{
"require": [
"$:/plugins/tiddlywiki/codemirror/addon/mode/simple.js",
"$:/plugins/tiddlywiki/codemirror/addon/mode/overlay.js",
"$:/plugins/tiddlywiki/codemirror/mode/gfm/gfm.js",
"$:/plugins/tiddlywiki/codemirror/addon/mode/eve-mode.js",
"$:/plugins/tiddlywiki/codemirror/addon/runmode/runmode.js",
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js",
"$:/plugins/tiddlywiki/codemirror/mode/css/css.js",
"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js",
"$:/plugins/tiddlywiki/codemirror/mode/meta.js",
"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js",
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js",
"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js"
],
"configuration": {
"matchBrackets": true,
"showCursorWhenSelecting": true
}
}
{
"tiddlers": {
"$:/Acknowledgements": {
"title": "$:/Acknowledgements",
"type": "text/vnd.tiddlywiki",
"text": "TiddlyWiki incorporates code from these fine OpenSource projects:\n\n* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]\n* [[The Jasmine JavaScript Test Framework|http://pivotal.github.io/jasmine/]]\n* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]\n\nAnd media from these projects:\n\n* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]]\n"
},
"$:/core/copyright.txt": {
"title": "$:/core/copyright.txt",
"type": "text/plain",
"text": "TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\n\nCopyright (c) 2004-2007, Jeremy Ruston\nCopyright (c) 2007-2017, UnaMesa Association\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
},
"$:/core/icon": {
"title": "$:/core/icon",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\"><path d=\"M64 0l54.56 32v64L64 128 9.44 96V32L64 0zm21.127 95.408c-3.578-.103-5.15-.094-6.974-3.152l-1.42.042c-1.653-.075-.964-.04-2.067-.097-1.844-.07-1.548-1.86-1.873-2.8-.52-3.202.687-6.43.65-9.632-.014-1.14-1.593-5.17-2.157-6.61-1.768.34-3.546.406-5.34.497-4.134-.01-8.24-.527-12.317-1.183-.8 3.35-3.16 8.036-1.21 11.44 2.37 3.52 4.03 4.495 6.61 4.707 2.572.212 3.16 3.18 2.53 4.242-.55.73-1.52.864-2.346 1.04l-1.65.08c-1.296-.046-2.455-.404-3.61-.955-1.93-1.097-3.925-3.383-5.406-5.024.345.658.55 1.938.24 2.53-.878 1.27-4.665 1.26-6.4.47-1.97-.89-6.73-7.162-7.468-11.86 1.96-3.78 4.812-7.07 6.255-11.186-3.146-2.05-4.83-5.384-4.61-9.16l.08-.44c-3.097.59-1.49.37-4.82.628-10.608-.032-19.935-7.37-14.68-18.774.34-.673.664-1.287 1.243-.994.466.237.4 1.18.166 2.227-3.005 13.627 11.67 13.732 20.69 11.21.89-.25 2.67-1.936 3.905-2.495 2.016-.91 4.205-1.282 6.376-1.55 5.4-.63 11.893 2.276 15.19 2.37 3.3.096 7.99-.805 10.87-.615 2.09.098 4.143.483 6.16 1.03 1.306-6.49 1.4-11.27 4.492-12.38 1.814.293 3.213 2.818 4.25 4.167 2.112-.086 4.12.46 6.115 1.066 3.61-.522 6.642-2.593 9.833-4.203-3.234 2.69-3.673 7.075-3.303 11.127.138 2.103-.444 4.386-1.164 6.54-1.348 3.507-3.95 7.204-6.97 7.014-1.14-.036-1.805-.695-2.653-1.4-.164 1.427-.81 2.7-1.434 3.96-1.44 2.797-5.203 4.03-8.687 7.016-3.484 2.985 1.114 13.65 2.23 15.594 1.114 1.94 4.226 2.652 3.02 4.406-.37.58-.936.785-1.54 1.01l-.82.11zm-40.097-8.85l.553.14c.694-.27 2.09.15 2.83.353-1.363-1.31-3.417-3.24-4.897-4.46-.485-1.47-.278-2.96-.174-4.46l.02-.123c-.582 1.205-1.322 2.376-1.72 3.645-.465 1.71 2.07 3.557 3.052 4.615l.336.3z\" fill-rule=\"evenodd\"/></svg>"
},
"$:/core/images/advanced-search-button": {
"title": "$:/core/images/advanced-search-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-advanced-search-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M74.5651535,87.9848361 C66.9581537,93.0488876 57.8237115,96 48,96 C21.490332,96 0,74.509668 0,48 C0,21.490332 21.490332,0 48,0 C74.509668,0 96,21.490332 96,48 C96,57.8541369 93.0305793,67.0147285 87.9377231,74.6357895 L122.284919,108.982985 C125.978897,112.676963 125.973757,118.65366 122.284271,122.343146 C118.593975,126.033442 112.613238,126.032921 108.92411,122.343793 L74.5651535,87.9848361 Z M48,80 C65.673112,80 80,65.673112 80,48 C80,30.326888 65.673112,16 48,16 C30.326888,16 16,30.326888 16,48 C16,65.673112 30.326888,80 48,80 Z\"></path>\n <circle cx=\"48\" cy=\"48\" r=\"8\"></circle>\n <circle cx=\"28\" cy=\"48\" r=\"8\"></circle>\n <circle cx=\"68\" cy=\"48\" r=\"8\"></circle>\n </g>\n</svg>"
},
"$:/core/images/auto-height": {
"title": "$:/core/images/auto-height",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-auto-height tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <path d=\"M67.9867828,114.356363 L67.9579626,99.8785426 C67.9550688,98.4248183 67.1636987,97.087107 65.8909901,96.3845863 L49.9251455,87.5716209 L47.992126,95.0735397 L79.8995411,95.0735397 C84.1215894,95.0735397 85.4638131,89.3810359 81.686497,87.4948823 L49.7971476,71.5713518 L48.0101917,79.1500092 L79.992126,79.1500092 C84.2093753,79.1500092 85.5558421,73.4676733 81.7869993,71.5753162 L49.805065,55.517008 L48.0101916,63.0917009 L79.9921259,63.0917015 C84.2035118,63.0917016 85.5551434,57.4217887 81.7966702,55.5218807 L65.7625147,47.4166161 L67.9579705,50.9864368 L67.9579705,35.6148245 L77.1715737,44.8284272 C78.7336709,46.3905243 81.2663308,46.3905243 82.8284279,44.8284271 C84.390525,43.2663299 84.390525,40.7336699 82.8284278,39.1715728 L66.8284271,23.1715728 C65.2663299,21.6094757 62.73367,21.6094757 61.1715729,23.1715729 L45.1715729,39.1715729 C43.6094757,40.73367 43.6094757,43.26633 45.1715729,44.8284271 C46.73367,46.3905243 49.26633,46.3905243 50.8284271,44.8284271 L59.9579705,35.6988837 L59.9579705,50.9864368 C59.9579705,52.495201 60.806922,53.8755997 62.1534263,54.5562576 L78.1875818,62.6615223 L79.9921261,55.0917015 L48.0101917,55.0917009 C43.7929424,55.0917008 42.4464755,60.7740368 46.2153183,62.6663939 L78.1972526,78.7247021 L79.992126,71.1500092 L48.0101917,71.1500092 C43.7881433,71.1500092 42.4459197,76.842513 46.2232358,78.7286665 L78.1125852,94.6521971 L79.8995411,87.0735397 L47.992126,87.0735397 C43.8588276,87.0735397 42.4404876,92.5780219 46.0591064,94.5754586 L62.024951,103.388424 L59.9579785,99.8944677 L59.9867142,114.32986 L50.8284271,105.171573 C49.26633,103.609476 46.73367,103.609476 45.1715729,105.171573 C43.6094757,106.73367 43.6094757,109.26633 45.1715729,110.828427 L61.1715729,126.828427 C62.73367,128.390524 65.2663299,128.390524 66.8284271,126.828427 L82.8284278,110.828427 C84.390525,109.26633 84.390525,106.73367 82.8284279,105.171573 C81.2663308,103.609476 78.7336709,103.609476 77.1715737,105.171573 L67.9867828,114.356363 L67.9867828,114.356363 Z M16,20 L112,20 C114.209139,20 116,18.209139 116,16 C116,13.790861 114.209139,12 112,12 L16,12 C13.790861,12 12,13.790861 12,16 C12,18.209139 13.790861,20 16,20 L16,20 Z\"></path>\n</svg>"
},
"$:/core/images/blank": {
"title": "$:/core/images/blank",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-blank tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\"></svg>"
},
"$:/core/images/bold": {
"title": "$:/core/images/bold",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-bold tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M41.1456583,51.8095238 L41.1456583,21.8711485 L67.4985994,21.8711485 C70.0084159,21.8711485 72.4285598,22.0802967 74.7591036,22.4985994 C77.0896475,22.9169022 79.1512515,23.6638602 80.9439776,24.7394958 C82.7367036,25.8151314 84.170863,27.3090474 85.2464986,29.2212885 C86.3221342,31.1335296 86.859944,33.5835518 86.859944,36.5714286 C86.859944,41.9496067 85.2465147,45.8337882 82.0196078,48.2240896 C78.792701,50.614391 74.6694929,51.8095238 69.6498599,51.8095238 L41.1456583,51.8095238 Z M13,0 L13,128 L75.0280112,128 C80.7647346,128 86.3519803,127.28292 91.789916,125.848739 C97.2278517,124.414559 102.068139,122.203563 106.310924,119.215686 C110.553709,116.22781 113.929959,112.373506 116.439776,107.652661 C118.949592,102.931816 120.204482,97.3445701 120.204482,90.8907563 C120.204482,82.8832466 118.262391,76.0411115 114.378151,70.3641457 C110.493911,64.6871798 104.607883,60.7133634 96.719888,58.442577 C102.456611,55.6937304 106.788968,52.1680887 109.717087,47.8655462 C112.645206,43.5630037 114.109244,38.1849062 114.109244,31.7310924 C114.109244,25.7553389 113.123259,20.7357813 111.151261,16.6722689 C109.179262,12.6087565 106.400578,9.35201972 102.815126,6.90196078 C99.2296739,4.45190185 94.927196,2.68908101 89.907563,1.61344538 C84.8879301,0.537809748 79.3305627,0 73.2352941,0 L13,0 Z M41.1456583,106.128852 L41.1456583,70.9915966 L71.8011204,70.9915966 C77.896389,70.9915966 82.7964334,72.3958776 86.5014006,75.2044818 C90.2063677,78.0130859 92.0588235,82.7039821 92.0588235,89.2773109 C92.0588235,92.6237329 91.4911355,95.3725383 90.3557423,97.5238095 C89.2203491,99.6750808 87.6965548,101.378145 85.7843137,102.633053 C83.8720726,103.887961 81.661077,104.784311 79.1512605,105.322129 C76.641444,105.859947 74.0121519,106.128852 71.2633053,106.128852 L41.1456583,106.128852 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/cancel-button": {
"title": "$:/core/images/cancel-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-cancel-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n\t<g fill-rule=\"evenodd\">\n\t <path d=\"M64,76.3137085 L47.0294734,93.2842351 C43.9038742,96.4098343 38.8399231,96.4084656 35.7157288,93.2842712 C32.5978915,90.166434 32.5915506,85.0947409 35.7157649,81.9705266 L52.6862915,65 L35.7157649,48.0294734 C32.5901657,44.9038742 32.5915344,39.8399231 35.7157288,36.7157288 C38.833566,33.5978915 43.9052591,33.5915506 47.0294734,36.7157649 L64,53.6862915 L80.9705266,36.7157649 C84.0961258,33.5901657 89.1600769,33.5915344 92.2842712,36.7157288 C95.4021085,39.833566 95.4084494,44.9052591 92.2842351,48.0294734 L75.3137085,65 L92.2842351,81.9705266 C95.4098343,85.0961258 95.4084656,90.1600769 92.2842712,93.2842712 C89.166434,96.4021085 84.0947409,96.4084494 80.9705266,93.2842351 L64,76.3137085 Z M64,129 C99.346224,129 128,100.346224 128,65 C128,29.653776 99.346224,1 64,1 C28.653776,1 1.13686838e-13,29.653776 1.13686838e-13,65 C1.13686838e-13,100.346224 28.653776,129 64,129 Z M64,113 C90.509668,113 112,91.509668 112,65 C112,38.490332 90.509668,17 64,17 C37.490332,17 16,38.490332 16,65 C16,91.509668 37.490332,113 64,113 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/chevron-down": {
"title": "$:/core/images/chevron-down",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-chevron-down tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n\t<g fill-rule=\"evenodd\" transform=\"translate(64.000000, 40.500000) rotate(-270.000000) translate(-64.000000, -40.500000) translate(-22.500000, -26.500000)\">\n <path d=\"M112.743107,112.12741 C111.310627,113.561013 109.331747,114.449239 107.145951,114.449239 L27.9777917,114.449239 C23.6126002,114.449239 20.0618714,110.904826 20.0618714,106.532572 C20.0618714,102.169214 23.6059497,98.6159054 27.9777917,98.6159054 L99.2285381,98.6159054 L99.2285381,27.365159 C99.2285381,22.9999675 102.77295,19.4492387 107.145205,19.4492387 C111.508562,19.4492387 115.061871,22.993317 115.061871,27.365159 L115.061871,106.533318 C115.061871,108.71579 114.175869,110.694669 112.743378,112.127981 Z\" transform=\"translate(67.561871, 66.949239) rotate(-45.000000) translate(-67.561871, -66.949239) \"></path>\n <path d=\"M151.35638,112.12741 C149.923899,113.561013 147.94502,114.449239 145.759224,114.449239 L66.5910645,114.449239 C62.225873,114.449239 58.6751442,110.904826 58.6751442,106.532572 C58.6751442,102.169214 62.2192225,98.6159054 66.5910645,98.6159054 L137.841811,98.6159054 L137.841811,27.365159 C137.841811,22.9999675 141.386223,19.4492387 145.758478,19.4492387 C150.121835,19.4492387 153.675144,22.993317 153.675144,27.365159 L153.675144,106.533318 C153.675144,108.71579 152.789142,110.694669 151.356651,112.127981 Z\" transform=\"translate(106.175144, 66.949239) rotate(-45.000000) translate(-106.175144, -66.949239) \"></path>\n\t</g>\n</svg>"
},
"$:/core/images/chevron-left": {
"title": "$:/core/images/chevron-left",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-chevron-left tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\" version=\"1.1\">\n <g fill-rule=\"evenodd\" transform=\"translate(92.500000, 64.000000) rotate(-180.000000) translate(-92.500000, -64.000000) translate(6.000000, -3.000000)\">\n <path d=\"M112.743107,112.12741 C111.310627,113.561013 109.331747,114.449239 107.145951,114.449239 L27.9777917,114.449239 C23.6126002,114.449239 20.0618714,110.904826 20.0618714,106.532572 C20.0618714,102.169214 23.6059497,98.6159054 27.9777917,98.6159054 L99.2285381,98.6159054 L99.2285381,27.365159 C99.2285381,22.9999675 102.77295,19.4492387 107.145205,19.4492387 C111.508562,19.4492387 115.061871,22.993317 115.061871,27.365159 L115.061871,106.533318 C115.061871,108.71579 114.175869,110.694669 112.743378,112.127981 Z\" transform=\"translate(67.561871, 66.949239) rotate(-45.000000) translate(-67.561871, -66.949239) \"></path>\n <path d=\"M151.35638,112.12741 C149.923899,113.561013 147.94502,114.449239 145.759224,114.449239 L66.5910645,114.449239 C62.225873,114.449239 58.6751442,110.904826 58.6751442,106.532572 C58.6751442,102.169214 62.2192225,98.6159054 66.5910645,98.6159054 L137.841811,98.6159054 L137.841811,27.365159 C137.841811,22.9999675 141.386223,19.4492387 145.758478,19.4492387 C150.121835,19.4492387 153.675144,22.993317 153.675144,27.365159 L153.675144,106.533318 C153.675144,108.71579 152.789142,110.694669 151.356651,112.127981 Z\" transform=\"translate(106.175144, 66.949239) rotate(-45.000000) translate(-106.175144, -66.949239) \"></path>\n </g>\n</svg>"
},
"$:/core/images/chevron-right": {
"title": "$:/core/images/chevron-right",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-chevron-right tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\" transform=\"translate(-48.000000, -3.000000)\">\n <path d=\"M112.743107,112.12741 C111.310627,113.561013 109.331747,114.449239 107.145951,114.449239 L27.9777917,114.449239 C23.6126002,114.449239 20.0618714,110.904826 20.0618714,106.532572 C20.0618714,102.169214 23.6059497,98.6159054 27.9777917,98.6159054 L99.2285381,98.6159054 L99.2285381,27.365159 C99.2285381,22.9999675 102.77295,19.4492387 107.145205,19.4492387 C111.508562,19.4492387 115.061871,22.993317 115.061871,27.365159 L115.061871,106.533318 C115.061871,108.71579 114.175869,110.694669 112.743378,112.127981 Z\" transform=\"translate(67.561871, 66.949239) rotate(-45.000000) translate(-67.561871, -66.949239) \"></path>\n <path d=\"M151.35638,112.12741 C149.923899,113.561013 147.94502,114.449239 145.759224,114.449239 L66.5910645,114.449239 C62.225873,114.449239 58.6751442,110.904826 58.6751442,106.532572 C58.6751442,102.169214 62.2192225,98.6159054 66.5910645,98.6159054 L137.841811,98.6159054 L137.841811,27.365159 C137.841811,22.9999675 141.386223,19.4492387 145.758478,19.4492387 C150.121835,19.4492387 153.675144,22.993317 153.675144,27.365159 L153.675144,106.533318 C153.675144,108.71579 152.789142,110.694669 151.356651,112.127981 Z\" transform=\"translate(106.175144, 66.949239) rotate(-45.000000) translate(-106.175144, -66.949239) \"></path>\n </g>\n</svg>"
},
"$:/core/images/chevron-up": {
"title": "$:/core/images/chevron-up",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-chevron-up tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n\t<g fill-rule=\"evenodd\" transform=\"translate(64.000000, 89.500000) rotate(-90.000000) translate(-64.000000, -89.500000) translate(-22.500000, 22.500000)\">\n <path d=\"M112.743107,112.12741 C111.310627,113.561013 109.331747,114.449239 107.145951,114.449239 L27.9777917,114.449239 C23.6126002,114.449239 20.0618714,110.904826 20.0618714,106.532572 C20.0618714,102.169214 23.6059497,98.6159054 27.9777917,98.6159054 L99.2285381,98.6159054 L99.2285381,27.365159 C99.2285381,22.9999675 102.77295,19.4492387 107.145205,19.4492387 C111.508562,19.4492387 115.061871,22.993317 115.061871,27.365159 L115.061871,106.533318 C115.061871,108.71579 114.175869,110.694669 112.743378,112.127981 Z\" transform=\"translate(67.561871, 66.949239) rotate(-45.000000) translate(-67.561871, -66.949239) \"></path>\n <path d=\"M151.35638,112.12741 C149.923899,113.561013 147.94502,114.449239 145.759224,114.449239 L66.5910645,114.449239 C62.225873,114.449239 58.6751442,110.904826 58.6751442,106.532572 C58.6751442,102.169214 62.2192225,98.6159054 66.5910645,98.6159054 L137.841811,98.6159054 L137.841811,27.365159 C137.841811,22.9999675 141.386223,19.4492387 145.758478,19.4492387 C150.121835,19.4492387 153.675144,22.993317 153.675144,27.365159 L153.675144,106.533318 C153.675144,108.71579 152.789142,110.694669 151.356651,112.127981 Z\" transform=\"translate(106.175144, 66.949239) rotate(-45.000000) translate(-106.175144, -66.949239) \"></path>\n\t</g>\n</svg>"
},
"$:/core/images/clone-button": {
"title": "$:/core/images/clone-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-clone-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M32.2650915,96 L32.2650915,120.002359 C32.2650915,124.419334 35.8432884,128 40.2627323,128 L120.002359,128 C124.419334,128 128,124.421803 128,120.002359 L128,40.2627323 C128,35.8457573 124.421803,32.2650915 120.002359,32.2650915 L96,32.2650915 L96,48 L108.858899,48 C110.519357,48 111.853018,49.3405131 111.853018,50.9941198 L111.853018,108.858899 C111.853018,110.519357 110.512505,111.853018 108.858899,111.853018 L50.9941198,111.853018 C49.333661,111.853018 48,110.512505 48,108.858899 L48,96 L32.2650915,96 Z\"></path>\n <path d=\"M40,56 L32.0070969,56 C27.5881712,56 24,52.418278 24,48 C24,43.5907123 27.5848994,40 32.0070969,40 L40,40 L40,32.0070969 C40,27.5881712 43.581722,24 48,24 C52.4092877,24 56,27.5848994 56,32.0070969 L56,40 L63.9929031,40 C68.4118288,40 72,43.581722 72,48 C72,52.4092877 68.4151006,56 63.9929031,56 L56,56 L56,63.9929031 C56,68.4118288 52.418278,72 48,72 C43.5907123,72 40,68.4151006 40,63.9929031 L40,56 Z M7.9992458,0 C3.58138434,0 0,3.5881049 0,7.9992458 L0,88.0007542 C0,92.4186157 3.5881049,96 7.9992458,96 L88.0007542,96 C92.4186157,96 96,92.4118951 96,88.0007542 L96,7.9992458 C96,3.58138434 92.4118951,0 88.0007542,0 L7.9992458,0 Z M19.0010118,16 C17.3435988,16 16,17.336731 16,19.0010118 L16,76.9989882 C16,78.6564012 17.336731,80 19.0010118,80 L76.9989882,80 C78.6564012,80 80,78.663269 80,76.9989882 L80,19.0010118 C80,17.3435988 78.663269,16 76.9989882,16 L19.0010118,16 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/close-all-button": {
"title": "$:/core/images/close-all-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-close-all-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\" transform=\"translate(-23.000000, -23.000000)\">\n <path d=\"M43,131 L22.9976794,131 C18.5827987,131 15,127.418278 15,123 C15,118.590712 18.5806831,115 22.9976794,115 L43,115 L43,94.9976794 C43,90.5827987 46.581722,87 51,87 C55.4092877,87 59,90.5806831 59,94.9976794 L59,115 L79.0023206,115 C83.4172013,115 87,118.581722 87,123 C87,127.409288 83.4193169,131 79.0023206,131 L59,131 L59,151.002321 C59,155.417201 55.418278,159 51,159 C46.5907123,159 43,155.419317 43,151.002321 L43,131 Z\" transform=\"translate(51.000000, 123.000000) rotate(-45.000000) translate(-51.000000, -123.000000) \"></path>\n <path d=\"M43,59 L22.9976794,59 C18.5827987,59 15,55.418278 15,51 C15,46.5907123 18.5806831,43 22.9976794,43 L43,43 L43,22.9976794 C43,18.5827987 46.581722,15 51,15 C55.4092877,15 59,18.5806831 59,22.9976794 L59,43 L79.0023206,43 C83.4172013,43 87,46.581722 87,51 C87,55.4092877 83.4193169,59 79.0023206,59 L59,59 L59,79.0023206 C59,83.4172013 55.418278,87 51,87 C46.5907123,87 43,83.4193169 43,79.0023206 L43,59 Z\" transform=\"translate(51.000000, 51.000000) rotate(-45.000000) translate(-51.000000, -51.000000) \"></path>\n <path d=\"M115,59 L94.9976794,59 C90.5827987,59 87,55.418278 87,51 C87,46.5907123 90.5806831,43 94.9976794,43 L115,43 L115,22.9976794 C115,18.5827987 118.581722,15 123,15 C127.409288,15 131,18.5806831 131,22.9976794 L131,43 L151.002321,43 C155.417201,43 159,46.581722 159,51 C159,55.4092877 155.419317,59 151.002321,59 L131,59 L131,79.0023206 C131,83.4172013 127.418278,87 123,87 C118.590712,87 115,83.4193169 115,79.0023206 L115,59 Z\" transform=\"translate(123.000000, 51.000000) rotate(-45.000000) translate(-123.000000, -51.000000) \"></path>\n <path d=\"M115,131 L94.9976794,131 C90.5827987,131 87,127.418278 87,123 C87,118.590712 90.5806831,115 94.9976794,115 L115,115 L115,94.9976794 C115,90.5827987 118.581722,87 123,87 C127.409288,87 131,90.5806831 131,94.9976794 L131,115 L151.002321,115 C155.417201,115 159,118.581722 159,123 C159,127.409288 155.419317,131 151.002321,131 L131,131 L131,151.002321 C131,155.417201 127.418278,159 123,159 C118.590712,159 115,155.419317 115,151.002321 L115,131 Z\" transform=\"translate(123.000000, 123.000000) rotate(-45.000000) translate(-123.000000, -123.000000) \"></path>\n </g>\n</svg>"
},
"$:/core/images/close-button": {
"title": "$:/core/images/close-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-close-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M65.0864256,75.4091629 L14.9727349,125.522854 C11.8515951,128.643993 6.78104858,128.64922 3.65685425,125.525026 C0.539017023,122.407189 0.5336324,117.334539 3.65902635,114.209145 L53.7727171,64.0954544 L3.65902635,13.9817637 C0.537886594,10.8606239 0.532659916,5.79007744 3.65685425,2.6658831 C6.77469148,-0.451954124 11.8473409,-0.457338747 14.9727349,2.66805521 L65.0864256,52.7817459 L115.200116,2.66805521 C118.321256,-0.453084553 123.391803,-0.458311231 126.515997,2.6658831 C129.633834,5.78372033 129.639219,10.8563698 126.513825,13.9817637 L76.4001341,64.0954544 L126.513825,114.209145 C129.634965,117.330285 129.640191,122.400831 126.515997,125.525026 C123.39816,128.642863 118.32551,128.648248 115.200116,125.522854 L65.0864256,75.4091629 L65.0864256,75.4091629 Z\"></path>\n </g>\n</svg>\n"
},
"$:/core/images/close-others-button": {
"title": "$:/core/images/close-others-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-close-others-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M64,128 C99.346224,128 128,99.346224 128,64 C128,28.653776 99.346224,0 64,0 C28.653776,0 0,28.653776 0,64 C0,99.346224 28.653776,128 64,128 Z M64,112 C90.509668,112 112,90.509668 112,64 C112,37.490332 90.509668,16 64,16 C37.490332,16 16,37.490332 16,64 C16,90.509668 37.490332,112 64,112 Z M64,96 C81.673112,96 96,81.673112 96,64 C96,46.326888 81.673112,32 64,32 C46.326888,32 32,46.326888 32,64 C32,81.673112 46.326888,96 64,96 Z M64,80 C72.836556,80 80,72.836556 80,64 C80,55.163444 72.836556,48 64,48 C55.163444,48 48,55.163444 48,64 C48,72.836556 55.163444,80 64,80 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/copy-clipboard": {
"title": "$:/core/images/copy-clipboard",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-copy-clipboard tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n\t<g fill-rule=\"evenodd\">\n\t\t<rect x=\"40\" y=\"40\" width=\"33\" height=\"8\" rx=\"4\"></rect>\n\t\t<rect x=\"40\" y=\"82\" width=\"17\" height=\"8\" rx=\"4\"></rect>\n\t\t<rect x=\"40\" y=\"54\" width=\"17\" height=\"8\" rx=\"4\"></rect>\n\t\t<rect x=\"40\" y=\"96\" width=\"33\" height=\"8\" rx=\"4\"></rect>\n\t\t<rect x=\"40\" y=\"68\" width=\"12\" height=\"8\" rx=\"4\"></rect>\n\t\t<path d=\"M40,16 L23.9992458,16 C19.5813843,16 16,19.5907123 16,24 C16,24.0016363 16.0000005,24.0032725 16.0000015,24.0049086 C16.0000005,24.0065441 16,24.0081803 16,24.0098166 L16,119.990183 C16,119.99182 16.0000005,119.993456 16.0000015,119.995092 C16.0000005,119.996727 16,119.998364 16,120 C16,124.409288 19.5813843,128 23.9992458,128 L104.000754,128 C106.205061,128 108.203844,127.105595 109.652065,125.659342 C111.102424,124.21251 112,122.214511 112,120.007595 L112,103.992405 C112,99.5776607 108.418278,96 104,96 C99.5907123,96 96,99.5783218 96,103.992405 L96,112 L32,112 L32,32 L96,32 L96,40.0075946 C96,44.4223393 99.581722,48 104,48 C108.409288,48 112,44.4216782 112,40.0075946 L112,23.9924054 C112,21.7851587 111.104671,19.7871591 109.657101,18.3409203 C108.203844,16.8944047 106.205061,16 104.000754,16 L88,16 C88,11.5907123 84.4151006,8 79.9929031,8 L48.0070969,8 C43.5881712,8 40,11.581722 40,16 Z M44,14.9958262 C44,12.7889923 45.7964248,11 48.0000255,11 L79.9999745,11 C82.2091276,11 84,12.7965212 84,14.9958262 L84,19.0041738 C84,21.2110077 82.2035752,23 79.9999745,23 L48.0000255,23 C45.7908724,23 44,21.2034788 44,19.0041738 L44,14.9958262 Z\"></path>\n\t\t<rect x=\"62\" y=\"64\" width=\"66\" height=\"16\" rx=\"8\"></rect>\n\t\t<path d=\"M60.6568542,85.6568542 L76.6568542,69.6568543 L65.3431458,69.6568542 L81.3431458,85.6568542 C84.4673401,88.7810486 89.5326599,88.7810486 92.6568542,85.6568542 C95.7810486,82.5326599 95.7810486,77.4673401 92.6568542,74.3431458 L76.6568542,58.3431458 C73.5326599,55.2189514 68.4673401,55.2189514 65.3431458,58.3431457 L49.3431458,74.3431457 C46.2189514,77.4673401 46.2189514,82.5326599 49.3431457,85.6568542 C52.4673401,88.7810486 57.5326599,88.7810486 60.6568542,85.6568542 L60.6568542,85.6568542 Z\" transform=\"translate(71.000000, 72.000000) rotate(-90.000000) translate(-71.000000, -72.000000) \"></path>\n\t</g>\n</svg>"
},
"$:/core/images/delete-button": {
"title": "$:/core/images/delete-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-delete-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\" transform=\"translate(12.000000, 0.000000)\">\n <rect x=\"0\" y=\"11\" width=\"105\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"28\" y=\"0\" width=\"48\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"8\" y=\"16\" width=\"16\" height=\"112\" rx=\"8\"></rect>\n <rect x=\"8\" y=\"112\" width=\"88\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"80\" y=\"16\" width=\"16\" height=\"112\" rx=\"8\"></rect>\n <rect x=\"56\" y=\"16\" width=\"16\" height=\"112\" rx=\"8\"></rect>\n <rect x=\"32\" y=\"16\" width=\"16\" height=\"112\" rx=\"8\"></rect>\n </g>\n</svg>"
},
"$:/core/images/done-button": {
"title": "$:/core/images/done-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-done-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M3.52445141,76.8322939 C2.07397484,75.3828178 1.17514421,73.3795385 1.17514421,71.1666288 L1.17514421,23.1836596 C1.17514421,18.7531992 4.75686621,15.1751442 9.17514421,15.1751442 C13.5844319,15.1751442 17.1751442,18.7606787 17.1751442,23.1836596 L17.1751442,63.1751442 L119.173716,63.1751442 C123.590457,63.1751442 127.175144,66.7568662 127.175144,71.1751442 C127.175144,75.5844319 123.592783,79.1751442 119.173716,79.1751442 L9.17657227,79.1751442 C6.96796403,79.1751442 4.9674142,78.279521 3.51911285,76.8315312 Z\" id=\"Rectangle-285\" transform=\"translate(64.175144, 47.175144) rotate(-45.000000) translate(-64.175144, -47.175144) \"></path>\n </g>\n</svg>"
},
"$:/core/images/down-arrow": {
"title": "$:/core/images/down-arrow",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-down-arrow tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <path d=\"M109.35638,81.3533152 C107.923899,82.7869182 105.94502,83.6751442 103.759224,83.6751442 L24.5910645,83.6751442 C20.225873,83.6751442 16.6751442,80.1307318 16.6751442,75.7584775 C16.6751442,71.3951199 20.2192225,67.8418109 24.5910645,67.8418109 L95.8418109,67.8418109 L95.8418109,-3.40893546 C95.8418109,-7.77412698 99.3862233,-11.3248558 103.758478,-11.3248558 C108.121835,-11.3248558 111.675144,-7.78077754 111.675144,-3.40893546 L111.675144,75.7592239 C111.675144,77.9416955 110.789142,79.9205745 109.356651,81.3538862 Z\" transform=\"translate(64.175144, 36.175144) rotate(45.000000) translate(-64.175144, -36.175144) \"></path>\n</svg>"
},
"$:/core/images/download-button": {
"title": "$:/core/images/download-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-download-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path class=\"tc-image-download-button-ring\" d=\"M64,128 C99.346224,128 128,99.346224 128,64 C128,28.653776 99.346224,0 64,0 C28.653776,0 0,28.653776 0,64 C0,99.346224 28.653776,128 64,128 Z M64,112 C90.509668,112 112,90.509668 112,64 C112,37.490332 90.509668,16 64,16 C37.490332,16 16,37.490332 16,64 C16,90.509668 37.490332,112 64,112 Z\"/><path d=\"M34.3496823,66.4308767 L61.2415823,93.634668 C63.0411536,95.4551107 65.9588502,95.4551107 67.7584215,93.634668 L94.6503215,66.4308767 C96.4498928,64.610434 96.4498928,61.6588981 94.6503215,59.8384554 C93.7861334,58.9642445 92.6140473,58.4731195 91.3919019,58.4731195 L82.9324098,58.4731195 C80.3874318,58.4731195 78.3243078,56.3860674 78.3243078,53.8115729 L78.3243078,38.6615466 C78.3243078,36.0870521 76.2611837,34 73.7162058,34 L55.283798,34 C52.7388201,34 50.675696,36.0870521 50.675696,38.6615466 L50.675696,38.6615466 L50.675696,53.8115729 C50.675696,56.3860674 48.612572,58.4731195 46.0675941,58.4731195 L37.608102,58.4731195 C35.063124,58.4731195 33,60.5601716 33,63.134666 C33,64.3709859 33.4854943,65.5566658 34.3496823,66.4308767 L34.3496823,66.4308767 Z\"/></g></svg>"
},
"$:/core/images/edit-button": {
"title": "$:/core/images/edit-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-edit-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M116.870058,45.3431458 L108.870058,45.3431458 L108.870058,45.3431458 L108.870058,61.3431458 L116.870058,61.3431458 L116.870058,45.3431458 Z M124.870058,45.3431458 L127.649881,45.3431458 C132.066101,45.3431458 135.656854,48.9248678 135.656854,53.3431458 C135.656854,57.7524334 132.07201,61.3431458 127.649881,61.3431458 L124.870058,61.3431458 L124.870058,45.3431458 Z M100.870058,45.3431458 L15.6638275,45.3431458 C15.5064377,45.3431458 15.3501085,45.3476943 15.1949638,45.3566664 L15.1949638,45.3566664 C15.0628002,45.3477039 14.928279,45.3431458 14.7913977,45.3431458 C6.68160973,45.3431458 -8.34314575,53.3431458 -8.34314575,53.3431458 C-8.34314575,53.3431458 6.85614548,61.3431458 14.7913977,61.3431458 C14.9266533,61.3431458 15.0596543,61.3384973 15.190398,61.3293588 C15.3470529,61.3385075 15.5049057,61.3431458 15.6638275,61.3431458 L100.870058,61.3431458 L100.870058,45.3431458 L100.870058,45.3431458 Z\" transform=\"translate(63.656854, 53.343146) rotate(-45.000000) translate(-63.656854, -53.343146) \"></path>\n <path d=\"M35.1714596,124.189544 C41.9594858,123.613403 49.068777,121.917633 58.85987,118.842282 C60.6854386,118.268877 62.4306907,117.705515 65.1957709,116.802278 C81.1962861,111.575575 87.0734839,109.994907 93.9414474,109.655721 C102.29855,109.242993 107.795169,111.785371 111.520478,118.355045 C112.610163,120.276732 115.051363,120.951203 116.97305,119.861518 C118.894737,118.771832 119.569207,116.330633 118.479522,114.408946 C113.146151,105.003414 104.734907,101.112919 93.5468356,101.66546 C85.6716631,102.054388 79.4899908,103.716944 62.7116783,109.197722 C59.9734132,110.092199 58.2519873,110.64787 56.4625698,111.20992 C37.002649,117.322218 25.6914684,118.282267 16.8654804,112.957098 C14.9739614,111.815848 12.5154166,112.424061 11.3741667,114.31558 C10.2329168,116.207099 10.84113,118.665644 12.7326489,119.806894 C19.0655164,123.627836 26.4866335,124.926678 35.1714596,124.189544 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/erase": {
"title": "$:/core/images/erase",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-erase tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M60.0870401,127.996166 L123.102318,64.980888 C129.636723,58.4464827 129.629513,47.8655877 123.098967,41.3350425 L99.4657866,17.7018617 C92.927448,11.1635231 82.3486358,11.1698163 75.8199411,17.698511 L4.89768189,88.6207702 C-1.63672343,95.1551755 -1.6295126,105.736071 4.90103262,112.266616 L20.6305829,127.996166 L60.0870401,127.996166 Z M25.1375576,120.682546 L10.812569,106.357558 C7.5455063,103.090495 7.54523836,97.793808 10.8048093,94.5342371 L46.2691086,59.0699377 L81.7308914,94.5317205 L55.5800654,120.682546 L25.1375576,120.682546 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/excise": {
"title": "$:/core/images/excise",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-excise tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M56,107.313709 L53.6568542,109.656854 C50.5326599,112.781049 45.4673401,112.781049 42.3431457,109.656854 C39.2189514,106.53266 39.2189514,101.46734 42.3431458,98.3431457 L58.3431458,82.3431457 C61.4673401,79.2189514 66.5326599,79.2189514 69.6568542,82.3431458 L85.6568542,98.3431458 C88.7810486,101.46734 88.7810486,106.53266 85.6568542,109.656854 C82.5326599,112.781049 77.4673401,112.781049 74.3431458,109.656854 L72,107.313708 L72,121.597798 C72,125.133636 68.418278,128 64,128 C59.581722,128 56,125.133636 56,121.597798 L56,107.313709 Z M0,40.0070969 C0,35.5848994 3.59071231,32 8,32 C12.418278,32 16,35.5881712 16,40.0070969 L16,71.9929031 C16,76.4151006 12.4092877,80 8,80 C3.581722,80 0,76.4118288 0,71.9929031 L0,40.0070969 Z M32,40.0070969 C32,35.5848994 35.5907123,32 40,32 C44.418278,32 48,35.5881712 48,40.0070969 L48,71.9929031 C48,76.4151006 44.4092877,80 40,80 C35.581722,80 32,76.4118288 32,71.9929031 L32,40.0070969 Z M80,40.0070969 C80,35.5848994 83.5907123,32 88,32 C92.418278,32 96,35.5881712 96,40.0070969 L96,71.9929031 C96,76.4151006 92.4092877,80 88,80 C83.581722,80 80,76.4118288 80,71.9929031 L80,40.0070969 Z M56,8.00709688 C56,3.58489938 59.5907123,0 64,0 C68.418278,0 72,3.58817117 72,8.00709688 L72,39.9929031 C72,44.4151006 68.4092877,48 64,48 C59.581722,48 56,44.4118288 56,39.9929031 L56,8.00709688 Z M112,40.0070969 C112,35.5848994 115.590712,32 120,32 C124.418278,32 128,35.5881712 128,40.0070969 L128,71.9929031 C128,76.4151006 124.409288,80 120,80 C115.581722,80 112,76.4118288 112,71.9929031 L112,40.0070969 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/export-button": {
"title": "$:/core/images/export-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-export-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M8.00348646,127.999999 C8.00464867,128 8.00581094,128 8.00697327,128 L119.993027,128 C122.205254,128 124.207939,127.101378 125.657096,125.651198 L125.656838,125.65759 C127.104563,124.210109 128,122.21009 128,119.999949 L128,56.0000511 C128,51.5817449 124.409288,48 120,48 C115.581722,48 112,51.5797863 112,56.0000511 L112,112 L16,112 L16,56.0000511 C16,51.5817449 12.4092877,48 8,48 C3.581722,48 7.10542736e-15,51.5797863 7.10542736e-15,56.0000511 L7.10542736e-15,119.999949 C7.10542736e-15,124.418255 3.59071231,128 8,128 C8.00116233,128 8.0023246,128 8.00348681,127.999999 Z M56.6235633,27.3113724 L47.6580188,36.2769169 C44.5333664,39.4015692 39.4634864,39.4061295 36.339292,36.2819351 C33.2214548,33.1640979 33.2173444,28.0901742 36.3443103,24.9632084 L58.9616908,2.34582788 C60.5248533,0.782665335 62.5748436,0.000361191261 64.624516,2.38225238e-14 L64.6193616,0.00151809229 C66.6695374,0.000796251595 68.7211167,0.781508799 70.2854358,2.34582788 L92.9028163,24.9632084 C96.0274686,28.0878607 96.0320289,33.1577408 92.9078345,36.2819351 C89.7899973,39.3997724 84.7160736,39.4038827 81.5891078,36.2769169 L72.6235633,27.3113724 L72.6235633,88.5669606 C72.6235633,92.9781015 69.0418413,96.5662064 64.6235633,96.5662064 C60.2142756,96.5662064 56.6235633,92.984822 56.6235633,88.5669606 L56.6235633,27.3113724 L56.6235633,27.3113724 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/file": {
"title": "$:/core/images/file",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-file tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"nonzero\">\n <path d=\"M111.96811,30.5 L112,30.5 L112,119.999079 C112,124.417866 108.419113,128 104.000754,128 L23.9992458,128 C19.5813843,128 16,124.417687 16,119.999079 L16,8.00092105 C16,3.58213437 19.5808867,0 23.9992458,0 L81,0 L81,0.0201838424 C83.1589869,-0.071534047 85.3482153,0.707077645 86.9982489,2.35711116 L109.625176,24.9840387 C111.151676,26.510538 111.932942,28.4998414 111.96811,30.5 L111.96811,30.5 Z M81,8 L24,8 L24,120 L104,120 L104,30.5 L89.0003461,30.5 C84.5818769,30.5 81,26.9216269 81,22.4996539 L81,8 Z\"></path>\n <rect x=\"32\" y=\"36\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"52\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"68\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"84\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"100\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"20\" width=\"40\" height=\"8\" rx=\"4\"></rect>\n </g>\n</svg>"
},
"$:/core/images/fixed-height": {
"title": "$:/core/images/fixed-height",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-fixed-height tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M60,35.6568542 L50.8284271,44.8284271 C49.26633,46.3905243 46.73367,46.3905243 45.1715729,44.8284271 C43.6094757,43.26633 43.6094757,40.73367 45.1715729,39.1715729 L61.1715729,23.1715729 C62.73367,21.6094757 65.2663299,21.6094757 66.8284271,23.1715728 L82.8284278,39.1715728 C84.390525,40.7336699 84.390525,43.2663299 82.8284279,44.8284271 C81.2663308,46.3905243 78.7336709,46.3905243 77.1715737,44.8284272 L68,35.6568539 L68,93.3431461 L77.1715737,84.1715728 C78.7336709,82.6094757 81.2663308,82.6094757 82.8284279,84.1715729 C84.390525,85.7336701 84.390525,88.2663301 82.8284278,89.8284272 L66.8284271,105.828427 C65.2663299,107.390524 62.73367,107.390524 61.1715729,105.828427 L45.1715729,89.8284271 C43.6094757,88.26633 43.6094757,85.73367 45.1715729,84.1715729 C46.73367,82.6094757 49.26633,82.6094757 50.8284271,84.1715729 L60,93.3431458 L60,35.6568542 L60,35.6568542 Z M16,116 L112,116 C114.209139,116 116,114.209139 116,112 C116,109.790861 114.209139,108 112,108 L16,108 C13.790861,108 12,109.790861 12,112 C12,114.209139 13.790861,116 16,116 L16,116 Z M16,20 L112,20 C114.209139,20 116,18.209139 116,16 C116,13.790861 114.209139,12 112,12 L16,12 C13.790861,12 12,13.790861 12,16 C12,18.209139 13.790861,20 16,20 L16,20 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/fold-all-button": {
"title": "$:/core/images/fold-all-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-fold-all tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"0\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"0\" y=\"64\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <path d=\"M64.0292774,58.6235628 C61.9791013,58.6242848 59.9275217,57.8435723 58.3632024,56.279253 L35.7458219,33.6618725 C32.6211696,30.5372202 32.6166093,25.4673401 35.7408036,22.3431458 C38.8586409,19.2253085 43.9325646,19.2211982 47.0595304,22.348164 L64.0250749,39.3137085 L80.9906194,22.348164 C84.1152717,19.2235117 89.1851518,19.2189514 92.3093461,22.3431458 C95.4271834,25.460983 95.4312937,30.5349067 92.3043279,33.6618725 L69.6869474,56.279253 C68.1237851,57.8424153 66.0737951,58.6247195 64.0241231,58.6250809 Z\" transform=\"translate(64.024316, 39.313708) scale(1, -1) translate(-64.024316, -39.313708) \"></path>\n <path d=\"M64.0292774,123.621227 C61.9791013,123.621949 59.9275217,122.841236 58.3632024,121.276917 L35.7458219,98.6595365 C32.6211696,95.5348842 32.6166093,90.4650041 35.7408036,87.3408098 C38.8586409,84.2229725 43.9325646,84.2188622 47.0595304,87.345828 L64.0250749,104.311373 L80.9906194,87.345828 C84.1152717,84.2211757 89.1851518,84.2166154 92.3093461,87.3408098 C95.4271834,90.458647 95.4312937,95.5325707 92.3043279,98.6595365 L69.6869474,121.276917 C68.1237851,122.840079 66.0737951,123.622383 64.0241231,123.622745 Z\" transform=\"translate(64.024316, 104.311372) scale(1, -1) translate(-64.024316, -104.311372) \"></path>\n </g>\n</svg>"
},
"$:/core/images/fold-button": {
"title": "$:/core/images/fold-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-fold tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"0\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <path d=\"M64.0292774,63.6235628 C61.9791013,63.6242848 59.9275217,62.8435723 58.3632024,61.279253 L35.7458219,38.6618725 C32.6211696,35.5372202 32.6166093,30.4673401 35.7408036,27.3431458 C38.8586409,24.2253085 43.9325646,24.2211982 47.0595304,27.348164 L64.0250749,44.3137085 L80.9906194,27.348164 C84.1152717,24.2235117 89.1851518,24.2189514 92.3093461,27.3431458 C95.4271834,30.460983 95.4312937,35.5349067 92.3043279,38.6618725 L69.6869474,61.279253 C68.1237851,62.8424153 66.0737951,63.6247195 64.0241231,63.6250809 Z\" transform=\"translate(64.024316, 44.313708) scale(1, -1) translate(-64.024316, -44.313708) \"></path>\n <path d=\"M64.0049614,105.998482 C61.9547853,105.999204 59.9032057,105.218491 58.3388864,103.654172 L35.7215059,81.0367916 C32.5968535,77.9121393 32.5922933,72.8422592 35.7164876,69.7180649 C38.8343248,66.6002276 43.9082485,66.5961173 47.0352144,69.7230831 L64.0007589,86.6886276 L80.9663034,69.7230831 C84.0909557,66.5984308 89.1608358,66.5938705 92.2850301,69.7180649 C95.4028673,72.8359021 95.4069777,77.9098258 92.2800119,81.0367916 L69.6626314,103.654172 C68.099469,105.217334 66.0494791,105.999639 63.999807,106 Z\" transform=\"translate(64.000000, 86.688628) scale(1, -1) translate(-64.000000, -86.688628) \"></path>\n </g>\n</svg>"
},
"$:/core/images/fold-others-button": {
"title": "$:/core/images/fold-others-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-fold-others tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"56.0314331\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <path d=\"M101.657101,104.948818 C100.207918,103.498614 98.2051847,102.599976 95.9929031,102.599976 L72,102.599976 L72,78.6070725 C72,76.3964271 71.1036108,74.3936927 69.6545293,72.9441002 L69.6571005,72.9488183 C68.2079177,71.4986143 66.2051847,70.5999756 63.9929031,70.5999756 L32.0070969,70.5999756 C27.5881712,70.5999756 24,74.1816976 24,78.5999756 C24,83.0092633 27.5848994,86.5999756 32.0070969,86.5999756 L56,86.5999756 L56,110.592879 C56,112.803524 56.8963895,114.806259 58.3454713,116.255852 L58.3429,116.251133 C59.7920828,117.701337 61.7948156,118.599976 64.0070969,118.599976 L88,118.599976 L88,142.592879 C88,147.011804 91.581722,150.599976 96,150.599976 C100.409288,150.599976 104,147.015076 104,142.592879 L104,110.607072 C104,108.396427 103.103611,106.393693 101.654529,104.9441 Z\" transform=\"translate(64.000000, 110.599976) rotate(-45.000000) translate(-64.000000, -110.599976) \"></path>\n <path d=\"M101.725643,11.7488671 C100.27646,10.2986632 98.2737272,9.40002441 96.0614456,9.40002441 L72.0685425,9.40002441 L72.0685425,-14.5928787 C72.0685425,-16.8035241 71.1721533,-18.8062584 69.7230718,-20.255851 L69.725643,-20.2511329 C68.2764602,-21.7013368 66.2737272,-22.5999756 64.0614456,-22.5999756 L32.0756394,-22.5999756 C27.6567137,-22.5999756 24.0685425,-19.0182536 24.0685425,-14.5999756 C24.0685425,-10.1906879 27.6534419,-6.59997559 32.0756394,-6.59997559 L56.0685425,-6.59997559 L56.0685425,17.3929275 C56.0685425,19.6035732 56.964932,21.6063078 58.4140138,23.0559004 L58.4114425,23.0511823 C59.8606253,24.5013859 61.8633581,25.4000244 64.0756394,25.4000244 L88.0685425,25.4000244 L88.0685425,49.3929275 C88.0685425,53.8118532 91.6502645,57.4000244 96.0685425,57.4000244 C100.47783,57.4000244 104.068542,53.815125 104.068542,49.3929275 L104.068542,17.4071213 C104.068542,15.1964759 103.172153,13.1937416 101.723072,11.744149 Z\" transform=\"translate(64.068542, 17.400024) scale(1, -1) rotate(-45.000000) translate(-64.068542, -17.400024) \"></path>\n </g>\n</svg>"
},
"$:/core/images/folder": {
"title": "$:/core/images/folder",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-folder tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M55.6943257,128.000004 L7.99859666,128.000004 C3.5810937,128.000004 0,124.413822 0,119.996384 L0,48.0036243 C0,43.5833471 3.58387508,40.0000044 7.99859666,40.0000044 L16,40.0000044 L16,31.9999914 C16,27.5817181 19.5783731,24 24.0003461,24 L55.9996539,24 C60.4181231,24 64,27.5800761 64,31.9999914 L64,40.0000044 L104.001403,40.0000044 C108.418906,40.0000044 112,43.5861868 112,48.0036243 L112,59.8298353 L104,59.7475921 L104,51.9994189 C104,49.7887607 102.207895,48.0000044 99.9972215,48.0000044 L56,48.0000044 L56,36.0000255 C56,33.7898932 54.2072328,32 51.9957423,32 L28.0042577,32 C25.7890275,32 24,33.7908724 24,36.0000255 L24,48.0000044 L12.0027785,48.0000044 C9.78987688,48.0000044 8,49.7906032 8,51.9994189 L8,116.00059 C8,118.211248 9.79210499,120.000004 12.0027785,120.000004 L58.7630167,120.000004 L55.6943257,128.000004 L55.6943257,128.000004 Z\"></path>\n <path d=\"M23.8728955,55.5 L119.875702,55.5 C124.293205,55.5 126.87957,59.5532655 125.650111,64.5630007 L112.305967,118.936999 C111.077582,123.942356 106.497904,128 102.083183,128 L6.08037597,128 C1.66287302,128 -0.923492342,123.946735 0.305967145,118.936999 L13.650111,64.5630007 C14.878496,59.5576436 19.4581739,55.5 23.8728955,55.5 L23.8728955,55.5 L23.8728955,55.5 Z M25.6530124,64 L113.647455,64 C115.858129,64 117.151473,66.0930612 116.538306,68.6662267 L105.417772,115.333773 C104.803671,117.910859 102.515967,120 100.303066,120 L12.3086228,120 C10.0979492,120 8.8046054,117.906939 9.41777189,115.333773 L20.5383062,68.6662267 C21.1524069,66.0891409 23.4401107,64 25.6530124,64 L25.6530124,64 L25.6530124,64 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/full-screen-button": {
"title": "$:/core/images/full-screen-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-full-screen-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g>\n <g>\n <path d=\"M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z\"></path>\n </g>\n <g transform=\"translate(104.000000, 104.000000) rotate(-180.000000) translate(-104.000000, -104.000000) translate(80.000000, 80.000000)\">\n <path d=\"M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z\"></path>\n </g>\n <g transform=\"translate(24.000000, 104.000000) rotate(-90.000000) translate(-24.000000, -104.000000) translate(0.000000, 80.000000)\">\n <path d=\"M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z\"></path>\n </g>\n <g transform=\"translate(104.000000, 24.000000) rotate(90.000000) translate(-104.000000, -24.000000) translate(80.000000, 0.000000)\">\n <path d=\"M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z\"></path>\n </g>\n </g>\n</svg>"
},
"$:/core/images/github": {
"title": "$:/core/images/github",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-github tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M63.9383506,1.60695328 C28.6017227,1.60695328 -0.055756057,30.2970814 -0.055756057,65.6906208 C-0.055756057,94.003092 18.2804728,118.019715 43.7123154,126.493393 C46.9143781,127.083482 48.0812647,125.104717 48.0812647,123.405261 C48.0812647,121.886765 48.02626,117.85449 47.9948287,112.508284 C30.1929317,116.379268 26.4368926,103.916587 26.4368926,103.916587 C23.5255693,96.5129372 19.3294921,94.5420399 19.3294921,94.5420399 C13.5186324,90.5687739 19.7695302,90.6474524 19.7695302,90.6474524 C26.1933001,91.099854 29.5721638,97.2525155 29.5721638,97.2525155 C35.2808718,107.044059 44.5531024,104.215566 48.1991321,102.575118 C48.7806109,98.4366275 50.4346826,95.612068 52.2616263,94.0109598 C38.0507543,92.3941159 23.1091047,86.8944862 23.1091047,62.3389152 C23.1091047,55.3443933 25.6039634,49.6205298 29.6978889,45.1437211 C29.0378318,43.5229433 26.8415704,37.0044266 30.3265147,28.1845627 C30.3265147,28.1845627 35.6973364,26.4615028 47.9241083,34.7542205 C53.027764,33.330139 58.5046663,32.6220321 63.9462084,32.5944947 C69.3838216,32.6220321 74.856795,33.330139 79.9683085,34.7542205 C92.1872225,26.4615028 97.5501864,28.1845627 97.5501864,28.1845627 C101.042989,37.0044266 98.8467271,43.5229433 98.190599,45.1437211 C102.292382,49.6205298 104.767596,55.3443933 104.767596,62.3389152 C104.767596,86.9574291 89.8023734,92.3744463 75.5482834,93.9598188 C77.8427675,95.9385839 79.8897303,99.8489072 79.8897303,105.828476 C79.8897303,114.392635 79.8111521,121.304544 79.8111521,123.405261 C79.8111521,125.120453 80.966252,127.114954 84.2115327,126.489459 C109.623731,117.996111 127.944244,93.9952241 127.944244,65.6906208 C127.944244,30.2970814 99.2867652,1.60695328 63.9383506,1.60695328\"></path>\n </g>\n </svg>\n"
},
"$:/core/images/globe": {
"title": "$:/core/images/globe",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-globe tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M72.8111354,37.1275855 C72.8111354,37.9789875 72.8111354,38.8303894 72.8111354,39.6817913 C72.8111354,41.8784743 73.7885604,46.5631866 72.8111354,48.5143758 C71.3445471,51.4420595 68.1617327,52.0543531 66.4170946,54.3812641 C65.2352215,55.9575873 61.7987417,64.9821523 62.7262858,67.3005778 C66.6959269,77.2228204 74.26087,70.4881886 80.6887657,76.594328 C81.5527211,77.415037 83.5758191,78.8666631 83.985137,79.8899578 C87.2742852,88.1128283 76.4086873,94.8989524 87.7419325,106.189751 C88.9872885,107.430443 91.555495,102.372895 91.8205061,101.575869 C92.6726866,99.0129203 98.5458765,96.1267309 100.908882,94.5234439 C102.928056,93.1534443 105.782168,91.8557166 107.236936,89.7775886 C109.507391,86.5342557 108.717505,82.2640435 110.334606,79.0328716 C112.473794,74.7585014 114.163418,69.3979002 116.332726,65.0674086 C120.230862,57.2857361 121.054075,67.1596684 121.400359,67.5059523 C121.757734,67.8633269 122.411167,67.5059523 122.916571,67.5059523 C123.011132,67.5059523 124.364019,67.6048489 124.432783,67.5059523 C125.0832,66.5705216 123.390209,49.5852316 123.114531,48.2089091 C121.710578,41.1996597 116.17083,32.4278331 111.249523,27.7092761 C104.975994,21.6942076 104.160516,11.5121686 92.9912146,12.7547535 C92.7872931,12.7774397 87.906794,22.9027026 85.2136766,26.2672064 C81.486311,30.9237934 82.7434931,22.1144904 78.6876623,22.1144904 C78.6065806,22.1144904 77.5045497,22.0107615 77.4353971,22.1144904 C76.8488637,22.9942905 75.9952305,26.0101404 75.1288269,26.5311533 C74.8635477,26.6906793 73.4071369,26.2924966 73.2826811,26.5311533 C71.0401728,30.8313939 81.5394677,28.7427264 79.075427,34.482926 C76.7225098,39.9642538 72.747373,32.4860199 72.747373,43.0434079\"></path>\n <path d=\"M44.4668556,7.01044608 C54.151517,13.1403033 45.1489715,19.2084878 47.1611905,23.2253896 C48.8157833,26.5283781 51.4021933,28.6198851 48.8753629,33.038878 C46.8123257,36.6467763 42.0052989,37.0050492 39.251679,39.7621111 C36.2115749,42.8060154 33.7884281,48.7028116 32.4624592,52.6732691 C30.8452419,57.5158356 47.0088721,59.5388126 44.5246867,63.6811917 C43.1386839,65.9923513 37.7785192,65.1466282 36.0880227,63.8791519 C34.9234453,63.0059918 32.4946425,63.3331166 31.6713597,62.0997342 C29.0575851,58.1839669 29.4107339,54.0758543 28.0457962,49.9707786 C27.1076833,47.1493864 21.732611,47.8501656 20.2022714,49.3776393 C19.6790362,49.8998948 19.8723378,51.1703278 19.8723378,51.8829111 C19.8723378,57.1682405 26.9914913,55.1986414 26.9914913,58.3421973 C26.9914913,72.9792302 30.9191897,64.8771867 38.1313873,69.6793121 C48.1678018,76.3618966 45.9763926,76.981595 53.0777543,84.0829567 C56.7511941,87.7563965 60.8192437,87.7689005 62.503478,93.3767069 C64.1046972,98.7081071 53.1759798,98.7157031 50.786754,100.825053 C49.663965,101.816317 47.9736094,104.970571 46.5680513,105.439676 C44.7757187,106.037867 43.334221,105.93607 41.6242359,107.219093 C39.1967302,109.040481 37.7241465,112.151588 37.6034934,112.030935 C35.4555278,109.88297 34.0848666,96.5511248 33.7147244,93.7726273 C33.1258872,89.3524817 28.1241923,88.2337027 26.7275443,84.7420826 C25.1572737,80.8164061 28.2518481,75.223612 25.599097,70.9819941 C19.0797019,60.557804 13.7775712,56.4811506 10.2493953,44.6896152 C9.3074899,41.5416683 13.5912267,38.1609942 15.1264825,35.8570308 C17.0029359,33.0410312 17.7876232,30.0028946 19.8723378,27.2224065 C22.146793,24.1888519 40.8551166,9.46076832 43.8574051,8.63490613 L44.4668556,7.01044608 Z\"></path>\n <path d=\"M64,126 C98.2416545,126 126,98.2416545 126,64 C126,29.7583455 98.2416545,2 64,2 C29.7583455,2 2,29.7583455 2,64 C2,98.2416545 29.7583455,126 64,126 Z M64,120 C94.927946,120 120,94.927946 120,64 C120,33.072054 94.927946,8 64,8 C33.072054,8 8,33.072054 8,64 C8,94.927946 33.072054,120 64,120 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-1": {
"title": "$:/core/images/heading-1",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-1 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M14,30 L27.25,30 L27.25,60.104 L61.7,60.104 L61.7,30 L74.95,30 L74.95,105.684 L61.7,105.684 L61.7,71.552 L27.25,71.552 L27.25,105.684 L14,105.684 L14,30 Z M84.3350766,43.78 C86.8790893,43.78 89.3523979,43.5680021 91.7550766,43.144 C94.1577553,42.7199979 96.3307336,42.0133383 98.2740766,41.024 C100.21742,40.0346617 101.87807,38.7626744 103.256077,37.208 C104.634084,35.6533256 105.535075,33.7453446 105.959077,31.484 L115.817077,31.484 L115.817077,105.684 L102.567077,105.684 L102.567077,53.32 L84.3350766,53.32 L84.3350766,43.78 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-2": {
"title": "$:/core/images/heading-2",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-2 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M6,30 L19.25,30 L19.25,60.104 L53.7,60.104 L53.7,30 L66.95,30 L66.95,105.684 L53.7,105.684 L53.7,71.552 L19.25,71.552 L19.25,105.684 L6,105.684 L6,30 Z M125.519077,105.684 L74.8510766,105.684 C74.9217436,99.5359693 76.4057288,94.1653563 79.3030766,89.572 C82.2004244,84.9786437 86.1577182,80.986017 91.1750766,77.594 C93.5777553,75.8273245 96.0863969,74.113675 98.7010766,72.453 C101.315756,70.792325 103.718399,69.0080095 105.909077,67.1 C108.099754,65.1919905 109.901736,63.1250111 111.315077,60.899 C112.728417,58.6729889 113.47041,56.1113478 113.541077,53.214 C113.541077,51.8713266 113.382078,50.4403409 113.064077,48.921 C112.746075,47.4016591 112.127748,45.9883399 111.209077,44.681 C110.290405,43.3736601 109.018418,42.2783377 107.393077,41.395 C105.767735,40.5116622 103.647756,40.07 101.033077,40.07 C98.6303979,40.07 96.6340846,40.5469952 95.0440766,41.501 C93.4540687,42.4550048 92.1820814,43.762325 91.2280766,45.423 C90.2740719,47.083675 89.5674123,49.0446554 89.1080766,51.306 C88.648741,53.5673446 88.3837436,56.0053203 88.3130766,58.62 L76.2290766,58.62 C76.2290766,54.5213128 76.7767378,50.7230175 77.8720766,47.225 C78.9674154,43.7269825 80.610399,40.7060127 82.8010766,38.162 C84.9917542,35.6179873 87.6593942,33.6216739 90.8040766,32.173 C93.948759,30.7243261 97.6057224,30 101.775077,30 C106.297766,30 110.078395,30.7419926 113.117077,32.226 C116.155758,33.7100074 118.611401,35.5826554 120.484077,37.844 C122.356753,40.1053446 123.681739,42.5609868 124.459077,45.211 C125.236414,47.8610133 125.625077,50.3873213 125.625077,52.79 C125.625077,55.7580148 125.165748,58.4433213 124.247077,60.846 C123.328405,63.2486787 122.091751,65.4569899 120.537077,67.471 C118.982402,69.4850101 117.215753,71.3399915 115.237077,73.036 C113.2584,74.7320085 111.209087,76.3219926 109.089077,77.806 C106.969066,79.2900074 104.849087,80.7033266 102.729077,82.046 C100.609066,83.3886734 98.6480856,84.7313266 96.8460766,86.074 C95.0440676,87.4166734 93.47175,88.8123261 92.1290766,90.261 C90.7864032,91.7096739 89.8677458,93.2466585 89.3730766,94.872 L125.519077,94.872 L125.519077,105.684 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-3": {
"title": "$:/core/images/heading-3",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-3 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M6,30 L19.25,30 L19.25,60.104 L53.7,60.104 L53.7,30 L66.95,30 L66.95,105.684 L53.7,105.684 L53.7,71.552 L19.25,71.552 L19.25,105.684 L6,105.684 L6,30 Z M94.8850766,62.224 C96.8637532,62.294667 98.8424001,62.1533351 100.821077,61.8 C102.799753,61.4466649 104.566402,60.8283378 106.121077,59.945 C107.675751,59.0616623 108.930072,57.8426744 109.884077,56.288 C110.838081,54.7333256 111.315077,52.8253446 111.315077,50.564 C111.315077,47.3839841 110.237421,44.8400095 108.082077,42.932 C105.926733,41.0239905 103.153094,40.07 99.7610766,40.07 C97.641066,40.07 95.8037511,40.4939958 94.2490766,41.342 C92.6944022,42.1900042 91.4047484,43.3383261 90.3800766,44.787 C89.3554048,46.2356739 88.5957458,47.860991 88.1010766,49.663 C87.6064075,51.465009 87.3944096,53.3199905 87.4650766,55.228 L75.3810766,55.228 C75.5224107,51.623982 76.1937373,48.2850154 77.3950766,45.211 C78.596416,42.1369846 80.2393995,39.4693446 82.3240766,37.208 C84.4087537,34.9466554 86.9350618,33.1800064 89.9030766,31.908 C92.8710915,30.6359936 96.2277246,30 99.9730766,30 C102.870424,30 105.714729,30.4239958 108.506077,31.272 C111.297424,32.1200042 113.806065,33.3566585 116.032077,34.982 C118.258088,36.6073415 120.042403,38.6743208 121.385077,41.183 C122.72775,43.6916792 123.399077,46.5713171 123.399077,49.822 C123.399077,53.5673521 122.551085,56.8356527 120.855077,59.627 C119.159068,62.4183473 116.509095,64.4499936 112.905077,65.722 L112.905077,65.934 C117.145098,66.7820042 120.448731,68.8843166 122.816077,72.241 C125.183422,75.5976835 126.367077,79.6786426 126.367077,84.484 C126.367077,88.017351 125.660417,91.1796527 124.247077,93.971 C122.833736,96.7623473 120.925755,99.129657 118.523077,101.073 C116.120398,103.016343 113.329093,104.517995 110.149077,105.578 C106.969061,106.638005 103.612428,107.168 100.079077,107.168 C95.7683884,107.168 92.005426,106.549673 88.7900766,105.313 C85.5747272,104.076327 82.8894207,102.327345 80.7340766,100.066 C78.5787325,97.8046554 76.9357489,95.0840159 75.8050766,91.904 C74.6744043,88.7239841 74.0737436,85.1906861 74.0030766,81.304 L86.0870766,81.304 C85.9457426,85.8266893 87.0587315,89.5896517 89.4260766,92.593 C91.7934218,95.5963483 95.3443863,97.098 100.079077,97.098 C104.107097,97.098 107.481396,95.9496782 110.202077,93.653 C112.922757,91.3563219 114.283077,88.0880212 114.283077,83.848 C114.283077,80.9506522 113.717749,78.6540085 112.587077,76.958 C111.456404,75.2619915 109.972419,73.9723378 108.135077,73.089 C106.297734,72.2056623 104.230755,71.6580011 101.934077,71.446 C99.6373985,71.2339989 97.2877553,71.163333 94.8850766,71.234 L94.8850766,62.224 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-4": {
"title": "$:/core/images/heading-4",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-4 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M8,30 L21.25,30 L21.25,60.104 L55.7,60.104 L55.7,30 L68.95,30 L68.95,105.684 L55.7,105.684 L55.7,71.552 L21.25,71.552 L21.25,105.684 L8,105.684 L8,30 Z M84.5890766,78.548 L107.061077,78.548 L107.061077,45.9 L106.849077,45.9 L84.5890766,78.548 Z M128.049077,88.088 L118.509077,88.088 L118.509077,105.684 L107.061077,105.684 L107.061077,88.088 L75.2610766,88.088 L75.2610766,76.11 L107.061077,31.484 L118.509077,31.484 L118.509077,78.548 L128.049077,78.548 L128.049077,88.088 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-5": {
"title": "$:/core/images/heading-5",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-5 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M6,30 L19.25,30 L19.25,60.104 L53.7,60.104 L53.7,30 L66.95,30 L66.95,105.684 L53.7,105.684 L53.7,71.552 L19.25,71.552 L19.25,105.684 L6,105.684 L6,30 Z M83.7550766,31.484 L122.127077,31.484 L122.127077,42.296 L92.7650766,42.296 L88.9490766,61.164 L89.1610766,61.376 C90.7864181,59.5386575 92.8533974,58.1430048 95.3620766,57.189 C97.8707558,56.2349952 100.361731,55.758 102.835077,55.758 C106.509762,55.758 109.795729,56.3763272 112.693077,57.613 C115.590424,58.8496729 118.0284,60.5809889 120.007077,62.807 C121.985753,65.0330111 123.487405,67.6653181 124.512077,70.704 C125.536748,73.7426819 126.049077,77.028649 126.049077,80.562 C126.049077,83.5300148 125.572081,86.5863176 124.618077,89.731 C123.664072,92.8756824 122.144754,95.7376538 120.060077,98.317 C117.9754,100.896346 115.30776,103.016325 112.057077,104.677 C108.806394,106.337675 104.919766,107.168 100.397077,107.168 C96.7930586,107.168 93.454092,106.691005 90.3800766,105.737 C87.3060613,104.782995 84.6030883,103.35201 82.2710766,101.444 C79.939065,99.5359905 78.0840835,97.1863473 76.7060766,94.395 C75.3280697,91.6036527 74.5684107,88.3353521 74.4270766,84.59 L86.5110766,84.59 C86.8644117,88.6180201 88.2423979,91.7096559 90.6450766,93.865 C93.0477553,96.0203441 96.2277235,97.098 100.185077,97.098 C102.729089,97.098 104.884401,96.6740042 106.651077,95.826 C108.417752,94.9779958 109.848738,93.8120074 110.944077,92.328 C112.039415,90.8439926 112.816741,89.1126766 113.276077,87.134 C113.735412,85.1553234 113.965077,83.0353446 113.965077,80.774 C113.965077,78.7246564 113.682413,76.763676 113.117077,74.891 C112.55174,73.018324 111.703749,71.3753404 110.573077,69.962 C109.442404,68.5486596 107.976086,67.4180042 106.174077,66.57 C104.372068,65.7219958 102.269755,65.298 99.8670766,65.298 C97.3230639,65.298 94.9380878,65.7749952 92.7120766,66.729 C90.4860655,67.6830048 88.8784149,69.4673203 87.8890766,72.082 L75.8050766,72.082 L83.7550766,31.484 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/heading-6": {
"title": "$:/core/images/heading-6",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-heading-6 tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M6,30 L19.25,30 L19.25,60.104 L53.7,60.104 L53.7,30 L66.95,30 L66.95,105.684 L53.7,105.684 L53.7,71.552 L19.25,71.552 L19.25,105.684 L6,105.684 L6,30 Z M112.587077,50.246 C112.304409,47.2073181 111.226753,44.751676 109.354077,42.879 C107.481401,41.006324 104.955093,40.07 101.775077,40.07 C99.584399,40.07 97.6940846,40.4763293 96.1040766,41.289 C94.5140687,42.1016707 93.1714154,43.1793266 92.0760766,44.522 C90.9807378,45.8646734 90.0974133,47.401658 89.4260766,49.133 C88.7547399,50.864342 88.2070787,52.6839905 87.7830766,54.592 C87.3590745,56.5000095 87.0587442,58.390324 86.8820766,60.263 C86.7054091,62.135676 86.5464107,63.8846585 86.4050766,65.51 L86.6170766,65.722 C88.2424181,62.7539852 90.4860623,60.5456739 93.3480766,59.097 C96.2100909,57.6483261 99.3017267,56.924 102.623077,56.924 C106.297762,56.924 109.583729,57.5599936 112.481077,58.832 C115.378424,60.1040064 117.834067,61.8529889 119.848077,64.079 C121.862087,66.3050111 123.399071,68.9373181 124.459077,71.976 C125.519082,75.0146819 126.049077,78.300649 126.049077,81.834 C126.049077,85.438018 125.466082,88.7769846 124.300077,91.851 C123.134071,94.9250154 121.455754,97.6103219 119.265077,99.907 C117.074399,102.203678 114.459758,103.987994 111.421077,105.26 C108.382395,106.532006 105.025762,107.168 101.351077,107.168 C95.9097161,107.168 91.4400941,106.16101 87.9420766,104.147 C84.4440591,102.13299 81.6880867,99.3770175 79.6740766,95.879 C77.6600666,92.3809825 76.2644138,88.2823568 75.4870766,83.583 C74.7097394,78.8836432 74.3210766,73.8133605 74.3210766,68.372 C74.3210766,63.9199777 74.7980719,59.4326893 75.7520766,54.91 C76.7060814,50.3873107 78.278399,46.2710186 80.4690766,42.561 C82.6597542,38.8509815 85.5393921,35.8300117 89.1080766,33.498 C92.6767611,31.1659883 97.0757171,30 102.305077,30 C105.273091,30 108.064397,30.4946617 110.679077,31.484 C113.293756,32.4733383 115.608067,33.8513245 117.622077,35.618 C119.636087,37.3846755 121.27907,39.5046543 122.551077,41.978 C123.823083,44.4513457 124.529743,47.2073181 124.671077,50.246 L112.587077,50.246 Z M100.927077,97.098 C103.117754,97.098 105.025735,96.6563378 106.651077,95.773 C108.276418,94.8896623 109.636738,93.7413404 110.732077,92.328 C111.827415,90.9146596 112.640074,89.271676 113.170077,87.399 C113.700079,85.526324 113.965077,83.6006766 113.965077,81.622 C113.965077,79.6433234 113.700079,77.7353425 113.170077,75.898 C112.640074,74.0606575 111.827415,72.4530069 110.732077,71.075 C109.636738,69.6969931 108.276418,68.5840042 106.651077,67.736 C105.025735,66.8879958 103.117754,66.464 100.927077,66.464 C98.736399,66.464 96.8107516,66.8703293 95.1500766,67.683 C93.4894017,68.4956707 92.0937489,69.5909931 90.9630766,70.969 C89.8324043,72.3470069 88.9844128,73.9546575 88.4190766,75.792 C87.8537405,77.6293425 87.5710766,79.5726564 87.5710766,81.622 C87.5710766,83.6713436 87.8537405,85.6146575 88.4190766,87.452 C88.9844128,89.2893425 89.8324043,90.9323261 90.9630766,92.381 C92.0937489,93.8296739 93.4894017,94.9779958 95.1500766,95.826 C96.8107516,96.6740042 98.736399,97.098 100.927077,97.098 L100.927077,97.098 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/help": {
"title": "$:/core/images/help",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-help tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M36.0548906,111.44117 C30.8157418,115.837088 20.8865444,118.803477 9.5,118.803477 C7.86465619,118.803477 6.25937294,118.742289 4.69372699,118.624467 C12.612543,115.984876 18.7559465,110.02454 21.0611049,102.609942 C8.74739781,92.845129 1.04940554,78.9359851 1.04940554,63.5 C1.04940554,33.9527659 29.2554663,10 64.0494055,10 C98.8433448,10 127.049406,33.9527659 127.049406,63.5 C127.049406,93.0472341 98.8433448,117 64.0494055,117 C53.9936953,117 44.48824,114.999337 36.0548906,111.44117 L36.0548906,111.44117 Z M71.4042554,77.5980086 C71.406883,77.2865764 71.4095079,76.9382011 71.4119569,76.5610548 C71.4199751,75.3262169 71.4242825,74.0811293 71.422912,72.9158546 C71.4215244,71.736154 71.4143321,70.709635 71.4001396,69.8743525 C71.4078362,68.5173028 71.9951951,67.7870427 75.1273009,65.6385471 C75.2388969,65.5619968 76.2124091,64.8981068 76.5126553,64.6910879 C79.6062455,62.5580654 81.5345849,60.9050204 83.2750652,58.5038955 C85.6146327,55.2762841 86.8327108,51.426982 86.8327108,46.8554323 C86.8327108,33.5625756 76.972994,24.9029551 65.3778484,24.9029551 C54.2752771,24.9029551 42.8794554,34.5115163 41.3121702,47.1975534 C40.9043016,50.4989536 43.2499725,53.50591 46.5513726,53.9137786 C49.8527728,54.3216471 52.8597292,51.9759763 53.2675978,48.6745761 C54.0739246,42.1479456 60.2395837,36.9492759 65.3778484,36.9492759 C70.6427674,36.9492759 74.78639,40.5885487 74.78639,46.8554323 C74.78639,50.4892974 73.6853224,52.008304 69.6746221,54.7736715 C69.4052605,54.9593956 68.448509,55.6118556 68.3131127,55.7047319 C65.6309785,57.5445655 64.0858213,58.803255 62.6123358,60.6352315 C60.5044618,63.2559399 59.3714208,66.3518252 59.3547527,69.9487679 C59.3684999,70.8407274 59.3752803,71.8084521 59.3765995,72.9300232 C59.3779294,74.0607297 59.3737237,75.2764258 59.36589,76.482835 C59.3634936,76.8518793 59.3609272,77.1924914 59.3583633,77.4963784 C59.3568319,77.6778944 59.3556368,77.8074256 59.3549845,77.8730928 C59.3219814,81.1994287 61.9917551,83.9227111 65.318091,83.9557142 C68.644427,83.9887173 71.3677093,81.3189435 71.4007124,77.9926076 C71.4014444,77.9187458 71.402672,77.7856841 71.4042554,77.5980086 Z M65.3778489,102.097045 C69.5359735,102.097045 72.9067994,98.7262189 72.9067994,94.5680944 C72.9067994,90.4099698 69.5359735,87.0391439 65.3778489,87.0391439 C61.2197243,87.0391439 57.8488984,90.4099698 57.8488984,94.5680944 C57.8488984,98.7262189 61.2197243,102.097045 65.3778489,102.097045 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/home-button": {
"title": "$:/core/images/home-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-home-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M112.9847,119.501583 C112.99485,119.336814 113,119.170705 113,119.003406 L113,67.56802 C116.137461,70.5156358 121.076014,70.4518569 124.133985,67.3938855 C127.25818,64.2696912 127.260618,59.2068102 124.131541,56.0777326 L70.3963143,2.34250601 C68.8331348,0.779326498 66.7828947,-0.000743167069 64.7337457,1.61675364e-05 C62.691312,-0.00409949529 60.6426632,0.777559815 59.077717,2.34250601 L33,28.420223 L33,28.420223 L33,8.00697327 C33,3.58484404 29.4092877,0 25,0 C20.581722,0 17,3.59075293 17,8.00697327 L17,44.420223 L5.3424904,56.0777326 C2.21694607,59.2032769 2.22220878,64.2760483 5.34004601,67.3938855 C8.46424034,70.5180798 13.5271213,70.5205187 16.6561989,67.3914411 L17,67.04764 L17,119.993027 C17,119.994189 17.0000002,119.995351 17.0000007,119.996514 C17.0000002,119.997675 17,119.998838 17,120 C17,124.418278 20.5881049,128 24.9992458,128 L105.000754,128 C109.418616,128 113,124.409288 113,120 C113,119.832611 112.99485,119.666422 112.9847,119.501583 Z M97,112 L97,51.5736087 L97,51.5736087 L64.7370156,19.3106244 L33,51.04764 L33,112 L97,112 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/import-button": {
"title": "$:/core/images/import-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-import-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M105.449437,94.2138951 C105.449437,94.2138951 110.049457,94.1897106 110.049457,99.4026111 C110.049457,104.615512 105.163246,104.615511 105.163246,104.615511 L45.0075072,105.157833 C45.0075072,105.157833 0.367531803,106.289842 0.367532368,66.6449212 C0.367532934,27.0000003 45.0428249,27.0000003 45.0428249,27.0000003 L105.532495,27.0000003 C105.532495,27.0000003 138.996741,25.6734987 138.996741,55.1771866 C138.996741,84.6808745 105.727102,82.8457535 105.727102,82.8457535 L56.1735087,82.8457535 C56.1735087,82.8457535 22.6899229,85.1500223 22.6899229,66.0913753 C22.6899229,47.0327282 56.1735087,49.3383013 56.1735087,49.3383013 L105.727102,49.3383013 C105.727102,49.3383013 111.245209,49.3383024 111.245209,54.8231115 C111.245209,60.3079206 105.727102,60.5074524 105.727102,60.5074524 L56.1735087,60.5074524 C56.1735087,60.5074524 37.48913,60.5074528 37.48913,66.6449195 C37.48913,72.7823862 56.1735087,71.6766023 56.1735087,71.6766023 L105.727102,71.6766029 C105.727102,71.6766029 127.835546,73.1411469 127.835546,55.1771866 C127.835546,35.5304025 105.727102,38.3035317 105.727102,38.3035317 L45.0428249,38.3035317 C45.0428249,38.3035317 11.5287276,38.3035313 11.5287276,66.6449208 C11.5287276,94.9863103 45.0428244,93.9579678 45.0428244,93.9579678 L105.449437,94.2138951 Z\" transform=\"translate(69.367532, 66.000000) rotate(-45.000000) translate(-69.367532, -66.000000) \"></path>\n </g>\n</svg>"
},
"$:/core/images/info-button": {
"title": "$:/core/images/info-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-info-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <g transform=\"translate(0.049406, 0.000000)\">\n <path d=\"M64,128 C99.346224,128 128,99.346224 128,64 C128,28.653776 99.346224,0 64,0 C28.653776,0 0,28.653776 0,64 C0,99.346224 28.653776,128 64,128 Z M64,112 C90.509668,112 112,90.509668 112,64 C112,37.490332 90.509668,16 64,16 C37.490332,16 16,37.490332 16,64 C16,90.509668 37.490332,112 64,112 Z\"></path>\n <circle cx=\"64\" cy=\"32\" r=\"8\"></circle>\n <rect x=\"56\" y=\"48\" width=\"16\" height=\"56\" rx=\"8\"></rect>\n </g>\n </g>\n</svg>"
},
"$:/core/images/italic": {
"title": "$:/core/images/italic",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-italic tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <polygon points=\"66.7114846 0 89.1204482 0 62.4089636 128 40 128\"></polygon>\n </g>\n</svg>"
},
"$:/core/images/left-arrow": {
"created": "20150315234410875",
"modified": "20150315235324760",
"tags": "$:/tags/Image",
"title": "$:/core/images/left-arrow",
"text": "<svg class=\"tc-image-left-arrow tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <path transform=\"rotate(135, 63.8945, 64.1752)\" d=\"m109.07576,109.35336c-1.43248,1.43361 -3.41136,2.32182 -5.59717,2.32182l-79.16816,0c-4.36519,0 -7.91592,-3.5444 -7.91592,-7.91666c0,-4.36337 3.54408,-7.91667 7.91592,-7.91667l71.25075,0l0,-71.25075c0,-4.3652 3.54442,-7.91592 7.91667,-7.91592c4.36336,0 7.91667,3.54408 7.91667,7.91592l0,79.16815c0,2.1825 -0.88602,4.16136 -2.3185,5.59467l-0.00027,-0.00056z\"/>\n</svg>\n"
},
"$:/core/images/line-width": {
"title": "$:/core/images/line-width",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-line-width tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M128,-97 L112.992786,-97 C112.452362,-97 112,-96.5522847 112,-96 C112,-95.4438648 112.444486,-95 112.992786,-95 L128,-95 L128,-97 Z M128,-78.6794919 L111.216185,-88.3696322 C110.748163,-88.6398444 110.132549,-88.4782926 109.856406,-88 C109.578339,-87.5183728 109.741342,-86.9117318 110.216185,-86.6375814 L128,-76.3700908 L128,-78.6794919 Z M78.6794919,-128 L88.3696322,-111.216185 C88.6437826,-110.741342 88.4816272,-110.134474 88,-109.856406 C87.5217074,-109.580264 86.9077936,-109.748163 86.6375814,-110.216185 L76.3700908,-128 L78.6794919,-128 Z M97,-128 L97,-112.992786 C97,-112.444486 96.5561352,-112 96,-112 C95.4477153,-112 95,-112.452362 95,-112.992786 L95,-128 L97,-128 Z M115.629909,-128 L105.362419,-110.216185 C105.088268,-109.741342 104.481627,-109.578339 104,-109.856406 C103.521707,-110.132549 103.360156,-110.748163 103.630368,-111.216185 L113.320508,-128 L115.629909,-128 Z M128,-113.320508 L111.216185,-103.630368 C110.741342,-103.356217 110.134474,-103.518373 109.856406,-104 C109.580264,-104.478293 109.748163,-105.092206 110.216185,-105.362419 L128,-115.629909 L128,-113.320508 Z M48,-96 C48,-96.5522847 48.4523621,-97 48.9927864,-97 L79.0072136,-97 C79.5555144,-97 80,-96.5561352 80,-96 C80,-95.4477153 79.5476379,-95 79.0072136,-95 L48.9927864,-95 C48.4444856,-95 48,-95.4438648 48,-96 Z M54.4307806,-120 C54.706923,-120.478293 55.3225377,-120.639844 55.7905589,-120.369632 L81.7838153,-105.362419 C82.2586577,-105.088268 82.4216611,-104.481627 82.1435935,-104 C81.8674512,-103.521707 81.2518365,-103.360156 80.7838153,-103.630368 L54.7905589,-118.637581 C54.3157165,-118.911732 54.152713,-119.518373 54.4307806,-120 Z M104,-82.1435935 C104.478293,-82.4197359 105.092206,-82.2518365 105.362419,-81.7838153 L120.369632,-55.7905589 C120.643783,-55.3157165 120.481627,-54.7088482 120,-54.4307806 C119.521707,-54.1546382 118.907794,-54.3225377 118.637581,-54.7905589 L103.630368,-80.7838153 C103.356217,-81.2586577 103.518373,-81.865526 104,-82.1435935 Z M96,-80 C96.5522847,-80 97,-79.5476379 97,-79.0072136 L97,-48.9927864 C97,-48.4444856 96.5561352,-48 96,-48 C95.4477153,-48 95,-48.4523621 95,-48.9927864 L95,-79.0072136 C95,-79.5555144 95.4438648,-80 96,-80 Z M88,-82.1435935 C88.4782926,-81.8674512 88.6398444,-81.2518365 88.3696322,-80.7838153 L73.3624186,-54.7905589 C73.0882682,-54.3157165 72.4816272,-54.152713 72,-54.4307806 C71.5217074,-54.706923 71.3601556,-55.3225377 71.6303678,-55.7905589 L86.6375814,-81.7838153 C86.9117318,-82.2586577 87.5183728,-82.4216611 88,-82.1435935 Z M82.1435935,-88 C82.4197359,-87.5217074 82.2518365,-86.9077936 81.7838153,-86.6375814 L55.7905589,-71.6303678 C55.3157165,-71.3562174 54.7088482,-71.5183728 54.4307806,-72 C54.1546382,-72.4782926 54.3225377,-73.0922064 54.7905589,-73.3624186 L80.7838153,-88.3696322 C81.2586577,-88.6437826 81.865526,-88.4816272 82.1435935,-88 Z M1.30626177e-08,-41.9868843 L15.0170091,-57.9923909 L20.7983821,-52.9749272 L44.7207091,-81.2095939 L73.4260467,-42.1002685 L85.984793,-56.6159488 L104.48741,-34.0310661 L127.969109,-47.4978019 L127.969109,7.99473128e-07 L1.30626177e-08,7.99473128e-07 L1.30626177e-08,-41.9868843 Z M96,-84 C102.627417,-84 108,-89.372583 108,-96 C108,-102.627417 102.627417,-108 96,-108 C89.372583,-108 84,-102.627417 84,-96 C84,-89.372583 89.372583,-84 96,-84 Z\"></path>\n <path d=\"M16,18 L112,18 C113.104569,18 114,17.1045695 114,16 C114,14.8954305 113.104569,14 112,14 L16,14 C14.8954305,14 14,14.8954305 14,16 C14,17.1045695 14.8954305,18 16,18 L16,18 Z M16,35 L112,35 C114.209139,35 116,33.209139 116,31 C116,28.790861 114.209139,27 112,27 L16,27 C13.790861,27 12,28.790861 12,31 C12,33.209139 13.790861,35 16,35 L16,35 Z M16,56 L112,56 C115.313708,56 118,53.3137085 118,50 C118,46.6862915 115.313708,44 112,44 L16,44 C12.6862915,44 10,46.6862915 10,50 C10,53.3137085 12.6862915,56 16,56 L16,56 Z M16,85 L112,85 C117.522847,85 122,80.5228475 122,75 C122,69.4771525 117.522847,65 112,65 L16,65 C10.4771525,65 6,69.4771525 6,75 C6,80.5228475 10.4771525,85 16,85 L16,85 Z M16,128 L112,128 C120.836556,128 128,120.836556 128,112 C128,103.163444 120.836556,96 112,96 L16,96 C7.163444,96 0,103.163444 0,112 C0,120.836556 7.163444,128 16,128 L16,128 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/link": {
"title": "$:/core/images/link",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-link tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M128.719999,57.568543 C130.219553,53.8628171 131.045202,49.8121445 131.045202,45.5685425 C131.045202,27.8915447 116.718329,13.5685425 99.0452364,13.5685425 L67.0451674,13.5685425 C49.3655063,13.5685425 35.0452019,27.8954305 35.0452019,45.5685425 C35.0452019,63.2455403 49.3720745,77.5685425 67.0451674,77.5685425 L99.0452364,77.5685425 C100.406772,77.5685425 101.748384,77.4835732 103.065066,77.3186499 C96.4792444,73.7895096 91.1190212,68.272192 87.7873041,61.5685425 L67.0506214,61.5685425 C58.2110723,61.5685425 51.0452019,54.4070414 51.0452019,45.5685425 C51.0452019,36.7319865 58.2005234,29.5685425 67.0506214,29.5685425 L99.0397824,29.5685425 C107.879331,29.5685425 115.045202,36.7300436 115.045202,45.5685425 C115.045202,48.9465282 113.99957,52.0800164 112.21335,54.6623005 C114.314383,56.4735917 117.050039,57.5685425 120.041423,57.5685425 L128.720003,57.5685425 Z\" transform=\"translate(83.045202, 45.568542) rotate(-225.000000) translate(-83.045202, -45.568542)\"></path>\n <path d=\"M-0.106255113,71.0452019 C-1.60580855,74.7509276 -2.43145751,78.8016001 -2.43145751,83.0452019 C-2.43145751,100.7222 11.8954151,115.045202 29.568508,115.045202 L61.568577,115.045202 C79.2482381,115.045202 93.5685425,100.718314 93.5685425,83.0452019 C93.5685425,65.3682041 79.2416699,51.0452019 61.568577,51.0452019 L29.568508,51.0452019 C28.206973,51.0452019 26.8653616,51.1301711 25.5486799,51.2950943 C32.1345,54.8242347 37.4947231,60.3415524 40.8264403,67.0452019 L61.563123,67.0452019 C70.4026721,67.0452019 77.5685425,74.206703 77.5685425,83.0452019 C77.5685425,91.8817579 70.413221,99.0452019 61.563123,99.0452019 L29.573962,99.0452019 C20.7344129,99.0452019 13.5685425,91.8837008 13.5685425,83.0452019 C13.5685425,79.6672162 14.6141741,76.533728 16.4003949,73.9514439 C14.2993609,72.1401527 11.5637054,71.0452019 8.5723215,71.0452019 L-0.106255113,71.0452019 Z\" transform=\"translate(45.568542, 83.045202) rotate(-225.000000) translate(-45.568542, -83.045202)\"></path>\n </g>\n</svg>"
},
"$:/core/images/list-bullet": {
"title": "$:/core/images/list-bullet",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-list-bullet tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M11.6363636,40.2727273 C18.0629498,40.2727273 23.2727273,35.0629498 23.2727273,28.6363636 C23.2727273,22.2097775 18.0629498,17 11.6363636,17 C5.20977746,17 0,22.2097775 0,28.6363636 C0,35.0629498 5.20977746,40.2727273 11.6363636,40.2727273 Z M11.6363636,75.1818182 C18.0629498,75.1818182 23.2727273,69.9720407 23.2727273,63.5454545 C23.2727273,57.1188684 18.0629498,51.9090909 11.6363636,51.9090909 C5.20977746,51.9090909 0,57.1188684 0,63.5454545 C0,69.9720407 5.20977746,75.1818182 11.6363636,75.1818182 Z M11.6363636,110.090909 C18.0629498,110.090909 23.2727273,104.881132 23.2727273,98.4545455 C23.2727273,92.0279593 18.0629498,86.8181818 11.6363636,86.8181818 C5.20977746,86.8181818 0,92.0279593 0,98.4545455 C0,104.881132 5.20977746,110.090909 11.6363636,110.090909 Z M34.9090909,22.8181818 L128,22.8181818 L128,34.4545455 L34.9090909,34.4545455 L34.9090909,22.8181818 Z M34.9090909,57.7272727 L128,57.7272727 L128,69.3636364 L34.9090909,69.3636364 L34.9090909,57.7272727 Z M34.9090909,92.6363636 L128,92.6363636 L128,104.272727 L34.9090909,104.272727 L34.9090909,92.6363636 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/list-number": {
"title": "$:/core/images/list-number",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-list-number tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M33.8390805,22.3563218 L128,22.3563218 L128,34.1264368 L33.8390805,34.1264368 L33.8390805,22.3563218 Z M33.8390805,57.6666667 L128,57.6666667 L128,69.4367816 L33.8390805,69.4367816 L33.8390805,57.6666667 Z M33.8390805,92.9770115 L128,92.9770115 L128,104.747126 L33.8390805,104.747126 L33.8390805,92.9770115 Z M0.379509711,42.6307008 L0.379509711,40.4082314 L1.37821948,40.4082314 C2.20382368,40.4082314 2.82301754,40.268077 3.23581964,39.9877642 C3.64862174,39.7074513 3.85501969,39.0400498 3.85501969,37.9855395 L3.85501969,22.7686318 C3.85501969,21.3270228 3.66193774,20.4327047 3.27576803,20.0856507 C2.88959832,19.7385967 1.79768657,19.5650723 0,19.5650723 L0,17.4226919 C3.50215975,17.2758613 6.25191314,16.4683055 8.24934266,15 L10.3666074,15 L10.3666074,37.865406 C10.3666074,38.786434 10.5164123,39.4404875 10.8160268,39.8275862 C11.1156412,40.2146849 11.764796,40.4082314 12.7635108,40.4082314 L13.7622206,40.4082314 L13.7622206,42.6307008 L0.379509711,42.6307008 Z M0.0798967812,77.9873934 L0.0798967812,76.0852799 C7.27064304,69.5312983 10.8659622,63.5046623 10.8659622,58.005191 C10.8659622,56.4434479 10.5397203,55.195407 9.88722667,54.2610308 C9.23473303,53.3266546 8.36253522,52.8594735 7.27060709,52.8594735 C6.3784219,52.8594735 5.61608107,53.1764892 4.98356173,53.8105302 C4.35104238,54.4445712 4.03478745,55.1753759 4.03478745,56.0029663 C4.03478745,56.9773871 4.28113339,57.8316611 4.77383268,58.5658139 C4.88036225,58.7259926 4.93362624,58.8461249 4.93362624,58.9262143 C4.93362624,59.0730449 4.77383427,59.2065252 4.45424555,59.3266593 C4.2411864,59.4067486 3.70188852,59.6336652 2.83633573,60.0074156 C1.99741533,60.3811661 1.47809145,60.5680386 1.2783485,60.5680386 C1.03865696,60.5680386 0.765679018,60.1976307 0.459406492,59.4568039 C0.153133966,58.715977 0,57.9184322 0,57.0641453 C0,55.1153036 0.848894811,53.5202138 2.5467099,52.2788283 C4.24452499,51.0374428 6.34512352,50.4167594 8.84856852,50.4167594 C11.3120649,50.4167594 13.3793735,51.0874979 15.0505562,52.4289952 C16.7217389,53.7704924 17.5573177,55.5224215 17.5573177,57.684835 C17.5573177,58.9662652 17.2743527,60.2076321 16.7084144,61.4089729 C16.142476,62.6103138 14.7875733,64.4623531 12.6436656,66.9651465 C10.4997579,69.4679398 8.40914641,71.7804862 6.3717683,73.902855 L17.8169822,73.902855 L16.7982982,79.6292176 L14.6810335,79.6292176 C14.7609307,79.3489048 14.8008787,79.0952922 14.8008787,78.8683723 C14.8008787,78.4812736 14.7010087,78.237672 14.5012658,78.1375603 C14.3015228,78.0374485 13.9020429,77.9873934 13.3028141,77.9873934 L0.0798967812,77.9873934 Z M12.2042333,97.1935484 C13.9486551,97.2335931 15.4400468,97.8309175 16.6784531,98.9855395 C17.9168594,100.140162 18.5360532,101.75861 18.5360532,103.840934 C18.5360532,106.830938 17.4041935,109.233584 15.14044,111.048943 C12.8766866,112.864303 10.1402492,113.771969 6.93104577,113.771969 C4.92030005,113.771969 3.26245842,113.388213 1.95747114,112.62069 C0.652483855,111.853166 0,110.848727 0,109.607341 C0,108.833144 0.26964894,108.209124 0.808954909,107.735261 C1.34826088,107.261399 1.93749375,107.024472 2.57667119,107.024472 C3.21584864,107.024472 3.73850152,107.224692 4.14464552,107.625139 C4.55078953,108.025586 4.92696644,108.67964 5.27318756,109.587319 C5.73925445,110.855401 6.51158227,111.489433 7.59019421,111.489433 C8.85523291,111.489433 9.87723568,111.012241 10.6562332,110.057842 C11.4352307,109.103444 11.8247236,107.371536 11.8247236,104.862069 C11.8247236,103.153495 11.7048796,101.838714 11.4651881,100.917686 C11.2254966,99.9966584 10.6728827,99.5361513 9.80732989,99.5361513 C9.22141723,99.5361513 8.62219737,99.843156 8.00965231,100.457175 C7.51695303,100.951059 7.07752513,101.197998 6.69135542,101.197998 C6.3584505,101.197998 6.08880156,101.051169 5.88240051,100.757508 C5.67599946,100.463847 5.57280049,100.183539 5.57280049,99.916574 C5.57280049,99.5962164 5.67599946,99.3225818 5.88240051,99.0956618 C6.08880156,98.8687419 6.57150646,98.5016711 7.33052967,97.9944383 C10.2068282,96.0722929 11.6449559,93.9766521 11.6449559,91.7074527 C11.6449559,90.5194601 11.3386879,89.615131 10.7261429,88.9944383 C10.1135978,88.3737455 9.37455999,88.0634038 8.5090072,88.0634038 C7.71003539,88.0634038 6.98431355,88.3270274 6.33181991,88.8542825 C5.67932627,89.3815377 5.35308434,90.0122321 5.35308434,90.7463849 C5.35308434,91.3871 5.60608828,91.9810874 6.11210376,92.5283648 C6.28521432,92.7285883 6.3717683,92.8954387 6.3717683,93.028921 C6.3717683,93.1490551 5.80250943,93.4560598 4.6639746,93.9499444 C3.52543978,94.4438289 2.80970494,94.6907675 2.51674861,94.6907675 C2.10394651,94.6907675 1.76771758,94.3570667 1.50805174,93.6896552 C1.24838591,93.0222436 1.11855494,92.4082342 1.11855494,91.8476085 C1.11855494,90.0989901 2.04734573,88.6240327 3.90495518,87.4226919 C5.76256463,86.2213511 7.86982116,85.6206897 10.226788,85.6206897 C12.2907985,85.6206897 14.0784711,86.0678487 15.5898594,86.9621802 C17.1012478,87.8565117 17.8569306,89.0778566 17.8569306,90.6262514 C17.8569306,91.987771 17.2876717,93.2491599 16.1491369,94.4104561 C15.0106021,95.5717522 13.6956474,96.4994404 12.2042333,97.1935484 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/list": {
"title": "$:/core/images/list",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-list tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M0.719999312,185.568543 C2.21955287,181.862817 3.0452019,177.812144 3.0452019,173.568542 C3.0452019,155.891545 -11.2816707,141.568542 -28.9547636,141.568542 L-60.9548326,141.568542 C-78.6344937,141.568542 -92.9547981,155.895431 -92.9547981,173.568542 C-92.9547981,191.24554 -78.6279255,205.568542 -60.9548326,205.568542 L-28.9547636,205.568542 C-27.593228,205.568542 -26.2516158,205.483573 -24.9349335,205.31865 C-31.5207556,201.78951 -36.8809788,196.272192 -40.2126959,189.568542 L-60.9493786,189.568542 C-69.7889277,189.568542 -76.9547981,182.407041 -76.9547981,173.568542 C-76.9547981,164.731986 -69.7994766,157.568542 -60.9493786,157.568542 L-28.9602176,157.568542 C-20.1206685,157.568542 -12.9547981,164.730044 -12.9547981,173.568542 C-12.9547981,176.946528 -14.0004297,180.080016 -15.7866505,182.6623 C-13.6856165,184.473592 -10.949961,185.568542 -7.9585771,185.568542 L0.720002586,185.568542 Z\" transform=\"translate(-44.954798, 173.568542) rotate(-225.000000) translate(44.954798, -173.568542) \"></path>\n <path d=\"M87.7480315,128 L23.9992458,128 C19.5813843,128 16,124.409247 16,119.993027 L16,8.00697327 C16,3.58484404 19.5881049,0 23.9992458,0 L104.000754,0 C108.418616,0 112,3.59075293 112,8.00697327 L112,104 L91.2492027,104 C90.2848199,104 89.410573,104.391703 88.7768998,105.025201 C88.1373658,105.661376 87.7480315,106.53563 87.7480315,107.501171 L87.7480315,128 Z M95.7480315,127.879386 L111.627417,112 L95.7480315,112 L95.7480315,127.879386 Z M40,15.5089165 C40,13.5709954 41.5636015,12 43.4998101,12 L98.5001899,12 C100.433082,12 102,13.5614718 102,15.5089165 L102,16.4910835 C102,18.4290046 100.436399,20 98.5001899,20 L43.4998101,20 C41.5669183,20 40,18.4385282 40,16.4910835 L40,15.5089165 Z M32,22 C35.3137085,22 38,19.3137085 38,16 C38,12.6862915 35.3137085,10 32,10 C28.6862915,10 26,12.6862915 26,16 C26,19.3137085 28.6862915,22 32,22 Z M40,31.5089165 C40,29.5709954 41.5636015,28 43.4998101,28 L98.5001899,28 C100.433082,28 102,29.5614718 102,31.5089165 L102,32.4910835 C102,34.4290046 100.436399,36 98.5001899,36 L43.4998101,36 C41.5669183,36 40,34.4385282 40,32.4910835 L40,31.5089165 Z M40,47.5089165 C40,45.5709954 41.5636015,44 43.4998101,44 L98.5001899,44 C100.433082,44 102,45.5614718 102,47.5089165 L102,48.4910835 C102,50.4290046 100.436399,52 98.5001899,52 L43.4998101,52 C41.5669183,52 40,50.4385282 40,48.4910835 L40,47.5089165 Z M40,63.5089165 C40,61.5709954 41.5636015,60 43.4998101,60 L98.5001899,60 C100.433082,60 102,61.5614718 102,63.5089165 L102,64.4910835 C102,66.4290046 100.436399,68 98.5001899,68 L43.4998101,68 C41.5669183,68 40,66.4385282 40,64.4910835 L40,63.5089165 Z M40,79.5089165 C40,77.5709954 41.5636015,76 43.4998101,76 L98.5001899,76 C100.433082,76 102,77.5614718 102,79.5089165 L102,80.4910835 C102,82.4290046 100.436399,84 98.5001899,84 L43.4998101,84 C41.5669183,84 40,82.4385282 40,80.4910835 L40,79.5089165 Z M40,95.5089165 C40,93.5709954 41.5636015,92 43.4998101,92 L98.5001899,92 C100.433082,92 102,93.5614718 102,95.5089165 L102,96.4910835 C102,98.4290046 100.436399,100 98.5001899,100 L43.4998101,100 C41.5669183,100 40,98.4385282 40,96.4910835 L40,95.5089165 Z M40,111.508916 C40,109.570995 41.5680474,108 43.4972017,108 L76.5027983,108 C78.4342495,108 80,109.561472 80,111.508916 L80,112.491084 C80,114.429005 78.4319526,116 76.5027983,116 L43.4972017,116 C41.5657505,116 40,114.438528 40,112.491084 L40,111.508916 Z M32,38 C35.3137085,38 38,35.3137085 38,32 C38,28.6862915 35.3137085,26 32,26 C28.6862915,26 26,28.6862915 26,32 C26,35.3137085 28.6862915,38 32,38 Z M32,54 C35.3137085,54 38,51.3137085 38,48 C38,44.6862915 35.3137085,42 32,42 C28.6862915,42 26,44.6862915 26,48 C26,51.3137085 28.6862915,54 32,54 Z M32,70 C35.3137085,70 38,67.3137085 38,64 C38,60.6862915 35.3137085,58 32,58 C28.6862915,58 26,60.6862915 26,64 C26,67.3137085 28.6862915,70 32,70 Z M32,86 C35.3137085,86 38,83.3137085 38,80 C38,76.6862915 35.3137085,74 32,74 C28.6862915,74 26,76.6862915 26,80 C26,83.3137085 28.6862915,86 32,86 Z M32,102 C35.3137085,102 38,99.3137085 38,96 C38,92.6862915 35.3137085,90 32,90 C28.6862915,90 26,92.6862915 26,96 C26,99.3137085 28.6862915,102 32,102 Z M32,118 C35.3137085,118 38,115.313708 38,112 C38,108.686292 35.3137085,106 32,106 C28.6862915,106 26,108.686292 26,112 C26,115.313708 28.6862915,118 32,118 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/locked-padlock": {
"title": "$:/core/images/locked-padlock",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-locked-padlock tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M96.4723753,64 L105,64 L105,96.0097716 C105,113.673909 90.6736461,128 73.001193,128 L55.998807,128 C38.3179793,128 24,113.677487 24,96.0097716 L24,64 L32.0000269,64 C32.0028554,48.2766389 32.3030338,16.2688026 64.1594984,16.2688041 C95.9543927,16.2688056 96.4648869,48.325931 96.4723753,64 Z M80.5749059,64 L48.4413579,64 C48.4426205,47.71306 48.5829272,31.9999996 64.1595001,31.9999996 C79.8437473,31.9999996 81.1369461,48.1359182 80.5749059,64 Z M67.7315279,92.3641717 C70.8232551,91.0923621 73,88.0503841 73,84.5 C73,79.8055796 69.1944204,76 64.5,76 C59.8055796,76 56,79.8055796 56,84.5 C56,87.947435 58.0523387,90.9155206 61.0018621,92.2491029 L55.9067479,115.020857 L72.8008958,115.020857 L67.7315279,92.3641717 L67.7315279,92.3641717 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/mail": {
"title": "$:/core/images/mail",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-mail tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M122.826782,104.894066 C121.945525,105.22777 120.990324,105.41043 119.993027,105.41043 L8.00697327,105.41043 C7.19458381,105.41043 6.41045219,105.289614 5.67161357,105.064967 L5.67161357,105.064967 L39.8346483,70.9019325 L60.6765759,91.7438601 C61.6118278,92.679112 62.8865166,93.0560851 64.0946097,92.8783815 C65.2975108,93.0473238 66.5641085,92.6696979 67.4899463,91.7438601 L88.5941459,70.6396605 C88.6693095,70.7292352 88.7490098,70.8162939 88.8332479,70.9005321 L122.826782,104.894066 Z M127.903244,98.6568194 C127.966933,98.2506602 128,97.8343714 128,97.4103789 L128,33.410481 C128,32.7414504 127.917877,32.0916738 127.763157,31.4706493 L94.2292399,65.0045665 C94.3188145,65.0797417 94.4058701,65.1594458 94.4901021,65.2436778 L127.903244,98.6568194 Z M0.205060636,99.2178117 C0.0709009529,98.6370366 0,98.0320192 0,97.4103789 L0,33.410481 C0,32.694007 0.0944223363,31.9995312 0.27147538,31.3387595 L0.27147538,31.3387595 L34.1777941,65.2450783 L0.205060636,99.2178117 L0.205060636,99.2178117 Z M5.92934613,25.6829218 C6.59211333,25.5051988 7.28862283,25.4104299 8.00697327,25.4104299 L119.993027,25.4104299 C120.759109,25.4104299 121.500064,25.5178649 122.201605,25.7184927 L122.201605,25.7184927 L64.0832611,83.8368368 L5.92934613,25.6829218 L5.92934613,25.6829218 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/menu-button": {
"title": "$:/core/images/menu-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-menu-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <rect x=\"0\" y=\"16\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"0\" y=\"56\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"0\" y=\"96\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n</svg>"
},
"$:/core/images/mono-block": {
"title": "$:/core/images/mono-block",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-mono-block tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M23.9653488,32.9670593 L24.3217888,32.9670593 C25.0766067,32.9670593 25.6497006,33.1592554 26.0410876,33.5436534 C26.4324747,33.9280514 26.6281653,34.4906619 26.6281653,35.2315017 C26.6281653,36.0562101 26.4219913,36.6502709 26.009637,37.0137017 C25.5972828,37.3771326 24.9158602,37.5588453 23.9653488,37.5588453 L17.6542639,37.5588453 C16.6897744,37.5588453 16.0048573,37.380627 15.5994921,37.0241852 C15.1941269,36.6677435 14.9914474,36.0701882 14.9914474,35.2315017 C14.9914474,34.4207713 15.1941269,33.8406885 15.5994921,33.4912358 C16.0048573,33.141783 16.6897744,32.9670593 17.6542639,32.9670593 L18.388111,32.9670593 L17.5284616,30.5139133 L8.47069195,30.5139133 L7.5691084,32.9670593 L8.30295547,32.9670593 C9.25346691,32.9670593 9.93488953,33.1452775 10.3472438,33.5017193 C10.759598,33.8581611 10.965772,34.4347494 10.965772,35.2315017 C10.965772,36.0562101 10.759598,36.6502709 10.3472438,37.0137017 C9.93488953,37.3771326 9.25346691,37.5588453 8.30295547,37.5588453 L2.89345418,37.5588453 C1.92896463,37.5588453 1.24404754,37.3771326 0.838682371,37.0137017 C0.433317198,36.6502709 0.230637652,36.0562101 0.230637652,35.2315017 C0.230637652,34.4906619 0.426328248,33.9280514 0.817715312,33.5436534 C1.20910238,33.1592554 1.78219626,32.9670593 2.53701417,32.9670593 L2.89345418,32.9670593 L8.51262607,17.3256331 L6.83526132,17.3256331 C5.88474988,17.3256331 5.20332727,17.1439204 4.79097304,16.7804895 C4.37861882,16.4170587 4.1724448,15.8299869 4.1724448,15.0192565 C4.1724448,14.1945481 4.37861882,13.6004873 4.79097304,13.2370565 C5.20332727,12.8736257 5.88474988,12.691913 6.83526132,12.691913 L14.6979086,12.691913 C15.9419603,12.691913 16.815579,13.3628521 17.318791,14.7047506 L17.318791,14.7676518 L23.9653488,32.9670593 Z M12.9786097,17.3256331 L9.9383861,26.1737321 L16.0188333,26.1737321 L12.9786097,17.3256331 Z M35.3809383,26.6979086 L35.3809383,33.0928616 L38.5259972,33.0928616 C40.7485166,33.0928616 42.3140414,32.8482484 43.2226185,32.3590146 C44.1311956,31.8697807 44.5854773,31.0520736 44.5854773,29.9058686 C44.5854773,28.7456855 44.1521624,27.9209895 43.2855197,27.4317556 C42.4188769,26.9425218 40.9022748,26.6979086 38.7356678,26.6979086 L35.3809383,26.6979086 Z M46.0741385,24.370565 C47.5977525,24.9296893 48.7159844,25.6949794 49.428868,26.666458 C50.1417516,27.6379366 50.498188,28.8784752 50.498188,30.388111 C50.498188,31.6601189 50.1906743,32.8202846 49.5756374,33.8686428 C48.9606006,34.917001 48.0799929,35.7766419 46.933788,36.4475911 C46.2628387,36.8389782 45.5115266,37.1220307 44.6798291,37.296757 C43.8481316,37.4714834 42.6704935,37.5588453 41.1468796,37.5588453 L39.3856466,37.5588453 L30.2020747,37.5588453 C29.2795194,37.5588453 28.6190637,37.3771326 28.2206876,37.0137017 C27.8223114,36.6502709 27.6231264,36.0562101 27.6231264,35.2315017 C27.6231264,34.4906619 27.811828,33.9280514 28.189237,33.5436534 C28.5666459,33.1592554 29.118773,32.9670593 29.8456347,32.9670593 L30.2020747,32.9670593 L30.2020747,17.3256331 L29.8456347,17.3256331 C29.118773,17.3256331 28.5666459,17.1299425 28.189237,16.7385554 C27.811828,16.3471683 27.6231264,15.7740744 27.6231264,15.0192565 C27.6231264,14.2085262 27.8258059,13.6179599 28.2311711,13.24754 C28.6365363,12.8771201 29.2934976,12.691913 30.2020747,12.691913 L39.8469219,12.691913 C42.796303,12.691913 45.0362615,13.2650068 46.5668644,14.4112118 C48.0974674,15.5574168 48.8627574,17.2347648 48.8627574,19.443306 C48.8627574,20.5335986 48.6286276,21.4945792 48.1603609,22.3262767 C47.6920943,23.1579742 46.9966938,23.8393968 46.0741385,24.370565 L46.0741385,24.370565 Z M35.3809383,17.1998307 L35.3809383,22.4835296 L38.2114913,22.4835296 C39.9307988,22.4835296 41.1433816,22.2808501 41.8492761,21.8754849 C42.5551706,21.4701197 42.9081126,20.7852027 42.9081126,19.8207131 C42.9081126,18.912136 42.5901154,18.2481858 41.9541114,17.8288425 C41.3181074,17.4094992 40.2872373,17.1998307 38.8614701,17.1998307 L35.3809383,17.1998307 Z M71.244119,13.3838259 C71.5236812,12.880614 71.8102281,12.5241775 72.1037684,12.3145059 C72.3973087,12.1048342 72.7677231,12 73.2150226,12 C73.8999499,12 74.3856819,12.1817127 74.6722332,12.5451435 C74.9587844,12.9085744 75.1020579,13.5305909 75.1020579,14.4112118 L75.143992,19.8626472 C75.143992,20.8271368 74.9867406,21.4771091 74.6722332,21.8125837 C74.3577257,22.1480584 73.7881263,22.3157932 72.9634178,22.3157932 C72.3763372,22.3157932 71.92555,22.1760142 71.6110425,21.896452 C71.2965351,21.6168898 71.0274605,21.0997075 70.8038107,20.3448896 C70.4403799,19.0169692 69.8602971,18.0629775 69.0635448,17.482886 C68.2667926,16.9027945 67.1625385,16.612753 65.7507494,16.612753 C63.5981206,16.612753 61.9487284,17.3396038 60.8025235,18.7933272 C59.6563185,20.2470506 59.0832246,22.3507245 59.0832246,25.104412 C59.0832246,27.8441215 59.6633074,29.9477954 60.8234905,31.4154969 C61.9836736,32.8831984 63.6400547,33.6170381 65.7926836,33.6170381 C67.2603851,33.6170381 68.878327,33.1278116 70.6465578,32.149344 C72.4147886,31.1708763 73.5295261,30.6816498 73.9908037,30.6816498 C74.53595,30.6816498 74.9937262,30.9122852 75.3641461,31.3735628 C75.734566,31.8348404 75.9197732,32.4079343 75.9197732,33.0928616 C75.9197732,34.3229353 74.836486,35.4831009 72.669879,36.5733935 C70.5032721,37.663686 68.0641285,38.2088241 65.3523753,38.2088241 C61.6901107,38.2088241 58.7267959,36.9997358 56.4623422,34.5815228 C54.1978885,32.1633099 53.0656786,29.0043046 53.0656786,25.104412 C53.0656786,21.3443006 54.2118664,18.22024 56.5042763,15.7321366 C58.7966863,13.2440331 61.7040894,12 65.226573,12 C66.2190187,12 67.1974717,12.1118232 68.1619613,12.3354729 C69.1264508,12.5591227 70.1538264,12.9085702 71.244119,13.3838259 L71.244119,13.3838259 Z M81.4645862,32.9670593 L81.4645862,17.3256331 L81.1081461,17.3256331 C80.3533282,17.3256331 79.7802344,17.1299425 79.3888473,16.7385554 C78.9974602,16.3471683 78.8017696,15.7740744 78.8017696,15.0192565 C78.8017696,14.2085262 79.0114381,13.6179599 79.4307814,13.24754 C79.8501247,12.8771201 80.5280528,12.691913 81.4645862,12.691913 L85.4063933,12.691913 L86.6434498,12.691913 C89.5648747,12.691913 91.7034933,12.8177141 93.0593699,13.06932 C94.4152465,13.320926 95.5684233,13.740263 96.5189347,14.3273436 C98.210286,15.3337675 99.5067362,16.7699967 100.408324,18.6360743 C101.309912,20.5021519 101.7607,22.6582429 101.7607,25.104412 C101.7607,27.6903623 101.247012,29.9512876 100.219621,31.8872557 C99.1922296,33.8232239 97.7350336,35.2874089 95.8479888,36.2798546 C94.9953241,36.7271541 93.9959043,37.0521403 92.8496993,37.2548229 C91.7034944,37.4575055 89.9981906,37.5588453 87.7337369,37.5588453 L85.4063933,37.5588453 L81.4645862,37.5588453 C80.5000966,37.5588453 79.8151795,37.380627 79.4098143,37.0241852 C79.0044492,36.6677435 78.8017696,36.0701882 78.8017696,35.2315017 C78.8017696,34.4906619 78.9974602,33.9280514 79.3888473,33.5436534 C79.7802344,33.1592554 80.3533282,32.9670593 81.1081461,32.9670593 L81.4645862,32.9670593 Z M86.8740874,17.2417648 L86.8740874,32.9670593 L88.0692098,32.9670593 C90.7110725,32.9670593 92.6609895,32.3205814 93.9190194,31.0276063 C95.1770492,29.7346312 95.8060547,27.7462749 95.8060547,25.0624779 C95.8060547,22.4206153 95.1665658,20.4497314 93.8875688,19.1497672 C92.6085718,17.849803 90.6831161,17.1998307 88.1111439,17.1998307 C87.7756693,17.1998307 87.5205727,17.2033252 87.3458463,17.2103142 C87.1711199,17.2173033 87.0138685,17.2277867 86.8740874,17.2417648 L86.8740874,17.2417648 Z M121.94052,17.1159625 L112.190837,17.1159625 L112.190837,22.4835296 L115.88104,22.4835296 L115.88104,22.2319249 C115.88104,21.4351727 116.055763,20.841112 116.405216,20.4497249 C116.754669,20.0583378 117.285829,19.8626472 117.998713,19.8626472 C118.627728,19.8626472 119.141415,20.0408655 119.539792,20.3973072 C119.938168,20.753749 120.137353,21.2045363 120.137353,21.7496826 C120.137353,21.7776388 120.144342,21.8684951 120.15832,22.0222543 C120.172298,22.1760135 120.179287,22.3297704 120.179287,22.4835296 L120.179287,26.8237109 C120.179287,27.7602442 120.011552,28.4311834 119.676077,28.8365486 C119.340603,29.2419138 118.795465,29.4445933 118.040647,29.4445933 C117.327763,29.4445933 116.789614,29.2558917 116.426183,28.8784827 C116.062752,28.5010738 115.88104,27.9419578 115.88104,27.201118 L115.88104,26.8237109 L112.190837,26.8237109 L112.190837,33.0928616 L121.94052,33.0928616 L121.94052,30.5977816 C121.94052,29.6612482 122.118738,28.9903091 122.47518,28.5849439 C122.831622,28.1795787 123.415199,27.9768992 124.225929,27.9768992 C125.022682,27.9768992 125.592281,28.1760842 125.934745,28.5744604 C126.277208,28.9728365 126.448438,29.6472701 126.448438,30.5977816 L126.448438,35.6718099 C126.448438,36.4266278 126.30167,36.9298322 126.008129,37.1814382 C125.714589,37.4330442 125.134506,37.5588453 124.267863,37.5588453 L107.095842,37.5588453 C106.173287,37.5588453 105.512831,37.3771326 105.114455,37.0137017 C104.716079,36.6502709 104.516894,36.0562101 104.516894,35.2315017 C104.516894,34.4906619 104.705595,33.9280514 105.083004,33.5436534 C105.460413,33.1592554 106.01254,32.9670593 106.739402,32.9670593 L107.095842,32.9670593 L107.095842,17.3256331 L106.739402,17.3256331 C106.026518,17.3256331 105.477886,17.126448 105.093488,16.7280719 C104.70909,16.3296957 104.516894,15.7600963 104.516894,15.0192565 C104.516894,14.2085262 104.719573,13.6179599 105.124938,13.24754 C105.530304,12.8771201 106.187265,12.691913 107.095842,12.691913 L124.267863,12.691913 C125.120528,12.691913 125.697116,12.8212085 125.997646,13.0798036 C126.298175,13.3383986 126.448438,13.8520864 126.448438,14.6208824 L126.448438,19.3175037 C126.448438,20.2680151 126.273714,20.9494377 125.924261,21.361792 C125.574808,21.7741462 125.008703,21.9803202 124.225929,21.9803202 C123.415199,21.9803202 122.831622,21.7706517 122.47518,21.3513084 C122.118738,20.9319652 121.94052,20.254037 121.94052,19.3175037 L121.94052,17.1159625 Z M19.7719369,47.6405477 C20.037521,47.1373358 20.3205734,46.7808993 20.6211028,46.5712277 C20.9216322,46.361556 21.295541,46.2567218 21.7428405,46.2567218 C22.4277678,46.2567218 22.9134998,46.4384345 23.2000511,46.8018653 C23.4866023,47.1652962 23.6298758,47.7873127 23.6298758,48.6679336 L23.6718099,54.119369 C23.6718099,55.0838586 23.5145586,55.7338309 23.2000511,56.0693055 C22.8855436,56.4047802 22.3089553,56.572515 21.4702687,56.572515 C20.8831881,56.572515 20.4254119,56.4292415 20.0969263,56.1426902 C19.7684407,55.856139 19.4993662,55.3424512 19.2896945,54.6016114 C18.9122856,53.2597129 18.3322027,52.3022267 17.5494286,51.7291243 C16.7666545,51.1560218 15.6693894,50.8694748 14.2576003,50.8694748 C12.1049715,50.8694748 10.4590738,51.5963256 9.31985785,53.050049 C8.18064193,54.5037724 7.61104252,56.6074463 7.61104252,59.3611338 C7.61104252,62.1148214 8.20859773,64.2429566 9.40372609,65.7456034 C10.5988544,67.2482501 12.2936748,67.9995623 14.488238,67.9995623 C14.9914499,67.9995623 15.5645438,67.9401562 16.2075368,67.8213423 C16.8505299,67.7025283 17.6053364,67.5173212 18.4719792,67.2657152 L18.4719792,63.9529198 L16.1027015,63.9529198 C15.1521901,63.9529198 14.4777564,63.7781961 14.0793803,63.4287433 C13.6810042,63.0792906 13.4818191,62.4992078 13.4818191,61.6884774 C13.4818191,60.8497908 13.6810042,60.2522356 14.0793803,59.8957938 C14.4777564,59.5393521 15.1521901,59.3611338 16.1027015,59.3611338 L23.6718099,59.3611338 C24.6502776,59.3611338 25.3386891,59.5358576 25.7370653,59.8853103 C26.1354414,60.2347631 26.3346265,60.8218348 26.3346265,61.6465433 C26.3346265,62.3873831 26.1354414,62.9569825 25.7370653,63.3553586 C25.3386891,63.7537347 24.7621008,63.9529198 24.0072829,63.9529198 L23.6718099,63.9529198 L23.6718099,68.9430799 L23.6718099,69.1946846 C23.6718099,69.6419841 23.6228873,69.9529924 23.5250405,70.1277188 C23.4271937,70.3024451 23.2315031,70.4806634 22.9379628,70.6623788 C22.1412106,71.1376345 20.8762107,71.5569715 19.1429251,71.9204023 C17.4096396,72.2838332 15.6554131,72.4655459 13.8801932,72.4655459 C10.2179286,72.4655459 7.25461383,71.2564576 4.99016011,68.8382446 C2.72570638,66.4200317 1.59349651,63.2610264 1.59349651,59.3611338 C1.59349651,55.6010224 2.73968428,52.4769618 5.03209423,49.9888583 C7.32450417,47.5007549 10.2319073,46.2567218 13.7543909,46.2567218 C14.7328585,46.2567218 15.7078171,46.368545 16.6792957,46.5921947 C17.6507743,46.8158445 18.6816444,47.165292 19.7719369,47.6405477 L19.7719369,47.6405477 Z M35.611576,51.5823548 L35.611576,56.4047785 L42.4678043,56.4047785 L42.4678043,51.5823548 L42.1323314,51.5823548 C41.3775135,51.5823548 40.8009251,51.3866642 40.402549,50.9952772 C40.0041729,50.6038901 39.8049878,50.0307962 39.8049878,49.2759783 C39.8049878,48.4512699 40.0111618,47.8572091 40.4235161,47.4937783 C40.8358703,47.1303474 41.5172929,46.9486347 42.4678043,46.9486347 L47.8773056,46.9486347 C48.8278171,46.9486347 49.5022507,47.1303474 49.9006269,47.4937783 C50.299003,47.8572091 50.498188,48.4512699 50.498188,49.2759783 C50.498188,50.0307962 50.3059919,50.6038901 49.9215939,50.9952772 C49.5371959,51.3866642 48.9745854,51.5823548 48.2337456,51.5823548 L47.8773056,51.5823548 L47.8773056,67.2237811 L48.2337456,67.2237811 C48.9885636,67.2237811 49.5616574,67.4159772 49.9530445,67.8003752 C50.3444316,68.1847732 50.5401222,68.7473837 50.5401222,69.4882235 C50.5401222,70.3129319 50.3374426,70.9069927 49.9320774,71.2704235 C49.5267123,71.6338543 48.8417952,71.815567 47.8773056,71.815567 L42.4678043,71.815567 C41.5033148,71.815567 40.8183977,71.6373488 40.4130325,71.280907 C40.0076674,70.9244652 39.8049878,70.32691 39.8049878,69.4882235 C39.8049878,68.7473837 40.0041729,68.1847732 40.402549,67.8003752 C40.8009251,67.4159772 41.3775135,67.2237811 42.1323314,67.2237811 L42.4678043,67.2237811 L42.4678043,61.0384986 L35.611576,61.0384986 L35.611576,67.2237811 L35.9470489,67.2237811 C36.7018668,67.2237811 37.2784552,67.4159772 37.6768313,67.8003752 C38.0752074,68.1847732 38.2743925,68.7473837 38.2743925,69.4882235 C38.2743925,70.3129319 38.0682185,70.9069927 37.6558642,71.2704235 C37.24351,71.6338543 36.5620874,71.815567 35.611576,71.815567 L30.2020747,71.815567 C29.2375851,71.815567 28.552668,71.6373488 28.1473029,71.280907 C27.7419377,70.9244652 27.5392581,70.32691 27.5392581,69.4882235 C27.5392581,68.7473837 27.7349487,68.1847732 28.1263358,67.8003752 C28.5177229,67.4159772 29.0908168,67.2237811 29.8456347,67.2237811 L30.2020747,67.2237811 L30.2020747,51.5823548 L29.8456347,51.5823548 C29.1047949,51.5823548 28.5421844,51.3866642 28.1577864,50.9952772 C27.7733884,50.6038901 27.5811923,50.0307962 27.5811923,49.2759783 C27.5811923,48.4512699 27.7803773,47.8572091 28.1787534,47.4937783 C28.5771296,47.1303474 29.2515632,46.9486347 30.2020747,46.9486347 L35.611576,46.9486347 C36.5481093,46.9486347 37.2260374,47.1303474 37.6453807,47.4937783 C38.064724,47.8572091 38.2743925,48.4512699 38.2743925,49.2759783 C38.2743925,50.0307962 38.0752074,50.6038901 37.6768313,50.9952772 C37.2784552,51.3866642 36.7018668,51.5823548 35.9470489,51.5823548 L35.611576,51.5823548 Z M67.365213,51.5823548 L67.365213,67.2237811 L70.887679,67.2237811 C71.8381904,67.2237811 72.519613,67.4019993 72.9319673,67.7584411 C73.3443215,68.1148829 73.5504955,68.6914712 73.5504955,69.4882235 C73.5504955,70.2989538 73.340827,70.8895201 72.9214837,71.25994 C72.5021404,71.6303599 71.8242123,71.815567 70.887679,71.815567 L58.4332458,71.815567 C57.4827343,71.815567 56.8013117,71.6338543 56.3889575,71.2704235 C55.9766033,70.9069927 55.7704292,70.3129319 55.7704292,69.4882235 C55.7704292,68.6774931 55.9731088,68.0974103 56.378474,67.7479575 C56.7838391,67.3985048 57.4687562,67.2237811 58.4332458,67.2237811 L61.9557117,67.2237811 L61.9557117,51.5823548 L58.4332458,51.5823548 C57.4827343,51.5823548 56.8013117,51.4006421 56.3889575,51.0372113 C55.9766033,50.6737805 55.7704292,50.0867087 55.7704292,49.2759783 C55.7704292,48.4512699 55.9731088,47.8641981 56.378474,47.5147453 C56.7838391,47.1652926 57.4687562,46.9905689 58.4332458,46.9905689 L70.887679,46.9905689 C71.8801247,46.9905689 72.5720308,47.1652926 72.9634178,47.5147453 C73.3548049,47.8641981 73.5504955,48.4512699 73.5504955,49.2759783 C73.5504955,50.0867087 73.347816,50.6737805 72.9424508,51.0372113 C72.5370856,51.4006421 71.8521685,51.5823548 70.887679,51.5823548 L67.365213,51.5823548 Z M97.8608265,51.5823548 L97.8608265,63.1771386 L97.8608265,63.5755127 C97.8608265,65.4485794 97.7385199,66.8044357 97.493903,67.6431222 C97.2492861,68.4818088 96.8404325,69.2296264 96.26733,69.8865976 C95.5264902,70.7392623 94.4991146,71.3822457 93.1851723,71.815567 C91.87123,72.2488884 90.2917273,72.4655459 88.4466169,72.4655459 C87.1466527,72.4655459 85.8921362,72.3397448 84.6830298,72.0881388 C83.4739233,71.8365328 82.3102631,71.4591296 81.1920144,70.9559176 C80.5769776,70.6763554 80.175113,70.31293 79.9864085,69.8656305 C79.797704,69.418331 79.7033532,68.6914802 79.7033532,67.6850564 L79.7033532,63.3658422 C79.7033532,62.1637247 79.8780769,61.3250508 80.2275297,60.849795 C80.5769824,60.3745393 81.185021,60.136915 82.0516638,60.136915 C83.2957156,60.136915 83.9806326,61.0524675 84.1064356,62.8835998 C84.1204137,63.2050963 84.1413806,63.4497096 84.1693368,63.6174469 C84.3370741,65.2389076 84.7144774,66.3466561 85.301558,66.9407258 C85.8886386,67.5347954 86.8251579,67.8318258 88.1111439,67.8318258 C89.7046484,67.8318258 90.8263749,67.4089943 91.476357,66.5633187 C92.126339,65.7176431 92.4513252,64.1765796 92.4513252,61.9400821 L92.4513252,51.5823548 L88.9288593,51.5823548 C87.9783478,51.5823548 87.2969252,51.4006421 86.884571,51.0372113 C86.4722168,50.6737805 86.2660427,50.0867087 86.2660427,49.2759783 C86.2660427,48.4512699 86.4652278,47.8641981 86.8636039,47.5147453 C87.26198,47.1652926 87.9503916,46.9905689 88.9288593,46.9905689 L99.6220595,46.9905689 C100.600527,46.9905689 101.288939,47.1652926 101.687315,47.5147453 C102.085691,47.8641981 102.284876,48.4512699 102.284876,49.2759783 C102.284876,50.0867087 102.078702,50.6737805 101.666348,51.0372113 C101.253994,51.4006421 100.572571,51.5823548 99.6220595,51.5823548 L97.8608265,51.5823548 Z M112.505343,51.5823548 L112.505343,57.9353738 L118.984165,51.4565525 C118.257303,51.3726838 117.747109,51.1665098 117.453569,50.8380242 C117.160029,50.5095387 117.013261,49.9888619 117.013261,49.2759783 C117.013261,48.4512699 117.212446,47.8572091 117.610822,47.4937783 C118.009198,47.1303474 118.683632,46.9486347 119.634143,46.9486347 L124.771073,46.9486347 C125.721584,46.9486347 126.396018,47.1303474 126.794394,47.4937783 C127.19277,47.8572091 127.391955,48.4512699 127.391955,49.2759783 C127.391955,50.0447743 127.19277,50.6213627 126.794394,51.0057607 C126.396018,51.3901587 125.812441,51.5823548 125.043645,51.5823548 L124.561402,51.5823548 L118.459988,57.641835 C119.592215,58.4805215 120.626579,59.5812811 121.563113,60.9441468 C122.499646,62.3070125 123.596911,64.400203 124.854941,67.2237811 L125.127513,67.2237811 L125.546854,67.2237811 C126.371563,67.2237811 126.98659,67.4124827 127.391955,67.7898917 C127.79732,68.1673006 128,68.7334056 128,69.4882235 C128,70.3129319 127.793826,70.9069927 127.381472,71.2704235 C126.969118,71.6338543 126.287695,71.815567 125.337183,71.815567 L122.758235,71.815567 C121.626008,71.815567 120.710456,71.0537715 120.01155,69.5301576 C119.885747,69.2505954 119.787902,69.026949 119.718012,68.8592117 C118.795456,66.9022764 117.949793,65.3926632 117.180997,64.3303269 C116.412201,63.2679906 115.510627,62.2965265 114.476247,61.4159056 L112.505343,63.302941 L112.505343,67.2237811 L112.840816,67.2237811 C113.595634,67.2237811 114.172222,67.4159772 114.570599,67.8003752 C114.968975,68.1847732 115.16816,68.7473837 115.16816,69.4882235 C115.16816,70.3129319 114.961986,70.9069927 114.549631,71.2704235 C114.137277,71.6338543 113.455855,71.815567 112.505343,71.815567 L107.095842,71.815567 C106.131352,71.815567 105.446435,71.6373488 105.04107,71.280907 C104.635705,70.9244652 104.433025,70.32691 104.433025,69.4882235 C104.433025,68.7473837 104.628716,68.1847732 105.020103,67.8003752 C105.41149,67.4159772 105.984584,67.2237811 106.739402,67.2237811 L107.095842,67.2237811 L107.095842,51.5823548 L106.739402,51.5823548 C105.998562,51.5823548 105.435952,51.3866642 105.051554,50.9952772 C104.667156,50.6038901 104.474959,50.0307962 104.474959,49.2759783 C104.474959,48.4512699 104.674145,47.8572091 105.072521,47.4937783 C105.470897,47.1303474 106.14533,46.9486347 107.095842,46.9486347 L112.505343,46.9486347 C113.441877,46.9486347 114.119805,47.1303474 114.539148,47.4937783 C114.958491,47.8572091 115.16816,48.4512699 115.16816,49.2759783 C115.16816,50.0307962 114.968975,50.6038901 114.570599,50.9952772 C114.172222,51.3866642 113.595634,51.5823548 112.840816,51.5823548 L112.505343,51.5823548 Z M13.439885,96.325622 L17.4445933,84.4372993 C17.6961993,83.6545252 18.0456468,83.0849258 18.4929463,82.728484 C18.9402458,82.3720422 19.5343065,82.193824 20.2751463,82.193824 L23.5460076,82.193824 C24.496519,82.193824 25.1779416,82.3755367 25.5902958,82.7389675 C26.0026501,83.1023984 26.2088241,83.6964591 26.2088241,84.5211676 C26.2088241,85.2759855 26.009639,85.8490794 25.6112629,86.2404664 C25.2128868,86.6318535 24.6362984,86.8275441 23.8814805,86.8275441 L23.5460076,86.8275441 L24.1330852,102.46897 L24.4895252,102.46897 C25.2443431,102.46897 25.8104481,102.661166 26.187857,103.045564 C26.565266,103.429962 26.7539676,103.992573 26.7539676,104.733413 C26.7539676,105.558121 26.5547826,106.152182 26.1564064,106.515613 C25.7580303,106.879044 25.0835967,107.060756 24.1330852,107.060756 L19.4154969,107.060756 C18.4649855,107.060756 17.7905518,106.882538 17.3921757,106.526096 C16.9937996,106.169654 16.7946145,105.572099 16.7946145,104.733413 C16.7946145,103.992573 16.9868106,103.429962 17.3712086,103.045564 C17.7556066,102.661166 18.325206,102.46897 19.0800239,102.46897 L19.4154969,102.46897 L19.1219581,89.6790642 L16.0607674,99.1981091 C15.8371177,99.9109927 15.5191204,100.42468 15.1067662,100.739188 C14.694412,101.053695 14.1248126,101.210947 13.3979509,101.210947 C12.6710892,101.210947 12.0945008,101.053695 11.6681685,100.739188 C11.2418362,100.42468 10.91685,99.9109927 10.6932002,99.1981091 L7.65297664,89.6790642 L7.35943781,102.46897 L7.69491075,102.46897 C8.44972866,102.46897 9.01932808,102.661166 9.40372609,103.045564 C9.78812409,103.429962 9.98032022,103.992573 9.98032022,104.733413 C9.98032022,105.558121 9.77764067,106.152182 9.3722755,106.515613 C8.96691032,106.879044 8.29597114,107.060756 7.35943781,107.060756 L2.62088241,107.060756 C1.68434908,107.060756 1.01340989,106.879044 0.608044719,106.515613 C0.202679546,106.152182 0,105.558121 0,104.733413 C0,103.992573 0.192196121,103.429962 0.57659413,103.045564 C0.960992139,102.661166 1.53059155,102.46897 2.28540946,102.46897 L2.62088241,102.46897 L3.22892713,86.8275441 L2.89345418,86.8275441 C2.13863627,86.8275441 1.56204791,86.6318535 1.16367179,86.2404664 C0.765295672,85.8490794 0.5661106,85.2759855 0.5661106,84.5211676 C0.5661106,83.6964591 0.772284622,83.1023984 1.18463885,82.7389675 C1.59699308,82.3755367 2.27841569,82.193824 3.22892713,82.193824 L6.49978838,82.193824 C7.22665007,82.193824 7.81022738,82.3685477 8.25053783,82.7180005 C8.69084827,83.0674532 9.05077919,83.6405471 9.33034138,84.4372993 L13.439885,96.325622 Z M43.8935644,98.3803938 L43.8935644,86.8275441 L42.7403761,86.8275441 C41.8178209,86.8275441 41.1573651,86.6458314 40.758989,86.2824006 C40.3606129,85.9189697 40.1614278,85.3318979 40.1614278,84.5211676 C40.1614278,83.7104372 40.3606129,83.119871 40.758989,82.7494511 C41.1573651,82.3790312 41.8178209,82.193824 42.7403761,82.193824 L48.6950209,82.193824 C49.6035981,82.193824 50.2605593,82.3790312 50.6659245,82.7494511 C51.0712897,83.119871 51.2739692,83.7104372 51.2739692,84.5211676 C51.2739692,85.2620074 51.0817731,85.8316068 50.6973751,86.2299829 C50.3129771,86.628359 49.7643445,86.8275441 49.051461,86.8275441 L48.6950209,86.8275441 L48.6950209,105.865634 C48.6950209,106.522605 48.6251315,106.934953 48.4853504,107.10269 C48.3455693,107.270428 48.0310665,107.354295 47.5418327,107.354295 L45.4451268,107.354295 C44.7741775,107.354295 44.3024234,107.284406 44.0298503,107.144625 C43.7572771,107.004843 43.5231473,106.76023 43.3274538,106.410777 L34.6051571,91.0838571 L34.6051571,102.46897 L35.8212466,102.46897 C36.7298237,102.46897 37.379796,102.643694 37.7711831,102.993147 C38.1625701,103.3426 38.3582607,103.922682 38.3582607,104.733413 C38.3582607,105.558121 38.1590757,106.152182 37.7606995,106.515613 C37.3623234,106.879044 36.7158456,107.060756 35.8212466,107.060756 L29.8037005,107.060756 C28.8951234,107.060756 28.2381621,106.879044 27.832797,106.515613 C27.4274318,106.152182 27.2247522,105.558121 27.2247522,104.733413 C27.2247522,103.992573 27.4134539,103.429962 27.7908629,103.045564 C28.1682718,102.661166 28.7273878,102.46897 29.4682276,102.46897 L29.8037005,102.46897 L29.8037005,86.8275441 L29.4682276,86.8275441 C28.755344,86.8275441 28.203217,86.628359 27.8118299,86.2299829 C27.4204428,85.8316068 27.2247522,85.2620074 27.2247522,84.5211676 C27.2247522,83.7104372 27.4309263,83.119871 27.8432805,82.7494511 C28.2556347,82.3790312 28.9091015,82.193824 29.8037005,82.193824 L33.2422983,82.193824 C34.0670067,82.193824 34.6261227,82.3021527 34.919663,82.5188134 C35.2132033,82.7354741 35.5416839,83.1722835 35.9051148,83.8292546 L43.8935644,98.3803938 Z M64.6604624,86.3662688 C62.8572863,86.3662688 61.4420239,87.0931196 60.4146329,88.546843 C59.3872418,90.0005663 58.873554,92.0203728 58.873554,94.6063231 C58.873554,97.1922733 59.3907363,99.2190688 60.4251164,100.68677 C61.4594965,102.154472 62.8712644,102.888312 64.6604624,102.888312 C66.4636385,102.888312 67.8823953,102.157966 68.9167754,100.697254 C69.9511555,99.2365414 70.4683378,97.2062514 70.4683378,94.6063231 C70.4683378,92.0203728 69.95465,90.0005663 68.9272589,88.546843 C67.8998679,87.0931196 66.4776166,86.3662688 64.6604624,86.3662688 L64.6604624,86.3662688 Z M64.6604624,81.501911 C68.0990773,81.501911 70.929602,82.7319662 73.1521214,85.1921135 C75.3746408,87.6522607 76.4858838,90.7902992 76.4858838,94.6063231 C76.4858838,98.4503032 75.3816297,101.595331 73.1730884,104.0415 C70.9645471,106.487669 68.1270335,107.710735 64.6604624,107.710735 C61.2358256,107.710735 58.4053009,106.477185 56.1688034,104.010049 C53.9323059,101.542913 52.8140739,98.4083688 52.8140739,94.6063231 C52.8140739,90.7763211 53.9218224,87.6347881 56.1373528,85.1816299 C58.3528831,82.7284717 61.1938912,81.501911 64.6604624,81.501911 L64.6604624,81.501911 Z M87.4611651,98.1707232 L87.4611651,102.46897 L89.6207722,102.46897 C90.5293493,102.46897 91.1758272,102.643694 91.5602252,102.993147 C91.9446232,103.3426 92.1368193,103.922682 92.1368193,104.733413 C92.1368193,105.558121 91.9411287,106.152182 91.5497417,106.515613 C91.1583546,106.879044 90.5153712,107.060756 89.6207722,107.060756 L82.3661697,107.060756 C81.4436145,107.060756 80.7831587,106.879044 80.3847826,106.515613 C79.9864065,106.152182 79.7872214,105.558121 79.7872214,104.733413 C79.7872214,103.992573 79.9759231,103.429962 80.353332,103.045564 C80.730741,102.661166 81.282868,102.46897 82.0097297,102.46897 L82.3661697,102.46897 L82.3661697,86.8275441 L82.0097297,86.8275441 C81.2968461,86.8275441 80.7482136,86.628359 80.3638155,86.2299829 C79.9794175,85.8316068 79.7872214,85.2620074 79.7872214,84.5211676 C79.7872214,83.7104372 79.989901,83.119871 80.3952661,82.7494511 C80.8006313,82.3790312 81.4575926,82.193824 82.3661697,82.193824 L91.0255652,82.193824 C94.450202,82.193824 97.0396079,82.8507853 98.7938606,84.1647276 C100.548113,85.4786699 101.425227,87.414609 101.425227,89.972603 C101.425227,92.6703781 100.551608,94.7111515 98.8043442,96.0949843 C97.0570805,97.4788171 94.4641801,98.1707232 91.0255652,98.1707232 L87.4611651,98.1707232 Z M87.4611651,86.8275441 L87.4611651,93.4531348 L90.4384875,93.4531348 C92.0879044,93.4531348 93.328443,93.1735768 94.1601405,92.6144525 C94.9918381,92.0553281 95.4076806,91.2166541 95.4076806,90.0984053 C95.4076806,89.0500471 94.9778602,88.2428234 94.1182064,87.67671 C93.2585527,87.1105966 92.031992,86.8275441 90.4384875,86.8275441 L87.4611651,86.8275441 Z M114.727851,107.396229 L113.092421,109.03166 C113.69348,108.835966 114.284046,108.689198 114.864137,108.591352 C115.444229,108.493505 116.013828,108.444582 116.572953,108.444582 C117.677223,108.444582 118.840883,108.608823 120.063968,108.937308 C121.287053,109.265794 122.031376,109.430034 122.29696,109.430034 C122.744259,109.430034 123.327837,109.279772 124.047709,108.979242 C124.767582,108.678713 125.253314,108.52845 125.50492,108.52845 C126.02211,108.52845 126.45193,108.727636 126.794394,109.126012 C127.136858,109.524388 127.308087,110.024098 127.308087,110.625156 C127.308087,111.421909 126.836333,112.099837 125.892811,112.658961 C124.949288,113.218086 123.792617,113.497643 122.422762,113.497643 C121.486229,113.497643 120.28413,113.277492 118.816428,112.837181 C117.348727,112.396871 116.286406,112.176719 115.629435,112.176719 C114.636989,112.176719 113.518757,112.449288 112.274706,112.994434 C111.030654,113.53958 110.261869,113.812149 109.968329,113.812149 C109.36727,113.812149 108.857077,113.612964 108.437734,113.214588 C108.01839,112.816212 107.808722,112.337469 107.808722,111.778345 C107.808722,111.386958 107.941512,110.971115 108.207096,110.530805 C108.47268,110.090494 108.94094,109.520895 109.611889,108.821989 L111.729562,106.683349 C109.395218,105.830685 107.536157,104.29661 106.152324,102.08108 C104.768491,99.8655494 104.076585,97.3180772 104.076585,94.4385866 C104.076585,90.6365409 105.180839,87.5299526 107.389381,85.1187288 C109.597922,82.7075049 112.442425,81.501911 115.922974,81.501911 C119.389545,81.501911 122.227059,82.7109994 124.4356,85.1292123 C126.644141,87.5474252 127.748395,90.650519 127.748395,94.4385866 C127.748395,98.2126762 126.65113,101.322759 124.456567,103.768928 C122.262004,106.215097 119.480402,107.438163 116.111677,107.438163 C115.888028,107.438163 115.660887,107.434669 115.430248,107.42768 C115.199609,107.420691 114.965479,107.410207 114.727851,107.396229 L114.727851,107.396229 Z M115.922974,86.3662688 C114.119798,86.3662688 112.704535,87.0931196 111.677144,88.546843 C110.649753,90.0005663 110.136065,92.0203728 110.136065,94.6063231 C110.136065,97.1922733 110.653248,99.2190688 111.687628,100.68677 C112.722008,102.154472 114.133776,102.888312 115.922974,102.888312 C117.72615,102.888312 119.144907,102.157966 120.179287,100.697254 C121.213667,99.2365414 121.730849,97.2062514 121.730849,94.6063231 C121.730849,92.0203728 121.217161,90.0005663 120.18977,88.546843 C119.162379,87.0931196 117.740128,86.3662688 115.922974,86.3662688 L115.922974,86.3662688 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/mono-line": {
"title": "$:/core/images/mono-line",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-mono-line tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M60.4374591,84.522627 L61.3450888,84.522627 C63.2671377,84.522627 64.7264493,85.0120303 65.7230673,85.9908515 C66.7196852,86.9696727 67.2179868,88.4022896 67.2179868,90.288745 C67.2179868,92.3887615 66.6929905,93.9014625 65.6429823,94.8268935 C64.5929741,95.7523244 62.857817,96.215033 60.4374591,96.215033 L44.3670747,96.215033 C41.9111232,96.215033 40.1670679,95.7612227 39.1348565,94.8535884 C38.102645,93.9459542 37.586547,92.424355 37.586547,90.288745 C37.586547,88.2243221 38.102645,86.747214 39.1348565,85.8573766 C40.1670679,84.9675391 41.9111232,84.522627 44.3670747,84.522627 L46.235724,84.522627 L44.0467348,78.2759992 L20.9822627,78.2759992 L18.6864935,84.522627 L20.5551429,84.522627 C22.9755008,84.522627 24.7106579,84.9764373 25.7606661,85.8840716 C26.8106743,86.7917058 27.3356705,88.2599156 27.3356705,90.288745 C27.3356705,92.3887615 26.8106743,93.9014625 25.7606661,94.8268935 C24.7106579,95.7523244 22.9755008,96.215033 20.5551429,96.215033 L6.78052766,96.215033 C4.32457622,96.215033 2.58052094,95.7523244 1.54830946,94.8268935 C0.516097994,93.9014625 0,92.3887615 0,90.288745 C0,88.4022896 0.498301511,86.9696727 1.49491948,85.9908515 C2.49153745,85.0120303 3.95084902,84.522627 5.87289797,84.522627 L6.78052766,84.522627 L21.0890427,44.6937008 L16.8178442,44.6937008 C14.3974863,44.6937008 12.6623292,44.2309922 11.612321,43.3055613 C10.5623128,42.3801303 10.0373165,40.8852258 10.0373165,38.8208028 C10.0373165,36.7207864 10.5623128,35.2080854 11.612321,34.2826544 C12.6623292,33.3572234 14.3974863,32.8945149 16.8178442,32.8945149 L36.8390873,32.8945149 C40.0069087,32.8945149 42.231469,34.6029772 43.512835,38.0199531 L43.512835,38.180123 L60.4374591,84.522627 Z M32.4611088,44.6937008 L24.7195615,67.224273 L40.2026561,67.224273 L32.4611088,44.6937008 Z M89.5058233,68.5590225 L89.5058233,84.8429669 L97.5143205,84.8429669 C103.173687,84.8429669 107.160099,84.22009 109.473676,82.9743176 C111.787254,81.7285451 112.944025,79.6463566 112.944025,76.7276897 C112.944025,73.7734293 111.840643,71.6734444 109.633846,70.4276719 C107.427049,69.1818994 103.565213,68.5590225 98.0482204,68.5590225 L89.5058233,68.5590225 Z M116.734714,62.6327346 C120.614405,64.0564746 123.461842,66.0051894 125.277111,68.4789376 C127.092379,70.9526857 128,74.1115614 128,77.9556593 C128,81.1946677 127.216955,84.1488838 125.650841,86.8183962 C124.084727,89.4879087 121.84237,91.676876 118.923703,93.385364 C117.215215,94.3819819 115.302093,95.1027395 113.18428,95.5476582 C111.066467,95.9925769 108.06776,96.215033 104.188068,96.215033 L99.7033098,96.215033 L76.3184979,96.215033 C73.9693269,96.215033 72.2875593,95.7523244 71.2731446,94.8268935 C70.2587299,93.9014625 69.7515301,92.3887615 69.7515301,90.288745 C69.7515301,88.4022896 70.2320352,86.9696727 71.1930596,85.9908515 C72.1540841,85.0120303 73.5600062,84.522627 75.4108682,84.522627 L76.3184979,84.522627 L76.3184979,44.6937008 L75.4108682,44.6937008 C73.5600062,44.6937008 72.1540841,44.1953993 71.1930596,43.1987813 C70.2320352,42.2021633 69.7515301,40.7428518 69.7515301,38.8208028 C69.7515301,36.7563799 70.2676281,35.2525771 71.2998396,34.3093494 C72.3320511,33.3661217 74.0049204,32.8945149 76.3184979,32.8945149 L100.877889,32.8945149 C108.388118,32.8945149 114.09189,34.3538264 117.989378,37.2724934 C121.886867,40.1911603 123.835581,44.4623161 123.835581,50.0860889 C123.835581,52.8623819 123.239399,55.3093982 122.047017,57.4272114 C120.854635,59.5450246 119.083885,61.2801816 116.734714,62.6327346 L116.734714,62.6327346 Z M89.5058233,44.3733609 L89.5058233,57.8276363 L96.7134708,57.8276363 C101.091471,57.8276363 104.179161,57.3115383 105.976633,56.2793268 C107.774104,55.2471153 108.672827,53.50306 108.672827,51.0471086 C108.672827,48.7335312 107.863087,47.0428653 106.243583,45.9750604 C104.624078,44.9072554 101.999097,44.3733609 98.3685602,44.3733609 L89.5058233,44.3733609 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/new-button": {
"title": "$:/core/images/new-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-new-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M56,72 L8.00697327,72 C3.59075293,72 0,68.418278 0,64 C0,59.5907123 3.58484404,56 8.00697327,56 L56,56 L56,8.00697327 C56,3.59075293 59.581722,0 64,0 C68.4092877,0 72,3.58484404 72,8.00697327 L72,56 L119.993027,56 C124.409247,56 128,59.581722 128,64 C128,68.4092877 124.415156,72 119.993027,72 L72,72 L72,119.993027 C72,124.409247 68.418278,128 64,128 C59.5907123,128 56,124.415156 56,119.993027 L56,72 L56,72 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/new-here-button": {
"title": "$:/core/images/new-here-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-new-here-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n \t<g transform=\"translate(52.233611, 64.389922) rotate(75.000000) translate(-52.233611, -64.389922) translate(-7.734417, 3.702450)\">\n\t <path d=\"M18.9270186,45.959338 L18.9080585,49.6521741 C18.8884833,53.4648378 21.0574548,58.7482162 23.7526408,61.4434022 L78.5671839,116.257945 C81.2617332,118.952495 85.6348701,118.950391 88.3334363,116.251825 L115.863237,88.7220241 C118.555265,86.0299959 118.564544,81.6509578 115.869358,78.9557717 L61.0548144,24.1412286 C58.3602652,21.4466794 53.0787224,19.2788426 49.2595808,19.3006519 L25.9781737,19.4336012 C22.1633003,19.4553862 19.0471195,22.5673232 19.0275223,26.3842526 L18.9871663,34.2443819 C19.0818862,34.255617 19.1779758,34.2665345 19.2754441,34.2771502 C22.6891275,34.6489512 27.0485594,34.2348566 31.513244,33.2285542 C31.7789418,32.8671684 32.075337,32.5211298 32.4024112,32.1940556 C34.8567584,29.7397084 38.3789778,29.0128681 41.4406288,30.0213822 C41.5958829,29.9543375 41.7503946,29.8866669 41.9041198,29.8183808 L42.1110981,30.2733467 C43.1114373,30.6972371 44.0473796,31.3160521 44.8614145,32.1300869 C48.2842088,35.5528813 48.2555691,41.130967 44.7974459,44.5890903 C41.4339531,47.952583 36.0649346,48.0717177 32.6241879,44.9262969 C27.8170558,45.8919233 23.0726921,46.2881596 18.9270186,45.959338 Z\"></path>\n\t <path d=\"M45.4903462,38.8768094 C36.7300141,42.6833154 26.099618,44.7997354 18.1909048,43.9383587 C7.2512621,42.7468685 1.50150083,35.8404432 4.66865776,24.7010202 C7.51507386,14.6896965 15.4908218,6.92103848 24.3842626,4.38423012 C34.1310219,1.60401701 42.4070208,6.15882777 42.4070209,16.3101169 L34.5379395,16.310117 C34.5379394,11.9285862 31.728784,10.3825286 26.5666962,11.8549876 C20.2597508,13.6540114 14.3453742,19.4148216 12.2444303,26.8041943 C10.4963869,32.9523565 12.6250796,35.5092726 19.0530263,36.2093718 C25.5557042,36.9176104 35.0513021,34.9907189 42.7038419,31.5913902 L42.7421786,31.6756595 C44.3874154,31.5384763 47.8846101,37.3706354 45.9274416,38.6772897 L45.9302799,38.6835285 C45.9166992,38.6895612 45.9031139,38.6955897 45.8895238,38.7016142 C45.8389288,38.7327898 45.7849056,38.7611034 45.7273406,38.7863919 C45.6506459,38.8200841 45.571574,38.8501593 45.4903462,38.8768094 Z\"></path>\n </g>\n <rect x=\"96\" y=\"80\" width=\"16\" height=\"48\" rx=\"8\"></rect>\n <rect x=\"80\" y=\"96\" width=\"48\" height=\"16\" rx=\"8\"></rect>\n </g>\n </g>\n</svg>"
},
"$:/core/images/new-image-button": {
"title": "$:/core/images/new-image-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-new-image-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M81.3619177,73.6270062 L97.1875317,46.2162388 C97.91364,44.9585822 97.4824378,43.3533085 96.2260476,42.6279312 L46.2162388,13.7547547 C44.9585822,13.0286463 43.3533085,13.4598485 42.6279312,14.7162388 L30.0575956,36.4886988 L40.0978909,31.2276186 C43.1404959,29.6333041 46.8692155,31.3421319 47.6479264,34.6877101 L51.2545483,52.3903732 L61.1353556,53.2399953 C63.2899974,53.4346096 65.1046382,54.9309951 65.706105,57.0091178 C65.7395572,57.1246982 65.8069154,57.3539875 65.9047035,57.6813669 C66.0696435,58.2335608 66.2581528,58.852952 66.4667073,59.5238092 C67.0618822,61.4383079 67.6960725,63.3742727 68.3393254,65.2021174 C68.5462918,65.7902259 68.7511789,66.3583016 68.953259,66.9034738 C69.5777086,68.5881157 70.1617856,70.0172008 70.6783305,71.110045 C70.9334784,71.6498566 71.1627732,72.0871602 71.4035746,72.5373068 C71.6178999,72.7492946 71.9508843,72.9623307 72.4151452,73.1586945 C73.5561502,73.6412938 75.1990755,73.899146 77.0720271,73.9171651 C77.9355886,73.9254732 78.7819239,73.8832103 79.5638842,73.8072782 C80.0123946,73.7637257 80.3172916,73.7224469 80.4352582,73.7027375 C80.7503629,73.6500912 81.0598053,73.6256267 81.3619177,73.6270062 L81.3619177,73.6270062 L81.3619177,73.6270062 L81.3619177,73.6270062 Z M37.4707881,2.64867269 C38.9217993,0.135447653 42.1388058,-0.723707984 44.6486727,0.725364314 L108.293614,37.4707881 C110.806839,38.9217993 111.665994,42.1388058 110.216922,44.6486727 L73.4714982,108.293614 C72.0204871,110.806839 68.8034805,111.665994 66.2936136,110.216922 L2.64867269,73.4714982 C0.135447653,72.0204871 -0.723707984,68.8034805 0.725364314,66.2936136 L37.4707881,2.64867269 L37.4707881,2.64867269 L37.4707881,2.64867269 L37.4707881,2.64867269 Z M80.3080975,53.1397764 C82.8191338,54.5895239 86.0299834,53.7291793 87.4797308,51.218143 C88.9294783,48.7071068 88.0691338,45.4962571 85.5580975,44.0465097 C83.0470612,42.5967622 79.8362116,43.4571068 78.3864641,45.968143 C76.9367166,48.4791793 77.7970612,51.6900289 80.3080975,53.1397764 L80.3080975,53.1397764 L80.3080975,53.1397764 L80.3080975,53.1397764 Z M96,112 L88.0070969,112 C83.5881712,112 80,108.418278 80,104 C80,99.5907123 83.5848994,96 88.0070969,96 L96,96 L96,88.0070969 C96,83.5881712 99.581722,80 104,80 C108.409288,80 112,83.5848994 112,88.0070969 L112,96 L119.992903,96 C124.411829,96 128,99.581722 128,104 C128,108.409288 124.415101,112 119.992903,112 L112,112 L112,119.992903 C112,124.411829 108.418278,128 104,128 C99.5907123,128 96,124.415101 96,119.992903 L96,112 L96,112 Z M33.3471097,51.7910932 C40.7754579,59.7394511 42.3564368,62.4818351 40.7958321,65.1848818 C39.2352273,67.8879286 26.9581062,62.8571718 24.7019652,66.7649227 C22.4458242,70.6726735 23.7947046,70.0228006 22.2648667,72.6725575 L41.9944593,84.0634431 C41.9944593,84.0634431 36.3904568,75.8079231 37.7602356,73.4353966 C40.2754811,69.0788636 46.5298923,72.1787882 48.1248275,69.4162793 C50.538989,65.234829 43.0222016,59.7770885 33.3471097,51.7910932 L33.3471097,51.7910932 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/new-journal-button": {
"title": "$:/core/images/new-journal-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-new-journal-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M102.545455,112.818182 L102.545455,124.636364 L102.545455,124.636364 L102.545455,124.636364 C102.545455,125.941761 103.630828,127 104.969697,127 L111.030303,127 C112.369172,127 113.454545,125.941761 113.454545,124.636364 L113.454545,112.818182 L125.575758,112.818182 C126.914626,112.818182 128,111.759982 128,110.454545 L128,104.545455 C128,103.240018 126.914626,102.181818 125.575758,102.181818 L113.454545,102.181818 L113.454545,90.3636364 C113.454545,89.0582 112.369172,88 111.030303,88 L104.969697,88 L104.969697,88 C103.630828,88 102.545455,89.0582 102.545455,90.3636364 L102.545455,102.181818 L90.4242424,102.181818 L90.4242424,102.181818 C89.0853705,102.181818 88,103.240018 88,104.545455 L88,110.454545 L88,110.454545 L88,110.454545 C88,111.759982 89.0853705,112.818182 90.4242424,112.818182 L102.545455,112.818182 Z\"></path>\n <g transform=\"translate(59.816987, 64.316987) rotate(30.000000) translate(-59.816987, -64.316987) translate(20.316987, 12.816987)\">\n <g transform=\"translate(0.000000, 0.000000)\">\n <path d=\"M9.99631148,0 C4.4755011,0 -2.27373675e-13,4.48070044 -2.27373675e-13,9.99759461 L-2.27373675e-13,91.6128884 C-2.27373675e-13,97.1344074 4.46966773,101.610483 9.99631148,101.610483 L68.9318917,101.610483 C74.4527021,101.610483 78.9282032,97.1297826 78.9282032,91.6128884 L78.9282032,9.99759461 C78.9282032,4.47607557 74.4585355,0 68.9318917,0 L9.99631148,0 Z M20.8885263,26 C24.2022348,26 26.8885263,23.3137085 26.8885263,20 C26.8885263,16.6862915 24.2022348,14 20.8885263,14 C17.5748178,14 14.8885263,16.6862915 14.8885263,20 C14.8885263,23.3137085 17.5748178,26 20.8885263,26 Z M57.3033321,25.6783342 C60.6170406,25.6783342 63.3033321,22.9920427 63.3033321,19.6783342 C63.3033321,16.3646258 60.6170406,13.6783342 57.3033321,13.6783342 C53.9896236,13.6783342 51.3033321,16.3646258 51.3033321,19.6783342 C51.3033321,22.9920427 53.9896236,25.6783342 57.3033321,25.6783342 Z\"></path>\n <text font-family=\"Helvetica\" font-size=\"47.1724138\" font-weight=\"bold\" fill=\"#FFFFFF\">\n <tspan x=\"42\" y=\"77.4847912\" text-anchor=\"middle\"><<now \"DD\">></tspan>\n </text>\n </g>\n </g>\n </g>\n</svg>"
},
"$:/core/images/opacity": {
"title": "$:/core/images/opacity",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-opacity tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M102.361773,65 C101.833691,67.051742 101.183534,69.0544767 100.419508,71 L82.5835324,71 C83.7602504,69.1098924 84.7666304,67.1027366 85.581205,65 L102.361773,65 Z M102.834311,63 C103.256674,61.0388326 103.568427,59.0365486 103.762717,57 L87.6555706,57 C87.3692052,59.0609452 86.9083652,61.0660782 86.2884493,63 L102.834311,63 Z M99.5852583,73 C98.6682925,75.0747721 97.6196148,77.0783056 96.4498253,79 L75.8124196,79 C77.8387053,77.2115633 79.6621163,75.1985844 81.2437158,73 L99.5852583,73 Z M95.1689122,81 C93.7449202,83.1155572 92.1695234,85.1207336 90.458251,87 L60.4614747,87 C65.1836162,85.86248 69.5430327,83.794147 73.3347255,81 L95.1689122,81 Z M87.6555706,47 L103.762717,47 C101.246684,20.6269305 79.0321807,0 52,0 C23.281193,0 0,23.281193 0,52 C0,77.2277755 17.9651296,98.2595701 41.8000051,103 L62.1999949,103 C67.8794003,101.870444 73.2255333,99.8158975 78.074754,97 L39,97 L39,95 L81.2493857,95 C83.8589242,93.2215015 86.2981855,91.2116653 88.5376609,89 L39,89 L39,87 L43.5385253,87 C27.7389671,83.1940333 16,68.967908 16,52 C16,32.117749 32.117749,16 52,16 C70.1856127,16 85.2217929,29.4843233 87.6555706,47 Z M87.8767787,49 L103.914907,49 C103.971379,49.9928025 104,50.9930589 104,52 C104,53.0069411 103.971379,54.0071975 103.914907,55 L87.8767787,55 C87.958386,54.0107999 88,53.0102597 88,52 C88,50.9897403 87.958386,49.9892001 87.8767787,49 Z\"></path>\n <path d=\"M76,128 C104.718807,128 128,104.718807 128,76 C128,47.281193 104.718807,24 76,24 C47.281193,24 24,47.281193 24,76 C24,104.718807 47.281193,128 76,128 L76,128 Z M76,112 C95.882251,112 112,95.882251 112,76 C112,56.117749 95.882251,40 76,40 C56.117749,40 40,56.117749 40,76 C40,95.882251 56.117749,112 76,112 L76,112 Z\"></path>\n <path d=\"M37,58 L90,58 L90,62 L37,62 L37,58 L37,58 Z M40,50 L93,50 L93,54 L40,54 L40,50 L40,50 Z M40,42 L93,42 L93,46 L40,46 L40,42 L40,42 Z M32,66 L85,66 L85,70 L32,70 L32,66 L32,66 Z M30,74 L83,74 L83,78 L30,78 L30,74 L30,74 Z M27,82 L80,82 L80,86 L27,86 L27,82 L27,82 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/open-window": {
"title": "$:/core/images/open-window",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-open-window tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M16,112 L104.993898,112 C108.863261,112 112,115.590712 112,120 C112,124.418278 108.858091,128 104.993898,128 L7.00610161,128 C3.13673853,128 0,124.409288 0,120 C0,119.998364 4.30952878e-07,119.996727 1.29273572e-06,119.995091 C4.89579306e-07,119.993456 0,119.99182 0,119.990183 L0,24.0098166 C0,19.586117 3.59071231,16 8,16 C12.418278,16 16,19.5838751 16,24.0098166 L16,112 Z\"></path>\n <path d=\"M96,43.1959595 L96,56 C96,60.418278 99.581722,64 104,64 C108.418278,64 112,60.418278 112,56 L112,24 C112,19.5907123 108.415101,16 103.992903,16 L72.0070969,16 C67.5881712,16 64,19.581722 64,24 C64,28.4092877 67.5848994,32 72.0070969,32 L84.5685425,32 L48.2698369,68.2987056 C45.1421332,71.4264093 45.1434327,76.4904296 48.267627,79.614624 C51.3854642,82.7324612 56.4581306,82.7378289 59.5835454,79.6124141 L96,43.1959595 Z M32,7.9992458 C32,3.58138434 35.5881049,0 39.9992458,0 L120.000754,0 C124.418616,0 128,3.5881049 128,7.9992458 L128,88.0007542 C128,92.4186157 124.411895,96 120.000754,96 L39.9992458,96 C35.5813843,96 32,92.4118951 32,88.0007542 L32,7.9992458 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/options-button": {
"title": "$:/core/images/options-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-options-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M110.48779,76.0002544 C109.354214,80.4045063 107.611262,84.5641217 105.354171,88.3838625 L105.354171,88.3838625 L112.07833,95.1080219 C115.20107,98.2307613 115.210098,103.299824 112.089164,106.420759 L106.420504,112.089418 C103.301049,115.208874 98.2346851,115.205502 95.1077675,112.078585 L88.3836082,105.354425 C84.5638673,107.611516 80.4042519,109.354468 76,110.488045 L76,110.488045 L76,119.993281 C76,124.409501 72.4220153,128.000254 68.0083475,128.000254 L59.9916525,128.000254 C55.5800761,128.000254 52,124.41541 52,119.993281 L52,110.488045 C47.5957481,109.354468 43.4361327,107.611516 39.6163918,105.354425 L32.8922325,112.078585 C29.7694931,115.201324 24.7004301,115.210353 21.5794957,112.089418 L15.9108363,106.420759 C12.7913807,103.301303 12.7947522,98.2349395 15.9216697,95.1080219 L22.6458291,88.3838625 C20.3887383,84.5641217 18.6457859,80.4045063 17.5122098,76.0002544 L8.00697327,76.0002544 C3.59075293,76.0002544 2.19088375e-16,72.4222697 4.89347582e-16,68.0086019 L9.80228577e-16,59.9919069 C1.25035972e-15,55.5803305 3.58484404,52.0002544 8.00697327,52.0002544 L17.5122098,52.0002544 C18.6457859,47.5960025 20.3887383,43.4363871 22.6458291,39.6166462 L15.9216697,32.8924868 C12.7989304,29.7697475 12.7899019,24.7006845 15.9108363,21.5797501 L21.5794957,15.9110907 C24.6989513,12.7916351 29.7653149,12.7950065 32.8922325,15.9219241 L39.6163918,22.6460835 C43.4361327,20.3889927 47.5957481,18.6460403 52,17.5124642 L52,8.00722764 C52,3.5910073 55.5779847,0.000254375069 59.9916525,0.000254375069 L68.0083475,0.000254375069 C72.4199239,0.000254375069 76,3.58509841 76,8.00722764 L76,17.5124642 C80.4042519,18.6460403 84.5638673,20.3889927 88.3836082,22.6460835 L95.1077675,15.9219241 C98.2305069,12.7991848 103.29957,12.7901562 106.420504,15.9110907 L112.089164,21.5797501 C115.208619,24.6992057 115.205248,29.7655693 112.07833,32.8924868 L105.354171,39.6166462 L105.354171,39.6166462 C107.611262,43.4363871 109.354214,47.5960025 110.48779,52.0002544 L119.993027,52.0002544 C124.409247,52.0002544 128,55.5782391 128,59.9919069 L128,68.0086019 C128,72.4201783 124.415156,76.0002544 119.993027,76.0002544 L110.48779,76.0002544 L110.48779,76.0002544 Z M64,96.0002544 C81.673112,96.0002544 96,81.6733664 96,64.0002544 C96,46.3271424 81.673112,32.0002544 64,32.0002544 C46.326888,32.0002544 32,46.3271424 32,64.0002544 C32,81.6733664 46.326888,96.0002544 64,96.0002544 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/paint": {
"title": "$:/core/images/paint",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-paint tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M83.5265806,76.1907935 C90.430962,69.2864121 91.8921169,59.0000433 87.9100453,50.6642209 L125.812763,12.7615036 C128.732035,9.84223095 128.72611,5.10322984 125.812796,2.18991592 C122.893542,-0.729338085 118.161775,-0.730617045 115.241209,2.18994966 L77.3384914,40.092667 C69.002669,36.1105954 58.7163002,37.5717503 51.8119188,44.4761317 L83.5265806,76.1907935 L83.5265806,76.1907935 L83.5265806,76.1907935 L83.5265806,76.1907935 Z M80.8836921,78.8336819 L49.1690303,47.1190201 C49.1690303,47.1190201 8.50573364,81.242543 0,80.2820711 C0,80.2820711 3.78222974,85.8744423 6.82737483,88.320684 C20.8514801,82.630792 44.1526049,63.720771 44.1526049,63.720771 L44.8144806,64.3803375 C44.8144806,64.3803375 19.450356,90.2231043 9.18040433,92.0477601 C10.4017154,93.4877138 13.5343883,96.1014812 15.4269991,97.8235871 C20.8439164,96.3356979 50.1595367,69.253789 50.1595367,69.253789 L50.8214124,69.9133555 L18.4136144,100.936036 L23.6993903,106.221812 L56.1060358,75.2002881 L56.7679115,75.8598546 C56.7679115,75.8598546 28.9040131,106.396168 28.0841366,108.291555 C28.0841366,108.291555 34.1159238,115.144621 35.6529617,116.115796 C36.3545333,113.280171 63.5365402,82.6307925 63.5365402,82.6307925 L64.1984159,83.290359 C64.1984159,83.290359 43.6013016,107.04575 39.2343772,120.022559 C42.443736,123.571575 46.7339155,125.159692 50.1595362,126.321151 C47.9699978,114.504469 80.8836921,78.8336819 80.8836921,78.8336819 L80.8836921,78.8336819 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/palette": {
"title": "$:/core/images/palette",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-palette tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M80.2470434,39.1821571 C75.0645698,38.2680897 69.6261555,37.7814854 64.0193999,37.7814854 C28.6624616,37.7814854 0,57.1324214 0,81.0030106 C0,90.644534 4.67604329,99.5487133 12.5805659,106.738252 C23.5031767,91.1899067 26.3405471,72.3946229 36.8885698,63.5622337 C52.0716764,50.8486559 63.4268694,55.7343343 63.4268694,55.7343343 L80.2470434,39.1821571 Z M106.781666,48.8370714 C119.830962,56.749628 128.0388,68.229191 128.0388,81.0030106 C128.0388,90.3534932 128.557501,98.4142085 116.165191,106.082518 C105.367708,112.763955 112.341384,99.546808 104.321443,95.1851533 C96.3015017,90.8234987 84.3749007,96.492742 86.1084305,103.091059 C89.3087234,115.272303 105.529892,114.54645 92.4224435,119.748569 C79.3149955,124.950687 74.2201582,124.224536 64.0193999,124.224536 C56.1979176,124.224536 48.7040365,123.277578 41.7755684,121.544216 C51.620343,117.347916 69.6563669,109.006202 75.129737,102.088562 C82.7876655,92.4099199 87.3713218,80.0000002 83.3235694,72.4837191 C83.1303943,72.1250117 94.5392656,60.81569 106.781666,48.8370714 Z M1.13430476,123.866563 C0.914084026,123.867944 0.693884185,123.868637 0.473712455,123.868637 C33.9526848,108.928928 22.6351223,59.642592 59.2924543,59.6425917 C59.6085574,61.0606542 59.9358353,62.5865065 60.3541977,64.1372318 C34.4465025,59.9707319 36.7873124,112.168427 1.13429588,123.866563 L1.13430476,123.866563 Z M1.84669213,123.859694 C40.7185279,123.354338 79.9985412,101.513051 79.9985401,79.0466836 C70.7284906,79.0466835 65.9257264,75.5670082 63.1833375,71.1051511 C46.585768,64.1019718 32.81846,116.819636 1.84665952,123.859695 L1.84669213,123.859694 Z M67.1980193,59.8524981 C62.748213,63.9666823 72.0838429,76.2846822 78.5155805,71.1700593 C89.8331416,59.8524993 112.468264,37.2173758 123.785825,25.8998146 C135.103386,14.5822535 123.785825,3.26469247 112.468264,14.5822535 C101.150703,25.8998144 78.9500931,48.9868127 67.1980193,59.8524981 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/permalink-button": {
"title": "$:/core/images/permalink-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-permalink-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M80.4834582,48 L73.0956761,80 L73.0956761,80 L47.5165418,80 L54.9043239,48 L80.4834582,48 Z M84.1773493,32 L89.8007299,7.64246248 C90.7941633,3.33942958 95.0918297,0.64641956 99.3968675,1.64031585 C103.693145,2.63218977 106.385414,6.93288901 105.390651,11.2416793 L100.598215,32 L104.000754,32 C108.411895,32 112,35.581722 112,40 C112,44.4092877 108.418616,48 104.000754,48 L96.9043239,48 L89.5165418,80 L104.000754,80 C108.411895,80 112,83.581722 112,88 C112,92.4092877 108.418616,96 104.000754,96 L85.8226507,96 L80.1992701,120.357538 C79.2058367,124.66057 74.9081703,127.35358 70.6031325,126.359684 C66.3068546,125.36781 63.6145865,121.067111 64.6093491,116.758321 L69.401785,96 L43.8226507,96 L38.1992701,120.357538 C37.2058367,124.66057 32.9081703,127.35358 28.6031325,126.359684 C24.3068546,125.36781 21.6145865,121.067111 22.6093491,116.758321 L27.401785,96 L23.9992458,96 C19.5881049,96 16,92.418278 16,88 C16,83.5907123 19.5813843,80 23.9992458,80 L31.0956761,80 L38.4834582,48 L23.9992458,48 C19.5881049,48 16,44.418278 16,40 C16,35.5907123 19.5813843,32 23.9992458,32 L42.1773493,32 L47.8007299,7.64246248 C48.7941633,3.33942958 53.0918297,0.64641956 57.3968675,1.64031585 C61.6931454,2.63218977 64.3854135,6.93288901 63.3906509,11.2416793 L58.598215,32 L84.1773493,32 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/permaview-button": {
"title": "$:/core/images/permaview-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-permaview-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M81.4834582,48 L79.6365127,56 L79.6365127,56 L74.0573784,56 L75.9043239,48 L81.4834582,48 Z M85.1773493,32 L90.8007299,7.64246248 C91.7941633,3.33942958 96.0918297,0.64641956 100.396867,1.64031585 C104.693145,2.63218977 107.385414,6.93288901 106.390651,11.2416793 L101.598215,32 L104.000754,32 C108.411895,32 112,35.581722 112,40 C112,44.4092877 108.418616,48 104.000754,48 L97.9043239,48 L96.0573784,56 L104.000754,56 C108.411895,56 112,59.581722 112,64 C112,68.4092877 108.418616,72 104.000754,72 L92.3634873,72 L90.5165418,80 L104.000754,80 C108.411895,80 112,83.581722 112,88 C112,92.4092877 108.418616,96 104.000754,96 L86.8226507,96 L81.1992701,120.357538 C80.2058367,124.66057 75.9081703,127.35358 71.6031325,126.359684 C67.3068546,125.36781 64.6145865,121.067111 65.6093491,116.758321 L70.401785,96 L64.8226507,96 L59.1992701,120.357538 C58.2058367,124.66057 53.9081703,127.35358 49.6031325,126.359684 C45.3068546,125.36781 42.6145865,121.067111 43.6093491,116.758321 L48.401785,96 L42.8226507,96 L37.1992701,120.357538 C36.2058367,124.66057 31.9081703,127.35358 27.6031325,126.359684 C23.3068546,125.36781 20.6145865,121.067111 21.6093491,116.758321 L26.401785,96 L23.9992458,96 C19.5881049,96 16,92.418278 16,88 C16,83.5907123 19.5813843,80 23.9992458,80 L30.0956761,80 L31.9426216,72 L23.9992458,72 C19.5881049,72 16,68.418278 16,64 C16,59.5907123 19.5813843,56 23.9992458,56 L35.6365127,56 L37.4834582,48 L23.9992458,48 C19.5881049,48 16,44.418278 16,40 C16,35.5907123 19.5813843,32 23.9992458,32 L41.1773493,32 L46.8007299,7.64246248 C47.7941633,3.33942958 52.0918297,0.64641956 56.3968675,1.64031585 C60.6931454,2.63218977 63.3854135,6.93288901 62.3906509,11.2416793 L57.598215,32 L63.1773493,32 L68.8007299,7.64246248 C69.7941633,3.33942958 74.0918297,0.64641956 78.3968675,1.64031585 C82.6931454,2.63218977 85.3854135,6.93288901 84.3906509,11.2416793 L79.598215,32 L85.1773493,32 Z M53.9043239,48 L52.0573784,56 L57.6365127,56 L59.4834582,48 L53.9043239,48 Z M75.9426216,72 L74.0956761,80 L74.0956761,80 L68.5165418,80 L70.3634873,72 L75.9426216,72 L75.9426216,72 Z M48.3634873,72 L46.5165418,80 L52.0956761,80 L53.9426216,72 L48.3634873,72 L48.3634873,72 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/picture": {
"title": "$:/core/images/picture",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-picture tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M112,68.2332211 L112,20.0027785 C112,17.7898769 110.207895,16 107.997221,16 L20.0027785,16 C17.7898769,16 16,17.792105 16,20.0027785 L16,58.312373 L25.2413115,43.7197989 C28.041793,39.297674 34.2643908,38.7118128 37.8410347,42.5335275 L56.0882845,63.1470817 L69.7748997,56.7400579 C72.766567,55.3552503 76.3013751,55.9473836 78.678437,58.2315339 C78.8106437,58.3585731 79.0742301,58.609836 79.4527088,58.9673596 C80.0910923,59.570398 80.8117772,60.2441563 81.598127,60.9705595 C83.8422198,63.043576 86.1541548,65.1151944 88.3956721,67.0372264 C89.1168795,67.6556396 89.8200801,68.2492007 90.5021258,68.8146755 C92.6097224,70.5620551 94.4693308,72.0029474 95.9836366,73.0515697 C96.7316295,73.5695379 97.3674038,73.9719282 98.0281481,74.3824999 C98.4724987,74.4989557 99.0742374,74.5263881 99.8365134,74.4317984 C101.709944,74.1993272 104.074502,73.2878514 106.559886,71.8846196 C107.705822,71.2376318 108.790494,70.5370325 109.764561,69.8410487 C110.323259,69.4418522 110.694168,69.1550757 110.834827,69.0391868 C111.210545,68.7296319 111.600264,68.4615815 112,68.2332211 L112,68.2332211 Z M0,8.00697327 C0,3.58484404 3.59075293,0 8.00697327,0 L119.993027,0 C124.415156,0 128,3.59075293 128,8.00697327 L128,119.993027 C128,124.415156 124.409247,128 119.993027,128 L8.00697327,128 C3.58484404,128 0,124.409247 0,119.993027 L0,8.00697327 L0,8.00697327 Z M95,42 C99.418278,42 103,38.418278 103,34 C103,29.581722 99.418278,26 95,26 C90.581722,26 87,29.581722 87,34 C87,38.418278 90.581722,42 95,42 L95,42 Z M32,76 C47.8587691,80.8294182 52.0345556,83.2438712 52.0345556,88 C52.0345556,92.7561288 32,95.4712486 32,102.347107 C32,109.222965 33.2849191,107.337637 33.2849191,112 L67.999999,112 C67.999999,112 54.3147136,105.375255 54.3147136,101.200691 C54.3147136,93.535181 64.9302432,92.860755 64.9302432,88 C64.9302432,80.6425555 50.8523779,79.167282 32,76 L32,76 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/plugin-generic-language": {
"title": "$:/core/images/plugin-generic-language",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M61.2072232,68.1369825 C56.8829239,70.9319564 54.2082892,74.793177 54.2082892,79.0581634 C54.2082892,86.9638335 63.3980995,93.4821994 75.2498076,94.3940006 C77.412197,98.2964184 83.8475284,101.178858 91.5684735,101.403106 C86.4420125,100.27851 82.4506393,97.6624107 80.9477167,94.3948272 C92.8046245,93.4861461 102,86.9662269 102,79.0581634 C102,70.5281905 91.3014611,63.6132813 78.1041446,63.6132813 C71.5054863,63.6132813 65.5315225,65.3420086 61.2072232,68.1369825 Z M74.001066,53.9793443 C69.6767667,56.7743182 63.7028029,58.5030456 57.1041446,58.5030456 C54.4851745,58.5030456 51.9646095,58.2307276 49.6065315,57.7275105 C46.2945155,59.9778212 41.2235699,61.4171743 35.5395922,61.4171743 C35.4545771,61.4171743 35.3696991,61.4168523 35.2849622,61.4162104 C39.404008,60.5235193 42.7961717,58.6691298 44.7630507,56.286533 C37.8379411,53.5817651 33.2082892,48.669413 33.2082892,43.0581634 C33.2082892,34.5281905 43.9068281,27.6132812 57.1041446,27.6132812 C70.3014611,27.6132812 81,34.5281905 81,43.0581634 C81,47.3231498 78.3253653,51.1843704 74.001066,53.9793443 Z M64,0 L118.5596,32 L118.5596,96 L64,128 L9.44039956,96 L9.44039956,32 L64,0 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/plugin-generic-plugin": {
"title": "$:/core/images/plugin-generic-plugin",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M40.3972881,76.4456988 L40.3972881,95.3404069 L54.5170166,95.3404069 L54.5170166,95.3404069 C54.5165526,95.3385183 54.516089,95.3366295 54.515626,95.3347404 C54.6093153,95.3385061 54.7034848,95.3404069 54.7980982,95.3404069 C58.6157051,95.3404069 61.710487,92.245625 61.710487,88.4280181 C61.710487,86.6197822 61.01617,84.9737128 59.8795929,83.7418666 L59.8795929,83.7418666 C59.8949905,83.7341665 59.9104102,83.7265043 59.925852,83.7188798 C58.8840576,82.5086663 58.2542926,80.9336277 58.2542926,79.2114996 C58.2542926,75.3938927 61.3490745,72.2991108 65.1666814,72.2991108 C68.9842884,72.2991108 72.0790703,75.3938927 72.0790703,79.2114996 C72.0790703,81.1954221 71.2432806,82.9841354 69.9045961,84.2447446 L69.9045961,84.2447446 C69.9333407,84.2629251 69.9619885,84.281245 69.9905383,84.2997032 L69.9905383,84.2997032 C69.1314315,85.4516923 68.6228758,86.8804654 68.6228758,88.4280181 C68.6228758,91.8584969 71.1218232,94.7053153 74.3986526,95.2474079 C74.3913315,95.2784624 74.3838688,95.3094624 74.3762652,95.3404069 L95.6963988,95.3404069 L95.6963988,75.5678578 L95.6963988,75.5678578 C95.6466539,75.5808558 95.5967614,75.5934886 95.5467242,75.6057531 C95.5504899,75.5120637 95.5523907,75.4178943 95.5523907,75.3232809 C95.5523907,71.505674 92.4576088,68.4108921 88.6400019,68.4108921 C86.831766,68.4108921 85.1856966,69.105209 83.9538504,70.2417862 L83.9538504,70.2417862 C83.9461503,70.2263886 83.938488,70.2109688 83.9308636,70.1955271 C82.7206501,71.2373215 81.1456115,71.8670865 79.4234834,71.8670865 C75.6058765,71.8670865 72.5110946,68.7723046 72.5110946,64.9546976 C72.5110946,61.1370907 75.6058765,58.0423088 79.4234834,58.0423088 C81.4074059,58.0423088 83.1961192,58.8780985 84.4567284,60.2167829 L84.4567284,60.2167829 C84.4749089,60.1880383 84.4932288,60.1593906 84.511687,60.1308407 L84.511687,60.1308407 C85.6636761,60.9899475 87.0924492,61.4985032 88.6400019,61.4985032 C92.0704807,61.4985032 94.9172991,58.9995558 95.4593917,55.7227265 C95.538755,55.7414363 95.6177614,55.761071 95.6963988,55.7816184 L95.6963988,40.0412962 L74.3762652,40.0412962 L74.3762652,40.0412962 C74.3838688,40.0103516 74.3913315,39.9793517 74.3986526,39.9482971 L74.3986526,39.9482971 C71.1218232,39.4062046 68.6228758,36.5593862 68.6228758,33.1289073 C68.6228758,31.5813547 69.1314315,30.1525815 69.9905383,29.0005925 C69.9619885,28.9821342 69.9333407,28.9638143 69.9045961,28.9456339 C71.2432806,27.6850247 72.0790703,25.8963113 72.0790703,23.9123888 C72.0790703,20.0947819 68.9842884,17 65.1666814,17 C61.3490745,17 58.2542926,20.0947819 58.2542926,23.9123888 C58.2542926,25.6345169 58.8840576,27.2095556 59.925852,28.419769 L59.925852,28.419769 C59.9104102,28.4273935 59.8949905,28.4350558 59.8795929,28.4427558 C61.01617,29.674602 61.710487,31.3206715 61.710487,33.1289073 C61.710487,36.9465143 58.6157051,40.0412962 54.7980982,40.0412962 C54.7034848,40.0412962 54.6093153,40.0393953 54.515626,40.0356296 L54.515626,40.0356296 C54.516089,40.0375187 54.5165526,40.0394075 54.5170166,40.0412962 L40.3972881,40.0412962 L40.3972881,52.887664 L40.3972881,52.887664 C40.4916889,53.3430132 40.5412962,53.8147625 40.5412962,54.2980982 C40.5412962,58.1157051 37.4465143,61.210487 33.6289073,61.210487 C32.0813547,61.210487 30.6525815,60.7019313 29.5005925,59.8428245 C29.4821342,59.8713744 29.4638143,59.9000221 29.4456339,59.9287667 C28.1850247,58.5900823 26.3963113,57.7542926 24.4123888,57.7542926 C20.5947819,57.7542926 17.5,60.8490745 17.5,64.6666814 C17.5,68.4842884 20.5947819,71.5790703 24.4123888,71.5790703 C26.134517,71.5790703 27.7095556,70.9493053 28.919769,69.9075109 L28.919769,69.9075109 C28.9273935,69.9229526 28.9350558,69.9383724 28.9427558,69.95377 C30.174602,68.8171928 31.8206715,68.1228758 33.6289073,68.1228758 C37.4465143,68.1228758 40.5412962,71.2176578 40.5412962,75.0352647 C40.5412962,75.5186004 40.4916889,75.9903496 40.3972881,76.4456988 Z M64,0 L118.5596,32 L118.5596,96 L64,128 L9.44039956,96 L9.44039956,32 L64,0 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/plugin-generic-theme": {
"title": "$:/core/images/plugin-generic-theme",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M29.4078519,91.4716406 L51.4693474,69.4101451 L51.4646675,69.4054652 C50.5969502,68.5377479 50.5929779,67.1348725 51.4693474,66.2585029 C52.3396494,65.3882009 53.7499654,65.3874786 54.6163097,66.2538229 L64.0805963,75.7181095 C64.9483136,76.5858268 64.9522859,77.9887022 64.0759163,78.8650718 C63.2056143,79.7353737 61.7952984,79.736096 60.9289541,78.8697517 L60.9242741,78.8650718 L60.9242741,78.8650718 L38.8627786,100.926567 C36.2518727,103.537473 32.0187578,103.537473 29.4078519,100.926567 C26.796946,98.3156614 26.796946,94.0825465 29.4078519,91.4716406 Z M60.8017407,66.3810363 C58.3659178,63.6765806 56.3370667,61.2899536 54.9851735,59.5123615 C48.1295381,50.4979488 44.671561,55.2444054 40.7586738,59.5123614 C36.8457866,63.7803174 41.789473,67.2384487 38.0759896,70.2532832 C34.3625062,73.2681177 34.5917646,74.3131575 28.3243876,68.7977024 C22.0570105,63.2822473 21.6235306,61.7636888 24.5005999,58.6166112 C27.3776691,55.4695337 29.7823103,60.4247912 35.6595047,54.8320442 C41.5366991,49.2392972 36.5996215,44.2825646 36.5996215,44.2825646 C36.5996215,44.2825646 48.8365511,19.267683 65.1880231,21.1152173 C81.5394952,22.9627517 59.0022276,18.7228947 53.3962199,38.3410355 C50.9960082,46.7405407 53.8429162,44.7613399 58.3941742,48.3090467 C59.7875202,49.3951602 64.4244828,52.7100463 70.1884353,56.9943417 L90.8648751,36.3179019 L92.4795866,31.5515482 L100.319802,26.8629752 L103.471444,30.0146174 L98.782871,37.8548326 L94.0165173,39.4695441 L73.7934912,59.6925702 C86.4558549,69.2403631 102.104532,81.8392557 102.104532,86.4016913 C102.104533,93.6189834 99.0337832,97.9277545 92.5695848,95.5655717 C87.8765989,93.8506351 73.8015497,80.3744087 63.8173444,69.668717 L60.9242741,72.5617873 L57.7726319,69.4101451 L60.8017407,66.3810363 L60.8017407,66.3810363 Z M63.9533761,1.42108547e-13 L118.512977,32 L118.512977,96 L63.9533761,128 L9.39377563,96 L9.39377563,32 L63.9533761,1.42108547e-13 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/preview-closed": {
"title": "$:/core/images/preview-closed",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-preview-closed tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M0.0881363238,64 C-0.210292223,65.8846266 0.249135869,67.8634737 1.4664206,69.4579969 C16.2465319,88.8184886 39.1692554,100.414336 64,100.414336 C88.8307446,100.414336 111.753468,88.8184886 126.533579,69.4579969 C127.750864,67.8634737 128.210292,65.8846266 127.911864,64 C110.582357,78.4158332 88.3036732,87.0858436 64,87.0858436 C39.6963268,87.0858436 17.4176431,78.4158332 0.0881363238,64 Z\"></path>\n <rect x=\"62\" y=\"96\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(80.000000, 101.000000) rotate(-5.000000) translate(-80.000000, -101.000000) \" x=\"78\" y=\"93\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(48.000000, 101.000000) rotate(-355.000000) translate(-48.000000, -101.000000) \" x=\"46\" y=\"93\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(32.000000, 96.000000) rotate(-350.000000) translate(-32.000000, -96.000000) \" x=\"30\" y=\"88\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(96.000000, 96.000000) rotate(-10.000000) translate(-96.000000, -96.000000) \" x=\"94\" y=\"88\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(112.000000, 88.000000) rotate(-20.000000) translate(-112.000000, -88.000000) \" x=\"110\" y=\"80\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n <rect transform=\"translate(16.000000, 88.000000) rotate(-340.000000) translate(-16.000000, -88.000000) \" x=\"14\" y=\"80\" width=\"4\" height=\"16\" rx=\"4\"></rect>\n </g>\n</svg>"
},
"$:/core/images/preview-open": {
"title": "$:/core/images/preview-open",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-preview-open tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M64.1099282,99.5876785 C39.2791836,99.5876785 16.3564602,87.9918313 1.57634884,68.6313396 C-0.378878622,66.070184 -0.378878622,62.5174945 1.57634884,59.9563389 C16.3564602,40.5958472 39.2791836,29 64.1099282,29 C88.9406729,29 111.863396,40.5958472 126.643508,59.9563389 C128.598735,62.5174945 128.598735,66.070184 126.643508,68.6313396 C111.863396,87.9918313 88.9406729,99.5876785 64.1099282,99.5876785 Z M110.213805,67.5808331 C111.654168,66.0569335 111.654168,63.9430665 110.213805,62.4191669 C99.3257042,50.8995835 82.4391647,44 64.1470385,44 C45.8549124,44 28.9683729,50.8995835 18.0802717,62.4191669 C16.6399094,63.9430665 16.6399094,66.0569335 18.0802717,67.5808331 C28.9683729,79.1004165 45.8549124,86 64.1470385,86 C82.4391647,86 99.3257042,79.1004165 110.213805,67.5808331 Z\"></path>\n <path d=\"M63.5,88 C76.4786916,88 87,77.4786916 87,64.5 C87,51.5213084 76.4786916,41 63.5,41 C50.5213084,41 40,51.5213084 40,64.5 C40,77.4786916 50.5213084,88 63.5,88 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/print-button": {
"title": "$:/core/images/print-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-print-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M112,71 L112,30.5 L111.96811,30.5 L111.96811,30.5 C111.932942,28.4998414 111.151676,26.510538 109.625176,24.9840387 L86.9982489,2.35711116 C85.3482153,0.707077645 83.1589869,-0.071534047 81,0.0201838424 L81,0 L23.9992458,0 C19.5808867,0 16,3.58213437 16,8.00092105 L16,71 L24,71 L24,8 L81,8 L81,22.4996539 C81,26.9216269 84.5818769,30.5 89.0003461,30.5 L104,30.5 L104,71 L112,71 Z\"></path>\n <rect x=\"32\" y=\"36\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"52\" width=\"64\" height=\"8\" rx=\"4\"></rect>\n <rect x=\"32\" y=\"20\" width=\"40\" height=\"8\" rx=\"4\"></rect>\n <path d=\"M0,80.0054195 C0,71.1658704 7.15611005,64 16.0008841,64 L111.999116,64 C120.83616,64 128,71.1553215 128,80.0054195 L128,111.99458 C128,120.83413 120.84389,128 111.999116,128 L16.0008841,128 C7.16383982,128 0,120.844679 0,111.99458 L0,80.0054195 Z M104,96 C108.418278,96 112,92.418278 112,88 C112,83.581722 108.418278,80 104,80 C99.581722,80 96,83.581722 96,88 C96,92.418278 99.581722,96 104,96 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/quote": {
"title": "$:/core/images/quote",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-quote tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M51.2188077,117.712501 L51.2188077,62.1993386 L27.4274524,62.1993386 C27.4274524,53.3075754 29.1096526,45.797753 32.4741035,39.669646 C35.8385544,33.541539 42.0867267,28.9154883 51.2188077,25.7913554 L51.2188077,2 C43.7689521,2.96127169 36.8599155,5.18417913 30.4914905,8.668789 C24.1230656,12.1533989 18.6559149,16.5391352 14.0898743,21.8261295 C9.52383382,27.1131238 5.97919764,33.2411389 3.45585945,40.2103586 C0.932521268,47.1795784 -0.208971741,54.6293222 0.0313461819,62.5598136 L0.0313461819,117.712501 L51.2188077,117.712501 Z M128,117.712501 L128,62.1993386 L104.208645,62.1993386 C104.208645,53.3075754 105.890845,45.797753 109.255296,39.669646 C112.619747,33.541539 118.867919,28.9154883 128,25.7913554 L128,2 C120.550144,2.96127169 113.641108,5.18417913 107.272683,8.668789 C100.904258,12.1533989 95.4371072,16.5391352 90.8710666,21.8261295 C86.3050261,27.1131238 82.7603899,33.2411389 80.2370517,40.2103586 C77.7137136,47.1795784 76.5722206,54.6293222 76.8125385,62.5598136 L76.8125385,117.712501 L128,117.712501 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/refresh-button": {
"title": "$:/core/images/refresh-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-refresh-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M106.369002,39.4325143 C116.529932,60.3119371 112.939592,86.1974934 95.5979797,103.539105 C73.7286194,125.408466 38.2713806,125.408466 16.4020203,103.539105 C-5.46734008,81.6697449 -5.46734008,46.2125061 16.4020203,24.3431458 C19.5262146,21.2189514 24.5915344,21.2189514 27.7157288,24.3431458 C30.8399231,27.4673401 30.8399231,32.5326599 27.7157288,35.6568542 C12.0947571,51.2778259 12.0947571,76.6044251 27.7157288,92.2253967 C43.3367004,107.846368 68.6632996,107.846368 84.2842712,92.2253967 C97.71993,78.7897379 99.5995262,58.1740623 89.9230597,42.729491 L83.4844861,54.9932839 C81.4307001,58.9052072 76.5945372,60.4115251 72.682614,58.3577391 C68.7706907,56.3039532 67.2643728,51.4677903 69.3181587,47.555867 L84.4354914,18.7613158 C86.4966389,14.8353707 91.3577499,13.3347805 95.273202,15.415792 L124.145886,30.7612457 C128.047354,32.8348248 129.52915,37.6785572 127.455571,41.5800249 C125.381992,45.4814927 120.53826,46.9632892 116.636792,44.8897102 L106.369002,39.4325143 Z M98.1470904,27.0648707 C97.9798954,26.8741582 97.811187,26.6843098 97.6409651,26.4953413 L98.6018187,26.1987327 L98.1470904,27.0648707 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/right-arrow": {
"title": "$:/core/images/right-arrow",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-right-arrow tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <path d=\"M80.3563798,109.353315 C78.9238993,110.786918 76.9450203,111.675144 74.7592239,111.675144 L-4.40893546,111.675144 C-8.77412698,111.675144 -12.3248558,108.130732 -12.3248558,103.758478 C-12.3248558,99.3951199 -8.78077754,95.8418109 -4.40893546,95.8418109 L66.8418109,95.8418109 L66.8418109,24.5910645 C66.8418109,20.225873 70.3862233,16.6751442 74.7584775,16.6751442 C79.1218352,16.6751442 82.6751442,20.2192225 82.6751442,24.5910645 L82.6751442,103.759224 C82.6751442,105.941695 81.7891419,107.920575 80.3566508,109.353886 Z\" transform=\"translate(35.175144, 64.175144) rotate(-45.000000) translate(-35.175144, -64.175144) \"></path>\n</svg>"
},
"$:/core/images/save-button": {
"title": "$:/core/images/save-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-save-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <path d=\"M120.78304,34.329058 C125.424287,43.1924006 128.049406,53.2778608 128.049406,63.9764502 C128.049406,99.3226742 99.3956295,127.97645 64.0494055,127.97645 C28.7031816,127.97645 0.0494055385,99.3226742 0.0494055385,63.9764502 C0.0494055385,28.6302262 28.7031816,-0.0235498012 64.0494055,-0.0235498012 C82.8568763,-0.0235498012 99.769563,8.08898558 111.479045,21.0056358 L114.159581,18.3250998 C117.289194,15.1954866 122.356036,15.1939641 125.480231,18.3181584 C128.598068,21.4359957 128.601317,26.5107804 125.473289,29.6388083 L120.78304,34.329058 Z M108.72451,46.3875877 C110.870571,51.8341374 112.049406,57.767628 112.049406,63.9764502 C112.049406,90.4861182 90.5590735,111.97645 64.0494055,111.97645 C37.5397375,111.97645 16.0494055,90.4861182 16.0494055,63.9764502 C16.0494055,37.4667822 37.5397375,15.9764502 64.0494055,15.9764502 C78.438886,15.9764502 91.3495036,22.308215 100.147097,32.3375836 L58.9411255,73.5435552 L41.975581,56.5780107 C38.8486152,53.4510448 33.7746915,53.4551552 30.6568542,56.5729924 C27.5326599,59.6971868 27.5372202,64.7670668 30.6618725,67.8917192 L53.279253,90.5090997 C54.8435723,92.073419 56.8951519,92.8541315 58.9380216,92.8558261 C60.987971,92.8559239 63.0389578,92.0731398 64.6049211,90.5071765 L108.72451,46.3875877 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/size": {
"title": "$:/core/images/size",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-size tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <path d=\"M92.3431458,26 L83.1715729,35.1715729 C81.6094757,36.73367 81.6094757,39.26633 83.1715729,40.8284271 C84.73367,42.3905243 87.26633,42.3905243 88.8284271,40.8284271 L104.828427,24.8284271 C106.390524,23.26633 106.390524,20.73367 104.828427,19.1715729 L88.8284271,3.17157288 C87.26633,1.60947571 84.73367,1.60947571 83.1715729,3.17157288 C81.6094757,4.73367004 81.6094757,7.26632996 83.1715729,8.82842712 L92.3431457,18 L22,18 C19.790861,18 18,19.790861 18,22 L18,92.3431458 L8.82842712,83.1715729 C7.26632996,81.6094757 4.73367004,81.6094757 3.17157288,83.1715729 C1.60947571,84.73367 1.60947571,87.26633 3.17157288,88.8284271 L19.1715729,104.828427 C20.73367,106.390524 23.26633,106.390524 24.8284271,104.828427 L40.8284271,88.8284271 C42.3905243,87.26633 42.3905243,84.73367 40.8284271,83.1715729 C39.26633,81.6094757 36.73367,81.6094757 35.1715729,83.1715729 L26,92.3431458 L26,22 L22,26 L92.3431458,26 L92.3431458,26 Z M112,52 L112,116 L116,112 L52,112 C49.790861,112 48,113.790861 48,116 C48,118.209139 49.790861,120 52,120 L116,120 C118.209139,120 120,118.209139 120,116 L120,52 C120,49.790861 118.209139,48 116,48 C113.790861,48 112,49.790861 112,52 L112,52 Z\"></path>\n</svg>"
},
"$:/core/images/spiral": {
"title": "$:/core/images/spiral",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-spiral tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"nonzero\">\n <path d=\"M64.534 68.348c3.39 0 6.097-2.62 6.476-5.968l-4.755-.538 4.75.583c.377-3.07-1.194-6.054-3.89-7.78-2.757-1.773-6.34-2.01-9.566-.7-3.46 1.403-6.14 4.392-7.35 8.148l-.01.026c-1.3 4.08-.72 8.64 1.58 12.52 2.5 4.2 6.77 7.2 11.76 8.27 5.37 1.15 11.11-.05 15.83-3.31 5.04-3.51 8.46-9.02 9.45-15.3 1.05-6.7-.72-13.63-4.92-19.19l.02.02c-4.42-5.93-11.2-9.82-18.78-10.78-7.96-1.01-16.13 1.31-22.59 6.43-6.81 5.39-11.18 13.41-12.11 22.26-.98 9.27 1.87 18.65 7.93 26.02 6.32 7.69 15.6 12.56 25.74 13.48 10.54.96 21.15-2.42 29.45-9.4l.01-.01c8.58-7.25 13.94-17.78 14.86-29.21.94-11.84-2.96-23.69-10.86-32.9-8.19-9.5-19.95-15.36-32.69-16.27-13.16-.94-26.24 3.49-36.34 12.34l.01-.01c-10.41 9.08-16.78 22.1-17.68 36.15-.93 14.44 4.03 28.77 13.79 39.78 10.03 11.32 24.28 18.2 39.6 19.09 15.73.92 31.31-4.56 43.24-15.234 12.23-10.954 19.61-26.44 20.5-43.074.14-2.64-1.89-4.89-4.52-5.03-2.64-.14-4.89 1.88-5.03 4.52-.75 14.1-7 27.2-17.33 36.45-10.03 8.98-23.11 13.58-36.3 12.81-12.79-.75-24.67-6.48-33-15.89-8.07-9.11-12.17-20.94-11.41-32.827.74-11.52 5.942-22.15 14.43-29.54l.01-.01c8.18-7.17 18.74-10.75 29.35-9.998 10.21.726 19.6 5.41 26.11 12.96 6.24 7.273 9.32 16.61 8.573 25.894-.718 8.9-4.88 17.064-11.504 22.66l.01-.007c-6.36 5.342-14.44 7.92-22.425 7.19-7.604-.68-14.52-4.314-19.21-10.027-4.44-5.4-6.517-12.23-5.806-18.94.67-6.3 3.76-11.977 8.54-15.766 4.46-3.54 10.05-5.128 15.44-4.44 5.03.63 9.46 3.18 12.32 7.01l.02.024c2.65 3.5 3.75 7.814 3.1 11.92-.59 3.71-2.58 6.925-5.45 8.924-2.56 1.767-5.61 2.403-8.38 1.81-2.42-.516-4.42-1.92-5.53-3.79-.93-1.56-1.15-3.3-.69-4.75l-4.56-1.446L59.325 65c.36-1.12 1.068-1.905 1.84-2.22.25-.103.48-.14.668-.13.06.006.11.015.14.025.01 0 .01 0-.01-.01-.02-.015-.054-.045-.094-.088-.06-.064-.12-.145-.17-.244-.15-.29-.23-.678-.18-1.11l-.005.04c.15-1.332 1.38-2.523 3.035-2.523-2.65 0-4.79 2.144-4.79 4.787s2.14 4.785 4.78 4.785z\"></path>\n </g>\n</svg>"
},
"$:/core/images/stamp": {
"title": "$:/core/images/stamp",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-stamp tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M49.7334301,64 L16.0098166,64 C11.5838751,64 8,67.5829053 8,72.002643 L8,74.4986785 L8,97 L120,97 L120,74.4986785 L120,72.002643 C120,67.5737547 116.413883,64 111.990183,64 L78.2665699,64 C76.502049,60.7519149 75.5,57.0311962 75.5,53.0769231 C75.5,46.6017951 78.1869052,40.7529228 82.5087769,36.5800577 C85.3313113,32.7688808 87,28.0549983 87,22.952183 C87,10.2760423 76.7025492,0 64,0 C51.2974508,0 41,10.2760423 41,22.952183 C41,28.0549983 42.6686887,32.7688808 45.4912231,36.5800577 C49.8130948,40.7529228 52.5,46.6017951 52.5,53.0769231 C52.5,57.0311962 51.497951,60.7519149 49.7334301,64 Z M8,104 L120,104 L120,112 L8,112 L8,104 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/star-filled": {
"title": "$:/core/images/star-filled",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-star-filled tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"nonzero\">\n <path d=\"M61.8361286,96.8228569 L99.1627704,124.110219 C101.883827,126.099427 105.541968,123.420868 104.505636,120.198072 L90.2895569,75.9887263 L89.0292911,79.8977279 L126.314504,52.5528988 C129.032541,50.5595011 127.635256,46.2255025 124.273711,46.2229134 L78.1610486,46.1873965 L81.4604673,48.6032923 L67.1773543,4.41589688 C66.1361365,1.19470104 61.6144265,1.19470104 60.5732087,4.41589688 L46.2900957,48.6032923 L49.5895144,46.1873965 L3.47685231,46.2229134 C0.115307373,46.2255025 -1.28197785,50.5595011 1.43605908,52.5528988 L38.7212719,79.8977279 L37.4610061,75.9887263 L23.2449266,120.198072 C22.2085954,123.420868 25.8667356,126.099427 28.5877926,124.110219 L65.9144344,96.8228569 L61.8361286,96.8228569 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/storyview-classic": {
"title": "$:/core/images/storyview-classic",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-storyview-classic tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M8.00697327,0 C3.58484404,0 0,3.59075293 0,8.00697327 L0,119.993027 C0,124.415156 3.59075293,128 8.00697327,128 L119.993027,128 C124.415156,128 128,124.409247 128,119.993027 L128,8.00697327 C128,3.58484404 124.409247,0 119.993027,0 L8.00697327,0 L8.00697327,0 Z M23.9992458,16 C19.5813843,16 16,19.5776607 16,23.9924054 L16,40.0075946 C16,44.4216782 19.5881049,48 23.9992458,48 L104.000754,48 C108.418616,48 112,44.4223393 112,40.0075946 L112,23.9924054 C112,19.5783218 108.411895,16 104.000754,16 L23.9992458,16 L23.9992458,16 Z M23.9992458,64 C19.5813843,64 16,67.5907123 16,72 C16,76.418278 19.5881049,80 23.9992458,80 L104.000754,80 C108.418616,80 112,76.4092877 112,72 C112,67.581722 108.411895,64 104.000754,64 L23.9992458,64 L23.9992458,64 Z M23.9992458,96 C19.5813843,96 16,99.5907123 16,104 C16,108.418278 19.5881049,112 23.9992458,112 L104.000754,112 C108.418616,112 112,108.409288 112,104 C112,99.581722 108.411895,96 104.000754,96 L23.9992458,96 L23.9992458,96 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/storyview-pop": {
"title": "$:/core/images/storyview-pop",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-storyview-pop tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M8.00697327,0 C3.58484404,0 0,3.59075293 0,8.00697327 L0,119.993027 C0,124.415156 3.59075293,128 8.00697327,128 L119.993027,128 C124.415156,128 128,124.409247 128,119.993027 L128,8.00697327 C128,3.58484404 124.409247,0 119.993027,0 L8.00697327,0 L8.00697327,0 Z M23.9992458,16 C19.5813843,16 16,19.5776607 16,23.9924054 L16,40.0075946 C16,44.4216782 19.5881049,48 23.9992458,48 L104.000754,48 C108.418616,48 112,44.4223393 112,40.0075946 L112,23.9924054 C112,19.5783218 108.411895,16 104.000754,16 L23.9992458,16 L23.9992458,16 Z M16.0098166,56 C11.586117,56 8,59.5776607 8,63.9924054 L8,80.0075946 C8,84.4216782 11.5838751,88 16.0098166,88 L111.990183,88 C116.413883,88 120,84.4223393 120,80.0075946 L120,63.9924054 C120,59.5783218 116.416125,56 111.990183,56 L16.0098166,56 L16.0098166,56 Z M23.9992458,96 C19.5813843,96 16,99.5907123 16,104 C16,108.418278 19.5881049,112 23.9992458,112 L104.000754,112 C108.418616,112 112,108.409288 112,104 C112,99.581722 108.411895,96 104.000754,96 L23.9992458,96 L23.9992458,96 Z M23.9992458,64 C19.5813843,64 16,67.5907123 16,72 C16,76.418278 19.5881049,80 23.9992458,80 L104.000754,80 C108.418616,80 112,76.4092877 112,72 C112,67.581722 108.411895,64 104.000754,64 L23.9992458,64 L23.9992458,64 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/storyview-zoomin": {
"title": "$:/core/images/storyview-zoomin",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-storyview-zoomin tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M8.00697327,0 C3.58484404,0 0,3.59075293 0,8.00697327 L0,119.993027 C0,124.415156 3.59075293,128 8.00697327,128 L119.993027,128 C124.415156,128 128,124.409247 128,119.993027 L128,8.00697327 C128,3.58484404 124.409247,0 119.993027,0 L8.00697327,0 L8.00697327,0 Z M23.9992458,16 C19.5813843,16 16,19.578055 16,24.0085154 L16,71.9914846 C16,76.4144655 19.5881049,80 23.9992458,80 L104.000754,80 C108.418616,80 112,76.421945 112,71.9914846 L112,24.0085154 C112,19.5855345 108.411895,16 104.000754,16 L23.9992458,16 L23.9992458,16 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/strikethrough": {
"title": "$:/core/images/strikethrough",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-strikethrough tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M92.793842,38.7255689 L108.215529,38.7255689 C107.987058,31.985687 106.70193,26.1883331 104.360107,21.3333333 C102.018284,16.4783336 98.8197436,12.4516001 94.7643909,9.25301205 C90.7090382,6.05442399 85.9969032,3.71263572 80.6278447,2.22757697 C75.2587862,0.742518233 69.4328739,0 63.1499331,0 C57.552404,0 52.0977508,0.713959839 46.7858099,2.14190094 C41.473869,3.56984203 36.7331757,5.74027995 32.5635877,8.65327979 C28.3939997,11.5662796 25.0526676,15.2788708 22.5394913,19.7911647 C20.026315,24.3034585 18.7697456,29.6438781 18.7697456,35.8125837 C18.7697456,41.4101128 19.883523,46.0651309 22.1111111,49.7777778 C24.3386992,53.4904246 27.3087722,56.5176144 31.021419,58.8594378 C34.7340659,61.2012612 38.9321497,63.0861151 43.6157965,64.5140562 C48.2994433,65.9419973 53.068695,67.1985666 57.9236948,68.2838019 C62.7786945,69.3690371 67.5479462,70.4256977 72.231593,71.4538153 C76.9152398,72.4819329 81.1133237,73.8241773 84.8259705,75.480589 C88.5386174,77.1370007 91.5086903,79.2788802 93.7362784,81.9062918 C95.9638666,84.5337035 97.0776439,87.9607107 97.0776439,92.1874163 C97.0776439,96.6425926 96.1637753,100.298067 94.3360107,103.153949 C92.5082461,106.009831 90.109341,108.265944 87.1392236,109.922356 C84.1691061,111.578768 80.827774,112.749662 77.1151272,113.435074 C73.4024803,114.120485 69.7184476,114.463186 66.0629183,114.463186 C61.4935068,114.463186 57.0383974,113.892018 52.6974565,112.749665 C48.3565156,111.607312 44.5582492,109.836692 41.3025435,107.437751 C38.0468378,105.03881 35.4194656,101.983062 33.4203481,98.270415 C31.4212305,94.5577681 30.4216867,90.1312171 30.4216867,84.9906292 L15,84.9906292 C15,92.4159229 16.3422445,98.8415614 19.0267738,104.267738 C21.711303,109.693914 25.3667774,114.149023 29.9933066,117.633199 C34.6198357,121.117376 39.9888137,123.71619 46.1004016,125.429719 C52.2119895,127.143248 58.6947448,128 65.5488621,128 C71.1463912,128 76.7723948,127.343157 82.4270415,126.029451 C88.0816882,124.715745 93.1936407,122.602424 97.7630522,119.689424 C102.332464,116.776425 106.073613,113.006717 108.986613,108.380187 C111.899613,103.753658 113.356091,98.1847715 113.356091,91.6733601 C113.356091,85.6188899 112.242314,80.5926126 110.014726,76.5943775 C107.787137,72.5961424 104.817065,69.2833688 101.104418,66.6559572 C97.3917708,64.0285455 93.193687,61.9437828 88.5100402,60.4016064 C83.8263934,58.85943 79.0571416,57.5171855 74.2021419,56.3748327 C69.3471422,55.2324798 64.5778904,54.1758192 59.8942436,53.2048193 C55.2105968,52.2338193 51.012513,51.0058084 47.2998661,49.5207497 C43.5872193,48.0356909 40.6171463,46.1222786 38.3895582,43.7804552 C36.1619701,41.4386318 35.0481928,38.3828836 35.0481928,34.6131191 C35.0481928,30.6148841 35.8192694,27.273552 37.3614458,24.5890228 C38.9036222,21.9044935 40.9598265,19.762614 43.5301205,18.1633199 C46.1004145,16.5640259 49.041929,15.4216902 52.3547523,14.7362784 C55.6675757,14.0508667 59.0374661,13.708166 62.4645248,13.708166 C70.9179361,13.708166 77.8576257,15.6786952 83.2838019,19.6198126 C88.709978,23.56093 91.8799597,29.9294518 92.793842,38.7255689 L92.793842,38.7255689 Z\"></path>\n <rect x=\"5\" y=\"54\" width=\"118\" height=\"16\"></rect>\n </g>\n</svg>"
},
"$:/core/images/subscript": {
"title": "$:/core/images/subscript",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-subscript tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M2.27170276,16 L22.1825093,16 L43.8305003,49.6746527 L66.4138983,16 L85.1220387,16 L53.5854592,61.9685735 L87.3937414,111.411516 L67.0820462,111.411516 L43.295982,74.9306422 L19.1090291,111.411516 L0,111.411516 L33.8082822,61.9685735 L2.27170276,16 Z M127.910914,128.411516 L85.3276227,128.411516 C85.3870139,123.24448 86.6342108,118.730815 89.0692508,114.870386 C91.5042907,111.009956 94.8301491,107.654403 99.0469256,104.803624 C101.066227,103.318844 103.174584,101.878629 105.372059,100.482935 C107.569534,99.0872413 109.588805,97.5876355 111.429933,95.9840726 C113.271061,94.3805097 114.785514,92.6433426 115.973338,90.7725192 C117.161163,88.9016958 117.784761,86.7487964 117.844152,84.3137564 C117.844152,83.1853233 117.710524,81.9826691 117.443264,80.7057579 C117.176003,79.4288467 116.656338,78.2410402 115.884252,77.1423026 C115.112166,76.0435651 114.04314,75.123015 112.677142,74.3806248 C111.311144,73.6382345 109.529434,73.267045 107.331959,73.267045 C105.312658,73.267045 103.634881,73.6679297 102.298579,74.4697112 C100.962276,75.2714926 99.8932503,76.3702137 99.0914688,77.7659073 C98.2896874,79.161601 97.6957841,80.8096826 97.3097412,82.7102016 C96.9236982,84.6107206 96.7009845,86.6596869 96.6415933,88.857162 L86.4857457,88.857162 C86.4857457,85.4124713 86.9460207,82.2202411 87.8665846,79.2803758 C88.7871485,76.3405105 90.1679736,73.801574 92.0091014,71.6634901 C93.8502292,69.5254062 96.092214,67.8476295 98.7351233,66.6301095 C101.378033,65.4125895 104.451482,64.8038386 107.955564,64.8038386 C111.756602,64.8038386 114.933984,65.4274371 117.487807,66.6746527 C120.041629,67.9218683 122.105443,69.4957119 123.67931,71.3962309 C125.253178,73.2967499 126.366746,75.3605638 127.02005,77.5877345 C127.673353,79.8149053 128,81.9381095 128,83.9574109 C128,86.4518421 127.613963,88.7086746 126.841877,90.727976 C126.069791,92.7472774 125.03046,94.6032252 123.723854,96.2958749 C122.417247,97.9885247 120.932489,99.5475208 119.269534,100.97291 C117.60658,102.398299 115.884261,103.734582 114.102524,104.981797 C112.320788,106.229013 110.539078,107.416819 108.757341,108.545253 C106.975605,109.673686 105.327523,110.802102 103.813047,111.930535 C102.298571,113.058968 100.977136,114.231927 99.8487031,115.449447 C98.7202699,116.666967 97.9481956,117.958707 97.5324571,119.324705 L127.910914,119.324705 L127.910914,128.411516 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/superscript": {
"title": "$:/core/images/superscript",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-superscript tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M2.27170276,16 L22.1825093,16 L43.8305003,49.6746527 L66.4138983,16 L85.1220387,16 L53.5854592,61.9685735 L87.3937414,111.411516 L67.0820462,111.411516 L43.295982,74.9306422 L19.1090291,111.411516 L0,111.411516 L33.8082822,61.9685735 L2.27170276,16 Z M127.910914,63.4115159 L85.3276227,63.4115159 C85.3870139,58.2444799 86.6342108,53.7308149 89.0692508,49.8703857 C91.5042907,46.0099565 94.8301491,42.654403 99.0469256,39.8036245 C101.066227,38.318844 103.174584,36.8786285 105.372059,35.4829349 C107.569534,34.0872413 109.588805,32.5876355 111.429933,30.9840726 C113.271061,29.3805097 114.785514,27.6433426 115.973338,25.7725192 C117.161163,23.9016958 117.784761,21.7487964 117.844152,19.3137564 C117.844152,18.1853233 117.710524,16.9826691 117.443264,15.7057579 C117.176003,14.4288467 116.656338,13.2410402 115.884252,12.1423026 C115.112166,11.0435651 114.04314,10.123015 112.677142,9.38062477 C111.311144,8.63823453 109.529434,8.26704499 107.331959,8.26704499 C105.312658,8.26704499 103.634881,8.6679297 102.298579,9.46971115 C100.962276,10.2714926 99.8932503,11.3702137 99.0914688,12.7659073 C98.2896874,14.161601 97.6957841,15.8096826 97.3097412,17.7102016 C96.9236982,19.6107206 96.7009845,21.6596869 96.6415933,23.857162 L86.4857457,23.857162 C86.4857457,20.4124713 86.9460207,17.2202411 87.8665846,14.2803758 C88.7871485,11.3405105 90.1679736,8.80157397 92.0091014,6.6634901 C93.8502292,4.52540622 96.092214,2.84762946 98.7351233,1.63010947 C101.378033,0.412589489 104.451482,-0.196161372 107.955564,-0.196161372 C111.756602,-0.196161372 114.933984,0.427437071 117.487807,1.67465266 C120.041629,2.92186826 122.105443,4.49571195 123.67931,6.39623095 C125.253178,8.29674995 126.366746,10.3605638 127.02005,12.5877345 C127.673353,14.8149053 128,16.9381095 128,18.9574109 C128,21.4518421 127.613963,23.7086746 126.841877,25.727976 C126.069791,27.7472774 125.03046,29.6032252 123.723854,31.2958749 C122.417247,32.9885247 120.932489,34.5475208 119.269534,35.97291 C117.60658,37.3982993 115.884261,38.7345816 114.102524,39.9817972 C112.320788,41.2290128 110.539078,42.4168194 108.757341,43.5452525 C106.975605,44.6736857 105.327523,45.8021019 103.813047,46.9305351 C102.298571,48.0589682 100.977136,49.2319272 99.8487031,50.4494472 C98.7202699,51.6669672 97.9481956,52.9587068 97.5324571,54.3247048 L127.910914,54.3247048 L127.910914,63.4115159 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/tag-button": {
"title": "$:/core/images/tag-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-tag-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M18.1643182,47.6600756 L18.1677196,51.7651887 C18.1708869,55.5878829 20.3581578,60.8623899 23.0531352,63.5573673 L84.9021823,125.406414 C87.5996731,128.103905 91.971139,128.096834 94.6717387,125.396234 L125.766905,94.3010679 C128.473612,91.5943612 128.472063,87.2264889 125.777085,84.5315115 L63.9280381,22.6824644 C61.2305472,19.9849735 55.9517395,17.801995 52.1318769,17.8010313 L25.0560441,17.7942007 C21.2311475,17.7932358 18.1421354,20.8872832 18.1452985,24.7049463 L18.1535504,34.6641936 C18.2481119,34.6754562 18.3439134,34.6864294 18.4409623,34.6971263 C22.1702157,35.1081705 26.9295004,34.6530132 31.806204,33.5444844 C32.1342781,33.0700515 32.5094815,32.6184036 32.9318197,32.1960654 C35.6385117,29.4893734 39.5490441,28.718649 42.94592,29.8824694 C43.0432142,29.8394357 43.1402334,29.7961748 43.2369683,29.7526887 L43.3646982,30.0368244 C44.566601,30.5115916 45.6933052,31.2351533 46.6655958,32.2074439 C50.4612154,36.0030635 50.4663097,42.1518845 46.6769742,45.94122 C43.0594074,49.5587868 37.2914155,49.7181264 33.4734256,46.422636 C28.1082519,47.5454734 22.7987486,48.0186448 18.1643182,47.6600756 Z\"></path>\n <path d=\"M47.6333528,39.5324628 L47.6562932,39.5834939 C37.9670934,43.9391617 26.0718874,46.3819521 17.260095,45.4107025 C5.27267473,44.0894301 -1.02778744,36.4307276 2.44271359,24.0779512 C5.56175386,12.9761516 14.3014034,4.36129832 24.0466405,1.54817001 C34.7269254,-1.53487574 43.7955833,3.51606438 43.7955834,14.7730751 L35.1728168,14.7730752 C35.1728167,9.91428944 32.0946059,8.19982862 26.4381034,9.83267419 C19.5270911,11.8276553 13.046247,18.2159574 10.7440788,26.4102121 C8.82861123,33.2280582 11.161186,36.0634845 18.2047888,36.8398415 C25.3302805,37.6252244 35.7353482,35.4884477 44.1208333,31.7188498 L44.1475077,31.7781871 C44.159701,31.7725635 44.1718402,31.7671479 44.1839238,31.7619434 C45.9448098,31.0035157 50.4503245,38.3109156 47.7081571,39.5012767 C47.6834429,39.512005 47.6585061,39.5223987 47.6333528,39.5324628 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/theme-button": {
"title": "$:/core/images/theme-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-theme-button tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M55.854113,66.9453198 C54.3299482,65.1432292 53.0133883,63.518995 51.9542746,62.1263761 C40.8899947,47.578055 35.3091807,55.2383404 28.9941893,62.1263758 C22.6791979,69.0144112 30.6577916,74.5954741 24.6646171,79.4611023 C18.6714426,84.3267304 19.0414417,86.0133155 8.92654943,77.1119468 C-1.18834284,68.2105781 -1.88793412,65.7597832 2.7553553,60.6807286 C7.39864472,55.601674 11.2794845,63.5989423 20.7646627,54.5728325 C30.2498409,45.5467226 22.2819131,37.5470737 22.2819131,37.5470737 C22.2819131,37.5470737 42.0310399,-2.82433362 68.4206088,0.157393922 C94.8101776,3.13912147 58.4373806,-3.70356506 49.3898693,27.958066 C45.5161782,41.5139906 50.1107906,38.3197672 57.4560458,44.0453955 C59.1625767,45.3756367 63.8839488,48.777453 70.127165,53.3625321 C63.9980513,59.2416709 58.9704753,64.0315459 55.854113,66.9453198 Z M67.4952439,79.8919946 C83.5082212,96.9282402 105.237121,117.617674 112.611591,120.312493 C123.044132,124.12481 128.000001,117.170903 128,105.522947 C127.999999,98.3705516 104.170675,78.980486 84.0760493,63.7529565 C76.6683337,70.9090328 70.7000957,76.7055226 67.4952439,79.8919946 Z\"></path>\n <path d=\"M58.2852966,138.232794 L58.2852966,88.3943645 C56.318874,88.3923153 54.7254089,86.7952906 54.7254089,84.8344788 C54.7254089,82.8684071 56.3175932,81.2745911 58.2890859,81.2745911 L79.6408336,81.2745911 C81.608998,81.2745911 83.2045105,82.8724076 83.2045105,84.8344788 C83.2045105,86.7992907 81.614366,88.3923238 79.6446228,88.3943645 L79.6446228,88.3943646 L79.6446228,138.232794 C79.6446228,144.131009 74.8631748,148.912457 68.9649597,148.912457 C63.0667446,148.912457 58.2852966,144.131009 58.2852966,138.232794 Z M65.405072,-14.8423767 L72.5248474,-14.8423767 L76.0847351,-0.690681892 L72.5248474,6.51694947 L72.5248474,81.2745911 L65.405072,81.2745911 L65.405072,6.51694947 L61.8451843,-0.690681892 L65.405072,-14.8423767 Z\" transform=\"translate(68.964960, 67.035040) rotate(45.000000) translate(-68.964960, -67.035040) \"></path>\n </g>\n</svg>"
},
"$:/core/images/timestamp-off": {
"title": "$:/core/images/timestamp-off",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-timestamp-off tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10c-2.762 0-5-2.24-5-5-.004-2.756 2.238-5 5-5H66.69c2.762 0 5.002 2.24 5 5 .006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M58.25 35.88c-18.777 0-33.998 15.224-33.998 33.998 0 18.773 15.22 34.002 33.998 34.002 18.784 0 34.002-15.23 34.002-34.002 0-18.774-15.218-33.998-34.002-33.998zm-3.03 50.123H44.196v-34H55.22v34zm16.976 0H61.17v-34h11.025v34z\"/>\n </g>\n</svg>\n"
},
"$:/core/images/timestamp-on": {
"title": "$:/core/images/timestamp-on",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-timestamp-on tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10c-2.762 0-5-2.24-5-5-.004-2.756 2.238-5 5-5H66.69c2.762 0 5.002 2.24 5 5 .006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M13.41 27.178c-2.116 1.775-5.27 1.498-7.045-.613-1.772-2.11-1.498-5.27.616-7.047l9.95-8.348c2.115-1.774 5.27-1.5 7.045.618 1.775 2.108 1.498 5.27-.616 7.043l-9.95 8.348zM102.983 27.178c2.116 1.775 5.27 1.498 7.045-.613 1.772-2.11 1.498-5.27-.616-7.047l-9.95-8.348c-2.114-1.774-5.27-1.5-7.044.618-1.775 2.108-1.498 5.27.616 7.043l9.95 8.348zM65.097 71.072c0 3.826-3.09 6.928-6.897 6.928-3.804.006-6.9-3.102-6.903-6.928 0 0 4.76-39.072 6.903-39.072s6.897 39.072 6.897 39.072z\"/>\n </g>\n</svg>\n"
},
"$:/core/images/tip": {
"title": "$:/core/images/tip",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-tip tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M64,128.241818 C99.346224,128.241818 128,99.5880417 128,64.2418177 C128,28.8955937 99.346224,0.241817675 64,0.241817675 C28.653776,0.241817675 0,28.8955937 0,64.2418177 C0,99.5880417 28.653776,128.241818 64,128.241818 Z M75.9358659,91.4531941 C75.3115438,95.581915 70.2059206,98.8016748 64,98.8016748 C57.7940794,98.8016748 52.6884562,95.581915 52.0641341,91.4531941 C54.3299053,94.0502127 58.8248941,95.8192805 64,95.8192805 C69.1751059,95.8192805 73.6700947,94.0502127 75.9358659,91.4531941 L75.9358659,91.4531941 Z M75.9358659,95.9453413 C75.3115438,100.074062 70.2059206,103.293822 64,103.293822 C57.7940794,103.293822 52.6884562,100.074062 52.0641341,95.9453413 C54.3299053,98.5423599 58.8248941,100.311428 64,100.311428 C69.1751059,100.311428 73.6700947,98.5423599 75.9358659,95.9453413 L75.9358659,95.9453413 Z M75.9358659,100.40119 C75.3115438,104.529911 70.2059206,107.74967 64,107.74967 C57.7940794,107.74967 52.6884562,104.529911 52.0641341,100.40119 C54.3299053,102.998208 58.8248941,104.767276 64,104.767276 C69.1751059,104.767276 73.6700947,102.998208 75.9358659,100.40119 L75.9358659,100.40119 Z M75.9358659,104.893337 C75.3115438,109.022058 70.2059206,112.241818 64,112.241818 C57.7940794,112.241818 52.6884562,109.022058 52.0641341,104.893337 C54.3299053,107.490356 58.8248941,109.259423 64,109.259423 C69.1751059,109.259423 73.6700947,107.490356 75.9358659,104.893337 L75.9358659,104.893337 Z M64.3010456,24.2418177 C75.9193117,24.2418188 88.0000013,32.0619847 88,48.4419659 C87.9999987,64.8219472 75.9193018,71.7540963 75.9193021,83.5755932 C75.9193022,89.4486648 70.0521957,92.8368862 63.9999994,92.8368862 C57.947803,92.8368862 51.9731007,89.8295115 51.9731007,83.5755932 C51.9731007,71.1469799 39.9999998,65.4700602 40,48.4419647 C40.0000002,31.4138691 52.6827796,24.2418166 64.3010456,24.2418177 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/twitter": {
"title": "$:/core/images/twitter",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-twitter tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M41.6263422,115.803477 C27.0279663,115.803477 13.4398394,111.540813 1.99987456,104.234833 C4.02221627,104.472643 6.08004574,104.594302 8.16644978,104.594302 C20.277456,104.594302 31.4238403,100.47763 40.270894,93.5715185 C28.9590538,93.3635501 19.4123842,85.9189246 16.1230832,75.6885328 C17.7011365,75.9892376 19.320669,76.1503787 20.9862896,76.1503787 C23.344152,76.1503787 25.6278127,75.8359011 27.7971751,75.247346 C15.9709927,72.8821073 7.06079851,62.4745062 7.06079851,49.9982394 C7.06079851,49.8898938 7.06079851,49.7820074 7.06264203,49.67458 C10.5482779,51.6032228 14.5339687,52.7615103 18.7717609,52.8951059 C11.8355159,48.277565 7.2714207,40.3958845 7.2714207,31.4624258 C7.2714207,26.7434257 8.54621495,22.3200804 10.7713439,18.5169676 C23.5211299,34.0957738 42.568842,44.3472839 64.0532269,45.4210985 C63.6126256,43.5365285 63.3835682,41.5711584 63.3835682,39.5529928 C63.3835682,25.3326379 74.95811,13.8034766 89.2347917,13.8034766 C96.6697089,13.8034766 103.387958,16.930807 108.103682,21.9353619 C113.991886,20.780288 119.52429,18.6372496 124.518847,15.6866694 C122.588682,21.6993889 118.490075,26.7457211 113.152623,29.9327334 C118.381769,29.3102055 123.363882,27.926045 127.999875,25.8780385 C124.534056,31.0418981 120.151087,35.5772616 115.100763,39.2077561 C115.150538,40.3118708 115.175426,41.4224128 115.175426,42.538923 C115.175426,76.5663154 89.1744164,115.803477 41.6263422,115.803477\"></path>\n </g>\n</svg>\n"
},
"$:/core/images/underline": {
"title": "$:/core/images/underline",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-underline tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M7,117.421488 L121.247934,117.421488 L121.247934,128 L7,128 L7,117.421488 Z M104.871212,98.8958333 L104.871212,0 L88.6117424,0 L88.6117424,55.8560606 C88.6117424,60.3194668 88.0060035,64.432115 86.7945076,68.1941288 C85.5830116,71.9561425 83.7657949,75.239885 81.342803,78.0454545 C78.9198111,80.8510241 75.8911167,83.0189317 72.2566288,84.5492424 C68.6221409,86.0795531 64.3182067,86.844697 59.344697,86.844697 C53.0959284,86.844697 48.1862552,85.0593613 44.6155303,81.4886364 C41.0448054,77.9179114 39.2594697,73.0720003 39.2594697,66.9507576 L39.2594697,0 L23,0 L23,65.0378788 C23,70.3939662 23.5419769,75.2717583 24.625947,79.6714015 C25.709917,84.0710447 27.5908957,87.864883 30.2689394,91.0530303 C32.9469831,94.2411776 36.4538925,96.6960141 40.7897727,98.4176136 C45.125653,100.139213 50.545422,101 57.0492424,101 C64.3182182,101 70.630655,99.5653553 75.9867424,96.6960227 C81.3428298,93.8266902 85.742407,89.33147 89.1856061,83.2102273 L89.5681818,83.2102273 L89.5681818,98.8958333 L104.871212,98.8958333 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/unfold-all-button": {
"title": "$:/core/images/unfold-all-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-unfold-all tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"0\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"0\" y=\"64\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <path d=\"M85.598226,8.34884273 C84.1490432,6.89863875 82.1463102,6 79.9340286,6 L47.9482224,6 C43.5292967,6 39.9411255,9.581722 39.9411255,14 C39.9411255,18.4092877 43.5260249,22 47.9482224,22 L71.9411255,22 L71.9411255,45.9929031 C71.9411255,50.4118288 75.5228475,54 79.9411255,54 C84.3504132,54 87.9411255,50.4151006 87.9411255,45.9929031 L87.9411255,14.0070969 C87.9411255,11.7964515 87.0447363,9.79371715 85.5956548,8.34412458 Z\" transform=\"translate(63.941125, 30.000000) scale(1, -1) rotate(-45.000000) translate(-63.941125, -30.000000) \"></path>\n <path d=\"M85.6571005,72.2899682 C84.2079177,70.8397642 82.2051847,69.9411255 79.9929031,69.9411255 L48.0070969,69.9411255 C43.5881712,69.9411255 40,73.5228475 40,77.9411255 C40,82.3504132 43.5848994,85.9411255 48.0070969,85.9411255 L72,85.9411255 L72,109.934029 C72,114.352954 75.581722,117.941125 80,117.941125 C84.4092877,117.941125 88,114.356226 88,109.934029 L88,77.9482224 C88,75.737577 87.1036108,73.7348426 85.6545293,72.2852501 Z\" transform=\"translate(64.000000, 93.941125) scale(1, -1) rotate(-45.000000) translate(-64.000000, -93.941125) \"></path>\n </g>\n</svg>"
},
"$:/core/images/unfold-button": {
"title": "$:/core/images/unfold-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-unfold tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"0\" width=\"128\" height=\"16\" rx=\"8\"></rect>\n <path d=\"M85.598226,11.3488427 C84.1490432,9.89863875 82.1463102,9 79.9340286,9 L47.9482224,9 C43.5292967,9 39.9411255,12.581722 39.9411255,17 C39.9411255,21.4092877 43.5260249,25 47.9482224,25 L71.9411255,25 L71.9411255,48.9929031 C71.9411255,53.4118288 75.5228475,57 79.9411255,57 C84.3504132,57 87.9411255,53.4151006 87.9411255,48.9929031 L87.9411255,17.0070969 C87.9411255,14.7964515 87.0447363,12.7937171 85.5956548,11.3441246 Z\" transform=\"translate(63.941125, 33.000000) scale(1, -1) rotate(-45.000000) translate(-63.941125, -33.000000) \"></path>\n <path d=\"M85.6571005,53.4077172 C84.2079177,51.9575133 82.2051847,51.0588745 79.9929031,51.0588745 L48.0070969,51.0588745 C43.5881712,51.0588745 40,54.6405965 40,59.0588745 C40,63.4681622 43.5848994,67.0588745 48.0070969,67.0588745 L72,67.0588745 L72,91.0517776 C72,95.4707033 75.581722,99.0588745 80,99.0588745 C84.4092877,99.0588745 88,95.4739751 88,91.0517776 L88,59.0659714 C88,56.855326 87.1036108,54.8525917 85.6545293,53.4029991 Z\" transform=\"translate(64.000000, 75.058875) scale(1, -1) rotate(-45.000000) translate(-64.000000, -75.058875) \"></path>\n </g>\n</svg>"
},
"$:/core/images/unlocked-padlock": {
"title": "$:/core/images/unlocked-padlock",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-unlocked-padlock tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M48.6266053,64 L105,64 L105,96.0097716 C105,113.673909 90.6736461,128 73.001193,128 L55.998807,128 C38.3179793,128 24,113.677487 24,96.0097716 L24,64 L30.136303,64 C19.6806213,51.3490406 2.77158986,28.2115132 25.8366966,8.85759246 C50.4723026,-11.8141335 71.6711028,13.2108337 81.613302,25.0594855 C91.5555012,36.9081373 78.9368488,47.4964439 69.1559674,34.9513593 C59.375086,22.4062748 47.9893192,10.8049522 35.9485154,20.9083862 C23.9077117,31.0118202 34.192312,43.2685325 44.7624679,55.8655518 C47.229397,58.805523 48.403443,61.5979188 48.6266053,64 Z M67.7315279,92.3641717 C70.8232551,91.0923621 73,88.0503841 73,84.5 C73,79.8055796 69.1944204,76 64.5,76 C59.8055796,76 56,79.8055796 56,84.5 C56,87.947435 58.0523387,90.9155206 61.0018621,92.2491029 L55.9067479,115.020857 L72.8008958,115.020857 L67.7315279,92.3641717 L67.7315279,92.3641717 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/up-arrow": {
"created": "20150316000544368",
"modified": "20150316000831867",
"tags": "$:/tags/Image",
"title": "$:/core/images/up-arrow",
"text": "<svg class=\"tc-image-up-arrow tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n<path transform=\"rotate(-135, 63.8945, 64.1752)\" d=\"m109.07576,109.35336c-1.43248,1.43361 -3.41136,2.32182 -5.59717,2.32182l-79.16816,0c-4.36519,0 -7.91592,-3.5444 -7.91592,-7.91666c0,-4.36337 3.54408,-7.91667 7.91592,-7.91667l71.25075,0l0,-71.25074c0,-4.3652 3.54442,-7.91592 7.91667,-7.91592c4.36336,0 7.91667,3.54408 7.91667,7.91592l0,79.16815c0,2.1825 -0.88602,4.16136 -2.3185,5.59467l-0.00027,-0.00056l0.00001,-0.00001z\" />\n</svg>\n \n"
},
"$:/core/images/video": {
"title": "$:/core/images/video",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-video tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M64,12 C29.0909091,12 8.72727273,14.9166667 5.81818182,17.8333333 C2.90909091,20.75 1.93784382e-15,41.1666667 0,64.5 C1.93784382e-15,87.8333333 2.90909091,108.25 5.81818182,111.166667 C8.72727273,114.083333 29.0909091,117 64,117 C98.9090909,117 119.272727,114.083333 122.181818,111.166667 C125.090909,108.25 128,87.8333333 128,64.5 C128,41.1666667 125.090909,20.75 122.181818,17.8333333 C119.272727,14.9166667 98.9090909,12 64,12 Z M54.9161194,44.6182253 C51.102648,42.0759111 48.0112186,43.7391738 48.0112186,48.3159447 L48.0112186,79.6840553 C48.0112186,84.2685636 51.109784,85.9193316 54.9161194,83.3817747 L77.0838806,68.6032672 C80.897352,66.0609529 80.890216,61.9342897 77.0838806,59.3967328 L54.9161194,44.6182253 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/warning": {
"title": "$:/core/images/warning",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-warning tc-image-button\" width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\">\n <g fill-rule=\"evenodd\">\n <path d=\"M57.0717968,11 C60.1509982,5.66666667 67.8490018,5.66666667 70.9282032,11 L126.353829,107 C129.433031,112.333333 125.584029,119 119.425626,119 L8.57437416,119 C2.41597129,119 -1.43303051,112.333333 1.64617093,107 L57.0717968,11 Z M64,37 C59.581722,37 56,40.5820489 56,44.9935776 L56,73.0064224 C56,77.4211534 59.5907123,81 64,81 C68.418278,81 72,77.4179511 72,73.0064224 L72,44.9935776 C72,40.5788466 68.4092877,37 64,37 Z M64,104 C68.418278,104 72,100.418278 72,96 C72,91.581722 68.418278,88 64,88 C59.581722,88 56,91.581722 56,96 C56,100.418278 59.581722,104 64,104 Z\"></path>\n </g>\n</svg>"
},
"$:/language/Buttons/AdvancedSearch/Caption": {
"title": "$:/language/Buttons/AdvancedSearch/Caption",
"text": "advanced search"
},
"$:/language/Buttons/AdvancedSearch/Hint": {
"title": "$:/language/Buttons/AdvancedSearch/Hint",
"text": "Advanced search"
},
"$:/language/Buttons/Cancel/Caption": {
"title": "$:/language/Buttons/Cancel/Caption",
"text": "cancel"
},
"$:/language/Buttons/Cancel/Hint": {
"title": "$:/language/Buttons/Cancel/Hint",
"text": "Discard changes to this tiddler"
},
"$:/language/Buttons/Clone/Caption": {
"title": "$:/language/Buttons/Clone/Caption",
"text": "clone"
},
"$:/language/Buttons/Clone/Hint": {
"title": "$:/language/Buttons/Clone/Hint",
"text": "Clone this tiddler"
},
"$:/language/Buttons/Close/Caption": {
"title": "$:/language/Buttons/Close/Caption",
"text": "close"
},
"$:/language/Buttons/Close/Hint": {
"title": "$:/language/Buttons/Close/Hint",
"text": "Close this tiddler"
},
"$:/language/Buttons/CloseAll/Caption": {
"title": "$:/language/Buttons/CloseAll/Caption",
"text": "close all"
},
"$:/language/Buttons/CloseAll/Hint": {
"title": "$:/language/Buttons/CloseAll/Hint",
"text": "Close all tiddlers"
},
"$:/language/Buttons/CloseOthers/Caption": {
"title": "$:/language/Buttons/CloseOthers/Caption",
"text": "close others"
},
"$:/language/Buttons/CloseOthers/Hint": {
"title": "$:/language/Buttons/CloseOthers/Hint",
"text": "Close other tiddlers"
},
"$:/language/Buttons/ControlPanel/Caption": {
"title": "$:/language/Buttons/ControlPanel/Caption",
"text": "control panel"
},
"$:/language/Buttons/ControlPanel/Hint": {
"title": "$:/language/Buttons/ControlPanel/Hint",
"text": "Open control panel"
},
"$:/language/Buttons/Delete/Caption": {
"title": "$:/language/Buttons/Delete/Caption",
"text": "delete"
},
"$:/language/Buttons/Delete/Hint": {
"title": "$:/language/Buttons/Delete/Hint",
"text": "Delete this tiddler"
},
"$:/language/Buttons/Edit/Caption": {
"title": "$:/language/Buttons/Edit/Caption",
"text": "edit"
},
"$:/language/Buttons/Edit/Hint": {
"title": "$:/language/Buttons/Edit/Hint",
"text": "Edit this tiddler"
},
"$:/language/Buttons/Encryption/Caption": {
"title": "$:/language/Buttons/Encryption/Caption",
"text": "encryption"
},
"$:/language/Buttons/Encryption/Hint": {
"title": "$:/language/Buttons/Encryption/Hint",
"text": "Set or clear a password for saving this wiki"
},
"$:/language/Buttons/Encryption/ClearPassword/Caption": {
"title": "$:/language/Buttons/Encryption/ClearPassword/Caption",
"text": "clear password"
},
"$:/language/Buttons/Encryption/ClearPassword/Hint": {
"title": "$:/language/Buttons/Encryption/ClearPassword/Hint",
"text": "Clear the password and save this wiki without encryption"
},
"$:/language/Buttons/Encryption/SetPassword/Caption": {
"title": "$:/language/Buttons/Encryption/SetPassword/Caption",
"text": "set password"
},
"$:/language/Buttons/Encryption/SetPassword/Hint": {
"title": "$:/language/Buttons/Encryption/SetPassword/Hint",
"text": "Set a password for saving this wiki with encryption"
},
"$:/language/Buttons/ExportPage/Caption": {
"title": "$:/language/Buttons/ExportPage/Caption",
"text": "export all"
},
"$:/language/Buttons/ExportPage/Hint": {
"title": "$:/language/Buttons/ExportPage/Hint",
"text": "Export all tiddlers"
},
"$:/language/Buttons/ExportTiddler/Caption": {
"title": "$:/language/Buttons/ExportTiddler/Caption",
"text": "export tiddler"
},
"$:/language/Buttons/ExportTiddler/Hint": {
"title": "$:/language/Buttons/ExportTiddler/Hint",
"text": "Export tiddler"
},
"$:/language/Buttons/ExportTiddlers/Caption": {
"title": "$:/language/Buttons/ExportTiddlers/Caption",
"text": "export tiddlers"
},
"$:/language/Buttons/ExportTiddlers/Hint": {
"title": "$:/language/Buttons/ExportTiddlers/Hint",
"text": "Export tiddlers"
},
"$:/language/Buttons/Fold/Caption": {
"title": "$:/language/Buttons/Fold/Caption",
"text": "fold tiddler"
},
"$:/language/Buttons/Fold/Hint": {
"title": "$:/language/Buttons/Fold/Hint",
"text": "Fold the body of this tiddler"
},
"$:/language/Buttons/Fold/FoldBar/Caption": {
"title": "$:/language/Buttons/Fold/FoldBar/Caption",
"text": "fold-bar"
},
"$:/language/Buttons/Fold/FoldBar/Hint": {
"title": "$:/language/Buttons/Fold/FoldBar/Hint",
"text": "Optional bars to fold and unfold tiddlers"
},
"$:/language/Buttons/Unfold/Caption": {
"title": "$:/language/Buttons/Unfold/Caption",
"text": "unfold tiddler"
},
"$:/language/Buttons/Unfold/Hint": {
"title": "$:/language/Buttons/Unfold/Hint",
"text": "Unfold the body of this tiddler"
},
"$:/language/Buttons/FoldOthers/Caption": {
"title": "$:/language/Buttons/FoldOthers/Caption",
"text": "fold other tiddlers"
},
"$:/language/Buttons/FoldOthers/Hint": {
"title": "$:/language/Buttons/FoldOthers/Hint",
"text": "Fold the bodies of other opened tiddlers"
},
"$:/language/Buttons/FoldAll/Caption": {
"title": "$:/language/Buttons/FoldAll/Caption",
"text": "fold all tiddlers"
},
"$:/language/Buttons/FoldAll/Hint": {
"title": "$:/language/Buttons/FoldAll/Hint",
"text": "Fold the bodies of all opened tiddlers"
},
"$:/language/Buttons/UnfoldAll/Caption": {
"title": "$:/language/Buttons/UnfoldAll/Caption",
"text": "unfold all tiddlers"
},
"$:/language/Buttons/UnfoldAll/Hint": {
"title": "$:/language/Buttons/UnfoldAll/Hint",
"text": "Unfold the bodies of all opened tiddlers"
},
"$:/language/Buttons/FullScreen/Caption": {
"title": "$:/language/Buttons/FullScreen/Caption",
"text": "full-screen"
},
"$:/language/Buttons/FullScreen/Hint": {
"title": "$:/language/Buttons/FullScreen/Hint",
"text": "Enter or leave full-screen mode"
},
"$:/language/Buttons/Help/Caption": {
"title": "$:/language/Buttons/Help/Caption",
"text": "help"
},
"$:/language/Buttons/Help/Hint": {
"title": "$:/language/Buttons/Help/Hint",
"text": "Show help panel"
},
"$:/language/Buttons/Import/Caption": {
"title": "$:/language/Buttons/Import/Caption",
"text": "import"
},
"$:/language/Buttons/Import/Hint": {
"title": "$:/language/Buttons/Import/Hint",
"text": "Import many types of file including text, image, TiddlyWiki or JSON"
},
"$:/language/Buttons/Info/Caption": {
"title": "$:/language/Buttons/Info/Caption",
"text": "info"
},
"$:/language/Buttons/Info/Hint": {
"title": "$:/language/Buttons/Info/Hint",
"text": "Show information for this tiddler"
},
"$:/language/Buttons/Home/Caption": {
"title": "$:/language/Buttons/Home/Caption",
"text": "home"
},
"$:/language/Buttons/Home/Hint": {
"title": "$:/language/Buttons/Home/Hint",
"text": "Open the default tiddlers"
},
"$:/language/Buttons/Language/Caption": {
"title": "$:/language/Buttons/Language/Caption",
"text": "language"
},
"$:/language/Buttons/Language/Hint": {
"title": "$:/language/Buttons/Language/Hint",
"text": "Choose the user interface language"
},
"$:/language/Buttons/Manager/Caption": {
"title": "$:/language/Buttons/Manager/Caption",
"text": "tiddler manager"
},
"$:/language/Buttons/Manager/Hint": {
"title": "$:/language/Buttons/Manager/Hint",
"text": "Open tiddler manager"
},
"$:/language/Buttons/More/Caption": {
"title": "$:/language/Buttons/More/Caption",
"text": "more"
},
"$:/language/Buttons/More/Hint": {
"title": "$:/language/Buttons/More/Hint",
"text": "More actions"
},
"$:/language/Buttons/NewHere/Caption": {
"title": "$:/language/Buttons/NewHere/Caption",
"text": "new here"
},
"$:/language/Buttons/NewHere/Hint": {
"title": "$:/language/Buttons/NewHere/Hint",
"text": "Create a new tiddler tagged with this one"
},
"$:/language/Buttons/NewJournal/Caption": {
"title": "$:/language/Buttons/NewJournal/Caption",
"text": "new journal"
},
"$:/language/Buttons/NewJournal/Hint": {
"title": "$:/language/Buttons/NewJournal/Hint",
"text": "Create a new journal tiddler"
},
"$:/language/Buttons/NewJournalHere/Caption": {
"title": "$:/language/Buttons/NewJournalHere/Caption",
"text": "new journal here"
},
"$:/language/Buttons/NewJournalHere/Hint": {
"title": "$:/language/Buttons/NewJournalHere/Hint",
"text": "Create a new journal tiddler tagged with this one"
},
"$:/language/Buttons/NewImage/Caption": {
"title": "$:/language/Buttons/NewImage/Caption",
"text": "new image"
},
"$:/language/Buttons/NewImage/Hint": {
"title": "$:/language/Buttons/NewImage/Hint",
"text": "Create a new image tiddler"
},
"$:/language/Buttons/NewMarkdown/Caption": {
"title": "$:/language/Buttons/NewMarkdown/Caption",
"text": "new Markdown tiddler"
},
"$:/language/Buttons/NewMarkdown/Hint": {
"title": "$:/language/Buttons/NewMarkdown/Hint",
"text": "Create a new Markdown tiddler"
},
"$:/language/Buttons/NewTiddler/Caption": {
"title": "$:/language/Buttons/NewTiddler/Caption",
"text": "new tiddler"
},
"$:/language/Buttons/NewTiddler/Hint": {
"title": "$:/language/Buttons/NewTiddler/Hint",
"text": "Create a new tiddler"
},
"$:/language/Buttons/OpenWindow/Caption": {
"title": "$:/language/Buttons/OpenWindow/Caption",
"text": "open in new window"
},
"$:/language/Buttons/OpenWindow/Hint": {
"title": "$:/language/Buttons/OpenWindow/Hint",
"text": "Open tiddler in new window"
},
"$:/language/Buttons/Palette/Caption": {
"title": "$:/language/Buttons/Palette/Caption",
"text": "palette"
},
"$:/language/Buttons/Palette/Hint": {
"title": "$:/language/Buttons/Palette/Hint",
"text": "Choose the colour palette"
},
"$:/language/Buttons/Permalink/Caption": {
"title": "$:/language/Buttons/Permalink/Caption",
"text": "permalink"
},
"$:/language/Buttons/Permalink/Hint": {
"title": "$:/language/Buttons/Permalink/Hint",
"text": "Set browser address bar to a direct link to this tiddler"
},
"$:/language/Buttons/Permaview/Caption": {
"title": "$:/language/Buttons/Permaview/Caption",
"text": "permaview"
},
"$:/language/Buttons/Permaview/Hint": {
"title": "$:/language/Buttons/Permaview/Hint",
"text": "Set browser address bar to a direct link to all the tiddlers in this story"
},
"$:/language/Buttons/Print/Caption": {
"title": "$:/language/Buttons/Print/Caption",
"text": "print page"
},
"$:/language/Buttons/Print/Hint": {
"title": "$:/language/Buttons/Print/Hint",
"text": "Print the current page"
},
"$:/language/Buttons/Refresh/Caption": {
"title": "$:/language/Buttons/Refresh/Caption",
"text": "refresh"
},
"$:/language/Buttons/Refresh/Hint": {
"title": "$:/language/Buttons/Refresh/Hint",
"text": "Perform a full refresh of the wiki"
},
"$:/language/Buttons/Save/Caption": {
"title": "$:/language/Buttons/Save/Caption",
"text": "ok"
},
"$:/language/Buttons/Save/Hint": {
"title": "$:/language/Buttons/Save/Hint",
"text": "Confirm changes to this tiddler"
},
"$:/language/Buttons/SaveWiki/Caption": {
"title": "$:/language/Buttons/SaveWiki/Caption",
"text": "save changes"
},
"$:/language/Buttons/SaveWiki/Hint": {
"title": "$:/language/Buttons/SaveWiki/Hint",
"text": "Save changes"
},
"$:/language/Buttons/StoryView/Caption": {
"title": "$:/language/Buttons/StoryView/Caption",
"text": "storyview"
},
"$:/language/Buttons/StoryView/Hint": {
"title": "$:/language/Buttons/StoryView/Hint",
"text": "Choose the story visualisation"
},
"$:/language/Buttons/HideSideBar/Caption": {
"title": "$:/language/Buttons/HideSideBar/Caption",
"text": "hide sidebar"
},
"$:/language/Buttons/HideSideBar/Hint": {
"title": "$:/language/Buttons/HideSideBar/Hint",
"text": "Hide sidebar"
},
"$:/language/Buttons/ShowSideBar/Caption": {
"title": "$:/language/Buttons/ShowSideBar/Caption",
"text": "show sidebar"
},
"$:/language/Buttons/ShowSideBar/Hint": {
"title": "$:/language/Buttons/ShowSideBar/Hint",
"text": "Show sidebar"
},
"$:/language/Buttons/TagManager/Caption": {
"title": "$:/language/Buttons/TagManager/Caption",
"text": "tag manager"
},
"$:/language/Buttons/TagManager/Hint": {
"title": "$:/language/Buttons/TagManager/Hint",
"text": "Open tag manager"
},
"$:/language/Buttons/Timestamp/Caption": {
"title": "$:/language/Buttons/Timestamp/Caption",
"text": "timestamps"
},
"$:/language/Buttons/Timestamp/Hint": {
"title": "$:/language/Buttons/Timestamp/Hint",
"text": "Choose whether modifications update timestamps"
},
"$:/language/Buttons/Timestamp/On/Caption": {
"title": "$:/language/Buttons/Timestamp/On/Caption",
"text": "timestamps are on"
},
"$:/language/Buttons/Timestamp/On/Hint": {
"title": "$:/language/Buttons/Timestamp/On/Hint",
"text": "Update timestamps when tiddlers are modified"
},
"$:/language/Buttons/Timestamp/Off/Caption": {
"title": "$:/language/Buttons/Timestamp/Off/Caption",
"text": "timestamps are off"
},
"$:/language/Buttons/Timestamp/Off/Hint": {
"title": "$:/language/Buttons/Timestamp/Off/Hint",
"text": "Don't update timestamps when tiddlers are modified"
},
"$:/language/Buttons/Theme/Caption": {
"title": "$:/language/Buttons/Theme/Caption",
"text": "theme"
},
"$:/language/Buttons/Theme/Hint": {
"title": "$:/language/Buttons/Theme/Hint",
"text": "Choose the display theme"
},
"$:/language/Buttons/Bold/Caption": {
"title": "$:/language/Buttons/Bold/Caption",
"text": "bold"
},
"$:/language/Buttons/Bold/Hint": {
"title": "$:/language/Buttons/Bold/Hint",
"text": "Apply bold formatting to selection"
},
"$:/language/Buttons/Clear/Caption": {
"title": "$:/language/Buttons/Clear/Caption",
"text": "clear"
},
"$:/language/Buttons/Clear/Hint": {
"title": "$:/language/Buttons/Clear/Hint",
"text": "Clear image to solid colour"
},
"$:/language/Buttons/EditorHeight/Caption": {
"title": "$:/language/Buttons/EditorHeight/Caption",
"text": "editor height"
},
"$:/language/Buttons/EditorHeight/Caption/Auto": {
"title": "$:/language/Buttons/EditorHeight/Caption/Auto",
"text": "Automatically adjust height to fit content"
},
"$:/language/Buttons/EditorHeight/Caption/Fixed": {
"title": "$:/language/Buttons/EditorHeight/Caption/Fixed",
"text": "Fixed height:"
},
"$:/language/Buttons/EditorHeight/Hint": {
"title": "$:/language/Buttons/EditorHeight/Hint",
"text": "Choose the height of the text editor"
},
"$:/language/Buttons/Excise/Caption": {
"title": "$:/language/Buttons/Excise/Caption",
"text": "excise"
},
"$:/language/Buttons/Excise/Caption/Excise": {
"title": "$:/language/Buttons/Excise/Caption/Excise",
"text": "Perform excision"
},
"$:/language/Buttons/Excise/Caption/MacroName": {
"title": "$:/language/Buttons/Excise/Caption/MacroName",
"text": "Macro name:"
},
"$:/language/Buttons/Excise/Caption/NewTitle": {
"title": "$:/language/Buttons/Excise/Caption/NewTitle",
"text": "Title of new tiddler:"
},
"$:/language/Buttons/Excise/Caption/Replace": {
"title": "$:/language/Buttons/Excise/Caption/Replace",
"text": "Replace excised text with:"
},
"$:/language/Buttons/Excise/Caption/Replace/Macro": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Macro",
"text": "macro"
},
"$:/language/Buttons/Excise/Caption/Replace/Link": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Link",
"text": "link"
},
"$:/language/Buttons/Excise/Caption/Replace/Transclusion": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Transclusion",
"text": "transclusion"
},
"$:/language/Buttons/Excise/Caption/Tag": {
"title": "$:/language/Buttons/Excise/Caption/Tag",
"text": "Tag new tiddler with the title of this tiddler"
},
"$:/language/Buttons/Excise/Caption/TiddlerExists": {
"title": "$:/language/Buttons/Excise/Caption/TiddlerExists",
"text": "Warning: tiddler already exists"
},
"$:/language/Buttons/Excise/Hint": {
"title": "$:/language/Buttons/Excise/Hint",
"text": "Excise the selected text into a new tiddler"
},
"$:/language/Buttons/Heading1/Caption": {
"title": "$:/language/Buttons/Heading1/Caption",
"text": "heading 1"
},
"$:/language/Buttons/Heading1/Hint": {
"title": "$:/language/Buttons/Heading1/Hint",
"text": "Apply heading level 1 formatting to lines containing selection"
},
"$:/language/Buttons/Heading2/Caption": {
"title": "$:/language/Buttons/Heading2/Caption",
"text": "heading 2"
},
"$:/language/Buttons/Heading2/Hint": {
"title": "$:/language/Buttons/Heading2/Hint",
"text": "Apply heading level 2 formatting to lines containing selection"
},
"$:/language/Buttons/Heading3/Caption": {
"title": "$:/language/Buttons/Heading3/Caption",
"text": "heading 3"
},
"$:/language/Buttons/Heading3/Hint": {
"title": "$:/language/Buttons/Heading3/Hint",
"text": "Apply heading level 3 formatting to lines containing selection"
},
"$:/language/Buttons/Heading4/Caption": {
"title": "$:/language/Buttons/Heading4/Caption",
"text": "heading 4"
},
"$:/language/Buttons/Heading4/Hint": {
"title": "$:/language/Buttons/Heading4/Hint",
"text": "Apply heading level 4 formatting to lines containing selection"
},
"$:/language/Buttons/Heading5/Caption": {
"title": "$:/language/Buttons/Heading5/Caption",
"text": "heading 5"
},
"$:/language/Buttons/Heading5/Hint": {
"title": "$:/language/Buttons/Heading5/Hint",
"text": "Apply heading level 5 formatting to lines containing selection"
},
"$:/language/Buttons/Heading6/Caption": {
"title": "$:/language/Buttons/Heading6/Caption",
"text": "heading 6"
},
"$:/language/Buttons/Heading6/Hint": {
"title": "$:/language/Buttons/Heading6/Hint",
"text": "Apply heading level 6 formatting to lines containing selection"
},
"$:/language/Buttons/Italic/Caption": {
"title": "$:/language/Buttons/Italic/Caption",
"text": "italic"
},
"$:/language/Buttons/Italic/Hint": {
"title": "$:/language/Buttons/Italic/Hint",
"text": "Apply italic formatting to selection"
},
"$:/language/Buttons/LineWidth/Caption": {
"title": "$:/language/Buttons/LineWidth/Caption",
"text": "line width"
},
"$:/language/Buttons/LineWidth/Hint": {
"title": "$:/language/Buttons/LineWidth/Hint",
"text": "Set line width for painting"
},
"$:/language/Buttons/Link/Caption": {
"title": "$:/language/Buttons/Link/Caption",
"text": "link"
},
"$:/language/Buttons/Link/Hint": {
"title": "$:/language/Buttons/Link/Hint",
"text": "Create wikitext link"
},
"$:/language/Buttons/ListBullet/Caption": {
"title": "$:/language/Buttons/ListBullet/Caption",
"text": "bulleted list"
},
"$:/language/Buttons/ListBullet/Hint": {
"title": "$:/language/Buttons/ListBullet/Hint",
"text": "Apply bulleted list formatting to lines containing selection"
},
"$:/language/Buttons/ListNumber/Caption": {
"title": "$:/language/Buttons/ListNumber/Caption",
"text": "numbered list"
},
"$:/language/Buttons/ListNumber/Hint": {
"title": "$:/language/Buttons/ListNumber/Hint",
"text": "Apply numbered list formatting to lines containing selection"
},
"$:/language/Buttons/MonoBlock/Caption": {
"title": "$:/language/Buttons/MonoBlock/Caption",
"text": "monospaced block"
},
"$:/language/Buttons/MonoBlock/Hint": {
"title": "$:/language/Buttons/MonoBlock/Hint",
"text": "Apply monospaced block formatting to lines containing selection"
},
"$:/language/Buttons/MonoLine/Caption": {
"title": "$:/language/Buttons/MonoLine/Caption",
"text": "monospaced"
},
"$:/language/Buttons/MonoLine/Hint": {
"title": "$:/language/Buttons/MonoLine/Hint",
"text": "Apply monospaced character formatting to selection"
},
"$:/language/Buttons/Opacity/Caption": {
"title": "$:/language/Buttons/Opacity/Caption",
"text": "opacity"
},
"$:/language/Buttons/Opacity/Hint": {
"title": "$:/language/Buttons/Opacity/Hint",
"text": "Set painting opacity"
},
"$:/language/Buttons/Paint/Caption": {
"title": "$:/language/Buttons/Paint/Caption",
"text": "paint colour"
},
"$:/language/Buttons/Paint/Hint": {
"title": "$:/language/Buttons/Paint/Hint",
"text": "Set painting colour"
},
"$:/language/Buttons/Picture/Caption": {
"title": "$:/language/Buttons/Picture/Caption",
"text": "picture"
},
"$:/language/Buttons/Picture/Hint": {
"title": "$:/language/Buttons/Picture/Hint",
"text": "Insert picture"
},
"$:/language/Buttons/Preview/Caption": {
"title": "$:/language/Buttons/Preview/Caption",
"text": "preview"
},
"$:/language/Buttons/Preview/Hint": {
"title": "$:/language/Buttons/Preview/Hint",
"text": "Show preview pane"
},
"$:/language/Buttons/PreviewType/Caption": {
"title": "$:/language/Buttons/PreviewType/Caption",
"text": "preview type"
},
"$:/language/Buttons/PreviewType/Hint": {
"title": "$:/language/Buttons/PreviewType/Hint",
"text": "Choose preview type"
},
"$:/language/Buttons/Quote/Caption": {
"title": "$:/language/Buttons/Quote/Caption",
"text": "quote"
},
"$:/language/Buttons/Quote/Hint": {
"title": "$:/language/Buttons/Quote/Hint",
"text": "Apply quoted text formatting to lines containing selection"
},
"$:/language/Buttons/Size/Caption": {
"title": "$:/language/Buttons/Size/Caption",
"text": "image size"
},
"$:/language/Buttons/Size/Caption/Height": {
"title": "$:/language/Buttons/Size/Caption/Height",
"text": "Height:"
},
"$:/language/Buttons/Size/Caption/Resize": {
"title": "$:/language/Buttons/Size/Caption/Resize",
"text": "Resize image"
},
"$:/language/Buttons/Size/Caption/Width": {
"title": "$:/language/Buttons/Size/Caption/Width",
"text": "Width:"
},
"$:/language/Buttons/Size/Hint": {
"title": "$:/language/Buttons/Size/Hint",
"text": "Set image size"
},
"$:/language/Buttons/Stamp/Caption": {
"title": "$:/language/Buttons/Stamp/Caption",
"text": "stamp"
},
"$:/language/Buttons/Stamp/Caption/New": {
"title": "$:/language/Buttons/Stamp/Caption/New",
"text": "Add your own"
},
"$:/language/Buttons/Stamp/Hint": {
"title": "$:/language/Buttons/Stamp/Hint",
"text": "Insert a preconfigured snippet of text"
},
"$:/language/Buttons/Stamp/New/Title": {
"title": "$:/language/Buttons/Stamp/New/Title",
"text": "Name as shown in menu"
},
"$:/language/Buttons/Stamp/New/Text": {
"title": "$:/language/Buttons/Stamp/New/Text",
"text": "Text of snippet. (Remember to add a descriptive title in the caption field)."
},
"$:/language/Buttons/Strikethrough/Caption": {
"title": "$:/language/Buttons/Strikethrough/Caption",
"text": "strikethrough"
},
"$:/language/Buttons/Strikethrough/Hint": {
"title": "$:/language/Buttons/Strikethrough/Hint",
"text": "Apply strikethrough formatting to selection"
},
"$:/language/Buttons/Subscript/Caption": {
"title": "$:/language/Buttons/Subscript/Caption",
"text": "subscript"
},
"$:/language/Buttons/Subscript/Hint": {
"title": "$:/language/Buttons/Subscript/Hint",
"text": "Apply subscript formatting to selection"
},
"$:/language/Buttons/Superscript/Caption": {
"title": "$:/language/Buttons/Superscript/Caption",
"text": "superscript"
},
"$:/language/Buttons/Superscript/Hint": {
"title": "$:/language/Buttons/Superscript/Hint",
"text": "Apply superscript formatting to selection"
},
"$:/language/Buttons/Underline/Caption": {
"title": "$:/language/Buttons/Underline/Caption",
"text": "underline"
},
"$:/language/Buttons/Underline/Hint": {
"title": "$:/language/Buttons/Underline/Hint",
"text": "Apply underline formatting to selection"
},
"$:/language/ControlPanel/Advanced/Caption": {
"title": "$:/language/ControlPanel/Advanced/Caption",
"text": "Advanced"
},
"$:/language/ControlPanel/Advanced/Hint": {
"title": "$:/language/ControlPanel/Advanced/Hint",
"text": "Internal information about this TiddlyWiki"
},
"$:/language/ControlPanel/Appearance/Caption": {
"title": "$:/language/ControlPanel/Appearance/Caption",
"text": "Appearance"
},
"$:/language/ControlPanel/Appearance/Hint": {
"title": "$:/language/ControlPanel/Appearance/Hint",
"text": "Ways to customise the appearance of your TiddlyWiki."
},
"$:/language/ControlPanel/Basics/AnimDuration/Prompt": {
"title": "$:/language/ControlPanel/Basics/AnimDuration/Prompt",
"text": "Animation duration:"
},
"$:/language/ControlPanel/Basics/Caption": {
"title": "$:/language/ControlPanel/Basics/Caption",
"text": "Basics"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint",
"text": "Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set=\"$:/DefaultTiddlers\" setTo=\"[list[$:/StoryList]]\">retain story ordering</$button>"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt",
"text": "Default tiddlers:"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint",
"text": "Choose which tiddlers are displayed at startup:"
},
"$:/language/ControlPanel/Basics/Language/Prompt": {
"title": "$:/language/ControlPanel/Basics/Language/Prompt",
"text": "Hello! Current language:"
},
"$:/language/ControlPanel/Basics/NewJournal/Title/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Title/Prompt",
"text": "Title of new journal tiddlers"
},
"$:/language/ControlPanel/Basics/NewJournal/Text/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Text/Prompt",
"text": "Text for new journal tiddlers"
},
"$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt",
"text": "Tags for new journal tiddlers"
},
"$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt",
"text": "Number of overridden shadow tiddlers:"
},
"$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt",
"text": "Number of shadow tiddlers:"
},
"$:/language/ControlPanel/Basics/Subtitle/Prompt": {
"title": "$:/language/ControlPanel/Basics/Subtitle/Prompt",
"text": "Subtitle:"
},
"$:/language/ControlPanel/Basics/SystemTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/SystemTiddlers/Prompt",
"text": "Number of system tiddlers:"
},
"$:/language/ControlPanel/Basics/Tags/Prompt": {
"title": "$:/language/ControlPanel/Basics/Tags/Prompt",
"text": "Number of tags:"
},
"$:/language/ControlPanel/Basics/Tiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/Tiddlers/Prompt",
"text": "Number of tiddlers:"
},
"$:/language/ControlPanel/Basics/Title/Prompt": {
"title": "$:/language/ControlPanel/Basics/Title/Prompt",
"text": "Title of this ~TiddlyWiki:"
},
"$:/language/ControlPanel/Basics/Username/Prompt": {
"title": "$:/language/ControlPanel/Basics/Username/Prompt",
"text": "Username for signing edits:"
},
"$:/language/ControlPanel/Basics/Version/Prompt": {
"title": "$:/language/ControlPanel/Basics/Version/Prompt",
"text": "~TiddlyWiki version:"
},
"$:/language/ControlPanel/EditorTypes/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Caption",
"text": "Editor Types"
},
"$:/language/ControlPanel/EditorTypes/Editor/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Editor/Caption",
"text": "Editor"
},
"$:/language/ControlPanel/EditorTypes/Hint": {
"title": "$:/language/ControlPanel/EditorTypes/Hint",
"text": "These tiddlers determine which editor is used to edit specific tiddler types."
},
"$:/language/ControlPanel/EditorTypes/Type/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Type/Caption",
"text": "Type"
},
"$:/language/ControlPanel/Info/Caption": {
"title": "$:/language/ControlPanel/Info/Caption",
"text": "Info"
},
"$:/language/ControlPanel/Info/Hint": {
"title": "$:/language/ControlPanel/Info/Hint",
"text": "Information about this TiddlyWiki"
},
"$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt",
"text": "Type shortcut here"
},
"$:/language/ControlPanel/KeyboardShortcuts/Add/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Add/Caption",
"text": "add shortcut"
},
"$:/language/ControlPanel/KeyboardShortcuts/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Caption",
"text": "Keyboard Shortcuts"
},
"$:/language/ControlPanel/KeyboardShortcuts/Hint": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Hint",
"text": "Manage keyboard shortcut assignments"
},
"$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption",
"text": "No keyboard shortcuts assigned"
},
"$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint",
"text": "remove keyboard shortcut"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/All": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/All",
"text": "All platforms"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac",
"text": "Macintosh platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac",
"text": "Non-Macintosh platforms only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux",
"text": "Linux platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux",
"text": "Non-Linux platforms only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows",
"text": "Windows platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows",
"text": "Non-Windows platforms only"
},
"$:/language/ControlPanel/LoadedModules/Caption": {
"title": "$:/language/ControlPanel/LoadedModules/Caption",
"text": "Loaded Modules"
},
"$:/language/ControlPanel/LoadedModules/Hint": {
"title": "$:/language/ControlPanel/LoadedModules/Hint",
"text": "These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process."
},
"$:/language/ControlPanel/Palette/Caption": {
"title": "$:/language/ControlPanel/Palette/Caption",
"text": "Palette"
},
"$:/language/ControlPanel/Palette/Editor/Clone/Caption": {
"title": "$:/language/ControlPanel/Palette/Editor/Clone/Caption",
"text": "clone"
},
"$:/language/ControlPanel/Palette/Editor/Clone/Prompt": {
"title": "$:/language/ControlPanel/Palette/Editor/Clone/Prompt",
"text": "It is recommended that you clone this shadow palette before editing it"
},
"$:/language/ControlPanel/Palette/Editor/Prompt/Modified": {
"title": "$:/language/ControlPanel/Palette/Editor/Prompt/Modified",
"text": "This shadow palette has been modified"
},
"$:/language/ControlPanel/Palette/Editor/Prompt": {
"title": "$:/language/ControlPanel/Palette/Editor/Prompt",
"text": "Editing"
},
"$:/language/ControlPanel/Palette/Editor/Reset/Caption": {
"title": "$:/language/ControlPanel/Palette/Editor/Reset/Caption",
"text": "reset"
},
"$:/language/ControlPanel/Palette/HideEditor/Caption": {
"title": "$:/language/ControlPanel/Palette/HideEditor/Caption",
"text": "hide editor"
},
"$:/language/ControlPanel/Palette/Prompt": {
"title": "$:/language/ControlPanel/Palette/Prompt",
"text": "Current palette:"
},
"$:/language/ControlPanel/Palette/ShowEditor/Caption": {
"title": "$:/language/ControlPanel/Palette/ShowEditor/Caption",
"text": "show editor"
},
"$:/language/ControlPanel/Parsing/Caption": {
"title": "$:/language/ControlPanel/Parsing/Caption",
"text": "Parsing"
},
"$:/language/ControlPanel/Parsing/Hint": {
"title": "$:/language/ControlPanel/Parsing/Hint",
"text": "Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text=\"TiddlyWiki\"/> from functioning correctly. Use [[safe mode|http://tiddlywiki.com/#SafeMode]] to restore normal operation."
},
"$:/language/ControlPanel/Parsing/Block/Caption": {
"title": "$:/language/ControlPanel/Parsing/Block/Caption",
"text": "Block Parse Rules"
},
"$:/language/ControlPanel/Parsing/Inline/Caption": {
"title": "$:/language/ControlPanel/Parsing/Inline/Caption",
"text": "Inline Parse Rules"
},
"$:/language/ControlPanel/Parsing/Pragma/Caption": {
"title": "$:/language/ControlPanel/Parsing/Pragma/Caption",
"text": "Pragma Parse Rules"
},
"$:/language/ControlPanel/Plugins/Add/Caption": {
"title": "$:/language/ControlPanel/Plugins/Add/Caption",
"text": "Get more plugins"
},
"$:/language/ControlPanel/Plugins/Add/Hint": {
"title": "$:/language/ControlPanel/Plugins/Add/Hint",
"text": "Install plugins from the official library"
},
"$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint": {
"title": "$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint",
"text": "This plugin is already installed at version <$text text=<<installedVersion>>/>"
},
"$:/language/ControlPanel/Plugins/Caption": {
"title": "$:/language/ControlPanel/Plugins/Caption",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Disable/Caption": {
"title": "$:/language/ControlPanel/Plugins/Disable/Caption",
"text": "disable"
},
"$:/language/ControlPanel/Plugins/Disable/Hint": {
"title": "$:/language/ControlPanel/Plugins/Disable/Hint",
"text": "Disable this plugin when reloading page"
},
"$:/language/ControlPanel/Plugins/Disabled/Status": {
"title": "$:/language/ControlPanel/Plugins/Disabled/Status",
"text": "(disabled)"
},
"$:/language/ControlPanel/Plugins/Empty/Hint": {
"title": "$:/language/ControlPanel/Plugins/Empty/Hint",
"text": "None"
},
"$:/language/ControlPanel/Plugins/Enable/Caption": {
"title": "$:/language/ControlPanel/Plugins/Enable/Caption",
"text": "enable"
},
"$:/language/ControlPanel/Plugins/Enable/Hint": {
"title": "$:/language/ControlPanel/Plugins/Enable/Hint",
"text": "Enable this plugin when reloading page"
},
"$:/language/ControlPanel/Plugins/Install/Caption": {
"title": "$:/language/ControlPanel/Plugins/Install/Caption",
"text": "install"
},
"$:/language/ControlPanel/Plugins/Installed/Hint": {
"title": "$:/language/ControlPanel/Plugins/Installed/Hint",
"text": "Currently installed plugins:"
},
"$:/language/ControlPanel/Plugins/Languages/Caption": {
"title": "$:/language/ControlPanel/Plugins/Languages/Caption",
"text": "Languages"
},
"$:/language/ControlPanel/Plugins/Languages/Hint": {
"title": "$:/language/ControlPanel/Plugins/Languages/Hint",
"text": "Language pack plugins"
},
"$:/language/ControlPanel/Plugins/NoInfoFound/Hint": {
"title": "$:/language/ControlPanel/Plugins/NoInfoFound/Hint",
"text": "No ''\"<$text text=<<currentTab>>/>\"'' found"
},
"$:/language/ControlPanel/Plugins/NoInformation/Hint": {
"title": "$:/language/ControlPanel/Plugins/NoInformation/Hint",
"text": "No information provided"
},
"$:/language/ControlPanel/Plugins/NotInstalled/Hint": {
"title": "$:/language/ControlPanel/Plugins/NotInstalled/Hint",
"text": "This plugin is not currently installed"
},
"$:/language/ControlPanel/Plugins/OpenPluginLibrary": {
"title": "$:/language/ControlPanel/Plugins/OpenPluginLibrary",
"text": "open plugin library"
},
"$:/language/ControlPanel/Plugins/ClosePluginLibrary": {
"title": "$:/language/ControlPanel/Plugins/ClosePluginLibrary",
"text": "close plugin library"
},
"$:/language/ControlPanel/Plugins/Plugins/Caption": {
"title": "$:/language/ControlPanel/Plugins/Plugins/Caption",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Plugins/Hint": {
"title": "$:/language/ControlPanel/Plugins/Plugins/Hint",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Reinstall/Caption": {
"title": "$:/language/ControlPanel/Plugins/Reinstall/Caption",
"text": "reinstall"
},
"$:/language/ControlPanel/Plugins/Themes/Caption": {
"title": "$:/language/ControlPanel/Plugins/Themes/Caption",
"text": "Themes"
},
"$:/language/ControlPanel/Plugins/Themes/Hint": {
"title": "$:/language/ControlPanel/Plugins/Themes/Hint",
"text": "Theme plugins"
},
"$:/language/ControlPanel/Saving/Caption": {
"title": "$:/language/ControlPanel/Saving/Caption",
"text": "Saving"
},
"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description",
"text": "Permit automatic saving for the download saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint",
"text": "Enable Autosave for Download Saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/Caption": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/Caption",
"text": "Download Saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/Hint": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/Hint",
"text": "These settings apply to the HTML5-compatible download saver"
},
"$:/language/ControlPanel/Saving/General/Caption": {
"title": "$:/language/ControlPanel/Saving/General/Caption",
"text": "General"
},
"$:/language/ControlPanel/Saving/General/Hint": {
"title": "$:/language/ControlPanel/Saving/General/Hint",
"text": "These settings apply to all the loaded savers"
},
"$:/language/ControlPanel/Saving/Hint": {
"title": "$:/language/ControlPanel/Saving/Hint",
"text": "Settings used for saving the entire TiddlyWiki as a single file via a saver module"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading",
"text": "Advanced Settings"
},
"$:/language/ControlPanel/Saving/TiddlySpot/BackupDir": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/BackupDir",
"text": "Backup Directory"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Backups": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Backups",
"text": "Backups"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Caption": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Caption",
"text": "~TiddlySpot Saver"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Description": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Description",
"text": "These settings are only used when saving to http://tiddlyspot.com or a compatible remote server"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Filename": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Filename",
"text": "Upload Filename"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Heading": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Heading",
"text": "~TiddlySpot"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Hint": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Hint",
"text": "//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Password": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Password",
"text": "Password"
},
"$:/language/ControlPanel/Saving/TiddlySpot/ServerURL": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/ServerURL",
"text": "Server URL"
},
"$:/language/ControlPanel/Saving/TiddlySpot/UploadDir": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/UploadDir",
"text": "Upload Directory"
},
"$:/language/ControlPanel/Saving/TiddlySpot/UserName": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/UserName",
"text": "Wiki Name"
},
"$:/language/ControlPanel/Settings/AutoSave/Caption": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Caption",
"text": "Autosave"
},
"$:/language/ControlPanel/Settings/AutoSave/Disabled/Description": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Disabled/Description",
"text": "Do not save changes automatically"
},
"$:/language/ControlPanel/Settings/AutoSave/Enabled/Description": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Enabled/Description",
"text": "Save changes automatically"
},
"$:/language/ControlPanel/Settings/AutoSave/Hint": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Hint",
"text": "Attempt to automatically save changes during editing when using a supporting saver"
},
"$:/language/ControlPanel/Settings/CamelCase/Caption": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Caption",
"text": "Camel Case Wiki Links"
},
"$:/language/ControlPanel/Settings/CamelCase/Hint": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Hint",
"text": "You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect"
},
"$:/language/ControlPanel/Settings/CamelCase/Description": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Description",
"text": "Enable automatic ~CamelCase linking"
},
"$:/language/ControlPanel/Settings/Caption": {
"title": "$:/language/ControlPanel/Settings/Caption",
"text": "Settings"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Caption": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Caption",
"text": "Editor Toolbar"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Hint": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Hint",
"text": "Enable or disable the editor toolbar:"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Description": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Description",
"text": "Show editor toolbar"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Caption": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Caption",
"text": "Tiddler Info Panel Mode"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Hint": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Hint",
"text": "Control when the tiddler info panel closes:"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description",
"text": "Tiddler info panel closes automatically"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description",
"text": "Tiddler info panel stays open until explicitly closed"
},
"$:/language/ControlPanel/Settings/Hint": {
"title": "$:/language/ControlPanel/Settings/Hint",
"text": "These settings let you customise the behaviour of TiddlyWiki."
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Caption": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Caption",
"text": "Navigation Address Bar"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Hint": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Hint",
"text": "Behaviour of the browser address bar when navigating to a tiddler:"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description",
"text": "Do not update the address bar"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description",
"text": "Include the target tiddler"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description",
"text": "Include the target tiddler and the current story sequence"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Caption": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Caption",
"text": "Navigation History"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Hint": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Hint",
"text": "Update browser history when navigating to a tiddler:"
},
"$:/language/ControlPanel/Settings/NavigationHistory/No/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/No/Description",
"text": "Do not update history"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description",
"text": "Update history"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption",
"text": "Performance Instrumentation"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint",
"text": "Displays performance statistics in the browser developer console. Requires reload to take effect"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description",
"text": "Enable performance instrumentation"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption",
"text": "Toolbar Button Style"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint",
"text": "Choose the style for toolbar buttons:"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless",
"text": "Borderless"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed",
"text": "Boxed"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded",
"text": "Rounded"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Caption": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Caption",
"text": "Toolbar Buttons"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Hint": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Hint",
"text": "Default toolbar button appearance:"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description",
"text": "Include icon"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description",
"text": "Include text"
},
"$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption": {
"title": "$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption",
"text": "Default Sidebar Tab"
},
"$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint": {
"title": "$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint",
"text": "Specify which sidebar tab is displayed by default"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/Caption": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/Caption",
"text": "Tiddler Opening Behaviour"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint",
"text": "Navigation from //within// the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint",
"text": "Navigation from //outside// the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove",
"text": "Open above the current tiddler"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow",
"text": "Open below the current tiddler"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop",
"text": "Open at the top of the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom",
"text": "Open at the bottom of the story river"
},
"$:/language/ControlPanel/Settings/TitleLinks/Caption": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Caption",
"text": "Tiddler Titles"
},
"$:/language/ControlPanel/Settings/TitleLinks/Hint": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Hint",
"text": "Optionally display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/TitleLinks/No/Description": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/No/Description",
"text": "Do not display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/TitleLinks/Yes/Description": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Yes/Description",
"text": "Display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/MissingLinks/Caption": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Caption",
"text": "Wiki Links"
},
"$:/language/ControlPanel/Settings/MissingLinks/Hint": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Hint",
"text": "Choose whether to link to tiddlers that do not exist yet"
},
"$:/language/ControlPanel/Settings/MissingLinks/Description": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Description",
"text": "Enable links to missing tiddlers"
},
"$:/language/ControlPanel/StoryView/Caption": {
"title": "$:/language/ControlPanel/StoryView/Caption",
"text": "Story View"
},
"$:/language/ControlPanel/StoryView/Prompt": {
"title": "$:/language/ControlPanel/StoryView/Prompt",
"text": "Current view:"
},
"$:/language/ControlPanel/Theme/Caption": {
"title": "$:/language/ControlPanel/Theme/Caption",
"text": "Theme"
},
"$:/language/ControlPanel/Theme/Prompt": {
"title": "$:/language/ControlPanel/Theme/Prompt",
"text": "Current theme:"
},
"$:/language/ControlPanel/TiddlerFields/Caption": {
"title": "$:/language/ControlPanel/TiddlerFields/Caption",
"text": "Tiddler Fields"
},
"$:/language/ControlPanel/TiddlerFields/Hint": {
"title": "$:/language/ControlPanel/TiddlerFields/Hint",
"text": "This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers)."
},
"$:/language/ControlPanel/Toolbars/Caption": {
"title": "$:/language/ControlPanel/Toolbars/Caption",
"text": "Toolbars"
},
"$:/language/ControlPanel/Toolbars/EditToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/EditToolbar/Caption",
"text": "Edit Toolbar"
},
"$:/language/ControlPanel/Toolbars/EditToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/EditToolbar/Hint",
"text": "Choose which buttons are displayed for tiddlers in edit mode. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/Hint": {
"title": "$:/language/ControlPanel/Toolbars/Hint",
"text": "Select which toolbar buttons are displayed"
},
"$:/language/ControlPanel/Toolbars/PageControls/Caption": {
"title": "$:/language/ControlPanel/Toolbars/PageControls/Caption",
"text": "Page Toolbar"
},
"$:/language/ControlPanel/Toolbars/PageControls/Hint": {
"title": "$:/language/ControlPanel/Toolbars/PageControls/Hint",
"text": "Choose which buttons are displayed on the main page toolbar. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/EditorToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/EditorToolbar/Caption",
"text": "Editor Toolbar"
},
"$:/language/ControlPanel/Toolbars/EditorToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/EditorToolbar/Hint",
"text": "Choose which buttons are displayed in the editor toolbar. Note that some buttons will only appear when editing tiddlers of a certain type. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/ViewToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/ViewToolbar/Caption",
"text": "View Toolbar"
},
"$:/language/ControlPanel/Toolbars/ViewToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/ViewToolbar/Hint",
"text": "Choose which buttons are displayed for tiddlers in view mode. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Tools/Download/Full/Caption": {
"title": "$:/language/ControlPanel/Tools/Download/Full/Caption",
"text": "Download full wiki"
},
"$:/language/Date/DaySuffix/1": {
"title": "$:/language/Date/DaySuffix/1",
"text": "st"
},
"$:/language/Date/DaySuffix/2": {
"title": "$:/language/Date/DaySuffix/2",
"text": "nd"
},
"$:/language/Date/DaySuffix/3": {
"title": "$:/language/Date/DaySuffix/3",
"text": "rd"
},
"$:/language/Date/DaySuffix/4": {
"title": "$:/language/Date/DaySuffix/4",
"text": "th"
},
"$:/language/Date/DaySuffix/5": {
"title": "$:/language/Date/DaySuffix/5",
"text": "th"
},
"$:/language/Date/DaySuffix/6": {
"title": "$:/language/Date/DaySuffix/6",
"text": "th"
},
"$:/language/Date/DaySuffix/7": {
"title": "$:/language/Date/DaySuffix/7",
"text": "th"
},
"$:/language/Date/DaySuffix/8": {
"title": "$:/language/Date/DaySuffix/8",
"text": "th"
},
"$:/language/Date/DaySuffix/9": {
"title": "$:/language/Date/DaySuffix/9",
"text": "th"
},
"$:/language/Date/DaySuffix/10": {
"title": "$:/language/Date/DaySuffix/10",
"text": "th"
},
"$:/language/Date/DaySuffix/11": {
"title": "$:/language/Date/DaySuffix/11",
"text": "th"
},
"$:/language/Date/DaySuffix/12": {
"title": "$:/language/Date/DaySuffix/12",
"text": "th"
},
"$:/language/Date/DaySuffix/13": {
"title": "$:/language/Date/DaySuffix/13",
"text": "th"
},
"$:/language/Date/DaySuffix/14": {
"title": "$:/language/Date/DaySuffix/14",
"text": "th"
},
"$:/language/Date/DaySuffix/15": {
"title": "$:/language/Date/DaySuffix/15",
"text": "th"
},
"$:/language/Date/DaySuffix/16": {
"title": "$:/language/Date/DaySuffix/16",
"text": "th"
},
"$:/language/Date/DaySuffix/17": {
"title": "$:/language/Date/DaySuffix/17",
"text": "th"
},
"$:/language/Date/DaySuffix/18": {
"title": "$:/language/Date/DaySuffix/18",
"text": "th"
},
"$:/language/Date/DaySuffix/19": {
"title": "$:/language/Date/DaySuffix/19",
"text": "th"
},
"$:/language/Date/DaySuffix/20": {
"title": "$:/language/Date/DaySuffix/20",
"text": "th"
},
"$:/language/Date/DaySuffix/21": {
"title": "$:/language/Date/DaySuffix/21",
"text": "st"
},
"$:/language/Date/DaySuffix/22": {
"title": "$:/language/Date/DaySuffix/22",
"text": "nd"
},
"$:/language/Date/DaySuffix/23": {
"title": "$:/language/Date/DaySuffix/23",
"text": "rd"
},
"$:/language/Date/DaySuffix/24": {
"title": "$:/language/Date/DaySuffix/24",
"text": "th"
},
"$:/language/Date/DaySuffix/25": {
"title": "$:/language/Date/DaySuffix/25",
"text": "th"
},
"$:/language/Date/DaySuffix/26": {
"title": "$:/language/Date/DaySuffix/26",
"text": "th"
},
"$:/language/Date/DaySuffix/27": {
"title": "$:/language/Date/DaySuffix/27",
"text": "th"
},
"$:/language/Date/DaySuffix/28": {
"title": "$:/language/Date/DaySuffix/28",
"text": "th"
},
"$:/language/Date/DaySuffix/29": {
"title": "$:/language/Date/DaySuffix/29",
"text": "th"
},
"$:/language/Date/DaySuffix/30": {
"title": "$:/language/Date/DaySuffix/30",
"text": "th"
},
"$:/language/Date/DaySuffix/31": {
"title": "$:/language/Date/DaySuffix/31",
"text": "st"
},
"$:/language/Date/Long/Day/0": {
"title": "$:/language/Date/Long/Day/0",
"text": "Sunday"
},
"$:/language/Date/Long/Day/1": {
"title": "$:/language/Date/Long/Day/1",
"text": "Monday"
},
"$:/language/Date/Long/Day/2": {
"title": "$:/language/Date/Long/Day/2",
"text": "Tuesday"
},
"$:/language/Date/Long/Day/3": {
"title": "$:/language/Date/Long/Day/3",
"text": "Wednesday"
},
"$:/language/Date/Long/Day/4": {
"title": "$:/language/Date/Long/Day/4",
"text": "Thursday"
},
"$:/language/Date/Long/Day/5": {
"title": "$:/language/Date/Long/Day/5",
"text": "Friday"
},
"$:/language/Date/Long/Day/6": {
"title": "$:/language/Date/Long/Day/6",
"text": "Saturday"
},
"$:/language/Date/Long/Month/1": {
"title": "$:/language/Date/Long/Month/1",
"text": "January"
},
"$:/language/Date/Long/Month/2": {
"title": "$:/language/Date/Long/Month/2",
"text": "February"
},
"$:/language/Date/Long/Month/3": {
"title": "$:/language/Date/Long/Month/3",
"text": "March"
},
"$:/language/Date/Long/Month/4": {
"title": "$:/language/Date/Long/Month/4",
"text": "April"
},
"$:/language/Date/Long/Month/5": {
"title": "$:/language/Date/Long/Month/5",
"text": "May"
},
"$:/language/Date/Long/Month/6": {
"title": "$:/language/Date/Long/Month/6",
"text": "June"
},
"$:/language/Date/Long/Month/7": {
"title": "$:/language/Date/Long/Month/7",
"text": "July"
},
"$:/language/Date/Long/Month/8": {
"title": "$:/language/Date/Long/Month/8",
"text": "August"
},
"$:/language/Date/Long/Month/9": {
"title": "$:/language/Date/Long/Month/9",
"text": "September"
},
"$:/language/Date/Long/Month/10": {
"title": "$:/language/Date/Long/Month/10",
"text": "October"
},
"$:/language/Date/Long/Month/11": {
"title": "$:/language/Date/Long/Month/11",
"text": "November"
},
"$:/language/Date/Long/Month/12": {
"title": "$:/language/Date/Long/Month/12",
"text": "December"
},
"$:/language/Date/Period/am": {
"title": "$:/language/Date/Period/am",
"text": "am"
},
"$:/language/Date/Period/pm": {
"title": "$:/language/Date/Period/pm",
"text": "pm"
},
"$:/language/Date/Short/Day/0": {
"title": "$:/language/Date/Short/Day/0",
"text": "Sun"
},
"$:/language/Date/Short/Day/1": {
"title": "$:/language/Date/Short/Day/1",
"text": "Mon"
},
"$:/language/Date/Short/Day/2": {
"title": "$:/language/Date/Short/Day/2",
"text": "Tue"
},
"$:/language/Date/Short/Day/3": {
"title": "$:/language/Date/Short/Day/3",
"text": "Wed"
},
"$:/language/Date/Short/Day/4": {
"title": "$:/language/Date/Short/Day/4",
"text": "Thu"
},
"$:/language/Date/Short/Day/5": {
"title": "$:/language/Date/Short/Day/5",
"text": "Fri"
},
"$:/language/Date/Short/Day/6": {
"title": "$:/language/Date/Short/Day/6",
"text": "Sat"
},
"$:/language/Date/Short/Month/1": {
"title": "$:/language/Date/Short/Month/1",
"text": "Jan"
},
"$:/language/Date/Short/Month/2": {
"title": "$:/language/Date/Short/Month/2",
"text": "Feb"
},
"$:/language/Date/Short/Month/3": {
"title": "$:/language/Date/Short/Month/3",
"text": "Mar"
},
"$:/language/Date/Short/Month/4": {
"title": "$:/language/Date/Short/Month/4",
"text": "Apr"
},
"$:/language/Date/Short/Month/5": {
"title": "$:/language/Date/Short/Month/5",
"text": "May"
},
"$:/language/Date/Short/Month/6": {
"title": "$:/language/Date/Short/Month/6",
"text": "Jun"
},
"$:/language/Date/Short/Month/7": {
"title": "$:/language/Date/Short/Month/7",
"text": "Jul"
},
"$:/language/Date/Short/Month/8": {
"title": "$:/language/Date/Short/Month/8",
"text": "Aug"
},
"$:/language/Date/Short/Month/9": {
"title": "$:/language/Date/Short/Month/9",
"text": "Sep"
},
"$:/language/Date/Short/Month/10": {
"title": "$:/language/Date/Short/Month/10",
"text": "Oct"
},
"$:/language/Date/Short/Month/11": {
"title": "$:/language/Date/Short/Month/11",
"text": "Nov"
},
"$:/language/Date/Short/Month/12": {
"title": "$:/language/Date/Short/Month/12",
"text": "Dec"
},
"$:/language/RelativeDate/Future/Days": {
"title": "$:/language/RelativeDate/Future/Days",
"text": "<<period>> days from now"
},
"$:/language/RelativeDate/Future/Hours": {
"title": "$:/language/RelativeDate/Future/Hours",
"text": "<<period>> hours from now"
},
"$:/language/RelativeDate/Future/Minutes": {
"title": "$:/language/RelativeDate/Future/Minutes",
"text": "<<period>> minutes from now"
},
"$:/language/RelativeDate/Future/Months": {
"title": "$:/language/RelativeDate/Future/Months",
"text": "<<period>> months from now"
},
"$:/language/RelativeDate/Future/Second": {
"title": "$:/language/RelativeDate/Future/Second",
"text": "1 second from now"
},
"$:/language/RelativeDate/Future/Seconds": {
"title": "$:/language/RelativeDate/Future/Seconds",
"text": "<<period>> seconds from now"
},
"$:/language/RelativeDate/Future/Years": {
"title": "$:/language/RelativeDate/Future/Years",
"text": "<<period>> years from now"
},
"$:/language/RelativeDate/Past/Days": {
"title": "$:/language/RelativeDate/Past/Days",
"text": "<<period>> days ago"
},
"$:/language/RelativeDate/Past/Hours": {
"title": "$:/language/RelativeDate/Past/Hours",
"text": "<<period>> hours ago"
},
"$:/language/RelativeDate/Past/Minutes": {
"title": "$:/language/RelativeDate/Past/Minutes",
"text": "<<period>> minutes ago"
},
"$:/language/RelativeDate/Past/Months": {
"title": "$:/language/RelativeDate/Past/Months",
"text": "<<period>> months ago"
},
"$:/language/RelativeDate/Past/Second": {
"title": "$:/language/RelativeDate/Past/Second",
"text": "1 second ago"
},
"$:/language/RelativeDate/Past/Seconds": {
"title": "$:/language/RelativeDate/Past/Seconds",
"text": "<<period>> seconds ago"
},
"$:/language/RelativeDate/Past/Years": {
"title": "$:/language/RelativeDate/Past/Years",
"text": "<<period>> years ago"
},
"$:/language/Docs/ModuleTypes/allfilteroperator": {
"title": "$:/language/Docs/ModuleTypes/allfilteroperator",
"text": "A sub-operator for the ''all'' filter operator."
},
"$:/language/Docs/ModuleTypes/animation": {
"title": "$:/language/Docs/ModuleTypes/animation",
"text": "Animations that may be used with the RevealWidget."
},
"$:/language/Docs/ModuleTypes/bitmapeditoroperation": {
"title": "$:/language/Docs/ModuleTypes/bitmapeditoroperation",
"text": "A bitmap editor toolbar operation."
},
"$:/language/Docs/ModuleTypes/command": {
"title": "$:/language/Docs/ModuleTypes/command",
"text": "Commands that can be executed under Node.js."
},
"$:/language/Docs/ModuleTypes/config": {
"title": "$:/language/Docs/ModuleTypes/config",
"text": "Data to be inserted into `$tw.config`."
},
"$:/language/Docs/ModuleTypes/filteroperator": {
"title": "$:/language/Docs/ModuleTypes/filteroperator",
"text": "Individual filter operator methods."
},
"$:/language/Docs/ModuleTypes/global": {
"title": "$:/language/Docs/ModuleTypes/global",
"text": "Global data to be inserted into `$tw`."
},
"$:/language/Docs/ModuleTypes/info": {
"title": "$:/language/Docs/ModuleTypes/info",
"text": "Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin."
},
"$:/language/Docs/ModuleTypes/isfilteroperator": {
"title": "$:/language/Docs/ModuleTypes/isfilteroperator",
"text": "Operands for the ''is'' filter operator."
},
"$:/language/Docs/ModuleTypes/library": {
"title": "$:/language/Docs/ModuleTypes/library",
"text": "Generic module type for general purpose JavaScript modules."
},
"$:/language/Docs/ModuleTypes/macro": {
"title": "$:/language/Docs/ModuleTypes/macro",
"text": "JavaScript macro definitions."
},
"$:/language/Docs/ModuleTypes/parser": {
"title": "$:/language/Docs/ModuleTypes/parser",
"text": "Parsers for different content types."
},
"$:/language/Docs/ModuleTypes/saver": {
"title": "$:/language/Docs/ModuleTypes/saver",
"text": "Savers handle different methods for saving files from the browser."
},
"$:/language/Docs/ModuleTypes/startup": {
"title": "$:/language/Docs/ModuleTypes/startup",
"text": "Startup functions."
},
"$:/language/Docs/ModuleTypes/storyview": {
"title": "$:/language/Docs/ModuleTypes/storyview",
"text": "Story views customise the animation and behaviour of list widgets."
},
"$:/language/Docs/ModuleTypes/texteditoroperation": {
"title": "$:/language/Docs/ModuleTypes/texteditoroperation",
"text": "A text editor toolbar operation."
},
"$:/language/Docs/ModuleTypes/tiddlerdeserializer": {
"title": "$:/language/Docs/ModuleTypes/tiddlerdeserializer",
"text": "Converts different content types into tiddlers."
},
"$:/language/Docs/ModuleTypes/tiddlerfield": {
"title": "$:/language/Docs/ModuleTypes/tiddlerfield",
"text": "Defines the behaviour of an individual tiddler field."
},
"$:/language/Docs/ModuleTypes/tiddlermethod": {
"title": "$:/language/Docs/ModuleTypes/tiddlermethod",
"text": "Adds methods to the `$tw.Tiddler` prototype."
},
"$:/language/Docs/ModuleTypes/upgrader": {
"title": "$:/language/Docs/ModuleTypes/upgrader",
"text": "Applies upgrade processing to tiddlers during an upgrade/import."
},
"$:/language/Docs/ModuleTypes/utils": {
"title": "$:/language/Docs/ModuleTypes/utils",
"text": "Adds methods to `$tw.utils`."
},
"$:/language/Docs/ModuleTypes/utils-node": {
"title": "$:/language/Docs/ModuleTypes/utils-node",
"text": "Adds Node.js-specific methods to `$tw.utils`."
},
"$:/language/Docs/ModuleTypes/widget": {
"title": "$:/language/Docs/ModuleTypes/widget",
"text": "Widgets encapsulate DOM rendering and refreshing."
},
"$:/language/Docs/ModuleTypes/wikimethod": {
"title": "$:/language/Docs/ModuleTypes/wikimethod",
"text": "Adds methods to `$tw.Wiki`."
},
"$:/language/Docs/ModuleTypes/wikirule": {
"title": "$:/language/Docs/ModuleTypes/wikirule",
"text": "Individual parser rules for the main WikiText parser."
},
"$:/language/Docs/PaletteColours/alert-background": {
"title": "$:/language/Docs/PaletteColours/alert-background",
"text": "Alert background"
},
"$:/language/Docs/PaletteColours/alert-border": {
"title": "$:/language/Docs/PaletteColours/alert-border",
"text": "Alert border"
},
"$:/language/Docs/PaletteColours/alert-highlight": {
"title": "$:/language/Docs/PaletteColours/alert-highlight",
"text": "Alert highlight"
},
"$:/language/Docs/PaletteColours/alert-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/alert-muted-foreground",
"text": "Alert muted foreground"
},
"$:/language/Docs/PaletteColours/background": {
"title": "$:/language/Docs/PaletteColours/background",
"text": "General background"
},
"$:/language/Docs/PaletteColours/blockquote-bar": {
"title": "$:/language/Docs/PaletteColours/blockquote-bar",
"text": "Blockquote bar"
},
"$:/language/Docs/PaletteColours/button-background": {
"title": "$:/language/Docs/PaletteColours/button-background",
"text": "Default button background"
},
"$:/language/Docs/PaletteColours/button-border": {
"title": "$:/language/Docs/PaletteColours/button-border",
"text": "Default button border"
},
"$:/language/Docs/PaletteColours/button-foreground": {
"title": "$:/language/Docs/PaletteColours/button-foreground",
"text": "Default button foreground"
},
"$:/language/Docs/PaletteColours/dirty-indicator": {
"title": "$:/language/Docs/PaletteColours/dirty-indicator",
"text": "Unsaved changes indicator"
},
"$:/language/Docs/PaletteColours/code-background": {
"title": "$:/language/Docs/PaletteColours/code-background",
"text": "Code background"
},
"$:/language/Docs/PaletteColours/code-border": {
"title": "$:/language/Docs/PaletteColours/code-border",
"text": "Code border"
},
"$:/language/Docs/PaletteColours/code-foreground": {
"title": "$:/language/Docs/PaletteColours/code-foreground",
"text": "Code foreground"
},
"$:/language/Docs/PaletteColours/download-background": {
"title": "$:/language/Docs/PaletteColours/download-background",
"text": "Download button background"
},
"$:/language/Docs/PaletteColours/download-foreground": {
"title": "$:/language/Docs/PaletteColours/download-foreground",
"text": "Download button foreground"
},
"$:/language/Docs/PaletteColours/dragger-background": {
"title": "$:/language/Docs/PaletteColours/dragger-background",
"text": "Dragger background"
},
"$:/language/Docs/PaletteColours/dragger-foreground": {
"title": "$:/language/Docs/PaletteColours/dragger-foreground",
"text": "Dragger foreground"
},
"$:/language/Docs/PaletteColours/dropdown-background": {
"title": "$:/language/Docs/PaletteColours/dropdown-background",
"text": "Dropdown background"
},
"$:/language/Docs/PaletteColours/dropdown-border": {
"title": "$:/language/Docs/PaletteColours/dropdown-border",
"text": "Dropdown border"
},
"$:/language/Docs/PaletteColours/dropdown-tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/dropdown-tab-background-selected",
"text": "Dropdown tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/dropdown-tab-background": {
"title": "$:/language/Docs/PaletteColours/dropdown-tab-background",
"text": "Dropdown tab background"
},
"$:/language/Docs/PaletteColours/dropzone-background": {
"title": "$:/language/Docs/PaletteColours/dropzone-background",
"text": "Dropzone background"
},
"$:/language/Docs/PaletteColours/external-link-background-hover": {
"title": "$:/language/Docs/PaletteColours/external-link-background-hover",
"text": "External link background hover"
},
"$:/language/Docs/PaletteColours/external-link-background-visited": {
"title": "$:/language/Docs/PaletteColours/external-link-background-visited",
"text": "External link background visited"
},
"$:/language/Docs/PaletteColours/external-link-background": {
"title": "$:/language/Docs/PaletteColours/external-link-background",
"text": "External link background"
},
"$:/language/Docs/PaletteColours/external-link-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground-hover",
"text": "External link foreground hover"
},
"$:/language/Docs/PaletteColours/external-link-foreground-visited": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground-visited",
"text": "External link foreground visited"
},
"$:/language/Docs/PaletteColours/external-link-foreground": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground",
"text": "External link foreground"
},
"$:/language/Docs/PaletteColours/foreground": {
"title": "$:/language/Docs/PaletteColours/foreground",
"text": "General foreground"
},
"$:/language/Docs/PaletteColours/message-background": {
"title": "$:/language/Docs/PaletteColours/message-background",
"text": "Message box background"
},
"$:/language/Docs/PaletteColours/message-border": {
"title": "$:/language/Docs/PaletteColours/message-border",
"text": "Message box border"
},
"$:/language/Docs/PaletteColours/message-foreground": {
"title": "$:/language/Docs/PaletteColours/message-foreground",
"text": "Message box foreground"
},
"$:/language/Docs/PaletteColours/modal-backdrop": {
"title": "$:/language/Docs/PaletteColours/modal-backdrop",
"text": "Modal backdrop"
},
"$:/language/Docs/PaletteColours/modal-background": {
"title": "$:/language/Docs/PaletteColours/modal-background",
"text": "Modal background"
},
"$:/language/Docs/PaletteColours/modal-border": {
"title": "$:/language/Docs/PaletteColours/modal-border",
"text": "Modal border"
},
"$:/language/Docs/PaletteColours/modal-footer-background": {
"title": "$:/language/Docs/PaletteColours/modal-footer-background",
"text": "Modal footer background"
},
"$:/language/Docs/PaletteColours/modal-footer-border": {
"title": "$:/language/Docs/PaletteColours/modal-footer-border",
"text": "Modal footer border"
},
"$:/language/Docs/PaletteColours/modal-header-border": {
"title": "$:/language/Docs/PaletteColours/modal-header-border",
"text": "Modal header border"
},
"$:/language/Docs/PaletteColours/muted-foreground": {
"title": "$:/language/Docs/PaletteColours/muted-foreground",
"text": "General muted foreground"
},
"$:/language/Docs/PaletteColours/notification-background": {
"title": "$:/language/Docs/PaletteColours/notification-background",
"text": "Notification background"
},
"$:/language/Docs/PaletteColours/notification-border": {
"title": "$:/language/Docs/PaletteColours/notification-border",
"text": "Notification border"
},
"$:/language/Docs/PaletteColours/page-background": {
"title": "$:/language/Docs/PaletteColours/page-background",
"text": "Page background"
},
"$:/language/Docs/PaletteColours/pre-background": {
"title": "$:/language/Docs/PaletteColours/pre-background",
"text": "Preformatted code background"
},
"$:/language/Docs/PaletteColours/pre-border": {
"title": "$:/language/Docs/PaletteColours/pre-border",
"text": "Preformatted code border"
},
"$:/language/Docs/PaletteColours/primary": {
"title": "$:/language/Docs/PaletteColours/primary",
"text": "General primary"
},
"$:/language/Docs/PaletteColours/sidebar-button-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-button-foreground",
"text": "Sidebar button foreground"
},
"$:/language/Docs/PaletteColours/sidebar-controls-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-controls-foreground-hover",
"text": "Sidebar controls foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-controls-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-controls-foreground",
"text": "Sidebar controls foreground"
},
"$:/language/Docs/PaletteColours/sidebar-foreground-shadow": {
"title": "$:/language/Docs/PaletteColours/sidebar-foreground-shadow",
"text": "Sidebar foreground shadow"
},
"$:/language/Docs/PaletteColours/sidebar-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-foreground",
"text": "Sidebar foreground"
},
"$:/language/Docs/PaletteColours/sidebar-muted-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-muted-foreground-hover",
"text": "Sidebar muted foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-muted-foreground",
"text": "Sidebar muted foreground"
},
"$:/language/Docs/PaletteColours/sidebar-tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-background-selected",
"text": "Sidebar tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-background": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-background",
"text": "Sidebar tab background"
},
"$:/language/Docs/PaletteColours/sidebar-tab-border-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-border-selected",
"text": "Sidebar tab border for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-border": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-border",
"text": "Sidebar tab border"
},
"$:/language/Docs/PaletteColours/sidebar-tab-divider": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-divider",
"text": "Sidebar tab divider"
},
"$:/language/Docs/PaletteColours/sidebar-tab-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-foreground-selected",
"text": "Sidebar tab foreground for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-foreground",
"text": "Sidebar tab foreground"
},
"$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground-hover",
"text": "Sidebar tiddler link foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground",
"text": "Sidebar tiddler link foreground"
},
"$:/language/Docs/PaletteColours/site-title-foreground": {
"title": "$:/language/Docs/PaletteColours/site-title-foreground",
"text": "Site title foreground"
},
"$:/language/Docs/PaletteColours/static-alert-foreground": {
"title": "$:/language/Docs/PaletteColours/static-alert-foreground",
"text": "Static alert foreground"
},
"$:/language/Docs/PaletteColours/tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/tab-background-selected",
"text": "Tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-background": {
"title": "$:/language/Docs/PaletteColours/tab-background",
"text": "Tab background"
},
"$:/language/Docs/PaletteColours/tab-border-selected": {
"title": "$:/language/Docs/PaletteColours/tab-border-selected",
"text": "Tab border for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-border": {
"title": "$:/language/Docs/PaletteColours/tab-border",
"text": "Tab border"
},
"$:/language/Docs/PaletteColours/tab-divider": {
"title": "$:/language/Docs/PaletteColours/tab-divider",
"text": "Tab divider"
},
"$:/language/Docs/PaletteColours/tab-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/tab-foreground-selected",
"text": "Tab foreground for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-foreground": {
"title": "$:/language/Docs/PaletteColours/tab-foreground",
"text": "Tab foreground"
},
"$:/language/Docs/PaletteColours/table-border": {
"title": "$:/language/Docs/PaletteColours/table-border",
"text": "Table border"
},
"$:/language/Docs/PaletteColours/table-footer-background": {
"title": "$:/language/Docs/PaletteColours/table-footer-background",
"text": "Table footer background"
},
"$:/language/Docs/PaletteColours/table-header-background": {
"title": "$:/language/Docs/PaletteColours/table-header-background",
"text": "Table header background"
},
"$:/language/Docs/PaletteColours/tag-background": {
"title": "$:/language/Docs/PaletteColours/tag-background",
"text": "Tag background"
},
"$:/language/Docs/PaletteColours/tag-foreground": {
"title": "$:/language/Docs/PaletteColours/tag-foreground",
"text": "Tag foreground"
},
"$:/language/Docs/PaletteColours/tiddler-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-background",
"text": "Tiddler background"
},
"$:/language/Docs/PaletteColours/tiddler-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-border",
"text": "Tiddler border"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground-hover",
"text": "Tiddler controls foreground hover"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground-selected",
"text": "Tiddler controls foreground for selected controls"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground",
"text": "Tiddler controls foreground"
},
"$:/language/Docs/PaletteColours/tiddler-editor-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-background",
"text": "Tiddler editor background"
},
"$:/language/Docs/PaletteColours/tiddler-editor-border-image": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-border-image",
"text": "Tiddler editor border image"
},
"$:/language/Docs/PaletteColours/tiddler-editor-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-border",
"text": "Tiddler editor border"
},
"$:/language/Docs/PaletteColours/tiddler-editor-fields-even": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-fields-even",
"text": "Tiddler editor background for even fields"
},
"$:/language/Docs/PaletteColours/tiddler-editor-fields-odd": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-fields-odd",
"text": "Tiddler editor background for odd fields"
},
"$:/language/Docs/PaletteColours/tiddler-info-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-background",
"text": "Tiddler info panel background"
},
"$:/language/Docs/PaletteColours/tiddler-info-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-border",
"text": "Tiddler info panel border"
},
"$:/language/Docs/PaletteColours/tiddler-info-tab-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-tab-background",
"text": "Tiddler info panel tab background"
},
"$:/language/Docs/PaletteColours/tiddler-link-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-link-background",
"text": "Tiddler link background"
},
"$:/language/Docs/PaletteColours/tiddler-link-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-link-foreground",
"text": "Tiddler link foreground"
},
"$:/language/Docs/PaletteColours/tiddler-subtitle-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-subtitle-foreground",
"text": "Tiddler subtitle foreground"
},
"$:/language/Docs/PaletteColours/tiddler-title-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-title-foreground",
"text": "Tiddler title foreground"
},
"$:/language/Docs/PaletteColours/toolbar-new-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-new-button",
"text": "Toolbar 'new tiddler' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-options-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-options-button",
"text": "Toolbar 'options' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-save-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-save-button",
"text": "Toolbar 'save' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-info-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-info-button",
"text": "Toolbar 'info' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-edit-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-edit-button",
"text": "Toolbar 'edit' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-close-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-close-button",
"text": "Toolbar 'close' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-delete-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-delete-button",
"text": "Toolbar 'delete' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-cancel-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-cancel-button",
"text": "Toolbar 'cancel' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-done-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-done-button",
"text": "Toolbar 'done' button foreground"
},
"$:/language/Docs/PaletteColours/untagged-background": {
"title": "$:/language/Docs/PaletteColours/untagged-background",
"text": "Untagged pill background"
},
"$:/language/Docs/PaletteColours/very-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/very-muted-foreground",
"text": "Very muted foreground"
},
"$:/language/EditTemplate/Body/External/Hint": {
"title": "$:/language/EditTemplate/Body/External/Hint",
"text": "This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself"
},
"$:/language/EditTemplate/Body/Placeholder": {
"title": "$:/language/EditTemplate/Body/Placeholder",
"text": "Type the text for this tiddler"
},
"$:/language/EditTemplate/Body/Preview/Type/Output": {
"title": "$:/language/EditTemplate/Body/Preview/Type/Output",
"text": "output"
},
"$:/language/EditTemplate/Field/Remove/Caption": {
"title": "$:/language/EditTemplate/Field/Remove/Caption",
"text": "remove field"
},
"$:/language/EditTemplate/Field/Remove/Hint": {
"title": "$:/language/EditTemplate/Field/Remove/Hint",
"text": "Remove field"
},
"$:/language/EditTemplate/Fields/Add/Button": {
"title": "$:/language/EditTemplate/Fields/Add/Button",
"text": "add"
},
"$:/language/EditTemplate/Fields/Add/Name/Placeholder": {
"title": "$:/language/EditTemplate/Fields/Add/Name/Placeholder",
"text": "field name"
},
"$:/language/EditTemplate/Fields/Add/Prompt": {
"title": "$:/language/EditTemplate/Fields/Add/Prompt",
"text": "Add a new field:"
},
"$:/language/EditTemplate/Fields/Add/Value/Placeholder": {
"title": "$:/language/EditTemplate/Fields/Add/Value/Placeholder",
"text": "field value"
},
"$:/language/EditTemplate/Fields/Add/Dropdown/System": {
"title": "$:/language/EditTemplate/Fields/Add/Dropdown/System",
"text": "System fields"
},
"$:/language/EditTemplate/Fields/Add/Dropdown/User": {
"title": "$:/language/EditTemplate/Fields/Add/Dropdown/User",
"text": "User fields"
},
"$:/language/EditTemplate/Shadow/Warning": {
"title": "$:/language/EditTemplate/Shadow/Warning",
"text": "This is a shadow tiddler. Any changes you make will override the default version from the plugin <<pluginLink>>"
},
"$:/language/EditTemplate/Shadow/OverriddenWarning": {
"title": "$:/language/EditTemplate/Shadow/OverriddenWarning",
"text": "This is a modified shadow tiddler. You can revert to the default version in the plugin <<pluginLink>> by deleting this tiddler"
},
"$:/language/EditTemplate/Tags/Add/Button": {
"title": "$:/language/EditTemplate/Tags/Add/Button",
"text": "add"
},
"$:/language/EditTemplate/Tags/Add/Placeholder": {
"title": "$:/language/EditTemplate/Tags/Add/Placeholder",
"text": "tag name"
},
"$:/language/EditTemplate/Tags/Dropdown/Caption": {
"title": "$:/language/EditTemplate/Tags/Dropdown/Caption",
"text": "tag list"
},
"$:/language/EditTemplate/Tags/Dropdown/Hint": {
"title": "$:/language/EditTemplate/Tags/Dropdown/Hint",
"text": "Show tag list"
},
"$:/language/EditTemplate/Title/BadCharacterWarning": {
"title": "$:/language/EditTemplate/Title/BadCharacterWarning",
"text": "Warning: avoid using any of the characters <<bad-chars>> in tiddler titles"
},
"$:/language/EditTemplate/Title/Exists/Prompt": {
"title": "$:/language/EditTemplate/Title/Exists/Prompt",
"text": "Target tiddler already exists"
},
"$:/language/EditTemplate/Title/Relink/Prompt": {
"title": "$:/language/EditTemplate/Title/Relink/Prompt",
"text": "Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers"
},
"$:/language/EditTemplate/Type/Dropdown/Caption": {
"title": "$:/language/EditTemplate/Type/Dropdown/Caption",
"text": "content type list"
},
"$:/language/EditTemplate/Type/Dropdown/Hint": {
"title": "$:/language/EditTemplate/Type/Dropdown/Hint",
"text": "Show content type list"
},
"$:/language/EditTemplate/Type/Delete/Caption": {
"title": "$:/language/EditTemplate/Type/Delete/Caption",
"text": "delete content type"
},
"$:/language/EditTemplate/Type/Delete/Hint": {
"title": "$:/language/EditTemplate/Type/Delete/Hint",
"text": "Delete content type"
},
"$:/language/EditTemplate/Type/Placeholder": {
"title": "$:/language/EditTemplate/Type/Placeholder",
"text": "content type"
},
"$:/language/EditTemplate/Type/Prompt": {
"title": "$:/language/EditTemplate/Type/Prompt",
"text": "Type:"
},
"$:/language/Exporters/StaticRiver": {
"title": "$:/language/Exporters/StaticRiver",
"text": "Static HTML"
},
"$:/language/Exporters/JsonFile": {
"title": "$:/language/Exporters/JsonFile",
"text": "JSON file"
},
"$:/language/Exporters/CsvFile": {
"title": "$:/language/Exporters/CsvFile",
"text": "CSV file"
},
"$:/language/Exporters/TidFile": {
"title": "$:/language/Exporters/TidFile",
"text": "\".tid\" file"
},
"$:/language/Docs/Fields/_canonical_uri": {
"title": "$:/language/Docs/Fields/_canonical_uri",
"text": "The full URI of an external image tiddler"
},
"$:/language/Docs/Fields/bag": {
"title": "$:/language/Docs/Fields/bag",
"text": "The name of the bag from which a tiddler came"
},
"$:/language/Docs/Fields/caption": {
"title": "$:/language/Docs/Fields/caption",
"text": "The text to be displayed on a tab or button"
},
"$:/language/Docs/Fields/color": {
"title": "$:/language/Docs/Fields/color",
"text": "The CSS color value associated with a tiddler"
},
"$:/language/Docs/Fields/component": {
"title": "$:/language/Docs/Fields/component",
"text": "The name of the component responsible for an [[alert tiddler|AlertMechanism]]"
},
"$:/language/Docs/Fields/current-tiddler": {
"title": "$:/language/Docs/Fields/current-tiddler",
"text": "Used to cache the top tiddler in a [[history list|HistoryMechanism]]"
},
"$:/language/Docs/Fields/created": {
"title": "$:/language/Docs/Fields/created",
"text": "The date a tiddler was created"
},
"$:/language/Docs/Fields/creator": {
"title": "$:/language/Docs/Fields/creator",
"text": "The name of the person who created a tiddler"
},
"$:/language/Docs/Fields/dependents": {
"title": "$:/language/Docs/Fields/dependents",
"text": "For a plugin, lists the dependent plugin titles"
},
"$:/language/Docs/Fields/description": {
"title": "$:/language/Docs/Fields/description",
"text": "The descriptive text for a plugin, or a modal dialogue"
},
"$:/language/Docs/Fields/draft.of": {
"title": "$:/language/Docs/Fields/draft.of",
"text": "For draft tiddlers, contains the title of the tiddler of which this is a draft"
},
"$:/language/Docs/Fields/draft.title": {
"title": "$:/language/Docs/Fields/draft.title",
"text": "For draft tiddlers, contains the proposed new title of the tiddler"
},
"$:/language/Docs/Fields/footer": {
"title": "$:/language/Docs/Fields/footer",
"text": "The footer text for a wizard"
},
"$:/language/Docs/Fields/hack-to-give-us-something-to-compare-against": {
"title": "$:/language/Docs/Fields/hack-to-give-us-something-to-compare-against",
"text": "A temporary storage field used in [[$:/core/templates/static.content]]"
},
"$:/language/Docs/Fields/icon": {
"title": "$:/language/Docs/Fields/icon",
"text": "The title of the tiddler containing the icon associated with a tiddler"
},
"$:/language/Docs/Fields/library": {
"title": "$:/language/Docs/Fields/library",
"text": "If set to \"yes\" indicates that a tiddler should be saved as a JavaScript library"
},
"$:/language/Docs/Fields/list": {
"title": "$:/language/Docs/Fields/list",
"text": "An ordered list of tiddler titles associated with a tiddler"
},
"$:/language/Docs/Fields/list-before": {
"title": "$:/language/Docs/Fields/list-before",
"text": "If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty"
},
"$:/language/Docs/Fields/list-after": {
"title": "$:/language/Docs/Fields/list-after",
"text": "If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles"
},
"$:/language/Docs/Fields/modified": {
"title": "$:/language/Docs/Fields/modified",
"text": "The date and time at which a tiddler was last modified"
},
"$:/language/Docs/Fields/modifier": {
"title": "$:/language/Docs/Fields/modifier",
"text": "The tiddler title associated with the person who last modified a tiddler"
},
"$:/language/Docs/Fields/name": {
"title": "$:/language/Docs/Fields/name",
"text": "The human readable name associated with a plugin tiddler"
},
"$:/language/Docs/Fields/plugin-priority": {
"title": "$:/language/Docs/Fields/plugin-priority",
"text": "A numerical value indicating the priority of a plugin tiddler"
},
"$:/language/Docs/Fields/plugin-type": {
"title": "$:/language/Docs/Fields/plugin-type",
"text": "The type of plugin in a plugin tiddler"
},
"$:/language/Docs/Fields/revision": {
"title": "$:/language/Docs/Fields/revision",
"text": "The revision of the tiddler held at the server"
},
"$:/language/Docs/Fields/released": {
"title": "$:/language/Docs/Fields/released",
"text": "Date of a TiddlyWiki release"
},
"$:/language/Docs/Fields/source": {
"title": "$:/language/Docs/Fields/source",
"text": "The source URL associated with a tiddler"
},
"$:/language/Docs/Fields/subtitle": {
"title": "$:/language/Docs/Fields/subtitle",
"text": "The subtitle text for a wizard"
},
"$:/language/Docs/Fields/tags": {
"title": "$:/language/Docs/Fields/tags",
"text": "A list of tags associated with a tiddler"
},
"$:/language/Docs/Fields/text": {
"title": "$:/language/Docs/Fields/text",
"text": "The body text of a tiddler"
},
"$:/language/Docs/Fields/title": {
"title": "$:/language/Docs/Fields/title",
"text": "The unique name of a tiddler"
},
"$:/language/Docs/Fields/type": {
"title": "$:/language/Docs/Fields/type",
"text": "The content type of a tiddler"
},
"$:/language/Docs/Fields/version": {
"title": "$:/language/Docs/Fields/version",
"text": "Version information for a plugin"
},
"$:/language/Filters/AllTiddlers": {
"title": "$:/language/Filters/AllTiddlers",
"text": "All tiddlers except system tiddlers"
},
"$:/language/Filters/RecentSystemTiddlers": {
"title": "$:/language/Filters/RecentSystemTiddlers",
"text": "Recently modified tiddlers, including system tiddlers"
},
"$:/language/Filters/RecentTiddlers": {
"title": "$:/language/Filters/RecentTiddlers",
"text": "Recently modified tiddlers"
},
"$:/language/Filters/AllTags": {
"title": "$:/language/Filters/AllTags",
"text": "All tags except system tags"
},
"$:/language/Filters/Missing": {
"title": "$:/language/Filters/Missing",
"text": "Missing tiddlers"
},
"$:/language/Filters/Drafts": {
"title": "$:/language/Filters/Drafts",
"text": "Draft tiddlers"
},
"$:/language/Filters/Orphans": {
"title": "$:/language/Filters/Orphans",
"text": "Orphan tiddlers"
},
"$:/language/Filters/SystemTiddlers": {
"title": "$:/language/Filters/SystemTiddlers",
"text": "System tiddlers"
},
"$:/language/Filters/ShadowTiddlers": {
"title": "$:/language/Filters/ShadowTiddlers",
"text": "Shadow tiddlers"
},
"$:/language/Filters/OverriddenShadowTiddlers": {
"title": "$:/language/Filters/OverriddenShadowTiddlers",
"text": "Overridden shadow tiddlers"
},
"$:/language/Filters/SystemTags": {
"title": "$:/language/Filters/SystemTags",
"text": "System tags"
},
"$:/language/Filters/StoryList": {
"title": "$:/language/Filters/StoryList",
"text": "Tiddlers in the story river, excluding <$text text=\"$:/AdvancedSearch\"/>"
},
"$:/language/Filters/TypedTiddlers": {
"title": "$:/language/Filters/TypedTiddlers",
"text": "Non wiki-text tiddlers"
},
"GettingStarted": {
"title": "GettingStarted",
"text": "\\define lingo-base() $:/language/ControlPanel/Basics/\nWelcome to ~TiddlyWiki and the ~TiddlyWiki community\n\nBefore you start storing important information in ~TiddlyWiki it is important to make sure that you can reliably save changes. See http://tiddlywiki.com/#GettingStarted for details\n\n!! Set up this ~TiddlyWiki\n\n<div class=\"tc-control-panel\">\n\n|<$link to=\"$:/SiteTitle\"><<lingo Title/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteTitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/SiteSubtitle\"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteSubtitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/DefaultTiddlers\"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag=\"textarea\" tiddler=\"$:/DefaultTiddlers\"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |\n</div>\n\nSee the [[control panel|$:/ControlPanel]] for more options.\n"
},
"$:/language/Help/build": {
"title": "$:/language/Help/build",
"description": "Automatically run configured commands",
"text": "Build the specified build targets for the current wiki. If no build targets are specified then all available targets will be built.\n\n```\n--build <target> [<target> ...]\n```\n\nBuild targets are defined in the `tiddlywiki.info` file of a wiki folder.\n\n"
},
"$:/language/Help/clearpassword": {
"title": "$:/language/Help/clearpassword",
"description": "Clear a password for subsequent crypto operations",
"text": "Clear the password for subsequent crypto operations\n\n```\n--clearpassword\n```\n"
},
"$:/language/Help/default": {
"title": "$:/language/Help/default",
"text": "\\define commandTitle()\n$:/language/Help/$(command)$\n\\end\n```\nusage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]\n```\n\nAvailable commands:\n\n<ul>\n<$list filter=\"[commands[]sort[title]]\" variable=\"command\">\n<li><$link to=<<commandTitle>>><$macrocall $name=\"command\" $type=\"text/plain\" $output=\"text/plain\"/></$link>: <$transclude tiddler=<<commandTitle>> field=\"description\"/></li>\n</$list>\n</ul>\n\nTo get detailed help on a command:\n\n```\ntiddlywiki --help <command>\n```\n"
},
"$:/language/Help/editions": {
"title": "$:/language/Help/editions",
"description": "Lists the available editions of TiddlyWiki",
"text": "Lists the names and descriptions of the available editions. You can create a new wiki of a specified edition with the `--init` command.\n\n```\n--editions\n```\n"
},
"$:/language/Help/fetch": {
"title": "$:/language/Help/fetch",
"description": "Fetch tiddlers from wiki by URL",
"text": "Fetch one or more files over HTTP/HTTPS, and import the tiddlers matching a filter, optionally transforming the incoming titles.\n\n```\n--fetch file <url> <import-filter> <transform-filter>\n--fetch files <url-filter> <import-filter> <transform-filter>\n```\n\nWith the \"file\" variant only a single file is fetched and the first parameter is the URL of the file to read.\n\nWith the \"files\" variant, multiple files are fetched and the first parameter is a filter yielding a list of URLs of the files to read. For example, given a set of tiddlers tagged \"remote-server\" that have a field \"url\" the filter `[tag[remote-server]get[url]]` will retrieve all the available URLs.\n\nThe `<import-filter>` parameter specifies a filter determining which tiddlers are imported. It defaults to `[all[tiddlers]]` if not provided.\n\nThe `<transform-filter>` parameter specifies an optional filter that transforms the titles of the imported tiddlers. For example, `[addprefix[$:/myimports/]]` would add the prefix `$:/myimports/` to each title.\n\nPreceding the `--fetch` command with `--verbose` will output progress information during the import.\n\nNote that TiddlyWiki will not fetch an older version of an already loaded plugin.\n\nThe following example retrieves all the non-system tiddlers from http://tiddlywiki.com and saves them to a JSON file:\n\n```\ntiddlywiki --verbose --fetch file \"http://tiddlywiki.com/\" \"[!is[system]]\" \"\" --rendertiddler \"$:/core/templates/exporters/JsonFile\" output.json text/plain \"\" exportFilter \"[!is[system]]\"\n```\n\n"
},
"$:/language/Help/help": {
"title": "$:/language/Help/help",
"description": "Display help for TiddlyWiki commands",
"text": "Displays help text for a command:\n\n```\n--help [<command>]\n```\n\nIf the command name is omitted then a list of available commands is displayed.\n"
},
"$:/language/Help/init": {
"title": "$:/language/Help/init",
"description": "Initialise a new wiki folder",
"text": "Initialise an empty [[WikiFolder|WikiFolders]] with a copy of the specified edition.\n\n```\n--init <edition> [<edition> ...]\n```\n\nFor example:\n\n```\ntiddlywiki ./MyWikiFolder --init empty\n```\n\nNote:\n\n* The wiki folder directory will be created if necessary\n* The \"edition\" defaults to ''empty''\n* The init command will fail if the wiki folder is not empty\n* The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file\n* When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final `tiddlywiki.info` file will be copied from the last edition)\n* `--editions` returns a list of available editions\n"
},
"$:/language/Help/load": {
"title": "$:/language/Help/load",
"description": "Load tiddlers from a file",
"text": "Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files\n\n```\n--load <filepath>\n```\n\nTo load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example:\n\n```\ntiddlywiki ./MyWiki --password pa55w0rd --load my_encrypted_wiki.html\n```\n\nNote that TiddlyWiki will not load an older version of an already loaded plugin.\n"
},
"$:/language/Help/makelibrary": {
"title": "$:/language/Help/makelibrary",
"description": "Construct library plugin required by upgrade process",
"text": "Constructs the `$:/UpgradeLibrary` tiddler for the upgrade process.\n\nThe upgrade library is formatted as an ordinary plugin tiddler with the plugin type `library`. It contains a copy of each of the plugins, themes and language packs available within the TiddlyWiki5 repository.\n\nThis command is intended for internal use; it is only relevant to users constructing a custom upgrade procedure.\n\n```\n--makelibrary <title>\n```\n\nThe title argument defaults to `$:/UpgradeLibrary`.\n"
},
"$:/language/Help/notfound": {
"title": "$:/language/Help/notfound",
"text": "No such help item"
},
"$:/language/Help/output": {
"title": "$:/language/Help/output",
"description": "Set the base output directory for subsequent commands",
"text": "Sets the base output directory for subsequent commands. The default output directory is the `output` subdirectory of the edition directory.\n\n```\n--output <pathname>\n```\n\nIf the specified pathname is relative then it is resolved relative to the current working directory. For example `--output .` sets the output directory to the current working directory.\n\n"
},
"$:/language/Help/password": {
"title": "$:/language/Help/password",
"description": "Set a password for subsequent crypto operations",
"text": "Set a password for subsequent crypto operations\n\n```\n--password <password>\n```\n\n''Note'': This should not be used for serving TiddlyWiki with password protection. Instead, see the password option under the [[ServerCommand]].\n"
},
"$:/language/Help/rendertiddler": {
"title": "$:/language/Help/rendertiddler",
"description": "Render an individual tiddler as a specified ContentType",
"text": "Render an individual tiddler as a specified ContentType, defaulting to `text/html` and save it to the specified filename.\n\nOptionally the title of a template tiddler can be specified, in which case the template tiddler is rendered with the \"currentTiddler\" variable set to the tiddler that is being rendered (the first parameter value).\n\nA name and value for an additional variable may optionally also be specified.\n\n```\n--rendertiddler <title> <filename> [<type>] [<template>] [<name>] [<value>]\n```\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny missing directories in the path to the filename are automatically created.\n\nFor example, the following command saves all tiddlers matching the filter `[tag[done]]` to a JSON file titled `output.json` by employing the core template `$:/core/templates/exporters/JsonFile`.\n\n```\n--rendertiddler \"$:/core/templates/exporters/JsonFile\" output.json text/plain \"\" exportFilter \"[tag[done]]\"\n```\n"
},
"$:/language/Help/rendertiddlers": {
"title": "$:/language/Help/rendertiddlers",
"description": "Render tiddlers matching a filter to a specified ContentType",
"text": "Render a set of tiddlers matching a filter to separate files of a specified ContentType (defaults to `text/html`) and extension (defaults to `.html`).\n\n```\n--rendertiddlers <filter> <template> <pathname> [<type>] [<extension>] [\"noclean\"]\n```\n\nFor example:\n\n```\n--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html ./static text/plain\n```\n\nBy default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny files in the target directory are deleted unless the ''noclean'' flag is specified. The target directory is recursively created if it is missing.\n"
},
"$:/language/Help/savetiddler": {
"title": "$:/language/Help/savetiddler",
"description": "Saves a raw tiddler to a file",
"text": "Saves an individual tiddler in its raw text or binary format to the specified filename.\n\n```\n--savetiddler <title> <filename>\n```\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny missing directories in the path to the filename are automatically created.\n"
},
"$:/language/Help/savetiddlers": {
"title": "$:/language/Help/savetiddlers",
"description": "Saves a group of raw tiddlers to a directory",
"text": "Saves a group of tiddlers in their raw text or binary format to the specified directory.\n\n```\n--savetiddlers <filter> <pathname> [\"noclean\"]\n```\n\nBy default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nThe output directory is cleared of existing files before saving the specified files. The deletion can be disabled by specifying the ''noclean'' flag.\n\nAny missing directories in the pathname are automatically created.\n"
},
"$:/language/Help/server": {
"title": "$:/language/Help/server",
"description": "Provides an HTTP server interface to TiddlyWiki",
"text": "The server built in to TiddlyWiki5 is very simple. Although compatible with TiddlyWeb it doesn't support many of the features needed for robust Internet-facing usage.\n\nAt the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for `GET`, `PUT` and `DELETE`.\n\n```\n--server <port> <roottiddler> <rendertype> <servetype> <username> <password> <host> <pathprefix>\n```\n\nThe parameters are:\n\n* ''port'' - port number to serve from (defaults to \"8080\")\n* ''roottiddler'' - the tiddler to serve at the root (defaults to \"$:/core/save/all\")\n* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to \"text/plain\")\n* ''servetype'' - the content type with which the root tiddler should be served (defaults to \"text/html\")\n* ''username'' - the default username for signing edits\n* ''password'' - optional password for basic authentication\n* ''host'' - optional hostname to serve from (defaults to \"127.0.0.1\" aka \"localhost\")\n* ''pathprefix'' - optional prefix for paths\n\nIf the password parameter is specified then the browser will prompt the user for the username and password. Note that the password is transmitted in plain text so this implementation isn't suitable for general use.\n\nFor example:\n\n```\n--server 8080 $:/core/save/all text/plain text/html MyUserName passw0rd\n```\n\nThe username and password can be specified as empty strings if you need to set the hostname or pathprefix and don't want to require a password:\n\n```\n--server 8080 $:/core/save/all text/plain text/html \"\" \"\" 192.168.0.245\n```\n\nTo run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port.\n"
},
"$:/language/Help/setfield": {
"title": "$:/language/Help/setfield",
"description": "Prepares external tiddlers for use",
"text": "//Note that this command is experimental and may change or be replaced before being finalised//\n\nSets the specified field of a group of tiddlers to the result of wikifying a template tiddler with the `currentTiddler` variable set to the tiddler.\n\n```\n--setfield <filter> <fieldname> <templatetitle> <rendertype>\n```\n\nThe parameters are:\n\n* ''filter'' - filter identifying the tiddlers to be affected\n* ''fieldname'' - the field to modify (defaults to \"text\")\n* ''templatetitle'' - the tiddler to wikify into the specified field. If blank or missing then the specified field is deleted\n* ''rendertype'' - the text type to render (defaults to \"text/plain\"; \"text/html\" can be used to include HTML tags)\n"
},
"$:/language/Help/unpackplugin": {
"title": "$:/language/Help/unpackplugin",
"description": "Unpack the payload tiddlers from a plugin",
"text": "Extract the payload tiddlers from a plugin, creating them as ordinary tiddlers:\n\n```\n--unpackplugin <title>\n```\n"
},
"$:/language/Help/verbose": {
"title": "$:/language/Help/verbose",
"description": "Triggers verbose output mode",
"text": "Triggers verbose output, useful for debugging\n\n```\n--verbose\n```\n"
},
"$:/language/Help/version": {
"title": "$:/language/Help/version",
"description": "Displays the version number of TiddlyWiki",
"text": "Displays the version number of TiddlyWiki.\n\n```\n--version\n```\n"
},
"$:/language/Import/Imported/Hint": {
"title": "$:/language/Import/Imported/Hint",
"text": "The following tiddlers were imported:"
},
"$:/language/Import/Listing/Cancel/Caption": {
"title": "$:/language/Import/Listing/Cancel/Caption",
"text": "Cancel"
},
"$:/language/Import/Listing/Hint": {
"title": "$:/language/Import/Listing/Hint",
"text": "These tiddlers are ready to import:"
},
"$:/language/Import/Listing/Import/Caption": {
"title": "$:/language/Import/Listing/Import/Caption",
"text": "Import"
},
"$:/language/Import/Listing/Select/Caption": {
"title": "$:/language/Import/Listing/Select/Caption",
"text": "Select"
},
"$:/language/Import/Listing/Status/Caption": {
"title": "$:/language/Import/Listing/Status/Caption",
"text": "Status"
},
"$:/language/Import/Listing/Title/Caption": {
"title": "$:/language/Import/Listing/Title/Caption",
"text": "Title"
},
"$:/language/Import/Upgrader/Plugins/Suppressed/Incompatible": {
"title": "$:/language/Import/Upgrader/Plugins/Suppressed/Incompatible",
"text": "Blocked incompatible or obsolete plugin"
},
"$:/language/Import/Upgrader/Plugins/Suppressed/Version": {
"title": "$:/language/Import/Upgrader/Plugins/Suppressed/Version",
"text": "Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)"
},
"$:/language/Import/Upgrader/Plugins/Upgraded": {
"title": "$:/language/Import/Upgrader/Plugins/Upgraded",
"text": "Upgraded plugin from <<incoming>> to <<upgraded>>"
},
"$:/language/Import/Upgrader/State/Suppressed": {
"title": "$:/language/Import/Upgrader/State/Suppressed",
"text": "Blocked temporary state tiddler"
},
"$:/language/Import/Upgrader/System/Suppressed": {
"title": "$:/language/Import/Upgrader/System/Suppressed",
"text": "Blocked system tiddler"
},
"$:/language/Import/Upgrader/ThemeTweaks/Created": {
"title": "$:/language/Import/Upgrader/ThemeTweaks/Created",
"text": "Migrated theme tweak from <$text text=<<from>>/>"
},
"$:/language/AboveStory/ClassicPlugin/Warning": {
"title": "$:/language/AboveStory/ClassicPlugin/Warning",
"text": "It looks like you are trying to load a plugin designed for ~TiddlyWiki Classic. Please note that [[these plugins do not work with TiddlyWiki version 5.x.x|http://tiddlywiki.com/#TiddlyWikiClassic]]. ~TiddlyWiki Classic plugins detected:"
},
"$:/language/BinaryWarning/Prompt": {
"title": "$:/language/BinaryWarning/Prompt",
"text": "This tiddler contains binary data"
},
"$:/language/ClassicWarning/Hint": {
"title": "$:/language/ClassicWarning/Hint",
"text": "This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See http://tiddlywiki.com/static/Upgrading.html for more details."
},
"$:/language/ClassicWarning/Upgrade/Caption": {
"title": "$:/language/ClassicWarning/Upgrade/Caption",
"text": "upgrade"
},
"$:/language/CloseAll/Button": {
"title": "$:/language/CloseAll/Button",
"text": "close all"
},
"$:/language/ColourPicker/Recent": {
"title": "$:/language/ColourPicker/Recent",
"text": "Recent:"
},
"$:/language/ConfirmCancelTiddler": {
"title": "$:/language/ConfirmCancelTiddler",
"text": "Do you wish to discard changes to the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmDeleteTiddler": {
"title": "$:/language/ConfirmDeleteTiddler",
"text": "Do you wish to delete the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmOverwriteTiddler": {
"title": "$:/language/ConfirmOverwriteTiddler",
"text": "Do you wish to overwrite the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmEditShadowTiddler": {
"title": "$:/language/ConfirmEditShadowTiddler",
"text": "You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit \"<$text text=<<title>>/>\"?"
},
"$:/language/Count": {
"title": "$:/language/Count",
"text": "count"
},
"$:/language/DefaultNewTiddlerTitle": {
"title": "$:/language/DefaultNewTiddlerTitle",
"text": "New Tiddler"
},
"$:/language/DropMessage": {
"title": "$:/language/DropMessage",
"text": "Drop here (or use the 'Escape' key to cancel)"
},
"$:/language/Encryption/Cancel": {
"title": "$:/language/Encryption/Cancel",
"text": "Cancel"
},
"$:/language/Encryption/ConfirmClearPassword": {
"title": "$:/language/Encryption/ConfirmClearPassword",
"text": "Do you wish to clear the password? This will remove the encryption applied when saving this wiki"
},
"$:/language/Encryption/PromptSetPassword": {
"title": "$:/language/Encryption/PromptSetPassword",
"text": "Set a new password for this TiddlyWiki"
},
"$:/language/Encryption/Username": {
"title": "$:/language/Encryption/Username",
"text": "Username"
},
"$:/language/Encryption/Password": {
"title": "$:/language/Encryption/Password",
"text": "Password"
},
"$:/language/Encryption/RepeatPassword": {
"title": "$:/language/Encryption/RepeatPassword",
"text": "Repeat password"
},
"$:/language/Encryption/PasswordNoMatch": {
"title": "$:/language/Encryption/PasswordNoMatch",
"text": "Passwords do not match"
},
"$:/language/Encryption/SetPassword": {
"title": "$:/language/Encryption/SetPassword",
"text": "Set password"
},
"$:/language/Error/Caption": {
"title": "$:/language/Error/Caption",
"text": "Error"
},
"$:/language/Error/EditConflict": {
"title": "$:/language/Error/EditConflict",
"text": "File changed on server"
},
"$:/language/Error/Filter": {
"title": "$:/language/Error/Filter",
"text": "Filter error"
},
"$:/language/Error/FilterSyntax": {
"title": "$:/language/Error/FilterSyntax",
"text": "Syntax error in filter expression"
},
"$:/language/Error/IsFilterOperator": {
"title": "$:/language/Error/IsFilterOperator",
"text": "Filter Error: Unknown operand for the 'is' filter operator"
},
"$:/language/Error/LoadingPluginLibrary": {
"title": "$:/language/Error/LoadingPluginLibrary",
"text": "Error loading plugin library"
},
"$:/language/Error/RecursiveTransclusion": {
"title": "$:/language/Error/RecursiveTransclusion",
"text": "Recursive transclusion error in transclude widget"
},
"$:/language/Error/RetrievingSkinny": {
"title": "$:/language/Error/RetrievingSkinny",
"text": "Error retrieving skinny tiddler list"
},
"$:/language/Error/SavingToTWEdit": {
"title": "$:/language/Error/SavingToTWEdit",
"text": "Error saving to TWEdit"
},
"$:/language/Error/WhileSaving": {
"title": "$:/language/Error/WhileSaving",
"text": "Error while saving"
},
"$:/language/Error/XMLHttpRequest": {
"title": "$:/language/Error/XMLHttpRequest",
"text": "XMLHttpRequest error code"
},
"$:/language/InternalJavaScriptError/Title": {
"title": "$:/language/InternalJavaScriptError/Title",
"text": "Internal JavaScript Error"
},
"$:/language/InternalJavaScriptError/Hint": {
"title": "$:/language/InternalJavaScriptError/Hint",
"text": "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser"
},
"$:/language/InvalidFieldName": {
"title": "$:/language/InvalidFieldName",
"text": "Illegal characters in field name \"<$text text=<<fieldName>>/>\". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)"
},
"$:/language/LazyLoadingWarning": {
"title": "$:/language/LazyLoadingWarning",
"text": "<p>Loading external text from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText</p>"
},
"$:/language/LoginToTiddlySpace": {
"title": "$:/language/LoginToTiddlySpace",
"text": "Login to TiddlySpace"
},
"$:/language/Manager/Controls/FilterByTag/None": {
"title": "$:/language/Manager/Controls/FilterByTag/None",
"text": "(none)"
},
"$:/language/Manager/Controls/FilterByTag/Prompt": {
"title": "$:/language/Manager/Controls/FilterByTag/Prompt",
"text": "Filter by tag:"
},
"$:/language/Manager/Controls/Order/Prompt": {
"title": "$:/language/Manager/Controls/Order/Prompt",
"text": "Reverse order"
},
"$:/language/Manager/Controls/Search/Placeholder": {
"title": "$:/language/Manager/Controls/Search/Placeholder",
"text": "Search"
},
"$:/language/Manager/Controls/Search/Prompt": {
"title": "$:/language/Manager/Controls/Search/Prompt",
"text": "Search:"
},
"$:/language/Manager/Controls/Show/Option/Tags": {
"title": "$:/language/Manager/Controls/Show/Option/Tags",
"text": "tags"
},
"$:/language/Manager/Controls/Show/Option/Tiddlers": {
"title": "$:/language/Manager/Controls/Show/Option/Tiddlers",
"text": "tiddlers"
},
"$:/language/Manager/Controls/Show/Prompt": {
"title": "$:/language/Manager/Controls/Show/Prompt",
"text": "Show:"
},
"$:/language/Manager/Controls/Sort/Prompt": {
"title": "$:/language/Manager/Controls/Sort/Prompt",
"text": "Sort by:"
},
"$:/language/Manager/Item/Colour": {
"title": "$:/language/Manager/Item/Colour",
"text": "Colour"
},
"$:/language/Manager/Item/Fields": {
"title": "$:/language/Manager/Item/Fields",
"text": "Fields"
},
"$:/language/Manager/Item/Icon/None": {
"title": "$:/language/Manager/Item/Icon/None",
"text": "(none)"
},
"$:/language/Manager/Item/Icon": {
"title": "$:/language/Manager/Item/Icon",
"text": "Icon"
},
"$:/language/Manager/Item/RawText": {
"title": "$:/language/Manager/Item/RawText",
"text": "Raw text"
},
"$:/language/Manager/Item/Tags": {
"title": "$:/language/Manager/Item/Tags",
"text": "Tags"
},
"$:/language/Manager/Item/Tools": {
"title": "$:/language/Manager/Item/Tools",
"text": "Tools"
},
"$:/language/Manager/Item/WikifiedText": {
"title": "$:/language/Manager/Item/WikifiedText",
"text": "Wikified text"
},
"$:/language/MissingTiddler/Hint": {
"title": "$:/language/MissingTiddler/Hint",
"text": "Missing tiddler \"<$text text=<<currentTiddler>>/>\" - click {{$:/core/images/edit-button}} to create"
},
"$:/language/No": {
"title": "$:/language/No",
"text": "No"
},
"$:/language/OfficialPluginLibrary": {
"title": "$:/language/OfficialPluginLibrary",
"text": "Official ~TiddlyWiki Plugin Library"
},
"$:/language/OfficialPluginLibrary/Hint": {
"title": "$:/language/OfficialPluginLibrary/Hint",
"text": "The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team."
},
"$:/language/PluginReloadWarning": {
"title": "$:/language/PluginReloadWarning",
"text": "Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect"
},
"$:/language/RecentChanges/DateFormat": {
"title": "$:/language/RecentChanges/DateFormat",
"text": "DDth MMM YYYY"
},
"$:/language/SystemTiddler/Tooltip": {
"title": "$:/language/SystemTiddler/Tooltip",
"text": "This is a system tiddler"
},
"$:/language/SystemTiddlers/Include/Prompt": {
"title": "$:/language/SystemTiddlers/Include/Prompt",
"text": "Include system tiddlers"
},
"$:/language/TagManager/Colour/Heading": {
"title": "$:/language/TagManager/Colour/Heading",
"text": "Colour"
},
"$:/language/TagManager/Count/Heading": {
"title": "$:/language/TagManager/Count/Heading",
"text": "Count"
},
"$:/language/TagManager/Icon/Heading": {
"title": "$:/language/TagManager/Icon/Heading",
"text": "Icon"
},
"$:/language/TagManager/Info/Heading": {
"title": "$:/language/TagManager/Info/Heading",
"text": "Info"
},
"$:/language/TagManager/Tag/Heading": {
"title": "$:/language/TagManager/Tag/Heading",
"text": "Tag"
},
"$:/language/Tiddler/DateFormat": {
"title": "$:/language/Tiddler/DateFormat",
"text": "DDth MMM YYYY at hh12:0mmam"
},
"$:/language/UnsavedChangesWarning": {
"title": "$:/language/UnsavedChangesWarning",
"text": "You have unsaved changes in TiddlyWiki"
},
"$:/language/Yes": {
"title": "$:/language/Yes",
"text": "Yes"
},
"$:/language/Modals/Download": {
"title": "$:/language/Modals/Download",
"type": "text/vnd.tiddlywiki",
"subtitle": "Download changes",
"footer": "<$button message=\"tm-close-tiddler\">Close</$button>",
"help": "http://tiddlywiki.com/static/DownloadingChanges.html",
"text": "Your browser only supports manual saving.\n\nTo save your modified wiki, right click on the download link below and select \"Download file\" or \"Save file\", and then choose the folder and filename.\n\n//You can marginally speed things up by clicking the link with the control key (Windows) or the options/alt key (Mac OS X). You will not be prompted for the folder or filename, but your browser is likely to give it an unrecognisable name -- you may need to rename the file to include an `.html` extension before you can do anything useful with it.//\n\nOn smartphones that do not allow files to be downloaded you can instead bookmark the link, and then sync your bookmarks to a desktop computer from where the wiki can be saved normally.\n"
},
"$:/language/Modals/SaveInstructions": {
"title": "$:/language/Modals/SaveInstructions",
"type": "text/vnd.tiddlywiki",
"subtitle": "Save your work",
"footer": "<$button message=\"tm-close-tiddler\">Close</$button>",
"help": "http://tiddlywiki.com/static/SavingChanges.html",
"text": "Your changes to this wiki need to be saved as a ~TiddlyWiki HTML file.\n\n!!! Desktop browsers\n\n# Select ''Save As'' from the ''File'' menu\n# Choose a filename and location\n#* Some browsers also require you to explicitly specify the file saving format as ''Webpage, HTML only'' or similar\n# Close this tab\n\n!!! Smartphone browsers\n\n# Create a bookmark to this page\n#* If you've got iCloud or Google Sync set up then the bookmark will automatically sync to your desktop where you can open it and save it as above\n# Close this tab\n\n//If you open the bookmark again in Mobile Safari you will see this message again. If you want to go ahead and use the file, just click the ''close'' button below//\n"
},
"$:/config/NewJournal/Title": {
"title": "$:/config/NewJournal/Title",
"text": "DDth MMM YYYY"
},
"$:/config/NewJournal/Text": {
"title": "$:/config/NewJournal/Text",
"text": ""
},
"$:/config/NewJournal/Tags": {
"title": "$:/config/NewJournal/Tags",
"text": "Journal"
},
"$:/language/Notifications/Save/Done": {
"title": "$:/language/Notifications/Save/Done",
"text": "Saved wiki"
},
"$:/language/Notifications/Save/Starting": {
"title": "$:/language/Notifications/Save/Starting",
"text": "Starting to save wiki"
},
"$:/language/Search/DefaultResults/Caption": {
"title": "$:/language/Search/DefaultResults/Caption",
"text": "List"
},
"$:/language/Search/Filter/Caption": {
"title": "$:/language/Search/Filter/Caption",
"text": "Filter"
},
"$:/language/Search/Filter/Hint": {
"title": "$:/language/Search/Filter/Hint",
"text": "Search via a [[filter expression|http://tiddlywiki.com/static/Filters.html]]"
},
"$:/language/Search/Filter/Matches": {
"title": "$:/language/Search/Filter/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Matches": {
"title": "$:/language/Search/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Matches/All": {
"title": "$:/language/Search/Matches/All",
"text": "All matches:"
},
"$:/language/Search/Matches/Title": {
"title": "$:/language/Search/Matches/Title",
"text": "Title matches:"
},
"$:/language/Search/Search": {
"title": "$:/language/Search/Search",
"text": "Search"
},
"$:/language/Search/Search/TooShort": {
"title": "$:/language/Search/Search/TooShort",
"text": "Search text too short"
},
"$:/language/Search/Shadows/Caption": {
"title": "$:/language/Search/Shadows/Caption",
"text": "Shadows"
},
"$:/language/Search/Shadows/Hint": {
"title": "$:/language/Search/Shadows/Hint",
"text": "Search for shadow tiddlers"
},
"$:/language/Search/Shadows/Matches": {
"title": "$:/language/Search/Shadows/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Standard/Caption": {
"title": "$:/language/Search/Standard/Caption",
"text": "Standard"
},
"$:/language/Search/Standard/Hint": {
"title": "$:/language/Search/Standard/Hint",
"text": "Search for standard tiddlers"
},
"$:/language/Search/Standard/Matches": {
"title": "$:/language/Search/Standard/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/System/Caption": {
"title": "$:/language/Search/System/Caption",
"text": "System"
},
"$:/language/Search/System/Hint": {
"title": "$:/language/Search/System/Hint",
"text": "Search for system tiddlers"
},
"$:/language/Search/System/Matches": {
"title": "$:/language/Search/System/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/SideBar/All/Caption": {
"title": "$:/language/SideBar/All/Caption",
"text": "All"
},
"$:/language/SideBar/Contents/Caption": {
"title": "$:/language/SideBar/Contents/Caption",
"text": "Contents"
},
"$:/language/SideBar/Drafts/Caption": {
"title": "$:/language/SideBar/Drafts/Caption",
"text": "Drafts"
},
"$:/language/SideBar/Missing/Caption": {
"title": "$:/language/SideBar/Missing/Caption",
"text": "Missing"
},
"$:/language/SideBar/More/Caption": {
"title": "$:/language/SideBar/More/Caption",
"text": "More"
},
"$:/language/SideBar/Open/Caption": {
"title": "$:/language/SideBar/Open/Caption",
"text": "Open"
},
"$:/language/SideBar/Orphans/Caption": {
"title": "$:/language/SideBar/Orphans/Caption",
"text": "Orphans"
},
"$:/language/SideBar/Recent/Caption": {
"title": "$:/language/SideBar/Recent/Caption",
"text": "Recent"
},
"$:/language/SideBar/Shadows/Caption": {
"title": "$:/language/SideBar/Shadows/Caption",
"text": "Shadows"
},
"$:/language/SideBar/System/Caption": {
"title": "$:/language/SideBar/System/Caption",
"text": "System"
},
"$:/language/SideBar/Tags/Caption": {
"title": "$:/language/SideBar/Tags/Caption",
"text": "Tags"
},
"$:/language/SideBar/Tags/Untagged/Caption": {
"title": "$:/language/SideBar/Tags/Untagged/Caption",
"text": "untagged"
},
"$:/language/SideBar/Tools/Caption": {
"title": "$:/language/SideBar/Tools/Caption",
"text": "Tools"
},
"$:/language/SideBar/Types/Caption": {
"title": "$:/language/SideBar/Types/Caption",
"text": "Types"
},
"$:/SiteSubtitle": {
"title": "$:/SiteSubtitle",
"text": "a non-linear personal web notebook"
},
"$:/SiteTitle": {
"title": "$:/SiteTitle",
"text": "My ~TiddlyWiki"
},
"$:/language/Snippets/ListByTag": {
"title": "$:/language/Snippets/ListByTag",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "List of tiddlers by tag",
"text": "<<list-links \"[tag[task]sort[title]]\">>\n"
},
"$:/language/Snippets/MacroDefinition": {
"title": "$:/language/Snippets/MacroDefinition",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Macro definition",
"text": "\\define macroName(param1:\"default value\",param2)\nText of the macro\n\\end\n"
},
"$:/language/Snippets/Table4x3": {
"title": "$:/language/Snippets/Table4x3",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Table with 4 columns by 3 rows",
"text": "|! |!Alpha |!Beta |!Gamma |!Delta |\n|!One | | | | |\n|!Two | | | | |\n|!Three | | | | |\n"
},
"$:/language/Snippets/TableOfContents": {
"title": "$:/language/Snippets/TableOfContents",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Table of Contents",
"text": "<div class=\"tc-table-of-contents\">\n\n<<toc-selective-expandable 'TableOfContents'>>\n\n</div>"
},
"$:/language/ThemeTweaks/ThemeTweaks": {
"title": "$:/language/ThemeTweaks/ThemeTweaks",
"text": "Theme Tweaks"
},
"$:/language/ThemeTweaks/ThemeTweaks/Hint": {
"title": "$:/language/ThemeTweaks/ThemeTweaks/Hint",
"text": "You can tweak certain aspects of the ''Vanilla'' theme."
},
"$:/language/ThemeTweaks/Options": {
"title": "$:/language/ThemeTweaks/Options",
"text": "Options"
},
"$:/language/ThemeTweaks/Options/SidebarLayout": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout",
"text": "Sidebar layout"
},
"$:/language/ThemeTweaks/Options/SidebarLayout/Fixed-Fluid": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout/Fixed-Fluid",
"text": "Fixed story, fluid sidebar"
},
"$:/language/ThemeTweaks/Options/SidebarLayout/Fluid-Fixed": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout/Fluid-Fixed",
"text": "Fluid story, fixed sidebar"
},
"$:/language/ThemeTweaks/Options/StickyTitles": {
"title": "$:/language/ThemeTweaks/Options/StickyTitles",
"text": "Sticky titles"
},
"$:/language/ThemeTweaks/Options/StickyTitles/Hint": {
"title": "$:/language/ThemeTweaks/Options/StickyTitles/Hint",
"text": "Causes tiddler titles to \"stick\" to the top of the browser window. Caution: Does not work at all with Chrome, and causes some layout issues in Firefox"
},
"$:/language/ThemeTweaks/Options/CodeWrapping": {
"title": "$:/language/ThemeTweaks/Options/CodeWrapping",
"text": "Wrap long lines in code blocks"
},
"$:/language/ThemeTweaks/Settings": {
"title": "$:/language/ThemeTweaks/Settings",
"text": "Settings"
},
"$:/language/ThemeTweaks/Settings/FontFamily": {
"title": "$:/language/ThemeTweaks/Settings/FontFamily",
"text": "Font family"
},
"$:/language/ThemeTweaks/Settings/CodeFontFamily": {
"title": "$:/language/ThemeTweaks/Settings/CodeFontFamily",
"text": "Code font family"
},
"$:/language/ThemeTweaks/Settings/BackgroundImage": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImage",
"text": "Page background image"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment",
"text": "Page background image attachment"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Scroll": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Scroll",
"text": "Scroll with tiddlers"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Fixed": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Fixed",
"text": "Fixed to window"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize",
"text": "Page background image size"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Auto": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Auto",
"text": "Auto"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Cover": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Cover",
"text": "Cover"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Contain": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Contain",
"text": "Contain"
},
"$:/language/ThemeTweaks/Metrics": {
"title": "$:/language/ThemeTweaks/Metrics",
"text": "Sizes"
},
"$:/language/ThemeTweaks/Metrics/FontSize": {
"title": "$:/language/ThemeTweaks/Metrics/FontSize",
"text": "Font size"
},
"$:/language/ThemeTweaks/Metrics/LineHeight": {
"title": "$:/language/ThemeTweaks/Metrics/LineHeight",
"text": "Line height"
},
"$:/language/ThemeTweaks/Metrics/BodyFontSize": {
"title": "$:/language/ThemeTweaks/Metrics/BodyFontSize",
"text": "Font size for tiddler body"
},
"$:/language/ThemeTweaks/Metrics/BodyLineHeight": {
"title": "$:/language/ThemeTweaks/Metrics/BodyLineHeight",
"text": "Line height for tiddler body"
},
"$:/language/ThemeTweaks/Metrics/StoryLeft": {
"title": "$:/language/ThemeTweaks/Metrics/StoryLeft",
"text": "Story left position"
},
"$:/language/ThemeTweaks/Metrics/StoryLeft/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryLeft/Hint",
"text": "how far the left margin of the story river<br>(tiddler area) is from the left of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryTop": {
"title": "$:/language/ThemeTweaks/Metrics/StoryTop",
"text": "Story top position"
},
"$:/language/ThemeTweaks/Metrics/StoryTop/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryTop/Hint",
"text": "how far the top margin of the story river<br>is from the top of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryRight": {
"title": "$:/language/ThemeTweaks/Metrics/StoryRight",
"text": "Story right"
},
"$:/language/ThemeTweaks/Metrics/StoryRight/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryRight/Hint",
"text": "how far the left margin of the sidebar <br>is from the left of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryWidth": {
"title": "$:/language/ThemeTweaks/Metrics/StoryWidth",
"text": "Story width"
},
"$:/language/ThemeTweaks/Metrics/StoryWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryWidth/Hint",
"text": "the overall width of the story river"
},
"$:/language/ThemeTweaks/Metrics/TiddlerWidth": {
"title": "$:/language/ThemeTweaks/Metrics/TiddlerWidth",
"text": "Tiddler width"
},
"$:/language/ThemeTweaks/Metrics/TiddlerWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/TiddlerWidth/Hint",
"text": "within the story river"
},
"$:/language/ThemeTweaks/Metrics/SidebarBreakpoint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarBreakpoint",
"text": "Sidebar breakpoint"
},
"$:/language/ThemeTweaks/Metrics/SidebarBreakpoint/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarBreakpoint/Hint",
"text": "the minimum page width at which the story<br>river and sidebar will appear side by side"
},
"$:/language/ThemeTweaks/Metrics/SidebarWidth": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarWidth",
"text": "Sidebar width"
},
"$:/language/ThemeTweaks/Metrics/SidebarWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarWidth/Hint",
"text": "the width of the sidebar in fluid-fixed layout"
},
"$:/language/TiddlerInfo/Advanced/Caption": {
"title": "$:/language/TiddlerInfo/Advanced/Caption",
"text": "Advanced"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Empty/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Empty/Hint",
"text": "none"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Heading": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Heading",
"text": "Plugin Details"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Hint",
"text": "This plugin contains the following shadow tiddlers:"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Heading": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Heading",
"text": "Shadow Status"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/NotShadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/NotShadow/Hint",
"text": "The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is not a shadow tiddler"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Hint",
"text": "The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is a shadow tiddler"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Source": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Source",
"text": "It is defined in the plugin <$link to=<<pluginTiddler>>><$text text=<<pluginTiddler>>/></$link>"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/OverriddenShadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/OverriddenShadow/Hint",
"text": "It is overridden by an ordinary tiddler"
},
"$:/language/TiddlerInfo/Fields/Caption": {
"title": "$:/language/TiddlerInfo/Fields/Caption",
"text": "Fields"
},
"$:/language/TiddlerInfo/List/Caption": {
"title": "$:/language/TiddlerInfo/List/Caption",
"text": "List"
},
"$:/language/TiddlerInfo/List/Empty": {
"title": "$:/language/TiddlerInfo/List/Empty",
"text": "This tiddler does not have a list"
},
"$:/language/TiddlerInfo/Listed/Caption": {
"title": "$:/language/TiddlerInfo/Listed/Caption",
"text": "Listed"
},
"$:/language/TiddlerInfo/Listed/Empty": {
"title": "$:/language/TiddlerInfo/Listed/Empty",
"text": "This tiddler is not listed by any others"
},
"$:/language/TiddlerInfo/References/Caption": {
"title": "$:/language/TiddlerInfo/References/Caption",
"text": "References"
},
"$:/language/TiddlerInfo/References/Empty": {
"title": "$:/language/TiddlerInfo/References/Empty",
"text": "No tiddlers link to this one"
},
"$:/language/TiddlerInfo/Tagging/Caption": {
"title": "$:/language/TiddlerInfo/Tagging/Caption",
"text": "Tagging"
},
"$:/language/TiddlerInfo/Tagging/Empty": {
"title": "$:/language/TiddlerInfo/Tagging/Empty",
"text": "No tiddlers are tagged with this one"
},
"$:/language/TiddlerInfo/Tools/Caption": {
"title": "$:/language/TiddlerInfo/Tools/Caption",
"text": "Tools"
},
"$:/language/Docs/Types/application/javascript": {
"title": "$:/language/Docs/Types/application/javascript",
"description": "JavaScript code",
"name": "application/javascript",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/application/json": {
"title": "$:/language/Docs/Types/application/json",
"description": "JSON data",
"name": "application/json",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/application/x-tiddler-dictionary": {
"title": "$:/language/Docs/Types/application/x-tiddler-dictionary",
"description": "Data dictionary",
"name": "application/x-tiddler-dictionary",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/image/gif": {
"title": "$:/language/Docs/Types/image/gif",
"description": "GIF image",
"name": "image/gif",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/jpeg": {
"title": "$:/language/Docs/Types/image/jpeg",
"description": "JPEG image",
"name": "image/jpeg",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/png": {
"title": "$:/language/Docs/Types/image/png",
"description": "PNG image",
"name": "image/png",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/svg+xml": {
"title": "$:/language/Docs/Types/image/svg+xml",
"description": "Structured Vector Graphics image",
"name": "image/svg+xml",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/x-icon": {
"title": "$:/language/Docs/Types/image/x-icon",
"description": "ICO format icon file",
"name": "image/x-icon",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/text/css": {
"title": "$:/language/Docs/Types/text/css",
"description": "Static stylesheet",
"name": "text/css",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/text/html": {
"title": "$:/language/Docs/Types/text/html",
"description": "HTML markup",
"name": "text/html",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/plain": {
"title": "$:/language/Docs/Types/text/plain",
"description": "Plain text",
"name": "text/plain",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/vnd.tiddlywiki": {
"title": "$:/language/Docs/Types/text/vnd.tiddlywiki",
"description": "TiddlyWiki 5",
"name": "text/vnd.tiddlywiki",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/x-tiddlywiki": {
"title": "$:/language/Docs/Types/text/x-tiddlywiki",
"description": "TiddlyWiki Classic",
"name": "text/x-tiddlywiki",
"group": "Text",
"group-sort": "0"
},
"$:/languages/en-GB/icon": {
"title": "$:/languages/en-GB/icon",
"type": "image/svg+xml",
"text": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 30\" width=\"1200\" height=\"600\">\n<clipPath id=\"t\">\n\t<path d=\"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z\"/>\n</clipPath>\n<path d=\"M0,0 v30 h60 v-30 z\" fill=\"#00247d\"/>\n<path d=\"M0,0 L60,30 M60,0 L0,30\" stroke=\"#fff\" stroke-width=\"6\"/>\n<path d=\"M0,0 L60,30 M60,0 L0,30\" clip-path=\"url(#t)\" stroke=\"#cf142b\" stroke-width=\"4\"/>\n<path d=\"M30,0 v30 M0,15 h60\" stroke=\"#fff\" stroke-width=\"10\"/>\n<path d=\"M30,0 v30 M0,15 h60\" stroke=\"#cf142b\" stroke-width=\"6\"/>\n</svg>\n"
},
"$:/languages/en-GB": {
"title": "$:/languages/en-GB",
"name": "en-GB",
"description": "English (British)",
"author": "JeremyRuston",
"core-version": ">=5.0.0\"",
"text": "Stub pseudo-plugin for the default language"
},
"$:/core/modules/commander.js": {
"text": "/*\\\ntitle: $:/core/modules/commander.js\ntype: application/javascript\nmodule-type: global\n\nThe $tw.Commander class is a command interpreter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParse a sequence of commands\n\tcommandTokens: an array of command string tokens\n\twiki: reference to the wiki store object\n\tstreams: {output:, error:}, each of which has a write(string) method\n\tcallback: a callback invoked as callback(err) where err is null if there was no error\n*/\nvar Commander = function(commandTokens,callback,wiki,streams) {\n\tvar path = require(\"path\");\n\tthis.commandTokens = commandTokens;\n\tthis.nextToken = 0;\n\tthis.callback = callback;\n\tthis.wiki = wiki;\n\tthis.streams = streams;\n\tthis.outputPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiOutputSubDir);\n};\n\n/*\nLog a string if verbose flag is set\n*/\nCommander.prototype.log = function(str) {\n\tif(this.verbose) {\n\t\tthis.streams.output.write(str + \"\\n\");\n\t}\n};\n\n/*\nWrite a string if verbose flag is set\n*/\nCommander.prototype.write = function(str) {\n\tif(this.verbose) {\n\t\tthis.streams.output.write(str);\n\t}\n};\n\n/*\nAdd a string of tokens to the command queue\n*/\nCommander.prototype.addCommandTokens = function(commandTokens) {\n\tvar params = commandTokens.slice(0);\n\tparams.unshift(0);\n\tparams.unshift(this.nextToken);\n\tArray.prototype.splice.apply(this.commandTokens,params);\n};\n\n/*\nExecute the sequence of commands and invoke a callback on completion\n*/\nCommander.prototype.execute = function() {\n\tthis.executeNextCommand();\n};\n\n/*\nExecute the next command in the sequence\n*/\nCommander.prototype.executeNextCommand = function() {\n\tvar self = this;\n\t// Invoke the callback if there are no more commands\n\tif(this.nextToken >= this.commandTokens.length) {\n\t\tthis.callback(null);\n\t} else {\n\t\t// Get and check the command token\n\t\tvar commandName = this.commandTokens[this.nextToken++];\n\t\tif(commandName.substr(0,2) !== \"--\") {\n\t\t\tthis.callback(\"Missing command: \" + commandName);\n\t\t} else {\n\t\t\tcommandName = commandName.substr(2); // Trim off the --\n\t\t\t// Accumulate the parameters to the command\n\t\t\tvar params = [];\n\t\t\twhile(this.nextToken < this.commandTokens.length && \n\t\t\t\tthis.commandTokens[this.nextToken].substr(0,2) !== \"--\") {\n\t\t\t\tparams.push(this.commandTokens[this.nextToken++]);\n\t\t\t}\n\t\t\t// Get the command info\n\t\t\tvar command = $tw.commands[commandName],\n\t\t\t\tc,err;\n\t\t\tif(!command) {\n\t\t\t\tthis.callback(\"Unknown command: \" + commandName);\n\t\t\t} else {\n\t\t\t\tif(this.verbose) {\n\t\t\t\t\tthis.streams.output.write(\"Executing command: \" + commandName + \" \" + params.join(\" \") + \"\\n\");\n\t\t\t\t}\n\t\t\t\tif(command.info.synchronous) {\n\t\t\t\t\t// Synchronous command\n\t\t\t\t\tc = new command.Command(params,this);\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.executeNextCommand();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Asynchronous command\n\t\t\t\t\tc = new command.Command(params,this,function(err) {\n\t\t\t\t\t\tif(err) {\n\t\t\t\t\t\t\tself.callback(err);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself.executeNextCommand();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nCommander.initCommands = function(moduleType) {\n\tmoduleType = moduleType || \"command\";\n\t$tw.commands = {};\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tvar c = $tw.commands[module.info.name] = {};\n\t\t// Add the methods defined by the module\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\tc[f] = module[f];\n\t\t\t}\n\t\t}\n\t});\n};\n\nexports.Commander = Commander;\n\n})();\n",
"title": "$:/core/modules/commander.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/commands/build.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/build.js\ntype: application/javascript\nmodule-type: command\n\nCommand to build a build target\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"build\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\t// Get the build targets defined in the wiki\n\tvar buildTargets = $tw.boot.wikiInfo.build;\n\tif(!buildTargets) {\n\t\treturn \"No build targets defined\";\n\t}\n\t// Loop through each of the specified targets\n\tvar targets;\n\tif(this.params.length > 0) {\n\t\ttargets = this.params;\n\t} else {\n\t\ttargets = Object.keys(buildTargets);\n\t}\n\tfor(var targetIndex=0; targetIndex<targets.length; targetIndex++) {\n\t\tvar target = targets[targetIndex],\n\t\t\tcommands = buildTargets[target];\n\t\tif(!commands) {\n\t\t\treturn \"Build target '\" + target + \"' not found\";\n\t\t}\n\t\t// Add the commands to the queue\n\t\tthis.commander.addCommandTokens(commands);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/build.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/clearpassword.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/clearpassword.js\ntype: application/javascript\nmodule-type: command\n\nClear password for crypto operations\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"clearpassword\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\t$tw.crypto.setPassword(null);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/clearpassword.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/editions.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/editions.js\ntype: application/javascript\nmodule-type: command\n\nCommand to list the available editions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"editions\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this;\n\t// Output the list\n\tthis.commander.streams.output.write(\"Available editions:\\n\\n\");\n\tvar editionInfo = $tw.utils.getEditionInfo();\n\t$tw.utils.each(editionInfo,function(info,name) {\n\t\tself.commander.streams.output.write(\" \" + name + \": \" + info.description + \"\\n\");\n\t});\n\tthis.commander.streams.output.write(\"\\n\");\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/editions.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/fetch.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/fetch.js\ntype: application/javascript\nmodule-type: command\n\nCommands to fetch external tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"fetch\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing subcommand and url\";\n\t}\n\tvar subcommand = this.params[0],\n\t\turl = this.params[1],\n\t\timportFilter = this.params[2] || \"[all[tiddlers]]\",\n\t\ttransformFilter = this.params[3] || \"\";\n\tswitch(subcommand) {\n\t\tcase \"file\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\turl: url,\n\t\t\t\timportFilter: importFilter,\n\t\t\t\ttransformFilter: transformFilter,\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"files\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\turlFilter: url,\n\t\t\t\timportFilter: importFilter,\n\t\t\t\ttransformFilter: transformFilter,\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t}\n\treturn null;\n};\n\nCommand.prototype.fetchFiles = function(options) {\n\tvar self = this;\n\t// Get the list of URLs\n\tvar urls;\n\tif(options.url) {\n\t\turls = [options.url]\n\t} else if(options.urlFilter) {\n\t\turls = $tw.wiki.filterTiddlers(options.urlFilter);\n\t} else {\n\t\treturn \"Missing URL\";\n\t}\n\t// Process each URL in turn\n\tvar next = 0;\n\tvar getNextFile = function(err) {\n\t\tif(err) {\n\t\t\treturn options.callback(err);\n\t\t}\n\t\tif(next < urls.length) {\n\t\t\tself.fetchFile(urls[next++],options,getNextFile);\n\t\t} else {\n\t\t\toptions.callback(null);\n\t\t}\n\t};\n\tgetNextFile(null);\n\t// Success\n\treturn null;\n};\n\nCommand.prototype.fetchFile = function(url,options,callback) {\n\tvar self = this,\n\t\tlib = url.substr(0,8) === \"https://\" ? require(\"https\") : require(\"http\");\n\tlib.get(url).on(\"response\",function(response) {\n\t var type = (response.headers[\"content-type\"] || \"\").split(\";\")[0],\n\t \tbody = \"\";\n\t self.commander.write(\"Reading \" + url + \": \");\n\t response.on(\"data\",function(chunk) {\n\t body += chunk;\n\t self.commander.write(\".\");\n\t });\n\t response.on(\"end\",function() {\n\t self.commander.write(\"\\n\");\n\t if(response.statusCode === 200) {\n\t\t self.processBody(body,type,options);\n\t\t callback(null);\n\t } else {\n\t \tcallback(\"Error \" + response.statusCode + \" retrieving \" + url)\n\t }\n\t \t});\n\t \tresponse.on(\"error\",function(e) {\n\t\t\tconsole.log(\"Error on GET request: \" + e);\n\t\t\tcallback(e);\n\t \t});\n\t});\n\treturn null;\n};\n\nCommand.prototype.processBody = function(body,type,options) {\n\t// Deserialise the HTML file and put the tiddlers in their own wiki\n\tvar self = this,\n\t\tincomingWiki = new $tw.Wiki(),\n\t\ttiddlers = this.commander.wiki.deserializeTiddlers(type || \"text/html\",body,{});\n\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\tincomingWiki.addTiddler(new $tw.Tiddler(tiddler));\n\t});\n\t// Filter the tiddlers to select the ones we want\n\tvar filteredTitles = incomingWiki.filterTiddlers(options.importFilter);\n\t// Import the selected tiddlers\n\tvar count = 0;\n\tincomingWiki.each(function(tiddler,title) {\n\t\tif(filteredTitles.indexOf(title) !== -1) {\n\t\t\tvar newTiddler;\n\t\t\tif(options.transformFilter) {\n\t\t\t\tvar transformedTitle = (incomingWiki.filterTiddlers(options.transformFilter,null,self.commander.wiki.makeTiddlerIterator([title])) || [\"\"])[0];\n\t\t\t\tif(transformedTitle) {\n\t\t\t\t\tself.commander.log(\"Importing \" + title + \" as \" + transformedTitle)\n\t\t\t\t\tnewTiddler = new $tw.Tiddler(tiddler,{title: transformedTitle});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tself.commander.log(\"Importing \" + title)\n\t\t\t\tnewTiddler = tiddler;\n\t\t\t}\n\t\t\tself.commander.wiki.importTiddler(newTiddler);\n\t\t\tcount++;\n\t\t}\n\t});\n\tself.commander.log(\"Imported \" + count + \" tiddlers\")\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/fetch.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/help.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/help.js\ntype: application/javascript\nmodule-type: command\n\nHelp command\n\n\\*/\n(function(){\n\n/*jshint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"help\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar subhelp = this.params[0] || \"default\",\n\t\thelpBase = \"$:/language/Help/\",\n\t\ttext;\n\tif(!this.commander.wiki.getTiddler(helpBase + subhelp)) {\n\t\tsubhelp = \"notfound\";\n\t}\n\t// Wikify the help as formatted text (ie block elements generate newlines)\n\ttext = this.commander.wiki.renderTiddler(\"text/plain-formatted\",helpBase + subhelp);\n\t// Remove any leading linebreaks\n\ttext = text.replace(/^(\\r?\\n)*/g,\"\");\n\tthis.commander.streams.output.write(text);\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/help.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/init.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/init.js\ntype: application/javascript\nmodule-type: command\n\nCommand to initialise an empty wiki folder\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"init\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar fs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\t// Check that we don't already have a valid wiki folder\n\tif($tw.boot.wikiTiddlersPath || ($tw.utils.isDirectory($tw.boot.wikiPath) && !$tw.utils.isDirectoryEmpty($tw.boot.wikiPath))) {\n\t\treturn \"Wiki folder is not empty\";\n\t}\n\t// Loop through each of the specified editions\n\tvar editions = this.params.length > 0 ? this.params : [\"empty\"];\n\tfor(var editionIndex=0; editionIndex<editions.length; editionIndex++) {\n\t\tvar editionName = editions[editionIndex];\n\t\t// Check the edition exists\n\t\tvar editionPath = $tw.findLibraryItem(editionName,$tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar));\n\t\tif(!$tw.utils.isDirectory(editionPath)) {\n\t\t\treturn \"Edition '\" + editionName + \"' not found\";\n\t\t}\n\t\t// Copy the edition content\n\t\tvar err = $tw.utils.copyDirectory(editionPath,$tw.boot.wikiPath);\n\t\tif(!err) {\n\t\t\tthis.commander.streams.output.write(\"Copied edition '\" + editionName + \"' to \" + $tw.boot.wikiPath + \"\\n\");\n\t\t} else {\n\t\t\treturn err;\n\t\t}\n\t}\n\t// Tweak the tiddlywiki.info to remove any included wikis\n\tvar packagePath = $tw.boot.wikiPath + \"/tiddlywiki.info\",\n\t\tpackageJson = JSON.parse(fs.readFileSync(packagePath));\n\tdelete packageJson.includeWikis;\n\tfs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/init.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/load.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/load.js\ntype: application/javascript\nmodule-type: command\n\nCommand to load tiddlers from a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"load\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar ext = path.extname(self.params[0]),\n\t\tstat = fs.statSync(self.params[0]),\n\t\ttiddlers = $tw.loadTiddlersFromPath(self.params[0]),\n\t\tcount = 0;\n\t$tw.utils.each(tiddlers,function(tiddlerInfo) {\n\t\t$tw.utils.each(tiddlerInfo.tiddlers,function(tiddler) {\n\t\t\tself.commander.wiki.importTiddler(new $tw.Tiddler(tiddler));\n\t\t\tcount++;\n\t\t});\n\t});\n\tif(!count) {\n\t\tself.callback(\"No tiddlers found in file \\\"\" + self.params[0] + \"\\\"\");\n\t} else {\n\t\tself.callback(null);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/load.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/makelibrary.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/makelibrary.js\ntype: application/javascript\nmodule-type: command\n\nCommand to pack all of the plugins in the library into a plugin tiddler of type \"library\"\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"makelibrary\",\n\tsynchronous: true\n};\n\nvar UPGRADE_LIBRARY_TITLE = \"$:/UpgradeLibrary\";\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar wiki = this.commander.wiki,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\tupgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,\n\t\ttiddlers = {};\n\t// Collect up the library plugins\n\tvar collectPlugins = function(folder) {\n\t\t\tvar pluginFolders = fs.readdirSync(folder);\n\t\t\tfor(var p=0; p<pluginFolders.length; p++) {\n\t\t\t\tif(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {\n\t\t\t\t\tpluginFields = $tw.loadPluginFolder(path.resolve(folder,\"./\" + pluginFolders[p]));\n\t\t\t\t\tif(pluginFields && pluginFields.title) {\n\t\t\t\t\t\ttiddlers[pluginFields.title] = pluginFields;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tcollectPublisherPlugins = function(folder) {\n\t\t\tvar publisherFolders = fs.readdirSync(folder);\n\t\t\tfor(var t=0; t<publisherFolders.length; t++) {\n\t\t\t\tif(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {\n\t\t\t\t\tcollectPlugins(path.resolve(folder,\"./\" + publisherFolders[t]));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\tcollectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.pluginsPath));\n\tcollectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.themesPath));\n\tcollectPlugins(path.resolve($tw.boot.corePath,$tw.config.languagesPath));\n\t// Save the upgrade library tiddler\n\tvar pluginFields = {\n\t\ttitle: upgradeLibraryTitle,\n\t\ttype: \"application/json\",\n\t\t\"plugin-type\": \"library\",\n\t\t\"text\": JSON.stringify({tiddlers: tiddlers},null,$tw.config.preferences.jsonSpaces)\n\t};\n\twiki.addTiddler(new $tw.Tiddler(pluginFields));\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/makelibrary.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/output.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/output.js\ntype: application/javascript\nmodule-type: command\n\nCommand to set the default output location (defaults to current working directory)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"output\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar fs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 1) {\n\t\treturn \"Missing output path\";\n\t}\n\tthis.commander.outputPath = path.resolve(process.cwd(),this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/output.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/password.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/password.js\ntype: application/javascript\nmodule-type: command\n\nSave password for crypto operations\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"password\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing password\";\n\t}\n\t$tw.crypto.setPassword(this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/password.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/rendertiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render a tiddler and save it to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"rendertiddler\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\ttitle = this.params[0],\n\t\tfilename = path.resolve(this.commander.outputPath,this.params[1]),\n\t\ttype = this.params[2] || \"text/html\",\n\t\ttemplate = this.params[3],\n\t\tname = this.params[4],\n\t\tvalue = this.params[5],\n\t\tvariables = {};\n\t$tw.utils.createFileDirectories(filename);\n\tif(template) {\n\t\tvariables.currentTiddler = title;\n\t\ttitle = template;\n\t}\n\tif(name && value) {\n\t\tvariables[name] = value;\n\t}\n\tfs.writeFile(filename,this.commander.wiki.renderTiddler(type,title,{variables: variables}),\"utf8\",function(err) {\n\t\tself.callback(err);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/rendertiddler.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/rendertiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render several tiddlers to a folder of files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"rendertiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\ttemplate = this.params[1],\n\t\toutputPath = this.commander.outputPath,\n\t\tpathname = path.resolve(outputPath,this.params[2]),\t\t\n\t\ttype = this.params[3] || \"text/html\",\n\t\textension = this.params[4] || \".html\",\n\t\tdeleteDirectory = (this.params[5] || \"\").toLowerCase() !== \"noclean\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\tif(deleteDirectory) {\n\t\t$tw.utils.deleteDirectory(pathname);\n\t}\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(template),\n\t\t\twidgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}),\n\t\t\tcontainer = $tw.fakeDocument.createElement(\"div\");\n\t\twidgetNode.render(container,null);\n\t\tvar text = type === \"text/html\" ? container.innerHTML : container.textContent,\n\t\t\texportPath = null;\n\t\tif($tw.utils.hop($tw.macros,\"tv-get-export-path\")) {\n\t\t\tvar macroPath = $tw.macros[\"tv-get-export-path\"].run.apply(self,[title]);\n\t\t\tif(macroPath) {\n\t\t\t\texportPath = path.resolve(outputPath,macroPath + extension);\n\t\t\t}\n\t\t}\n\t\tvar finalPath = exportPath || path.resolve(pathname,encodeURIComponent(title) + extension);\n\t\t$tw.utils.createFileDirectories(finalPath);\n\t\tfs.writeFileSync(finalPath,text,\"utf8\");\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/rendertiddlers.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savelibrarytiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/savelibrarytiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save the subtiddlers of a bundle tiddler as a series of JSON files\n\n--savelibrarytiddlers <tiddler> <pathname> <skinnylisting>\n\nThe tiddler identifies the bundle tiddler that contains the subtiddlers.\n\nThe pathname specifies the pathname to the folder in which the JSON files should be saved. The filename is the URL encoded title of the subtiddler.\n\nThe skinnylisting specifies the title of the tiddler to which a JSON catalogue of the subtiddlers will be saved. The JSON file contains the same data as the bundle tiddler but with the `text` field removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savelibrarytiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\tcontainerTitle = this.params[0],\n\t\tfilter = this.params[1],\n\t\tbasepath = this.params[2],\n\t\tskinnyListTitle = this.params[3];\n\t// Get the container tiddler as data\n\tvar containerData = self.commander.wiki.getTiddlerDataCached(containerTitle,undefined);\n\tif(!containerData) {\n\t\treturn \"'\" + containerTitle + \"' is not a tiddler bundle\";\n\t}\n\t// Filter the list of plugins\n\tvar pluginList = [];\n\t$tw.utils.each(containerData.tiddlers,function(tiddler,title) {\n\t\tpluginList.push(title);\n\t});\n\tvar filteredPluginList;\n\tif(filter) {\n\t\tfilteredPluginList = self.commander.wiki.filterTiddlers(filter,null,self.commander.wiki.makeTiddlerIterator(pluginList));\n\t} else {\n\t\tfilteredPluginList = pluginList;\n\t}\n\t// Iterate through the plugins\n\tvar skinnyList = [];\n\t$tw.utils.each(filteredPluginList,function(title) {\n\t\tvar tiddler = containerData.tiddlers[title];\n\t\t// Save each JSON file and collect the skinny data\n\t\tvar pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + \".json\");\n\t\t$tw.utils.createFileDirectories(pathname);\n\t\tfs.writeFileSync(pathname,JSON.stringify(tiddler,null,$tw.config.preferences.jsonSpaces),\"utf8\");\n\t\t// Collect the skinny list data\n\t\tvar pluginTiddlers = JSON.parse(tiddler.text),\n\t\t\treadmeContent = (pluginTiddlers.tiddlers[title + \"/readme\"] || {}).text,\n\t\t\ticonTiddler = pluginTiddlers.tiddlers[title + \"/icon\"] || {},\n\t\t\ticonType = iconTiddler.type,\n\t\t\ticonText = iconTiddler.text,\n\t\t\ticonContent;\n\t\tif(iconType && iconText) {\n\t\t\ticonContent = $tw.utils.makeDataUri(iconText,iconType);\n\t\t}\n\t\tskinnyList.push($tw.utils.extend({},tiddler,{text: undefined, readme: readmeContent, icon: iconContent}));\n\t});\n\t// Save the catalogue tiddler\n\tif(skinnyListTitle) {\n\t\tself.commander.wiki.setTiddlerData(skinnyListTitle,skinnyList);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/savelibrarytiddlers.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save the content of a tiddler to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savetiddler\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\ttitle = this.params[0],\n\t\tfilename = path.resolve(this.commander.outputPath,this.params[1]),\n\t\ttiddler = this.commander.wiki.getTiddler(title);\n\tif(tiddler) {\n\t\tvar type = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"};\n\t\t$tw.utils.createFileDirectories(filename);\n\t\tfs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {\n\t\t\tself.callback(err);\n\t\t});\n\t} else {\n\t\treturn \"Missing tiddler: \" + title;\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/savetiddler.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save several tiddlers to a folder of files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"savetiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\tpathname = path.resolve(this.commander.outputPath,this.params[1]),\n\t\tdeleteDirectory = (this.params[2] || \"\").toLowerCase() !== \"noclean\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\tif(deleteDirectory) {\n\t\t$tw.utils.deleteDirectory(pathname);\n\t}\n\t$tw.utils.createDirectory(pathname);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.commander.wiki.getTiddler(title),\n\t\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"},\n\t\t\tfilename = path.resolve(pathname,encodeURIComponent(title));\n\t\tfs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/savetiddlers.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/server.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/server.js\ntype: application/javascript\nmodule-type: command\n\nServe tiddlers over http\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nif($tw.node) {\n\tvar util = require(\"util\"),\n\t\tfs = require(\"fs\"),\n\t\turl = require(\"url\"),\n\t\tpath = require(\"path\"),\n\t\thttp = require(\"http\");\n}\n\nexports.info = {\n\tname: \"server\",\n\tsynchronous: true\n};\n\n/*\nA simple HTTP server with regexp-based routes\n*/\nfunction SimpleServer(options) {\n\tthis.routes = options.routes || [];\n\tthis.wiki = options.wiki;\n\tthis.variables = options.variables || {};\n}\n\nSimpleServer.prototype.set = function(obj) {\n\tvar self = this;\n\t$tw.utils.each(obj,function(value,name) {\n\t\tself.variables[name] = value;\n\t});\n};\n\nSimpleServer.prototype.get = function(name) {\n\treturn this.variables[name];\n};\n\nSimpleServer.prototype.addRoute = function(route) {\n\tthis.routes.push(route);\n};\n\nSimpleServer.prototype.findMatchingRoute = function(request,state) {\n\tvar pathprefix = this.get(\"pathprefix\") || \"\";\n\tfor(var t=0; t<this.routes.length; t++) {\n\t\tvar potentialRoute = this.routes[t],\n\t\t\tpathRegExp = potentialRoute.path,\n\t\t\tpathname = state.urlInfo.pathname,\n\t\t\tmatch;\n\t\tif(pathprefix) {\n\t\t\tif(pathname.substr(0,pathprefix.length) === pathprefix) {\n\t\t\t\tpathname = pathname.substr(pathprefix.length);\n\t\t\t\tmatch = potentialRoute.path.exec(pathname);\n\t\t\t} else {\n\t\t\t\tmatch = false;\n\t\t\t}\n\t\t} else {\n\t\t\tmatch = potentialRoute.path.exec(pathname);\n\t\t}\n\t\tif(match && request.method === potentialRoute.method) {\n\t\t\tstate.params = [];\n\t\t\tfor(var p=1; p<match.length; p++) {\n\t\t\t\tstate.params.push(match[p]);\n\t\t\t}\n\t\t\treturn potentialRoute;\n\t\t}\n\t}\n\treturn null;\n};\n\nSimpleServer.prototype.checkCredentials = function(request,incomingUsername,incomingPassword) {\n\tvar header = request.headers.authorization || \"\",\n\t\ttoken = header.split(/\\s+/).pop() || \"\",\n\t\tauth = $tw.utils.base64Decode(token),\n\t\tparts = auth.split(/:/),\n\t\tusername = parts[0],\n\t\tpassword = parts[1];\n\tif(incomingUsername === username && incomingPassword === password) {\n\t\treturn \"ALLOWED\";\n\t} else {\n\t\treturn \"DENIED\";\n\t}\n};\n\nSimpleServer.prototype.requestHandler = function(request,response) {\n\t// Compose the state object\n\tvar self = this;\n\tvar state = {};\n\tstate.wiki = self.wiki;\n\tstate.server = self;\n\tstate.urlInfo = url.parse(request.url);\n\t// Find the route that matches this path\n\tvar route = self.findMatchingRoute(request,state);\n\t// Check for the username and password if we've got one\n\tvar username = self.get(\"username\"),\n\t\tpassword = self.get(\"password\");\n\tif(username && password) {\n\t\t// Check they match\n\t\tif(self.checkCredentials(request,username,password) !== \"ALLOWED\") {\n\t\t\tvar servername = state.wiki.getTiddlerText(\"$:/SiteTitle\") || \"TiddlyWiki5\";\n\t\t\tresponse.writeHead(401,\"Authentication required\",{\n\t\t\t\t\"WWW-Authenticate\": 'Basic realm=\"Please provide your username and password to login to ' + servername + '\"'\n\t\t\t});\n\t\t\tresponse.end();\n\t\t\treturn;\n\t\t}\n\t}\n\t// Return a 404 if we didn't find a route\n\tif(!route) {\n\t\tresponse.writeHead(404);\n\t\tresponse.end();\n\t\treturn;\n\t}\n\t// Set the encoding for the incoming request\n\t// TODO: Presumably this would need tweaking if we supported PUTting binary tiddlers\n\trequest.setEncoding(\"utf8\");\n\t// Dispatch the appropriate method\n\tswitch(request.method) {\n\t\tcase \"GET\": // Intentional fall-through\n\t\tcase \"DELETE\":\n\t\t\troute.handler(request,response,state);\n\t\t\tbreak;\n\t\tcase \"PUT\":\n\t\t\tvar data = \"\";\n\t\t\trequest.on(\"data\",function(chunk) {\n\t\t\t\tdata += chunk.toString();\n\t\t\t});\n\t\t\trequest.on(\"end\",function() {\n\t\t\t\tstate.data = data;\n\t\t\t\troute.handler(request,response,state);\n\t\t\t});\n\t\t\tbreak;\n\t}\n};\n\t\nSimpleServer.prototype.listen = function(port,host) {\n\thttp.createServer(this.requestHandler.bind(this)).listen(port,host);\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n\t// Set up server\n\tthis.server = new SimpleServer({\n\t\twiki: this.commander.wiki\n\t});\n\t// Add route handlers\n\tthis.server.addRoute({\n\t\tmethod: \"PUT\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]),\n\t\t\t\tfields = JSON.parse(state.data);\n\t\t\t// Pull up any subfields in the `fields` object\n\t\t\tif(fields.fields) {\n\t\t\t\t$tw.utils.each(fields.fields,function(field,name) {\n\t\t\t\t\tfields[name] = field;\n\t\t\t\t});\n\t\t\t\tdelete fields.fields;\n\t\t\t}\n\t\t\t// Remove any revision field\n\t\t\tif(fields.revision) {\n\t\t\t\tdelete fields.revision;\n\t\t\t}\n\t\t\tstate.wiki.addTiddler(new $tw.Tiddler(state.wiki.getCreationFields(),fields,{title: title},state.wiki.getModificationFields()));\n\t\t\tvar changeCount = state.wiki.getChangeCount(title).toString();\n\t\t\tresponse.writeHead(204, \"OK\",{\n\t\t\t\tEtag: \"\\\"default/\" + encodeURIComponent(title) + \"/\" + changeCount + \":\\\"\",\n\t\t\t\t\"Content-Type\": \"text/plain\"\n\t\t\t});\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"DELETE\",\n\t\tpath: /^\\/bags\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]);\n\t\t\tstate.wiki.deleteTiddler(title);\n\t\t\tresponse.writeHead(204, \"OK\", {\n\t\t\t\t\"Content-Type\": \"text/plain\"\n\t\t\t});\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": state.server.get(\"serveType\")});\n\t\t\tvar text = state.wiki.renderTiddler(state.server.get(\"renderType\"),state.server.get(\"rootTiddler\"));\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/status$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\tvar text = JSON.stringify({\n\t\t\t\tusername: state.server.get(\"username\"),\n\t\t\t\tspace: {\n\t\t\t\t\trecipe: \"default\"\n\t\t\t\t},\n\t\t\t\ttiddlywiki_version: $tw.version\n\t\t\t});\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/favicon.ico$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"image/x-icon\"});\n\t\t\tvar buffer = state.wiki.getTiddlerText(\"$:/favicon.ico\",\"\");\n\t\t\tresponse.end(buffer,\"base64\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers.json$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\tvar tiddlers = [];\n\t\t\tstate.wiki.forEachTiddler({sortField: \"title\"},function(title,tiddler) {\n\t\t\t\tvar tiddlerFields = {};\n\t\t\t\t$tw.utils.each(tiddler.fields,function(field,name) {\n\t\t\t\t\tif(name !== \"text\") {\n\t\t\t\t\t\ttiddlerFields[name] = tiddler.getFieldString(name);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttiddlerFields.revision = state.wiki.getChangeCount(title);\n\t\t\t\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\n\t\t\t\ttiddlers.push(tiddlerFields);\n\t\t\t});\n\t\t\tvar text = JSON.stringify(tiddlers);\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]),\n\t\t\t\ttiddler = state.wiki.getTiddler(title),\n\t\t\t\ttiddlerFields = {},\n\t\t\t\tknownFields = [\n\t\t\t\t\t\"bag\", \"created\", \"creator\", \"modified\", \"modifier\", \"permissions\", \"recipe\", \"revision\", \"tags\", \"text\", \"title\", \"type\", \"uri\"\n\t\t\t\t];\n\t\t\tif(tiddler) {\n\t\t\t\t$tw.utils.each(tiddler.fields,function(field,name) {\n\t\t\t\t\tvar value = tiddler.getFieldString(name);\n\t\t\t\t\tif(knownFields.indexOf(name) !== -1) {\n\t\t\t\t\t\ttiddlerFields[name] = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttiddlerFields.fields = tiddlerFields.fields || {};\n\t\t\t\t\t\ttiddlerFields.fields[name] = value;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttiddlerFields.revision = state.wiki.getChangeCount(title);\n\t\t\t\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\n\t\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\t\tresponse.end(JSON.stringify(tiddlerFields),\"utf8\");\n\t\t\t} else {\n\t\t\t\tresponse.writeHead(404);\n\t\t\t\tresponse.end();\n\t\t\t}\n\t\t}\n\t});\n};\n\nCommand.prototype.execute = function() {\n\tif(!$tw.boot.wikiTiddlersPath) {\n\t\t$tw.utils.warning(\"Warning: Wiki folder '\" + $tw.boot.wikiPath + \"' does not exist or is missing a tiddlywiki.info file\");\n\t}\n\tvar port = this.params[0] || \"8080\",\n\t\trootTiddler = this.params[1] || \"$:/core/save/all\",\n\t\trenderType = this.params[2] || \"text/plain\",\n\t\tserveType = this.params[3] || \"text/html\",\n\t\tusername = this.params[4],\n\t\tpassword = this.params[5],\n\t\thost = this.params[6] || \"127.0.0.1\",\n\t\tpathprefix = this.params[7];\n\tthis.server.set({\n\t\trootTiddler: rootTiddler,\n\t\trenderType: renderType,\n\t\tserveType: serveType,\n\t\tusername: username,\n\t\tpassword: password,\n\t\tpathprefix: pathprefix\n\t});\n\tthis.server.listen(port,host);\n\tconsole.log(\"Serving on \" + host + \":\" + port);\n\tconsole.log(\"(press ctrl-C to exit)\");\n\t// Warn if required plugins are missing\n\tif(!$tw.wiki.getTiddler(\"$:/plugins/tiddlywiki/tiddlyweb\") || !$tw.wiki.getTiddler(\"$:/plugins/tiddlywiki/filesystem\")) {\n\t\t$tw.utils.warning(\"Warning: Plugins required for client-server operation (\\\"tiddlywiki/filesystem\\\" and \\\"tiddlywiki/tiddlyweb\\\") are missing from tiddlywiki.info file\");\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/server.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/setfield.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/setfield.js\ntype: application/javascript\nmodule-type: command\n\nCommand to modify selected tiddlers to set a field to the text of a template tiddler that has been wikified with the selected tiddler as the current tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"setfield\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 4) {\n\t\treturn \"Missing parameters\";\n\t}\n\tvar self = this,\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\tfieldname = this.params[1] || \"text\",\n\t\ttemplatetitle = this.params[2],\n\t\trendertype = this.params[3] || \"text/plain\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(templatetitle),\n\t\t\tnewFields = {},\n\t\t\ttiddler = wiki.getTiddler(title);\n\t\tif(parser) {\n\t\t\tvar widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});\n\t\t\tvar container = $tw.fakeDocument.createElement(\"div\");\n\t\t\twidgetNode.render(container,null);\n\t\t\tnewFields[fieldname] = rendertype === \"text/html\" ? container.innerHTML : container.textContent;\n\t\t} else {\n\t\t\tnewFields[fieldname] = undefined;\n\t\t}\n\t\twiki.addTiddler(new $tw.Tiddler(tiddler,newFields));\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/setfield.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/unpackplugin.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/unpackplugin.js\ntype: application/javascript\nmodule-type: command\n\nCommand to extract the shadow tiddlers from within a plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"unpackplugin\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing plugin name\";\n\t}\n\tvar self = this,\n\t\ttitle = this.params[0],\n\t\tpluginData = this.commander.wiki.getTiddlerDataCached(title);\n\tif(!pluginData) {\n\t\treturn \"Plugin '\" + title + \"' not found\";\n\t}\n\t$tw.utils.each(pluginData.tiddlers,function(tiddler) {\n\t\tself.commander.wiki.addTiddler(new $tw.Tiddler(tiddler));\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/unpackplugin.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/verbose.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/verbose.js\ntype: application/javascript\nmodule-type: command\n\nVerbose command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"verbose\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.verbose = true;\n\t// Output the boot message log\n\tthis.commander.streams.output.write(\"Boot log:\\n \" + $tw.boot.logMessages.join(\"\\n \") + \"\\n\");\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/verbose.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/version.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/version.js\ntype: application/javascript\nmodule-type: command\n\nVersion command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"version\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.streams.output.write($tw.version + \"\\n\");\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/version.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/config.js": {
"text": "/*\\\ntitle: $:/core/modules/config.js\ntype: application/javascript\nmodule-type: config\n\nCore configuration constants\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.preferences = {};\n\nexports.preferences.notificationDuration = 3 * 1000;\nexports.preferences.jsonSpaces = 4;\n\nexports.textPrimitives = {\n\tupperLetter: \"[A-Z\\u00c0-\\u00d6\\u00d8-\\u00de\\u0150\\u0170]\",\n\tlowerLetter: \"[a-z\\u00df-\\u00f6\\u00f8-\\u00ff\\u0151\\u0171]\",\n\tanyLetter: \"[A-Za-z0-9\\u00c0-\\u00d6\\u00d8-\\u00de\\u00df-\\u00f6\\u00f8-\\u00ff\\u0150\\u0170\\u0151\\u0171]\",\n\tblockPrefixLetters:\t\"[A-Za-z0-9-_\\u00c0-\\u00d6\\u00d8-\\u00de\\u00df-\\u00f6\\u00f8-\\u00ff\\u0150\\u0170\\u0151\\u0171]\"\n};\n\nexports.textPrimitives.unWikiLink = \"~\";\nexports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + \"+\" +\n\texports.textPrimitives.lowerLetter + \"+\" +\n\texports.textPrimitives.upperLetter +\n\texports.textPrimitives.anyLetter + \"*\";\n\nexports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };\n\nexports.htmlVoidElements = \"area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr\".split(\",\");\n\nexports.htmlBlockElements = \"address,article,aside,audio,blockquote,canvas,dd,div,dl,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,noscript,ol,output,p,pre,section,table,tfoot,ul,video\".split(\",\");\n\nexports.htmlUnsafeElements = \"script\".split(\",\");\n\n})();\n",
"title": "$:/core/modules/config.js",
"type": "application/javascript",
"module-type": "config"
},
"$:/core/modules/deserializers.js": {
"text": "/*\\\ntitle: $:/core/modules/deserializers.js\ntype: application/javascript\nmodule-type: tiddlerdeserializer\n\nFunctions to deserialise tiddlers from a block of text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nUtility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:\n\n<div title=\"Title\" creator=\"JoeBloggs\" modifier=\"JoeBloggs\" created=\"201102111106\" modified=\"201102111310\" tags=\"myTag [[my long tag]]\">\n<pre>The text of the tiddler (without the expected HTML encoding).\n</pre>\n</div>\n\nNote that the field attributes are HTML encoded, but that the body of the <PRE> tag is not encoded.\n\nWhen these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.\n*/\nvar parseTiddlerDiv = function(text /* [,fields] */) {\n\t// Slot together the default results\n\tvar result = {};\n\tif(arguments.length > 1) {\n\t\tfor(var f=1; f<arguments.length; f++) {\n\t\t\tvar fields = arguments[f];\n\t\t\tfor(var t in fields) {\n\t\t\t\tresult[t] = fields[t];\t\t\n\t\t\t}\n\t\t}\n\t}\n\t// Parse the DIV body\n\tvar startRegExp = /^\\s*<div\\s+([^>]*)>(\\s*<pre>)?/gi,\n\t\tendRegExp,\n\t\tmatch = startRegExp.exec(text);\n\tif(match) {\n\t\t// Old-style DIVs don't have the <pre> tag\n\t\tif(match[2]) {\n\t\t\tendRegExp = /<\\/pre>\\s*<\\/div>\\s*$/gi;\n\t\t} else {\n\t\t\tendRegExp = /<\\/div>\\s*$/gi;\n\t\t}\n\t\tvar endMatch = endRegExp.exec(text);\n\t\tif(endMatch) {\n\t\t\t// Extract the text\n\t\t\tresult.text = text.substring(match.index + match[0].length,endMatch.index);\n\t\t\t// Process the attributes\n\t\t\tvar attrRegExp = /\\s*([^=\\s]+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/gi,\n\t\t\t\tattrMatch;\n\t\t\tdo {\n\t\t\t\tattrMatch = attrRegExp.exec(match[1]);\n\t\t\t\tif(attrMatch) {\n\t\t\t\t\tvar name = attrMatch[1];\n\t\t\t\t\tvar value = attrMatch[2] !== undefined ? attrMatch[2] : attrMatch[3];\n\t\t\t\t\tresult[name] = value;\n\t\t\t\t}\n\t\t\t} while(attrMatch);\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports[\"application/x-tiddler-html-div\"] = function(text,fields) {\n\treturn [parseTiddlerDiv(text,fields)];\n};\n\nexports[\"application/json\"] = function(text,fields) {\n\tvar incoming,\n\t\tresults = [];\n\ttry {\n\t\tincoming = JSON.parse(text);\n\t} catch(e) {\n\t\tincoming = [{\n\t\t\ttitle: \"JSON error: \" + e,\n\t\t\ttext: \"\"\n\t\t}]\n\t}\n\tif(!$tw.utils.isArray(incoming)) {\n\t\tincoming = [incoming];\n\t}\n\tfor(var t=0; t<incoming.length; t++) {\n\t\tvar incomingFields = incoming[t],\n\t\t\tfields = {};\n\t\tfor(var f in incomingFields) {\n\t\t\tif(typeof incomingFields[f] === \"string\") {\n\t\t\t\tfields[f] = incomingFields[f];\n\t\t\t}\n\t\t}\n\t\tresults.push(fields);\n\t}\n\treturn results;\n};\n\n/*\nParse an HTML file into tiddlers. There are three possibilities:\n# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers\n# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers\n# An ordinary HTML file\n*/\nexports[\"text/html\"] = function(text,fields) {\n\t// Check if we've got a store area\n\tvar storeAreaMarkerRegExp = /<div id=[\"']?storeArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\tmatch = storeAreaMarkerRegExp.exec(text);\n\tif(match) {\n\t\t// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file\n\t\t// First read the normal tiddlers\n\t\tvar results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);\n\t\t// Then any system tiddlers\n\t\tvar systemAreaMarkerRegExp = /<div id=[\"']?systemArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\t\tsysMatch = systemAreaMarkerRegExp.exec(text);\n\t\tif(sysMatch) {\n\t\t\tresults.push.apply(results,deserializeTiddlyWikiFile(text,systemAreaMarkerRegExp.lastIndex,!!sysMatch[1],fields));\n\t\t}\n\t\treturn results;\n\t} else {\n\t\t// Check whether we've got an encrypted file\n\t\tvar encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);\n\t\tif(encryptedStoreArea) {\n\t\t\t// If so, attempt to decrypt it using the current password\n\t\t\treturn $tw.utils.decryptStoreArea(encryptedStoreArea);\n\t\t} else {\n\t\t\t// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler\n\t\t\treturn deserializeHtmlFile(text,fields);\n\t\t}\n\t}\n};\n\nfunction deserializeHtmlFile(text,fields) {\n\tvar result = {};\n\t$tw.utils.each(fields,function(value,name) {\n\t\tresult[name] = value;\n\t});\n\tresult.text = text;\n\tresult.type = \"text/html\";\n\treturn [result];\n}\n\nfunction deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {\n\tvar results = [],\n\t\tendOfDivRegExp = /(<\\/div>\\s*)/gi,\n\t\tstartPos = storeAreaEnd,\n\t\tdefaultType = isTiddlyWiki5 ? undefined : \"text/x-tiddlywiki\";\n\tendOfDivRegExp.lastIndex = startPos;\n\tvar match = endOfDivRegExp.exec(text);\n\twhile(match) {\n\t\tvar endPos = endOfDivRegExp.lastIndex,\n\t\t\ttiddlerFields = parseTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});\n\t\tif(!tiddlerFields) {\n\t\t\tbreak;\n\t\t}\n\t\t$tw.utils.each(tiddlerFields,function(value,name) {\n\t\t\tif(typeof value === \"string\") {\n\t\t\t\ttiddlerFields[name] = $tw.utils.htmlDecode(value);\n\t\t\t}\n\t\t});\n\t\tif(tiddlerFields.text !== null) {\n\t\t\tresults.push(tiddlerFields);\n\t\t}\n\t\tstartPos = endPos;\n\t\tmatch = endOfDivRegExp.exec(text);\n\t}\n\treturn results;\n}\n\n})();\n",
"title": "$:/core/modules/deserializers.js",
"type": "application/javascript",
"module-type": "tiddlerdeserializer"
},
"$:/core/modules/editor/engines/framed.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/engines/framed.js\ntype: application/javascript\nmodule-type: library\n\nText editor engine based on a simple input or textarea within an iframe. This is done so that the selection is preserved even when clicking away from the textarea\n\n\\*/\n(function(){\n\n/*jslint node: true,browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HEIGHT_VALUE_TITLE = \"$:/config/TextEditor/EditorHeight/Height\";\n\nfunction FramedEngine(options) {\n\t// Save our options\n\toptions = options || {};\n\tthis.widget = options.widget;\n\tthis.value = options.value;\n\tthis.parentNode = options.parentNode;\n\tthis.nextSibling = options.nextSibling;\n\t// Create our hidden dummy text area for reading styles\n\tthis.dummyTextArea = this.widget.document.createElement(\"textarea\");\n\tif(this.widget.editClass) {\n\t\tthis.dummyTextArea.className = this.widget.editClass;\n\t}\n\tthis.dummyTextArea.setAttribute(\"hidden\",\"true\");\n\tthis.parentNode.insertBefore(this.dummyTextArea,this.nextSibling);\n\tthis.widget.domNodes.push(this.dummyTextArea);\n\t// Create the iframe\n\tthis.iframeNode = this.widget.document.createElement(\"iframe\");\n\tthis.parentNode.insertBefore(this.iframeNode,this.nextSibling);\n\tthis.iframeDoc = this.iframeNode.contentWindow.document;\n\t// (Firefox requires us to put some empty content in the iframe)\n\tthis.iframeDoc.open();\n\tthis.iframeDoc.write(\"\");\n\tthis.iframeDoc.close();\n\t// Style the iframe\n\tthis.iframeNode.className = this.dummyTextArea.className;\n\tthis.iframeNode.style.border = \"none\";\n\tthis.iframeNode.style.padding = \"0\";\n\tthis.iframeNode.style.resize = \"none\";\n\tthis.iframeDoc.body.style.margin = \"0\";\n\tthis.iframeDoc.body.style.padding = \"0\";\n\tthis.widget.domNodes.push(this.iframeNode);\n\t// Construct the textarea or input node\n\tvar tag = this.widget.editTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"input\";\n\t}\n\tthis.domNode = this.iframeDoc.createElement(tag);\n\t// Set the text\n\tif(this.widget.editTag === \"textarea\") {\n\t\tthis.domNode.appendChild(this.iframeDoc.createTextNode(this.value));\n\t} else {\n\t\tthis.domNode.value = this.value;\n\t}\n\t// Set the attributes\n\tif(this.widget.editType) {\n\t\tthis.domNode.setAttribute(\"type\",this.widget.editType);\n\t}\n\tif(this.widget.editPlaceholder) {\n\t\tthis.domNode.setAttribute(\"placeholder\",this.widget.editPlaceholder);\n\t}\n\tif(this.widget.editSize) {\n\t\tthis.domNode.setAttribute(\"size\",this.widget.editSize);\n\t}\n\tif(this.widget.editRows) {\n\t\tthis.domNode.setAttribute(\"rows\",this.widget.editRows);\n\t}\n\t// Copy the styles from the dummy textarea\n\tthis.copyStyles();\n\t// Add event listeners\n\t$tw.utils.addEventListeners(this.domNode,[\n\t\t{name: \"input\",handlerObject: this,handlerMethod: \"handleInputEvent\"},\n\t\t{name: \"keydown\",handlerObject: this.widget,handlerMethod: \"handleKeydownEvent\"}\n\t]);\n\t// Insert the element into the DOM\n\tthis.iframeDoc.body.appendChild(this.domNode);\n}\n\n/*\nCopy styles from the dummy text area to the textarea in the iframe\n*/\nFramedEngine.prototype.copyStyles = function() {\n\t// Copy all styles\n\t$tw.utils.copyStyles(this.dummyTextArea,this.domNode);\n\t// Override the ones that should not be set the same as the dummy textarea\n\tthis.domNode.style.display = \"block\";\n\tthis.domNode.style.width = \"100%\";\n\tthis.domNode.style.margin = \"0\";\n\t// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour\n\tthis.domNode.style[\"-webkit-text-fill-color\"] = \"currentcolor\";\n};\n\n/*\nSet the text of the engine if it doesn't currently have focus\n*/\nFramedEngine.prototype.setText = function(text,type) {\n\tif(!this.domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.domNode.ownerDocument.activeElement !== this.domNode) {\n\t\t\tthis.domNode.value = text;\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nGet the text of the engine\n*/\nFramedEngine.prototype.getText = function() {\n\treturn this.domNode.value;\n};\n\n/*\nFix the height of textarea to fit content\n*/\nFramedEngine.prototype.fixHeight = function() {\n\t// Make sure styles are updated\n\tthis.copyStyles();\n\t// Adjust height\n\tif(this.widget.editTag === \"textarea\") {\n\t\tif(this.widget.editAutoHeight) {\n\t\t\tif(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {\n\t\t\t\tvar newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);\n\t\t\t\tthis.iframeNode.style.height = (newHeight + 14) + \"px\"; // +14 for the border on the textarea\n\t\t\t}\n\t\t} else {\n\t\t\tvar fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,\"400px\"),10);\n\t\t\tfixedHeight = Math.max(fixedHeight,20);\n\t\t\tthis.domNode.style.height = fixedHeight + \"px\";\n\t\t\tthis.iframeNode.style.height = (fixedHeight + 14) + \"px\";\n\t\t}\n\t}\n};\n\n/*\nFocus the engine node\n*/\nFramedEngine.prototype.focus = function() {\n\tif(this.domNode.focus && this.domNode.select) {\n\t\tthis.domNode.focus();\n\t\tthis.domNode.select();\n\t}\n};\n\n/*\nHandle a dom \"input\" event which occurs when the text has changed\n*/\nFramedEngine.prototype.handleInputEvent = function(event) {\n\tthis.widget.saveChanges(this.getText());\n\tthis.fixHeight();\n\treturn true;\n};\n\n/*\nCreate a blank structure representing a text operation\n*/\nFramedEngine.prototype.createTextOperation = function() {\n\tvar operation = {\n\t\ttext: this.domNode.value,\n\t\tselStart: this.domNode.selectionStart,\n\t\tselEnd: this.domNode.selectionEnd,\n\t\tcutStart: null,\n\t\tcutEnd: null,\n\t\treplacement: null,\n\t\tnewSelStart: null,\n\t\tnewSelEnd: null\n\t};\n\toperation.selection = operation.text.substring(operation.selStart,operation.selEnd);\n\treturn operation;\n};\n\n/*\nExecute a text operation\n*/\nFramedEngine.prototype.executeTextOperation = function(operation) {\n\t// Perform the required changes to the text area and the underlying tiddler\n\tvar newText = operation.text;\n\tif(operation.replacement !== null) {\n\t\tnewText = operation.text.substring(0,operation.cutStart) + operation.replacement + operation.text.substring(operation.cutEnd);\n\t\t// Attempt to use a execCommand to modify the value of the control\n\t\tif(this.iframeDoc.queryCommandSupported(\"insertText\") && this.iframeDoc.queryCommandSupported(\"delete\") && !$tw.browser.isFirefox) {\n\t\t\tthis.domNode.focus();\n\t\t\tthis.domNode.setSelectionRange(operation.cutStart,operation.cutEnd);\n\t\t\tif(operation.replacement === \"\") {\n\t\t\t\tthis.iframeDoc.execCommand(\"delete\",false,\"\");\n\t\t\t} else {\n\t\t\t\tthis.iframeDoc.execCommand(\"insertText\",false,operation.replacement);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.domNode.value = newText;\n\t\t}\n\t\tthis.domNode.focus();\n\t\tthis.domNode.setSelectionRange(operation.newSelStart,operation.newSelEnd);\n\t}\n\tthis.domNode.focus();\n\treturn newText;\n};\n\nexports.FramedEngine = FramedEngine;\n\n})();\n",
"title": "$:/core/modules/editor/engines/framed.js",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/engines/simple.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/engines/simple.js\ntype: application/javascript\nmodule-type: library\n\nText editor engine based on a simple input or textarea tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HEIGHT_VALUE_TITLE = \"$:/config/TextEditor/EditorHeight/Height\";\n\nfunction SimpleEngine(options) {\n\t// Save our options\n\toptions = options || {};\n\tthis.widget = options.widget;\n\tthis.value = options.value;\n\tthis.parentNode = options.parentNode;\n\tthis.nextSibling = options.nextSibling;\n\t// Construct the textarea or input node\n\tvar tag = this.widget.editTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"input\";\n\t}\n\tthis.domNode = this.widget.document.createElement(tag);\n\t// Set the text\n\tif(this.widget.editTag === \"textarea\") {\n\t\tthis.domNode.appendChild(this.widget.document.createTextNode(this.value));\n\t} else {\n\t\tthis.domNode.value = this.value;\n\t}\n\t// Set the attributes\n\tif(this.widget.editType) {\n\t\tthis.domNode.setAttribute(\"type\",this.widget.editType);\n\t}\n\tif(this.widget.editPlaceholder) {\n\t\tthis.domNode.setAttribute(\"placeholder\",this.widget.editPlaceholder);\n\t}\n\tif(this.widget.editSize) {\n\t\tthis.domNode.setAttribute(\"size\",this.widget.editSize);\n\t}\n\tif(this.widget.editRows) {\n\t\tthis.domNode.setAttribute(\"rows\",this.widget.editRows);\n\t}\n\tif(this.widget.editClass) {\n\t\tthis.domNode.className = this.widget.editClass;\n\t}\n\t// Add an input event handler\n\t$tw.utils.addEventListeners(this.domNode,[\n\t\t{name: \"focus\", handlerObject: this, handlerMethod: \"handleFocusEvent\"},\n\t\t{name: \"input\", handlerObject: this, handlerMethod: \"handleInputEvent\"}\n\t]);\n\t// Insert the element into the DOM\n\tthis.parentNode.insertBefore(this.domNode,this.nextSibling);\n\tthis.widget.domNodes.push(this.domNode);\n}\n\n/*\nSet the text of the engine if it doesn't currently have focus\n*/\nSimpleEngine.prototype.setText = function(text,type) {\n\tif(!this.domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.domNode.ownerDocument.activeElement !== this.domNode || text === \"\") {\n\t\t\tthis.domNode.value = text;\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nGet the text of the engine\n*/\nSimpleEngine.prototype.getText = function() {\n\treturn this.domNode.value;\n};\n\n/*\nFix the height of textarea to fit content\n*/\nSimpleEngine.prototype.fixHeight = function() {\n\tif(this.widget.editTag === \"textarea\") {\n\t\tif(this.widget.editAutoHeight) {\n\t\t\tif(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {\n\t\t\t\t$tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);\n\t\t\t}\n\t\t} else {\n\t\t\tvar fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,\"400px\"),10);\n\t\t\tfixedHeight = Math.max(fixedHeight,20);\n\t\t\tthis.domNode.style.height = fixedHeight + \"px\";\n\t\t}\n\t}\n};\n\n/*\nFocus the engine node\n*/\nSimpleEngine.prototype.focus = function() {\n\tif(this.domNode.focus && this.domNode.select) {\n\t\tthis.domNode.focus();\n\t\tthis.domNode.select();\n\t}\n};\n\n/*\nHandle a dom \"input\" event which occurs when the text has changed\n*/\nSimpleEngine.prototype.handleInputEvent = function(event) {\n\tthis.widget.saveChanges(this.getText());\n\tthis.fixHeight();\n\treturn true;\n};\n\n/*\nHandle a dom \"focus\" event\n*/\nSimpleEngine.prototype.handleFocusEvent = function(event) {\n\tif(this.widget.editFocusPopup) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNode,\n\t\t\ttitle: this.widget.editFocusPopup,\n\t\t\twiki: this.widget.wiki,\n\t\t\tforce: true\n\t\t});\n\t}\n\treturn true;\n};\n\n/*\nCreate a blank structure representing a text operation\n*/\nSimpleEngine.prototype.createTextOperation = function() {\n\treturn null;\n};\n\n/*\nExecute a text operation\n*/\nSimpleEngine.prototype.executeTextOperation = function(operation) {\n};\n\nexports.SimpleEngine = SimpleEngine;\n\n})();\n",
"title": "$:/core/modules/editor/engines/simple.js",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/factory.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/factory.js\ntype: application/javascript\nmodule-type: library\n\nFactory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DEFAULT_MIN_TEXT_AREA_HEIGHT = \"100px\"; // Minimum height of textareas in pixels\n\n// Configuration tiddlers\nvar HEIGHT_MODE_TITLE = \"$:/config/TextEditor/EditorHeight/Mode\";\nvar ENABLE_TOOLBAR_TITLE = \"$:/config/TextEditor/EnableToolbar\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nfunction editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {\n\n\tvar EditTextWidget = function(parseTreeNode,options) {\n\t\t// Initialise the editor operations if they've not been done already\n\t\tif(!this.editorOperations) {\n\t\t\tEditTextWidget.prototype.editorOperations = {};\n\t\t\t$tw.modules.applyMethods(\"texteditoroperation\",this.editorOperations);\n\t\t}\n\t\tthis.initialise(parseTreeNode,options);\n\t};\n\n\t/*\n\tInherit from the base widget class\n\t*/\n\tEditTextWidget.prototype = new Widget();\n\n\t/*\n\tRender this widget into the DOM\n\t*/\n\tEditTextWidget.prototype.render = function(parent,nextSibling) {\n\t\t// Save the parent dom node\n\t\tthis.parentDomNode = parent;\n\t\t// Compute our attributes\n\t\tthis.computeAttributes();\n\t\t// Execute our logic\n\t\tthis.execute();\n\t\t// Create the wrapper for the toolbar and render its content\n\t\tif(this.editShowToolbar) {\n\t\t\tthis.toolbarNode = this.document.createElement(\"div\");\n\t\t\tthis.toolbarNode.className = \"tc-editor-toolbar\";\n\t\t\tparent.insertBefore(this.toolbarNode,nextSibling);\n\t\t\tthis.renderChildren(this.toolbarNode,null);\n\t\t\tthis.domNodes.push(this.toolbarNode);\n\t\t}\n\t\t// Create our element\n\t\tvar editInfo = this.getEditInfo(),\n\t\t\tEngine = this.editShowToolbar ? toolbarEngine : nonToolbarEngine;\n\t\tthis.engine = new Engine({\n\t\t\t\twidget: this,\n\t\t\t\tvalue: editInfo.value,\n\t\t\t\ttype: editInfo.type,\n\t\t\t\tparentNode: parent,\n\t\t\t\tnextSibling: nextSibling\n\t\t\t});\n\t\t// Call the postRender hook\n\t\tif(this.postRender) {\n\t\t\tthis.postRender();\n\t\t}\n\t\t// Fix height\n\t\tthis.engine.fixHeight();\n\t\t// Focus if required\n\t\tif(this.editFocus === \"true\" || this.editFocus === \"yes\") {\n\t\t\tthis.engine.focus();\n\t\t}\n\t\t// Add widget message listeners\n\t\tthis.addEventListeners([\n\t\t\t{type: \"tm-edit-text-operation\", handler: \"handleEditTextOperationMessage\"}\n\t\t]);\n\t};\n\n\t/*\n\tGet the tiddler being edited and current value\n\t*/\n\tEditTextWidget.prototype.getEditInfo = function() {\n\t\t// Get the edit value\n\t\tvar self = this,\n\t\t\tvalue,\n\t\t\ttype = \"text/plain\",\n\t\t\tupdate;\n\t\tif(this.editIndex) {\n\t\t\tvalue = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault);\n\t\t\tupdate = function(value) {\n\t\t\t\tvar data = self.wiki.getTiddlerData(self.editTitle,{});\n\t\t\t\tif(data[self.editIndex] !== value) {\n\t\t\t\t\tdata[self.editIndex] = value;\n\t\t\t\t\tself.wiki.setTiddlerData(self.editTitle,data);\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t// Get the current tiddler and the field name\n\t\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\t\tif(tiddler) {\n\t\t\t\t// If we've got a tiddler, the value to display is the field string value\n\t\t\t\tvalue = tiddler.getFieldString(this.editField);\n\t\t\t\tif(this.editField === \"text\") {\n\t\t\t\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Otherwise, we need to construct a default value for the editor\n\t\t\t\tswitch(this.editField) {\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tvalue = \"Type the text for the tiddler '\" + this.editTitle + \"'\";\n\t\t\t\t\t\ttype = \"text/vnd.tiddlywiki\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\tvalue = this.editTitle;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tvalue = \"\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(this.editDefault !== undefined) {\n\t\t\t\t\tvalue = this.editDefault;\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdate = function(value) {\n\t\t\t\tvar tiddler = self.wiki.getTiddler(self.editTitle),\n\t\t\t\t\tupdateFields = {\n\t\t\t\t\t\ttitle: self.editTitle\n\t\t\t\t\t};\n\t\t\t\tupdateFields[self.editField] = value;\n\t\t\t\tself.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields()));\n\t\t\t};\n\t\t}\n\t\tif(this.editType) {\n\t\t\ttype = this.editType;\n\t\t}\n\t\treturn {value: value || \"\", type: type, update: update};\n\t};\n\n\t/*\n\tHandle an edit text operation message from the toolbar\n\t*/\n\tEditTextWidget.prototype.handleEditTextOperationMessage = function(event) {\n\t\t// Prepare information about the operation\n\t\tvar operation = this.engine.createTextOperation();\n\t\t// Invoke the handler for the selected operation\n\t\tvar handler = this.editorOperations[event.param];\n\t\tif(handler) {\n\t\t\thandler.call(this,event,operation);\n\t\t}\n\t\t// Execute the operation via the engine\n\t\tvar newText = this.engine.executeTextOperation(operation);\n\t\t// Fix the tiddler height and save changes\n\t\tthis.engine.fixHeight();\n\t\tthis.saveChanges(newText);\n\t};\n\n\t/*\n\tCompute the internal state of the widget\n\t*/\n\tEditTextWidget.prototype.execute = function() {\n\t\t// Get our parameters\n\t\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t\tthis.editField = this.getAttribute(\"field\",\"text\");\n\t\tthis.editIndex = this.getAttribute(\"index\");\n\t\tthis.editDefault = this.getAttribute(\"default\");\n\t\tthis.editClass = this.getAttribute(\"class\");\n\t\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\t\tthis.editSize = this.getAttribute(\"size\");\n\t\tthis.editRows = this.getAttribute(\"rows\");\n\t\tthis.editAutoHeight = this.wiki.getTiddlerText(HEIGHT_MODE_TITLE,\"auto\");\n\t\tthis.editAutoHeight = this.getAttribute(\"autoHeight\",this.editAutoHeight === \"auto\" ? \"yes\" : \"no\") === \"yes\";\n\t\tthis.editMinHeight = this.getAttribute(\"minHeight\",DEFAULT_MIN_TEXT_AREA_HEIGHT);\n\t\tthis.editFocusPopup = this.getAttribute(\"focusPopup\");\n\t\tthis.editFocus = this.getAttribute(\"focus\");\n\t\t// Get the default editor element tag and type\n\t\tvar tag,type;\n\t\tif(this.editField === \"text\") {\n\t\t\ttag = \"textarea\";\n\t\t} else {\n\t\t\ttag = \"input\";\n\t\t\tvar fieldModule = $tw.Tiddler.fieldModules[this.editField];\n\t\t\tif(fieldModule && fieldModule.editTag) {\n\t\t\t\ttag = fieldModule.editTag;\n\t\t\t}\n\t\t\tif(fieldModule && fieldModule.editType) {\n\t\t\t\ttype = fieldModule.editType;\n\t\t\t}\n\t\t\ttype = type || \"text\";\n\t\t}\n\t\t// Get the rest of our parameters\n\t\tthis.editTag = this.getAttribute(\"tag\",tag);\n\t\tthis.editType = this.getAttribute(\"type\",type);\n\t\t// Make the child widgets\n\t\tthis.makeChildWidgets();\n\t\t// Determine whether to show the toolbar\n\t\tthis.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,\"yes\");\n\t\tthis.editShowToolbar = (this.editShowToolbar === \"yes\") && !!(this.children && this.children.length > 0);\n\t};\n\n\t/*\n\tSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n\t*/\n\tEditTextWidget.prototype.refresh = function(changedTiddlers) {\n\t\tvar changedAttributes = this.computeAttributes();\n\t\t// Completely rerender if any of our attributes have changed\n\t\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes[\"default\"] || changedAttributes[\"class\"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {\n\t\t\tthis.refreshSelf();\n\t\t\treturn true;\n\t\t} else if(changedTiddlers[this.editTitle]) {\n\t\t\tvar editInfo = this.getEditInfo();\n\t\t\tthis.updateEditor(editInfo.value,editInfo.type);\n\t\t}\n\t\tthis.engine.fixHeight();\n\t\tif(this.editShowToolbar) {\n\t\t\treturn this.refreshChildren(changedTiddlers);\t\t\t\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\t/*\n\tUpdate the editor with new text. This method is separate from updateEditorDomNode()\n\tso that subclasses can override updateEditor() and still use updateEditorDomNode()\n\t*/\n\tEditTextWidget.prototype.updateEditor = function(text,type) {\n\t\tthis.updateEditorDomNode(text,type);\n\t};\n\n\t/*\n\tUpdate the editor dom node with new text\n\t*/\n\tEditTextWidget.prototype.updateEditorDomNode = function(text,type) {\n\t\tthis.engine.setText(text,type);\n\t};\n\n\t/*\n\tSave changes back to the tiddler store\n\t*/\n\tEditTextWidget.prototype.saveChanges = function(text) {\n\t\tvar editInfo = this.getEditInfo();\n\t\tif(text !== editInfo.value) {\n\t\t\teditInfo.update(text);\n\t\t}\n\t};\n\n\t/*\n\tHandle a dom \"keydown\" event, which we'll bubble up to our container for the keyboard widgets benefit\n\t*/\n\tEditTextWidget.prototype.handleKeydownEvent = function(event) {\n\t\t// Check for a keyboard shortcut\n\t\tif(this.toolbarNode) {\n\t\t\tvar shortcutElements = this.toolbarNode.querySelectorAll(\"[data-tw-keyboard-shortcut]\");\n\t\t\tfor(var index=0; index<shortcutElements.length; index++) {\n\t\t\t\tvar el = shortcutElements[index],\n\t\t\t\t\tshortcutData = el.getAttribute(\"data-tw-keyboard-shortcut\"),\n\t\t\t\t\tkeyInfoArray = $tw.keyboardManager.parseKeyDescriptors(shortcutData,{\n\t\t\t\t\t\twiki: this.wiki\n\t\t\t\t\t});\n\t\t\t\tif($tw.keyboardManager.checkKeyDescriptors(event,keyInfoArray)) {\n\t\t\t\t\tvar clickEvent = this.document.createEvent(\"Events\");\n\t\t\t\t clickEvent.initEvent(\"click\",true,false);\n\t\t\t\t el.dispatchEvent(clickEvent);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\treturn true;\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Propogate the event to the container\n\t\tif(this.propogateKeydownEvent(event)) {\n\t\t\t// Ignore the keydown if it was already handled\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn true;\n\t\t}\n\t\t// Otherwise, process the keydown normally\n\t\treturn false;\n\t};\n\n\t/*\n\tPropogate keydown events to our container for the keyboard widgets benefit\n\t*/\n\tEditTextWidget.prototype.propogateKeydownEvent = function(event) {\n\t\tvar newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent(\"Events\");\n\t\tif(newEvent.initEvent) {\n\t\t\tnewEvent.initEvent(\"keydown\", true, true);\n\t\t}\n\t\tnewEvent.keyCode = event.keyCode;\n\t\tnewEvent.which = event.which;\n\t\tnewEvent.metaKey = event.metaKey;\n\t\tnewEvent.ctrlKey = event.ctrlKey;\n\t\tnewEvent.altKey = event.altKey;\n\t\tnewEvent.shiftKey = event.shiftKey;\n\t\treturn !this.parentDomNode.dispatchEvent(newEvent);\n\t};\n\n\treturn EditTextWidget;\n\n}\n\nexports.editTextWidgetFactory = editTextWidgetFactory;\n\n})();\n",
"title": "$:/core/modules/editor/factory.js",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/operations/bitmap/clear.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/bitmap/clear.js\ntype: application/javascript\nmodule-type: bitmapeditoroperation\n\nBitmap editor operation to clear the image\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"clear\"] = function(event) {\n\tvar ctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.globalAlpha = 1;\n\tctx.fillStyle = event.paramObject.colour || \"white\";\n\tctx.fillRect(0,0,this.canvasDomNode.width,this.canvasDomNode.height);\n\t// Save changes\n\tthis.strokeEnd();\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/bitmap/clear.js",
"type": "application/javascript",
"module-type": "bitmapeditoroperation"
},
"$:/core/modules/editor/operations/bitmap/resize.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/bitmap/resize.js\ntype: application/javascript\nmodule-type: bitmapeditoroperation\n\nBitmap editor operation to resize the image\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"resize\"] = function(event) {\n\t// Get the new width\n\tvar newWidth = parseInt(event.paramObject.width || this.canvasDomNode.width,10),\n\t\tnewHeight = parseInt(event.paramObject.height || this.canvasDomNode.height,10);\n\t// Update if necessary\n\tif(newWidth > 0 && newHeight > 0 && !(newWidth === this.currCanvas.width && newHeight === this.currCanvas.height)) {\n\t\tthis.changeCanvasSize(newWidth,newHeight);\n\t}\n\t// Update the input controls\n\tthis.refreshToolbar();\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/bitmap/resize.js",
"type": "application/javascript",
"module-type": "bitmapeditoroperation"
},
"$:/core/modules/editor/operations/text/excise.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/excise.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to excise the selection to a new tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"excise\"] = function(event,operation) {\n\tvar editTiddler = this.wiki.getTiddler(this.editTitle),\n\t\teditTiddlerTitle = this.editTitle;\n\tif(editTiddler && editTiddler.fields[\"draft.of\"]) {\n\t\teditTiddlerTitle = editTiddler.fields[\"draft.of\"];\n\t}\n\tvar excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(\"New Excision\");\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\tthis.wiki.getCreationFields(),\n\t\tthis.wiki.getModificationFields(),\n\t\t{\n\t\t\ttitle: excisionTitle,\n\t\t\ttext: operation.selection,\n\t\t\ttags: event.paramObject.tagnew === \"yes\" ? [editTiddlerTitle] : []\n\t\t}\n\t));\n\toperation.replacement = excisionTitle;\n\tswitch(event.paramObject.type || \"transclude\") {\n\t\tcase \"transclude\":\n\t\t\toperation.replacement = \"{{\" + operation.replacement+ \"}}\";\n\t\t\tbreak;\n\t\tcase \"link\":\n\t\t\toperation.replacement = \"[[\" + operation.replacement+ \"]]\";\n\t\t\tbreak;\n\t\tcase \"macro\":\n\t\t\toperation.replacement = \"<<\" + (event.paramObject.macro || \"translink\") + \" \\\"\\\"\\\"\" + operation.replacement + \"\\\"\\\"\\\">>\";\n\t\t\tbreak;\n\t}\n\toperation.cutStart = operation.selStart;\n\toperation.cutEnd = operation.selEnd;\n\toperation.newSelStart = operation.selStart;\n\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/excise.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/make-link.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/make-link.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to make a link\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"make-link\"] = function(event,operation) {\n\tif(operation.selection) {\n\t\toperation.replacement = \"[[\" + operation.selection + \"|\" + event.paramObject.text + \"]]\";\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t} else {\n\t\toperation.replacement = \"[[\" + event.paramObject.text + \"]]\";\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t}\n\toperation.newSelStart = operation.selStart + operation.replacement.length;\n\toperation.newSelEnd = operation.newSelStart;\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/make-link.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/prefix-lines.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/prefix-lines.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to add a prefix to the selected lines\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"prefix-lines\"] = function(event,operation) {\n\t// Cut just past the preceding line break, or the start of the text\n\toperation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);\n\t// Cut to just past the following line break, or to the end of the text\n\toperation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);\n\t// Compose the required prefix\n\tvar prefix = $tw.utils.repeat(event.paramObject.character,event.paramObject.count);\n\t// Process each line\n\tvar lines = operation.text.substring(operation.cutStart,operation.cutEnd).split(/\\r?\\n/mg);\n\t$tw.utils.each(lines,function(line,index) {\n\t\t// Remove and count any existing prefix characters\n\t\tvar count = 0;\n\t\twhile(line.charAt(0) === event.paramObject.character) {\n\t\t\tline = line.substring(1);\n\t\t\tcount++;\n\t\t}\n\t\t// Remove any whitespace\n\t\twhile(line.charAt(0) === \" \") {\n\t\t\tline = line.substring(1);\n\t\t}\n\t\t// We're done if we removed the exact required prefix, otherwise add it\n\t\tif(count !== event.paramObject.count) {\n\t\t\t// Apply the prefix\n\t\t\tline = prefix + \" \" + line;\n\t\t}\n\t\t// Save the modified line\n\t\tlines[index] = line;\n\t});\n\t// Stitch the replacement text together and set the selection\n\toperation.replacement = lines.join(\"\\n\");\n\tif(lines.length === 1) {\n\t\toperation.newSelStart = operation.cutStart + operation.replacement.length;\n\t\toperation.newSelEnd = operation.newSelStart;\n\t} else {\n\t\toperation.newSelStart = operation.cutStart;\n\t\toperation.newSelEnd = operation.newSelStart + operation.replacement.length;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/prefix-lines.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/replace-all.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/replace-all.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to replace the entire text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"replace-all\"] = function(event,operation) {\n\toperation.cutStart = 0;\n\toperation.cutEnd = operation.text.length;\n\toperation.replacement = event.paramObject.text;\n\toperation.newSelStart = 0;\n\toperation.newSelEnd = operation.replacement.length;\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/replace-all.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/replace-selection.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/replace-selection.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to replace the selection\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"replace-selection\"] = function(event,operation) {\n\toperation.replacement = event.paramObject.text;\n\toperation.cutStart = operation.selStart;\n\toperation.cutEnd = operation.selEnd;\n\toperation.newSelStart = operation.selStart;\n\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/replace-selection.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/wrap-lines.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/wrap-lines.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to wrap the selected lines with a prefix and suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"wrap-lines\"] = function(event,operation) {\n\t// Cut just past the preceding line break, or the start of the text\n\toperation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);\n\t// Cut to just past the following line break, or to the end of the text\n\toperation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);\n\t// Add the prefix and suffix\n\toperation.replacement = event.paramObject.prefix + \"\\n\" +\n\t\t\t\toperation.text.substring(operation.cutStart,operation.cutEnd) + \"\\n\" +\n\t\t\t\tevent.paramObject.suffix + \"\\n\";\n\toperation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1;\n\toperation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/wrap-lines.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/wrap-selection.js": {
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/wrap-selection.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to wrap the selection with the specified prefix and suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"wrap-selection\"] = function(event,operation) {\n\tif(operation.selStart === operation.selEnd) {\n\t\t// No selection; check if we're within the prefix/suffix\n\t\tif(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) {\n\t\t\t// Remove the prefix and suffix unless they comprise the entire text\n\t\t\tif(operation.selStart > event.paramObject.prefix.length || (operation.selEnd + event.paramObject.suffix.length) < operation.text.length ) {\n\t\t\t\toperation.cutStart = operation.selStart - event.paramObject.prefix.length;\n\t\t\t\toperation.cutEnd = operation.selEnd + event.paramObject.suffix.length;\n\t\t\t\toperation.replacement = \"\";\n\t\t\t\toperation.newSelStart = operation.cutStart;\n\t\t\t\toperation.newSelEnd = operation.newSelStart;\n\t\t\t}\n\t\t} else {\n\t\t\t// Wrap the cursor instead\n\t\t\toperation.cutStart = operation.selStart;\n\t\t\toperation.cutEnd = operation.selEnd;\n\t\t\toperation.replacement = event.paramObject.prefix + event.paramObject.suffix;\n\t\t\toperation.newSelStart = operation.selStart + event.paramObject.prefix.length;\n\t\t\toperation.newSelEnd = operation.newSelStart;\n\t\t}\n\t} else if(operation.text.substring(operation.selStart,operation.selStart + event.paramObject.prefix.length) === event.paramObject.prefix && operation.text.substring(operation.selEnd - event.paramObject.suffix.length,operation.selEnd) === event.paramObject.suffix) {\n\t\t// Prefix and suffix are already present, so remove them\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t\toperation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length);\n\t\toperation.newSelStart = operation.selStart;\n\t\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n\t} else {\n\t\t// Add the prefix and suffix\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t\toperation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix;\n\t\toperation.newSelStart = operation.selStart;\n\t\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/editor/operations/text/wrap-selection.js",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/filters/addprefix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/addprefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for adding a prefix to each title in the list. This is\nespecially useful in contexts where only a filter expression is allowed\nand macro substitution isn't available.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.addprefix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(operator.operand + title);\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/addprefix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/addsuffix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/addsuffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for adding a suffix to each title in the list. This is\nespecially useful in contexts where only a filter expression is allowed\nand macro substitution isn't available.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.addsuffix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title + operator.operand);\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/addsuffix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/after.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/after.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler from the current list that is after the tiddler named in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.after = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar index = results.indexOf(operator.operand);\n\tif(index === -1 || index > (results.length - 2)) {\n\t\treturn [];\n\t} else {\n\t\treturn [results[index + 1]];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/after.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/all/current.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/current.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[current]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar currTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\");\n\tif(currTiddlerTitle) {\n\t\treturn [currTiddlerTitle];\n\t} else {\n\t\treturn [];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/current.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/missing.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/missing.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[missing]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\treturn options.wiki.getMissingTitles();\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/missing.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/orphans.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/orphans.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[orphans]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.orphans = function(source,prefix,options) {\n\treturn options.wiki.getOrphanTitles();\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/orphans.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/shadows.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/shadows.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[shadows]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadows = function(source,prefix,options) {\n\treturn options.wiki.allShadowTitles();\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/shadows.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/tags.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/tags.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[tags]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,prefix,options) {\n\treturn Object.keys(options.wiki.getTagMap());\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/tags.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/tiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all/tiddlers.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[tiddlers]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tiddlers = function(source,prefix,options) {\n\treturn options.wiki.allTitles();\n};\n\n})();\n",
"title": "$:/core/modules/filters/all/tiddlers.js",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/all.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for selecting tiddlers\n\n[all[shadows+tiddlers]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar allFilterOperators;\n\nfunction getAllFilterOperators() {\n\tif(!allFilterOperators) {\n\t\tallFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"allfilteroperator\",allFilterOperators);\n\t}\n\treturn allFilterOperators;\n}\n\n/*\nExport our filter function\n*/\nexports.all = function(source,operator,options) {\n\t// Get our suboperators\n\tvar allFilterOperators = getAllFilterOperators();\n\t// Cycle through the suboperators accumulating their results\n\tvar results = [],\n\t\tsubops = operator.operand.split(\"+\");\n\t// Check for common optimisations\n\tif(subops.length === 1 && subops[0] === \"\") {\n\t\treturn source;\n\t} else if(subops.length === 1 && subops[0] === \"tiddlers\") {\n\t\treturn options.wiki.each;\n\t} else if(subops.length === 1 && subops[0] === \"shadows\") {\n\t\treturn options.wiki.eachShadow;\n\t} else if(subops.length === 2 && subops[0] === \"tiddlers\" && subops[1] === \"shadows\") {\n\t\treturn options.wiki.eachTiddlerPlusShadows;\n\t} else if(subops.length === 2 && subops[0] === \"shadows\" && subops[1] === \"tiddlers\") {\n\t\treturn options.wiki.eachShadowPlusTiddlers;\n\t}\n\t// Do it the hard way\n\tfor(var t=0; t<subops.length; t++) {\n\t\tvar subop = allFilterOperators[subops[t]];\n\t\tif(subop) {\n\t\t\t$tw.utils.pushTop(results,subop(source,operator.prefix,options));\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/all.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/backlinks.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/backlinks.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the backlinks from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.backlinks = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/backlinks.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/before.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/before.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler from the current list that is before the tiddler named in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.before = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar index = results.indexOf(operator.operand);\n\tif(index <= 0) {\n\t\treturn [];\n\t} else {\n\t\treturn [results[index - 1]];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/before.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/commands.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/commands.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the commands available in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.commands = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.commands,function(commandInfo,name) {\n\t\tresults.push(name);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/commands.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/count.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/count.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the number of entries in the current list.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.count = function(source,operator,options) {\n\tvar count = 0;\n\tsource(function(tiddler,title) {\n\t\tcount++;\n\t});\n\treturn [count + \"\"];\n};\n\n})();\n",
"title": "$:/core/modules/filters/count.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/days.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/days.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects tiddlers with a specified date field within a specified date interval.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.days = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldName = operator.suffix || \"modified\",\n\t\tdayInterval = (parseInt(operator.operand,10)||0),\n\t\tdayIntervalSign = $tw.utils.sign(dayInterval),\n\t\ttargetTimeStamp = (new Date()).setHours(0,0,0,0) + 1000*60*60*24*dayInterval,\n\t\tisWithinDays = function(dateField) {\n\t\t\tvar sign = $tw.utils.sign(targetTimeStamp - (new Date(dateField)).setHours(0,0,0,0));\n\t\t\treturn sign === 0 || sign === dayIntervalSign;\n\t\t};\n\n\tif(operator.prefix === \"!\") {\n\t\ttargetTimeStamp = targetTimeStamp - 1000*60*60*24*dayIntervalSign;\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\t\tif(!isWithinDays($tw.utils.parseDate(tiddler.fields[fieldName]))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\t\tif(isWithinDays($tw.utils.parseDate(tiddler.fields[fieldName]))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/days.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/each.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/each.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique value of the specified field.\nWith suffix \"list\", selects all tiddlers that are values in a specified list field.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.each = function(source,operator,options) {\n\tvar results =[] ,\n\t\tvalue,values = {},\n\t\tfield = operator.operand || \"title\";\n\tif(operator.suffix !== \"list-item\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\tvalue = (field === \"title\") ? title : tiddler.getFieldString(field);\n\t\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\t\tvalues[value] = true;\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\t$tw.utils.each(\n\t\t\t\t\toptions.wiki.getTiddlerList(title,field),\n\t\t\t\t\tfunction(value) {\n\t\t\t\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\t\t\t\tvalues[value] = true;\n\t\t\t\t\t\t\tresults.push(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/each.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/eachday.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/eachday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique day covered by the specified date field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.eachday = function(source,operator,options) {\n\tvar results = [],\n\t\tvalues = [],\n\t\tfieldName = operator.operand || \"modified\";\n\t// Function to convert a date/time to a date integer\n\tvar toDate = function(value) {\n\t\tvalue = (new Date(value)).setHours(0,0,0,0);\n\t\treturn value+0;\n\t};\n\tsource(function(tiddler,title) {\n\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\tvar value = toDate($tw.utils.parseDate(tiddler.fields[fieldName]));\n\t\t\tif(values.indexOf(value) === -1) {\n\t\t\t\tvalues.push(value);\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/eachday.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/editiondescription.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/editiondescription.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the descriptions of the specified edition names\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.editiondescription = function(source,operator,options) {\n\tvar results = [],\n\t\teditionInfo = $tw.utils.getEditionInfo();\n\tif(editionInfo) {\n\t\tsource(function(tiddler,title) {\n\t\t\tif($tw.utils.hop(editionInfo,title)) {\n\t\t\t\tresults.push(editionInfo[title].description || \"\");\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/editiondescription.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/editions.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/editions.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the available editions in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.editions = function(source,operator,options) {\n\tvar results = [],\n\t\teditionInfo = $tw.utils.getEditionInfo();\n\tif(editionInfo) {\n\t\t$tw.utils.each(editionInfo,function(info,name) {\n\t\t\tresults.push(name);\n\t\t});\n\t}\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/editions.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/decodeuricomponent.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/decodeuricomponent.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for applying decodeURIComponent() to each item.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter functions\n*/\n\nexports.decodeuricomponent = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(decodeURIComponent(title));\n\t});\n\treturn results;\n};\n\nexports.encodeuricomponent = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(encodeURIComponent(title));\n\t});\n\treturn results;\n};\n\nexports.decodeuri = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(decodeURI(title));\n\t});\n\treturn results;\n};\n\nexports.encodeuri = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(encodeURI(title));\n\t});\n\treturn results;\n};\n\nexports.decodehtml = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.htmlDecode(title));\n\t});\n\treturn results;\n};\n\nexports.encodehtml = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.htmlEncode(title));\n\t});\n\treturn results;\n};\n\nexports.stringify = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.stringify(title));\n\t});\n\treturn results;\n};\n\nexports.escaperegexp = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.escapeRegExp(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/decodeuricomponent.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/enlist.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/enlist.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning its operand parsed as a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.enlist = function(source,operator,options) {\n\tvar list = $tw.utils.parseStringArray(operator.operand);\n\tif(operator.prefix === \"!\") {\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t\treturn results;\n\t} else {\n\t\treturn list;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/enlist.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/field.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/field.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.field = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldname = (operator.suffix || operator.operator || \"title\").toLowerCase();\n\tif(operator.prefix === \"!\") {\n\t\tif(operator.regexp) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && !operator.regexp.exec(text)) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && text !== operator.operand) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif(operator.regexp) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && !!operator.regexp.exec(text)) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && text === operator.operand) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/field.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/fields.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/fields.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the fields on the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.fields = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tfor(var fieldName in tiddler.fields) {\n\t\t\t\t$tw.utils.pushTop(results,fieldName);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/fields.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/get.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/get.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for replacing tiddler titles by the value of the field specified in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.get = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tvar value = tiddler.getFieldString(operator.operand);\n\t\t\tif(value) {\n\t\t\t\tresults.push(value);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/get.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/getindex.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/getindex.js\ntype: application/javascript\nmodule-type: filteroperator\n\nreturns the value at a given index of datatiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.getindex = function(source,operator,options) {\n\tvar data,title,results = [];\n\tif(operator.operand){\n\t\tsource(function(tiddler,title) {\n\t\t\ttitle = tiddler ? tiddler.fields.title : title;\n\t\t\tdata = options.wiki.extractTiddlerDataItem(tiddler,operator.operand);\n\t\t\tif(data) {\n\t\t\t\tresults.push(data);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/getindex.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/has.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/has.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a tiddler has the specified field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.has = function(source,operator,options) {\n\tvar results = [],\n\t\tinvert = operator.prefix === \"!\";\n\n\tif(operator.suffix === \"field\") {\n\t\tif(invert) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(!tiddler || (tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand)))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && $tw.utils.hop(tiddler.fields,operator.operand)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif(invert) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand] === \"\")) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && !(tiddler.fields[operator.operand] === \"\" || tiddler.fields[operator.operand].length === 0)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/has.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/haschanged.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/haschanged.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returns tiddlers from the list that have a non-zero changecount.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.haschanged = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.getChangeCount(title) === 0) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.getChangeCount(title) > 0) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/haschanged.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/indexes.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/indexes.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the indexes of a data tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.indexes = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar data = options.wiki.getTiddlerDataCached(title);\n\t\tif(data) {\n\t\t\t$tw.utils.pushTop(results,Object.keys(data));\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/indexes.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/insertbefore.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/insertbefore.js\ntype: application/javascript\nmodule-type: filteroperator\n\nInsert an item before another item in a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOrder a list\n*/\nexports.insertbefore = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar target = options.widget && options.widget.getVariable(operator.suffix || \"currentTiddler\");\n\tif(target !== operator.operand) {\n\t\t// Remove the entry from the list if it is present\n\t\tvar pos = results.indexOf(operator.operand);\n\t\tif(pos !== -1) {\n\t\t\tresults.splice(pos,1);\n\t\t}\n\t\t// Insert the entry before the target marker\n\t\tpos = results.indexOf(target);\n\t\tif(pos !== -1) {\n\t\t\tresults.splice(pos,0,operator.operand);\n\t\t} else {\n\t\t\tresults.push(operator.operand);\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/insertbefore.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/is/current.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/current.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[current]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar results = [],\n\t\tcurrTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\");\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title !== currTiddlerTitle) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title === currTiddlerTitle) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/current.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/image.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/image.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[image]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.image = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isImageTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isImageTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/image.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/missing.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/missing.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[missing]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/missing.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/orphan.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/orphan.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[orphan]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.orphan = function(source,prefix,options) {\n\tvar results = [],\n\t\torphanTitles = options.wiki.getOrphanTitles();\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(orphanTitles.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(orphanTitles.indexOf(title) !== -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/orphan.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/shadow.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/shadow.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[shadow]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadow = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isShadowTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isShadowTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/shadow.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/system.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/system.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[system]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.system = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isSystemTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isSystemTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/system.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/tag.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/tag.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[tag]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,prefix,options) {\n\tvar results = [],\n\t\ttagMap = options.wiki.getTagMap();\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!$tw.utils.hop(tagMap,title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif($tw.utils.hop(tagMap,title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/tag.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/tiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/tiddler.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[tiddler]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tiddler = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/tiddler.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking tiddler properties\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar isFilterOperators;\n\nfunction getIsFilterOperators() {\n\tif(!isFilterOperators) {\n\t\tisFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"isfilteroperator\",isFilterOperators);\n\t}\n\treturn isFilterOperators;\n}\n\n/*\nExport our filter function\n*/\nexports.is = function(source,operator,options) {\n\t// Dispatch to the correct isfilteroperator\n\tvar isFilterOperators = getIsFilterOperators();\n\tif(operator.operand) {\n\t\tvar isFilterOperator = isFilterOperators[operator.operand];\n\t\tif(isFilterOperator) {\n\t\t\treturn isFilterOperator(source,operator.prefix,options);\n\t\t} else {\n\t\t\treturn [$tw.language.getString(\"Error/IsFilterOperator\")];\n\t\t}\n\t} else {\n\t\t// Return all tiddlers if the operand is missing\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t\treturn results;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/is.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/limit.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/limit.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for chopping the results to a specified maximum number of entries\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.limit = function(source,operator,options) {\n\tvar results = [];\n\t// Convert to an array\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\t// Slice the array if necessary\n\tvar limit = Math.min(results.length,parseInt(operator.operand,10));\n\tif(operator.prefix === \"!\") {\n\t\tresults = results.slice(-limit);\n\t} else {\n\t\tresults = results.slice(0,limit);\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/limit.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/links.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/links.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the links from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.links = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerLinks(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/links.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/list.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/list.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddlers whose title is listed in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.list = function(source,operator,options) {\n\tvar results = [],\n\t\ttr = $tw.utils.parseTextReference(operator.operand),\n\t\tcurrTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\"),\n\t\tlist = options.wiki.getTiddlerList(tr.title || currTiddlerTitle,tr.field,tr.index);\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tresults = list;\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/list.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/listed.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/listed.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that have the selected tiddlers in a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.listed = function(source,operator,options) {\n\tvar field = operator.operand || \"list\",\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.findListingsOfTiddler(title,field));\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/listed.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/listops.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/listops.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operators for manipulating the current selection list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOrder a list\n*/\nexports.order = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.operand.toLowerCase() === \"reverse\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.unshift(title);\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\t\t\n\t}\n\treturn results;\n};\n\n/*\nReverse list\n*/\nexports.reverse = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.unshift(title);\n\t});\n\treturn results;\n};\n\n/*\nFirst entry/entries in list\n*/\nexports.first = function(source,operator,options) {\n\tvar count = parseInt(operator.operand) || 1,\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(0,count);\n};\n\n/*\nLast entry/entries in list\n*/\nexports.last = function(source,operator,options) {\n\tvar count = parseInt(operator.operand) || 1,\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(-count);\n};\n\n/*\nAll but the first entry/entries of the list\n*/\nexports.rest = function(source,operator,options) {\n\tvar count = parseInt(operator.operand) || 1,\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(count);\n};\nexports.butfirst = exports.rest;\nexports.bf = exports.rest;\n\n/*\nAll but the last entry/entries of the list\n*/\nexports.butlast = function(source,operator,options) {\n\tvar count = parseInt(operator.operand) || 1,\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(0,-count);\n};\nexports.bl = exports.butlast;\n\n/*\nThe nth member of the list\n*/\nexports.nth = function(source,operator,options) {\n\tvar count = parseInt(operator.operand) || 1,\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(count - 1,count);\n};\n\n})();\n",
"title": "$:/core/modules/filters/listops.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/minlength.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/minlength.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for filtering out titles that don't meet the minimum length in the operand\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.minlength = function(source,operator,options) {\n\tvar results = [],\n\t\tminLength = parseInt(operator.operand || \"\",10) || 0;\n\tsource(function(tiddler,title) {\n\t\tif(title.length >= minLength) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/minlength.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/modules.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/modules.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the titles of the modules of a given type in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.modules = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {\n\t\t\tresults.push(moduleName);\n\t\t});\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/modules.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/moduletypes.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/moduletypes.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the module types in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.moduletypes = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.modules.types,function(moduleInfo,type) {\n\t\tresults.push(type);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/moduletypes.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/next.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/next.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs next in the list supplied in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.next = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tsource(function(tiddler,title) {\n\t\tvar match = list.indexOf(title);\n\t\t// increment match and then test if result is in range\n\t\tmatch++;\n\t\tif(match > 0 && match < list.length) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/next.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/plugintiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/plugintiddlers.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the titles of the shadow tiddlers within a plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.plugintiddlers = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar pluginInfo = options.wiki.getPluginInfo(title) || options.wiki.getTiddlerDataCached(title,{tiddlers:[]});\n\t\tif(pluginInfo && pluginInfo.tiddlers) {\n\t\t\t$tw.utils.each(pluginInfo.tiddlers,function(fields,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/plugintiddlers.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/prefix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/prefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title starts with a prefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.prefix = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(0,operator.operand.length) !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(0,operator.operand.length) === operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/prefix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/previous.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/previous.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs immediately prior in the list supplied in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.previous = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tsource(function(tiddler,title) {\n\t\tvar match = list.indexOf(title);\n\t\t// increment match and then test if result is in range\n\t\tmatch--;\n\t\tif(match >= 0) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/previous.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/regexp.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/regexp.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for regexp matching\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.regexp = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldname = (operator.suffix || \"title\").toLowerCase(),\n\t\tregexpString, regexp, flags = \"\", match,\n\t\tgetFieldString = function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\treturn tiddler.getFieldString(fieldname);\n\t\t\t} else if(fieldname === \"title\") {\n\t\t\t\treturn title;\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t};\n\t// Process flags and construct regexp\n\tregexpString = operator.operand;\n\tmatch = /^\\(\\?([gim]+)\\)/.exec(regexpString);\n\tif(match) {\n\t\tflags = match[1];\n\t\tregexpString = regexpString.substr(match[0].length);\n\t} else {\n\t\tmatch = /\\(\\?([gim]+)\\)$/.exec(regexpString);\n\t\tif(match) {\n\t\t\tflags = match[1];\n\t\t\tregexpString = regexpString.substr(0,regexpString.length - match[0].length);\n\t\t}\n\t}\n\ttry {\n\t\tregexp = new RegExp(regexpString,flags);\n\t} catch(e) {\n\t\treturn [\"\" + e];\n\t}\n\t// Process the incoming tiddlers\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tvar text = getFieldString(tiddler,title);\n\t\t\tif(text !== null) {\n\t\t\t\tif(!regexp.exec(text)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tvar text = getFieldString(tiddler,title);\n\t\t\tif(text !== null) {\n\t\t\t\tif(!!regexp.exec(text)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/regexp.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/removeprefix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/removeprefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for removing a prefix from each title in the list. Titles that do not start with the prefix are removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.removeprefix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(title.substr(0,operator.operand.length) === operator.operand) {\n\t\t\tresults.push(title.substr(operator.operand.length));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/removeprefix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/removesuffix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/removesuffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for removing a suffix from each title in the list. Titles that do not end with the suffix are removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.removesuffix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(title.substr(-operator.operand.length) === operator.operand) {\n\t\t\tresults.push(title.substr(0,title.length - operator.operand.length));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/removesuffix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sameday.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/sameday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects tiddlers with a modified date field on the same day as the provided value.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sameday = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldName = operator.suffix || \"modified\",\n\t\ttargetDate = (new Date($tw.utils.parseDate(operator.operand))).setHours(0,0,0,0);\n\t// Function to convert a date/time to a date integer\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tif(tiddler.getFieldDay(fieldName) === targetDate) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/sameday.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/search.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/search.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for searching for the text in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.search = function(source,operator,options) {\n\tvar invert = operator.prefix === \"!\";\n\tif(operator.suffix) {\n\t\treturn options.wiki.search(operator.operand,{\n\t\t\tsource: source,\n\t\t\tinvert: invert,\n\t\t\tfield: operator.suffix\n\t\t});\n\t} else {\n\t\treturn options.wiki.search(operator.operand,{\n\t\t\tsource: source,\n\t\t\tinvert: invert\n\t\t});\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/search.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/shadowsource.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/shadowsource.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the source plugins for shadow tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadowsource = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar source = options.wiki.getShadowSource(title);\n\t\tif(source) {\n\t\t\t$tw.utils.pushTop(results,source);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/shadowsource.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sort.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/sort.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for sorting\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sort = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",false,false);\n\treturn results;\n};\n\nexports.nsort = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",false,true);\n\treturn results;\n};\n\nexports.sortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",true,false);\n\treturn results;\n};\n\nexports.nsortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",true,true);\n\treturn results;\n};\n\nvar prepare_results = function (source) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/sort.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/splitbefore.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/splitbefore.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that splits each result on the first occurance of the specified separator and returns the unique values.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.splitbefore = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar parts = title.split(operator.operand);\n\t\tif(parts.length === 1) {\n\t\t\t$tw.utils.pushTop(results,parts[0]);\n\t\t} else {\n\t\t\t$tw.utils.pushTop(results,parts[0] + operator.operand);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/splitbefore.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/storyviews.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/storyviews.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the story views in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.storyviews = function(source,operator,options) {\n\tvar results = [],\n\t\tstoryviews = {};\n\t$tw.modules.applyMethods(\"storyview\",storyviews);\n\t$tw.utils.each(storyviews,function(info,name) {\n\t\tresults.push(name);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/storyviews.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/suffix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/suffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title ends with a suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.suffix = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(-operator.operand.length) !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(-operator.operand.length) === operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/suffix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tag.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tag.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking for the presence of a tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,operator,options) {\n\tvar results = [];\n\tif((operator.suffix || \"\").toLowerCase() === \"strict\" && !operator.operand) {\n\t\t// New semantics:\n\t\t// Always return copy of input if operator.operand is missing\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t} else {\n\t\t// Old semantics:\n\t\tif(operator.prefix === \"!\") {\n\t\t\t// Returns a copy of the input if operator.operand is missing\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && !tiddler.hasTag(operator.operand)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\t// Returns empty results if operator.operand is missing\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && tiddler.hasTag(operator.operand)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t\tresults = options.wiki.sortByList(results,operator.operand);\n\t\t}\t\t\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/tag.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tagging.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tagging.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that are tagged with the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tagging = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlersWithTag(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/tagging.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tags.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tags.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all the tags of the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,operator,options) {\n\tvar tags = {};\n\tsource(function(tiddler,title) {\n\t\tvar t, length;\n\t\tif(tiddler && tiddler.fields.tags) {\n\t\t\tfor(t=0, length=tiddler.fields.tags.length; t<length; t++) {\n\t\t\t\ttags[tiddler.fields.tags[t]] = true;\n\t\t\t}\n\t\t}\n\t});\n\treturn Object.keys(tags);\n};\n\n})();\n",
"title": "$:/core/modules/filters/tags.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/title.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/title.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing title fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.title = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields.title !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tresults.push(operator.operand);\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/title.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/untagged.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/untagged.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all the selected tiddlers that are untagged\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.untagged = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) {\n\t\t\t\t$tw.utils.pushTop(results,title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!tiddler || !tiddler.hasField(\"tags\") || ($tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length === 0)) {\n\t\t\t\t$tw.utils.pushTop(results,title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/untagged.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/wikiparserrules.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/wikiparserrules.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the wiki parser rules in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.wikiparserrules = function(source,operator,options) {\n\tvar results = [],\n\t\toperand = operator.operand;\n\t$tw.utils.each($tw.modules.types.wikirule,function(mod) {\n\t\tvar exp = mod.exports;\n\t\tif(!operand || exp.types[operand]) {\n\t\t\tresults.push(exp.name);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/wikiparserrules.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/x-listops.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/x-listops.js\ntype: application/javascript\nmodule-type: filteroperator\n\nExtended filter operators to manipulate the current list.\n\n\\*/\n(function () {\n\n /*jslint node: true, browser: true */\n /*global $tw: false */\n \"use strict\";\n\n /*\n Fetch titles from the current list\n */\n var prepare_results = function (source) {\n var results = [];\n source(function (tiddler, title) {\n results.push(title);\n });\n return results;\n };\n\n /*\n Moves a number of items from the tail of the current list before the item named in the operand\n */\n exports.putbefore = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand),\n count = parseInt(operator.suffix) || 1;\n return (index === -1) ?\n results.slice(0, -1) :\n results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));\n };\n\n /*\n Moves a number of items from the tail of the current list after the item named in the operand\n */\n exports.putafter = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand),\n count = parseInt(operator.suffix) || 1;\n return (index === -1) ?\n results.slice(0, -1) :\n results.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));\n };\n\n /*\n Replaces the item named in the operand with a number of items from the tail of the current list\n */\n exports.replace = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand),\n count = parseInt(operator.suffix) || 1;\n return (index === -1) ?\n results.slice(0, -count) :\n results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));\n };\n\n /*\n Moves a number of items from the tail of the current list to the head of the list\n */\n exports.putfirst = function (source, operator) {\n var results = prepare_results(source),\n count = parseInt(operator.suffix) || 1;\n return results.slice(-count).concat(results.slice(0, -count));\n };\n\n /*\n Moves a number of items from the head of the current list to the tail of the list\n */\n exports.putlast = function (source, operator) {\n var results = prepare_results(source),\n count = parseInt(operator.suffix) || 1;\n return results.slice(count).concat(results.slice(0, count));\n };\n\n /*\n Moves the item named in the operand a number of places forward or backward in the list\n */\n exports.move = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand),\n count = parseInt(operator.suffix) || 1,\n marker = results.splice(index, 1),\n offset = (index + count) > 0 ? index + count : 0;\n return results.slice(0, offset).concat(marker).concat(results.slice(offset));\n };\n\n /*\n Returns the items from the current list that are after the item named in the operand\n */\n exports.allafter = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand);\n return (index === -1 || index > (results.length - 2)) ? [] :\n (operator.suffix) ? results.slice(index) :\n results.slice(index + 1);\n };\n\n /*\n Returns the items from the current list that are before the item named in the operand\n */\n exports.allbefore = function (source, operator) {\n var results = prepare_results(source),\n index = results.indexOf(operator.operand);\n return (index <= 0) ? [] :\n (operator.suffix) ? results.slice(0, index + 1) :\n results.slice(0, index);\n };\n\n /*\n Appends the items listed in the operand array to the tail of the current list\n */\n exports.append = function (source, operator) {\n var append = $tw.utils.parseStringArray(operator.operand, \"true\"),\n results = prepare_results(source),\n count = parseInt(operator.suffix) || append.length;\n return (append.length === 0) ? results :\n (operator.prefix) ? results.concat(append.slice(-count)) :\n results.concat(append.slice(0, count));\n };\n\n /*\n Prepends the items listed in the operand array to the head of the current list\n */\n exports.prepend = function (source, operator) {\n var prepend = $tw.utils.parseStringArray(operator.operand, \"true\"),\n results = prepare_results(source),\n count = parseInt(operator.suffix) || prepend.length;\n return (prepend.length === 0) ? results :\n (operator.prefix) ? prepend.slice(-count).concat(results) :\n prepend.slice(0, count).concat(results);\n };\n\n /*\n Returns all items from the current list except the items listed in the operand array\n */\n exports.remove = function (source, operator) {\n var array = $tw.utils.parseStringArray(operator.operand, \"true\"),\n results = prepare_results(source),\n count = parseInt(operator.suffix) || array.length,\n p,\n len,\n index;\n len = array.length - 1;\n for (p = 0; p < count; ++p) {\n if (operator.prefix) {\n index = results.indexOf(array[len - p]);\n } else {\n index = results.indexOf(array[p]);\n }\n if (index !== -1) {\n results.splice(index, 1);\n }\n }\n return results;\n };\n\n /*\n Returns all items from the current list sorted in the order of the items in the operand array\n */\n exports.sortby = function (source, operator) {\n var results = prepare_results(source);\n if (!results || results.length < 2) {\n return results;\n }\n var lookup = $tw.utils.parseStringArray(operator.operand, \"true\");\n results.sort(function (a, b) {\n return lookup.indexOf(a) - lookup.indexOf(b);\n });\n return results;\n };\n\n /*\n Removes all duplicate items from the current list\n */\n exports.unique = function (source, operator) {\n var results = prepare_results(source);\n var set = results.reduce(function (a, b) {\n if (a.indexOf(b) < 0) {\n a.push(b);\n }\n return a;\n }, []);\n return set;\n };\n})();\n",
"title": "$:/core/modules/filters/x-listops.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters.js": {
"text": "/*\\\ntitle: $:/core/modules/filters.js\ntype: application/javascript\nmodule-type: wikimethod\n\nAdds tiddler filtering methods to the $tw.Wiki object.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParses an operation (i.e. a run) within a filter string\n\toperators: Array of array of operator nodes into which results should be inserted\n\tfilterString: filter string\n\tp: start position within the string\nReturns the new start position, after the parsed operation\n*/\nfunction parseFilterOperation(operators,filterString,p) {\n\tvar nextBracketPos, operator;\n\t// Skip the starting square bracket\n\tif(filterString.charAt(p++) !== \"[\") {\n\t\tthrow \"Missing [ in filter expression\";\n\t}\n\t// Process each operator in turn\n\tdo {\n\t\toperator = {};\n\t\t// Check for an operator prefix\n\t\tif(filterString.charAt(p) === \"!\") {\n\t\t\toperator.prefix = filterString.charAt(p++);\n\t\t}\n\t\t// Get the operator name\n\t\tnextBracketPos = filterString.substring(p).search(/[\\[\\{<\\/]/);\n\t\tif(nextBracketPos === -1) {\n\t\t\tthrow \"Missing [ in filter expression\";\n\t\t}\n\t\tnextBracketPos += p;\n\t\tvar bracket = filterString.charAt(nextBracketPos);\n\t\toperator.operator = filterString.substring(p,nextBracketPos);\n\n\t\t// Any suffix?\n\t\tvar colon = operator.operator.indexOf(':');\n\t\tif(colon > -1) {\n\t\t\toperator.suffix = operator.operator.substring(colon + 1);\n\t\t\toperator.operator = operator.operator.substring(0,colon) || \"field\";\n\t\t}\n\t\t// Empty operator means: title\n\t\telse if(operator.operator === \"\") {\n\t\t\toperator.operator = \"title\";\n\t\t}\n\n\t\tp = nextBracketPos + 1;\n\t\tswitch (bracket) {\n\t\t\tcase \"{\": // Curly brackets\n\t\t\t\toperator.indirect = true;\n\t\t\t\tnextBracketPos = filterString.indexOf(\"}\",p);\n\t\t\t\tbreak;\n\t\t\tcase \"[\": // Square brackets\n\t\t\t\tnextBracketPos = filterString.indexOf(\"]\",p);\n\t\t\t\tbreak;\n\t\t\tcase \"<\": // Angle brackets\n\t\t\t\toperator.variable = true;\n\t\t\t\tnextBracketPos = filterString.indexOf(\">\",p);\n\t\t\t\tbreak;\n\t\t\tcase \"/\": // regexp brackets\n\t\t\t\tvar rex = /^((?:[^\\\\\\/]*|\\\\.)*)\\/(?:\\(([mygi]+)\\))?/g,\n\t\t\t\t\trexMatch = rex.exec(filterString.substring(p));\n\t\t\t\tif(rexMatch) {\n\t\t\t\t\toperator.regexp = new RegExp(rexMatch[1], rexMatch[2]);\n// DEPRECATION WARNING\nconsole.log(\"WARNING: Filter\",operator.operator,\"has a deprecated regexp operand\",operator.regexp);\n\t\t\t\t\tnextBracketPos = p + rex.lastIndex - 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow \"Unterminated regular expression in filter expression\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif(nextBracketPos === -1) {\n\t\t\tthrow \"Missing closing bracket in filter expression\";\n\t\t}\n\t\tif(!operator.regexp) {\n\t\t\toperator.operand = filterString.substring(p,nextBracketPos);\n\t\t}\n\t\tp = nextBracketPos + 1;\n\n\t\t// Push this operator\n\t\toperators.push(operator);\n\t} while(filterString.charAt(p) !== \"]\");\n\t// Skip the ending square bracket\n\tif(filterString.charAt(p++) !== \"]\") {\n\t\tthrow \"Missing ] in filter expression\";\n\t}\n\t// Return the parsing position\n\treturn p;\n}\n\n/*\nParse a filter string\n*/\nexports.parseFilter = function(filterString) {\n\tfilterString = filterString || \"\";\n\tvar results = [], // Array of arrays of operator nodes {operator:,operand:}\n\t\tp = 0, // Current position in the filter string\n\t\tmatch;\n\tvar whitespaceRegExp = /(\\s+)/mg,\n\t\toperandRegExp = /((?:\\+|\\-)?)(?:(\\[)|(?:\"([^\"]*)\")|(?:'([^']*)')|([^\\s\\[\\]]+))/mg;\n\twhile(p < filterString.length) {\n\t\t// Skip any whitespace\n\t\twhitespaceRegExp.lastIndex = p;\n\t\tmatch = whitespaceRegExp.exec(filterString);\n\t\tif(match && match.index === p) {\n\t\t\tp = p + match[0].length;\n\t\t}\n\t\t// Match the start of the operation\n\t\tif(p < filterString.length) {\n\t\t\toperandRegExp.lastIndex = p;\n\t\t\tmatch = operandRegExp.exec(filterString);\n\t\t\tif(!match || match.index !== p) {\n\t\t\t\tthrow $tw.language.getString(\"Error/FilterSyntax\");\n\t\t\t}\n\t\t\tvar operation = {\n\t\t\t\tprefix: \"\",\n\t\t\t\toperators: []\n\t\t\t};\n\t\t\tif(match[1]) {\n\t\t\t\toperation.prefix = match[1];\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tif(match[2]) { // Opening square bracket\n\t\t\t\tp = parseFilterOperation(operation.operators,filterString,p);\n\t\t\t} else {\n\t\t\t\tp = match.index + match[0].length;\n\t\t\t}\n\t\t\tif(match[3] || match[4] || match[5]) { // Double quoted string, single quoted string or unquoted title\n\t\t\t\toperation.operators.push(\n\t\t\t\t\t{operator: \"title\", operand: match[3] || match[4] || match[5]}\n\t\t\t\t);\n\t\t\t}\n\t\t\tresults.push(operation);\n\t\t}\n\t}\n\treturn results;\n};\n\nexports.getFilterOperators = function() {\n\tif(!this.filterOperators) {\n\t\t$tw.Wiki.prototype.filterOperators = {};\n\t\t$tw.modules.applyMethods(\"filteroperator\",this.filterOperators);\n\t}\n\treturn this.filterOperators;\n};\n\nexports.filterTiddlers = function(filterString,widget,source) {\n\tvar fn = this.compileFilter(filterString);\n\treturn fn.call(this,source,widget);\n};\n\n/*\nCompile a filter into a function with the signature fn(source,widget) where:\nsource: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)\nwidget: an optional widget node for retrieving the current tiddler etc.\n*/\nexports.compileFilter = function(filterString) {\n\tvar filterParseTree;\n\ttry {\n\t\tfilterParseTree = this.parseFilter(filterString);\n\t} catch(e) {\n\t\treturn function(source,widget) {\n\t\t\treturn [$tw.language.getString(\"Error/Filter\") + \": \" + e];\n\t\t};\n\t}\n\t// Get the hashmap of filter operator functions\n\tvar filterOperators = this.getFilterOperators();\n\t// Assemble array of functions, one for each operation\n\tvar operationFunctions = [];\n\t// Step through the operations\n\tvar self = this;\n\t$tw.utils.each(filterParseTree,function(operation) {\n\t\t// Create a function for the chain of operators in the operation\n\t\tvar operationSubFunction = function(source,widget) {\n\t\t\tvar accumulator = source,\n\t\t\t\tresults = [],\n\t\t\t\tcurrTiddlerTitle = widget && widget.getVariable(\"currentTiddler\");\n\t\t\t$tw.utils.each(operation.operators,function(operator) {\n\t\t\t\tvar operand = operator.operand,\n\t\t\t\t\toperatorFunction;\n\t\t\t\tif(!operator.operator) {\n\t\t\t\t\toperatorFunction = filterOperators.title;\n\t\t\t\t} else if(!filterOperators[operator.operator]) {\n\t\t\t\t\toperatorFunction = filterOperators.field;\n\t\t\t\t} else {\n\t\t\t\t\toperatorFunction = filterOperators[operator.operator];\n\t\t\t\t}\n\t\t\t\tif(operator.indirect) {\n\t\t\t\t\toperand = self.getTextReference(operator.operand,\"\",currTiddlerTitle);\n\t\t\t\t}\n\t\t\t\tif(operator.variable) {\n\t\t\t\t\toperand = widget.getVariable(operator.operand,{defaultValue: \"\"});\n\t\t\t\t}\n\t\t\t\t// Invoke the appropriate filteroperator module\n\t\t\t\tresults = operatorFunction(accumulator,{\n\t\t\t\t\t\t\toperator: operator.operator,\n\t\t\t\t\t\t\toperand: operand,\n\t\t\t\t\t\t\tprefix: operator.prefix,\n\t\t\t\t\t\t\tsuffix: operator.suffix,\n\t\t\t\t\t\t\tregexp: operator.regexp\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\twiki: self,\n\t\t\t\t\t\t\twidget: widget\n\t\t\t\t\t\t});\n\t\t\t\tif($tw.utils.isArray(results)) {\n\t\t\t\t\taccumulator = self.makeTiddlerIterator(results);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator = results;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif($tw.utils.isArray(results)) {\n\t\t\t\treturn results;\n\t\t\t} else {\n\t\t\t\tvar resultArray = [];\n\t\t\t\tresults(function(tiddler,title) {\n\t\t\t\t\tresultArray.push(title);\n\t\t\t\t});\n\t\t\t\treturn resultArray;\n\t\t\t}\n\t\t};\n\t\t// Wrap the operator functions in a wrapper function that depends on the prefix\n\t\toperationFunctions.push((function() {\n\t\t\tswitch(operation.prefix || \"\") {\n\t\t\t\tcase \"\": // No prefix means that the operation is unioned into the result\n\t\t\t\t\treturn function(results,source,widget) {\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,widget));\n\t\t\t\t\t};\n\t\t\t\tcase \"-\": // The results of this operation are removed from the main result\n\t\t\t\t\treturn function(results,source,widget) {\n\t\t\t\t\t\t$tw.utils.removeArrayEntries(results,operationSubFunction(source,widget));\n\t\t\t\t\t};\n\t\t\t\tcase \"+\": // This operation is applied to the main results so far\n\t\t\t\t\treturn function(results,source,widget) {\n\t\t\t\t\t\t// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved\n\t\t\t\t\t\tsource = self.makeTiddlerIterator(results);\n\t\t\t\t\t\tresults.splice(0,results.length);\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,widget));\n\t\t\t\t\t};\n\t\t\t}\n\t\t})());\n\t});\n\t// Return a function that applies the operations to a source iterator of tiddler titles\n\treturn $tw.perf.measure(\"filter\",function filterFunction(source,widget) {\n\t\tif(!source) {\n\t\t\tsource = self.each;\n\t\t} else if(typeof source === \"object\") { // Array or hashmap\n\t\t\tsource = self.makeTiddlerIterator(source);\n\t\t}\n\t\tvar results = [];\n\t\t$tw.utils.each(operationFunctions,function(operationFunction) {\n\t\t\toperationFunction(results,source,widget);\n\t\t});\n\t\treturn results;\n\t});\n};\n\n})();\n",
"title": "$:/core/modules/filters.js",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/modules/info/platform.js": {
"text": "/*\\\ntitle: $:/core/modules/info/platform.js\ntype: application/javascript\nmodule-type: info\n\nInitialise basic platform $:/info/ tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.getInfoTiddlerFields = function() {\n\tvar mapBoolean = function(value) {return value ? \"yes\" : \"no\";},\n\t\tinfoTiddlerFields = [];\n\t// Basics\n\tinfoTiddlerFields.push({title: \"$:/info/browser\", text: mapBoolean(!!$tw.browser)});\n\tinfoTiddlerFields.push({title: \"$:/info/node\", text: mapBoolean(!!$tw.node)});\n\t// Document location\n\tif($tw.browser) {\n\t\tvar setLocationProperty = function(name,value) {\n\t\t\t\tinfoTiddlerFields.push({title: \"$:/info/url/\" + name, text: value});\t\t\t\n\t\t\t},\n\t\t\tlocation = document.location;\n\t\tsetLocationProperty(\"full\", (location.toString()).split(\"#\")[0]);\n\t\tsetLocationProperty(\"host\", location.host);\n\t\tsetLocationProperty(\"hostname\", location.hostname);\n\t\tsetLocationProperty(\"protocol\", location.protocol);\n\t\tsetLocationProperty(\"port\", location.port);\n\t\tsetLocationProperty(\"pathname\", location.pathname);\n\t\tsetLocationProperty(\"search\", location.search);\n\t\tsetLocationProperty(\"origin\", location.origin);\n\t}\n\treturn infoTiddlerFields;\n};\n\n})();\n",
"title": "$:/core/modules/info/platform.js",
"type": "application/javascript",
"module-type": "info"
},
"$:/core/modules/keyboard.js": {
"text": "/*\\\ntitle: $:/core/modules/keyboard.js\ntype: application/javascript\nmodule-type: global\n\nKeyboard handling utilities\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar namedKeys = {\n\t\"cancel\": 3,\n\t\"help\": 6,\n\t\"backspace\": 8,\n\t\"tab\": 9,\n\t\"clear\": 12,\n\t\"return\": 13,\n\t\"enter\": 13,\n\t\"pause\": 19,\n\t\"escape\": 27,\n\t\"space\": 32,\n\t\"page_up\": 33,\n\t\"page_down\": 34,\n\t\"end\": 35,\n\t\"home\": 36,\n\t\"left\": 37,\n\t\"up\": 38,\n\t\"right\": 39,\n\t\"down\": 40,\n\t\"printscreen\": 44,\n\t\"insert\": 45,\n\t\"delete\": 46,\n\t\"0\": 48,\n\t\"1\": 49,\n\t\"2\": 50,\n\t\"3\": 51,\n\t\"4\": 52,\n\t\"5\": 53,\n\t\"6\": 54,\n\t\"7\": 55,\n\t\"8\": 56,\n\t\"9\": 57,\n\t\"firefoxsemicolon\": 59,\n\t\"firefoxequals\": 61,\n\t\"a\": 65,\n\t\"b\": 66,\n\t\"c\": 67,\n\t\"d\": 68,\n\t\"e\": 69,\n\t\"f\": 70,\n\t\"g\": 71,\n\t\"h\": 72,\n\t\"i\": 73,\n\t\"j\": 74,\n\t\"k\": 75,\n\t\"l\": 76,\n\t\"m\": 77,\n\t\"n\": 78,\n\t\"o\": 79,\n\t\"p\": 80,\n\t\"q\": 81,\n\t\"r\": 82,\n\t\"s\": 83,\n\t\"t\": 84,\n\t\"u\": 85,\n\t\"v\": 86,\n\t\"w\": 87,\n\t\"x\": 88,\n\t\"y\": 89,\n\t\"z\": 90,\n\t\"numpad0\": 96,\n\t\"numpad1\": 97,\n\t\"numpad2\": 98,\n\t\"numpad3\": 99,\n\t\"numpad4\": 100,\n\t\"numpad5\": 101,\n\t\"numpad6\": 102,\n\t\"numpad7\": 103,\n\t\"numpad8\": 104,\n\t\"numpad9\": 105,\n\t\"multiply\": 106,\n\t\"add\": 107,\n\t\"separator\": 108,\n\t\"subtract\": 109,\n\t\"decimal\": 110,\n\t\"divide\": 111,\n\t\"f1\": 112,\n\t\"f2\": 113,\n\t\"f3\": 114,\n\t\"f4\": 115,\n\t\"f5\": 116,\n\t\"f6\": 117,\n\t\"f7\": 118,\n\t\"f8\": 119,\n\t\"f9\": 120,\n\t\"f10\": 121,\n\t\"f11\": 122,\n\t\"f12\": 123,\n\t\"f13\": 124,\n\t\"f14\": 125,\n\t\"f15\": 126,\n\t\"f16\": 127,\n\t\"f17\": 128,\n\t\"f18\": 129,\n\t\"f19\": 130,\n\t\"f20\": 131,\n\t\"f21\": 132,\n\t\"f22\": 133,\n\t\"f23\": 134,\n\t\"f24\": 135,\n\t\"firefoxminus\": 173,\n\t\"semicolon\": 186,\n\t\"equals\": 187,\n\t\"comma\": 188,\n\t\"dash\": 189,\n\t\"period\": 190,\n\t\"slash\": 191,\n\t\"backquote\": 192,\n\t\"openbracket\": 219,\n\t\"backslash\": 220,\n\t\"closebracket\": 221,\n\t\"quote\": 222\n};\n\nfunction KeyboardManager(options) {\n\tvar self = this;\n\toptions = options || \"\";\n\t// Save the named key hashmap\n\tthis.namedKeys = namedKeys;\n\t// Create a reverse mapping of code to keyname\n\tthis.keyNames = [];\n\t$tw.utils.each(namedKeys,function(keyCode,name) {\n\t\tself.keyNames[keyCode] = name.substr(0,1).toUpperCase() + name.substr(1);\n\t});\n\t// Save the platform-specific name of the \"meta\" key\n\tthis.metaKeyName = $tw.platform.isMac ? \"cmd-\" : \"win-\";\n}\n\n/*\nReturn an array of keycodes for the modifier keys ctrl, shift, alt, meta\n*/\nKeyboardManager.prototype.getModifierKeys = function() {\n\treturn [\n\t\t16, // Shift\n\t\t17, // Ctrl\n\t\t18, // Alt\n\t\t20, // CAPS LOCK\n\t\t91, // Meta (left)\n\t\t93, // Meta (right)\n\t\t224 // Meta (Firefox)\n\t]\n};\n\n/*\nParses a key descriptor into the structure:\n{\n\tkeyCode: numeric keycode\n\tshiftKey: boolean\n\taltKey: boolean\n\tctrlKey: boolean\n\tmetaKey: boolean\n}\nKey descriptors have the following format:\n\tctrl+enter\n\tctrl+shift+alt+A\n*/\nKeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) {\n\tvar components = keyDescriptor.split(/\\+|\\-/),\n\t\tinfo = {\n\t\t\tkeyCode: 0,\n\t\t\tshiftKey: false,\n\t\t\taltKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\tfor(var t=0; t<components.length; t++) {\n\t\tvar s = components[t].toLowerCase(),\n\t\t\tc = s.charCodeAt(0);\n\t\t// Look for modifier keys\n\t\tif(s === \"ctrl\") {\n\t\t\tinfo.ctrlKey = true;\n\t\t} else if(s === \"shift\") {\n\t\t\tinfo.shiftKey = true;\n\t\t} else if(s === \"alt\") {\n\t\t\tinfo.altKey = true;\n\t\t} else if(s === \"meta\" || s === \"cmd\" || s === \"win\") {\n\t\t\tinfo.metaKey = true;\n\t\t}\n\t\t// Replace named keys with their code\n\t\tif(this.namedKeys[s]) {\n\t\t\tinfo.keyCode = this.namedKeys[s];\n\t\t}\n\t}\n\tif(info.keyCode) {\n\t\treturn info;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nParse a list of key descriptors into an array of keyInfo objects. The key descriptors can be passed as an array of strings or a space separated string\n*/\nKeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options) {\n\tvar self = this;\n\toptions = options || {};\n\toptions.stack = options.stack || [];\n\tvar wiki = options.wiki || $tw.wiki;\n\tif(typeof keyDescriptors === \"string\" && keyDescriptors === \"\") {\n\t\treturn [];\n\t}\n\tif(!$tw.utils.isArray(keyDescriptors)) {\n\t\tkeyDescriptors = keyDescriptors.split(\" \");\n\t}\n\tvar result = [];\n\t$tw.utils.each(keyDescriptors,function(keyDescriptor) {\n\t\t// Look for a named shortcut\n\t\tif(keyDescriptor.substr(0,2) === \"((\" && keyDescriptor.substr(-2,2) === \"))\") {\n\t\t\tif(options.stack.indexOf(keyDescriptor) === -1) {\n\t\t\t\toptions.stack.push(keyDescriptor);\n\t\t\t\tvar name = keyDescriptor.substring(2,keyDescriptor.length - 2),\n\t\t\t\t\tlookupName = function(configName) {\n\t\t\t\t\t\tvar keyDescriptors = wiki.getTiddlerText(\"$:/config/\" + configName + \"/\" + name);\n\t\t\t\t\t\tif(keyDescriptors) {\n\t\t\t\t\t\t\tresult.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options));\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\tlookupName(\"shortcuts\");\n\t\t\t\tlookupName($tw.platform.isMac ? \"shortcuts-mac\" : \"shortcuts-not-mac\");\n\t\t\t\tlookupName($tw.platform.isWindows ? \"shortcuts-windows\" : \"shortcuts-not-windows\");\n\t\t\t\tlookupName($tw.platform.isLinux ? \"shortcuts-linux\" : \"shortcuts-not-linux\");\n\t\t\t}\n\t\t} else {\n\t\t\tresult.push(self.parseKeyDescriptor(keyDescriptor));\n\t\t}\n\t});\n\treturn result;\n};\n\nKeyboardManager.prototype.getPrintableShortcuts = function(keyInfoArray) {\n\tvar self = this,\n\t\tresult = [];\n\t$tw.utils.each(keyInfoArray,function(keyInfo) {\n\t\tif(keyInfo) {\n\t\t\tresult.push((keyInfo.ctrlKey ? \"ctrl-\" : \"\") + \n\t\t\t\t (keyInfo.shiftKey ? \"shift-\" : \"\") + \n\t\t\t\t (keyInfo.altKey ? \"alt-\" : \"\") + \n\t\t\t\t (keyInfo.metaKey ? self.metaKeyName : \"\") + \n\t\t\t\t (self.keyNames[keyInfo.keyCode]));\n\t\t}\n\t});\n\treturn result;\n}\n\nKeyboardManager.prototype.checkKeyDescriptor = function(event,keyInfo) {\n\treturn keyInfo &&\n\t\t\tevent.keyCode === keyInfo.keyCode && \n\t\t\tevent.shiftKey === keyInfo.shiftKey && \n\t\t\tevent.altKey === keyInfo.altKey && \n\t\t\tevent.ctrlKey === keyInfo.ctrlKey && \n\t\t\tevent.metaKey === keyInfo.metaKey;\n};\n\nKeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) {\n\tfor(var t=0; t<keyInfoArray.length; t++) {\n\t\tif(this.checkKeyDescriptor(event,keyInfoArray[t])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\nexports.KeyboardManager = KeyboardManager;\n\n})();\n",
"title": "$:/core/modules/keyboard.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/language.js": {
"text": "/*\\\ntitle: $:/core/modules/language.js\ntype: application/javascript\nmodule-type: global\n\nThe $tw.Language() manages translateable strings\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate an instance of the language manager. Options include:\nwiki: wiki from which to retrieve translation tiddlers\n*/\nfunction Language(options) {\n\toptions = options || \"\";\n\tthis.wiki = options.wiki || $tw.wiki;\n}\n\n/*\nReturn a wikified translateable string. The title is automatically prefixed with \"$:/language/\"\nOptions include:\nvariables: optional hashmap of variables to supply to the language wikification\n*/\nLanguage.prototype.getString = function(title,options) {\n\toptions = options || {};\n\ttitle = \"$:/language/\" + title;\n\treturn this.wiki.renderTiddler(\"text/plain\",title,{variables: options.variables});\n};\n\n/*\nReturn a raw, unwikified translateable string. The title is automatically prefixed with \"$:/language/\"\n*/\nLanguage.prototype.getRawString = function(title) {\n\ttitle = \"$:/language/\" + title;\n\treturn this.wiki.getTiddlerText(title);\n};\n\nexports.Language = Language;\n\n})();\n",
"title": "$:/core/modules/language.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/macros/changecount.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/changecount.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the changecount for the current tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"changecount\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn this.wiki.getChangeCount(this.getVariable(\"currentTiddler\")) + \"\";\n};\n\n})();\n",
"title": "$:/core/modules/macros/changecount.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/contrastcolour.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/contrastcolour.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to choose which of two colours has the highest contrast with a base colour\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"contrastcolour\";\n\nexports.params = [\n\t{name: \"target\"},\n\t{name: \"fallbackTarget\"},\n\t{name: \"colourA\"},\n\t{name: \"colourB\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(target,fallbackTarget,colourA,colourB) {\n\tvar rgbTarget = $tw.utils.parseCSSColor(target) || $tw.utils.parseCSSColor(fallbackTarget);\n\tif(!rgbTarget) {\n\t\treturn colourA;\n\t}\n\tvar rgbColourA = $tw.utils.parseCSSColor(colourA),\n\t\trgbColourB = $tw.utils.parseCSSColor(colourB);\n\tif(rgbColourA && !rgbColourB) {\n\t\treturn rgbColourA;\n\t}\n\tif(rgbColourB && !rgbColourA) {\n\t\treturn rgbColourB;\n\t}\n\tif(!rgbColourA && !rgbColourB) {\n\t\t// If neither colour is readable, return a crude inverse of the target\n\t\treturn [255 - rgbTarget[0],255 - rgbTarget[1],255 - rgbTarget[2],rgbTarget[3]];\n\t}\n\t// Colour brightness formula derived from http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\tvar brightnessTarget = rgbTarget[0] * 0.299 + rgbTarget[1] * 0.587 + rgbTarget[2] * 0.114,\n\t\tbrightnessA = rgbColourA[0] * 0.299 + rgbColourA[1] * 0.587 + rgbColourA[2] * 0.114,\n\t\tbrightnessB = rgbColourB[0] * 0.299 + rgbColourB[1] * 0.587 + rgbColourB[2] * 0.114;\n\treturn Math.abs(brightnessTarget - brightnessA) > Math.abs(brightnessTarget - brightnessB) ? colourA : colourB;\n};\n\n})();\n",
"title": "$:/core/modules/macros/contrastcolour.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/csvtiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/csvtiddlers.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output tiddlers matching a filter to CSV\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"csvtiddlers\";\n\nexports.params = [\n\t{name: \"filter\"},\n\t{name: \"format\"},\n];\n\n/*\nRun the macro\n*/\nexports.run = function(filter,format) {\n\tvar self = this,\n\t\ttiddlers = this.wiki.filterTiddlers(filter),\n\t\ttiddler,\n\t\tfields = [],\n\t\tt,f;\n\t// Collect all the fields\n\tfor(t=0;t<tiddlers.length; t++) {\n\t\ttiddler = this.wiki.getTiddler(tiddlers[t]);\n\t\tfor(f in tiddler.fields) {\n\t\t\tif(fields.indexOf(f) === -1) {\n\t\t\t\tfields.push(f);\n\t\t\t}\n\t\t}\n\t}\n\t// Sort the fields and bring the standard ones to the front\n\tfields.sort();\n\t\"title text modified modifier created creator\".split(\" \").reverse().forEach(function(value,index) {\n\t\tvar p = fields.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tfields.splice(p,1);\n\t\t\tfields.unshift(value)\n\t\t}\n\t});\n\t// Output the column headings\n\tvar output = [], row = [];\n\tfields.forEach(function(value) {\n\t\trow.push(quoteAndEscape(value))\n\t});\n\toutput.push(row.join(\",\"));\n\t// Output each tiddler\n\tfor(var t=0;t<tiddlers.length; t++) {\n\t\trow = [];\n\t\ttiddler = this.wiki.getTiddler(tiddlers[t]);\n\t\t\tfor(f=0; f<fields.length; f++) {\n\t\t\t\trow.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || \"\" : \"\"));\n\t\t\t}\n\t\toutput.push(row.join(\",\"));\n\t}\n\treturn output.join(\"\\n\");\n};\n\nfunction quoteAndEscape(value) {\n\treturn \"\\\"\" + value.replace(/\"/mg,\"\\\"\\\"\") + \"\\\"\";\n}\n\n})();\n",
"title": "$:/core/modules/macros/csvtiddlers.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/displayshortcuts.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/displayshortcuts.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"displayshortcuts\";\n\nexports.params = [\n\t{name: \"shortcuts\"},\n\t{name: \"prefix\"},\n\t{name: \"separator\"},\n\t{name: \"suffix\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(shortcuts,prefix,separator,suffix) {\n\tvar shortcutArray = $tw.keyboardManager.getPrintableShortcuts($tw.keyboardManager.parseKeyDescriptors(shortcuts,{\n\t\twiki: this.wiki\n\t}));\n\tif(shortcutArray.length > 0) {\n\t\tshortcutArray.sort(function(a,b) {\n\t\t return a.toLowerCase().localeCompare(b.toLowerCase());\n\t\t})\n\t\treturn prefix + shortcutArray.join(separator) + suffix;\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/macros/displayshortcuts.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/dumpvariables.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/dumpvariables.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to dump all active variable values\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"dumpvariables\";\n\nexports.params = [\n];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\tvar output = [\"|!Variable |!Value |\"],\n\t\tvariables = [], variable;\n\tfor(variable in this.variables) {\n\t\tvariables.push(variable);\n\t}\n\tvariables.sort();\n\tfor(var index=0; index<variables.length; index++) {\n\t\tvar variable = variables[index];\n\t\toutput.push(\"|\" + variable + \" |<input size=50 value=<<\" + variable + \">>/> |\")\n\t}\n\treturn output.join(\"\\n\");\n};\n\n})();\n",
"title": "$:/core/modules/macros/dumpvariables.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/jsontiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/jsontiddler.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output a single tiddler to JSON\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"jsontiddler\";\n\nexports.params = [\n\t{name: \"title\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\ttitle = title || this.getVariable(\"currentTiddler\");\n\tvar tiddler = !!title && this.wiki.getTiddler(title),\n\t\tfields = new Object();\n\tif(tiddler) {\n\t\tfor(var field in tiddler.fields) {\n\t\t\tfields[field] = tiddler.getFieldString(field);\n\t\t}\n\t}\n\treturn JSON.stringify(fields,null,$tw.config.preferences.jsonSpaces);\n};\n\n})();\n",
"title": "$:/core/modules/macros/jsontiddler.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/jsontiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/jsontiddlers.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output tiddlers matching a filter to JSON\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"jsontiddlers\";\n\nexports.params = [\n\t{name: \"filter\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(filter) {\n\tvar tiddlers = this.wiki.filterTiddlers(filter),\n\t\tdata = [];\n\tfor(var t=0;t<tiddlers.length; t++) {\n\t\tvar tiddler = this.wiki.getTiddler(tiddlers[t]);\n\t\tif(tiddler) {\n\t\t\tvar fields = new Object();\n\t\t\tfor(var field in tiddler.fields) {\n\t\t\t\tfields[field] = tiddler.getFieldString(field);\n\t\t\t}\n\t\t\tdata.push(fields);\n\t\t}\n\t}\n\treturn JSON.stringify(data,null,$tw.config.preferences.jsonSpaces);\n};\n\n})();\n",
"title": "$:/core/modules/macros/jsontiddlers.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/makedatauri.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/makedatauri.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to convert a string of text to a data URI\n\n<<makedatauri text:\"Text to be converted\" type:\"text/vnd.tiddlywiki\">>\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"makedatauri\";\n\nexports.params = [\n\t{name: \"text\"},\n\t{name: \"type\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(text,type) {\n\treturn $tw.utils.makeDataUri(text,type);\n};\n\n})();\n",
"title": "$:/core/modules/macros/makedatauri.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/now.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/now.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return a formatted version of the current time\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"now\";\n\nexports.params = [\n\t{name: \"format\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(format) {\n\treturn $tw.utils.formatDateString(new Date(),format || \"0hh:0mm, DDth MMM YYYY\");\n};\n\n})();\n",
"title": "$:/core/modules/macros/now.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/qualify.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/qualify.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to qualify a state tiddler title according\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"qualify\";\n\nexports.params = [\n\t{name: \"title\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\treturn title + \"-\" + this.getStateQualifier();\n};\n\n})();\n",
"title": "$:/core/modules/macros/qualify.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/resolvepath.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/resolvepath.js\ntype: application/javascript\nmodule-type: macro\n\nResolves a relative path for an absolute rootpath.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"resolvepath\";\n\nexports.params = [\n\t{name: \"source\"},\n\t{name: \"root\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(source, root) {\n\treturn $tw.utils.resolvePath(source, root);\n};\n\n})();\n",
"title": "$:/core/modules/macros/resolvepath.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/version.js": {
"text": "/*\\\ntitle: $:/core/modules/macros/version.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the TiddlyWiki core version number\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"version\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn $tw.version;\n};\n\n})();\n",
"title": "$:/core/modules/macros/version.js",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/parsers/audioparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/audioparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe audio parser parses an audio tiddler into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar AudioParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"audio\",\n\t\t\tattributes: {\n\t\t\t\tcontrols: {type: \"string\", value: \"controls\"}\n\t\t\t}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"audio/ogg\"] = AudioParser;\nexports[\"audio/mpeg\"] = AudioParser;\nexports[\"audio/mp3\"] = AudioParser;\nexports[\"audio/mp4\"] = AudioParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/audioparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/csvparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/csvparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe CSV text parser processes CSV files into a table wrapped in a scrollable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar CsvParser = function(type,text,options) {\n\t// Table framework\n\tthis.tree = [{\n\t\t\"type\": \"scrollable\", \"children\": [{\n\t\t\t\"type\": \"element\", \"tag\": \"table\", \"children\": [{\n\t\t\t\t\"type\": \"element\", \"tag\": \"tbody\", \"children\": []\n\t\t\t}], \"attributes\": {\n\t\t\t\t\"class\": {\"type\": \"string\", \"value\": \"tc-csv-table\"}\n\t\t\t}\n\t\t}]\n\t}];\n\t// Split the text into lines\n\tvar lines = text.split(/\\r?\\n/mg),\n\t\ttag = \"th\";\n\tfor(var line=0; line<lines.length; line++) {\n\t\tvar lineText = lines[line];\n\t\tif(lineText) {\n\t\t\tvar row = {\n\t\t\t\t\t\"type\": \"element\", \"tag\": \"tr\", \"children\": []\n\t\t\t\t};\n\t\t\tvar columns = lineText.split(\",\");\n\t\t\tfor(var column=0; column<columns.length; column++) {\n\t\t\t\trow.children.push({\n\t\t\t\t\t\t\"type\": \"element\", \"tag\": tag, \"children\": [{\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": columns[column]\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\ttag = \"td\";\n\t\t\tthis.tree[0].children[0].children[0].children.push(row);\n\t\t}\n\t}\n};\n\nexports[\"text/csv\"] = CsvParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/csvparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/htmlparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/htmlparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe HTML parser displays text as raw HTML\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HtmlParser = function(type,text,options) {\n\tvar src;\n\tif(options._canonical_uri) {\n\t\tsrc = options._canonical_uri;\n\t} else if(text) {\n\t\tsrc = \"data:text/html;charset=utf-8,\" + encodeURIComponent(text);\n\t}\n\tthis.tree = [{\n\t\ttype: \"element\",\n\t\ttag: \"iframe\",\n\t\tattributes: {\n\t\t\tsrc: {type: \"string\", value: src},\n\t\t\tsandbox: {type: \"string\", value: \"\"}\n\t\t}\n\t}];\n};\n\nexports[\"text/html\"] = HtmlParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/htmlparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/imageparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/imageparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe image parser parses an image into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImageParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"img\",\n\t\t\tattributes: {}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\tif(type === \"image/svg+xml\" || type === \".svg\") {\n\t\t\telement.attributes.src = {type: \"string\", value: \"data:image/svg+xml,\" + encodeURIComponent(text)};\n\t\t} else {\n\t\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t\t}\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"image/svg+xml\"] = ImageParser;\nexports[\"image/jpg\"] = ImageParser;\nexports[\"image/jpeg\"] = ImageParser;\nexports[\"image/png\"] = ImageParser;\nexports[\"image/gif\"] = ImageParser;\nexports[\"image/x-icon\"] = ImageParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/imageparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/utils/parseutils.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/parseutils.js\ntype: application/javascript\nmodule-type: utils\n\nUtility functions concerned with parsing text into tokens.\n\nMost functions have the following pattern:\n\n* The parameters are:\n** `source`: the source string being parsed\n** `pos`: the current parse position within the string\n** Any further parameters are used to identify the token that is being parsed\n* The return value is:\n** null if the token was not found at the specified position\n** an object representing the token with the following standard fields:\n*** `type`: string indicating the type of the token\n*** `start`: start position of the token in the source string\n*** `end`: end position of the token in the source string\n*** Any further fields required to describe the token\n\nThe exception is `skipWhiteSpace`, which just returns the position after the whitespace.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nLook for a whitespace token. Returns null if not found, otherwise returns {type: \"whitespace\", start:, end:,}\n*/\nexports.parseWhiteSpace = function(source,pos) {\n\tvar p = pos,c;\n\twhile(true) {\n\t\tc = source.charAt(p);\n\t\tif((c === \" \") || (c === \"\\f\") || (c === \"\\n\") || (c === \"\\r\") || (c === \"\\t\") || (c === \"\\v\") || (c === \"\\u00a0\")) { // Ignores some obscure unicode spaces\n\t\t\tp++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(p === pos) {\n\t\treturn null;\n\t} else {\n\t\treturn {\n\t\t\ttype: \"whitespace\",\n\t\t\tstart: pos,\n\t\t\tend: p\n\t\t}\n\t}\n};\n\n/*\nConvenience wrapper for parseWhiteSpace. Returns the position after the whitespace\n*/\nexports.skipWhiteSpace = function(source,pos) {\n\tvar c;\n\twhile(true) {\n\t\tc = source.charAt(pos);\n\t\tif((c === \" \") || (c === \"\\f\") || (c === \"\\n\") || (c === \"\\r\") || (c === \"\\t\") || (c === \"\\v\") || (c === \"\\u00a0\")) { // Ignores some obscure unicode spaces\n\t\t\tpos++;\n\t\t} else {\n\t\t\treturn pos;\n\t\t}\n\t}\n};\n\n/*\nLook for a given string token. Returns null if not found, otherwise returns {type: \"token\", value:, start:, end:,}\n*/\nexports.parseTokenString = function(source,pos,token) {\n\tvar match = source.indexOf(token,pos) === pos;\n\tif(match) {\n\t\treturn {\n\t\t\ttype: \"token\",\n\t\t\tvalue: token,\n\t\t\tstart: pos,\n\t\t\tend: pos + token.length\n\t\t};\n\t}\n\treturn null;\n};\n\n/*\nLook for a token matching a regex. Returns null if not found, otherwise returns {type: \"regexp\", match:, start:, end:,}\n*/\nexports.parseTokenRegExp = function(source,pos,reToken) {\n\tvar node = {\n\t\ttype: \"regexp\",\n\t\tstart: pos\n\t};\n\treToken.lastIndex = pos;\n\tnode.match = reToken.exec(source);\n\tif(node.match && node.match.index === pos) {\n\t\tnode.end = pos + node.match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a string literal. Returns null if not found, otherwise returns {type: \"string\", value:, start:, end:,}\n*/\nexports.parseStringLiteral = function(source,pos) {\n\tvar node = {\n\t\ttype: \"string\",\n\t\tstart: pos\n\t};\n\tvar reString = /(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\")|(?:'([^']*)')/g;\n\treString.lastIndex = pos;\n\tvar match = reString.exec(source);\n\tif(match && match.index === pos) {\n\t\tnode.value = match[1] !== undefined ? match[1] :(\n\t\t\tmatch[2] !== undefined ? match[2] : match[3] \n\t\t\t\t\t);\n\t\tnode.end = pos + match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a macro invocation parameter. Returns null if not found, or {type: \"macro-parameter\", name:, value:, start:, end:}\n*/\nexports.parseMacroParameter = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macro-parameter\",\n\t\tstart: pos\n\t};\n\t// Define our regexp\n\tvar reMacroParameter = /(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\\s>\"'=]+)))/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the parameter\n\tvar token = $tw.utils.parseTokenRegExp(source,pos,reMacroParameter);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the parameter details\n\tnode.value = token.match[2] !== undefined ? token.match[2] : (\n\t\t\t\t\ttoken.match[3] !== undefined ? token.match[3] : (\n\t\t\t\t\t\ttoken.match[4] !== undefined ? token.match[4] : (\n\t\t\t\t\t\t\ttoken.match[5] !== undefined ? token.match[5] : (\n\t\t\t\t\t\t\t\ttoken.match[6] !== undefined ? token.match[6] : (\n\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\tif(token.match[1]) {\n\t\tnode.name = token.match[1];\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for a macro invocation. Returns null if not found, or {type: \"macrocall\", name:, parameters:, start:, end:}\n*/\nexports.parseMacroInvocation = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macrocall\",\n\t\tstart: pos,\n\t\tparams: []\n\t};\n\t// Define our regexps\n\tvar reMacroName = /([^\\s>\"'=]+)/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a double less than sign\n\tvar token = $tw.utils.parseTokenString(source,pos,\"<<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the macro name\n\tvar name = $tw.utils.parseTokenRegExp(source,pos,reMacroName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Process parameters\n\tvar parameter = $tw.utils.parseMacroParameter(source,pos);\n\twhile(parameter) {\n\t\tnode.params.push(parameter);\n\t\tpos = parameter.end;\n\t\t// Get the next parameter\n\t\tparameter = $tw.utils.parseMacroParameter(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a double greater than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\">>\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for an HTML attribute definition. Returns null if not found, otherwise returns {type: \"attribute\", name:, valueType: \"string|indirect|macro\", value:, start:, end:,}\n*/\nexports.parseAttribute = function(source,pos) {\n\tvar node = {\n\t\tstart: pos\n\t};\n\t// Define our regexps\n\tvar reAttributeName = /([^\\/\\s>\"'=]+)/g,\n\t\treUnquotedAttribute = /([^\\/\\s<>\"'=]+)/g,\n\t\treFilteredValue = /\\{\\{\\{(.+?)\\}\\}\\}/g,\n\t\treIndirectValue = /\\{\\{([^\\}]+)\\}\\}/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Get the attribute name\n\tvar name = $tw.utils.parseTokenRegExp(source,pos,reAttributeName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for an equals sign\n\tvar token = $tw.utils.parseTokenString(source,pos,\"=\");\n\tif(token) {\n\t\tpos = token.end;\n\t\t// Skip whitespace\n\t\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t\t// Look for a string literal\n\t\tvar stringLiteral = $tw.utils.parseStringLiteral(source,pos);\n\t\tif(stringLiteral) {\n\t\t\tpos = stringLiteral.end;\n\t\t\tnode.type = \"string\";\n\t\t\tnode.value = stringLiteral.value;\n\t\t} else {\n\t\t\t// Look for a filtered value\n\t\t\tvar filteredValue = $tw.utils.parseTokenRegExp(source,pos,reFilteredValue);\n\t\t\tif(filteredValue) {\n\t\t\t\tpos = filteredValue.end;\n\t\t\t\tnode.type = \"filtered\";\n\t\t\t\tnode.filter = filteredValue.match[1];\n\t\t\t} else {\n\t\t\t\t// Look for an indirect value\n\t\t\t\tvar indirectValue = $tw.utils.parseTokenRegExp(source,pos,reIndirectValue);\n\t\t\t\tif(indirectValue) {\n\t\t\t\t\tpos = indirectValue.end;\n\t\t\t\t\tnode.type = \"indirect\";\n\t\t\t\t\tnode.textReference = indirectValue.match[1];\n\t\t\t\t} else {\n\t\t\t\t\t// Look for a unquoted value\n\t\t\t\t\tvar unquotedValue = $tw.utils.parseTokenRegExp(source,pos,reUnquotedAttribute);\n\t\t\t\t\tif(unquotedValue) {\n\t\t\t\t\t\tpos = unquotedValue.end;\n\t\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\t\tnode.value = unquotedValue.match[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Look for a macro invocation value\n\t\t\t\t\t\tvar macroInvocation = $tw.utils.parseMacroInvocation(source,pos);\n\t\t\t\t\t\tif(macroInvocation) {\n\t\t\t\t\t\t\tpos = macroInvocation.end;\n\t\t\t\t\t\t\tnode.type = \"macro\";\n\t\t\t\t\t\t\tnode.value = macroInvocation;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\t\t\tnode.value = \"true\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tnode.type = \"string\";\n\t\tnode.value = \"true\";\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n})();\n",
"title": "$:/core/modules/utils/parseutils.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/parsers/pdfparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/pdfparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe PDF parser embeds a PDF viewer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImageParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"embed\",\n\t\t\tattributes: {}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:application/pdf;base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"application/pdf\"] = ImageParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/pdfparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/textparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/textparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar TextParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \"codeblock\",\n\t\tattributes: {\n\t\t\tcode: {type: \"string\", value: text},\n\t\t\tlanguage: {type: \"string\", value: type}\n\t\t}\n\t}];\n};\n\nexports[\"text/plain\"] = TextParser;\nexports[\"text/x-tiddlywiki\"] = TextParser;\nexports[\"application/javascript\"] = TextParser;\nexports[\"application/json\"] = TextParser;\nexports[\"text/css\"] = TextParser;\nexports[\"application/x-tiddler-dictionary\"] = TextParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/textparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/videoparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/videoparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe video parser parses a video tiddler into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar VideoParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"video\",\n\t\t\tattributes: {\n\t\t\t\tcontrols: {type: \"string\", value: \"controls\"}\n\t\t\t}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"video/mp4\"] = VideoParser;\nexports[\"video/quicktime\"] = VideoParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/videoparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/codeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for code blocks. For example:\n\n```\n\t```\n\tThis text will not be //wikified//\n\t```\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match and get language if defined\n\tthis.matchRegExp = /```([\\w-]*)\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\\r?\\n```$)/mg;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Return the $codeblock widget\n\treturn [{\n\t\t\ttype: \"codeblock\",\n\t\t\tattributes: {\n\t\t\t\t\tcode: {type: \"string\", value: text},\n\t\t\t\t\tlanguage: {type: \"string\", value: this.match[1]}\n\t\t\t}\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/codeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/codeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for code runs. For example:\n\n```\n\tThis is a `code run`.\n\tThis is another ``code run``\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(``?)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar reEnd = new RegExp(this.match[1], \"mg\");\n\t// Look for the end marker\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the text\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"code\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/codeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\nNote that the syntax for comments is simplified to an opening \"<!--\" sequence and a closing \"-->\" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\tthis.matchRegExp = /<!--/mg;\n\tthis.endMatchRegExp = /-->/mg;\n};\n\nexports.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\tif(this.match) {\n\t\tthis.endMatchRegExp.lastIndex = startPos + this.match[0].length;\n\t\tthis.endMatch = this.endMatchRegExp.exec(this.parser.source);\n\t\tif(this.endMatch) {\n\t\t\treturn this.match.index;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.endMatchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/commentblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\nNote that the syntax for comments is simplified to an opening \"<!--\" sequence and a closing \"-->\" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\tthis.matchRegExp = /<!--/mg;\n\tthis.endMatchRegExp = /-->/mg;\n};\n\nexports.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\tif(this.match) {\n\t\tthis.endMatchRegExp.lastIndex = startPos + this.match[0].length;\n\t\tthis.endMatch = this.endMatchRegExp.exec(this.parser.source);\n\t\tif(this.endMatch) {\n\t\t\treturn this.match.index;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.endMatchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/commentinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/dash.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/dash.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for dashes. For example:\n\n```\nThis is an en-dash: --\n\nThis is an em-dash: ---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"dash\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{2,3}(?!-)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar dash = this.match[0].length === 2 ? \"–\" : \"—\";\n\treturn [{\n\t\ttype: \"entity\",\n\t\tentity: dash\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/dash.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/bold.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/bold.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - bold. For example:\n\n```\n\tThis is ''bold'' text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except bold \n\\rules only bold \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"bold\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /''/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/''/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"strong\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/bold.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/italic.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/italic.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - italic. For example:\n\n```\n\tThis is //italic// text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except italic\n\\rules only italic\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"italic\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\/\\//mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/\\/\\//mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"em\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/italic.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - strikethrough. For example:\n\n```\n\tThis is ~~strikethrough~~ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except strikethrough \n\\rules only strikethrough \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"strikethrough\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /~~/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/~~/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"strike\",\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - subscript. For example:\n\n```\n\tThis is ,,subscript,, text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except subscript \n\\rules only subscript \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"subscript\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /,,/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/,,/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"sub\",\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - superscript. For example:\n\n```\n\tThis is ^^superscript^^ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except superscript \n\\rules only superscript \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"superscript\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\^\\^/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/\\^\\^/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"sup\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - underscore. For example:\n\n```\n\tThis is __underscore__ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except underscore \n\\rules only underscore\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"underscore\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /__/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/__/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"u\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/entity.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/entity.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML entities. For example:\n\n```\n\tThis is a copyright symbol: ©\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"entity\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(&#?[a-zA-Z0-9]{2,8};)/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar entityString = this.match[1];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Return the entity\n\treturn [{type: \"entity\", entity: this.match[0]}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/entity.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/extlink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/extlink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for external links. For example:\n\n```\nAn external link: http://www.tiddlywiki.com/\n\nA suppressed external link: ~http://www.tiddlyspace.com/\n```\n\nExternal links can be suppressed by preceding them with `~`.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"extlink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /~?(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s<>{}\\[\\]`|\"\\\\^]+(?:\\/|\\b)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Create the link unless it is suppressed\n\tif(this.match[0].substr(0,1) === \"~\") {\n\t\treturn [{type: \"text\", text: this.match[0].substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: this.match[0]},\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"},\n\t\t\t\trel: {type: \"string\", value: \"noopener noreferrer\"}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: this.match[0]\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/extlink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t},\n\t\tisBlock: true\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes.itemClass = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t}\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes.itemClass = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for marking areas with hard line breaks. For example:\n\n```\n\"\"\"\nThis is some text\nThat is set like\nIt is a Poem\nWhen it is\nClearly\nNot\n\"\"\"\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"hardlinebreaks\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\"\"\"(?:\\r?\\n)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\"\"\")|(\\r?\\n)/mg,\n\t\ttree = [],\n\t\tmatch;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tdo {\n\t\t// Parse the run up to the terminator\n\t\ttree.push.apply(tree,this.parser.parseInlineRun(reEnd,{eatTerminator: false}));\n\t\t// Redo the terminator match\n\t\treEnd.lastIndex = this.parser.pos;\n\t\tmatch = reEnd.exec(this.parser.source);\n\t\tif(match) {\n\t\t\tthis.parser.pos = reEnd.lastIndex;\n\t\t\t// Add a line break if the terminator was a line break\n\t\t\tif(match[2]) {\n\t\t\t\ttree.push({type: \"element\", tag: \"br\"});\n\t\t\t}\n\t\t}\n\t} while(match && !match[1]);\n\t// Return the nodes\n\treturn tree;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/heading.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/heading.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for headings\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"heading\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(!{1,6})/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar headingLevel = this.match[1].length;\n\t// Move past the !s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse any classes, whitespace and then the heading itself\n\tvar classes = this.parser.parseClasses();\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// Return the heading\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"h\" + headingLevel, \n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: classes.join(\" \")}\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/heading.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/horizrule.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/horizrule.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for rules. For example:\n\n```\n---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"horizrule\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{3,}\\r?(?:\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\treturn [{type: \"element\", tag: \"hr\"}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/horizrule.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/html.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/html.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for HTML elements and widgets. For example:\n\n{{{\n<aside>\nThis is an HTML5 aside element\n</aside>\n\n<$slider target=\"MyTiddler\">\nThis is a widget invocation\n</$slider>\n\n}}}\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"html\";\nexports.types = {inline: true, block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextTag = this.findNextTag(this.parser.source,startPos,{\n\t\trequireLineBreak: this.is.block\n\t});\n\treturn this.nextTag ? this.nextTag.start : undefined;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Retrieve the most recent match so that recursive calls don't overwrite it\n\tvar tag = this.nextTag;\n\tthis.nextTag = null;\n\t// Advance the parser position to past the tag\n\tthis.parser.pos = tag.end;\n\t// Check for an immediately following double linebreak\n\tvar hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\\S\\n\\r]*\\r?\\n(?:[^\\S\\n\\r]*\\r?\\n|$))/g);\n\t// Set whether we're in block mode\n\ttag.isBlock = this.is.block || hasLineBreak;\n\t// Parse the body if we need to\n\tif(!tag.isSelfClosing && $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {\n\t\t\tvar reEndString = \"</\" + $tw.utils.escapeRegExp(tag.tag) + \">\",\n\t\t\t\treEnd = new RegExp(\"(\" + reEndString + \")\",\"mg\");\n\t\tif(hasLineBreak) {\n\t\t\ttag.children = this.parser.parseBlocks(reEndString);\n\t\t} else {\n\t\t\ttag.children = this.parser.parseInlineRun(reEnd);\n\t\t}\n\t\treEnd.lastIndex = this.parser.pos;\n\t\tvar endMatch = reEnd.exec(this.parser.source);\n\t\tif(endMatch && endMatch.index === this.parser.pos) {\n\t\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t\t}\n\t}\n\t// Return the tag\n\treturn [tag];\n};\n\n/*\nLook for an HTML tag. Returns null if not found, otherwise returns {type: \"element\", name:, attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseTag = function(source,pos,options) {\n\toptions = options || {};\n\tvar token,\n\t\tnode = {\n\t\t\ttype: \"element\",\n\t\t\tstart: pos,\n\t\t\tattributes: {}\n\t\t};\n\t// Define our regexps\n\tvar reTagName = /([a-zA-Z0-9\\-\\$]+)/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a less than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\"<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the tag name\n\ttoken = $tw.utils.parseTokenRegExp(source,pos,reTagName);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tnode.tag = token.match[1];\n\tif(node.tag.charAt(0) === \"$\") {\n\t\tnode.type = node.tag.substr(1);\n\t}\n\tpos = token.end;\n\t// Check that the tag is terminated by a space, / or >\n\tif(!$tw.utils.parseWhiteSpace(source,pos) && !(source.charAt(pos) === \"/\") && !(source.charAt(pos) === \">\") ) {\n\t\treturn null;\n\t}\n\t// Process attributes\n\tvar attribute = $tw.utils.parseAttribute(source,pos);\n\twhile(attribute) {\n\t\tnode.attributes[attribute.name] = attribute;\n\t\tpos = attribute.end;\n\t\t// Get the next attribute\n\t\tattribute = $tw.utils.parseAttribute(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a closing slash\n\ttoken = $tw.utils.parseTokenString(source,pos,\"/\");\n\tif(token) {\n\t\tpos = token.end;\n\t\tnode.isSelfClosing = true;\n\t}\n\t// Look for a greater than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\">\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Check for a required line break\n\tif(options.requireLineBreak) {\n\t\ttoken = $tw.utils.parseTokenRegExp(source,pos,/([^\\S\\n\\r]*\\r?\\n(?:[^\\S\\n\\r]*\\r?\\n|$))/g);\n\t\tif(!token) {\n\t\t\treturn null;\n\t\t}\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\nexports.findNextTag = function(source,pos,options) {\n\t// A regexp for finding candidate HTML tags\n\tvar reLookahead = /<([a-zA-Z\\-\\$]+)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a tag\n\t\tvar tag = this.parseTag(source,match.index,options);\n\t\t// Return success\n\t\tif(tag && this.isLegalTag(tag)) {\n\t\t\treturn tag;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\nexports.isLegalTag = function(tag) {\n\t// Widgets are always OK\n\tif(tag.type !== \"element\") {\n\t\treturn true;\n\t// If it's an HTML tag that starts with a dash then it's not legal\n\t} else if(tag.tag.charAt(0) === \"-\") {\n\t\treturn false;\n\t} else {\n\t\t// Otherwise it's OK\n\t\treturn true;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/html.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/image.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/image.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for embedding images. For example:\n\n```\n[img[http://tiddlywiki.com/fractalveg.jpg]]\n[img width=23 height=24 [http://tiddlywiki.com/fractalveg.jpg]]\n[img width={{!!width}} height={{!!height}} [http://tiddlywiki.com/fractalveg.jpg]]\n[img[Description of image|http://tiddlywiki.com/fractalveg.jpg]]\n[img[TiddlerTitle]]\n[img[Description of image|TiddlerTitle]]\n```\n\nGenerates the `<$image>` widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"image\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextImage = this.findNextImage(this.parser.source,startPos);\n\treturn this.nextImage ? this.nextImage.start : undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.nextImage.end;\n\tvar node = {\n\t\ttype: \"image\",\n\t\tattributes: this.nextImage.attributes\n\t};\n\treturn [node];\n};\n\n/*\nFind the next image from the current position\n*/\nexports.findNextImage = function(source,pos) {\n\t// A regexp for finding candidate HTML tags\n\tvar reLookahead = /(\\[img)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a tag\n\t\tvar tag = this.parseImage(source,match.index);\n\t\t// Return success\n\t\tif(tag) {\n\t\t\treturn tag;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\n/*\nLook for an image at the specified position. Returns null if not found, otherwise returns {type: \"image\", attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseImage = function(source,pos) {\n\tvar token,\n\t\tnode = {\n\t\t\ttype: \"image\",\n\t\t\tstart: pos,\n\t\t\tattributes: {}\n\t\t};\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[img`\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[img\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Process attributes\n\tif(source.charAt(pos) !== \"[\") {\n\t\tvar attribute = $tw.utils.parseAttribute(source,pos);\n\t\twhile(attribute) {\n\t\t\tnode.attributes[attribute.name] = attribute;\n\t\t\tpos = attribute.end;\n\t\t\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t\t\tif(source.charAt(pos) !== \"[\") {\n\t\t\t\t// Get the next attribute\n\t\t\t\tattribute = $tw.utils.parseAttribute(source,pos);\n\t\t\t} else {\n\t\t\t\tattribute = null;\n\t\t\t}\n\t\t}\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[` after the attributes\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Get the source up to the terminating `]]`\n\ttoken = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\\]]*?)\\|)?([^\\]]+?)\\]\\]/g);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\tif(token.match[1]) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: token.match[1].trim()};\n\t}\n\tnode.attributes.source = {type: \"string\", value: (token.match[2] || \"\").trim()};\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/image.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/list.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/list.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for lists. For example:\n\n```\n* This is an unordered list\n* It has two items\n\n# This is a numbered list\n## With a subitem\n# And a third item\n\n; This is a term that is being defined\n: This is the definition of that term\n```\n\nNote that lists can be nested arbitrarily:\n\n```\n#** One\n#* Two\n#** Three\n#**** Four\n#**# Five\n#**## Six\n## Seven\n### Eight\n## Nine\n```\n\nA CSS class can be applied to a list item as follows:\n\n```\n* List item one\n*.active List item two has the class `active`\n* List item three\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"list\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /([\\*#;:>]+)/mg;\n};\n\nvar listTypes = {\n\t\"*\": {listTag: \"ul\", itemTag: \"li\"},\n\t\"#\": {listTag: \"ol\", itemTag: \"li\"},\n\t\";\": {listTag: \"dl\", itemTag: \"dt\"},\n\t\":\": {listTag: \"dl\", itemTag: \"dd\"},\n\t\">\": {listTag: \"blockquote\", itemTag: \"p\"}\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Array of parse tree nodes for the previous row of the list\n\tvar listStack = [];\n\t// Cycle through the items in the list\n\twhile(true) {\n\t\t// Match the list marker\n\t\tvar reMatch = /([\\*#;:>]+)/mg;\n\t\treMatch.lastIndex = this.parser.pos;\n\t\tvar match = reMatch.exec(this.parser.source);\n\t\tif(!match || match.index !== this.parser.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check whether the list type of the top level matches\n\t\tvar listInfo = listTypes[match[0].charAt(0)];\n\t\tif(listStack.length > 0 && listStack[0].tag !== listInfo.listTag) {\n\t\t\tbreak;\n\t\t}\n\t\t// Move past the list marker\n\t\tthis.parser.pos = match.index + match[0].length;\n\t\t// Walk through the list markers for the current row\n\t\tfor(var t=0; t<match[0].length; t++) {\n\t\t\tlistInfo = listTypes[match[0].charAt(t)];\n\t\t\t// Remove any stacked up element if we can't re-use it because the list type doesn't match\n\t\t\tif(listStack.length > t && listStack[t].tag !== listInfo.listTag) {\n\t\t\t\tlistStack.splice(t,listStack.length - t);\n\t\t\t}\n\t\t\t// Construct the list element or reuse the previous one at this level\n\t\t\tif(listStack.length <= t) {\n\t\t\t\tvar listElement = {type: \"element\", tag: listInfo.listTag, children: [\n\t\t\t\t\t{type: \"element\", tag: listInfo.itemTag, children: []}\n\t\t\t\t]};\n\t\t\t\t// Link this list element into the last child item of the parent list item\n\t\t\t\tif(t) {\n\t\t\t\t\tvar prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];\n\t\t\t\t\tprevListItem.children.push(listElement);\n\t\t\t\t}\n\t\t\t\t// Save this element in the stack\n\t\t\t\tlistStack[t] = listElement;\n\t\t\t} else if(t === (match[0].length - 1)) {\n\t\t\t\tlistStack[t].children.push({type: \"element\", tag: listInfo.itemTag, children: []});\n\t\t\t}\n\t\t}\n\t\tif(listStack.length > match[0].length) {\n\t\t\tlistStack.splice(match[0].length,listStack.length - match[0].length);\n\t\t}\n\t\t// Process the body of the list item into the last list item\n\t\tvar lastListChildren = listStack[listStack.length-1].children,\n\t\t\tlastListItem = lastListChildren[lastListChildren.length-1],\n\t\t\tclasses = this.parser.parseClasses();\n\t\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\t\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t\tlastListItem.children.push.apply(lastListItem.children,tree);\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(\" \"));\n\t\t}\n\t\t// Consume any whitespace following the list item\n\t\tthis.parser.skipWhitespace();\n\t}\n\t// Return the root element of the list\n\treturn [listStack[0]];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/list.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for block macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /<<([^>\\s]+)(?:\\s*)((?:[^>]|(?:>(?!>)))*?)>>(?:\\r?\\n|$)/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar macroName = this.match[1],\n\t\tparamString = this.match[2];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar params = [],\n\t\treParam = /\\s*(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))/mg,\n\t\tparamMatch = reParam.exec(paramString);\n\twhile(paramMatch) {\n\t\t// Process this parameter\n\t\tvar paramInfo = {\n\t\t\tvalue: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]\n\t\t};\n\t\tif(paramMatch[1]) {\n\t\t\tparamInfo.name = paramMatch[1];\n\t\t}\n\t\tparams.push(paramInfo);\n\t\t// Find the next match\n\t\tparamMatch = reParam.exec(paramString);\n\t}\n\treturn [{\n\t\ttype: \"macrocall\",\n\t\tname: macroName,\n\t\tparams: params,\n\t\tisBlock: true\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /<<([^\\s>]+)\\s*([\\s\\S]*?)>>/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar macroName = this.match[1],\n\t\tparamString = this.match[2];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar params = [],\n\t\treParam = /\\s*(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))/mg,\n\t\tparamMatch = reParam.exec(paramString);\n\twhile(paramMatch) {\n\t\t// Process this parameter\n\t\tvar paramInfo = {\n\t\t\tvalue: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]|| paramMatch[6]\n\t\t};\n\t\tif(paramMatch[1]) {\n\t\t\tparamInfo.name = paramMatch[1];\n\t\t}\n\t\tparams.push(paramInfo);\n\t\t// Find the next match\n\t\tparamMatch = reParam.exec(paramString);\n\t}\n\treturn [{\n\t\ttype: \"macrocall\",\n\t\tname: macroName,\n\t\tparams: params\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrodef.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrodef.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for macro definitions\n\n```\n\\define name(param:defaultvalue,param2:defaultvalue)\ndefinition text, including $param$ markers\n\\end\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrodef\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\define\\s+([^(\\s]+)\\(\\s*([^)]*)\\)(\\s*\\r?\\n)?/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the macro name and parameters\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the parameters\n\tvar paramString = this.match[2],\n\t\tparams = [];\n\tif(paramString !== \"\") {\n\t\tvar reParam = /\\s*([A-Za-z0-9\\-_]+)(?:\\s*:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))?/mg,\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\twhile(paramMatch) {\n\t\t\t// Save the parameter details\n\t\t\tvar paramInfo = {name: paramMatch[1]},\n\t\t\t\tdefaultValue = paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6];\n\t\t\tif(defaultValue) {\n\t\t\t\tparamInfo[\"default\"] = defaultValue;\n\t\t\t}\n\t\t\tparams.push(paramInfo);\n\t\t\t// Look for the next parameter\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\t}\n\t}\n\t// Is this a multiline definition?\n\tvar reEnd;\n\tif(this.match[3]) {\n\t\t// If so, the end of the body is marked with \\end\n\t\treEnd = /(\\r?\\n\\\\end[^\\S\\n\\r]*(?:$|\\r?\\n))/mg;\n\t} else {\n\t\t// Otherwise, the end of the definition is marked by the end of the line\n\t\treEnd = /($|\\r?\\n)/mg;\n\t\t// Move past any whitespace\n\t\tthis.parser.pos = $tw.utils.skipWhiteSpace(this.parser.source,this.parser.pos);\n\t}\n\t// Find the end of the definition\n\treEnd.lastIndex = this.parser.pos;\n\tvar text,\n\t\tendMatch = reEnd.exec(this.parser.source);\n\tif(endMatch) {\n\t\ttext = this.parser.source.substring(this.parser.pos,endMatch.index);\n\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t} else {\n\t\t// We didn't find the end of the definition, so we'll make it blank\n\t\ttext = \"\";\n\t}\n\t// Save the macro definition\n\treturn [{\n\t\ttype: \"set\",\n\t\tattributes: {\n\t\t\tname: {type: \"string\", value: this.match[1]},\n\t\t\tvalue: {type: \"string\", value: text}\n\t\t},\n\t\tchildren: [],\n\t\tparams: params\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrodef.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/prettyextlink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/prettyextlink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for external links. For example:\n\n```\n[ext[http://tiddlywiki.com/fractalveg.jpg]]\n[ext[Tooltip|http://tiddlywiki.com/fractalveg.jpg]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"prettyextlink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextLink = this.findNextLink(this.parser.source,startPos);\n\treturn this.nextLink ? this.nextLink.start : undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.nextLink.end;\n\treturn [this.nextLink];\n};\n\n/*\nFind the next link from the current position\n*/\nexports.findNextLink = function(source,pos) {\n\t// A regexp for finding candidate links\n\tvar reLookahead = /(\\[ext\\[)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a link\n\t\tvar link = this.parseLink(source,match.index);\n\t\t// Return success\n\t\tif(link) {\n\t\t\treturn link;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\n/*\nLook for an link at the specified position. Returns null if not found, otherwise returns {type: \"element\", tag: \"a\", attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseLink = function(source,pos) {\n\tvar token,\n\t\ttextNode = {\n\t\t\ttype: \"text\"\n\t\t},\n\t\tnode = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tstart: pos,\n\t\t\tattributes: {\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t},\n\t\t\tchildren: [textNode]\n\t\t};\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[ext[`\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[ext[\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Look ahead for the terminating `]]`\n\tvar closePos = source.indexOf(\"]]\",pos);\n\tif(closePos === -1) {\n\t\treturn null;\n\t}\n\t// Look for a `|` separating the tooltip\n\tvar splitPos = source.indexOf(\"|\",pos);\n\tif(splitPos === -1 || splitPos > closePos) {\n\t\tsplitPos = null;\n\t}\n\t// Pull out the tooltip and URL\n\tvar tooltip, URL;\n\tif(splitPos) {\n\t\tURL = source.substring(splitPos + 1,closePos).trim();\n\t\ttextNode.text = source.substring(pos,splitPos).trim();\n\t} else {\n\t\tURL = source.substring(pos,closePos).trim();\n\t\ttextNode.text = URL;\n\t}\n\tnode.attributes.href = {type: \"string\", value: URL};\n\tnode.attributes.target = {type: \"string\", value: \"_blank\"};\n\tnode.attributes.rel = {type: \"string\", value: \"noopener noreferrer\"};\n\t// Update the end position\n\tnode.end = closePos + 2;\n\treturn node;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/prettyextlink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/prettylink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/prettylink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for pretty links. For example:\n\n```\n[[Introduction]]\n\n[[Link description|TiddlerTitle]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"prettylink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\[\\[(.*?)(?:\\|(.*?))?\\]\\]/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Process the link\n\tvar text = this.match[1],\n\t\tlink = this.match[2] || text;\n\tif($tw.utils.isLinkExternal(link)) {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: link},\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"},\n\t\t\t\trel: {type: \"string\", value: \"noopener noreferrer\"}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\n\t\t}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: link}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/prettylink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/quoteblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/quoteblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for quote blocks. For example:\n\n```\n\t<<<.optionalClass(es) optional cited from\n\ta quote\n\t<<<\n\t\n\t<<<.optionalClass(es)\n\ta quote\n\t<<< optional cited from\n```\n\nQuotes can be quoted by putting more <s\n\n```\n\t<<<\n\tQuote Level 1\n\t\n\t<<<<\n\tQuoteLevel 2\n\t<<<<\n\t\n\t<<<\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"quoteblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(<<<+)/mg;\n};\n\nexports.parse = function() {\n\tvar classes = [\"tc-quote\"];\n\t// Get all the details of the match\n\tvar reEndString = \"^\" + this.match[1] + \"(?!<)\";\n\t// Move past the <s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\n\t// Parse any classes, whitespace and then the optional cite itself\n\tclasses.push.apply(classes, this.parser.parseClasses());\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar cite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// before handling the cite, parse the body of the quote\n\tvar tree= this.parser.parseBlocks(reEndString);\n\t// If we got a cite, put it before the text\n\tif(cite.length > 0) {\n\t\ttree.unshift({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\t// Parse any optional cite\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tcite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// If we got a cite, push it\n\tif(cite.length > 0) {\n\t\ttree.push({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\t// Return the blockquote element\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"blockquote\",\n\t\tattributes: {\n\t\t\tclass: { type: \"string\", value: classes.join(\" \") },\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/quoteblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/rules.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/rules.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for rules specifications\n\n```\n\\rules except ruleone ruletwo rulethree\n\\rules only ruleone ruletwo rulethree\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"rules\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\rules[^\\S\\n]/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the pragma invocation\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse whitespace delimited tokens terminated by a line break\n\tvar reMatch = /[^\\S\\n]*(\\S+)|(\\r?\\n)/mg,\n\t\ttokens = [];\n\treMatch.lastIndex = this.parser.pos;\n\tvar match = reMatch.exec(this.parser.source);\n\twhile(match && match.index === this.parser.pos) {\n\t\tthis.parser.pos = reMatch.lastIndex;\n\t\t// Exit if we've got the line break\n\t\tif(match[2]) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the token\n\t\tif(match[1]) {\n\t\t\ttokens.push(match[1]);\n\t\t}\n\t\t// Match the next token\n\t\tmatch = reMatch.exec(this.parser.source);\n\t}\n\t// Process the tokens\n\tif(tokens.length > 0) {\n\t\tthis.parser.amendRules(tokens[0],tokens.slice(1));\n\t}\n\t// No parse tree nodes to return\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/rules.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for assigning styles and classes to paragraphs and other blocks. For example:\n\n```\n@@.myClass\n@@background-color:red;\nThis paragraph will have the CSS class `myClass`.\n\n* The `<ul>` around this list will also have the class `myClass`\n* List item 2\n\n@@\n```\n\nNote that classes and styles can be mixed subject to the rule that styles must precede classes. For example\n\n```\n@@.myFirstClass.mySecondClass\n@@width:100px;.myThirdClass\nThis is a paragraph\n@@\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(?:\\.([^\\r\\n\\s]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEndString = \"^@@(?:\\\\r?\\\\n)?\";\n\tvar classes = [], styles = [];\n\tdo {\n\t\t// Get the class and style\n\t\tif(this.match[1]) {\n\t\t\tstyles.push(this.match[1]);\n\t\t}\n\t\tif(this.match[2]) {\n\t\t\tclasses.push(this.match[2].split(\".\").join(\" \"));\n\t\t}\n\t\t// Move past the match\n\t\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\t// Look for another line of classes and styles\n\t\tthis.match = this.matchRegExp.exec(this.parser.source);\n\t} while(this.match && this.match.index === this.parser.pos);\n\t// Parse the body\n\tvar tree = this.parser.parseBlocks(reEndString);\n\tfor(var t=0; t<tree.length; t++) {\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(tree[t],classes.join(\" \"));\n\t\t}\n\t\tif(styles.length > 0) {\n\t\t\t$tw.utils.addAttributeToParseTreeNode(tree[t],\"style\",styles.join(\"\"));\n\t\t}\n\t}\n\treturn tree;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/styleblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for assigning styles and classes to inline runs. For example:\n\n```\n@@.myClass This is some text with a class@@\n@@background-color:red;This is some text with a background colour@@\n@@width:100px;.myClass This is some text with a class and a width@@\n```\n\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(\\.(?:[^\\r\\n\\s]+)\\s+)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /@@/g;\n\t// Get the styles and class\n\tvar stylesString = this.match[1],\n\t\tclassString = this.match[2] ? this.match[2].split(\".\").join(\" \") : undefined;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the run up to the terminator\n\tvar tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t// Return the classed span\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"span\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tc-inline-style\"}\n\t\t},\n\t\tchildren: tree\n\t};\n\tif(classString) {\n\t\t$tw.utils.addClassToParseTreeNode(node,classString);\n\t}\n\tif(stylesString) {\n\t\t$tw.utils.addAttributeToParseTreeNode(node,\"style\",stylesString);\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/styleinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/syslink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/syslink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for system tiddler links.\nCan be suppressed preceding them with `~`.\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"syslink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp(\n\t\t\"~?\\\\$:\\\\/[\" +\n\t\t$tw.config.textPrimitives.anyLetter.substr(1,$tw.config.textPrimitives.anyLetter.length - 2) +\n\t\t\"\\/._-]+\",\n\t\t\"mg\"\n\t);\n};\n\nexports.parse = function() {\n\tvar match = this.match[0];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Create the link unless it is suppressed\n\tif(match.substr(0,1) === \"~\") {\n\t\treturn [{type: \"text\", text: match.substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: match}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: match\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();",
"title": "$:/core/modules/parsers/wikiparser/rules/syslink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/table.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/table.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for tables.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"table\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\|(?:[^\\n]*)\\|(?:[fhck]?)\\r?(?:\\n|$)/mg;\n};\n\nvar processRow = function(prevColumns) {\n\tvar cellRegExp = /(?:\\|([^\\n\\|]*)\\|)|(\\|[fhck]?\\r?(?:\\n|$))/mg,\n\t\tcellTermRegExp = /((?:\\x20*)\\|)/mg,\n\t\ttree = [],\n\t\tcol = 0,\n\t\tcolSpanCount = 1,\n\t\tprevCell,\n\t\tvAlign;\n\t// Match a single cell\n\tcellRegExp.lastIndex = this.parser.pos;\n\tvar cellMatch = cellRegExp.exec(this.parser.source);\n\twhile(cellMatch && cellMatch.index === this.parser.pos) {\n\t\tif(cellMatch[1] === \"~\") {\n\t\t\t// Rowspan\n\t\t\tvar last = prevColumns[col];\n\t\t\tif(last) {\n\t\t\t\tlast.rowSpanCount++;\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"rowspan\",last.rowSpanCount);\n\t\t\t\tvAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,\"valign\",\"center\");\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"valign\",vAlign);\n\t\t\t\tif(colSpanCount > 1) {\n\t\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"colspan\",colSpanCount);\n\t\t\t\t\tcolSpanCount = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[1] === \">\") {\n\t\t\t// Colspan\n\t\t\tcolSpanCount++;\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[1] === \"<\" && prevCell) {\n\t\t\tcolSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,\"colspan\",1);\n\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\tcolSpanCount = 1;\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[2]) {\n\t\t\t// End of row\n\t\t\tif(prevCell && colSpanCount > 1) {\n\t\t\t\tif(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) {\n\t\t\t\t\t\tcolSpanCount += prevCell.attributes.colspan.value;\n\t\t\t\t} else {\n\t\t\t\t\tcolSpanCount -= 1;\n\t\t\t\t}\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\t}\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t\tbreak;\n\t\t} else {\n\t\t\t// For ordinary cells, step beyond the opening `|`\n\t\t\tthis.parser.pos++;\n\t\t\t// Look for a space at the start of the cell\n\t\t\tvar spaceLeft = false;\n\t\t\tvAlign = null;\n\t\t\tif(this.parser.source.substr(this.parser.pos).search(/^\\^([^\\^]|\\^\\^)/) === 0) {\n\t\t\t\tvAlign = \"top\";\n\t\t\t} else if(this.parser.source.substr(this.parser.pos).search(/^,([^,]|,,)/) === 0) {\n\t\t\t\tvAlign = \"bottom\";\n\t\t\t}\n\t\t\tif(vAlign) {\n\t\t\t\tthis.parser.pos++;\n\t\t\t}\n\t\t\tvar chr = this.parser.source.substr(this.parser.pos,1);\n\t\t\twhile(chr === \" \") {\n\t\t\t\tspaceLeft = true;\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\t}\n\t\t\t// Check whether this is a heading cell\n\t\t\tvar cell;\n\t\t\tif(chr === \"!\") {\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tcell = {type: \"element\", tag: \"th\", children: []};\n\t\t\t} else {\n\t\t\t\tcell = {type: \"element\", tag: \"td\", children: []};\n\t\t\t}\n\t\t\ttree.push(cell);\n\t\t\t// Record information about this cell\n\t\t\tprevCell = cell;\n\t\t\tprevColumns[col] = {rowSpanCount:1,element:cell};\n\t\t\t// Check for a colspan\n\t\t\tif(colSpanCount > 1) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"colspan\",colSpanCount);\n\t\t\t\tcolSpanCount = 1;\n\t\t\t}\n\t\t\t// Parse the cell\n\t\t\tcell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});\n\t\t\t// Set the alignment for the cell\n\t\t\tif(vAlign) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"valign\",vAlign);\n\t\t\t}\n\t\t\tif(this.parser.source.substr(this.parser.pos - 2,1) === \" \") { // spaceRight\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",spaceLeft ? \"center\" : \"left\");\n\t\t\t} else if(spaceLeft) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",\"right\");\n\t\t\t}\n\t\t\t// Move back to the closing `|`\n\t\t\tthis.parser.pos--;\n\t\t}\n\t\tcol++;\n\t\tcellRegExp.lastIndex = this.parser.pos;\n\t\tcellMatch = cellRegExp.exec(this.parser.source);\n\t}\n\treturn tree;\n};\n\nexports.parse = function() {\n\tvar rowContainerTypes = {\"c\":\"caption\", \"h\":\"thead\", \"\":\"tbody\", \"f\":\"tfoot\"},\n\t\ttable = {type: \"element\", tag: \"table\", children: []},\n\t\trowRegExp = /^\\|([^\\n]*)\\|([fhck]?)\\r?(?:\\n|$)/mg,\n\t\trowTermRegExp = /(\\|(?:[fhck]?)\\r?(?:\\n|$))/mg,\n\t\tprevColumns = [],\n\t\tcurrRowType,\n\t\trowContainer,\n\t\trowCount = 0;\n\t// Match the row\n\trowRegExp.lastIndex = this.parser.pos;\n\tvar rowMatch = rowRegExp.exec(this.parser.source);\n\twhile(rowMatch && rowMatch.index === this.parser.pos) {\n\t\tvar rowType = rowMatch[2];\n\t\t// Check if it is a class assignment\n\t\tif(rowType === \"k\") {\n\t\t\t$tw.utils.addClassToParseTreeNode(table,rowMatch[1]);\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t} else {\n\t\t\t// Otherwise, create a new row if this one is of a different type\n\t\t\tif(rowType !== currRowType) {\n\t\t\t\trowContainer = {type: \"element\", tag: rowContainerTypes[rowType], children: []};\n\t\t\t\ttable.children.push(rowContainer);\n\t\t\t\tcurrRowType = rowType;\n\t\t\t}\n\t\t\t// Is this a caption row?\n\t\t\tif(currRowType === \"c\") {\n\t\t\t\t// If so, move past the opening `|` of the row\n\t\t\t\tthis.parser.pos++;\n\t\t\t\t// Move the caption to the first row if it isn't already\n\t\t\t\tif(table.children.length !== 1) {\n\t\t\t\t\ttable.children.pop(); // Take rowContainer out of the children array\n\t\t\t\t\ttable.children.splice(0,0,rowContainer); // Insert it at the bottom\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// Set the alignment - TODO: figure out why TW did this\n//\t\t\t\trowContainer.attributes.align = rowCount === 0 ? \"top\" : \"bottom\";\n\t\t\t\t// Parse the caption\n\t\t\t\trowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});\n\t\t\t} else {\n\t\t\t\t// Create the row\n\t\t\t\tvar theRow = {type: \"element\", tag: \"tr\", children: []};\n\t\t\t\t$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? \"oddRow\" : \"evenRow\");\n\t\t\t\trowContainer.children.push(theRow);\n\t\t\t\t// Process the row\n\t\t\t\ttheRow.children = processRow.call(this,prevColumns);\n\t\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t\t\t// Increment the row count\n\t\t\t\trowCount++;\n\t\t\t}\n\t\t}\n\t\trowMatch = rowRegExp.exec(this.parser.source);\n\t}\n\treturn [table];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/table.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler||TemplateTitle}}\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]*)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar template = $tw.utils.trim(this.match[2]),\n\t\ttextRef = $tw.utils.trim(this.match[1]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {},\n\t\t\tisBlock: true\n\t\t};\n\t// Prepare the tiddler widget\n\tvar tr, targetTitle, targetField, targetIndex, tiddlerNode;\n\tif(textRef) {\n\t\ttr = $tw.utils.parseTextReference(textRef);\n\t\ttargetTitle = tr.title;\n\t\ttargetField = tr.field;\n\t\ttargetIndex = tr.index;\n\t\ttiddlerNode = {\n\t\t\ttype: \"tiddler\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t\t},\n\t\t\tisBlock: true,\n\t\t\tchildren: [transcludeNode]\n\t\t};\n\t}\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t\tif(textRef) {\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t} else {\n\t\tif(textRef) {\n\t\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\t\tif(targetField) {\n\t\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t\t}\n\t\t\tif(targetIndex) {\n\t\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t\t}\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler||TemplateTitle}}\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]*)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar template = $tw.utils.trim(this.match[2]),\n\t\ttextRef = $tw.utils.trim(this.match[1]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {}\n\t\t};\n\t// Prepare the tiddler widget\n\tvar tr, targetTitle, targetField, targetIndex, tiddlerNode;\n\tif(textRef) {\n\t\ttr = $tw.utils.parseTextReference(textRef);\n\t\ttargetTitle = tr.title;\n\t\ttargetField = tr.field;\n\t\ttargetIndex = tr.index;\n\t\ttiddlerNode = {\n\t\t\ttype: \"tiddler\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t\t},\n\t\t\tchildren: [transcludeNode]\n\t\t};\n\t}\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t\tif(textRef) {\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t} else {\n\t\tif(textRef) {\n\t\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\t\tif(targetField) {\n\t\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t\t}\n\t\t\tif(targetIndex) {\n\t\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t\t}\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/typedblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/typedblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for typed blocks. For example:\n\n```\n$$$.js\nThis will be rendered as JavaScript\n$$$\n\n$$$.svg\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"150\" height=\"100\">\n <circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\" />\n</svg>\n$$$\n\n$$$text/vnd.tiddlywiki>text/html\nThis will be rendered as an //HTML representation// of WikiText\n$$$\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.name = \"typedblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\$\\$\\$([^ >\\r\\n]*)(?: *> *([^ \\r\\n]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /\\r?\\n\\$\\$\\$\\r?(?:\\n|$)/mg;\n\t// Save the type\n\tvar parseType = this.match[1],\n\t\trenderType = this.match[2];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Parse the block according to the specified type\n\tvar parser = this.parser.wiki.parseText(parseType,text,{defaultType: \"text/plain\"});\n\t// If there's no render type, just return the parse tree\n\tif(!renderType) {\n\t\treturn parser.tree;\n\t} else {\n\t\t// Otherwise, render to the rendertype and return in a <PRE> tag\n\t\tvar widgetNode = this.parser.wiki.makeWidget(parser),\n\t\t\tcontainer = $tw.fakeDocument.createElement(\"div\");\n\t\twidgetNode.render(container,null);\n\t\ttext = renderType === \"text/html\" ? container.innerHTML : container.textContent;\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"pre\",\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/typedblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/wikilink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikilink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for wiki links. For example:\n\n```\nAWikiLink\nAnotherLink\n~SuppressedLink\n```\n\nPrecede a camel case word with `~` to prevent it from being recognised as a link.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"wikilink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp($tw.config.textPrimitives.unWikiLink + \"?\" + $tw.config.textPrimitives.wikiLink,\"mg\");\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get the details of the match\n\tvar linkText = this.match[0];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// If the link starts with the unwikilink character then just output it as plain text\n\tif(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {\n\t\treturn [{type: \"text\", text: linkText.substr(1)}];\n\t}\n\t// If the link has been preceded with a blocked letter then don't treat it as a link\n\tif(this.match.index > 0) {\n\t\tvar preRegExp = new RegExp($tw.config.textPrimitives.blockPrefixLetters,\"mg\");\n\t\tpreRegExp.lastIndex = this.match.index-1;\n\t\tvar preMatch = preRegExp.exec(this.parser.source);\n\t\tif(preMatch && preMatch.index === this.match.index-1) {\n\t\t\treturn [{type: \"text\", text: linkText}];\n\t\t}\n\t}\n\treturn [{\n\t\ttype: \"link\",\n\t\tattributes: {\n\t\t\tto: {type: \"string\", value: linkText}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: linkText\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/wikilink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/wikiparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/wikiparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe wiki text parser processes blocks of source text into a parse tree.\n\nThe parse tree is made up of nested arrays of these JavaScript objects:\n\n\t{type: \"element\", tag: <string>, attributes: {}, children: []} - an HTML element\n\t{type: \"text\", text: <string>} - a text node\n\t{type: \"entity\", value: <string>} - an entity\n\t{type: \"raw\", html: <string>} - raw HTML\n\nAttributes are stored as hashmaps of the following objects:\n\n\t{type: \"string\", value: <string>} - literal string\n\t{type: \"indirect\", textReference: <textReference>} - indirect through a text reference\n\t{type: \"macro\", macro: <TBD>} - indirect through a macro invocation\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar WikiParser = function(type,text,options) {\n\tthis.wiki = options.wiki;\n\tvar self = this;\n\t// Check for an externally linked tiddler\n\tif($tw.browser && (text || \"\") === \"\" && options._canonical_uri) {\n\t\tthis.loadRemoteTiddler(options._canonical_uri);\n\t\ttext = $tw.language.getRawString(\"LazyLoadingWarning\");\n\t}\n\t// Initialise the classes if we don't have them already\n\tif(!this.pragmaRuleClasses) {\n\t\tWikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"pragma\",$tw.WikiRuleBase);\n\t\tthis.setupRules(WikiParser.prototype.pragmaRuleClasses,\"$:/config/WikiParserRules/Pragmas/\");\n\t}\n\tif(!this.blockRuleClasses) {\n\t\tWikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"block\",$tw.WikiRuleBase);\n\t\tthis.setupRules(WikiParser.prototype.blockRuleClasses,\"$:/config/WikiParserRules/Block/\");\n\t}\n\tif(!this.inlineRuleClasses) {\n\t\tWikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"inline\",$tw.WikiRuleBase);\n\t\tthis.setupRules(WikiParser.prototype.inlineRuleClasses,\"$:/config/WikiParserRules/Inline/\");\n\t}\n\t// Save the parse text\n\tthis.type = type || \"text/vnd.tiddlywiki\";\n\tthis.source = text || \"\";\n\tthis.sourceLength = this.source.length;\n\t// Set current parse position\n\tthis.pos = 0;\n\t// Instantiate the pragma parse rules\n\tthis.pragmaRules = this.instantiateRules(this.pragmaRuleClasses,\"pragma\",0);\n\t// Instantiate the parser block and inline rules\n\tthis.blockRules = this.instantiateRules(this.blockRuleClasses,\"block\",0);\n\tthis.inlineRules = this.instantiateRules(this.inlineRuleClasses,\"inline\",0);\n\t// Parse any pragmas\n\tthis.tree = [];\n\tvar topBranch = this.parsePragmas();\n\t// Parse the text into inline runs or blocks\n\tif(options.parseAsInline) {\n\t\ttopBranch.push.apply(topBranch,this.parseInlineRun());\n\t} else {\n\t\ttopBranch.push.apply(topBranch,this.parseBlocks());\n\t}\n\t// Return the parse tree\n};\n\n/*\n*/\nWikiParser.prototype.loadRemoteTiddler = function(url) {\n\tvar self = this;\n\t$tw.utils.httpRequest({\n\t\turl: url,\n\t\ttype: \"GET\",\n\t\tcallback: function(err,data) {\n\t\t\tif(!err) {\n\t\t\t\tvar tiddlers = self.wiki.deserializeTiddlers(\".tid\",data,self.wiki.getCreationFields());\n\t\t\t\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\t\t\t\ttiddler[\"_canonical_uri\"] = url;\n\t\t\t\t});\n\t\t\t\tif(tiddlers) {\n\t\t\t\t\tself.wiki.addTiddlers(tiddlers);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\n*/\nWikiParser.prototype.setupRules = function(proto,configPrefix) {\n\tvar self = this;\n\tif(!$tw.safemode) {\n\t\t$tw.utils.each(proto,function(object,name) {\n\t\t\tif(self.wiki.getTiddlerText(configPrefix + name,\"enable\") !== \"enable\") {\n\t\t\t\tdelete proto[name];\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nInstantiate an array of parse rules\n*/\nWikiParser.prototype.instantiateRules = function(classes,type,startPos) {\n\tvar rulesInfo = [],\n\t\tself = this;\n\t$tw.utils.each(classes,function(RuleClass) {\n\t\t// Instantiate the rule\n\t\tvar rule = new RuleClass(self);\n\t\trule.is = {};\n\t\trule.is[type] = true;\n\t\trule.init(self);\n\t\tvar matchIndex = rule.findNextMatch(startPos);\n\t\tif(matchIndex !== undefined) {\n\t\t\trulesInfo.push({\n\t\t\t\trule: rule,\n\t\t\t\tmatchIndex: matchIndex\n\t\t\t});\n\t\t}\n\t});\n\treturn rulesInfo;\n};\n\n/*\nSkip any whitespace at the current position. Options are:\n\ttreatNewlinesAsNonWhitespace: true if newlines are NOT to be treated as whitespace\n*/\nWikiParser.prototype.skipWhitespace = function(options) {\n\toptions = options || {};\n\tvar whitespaceRegExp = options.treatNewlinesAsNonWhitespace ? /([^\\S\\n]+)/mg : /(\\s+)/mg;\n\twhitespaceRegExp.lastIndex = this.pos;\n\tvar whitespaceMatch = whitespaceRegExp.exec(this.source);\n\tif(whitespaceMatch && whitespaceMatch.index === this.pos) {\n\t\tthis.pos = whitespaceRegExp.lastIndex;\n\t}\n};\n\n/*\nGet the next match out of an array of parse rule instances\n*/\nWikiParser.prototype.findNextMatch = function(rules,startPos) {\n\t// Find the best matching rule by finding the closest match position\n\tvar matchingRule,\n\t\tmatchingRulePos = this.sourceLength;\n\t// Step through each rule\n\tfor(var t=0; t<rules.length; t++) {\n\t\tvar ruleInfo = rules[t];\n\t\t// Ask the rule to get the next match if we've moved past the current one\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex < startPos) {\n\t\t\truleInfo.matchIndex = ruleInfo.rule.findNextMatch(startPos);\n\t\t}\n\t\t// Adopt this match if it's closer than the current best match\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex <= matchingRulePos) {\n\t\t\tmatchingRule = ruleInfo;\n\t\t\tmatchingRulePos = ruleInfo.matchIndex;\n\t\t}\n\t}\n\treturn matchingRule;\n};\n\n/*\nParse any pragmas at the beginning of a block of parse text\n*/\nWikiParser.prototype.parsePragmas = function() {\n\tvar currentTreeBranch = this.tree;\n\twhile(true) {\n\t\t// Skip whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check for the end of the text\n\t\tif(this.pos >= this.sourceLength) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check if we've arrived at a pragma rule match\n\t\tvar nextMatch = this.findNextMatch(this.pragmaRules,this.pos);\n\t\t// If not, just exit\n\t\tif(!nextMatch || nextMatch.matchIndex !== this.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the pragma rule\n\t\tvar subTree = nextMatch.rule.parse();\n\t\tif(subTree.length > 0) {\n\t\t\t// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment\n\t\t\tcurrentTreeBranch.push.apply(currentTreeBranch,subTree);\n\t\t\tsubTree[0].children = [];\n\t\t\tcurrentTreeBranch = subTree[0].children;\n\t\t}\n\t}\n\treturn currentTreeBranch;\n};\n\n/*\nParse a block from the current position\n\tterminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis\n*/\nWikiParser.prototype.parseBlock = function(terminatorRegExpString) {\n\tvar terminatorRegExp = terminatorRegExpString ? new RegExp(\"(\" + terminatorRegExpString + \"|\\\\r?\\\\n\\\\r?\\\\n)\",\"mg\") : /(\\r?\\n\\r?\\n)/mg;\n\tthis.skipWhitespace();\n\tif(this.pos >= this.sourceLength) {\n\t\treturn [];\n\t}\n\t// Look for a block rule that applies at the current position\n\tvar nextMatch = this.findNextMatch(this.blockRules,this.pos);\n\tif(nextMatch && nextMatch.matchIndex === this.pos) {\n\t\treturn nextMatch.rule.parse();\n\t}\n\t// Treat it as a paragraph if we didn't find a block rule\n\treturn [{type: \"element\", tag: \"p\", children: this.parseInlineRun(terminatorRegExp)}];\n};\n\n/*\nParse a series of blocks of text until a terminating regexp is encountered or the end of the text\n\tterminatorRegExpString: terminating regular expression\n*/\nWikiParser.prototype.parseBlocks = function(terminatorRegExpString) {\n\tif(terminatorRegExpString) {\n\t\treturn this.parseBlocksTerminated(terminatorRegExpString);\n\t} else {\n\t\treturn this.parseBlocksUnterminated();\n\t}\n};\n\n/*\nParse a block from the current position to the end of the text\n*/\nWikiParser.prototype.parseBlocksUnterminated = function() {\n\tvar tree = [];\n\twhile(this.pos < this.sourceLength) {\n\t\ttree.push.apply(tree,this.parseBlock());\n\t}\n\treturn tree;\n};\n\n/*\nParse blocks of text until a terminating regexp is encountered\n*/\nWikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {\n\tvar terminatorRegExp = new RegExp(\"(\" + terminatorRegExpString + \")\",\"mg\"),\n\t\ttree = [];\n\t// Skip any whitespace\n\tthis.skipWhitespace();\n\t// Check if we've got the end marker\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar match = terminatorRegExp.exec(this.source);\n\t// Parse the text into blocks\n\twhile(this.pos < this.sourceLength && !(match && match.index === this.pos)) {\n\t\tvar blocks = this.parseBlock(terminatorRegExpString);\n\t\ttree.push.apply(tree,blocks);\n\t\t// Skip any whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check if we've got the end marker\n\t\tterminatorRegExp.lastIndex = this.pos;\n\t\tmatch = terminatorRegExp.exec(this.source);\n\t}\n\tif(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t}\n\treturn tree;\n};\n\n/*\nParse a run of text at the current position\n\tterminatorRegExp: a regexp at which to stop the run\n\toptions: see below\nOptions available:\n\teatTerminator: move the parse position past any encountered terminator (default false)\n*/\nWikiParser.prototype.parseInlineRun = function(terminatorRegExp,options) {\n\tif(terminatorRegExp) {\n\t\treturn this.parseInlineRunTerminated(terminatorRegExp,options);\n\t} else {\n\t\treturn this.parseInlineRunUnterminated(options);\n\t}\n};\n\nWikiParser.prototype.parseInlineRunUnterminated = function(options) {\n\tvar tree = [];\n\t// Find the next occurrence of an inline rule\n\tvar nextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around the matches until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && nextMatch) {\n\t\t// Process the text preceding the run rule\n\t\tif(nextMatch.matchIndex > this.pos) {\n\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,nextMatch.matchIndex)});\n\t\t\tthis.pos = nextMatch.matchIndex;\n\t\t}\n\t\t// Process the run rule\n\t\ttree.push.apply(tree,nextMatch.rule.parse());\n\t\t// Look for the next run rule\n\t\tnextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\ttree.push({type: \"text\", text: this.source.substr(this.pos)});\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\nWikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {\n\toptions = options || {};\n\tvar tree = [];\n\t// Find the next occurrence of the terminator\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar terminatorMatch = terminatorRegExp.exec(this.source);\n\t// Find the next occurrence of a inlinerule\n\tvar inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && (terminatorMatch || inlineRuleMatch)) {\n\t\t// Return if we've found the terminator, and it precedes any inline rule match\n\t\tif(terminatorMatch) {\n\t\t\tif(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {\n\t\t\t\tif(terminatorMatch.index > this.pos) {\n\t\t\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,terminatorMatch.index)});\n\t\t\t\t}\n\t\t\t\tthis.pos = terminatorMatch.index;\n\t\t\t\tif(options.eatTerminator) {\n\t\t\t\t\tthis.pos += terminatorMatch[0].length;\n\t\t\t\t}\n\t\t\t\treturn tree;\n\t\t\t}\n\t\t}\n\t\t// Process any inline rule, along with the text preceding it\n\t\tif(inlineRuleMatch) {\n\t\t\t// Preceding text\n\t\t\tif(inlineRuleMatch.matchIndex > this.pos) {\n\t\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,inlineRuleMatch.matchIndex)});\n\t\t\t\tthis.pos = inlineRuleMatch.matchIndex;\n\t\t\t}\n\t\t\t// Process the inline rule\n\t\t\ttree.push.apply(tree,inlineRuleMatch.rule.parse());\n\t\t\t// Look for the next inline rule\n\t\t\tinlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t\t\t// Look for the next terminator match\n\t\t\tterminatorRegExp.lastIndex = this.pos;\n\t\t\tterminatorMatch = terminatorRegExp.exec(this.source);\n\t\t}\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\ttree.push({type: \"text\", text: this.source.substr(this.pos)});\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\n/*\nParse zero or more class specifiers `.classname`\n*/\nWikiParser.prototype.parseClasses = function() {\n\tvar classRegExp = /\\.([^\\s\\.]+)/mg,\n\t\tclassNames = [];\n\tclassRegExp.lastIndex = this.pos;\n\tvar match = classRegExp.exec(this.source);\n\twhile(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t\tclassNames.push(match[1]);\n\t\tmatch = classRegExp.exec(this.source);\n\t}\n\treturn classNames;\n};\n\n/*\nAmend the rules used by this instance of the parser\n\ttype: `only` keeps just the named rules, `except` keeps all but the named rules\n\tnames: array of rule names\n*/\nWikiParser.prototype.amendRules = function(type,names) {\n\tnames = names || [];\n\t// Define the filter function\n\tvar keepFilter;\n\tif(type === \"only\") {\n\t\tkeepFilter = function(name) {\n\t\t\treturn names.indexOf(name) !== -1;\n\t\t};\n\t} else if(type === \"except\") {\n\t\tkeepFilter = function(name) {\n\t\t\treturn names.indexOf(name) === -1;\n\t\t};\n\t} else {\n\t\treturn;\n\t}\n\t// Define a function to process each of our rule arrays\n\tvar processRuleArray = function(ruleArray) {\n\t\tfor(var t=ruleArray.length-1; t>=0; t--) {\n\t\t\tif(!keepFilter(ruleArray[t].rule.name)) {\n\t\t\t\truleArray.splice(t,1);\n\t\t\t}\n\t\t}\n\t};\n\t// Process each rule array\n\tprocessRuleArray(this.pragmaRules);\n\tprocessRuleArray(this.blockRules);\n\tprocessRuleArray(this.inlineRules);\n};\n\nexports[\"text/vnd.tiddlywiki\"] = WikiParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/wikiparser/wikiparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/wikirulebase.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikirulebase.js\ntype: application/javascript\nmodule-type: global\n\nBase class for wiki parser rules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nThis constructor is always overridden with a blank constructor, and so shouldn't be used\n*/\nvar WikiRuleBase = function() {\n};\n\n/*\nTo be overridden by individual rules\n*/\nWikiRuleBase.prototype.init = function(parser) {\n\tthis.parser = parser;\n};\n\n/*\nDefault implementation of findNextMatch uses RegExp matching\n*/\nWikiRuleBase.prototype.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\treturn this.match ? this.match.index : undefined;\n};\n\nexports.WikiRuleBase = WikiRuleBase;\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/wikirulebase.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/pluginswitcher.js": {
"text": "/*\\\ntitle: $:/core/modules/pluginswitcher.js\ntype: application/javascript\nmodule-type: global\n\nManages switching plugins for themes and languages.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\noptions:\nwiki: wiki store to be used\npluginType: type of plugin to be switched\ncontrollerTitle: title of tiddler used to control switching of this resource\ndefaultPlugins: array of default plugins to be used if nominated plugin isn't found\nonSwitch: callback when plugin is switched (single parameter is array of plugin titles)\n*/\nfunction PluginSwitcher(options) {\n\tthis.wiki = options.wiki;\n\tthis.pluginType = options.pluginType;\n\tthis.controllerTitle = options.controllerTitle;\n\tthis.defaultPlugins = options.defaultPlugins || [];\n\tthis.onSwitch = options.onSwitch;\n\t// Switch to the current plugin\n\tthis.switchPlugins();\n\t// Listen for changes to the selected plugin\n\tvar self = this;\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,self.controllerTitle)) {\n\t\t\tself.switchPlugins();\n\t\t}\n\t});\n}\n\nPluginSwitcher.prototype.switchPlugins = function() {\n\t// Get the name of the current theme\n\tvar selectedPluginTitle = this.wiki.getTiddlerText(this.controllerTitle);\n\t// If it doesn't exist, then fallback to one of the default themes\n\tvar index = 0;\n\twhile(!this.wiki.getTiddler(selectedPluginTitle) && index < this.defaultPlugins.length) {\n\t\tselectedPluginTitle = this.defaultPlugins[index++];\n\t}\n\t// Accumulate the titles of the plugins that we need to load\n\tvar plugins = [],\n\t\tself = this,\n\t\taccumulatePlugin = function(title) {\n\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\tif(tiddler && tiddler.isPlugin() && plugins.indexOf(title) === -1) {\n\t\t\t\tplugins.push(title);\n\t\t\t\tvar pluginInfo = JSON.parse(self.wiki.getTiddlerText(title)),\n\t\t\t\t\tdependents = $tw.utils.parseStringArray(tiddler.fields.dependents || \"\");\n\t\t\t\t$tw.utils.each(dependents,function(title) {\n\t\t\t\t\taccumulatePlugin(title);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\taccumulatePlugin(selectedPluginTitle);\n\t// Unregister any existing theme tiddlers\n\tvar unregisteredTiddlers = $tw.wiki.unregisterPluginTiddlers(this.pluginType);\n\t// Register any new theme tiddlers\n\tvar registeredTiddlers = $tw.wiki.registerPluginTiddlers(this.pluginType,plugins);\n\t// Unpack the current theme tiddlers\n\t$tw.wiki.unpackPluginTiddlers();\n\t// Call the switch handler\n\tif(this.onSwitch) {\n\t\tthis.onSwitch(plugins);\n\t}\n};\n\nexports.PluginSwitcher = PluginSwitcher;\n\n})();\n",
"title": "$:/core/modules/pluginswitcher.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/saver-handler.js": {
"text": "/*\\\ntitle: $:/core/modules/saver-handler.js\ntype: application/javascript\nmodule-type: global\n\nThe saver handler tracks changes to the store and handles saving the entire wiki via saver modules.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInstantiate the saver handler with the following options:\nwiki: wiki to be synced\ndirtyTracking: true if dirty tracking should be performed\n*/\nfunction SaverHandler(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\tthis.dirtyTracking = options.dirtyTracking;\n\tthis.pendingAutoSave = false;\n\t// Make a logger\n\tthis.logger = new $tw.utils.Logger(\"saver-handler\");\n\t// Initialise our savers\n\tif($tw.browser) {\n\t\tthis.initSavers();\n\t}\n\t// Only do dirty tracking if required\n\tif($tw.browser && this.dirtyTracking) {\n\t\t// Compile the dirty tiddler filter\n\t\tthis.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));\n\t\t// Count of changes that have not yet been saved\n\t\tthis.numChanges = 0;\n\t\t// Listen out for changes to tiddlers\n\t\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\t\t// Filter the changes so that we only count changes to tiddlers that we care about\n\t\t\tvar filteredChanges = self.filterFn.call(self.wiki,function(iterator) {\n\t\t\t\t$tw.utils.each(changes,function(change,title) {\n\t\t\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\t\t\titerator(tiddler,title);\n\t\t\t\t});\n\t\t\t});\n\t\t\t// Adjust the number of changes\n\t\t\tself.numChanges += filteredChanges.length;\n\t\t\tself.updateDirtyStatus();\n\t\t\t// Do any autosave if one is pending and there's no more change events\n\t\t\tif(self.pendingAutoSave && self.wiki.getSizeOfTiddlerEventQueue() === 0) {\n\t\t\t\t// Check if we're dirty\n\t\t\t\tif(self.numChanges > 0) {\n\t\t\t\t\tself.saveWiki({\n\t\t\t\t\t\tmethod: \"autosave\",\n\t\t\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tself.pendingAutoSave = false;\n\t\t\t}\n\t\t});\n\t\t// Listen for the autosave event\n\t\t$tw.rootWidget.addEventListener(\"tm-auto-save-wiki\",function(event) {\n\t\t\t// Do the autosave unless there are outstanding tiddler change events\n\t\t\tif(self.wiki.getSizeOfTiddlerEventQueue() === 0) {\n\t\t\t\t// Check if we're dirty\n\t\t\t\tif(self.numChanges > 0) {\n\t\t\t\t\tself.saveWiki({\n\t\t\t\t\t\tmethod: \"autosave\",\n\t\t\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Otherwise put ourselves in the \"pending autosave\" state and wait for the change event before we do the autosave\n\t\t\t\tself.pendingAutoSave = true;\n\t\t\t}\n\t\t});\n\t\t// Set up our beforeunload handler\n\t\t$tw.addUnloadTask(function(event) {\n\t\t\tvar confirmationMessage;\n\t\t\tif(self.isDirty()) {\n\t\t\t\tconfirmationMessage = $tw.language.getString(\"UnsavedChangesWarning\");\n\t\t\t\tevent.returnValue = confirmationMessage; // Gecko\n\t\t\t}\n\t\t\treturn confirmationMessage;\n\t\t});\n\t}\n\t// Install the save action handlers\n\tif($tw.browser) {\n\t\t$tw.rootWidget.addEventListener(\"tm-save-wiki\",function(event) {\n\t\t\tself.saveWiki({\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\",\n\t\t\t\tvariables: event.paramObject\n\t\t\t});\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-download-file\",function(event) {\n\t\t\tself.saveWiki({\n\t\t\t\tmethod: \"download\",\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\",\n\t\t\t\tvariables: event.paramObject\n\t\t\t});\n\t\t});\n\t}\n}\n\nSaverHandler.prototype.titleSyncFilter = \"$:/config/SaverFilter\";\nSaverHandler.prototype.titleAutoSave = \"$:/config/AutoSave\";\nSaverHandler.prototype.titleSavedNotification = \"$:/language/Notifications/Save/Done\";\n\n/*\nSelect the appropriate saver modules and set them up\n*/\nSaverHandler.prototype.initSavers = function(moduleType) {\n\tmoduleType = moduleType || \"saver\";\n\t// Instantiate the available savers\n\tthis.savers = [];\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tif(module.canSave(self)) {\n\t\t\tself.savers.push(module.create(self.wiki));\n\t\t}\n\t});\n\t// Sort the savers into priority order\n\tthis.savers.sort(function(a,b) {\n\t\tif(a.info.priority < b.info.priority) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(a.info.priority > b.info.priority) {\n\t\t\t\treturn +1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nSave the wiki contents. Options are:\n\tmethod: \"save\", \"autosave\" or \"download\"\n\ttemplate: the tiddler containing the template to save\n\tdownloadType: the content type for the saved file\n*/\nSaverHandler.prototype.saveWiki = function(options) {\n\toptions = options || {};\n\tvar self = this,\n\t\tmethod = options.method || \"save\",\n\t\tvariables = options.variables || {},\n\t\ttemplate = options.template || \"$:/core/save/all\",\n\t\tdownloadType = options.downloadType || \"text/plain\",\n\t\ttext = this.wiki.renderTiddler(downloadType,template,options),\n\t\tcallback = function(err) {\n\t\t\tif(err) {\n\t\t\t\talert($tw.language.getString(\"Error/WhileSaving\") + \":\\n\\n\" + err);\n\t\t\t} else {\n\t\t\t\t// Clear the task queue if we're saving (rather than downloading)\n\t\t\t\tif(method !== \"download\") {\n\t\t\t\t\tself.numChanges = 0;\n\t\t\t\t\tself.updateDirtyStatus();\n\t\t\t\t}\n\t\t\t\t$tw.notifier.display(self.titleSavedNotification);\n\t\t\t\tif(options.callback) {\n\t\t\t\t\toptions.callback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t// Ignore autosave if disabled\n\tif(method === \"autosave\" && this.wiki.getTiddlerText(this.titleAutoSave,\"yes\") !== \"yes\") {\n\t\treturn false;\n\t}\n\t// Call the highest priority saver that supports this method\n\tfor(var t=this.savers.length-1; t>=0; t--) {\n\t\tvar saver = this.savers[t];\n\t\tif(saver.info.capabilities.indexOf(method) !== -1 && saver.save(text,method,callback,{variables: {filename: variables.filename}})) {\n\t\t\tthis.logger.log(\"Saving wiki with method\",method,\"through saver\",saver.info.name);\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nChecks whether the wiki is dirty (ie the window shouldn't be closed)\n*/\nSaverHandler.prototype.isDirty = function() {\n\treturn this.numChanges > 0;\n};\n\n/*\nUpdate the document body with the class \"tc-dirty\" if the wiki has unsaved/unsynced changes\n*/\nSaverHandler.prototype.updateDirtyStatus = function() {\n\tif($tw.browser) {\n\t\t$tw.utils.toggleClass(document.body,\"tc-dirty\",this.isDirty());\n\t}\n};\n\nexports.SaverHandler = SaverHandler;\n\n})();\n",
"title": "$:/core/modules/saver-handler.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/savers/andtidwiki.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/andtidwiki.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the AndTidWiki Android app\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar AndTidWiki = function(wiki) {\n};\n\nAndTidWiki.prototype.save = function(text,method,callback) {\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.toString().split(\"#\")[0]);\n\t// Strip the file://\n\tif(pathname.indexOf(\"file://\") === 0) {\n\t\tpathname = pathname.substr(7);\n\t}\n\t// Strip any query or location part\n\tvar p = pathname.indexOf(\"?\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\"#\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\t// Save the file\n\twindow.twi.saveFile(pathname,text);\n\t// Call the callback\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nAndTidWiki.prototype.info = {\n\tname: \"andtidwiki\",\n\tpriority: 1600,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.twi && !!window.twi.saveFile;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new AndTidWiki(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/andtidwiki.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/beaker.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/beaker.js\ntype: application/javascript\nmodule-type: saver\n\nSaves files using the Beaker browser's (https://beakerbrowser.com) Dat protocol (https://datproject.org/)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet up the saver\n*/\nvar BeakerSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nBeakerSaver.prototype.save = function(text,method,callback) {\n\tvar url = (location.toString()).split(\"#\")[0];\n\tdat.stat(url).then(function(value) {\n\t\tif(value.type === \"directory\") {\n\t\t\turl = url + \"/index.html\";\n\t\t}\n\t\tdat.writeFile(url,text,\"utf8\").then(function(value) {\n\t\t\tcallback(null);\n\t\t},function(reason) {\n\t\t\tcallback(\"Beaker Saver Write Error: \" + reason);\n\t\t});\t\t\n\t},function(reason) {\n\t\tcallback(\"Beaker Saver Stat Error: \" + reason);\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nBeakerSaver.prototype.info = {\n\tname: \"beaker\",\n\tpriority: 3000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.dat;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new BeakerSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/beaker.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/download.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/download.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar DownloadSaver = function(wiki) {\n};\n\nDownloadSaver.prototype.save = function(text,method,callback,options) {\n\toptions = options || {};\n\t// Get the current filename\n\tvar filename = options.variables.filename;\n\tif(!filename) {\n\t\tvar p = document.location.pathname.lastIndexOf(\"/\");\n\t\tif(p !== -1) {\n\t\t\tfilename = document.location.pathname.substr(p+1);\n\t\t}\n\t}\n\tif(!filename) {\n\t\tfilename = \"tiddlywiki.html\";\n\t}\n\t// Set up the link\n\tvar link = document.createElement(\"a\");\n\tif(Blob !== undefined) {\n\t\tvar blob = new Blob([text], {type: \"text/html\"});\n\t\tlink.setAttribute(\"href\", URL.createObjectURL(blob));\n\t} else {\n\t\tlink.setAttribute(\"href\",\"data:text/html,\" + encodeURIComponent(text));\n\t}\n\tlink.setAttribute(\"download\",filename);\n\tdocument.body.appendChild(link);\n\tlink.click();\n\tdocument.body.removeChild(link);\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nDownloadSaver.prototype.info = {\n\tname: \"download\",\n\tpriority: 100\n};\n\nObject.defineProperty(DownloadSaver.prototype.info, \"capabilities\", {\n\tget: function() {\n\t\tvar capabilities = [\"save\", \"download\"];\n\t\tif(($tw.wiki.getTextReference(\"$:/config/DownloadSaver/AutoSave\") || \"\").toLowerCase() === \"yes\") {\n\t\t\tcapabilities.push(\"autosave\");\n\t\t}\n\t\treturn capabilities;\n\t}\n});\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn document.createElement(\"a\").download !== undefined;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new DownloadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/download.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/fsosaver.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/fsosaver.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via MS FileSystemObject ActiveXObject\n\nNote: Since TiddlyWiki's markup contains the MOTW, the FileSystemObject normally won't be available. \nHowever, if the wiki is loaded as an .HTA file (Windows HTML Applications) then the FSO can be used.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar FSOSaver = function(wiki) {\n};\n\nFSOSaver.prototype.save = function(text,method,callback) {\n\t// Get the pathname of this document\n\tvar pathname = unescape(document.location.pathname);\n\t// Test for a Windows path of the form /x:\\blah...\n\tif(/^\\/[A-Z]\\:\\\\[^\\\\]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t} else if(document.location.hostname !== \"\" && /^\\/\\\\[^\\\\]+\\\\[^\\\\]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t\t// reconstruct UNC path\n\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t} else {\n\t\treturn false;\n\t}\n\t// Save the file (as UTF-16)\n\tvar fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n\tvar file = fso.OpenTextFile(pathname,2,-1,-1);\n\tfile.Write(text);\n\tfile.Close();\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nFSOSaver.prototype.info = {\n\tname: \"FSOSaver\",\n\tpriority: 120,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\ttry {\n\t\treturn (window.location.protocol === \"file:\") && !!(new ActiveXObject(\"Scripting.FileSystemObject\"));\n\t} catch(e) { return false; }\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new FSOSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/fsosaver.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/manualdownload.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/manualdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Title of the tiddler containing the download message\nvar downloadInstructionsTitle = \"$:/language/Modals/Download\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar ManualDownloadSaver = function(wiki) {\n};\n\nManualDownloadSaver.prototype.save = function(text,method,callback) {\n\t$tw.modal.display(downloadInstructionsTitle,{\n\t\tdownloadLink: \"data:text/html,\" + encodeURIComponent(text)\n\t});\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nManualDownloadSaver.prototype.info = {\n\tname: \"manualdownload\",\n\tpriority: 0,\n\tcapabilities: [\"save\", \"download\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new ManualDownloadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/manualdownload.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/msdownload.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/msdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via window.navigator.msSaveBlob()\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar MsDownloadSaver = function(wiki) {\n};\n\nMsDownloadSaver.prototype.save = function(text,method,callback) {\n\t// Get the current filename\n\tvar filename = \"tiddlywiki.html\",\n\t\tp = document.location.pathname.lastIndexOf(\"/\");\n\tif(p !== -1) {\n\t\tfilename = document.location.pathname.substr(p+1);\n\t}\n\t// Set up the link\n\tvar blob = new Blob([text], {type: \"text/html\"});\n\twindow.navigator.msSaveBlob(blob,filename);\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nMsDownloadSaver.prototype.info = {\n\tname: \"msdownload\",\n\tpriority: 110,\n\tcapabilities: [\"save\", \"download\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.navigator.msSaveBlob;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new MsDownloadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/msdownload.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/put.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/put.js\ntype: application/javascript\nmodule-type: saver\n\nSaves wiki by performing a PUT request to the server\n\nWorks with any server which accepts a PUT request\nto the current URL, such as a WebDAV server.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar PutSaver = function(wiki) {\n\tthis.wiki = wiki;\n\tvar self = this;\n\tvar uri = this.uri();\n\t// Async server probe. Until probe finishes, save will fail fast\n\t// See also https://github.com/Jermolene/TiddlyWiki5/issues/2276\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: \"OPTIONS\",\n\t\tcallback: function(err, data, xhr) {\n\t\t\t// Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1\n\t\t\tif(!err) {\n\t\t\t\tself.serverAcceptsPuts = xhr.status === 200 && !!xhr.getResponseHeader(\"dav\");\n\t\t\t}\n\t\t}\n\t});\n\t// Retrieve ETag if available\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: \"HEAD\",\n\t\tcallback: function(err, data, xhr) {\n\t\t\tif(!err) {\n\t\t\t\tself.etag = xhr.getResponseHeader(\"ETag\");\n\t\t\t}\n\t\t}\n\t});\n};\n\nPutSaver.prototype.uri = function() {\n\treturn encodeURI(document.location.toString().split(\"#\")[0]);\n};\n\n// TODO: in case of edit conflict\n// Prompt: Do you want to save over this? Y/N\n// Merging would be ideal, and may be possible using future generic merge flow\nPutSaver.prototype.save = function(text, method, callback) {\n\tif(!this.serverAcceptsPuts) {\n\t\treturn false;\n\t}\n\tvar self = this;\n\tvar headers = { \"Content-Type\": \"text/html;charset=UTF-8\" };\n\tif(this.etag) {\n\t\theaders[\"If-Match\"] = this.etag;\n\t}\n\t$tw.utils.httpRequest({\n\t\turl: this.uri(),\n\t\ttype: \"PUT\",\n\t\theaders: headers,\n\t\tdata: text,\n\t\tcallback: function(err, data, xhr) {\n\t\t\tif(err) {\n\t\t\t\tcallback(err);\n\t\t\t} if(xhr.status === 200 || xhr.status === 201) {\n\t\t\t\tself.etag = xhr.getResponseHeader(\"ETag\");\n\t\t\t\tcallback(null); // success\n\t\t\t} else if(xhr.status === 412) { // edit conflict\n\t\t\t\tvar message = $tw.language.getString(\"Error/EditConflict\");\n\t\t\t\tcallback(message);\n\t\t\t} else {\n\t\t\t\tcallback(xhr.responseText); // fail\n\t\t\t}\n\t\t}\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nPutSaver.prototype.info = {\n\tname: \"put\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn /^https?:/.test(location.protocol);\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new PutSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/put.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/tiddlyfox.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyfox.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TiddlyFox file extension\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TiddlyFoxSaver = function(wiki) {\n};\n\nTiddlyFoxSaver.prototype.save = function(text,method,callback) {\n\tvar messageBox = document.getElementById(\"tiddlyfox-message-box\");\n\tif(messageBox) {\n\t\t// Get the pathname of this document\n\t\tvar pathname = document.location.toString().split(\"#\")[0];\n\t\t// Replace file://localhost/ with file:///\n\t\tif(pathname.indexOf(\"file://localhost/\") === 0) {\n\t\t\tpathname = \"file://\" + pathname.substr(16);\n\t\t}\n\t\t// Windows path file:///x:/blah/blah --> x:\\blah\\blah\n\t\tif(/^file\\:\\/\\/\\/[A-Z]\\:\\//i.test(pathname)) {\n\t\t\t// Remove the leading slash and convert slashes to backslashes\n\t\t\tpathname = pathname.substr(8).replace(/\\//g,\"\\\\\");\n\t\t// Firefox Windows network path file://///server/share/blah/blah --> //server/share/blah/blah\n\t\t} else if(pathname.indexOf(\"file://///\") === 0) {\n\t\t\tpathname = \"\\\\\\\\\" + unescape(pathname.substr(10)).replace(/\\//g,\"\\\\\");\n\t\t// Mac/Unix local path file:///path/path --> /path/path\n\t\t} else if(pathname.indexOf(\"file:///\") === 0) {\n\t\t\tpathname = unescape(pathname.substr(7));\n\t\t// Mac/Unix local path file:/path/path --> /path/path\n\t\t} else if(pathname.indexOf(\"file:/\") === 0) {\n\t\t\tpathname = unescape(pathname.substr(5));\n\t\t// Otherwise Windows networth path file://server/share/path/path --> \\\\server\\share\\path\\path\n\t\t} else {\n\t\t\tpathname = \"\\\\\\\\\" + unescape(pathname.substr(7)).replace(new RegExp(\"/\",\"g\"),\"\\\\\");\n\t\t}\n\t\t// Create the message element and put it in the message box\n\t\tvar message = document.createElement(\"div\");\n\t\tmessage.setAttribute(\"data-tiddlyfox-path\",decodeURIComponent(pathname));\n\t\tmessage.setAttribute(\"data-tiddlyfox-content\",text);\n\t\tmessageBox.appendChild(message);\n\t\t// Add an event handler for when the file has been saved\n\t\tmessage.addEventListener(\"tiddlyfox-have-saved-file\",function(event) {\n\t\t\tcallback(null);\n\t\t}, false);\n\t\t// Create and dispatch the custom event to the extension\n\t\tvar event = document.createEvent(\"Events\");\n\t\tevent.initEvent(\"tiddlyfox-save-file\",true,false);\n\t\tmessage.dispatchEvent(event);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyFoxSaver.prototype.info = {\n\tname: \"tiddlyfox\",\n\tpriority: 1500,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyFoxSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/tiddlyfox.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/tiddlyie.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyie.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via Internet Explorer BHO extenion (TiddlyIE)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar TiddlyIESaver = function(wiki) {\n};\n\nTiddlyIESaver.prototype.save = function(text,method,callback) {\n\t// Check existence of TiddlyIE BHO extension (note: only works after document is complete)\n\tif(typeof(window.TiddlyIE) != \"undefined\") {\n\t\t// Get the pathname of this document\n\t\tvar pathname = unescape(document.location.pathname);\n\t\t// Test for a Windows path of the form /x:/blah...\n\t\tif(/^\\/[A-Z]\\:\\/[^\\/]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+ (is this better?: ^/[a-z]:/[^/]+(/[^/]+)*\\.[^/]+ )\n\t\t\t// Remove the leading slash\n\t\t\tpathname = pathname.substr(1);\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t} else if(document.hostname !== \"\" && /^\\/[^\\/]+\\/[^\\/]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t\t// reconstruct UNC path\n\t\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t\t} else return false;\n\t\t// Prompt the user to save the file\n\t\twindow.TiddlyIE.save(pathname, text);\n\t\t// Callback that we succeeded\n\t\tcallback(null);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyIESaver.prototype.info = {\n\tname: \"tiddlyiesaver\",\n\tpriority: 1500,\n\tcapabilities: [\"save\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn (window.location.protocol === \"file:\");\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyIESaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/tiddlyie.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/twedit.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/twedit.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TWEdit iOS app\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TWEditSaver = function(wiki) {\n};\n\nTWEditSaver.prototype.save = function(text,method,callback) {\n\t// Bail if we're not running under TWEdit\n\tif(typeof DeviceInfo !== \"object\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.pathname);\n\t// Strip any query or location part\n\tvar p = pathname.indexOf(\"?\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\"#\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\t// Remove the leading \"/Documents\" from path\n\tvar prefix = \"/Documents\";\n\tif(pathname.indexOf(prefix) === 0) {\n\t\tpathname = pathname.substr(prefix.length);\n\t}\n\t// Error handler\n\tvar errorHandler = function(event) {\n\t\t// Error\n\t\tcallback($tw.language.getString(\"Error/SavingToTWEdit\") + \": \" + event.target.error.code);\n\t};\n\t// Get the file system\n\twindow.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) {\n\t\t// Now we've got the filesystem, get the fileEntry\n\t\tfileSystem.root.getFile(pathname, {create: true}, function(fileEntry) {\n\t\t\t// Now we've got the fileEntry, create the writer\n\t\t\tfileEntry.createWriter(function(writer) {\n\t\t\t\twriter.onerror = errorHandler;\n\t\t\t\twriter.onwrite = function() {\n\t\t\t\t\tcallback(null);\n\t\t\t\t};\n\t\t\t\twriter.position = 0;\n\t\t\t\twriter.write(text);\n\t\t\t},errorHandler);\n\t\t}, errorHandler);\n\t}, errorHandler);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nTWEditSaver.prototype.info = {\n\tname: \"twedit\",\n\tpriority: 1600,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TWEditSaver(wiki);\n};\n\n/////////////////////////// Hack\n// HACK: This ensures that TWEdit recognises us as a TiddlyWiki document\nif($tw.browser) {\n\twindow.version = {title: \"TiddlyWiki\"};\n}\n\n})();\n",
"title": "$:/core/modules/savers/twedit.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/upload.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/upload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via upload to a server.\n\nDesigned to be compatible with BidiX's UploadPlugin at http://tiddlywiki.bidix.info/#UploadPlugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar UploadSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nUploadSaver.prototype.save = function(text,method,callback) {\n\t// Get the various parameters we need\n\tvar backupDir = this.wiki.getTextReference(\"$:/UploadBackupDir\") || \".\",\n\t\tusername = this.wiki.getTextReference(\"$:/UploadName\"),\n\t\tpassword = $tw.utils.getPassword(\"upload\"),\n\t\tuploadDir = this.wiki.getTextReference(\"$:/UploadDir\") || \".\",\n\t\tuploadFilename = this.wiki.getTextReference(\"$:/UploadFilename\") || \"index.html\",\n\t\turl = this.wiki.getTextReference(\"$:/UploadURL\");\n\t// Bail out if we don't have the bits we need\n\tif(!username || username.toString().trim() === \"\" || !password || password.toString().trim() === \"\") {\n\t\treturn false;\n\t}\n\t// Construct the url if not provided\n\tif(!url) {\n\t\turl = \"http://\" + username + \".tiddlyspot.com/store.cgi\";\n\t}\n\t// Assemble the header\n\tvar boundary = \"---------------------------\" + \"AaB03x\";\t\n\tvar uploadFormName = \"UploadPlugin\";\n\tvar head = [];\n\thead.push(\"--\" + boundary + \"\\r\\nContent-disposition: form-data; name=\\\"UploadPlugin\\\"\\r\\n\");\n\thead.push(\"backupDir=\" + backupDir + \";user=\" + username + \";password=\" + password + \";uploaddir=\" + uploadDir + \";;\"); \n\thead.push(\"\\r\\n\" + \"--\" + boundary);\n\thead.push(\"Content-disposition: form-data; name=\\\"userfile\\\"; filename=\\\"\" + uploadFilename + \"\\\"\");\n\thead.push(\"Content-Type: text/html;charset=UTF-8\");\n\thead.push(\"Content-Length: \" + text.length + \"\\r\\n\");\n\thead.push(\"\");\n\t// Assemble the tail and the data itself\n\tvar tail = \"\\r\\n--\" + boundary + \"--\\r\\n\",\n\t\tdata = head.join(\"\\r\\n\") + text + tail;\n\t// Do the HTTP post\n\tvar http = new XMLHttpRequest();\n\thttp.open(\"POST\",url,true,username,password);\n\thttp.setRequestHeader(\"Content-Type\",\"multipart/form-data; charset=UTF-8; boundary=\" + boundary);\n\thttp.onreadystatechange = function() {\n\t\tif(http.readyState == 4 && http.status == 200) {\n\t\t\tif(http.responseText.substr(0,4) === \"0 - \") {\n\t\t\t\tcallback(null);\n\t\t\t} else {\n\t\t\t\tcallback(http.responseText);\n\t\t\t}\n\t\t}\n\t};\n\ttry {\n\t\thttp.send(data);\n\t} catch(ex) {\n\t\treturn callback($tw.language.getString(\"Error/Caption\") + \":\" + ex);\n\t}\n\t$tw.notifier.display(\"$:/language/Notifications/Save/Starting\");\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nUploadSaver.prototype.info = {\n\tname: \"upload\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new UploadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/upload.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/browser-messaging.js": {
"text": "/*\\\ntitle: $:/core/modules/browser-messaging.js\ntype: application/javascript\nmodule-type: startup\n\nBrowser message handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"browser-messaging\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n/*\nLoad a specified url as an iframe and call the callback when it is loaded. If the url is already loaded then the existing iframe instance is used\n*/\nfunction loadIFrame(url,callback) {\n\t// Check if iframe already exists\n\tvar iframeInfo = $tw.browserMessaging.iframeInfoMap[url];\n\tif(iframeInfo) {\n\t\t// We've already got the iframe\n\t\tcallback(null,iframeInfo);\n\t} else {\n\t\t// Create the iframe and save it in the list\n\t\tvar iframe = document.createElement(\"iframe\");\n\t\tiframeInfo = {\n\t\t\turl: url,\n\t\t\tstatus: \"loading\",\n\t\t\tdomNode: iframe\n\t\t};\n\t\t$tw.browserMessaging.iframeInfoMap[url] = iframeInfo;\n\t\tsaveIFrameInfoTiddler(iframeInfo);\n\t\t// Add the iframe to the DOM and hide it\n\t\tiframe.style.display = \"none\";\n\t\tiframe.setAttribute(\"library\",\"true\");\n\t\tdocument.body.appendChild(iframe);\n\t\t// Set up onload\n\t\tiframe.onload = function() {\n\t\t\tiframeInfo.status = \"loaded\";\n\t\t\tsaveIFrameInfoTiddler(iframeInfo);\n\t\t\tcallback(null,iframeInfo);\n\t\t};\n\t\tiframe.onerror = function() {\n\t\t\tcallback(\"Cannot load iframe\");\n\t\t};\n\t\ttry {\n\t\t\tiframe.src = url;\n\t\t} catch(ex) {\n\t\t\tcallback(ex);\n\t\t}\n\t}\n}\n\n/*\nUnload library iframe for given url\n*/\nfunction unloadIFrame(url){\n\t$tw.utils.each(document.getElementsByTagName('iframe'), function(iframe) {\n\t\tif(iframe.getAttribute(\"library\") === \"true\" &&\n\t\t iframe.getAttribute(\"src\") === url) {\n\t\t\tiframe.parentNode.removeChild(iframe);\n\t\t}\n\t});\n}\n\nfunction saveIFrameInfoTiddler(iframeInfo) {\n\t$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),{\n\t\ttitle: \"$:/temp/ServerConnection/\" + iframeInfo.url,\n\t\ttext: iframeInfo.status,\n\t\ttags: [\"$:/tags/ServerConnection\"],\n\t\turl: iframeInfo.url\n\t},$tw.wiki.getModificationFields()));\n}\n\nexports.startup = function() {\n\t// Initialise the store of iframes we've created\n\t$tw.browserMessaging = {\n\t\tiframeInfoMap: {} // Hashmap by URL of {url:,status:\"loading/loaded\",domNode:}\n\t};\n\t// Listen for widget messages to control loading the plugin library\n\t$tw.rootWidget.addEventListener(\"tm-load-plugin-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url;\n\t\tif(url) {\n\t\t\tloadIFrame(url,function(err,iframeInfo) {\n\t\t\t\tif(err) {\n\t\t\t\t\talert($tw.language.getString(\"Error/LoadingPluginLibrary\") + \": \" + url);\n\t\t\t\t} else {\n\t\t\t\t\tiframeInfo.domNode.contentWindow.postMessage({\n\t\t\t\t\t\tverb: \"GET\",\n\t\t\t\t\t\turl: \"recipes/library/tiddlers.json\",\n\t\t\t\t\t\tcookies: {\n\t\t\t\t\t\t\ttype: \"save-info\",\n\t\t\t\t\t\t\tinfoTitlePrefix: paramObject.infoTitlePrefix || \"$:/temp/RemoteAssetInfo/\",\n\t\t\t\t\t\t\turl: url\n\t\t\t\t\t\t}\n\t\t\t\t\t},\"*\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\t// Listen for widget messages to control unloading the plugin library\n\t$tw.rootWidget.addEventListener(\"tm-unload-plugin-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url;\n\t\t$tw.browserMessaging.iframeInfoMap[url] = undefined;\n\t\tif(url) {\n\t\t\tunloadIFrame(url);\n\t\t\t$tw.utils.each(\n\t\t\t\t$tw.wiki.filterTiddlers(\"[[$:/temp/ServerConnection/\" + url + \"]] [prefix[$:/temp/RemoteAssetInfo/\" + url + \"/]]\"),\n\t\t\t\tfunction(title) {\n\t\t\t\t\t$tw.wiki.deleteTiddler(title);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-load-plugin-from-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url,\n\t\t\ttitle = paramObject.title;\n\t\tif(url && title) {\n\t\t\tloadIFrame(url,function(err,iframeInfo) {\n\t\t\t\tif(err) {\n\t\t\t\t\talert($tw.language.getString(\"Error/LoadingPluginLibrary\") + \": \" + url);\n\t\t\t\t} else {\n\t\t\t\t\tiframeInfo.domNode.contentWindow.postMessage({\n\t\t\t\t\t\tverb: \"GET\",\n\t\t\t\t\t\turl: \"recipes/library/tiddlers/\" + encodeURIComponent(title) + \".json\",\n\t\t\t\t\t\tcookies: {\n\t\t\t\t\t\t\ttype: \"save-tiddler\",\n\t\t\t\t\t\t\turl: url\n\t\t\t\t\t\t}\n\t\t\t\t\t},\"*\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\t// Listen for window messages from other windows\n\twindow.addEventListener(\"message\",function listener(event){\n\t\tconsole.log(\"browser-messaging: \",document.location.toString())\n\t\tconsole.log(\"browser-messaging: Received message from\",event.origin);\n\t\tconsole.log(\"browser-messaging: Message content\",event.data);\n\t\tswitch(event.data.verb) {\n\t\t\tcase \"GET-RESPONSE\":\n\t\t\t\tif(event.data.status.charAt(0) === \"2\") {\n\t\t\t\t\tif(event.data.cookies) {\n\t\t\t\t\t\tif(event.data.cookies.type === \"save-info\") {\n\t\t\t\t\t\t\tvar tiddlers = JSON.parse(event.data.body);\n\t\t\t\t\t\t\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\t\t\t\t\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\t\t\t\t\ttitle: event.data.cookies.infoTitlePrefix + event.data.cookies.url + \"/\" + tiddler.title,\n\t\t\t\t\t\t\t\t\t\"original-title\": tiddler.title,\n\t\t\t\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\t\t\t\ttype: \"text/vnd.tiddlywiki\",\n\t\t\t\t\t\t\t\t\t\"original-type\": tiddler.type,\n\t\t\t\t\t\t\t\t\t\"plugin-type\": undefined,\n\t\t\t\t\t\t\t\t\t\"original-plugin-type\": tiddler[\"plugin-type\"],\n\t\t\t\t\t\t\t\t\t\"module-type\": undefined,\n\t\t\t\t\t\t\t\t\t\"original-module-type\": tiddler[\"module-type\"],\n\t\t\t\t\t\t\t\t\ttags: [\"$:/tags/RemoteAssetInfo\"],\n\t\t\t\t\t\t\t\t\t\"original-tags\": $tw.utils.stringifyList(tiddler.tags || []),\n\t\t\t\t\t\t\t\t\t\"server-url\": event.data.cookies.url\n\t\t\t\t\t\t\t\t},$tw.wiki.getModificationFields()));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if(event.data.cookies.type === \"save-tiddler\") {\n\t\t\t\t\t\t\tvar tiddler = JSON.parse(event.data.body);\n\t\t\t\t\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler(tiddler));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t},false);\n};\n\n})();\n",
"title": "$:/core/modules/browser-messaging.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/commands.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/commands.js\ntype: application/javascript\nmodule-type: startup\n\nCommand processing\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"commands\";\nexports.platforms = [\"node\"];\nexports.after = [\"story\"];\nexports.synchronous = false;\n\nexports.startup = function(callback) {\n\t// On the server, start a commander with the command line arguments\n\tvar commander = new $tw.Commander(\n\t\t$tw.boot.argv,\n\t\tfunction(err) {\n\t\t\tif(err) {\n\t\t\t\treturn $tw.utils.error(\"Error: \" + err);\n\t\t\t}\n\t\t\tcallback();\n\t\t},\n\t\t$tw.wiki,\n\t\t{output: process.stdout, error: process.stderr}\n\t);\n\tcommander.execute();\n};\n\n})();\n",
"title": "$:/core/modules/startup/commands.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/favicon.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/favicon.js\ntype: application/javascript\nmodule-type: startup\n\nFavicon handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"favicon\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\t\t\n// Favicon tiddler\nvar FAVICON_TITLE = \"$:/favicon.ico\";\n\nexports.startup = function() {\n\t// Set up the favicon\n\tsetFavicon();\n\t// Reset the favicon when the tiddler changes\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,FAVICON_TITLE)) {\n\t\t\tsetFavicon();\n\t\t}\n\t});\n};\n\nfunction setFavicon() {\n\tvar tiddler = $tw.wiki.getTiddler(FAVICON_TITLE);\n\tif(tiddler) {\n\t\tvar faviconLink = document.getElementById(\"faviconLink\");\n\t\tfaviconLink.setAttribute(\"href\",\"data:\" + tiddler.fields.type + \";base64,\" + tiddler.fields.text);\n\t}\n}\n\n})();\n",
"title": "$:/core/modules/startup/favicon.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/info.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/info.js\ntype: application/javascript\nmodule-type: startup\n\nInitialise $:/info tiddlers via $:/temp/info-plugin pseudo-plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"info\";\nexports.before = [\"startup\"];\nexports.after = [\"load-modules\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\t// Collect up the info tiddlers\n\tvar infoTiddlerFields = {};\n\t// Give each info module a chance to fill in as many info tiddlers as they want\n\t$tw.modules.forEachModuleOfType(\"info\",function(title,moduleExports) {\n\t\tif(moduleExports && moduleExports.getInfoTiddlerFields) {\n\t\t\tvar tiddlerFieldsArray = moduleExports.getInfoTiddlerFields(infoTiddlerFields);\n\t\t\t$tw.utils.each(tiddlerFieldsArray,function(fields) {\n\t\t\t\tif(fields) {\n\t\t\t\t\tinfoTiddlerFields[fields.title] = fields;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\t// Bake the info tiddlers into a plugin\n\tvar fields = {\n\t\ttitle: \"$:/temp/info-plugin\",\n\t\ttype: \"application/json\",\n\t\t\"plugin-type\": \"info\",\n\t\ttext: JSON.stringify({tiddlers: infoTiddlerFields},null,$tw.config.preferences.jsonSpaces)\n\t};\n\t$tw.wiki.addTiddler(new $tw.Tiddler(fields));\n\t$tw.wiki.readPluginInfo();\n\t$tw.wiki.registerPluginTiddlers(\"info\");\n\t$tw.wiki.unpackPluginTiddlers();\n};\n\n})();\n",
"title": "$:/core/modules/startup/info.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/load-modules.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/load-modules.js\ntype: application/javascript\nmodule-type: startup\n\nLoad core modules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"load-modules\";\nexports.synchronous = true;\n\nexports.startup = function() {\n\t// Load modules\n\t$tw.modules.applyMethods(\"utils\",$tw.utils);\n\tif($tw.node) {\n\t\t$tw.modules.applyMethods(\"utils-node\",$tw.utils);\n\t}\n\t$tw.modules.applyMethods(\"global\",$tw);\n\t$tw.modules.applyMethods(\"config\",$tw.config);\n\t$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap(\"tiddlerfield\");\n\t$tw.modules.applyMethods(\"tiddlermethod\",$tw.Tiddler.prototype);\n\t$tw.modules.applyMethods(\"wikimethod\",$tw.Wiki.prototype);\n\t$tw.modules.applyMethods(\"tiddlerdeserializer\",$tw.Wiki.tiddlerDeserializerModules);\n\t$tw.macros = $tw.modules.getModulesByTypeAsHashmap(\"macro\");\n\t$tw.wiki.initParsers();\n\t$tw.Commander.initCommands();\n};\n\n})();\n",
"title": "$:/core/modules/startup/load-modules.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/password.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/password.js\ntype: application/javascript\nmodule-type: startup\n\nPassword handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"password\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\t$tw.rootWidget.addEventListener(\"tm-set-password\",function(event) {\n\t\t$tw.passwordPrompt.createPrompt({\n\t\t\tserviceName: $tw.language.getString(\"Encryption/PromptSetPassword\"),\n\t\t\tnoUserName: true,\n\t\t\tsubmitText: $tw.language.getString(\"Encryption/SetPassword\"),\n\t\t\tcanCancel: true,\n\t\t\trepeatPassword: true,\n\t\t\tcallback: function(data) {\n\t\t\t\tif(data) {\n\t\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\t}\n\t\t\t\treturn true; // Get rid of the password prompt\n\t\t\t}\n\t\t});\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-clear-password\",function(event) {\n\t\tif($tw.browser) {\n\t\t\tif(!confirm($tw.language.getString(\"Encryption/ConfirmClearPassword\"))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t$tw.crypto.setPassword(null);\n\t});\n\t// Ensure that $:/isEncrypted is maintained properly\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,\"$:/isEncrypted\")) {\n\t\t\t$tw.crypto.updateCryptoStateTiddler();\n\t\t}\n\t});\n};\n\n})();\n",
"title": "$:/core/modules/startup/password.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/render.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/render.js\ntype: application/javascript\nmodule-type: startup\n\nTitle, stylesheet and page rendering\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"render\";\nexports.platforms = [\"browser\"];\nexports.after = [\"story\"];\nexports.synchronous = true;\n\n// Default story and history lists\nvar PAGE_TITLE_TITLE = \"$:/core/wiki/title\";\nvar PAGE_STYLESHEET_TITLE = \"$:/core/ui/PageStylesheet\";\nvar PAGE_TEMPLATE_TITLE = \"$:/core/ui/PageTemplate\";\n\n// Time (in ms) that we defer refreshing changes to draft tiddlers\nvar DRAFT_TIDDLER_TIMEOUT_TITLE = \"$:/config/Drafts/TypingTimeout\";\nvar DRAFT_TIDDLER_TIMEOUT = 400;\n\nexports.startup = function() {\n\t// Set up the title\n\t$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE,{document: $tw.fakeDocument, parseAsInline: true});\n\t$tw.titleContainer = $tw.fakeDocument.createElement(\"div\");\n\t$tw.titleWidgetNode.render($tw.titleContainer,null);\n\tdocument.title = $tw.titleContainer.textContent;\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.titleWidgetNode.refresh(changes,$tw.titleContainer,null)) {\n\t\t\tdocument.title = $tw.titleContainer.textContent;\n\t\t}\n\t});\n\t// Set up the styles\n\t$tw.styleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_STYLESHEET_TITLE,{document: $tw.fakeDocument});\n\t$tw.styleContainer = $tw.fakeDocument.createElement(\"style\");\n\t$tw.styleWidgetNode.render($tw.styleContainer,null);\n\t$tw.styleElement = document.createElement(\"style\");\n\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\tdocument.head.insertBefore($tw.styleElement,document.head.firstChild);\n\t$tw.wiki.addEventListener(\"change\",$tw.perf.report(\"styleRefresh\",function(changes) {\n\t\tif($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {\n\t\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\t}\n\t}));\n\t// Display the $:/core/ui/PageTemplate tiddler to kick off the display\n\t$tw.perf.report(\"mainRender\",function() {\n\t\t$tw.pageWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TEMPLATE_TITLE,{document: document, parentWidget: $tw.rootWidget});\n\t\t$tw.pageContainer = document.createElement(\"div\");\n\t\t$tw.utils.addClass($tw.pageContainer,\"tc-page-container-wrapper\");\n\t\tdocument.body.insertBefore($tw.pageContainer,document.body.firstChild);\n\t\t$tw.pageWidgetNode.render($tw.pageContainer,null);\n\t})();\n\t// Prepare refresh mechanism\n\tvar deferredChanges = Object.create(null),\n\t\ttimerId;\n\tfunction refresh() {\n\t\t// Process the refresh\n\t\t$tw.pageWidgetNode.refresh(deferredChanges);\n\t\tdeferredChanges = Object.create(null);\n\t}\n\t// Add the change event handler\n\t$tw.wiki.addEventListener(\"change\",$tw.perf.report(\"mainRefresh\",function(changes) {\n\t\t// Check if only drafts have changed\n\t\tvar onlyDraftsHaveChanged = true;\n\t\tfor(var title in changes) {\n\t\t\tvar tiddler = $tw.wiki.getTiddler(title);\n\t\t\tif(!tiddler || !tiddler.hasField(\"draft.of\")) {\n\t\t\t\tonlyDraftsHaveChanged = false;\n\t\t\t}\n\t\t}\n\t\t// Defer the change if only drafts have changed\n\t\tif(timerId) {\n\t\t\tclearTimeout(timerId);\n\t\t}\n\t\ttimerId = null;\n\t\tif(onlyDraftsHaveChanged) {\n\t\t\tvar timeout = parseInt($tw.wiki.getTiddlerText(DRAFT_TIDDLER_TIMEOUT_TITLE,\"\"),10);\n\t\t\tif(isNaN(timeout)) {\n\t\t\t\ttimeout = DRAFT_TIDDLER_TIMEOUT;\n\t\t\t}\n\t\t\ttimerId = setTimeout(refresh,timeout);\n\t\t\t$tw.utils.extend(deferredChanges,changes);\n\t\t} else {\n\t\t\t$tw.utils.extend(deferredChanges,changes);\n\t\t\trefresh();\n\t\t}\n\t}));\n\t// Fix up the link between the root widget and the page container\n\t$tw.rootWidget.domNodes = [$tw.pageContainer];\n\t$tw.rootWidget.children = [$tw.pageWidgetNode];\n};\n\n})();\n",
"title": "$:/core/modules/startup/render.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/rootwidget.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/rootwidget.js\ntype: application/javascript\nmodule-type: startup\n\nSetup the root widget and the core root widget handlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"rootwidget\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.before = [\"story\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\t// Install the modal message mechanism\n\t$tw.modal = new $tw.utils.Modal($tw.wiki);\n\t$tw.rootWidget.addEventListener(\"tm-modal\",function(event) {\n\t\t$tw.modal.display(event.param,{variables: event.paramObject});\n\t});\n\t// Install the notification mechanism\n\t$tw.notifier = new $tw.utils.Notifier($tw.wiki);\n\t$tw.rootWidget.addEventListener(\"tm-notify\",function(event) {\n\t\t$tw.notifier.display(event.param,{variables: event.paramObject});\n\t});\n\t// Install the scroller\n\t$tw.pageScroller = new $tw.utils.PageScroller();\n\t$tw.rootWidget.addEventListener(\"tm-scroll\",function(event) {\n\t\t$tw.pageScroller.handleEvent(event);\n\t});\n\tvar fullscreen = $tw.utils.getFullScreenApis();\n\tif(fullscreen) {\n\t\t$tw.rootWidget.addEventListener(\"tm-full-screen\",function(event) {\n\t\t\tif(document[fullscreen._fullscreenElement]) {\n\t\t\t\tdocument[fullscreen._exitFullscreen]();\n\t\t\t} else {\n\t\t\t\tdocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);\n\t\t\t}\n\t\t});\n\t}\n\t// If we're being viewed on a data: URI then give instructions for how to save\n\tif(document.location.protocol === \"data:\") {\n\t\t$tw.rootWidget.dispatchEvent({\n\t\t\ttype: \"tm-modal\",\n\t\t\tparam: \"$:/language/Modals/SaveInstructions\"\n\t\t});\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/startup/rootwidget.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup.js": {
"text": "/*\\\ntitle: $:/core/modules/startup.js\ntype: application/javascript\nmodule-type: startup\n\nMiscellaneous startup logic for both the client and server.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"startup\";\nexports.after = [\"load-modules\"];\nexports.synchronous = true;\n\n// Set to `true` to enable performance instrumentation\nvar PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = \"$:/config/Performance/Instrumentation\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.startup = function() {\n\tvar modules,n,m,f;\n\t// Minimal browser detection\n\tif($tw.browser) {\n\t\t$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));\n\t\t$tw.browser.isFirefox = !!document.mozFullScreenEnabled;\n\t}\n\t// Platform detection\n\t$tw.platform = {};\n\tif($tw.browser) {\n\t\t$tw.platform.isMac = /Mac/.test(navigator.platform);\n\t\t$tw.platform.isWindows = /win/i.test(navigator.platform);\n\t\t$tw.platform.isLinux = /Linux/i.test(navigator.appVersion);\n\t} else {\n\t\tswitch(require(\"os\").platform()) {\n\t\t\tcase \"darwin\":\n\t\t\t\t$tw.platform.isMac = true;\n\t\t\t\tbreak;\n\t\t\tcase \"win32\":\n\t\t\t\t$tw.platform.isWindows = true;\n\t\t\t\tbreak;\n\t\t\tcase \"freebsd\":\n\t\t\t\t$tw.platform.isLinux = true;\n\t\t\t\tbreak;\n\t\t\tcase \"linux\":\n\t\t\t\t$tw.platform.isLinux = true;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t// Initialise version\n\t$tw.version = $tw.utils.extractVersionInfo();\n\t// Set up the performance framework\n\t$tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,\"no\") === \"yes\");\n\t// Kick off the language manager and switcher\n\t$tw.language = new $tw.Language();\n\t$tw.languageSwitcher = new $tw.PluginSwitcher({\n\t\twiki: $tw.wiki,\n\t\tpluginType: \"language\",\n\t\tcontrollerTitle: \"$:/language\",\n\t\tdefaultPlugins: [\n\t\t\t\"$:/languages/en-US\"\n\t\t],\n\t\tonSwitch: function(plugins) {\n\t\t\tif($tw.browser) {\n\t\t\t\tvar pluginTiddler = $tw.wiki.getTiddler(plugins[0]);\n\t\t\t\tif(pluginTiddler) {\n\t\t\t\t\tdocument.documentElement.setAttribute(\"dir\",pluginTiddler.getFieldString(\"text-direction\") || \"auto\");\n\t\t\t\t} else {\n\t\t\t\t\tdocument.documentElement.removeAttribute(\"dir\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t// Kick off the theme manager\n\t$tw.themeManager = new $tw.PluginSwitcher({\n\t\twiki: $tw.wiki,\n\t\tpluginType: \"theme\",\n\t\tcontrollerTitle: \"$:/theme\",\n\t\tdefaultPlugins: [\n\t\t\t\"$:/themes/tiddlywiki/snowwhite\",\n\t\t\t\"$:/themes/tiddlywiki/vanilla\"\n\t\t]\n\t});\n\t// Kick off the keyboard manager\n\t$tw.keyboardManager = new $tw.KeyboardManager();\n\t// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup\n\t$tw.wiki.clearTiddlerEventQueue();\n\t// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers\n\tif($tw.browser) {\n\t\t$tw.rootWidget = new widget.widget({\n\t\t\ttype: \"widget\",\n\t\t\tchildren: []\n\t\t},{\n\t\t\twiki: $tw.wiki,\n\t\t\tdocument: document\n\t\t});\n\t}\n\t// Find a working syncadaptor\n\t$tw.syncadaptor = undefined;\n\t$tw.modules.forEachModuleOfType(\"syncadaptor\",function(title,module) {\n\t\tif(!$tw.syncadaptor && module.adaptorClass) {\n\t\t\t$tw.syncadaptor = new module.adaptorClass({wiki: $tw.wiki});\n\t\t}\n\t});\n\t// Set up the syncer object if we've got a syncadaptor\n\tif($tw.syncadaptor) {\n\t\t$tw.syncer = new $tw.Syncer({wiki: $tw.wiki, syncadaptor: $tw.syncadaptor});\n\t} \n\t// Setup the saver handler\n\t$tw.saverHandler = new $tw.SaverHandler({wiki: $tw.wiki, dirtyTracking: !$tw.syncadaptor});\n\t// Host-specific startup\n\tif($tw.browser) {\n\t\t// Install the popup manager\n\t\t$tw.popup = new $tw.utils.Popup();\n\t\t// Install the animator\n\t\t$tw.anim = new $tw.utils.Animator();\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/startup.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/story.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/story.js\ntype: application/javascript\nmodule-type: startup\n\nLoad core modules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"story\";\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n// Default story and history lists\nvar DEFAULT_STORY_TITLE = \"$:/StoryList\";\nvar DEFAULT_HISTORY_TITLE = \"$:/HistoryList\";\n\n// Default tiddlers\nvar DEFAULT_TIDDLERS_TITLE = \"$:/DefaultTiddlers\";\n\n// Config\nvar CONFIG_UPDATE_ADDRESS_BAR = \"$:/config/Navigation/UpdateAddressBar\"; // Can be \"no\", \"permalink\", \"permaview\"\nvar CONFIG_UPDATE_HISTORY = \"$:/config/Navigation/UpdateHistory\"; // Can be \"yes\" or \"no\"\n\nexports.startup = function() {\n\t// Open startup tiddlers\n\topenStartupTiddlers();\n\tif($tw.browser) {\n\t\t// Set up location hash update\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\tif($tw.utils.hop(changes,DEFAULT_STORY_TITLE) || $tw.utils.hop(changes,DEFAULT_HISTORY_TITLE)) {\n\t\t\t\tupdateLocationHash({\n\t\t\t\t\tupdateAddressBar: $tw.wiki.getTiddlerText(CONFIG_UPDATE_ADDRESS_BAR,\"permaview\").trim(),\n\t\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim()\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t// Listen for changes to the browser location hash\n\t\twindow.addEventListener(\"hashchange\",function() {\n\t\t\tvar hash = $tw.utils.getLocationHash();\n\t\t\tif(hash !== $tw.locationHash) {\n\t\t\t\t$tw.locationHash = hash;\n\t\t\t\topenStartupTiddlers({defaultToCurrentStory: true});\n\t\t\t}\n\t\t},false);\n\t\t// Listen for the tm-browser-refresh message\n\t\t$tw.rootWidget.addEventListener(\"tm-browser-refresh\",function(event) {\n\t\t\twindow.location.reload(true);\n\t\t});\n\t\t// Listen for the tm-print message\n\t\t$tw.rootWidget.addEventListener(\"tm-print\",function(event) {\n\t\t\t(event.event.view || window).print();\n\t\t});\n\t\t// Listen for the tm-home message\n\t\t$tw.rootWidget.addEventListener(\"tm-home\",function(event) {\n\t\t\twindow.location.hash = \"\";\n\t\t\tvar storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE),\n\t\t\t\tstoryList = $tw.wiki.filterTiddlers(storyFilter);\n\t\t\t//invoke any hooks that might change the default story list\n\t\t\tstoryList = $tw.hooks.invokeHook(\"th-opening-default-tiddlers-list\",storyList);\n\t\t\t$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: \"\", list: storyList},$tw.wiki.getModificationFields());\n\t\t\tif(storyList[0]) {\n\t\t\t\t$tw.wiki.addToHistory(storyList[0]);\t\t\t\t\n\t\t\t}\n\t\t});\n\t\t// Listen for the tm-permalink message\n\t\t$tw.rootWidget.addEventListener(\"tm-permalink\",function(event) {\n\t\t\tupdateLocationHash({\n\t\t\t\tupdateAddressBar: \"permalink\",\n\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim(),\n\t\t\t\ttargetTiddler: event.param || event.tiddlerTitle\n\t\t\t});\n\t\t});\n\t\t// Listen for the tm-permaview message\n\t\t$tw.rootWidget.addEventListener(\"tm-permaview\",function(event) {\n\t\t\tupdateLocationHash({\n\t\t\t\tupdateAddressBar: \"permaview\",\n\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim(),\n\t\t\t\ttargetTiddler: event.param || event.tiddlerTitle\n\t\t\t});\n\t\t});\n\t}\n};\n\n/*\nProcess the location hash to open the specified tiddlers. Options:\ndefaultToCurrentStory: If true, the current story is retained as the default, instead of opening the default tiddlers\n*/\nfunction openStartupTiddlers(options) {\n\toptions = options || {};\n\t// Work out the target tiddler and the story filter. \"null\" means \"unspecified\"\n\tvar target = null,\n\t\tstoryFilter = null;\n\tif($tw.locationHash.length > 1) {\n\t\tvar hash = $tw.locationHash.substr(1),\n\t\t\tsplit = hash.indexOf(\":\");\n\t\tif(split === -1) {\n\t\t\ttarget = decodeURIComponent(hash.trim());\n\t\t} else {\n\t\t\ttarget = decodeURIComponent(hash.substr(0,split).trim());\n\t\t\tstoryFilter = decodeURIComponent(hash.substr(split + 1).trim());\n\t\t}\n\t}\n\t// If the story wasn't specified use the current tiddlers or a blank story\n\tif(storyFilter === null) {\n\t\tif(options.defaultToCurrentStory) {\n\t\t\tvar currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);\n\t\t\tstoryFilter = $tw.utils.stringifyList(currStoryList);\n\t\t} else {\n\t\t\tif(target && target !== \"\") {\n\t\t\t\tstoryFilter = \"\";\n\t\t\t} else {\n\t\t\t\tstoryFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);\n\t\t\t}\n\t\t}\n\t}\n\t// Process the story filter to get the story list\n\tvar storyList = $tw.wiki.filterTiddlers(storyFilter);\n\t// Invoke any hooks that want to change the default story list\n\tstoryList = $tw.hooks.invokeHook(\"th-opening-default-tiddlers-list\",storyList);\n\t// If the target tiddler isn't included then splice it in at the top\n\tif(target && storyList.indexOf(target) === -1) {\n\t\tstoryList.unshift(target);\n\t}\n\t// Save the story list\n\t$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: \"\", list: storyList},$tw.wiki.getModificationFields());\n\t// If a target tiddler was specified add it to the history stack\n\tif(target && target !== \"\") {\n\t\t// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present\n\t\tif(target.indexOf(\"[[\") === 0 && target.substr(-2) === \"]]\") {\n\t\t\ttarget = target.substr(2,target.length - 4);\n\t\t}\n\t\t$tw.wiki.addToHistory(target);\n\t} else if(storyList.length > 0) {\n\t\t$tw.wiki.addToHistory(storyList[0]);\n\t}\n}\n\n/*\noptions: See below\noptions.updateAddressBar: \"permalink\", \"permaview\" or \"no\" (defaults to \"permaview\")\noptions.updateHistory: \"yes\" or \"no\" (defaults to \"no\")\noptions.targetTiddler: optional title of target tiddler for permalink\n*/\nfunction updateLocationHash(options) {\n\tif(options.updateAddressBar !== \"no\") {\n\t\t// Get the story and the history stack\n\t\tvar storyList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE),\n\t\t\thistoryList = $tw.wiki.getTiddlerData(DEFAULT_HISTORY_TITLE,[]),\n\t\t\ttargetTiddler = \"\";\n\t\tif(options.targetTiddler) {\n\t\t\ttargetTiddler = options.targetTiddler;\n\t\t} else {\n\t\t\t// The target tiddler is the one at the top of the stack\n\t\t\tif(historyList.length > 0) {\n\t\t\t\ttargetTiddler = historyList[historyList.length-1].title;\n\t\t\t}\n\t\t\t// Blank the target tiddler if it isn't present in the story\n\t\t\tif(storyList.indexOf(targetTiddler) === -1) {\n\t\t\t\ttargetTiddler = \"\";\n\t\t\t}\n\t\t}\n\t\t// Assemble the location hash\n\t\tif(options.updateAddressBar === \"permalink\") {\n\t\t\t$tw.locationHash = \"#\" + encodeURIComponent(targetTiddler);\n\t\t} else {\n\t\t\t$tw.locationHash = \"#\" + encodeURIComponent(targetTiddler) + \":\" + encodeURIComponent($tw.utils.stringifyList(storyList));\n\t\t}\n\t\t// Only change the location hash if we must, thus avoiding unnecessary onhashchange events\n\t\tif($tw.utils.getLocationHash() !== $tw.locationHash) {\n\t\t\tif(options.updateHistory === \"yes\") {\n\t\t\t\t// Assign the location hash so that history is updated\n\t\t\t\twindow.location.hash = $tw.locationHash;\n\t\t\t} else {\n\t\t\t\t// We use replace so that browser history isn't affected\n\t\t\t\twindow.location.replace(window.location.toString().split(\"#\")[0] + $tw.locationHash);\n\t\t\t}\n\t\t}\n\t}\n}\n\n})();\n",
"title": "$:/core/modules/startup/story.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/windows.js": {
"text": "/*\\\ntitle: $:/core/modules/startup/windows.js\ntype: application/javascript\nmodule-type: startup\n\nSetup root widget handlers for the messages concerned with opening external browser windows\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"windows\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n// Global to keep track of open windows (hashmap by title)\nvar windows = {};\n\nexports.startup = function() {\n\t// Handle open window message\n\t$tw.rootWidget.addEventListener(\"tm-open-window\",function(event) {\n\t\t// Get the parameters\n\t\tvar refreshHandler,\n\t\t\ttitle = event.param || event.tiddlerTitle,\n\t\t\tparamObject = event.paramObject || {},\n\t\t\ttemplate = paramObject.template || \"$:/core/templates/single.tiddler.window\",\n\t\t\twidth = paramObject.width || \"700\",\n\t\t\theight = paramObject.height || \"600\",\n\t\t\tvariables = $tw.utils.extend({},paramObject,{currentTiddler: title});\n\t\t// Open the window\n\t\tvar srcWindow = window.open(\"\",\"external-\" + title,\"scrollbars,width=\" + width + \",height=\" + height),\n\t\t\tsrcDocument = srcWindow.document;\n\t\twindows[title] = srcWindow;\n\t\t// Check for reopening the same window\n\t\tif(srcWindow.haveInitialisedWindow) {\n\t\t\treturn;\n\t\t}\n\t\t// Initialise the document\n\t\tsrcDocument.write(\"<html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>\");\n\t\tsrcDocument.close();\n\t\tsrcDocument.title = title;\n\t\tsrcWindow.addEventListener(\"beforeunload\",function(event) {\n\t\t\tdelete windows[title];\n\t\t\t$tw.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t},false);\n\t\t// Set up the styles\n\t\tvar styleWidgetNode = $tw.wiki.makeTranscludeWidget(\"$:/core/ui/PageStylesheet\",{\n\t\t\t\tdocument: $tw.fakeDocument,\n\t\t\t\tvariables: variables,\n\t\t\t\timportPageMacros: true}),\n\t\t\tstyleContainer = $tw.fakeDocument.createElement(\"style\");\n\t\tstyleWidgetNode.render(styleContainer,null);\n\t\tvar styleElement = srcDocument.createElement(\"style\");\n\t\tstyleElement.innerHTML = styleContainer.textContent;\n\t\tsrcDocument.head.insertBefore(styleElement,srcDocument.head.firstChild);\n\t\t// Render the text of the tiddler\n\t\tvar parser = $tw.wiki.parseTiddler(template),\n\t\t\twidgetNode = $tw.wiki.makeWidget(parser,{document: srcDocument, parentWidget: $tw.rootWidget, variables: variables});\n\t\twidgetNode.render(srcDocument.body,srcDocument.body.firstChild);\n\t\t// Function to handle refreshes\n\t\trefreshHandler = function(changes) {\n\t\t\tif(styleWidgetNode.refresh(changes,styleContainer,null)) {\n\t\t\t\tstyleElement.innerHTML = styleContainer.textContent;\n\t\t\t}\n\t\t\twidgetNode.refresh(changes);\n\t\t};\n\t\t$tw.wiki.addEventListener(\"change\",refreshHandler);\n\t\tsrcWindow.haveInitialisedWindow = true;\n\t});\n\t// Close open windows when unloading main window\n\t$tw.addUnloadTask(function() {\n\t\t$tw.utils.each(windows,function(win) {\n\t\t\twin.close();\n\t\t});\n\t});\n\n};\n\n})();\n",
"title": "$:/core/modules/startup/windows.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/story.js": {
"text": "/*\\\ntitle: $:/core/modules/story.js\ntype: application/javascript\nmodule-type: global\n\nLightweight object for managing interactions with the story and history lists.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nConstruct Story object with options:\nwiki: reference to wiki object to use to resolve tiddler titles\nstoryTitle: title of story list tiddler\nhistoryTitle: title of history list tiddler\n*/\nfunction Story(options) {\n\toptions = options || {};\n\tthis.wiki = options.wiki || $tw.wiki;\n\tthis.storyTitle = options.storyTitle || \"$:/StoryList\";\n\tthis.historyTitle = options.historyTitle || \"$:/HistoryList\";\n};\n\nStory.prototype.navigateTiddler = function(navigateTo,navigateFromTitle,navigateFromClientRect) {\n\tthis.addToStory(navigateTo,navigateFromTitle);\n\tthis.addToHistory(navigateTo,navigateFromClientRect);\n};\n\nStory.prototype.getStoryList = function() {\n\treturn this.wiki.getTiddlerList(this.storyTitle) || [];\n};\n\nStory.prototype.addToStory = function(navigateTo,navigateFromTitle,options) {\n\toptions = options || {};\n\tvar storyList = this.getStoryList();\n\t// See if the tiddler is already there\n\tvar slot = storyList.indexOf(navigateTo);\n\t// Quit if it already exists in the story river\n\tif(slot >= 0) {\n\t\treturn;\n\t}\n\t// First we try to find the position of the story element we navigated from\n\tvar fromIndex = storyList.indexOf(navigateFromTitle);\n\tif(fromIndex >= 0) {\n\t\t// The tiddler is added from inside the river\n\t\t// Determine where to insert the tiddler; Fallback is \"below\"\n\t\tswitch(options.openLinkFromInsideRiver) {\n\t\t\tcase \"top\":\n\t\t\t\tslot = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"bottom\":\n\t\t\t\tslot = storyList.length;\n\t\t\t\tbreak;\n\t\t\tcase \"above\":\n\t\t\t\tslot = fromIndex;\n\t\t\t\tbreak;\n\t\t\tcase \"below\": // Intentional fall-through\n\t\t\tdefault:\n\t\t\t\tslot = fromIndex + 1;\n\t\t\t\tbreak;\n\t\t}\n\t} else {\n\t\t// The tiddler is opened from outside the river. Determine where to insert the tiddler; default is \"top\"\n\t\tif(options.openLinkFromOutsideRiver === \"bottom\") {\n\t\t\t// Insert at bottom\n\t\t\tslot = storyList.length;\n\t\t} else {\n\t\t\t// Insert at top\n\t\t\tslot = 0;\n\t\t}\n\t}\n\t// Add the tiddler\n\tstoryList.splice(slot,0,navigateTo);\n\t// Save the story\n\tthis.saveStoryList(storyList);\n};\n\nStory.prototype.saveStoryList = function(storyList) {\n\tvar storyTiddler = this.wiki.getTiddler(this.storyTitle);\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\tthis.wiki.getCreationFields(),\n\t\t{title: this.storyTitle},\n\t\tstoryTiddler,\n\t\t{list: storyList},\n\t\tthis.wiki.getModificationFields()\n\t));\n};\n\nStory.prototype.addToHistory = function(navigateTo,navigateFromClientRect) {\n\tvar titles = $tw.utils.isArray(navigateTo) ? navigateTo : [navigateTo];\n\t// Add a new record to the top of the history stack\n\tvar historyList = this.wiki.getTiddlerData(this.historyTitle,[]);\n\t$tw.utils.each(titles,function(title) {\n\t\thistoryList.push({title: title, fromPageRect: navigateFromClientRect});\n\t});\n\tthis.wiki.setTiddlerData(this.historyTitle,historyList,{\"current-tiddler\": titles[titles.length-1]});\n};\n\nStory.prototype.storyCloseTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyCloseAllTiddlers = function() {\n// TBD\n};\n\nStory.prototype.storyCloseOtherTiddlers = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyEditTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyDeleteTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storySaveTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyCancelTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyNewTiddler = function(targetTitle) {\n// TBD\n};\n\nexports.Story = Story;\n\n\n})();\n",
"title": "$:/core/modules/story.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/storyviews/classic.js": {
"text": "/*\\\ntitle: $:/core/modules/storyviews/classic.js\ntype: application/javascript\nmodule-type: storyview\n\nViews the story as a linear sequence\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar easing = \"cubic-bezier(0.645, 0.045, 0.355, 1)\"; // From http://easings.net/#easeInOutCubic\n\nvar ClassicStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n};\n\nClassicStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \"tm-scroll\", target: targetElement});\n};\n\nClassicStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Get the current height of the tiddler\n\tvar computedStyle = window.getComputedStyle(targetElement),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t// Reset the margin once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"}\n\t\t]);\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t// Transition to the final position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"opacity \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms \" + easing},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nClassicStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\tremoveElement = function() {\n\t\t\twidget.removeChildDomNodes();\n\t\t};\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Get the current height of the tiddler\n\tvar currWidth = targetElement.offsetWidth,\n\t\tcomputedStyle = window.getComputedStyle(targetElement),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t// Remove the dom nodes of the widget at the end of the transition\n\tsetTimeout(removeElement,duration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"translateX(0px)\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms \" + easing},\n\t\t{transform: \"translateX(-\" + currWidth + \"px)\"},\n\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n};\n\nexports.classic = ClassicStoryView;\n\n})();",
"title": "$:/core/modules/storyviews/classic.js",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/storyviews/pop.js": {
"text": "/*\\\ntitle: $:/core/modules/storyviews/pop.js\ntype: application/javascript\nmodule-type: storyview\n\nAnimates list insertions and removals\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar PopStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n};\n\nPopStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \"tm-scroll\", target: targetElement});\n};\n\nPopStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Reset once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{transform: \"none\"}\n\t\t]);\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(2)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t// Transition to the final position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nPopStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\tremoveElement = function() {\n\t\t\tif(targetElement.parentNode) {\n\t\t\t\twidget.removeChildDomNodes();\n\t\t\t}\n\t\t};\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Remove the element at the end of the transition\n\tsetTimeout(removeElement,duration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(0.1)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n};\n\nexports.pop = PopStoryView;\n\n})();\n",
"title": "$:/core/modules/storyviews/pop.js",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/storyviews/zoomin.js": {
"text": "/*\\\ntitle: $:/core/modules/storyviews/zoomin.js\ntype: application/javascript\nmodule-type: storyview\n\nZooms between individual tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar easing = \"cubic-bezier(0.645, 0.045, 0.355, 1)\"; // From http://easings.net/#easeInOutCubic\n\nvar ZoominListView = function(listWidget) {\n\tvar self = this;\n\tthis.listWidget = listWidget;\n\t// Get the index of the tiddler that is at the top of the history\n\tvar history = this.listWidget.wiki.getTiddlerDataCached(this.listWidget.historyTitle,[]),\n\t\ttargetTiddler;\n\tif(history.length > 0) {\n\t\ttargetTiddler = history[history.length-1].title;\n\t}\n\t// Make all the tiddlers position absolute, and hide all but the top (or first) one\n\t$tw.utils.each(this.listWidget.children,function(itemWidget,index) {\n\t\tvar domNode = itemWidget.findFirstDomNode();\n\t\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\t\tif(!(domNode instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tif((targetTiddler && targetTiddler !== itemWidget.parseTreeNode.itemTitle) || (!targetTiddler && index)) {\n\t\t\tdomNode.style.display = \"none\";\n\t\t} else {\n\t\t\tself.currentTiddlerDomNode = domNode;\n\t\t}\n\t\t$tw.utils.addClass(domNode,\"tc-storyview-zoomin-tiddler\");\n\t});\n};\n\nZoominListView.prototype.navigateTo = function(historyInfo) {\n\tvar duration = $tw.utils.getAnimationDuration(),\n\t\tlistElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Make the new tiddler be position absolute and visible so that we can measure it\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"0 0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t// Get the position of the source node, or use the centre of the window as the source position\n\tvar sourceBounds = historyInfo.fromPageRect || {\n\t\t\tleft: window.innerWidth/2 - 2,\n\t\t\ttop: window.innerHeight/2 - 2,\n\t\t\twidth: window.innerWidth/8,\n\t\t\theight: window.innerHeight/8\n\t\t};\n\t// Try to find the title node in the target tiddler\n\tvar titleDomNode = findTitleDomNode(listItemWidget) || listItemWidget.findFirstDomNode(),\n\t\tzoomBounds = titleDomNode.getBoundingClientRect();\n\t// Compute the transform for the target tiddler to make the title lie over the source rectange\n\tvar targetBounds = targetElement.getBoundingClientRect(),\n\t\tscale = sourceBounds.width / zoomBounds.width,\n\t\tx = sourceBounds.left - targetBounds.left - (zoomBounds.left - targetBounds.left) * scale,\n\t\ty = sourceBounds.top - targetBounds.top - (zoomBounds.top - targetBounds.top) * scale;\n\t// Transform the target tiddler to its starting position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(targetElement);\n\t// Apply the ending transitions with a timeout to ensure that the previously applied transformations are applied first\n\tvar self = this,\n\t\tprevCurrentTiddler = this.currentTiddlerDomNode;\n\tthis.currentTiddlerDomNode = targetElement;\n\t// Transform the target tiddler to its natural size\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{zIndex: \"500\"},\n\t]);\n\t// Transform the previous tiddler out of the way and then hide it\n\tif(prevCurrentTiddler && prevCurrentTiddler !== targetElement) {\n\t\tscale = zoomBounds.width / sourceBounds.width;\n\t\tx = zoomBounds.left - targetBounds.left - (sourceBounds.left - targetBounds.left) * scale;\n\t\ty = zoomBounds.top - targetBounds.top - (sourceBounds.top - targetBounds.top) * scale;\n\t\t$tw.utils.setStyle(prevCurrentTiddler,[\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transformOrigin: \"0 0\"},\n\t\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"},\n\t\t\t{zIndex: \"0\"}\n\t\t]);\n\t\t// Hide the tiddler when the transition has finished\n\t\tsetTimeout(function() {\n\t\t\tif(self.currentTiddlerDomNode !== prevCurrentTiddler) {\n\t\t\t\tprevCurrentTiddler.style.display = \"none\";\n\t\t\t}\n\t\t},duration);\n\t}\n\t// Scroll the target into view\n//\t$tw.pageScroller.scrollIntoView(targetElement);\n};\n\n/*\nFind the first child DOM node of a widget that has the class \"tc-title\"\n*/\nfunction findTitleDomNode(widget,targetClass) {\n\ttargetClass = targetClass || \"tc-title\";\n\tvar domNode = widget.findFirstDomNode();\n\tif(domNode && domNode.querySelector) {\n\t\treturn domNode.querySelector(\".\" + targetClass);\n\t}\n\treturn null;\n}\n\nZoominListView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Make the newly inserted node position absolute and hidden\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"none\"}\n\t]);\n};\n\nZoominListView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\tremoveElement = function() {\n\t\t\twidget.removeChildDomNodes();\n\t\t};\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Abandon if hidden\n\tif(targetElement.style.display != \"block\" ) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Set up the tiddler that is being closed\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\t// We'll move back to the previous or next element in the story\n\tvar toWidget = widget.previousSibling();\n\tif(!toWidget) {\n\t\ttoWidget = widget.nextSibling();\n\t}\n\tvar toWidgetDomNode = toWidget && toWidget.findFirstDomNode();\n\t// Set up the tiddler we're moving back in\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.addClass(toWidgetDomNode,\"tc-storyview-zoomin-tiddler\");\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{display: \"block\"},\n\t\t\t{transformOrigin: \"50% 50%\"},\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(10)\"},\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t\t{opacity: \"0\"},\n\t\t\t{zIndex: \"500\"}\n\t\t]);\n\t\tthis.currentTiddlerDomNode = toWidgetDomNode;\n\t}\n\t// Animate them both\n\t// Force layout\n\t$tw.utils.forceLayout(this.listWidget.parentDomNode);\n\t// First, the tiddler we're closing\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(0.1)\"},\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t{opacity: \"0\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\tsetTimeout(removeElement,duration);\n\t// Now the tiddler we're going back to\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t\t{opacity: \"1\"}\n\t\t]);\n\t}\n\treturn true; // Indicate that we'll delete the DOM node\n};\n\nexports.zoomin = ZoominListView;\n\n})();\n",
"title": "$:/core/modules/storyviews/zoomin.js",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/syncer.js": {
"text": "/*\\\ntitle: $:/core/modules/syncer.js\ntype: application/javascript\nmodule-type: global\n\nThe syncer tracks changes to the store. If a syncadaptor is used then individual tiddlers are synchronised through it. If there is no syncadaptor then the entire wiki is saved via saver modules.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDefaults\n*/\nSyncer.prototype.titleIsLoggedIn = \"$:/status/IsLoggedIn\";\nSyncer.prototype.titleUserName = \"$:/status/UserName\";\nSyncer.prototype.titleSyncFilter = \"$:/config/SyncFilter\";\nSyncer.prototype.titleSavedNotification = \"$:/language/Notifications/Save/Done\";\nSyncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer\nSyncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...\nSyncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s\nSyncer.prototype.pollTimerInterval = 60 * 1000; // Interval for polling for changes from the adaptor\n\n/*\nInstantiate the syncer with the following options:\nsyncadaptor: reference to syncadaptor to be used\nwiki: wiki to be synced\n*/\nfunction Syncer(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\tthis.syncadaptor = options.syncadaptor;\n\tthis.titleIsLoggedIn = options.titleIsLoggedIn || this.titleIsLoggedIn;\n\tthis.titleUserName = options.titleUserName || this.titleUserName;\n\tthis.titleSyncFilter = options.titleSyncFilter || this.titleSyncFilter;\n\tthis.titleSavedNotification = options.titleSavedNotification || this.titleSavedNotification;\n\tthis.taskTimerInterval = options.taskTimerInterval || this.taskTimerInterval;\n\tthis.throttleInterval = options.throttleInterval || this.throttleInterval;\n\tthis.fallbackInterval = options.fallbackInterval || this.fallbackInterval;\n\tthis.pollTimerInterval = options.pollTimerInterval || this.pollTimerInterval;\n\t// Make a logger\n\tthis.logger = new $tw.utils.Logger(\"syncer\" + ($tw.browser ? \"-browser\" : \"\") + ($tw.node ? \"-server\" : \"\") + (this.syncadaptor.name ? (\"-\" + this.syncadaptor.name) : \"\"));\n\t// Compile the dirty tiddler filter\n\tthis.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));\n\t// Record information for known tiddlers\n\tthis.readTiddlerInfo();\n\t// Tasks are {type: \"load\"/\"save\"/\"delete\", title:, queueTime:, lastModificationTime:}\n\tthis.taskQueue = {}; // Hashmap of tasks yet to be performed\n\tthis.taskInProgress = {}; // Hash of tasks in progress\n\tthis.taskTimerId = null; // Timer for task dispatch\n\tthis.pollTimerId = null; // Timer for polling server\n\t// Listen out for changes to tiddlers\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tself.syncToServer(changes);\n\t});\n\t// Browser event handlers\n\tif($tw.browser) {\n\t\t// Set up our beforeunload handler\n\t\t$tw.addUnloadTask(function(event) {\n\t\t\tvar confirmationMessage;\n\t\t\tif(self.isDirty()) {\n\t\t\t\tconfirmationMessage = $tw.language.getString(\"UnsavedChangesWarning\");\n\t\t\t\tevent.returnValue = confirmationMessage; // Gecko\n\t\t\t}\n\t\t\treturn confirmationMessage;\n\t\t});\n\t\t// Listen out for login/logout/refresh events in the browser\n\t\t$tw.rootWidget.addEventListener(\"tm-login\",function() {\n\t\t\tself.handleLoginEvent();\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-logout\",function() {\n\t\t\tself.handleLogoutEvent();\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-server-refresh\",function() {\n\t\t\tself.handleRefreshEvent();\n\t\t});\n\t}\n\t// Listen out for lazyLoad events\n\tthis.wiki.addEventListener(\"lazyLoad\",function(title) {\n\t\tself.handleLazyLoadEvent(title);\n\t});\n\t// Get the login status\n\tthis.getStatus(function(err,isLoggedIn) {\n\t\t// Do a sync from the server\n\t\tself.syncFromServer();\n\t});\n}\n\n/*\nRead (or re-read) the latest tiddler info from the store\n*/\nSyncer.prototype.readTiddlerInfo = function() {\n\t// Hashmap by title of {revision:,changeCount:,adaptorInfo:}\n\tthis.tiddlerInfo = {};\n\t// Record information for known tiddlers\n\tvar self = this,\n\t\ttiddlers = this.filterFn.call(this.wiki);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\tself.tiddlerInfo[title] = {\n\t\t\trevision: tiddler.fields.revision,\n\t\t\tadaptorInfo: self.syncadaptor && self.syncadaptor.getTiddlerInfo(tiddler),\n\t\t\tchangeCount: self.wiki.getChangeCount(title),\n\t\t\thasBeenLazyLoaded: false\n\t\t};\n\t});\n};\n\n/*\nCreate an tiddlerInfo structure if it doesn't already exist\n*/\nSyncer.prototype.createTiddlerInfo = function(title) {\n\tif(!$tw.utils.hop(this.tiddlerInfo,title)) {\n\t\tthis.tiddlerInfo[title] = {\n\t\t\trevision: null,\n\t\t\tadaptorInfo: {},\n\t\t\tchangeCount: -1,\n\t\t\thasBeenLazyLoaded: false\n\t\t};\n\t}\n};\n\n/*\nChecks whether the wiki is dirty (ie the window shouldn't be closed)\n*/\nSyncer.prototype.isDirty = function() {\n\treturn (this.numTasksInQueue() > 0) || (this.numTasksInProgress() > 0);\n};\n\n/*\nUpdate the document body with the class \"tc-dirty\" if the wiki has unsaved/unsynced changes\n*/\nSyncer.prototype.updateDirtyStatus = function() {\n\tif($tw.browser) {\n\t\t$tw.utils.toggleClass(document.body,\"tc-dirty\",this.isDirty());\n\t}\n};\n\n/*\nSave an incoming tiddler in the store, and updates the associated tiddlerInfo\n*/\nSyncer.prototype.storeTiddler = function(tiddlerFields,hasBeenLazyLoaded) {\n\t// Save the tiddler\n\tvar tiddler = new $tw.Tiddler(this.wiki.getTiddler(tiddlerFields.title),tiddlerFields);\n\tthis.wiki.addTiddler(tiddler);\n\t// Save the tiddler revision and changeCount details\n\tthis.tiddlerInfo[tiddlerFields.title] = {\n\t\trevision: tiddlerFields.revision,\n\t\tadaptorInfo: this.syncadaptor.getTiddlerInfo(tiddler),\n\t\tchangeCount: this.wiki.getChangeCount(tiddlerFields.title),\n\t\thasBeenLazyLoaded: hasBeenLazyLoaded !== undefined ? hasBeenLazyLoaded : true\n\t};\n};\n\nSyncer.prototype.getStatus = function(callback) {\n\tvar self = this;\n\t// Check if the adaptor supports getStatus()\n\tif(this.syncadaptor && this.syncadaptor.getStatus) {\n\t\t// Mark us as not logged in\n\t\tthis.wiki.addTiddler({title: this.titleIsLoggedIn,text: \"no\"});\n\t\t// Get login status\n\t\tthis.syncadaptor.getStatus(function(err,isLoggedIn,username) {\n\t\t\tif(err) {\n\t\t\t\tself.logger.alert(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Set the various status tiddlers\n\t\t\tself.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? \"yes\" : \"no\"});\n\t\t\tif(isLoggedIn) {\n\t\t\t\tself.wiki.addTiddler({title: self.titleUserName,text: username || \"\"});\n\t\t\t} else {\n\t\t\t\tself.wiki.deleteTiddler(self.titleUserName);\n\t\t\t}\n\t\t\t// Invoke the callback\n\t\t\tif(callback) {\n\t\t\t\tcallback(err,isLoggedIn,username);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tcallback(null,true,\"UNAUTHENTICATED\");\n\t}\n};\n\n/*\nSynchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date\n*/\nSyncer.prototype.syncFromServer = function() {\n\tif(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {\n\t\tthis.logger.log(\"Retrieving skinny tiddler list\");\n\t\tvar self = this;\n\t\tif(this.pollTimerId) {\n\t\t\tclearTimeout(this.pollTimerId);\n\t\t\tthis.pollTimerId = null;\n\t\t}\n\t\tthis.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {\n\t\t\t// Trigger the next sync\n\t\t\tself.pollTimerId = setTimeout(function() {\n\t\t\t\tself.pollTimerId = null;\n\t\t\t\tself.syncFromServer.call(self);\n\t\t\t},self.pollTimerInterval);\n\t\t\t// Check for errors\n\t\t\tif(err) {\n\t\t\t\tself.logger.alert($tw.language.getString(\"Error/RetrievingSkinny\") + \":\",err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Process each incoming tiddler\n\t\t\tfor(var t=0; t<tiddlers.length; t++) {\n\t\t\t\t// Get the incoming tiddler fields, and the existing tiddler\n\t\t\t\tvar tiddlerFields = tiddlers[t],\n\t\t\t\t\tincomingRevision = tiddlerFields.revision + \"\",\n\t\t\t\t\ttiddler = self.wiki.getTiddler(tiddlerFields.title),\n\t\t\t\t\ttiddlerInfo = self.tiddlerInfo[tiddlerFields.title],\n\t\t\t\t\tcurrRevision = tiddlerInfo ? tiddlerInfo.revision : null;\n\t\t\t\t// Ignore the incoming tiddler if it's the same as the revision we've already got\n\t\t\t\tif(currRevision !== incomingRevision) {\n\t\t\t\t\t// Do a full load if we've already got a fat version of the tiddler\n\t\t\t\t\tif(tiddler && tiddler.fields.text !== undefined) {\n\t\t\t\t\t\t// Do a full load of this tiddler\n\t\t\t\t\t\tself.enqueueSyncTask({\n\t\t\t\t\t\t\ttype: \"load\",\n\t\t\t\t\t\t\ttitle: tiddlerFields.title\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Load the skinny version of the tiddler\n\t\t\t\t\t\tself.storeTiddler(tiddlerFields,false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nSynchronise a set of changes to the server\n*/\nSyncer.prototype.syncToServer = function(changes) {\n\tvar self = this,\n\t\tnow = Date.now(),\n\t\tfilteredChanges = this.filterFn.call(this.wiki,function(callback) {\n\t\t\t$tw.utils.each(changes,function(change,title) {\n\t\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\t\tcallback(tiddler,title);\n\t\t\t});\n\t\t});\n\t$tw.utils.each(changes,function(change,title,object) {\n\t\t// Process the change if it is a deletion of a tiddler we're already syncing, or is on the filtered change list\n\t\tif((change.deleted && $tw.utils.hop(self.tiddlerInfo,title)) || filteredChanges.indexOf(title) !== -1) {\n\t\t\t// Queue a task to sync this tiddler\n\t\t\tself.enqueueSyncTask({\n\t\t\t\ttype: change.deleted ? \"delete\" : \"save\",\n\t\t\t\ttitle: title\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nLazily load a skinny tiddler if we can\n*/\nSyncer.prototype.handleLazyLoadEvent = function(title) {\n\t// Don't lazy load the same tiddler twice\n\tvar info = this.tiddlerInfo[title];\n\tif(!info || !info.hasBeenLazyLoaded) {\n\t\tthis.createTiddlerInfo(title);\n\t\tthis.tiddlerInfo[title].hasBeenLazyLoaded = true;\n\t\t// Queue up a sync task to load this tiddler\n\t\tthis.enqueueSyncTask({\n\t\t\ttype: \"load\",\n\t\t\ttitle: title\n\t\t});\t\t\n\t}\n};\n\n/*\nDispay a password prompt and allow the user to login\n*/\nSyncer.prototype.handleLoginEvent = function() {\n\tvar self = this;\n\tthis.getStatus(function(err,isLoggedIn,username) {\n\t\tif(!isLoggedIn) {\n\t\t\t$tw.passwordPrompt.createPrompt({\n\t\t\t\tserviceName: $tw.language.getString(\"LoginToTiddlySpace\"),\n\t\t\t\tcallback: function(data) {\n\t\t\t\t\tself.login(data.username,data.password,function(err,isLoggedIn) {\n\t\t\t\t\t\tself.syncFromServer();\n\t\t\t\t\t});\n\t\t\t\t\treturn true; // Get rid of the password prompt\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nAttempt to login to TiddlyWeb.\n\tusername: username\n\tpassword: password\n\tcallback: invoked with arguments (err,isLoggedIn)\n*/\nSyncer.prototype.login = function(username,password,callback) {\n\tthis.logger.log(\"Attempting to login as\",username);\n\tvar self = this;\n\tif(this.syncadaptor.login) {\n\t\tthis.syncadaptor.login(username,password,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.getStatus(function(err,isLoggedIn,username) {\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback(null,isLoggedIn);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t} else {\n\t\tcallback(null,true);\n\t}\n};\n\n/*\nAttempt to log out of TiddlyWeb\n*/\nSyncer.prototype.handleLogoutEvent = function() {\n\tthis.logger.log(\"Attempting to logout\");\n\tvar self = this;\n\tif(this.syncadaptor.logout) {\n\t\tthis.syncadaptor.logout(function(err) {\n\t\t\tif(err) {\n\t\t\t\tself.logger.alert(err);\n\t\t\t} else {\n\t\t\t\tself.getStatus();\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nImmediately refresh from the server\n*/\nSyncer.prototype.handleRefreshEvent = function() {\n\tthis.syncFromServer();\n};\n\n/*\nQueue up a sync task. If there is already a pending task for the tiddler, just update the last modification time\n*/\nSyncer.prototype.enqueueSyncTask = function(task) {\n\tvar self = this,\n\t\tnow = Date.now();\n\t// Set the timestamps on this task\n\ttask.queueTime = now;\n\ttask.lastModificationTime = now;\n\t// Fill in some tiddlerInfo if the tiddler is one we haven't seen before\n\tthis.createTiddlerInfo(task.title);\n\t// Bail if this is a save and the tiddler is already at the changeCount that the server has\n\tif(task.type === \"save\" && this.wiki.getChangeCount(task.title) <= this.tiddlerInfo[task.title].changeCount) {\n\t\treturn;\n\t}\n\t// Check if this tiddler is already in the queue\n\tif($tw.utils.hop(this.taskQueue,task.title)) {\n\t\t// this.logger.log(\"Re-queueing up sync task with type:\",task.type,\"title:\",task.title);\n\t\tvar existingTask = this.taskQueue[task.title];\n\t\t// If so, just update the last modification time\n\t\texistingTask.lastModificationTime = task.lastModificationTime;\n\t\t// If the new task is a save then we upgrade the existing task to a save. Thus a pending load is turned into a save if the tiddler changes locally in the meantime. But a pending save is not modified to become a load\n\t\tif(task.type === \"save\" || task.type === \"delete\") {\n\t\t\texistingTask.type = task.type;\n\t\t}\n\t} else {\n\t\t// this.logger.log(\"Queuing up sync task with type:\",task.type,\"title:\",task.title);\n\t\t// If it is not in the queue, insert it\n\t\tthis.taskQueue[task.title] = task;\n\t\tthis.updateDirtyStatus();\n\t}\n\t// Process the queue\n\t$tw.utils.nextTick(function() {self.processTaskQueue.call(self);});\n};\n\n/*\nReturn the number of tasks in progress\n*/\nSyncer.prototype.numTasksInProgress = function() {\n\treturn $tw.utils.count(this.taskInProgress);\n};\n\n/*\nReturn the number of tasks in the queue\n*/\nSyncer.prototype.numTasksInQueue = function() {\n\treturn $tw.utils.count(this.taskQueue);\n};\n\n/*\nTrigger a timeout if one isn't already outstanding\n*/\nSyncer.prototype.triggerTimeout = function() {\n\tvar self = this;\n\tif(!this.taskTimerId) {\n\t\tthis.taskTimerId = setTimeout(function() {\n\t\t\tself.taskTimerId = null;\n\t\t\tself.processTaskQueue.call(self);\n\t\t},self.taskTimerInterval);\n\t}\n};\n\n/*\nProcess the task queue, performing the next task if appropriate\n*/\nSyncer.prototype.processTaskQueue = function() {\n\tvar self = this;\n\t// Only process a task if the sync adaptor is fully initialised and we're not already performing a task. If we are already performing a task then we'll dispatch the next one when it completes\n\tif((!this.syncadaptor.isReady || this.syncadaptor.isReady()) && this.numTasksInProgress() === 0) {\n\t\t// Choose the next task to perform\n\t\tvar task = this.chooseNextTask();\n\t\t// Perform the task if we had one\n\t\tif(task) {\n\t\t\t// Remove the task from the queue and add it to the in progress list\n\t\t\tdelete this.taskQueue[task.title];\n\t\t\tthis.taskInProgress[task.title] = task;\n\t\t\tthis.updateDirtyStatus();\n\t\t\t// Dispatch the task\n\t\t\tthis.dispatchTask(task,function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\tself.logger.alert(\"Sync error while processing '\" + task.title + \"':\\n\" + err);\n\t\t\t\t}\n\t\t\t\t// Mark that this task is no longer in progress\n\t\t\t\tdelete self.taskInProgress[task.title];\n\t\t\t\tself.updateDirtyStatus();\n\t\t\t\t// Process the next task\n\t\t\t\tself.processTaskQueue.call(self);\n\t\t\t});\n\t\t} else {\n\t\t\t// Make sure we've set a time if there wasn't a task to perform, but we've still got tasks in the queue\n\t\t\tif(this.numTasksInQueue() > 0) {\n\t\t\t\tthis.triggerTimeout();\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nChoose the next applicable task\n*/\nSyncer.prototype.chooseNextTask = function() {\n\tvar self = this,\n\t\tcandidateTask = null,\n\t\tnow = Date.now();\n\t// Select the best candidate task\n\t$tw.utils.each(this.taskQueue,function(task,title) {\n\t\t// Exclude the task if there's one of the same name in progress\n\t\tif($tw.utils.hop(self.taskInProgress,title)) {\n\t\t\treturn;\n\t\t}\n\t\t// Exclude the task if it is a save and the tiddler has been modified recently, but not hit the fallback time\n\t\tif(task.type === \"save\" && (now - task.lastModificationTime) < self.throttleInterval &&\n\t\t\t(now - task.queueTime) < self.fallbackInterval) {\n\t\t\treturn;\n\t\t}\n\t\t// Exclude the task if it is newer than the current best candidate\n\t\tif(candidateTask && candidateTask.queueTime < task.queueTime) {\n\t\t\treturn;\n\t\t}\n\t\t// Now this is our best candidate\n\t\tcandidateTask = task;\n\t});\n\treturn candidateTask;\n};\n\n/*\nDispatch a task and invoke the callback\n*/\nSyncer.prototype.dispatchTask = function(task,callback) {\n\tvar self = this;\n\tif(task.type === \"save\") {\n\t\tvar changeCount = this.wiki.getChangeCount(task.title),\n\t\t\ttiddler = this.wiki.getTiddler(task.title);\n\t\tthis.logger.log(\"Dispatching 'save' task:\",task.title);\n\t\tif(tiddler) {\n\t\t\tthis.syncadaptor.saveTiddler(tiddler,function(err,adaptorInfo,revision) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\t// Adjust the info stored about this tiddler\n\t\t\t\tself.tiddlerInfo[task.title] = {\n\t\t\t\t\tchangeCount: changeCount,\n\t\t\t\t\tadaptorInfo: adaptorInfo,\n\t\t\t\t\trevision: revision\n\t\t\t\t};\n\t\t\t\t// Invoke the callback\n\t\t\t\tcallback(null);\n\t\t\t},{\n\t\t\t\ttiddlerInfo: self.tiddlerInfo[task.title]\n\t\t\t});\n\t\t} else {\n\t\t\tthis.logger.log(\" Not Dispatching 'save' task:\",task.title,\"tiddler does not exist\");\n\t\t\treturn callback(null);\n\t\t}\n\t} else if(task.type === \"load\") {\n\t\t// Load the tiddler\n\t\tthis.logger.log(\"Dispatching 'load' task:\",task.title);\n\t\tthis.syncadaptor.loadTiddler(task.title,function(err,tiddlerFields) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Store the tiddler\n\t\t\tif(tiddlerFields) {\n\t\t\t\tself.storeTiddler(tiddlerFields,true);\n\t\t\t}\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t} else if(task.type === \"delete\") {\n\t\t// Delete the tiddler\n\t\tthis.logger.log(\"Dispatching 'delete' task:\",task.title);\n\t\tthis.syncadaptor.deleteTiddler(task.title,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tdelete self.tiddlerInfo[task.title];\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t},{\n\t\t\ttiddlerInfo: self.tiddlerInfo[task.title]\n\t\t});\n\t}\n};\n\nexports.Syncer = Syncer;\n\n})();\n",
"title": "$:/core/modules/syncer.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/tiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/tiddler.js\ntype: application/javascript\nmodule-type: tiddlermethod\n\nExtension methods for the $tw.Tiddler object (constructor and methods required at boot time are in boot/boot.js)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.hasTag = function(tag) {\n\treturn this.fields.tags && this.fields.tags.indexOf(tag) !== -1;\n};\n\nexports.isPlugin = function() {\n\treturn this.fields.type === \"application/json\" && this.hasField(\"plugin-type\");\n};\n\nexports.isDraft = function() {\n\treturn this.hasField(\"draft.of\");\n};\n\nexports.getFieldString = function(field) {\n\tvar value = this.fields[field];\n\t// Check for a missing field\n\tif(value === undefined || value === null) {\n\t\treturn \"\";\n\t}\n\t// Parse the field with the associated module (if any)\n\tvar fieldModule = $tw.Tiddler.fieldModules[field];\n\tif(fieldModule && fieldModule.stringify) {\n\t\treturn fieldModule.stringify.call(this,value);\n\t} else {\n\t\treturn value.toString();\n\t}\n};\n\n/*\nGet all the fields as a hashmap of strings. Options:\n\texclude: an array of field names to exclude\n*/\nexports.getFieldStrings = function(options) {\n\toptions = options || {};\n\tvar exclude = options.exclude || [];\n\tvar fields = {};\n\tfor(var field in this.fields) {\n\t\tif($tw.utils.hop(this.fields,field)) {\n\t\t\tif(exclude.indexOf(field) === -1) {\n\t\t\t\tfields[field] = this.getFieldString(field);\n\t\t\t}\n\t\t}\n\t}\n\treturn fields;\n};\n\n/*\nGet all the fields as a name:value block. Options:\n\texclude: an array of field names to exclude\n*/\nexports.getFieldStringBlock = function(options) {\n\toptions = options || {};\n\tvar exclude = options.exclude || [];\n\tvar fields = [];\n\tfor(var field in this.fields) {\n\t\tif($tw.utils.hop(this.fields,field)) {\n\t\t\tif(exclude.indexOf(field) === -1) {\n\t\t\t\tfields.push(field + \": \" + this.getFieldString(field));\n\t\t\t}\n\t\t}\n\t}\n\treturn fields.join(\"\\n\");\n};\n\n/*\nCompare two tiddlers for equality\ntiddler: the tiddler to compare\nexcludeFields: array of field names to exclude from the comparison\n*/\nexports.isEqual = function(tiddler,excludeFields) {\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\treturn false;\n\t}\n\texcludeFields = excludeFields || [];\n\tvar self = this,\n\t\tdifferences = []; // Fields that have differences\n\t// Add to the differences array\n\tfunction addDifference(fieldName) {\n\t\t// Check for this field being excluded\n\t\tif(excludeFields.indexOf(fieldName) === -1) {\n\t\t\t// Save the field as a difference\n\t\t\t$tw.utils.pushTop(differences,fieldName);\n\t\t}\n\t}\n\t// Returns true if the two values of this field are equal\n\tfunction isFieldValueEqual(fieldName) {\n\t\tvar valueA = self.fields[fieldName],\n\t\t\tvalueB = tiddler.fields[fieldName];\n\t\t// Check for identical string values\n\t\tif(typeof(valueA) === \"string\" && typeof(valueB) === \"string\" && valueA === valueB) {\n\t\t\treturn true;\n\t\t}\n\t\t// Check for identical array values\n\t\tif($tw.utils.isArray(valueA) && $tw.utils.isArray(valueB) && $tw.utils.isArrayEqual(valueA,valueB)) {\n\t\t\treturn true;\n\t\t}\n\t\t// Otherwise the fields must be different\n\t\treturn false;\n\t}\n\t// Compare our fields\n\tfor(var fieldName in this.fields) {\n\t\tif(!isFieldValueEqual(fieldName)) {\n\t\t\taddDifference(fieldName);\n\t\t}\n\t}\n\t// There's a difference for every field in the other tiddler that we don't have\n\tfor(fieldName in tiddler.fields) {\n\t\tif(!(fieldName in this.fields)) {\n\t\t\taddDifference(fieldName);\n\t\t}\n\t}\n\t// Return whether there were any differences\n\treturn differences.length === 0;\n};\n\nexports.getFieldDay = function(field) {\n\tif(this.cache && this.cache.day && $tw.utils.hop(this.cache.day,field) ) {\n\t\treturn this.cache.day[field];\n\t}\n\tvar day = \"\";\n\tif(this.fields[field]) {\n\t\tday = (new Date($tw.utils.parseDate(this.fields[field]))).setHours(0,0,0,0);\n\t}\n\tthis.cache.day = this.cache.day || {};\n\tthis.cache.day[field] = day;\n\treturn day;\n};\n\n})();\n",
"title": "$:/core/modules/tiddler.js",
"type": "application/javascript",
"module-type": "tiddlermethod"
},
"$:/core/modules/upgraders/plugins.js": {
"text": "/*\\\ntitle: $:/core/modules/upgraders/plugins.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that checks that plugins are newer than any already installed version\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar UPGRADE_LIBRARY_TITLE = \"$:/UpgradeLibrary\";\n\nvar BLOCKED_PLUGINS = {\n\t\"$:/themes/tiddlywiki/stickytitles\": {\n\t\tversions: [\"*\"]\n\t},\n\t\"$:/plugins/tiddlywiki/fullscreen\": {\n\t\tversions: [\"*\"]\n\t}\n};\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {},\n\t\tupgradeLibrary,\n\t\tgetLibraryTiddler = function(title) {\n\t\t\tif(!upgradeLibrary) {\n\t\t\t\tupgradeLibrary = wiki.getTiddlerData(UPGRADE_LIBRARY_TITLE,{});\n\t\t\t\tupgradeLibrary.tiddlers = upgradeLibrary.tiddlers || {};\n\t\t\t}\n\t\t\treturn upgradeLibrary.tiddlers[title];\n\t\t};\n\n\t// Go through all the incoming tiddlers\n\t$tw.utils.each(titles,function(title) {\n\t\tvar incomingTiddler = tiddlers[title];\n\t\t// Check if we're dealing with a plugin\n\t\tif(incomingTiddler && incomingTiddler[\"plugin-type\"] && incomingTiddler.version) {\n\t\t\t// Upgrade the incoming plugin if it is in the upgrade library\n\t\t\tvar libraryTiddler = getLibraryTiddler(title);\n\t\t\tif(libraryTiddler && libraryTiddler[\"plugin-type\"] && libraryTiddler.version) {\n\t\t\t\ttiddlers[title] = libraryTiddler;\n\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Plugins/Upgraded\",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Suppress the incoming plugin if it is older than the currently installed one\n\t\t\tvar existingTiddler = wiki.getTiddler(title);\n\t\t\tif(existingTiddler && existingTiddler.hasField(\"plugin-type\") && existingTiddler.hasField(\"version\")) {\n\t\t\t\t// Reject the incoming plugin by blanking all its fields\n\t\t\t\tif($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {\n\t\t\t\t\ttiddlers[title] = Object.create(null);\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Plugins/Suppressed/Version\",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(incomingTiddler && incomingTiddler[\"plugin-type\"]) {\n\t\t\t// Check whether the plugin is on the blocked list\n\t\t\tvar blockInfo = BLOCKED_PLUGINS[title];\n\t\t\tif(blockInfo) {\n\t\t\t\tif(blockInfo.versions.indexOf(\"*\") !== -1 || (incomingTiddler.version && blockInfo.versions.indexOf(incomingTiddler.version) !== -1)) {\n\t\t\t\t\ttiddlers[title] = Object.create(null);\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Plugins/Suppressed/Incompatible\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn messages;\n};\n\n})();\n",
"title": "$:/core/modules/upgraders/plugins.js",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/upgraders/system.js": {
"text": "/*\\\ntitle: $:/core/modules/upgraders/system.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that suppresses certain system tiddlers that shouldn't be imported\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DONT_IMPORT_LIST = [\"$:/StoryList\",\"$:/HistoryList\"],\n\tDONT_IMPORT_PREFIX_LIST = [\"$:/temp/\",\"$:/state/\"];\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {};\n\t// Check for tiddlers on our list\n\t$tw.utils.each(titles,function(title) {\n\t\tif(DONT_IMPORT_LIST.indexOf(title) !== -1) {\n\t\t\ttiddlers[title] = Object.create(null);\n\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/System/Suppressed\");\n\t\t} else {\n\t\t\tfor(var t=0; t<DONT_IMPORT_PREFIX_LIST.length; t++) {\n\t\t\t\tvar prefix = DONT_IMPORT_PREFIX_LIST[t];\n\t\t\t\tif(title.substr(0,prefix.length) === prefix) {\n\t\t\t\t\ttiddlers[title] = Object.create(null);\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/State/Suppressed\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn messages;\n};\n\n})();\n",
"title": "$:/core/modules/upgraders/system.js",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/upgraders/themetweaks.js": {
"text": "/*\\\ntitle: $:/core/modules/upgraders/themetweaks.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that handles the change in theme tweak storage introduced in 5.0.14-beta.\n\nPreviously, theme tweaks were stored in two data tiddlers:\n\n* $:/themes/tiddlywiki/vanilla/metrics\n* $:/themes/tiddlywiki/vanilla/settings\n\nNow, each tweak is stored in its own separate tiddler.\n\nThis upgrader copies any values from the old format to the new. The old data tiddlers are not deleted in case they have been used to store additional indexes.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar MAPPINGS = {\n\t\"$:/themes/tiddlywiki/vanilla/metrics\": {\n\t\t\"fontsize\": \"$:/themes/tiddlywiki/vanilla/metrics/fontsize\",\n\t\t\"lineheight\": \"$:/themes/tiddlywiki/vanilla/metrics/lineheight\",\n\t\t\"storyleft\": \"$:/themes/tiddlywiki/vanilla/metrics/storyleft\",\n\t\t\"storytop\": \"$:/themes/tiddlywiki/vanilla/metrics/storytop\",\n\t\t\"storyright\": \"$:/themes/tiddlywiki/vanilla/metrics/storyright\",\n\t\t\"storywidth\": \"$:/themes/tiddlywiki/vanilla/metrics/storywidth\",\n\t\t\"tiddlerwidth\": \"$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth\"\n\t},\n\t\"$:/themes/tiddlywiki/vanilla/settings\": {\n\t\t\"fontfamily\": \"$:/themes/tiddlywiki/vanilla/settings/fontfamily\"\n\t}\n};\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {};\n\t// Check for tiddlers on our list\n\t$tw.utils.each(titles,function(title) {\n\t\tvar mapping = MAPPINGS[title];\n\t\tif(mapping) {\n\t\t\tvar tiddler = new $tw.Tiddler(tiddlers[title]),\n\t\t\t\ttiddlerData = wiki.getTiddlerDataCached(tiddler,{});\n\t\t\tfor(var index in mapping) {\n\t\t\t\tvar mappedTitle = mapping[index];\n\t\t\t\tif(!tiddlers[mappedTitle] || tiddlers[mappedTitle].title !== mappedTitle) {\n\t\t\t\t\ttiddlers[mappedTitle] = {\n\t\t\t\t\t\ttitle: mappedTitle,\n\t\t\t\t\t\ttext: tiddlerData[index]\n\t\t\t\t\t};\n\t\t\t\t\tmessages[mappedTitle] = $tw.language.getString(\"Import/Upgrader/ThemeTweaks/Created\",{variables: {\n\t\t\t\t\t\tfrom: title + \"##\" + index\n\t\t\t\t\t}});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn messages;\n};\n\n})();\n",
"title": "$:/core/modules/upgraders/themetweaks.js",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/utils/crypto.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/crypto.js\ntype: application/javascript\nmodule-type: utils\n\nUtility functions related to crypto.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nLook for an encrypted store area in the text of a TiddlyWiki file\n*/\nexports.extractEncryptedStoreArea = function(text) {\n\tvar encryptedStoreAreaStartMarker = \"<pre id=\\\"encryptedStoreArea\\\" type=\\\"text/plain\\\" style=\\\"display:none;\\\">\",\n\t\tencryptedStoreAreaStart = text.indexOf(encryptedStoreAreaStartMarker);\n\tif(encryptedStoreAreaStart !== -1) {\n\t\tvar encryptedStoreAreaEnd = text.indexOf(\"</pre>\",encryptedStoreAreaStart);\n\t\tif(encryptedStoreAreaEnd !== -1) {\n\t\t\treturn $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd-1));\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nAttempt to extract the tiddlers from an encrypted store area using the current password. If the password is not provided then the password in the password store will be used\n*/\nexports.decryptStoreArea = function(encryptedStoreArea,password) {\n\tvar decryptedText = $tw.crypto.decrypt(encryptedStoreArea,password);\n\tif(decryptedText) {\n\t\tvar json = JSON.parse(decryptedText),\n\t\t\ttiddlers = [];\n\t\tfor(var title in json) {\n\t\t\tif(title !== \"$:/isEncrypted\") {\n\t\t\t\ttiddlers.push(json[title]);\n\t\t\t}\n\t\t}\n\t\treturn tiddlers;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n\n/*\nAttempt to extract the tiddlers from an encrypted store area using the current password. If that fails, the user is prompted for a password.\nencryptedStoreArea: text of the TiddlyWiki encrypted store area\ncallback: function(tiddlers) called with the array of decrypted tiddlers\n\nThe following configuration settings are supported:\n\n$tw.config.usePasswordVault: causes any password entered by the user to also be put into the system password vault\n*/\nexports.decryptStoreAreaInteractive = function(encryptedStoreArea,callback,options) {\n\t// Try to decrypt with the current password\n\tvar tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea);\n\tif(tiddlers) {\n\t\tcallback(tiddlers);\n\t} else {\n\t\t// Prompt for a new password and keep trying\n\t\t$tw.passwordPrompt.createPrompt({\n\t\t\tserviceName: \"Enter a password to decrypt the imported TiddlyWiki\",\n\t\t\tnoUserName: true,\n\t\t\tcanCancel: true,\n\t\t\tsubmitText: \"Decrypt\",\n\t\t\tcallback: function(data) {\n\t\t\t\t// Exit if the user cancelled\n\t\t\t\tif(!data) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// Attempt to decrypt the tiddlers\n\t\t\t\tvar tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea,data.password);\n\t\t\t\tif(tiddlers) {\n\t\t\t\t\tif($tw.config.usePasswordVault) {\n\t\t\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\t\t}\n\t\t\t\t\tcallback(tiddlers);\n\t\t\t\t\t// Exit and remove the password prompt\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\t// We didn't decrypt everything, so continue to prompt for password\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/utils/crypto.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/animations/slide.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animations/slide.js\ntype: application/javascript\nmodule-type: animation\n\nA simple slide animation that varies the height of the element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction slideOpen(domNode,options) {\n\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration();\n\t// Get the current height of the domNode\n\tvar computedStyle = window.getComputedStyle(domNode),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrPaddingBottom = parseInt(computedStyle.paddingBottom,10),\n\t\tcurrPaddingTop = parseInt(computedStyle.paddingTop,10),\n\t\tcurrHeight = domNode.offsetHeight;\n\t// Reset the margin once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"none\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{marginTop: currMarginTop + \"px\"},\n\t\t{paddingBottom: currPaddingBottom + \"px\"},\n\t\t{paddingTop: currPaddingTop + \"px\"},\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n}\n\nfunction slideClosed(domNode,options) {\n\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration(),\n\t\tcurrHeight = domNode.offsetHeight;\n\t// Clear the properties we've set when the animation is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n}\n\nexports.slide = {\n\topen: slideOpen,\n\tclose: slideClosed\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/animations/slide.js",
"type": "application/javascript",
"module-type": "animation"
},
"$:/core/modules/utils/dom/animator.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animator.js\ntype: application/javascript\nmodule-type: utils\n\nOrchestrates animations and transitions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Animator() {\n\t// Get the registered animation modules\n\tthis.animations = {};\n\t$tw.modules.applyMethods(\"animation\",this.animations);\n}\n\nAnimator.prototype.perform = function(type,domNode,options) {\n\toptions = options || {};\n\t// Find an animation that can handle this type\n\tvar chosenAnimation;\n\t$tw.utils.each(this.animations,function(animation,name) {\n\t\tif($tw.utils.hop(animation,type)) {\n\t\t\tchosenAnimation = animation[type];\n\t\t}\n\t});\n\tif(!chosenAnimation) {\n\t\tchosenAnimation = function(domNode,options) {\n\t\t\tif(options.callback) {\n\t\t\t\toptions.callback();\n\t\t\t}\n\t\t};\n\t}\n\t// Call the animation\n\tchosenAnimation(domNode,options);\n};\n\nexports.Animator = Animator;\n\n})();\n",
"title": "$:/core/modules/utils/dom/animator.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/browser.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/browser.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser feature detection\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet style properties of an element\n\telement: dom node\n\tstyles: ordered array of {name: value} pairs\n*/\nexports.setStyle = function(element,styles) {\n\tif(element.nodeType === 1) { // Element.ELEMENT_NODE\n\t\tfor(var t=0; t<styles.length; t++) {\n\t\t\tfor(var styleName in styles[t]) {\n\t\t\t\telement.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nConverts a standard CSS property name into the local browser-specific equivalent. For example:\n\t\"background-color\" --> \"backgroundColor\"\n\t\"transition\" --> \"webkitTransition\"\n*/\n\nvar styleNameCache = {}; // We'll cache the style name conversions\n\nexports.convertStyleNameToPropertyName = function(styleName) {\n\t// Return from the cache if we can\n\tif(styleNameCache[styleName]) {\n\t\treturn styleNameCache[styleName];\n\t}\n\t// Convert it by first removing any hyphens\n\tvar propertyName = $tw.utils.unHyphenateCss(styleName);\n\t// Then check if it needs a prefix\n\tif($tw.browser && document.body.style[propertyName] === undefined) {\n\t\tvar prefixes = [\"O\",\"MS\",\"Moz\",\"webkit\"];\n\t\tfor(var t=0; t<prefixes.length; t++) {\n\t\t\tvar prefixedName = prefixes[t] + propertyName.substr(0,1).toUpperCase() + propertyName.substr(1);\n\t\t\tif(document.body.style[prefixedName] !== undefined) {\n\t\t\t\tpropertyName = prefixedName;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// Put it in the cache too\n\tstyleNameCache[styleName] = propertyName;\n\treturn propertyName;\n};\n\n/*\nConverts a JS format CSS property name back into the dashed form used in CSS declarations. For example:\n\t\"backgroundColor\" --> \"background-color\"\n\t\"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.convertPropertyNameToStyleName = function(propertyName) {\n\t// Rehyphenate the name\n\tvar styleName = $tw.utils.hyphenateCss(propertyName);\n\t// If there's a webkit prefix, add a dash (other browsers have uppercase prefixes, and so get the dash automatically)\n\tif(styleName.indexOf(\"webkit\") === 0) {\n\t\tstyleName = \"-\" + styleName;\n\t} else if(styleName.indexOf(\"-m-s\") === 0) {\n\t\tstyleName = \"-ms\" + styleName.substr(4);\n\t}\n\treturn styleName;\n};\n\n/*\nRound trip a stylename to a property name and back again. For example:\n\t\"transform\" --> \"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.roundTripPropertyName = function(propertyName) {\n\treturn $tw.utils.convertPropertyNameToStyleName($tw.utils.convertStyleNameToPropertyName(propertyName));\n};\n\n/*\nConverts a standard event name into the local browser specific equivalent. For example:\n\t\"animationEnd\" --> \"webkitAnimationEnd\"\n*/\n\nvar eventNameCache = {}; // We'll cache the conversions\n\nvar eventNameMappings = {\n\t\"transitionEnd\": {\n\t\tcorrespondingCssProperty: \"transition\",\n\t\tmappings: {\n\t\t\ttransition: \"transitionend\",\n\t\t\tOTransition: \"oTransitionEnd\",\n\t\t\tMSTransition: \"msTransitionEnd\",\n\t\t\tMozTransition: \"transitionend\",\n\t\t\twebkitTransition: \"webkitTransitionEnd\"\n\t\t}\n\t},\n\t\"animationEnd\": {\n\t\tcorrespondingCssProperty: \"animation\",\n\t\tmappings: {\n\t\t\tanimation: \"animationend\",\n\t\t\tOAnimation: \"oAnimationEnd\",\n\t\t\tMSAnimation: \"msAnimationEnd\",\n\t\t\tMozAnimation: \"animationend\",\n\t\t\twebkitAnimation: \"webkitAnimationEnd\"\n\t\t}\n\t}\n};\n\nexports.convertEventName = function(eventName) {\n\tif(eventNameCache[eventName]) {\n\t\treturn eventNameCache[eventName];\n\t}\n\tvar newEventName = eventName,\n\t\tmappings = eventNameMappings[eventName];\n\tif(mappings) {\n\t\tvar convertedProperty = $tw.utils.convertStyleNameToPropertyName(mappings.correspondingCssProperty);\n\t\tif(mappings.mappings[convertedProperty]) {\n\t\t\tnewEventName = mappings.mappings[convertedProperty];\n\t\t}\n\t}\n\t// Put it in the cache too\n\teventNameCache[eventName] = newEventName;\n\treturn newEventName;\n};\n\n/*\nReturn the names of the fullscreen APIs\n*/\nexports.getFullScreenApis = function() {\n\tvar d = document,\n\t\tdb = d.body,\n\t\tresult = {\n\t\t\"_requestFullscreen\": db.webkitRequestFullscreen !== undefined ? \"webkitRequestFullscreen\" :\n\t\t\t\t\t\t\tdb.mozRequestFullScreen !== undefined ? \"mozRequestFullScreen\" :\n\t\t\t\t\t\t\tdb.msRequestFullscreen !== undefined ? \"msRequestFullscreen\" :\n\t\t\t\t\t\t\tdb.requestFullscreen !== undefined ? \"requestFullscreen\" : \"\",\n\t\t\"_exitFullscreen\": d.webkitExitFullscreen !== undefined ? \"webkitExitFullscreen\" :\n\t\t\t\t\t\t\td.mozCancelFullScreen !== undefined ? \"mozCancelFullScreen\" :\n\t\t\t\t\t\t\td.msExitFullscreen !== undefined ? \"msExitFullscreen\" :\n\t\t\t\t\t\t\td.exitFullscreen !== undefined ? \"exitFullscreen\" : \"\",\n\t\t\"_fullscreenElement\": d.webkitFullscreenElement !== undefined ? \"webkitFullscreenElement\" :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \"mozFullScreenElement\" :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \"msFullscreenElement\" :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \"fullscreenElement\" : \"\",\n\t\t\"_fullscreenChange\": d.webkitFullscreenElement !== undefined ? \"webkitfullscreenchange\" :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \"mozfullscreenchange\" :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \"MSFullscreenChange\" :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \"fullscreenchange\" : \"\"\n\t};\n\tif(!result._requestFullscreen || !result._exitFullscreen || !result._fullscreenElement || !result._fullscreenChange) {\n\t\treturn null;\n\t} else {\n\t\treturn result;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/browser.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/csscolorparser.js": {
"text": "// (c) Dean McNamee <dean@gmail.com>, 2012.\n//\n// https://github.com/deanm/css-color-parser-js\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n\n// http://www.w3.org/TR/css3-color/\nvar kCSSColorTable = {\n \"transparent\": [0,0,0,0], \"aliceblue\": [240,248,255,1],\n \"antiquewhite\": [250,235,215,1], \"aqua\": [0,255,255,1],\n \"aquamarine\": [127,255,212,1], \"azure\": [240,255,255,1],\n \"beige\": [245,245,220,1], \"bisque\": [255,228,196,1],\n \"black\": [0,0,0,1], \"blanchedalmond\": [255,235,205,1],\n \"blue\": [0,0,255,1], \"blueviolet\": [138,43,226,1],\n \"brown\": [165,42,42,1], \"burlywood\": [222,184,135,1],\n \"cadetblue\": [95,158,160,1], \"chartreuse\": [127,255,0,1],\n \"chocolate\": [210,105,30,1], \"coral\": [255,127,80,1],\n \"cornflowerblue\": [100,149,237,1], \"cornsilk\": [255,248,220,1],\n \"crimson\": [220,20,60,1], \"cyan\": [0,255,255,1],\n \"darkblue\": [0,0,139,1], \"darkcyan\": [0,139,139,1],\n \"darkgoldenrod\": [184,134,11,1], \"darkgray\": [169,169,169,1],\n \"darkgreen\": [0,100,0,1], \"darkgrey\": [169,169,169,1],\n \"darkkhaki\": [189,183,107,1], \"darkmagenta\": [139,0,139,1],\n \"darkolivegreen\": [85,107,47,1], \"darkorange\": [255,140,0,1],\n \"darkorchid\": [153,50,204,1], \"darkred\": [139,0,0,1],\n \"darksalmon\": [233,150,122,1], \"darkseagreen\": [143,188,143,1],\n \"darkslateblue\": [72,61,139,1], \"darkslategray\": [47,79,79,1],\n \"darkslategrey\": [47,79,79,1], \"darkturquoise\": [0,206,209,1],\n \"darkviolet\": [148,0,211,1], \"deeppink\": [255,20,147,1],\n \"deepskyblue\": [0,191,255,1], \"dimgray\": [105,105,105,1],\n \"dimgrey\": [105,105,105,1], \"dodgerblue\": [30,144,255,1],\n \"firebrick\": [178,34,34,1], \"floralwhite\": [255,250,240,1],\n \"forestgreen\": [34,139,34,1], \"fuchsia\": [255,0,255,1],\n \"gainsboro\": [220,220,220,1], \"ghostwhite\": [248,248,255,1],\n \"gold\": [255,215,0,1], \"goldenrod\": [218,165,32,1],\n \"gray\": [128,128,128,1], \"green\": [0,128,0,1],\n \"greenyellow\": [173,255,47,1], \"grey\": [128,128,128,1],\n \"honeydew\": [240,255,240,1], \"hotpink\": [255,105,180,1],\n \"indianred\": [205,92,92,1], \"indigo\": [75,0,130,1],\n \"ivory\": [255,255,240,1], \"khaki\": [240,230,140,1],\n \"lavender\": [230,230,250,1], \"lavenderblush\": [255,240,245,1],\n \"lawngreen\": [124,252,0,1], \"lemonchiffon\": [255,250,205,1],\n \"lightblue\": [173,216,230,1], \"lightcoral\": [240,128,128,1],\n \"lightcyan\": [224,255,255,1], \"lightgoldenrodyellow\": [250,250,210,1],\n \"lightgray\": [211,211,211,1], \"lightgreen\": [144,238,144,1],\n \"lightgrey\": [211,211,211,1], \"lightpink\": [255,182,193,1],\n \"lightsalmon\": [255,160,122,1], \"lightseagreen\": [32,178,170,1],\n \"lightskyblue\": [135,206,250,1], \"lightslategray\": [119,136,153,1],\n \"lightslategrey\": [119,136,153,1], \"lightsteelblue\": [176,196,222,1],\n \"lightyellow\": [255,255,224,1], \"lime\": [0,255,0,1],\n \"limegreen\": [50,205,50,1], \"linen\": [250,240,230,1],\n \"magenta\": [255,0,255,1], \"maroon\": [128,0,0,1],\n \"mediumaquamarine\": [102,205,170,1], \"mediumblue\": [0,0,205,1],\n \"mediumorchid\": [186,85,211,1], \"mediumpurple\": [147,112,219,1],\n \"mediumseagreen\": [60,179,113,1], \"mediumslateblue\": [123,104,238,1],\n \"mediumspringgreen\": [0,250,154,1], \"mediumturquoise\": [72,209,204,1],\n \"mediumvioletred\": [199,21,133,1], \"midnightblue\": [25,25,112,1],\n \"mintcream\": [245,255,250,1], \"mistyrose\": [255,228,225,1],\n \"moccasin\": [255,228,181,1], \"navajowhite\": [255,222,173,1],\n \"navy\": [0,0,128,1], \"oldlace\": [253,245,230,1],\n \"olive\": [128,128,0,1], \"olivedrab\": [107,142,35,1],\n \"orange\": [255,165,0,1], \"orangered\": [255,69,0,1],\n \"orchid\": [218,112,214,1], \"palegoldenrod\": [238,232,170,1],\n \"palegreen\": [152,251,152,1], \"paleturquoise\": [175,238,238,1],\n \"palevioletred\": [219,112,147,1], \"papayawhip\": [255,239,213,1],\n \"peachpuff\": [255,218,185,1], \"peru\": [205,133,63,1],\n \"pink\": [255,192,203,1], \"plum\": [221,160,221,1],\n \"powderblue\": [176,224,230,1], \"purple\": [128,0,128,1],\n \"red\": [255,0,0,1], \"rosybrown\": [188,143,143,1],\n \"royalblue\": [65,105,225,1], \"saddlebrown\": [139,69,19,1],\n \"salmon\": [250,128,114,1], \"sandybrown\": [244,164,96,1],\n \"seagreen\": [46,139,87,1], \"seashell\": [255,245,238,1],\n \"sienna\": [160,82,45,1], \"silver\": [192,192,192,1],\n \"skyblue\": [135,206,235,1], \"slateblue\": [106,90,205,1],\n \"slategray\": [112,128,144,1], \"slategrey\": [112,128,144,1],\n \"snow\": [255,250,250,1], \"springgreen\": [0,255,127,1],\n \"steelblue\": [70,130,180,1], \"tan\": [210,180,140,1],\n \"teal\": [0,128,128,1], \"thistle\": [216,191,216,1],\n \"tomato\": [255,99,71,1], \"turquoise\": [64,224,208,1],\n \"violet\": [238,130,238,1], \"wheat\": [245,222,179,1],\n \"white\": [255,255,255,1], \"whitesmoke\": [245,245,245,1],\n \"yellow\": [255,255,0,1], \"yellowgreen\": [154,205,50,1]}\n\nfunction clamp_css_byte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clamp_css_float(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parse_css_int(str) { // int or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n return clamp_css_byte(parseInt(str));\n}\n\nfunction parse_css_float(str) { // float or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_float(parseFloat(str) / 100);\n return clamp_css_float(parseFloat(str));\n}\n\nfunction css_hue_to_rgb(m1, m2, h) {\n if (h < 0) h += 1;\n else if (h > 1) h -= 1;\n\n if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;\n if (h * 2 < 1) return m2;\n if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6;\n return m1;\n}\n\nfunction parseCSSColor(css_str) {\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = css_str.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) return kCSSColorTable[str].slice(); // dup.\n\n // #abc and #abc123 syntax.\n if (str[0] === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) return null; // Covers NaN.\n return [((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) return null; // Covers NaN.\n return [(iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1];\n }\n\n return null;\n }\n\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op+1, ep-(op+1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'rgb':\n if (params.length !== 3) return null;\n return [parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha];\n case 'hsla':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'hsl':\n if (params.length !== 3) return null;\n var h = (((parseFloat(params[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [clamp_css_byte(css_hue_to_rgb(m1, m2, h+1/3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h-1/3) * 255),\n alpha];\n default:\n return null;\n }\n }\n\n return null;\n}\n\ntry { exports.parseCSSColor = parseCSSColor } catch(e) { }\n",
"title": "$:/core/modules/utils/dom/csscolorparser.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static DOM-related utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDetermines whether element 'a' contains element 'b'\nCode thanks to John Resig, http://ejohn.org/blog/comparing-document-position/\n*/\nexports.domContains = function(a,b) {\n\treturn a.contains ?\n\t\ta !== b && a.contains(b) :\n\t\t!!(a.compareDocumentPosition(b) & 16);\n};\n\nexports.removeChildren = function(node) {\n\twhile(node.hasChildNodes()) {\n\t\tnode.removeChild(node.firstChild);\n\t}\n};\n\nexports.hasClass = function(el,className) {\n\treturn el && el.className && el.className.toString().split(\" \").indexOf(className) !== -1;\n};\n\nexports.addClass = function(el,className) {\n\tvar c = el.className.split(\" \");\n\tif(c.indexOf(className) === -1) {\n\t\tc.push(className);\n\t}\n\tel.className = c.join(\" \");\n};\n\nexports.removeClass = function(el,className) {\n\tvar c = el.className.split(\" \"),\n\t\tp = c.indexOf(className);\n\tif(p !== -1) {\n\t\tc.splice(p,1);\n\t\tel.className = c.join(\" \");\n\t}\n};\n\nexports.toggleClass = function(el,className,status) {\n\tif(status === undefined) {\n\t\tstatus = !exports.hasClass(el,className);\n\t}\n\tif(status) {\n\t\texports.addClass(el,className);\n\t} else {\n\t\texports.removeClass(el,className);\n\t}\n};\n\n/*\nGet the first parent element that has scrollbars or use the body as fallback.\n*/\nexports.getScrollContainer = function(el) {\n\tvar doc = el.ownerDocument;\n\twhile(el.parentNode) {\t\n\t\tel = el.parentNode;\n\t\tif(el.scrollTop) {\n\t\t\treturn el;\n\t\t}\n\t}\n\treturn doc.body;\n};\n\n/*\nGet the scroll position of the viewport\nReturns:\n\t{\n\t\tx: horizontal scroll position in pixels,\n\t\ty: vertical scroll position in pixels\n\t}\n*/\nexports.getScrollPosition = function() {\n\tif(\"scrollX\" in window) {\n\t\treturn {x: window.scrollX, y: window.scrollY};\n\t} else {\n\t\treturn {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop};\n\t}\n};\n\n/*\nAdjust the height of a textarea to fit its content, preserving scroll position, and return the height\n*/\nexports.resizeTextAreaToFit = function(domNode,minHeight) {\n\t// Get the scroll container and register the current scroll position\n\tvar container = $tw.utils.getScrollContainer(domNode),\n\t\tscrollTop = container.scrollTop;\n // Measure the specified minimum height\n\tdomNode.style.height = minHeight;\n\tvar measuredHeight = domNode.offsetHeight;\n\t// Set its height to auto so that it snaps to the correct height\n\tdomNode.style.height = \"auto\";\n\t// Calculate the revised height\n\tvar newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,measuredHeight);\n\t// Only try to change the height if it has changed\n\tif(newHeight !== domNode.offsetHeight) {\n\t\tdomNode.style.height = newHeight + \"px\";\n\t\t// Make sure that the dimensions of the textarea are recalculated\n\t\t$tw.utils.forceLayout(domNode);\n\t\t// Set the container to the position we registered at the beginning\n\t\tcontainer.scrollTop = scrollTop;\n\t}\n\treturn newHeight;\n};\n\n/*\nGets the bounding rectangle of an element in absolute page coordinates\n*/\nexports.getBoundingPageRect = function(element) {\n\tvar scrollPos = $tw.utils.getScrollPosition(),\n\t\tclientRect = element.getBoundingClientRect();\n\treturn {\n\t\tleft: clientRect.left + scrollPos.x,\n\t\twidth: clientRect.width,\n\t\tright: clientRect.right + scrollPos.x,\n\t\ttop: clientRect.top + scrollPos.y,\n\t\theight: clientRect.height,\n\t\tbottom: clientRect.bottom + scrollPos.y\n\t};\n};\n\n/*\nSaves a named password in the browser\n*/\nexports.savePassword = function(name,password) {\n\ttry {\n\t\tif(window.localStorage) {\n\t\t\tlocalStorage.setItem(\"tw5-password-\" + name,password);\n\t\t}\n\t} catch(e) {\n\t}\n};\n\n/*\nRetrieve a named password from the browser\n*/\nexports.getPassword = function(name) {\n\ttry {\n\t\treturn window.localStorage ? localStorage.getItem(\"tw5-password-\" + name) : \"\";\n\t} catch(e) {\n\t\treturn \"\";\n\t}\n};\n\n/*\nForce layout of a dom node and its descendents\n*/\nexports.forceLayout = function(element) {\n\tvar dummy = element.offsetWidth;\n};\n\n/*\nPulse an element for debugging purposes\n*/\nexports.pulseElement = function(element) {\n\t// Event handler to remove the class at the end\n\telement.addEventListener($tw.browser.animationEnd,function handler(event) {\n\t\telement.removeEventListener($tw.browser.animationEnd,handler,false);\n\t\t$tw.utils.removeClass(element,\"pulse\");\n\t},false);\n\t// Apply the pulse class\n\t$tw.utils.removeClass(element,\"pulse\");\n\t$tw.utils.forceLayout(element);\n\t$tw.utils.addClass(element,\"pulse\");\n};\n\n/*\nAttach specified event handlers to a DOM node\ndomNode: where to attach the event handlers\nevents: array of event handlers to be added (see below)\nEach entry in the events array is an object with these properties:\nhandlerFunction: optional event handler function\nhandlerObject: optional event handler object\nhandlerMethod: optionally specifies object handler method name (defaults to `handleEvent`)\n*/\nexports.addEventListeners = function(domNode,events) {\n\t$tw.utils.each(events,function(eventInfo) {\n\t\tvar handler;\n\t\tif(eventInfo.handlerFunction) {\n\t\t\thandler = eventInfo.handlerFunction;\n\t\t} else if(eventInfo.handlerObject) {\n\t\t\tif(eventInfo.handlerMethod) {\n\t\t\t\thandler = function(event) {\n\t\t\t\t\teventInfo.handlerObject[eventInfo.handlerMethod].call(eventInfo.handlerObject,event);\n\t\t\t\t};\t\n\t\t\t} else {\n\t\t\t\thandler = eventInfo.handlerObject;\n\t\t\t}\n\t\t}\n\t\tdomNode.addEventListener(eventInfo.name,handler,false);\n\t});\n};\n\n/*\nGet the computed styles applied to an element as an array of strings of individual CSS properties\n*/\nexports.getComputedStyles = function(domNode) {\n\tvar textAreaStyles = window.getComputedStyle(domNode,null),\n\t\tstyleDefs = [],\n\t\tname;\n\tfor(var t=0; t<textAreaStyles.length; t++) {\n\t\tname = textAreaStyles[t];\n\t\tstyleDefs.push(name + \": \" + textAreaStyles.getPropertyValue(name) + \";\");\n\t}\n\treturn styleDefs;\n};\n\n/*\nApply a set of styles passed as an array of strings of individual CSS properties\n*/\nexports.setStyles = function(domNode,styleDefs) {\n\tdomNode.style.cssText = styleDefs.join(\"\");\n};\n\n/*\nCopy the computed styles from a source element to a destination element\n*/\nexports.copyStyles = function(srcDomNode,dstDomNode) {\n\t$tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode));\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/dragndrop.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/dragndrop.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser data transfer utilities, used with the clipboard and drag and drop\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOptions:\n\ndomNode: dom node to make draggable\ndragImageType: \"pill\" or \"dom\"\ndragTiddlerFn: optional function to retrieve the title of tiddler to drag\ndragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag\nwidget: widget to use as the contect for the filter\n*/\nexports.makeDraggable = function(options) {\n\tvar dragImageType = options.dragImageType || \"dom\",\n\t\tdragImage,\n\t\tdomNode = options.domNode;\n\t// Make the dom node draggable (not necessary for anchor tags)\n\tif((domNode.tagName || \"\").toLowerCase() !== \"a\") {\n\t\tdomNode.setAttribute(\"draggable\",\"true\");\t\t\n\t}\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"dragstart\", handlerFunction: function(event) {\n\t\t\t// Collect the tiddlers being dragged\n\t\t\tvar dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),\n\t\t\t\tdragFilter = options.dragFilterFn && options.dragFilterFn(),\n\t\t\t\ttitles = dragTiddler ? [dragTiddler] : [];\n\t\t\tif(dragFilter) {\n\t\t\t\ttitles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));\n\t\t\t}\n\t\t\tvar titleString = $tw.utils.stringifyList(titles);\n\t\t\t// Check that we've something to drag\n\t\t\tif(titles.length > 0 && event.target === domNode) {\n\t\t\t\t// Mark the drag in progress\n\t\t\t\t$tw.dragInProgress = domNode;\n\t\t\t\t// Set the dragging class on the element being dragged\n\t\t\t\t$tw.utils.addClass(event.target,\"tc-dragging\");\n\t\t\t\t// Create the drag image elements\n\t\t\t\tdragImage = options.widget.document.createElement(\"div\");\n\t\t\t\tdragImage.className = \"tc-tiddler-dragger\";\n\t\t\t\tvar inner = options.widget.document.createElement(\"div\");\n\t\t\t\tinner.className = \"tc-tiddler-dragger-inner\";\n\t\t\t\tinner.appendChild(options.widget.document.createTextNode(\n\t\t\t\t\ttitles.length === 1 ? \n\t\t\t\t\t\ttitles[0] :\n\t\t\t\t\t\ttitles.length + \" tiddlers\"\n\t\t\t\t));\n\t\t\t\tdragImage.appendChild(inner);\n\t\t\t\toptions.widget.document.body.appendChild(dragImage);\n\t\t\t\t// Set the data transfer properties\n\t\t\t\tvar dataTransfer = event.dataTransfer;\n\t\t\t\t// Set up the image\n\t\t\t\tdataTransfer.effectAllowed = \"all\";\n\t\t\t\tif(dataTransfer.setDragImage) {\n\t\t\t\t\tif(dragImageType === \"pill\") {\n\t\t\t\t\t\tdataTransfer.setDragImage(dragImage.firstChild,-16,-16);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar r = domNode.getBoundingClientRect();\n\t\t\t\t\t\tdataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Set up the data transfer\n\t\t\t\tif(dataTransfer.clearData) {\n\t\t\t\t\tdataTransfer.clearData();\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tvar jsonData = [];\n\t\t\t\tif(titles.length > 1) {\n\t\t\t\t\ttitles.forEach(function(title) {\n\t\t\t\t\t\tjsonData.push(options.widget.wiki.getTiddlerAsJson(title));\n\t\t\t\t\t});\n\t\t\t\t\tjsonData = \"[\" + jsonData.join(\",\") + \"]\";\n\t\t\t\t} else {\n\t\t\t\t\tjsonData = options.widget.wiki.getTiddlerAsJson(titles[0]);\n\t\t\t\t}\n\t\t\t\t// IE doesn't like these content types\n\t\t\t\tif(!$tw.browser.isIE) {\n\t\t\t\t\tdataTransfer.setData(\"text/vnd.tiddler\",jsonData);\n\t\t\t\t\tdataTransfer.setData(\"text/plain\",titleString);\n\t\t\t\t\tdataTransfer.setData(\"text/x-moz-url\",\"data:text/vnd.tiddler,\" + encodeURIComponent(jsonData));\n\t\t\t\t}\n\t\t\t\tdataTransfer.setData(\"URL\",\"data:text/vnd.tiddler,\" + encodeURIComponent(jsonData));\n\t\t\t\tdataTransfer.setData(\"Text\",titleString);\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t\treturn false;\n\t\t}},\n\t\t{name: \"dragend\", handlerFunction: function(event) {\n\t\t\tif(event.target === domNode) {\n\t\t\t\t$tw.dragInProgress = null;\n\t\t\t\t// Remove the dragging class on the element being dragged\n\t\t\t\t$tw.utils.removeClass(event.target,\"tc-dragging\");\n\t\t\t\t// Delete the drag image element\n\t\t\t\tif(dragImage) {\n\t\t\t\t\tdragImage.parentNode.removeChild(dragImage);\n\t\t\t\t\tdragImage = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}}\n\t]);\n};\n\nexports.importDataTransfer = function(dataTransfer,fallbackTitle,callback) {\n\t// Try each provided data type in turn\n\tfor(var t=0; t<importDataTypes.length; t++) {\n\t\tif(!$tw.browser.isIE || importDataTypes[t].IECompatible) {\n\t\t\t// Get the data\n\t\t\tvar dataType = importDataTypes[t];\n\t\t\t\tvar data = dataTransfer.getData(dataType.type);\n\t\t\t// Import the tiddlers in the data\n\t\t\tif(data !== \"\" && data !== null) {\n\t\t\t\tif($tw.log.IMPORT) {\n\t\t\t\t\tconsole.log(\"Importing data type '\" + dataType.type + \"', data: '\" + data + \"'\")\n\t\t\t\t}\n\t\t\t\tvar tiddlerFields = dataType.toTiddlerFieldsArray(data,fallbackTitle);\n\t\t\t\tcallback(tiddlerFields);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar importDataTypes = [\n\t{type: \"text/vnd.tiddler\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn parseJSONTiddlers(data,fallbackTitle);\n\t}},\n\t{type: \"URL\", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURIComponent(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn parseJSONTiddlers(match[1],fallbackTitle);\n\t\t} else {\n\t\t\treturn [{title: fallbackTitle, text: data}]; // As URL string\n\t\t}\n\t}},\n\t{type: \"text/x-moz-url\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURIComponent(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn parseJSONTiddlers(match[1],fallbackTitle);\n\t\t} else {\n\t\t\treturn [{title: fallbackTitle, text: data}]; // As URL string\n\t\t}\n\t}},\n\t{type: \"text/html\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"text/plain\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"Text\", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"text/uri-list\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}}\n];\n\nfunction parseJSONTiddlers(json,fallbackTitle) {\n\tvar data = JSON.parse(json);\n\tif(!$tw.utils.isArray(data)) {\n\t\tdata = [data];\n\t}\n\tdata.forEach(function(fields) {\n\t\tfields.title = fields.title || fallbackTitle;\n\t});\n\treturn data;\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/dragndrop.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/http.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/http.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser HTTP support\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nA quick and dirty HTTP function; to be refactored later. Options are:\n\turl: URL to retrieve\n\ttype: GET, PUT, POST etc\n\tcallback: function invoked with (err,data)\n\treturnProp: string name of the property to return as first argument of callback\n*/\nexports.httpRequest = function(options) {\n\tvar type = options.type || \"GET\",\n\t\theaders = options.headers || {accept: \"application/json\"},\n\t\treturnProp = options.returnProp || \"responseText\",\n\t\trequest = new XMLHttpRequest(),\n\t\tdata = \"\",\n\t\tf,results;\n\t// Massage the data hashmap into a string\n\tif(options.data) {\n\t\tif(typeof options.data === \"string\") { // Already a string\n\t\t\tdata = options.data;\n\t\t} else { // A hashmap of strings\n\t\t\tresults = [];\n\t\t\t$tw.utils.each(options.data,function(dataItem,dataItemTitle) {\n\t\t\t\tresults.push(dataItemTitle + \"=\" + encodeURIComponent(dataItem));\n\t\t\t});\n\t\t\tdata = results.join(\"&\");\n\t\t}\n\t}\n\t// Set up the state change handler\n\trequest.onreadystatechange = function() {\n\t\tif(this.readyState === 4) {\n\t\t\tif(this.status === 200 || this.status === 201 || this.status === 204) {\n\t\t\t\t// Success!\n\t\t\t\toptions.callback(null,this[returnProp],this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t// Something went wrong\n\t\toptions.callback($tw.language.getString(\"Error/XMLHttpRequest\") + \": \" + this.status);\n\t\t}\n\t};\n\t// Make the request\n\trequest.open(type,options.url,true);\n\tif(headers) {\n\t\t$tw.utils.each(headers,function(header,headerTitle,object) {\n\t\t\trequest.setRequestHeader(headerTitle,header);\n\t\t});\n\t}\n\tif(data && !$tw.utils.hop(headers,\"Content-type\")) {\n\t\trequest.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded; charset=UTF-8\");\n\t}\n\ttry {\n\t\trequest.send(data);\n\t} catch(e) {\n\t\toptions.callback(e);\n\t}\n\treturn request;\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/http.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/keyboard.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/keyboard.js\ntype: application/javascript\nmodule-type: utils\n\nKeyboard utilities; now deprecated. Instead, use $tw.keyboardManager\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n[\"parseKeyDescriptor\",\"checkKeyDescriptor\"].forEach(function(method) {\n\texports[method] = function() {\n\t\tif($tw.keyboardManager) {\n\t\t\treturn $tw.keyboardManager[method].apply($tw.keyboardManager,Array.prototype.slice.call(arguments,0));\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t};\n});\n\n})();\n",
"title": "$:/core/modules/utils/dom/keyboard.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/modal.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/modal.js\ntype: application/javascript\nmodule-type: utils\n\nModal message mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar Modal = function(wiki) {\n\tthis.wiki = wiki;\n\tthis.modalCount = 0;\n};\n\n/*\nDisplay a modal dialogue\n\ttitle: Title of tiddler to display\n\toptions: see below\nOptions include:\n\tdownloadLink: Text of a big download link to include\n*/\nModal.prototype.display = function(title,options) {\n\toptions = options || {};\n\tvar self = this,\n\t\trefreshHandler,\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\ttiddler = this.wiki.getTiddler(title);\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Create the variables\n\tvar variables = $tw.utils.extend({currentTiddler: title},options.variables);\n\t// Create the wrapper divs\n\tvar wrapper = document.createElement(\"div\"),\n\t\tmodalBackdrop = document.createElement(\"div\"),\n\t\tmodalWrapper = document.createElement(\"div\"),\n\t\tmodalHeader = document.createElement(\"div\"),\n\t\theaderTitle = document.createElement(\"h3\"),\n\t\tmodalBody = document.createElement(\"div\"),\n\t\tmodalLink = document.createElement(\"a\"),\n\t\tmodalFooter = document.createElement(\"div\"),\n\t\tmodalFooterHelp = document.createElement(\"span\"),\n\t\tmodalFooterButtons = document.createElement(\"span\");\n\t// Up the modal count and adjust the body class\n\tthis.modalCount++;\n\tthis.adjustPageClass();\n\t// Add classes\n\t$tw.utils.addClass(wrapper,\"tc-modal-wrapper\");\n\t$tw.utils.addClass(modalBackdrop,\"tc-modal-backdrop\");\n\t$tw.utils.addClass(modalWrapper,\"tc-modal\");\n\t$tw.utils.addClass(modalHeader,\"tc-modal-header\");\n\t$tw.utils.addClass(modalBody,\"tc-modal-body\");\n\t$tw.utils.addClass(modalFooter,\"tc-modal-footer\");\n\t// Join them together\n\twrapper.appendChild(modalBackdrop);\n\twrapper.appendChild(modalWrapper);\n\tmodalHeader.appendChild(headerTitle);\n\tmodalWrapper.appendChild(modalHeader);\n\tmodalWrapper.appendChild(modalBody);\n\tmodalFooter.appendChild(modalFooterHelp);\n\tmodalFooter.appendChild(modalFooterButtons);\n\tmodalWrapper.appendChild(modalFooter);\n\t// Render the title of the message\n\tvar headerWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tfield: \"subtitle\",\n\t\tmode: \"inline\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\tattributes: {\n\t\t\t\ttext: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: title\n\t\t}}}],\n\t\tparentWidget: $tw.rootWidget,\n\t\tdocument: document,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\theaderWidgetNode.render(headerTitle,null);\n\t// Render the body of the message\n\tvar bodyWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tparentWidget: $tw.rootWidget,\n\t\tdocument: document,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\tbodyWidgetNode.render(modalBody,null);\n\t// Setup the link if present\n\tif(options.downloadLink) {\n\t\tmodalLink.href = options.downloadLink;\n\t\tmodalLink.appendChild(document.createTextNode(\"Right-click to save changes\"));\n\t\tmodalBody.appendChild(modalLink);\n\t}\n\t// Render the footer of the message\n\tif(tiddler && tiddler.fields && tiddler.fields.help) {\n\t\tvar link = document.createElement(\"a\");\n\t\tlink.setAttribute(\"href\",tiddler.fields.help);\n\t\tlink.setAttribute(\"target\",\"_blank\");\n\t\tlink.setAttribute(\"rel\",\"noopener noreferrer\");\n\t\tlink.appendChild(document.createTextNode(\"Help\"));\n\t\tmodalFooterHelp.appendChild(link);\n\t\tmodalFooterHelp.style.float = \"left\";\n\t}\n\tvar footerWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tfield: \"footer\",\n\t\tmode: \"inline\",\n\t\tchildren: [{\n\t\t\ttype: \"button\",\n\t\t\tattributes: {\n\t\t\t\tmessage: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: \"tm-close-tiddler\"\n\t\t\t\t}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\tattributes: {\n\t\t\t\t\ttext: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tvalue: $tw.language.getString(\"Buttons/Close/Caption\")\n\t\t\t}}}\n\t\t]}],\n\t\tparentWidget: $tw.rootWidget,\n\t\tdocument: document,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\tfooterWidgetNode.render(modalFooterButtons,null);\n\t// Set up the refresh handler\n\trefreshHandler = function(changes) {\n\t\theaderWidgetNode.refresh(changes,modalHeader,null);\n\t\tbodyWidgetNode.refresh(changes,modalBody,null);\n\t\tfooterWidgetNode.refresh(changes,modalFooterButtons,null);\n\t};\n\tthis.wiki.addEventListener(\"change\",refreshHandler);\n\t// Add the close event handler\n\tvar closeHandler = function(event) {\n\t\t// Remove our refresh handler\n\t\tself.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t// Decrease the modal count and adjust the body class\n\t\tself.modalCount--;\n\t\tself.adjustPageClass();\n\t\t// Force layout and animate the modal message away\n\t\t$tw.utils.forceLayout(modalBackdrop);\n\t\t$tw.utils.forceLayout(modalWrapper);\n\t\t$tw.utils.setStyle(modalBackdrop,[\n\t\t\t{opacity: \"0\"}\n\t\t]);\n\t\t$tw.utils.setStyle(modalWrapper,[\n\t\t\t{transform: \"translateY(\" + window.innerHeight + \"px)\"}\n\t\t]);\n\t\t// Set up an event for the transition end\n\t\twindow.setTimeout(function() {\n\t\t\tif(wrapper.parentNode) {\n\t\t\t\t// Remove the modal message from the DOM\n\t\t\t\tdocument.body.removeChild(wrapper);\n\t\t\t}\n\t\t},duration);\n\t\t// Don't let anyone else handle the tm-close-tiddler message\n\t\treturn false;\n\t};\n\theaderWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\tbodyWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\tfooterWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\t// Set the initial styles for the message\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-window.innerHeight) + \"px)\"}\n\t]);\n\t// Put the message into the document\n\tdocument.body.appendChild(wrapper);\n\t// Set up animation for the styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{transition: \"opacity \" + duration + \"ms ease-out\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(modalBackdrop);\n\t$tw.utils.forceLayout(modalWrapper);\n\t// Set final animated styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0.7\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n};\n\nModal.prototype.adjustPageClass = function() {\n\tif($tw.pageContainer) {\n\t\t$tw.utils.toggleClass($tw.pageContainer,\"tc-modal-displayed\",this.modalCount > 0);\n\t}\n};\n\nexports.Modal = Modal;\n\n})();\n",
"title": "$:/core/modules/utils/dom/modal.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/notifier.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/notifier.js\ntype: application/javascript\nmodule-type: utils\n\nNotifier mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar Notifier = function(wiki) {\n\tthis.wiki = wiki;\n};\n\n/*\nDisplay a notification\n\ttitle: Title of tiddler containing the notification text\n\toptions: see below\nOptions include:\n*/\nNotifier.prototype.display = function(title,options) {\n\toptions = options || {};\n\t// Create the wrapper divs\n\tvar self = this,\n\t\tnotification = document.createElement(\"div\"),\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\trefreshHandler;\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Add classes\n\t$tw.utils.addClass(notification,\"tc-notification\");\n\t// Create the variables\n\tvar variables = $tw.utils.extend({currentTiddler: title},options.variables);\n\t// Render the body of the notification\n\tvar widgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tparentWidget: $tw.rootWidget,\n\t\tdocument: document,\n\t\tvariables: variables,\n\t\timportPageMacros: true});\n\twidgetNode.render(notification,null);\n\trefreshHandler = function(changes) {\n\t\twidgetNode.refresh(changes,notification,null);\n\t};\n\tthis.wiki.addEventListener(\"change\",refreshHandler);\n\t// Set the initial styles for the notification\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"0\"},\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-window.innerHeight) + \"px)\"},\n\t\t{transition: \"opacity \" + duration + \"ms ease-out, \" + $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out\"}\n\t]);\n\t// Add the notification to the DOM\n\tdocument.body.appendChild(notification);\n\t// Force layout\n\t$tw.utils.forceLayout(notification);\n\t// Set final animated styles\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n\t// Set a timer to remove the notification\n\twindow.setTimeout(function() {\n\t\t// Remove our change event handler\n\t\tself.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t// Force layout and animate the notification away\n\t\t$tw.utils.forceLayout(notification);\n\t\t$tw.utils.setStyle(notification,[\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transform: \"translateX(\" + (notification.offsetWidth) + \"px)\"}\n\t\t]);\n\t\t// Remove the modal message from the DOM once the transition ends\n\t\tsetTimeout(function() {\n\t\t\tif(notification.parentNode) {\n\t\t\t\tdocument.body.removeChild(notification);\n\t\t\t}\n\t\t},duration);\n\t},$tw.config.preferences.notificationDuration);\n};\n\nexports.Notifier = Notifier;\n\n})();\n",
"title": "$:/core/modules/utils/dom/notifier.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/popup.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/popup.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Popup object prototype that manages popups in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreates a Popup object with these options:\n\trootElement: the DOM element to which the popup zapper should be attached\n*/\nvar Popup = function(options) {\n\toptions = options || {};\n\tthis.rootElement = options.rootElement || document.documentElement;\n\tthis.popups = []; // Array of {title:,wiki:,domNode:} objects\n};\n\n/*\nTrigger a popup open or closed. Parameters are in a hashmap:\n\ttitle: title of the tiddler where the popup details are stored\n\tdomNode: dom node to which the popup will be positioned\n\twiki: wiki\n\tforce: if specified, forces the popup state to true or false (instead of toggling it)\n*/\nPopup.prototype.triggerPopup = function(options) {\n\t// Check if this popup is already active\n\tvar index = this.findPopup(options.title);\n\t// Compute the new state\n\tvar state = index === -1;\n\tif(options.force !== undefined) {\n\t\tstate = options.force;\n\t}\n\t// Show or cancel the popup according to the new state\n\tif(state) {\n\t\tthis.show(options);\n\t} else {\n\t\tthis.cancel(index);\n\t}\n};\n\nPopup.prototype.findPopup = function(title) {\n\tvar index = -1;\n\tfor(var t=0; t<this.popups.length; t++) {\n\t\tif(this.popups[t].title === title) {\n\t\t\tindex = t;\n\t\t}\n\t}\n\treturn index;\n};\n\nPopup.prototype.handleEvent = function(event) {\n\tif(event.type === \"click\") {\n\t\t// Find out what was clicked on\n\t\tvar info = this.popupInfo(event.target),\n\t\t\tcancelLevel = info.popupLevel - 1;\n\t\t// Don't remove the level that was clicked on if we clicked on a handle\n\t\tif(info.isHandle) {\n\t\t\tcancelLevel++;\n\t\t}\n\t\t// Cancel\n\t\tthis.cancel(cancelLevel);\n\t}\n};\n\n/*\nFind the popup level containing a DOM node. Returns:\npopupLevel: count of the number of nested popups containing the specified element\nisHandle: true if the specified element is within a popup handle\n*/\nPopup.prototype.popupInfo = function(domNode) {\n\tvar isHandle = false,\n\t\tpopupCount = 0,\n\t\tnode = domNode;\n\t// First check ancestors to see if we're within a popup handle\n\twhile(node) {\n\t\tif($tw.utils.hasClass(node,\"tc-popup-handle\")) {\n\t\t\tisHandle = true;\n\t\t\tpopupCount++;\n\t\t}\n\t\tif($tw.utils.hasClass(node,\"tc-popup-keep\")) {\n\t\t\tisHandle = true;\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\t// Then count the number of ancestor popups\n\tnode = domNode;\n\twhile(node) {\n\t\tif($tw.utils.hasClass(node,\"tc-popup\")) {\n\t\t\tpopupCount++;\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\tvar info = {\n\t\tpopupLevel: popupCount,\n\t\tisHandle: isHandle\n\t};\n\treturn info;\n};\n\n/*\nDisplay a popup by adding it to the stack\n*/\nPopup.prototype.show = function(options) {\n\t// Find out what was clicked on\n\tvar info = this.popupInfo(options.domNode);\n\t// Cancel any higher level popups\n\tthis.cancel(info.popupLevel);\n\t// Store the popup details if not already there\n\tif(this.findPopup(options.title) === -1) {\n\t\tthis.popups.push({\n\t\t\ttitle: options.title,\n\t\t\twiki: options.wiki,\n\t\t\tdomNode: options.domNode\n\t\t});\n\t}\n\t// Set the state tiddler\n\toptions.wiki.setTextReference(options.title,\n\t\t\t\"(\" + options.domNode.offsetLeft + \",\" + options.domNode.offsetTop + \",\" + \n\t\t\t\toptions.domNode.offsetWidth + \",\" + options.domNode.offsetHeight + \")\");\n\t// Add the click handler if we have any popups\n\tif(this.popups.length > 0) {\n\t\tthis.rootElement.addEventListener(\"click\",this,true);\t\t\n\t}\n};\n\n/*\nCancel all popups at or above a specified level or DOM node\nlevel: popup level to cancel (0 cancels all popups)\n*/\nPopup.prototype.cancel = function(level) {\n\tvar numPopups = this.popups.length;\n\tlevel = Math.max(0,Math.min(level,numPopups));\n\tfor(var t=level; t<numPopups; t++) {\n\t\tvar popup = this.popups.pop();\n\t\tif(popup.title) {\n\t\t\tpopup.wiki.deleteTiddler(popup.title);\n\t\t}\n\t}\n\tif(this.popups.length === 0) {\n\t\tthis.rootElement.removeEventListener(\"click\",this,false);\n\t}\n};\n\n/*\nReturns true if the specified title and text identifies an active popup\n*/\nPopup.prototype.readPopupState = function(text) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/;\n\treturn popupLocationRegExp.test(text);\n};\n\nexports.Popup = Popup;\n\n})();\n",
"title": "$:/core/modules/utils/dom/popup.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/scroller.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/scroller.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Scroller object prototype that manages scrolling in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nEvent handler for when the `tm-scroll` event hits the document body\n*/\nvar PageScroller = function() {\n\tthis.idRequestFrame = null;\n\tthis.requestAnimationFrame = window.requestAnimationFrame ||\n\t\twindow.webkitRequestAnimationFrame ||\n\t\twindow.mozRequestAnimationFrame ||\n\t\tfunction(callback) {\n\t\t\treturn window.setTimeout(callback, 1000/60);\n\t\t};\n\tthis.cancelAnimationFrame = window.cancelAnimationFrame ||\n\t\twindow.webkitCancelAnimationFrame ||\n\t\twindow.webkitCancelRequestAnimationFrame ||\n\t\twindow.mozCancelAnimationFrame ||\n\t\twindow.mozCancelRequestAnimationFrame ||\n\t\tfunction(id) {\n\t\t\twindow.clearTimeout(id);\n\t\t};\n};\n\nPageScroller.prototype.cancelScroll = function() {\n\tif(this.idRequestFrame) {\n\t\tthis.cancelAnimationFrame.call(window,this.idRequestFrame);\n\t\tthis.idRequestFrame = null;\n\t}\n};\n\n/*\nHandle an event\n*/\nPageScroller.prototype.handleEvent = function(event) {\n\tif(event.type === \"tm-scroll\") {\n\t\treturn this.scrollIntoView(event.target);\n\t}\n\treturn true;\n};\n\n/*\nHandle a scroll event hitting the page document\n*/\nPageScroller.prototype.scrollIntoView = function(element) {\n\tvar duration = $tw.utils.getAnimationDuration();\n\t// Now get ready to scroll the body\n\tthis.cancelScroll();\n\tthis.startTime = Date.now();\n\tvar scrollPosition = $tw.utils.getScrollPosition();\n\t// Get the client bounds of the element and adjust by the scroll position\n\tvar clientBounds = element.getBoundingClientRect(),\n\t\tbounds = {\n\t\t\tleft: clientBounds.left + scrollPosition.x,\n\t\t\ttop: clientBounds.top + scrollPosition.y,\n\t\t\twidth: clientBounds.width,\n\t\t\theight: clientBounds.height\n\t\t};\n\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\t// targetPos/targetSize - position and size of the target element\n\t// currentPos/currentSize - position and size of the current scroll viewport\n\t// returns: new position of the scroll viewport\n\tvar getEndPos = function(targetPos,targetSize,currentPos,currentSize) {\n\t\t\tvar newPos = currentPos;\n\t\t\t// If the target is above/left of the current view, then scroll to it's top/left\n\t\t\tif(targetPos <= currentPos) {\n\t\t\t\tnewPos = targetPos;\n\t\t\t// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window\n\t\t\t} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {\n\t\t\t\tnewPos = targetPos + targetSize - currentSize;\n\t\t\t// If the target is big, then just scroll to the top\n\t\t\t} else if(currentPos < targetPos) {\n\t\t\t\tnewPos = targetPos;\n\t\t\t// Otherwise, stay where we are\n\t\t\t} else {\n\t\t\t\tnewPos = currentPos;\n\t\t\t}\n\t\t\t// If we are scrolling within 50 pixels of the top/left then snap to zero\n\t\t\tif(newPos < 50) {\n\t\t\t\tnewPos = 0;\n\t\t\t}\n\t\t\treturn newPos;\n\t\t},\n\t\tendX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),\n\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);\n\t// Only scroll if the position has changed\n\tif(endX !== scrollPosition.x || endY !== scrollPosition.y) {\n\t\tvar self = this,\n\t\t\tdrawFrame;\n\t\tdrawFrame = function () {\n\t\t\tvar t;\n\t\t\tif(duration <= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((Date.now()) - self.startTime) / duration;\t\n\t\t\t}\n\t\t\tif(t >= 1) {\n\t\t\t\tself.cancelScroll();\n\t\t\t\tt = 1;\n\t\t\t}\n\t\t\tt = $tw.utils.slowInSlowOut(t);\n\t\t\twindow.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t);\n\t\t\tif(t < 1) {\n\t\t\t\tself.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);\n\t\t\t}\n\t\t};\n\t\tdrawFrame();\n\t}\n};\n\nexports.PageScroller = PageScroller;\n\n})();\n",
"title": "$:/core/modules/utils/dom/scroller.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/edition-info.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/edition-info.js\ntype: application/javascript\nmodule-type: utils-node\n\nInformation about the available editions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar fs = require(\"fs\"),\n\tpath = require(\"path\");\n\nvar editionInfo;\n\nexports.getEditionInfo = function() {\n\tif(!editionInfo) {\n\t\t// Enumerate the edition paths\n\t\tvar editionPaths = $tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar);\n\t\teditionInfo = {};\n\t\tfor(var editionIndex=0; editionIndex<editionPaths.length; editionIndex++) {\n\t\t\tvar editionPath = editionPaths[editionIndex];\n\t\t\t// Enumerate the folders\n\t\t\tvar entries = fs.readdirSync(editionPath);\n\t\t\tfor(var entryIndex=0; entryIndex<entries.length; entryIndex++) {\n\t\t\t\tvar entry = entries[entryIndex];\n\t\t\t\t// Check if directories have a valid tiddlywiki.info\n\t\t\t\tif(!editionInfo[entry] && $tw.utils.isDirectory(path.resolve(editionPath,entry))) {\n\t\t\t\t\tvar info;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinfo = JSON.parse(fs.readFileSync(path.resolve(editionPath,entry,\"tiddlywiki.info\"),\"utf8\"));\n\t\t\t\t\t} catch(ex) {\n\t\t\t\t\t}\n\t\t\t\t\tif(info) {\n\t\t\t\t\t\teditionInfo[entry] = info;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn editionInfo;\n};\n\n})();\n",
"title": "$:/core/modules/utils/edition-info.js",
"type": "application/javascript",
"module-type": "utils-node"
},
"$:/core/modules/utils/fakedom.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/fakedom.js\ntype: application/javascript\nmodule-type: global\n\nA barebones implementation of DOM interfaces needed by the rendering mechanism.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Sequence number used to enable us to track objects for testing\nvar sequenceNumber = null;\n\nvar bumpSequenceNumber = function(object) {\n\tif(sequenceNumber !== null) {\n\t\tobject.sequenceNumber = sequenceNumber++;\n\t}\n};\n\nvar TW_TextNode = function(text) {\n\tbumpSequenceNumber(this);\n\tthis.textContent = text + \"\";\n};\n\nObject.defineProperty(TW_TextNode.prototype, \"nodeType\", {\n\tget: function() {\n\t\treturn 3;\n\t}\n});\n\nObject.defineProperty(TW_TextNode.prototype, \"formattedTextContent\", {\n\tget: function() {\n\t\treturn this.textContent.replace(/(\\r?\\n)/g,\"\");\n\t}\n});\n\nvar TW_Element = function(tag,namespace) {\n\tbumpSequenceNumber(this);\n\tthis.isTiddlyWikiFakeDom = true;\n\tthis.tag = tag;\n\tthis.attributes = {};\n\tthis.isRaw = false;\n\tthis.children = [];\n\tthis.style = {};\n\tthis.namespaceURI = namespace || \"http://www.w3.org/1999/xhtml\";\n};\n\nObject.defineProperty(TW_Element.prototype, \"nodeType\", {\n\tget: function() {\n\t\treturn 1;\n\t}\n});\n\nTW_Element.prototype.getAttribute = function(name) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot getAttribute on a raw TW_Element\";\n\t}\n\treturn this.attributes[name];\n};\n\nTW_Element.prototype.setAttribute = function(name,value) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot setAttribute on a raw TW_Element\";\n\t}\n\tthis.attributes[name] = value + \"\";\n};\n\nTW_Element.prototype.setAttributeNS = function(namespace,name,value) {\n\tthis.setAttribute(name,value);\n};\n\nTW_Element.prototype.removeAttribute = function(name) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot removeAttribute on a raw TW_Element\";\n\t}\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\tdelete this.attributes[name];\n\t}\n};\n\nTW_Element.prototype.appendChild = function(node) {\n\tthis.children.push(node);\n\tnode.parentNode = this;\n};\n\nTW_Element.prototype.insertBefore = function(node,nextSibling) {\n\tif(nextSibling) {\n\t\tvar p = this.children.indexOf(nextSibling);\n\t\tif(p !== -1) {\n\t\t\tthis.children.splice(p,0,node);\n\t\t\tnode.parentNode = this;\n\t\t} else {\n\t\t\tthis.appendChild(node);\n\t\t}\n\t} else {\n\t\tthis.appendChild(node);\n\t}\n};\n\nTW_Element.prototype.removeChild = function(node) {\n\tvar p = this.children.indexOf(node);\n\tif(p !== -1) {\n\t\tthis.children.splice(p,1);\n\t}\n};\n\nTW_Element.prototype.hasChildNodes = function() {\n\treturn !!this.children.length;\n};\n\nObject.defineProperty(TW_Element.prototype, \"childNodes\", {\n\tget: function() {\n\t\treturn this.children;\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"firstChild\", {\n\tget: function() {\n\t\treturn this.children[0];\n\t}\n});\n\nTW_Element.prototype.addEventListener = function(type,listener,useCapture) {\n\t// Do nothing\n};\n\nObject.defineProperty(TW_Element.prototype, \"tagName\", {\n\tget: function() {\n\t\treturn this.tag || \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"className\", {\n\tget: function() {\n\t\treturn this.attributes[\"class\"] || \"\";\n\t},\n\tset: function(value) {\n\t\tthis.attributes[\"class\"] = value + \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"value\", {\n\tget: function() {\n\t\treturn this.attributes.value || \"\";\n\t},\n\tset: function(value) {\n\t\tthis.attributes.value = value + \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"outerHTML\", {\n\tget: function() {\n\t\tvar output = [],attr,a,v;\n\t\toutput.push(\"<\",this.tag);\n\t\tif(this.attributes) {\n\t\t\tattr = [];\n\t\t\tfor(a in this.attributes) {\n\t\t\t\tattr.push(a);\n\t\t\t}\n\t\t\tattr.sort();\n\t\t\tfor(a=0; a<attr.length; a++) {\n\t\t\t\tv = this.attributes[attr[a]];\n\t\t\t\tif(v !== undefined) {\n\t\t\t\t\toutput.push(\" \",attr[a],\"=\\\"\",$tw.utils.htmlEncode(v),\"\\\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(this.style) {\n\t\t\tvar style = [];\n\t\t\tfor(var s in this.style) {\n\t\t\t\tstyle.push(s + \":\" + this.style[s] + \";\");\n\t\t\t}\n\t\t\tif(style.length > 0) {\n\t\t\t\toutput.push(\" style=\\\"\",style.join(\"\"),\"\\\"\")\n\t\t\t}\n\t\t}\n\t\toutput.push(\">\");\n\t\tif($tw.config.htmlVoidElements.indexOf(this.tag) === -1) {\n\t\t\toutput.push(this.innerHTML);\n\t\t\toutput.push(\"</\",this.tag,\">\");\n\t\t}\n\t\treturn output.join(\"\");\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"innerHTML\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\treturn this.rawHTML;\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node instanceof TW_Element) {\n\t\t\t\t\tb.push(node.outerHTML);\n\t\t\t\t} else if(node instanceof TW_TextNode) {\n\t\t\t\t\tb.push($tw.utils.htmlEncode(node.textContent));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t},\n\tset: function(value) {\n\t\tthis.isRaw = true;\n\t\tthis.rawHTML = value;\n\t\tthis.rawTextContent = null;\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"textInnerHTML\", {\n\tset: function(value) {\n\t\tif(this.isRaw) {\n\t\t\tthis.rawTextContent = value;\n\t\t} else {\n\t\t\tthrow \"Cannot set textInnerHTML of a non-raw TW_Element\";\n\t\t}\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"textContent\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\tif(this.rawTextContent === null) {\n\t\t\t\tconsole.log(booboo)\n\t\t\t\tthrow \"Cannot get textContent on a raw TW_Element\";\t\t\t\t\n\t\t\t} else {\n\t\t\t\treturn this.rawTextContent;\n\t\t\t}\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tb.push(node.textContent);\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t},\n\tset: function(value) {\n\t\tthis.children = [new TW_TextNode(value)];\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"formattedTextContent\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\tthrow \"Cannot get formattedTextContent on a raw TW_Element\";\n\t\t} else {\n\t\t\tvar b = [],\n\t\t\t\tisBlock = $tw.config.htmlBlockElements.indexOf(this.tag) !== -1;\n\t\t\tif(isBlock) {\n\t\t\t\tb.push(\"\\n\");\n\t\t\t}\n\t\t\tif(this.tag === \"li\") {\n\t\t\t\tb.push(\"* \");\n\t\t\t}\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tb.push(node.formattedTextContent);\n\t\t\t});\n\t\t\tif(isBlock) {\n\t\t\t\tb.push(\"\\n\");\n\t\t\t}\n\t\t\treturn b.join(\"\");\n\t\t}\n\t}\n});\n\nvar document = {\n\tsetSequenceNumber: function(value) {\n\t\tsequenceNumber = value;\n\t},\n\tcreateElementNS: function(namespace,tag) {\n\t\treturn new TW_Element(tag,namespace);\n\t},\n\tcreateElement: function(tag) {\n\t\treturn new TW_Element(tag);\n\t},\n\tcreateTextNode: function(text) {\n\t\treturn new TW_TextNode(text);\n\t},\n\tcompatMode: \"CSS1Compat\", // For KaTeX to know that we're not a browser in quirks mode\n\tisTiddlyWikiFakeDom: true\n};\n\nexports.fakeDocument = document;\n\n})();\n",
"title": "$:/core/modules/utils/fakedom.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/utils/filesystem.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/filesystem.js\ntype: application/javascript\nmodule-type: utils-node\n\nFile system utilities\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar fs = require(\"fs\"),\n\tpath = require(\"path\");\n\n/*\nRecursively (and synchronously) copy a directory and all its content\n*/\nexports.copyDirectory = function(srcPath,dstPath) {\n\t// Remove any trailing path separators\n\tsrcPath = $tw.utils.removeTrailingSeparator(srcPath);\n\tdstPath = $tw.utils.removeTrailingSeparator(dstPath);\n\t// Create the destination directory\n\tvar err = $tw.utils.createDirectory(dstPath);\n\tif(err) {\n\t\treturn err;\n\t}\n\t// Function to copy a folder full of files\n\tvar copy = function(srcPath,dstPath) {\n\t\tvar srcStats = fs.lstatSync(srcPath),\n\t\t\tdstExists = fs.existsSync(dstPath);\n\t\tif(srcStats.isFile()) {\n\t\t\t$tw.utils.copyFile(srcPath,dstPath);\n\t\t} else if(srcStats.isDirectory()) {\n\t\t\tvar items = fs.readdirSync(srcPath);\n\t\t\tfor(var t=0; t<items.length; t++) {\n\t\t\t\tvar item = items[t],\n\t\t\t\t\terr = copy(srcPath + path.sep + item,dstPath + path.sep + item);\n\t\t\t\tif(err) {\n\t\t\t\t\treturn err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tcopy(srcPath,dstPath);\n\treturn null;\n};\n\n/*\nCopy a file\n*/\nvar FILE_BUFFER_LENGTH = 64 * 1024,\n\tfileBuffer;\n\nexports.copyFile = function(srcPath,dstPath) {\n\t// Create buffer if required\n\tif(!fileBuffer) {\n\t\tfileBuffer = new Buffer(FILE_BUFFER_LENGTH);\n\t}\n\t// Create any directories in the destination\n\t$tw.utils.createDirectory(path.dirname(dstPath));\n\t// Copy the file\n\tvar srcFile = fs.openSync(srcPath,\"r\"),\n\t\tdstFile = fs.openSync(dstPath,\"w\"),\n\t\tbytesRead = 1,\n\t\tpos = 0;\n\twhile (bytesRead > 0) {\n\t\tbytesRead = fs.readSync(srcFile,fileBuffer,0,FILE_BUFFER_LENGTH,pos);\n\t\tfs.writeSync(dstFile,fileBuffer,0,bytesRead);\n\t\tpos += bytesRead;\n\t}\n\tfs.closeSync(srcFile);\n\tfs.closeSync(dstFile);\n\treturn null;\n};\n\n/*\nRemove trailing path separator\n*/\nexports.removeTrailingSeparator = function(dirPath) {\n\tvar len = dirPath.length;\n\tif(dirPath.charAt(len-1) === path.sep) {\n\t\tdirPath = dirPath.substr(0,len-1);\n\t}\n\treturn dirPath;\n};\n\n/*\nRecursively create a directory\n*/\nexports.createDirectory = function(dirPath) {\n\tif(dirPath.substr(dirPath.length-1,1) !== path.sep) {\n\t\tdirPath = dirPath + path.sep;\n\t}\n\tvar pos = 1;\n\tpos = dirPath.indexOf(path.sep,pos);\n\twhile(pos !== -1) {\n\t\tvar subDirPath = dirPath.substr(0,pos);\n\t\tif(!$tw.utils.isDirectory(subDirPath)) {\n\t\t\ttry {\n\t\t\t\tfs.mkdirSync(subDirPath);\n\t\t\t} catch(e) {\n\t\t\t\treturn \"Error creating directory '\" + subDirPath + \"'\";\n\t\t\t}\n\t\t}\n\t\tpos = dirPath.indexOf(path.sep,pos + 1);\n\t}\n\treturn null;\n};\n\n/*\nRecursively create directories needed to contain a specified file\n*/\nexports.createFileDirectories = function(filePath) {\n\treturn $tw.utils.createDirectory(path.dirname(filePath));\n};\n\n/*\nRecursively delete a directory\n*/\nexports.deleteDirectory = function(dirPath) {\n\tif(fs.existsSync(dirPath)) {\n\t\tvar entries = fs.readdirSync(dirPath);\n\t\tfor(var entryIndex=0; entryIndex<entries.length; entryIndex++) {\n\t\t\tvar currPath = dirPath + path.sep + entries[entryIndex];\n\t\t\tif(fs.lstatSync(currPath).isDirectory()) {\n\t\t\t\t$tw.utils.deleteDirectory(currPath);\n\t\t\t} else {\n\t\t\t\tfs.unlinkSync(currPath);\n\t\t\t}\n\t\t}\n\tfs.rmdirSync(dirPath);\n\t}\n\treturn null;\n};\n\n/*\nCheck if a path identifies a directory\n*/\nexports.isDirectory = function(dirPath) {\n\treturn fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();\n};\n\n/*\nCheck if a path identifies a directory that is empty\n*/\nexports.isDirectoryEmpty = function(dirPath) {\n\tif(!$tw.utils.isDirectory(dirPath)) {\n\t\treturn false;\n\t}\n\tvar files = fs.readdirSync(dirPath),\n\t\tempty = true;\n\t$tw.utils.each(files,function(file,index) {\n\t\tif(file.charAt(0) !== \".\") {\n\t\t\tempty = false;\n\t\t}\n\t});\n\treturn empty;\n};\n\n/*\nRecursively delete a tree of empty directories\n*/\nexports.deleteEmptyDirs = function(dirpath,callback) {\n\tvar self = this;\n\tfs.readdir(dirpath,function(err,files) {\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\tif(files.length > 0) {\n\t\t\treturn callback(null);\n\t\t}\n\t\tfs.rmdir(dirpath,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.deleteEmptyDirs(path.dirname(dirpath),callback);\n\t\t});\n\t});\n};\n\n})();\n",
"title": "$:/core/modules/utils/filesystem.js",
"type": "application/javascript",
"module-type": "utils-node"
},
"$:/core/modules/utils/logger.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/logger.js\ntype: application/javascript\nmodule-type: utils\n\nA basic logging implementation\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ALERT_TAG = \"$:/tags/Alert\";\n\n/*\nMake a new logger\n*/\nfunction Logger(componentName) {\n\tthis.componentName = componentName || \"\";\n}\n\n/*\nLog a message\n*/\nLogger.prototype.log = function(/* args */) {\n\tif(console !== undefined && console.log !== undefined) {\n\t\treturn Function.apply.call(console.log, console, [this.componentName + \":\"].concat(Array.prototype.slice.call(arguments,0)));\n\t}\n};\n\n/*\nAlert a message\n*/\nLogger.prototype.alert = function(/* args */) {\n\t// Prepare the text of the alert\n\tvar text = Array.prototype.join.call(arguments,\" \");\n\t// Create alert tiddlers in the browser\n\tif($tw.browser) {\n\t\t// Check if there is an existing alert with the same text and the same component\n\t\tvar existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),\n\t\t\talertFields,\n\t\t\texistingCount,\n\t\t\tself = this;\n\t\t$tw.utils.each(existingAlerts,function(title) {\n\t\t\tvar tiddler = $tw.wiki.getTiddler(title);\n\t\t\tif(tiddler.fields.text === text && tiddler.fields.component === self.componentName && tiddler.fields.modified && (!alertFields || tiddler.fields.modified < alertFields.modified)) {\n\t\t\t\t\talertFields = $tw.utils.extend({},tiddler.fields);\n\t\t\t}\n\t\t});\n\t\tif(alertFields) {\n\t\t\texistingCount = alertFields.count || 1;\n\t\t} else {\n\t\t\talertFields = {\n\t\t\t\ttitle: $tw.wiki.generateNewTitle(\"$:/temp/alerts/alert\",{prefix: \"\"}),\n\t\t\t\ttext: text,\n\t\t\t\ttags: [ALERT_TAG],\n\t\t\t\tcomponent: this.componentName\n\t\t\t};\n\t\t\texistingCount = 0;\n\t\t}\n\t\talertFields.modified = new Date();\n\t\tif(++existingCount > 1) {\n\t\t\talertFields.count = existingCount;\n\t\t} else {\n\t\t\talertFields.count = undefined;\n\t\t}\n\t\t$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));\n\t\t// Log the alert as well\n\t\tthis.log.apply(this,Array.prototype.slice.call(arguments,0));\n\t} else {\n\t\t// Print an orange message to the console if not in the browser\n\t\tconsole.error(\"\\x1b[1;33m\" + text + \"\\x1b[0m\");\n\t}\n};\n\nexports.Logger = Logger;\n\n})();\n",
"title": "$:/core/modules/utils/logger.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/parsetree.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/parsetree.js\ntype: application/javascript\nmodule-type: utils\n\nParse tree utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.addAttributeToParseTreeNode = function(node,name,value) {\n\tnode.attributes = node.attributes || {};\n\tnode.attributes[name] = {type: \"string\", value: value};\n};\n\nexports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {\n\tif(node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) {\n\t\treturn node.attributes[name].value;\n\t}\n\treturn defaultValue;\n};\n\nexports.addClassToParseTreeNode = function(node,classString) {\n\tvar classes = [];\n\tnode.attributes = node.attributes || {};\n\tnode.attributes[\"class\"] = node.attributes[\"class\"] || {type: \"string\", value: \"\"};\n\tif(node.attributes[\"class\"].type === \"string\") {\n\t\tif(node.attributes[\"class\"].value !== \"\") {\n\t\t\tclasses = node.attributes[\"class\"].value.split(\" \");\n\t\t}\n\t\tif(classString !== \"\") {\n\t\t\t$tw.utils.pushTop(classes,classString.split(\" \"));\n\t\t}\n\t\tnode.attributes[\"class\"].value = classes.join(\" \");\n\t}\n};\n\nexports.addStyleToParseTreeNode = function(node,name,value) {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes.style = node.attributes.style || {type: \"string\", value: \"\"};\n\t\tif(node.attributes.style.type === \"string\") {\n\t\t\tnode.attributes.style.value += name + \":\" + value + \";\";\n\t\t}\n};\n\nexports.findParseTreeNode = function(nodeArray,search) {\n\tfor(var t=0; t<nodeArray.length; t++) {\n\t\tif(nodeArray[t].type === search.type && nodeArray[t].tag === search.tag) {\n\t\t\treturn nodeArray[t];\n\t\t}\n\t}\n\treturn undefined;\n};\n\n/*\nHelper to get the text of a parse tree node or array of nodes\n*/\nexports.getParseTreeText = function getParseTreeText(tree) {\n\tvar output = [];\n\tif($tw.utils.isArray(tree)) {\n\t\t$tw.utils.each(tree,function(node) {\n\t\t\toutput.push(getParseTreeText(node));\n\t\t});\n\t} else {\n\t\tif(tree.type === \"text\") {\n\t\t\toutput.push(tree.text);\n\t\t}\n\t\tif(tree.children) {\n\t\t\treturn getParseTreeText(tree.children);\n\t\t}\n\t}\n\treturn output.join(\"\");\n};\n\n})();\n",
"title": "$:/core/modules/utils/parsetree.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/performance.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/performance.js\ntype: application/javascript\nmodule-type: global\n\nPerformance measurement.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Performance(enabled) {\n\tthis.enabled = !!enabled;\n\tthis.measures = {}; // Hashmap of current values of measurements\n\tthis.logger = new $tw.utils.Logger(\"performance\");\n}\n\n/*\nWrap performance reporting around a top level function\n*/\nPerformance.prototype.report = function(name,fn) {\n\tvar self = this;\n\tif(this.enabled) {\n\t\treturn function() {\n\t\t\tself.measures = {};\n\t\t\tvar startTime = $tw.utils.timer(),\n\t\t\t\tresult = fn.apply(this,arguments);\n\t\t\tself.logger.log(name + \": \" + $tw.utils.timer(startTime).toFixed(2) + \"ms\");\n\t\t\tfor(var m in self.measures) {\n\t\t\t\tself.logger.log(\"+\" + m + \": \" + self.measures[m].toFixed(2) + \"ms\");\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t} else {\n\t\treturn fn;\n\t}\n};\n\n/*\nWrap performance measurements around a subfunction\n*/\nPerformance.prototype.measure = function(name,fn) {\n\tvar self = this;\n\tif(this.enabled) {\n\t\treturn function() {\n\t\t\tvar startTime = $tw.utils.timer(),\n\t\t\t\tresult = fn.apply(this,arguments),\n\t\t\t\tvalue = self.measures[name] || 0;\n\t\t\tself.measures[name] = value + $tw.utils.timer(startTime);\n\t\t\treturn result;\n\t\t};\n\t} else {\n\t\treturn fn;\n\t}\n};\n\nexports.Performance = Performance;\n\n})();\n",
"title": "$:/core/modules/utils/performance.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/utils/pluginmaker.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/pluginmaker.js\ntype: application/javascript\nmodule-type: utils\n\nA quick and dirty way to pack up plugins within the browser.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRepack a plugin, and then delete any non-shadow payload tiddlers\n*/\nexports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {\n\tadditionalTiddlers = additionalTiddlers || [];\n\texcludeTiddlers = excludeTiddlers || [];\n\t// Get the plugin tiddler\n\tvar pluginTiddler = $tw.wiki.getTiddler(title);\n\tif(!pluginTiddler) {\n\t\tthrow \"No such tiddler as \" + title;\n\t}\n\t// Extract the JSON\n\tvar jsonPluginTiddler;\n\ttry {\n\t\tjsonPluginTiddler = JSON.parse(pluginTiddler.fields.text);\n\t} catch(e) {\n\t\tthrow \"Cannot parse plugin tiddler \" + title + \"\\n\" + $tw.language.getString(\"Error/Caption\") + \": \" + e;\n\t}\n\t// Get the list of tiddlers\n\tvar tiddlers = Object.keys(jsonPluginTiddler.tiddlers);\n\t// Add the additional tiddlers\n\t$tw.utils.pushTop(tiddlers,additionalTiddlers);\n\t// Remove any excluded tiddlers\n\tfor(var t=tiddlers.length-1; t>=0; t--) {\n\t\tif(excludeTiddlers.indexOf(tiddlers[t]) !== -1) {\n\t\t\ttiddlers.splice(t,1);\n\t\t}\n\t}\n\t// Pack up the tiddlers into a block of JSON\n\tvar plugins = {};\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = $tw.wiki.getTiddler(title),\n\t\t\tfields = {};\n\t\t$tw.utils.each(tiddler.fields,function (value,name) {\n\t\t\tfields[name] = tiddler.getFieldString(name);\n\t\t});\n\t\tplugins[title] = fields;\n\t});\n\t// Retrieve and bump the version number\n\tvar pluginVersion = $tw.utils.parseVersion(pluginTiddler.getFieldString(\"version\") || \"0.0.0\") || {\n\t\t\tmajor: \"0\",\n\t\t\tminor: \"0\",\n\t\t\tpatch: \"0\"\n\t\t};\n\tpluginVersion.patch++;\n\tvar version = pluginVersion.major + \".\" + pluginVersion.minor + \".\" + pluginVersion.patch;\n\tif(pluginVersion.prerelease) {\n\t\tversion += \"-\" + pluginVersion.prerelease;\n\t}\n\tif(pluginVersion.build) {\n\t\tversion += \"+\" + pluginVersion.build;\n\t}\n\t// Save the tiddler\n\t$tw.wiki.addTiddler(new $tw.Tiddler(pluginTiddler,{text: JSON.stringify({tiddlers: plugins},null,4), version: version}));\n\t// Delete any non-shadow constituent tiddlers\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tif($tw.wiki.tiddlerExists(title)) {\n\t\t\t$tw.wiki.deleteTiddler(title);\n\t\t}\n\t});\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\t// Return a heartwarming confirmation\n\treturn \"Plugin \" + title + \" successfully saved\";\n};\n\n})();\n",
"title": "$:/core/modules/utils/pluginmaker.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/utils.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/utils.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDisplay a warning, in colour if we're on a terminal\n*/\nexports.warning = function(text) {\n\tconsole.log($tw.node ? \"\\x1b[1;33m\" + text + \"\\x1b[0m\" : text);\n};\n\n/*\nRepeatedly replaces a substring within a string. Like String.prototype.replace, but without any of the default special handling of $ sequences in the replace string\n*/\nexports.replaceString = function(text,search,replace) {\n\treturn text.replace(search,function() {\n\t\treturn replace;\n\t});\n};\n\n/*\nRepeats a string\n*/\nexports.repeat = function(str,count) {\n\tvar result = \"\";\n\tfor(var t=0;t<count;t++) {\n\t\tresult += str;\n\t}\n\treturn result;\n};\n\n/*\nTrim whitespace from the start and end of a string\nThanks to Steven Levithan, http://blog.stevenlevithan.com/archives/faster-trim-javascript\n*/\nexports.trim = function(str) {\n\tif(typeof str === \"string\") {\n\t\treturn str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\t} else {\n\t\treturn str;\n\t}\n};\n\n/*\nFind the line break preceding a given position in a string\nReturns position immediately after that line break, or the start of the string\n*/\nexports.findPrecedingLineBreak = function(text,pos) {\n\tvar result = text.lastIndexOf(\"\\n\",pos - 1);\n\tif(result === -1) {\n\t\tresult = 0;\n\t} else {\n\t\tresult++;\n\t\tif(text.charAt(result) === \"\\r\") {\n\t\t\tresult++;\n\t\t}\n\t}\n\treturn result;\n};\n\n/*\nFind the line break following a given position in a string\n*/\nexports.findFollowingLineBreak = function(text,pos) {\n\t// Cut to just past the following line break, or to the end of the text\n\tvar result = text.indexOf(\"\\n\",pos);\n\tif(result === -1) {\n\t\tresult = text.length;\n\t} else {\n\t\tif(text.charAt(result) === \"\\r\") {\n\t\t\tresult++;\n\t\t}\n\t}\n\treturn result;\n};\n\n/*\nReturn the number of keys in an object\n*/\nexports.count = function(object) {\n\treturn Object.keys(object || {}).length;\n};\n\n/*\nCheck if an array is equal by value and by reference.\n*/\nexports.isArrayEqual = function(array1,array2) {\n\tif(array1 === array2) {\n\t\treturn true;\n\t}\n\tarray1 = array1 || [];\n\tarray2 = array2 || [];\n\tif(array1.length !== array2.length) {\n\t\treturn false;\n\t}\n\treturn array1.every(function(value,index) {\n\t\treturn value === array2[index];\n\t});\n};\n\n/*\nPush entries onto an array, removing them first if they already exist in the array\n\tarray: array to modify (assumed to be free of duplicates)\n\tvalue: a single value to push or an array of values to push\n*/\nexports.pushTop = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\t// Remove any array entries that are duplicated in the new values\n\t\tif(value.length !== 0) {\n\t\t\tif(array.length !== 0) {\n\t\t\t\tif(value.length < array.length) {\n\t\t\t\t\tfor(t=0; t<value.length; t++) {\n\t\t\t\t\t\tp = array.indexOf(value[t]);\n\t\t\t\t\t\tif(p !== -1) {\n\t\t\t\t\t\t\tarray.splice(p,1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor(t=array.length-1; t>=0; t--) {\n\t\t\t\t\t\tp = value.indexOf(array[t]);\n\t\t\t\t\t\tif(p !== -1) {\n\t\t\t\t\t\t\tarray.splice(t,1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Push the values on top of the main array\n\t\t\tarray.push.apply(array,value);\n\t\t}\n\t} else {\n\t\tp = array.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tarray.splice(p,1);\n\t\t}\n\t\tarray.push(value);\n\t}\n\treturn array;\n};\n\n/*\nRemove entries from an array\n\tarray: array to modify\n\tvalue: a single value to remove, or an array of values to remove\n*/\nexports.removeArrayEntries = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\tfor(t=0; t<value.length; t++) {\n\t\t\tp = array.indexOf(value[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tarray.splice(p,1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tp = array.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tarray.splice(p,1);\n\t\t}\n\t}\n};\n\n/*\nCheck whether any members of a hashmap are present in another hashmap\n*/\nexports.checkDependencies = function(dependencies,changes) {\n\tvar hit = false;\n\t$tw.utils.each(changes,function(change,title) {\n\t\tif($tw.utils.hop(dependencies,title)) {\n\t\t\thit = true;\n\t\t}\n\t});\n\treturn hit;\n};\n\nexports.extend = function(object /* [, src] */) {\n\t$tw.utils.each(Array.prototype.slice.call(arguments, 1), function(source) {\n\t\tif(source) {\n\t\t\tfor(var property in source) {\n\t\t\t\tobject[property] = source[property];\n\t\t\t}\n\t\t}\n\t});\n\treturn object;\n};\n\nexports.deepCopy = function(object) {\n\tvar result,t;\n\tif($tw.utils.isArray(object)) {\n\t\t// Copy arrays\n\t\tresult = object.slice(0);\n\t} else if(typeof object === \"object\") {\n\t\tresult = {};\n\t\tfor(t in object) {\n\t\t\tif(object[t] !== undefined) {\n\t\t\t\tresult[t] = $tw.utils.deepCopy(object[t]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresult = object;\n\t}\n\treturn result;\n};\n\nexports.extendDeepCopy = function(object,extendedProperties) {\n\tvar result = $tw.utils.deepCopy(object),t;\n\tfor(t in extendedProperties) {\n\t\tif(extendedProperties[t] !== undefined) {\n\t\t\tresult[t] = $tw.utils.deepCopy(extendedProperties[t]);\n\t\t}\n\t}\n\treturn result;\n};\n\nexports.deepFreeze = function deepFreeze(object) {\n\tvar property, key;\n\tif(object) {\n\t\tObject.freeze(object);\n\t\tfor(key in object) {\n\t\t\tproperty = object[key];\n\t\t\tif($tw.utils.hop(object,key) && (typeof property === \"object\") && !Object.isFrozen(property)) {\n\t\t\t\tdeepFreeze(property);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexports.slowInSlowOut = function(t) {\n\treturn (1 - ((Math.cos(t * Math.PI) + 1) / 2));\n};\n\nexports.formatDateString = function(date,template) {\n\tvar result = \"\",\n\t\tt = template,\n\t\tmatches = [\n\t\t\t[/^0hh12/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getHours12(date));\n\t\t\t}],\n\t\t\t[/^wYYYY/, function() {\n\t\t\t\treturn $tw.utils.getYearForWeekNo(date);\n\t\t\t}],\n\t\t\t[/^hh12/, function() {\n\t\t\t\treturn $tw.utils.getHours12(date);\n\t\t\t}],\n\t\t\t[/^DDth/, function() {\n\t\t\t\treturn date.getDate() + $tw.utils.getDaySuffix(date);\n\t\t\t}],\n\t\t\t[/^YYYY/, function() {\n\t\t\t\treturn date.getFullYear();\n\t\t\t}],\n\t\t\t[/^0hh/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getHours());\n\t\t\t}],\n\t\t\t[/^0mm/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getMinutes());\n\t\t\t}],\n\t\t\t[/^0ss/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getSeconds());\n\t\t\t}],\n\t\t\t[/^0DD/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getDate());\n\t\t\t}],\n\t\t\t[/^0MM/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getMonth()+1);\n\t\t\t}],\n\t\t\t[/^0WW/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getWeek(date));\n\t\t\t}],\n\t\t\t[/^ddd/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Short/Day/\" + date.getDay());\n\t\t\t}],\n\t\t\t[/^mmm/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Short/Month/\" + (date.getMonth() + 1));\n\t\t\t}],\n\t\t\t[/^DDD/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Long/Day/\" + date.getDay());\n\t\t\t}],\n\t\t\t[/^MMM/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Long/Month/\" + (date.getMonth() + 1));\n\t\t\t}],\n\t\t\t[/^TZD/, function() {\n\t\t\t\tvar tz = date.getTimezoneOffset(),\n\t\t\t\tatz = Math.abs(tz);\n\t\t\t\treturn (tz < 0 ? '+' : '-') + $tw.utils.pad(Math.floor(atz / 60)) + ':' + $tw.utils.pad(atz % 60);\n\t\t\t}],\n\t\t\t[/^wYY/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getYearForWeekNo(date) - 2000);\n\t\t\t}],\n\t\t\t[/^[ap]m/, function() {\n\t\t\t\treturn $tw.utils.getAmPm(date).toLowerCase();\n\t\t\t}],\n\t\t\t[/^hh/, function() {\n\t\t\t\treturn date.getHours();\n\t\t\t}],\n\t\t\t[/^mm/, function() {\n\t\t\t\treturn date.getMinutes();\n\t\t\t}],\n\t\t\t[/^ss/, function() {\n\t\t\t\treturn date.getSeconds();\n\t\t\t}],\n\t\t\t[/^[AP]M/, function() {\n\t\t\t\treturn $tw.utils.getAmPm(date).toUpperCase();\n\t\t\t}],\n\t\t\t[/^DD/, function() {\n\t\t\t\treturn date.getDate();\n\t\t\t}],\n\t\t\t[/^MM/, function() {\n\t\t\t\treturn date.getMonth() + 1;\n\t\t\t}],\n\t\t\t[/^WW/, function() {\n\t\t\t\treturn $tw.utils.getWeek(date);\n\t\t\t}],\n\t\t\t[/^YY/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getFullYear() - 2000);\n\t\t\t}]\n\t\t];\n\twhile(t.length){\n\t\tvar matchString = \"\";\n\t\t$tw.utils.each(matches, function(m) {\n\t\t\tvar match = m[0].exec(t);\n\t\t\tif(match) {\n\t\t\t\tmatchString = m[1].call();\n\t\t\t\tt = t.substr(match[0].length);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\tif(matchString) {\n\t\t\tresult += matchString;\n\t\t} else {\n\t\t\tresult += t.charAt(0);\n\t\t\tt = t.substr(1);\n\t\t}\n\t}\n\tresult = result.replace(/\\\\(.)/g,\"$1\");\n\treturn result;\n};\n\nexports.getAmPm = function(date) {\n\treturn $tw.language.getString(\"Date/Period/\" + (date.getHours() >= 12 ? \"pm\" : \"am\"));\n};\n\nexports.getDaySuffix = function(date) {\n\treturn $tw.language.getString(\"Date/DaySuffix/\" + date.getDate());\n};\n\nexports.getWeek = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) {\n\t\td = 7; // JavaScript Sun=0, ISO Sun=7\n\t}\n\tdt.setTime(dt.getTime() + (4 - d) * 86400000);// shift day to Thurs of same week to calculate weekNo\n\tvar x = new Date(dt.getFullYear(),0,1);\n\tvar n = Math.floor((dt.getTime() - x.getTime()) / 86400000);\n\treturn Math.floor(n / 7) + 1;\n};\n\nexports.getYearForWeekNo = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) {\n\t\td = 7; // JavaScript Sun=0, ISO Sun=7\n\t}\n\tdt.setTime(dt.getTime() + (4 - d) * 86400000);// shift day to Thurs of same week\n\treturn dt.getFullYear();\n};\n\nexports.getHours12 = function(date) {\n\tvar h = date.getHours();\n\treturn h > 12 ? h-12 : ( h > 0 ? h : 12 );\n};\n\n/*\nConvert a date delta in milliseconds into a string representation of \"23 seconds ago\", \"27 minutes ago\" etc.\n\tdelta: delta in milliseconds\nReturns an object with these members:\n\tdescription: string describing the delta period\n\tupdatePeriod: time in millisecond until the string will be inaccurate\n*/\nexports.getRelativeDate = function(delta) {\n\tvar futurep = false;\n\tif(delta < 0) {\n\t\tdelta = -1 * delta;\n\t\tfuturep = true;\n\t}\n\tvar units = [\n\t\t{name: \"Years\", duration: 365 * 24 * 60 * 60 * 1000},\n\t\t{name: \"Months\", duration: (365/12) * 24 * 60 * 60 * 1000},\n\t\t{name: \"Days\", duration: 24 * 60 * 60 * 1000},\n\t\t{name: \"Hours\", duration: 60 * 60 * 1000},\n\t\t{name: \"Minutes\", duration: 60 * 1000},\n\t\t{name: \"Seconds\", duration: 1000}\n\t];\n\tfor(var t=0; t<units.length; t++) {\n\t\tvar result = Math.floor(delta / units[t].duration);\n\t\tif(result >= 2) {\n\t\t\treturn {\n\t\t\t\tdelta: delta,\n\t\t\t\tdescription: $tw.language.getString(\n\t\t\t\t\t\"RelativeDate/\" + (futurep ? \"Future\" : \"Past\") + \"/\" + units[t].name,\n\t\t\t\t\t{variables:\n\t\t\t\t\t\t{period: result.toString()}\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t\tupdatePeriod: units[t].duration\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tdelta: delta,\n\t\tdescription: $tw.language.getString(\n\t\t\t\"RelativeDate/\" + (futurep ? \"Future\" : \"Past\") + \"/Second\",\n\t\t\t{variables:\n\t\t\t\t{period: \"1\"}\n\t\t\t}\n\t\t),\n\t\tupdatePeriod: 1000\n\t};\n};\n\n// Convert & to \"&\", < to \"<\", > to \">\", \" to \""\"\nexports.htmlEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&/mg,\"&\").replace(/</mg,\"<\").replace(/>/mg,\">\").replace(/\\\"/mg,\""\");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n// Converts all HTML entities to their character equivalents\nexports.entityDecode = function(s) {\n\tvar converter = String.fromCodePoint || String.fromCharCode,\n\t\te = s.substr(1,s.length-2); // Strip the & and the ;\n\tif(e.charAt(0) === \"#\") {\n\t\tif(e.charAt(1) === \"x\" || e.charAt(1) === \"X\") {\n\t\t\treturn converter(parseInt(e.substr(2),16));\t\n\t\t} else {\n\t\t\treturn converter(parseInt(e.substr(1),10));\n\t\t}\n\t} else {\n\t\tvar c = $tw.config.htmlEntities[e];\n\t\tif(c) {\n\t\t\treturn converter(c);\n\t\t} else {\n\t\t\treturn s; // Couldn't convert it as an entity, just return it raw\n\t\t}\n\t}\n};\n\nexports.unescapeLineBreaks = function(s) {\n\treturn s.replace(/\\\\n/mg,\"\\n\").replace(/\\\\b/mg,\" \").replace(/\\\\s/mg,\"\\\\\").replace(/\\r/mg,\"\");\n};\n\n/*\n * Returns an escape sequence for given character. Uses \\x for characters <=\n * 0xFF to save space, \\u for the rest.\n *\n * The code needs to be in sync with th code template in the compilation\n * function for \"action\" nodes.\n */\n// Copied from peg.js, thanks to David Majda\nexports.escape = function(ch) {\n\tvar charCode = ch.charCodeAt(0);\n\tif(charCode <= 0xFF) {\n\t\treturn '\\\\x' + $tw.utils.pad(charCode.toString(16).toUpperCase());\n\t} else {\n\t\treturn '\\\\u' + $tw.utils.pad(charCode.toString(16).toUpperCase(),4);\n\t}\n};\n\n// Turns a string into a legal JavaScript string\n// Copied from peg.js, thanks to David Majda\nexports.stringify = function(s) {\n\t/*\n\t* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string\n\t* literal except for the closing quote character, backslash, carriage return,\n\t* line separator, paragraph separator, and line feed. Any character may\n\t* appear in the form of an escape sequence.\n\t*\n\t* For portability, we also escape all non-ASCII characters.\n\t*/\n\treturn (s || \"\")\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\"/g, '\\\\\"') // double quote character\n\t\t.replace(/'/g, \"\\\\'\") // single quote character\n\t\t.replace(/\\r/g, '\\\\r') // carriage return\n\t\t.replace(/\\n/g, '\\\\n') // line feed\n\t\t.replace(/[\\x80-\\uFFFF]/g, exports.escape); // non-ASCII characters\n};\n\n/*\nEscape the RegExp special characters with a preceding backslash\n*/\nexports.escapeRegExp = function(s) {\n return s.replace(/[\\-\\/\\\\\\^\\$\\*\\+\\?\\.\\(\\)\\|\\[\\]\\{\\}]/g, '\\\\$&');\n};\n\n// Checks whether a link target is external, i.e. not a tiddler title\nexports.isLinkExternal = function(to) {\n\tvar externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s<>{}\\[\\]`|\"\\\\^]+(?:\\/|\\b)/i;\n\treturn externalRegExp.test(to);\n};\n\nexports.nextTick = function(fn) {\n/*global window: false */\n\tif(typeof process === \"undefined\") {\n\t\t// Apparently it would be faster to use postMessage - http://dbaron.org/log/20100309-faster-timeouts\n\t\twindow.setTimeout(fn,4);\n\t} else {\n\t\tprocess.nextTick(fn);\n\t}\n};\n\n/*\nConvert a hyphenated CSS property name into a camel case one\n*/\nexports.unHyphenateCss = function(propName) {\n\treturn propName.replace(/-([a-z])/gi, function(match0,match1) {\n\t\treturn match1.toUpperCase();\n\t});\n};\n\n/*\nConvert a camelcase CSS property name into a dashed one (\"backgroundColor\" --> \"background-color\")\n*/\nexports.hyphenateCss = function(propName) {\n\treturn propName.replace(/([A-Z])/g, function(match0,match1) {\n\t\treturn \"-\" + match1.toLowerCase();\n\t});\n};\n\n/*\nParse a text reference of one of these forms:\n* title\n* !!field\n* title!!field\n* title##index\n* etc\nReturns an object with the following fields, all optional:\n* title: tiddler title\n* field: tiddler field name\n* index: JSON property index\n*/\nexports.parseTextReference = function(textRef) {\n\t// Separate out the title, field name and/or JSON indices\n\tvar reTextRef = /(?:(.*?)!!(.+))|(?:(.*?)##(.+))|(.*)/mg,\n\t\tmatch = reTextRef.exec(textRef),\n\t\tresult = {};\n\tif(match && reTextRef.lastIndex === textRef.length) {\n\t\t// Return the parts\n\t\tif(match[1]) {\n\t\t\tresult.title = match[1];\n\t\t}\n\t\tif(match[2]) {\n\t\t\tresult.field = match[2];\n\t\t}\n\t\tif(match[3]) {\n\t\t\tresult.title = match[3];\n\t\t}\n\t\tif(match[4]) {\n\t\t\tresult.index = match[4];\n\t\t}\n\t\tif(match[5]) {\n\t\t\tresult.title = match[5];\n\t\t}\n\t} else {\n\t\t// If we couldn't parse it\n\t\tresult.title = textRef\n\t}\n\treturn result;\n};\n\n/*\nChecks whether a string is a valid fieldname\n*/\nexports.isValidFieldName = function(name) {\n\tif(!name || typeof name !== \"string\") {\n\t\treturn false;\n\t}\n\tname = name.toLowerCase().trim();\n\tvar fieldValidatorRegEx = /^[a-z0-9\\-\\._]+$/mg;\n\treturn fieldValidatorRegEx.test(name);\n};\n\n/*\nExtract the version number from the meta tag or from the boot file\n*/\n\n// Browser version\nexports.extractVersionInfo = function() {\n\tif($tw.packageInfo) {\n\t\treturn $tw.packageInfo.version;\n\t} else {\n\t\tvar metatags = document.getElementsByTagName(\"meta\");\n\t\tfor(var t=0; t<metatags.length; t++) {\n\t\t\tvar m = metatags[t];\n\t\t\tif(m.name === \"tiddlywiki-version\") {\n\t\t\t\treturn m.content;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGet the animation duration in ms\n*/\nexports.getAnimationDuration = function() {\n\treturn parseInt($tw.wiki.getTiddlerText(\"$:/config/AnimationDuration\",\"400\"),10);\n};\n\n/*\nHash a string to a number\nDerived from http://stackoverflow.com/a/15710692\n*/\nexports.hashString = function(str) {\n\treturn str.split(\"\").reduce(function(a,b) {\n\t\ta = ((a << 5) - a) + b.charCodeAt(0);\n\t\treturn a & a;\n\t},0);\n};\n\n/*\nDecode a base64 string\n*/\nexports.base64Decode = function(string64) {\n\tif($tw.browser) {\n\t\t// TODO\n\t\tthrow \"$tw.utils.base64Decode() doesn't work in the browser\";\n\t} else {\n\t\treturn (new Buffer(string64,\"base64\")).toString();\n\t}\n};\n\n/*\nConvert a hashmap into a tiddler dictionary format sequence of name:value pairs\n*/\nexports.makeTiddlerDictionary = function(data) {\n\tvar output = [];\n\tfor(var name in data) {\n\t\toutput.push(name + \": \" + data[name]);\n\t}\n\treturn output.join(\"\\n\");\n};\n\n/*\nHigh resolution microsecond timer for profiling\n*/\nexports.timer = function(base) {\n\tvar m;\n\tif($tw.node) {\n\t\tvar r = process.hrtime();\t\t\n\t\tm = r[0] * 1e3 + (r[1] / 1e6);\n\t} else if(window.performance) {\n\t\tm = performance.now();\n\t} else {\n\t\tm = Date.now();\n\t}\n\tif(typeof base !== \"undefined\") {\n\t\tm = m - base;\n\t}\n\treturn m;\n};\n\n/*\nConvert text and content type to a data URI\n*/\nexports.makeDataUri = function(text,type) {\n\ttype = type || \"text/vnd.tiddlywiki\";\n\tvar typeInfo = $tw.config.contentTypeInfo[type] || $tw.config.contentTypeInfo[\"text/plain\"],\n\t\tisBase64 = typeInfo.encoding === \"base64\",\n\t\tparts = [];\n\tparts.push(\"data:\");\n\tparts.push(type);\n\tparts.push(isBase64 ? \";base64\" : \"\");\n\tparts.push(\",\");\n\tparts.push(isBase64 ? text : encodeURIComponent(text));\n\treturn parts.join(\"\");\n};\n\n/*\nUseful for finding out the fully escaped CSS selector equivalent to a given tag. For example:\n\n$tw.utils.tagToCssSelector(\"$:/tags/Stylesheet\") --> tc-tagged-\\%24\\%3A\\%2Ftags\\%2FStylesheet\n*/\nexports.tagToCssSelector = function(tagName) {\n\treturn \"tc-tagged-\" + encodeURIComponent(tagName).replace(/[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^`{\\|}~,]/mg,function(c) {\n\t\treturn \"\\\\\" + c;\n\t});\n};\n\n/*\nIE does not have sign function\n*/\nexports.sign = Math.sign || function(x) {\n\tx = +x; // convert to a number\n\tif (x === 0 || isNaN(x)) {\n\t\treturn x;\n\t}\n\treturn x > 0 ? 1 : -1;\n};\n\n/*\nIE does not have an endsWith function\n*/\nexports.strEndsWith = function(str,ending,position) {\n\tif(str.endsWith) {\n\t\treturn str.endsWith(ending,position);\n\t} else {\n\t\tif (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) {\n\t\t\tposition = str.length;\n\t\t}\n\t\tposition -= ending.length;\n\t\tvar lastIndex = str.indexOf(ending, position);\n\t\treturn lastIndex !== -1 && lastIndex === position;\n\t}\n};\n\n/*\nTransliterate string from eg. Cyrillic Russian to Latin\n*/\nvar transliterationPairs = {\n\t\"Ё\":\"YO\",\n\t\"Й\":\"I\",\n\t\"Ц\":\"TS\",\n\t\"У\":\"U\",\n\t\"К\":\"K\",\n\t\"Е\":\"E\",\n\t\"Н\":\"N\",\n\t\"Г\":\"G\",\n\t\"Ш\":\"SH\",\n\t\"Щ\":\"SCH\",\n\t\"З\":\"Z\",\n\t\"Х\":\"H\",\n\t\"Ъ\":\"'\",\n\t\"ё\":\"yo\",\n\t\"й\":\"i\",\n\t\"ц\":\"ts\",\n\t\"у\":\"u\",\n\t\"к\":\"k\",\n\t\"е\":\"e\",\n\t\"н\":\"n\",\n\t\"г\":\"g\",\n\t\"ш\":\"sh\",\n\t\"щ\":\"sch\",\n\t\"з\":\"z\",\n\t\"х\":\"h\",\n\t\"ъ\":\"'\",\n\t\"Ф\":\"F\",\n\t\"Ы\":\"I\",\n\t\"В\":\"V\",\n\t\"А\":\"a\",\n\t\"П\":\"P\",\n\t\"Р\":\"R\",\n\t\"О\":\"O\",\n\t\"Л\":\"L\",\n\t\"Д\":\"D\",\n\t\"Ж\":\"ZH\",\n\t\"Э\":\"E\",\n\t\"ф\":\"f\",\n\t\"ы\":\"i\",\n\t\"в\":\"v\",\n\t\"а\":\"a\",\n\t\"п\":\"p\",\n\t\"р\":\"r\",\n\t\"о\":\"o\",\n\t\"л\":\"l\",\n\t\"д\":\"d\",\n\t\"ж\":\"zh\",\n\t\"э\":\"e\",\n\t\"Я\":\"Ya\",\n\t\"Ч\":\"CH\",\n\t\"С\":\"S\",\n\t\"М\":\"M\",\n\t\"И\":\"I\",\n\t\"Т\":\"T\",\n\t\"Ь\":\"'\",\n\t\"Б\":\"B\",\n\t\"Ю\":\"YU\",\n\t\"я\":\"ya\",\n\t\"ч\":\"ch\",\n\t\"с\":\"s\",\n\t\"м\":\"m\",\n\t\"и\":\"i\",\n\t\"т\":\"t\",\n\t\"ь\":\"'\",\n\t\"б\":\"b\",\n\t\"ю\":\"yu\"\n};\n\nexports.transliterate = function(str) {\n\treturn str.split(\"\").map(function(char) {\n\t\treturn transliterationPairs[char] || char;\n\t}).join(\"\");\n};\n\n})();\n",
"title": "$:/core/modules/utils/utils.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/widgets/action-createtiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-createtiddler.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to create a new tiddler with a unique name and specified fields.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CreateTiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCreateTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCreateTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nCreateTiddlerWidget.prototype.execute = function() {\n\tthis.actionBaseTitle = this.getAttribute(\"$basetitle\");\n\tthis.actionSaveTitle = this.getAttribute(\"$savetitle\");\n\tthis.actionTimestamp = this.getAttribute(\"$timestamp\",\"yes\") === \"yes\";\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nCreateTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nCreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar title = this.wiki.generateNewTitle(this.actionBaseTitle),\n\t\tfields = {},\n\t\tcreationFields,\n\t\tmodificationFields;\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tfields[name] = attribute;\n\t\t}\n\t});\n\tif(this.actionTimestamp) {\n\t\tcreationFields = this.wiki.getCreationFields();\n\t\tmodificationFields = this.wiki.getModificationFields();\n\t}\n\tvar tiddler = this.wiki.addTiddler(new $tw.Tiddler(creationFields,fields,modificationFields,{title: title}));\n\tif(this.actionSaveTitle) {\n\t\tthis.wiki.setTextReference(this.actionSaveTitle,title,this.getVariable(\"currentTiddler\"));\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-createtiddler\"] = CreateTiddlerWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-createtiddler.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-deletefield.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-deletefield.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to delete fields of a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DeleteFieldWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDeleteFieldWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDeleteFieldWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nDeleteFieldWidget.prototype.execute = function() {\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.actionField = this.getAttribute(\"$field\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nDeleteFieldWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$tiddler\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nDeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar self = this,\n\t\ttiddler = this.wiki.getTiddler(self.actionTiddler),\n\t\tremoveFields = {},\n\t\thasChanged = false;\n\tif(this.actionField) {\n\t\tremoveFields[this.actionField] = undefined;\n\t\tif(this.actionField in tiddler.fields) {\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\tif(tiddler) {\n\t\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\t\tif(name.charAt(0) !== \"$\" && name !== \"title\") {\n\t\t\t\tremoveFields[name] = undefined;\n\t\t\t\thasChanged = true;\n\t\t\t}\n\t\t});\n\t\tif(hasChanged) {\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));\t\t\t\n\t\t}\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-deletefield\"] = DeleteFieldWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-deletefield.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-deletetiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-deletetiddler.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to delete a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DeleteTiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDeleteTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDeleteTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nDeleteTiddlerWidget.prototype.execute = function() {\n\tthis.actionFilter = this.getAttribute(\"$filter\");\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nDeleteTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$filter\"] || changedAttributes[\"$tiddler\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nDeleteTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar tiddlers = [];\n\tif(this.actionFilter) {\n\t\ttiddlers = this.wiki.filterTiddlers(this.actionFilter,this);\n\t}\n\tif(this.actionTiddler) {\n\t\ttiddlers.push(this.actionTiddler);\n\t}\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tthis.wiki.deleteTiddler(tiddlers[t]);\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-deletetiddler\"] = DeleteTiddlerWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-deletetiddler.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-listops.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-listops.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to apply list operations to any tiddler field (defaults to the 'list' field of the current tiddler)\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\nvar ActionListopsWidget = function(parseTreeNode, options) {\n\tthis.initialise(parseTreeNode, options);\n};\n/**\n * Inherit from the base widget class\n */\nActionListopsWidget.prototype = new Widget();\n/**\n * Render this widget into the DOM\n */\nActionListopsWidget.prototype.render = function(parent, nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n/**\n * Compute the internal state of the widget\n */\nActionListopsWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.target = this.getAttribute(\"$tiddler\", this.getVariable(\n\t\t\"currentTiddler\"));\n\tthis.filter = this.getAttribute(\"$filter\");\n\tthis.subfilter = this.getAttribute(\"$subfilter\");\n\tthis.listField = this.getAttribute(\"$field\", \"list\");\n\tthis.listIndex = this.getAttribute(\"$index\");\n\tthis.filtertags = this.getAttribute(\"$tags\");\n};\n/**\n * \tRefresh the widget by ensuring our attributes are up to date\n */\nActionListopsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.$tiddler || changedAttributes.$filter ||\n\t\tchangedAttributes.$subfilter || changedAttributes.$field ||\n\t\tchangedAttributes.$index || changedAttributes.$tags) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n/**\n * \tInvoke the action associated with this widget\n */\nActionListopsWidget.prototype.invokeAction = function(triggeringWidget,\n\tevent) {\n\t//Apply the specified filters to the lists\n\tvar field = this.listField,\n\t\tindex,\n\t\ttype = \"!!\",\n\t\tlist = this.listField;\n\tif(this.listIndex) {\n\t\tfield = undefined;\n\t\tindex = this.listIndex;\n\t\ttype = \"##\";\n\t\tlist = this.listIndex;\n\t}\n\tif(this.filter) {\n\t\tthis.wiki.setText(this.target, field, index, $tw.utils.stringifyList(\n\t\t\tthis.wiki\n\t\t\t.filterTiddlers(this.filter, this)));\n\t}\n\tif(this.subfilter) {\n\t\tvar subfilter = \"[list[\" + this.target + type + list + \"]] \" + this.subfilter;\n\t\tthis.wiki.setText(this.target, field, index, $tw.utils.stringifyList(\n\t\t\tthis.wiki\n\t\t\t.filterTiddlers(subfilter, this)));\n\t}\n\tif(this.filtertags) {\n\t\tvar tiddler = this.wiki.getTiddler(this.target),\n\t\t\toldtags = tiddler ? (tiddler.fields.tags || []).slice(0) : [],\n\t\t\ttagfilter = \"[list[\" + this.target + \"!!tags]] \" + this.filtertags,\n\t\t\tnewtags = this.wiki.filterTiddlers(tagfilter,this);\n\t\tif($tw.utils.stringifyList(oldtags.sort()) !== $tw.utils.stringifyList(newtags.sort())) {\n\t\t\tthis.wiki.setText(this.target,\"tags\",undefined,$tw.utils.stringifyList(newtags));\t\t\t\n\t\t}\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-listops\"] = ActionListopsWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-listops.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-navigate.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-navigate.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to navigate to a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar NavigateWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nNavigateWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nNavigateWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nNavigateWidget.prototype.execute = function() {\n\tthis.actionTo = this.getAttribute(\"$to\");\n\tthis.actionScroll = this.getAttribute(\"$scroll\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nNavigateWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$to\"] || changedAttributes[\"$scroll\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nNavigateWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar bounds = triggeringWidget && triggeringWidget.getBoundingClientRect && triggeringWidget.getBoundingClientRect(),\n\t\tsuppressNavigation = event.metaKey || event.ctrlKey || (event.button === 1);\n\tif(this.actionScroll === \"yes\") {\n\t\tsuppressNavigation = false;\n\t} else if(this.actionScroll === \"no\") {\n\t\tsuppressNavigation = true;\n\t}\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.actionTo === undefined ? this.getVariable(\"currentTiddler\") : this.actionTo,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: triggeringWidget,\n\t\tnavigateFromClientRect: bounds && { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: suppressNavigation\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-navigate\"] = NavigateWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-navigate.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-sendmessage.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-sendmessage.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to send a message\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SendMessageWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSendMessageWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSendMessageWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nSendMessageWidget.prototype.execute = function() {\n\tthis.actionMessage = this.getAttribute(\"$message\");\n\tthis.actionParam = this.getAttribute(\"$param\");\n\tthis.actionName = this.getAttribute(\"$name\");\n\tthis.actionValue = this.getAttribute(\"$value\",\"\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nSendMessageWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(Object.keys(changedAttributes).length) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nSendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\t// Get the string parameter\n\tvar param = this.actionParam;\n\t// Assemble the attributes as a hashmap\n\tvar paramObject = Object.create(null);\n\tvar count = 0;\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tparamObject[name] = attribute;\n\t\t\tcount++;\n\t\t}\n\t});\n\t// Add name/value pair if present\n\tif(this.actionName) {\n\t\tparamObject[this.actionName] = this.actionValue;\n\t}\n\t// Dispatch the message\n\tthis.dispatchEvent({\n\t\ttype: this.actionMessage,\n\t\tparam: param,\n\t\tparamObject: paramObject,\n\t\ttiddlerTitle: this.getVariable(\"currentTiddler\"),\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tevent: event\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-sendmessage\"] = SendMessageWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-sendmessage.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-setfield.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/action-setfield.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to set a single field or index on a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SetFieldWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSetFieldWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSetFieldWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nSetFieldWidget.prototype.execute = function() {\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.actionField = this.getAttribute(\"$field\");\n\tthis.actionIndex = this.getAttribute(\"$index\");\n\tthis.actionValue = this.getAttribute(\"$value\");\n\tthis.actionTimestamp = this.getAttribute(\"$timestamp\",\"yes\") === \"yes\";\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nSetFieldWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$tiddler\"] || changedAttributes[\"$field\"] || changedAttributes[\"$index\"] || changedAttributes[\"$value\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nSetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar self = this,\n\t\toptions = {};\n\toptions.suppressTimestamp = !this.actionTimestamp;\n\tif((typeof this.actionField == \"string\") || (typeof this.actionIndex == \"string\") || (typeof this.actionValue == \"string\")) {\n\t\tthis.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue,options);\n\t}\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tself.wiki.setText(self.actionTiddler,name,undefined,attribute,options);\n\t\t}\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-setfield\"] = SetFieldWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/action-setfield.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/browse.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/browse.js\ntype: application/javascript\nmodule-type: widget\n\nBrowse widget for browsing for files to import\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar BrowseWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nBrowseWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nBrowseWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"file\");\n\tif(this.browseMultiple) {\n\t\tdomNode.setAttribute(\"multiple\",\"multiple\");\n\t}\n\tif(this.tooltip) {\n\t\tdomNode.setAttribute(\"title\",this.tooltip);\n\t}\n\t// Nw.js supports \"nwsaveas\" to force a \"save as\" dialogue that allows a new or existing file to be selected\n\tif(this.nwsaveas) {\n\t\tdomNode.setAttribute(\"nwsaveas\",this.nwsaveas);\n\t}\n\t// Nw.js supports \"webkitdirectory\" to allow a directory to be selected\n\tif(this.webkitdirectory) {\n\t\tdomNode.setAttribute(\"webkitdirectory\",this.webkitdirectory);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\"change\",function (event) {\n\t\tif(self.message) {\n\t\t\tself.dispatchEvent({type: self.message, param: self.param, files: event.target.files});\n\t\t} else {\n\t\t\tself.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {\n\t\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t\t\t});\n\t\t}\n\t\treturn false;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nBrowseWidget.prototype.execute = function() {\n\tthis.browseMultiple = this.getAttribute(\"multiple\");\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis.nwsaveas = this.getAttribute(\"nwsaveas\");\n\tthis.webkitdirectory = this.getAttribute(\"webkitdirectory\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nBrowseWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.browse = BrowseWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/browse.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/button.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/button.js\ntype: application/javascript\nmodule-type: widget\n\nButton widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ButtonWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nButtonWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nButtonWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar tag = \"button\";\n\tif(this.buttonTag && $tw.config.htmlUnsafeElements.indexOf(this.buttonTag) === -1) {\n\t\ttag = this.buttonTag;\n\t}\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = this[\"class\"].split(\" \") || [],\n\t\tisPoppedUp = this.popup && this.isPoppedUp();\n\tif(this.selectedClass) {\n\t\tif(this.set && this.setTo && this.isSelected()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t\tif(isPoppedUp) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t}\n\tif(isPoppedUp) {\n\t\t$tw.utils.pushTop(classes,\"tc-popup-handle\");\n\t}\n\tdomNode.className = classes.join(\" \");\n\t// Assign other attributes\n\tif(this.style) {\n\t\tdomNode.setAttribute(\"style\",this.style);\n\t}\n\tif(this.tooltip) {\n\t\tdomNode.setAttribute(\"title\",this.tooltip);\n\t}\n\tif(this[\"aria-label\"]) {\n\t\tdomNode.setAttribute(\"aria-label\",this[\"aria-label\"]);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\"click\",function (event) {\n\t\tvar handled = false;\n\t\tif(self.invokeActions(this,event)) {\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.to) {\n\t\t\tself.navigateTo(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.message) {\n\t\t\tself.dispatchMessage(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.popup) {\n\t\t\tself.triggerPopup(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.set) {\n\t\t\tself.setTiddler();\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.actions) {\n\t\t\tself.invokeActionString(self.actions,self,event);\n\t\t}\n\t\tif(handled) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\treturn handled;\n\t},false);\n\t// Make it draggable if required\n\tif(this.dragTiddler || this.dragFilter) {\n\t\t$tw.utils.makeDraggable({\n\t\t\tdomNode: domNode,\n\t\t\tdragTiddlerFn: function() {return self.dragTiddler;},\n\t\t\tdragFilterFn: function() {return self.dragFilter;},\n\t\t\twidget: this\n\t\t});\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nWe don't allow actions to propagate because we trigger actions ourselves\n*/\nButtonWidget.prototype.allowActionPropagation = function() {\n\treturn false;\n};\n\nButtonWidget.prototype.getBoundingClientRect = function() {\n\treturn this.domNodes[0].getBoundingClientRect();\n};\n\nButtonWidget.prototype.isSelected = function() {\n return this.wiki.getTextReference(this.set,this.defaultSetValue,this.getVariable(\"currentTiddler\")) === this.setTo;\n};\n\nButtonWidget.prototype.isPoppedUp = function() {\n\tvar tiddler = this.wiki.getTiddler(this.popup);\n\tvar result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(tiddler.fields.text) : false;\n\treturn result;\n};\n\nButtonWidget.prototype.navigateTo = function(event) {\n\tvar bounds = this.getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: this,\n\t\tnavigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1),\n\t\tevent: event\n\t});\n};\n\nButtonWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\"currentTiddler\"), event: event});\n};\n\nButtonWidget.prototype.triggerPopup = function(event) {\n\t$tw.popup.triggerPopup({\n\t\tdomNode: this.domNodes[0],\n\t\ttitle: this.popup,\n\t\twiki: this.wiki\n\t});\n};\n\nButtonWidget.prototype.setTiddler = function() {\n\tthis.wiki.setTextReference(this.set,this.setTo,this.getVariable(\"currentTiddler\"));\n};\n\n/*\nCompute the internal state of the widget\n*/\nButtonWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.actions = this.getAttribute(\"actions\");\n\tthis.to = this.getAttribute(\"to\");\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.set = this.getAttribute(\"set\");\n\tthis.setTo = this.getAttribute(\"setTo\");\n\tthis.popup = this.getAttribute(\"popup\");\n\tthis.hover = this.getAttribute(\"hover\");\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tthis[\"aria-label\"] = this.getAttribute(\"aria-label\");\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis.style = this.getAttribute(\"style\");\n\tthis.selectedClass = this.getAttribute(\"selectedClass\");\n\tthis.defaultSetValue = this.getAttribute(\"default\",\"\");\n\tthis.buttonTag = this.getAttribute(\"tag\");\n\tthis.dragTiddler = this.getAttribute(\"dragTiddler\");\n\tthis.dragFilter = this.getAttribute(\"dragFilter\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nButtonWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes[\"class\"] || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.button = ButtonWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/button.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/checkbox.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/checkbox.js\ntype: application/javascript\nmodule-type: widget\n\nCheckbox widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CheckboxWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCheckboxWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCheckboxWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.labelDomNode.setAttribute(\"class\",this.checkboxClass);\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"checkbox\");\n\tif(this.getValue()) {\n\t\tthis.inputDomNode.setAttribute(\"checked\",\"true\");\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nCheckboxWidget.prototype.getValue = function() {\n\tvar tiddler = this.wiki.getTiddler(this.checkboxTitle);\n\tif(tiddler) {\n\t\tif(this.checkboxTag) {\n\t\t\tif(this.checkboxInvertTag) {\n\t\t\t\treturn !tiddler.hasTag(this.checkboxTag);\n\t\t\t} else {\n\t\t\t\treturn tiddler.hasTag(this.checkboxTag);\n\t\t\t}\n\t\t}\n\t\tif(this.checkboxField) {\n\t\t\tvar value;\n\t\t\tif($tw.utils.hop(tiddler.fields,this.checkboxField)) {\n\t\t\t\tvalue = tiddler.fields[this.checkboxField] || \"\";\n\t\t\t} else {\n\t\t\t\tvalue = this.checkboxDefault || \"\";\n\t\t\t}\n\t\t\tif(value === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(value === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif(this.checkboxIndex) {\n\t\t\tvar value = this.wiki.extractTiddlerDataItem(tiddler,this.checkboxIndex,this.checkboxDefault || \"\");\n\t\t\tif(value === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(value === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(this.checkboxTag) {\n\t\t\treturn false;\n\t\t}\n\t\tif(this.checkboxField) {\n\t\t\tif(this.checkboxDefault === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(this.checkboxDefault === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\nCheckboxWidget.prototype.handleChangeEvent = function(event) {\n\tvar checked = this.inputDomNode.checked,\n\t\ttiddler = this.wiki.getTiddler(this.checkboxTitle),\n\t\tfallbackFields = {text: \"\"},\n\t\tnewFields = {title: this.checkboxTitle},\n\t\thasChanged = false,\n\t\ttagCheck = false,\n\t\thasTag = tiddler && tiddler.hasTag(this.checkboxTag),\n\t\tvalue = checked ? this.checkboxChecked : this.checkboxUnchecked;\n\tif(this.checkboxTag && this.checkboxInvertTag === \"yes\") {\n\t\ttagCheck = hasTag === checked;\n\t} else {\n\t\ttagCheck = hasTag !== checked;\n\t}\n\t// Set the tag if specified\n\tif(this.checkboxTag && (!tiddler || tagCheck)) {\n\t\tnewFields.tags = tiddler ? (tiddler.fields.tags || []).slice(0) : [];\n\t\tvar pos = newFields.tags.indexOf(this.checkboxTag);\n\t\tif(pos !== -1) {\n\t\t\tnewFields.tags.splice(pos,1);\n\t\t}\n\t\tif(this.checkboxInvertTag === \"yes\" && !checked) {\n\t\t\tnewFields.tags.push(this.checkboxTag);\n\t\t} else if(this.checkboxInvertTag !== \"yes\" && checked) {\n\t\t\tnewFields.tags.push(this.checkboxTag);\n\t\t}\n\t\thasChanged = true;\n\t}\n\t// Set the field if specified\n\tif(this.checkboxField) {\n\t\tif(!tiddler || tiddler.fields[this.checkboxField] !== value) {\n\t\t\tnewFields[this.checkboxField] = value;\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\t// Set the index if specified\n\tif(this.checkboxIndex) {\n\t\tvar indexValue = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxIndex);\n\t\tif(!tiddler || indexValue !== value) {\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\tif(hasChanged) {\n\t\tif(this.checkboxIndex) {\n\t\t\tthis.wiki.setText(this.checkboxTitle,\"\",this.checkboxIndex,value);\n\t\t} else {\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields()));\n\t\t}\n\t}\n\t// Trigger actions\n\tif(this.checkboxActions) {\n\t\tthis.invokeActionString(this.checkboxActions,this,event);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nCheckboxWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.checkboxActions = this.getAttribute(\"actions\");\n\tthis.checkboxTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.checkboxTag = this.getAttribute(\"tag\");\n\tthis.checkboxField = this.getAttribute(\"field\");\n\tthis.checkboxIndex = this.getAttribute(\"index\");\n\tthis.checkboxChecked = this.getAttribute(\"checked\");\n\tthis.checkboxUnchecked = this.getAttribute(\"unchecked\");\n\tthis.checkboxDefault = this.getAttribute(\"default\");\n\tthis.checkboxClass = this.getAttribute(\"class\",\"\");\n\tthis.checkboxInvertTag = this.getAttribute(\"invertTag\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCheckboxWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.index || changedAttributes.checked || changedAttributes.unchecked || changedAttributes[\"default\"] || changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.checkboxTitle]) {\n\t\t\tthis.inputDomNode.checked = this.getValue();\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\nexports.checkbox = CheckboxWidget;\n\n})();",
"title": "$:/core/modules/widgets/checkbox.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/codeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/codeblock.js\ntype: application/javascript\nmodule-type: widget\n\nCode block node widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CodeBlockWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCodeBlockWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCodeBlockWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar codeNode = this.document.createElement(\"code\"),\n\t\tdomNode = this.document.createElement(\"pre\");\n\tcodeNode.appendChild(this.document.createTextNode(this.getAttribute(\"code\")));\n\tdomNode.appendChild(codeNode);\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n\tif(this.postRender) {\n\t\tthis.postRender();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nCodeBlockWidget.prototype.execute = function() {\n\tthis.language = this.getAttribute(\"language\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCodeBlockWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.codeblock = CodeBlockWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/codeblock.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/count.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/count.js\ntype: application/javascript\nmodule-type: widget\n\nCount widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CountWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCountWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCountWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.currentCount);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nCountWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\");\n\t// Execute the filter\n\tif(this.filter) {\n\t\tthis.currentCount = this.wiki.filterTiddlers(this.filter,this).length;\n\t} else {\n\t\tthis.currentCount = undefined;\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCountWidget.prototype.refresh = function(changedTiddlers) {\n\t// Re-execute the filter to get the count\n\tthis.computeAttributes();\n\tvar oldCount = this.currentCount;\n\tthis.execute();\n\tif(this.currentCount !== oldCount) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\n};\n\nexports.count = CountWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/count.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/draggable.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/draggable.js\ntype: application/javascript\nmodule-type: widget\n\nDraggable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DraggableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDraggableWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDraggableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Sanitise the specified tag\n\tvar tag = this.draggableTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"div\";\n\t}\n\t// Create our element\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = [\"tc-draggable\"];\n\tif(this.draggableClasses) {\n\t\tclasses.push(this.draggableClasses);\n\t}\n\tdomNode.setAttribute(\"class\",classes.join(\" \"));\n\t// Add event handlers\n\t$tw.utils.makeDraggable({\n\t\tdomNode: domNode,\n\t\tdragTiddlerFn: function() {return self.getAttribute(\"tiddler\");},\n\t\tdragFilterFn: function() {return self.getAttribute(\"filter\");},\n\t\twidget: this\n\t});\n\t// Insert the link into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nDraggableWidget.prototype.execute = function() {\n\t// Pick up our attributes\n\tthis.draggableTag = this.getAttribute(\"tag\",\"div\");\n\tthis.draggableClasses = this.getAttribute(\"class\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDraggableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedTiddlers.tag || changedTiddlers[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.draggable = DraggableWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/draggable.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/droppable.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/droppable.js\ntype: application/javascript\nmodule-type: widget\n\nDroppable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DroppableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDroppableWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDroppableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.droppableTag && $tw.config.htmlUnsafeElements.indexOf(this.droppableTag) === -1) {\n\t\ttag = this.droppableTag;\n\t}\n\t// Create element and assign classes\n\tvar domNode = this.document.createElement(tag),\n\t\tclasses = (this[\"class\"] || \"\").split(\" \");\n\tclasses.push(\"tc-droppable\");\n\tdomNode.className = classes.join(\" \");\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"}\n\t]);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n\t// Stack of outstanding enter/leave events\n\tthis.currentlyEntered = [];\n};\n\nDroppableWidget.prototype.enterDrag = function(event) {\n\tif(this.currentlyEntered.indexOf(event.target) === -1) {\n\t\tthis.currentlyEntered.push(event.target);\n\t}\n\t// If we're entering for the first time we need to apply highlighting\n\t$tw.utils.addClass(this.domNodes[0],\"tc-dragover\");\n};\n\nDroppableWidget.prototype.leaveDrag = function(event) {\n\tvar pos = this.currentlyEntered.indexOf(event.target);\n\tif(pos !== -1) {\n\t\tthis.currentlyEntered.splice(pos,1);\n\t}\n\t// Remove highlighting if we're leaving externally. The hacky second condition is to resolve a problem with Firefox whereby there is an erroneous dragenter event if the node being dragged is within the dropzone\n\tif(this.currentlyEntered.length === 0 || (this.currentlyEntered.length === 1 && this.currentlyEntered[0] === $tw.dragInProgress)) {\n\t\tthis.currentlyEntered = [];\n\t\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t}\n};\n\nDroppableWidget.prototype.handleDragEnterEvent = function(event) {\n\tthis.enterDrag(event);\n\t// Tell the browser that we're ready to handle the drop\n\tevent.preventDefault();\n\t// Tell the browser not to ripple the drag up to any parent drop handlers\n\tevent.stopPropagation();\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDragOverEvent = function(event) {\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\t// Set the drop effect\n\tevent.dataTransfer.dropEffect = this.droppableEffect;\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDragLeaveEvent = function(event) {\n\tthis.leaveDrag(event);\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this;\n\tthis.leaveDrag(event);\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\tvar dataTransfer = event.dataTransfer;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t// Try to import the various data types we understand\n\t$tw.utils.importDataTransfer(dataTransfer,null,function(fieldsArray) {\n\t\tfieldsArray.forEach(function(fields) {\n\t\t\tself.performActions(fields.title || fields.text,event);\n\t\t});\n\t});\n\t// Tell the browser that we handled the drop\n\tevent.preventDefault();\n\t// Stop the drop ripple up to any parent handlers\n\tevent.stopPropagation();\n\treturn false;\n};\n\nDroppableWidget.prototype.performActions = function(title,event) {\n\tif(this.droppableActions) {\n\t\tthis.invokeActionString(this.droppableActions,this,event,{actionTiddler: title});\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nDroppableWidget.prototype.execute = function() {\n\tthis.droppableActions = this.getAttribute(\"actions\");\n\tthis.droppableEffect = this.getAttribute(\"effect\",\"copy\");\n\tthis.droppableTag = this.getAttribute(\"tag\");\n\tthis.droppableClass = this.getAttribute(\"class\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDroppableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"class\"] || changedAttributes.tag) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.droppable = DroppableWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/droppable.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/dropzone.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/dropzone.js\ntype: application/javascript\nmodule-type: widget\n\nDropzone widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DropZoneWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDropZoneWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDropZoneWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"div\");\n\tdomNode.className = \"tc-dropzone\";\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"},\n\t\t{name: \"paste\", handlerObject: this, handlerMethod: \"handlePasteEvent\"}\n\t]);\n\tdomNode.addEventListener(\"click\",function (event) {\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n\t// Stack of outstanding enter/leave events\n\tthis.currentlyEntered = [];\n};\n\nDropZoneWidget.prototype.enterDrag = function(event) {\n\tif(this.currentlyEntered.indexOf(event.target) === -1) {\n\t\tthis.currentlyEntered.push(event.target);\n\t}\n\t// If we're entering for the first time we need to apply highlighting\n\t$tw.utils.addClass(this.domNodes[0],\"tc-dragover\");\n};\n\nDropZoneWidget.prototype.leaveDrag = function(event) {\n\tvar pos = this.currentlyEntered.indexOf(event.target);\n\tif(pos !== -1) {\n\t\tthis.currentlyEntered.splice(pos,1);\n\t}\n\t// Remove highlighting if we're leaving externally\n\tif(this.currentlyEntered.length === 0) {\n\t\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t}\n};\n\nDropZoneWidget.prototype.handleDragEnterEvent = function(event) {\n\t// Check for this window being the source of the drag\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\tthis.enterDrag(event);\n\t// Tell the browser that we're ready to handle the drop\n\tevent.preventDefault();\n\t// Tell the browser not to ripple the drag up to any parent drop handlers\n\tevent.stopPropagation();\n};\n\nDropZoneWidget.prototype.handleDragOverEvent = function(event) {\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Check for this window being the source of the drag\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\t// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\tevent.dataTransfer.dropEffect = \"copy\"; // Explicitly show this is a copy\n};\n\nDropZoneWidget.prototype.handleDragLeaveEvent = function(event) {\n\tthis.leaveDrag(event);\n};\n\nDropZoneWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this;\n\tthis.leaveDrag(event);\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Check for this window being the source of the drag\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\tvar self = this,\n\t\tdataTransfer = event.dataTransfer;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t// Import any files in the drop\n\tvar numFiles = 0;\n\tif(dataTransfer.files) {\n\t\tnumFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {\n\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t\t});\n\t}\n\t// Try to import the various data types we understand\n\tif(numFiles === 0) {\n\t\t$tw.utils.importDataTransfer(dataTransfer,this.wiki.generateNewTitle(\"Untitled\"),function(fieldsArray) {\n\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(fieldsArray)});\n\t\t});\n\t}\n\t// Tell the browser that we handled the drop\n\tevent.preventDefault();\n\t// Stop the drop ripple up to any parent handlers\n\tevent.stopPropagation();\n};\n\nDropZoneWidget.prototype.handlePasteEvent = function(event) {\n\t// Let the browser handle it if we're in a textarea or input box\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) == -1) {\n\t\tvar self = this,\n\t\t\titems = event.clipboardData.items;\n\t\t// Enumerate the clipboard items\n\t\tfor(var t = 0; t<items.length; t++) {\n\t\t\tvar item = items[t];\n\t\t\tif(item.kind === \"file\") {\n\t\t\t\t// Import any files\n\t\t\t\tthis.wiki.readFile(item.getAsFile(),function(tiddlerFieldsArray) {\n\t\t\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t\t\t\t});\n\t\t\t} else if(item.kind === \"string\") {\n\t\t\t\t// Create tiddlers from string items\n\t\t\t\tvar type = item.type;\n\t\t\t\titem.getAsString(function(str) {\n\t\t\t\t\tvar tiddlerFields = {\n\t\t\t\t\t\ttitle: self.wiki.generateNewTitle(\"Untitled\"),\n\t\t\t\t\t\ttext: str,\n\t\t\t\t\t\ttype: type\n\t\t\t\t\t};\n\t\t\t\t\tif($tw.log.IMPORT) {\n\t\t\t\t\t\tconsole.log(\"Importing string '\" + str + \"', type: '\" + type + \"'\");\n\t\t\t\t\t}\n\t\t\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify([tiddlerFields])});\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// Tell the browser that we've handled the paste\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nDropZoneWidget.prototype.execute = function() {\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDropZoneWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.dropzone = DropZoneWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/dropzone.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-binary.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-binary.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-binary widget; placeholder for editing binary tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar BINARY_WARNING_MESSAGE = \"$:/core/ui/BinaryWarning\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditBinaryWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditBinaryWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditBinaryWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditBinaryWidget.prototype.execute = function() {\n\t// Construct the child widgets\n\tthis.makeChildWidgets([{\n\t\ttype: \"transclude\",\n\t\tattributes: {\n\t\t\ttiddler: {type: \"string\", value: BINARY_WARNING_MESSAGE}\n\t\t}\n\t}]);\n};\n\n/*\nRefresh by refreshing our child widget\n*/\nEditBinaryWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports[\"edit-binary\"] = EditBinaryWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/edit-binary.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-bitmap.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-bitmap.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-bitmap widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Default image sizes\nvar DEFAULT_IMAGE_WIDTH = 600,\n\tDEFAULT_IMAGE_HEIGHT = 370;\n\n// Configuration tiddlers\nvar LINE_WIDTH_TITLE = \"$:/config/BitmapEditor/LineWidth\",\n\tLINE_COLOUR_TITLE = \"$:/config/BitmapEditor/Colour\",\n\tLINE_OPACITY_TITLE = \"$:/config/BitmapEditor/Opacity\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditBitmapWidget = function(parseTreeNode,options) {\n\t// Initialise the editor operations if they've not been done already\n\tif(!this.editorOperations) {\n\t\tEditBitmapWidget.prototype.editorOperations = {};\n\t\t$tw.modules.applyMethods(\"bitmapeditoroperation\",this.editorOperations);\n\t}\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditBitmapWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditBitmapWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create the wrapper for the toolbar and render its content\n\tthis.toolbarNode = this.document.createElement(\"div\");\n\tthis.toolbarNode.className = \"tc-editor-toolbar\";\n\tparent.insertBefore(this.toolbarNode,nextSibling);\n\tthis.domNodes.push(this.toolbarNode);\n\t// Create the on-screen canvas\n\tthis.canvasDomNode = $tw.utils.domMaker(\"canvas\",{\n\t\tdocument: this.document,\n\t\t\"class\":\"tc-edit-bitmapeditor\",\n\t\teventListeners: [{\n\t\t\tname: \"touchstart\", handlerObject: this, handlerMethod: \"handleTouchStartEvent\"\n\t\t},{\n\t\t\tname: \"touchmove\", handlerObject: this, handlerMethod: \"handleTouchMoveEvent\"\n\t\t},{\n\t\t\tname: \"touchend\", handlerObject: this, handlerMethod: \"handleTouchEndEvent\"\n\t\t},{\n\t\t\tname: \"mousedown\", handlerObject: this, handlerMethod: \"handleMouseDownEvent\"\n\t\t},{\n\t\t\tname: \"mousemove\", handlerObject: this, handlerMethod: \"handleMouseMoveEvent\"\n\t\t},{\n\t\t\tname: \"mouseup\", handlerObject: this, handlerMethod: \"handleMouseUpEvent\"\n\t\t}]\n\t});\n\t// Set the width and height variables\n\tthis.setVariable(\"tv-bitmap-editor-width\",this.canvasDomNode.width + \"px\");\n\tthis.setVariable(\"tv-bitmap-editor-height\",this.canvasDomNode.height + \"px\");\n\t// Render toolbar child widgets\n\tthis.renderChildren(this.toolbarNode,null);\n\t// // Insert the elements into the DOM\n\tparent.insertBefore(this.canvasDomNode,nextSibling);\n\tthis.domNodes.push(this.canvasDomNode);\n\t// Load the image into the canvas\n\tif($tw.browser) {\n\t\tthis.loadCanvas();\n\t}\n\t// Add widget message listeners\n\tthis.addEventListeners([\n\t\t{type: \"tm-edit-bitmap-operation\", handler: \"handleEditBitmapOperationMessage\"}\n\t]);\n};\n\n/*\nHandle an edit bitmap operation message from the toolbar\n*/\nEditBitmapWidget.prototype.handleEditBitmapOperationMessage = function(event) {\n\t// Invoke the handler\n\tvar handler = this.editorOperations[event.param];\n\tif(handler) {\n\t\thandler.call(this,event);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditBitmapWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nJust refresh the toolbar\n*/\nEditBitmapWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nSet the bitmap size variables and refresh the toolbar\n*/\nEditBitmapWidget.prototype.refreshToolbar = function() {\n\t// Set the width and height variables\n\tthis.setVariable(\"tv-bitmap-editor-width\",this.canvasDomNode.width + \"px\");\n\tthis.setVariable(\"tv-bitmap-editor-height\",this.canvasDomNode.height + \"px\");\n\t// Refresh each of our child widgets\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\tchildWidget.refreshSelf();\n\t});\n};\n\nEditBitmapWidget.prototype.loadCanvas = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle),\n\t\tcurrImage = new Image();\n\t// Set up event handlers for loading the image\n\tvar self = this;\n\tcurrImage.onload = function() {\n\t\t// Copy the image to the on-screen canvas\n\t\tself.initCanvas(self.canvasDomNode,currImage.width,currImage.height,currImage);\n\t\t// And also copy the current bitmap to the off-screen canvas\n\t\tself.currCanvas = self.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage);\n\t\t// Set the width and height input boxes\n\t\tself.refreshToolbar();\n\t};\n\tcurrImage.onerror = function() {\n\t\t// Set the on-screen canvas size and clear it\n\t\tself.initCanvas(self.canvasDomNode,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the off-screen canvas size and clear it\n\t\tself.currCanvas = self.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the width and height input boxes\n\t\tself.refreshToolbar();\n\t};\n\t// Get the current bitmap into an image object\n\tcurrImage.src = \"data:\" + tiddler.fields.type + \";base64,\" + tiddler.fields.text;\n};\n\nEditBitmapWidget.prototype.initCanvas = function(canvas,width,height,image) {\n\tcanvas.width = width;\n\tcanvas.height = height;\n\tvar ctx = canvas.getContext(\"2d\");\n\tif(image) {\n\t\tctx.drawImage(image,0,0);\n\t} else {\n\t\tctx.fillStyle = \"#fff\";\n\t\tctx.fillRect(0,0,canvas.width,canvas.height);\n\t}\n};\n\n/*\n** Change the size of the canvas, preserving the current image\n*/\nEditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) {\n\t// Create and size a new canvas\n\tvar newCanvas = this.document.createElement(\"canvas\");\n\tthis.initCanvas(newCanvas,newWidth,newHeight);\n\t// Copy the old image\n\tvar ctx = newCanvas.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Set the new canvas as the current one\n\tthis.currCanvas = newCanvas;\n\t// Set the size of the onscreen canvas\n\tthis.canvasDomNode.width = newWidth;\n\tthis.canvasDomNode.height = newHeight;\n\t// Paint the onscreen canvas with the offscreen canvas\n\tctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\nEditBitmapWidget.prototype.handleTouchStartEvent = function(event) {\n\tthis.brushDown = true;\n\tthis.strokeStart(event.touches[0].clientX,event.touches[0].clientY);\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleTouchMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.touches[0].clientX,event.touches[0].clientY);\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleTouchEndEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleMouseDownEvent = function(event) {\n\tthis.strokeStart(event.clientX,event.clientY);\n\tthis.brushDown = true;\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleMouseMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.clientX,event.clientY);\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nEditBitmapWidget.prototype.handleMouseUpEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nEditBitmapWidget.prototype.adjustCoordinates = function(x,y) {\n\tvar canvasRect = this.canvasDomNode.getBoundingClientRect(),\n\t\tscale = this.canvasDomNode.width/canvasRect.width;\n\treturn {x: (x - canvasRect.left) * scale, y: (y - canvasRect.top) * scale};\n};\n\nEditBitmapWidget.prototype.strokeStart = function(x,y) {\n\t// Start off a new stroke\n\tthis.stroke = [this.adjustCoordinates(x,y)];\n};\n\nEditBitmapWidget.prototype.strokeMove = function(x,y) {\n\tvar ctx = this.canvasDomNode.getContext(\"2d\"),\n\t\tt;\n\t// Add the new position to the end of the stroke\n\tthis.stroke.push(this.adjustCoordinates(x,y));\n\t// Redraw the previous image\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Render the stroke\n\tctx.globalAlpha = parseFloat(this.wiki.getTiddlerText(LINE_OPACITY_TITLE,\"1.0\"));\n\tctx.strokeStyle = this.wiki.getTiddlerText(LINE_COLOUR_TITLE,\"#ff0\");\n\tctx.lineWidth = parseFloat(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,\"3\"));\n\tctx.lineCap = \"round\";\n\tctx.lineJoin = \"round\";\n\tctx.beginPath();\n\tctx.moveTo(this.stroke[0].x,this.stroke[0].y);\n\tfor(t=1; t<this.stroke.length-1; t++) {\n\t\tvar s1 = this.stroke[t],\n\t\t\ts2 = this.stroke[t-1],\n\t\t\ttx = (s1.x + s2.x)/2,\n\t\t\tty = (s1.y + s2.y)/2;\n\t\tctx.quadraticCurveTo(s2.x,s2.y,tx,ty);\n\t}\n\tctx.stroke();\n};\n\nEditBitmapWidget.prototype.strokeEnd = function() {\n\t// Copy the bitmap to the off-screen canvas\n\tvar ctx = this.currCanvas.getContext(\"2d\");\n\tctx.drawImage(this.canvasDomNode,0,0);\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\nEditBitmapWidget.prototype.saveChanges = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\tif(tiddler) {\n\t\t// data URIs look like \"data:<type>;base64,<text>\"\n\t\tvar dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type),\n\t\t\tposColon = dataURL.indexOf(\":\"),\n\t\t\tposSemiColon = dataURL.indexOf(\";\"),\n\t\t\tposComma = dataURL.indexOf(\",\"),\n\t\t\ttype = dataURL.substring(posColon+1,posSemiColon),\n\t\t\ttext = dataURL.substring(posComma+1);\n\t\tvar update = {type: type, text: text};\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getModificationFields(),tiddler,update,this.wiki.getCreationFields()));\n\t}\n};\n\nexports[\"edit-bitmap\"] = EditBitmapWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/edit-bitmap.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-shortcut.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-shortcut.js\ntype: application/javascript\nmodule-type: widget\n\nWidget to display an editable keyboard shortcut\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditShortcutWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditShortcutWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditShortcutWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.inputNode = this.document.createElement(\"input\");\n\t// Assign classes\n\tif(this.shortcutClass) {\n\t\tthis.inputNode.className = this.shortcutClass;\t\t\n\t}\n\t// Assign other attributes\n\tif(this.shortcutStyle) {\n\t\tthis.inputNode.setAttribute(\"style\",this.shortcutStyle);\n\t}\n\tif(this.shortcutTooltip) {\n\t\tthis.inputNode.setAttribute(\"title\",this.shortcutTooltip);\n\t}\n\tif(this.shortcutPlaceholder) {\n\t\tthis.inputNode.setAttribute(\"placeholder\",this.shortcutPlaceholder);\n\t}\n\tif(this.shortcutAriaLabel) {\n\t\tthis.inputNode.setAttribute(\"aria-label\",this.shortcutAriaLabel);\n\t}\n\t// Assign the current shortcut\n\tthis.updateInputNode();\n\t// Add event handlers\n\t$tw.utils.addEventListeners(this.inputNode,[\n\t\t{name: \"keydown\", handlerObject: this, handlerMethod: \"handleKeydownEvent\"}\n\t]);\n\t// Link into the DOM\n\tparent.insertBefore(this.inputNode,nextSibling);\n\tthis.domNodes.push(this.inputNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditShortcutWidget.prototype.execute = function() {\n\tthis.shortcutTiddler = this.getAttribute(\"tiddler\");\n\tthis.shortcutField = this.getAttribute(\"field\");\n\tthis.shortcutIndex = this.getAttribute(\"index\");\n\tthis.shortcutPlaceholder = this.getAttribute(\"placeholder\");\n\tthis.shortcutDefault = this.getAttribute(\"default\",\"\");\n\tthis.shortcutClass = this.getAttribute(\"class\");\n\tthis.shortcutStyle = this.getAttribute(\"style\");\n\tthis.shortcutTooltip = this.getAttribute(\"tooltip\");\n\tthis.shortcutAriaLabel = this.getAttribute(\"aria-label\");\n};\n\n/*\nUpdate the value of the input node\n*/\nEditShortcutWidget.prototype.updateInputNode = function() {\n\tif(this.shortcutField) {\n\t\tvar tiddler = this.wiki.getTiddler(this.shortcutTiddler);\n\t\tif(tiddler && $tw.utils.hop(tiddler.fields,this.shortcutField)) {\n\t\t\tthis.inputNode.value = tiddler.getFieldString(this.shortcutField);\n\t\t} else {\n\t\t\tthis.inputNode.value = this.shortcutDefault;\n\t\t}\n\t} else if(this.shortcutIndex) {\n\t\tthis.inputNode.value = this.wiki.extractTiddlerDataItem(this.shortcutTiddler,this.shortcutIndex,this.shortcutDefault);\n\t} else {\n\t\tthis.inputNode.value = this.wiki.getTiddlerText(this.shortcutTiddler,this.shortcutDefault);\n\t}\n};\n\n/*\nHandle a dom \"keydown\" event\n*/\nEditShortcutWidget.prototype.handleKeydownEvent = function(event) {\n\t// Ignore shift, ctrl, meta, alt\n\tif(event.keyCode && $tw.keyboardManager.getModifierKeys().indexOf(event.keyCode) === -1) {\n\t\t// Get the shortcut text representation\n\t\tvar value = $tw.keyboardManager.getPrintableShortcuts([{\n\t\t\tctrlKey: event.ctrlKey,\n\t\t\tshiftKey: event.shiftKey,\n\t\t\taltKey: event.altKey,\n\t\t\tmetaKey: event.metaKey,\n\t\t\tkeyCode: event.keyCode\n\t\t}]);\n\t\tif(value.length > 0) {\n\t\t\tthis.wiki.setText(this.shortcutTiddler,this.shortcutField,this.shortcutIndex,value[0]);\n\t\t}\n\t\t// Ignore the keydown if it was already handled\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn true;\t\t\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget needed re-rendering\n*/\nEditShortcutWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes[\"default\"] || changedAttributes[\"class\"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes[\"aria-label\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedTiddlers[this.shortcutTiddler]) {\n\t\tthis.updateInputNode();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports[\"edit-shortcut\"] = EditShortcutWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/edit-shortcut.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-text.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-text.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-text widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar editTextWidgetFactory = require(\"$:/core/modules/editor/factory.js\").editTextWidgetFactory,\n\tFramedEngine = require(\"$:/core/modules/editor/engines/framed.js\").FramedEngine,\n\tSimpleEngine = require(\"$:/core/modules/editor/engines/simple.js\").SimpleEngine;\n\nexports[\"edit-text\"] = editTextWidgetFactory(FramedEngine,SimpleEngine);\n\n})();\n",
"title": "$:/core/modules/widgets/edit-text.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit.js\ntype: application/javascript\nmodule-type: widget\n\nEdit widget is a meta-widget chooses the appropriate actual editting widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n// Mappings from content type to editor type are stored in tiddlers with this prefix\nvar EDITOR_MAPPING_PREFIX = \"$:/config/EditorTypeMappings/\";\n\n/*\nCompute the internal state of the widget\n*/\nEditWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.editField = this.getAttribute(\"field\",\"text\");\n\tthis.editIndex = this.getAttribute(\"index\");\n\tthis.editClass = this.getAttribute(\"class\");\n\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\t// Choose the appropriate edit widget\n\tthis.editorType = this.getEditorType();\n\t// Make the child widgets\n\tthis.makeChildWidgets([{\n\t\ttype: \"edit-\" + this.editorType,\n\t\tattributes: {\n\t\t\ttiddler: {type: \"string\", value: this.editTitle},\n\t\t\tfield: {type: \"string\", value: this.editField},\n\t\t\tindex: {type: \"string\", value: this.editIndex},\n\t\t\t\"class\": {type: \"string\", value: this.editClass},\n\t\t\t\"placeholder\": {type: \"string\", value: this.editPlaceholder}\n\t\t},\n\t\tchildren: this.parseTreeNode.children\n\t}]);\n};\n\nEditWidget.prototype.getEditorType = function() {\n\t// Get the content type of the thing we're editing\n\tvar type;\n\tif(this.editField === \"text\") {\n\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\tif(tiddler) {\n\t\t\ttype = tiddler.fields.type;\n\t\t}\n\t}\n\ttype = type || \"text/vnd.tiddlywiki\";\n\tvar editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type);\n\tif(!editorType) {\n\t\tvar typeInfo = $tw.config.contentTypeInfo[type];\n\t\tif(typeInfo && typeInfo.encoding === \"base64\") {\n\t\t\teditorType = \"binary\";\n\t\t} else {\n\t\t\teditorType = \"text\";\n\t\t}\n\t}\n\treturn editorType;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEditWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Refresh if an attribute has changed, or the type associated with the target tiddler has changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.edit = EditWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/edit.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/element.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/element.js\ntype: application/javascript\nmodule-type: widget\n\nElement widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ElementWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nElementWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nElementWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Neuter blacklisted elements\n\tvar tag = this.parseTreeNode.tag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"safe-\" + tag;\n\t}\n\tvar domNode = this.document.createElementNS(this.namespace,tag);\n\tthis.assignAttributes(domNode,{excludeEventAttributes: true});\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nElementWidget.prototype.execute = function() {\n\t// Select the namespace for the tag\n\tvar tagNamespaces = {\n\t\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\t\tmath: \"http://www.w3.org/1998/Math/MathML\",\n\t\t\tbody: \"http://www.w3.org/1999/xhtml\"\n\t\t};\n\tthis.namespace = tagNamespaces[this.parseTreeNode.tag];\n\tif(this.namespace) {\n\t\tthis.setVariable(\"namespace\",this.namespace);\n\t} else {\n\t\tthis.namespace = this.getVariable(\"namespace\",{defaultValue: \"http://www.w3.org/1999/xhtml\"});\n\t}\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nElementWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\thasChangedAttributes = $tw.utils.count(changedAttributes) > 0;\n\tif(hasChangedAttributes) {\n\t\t// Update our attributes\n\t\tthis.assignAttributes(this.domNodes[0],{excludeEventAttributes: true});\n\t}\n\treturn this.refreshChildren(changedTiddlers) || hasChangedAttributes;\n};\n\nexports.element = ElementWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/element.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/encrypt.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/encrypt.js\ntype: application/javascript\nmodule-type: widget\n\nEncrypt widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EncryptWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEncryptWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEncryptWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.encryptedText);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEncryptWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\",\"[!is[system]]\");\n\t// Encrypt the filtered tiddlers\n\tvar tiddlers = this.wiki.filterTiddlers(this.filter),\n\t\tjson = {},\n\t\tself = this;\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.wiki.getTiddler(title),\n\t\t\tjsonTiddler = {};\n\t\tfor(var f in tiddler.fields) {\n\t\t\tjsonTiddler[f] = tiddler.getFieldString(f);\n\t\t}\n\t\tjson[title] = jsonTiddler;\n\t});\n\tthis.encryptedText = $tw.utils.htmlEncode($tw.crypto.encrypt(JSON.stringify(json)));\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEncryptWidget.prototype.refresh = function(changedTiddlers) {\n\t// We don't need to worry about refreshing because the encrypt widget isn't for interactive use\n\treturn false;\n};\n\nexports.encrypt = EncryptWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/encrypt.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/entity.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/entity.js\ntype: application/javascript\nmodule-type: widget\n\nHTML entity widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EntityWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEntityWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEntityWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar entityString = this.getAttribute(\"entity\",this.parseTreeNode.entity || \"\"),\n\t\ttextNode = this.document.createTextNode($tw.utils.entityDecode(entityString));\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEntityWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEntityWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.entity) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports.entity = EntityWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/entity.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fieldmangler.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fieldmangler.js\ntype: application/javascript\nmodule-type: widget\n\nField mangler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldManglerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tm-remove-field\", handler: \"handleRemoveFieldEvent\"},\n\t\t{type: \"tm-add-field\", handler: \"handleAddFieldEvent\"},\n\t\t{type: \"tm-remove-tag\", handler: \"handleRemoveTagEvent\"},\n\t\t{type: \"tm-add-tag\", handler: \"handleAddTagEvent\"}\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldManglerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldManglerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldManglerWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.mangleTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldManglerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nFieldManglerWidget.prototype.handleRemoveFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\tdeletion = {};\n\tdeletion[event.param] = undefined;\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,deletion));\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleAddFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\taddition = this.wiki.getModificationFields(),\n\t\thadInvalidFieldName = false,\n\t\taddField = function(name,value) {\n\t\t\tvar trimmedName = name.toLowerCase().trim();\n\t\t\tif(!$tw.utils.isValidFieldName(trimmedName)) {\n\t\t\t\tif(!hadInvalidFieldName) {\n\t\t\t\t\talert($tw.language.getString(\n\t\t\t\t\t\t\"InvalidFieldName\",\n\t\t\t\t\t\t{variables:\n\t\t\t\t\t\t\t{fieldName: trimmedName}\n\t\t\t\t\t\t}\n\t\t\t\t\t));\n\t\t\t\t\thadInvalidFieldName = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif(!value && tiddler) {\n\t\t\t\t\tvalue = tiddler.fields[trimmedName];\n\t\t\t\t}\n\t\t\t\taddition[trimmedName] = value || \"\";\n\t\t\t}\n\t\t\treturn;\n\t\t};\n\taddition.title = this.mangleTitle;\n\tif(typeof event.param === \"string\") {\n\t\taddField(event.param,\"\");\n\t}\n\tif(typeof event.paramObject === \"object\") {\n\t\tfor(var name in event.paramObject) {\n\t\t\taddField(name,event.paramObject[name]);\n\t\t}\n\t}\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler && tiddler.fields.tags) {\n\t\tvar p = tiddler.fields.tags.indexOf(event.param);\n\t\tif(p !== -1) {\n\t\t\tvar modification = this.wiki.getModificationFields();\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\tmodification.tags.splice(p,1);\n\t\t\tif(modification.tags.length === 0) {\n\t\t\t\tmodification.tags = undefined;\n\t\t\t}\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t\t}\n\t}\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleAddTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler && typeof event.param === \"string\") {\n\t\tvar tag = event.param.trim();\n\t\tif(tag !== \"\") {\n\t\t\tvar modification = this.wiki.getModificationFields();\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\t$tw.utils.pushTop(modification.tags,tag);\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\t\t\t\n\t\t}\n\t} else if(typeof event.param === \"string\" && event.param.trim() !== \"\" && this.mangleTitle.trim() !== \"\") {\n\t\tvar tag = [];\n\t\ttag.push(event.param.trim());\n\t\tthis.wiki.addTiddler({title: this.mangleTitle, tags: tag});\t\t\n\t}\n\treturn true;\n};\n\nexports.fieldmangler = FieldManglerWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fieldmangler.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fields.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fields.js\ntype: application/javascript\nmodule-type: widget\n\nFields widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldsWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldsWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldsWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldsWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.template = this.getAttribute(\"template\");\n\tthis.exclude = this.getAttribute(\"exclude\");\n\tthis.stripTitlePrefix = this.getAttribute(\"stripTitlePrefix\",\"no\") === \"yes\";\n\t// Get the value to display\n\tvar tiddler = this.wiki.getTiddler(this.tiddlerTitle);\n\t// Get the exclusion list\n\tvar exclude;\n\tif(this.exclude) {\n\t\texclude = this.exclude.split(\" \");\n\t} else {\n\t\texclude = [\"text\"]; \n\t}\n\t// Compose the template\n\tvar text = [];\n\tif(this.template && tiddler) {\n\t\tvar fields = [];\n\t\tfor(var fieldName in tiddler.fields) {\n\t\t\tif(exclude.indexOf(fieldName) === -1) {\n\t\t\t\tfields.push(fieldName);\n\t\t\t}\n\t\t}\n\t\tfields.sort();\n\t\tfor(var f=0; f<fields.length; f++) {\n\t\t\tfieldName = fields[f];\n\t\t\tif(exclude.indexOf(fieldName) === -1) {\n\t\t\t\tvar row = this.template,\n\t\t\t\t\tvalue = tiddler.getFieldString(fieldName);\n\t\t\t\tif(this.stripTitlePrefix && fieldName === \"title\") {\n\t\t\t\t\tvar reStrip = /^\\{[^\\}]+\\}(.+)/mg,\n\t\t\t\t\t\treMatch = reStrip.exec(value);\n\t\t\t\t\tif(reMatch) {\n\t\t\t\t\t\tvalue = reMatch[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trow = $tw.utils.replaceString(row,\"$name$\",fieldName);\n\t\t\t\trow = $tw.utils.replaceString(row,\"$value$\",value);\n\t\t\t\trow = $tw.utils.replaceString(row,\"$encoded_value$\",$tw.utils.htmlEncode(value));\n\t\t\t\ttext.push(row);\n\t\t\t}\n\t\t}\n\t}\n\tthis.text = text.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.template || changedAttributes.exclude || changedAttributes.stripTitlePrefix || changedTiddlers[this.tiddlerTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports.fields = FieldsWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fields.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/image.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/image.js\ntype: application/javascript\nmodule-type: widget\n\nThe image widget displays an image referenced with an external URI or with a local tiddler title.\n\n```\n<$image src=\"TiddlerTitle\" width=\"320\" height=\"400\" class=\"classnames\">\n```\n\nThe image source can be the title of an existing tiddler or the URL of an external image.\n\nExternal images always generate an HTML `<img>` tag.\n\nTiddlers that have a _canonical_uri field generate an HTML `<img>` tag with the src attribute containing the URI.\n\nTiddlers that contain image data generate an HTML `<img>` tag with the src attribute containing a base64 representation of the image.\n\nTiddlers that contain wikitext could be rendered to a DIV of the usual size of a tiddler, and then transformed to the size requested.\n\nThe width and height attributes are interpreted as a number of pixels, and do not need to include the \"px\" suffix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ImageWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nImageWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nImageWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\t// Determine what type of image it is\n\tvar tag = \"img\", src = \"\",\n\t\ttiddler = this.wiki.getTiddler(this.imageSource);\n\tif(!tiddler) {\n\t\t// The source isn't the title of a tiddler, so we'll assume it's a URL\n\t\tsrc = this.getVariable(\"tv-get-export-image-link\",{params: [{name: \"src\",value: this.imageSource}],defaultValue: this.imageSource});\n\t} else {\n\t\t// Check if it is an image tiddler\n\t\tif(this.wiki.isImageTiddler(this.imageSource)) {\n\t\t\tvar type = tiddler.fields.type,\n\t\t\t\ttext = tiddler.fields.text,\n\t\t\t\t_canonical_uri = tiddler.fields._canonical_uri;\n\t\t\t// If the tiddler has body text then it doesn't need to be lazily loaded\n\t\t\tif(text) {\n\t\t\t\t// Render the appropriate element for the image type\n\t\t\t\tswitch(type) {\n\t\t\t\t\tcase \"application/pdf\":\n\t\t\t\t\t\ttag = \"embed\";\n\t\t\t\t\t\tsrc = \"data:application/pdf;base64,\" + text;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/svg+xml\":\n\t\t\t\t\t\tsrc = \"data:image/svg+xml,\" + encodeURIComponent(text);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tsrc = \"data:\" + type + \";base64,\" + text;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if(_canonical_uri) {\n\t\t\t\tswitch(type) {\n\t\t\t\t\tcase \"application/pdf\":\n\t\t\t\t\t\ttag = \"embed\";\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/svg+xml\":\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t} else {\n\t\t\t\t// Just trigger loading of the tiddler\n\t\t\t\tthis.wiki.getTiddlerText(this.imageSource);\n\t\t\t}\n\t\t}\n\t}\n\t// Create the element and assign the attributes\n\tvar domNode = this.document.createElement(tag);\n\tdomNode.setAttribute(\"src\",src);\n\tif(this.imageClass) {\n\t\tdomNode.setAttribute(\"class\",this.imageClass);\t\t\n\t}\n\tif(this.imageWidth) {\n\t\tdomNode.setAttribute(\"width\",this.imageWidth);\n\t}\n\tif(this.imageHeight) {\n\t\tdomNode.setAttribute(\"height\",this.imageHeight);\n\t}\n\tif(this.imageTooltip) {\n\t\tdomNode.setAttribute(\"title\",this.imageTooltip);\t\t\n\t}\n\tif(this.imageAlt) {\n\t\tdomNode.setAttribute(\"alt\",this.imageAlt);\t\t\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nImageWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.imageSource = this.getAttribute(\"source\");\n\tthis.imageWidth = this.getAttribute(\"width\");\n\tthis.imageHeight = this.getAttribute(\"height\");\n\tthis.imageClass = this.getAttribute(\"class\");\n\tthis.imageTooltip = this.getAttribute(\"tooltip\");\n\tthis.imageAlt = this.getAttribute(\"alt\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nImageWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes[\"class\"] || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\t\n\t}\n};\n\nexports.image = ImageWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/image.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/importvariables.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/importvariables.js\ntype: application/javascript\nmodule-type: widget\n\nImport variable definitions from other tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ImportVariablesWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nImportVariablesWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nImportVariablesWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nImportVariablesWidget.prototype.execute = function(tiddlerList) {\n\tvar self = this;\n\t// Get our parameters\n\tthis.filter = this.getAttribute(\"filter\");\n\t// Compute the filter\n\tthis.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);\n\t// Accumulate the <$set> widgets from each tiddler\n\tvar widgetStackStart,widgetStackEnd;\n\tfunction addWidgetNode(widgetNode) {\n\t\tif(widgetNode) {\n\t\t\tif(!widgetStackStart && !widgetStackEnd) {\n\t\t\t\twidgetStackStart = widgetNode;\n\t\t\t\twidgetStackEnd = widgetNode;\n\t\t\t} else {\n\t\t\t\twidgetStackEnd.children = [widgetNode];\n\t\t\t\twidgetStackEnd = widgetNode;\n\t\t\t}\n\t\t}\n\t}\n\t$tw.utils.each(this.tiddlerList,function(title) {\n\t\tvar parser = self.wiki.parseTiddler(title);\n\t\tif(parser) {\n\t\t\tvar parseTreeNode = parser.tree[0];\n\t\t\twhile(parseTreeNode && parseTreeNode.type === \"set\") {\n\t\t\t\taddWidgetNode({\n\t\t\t\t\ttype: \"set\",\n\t\t\t\t\tattributes: parseTreeNode.attributes,\n\t\t\t\t\tparams: parseTreeNode.params\n\t\t\t\t});\n\t\t\t\tparseTreeNode = parseTreeNode.children[0];\n\t\t\t}\n\t\t} \n\t});\n\t// Add our own children to the end of the pile\n\tvar parseTreeNodes;\n\tif(widgetStackStart && widgetStackEnd) {\n\t\tparseTreeNodes = [widgetStackStart];\n\t\twidgetStackEnd.children = this.parseTreeNode.children;\n\t} else {\n\t\tparseTreeNodes = this.parseTreeNode.children;\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nImportVariablesWidget.prototype.refresh = function(changedTiddlers) {\n\t// Recompute our attributes and the filter list\n\tvar changedAttributes = this.computeAttributes(),\n\t\ttiddlerList = this.wiki.filterTiddlers(this.getAttribute(\"filter\"),this);\n\t// Refresh if the filter has changed, or the list of tiddlers has changed, or any of the tiddlers in the list has changed\n\tfunction haveListedTiddlersChanged() {\n\t\tvar changed = false;\n\t\ttiddlerList.forEach(function(title) {\n\t\t\tif(changedTiddlers[title]) {\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t});\n\t\treturn changed;\n\t}\n\tif(changedAttributes.filter || !$tw.utils.isArrayEqual(this.tiddlerList,tiddlerList) || haveListedTiddlersChanged()) {\n\t\t// Compute the filter\n\t\tthis.removeChildDomNodes();\n\t\tthis.execute(tiddlerList);\n\t\tthis.renderChildren(this.parentDomNode,this.findNextSiblingDomNode());\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.importvariables = ImportVariablesWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/importvariables.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/keyboard.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/keyboard.js\ntype: application/javascript\nmodule-type: widget\n\nKeyboard shortcut widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar KeyboardWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nKeyboardWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nKeyboardWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.tag && $tw.config.htmlUnsafeElements.indexOf(this.tag) === -1) {\n\t\ttag = this.tag;\n\t}\n\t// Create element\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = (this[\"class\"] || \"\").split(\" \");\n\tclasses.push(\"tc-keyboard\");\n\tdomNode.className = classes.join(\" \");\n\t// Add a keyboard event handler\n\tdomNode.addEventListener(\"keydown\",function (event) {\n\t\tif($tw.keyboardManager.checkKeyDescriptors(event,self.keyInfoArray)) {\n\t\t\tself.invokeActions(self,event);\n\t\t\tif(self.actions) {\n\t\t\t\tself.invokeActionString(self.actions,self,event);\n\t\t\t}\n\t\t\tself.dispatchMessage(event);\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nKeyboardWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\"currentTiddler\")});\n};\n\n/*\nCompute the internal state of the widget\n*/\nKeyboardWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.actions = this.getAttribute(\"actions\");\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.key = this.getAttribute(\"key\");\n\tthis.tag = this.getAttribute(\"tag\");\n\tthis.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);\n\tthis[\"class\"] = this.getAttribute(\"class\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nKeyboardWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.message || changedAttributes.param || changedAttributes.key || changedAttributes[\"class\"] || changedAttributes.tag) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.keyboard = KeyboardWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/keyboard.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/link.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/link.js\ntype: application/javascript\nmodule-type: widget\n\nLink widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\nvar MISSING_LINK_CONFIG_TITLE = \"$:/config/MissingLinks\";\n\nvar LinkWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the value of the tv-wikilinks configuration macro\n\tvar wikiLinksMacro = this.getVariable(\"tv-wikilinks\"),\n\t\tuseWikiLinks = wikiLinksMacro ? (wikiLinksMacro.trim() !== \"no\") : true,\n\t\tmissingLinksEnabled = !(this.hideMissingLinks && this.isMissing && !this.isShadow);\n\t// Render the link if required\n\tif(useWikiLinks && missingLinksEnabled) {\n\t\tthis.renderLink(parent,nextSibling);\n\t} else {\n\t\t// Just insert the link text\n\t\tvar domNode = this.document.createElement(\"span\");\n\t\tparent.insertBefore(domNode,nextSibling);\n\t\tthis.renderChildren(domNode,null);\n\t\tthis.domNodes.push(domNode);\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.renderLink = function(parent,nextSibling) {\n\tvar self = this;\n\t// Sanitise the specified tag\n\tvar tag = this.linkTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"a\";\n\t}\n\t// Create our element\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = [];\n\tif(this.linkClasses) {\n\t\tclasses.push(this.linkClasses);\n\t}\n\tclasses.push(\"tc-tiddlylink\");\n\tif(this.isShadow) {\n\t\tclasses.push(\"tc-tiddlylink-shadow\");\n\t}\n\tif(this.isMissing && !this.isShadow) {\n\t\tclasses.push(\"tc-tiddlylink-missing\");\n\t} else {\n\t\tif(!this.isMissing) {\n\t\t\tclasses.push(\"tc-tiddlylink-resolves\");\n\t\t}\n\t}\n\tdomNode.setAttribute(\"class\",classes.join(\" \"));\n\t// Set an href\n\tvar wikiLinkTemplateMacro = this.getVariable(\"tv-wikilink-template\"),\n\t\twikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : \"#$uri_encoded$\",\n\t\twikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,\"$uri_encoded$\",encodeURIComponent(this.to));\n\twikiLinkText = $tw.utils.replaceString(wikiLinkText,\"$uri_doubleencoded$\",encodeURIComponent(encodeURIComponent(this.to)));\n\twikiLinkText = this.getVariable(\"tv-get-export-link\",{params: [{name: \"to\",value: this.to}],defaultValue: wikiLinkText});\n\tif(tag === \"a\") {\n\t\tdomNode.setAttribute(\"href\",wikiLinkText);\n\t}\n\tif(this.tabIndex) {\n\t\tdomNode.setAttribute(\"tabindex\",this.tabIndex);\n\t}\n\t// Set the tooltip\n\t// HACK: Performance issues with re-parsing the tooltip prevent us defaulting the tooltip to \"<$transclude field='tooltip'><$transclude field='title'/></$transclude>\"\n\tvar tooltipWikiText = this.tooltip || this.getVariable(\"tv-wikilink-tooltip\");\n\tif(tooltipWikiText) {\n\t\tvar tooltipText = this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",tooltipWikiText,{\n\t\t\t\tparseAsInline: true,\n\t\t\t\tvariables: {\n\t\t\t\t\tcurrentTiddler: this.to\n\t\t\t\t},\n\t\t\t\tparentWidget: this\n\t\t\t});\n\t\tdomNode.setAttribute(\"title\",tooltipText);\n\t}\n\tif(this[\"aria-label\"]) {\n\t\tdomNode.setAttribute(\"aria-label\",this[\"aria-label\"]);\n\t}\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"click\", handlerObject: this, handlerMethod: \"handleClickEvent\"},\n\t]);\n\t// Make the link draggable if required\n\tif(this.draggable === \"yes\") {\n\t\t$tw.utils.makeDraggable({\n\t\t\tdomNode: domNode,\n\t\t\tdragTiddlerFn: function() {return self.to;},\n\t\t\twidget: this\n\t\t});\n\t}\n\t// Insert the link into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nLinkWidget.prototype.handleClickEvent = function(event) {\n\t// Send the click on its way as a navigate event\n\tvar bounds = this.domNodes[0].getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: this,\n\t\tnavigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1)\n\t});\n\tif(this.domNodes[0].hasAttribute(\"href\")) {\n\t\tevent.preventDefault();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkWidget.prototype.execute = function() {\n\t// Pick up our attributes\n\tthis.to = this.getAttribute(\"to\",this.getVariable(\"currentTiddler\"));\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis[\"aria-label\"] = this.getAttribute(\"aria-label\");\n\tthis.linkClasses = this.getAttribute(\"class\");\n\tthis.tabIndex = this.getAttribute(\"tabindex\");\n\tthis.draggable = this.getAttribute(\"draggable\",\"yes\");\n\tthis.linkTag = this.getAttribute(\"tag\",\"a\");\n\t// Determine the link characteristics\n\tthis.isMissing = !this.wiki.tiddlerExists(this.to);\n\tthis.isShadow = this.wiki.isShadowTiddler(this.to);\n\tthis.hideMissingLinks = ($tw.wiki.getTiddlerText(MISSING_LINK_CONFIG_TITLE,\"yes\") === \"no\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedTiddlers[this.to] || changedAttributes[\"aria-label\"] || changedAttributes.tooltip || changedTiddlers[MISSING_LINK_CONFIG_TITLE]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.link = LinkWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/link.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/linkcatcher.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/linkcatcher.js\ntype: application/javascript\nmodule-type: widget\n\nLinkcatcher widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LinkCatcherWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tm-navigate\", handler: \"handleNavigateEvent\"}\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkCatcherWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkCatcherWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkCatcherWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.catchTo = this.getAttribute(\"to\");\n\tthis.catchMessage = this.getAttribute(\"message\");\n\tthis.catchSet = this.getAttribute(\"set\");\n\tthis.catchSetTo = this.getAttribute(\"setTo\");\n\tthis.catchActions = this.getAttribute(\"actions\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkCatcherWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedAttributes.message || changedAttributes.set || changedAttributes.setTo) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\n/*\nHandle a tm-navigate event\n*/\nLinkCatcherWidget.prototype.handleNavigateEvent = function(event) {\n\tif(this.catchTo) {\n\t\tthis.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable(\"currentTiddler\"));\n\t}\n\tif(this.catchMessage && this.parentWidget) {\n\t\tthis.parentWidget.dispatchEvent({\n\t\t\ttype: this.catchMessage,\n\t\t\tparam: event.navigateTo,\n\t\t\tnavigateTo: event.navigateTo\n\t\t});\n\t}\n\tif(this.catchSet) {\n\t\tvar tiddler = this.wiki.getTiddler(this.catchSet);\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo}));\n\t}\n\tif(this.catchActions) {\n\t\tthis.invokeActionString(this.catchActions,this);\n\t}\n\treturn false;\n};\n\nexports.linkcatcher = LinkCatcherWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/linkcatcher.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/list.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list.js\ntype: application/javascript\nmodule-type: widget\n\nList and list item widgets\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\n/*\nThe list widget creates list element sub-widgets that reach back into the list widget for their configuration\n*/\n\nvar ListWidget = function(parseTreeNode,options) {\n\t// Initialise the storyviews if they've not been done already\n\tif(!this.storyViews) {\n\t\tListWidget.prototype.storyViews = {};\n\t\t$tw.modules.applyMethods(\"storyview\",this.storyViews);\n\t}\n\t// Main initialisation inherited from widget.js\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n\t// Construct the storyview\n\tvar StoryView = this.storyViews[this.storyViewName];\n\tif(this.storyViewName && !StoryView) {\n\t\tStoryView = this.storyViews[\"classic\"];\n\t}\n\tif(StoryView && !this.document.isTiddlyWikiFakeDom) {\n\t\tthis.storyview = new StoryView(this);\n\t} else {\n\t\tthis.storyview = null;\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nListWidget.prototype.execute = function() {\n\t// Get our attributes\n\tthis.template = this.getAttribute(\"template\");\n\tthis.editTemplate = this.getAttribute(\"editTemplate\");\n\tthis.variableName = this.getAttribute(\"variable\",\"currentTiddler\");\n\tthis.storyViewName = this.getAttribute(\"storyview\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\t// Compose the list elements\n\tthis.list = this.getTiddlerList();\n\tvar members = [],\n\t\tself = this;\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\tmembers = this.getEmptyMessage();\n\t} else {\n\t\t$tw.utils.each(this.list,function(title,index) {\n\t\t\tmembers.push(self.makeItemTemplate(title));\n\t\t});\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(members);\n\t// Clear the last history\n\tthis.history = [];\n};\n\nListWidget.prototype.getTiddlerList = function() {\n\tvar defaultFilter = \"[!is[system]sort[title]]\";\n\treturn this.wiki.filterTiddlers(this.getAttribute(\"filter\",defaultFilter),this);\n};\n\nListWidget.prototype.getEmptyMessage = function() {\n\tvar emptyMessage = this.getAttribute(\"emptyMessage\",\"\"),\n\t\tparser = this.wiki.parseText(\"text/vnd.tiddlywiki\",emptyMessage,{parseAsInline: true});\n\tif(parser) {\n\t\treturn parser.tree;\n\t} else {\n\t\treturn [];\n\t}\n};\n\n/*\nCompose the template for a list item\n*/\nListWidget.prototype.makeItemTemplate = function(title) {\n\t// Check if the tiddler is a draft\n\tvar tiddler = this.wiki.getTiddler(title),\n\t\tisDraft = tiddler && tiddler.hasField(\"draft.of\"),\n\t\ttemplate = this.template,\n\t\ttemplateTree;\n\tif(isDraft && this.editTemplate) {\n\t\ttemplate = this.editTemplate;\n\t}\n\t// Compose the transclusion of the template\n\tif(template) {\n\t\ttemplateTree = [{type: \"transclude\", attributes: {tiddler: {type: \"string\", value: template}}}];\n\t} else {\n\t\tif(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {\n\t\t\ttemplateTree = this.parseTreeNode.children;\n\t\t} else {\n\t\t\t// Default template is a link to the title\n\t\t\ttemplateTree = [{type: \"element\", tag: this.parseTreeNode.isBlock ? \"div\" : \"span\", children: [{type: \"link\", attributes: {to: {type: \"string\", value: title}}, children: [\n\t\t\t\t\t{type: \"text\", text: title}\n\t\t\t]}]}];\n\t\t}\n\t}\n\t// Return the list item\n\treturn {type: \"listitem\", itemTitle: title, variableName: this.variableName, children: templateTree};\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\tresult;\n\t// Call the storyview\n\tif(this.storyview && this.storyview.refreshStart) {\n\t\tthis.storyview.refreshStart(changedTiddlers,changedAttributes);\n\t}\n\t// Completely refresh if any of our attributes have changed\n\tif(changedAttributes.filter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\tresult = true;\n\t} else {\n\t\t// Handle any changes to the list\n\t\tresult = this.handleListChanges(changedTiddlers);\n\t\t// Handle any changes to the history stack\n\t\tif(this.historyTitle && changedTiddlers[this.historyTitle]) {\n\t\t\tthis.handleHistoryChanges();\n\t\t}\n\t}\n\t// Call the storyview\n\tif(this.storyview && this.storyview.refreshEnd) {\n\t\tthis.storyview.refreshEnd(changedTiddlers,changedAttributes);\n\t}\n\treturn result;\n};\n\n/*\nHandle any changes to the history list\n*/\nListWidget.prototype.handleHistoryChanges = function() {\n\t// Get the history data\n\tvar newHistory = this.wiki.getTiddlerDataCached(this.historyTitle,[]);\n\t// Ignore any entries of the history that match the previous history\n\tvar entry = 0;\n\twhile(entry < newHistory.length && entry < this.history.length && newHistory[entry].title === this.history[entry].title) {\n\t\tentry++;\n\t}\n\t// Navigate forwards to each of the new tiddlers\n\twhile(entry < newHistory.length) {\n\t\tif(this.storyview && this.storyview.navigateTo) {\n\t\t\tthis.storyview.navigateTo(newHistory[entry]);\n\t\t}\n\t\tentry++;\n\t}\n\t// Update the history\n\tthis.history = newHistory;\n};\n\n/*\nProcess any changes to the list\n*/\nListWidget.prototype.handleListChanges = function(changedTiddlers) {\n\t// Get the new list\n\tvar prevList = this.list;\n\tthis.list = this.getTiddlerList();\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\t// Check if it was empty before\n\t\tif(prevList.length === 0) {\n\t\t\t// If so, just refresh the empty message\n\t\t\treturn this.refreshChildren(changedTiddlers);\n\t\t} else {\n\t\t\t// Replace the previous content with the empty message\n\t\t\tfor(t=this.children.length-1; t>=0; t--) {\n\t\t\t\tthis.removeListItem(t);\n\t\t\t}\n\t\t\tvar nextSibling = this.findNextSiblingDomNode();\n\t\t\tthis.makeChildWidgets(this.getEmptyMessage());\n\t\t\tthis.renderChildren(this.parentDomNode,nextSibling);\n\t\t\treturn true;\n\t\t}\n\t} else {\n\t\t// If the list was empty then we need to remove the empty message\n\t\tif(prevList.length === 0) {\n\t\t\tthis.removeChildDomNodes();\n\t\t\tthis.children = [];\n\t\t}\n\t\t// Cycle through the list, inserting and removing list items as needed\n\t\tvar hasRefreshed = false;\n\t\tfor(var t=0; t<this.list.length; t++) {\n\t\t\tvar index = this.findListItem(t,this.list[t]);\n\t\t\tif(index === undefined) {\n\t\t\t\t// The list item must be inserted\n\t\t\t\tthis.insertListItem(t,this.list[t]);\n\t\t\t\thasRefreshed = true;\n\t\t\t} else {\n\t\t\t\t// There are intervening list items that must be removed\n\t\t\t\tfor(var n=index-1; n>=t; n--) {\n\t\t\t\t\tthis.removeListItem(n);\n\t\t\t\t\thasRefreshed = true;\n\t\t\t\t}\n\t\t\t\t// Refresh the item we're reusing\n\t\t\t\tvar refreshed = this.children[t].refresh(changedTiddlers);\n\t\t\t\thasRefreshed = hasRefreshed || refreshed;\n\t\t\t}\n\t\t}\n\t\t// Remove any left over items\n\t\tfor(t=this.children.length-1; t>=this.list.length; t--) {\n\t\t\tthis.removeListItem(t);\n\t\t\thasRefreshed = true;\n\t\t}\n\t\treturn hasRefreshed;\n\t}\n};\n\n/*\nFind the list item with a given title, starting from a specified position\n*/\nListWidget.prototype.findListItem = function(startIndex,title) {\n\twhile(startIndex < this.children.length) {\n\t\tif(this.children[startIndex].parseTreeNode.itemTitle === title) {\n\t\t\treturn startIndex;\n\t\t}\n\t\tstartIndex++;\n\t}\n\treturn undefined;\n};\n\n/*\nInsert a new list item at the specified index\n*/\nListWidget.prototype.insertListItem = function(index,title) {\n\t// Create, insert and render the new child widgets\n\tvar widget = this.makeChildWidget(this.makeItemTemplate(title));\n\twidget.parentDomNode = this.parentDomNode; // Hack to enable findNextSiblingDomNode() to work\n\tthis.children.splice(index,0,widget);\n\tvar nextSibling = widget.findNextSiblingDomNode();\n\twidget.render(this.parentDomNode,nextSibling);\n\t// Animate the insertion if required\n\tif(this.storyview && this.storyview.insert) {\n\t\tthis.storyview.insert(widget);\n\t}\n\treturn true;\n};\n\n/*\nRemove the specified list item\n*/\nListWidget.prototype.removeListItem = function(index) {\n\tvar widget = this.children[index];\n\t// Animate the removal if required\n\tif(this.storyview && this.storyview.remove) {\n\t\tthis.storyview.remove(widget);\n\t} else {\n\t\twidget.removeChildDomNodes();\n\t}\n\t// Remove the child widget\n\tthis.children.splice(index,1);\n};\n\nexports.list = ListWidget;\n\nvar ListItemWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListItemWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListItemWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nListItemWidget.prototype.execute = function() {\n\t// Set the current list item title\n\tthis.setVariable(this.parseTreeNode.variableName,this.parseTreeNode.itemTitle);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListItemWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.listitem = ListItemWidget;\n\n})();",
"title": "$:/core/modules/widgets/list.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/macrocall.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/macrocall.js\ntype: application/javascript\nmodule-type: widget\n\nMacrocall widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar MacroCallWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nMacroCallWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nMacroCallWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nMacroCallWidget.prototype.execute = function() {\n\t// Get the parse type if specified\n\tthis.parseType = this.getAttribute(\"$type\",\"text/vnd.tiddlywiki\");\n\tthis.renderOutput = this.getAttribute(\"$output\",\"text/html\");\n\t// Merge together the parameters specified in the parse tree with the specified attributes\n\tvar params = this.parseTreeNode.params ? this.parseTreeNode.params.slice(0) : [];\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tparams.push({name: name, value: attribute});\t\t\t\n\t\t}\n\t});\n\t// Get the macro value\n\tvar text = this.getVariable(this.parseTreeNode.name || this.getAttribute(\"$name\"),{params: params}),\n\t\tparseTreeNodes;\n\t// Are we rendering to HTML?\n\tif(this.renderOutput === \"text/html\") {\n\t\t// If so we'll return the parsed macro\n\t\tvar parser = this.wiki.parseText(this.parseType,text,\n\t\t\t\t\t\t\t{parseAsInline: !this.parseTreeNode.isBlock});\n\t\tparseTreeNodes = parser ? parser.tree : [];\n\t} else {\n\t\t// Otherwise, we'll render the text\n\t\tvar plainText = this.wiki.renderText(\"text/plain\",this.parseType,text,{parentWidget: this});\n\t\tparseTreeNodes = [{type: \"text\", text: plainText}];\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nMacroCallWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\t// Rerender ourselves\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.macrocall = MacroCallWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/macrocall.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/navigator.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/navigator.js\ntype: application/javascript\nmodule-type: widget\n\nNavigator widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar IMPORT_TITLE = \"$:/Import\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar NavigatorWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tm-navigate\", handler: \"handleNavigateEvent\"},\n\t\t{type: \"tm-edit-tiddler\", handler: \"handleEditTiddlerEvent\"},\n\t\t{type: \"tm-delete-tiddler\", handler: \"handleDeleteTiddlerEvent\"},\n\t\t{type: \"tm-save-tiddler\", handler: \"handleSaveTiddlerEvent\"},\n\t\t{type: \"tm-cancel-tiddler\", handler: \"handleCancelTiddlerEvent\"},\n\t\t{type: \"tm-close-tiddler\", handler: \"handleCloseTiddlerEvent\"},\n\t\t{type: \"tm-close-all-tiddlers\", handler: \"handleCloseAllTiddlersEvent\"},\n\t\t{type: \"tm-close-other-tiddlers\", handler: \"handleCloseOtherTiddlersEvent\"},\n\t\t{type: \"tm-new-tiddler\", handler: \"handleNewTiddlerEvent\"},\n\t\t{type: \"tm-import-tiddlers\", handler: \"handleImportTiddlersEvent\"},\n\t\t{type: \"tm-perform-import\", handler: \"handlePerformImportEvent\"},\n\t\t{type: \"tm-fold-tiddler\", handler: \"handleFoldTiddlerEvent\"},\n\t\t{type: \"tm-fold-other-tiddlers\", handler: \"handleFoldOtherTiddlersEvent\"},\n\t\t{type: \"tm-fold-all-tiddlers\", handler: \"handleFoldAllTiddlersEvent\"},\n\t\t{type: \"tm-unfold-all-tiddlers\", handler: \"handleUnfoldAllTiddlersEvent\"},\n\t\t{type: \"tm-rename-tiddler\", handler: \"handleRenameTiddlerEvent\"}\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nNavigatorWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nNavigatorWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nNavigatorWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.storyTitle = this.getAttribute(\"story\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nNavigatorWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.story || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nNavigatorWidget.prototype.getStoryList = function() {\n\treturn this.storyTitle ? this.wiki.getTiddlerList(this.storyTitle) : null;\n};\n\nNavigatorWidget.prototype.saveStoryList = function(storyList) {\n\tvar storyTiddler = this.wiki.getTiddler(this.storyTitle);\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\t{title: this.storyTitle},\n\t\tstoryTiddler,\n\t\t{list: storyList}\n\t));\n};\n\nNavigatorWidget.prototype.removeTitleFromStory = function(storyList,title) {\n\tvar p = storyList.indexOf(title);\n\twhile(p !== -1) {\n\t\tstoryList.splice(p,1);\n\t\tp = storyList.indexOf(title);\n\t}\n};\n\nNavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle,newTitle) {\n\tvar pos = storyList.indexOf(oldTitle);\n\tif(pos !== -1) {\n\t\tstoryList[pos] = newTitle;\n\t\tdo {\n\t\t\tpos = storyList.indexOf(oldTitle,pos + 1);\n\t\t\tif(pos !== -1) {\n\t\t\t\tstoryList.splice(pos,1);\n\t\t\t}\n\t\t} while(pos !== -1);\n\t} else {\n\t\tstoryList.splice(0,0,newTitle);\n\t}\n};\n\nNavigatorWidget.prototype.addToStory = function(title,fromTitle) {\n\tvar storyList = this.getStoryList();\n\t// Quit if we cannot get hold of the story list\n\tif(!storyList) {\n\t\treturn;\n\t}\n\t// See if the tiddler is already there\n\tvar slot = storyList.indexOf(title);\n\t// Quit if it already exists in the story river\n\tif(slot >= 0) {\n\t\treturn;\n\t}\n\t// First we try to find the position of the story element we navigated from\n\tvar fromIndex = storyList.indexOf(fromTitle);\n\tif(fromIndex >= 0) {\n\t\t// The tiddler is added from inside the river\n\t\t// Determine where to insert the tiddler; Fallback is \"below\"\n\t\tswitch(this.getAttribute(\"openLinkFromInsideRiver\",\"below\")) {\n\t\t\tcase \"top\":\n\t\t\t\tslot = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"bottom\":\n\t\t\t\tslot = storyList.length;\n\t\t\t\tbreak;\n\t\t\tcase \"above\":\n\t\t\t\tslot = fromIndex;\n\t\t\t\tbreak;\n\t\t\tcase \"below\": // Intentional fall-through\n\t\t\tdefault:\n\t\t\t\tslot = fromIndex + 1;\n\t\t\t\tbreak;\n\t\t}\n\t} else {\n\t\t// The tiddler is opened from outside the river. Determine where to insert the tiddler; default is \"top\"\n\t\tif(this.getAttribute(\"openLinkFromOutsideRiver\",\"top\") === \"bottom\") {\n\t\t\t// Insert at bottom\n\t\t\tslot = storyList.length;\n\t\t} else {\n\t\t\t// Insert at top\n\t\t\tslot = 0;\n\t\t}\n\t}\n\t// Add the tiddler\n\tstoryList.splice(slot,0,title);\n\t// Save the story\n\tthis.saveStoryList(storyList);\n};\n\n/*\nAdd a new record to the top of the history stack\ntitle: a title string or an array of title strings\nfromPageRect: page coordinates of the origin of the navigation\n*/\nNavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {\n\tthis.wiki.addToHistory(title,fromPageRect,this.historyTitle);\n};\n\n/*\nHandle a tm-navigate event\n*/\nNavigatorWidget.prototype.handleNavigateEvent = function(event) {\n\tevent = $tw.hooks.invokeHook(\"th-navigating\",event);\n\tif(event.navigateTo) {\n\t\tthis.addToStory(event.navigateTo,event.navigateFromTitle);\n\t\tif(!event.navigateSuppressNavigation) {\n\t\t\tthis.addToHistory(event.navigateTo,event.navigateFromClientRect);\n\t\t}\n\t}\n\treturn false;\n};\n\n// Close a specified tiddler\nNavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle,\n\t\tstoryList = this.getStoryList();\n\t// Look for tiddlers with this title to close\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\treturn false;\n};\n\n// Close all tiddlers\nNavigatorWidget.prototype.handleCloseAllTiddlersEvent = function(event) {\n\tthis.saveStoryList([]);\n\treturn false;\n};\n\n// Close other tiddlers\nNavigatorWidget.prototype.handleCloseOtherTiddlersEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle;\n\tthis.saveStoryList([title]);\n\treturn false;\n};\n\n// Place a tiddler in edit mode\nNavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {\n\tvar self = this;\n\tfunction isUnmodifiedShadow(title) {\n\t\treturn self.wiki.isShadowTiddler(title) && !self.wiki.tiddlerExists(title);\n\t}\n\tfunction confirmEditShadow(title) {\n\t\treturn confirm($tw.language.getString(\n\t\t\t\"ConfirmEditShadowTiddler\",\n\t\t\t{variables:\n\t\t\t\t{title: title}\n\t\t\t}\n\t\t));\n\t}\n\tvar title = event.param || event.tiddlerTitle;\n\tif(isUnmodifiedShadow(title) && !confirmEditShadow(title)) {\n\t\treturn false;\n\t}\n\t// Replace the specified tiddler with a draft in edit mode\n\tvar draftTiddler = this.makeDraftTiddler(title);\n\t// Update the story and history if required\n\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\tvar draftTitle = draftTiddler.fields.title,\n\t\t\tstoryList = this.getStoryList();\n\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\tthis.saveStoryList(storyList);\n\t\treturn false;\n\t}\n};\n\n// Delete a tiddler\nNavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {\n\t// Get the tiddler we're deleting\n\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList(),\n\t\toriginalTitle = tiddler ? tiddler.fields[\"draft.of\"] : \"\",\n\t\toriginalTiddler = originalTitle ? this.wiki.getTiddler(originalTitle) : undefined,\n\t\tconfirmationTitle;\n\tif(!tiddler) {\n\t\treturn false;\n\t}\n\t// Check if the tiddler we're deleting is in draft mode\n\tif(originalTitle) {\n\t\t// If so, we'll prompt for confirmation referencing the original tiddler\n\t\tconfirmationTitle = originalTitle;\n\t} else {\n\t\t// If not a draft, then prompt for confirmation referencing the specified tiddler\n\t\tconfirmationTitle = title;\n\t}\n\t// Seek confirmation\n\tif((this.wiki.getTiddler(originalTitle) || (tiddler.fields.text || \"\") !== \"\") && !confirm($tw.language.getString(\n\t\t\t\t\"ConfirmDeleteTiddler\",\n\t\t\t\t{variables:\n\t\t\t\t\t{title: confirmationTitle}\n\t\t\t\t}\n\t\t\t))) {\n\t\treturn false;\n\t}\n\t// Delete the original tiddler\n\tif(originalTitle) {\n\t\tif(originalTiddler) {\n\t\t\t$tw.hooks.invokeHook(\"th-deleting-tiddler\",originalTiddler);\n\t\t}\n\t\tthis.wiki.deleteTiddler(originalTitle);\n\t\tthis.removeTitleFromStory(storyList,originalTitle);\n\t}\n\t// Invoke the hook function and delete this tiddler\n\t$tw.hooks.invokeHook(\"th-deleting-tiddler\",tiddler);\n\tthis.wiki.deleteTiddler(title);\n\t// Remove the closed tiddler from the story\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\treturn false;\n};\n\n/*\nCreate/reuse the draft tiddler for a given title\n*/\nNavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) {\n\t// See if there is already a draft tiddler for this tiddler\n\tvar draftTitle = this.wiki.findDraft(targetTitle);\n\tif(draftTitle) {\n\t\treturn this.wiki.getTiddler(draftTitle);\n\t}\n\t// Get the current value of the tiddler we're editing\n\tvar tiddler = this.wiki.getTiddler(targetTitle);\n\t// Save the initial value of the draft tiddler\n\tdraftTitle = this.generateDraftTitle(targetTitle);\n\tvar draftTiddler = new $tw.Tiddler(\n\t\t\ttiddler,\n\t\t\t{\n\t\t\t\ttitle: draftTitle,\n\t\t\t\t\"draft.title\": targetTitle,\n\t\t\t\t\"draft.of\": targetTitle\n\t\t\t},\n\t\t\tthis.wiki.getModificationFields()\n\t\t);\n\tthis.wiki.addTiddler(draftTiddler);\n\treturn draftTiddler;\n};\n\n/*\nGenerate a title for the draft of a given tiddler\n*/\nNavigatorWidget.prototype.generateDraftTitle = function(title) {\n\tvar c = 0,\n\t\tdraftTitle;\n\tdo {\n\t\tdraftTitle = \"Draft \" + (c ? (c + 1) + \" \" : \"\") + \"of '\" + title + \"'\";\n\t\tc++;\n\t} while(this.wiki.tiddlerExists(draftTitle));\n\treturn draftTitle;\n};\n\n// Take a tiddler out of edit mode, saving the changes\nNavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList();\n\t// Replace the original tiddler with the draft\n\tif(tiddler) {\n\t\tvar draftTitle = (tiddler.fields[\"draft.title\"] || \"\").trim(),\n\t\t\tdraftOf = (tiddler.fields[\"draft.of\"] || \"\").trim();\n\t\tif(draftTitle) {\n\t\t\tvar isRename = draftOf !== draftTitle,\n\t\t\t\tisConfirmed = true;\n\t\t\tif(isRename && this.wiki.tiddlerExists(draftTitle)) {\n\t\t\t\tisConfirmed = confirm($tw.language.getString(\n\t\t\t\t\t\"ConfirmOverwriteTiddler\",\n\t\t\t\t\t{variables:\n\t\t\t\t\t\t{title: draftTitle}\n\t\t\t\t\t}\n\t\t\t\t));\n\t\t\t}\n\t\t\tif(isConfirmed) {\n\t\t\t\t// Create the new tiddler and pass it through the th-saving-tiddler hook\n\t\t\t\tvar newTiddler = new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\ttitle: draftTitle,\n\t\t\t\t\t\"draft.title\": undefined,\n\t\t\t\t\t\"draft.of\": undefined\n\t\t\t\t},this.wiki.getModificationFields());\n\t\t\t\tnewTiddler = $tw.hooks.invokeHook(\"th-saving-tiddler\",newTiddler);\n\t\t\t\tthis.wiki.addTiddler(newTiddler);\n\t\t\t\t// If enabled, relink references to renamed tiddler\n\t\t\t\tvar shouldRelink = this.getAttribute(\"relinkOnRename\",\"no\").toLowerCase().trim() === \"yes\";\n\t\t\t\tif(isRename && shouldRelink && this.wiki.tiddlerExists(draftOf)) {\nconsole.log(\"Relinking '\" + draftOf + \"' to '\" + draftTitle + \"'\");\n\t\t\t\t\tthis.wiki.relinkTiddler(draftOf,draftTitle);\n\t\t\t\t}\n\t\t\t\t// Remove the draft tiddler\n\t\t\t\tthis.wiki.deleteTiddler(title);\n\t\t\t\t// Remove the original tiddler if we're renaming it\n\t\t\t\tif(isRename) {\n\t\t\t\t\tthis.wiki.deleteTiddler(draftOf);\n\t\t\t\t}\n\t\t\t\t// #2381 always remove new title & old\n\t\t\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\t\t\tthis.removeTitleFromStory(storyList,draftOf);\n\t\t\t\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\t\t\t\t// Replace the draft in the story with the original\n\t\t\t\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\t\t\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\t\t\t\tif(draftTitle !== this.storyTitle) {\n\t\t\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Trigger an autosave\n\t\t\t\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// Take a tiddler out of edit mode without saving the changes\nNavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {\n\t// Flip the specified tiddler from draft back to the original\n\tvar draftTitle = event.param || event.tiddlerTitle,\n\t\tdraftTiddler = this.wiki.getTiddler(draftTitle),\n\t\toriginalTitle = draftTiddler && draftTiddler.fields[\"draft.of\"];\n\tif(draftTiddler && originalTitle) {\n\t\t// Ask for confirmation if the tiddler text has changed\n\t\tvar isConfirmed = true,\n\t\t\toriginalTiddler = this.wiki.getTiddler(originalTitle),\n\t\t\tstoryList = this.getStoryList();\n\t\tif(this.wiki.isDraftModified(draftTitle)) {\n\t\t\tisConfirmed = confirm($tw.language.getString(\n\t\t\t\t\"ConfirmCancelTiddler\",\n\t\t\t\t{variables:\n\t\t\t\t\t{title: draftTitle}\n\t\t\t\t}\n\t\t\t));\n\t\t}\n\t\t// Remove the draft tiddler\n\t\tif(isConfirmed) {\n\t\t\tthis.wiki.deleteTiddler(draftTitle);\n\t\t\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\t\t\tif(originalTiddler) {\n\t\t\t\t\tthis.replaceFirstTitleInStory(storyList,draftTitle,originalTitle);\n\t\t\t\t\tthis.addToHistory(originalTitle,event.navigateFromClientRect);\n\t\t\t\t} else {\n\t\t\t\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\t\t\t}\n\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// Create a new draft tiddler\n// event.param can either be the title of a template tiddler, or a hashmap of fields.\n//\n// The title of the newly created tiddler follows these rules:\n// * If a hashmap was used and a title field was specified, use that title\n// * If a hashmap was used without a title field, use a default title, if necessary making it unique with a numeric suffix\n// * If a template tiddler was used, use the title of the template, if necessary making it unique with a numeric suffix\n//\n// If a draft of the target tiddler already exists then it is reused\nNavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {\n\t// Get the story details\n\tvar storyList = this.getStoryList(),\n\t\ttemplateTiddler, additionalFields, title, draftTitle, existingTiddler;\n\t// Get the template tiddler (if any)\n\tif(typeof event.param === \"string\") {\n\t\t// Get the template tiddler\n\t\ttemplateTiddler = this.wiki.getTiddler(event.param);\n\t\t// Generate a new title\n\t\ttitle = this.wiki.generateNewTitle(event.param || $tw.language.getString(\"DefaultNewTiddlerTitle\"));\n\t}\n\t// Get the specified additional fields\n\tif(typeof event.paramObject === \"object\") {\n\t\tadditionalFields = event.paramObject;\n\t}\n\tif(typeof event.param === \"object\") { // Backwards compatibility with 5.1.3\n\t\tadditionalFields = event.param;\n\t}\n\tif(additionalFields && additionalFields.title) {\n\t\ttitle = additionalFields.title;\n\t}\n\t// Generate a title if we don't have one\n\ttitle = title || this.wiki.generateNewTitle($tw.language.getString(\"DefaultNewTiddlerTitle\"));\n\t// Find any existing draft for this tiddler\n\tdraftTitle = this.wiki.findDraft(title);\n\t// Pull in any existing tiddler\n\tif(draftTitle) {\n\t\texistingTiddler = this.wiki.getTiddler(draftTitle);\n\t} else {\n\t\tdraftTitle = this.generateDraftTitle(title);\n\t\texistingTiddler = this.wiki.getTiddler(title);\n\t}\n\t// Merge the tags\n\tvar mergedTags = [];\n\tif(existingTiddler && existingTiddler.fields.tags) {\n\t\t$tw.utils.pushTop(mergedTags,existingTiddler.fields.tags);\n\t}\n\tif(additionalFields && additionalFields.tags) {\n\t\t// Merge tags\n\t\tmergedTags = $tw.utils.pushTop(mergedTags,$tw.utils.parseStringArray(additionalFields.tags));\n\t}\n\tif(templateTiddler && templateTiddler.fields.tags) {\n\t\t// Merge tags\n\t\tmergedTags = $tw.utils.pushTop(mergedTags,templateTiddler.fields.tags);\n\t}\n\t// Save the draft tiddler\n\tvar draftTiddler = new $tw.Tiddler({\n\t\t\ttext: \"\",\n\t\t\t\"draft.title\": title\n\t\t},\n\t\ttemplateTiddler,\n\t\texistingTiddler,\n\t\tadditionalFields,\n\t\tthis.wiki.getCreationFields(),\n\t\t{\n\t\t\ttitle: draftTitle,\n\t\t\t\"draft.of\": title,\n\t\t\ttags: mergedTags\n\t\t},this.wiki.getModificationFields());\n\tthis.wiki.addTiddler(draftTiddler);\n\t// Update the story to insert the new draft at the top and remove any existing tiddler\n\tif(storyList.indexOf(draftTitle) === -1) {\n\t\tvar slot = storyList.indexOf(event.navigateFromTitle);\n\t\tstoryList.splice(slot + 1,0,draftTitle);\n\t}\n\tif(storyList.indexOf(title) !== -1) {\n\t\tstoryList.splice(storyList.indexOf(title),1);\t\t\n\t}\n\tthis.saveStoryList(storyList);\n\t// Add a new record to the top of the history stack\n\tthis.addToHistory(draftTitle);\n\treturn false;\n};\n\n// Import JSON tiddlers into a pending import tiddler\nNavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {\n\t// Get the tiddlers\n\tvar tiddlers = [];\n\ttry {\n\t\ttiddlers = JSON.parse(event.param);\t\n\t} catch(e) {\n\t}\n\t// Get the current $:/Import tiddler\n\tvar importTiddler = this.wiki.getTiddler(IMPORT_TITLE),\n\t\timportData = this.wiki.getTiddlerData(IMPORT_TITLE,{}),\n\t\tnewFields = new Object({\n\t\t\ttitle: IMPORT_TITLE,\n\t\t\ttype: \"application/json\",\n\t\t\t\"plugin-type\": \"import\",\n\t\t\t\"status\": \"pending\"\n\t\t}),\n\t\tincomingTiddlers = [];\n\t// Process each tiddler\n\timportData.tiddlers = importData.tiddlers || {};\n\t$tw.utils.each(tiddlers,function(tiddlerFields) {\n\t\tvar title = tiddlerFields.title;\n\t\tif(title) {\n\t\t\tincomingTiddlers.push(title);\n\t\t\timportData.tiddlers[title] = tiddlerFields;\n\t\t}\n\t});\n\t// Give the active upgrader modules a chance to process the incoming tiddlers\n\tvar messages = this.wiki.invokeUpgraders(incomingTiddlers,importData.tiddlers);\n\t$tw.utils.each(messages,function(message,title) {\n\t\tnewFields[\"message-\" + title] = message;\n\t});\n\t// Deselect any suppressed tiddlers\n\t$tw.utils.each(importData.tiddlers,function(tiddler,title) {\n\t\tif($tw.utils.count(tiddler) === 0) {\n\t\t\tnewFields[\"selection-\" + title] = \"unchecked\";\n\t\t}\n\t});\n\t// Save the $:/Import tiddler\n\tnewFields.text = JSON.stringify(importData,null,$tw.config.preferences.jsonSpaces);\n\tthis.wiki.addTiddler(new $tw.Tiddler(importTiddler,newFields));\n\t// Update the story and history details\n\tif(this.getVariable(\"tv-auto-open-on-import\") !== \"no\") {\n\t\tvar storyList = this.getStoryList(),\n\t\t\thistory = [];\n\t\t// Add it to the story\n\t\tif(storyList.indexOf(IMPORT_TITLE) === -1) {\n\t\t\tstoryList.unshift(IMPORT_TITLE);\n\t\t}\n\t\t// And to history\n\t\thistory.push(IMPORT_TITLE);\n\t\t// Save the updated story and history\n\t\tthis.saveStoryList(storyList);\n\t\tthis.addToHistory(history);\n\t}\n\treturn false;\n};\n\n// \nNavigatorWidget.prototype.handlePerformImportEvent = function(event) {\n\tvar self = this,\n\t\timportTiddler = this.wiki.getTiddler(event.param),\n\t\timportData = this.wiki.getTiddlerDataCached(event.param,{tiddlers: {}}),\n\t\timportReport = [];\n\t// Add the tiddlers to the store\n\timportReport.push($tw.language.getString(\"Import/Imported/Hint\") + \"\\n\");\n\t$tw.utils.each(importData.tiddlers,function(tiddlerFields) {\n\t\tvar title = tiddlerFields.title;\n\t\tif(title && importTiddler && importTiddler.fields[\"selection-\" + title] !== \"unchecked\") {\n\t\t\tvar tiddler = new $tw.Tiddler(tiddlerFields);\n\t\t\ttiddler = $tw.hooks.invokeHook(\"th-importing-tiddler\",tiddler);\n\t\t\tself.wiki.addTiddler(tiddler);\n\t\t\timportReport.push(\"# [[\" + tiddlerFields.title + \"]]\");\n\t\t}\n\t});\n\t// Replace the $:/Import tiddler with an import report\n\tthis.wiki.addTiddler(new $tw.Tiddler({\n\t\ttitle: event.param,\n\t\ttext: importReport.join(\"\\n\"),\n\t\t\"status\": \"complete\"\n\t}));\n\t// Navigate to the $:/Import tiddler\n\tthis.addToHistory([event.param]);\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n};\n\nNavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) {\n\tvar paramObject = event.paramObject || {};\n\tif(paramObject.foldedState) {\n\t\tvar foldedState = this.wiki.getTiddlerText(paramObject.foldedState,\"show\") === \"show\" ? \"hide\" : \"show\";\n\t\tthis.wiki.setText(paramObject.foldedState,\"text\",null,foldedState);\n\t}\n};\n\nNavigatorWidget.prototype.handleFoldOtherTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix;\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,event.param === title ? \"show\" : \"hide\");\n\t});\n};\n\nNavigatorWidget.prototype.handleFoldAllTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix;\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,\"hide\");\n\t});\n};\n\nNavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix;\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,\"show\");\n\t});\n};\n\nNavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {\n\tvar paramObject = event.paramObject || {},\n\t\tfrom = paramObject.from || event.tiddlerTitle,\n\t\tto = paramObject.to;\n\t$tw.wiki.renameTiddler(from,to);\n};\n\nexports.navigator = NavigatorWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/navigator.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/password.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/password.js\ntype: application/javascript\nmodule-type: widget\n\nPassword widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar PasswordWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nPasswordWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nPasswordWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the current password\n\tvar password = $tw.browser ? $tw.utils.getPassword(this.passwordName) || \"\" : \"\";\n\t// Create our element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"password\");\n\tdomNode.setAttribute(\"value\",password);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nPasswordWidget.prototype.handleChangeEvent = function(event) {\n\tvar password = this.domNodes[0].value;\n\treturn $tw.utils.savePassword(this.passwordName,password);\n};\n\n/*\nCompute the internal state of the widget\n*/\nPasswordWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.passwordName = this.getAttribute(\"name\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nPasswordWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.password = PasswordWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/password.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/radio.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/radio.js\ntype: application/javascript\nmodule-type: widget\n\nSet a field or index at a given tiddler via radio buttons\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RadioWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRadioWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRadioWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.labelDomNode.setAttribute(\"class\",this.radioClass);\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"radio\");\n\tif(this.getValue() == this.radioValue) {\n\t\tthis.inputDomNode.setAttribute(\"checked\",\"true\");\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nRadioWidget.prototype.getValue = function() {\n\tvar value,\n\t\ttiddler = this.wiki.getTiddler(this.radioTitle);\n\tif (this.radioIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex);\n\t} else {\n\t\tvalue = tiddler && tiddler.getFieldString(this.radioField);\n\t}\n\treturn value;\n};\n\nRadioWidget.prototype.setValue = function() {\n\tif(this.radioIndex) {\n\t\tthis.wiki.setText(this.radioTitle,\"\",this.radioIndex,this.radioValue);\n\t} else {\n\t\tvar tiddler = this.wiki.getTiddler(this.radioTitle),\n\t\t\taddition = {};\n\t\taddition[this.radioField] = this.radioValue;\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),{title: this.radioTitle},tiddler,addition,this.wiki.getModificationFields()));\n\t}\n};\n\nRadioWidget.prototype.handleChangeEvent = function(event) {\n\tif(this.inputDomNode.checked) {\n\t\tthis.setValue();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRadioWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.radioTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.radioField = this.getAttribute(\"field\",\"text\");\n\tthis.radioIndex = this.getAttribute(\"index\");\n\tthis.radioValue = this.getAttribute(\"value\");\n\tthis.radioClass = this.getAttribute(\"class\",\"\");\n\tif(this.radioClass !== \"\") {\n\t\tthis.radioClass += \" \";\n\t}\n\tthis.radioClass += \"tc-radio\";\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRadioWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.value || changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.radioTitle]) {\n\t\t\tthis.inputDomNode.checked = this.getValue() === this.radioValue;\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\nexports.radio = RadioWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/radio.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/raw.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/raw.js\ntype: application/javascript\nmodule-type: widget\n\nRaw widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RawWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRawWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRawWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar div = this.document.createElement(\"div\");\n\tdiv.innerHTML=this.parseTreeNode.html;\n\tparent.insertBefore(div,nextSibling);\n\tthis.domNodes.push(div);\t\n};\n\n/*\nCompute the internal state of the widget\n*/\nRawWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRawWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.raw = RawWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/raw.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/reveal.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/reveal.js\ntype: application/javascript\nmodule-type: widget\n\nReveal widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RevealWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRevealWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRevealWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.revealTag && $tw.config.htmlUnsafeElements.indexOf(this.revealTag) === -1) {\n\t\ttag = this.revealTag;\n\t}\n\tvar domNode = this.document.createElement(tag);\n\tvar classes = this[\"class\"].split(\" \") || [];\n\tclasses.push(\"tc-reveal\");\n\tdomNode.className = classes.join(\" \");\n\tif(this.style) {\n\t\tdomNode.setAttribute(\"style\",this.style);\n\t}\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tc-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\t}\n\tif(!this.isOpen) {\n\t\tdomNode.setAttribute(\"hidden\",\"true\");\n\t}\n\tthis.domNodes.push(domNode);\n};\n\nRevealWidget.prototype.positionPopup = function(domNode) {\n\tdomNode.style.position = \"absolute\";\n\tdomNode.style.zIndex = \"1000\";\n\tswitch(this.position) {\n\t\tcase \"left\":\n\t\t\tdomNode.style.left = (this.popup.left - domNode.offsetWidth) + \"px\";\n\t\t\tdomNode.style.top = this.popup.top + \"px\";\n\t\t\tbreak;\n\t\tcase \"above\":\n\t\t\tdomNode.style.left = this.popup.left + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top - domNode.offsetHeight) + \"px\";\n\t\t\tbreak;\n\t\tcase \"aboveright\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height - domNode.offsetHeight) + \"px\";\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\tdomNode.style.top = this.popup.top + \"px\";\n\t\t\tbreak;\n\t\tcase \"belowleft\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width - domNode.offsetWidth) + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\tbreak;\n\t\tdefault: // Below\n\t\t\tdomNode.style.left = this.popup.left + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\tbreak;\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRevealWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.state = this.getAttribute(\"state\");\n\tthis.revealTag = this.getAttribute(\"tag\");\n\tthis.type = this.getAttribute(\"type\");\n\tthis.text = this.getAttribute(\"text\");\n\tthis.position = this.getAttribute(\"position\");\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tthis.style = this.getAttribute(\"style\",\"\");\n\tthis[\"default\"] = this.getAttribute(\"default\",\"\");\n\tthis.animate = this.getAttribute(\"animate\",\"no\");\n\tthis.retain = this.getAttribute(\"retain\",\"no\");\n\tthis.openAnimation = this.animate === \"no\" ? undefined : \"open\";\n\tthis.closeAnimation = this.animate === \"no\" ? undefined : \"close\";\n\t// Compute the title of the state tiddler and read it\n\tthis.stateTitle = this.state;\n\tthis.readState();\n\t// Construct the child widgets\n\tvar childNodes = this.isOpen ? this.parseTreeNode.children : [];\n\tthis.hasChildNodes = this.isOpen;\n\tthis.makeChildWidgets(childNodes);\n};\n\n/*\nRead the state tiddler\n*/\nRevealWidget.prototype.readState = function() {\n\t// Read the information from the state tiddler\n\tvar state = this.stateTitle ? this.wiki.getTextReference(this.stateTitle,this[\"default\"],this.getVariable(\"currentTiddler\")) : this[\"default\"];\n\tswitch(this.type) {\n\t\tcase \"popup\":\n\t\t\tthis.readPopupState(state);\n\t\t\tbreak;\n\t\tcase \"match\":\n\t\t\tthis.readMatchState(state);\n\t\t\tbreak;\n\t\tcase \"nomatch\":\n\t\t\tthis.readMatchState(state);\n\t\t\tthis.isOpen = !this.isOpen;\n\t\t\tbreak;\n\t}\n};\n\nRevealWidget.prototype.readMatchState = function(state) {\n\tthis.isOpen = state === this.text;\n};\n\nRevealWidget.prototype.readPopupState = function(state) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tmatch = popupLocationRegExp.exec(state);\n\t// Check if the state matches the location regexp\n\tif(match) {\n\t\t// If so, we're open\n\t\tthis.isOpen = true;\n\t\t// Get the location\n\t\tthis.popup = {\n\t\t\tleft: parseFloat(match[1]),\n\t\t\ttop: parseFloat(match[2]),\n\t\t\twidth: parseFloat(match[3]),\n\t\t\theight: parseFloat(match[4])\n\t\t};\n\t} else {\n\t\t// If not, we're closed\n\t\tthis.isOpen = false;\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRevealWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes[\"default\"] || changedAttributes.animate) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false,\n\t\t\tcurrentlyOpen = this.isOpen;\n\t\tthis.readState();\n\t\tif(this.isOpen !== currentlyOpen) {\n\t\t\tif(this.retain === \"yes\") {\n\t\t\t\tthis.updateState();\n\t\t\t} else {\n\t\t\t\tthis.refreshSelf();\n\t\t\t\trefreshed = true;\n\t\t\t}\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\n/*\nCalled by refresh() to dynamically show or hide the content\n*/\nRevealWidget.prototype.updateState = function() {\n\t// Read the current state\n\tthis.readState();\n\t// Construct the child nodes if needed\n\tvar domNode = this.domNodes[0];\n\tif(this.isOpen && !this.hasChildNodes) {\n\t\tthis.hasChildNodes = true;\n\t\tthis.makeChildWidgets(this.parseTreeNode.children);\n\t\tthis.renderChildren(domNode,null);\n\t}\n\t// Animate our DOM node\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tc-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\n\t}\n\tif(this.isOpen) {\n\t\tdomNode.removeAttribute(\"hidden\");\n $tw.anim.perform(this.openAnimation,domNode);\n\t} else {\n\t\t$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {\n\t\t\tdomNode.setAttribute(\"hidden\",\"true\");\n }});\n\t}\n};\n\nexports.reveal = RevealWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/reveal.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/scrollable.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/scrollable.js\ntype: application/javascript\nmodule-type: widget\n\nScrollable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ScrollableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.scaleFactor = 1;\n\tthis.addEventListeners([\n\t\t{type: \"tm-scroll\", handler: \"handleScrollEvent\"}\n\t]);\n\tif($tw.browser) {\n\t\tthis.requestAnimationFrame = window.requestAnimationFrame ||\n\t\t\twindow.webkitRequestAnimationFrame ||\n\t\t\twindow.mozRequestAnimationFrame ||\n\t\t\tfunction(callback) {\n\t\t\t\treturn window.setTimeout(callback, 1000/60);\n\t\t\t};\n\t\tthis.cancelAnimationFrame = window.cancelAnimationFrame ||\n\t\t\twindow.webkitCancelAnimationFrame ||\n\t\t\twindow.webkitCancelRequestAnimationFrame ||\n\t\t\twindow.mozCancelAnimationFrame ||\n\t\t\twindow.mozCancelRequestAnimationFrame ||\n\t\t\tfunction(id) {\n\t\t\t\twindow.clearTimeout(id);\n\t\t\t};\n\t}\n};\n\n/*\nInherit from the base widget class\n*/\nScrollableWidget.prototype = new Widget();\n\nScrollableWidget.prototype.cancelScroll = function() {\n\tif(this.idRequestFrame) {\n\t\tthis.cancelAnimationFrame.call(window,this.idRequestFrame);\n\t\tthis.idRequestFrame = null;\n\t}\n};\n\n/*\nHandle a scroll event\n*/\nScrollableWidget.prototype.handleScrollEvent = function(event) {\n\t// Pass the scroll event through if our offsetsize is larger than our scrollsize\n\tif(this.outerDomNode.scrollWidth <= this.outerDomNode.offsetWidth && this.outerDomNode.scrollHeight <= this.outerDomNode.offsetHeight && this.fallthrough === \"yes\") {\n\t\treturn true;\n\t}\n\tthis.scrollIntoView(event.target);\n\treturn false; // Handled event\n};\n\n/*\nScroll an element into view\n*/\nScrollableWidget.prototype.scrollIntoView = function(element) {\n\tvar duration = $tw.utils.getAnimationDuration();\n\tthis.cancelScroll();\n\tthis.startTime = Date.now();\n\tvar scrollPosition = {\n\t\tx: this.outerDomNode.scrollLeft,\n\t\ty: this.outerDomNode.scrollTop\n\t};\n\t// Get the client bounds of the element and adjust by the scroll position\n\tvar scrollableBounds = this.outerDomNode.getBoundingClientRect(),\n\t\tclientTargetBounds = element.getBoundingClientRect(),\n\t\tbounds = {\n\t\t\tleft: clientTargetBounds.left + scrollPosition.x - scrollableBounds.left,\n\t\t\ttop: clientTargetBounds.top + scrollPosition.y - scrollableBounds.top,\n\t\t\twidth: clientTargetBounds.width,\n\t\t\theight: clientTargetBounds.height\n\t\t};\n\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\tvar getEndPos = function(targetPos,targetSize,currentPos,currentSize) {\n\t\t\t// If the target is already visible then stay where we are\n\t\t\tif(targetPos >= currentPos && (targetPos + targetSize) <= (currentPos + currentSize)) {\n\t\t\t\treturn currentPos;\n\t\t\t// If the target is above/left of the current view, then scroll to its top/left\n\t\t\t} else if(targetPos <= currentPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window\n\t\t\t} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {\n\t\t\t\treturn targetPos + targetSize - currentSize;\n\t\t\t// If the target is big, then just scroll to the top\n\t\t\t} else if(currentPos < targetPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// Otherwise, stay where we are\n\t\t\t} else {\n\t\t\t\treturn currentPos;\n\t\t\t}\n\t\t},\n\t\tendX = getEndPos(bounds.left,bounds.width,scrollPosition.x,this.outerDomNode.offsetWidth),\n\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,this.outerDomNode.offsetHeight);\n\t// Only scroll if necessary\n\tif(endX !== scrollPosition.x || endY !== scrollPosition.y) {\n\t\tvar self = this,\n\t\t\tdrawFrame;\n\t\tdrawFrame = function () {\n\t\t\tvar t;\n\t\t\tif(duration <= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((Date.now()) - self.startTime) / duration;\t\n\t\t\t}\n\t\t\tif(t >= 1) {\n\t\t\t\tself.cancelScroll();\n\t\t\t\tt = 1;\n\t\t\t}\n\t\t\tt = $tw.utils.slowInSlowOut(t);\n\t\t\tself.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;\n\t\t\tself.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;\n\t\t\tif(t < 1) {\n\t\t\t\tself.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);\n\t\t\t}\n\t\t};\n\t\tdrawFrame();\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nScrollableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create elements\n\tthis.outerDomNode = this.document.createElement(\"div\");\n\t$tw.utils.setStyle(this.outerDomNode,[\n\t\t{overflowY: \"auto\"},\n\t\t{overflowX: \"auto\"},\n\t\t{webkitOverflowScrolling: \"touch\"}\n\t]);\n\tthis.innerDomNode = this.document.createElement(\"div\");\n\tthis.outerDomNode.appendChild(this.innerDomNode);\n\t// Assign classes\n\tthis.outerDomNode.className = this[\"class\"] || \"\";\n\t// Insert element\n\tparent.insertBefore(this.outerDomNode,nextSibling);\n\tthis.renderChildren(this.innerDomNode,null);\n\tthis.domNodes.push(this.outerDomNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nScrollableWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.fallthrough = this.getAttribute(\"fallthrough\",\"yes\");\n\tthis[\"class\"] = this.getAttribute(\"class\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nScrollableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.scrollable = ScrollableWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/scrollable.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/select.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/select.js\ntype: application/javascript\nmodule-type: widget\n\nSelect widget:\n\n```\n<$select tiddler=\"MyTiddler\" field=\"text\">\n<$list filter=\"[tag[chapter]]\">\n<option value=<<currentTiddler>>>\n<$view field=\"description\"/>\n</option>\n</$list>\n</$select>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SelectWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSelectWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSelectWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n\tthis.setSelectValue();\n\t$tw.utils.addEventListeners(this.getSelectDomNode(),[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n};\n\n/*\nHandle a change event\n*/\nSelectWidget.prototype.handleChangeEvent = function(event) {\n\t// Get the new value and assign it to the tiddler\n\tif(this.selectMultiple == false) {\n\t\tvar value = this.getSelectDomNode().value;\n\t} else {\n\t\tvar value = this.getSelectValues()\n\t\t\t\tvalue = $tw.utils.stringifyList(value);\n\t}\n\tthis.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value);\n\t// Trigger actions\n\tif(this.selectActions) {\n\t\tthis.invokeActionString(this.selectActions,this,event);\n\t}\n};\n\n/*\nIf necessary, set the value of the select element to the current value\n*/\nSelectWidget.prototype.setSelectValue = function() {\n\tvar value = this.selectDefault;\n\t// Get the value\n\tif(this.selectIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex);\n\t} else {\n\t\tvar tiddler = this.wiki.getTiddler(this.selectTitle);\n\t\tif(tiddler) {\n\t\t\tif(this.selectField === \"text\") {\n\t\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\t\tvalue = this.wiki.getTiddlerText(this.selectTitle);\n\t\t\t} else {\n\t\t\t\tif($tw.utils.hop(tiddler.fields,this.selectField)) {\n\t\t\t\t\tvalue = tiddler.getFieldString(this.selectField);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif(this.selectField === \"title\") {\n\t\t\t\tvalue = this.selectTitle;\n\t\t\t}\n\t\t}\n\t}\n\t// Assign it to the select element if it's different than the current value\n\tif (this.selectMultiple) {\n\t\tvalue = value === undefined ? \"\" : value;\n\t\tvar select = this.getSelectDomNode();\n\t\tvar values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);\n\t\tfor(var i=0; i < select.children.length; i++){\n\t\t\tif(values.indexOf(select.children[i].value) != -1) {\n\t\t\t\tselect.children[i].selected = true;\n\t\t\t}\n\t\t}\n\t\t\n\t} else {\n\t\tvar domNode = this.getSelectDomNode();\n\t\tif(domNode.value !== value) {\n\t\t\tdomNode.value = value;\n\t\t}\n\t}\n};\n\n/*\nGet the DOM node of the select element\n*/\nSelectWidget.prototype.getSelectDomNode = function() {\n\treturn this.children[0].domNodes[0];\n};\n\n// Return an array of the selected opion values\n// select is an HTML select element\nSelectWidget.prototype.getSelectValues = function() {\n\tvar select, result, options, opt;\n\tselect = this.getSelectDomNode();\n\tresult = [];\n\toptions = select && select.options;\n\tfor (var i=0; i<options.length; i++) {\n\t\topt = options[i];\n\t\tif (opt.selected) {\n\t\t\tresult.push(opt.value || opt.text);\n\t\t}\n\t}\n\treturn result;\n}\n\n/*\nCompute the internal state of the widget\n*/\nSelectWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.selectActions = this.getAttribute(\"actions\");\n\tthis.selectTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.selectField = this.getAttribute(\"field\",\"text\");\n\tthis.selectIndex = this.getAttribute(\"index\");\n\tthis.selectClass = this.getAttribute(\"class\");\n\tthis.selectDefault = this.getAttribute(\"default\");\n\tthis.selectMultiple = this.getAttribute(\"multiple\", false);\n\tthis.selectSize = this.getAttribute(\"size\");\n\t// Make the child widgets\n\tvar selectNode = {\n\t\ttype: \"element\",\n\t\ttag: \"select\",\n\t\tchildren: this.parseTreeNode.children\n\t};\n\tif(this.selectClass) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"class\",this.selectClass);\n\t}\n\tif(this.selectMultiple) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"multiple\",\"multiple\");\n\t}\n\tif(this.selectSize) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"size\",this.selectSize);\n\t}\n\tthis.makeChildWidgets([selectNode]);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nSelectWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// If we're using a different tiddler/field/index then completely refresh ourselves\n\tif(changedAttributes.selectTitle || changedAttributes.selectField || changedAttributes.selectIndex) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t// If the target tiddler value has changed, just update setting and refresh the children\n\t} else {\n\t\tvar childrenRefreshed = this.refreshChildren(changedTiddlers);\n\t\tif(changedTiddlers[this.selectTitle] || childrenRefreshed) {\n\t\t\tthis.setSelectValue();\n\t\t} \n\t\treturn childrenRefreshed;\n\t}\n};\n\nexports.select = SelectWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/select.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/set.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/set.js\ntype: application/javascript\nmodule-type: widget\n\nSet variable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SetWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSetWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSetWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nSetWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.setName = this.getAttribute(\"name\",\"currentTiddler\");\n\tthis.setFilter = this.getAttribute(\"filter\");\n\tthis.setSelect = this.getAttribute(\"select\");\n\tthis.setValue = this.getAttribute(\"value\");\n\tthis.setEmptyValue = this.getAttribute(\"emptyValue\");\n\t// Set context variable\n\tthis.setVariable(this.setName,this.getValue(),this.parseTreeNode.params);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nGet the value to be assigned\n*/\nSetWidget.prototype.getValue = function() {\n\tvar value = this.setValue;\n\tif(this.setFilter) {\n\t\tvar results = this.wiki.filterTiddlers(this.setFilter,this);\n\t\tif(!this.setValue) {\n\t\t\tvar select;\n\t\t\tif(this.setSelect) {\n\t\t\t\tselect = parseInt(this.setSelect,10);\n\t\t\t}\n\t\t\tif(select !== undefined) {\n\t\t\t\tvalue = results[select] || \"\";\n\t\t\t} else {\n\t\t\t\tvalue = $tw.utils.stringifyList(results);\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(results.length === 0 && this.setEmptyValue !== undefined) {\n\t\t\tvalue = this.setEmptyValue;\n\t\t}\n\t} else if(!value && this.setEmptyValue) {\n\t\tvalue = this.setEmptyValue;\n\t}\n\treturn value;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nSetWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name || changedAttributes.filter || changedAttributes.select ||changedAttributes.value || changedAttributes.emptyValue ||\n\t (this.setFilter && this.getValue() != this.variables[this.setName].value)) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.setvariable = SetWidget;\nexports.set = SetWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/set.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/text.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/text.js\ntype: application/javascript\nmodule-type: widget\n\nText node widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TextNodeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTextNodeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTextNodeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar text = this.getAttribute(\"text\",this.parseTreeNode.text || \"\");\n\ttext = text.replace(/\\r/mg,\"\");\n\tvar textNode = this.document.createTextNode(text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTextNodeWidget.prototype.execute = function() {\n\t// Nothing to do for a text node\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTextNodeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.text) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports.text = TextNodeWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/text.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/tiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/tiddler.js\ntype: application/javascript\nmodule-type: widget\n\nTiddler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTiddlerWidget.prototype.execute = function() {\n\tthis.tiddlerState = this.computeTiddlerState();\n\tthis.setVariable(\"currentTiddler\",this.tiddlerState.currentTiddler);\n\tthis.setVariable(\"missingTiddlerClass\",this.tiddlerState.missingTiddlerClass);\n\tthis.setVariable(\"shadowTiddlerClass\",this.tiddlerState.shadowTiddlerClass);\n\tthis.setVariable(\"systemTiddlerClass\",this.tiddlerState.systemTiddlerClass);\n\tthis.setVariable(\"tiddlerTagClasses\",this.tiddlerState.tiddlerTagClasses);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nCompute the tiddler state flags\n*/\nTiddlerWidget.prototype.computeTiddlerState = function() {\n\t// Get our parameters\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Compute the state\n\tvar state = {\n\t\tcurrentTiddler: this.tiddlerTitle || \"\",\n\t\tmissingTiddlerClass: (this.wiki.tiddlerExists(this.tiddlerTitle) || this.wiki.isShadowTiddler(this.tiddlerTitle)) ? \"tc-tiddler-exists\" : \"tc-tiddler-missing\",\n\t\tshadowTiddlerClass: this.wiki.isShadowTiddler(this.tiddlerTitle) ? \"tc-tiddler-shadow\" : \"\",\n\t\tsystemTiddlerClass: this.wiki.isSystemTiddler(this.tiddlerTitle) ? \"tc-tiddler-system\" : \"\",\n\t\ttiddlerTagClasses: this.getTagClasses()\n\t};\n\t// Compute a simple hash to make it easier to detect changes\n\tstate.hash = state.currentTiddler + state.missingTiddlerClass + state.shadowTiddlerClass + state.systemTiddlerClass + state.tiddlerTagClasses;\n\treturn state;\n};\n\n/*\nCreate a string of CSS classes derived from the tags of the current tiddler\n*/\nTiddlerWidget.prototype.getTagClasses = function() {\n\tvar tiddler = this.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler) {\n\t\tvar tags = [];\n\t\t$tw.utils.each(tiddler.fields.tags,function(tag) {\n\t\t\ttags.push(\"tc-tagged-\" + encodeURIComponent(tag));\n\t\t});\n\t\treturn tags.join(\" \");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\tnewTiddlerState = this.computeTiddlerState();\n\tif(changedAttributes.tiddler || newTiddlerState.hash !== this.tiddlerState.hash) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.tiddler = TiddlerWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/tiddler.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/transclude.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/transclude.js\ntype: application/javascript\nmodule-type: widget\n\nTransclude widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TranscludeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTranscludeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTranscludeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTranscludeWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.transcludeTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.transcludeSubTiddler = this.getAttribute(\"subtiddler\");\n\tthis.transcludeField = this.getAttribute(\"field\");\n\tthis.transcludeIndex = this.getAttribute(\"index\");\n\tthis.transcludeMode = this.getAttribute(\"mode\");\n\t// Parse the text reference\n\tvar parseAsInline = !this.parseTreeNode.isBlock;\n\tif(this.transcludeMode === \"inline\") {\n\t\tparseAsInline = true;\n\t} else if(this.transcludeMode === \"block\") {\n\t\tparseAsInline = false;\n\t}\n\tvar parser = this.wiki.parseTextReference(\n\t\t\t\t\t\tthis.transcludeTitle,\n\t\t\t\t\t\tthis.transcludeField,\n\t\t\t\t\t\tthis.transcludeIndex,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tparseAsInline: parseAsInline,\n\t\t\t\t\t\t\tsubTiddler: this.transcludeSubTiddler\n\t\t\t\t\t\t}),\n\t\tparseTreeNodes = parser ? parser.tree : this.parseTreeNode.children;\n\t// Set context variables for recursion detection\n\tvar recursionMarker = this.makeRecursionMarker();\n\tthis.setVariable(\"transclusion\",recursionMarker);\n\t// Check for recursion\n\tif(parser) {\n\t\tif(this.parentWidget && this.parentWidget.hasVariable(\"transclusion\",recursionMarker)) {\n\t\t\tparseTreeNodes = [{type: \"element\", tag: \"span\", attributes: {\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-error\"}\n\t\t\t}, children: [\n\t\t\t\t{type: \"text\", text: $tw.language.getString(\"Error/RecursiveTransclusion\")}\n\t\t\t]}];\n\t\t}\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nCompose a string comprising the title, field and/or index to identify this transclusion for recursion detection\n*/\nTranscludeWidget.prototype.makeRecursionMarker = function() {\n\tvar output = [];\n\toutput.push(\"{\");\n\toutput.push(this.getVariable(\"currentTiddler\",{defaultValue: \"\"}));\n\toutput.push(\"|\");\n\toutput.push(this.transcludeTitle || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeField || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeIndex || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeSubTiddler || \"\");\n\toutput.push(\"}\");\n\treturn output.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTranscludeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedTiddlers[this.transcludeTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.transclude = TranscludeWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/transclude.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/vars.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/vars.js\ntype: application/javascript\nmodule-type: widget\n\nThis widget allows multiple variables to be set in one go:\n\n```\n\\define helloworld() Hello world!\n<$vars greeting=\"Hi\" me={{!!title}} sentence=<<helloworld>>>\n <<greeting>>! I am <<me>> and I say: <<sentence>>\n</$vars>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar VarsWidget = function(parseTreeNode,options) {\n\t// Call the constructor\n\tWidget.call(this);\n\t// Initialise\t\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nVarsWidget.prototype = Object.create(Widget.prototype);\n\n/*\nRender this widget into the DOM\n*/\nVarsWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nVarsWidget.prototype.execute = function() {\n\t// Parse variables\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(val,key) {\n\t\tif(key.charAt(0) !== \"$\") {\n\t\t\tself.setVariable(key,val);\n\t\t}\n\t});\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nVarsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(Object.keys(changedAttributes).length) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports[\"vars\"] = VarsWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/vars.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/view.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view.js\ntype: application/javascript\nmodule-type: widget\n\nView widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ViewWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nViewWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nViewWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tif(this.text) {\n\t\tvar textNode = this.document.createTextNode(this.text);\n\t\tparent.insertBefore(textNode,nextSibling);\n\t\tthis.domNodes.push(textNode);\n\t} else {\n\t\tthis.makeChildWidgets();\n\t\tthis.renderChildren(parent,nextSibling);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nViewWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.viewTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.viewSubtiddler = this.getAttribute(\"subtiddler\");\n\tthis.viewField = this.getAttribute(\"field\",\"text\");\n\tthis.viewIndex = this.getAttribute(\"index\");\n\tthis.viewFormat = this.getAttribute(\"format\",\"text\");\n\tthis.viewTemplate = this.getAttribute(\"template\",\"\");\n\tswitch(this.viewFormat) {\n\t\tcase \"htmlwikified\":\n\t\t\tthis.text = this.getValueAsHtmlWikified();\n\t\t\tbreak;\n\t\tcase \"plainwikified\":\n\t\t\tthis.text = this.getValueAsPlainWikified();\n\t\t\tbreak;\n\t\tcase \"htmlencodedplainwikified\":\n\t\t\tthis.text = this.getValueAsHtmlEncodedPlainWikified();\n\t\t\tbreak;\n\t\tcase \"htmlencoded\":\n\t\t\tthis.text = this.getValueAsHtmlEncoded();\n\t\t\tbreak;\n\t\tcase \"urlencoded\":\n\t\t\tthis.text = this.getValueAsUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"doubleurlencoded\":\n\t\t\tthis.text = this.getValueAsDoubleUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\tthis.text = this.getValueAsDate(this.viewTemplate);\n\t\t\tbreak;\n\t\tcase \"relativedate\":\n\t\t\tthis.text = this.getValueAsRelativeDate();\n\t\t\tbreak;\n\t\tcase \"stripcomments\":\n\t\t\tthis.text = this.getValueAsStrippedComments();\n\t\t\tbreak;\n\t\tcase \"jsencoded\":\n\t\t\tthis.text = this.getValueAsJsEncoded();\n\t\t\tbreak;\n\t\tdefault: // \"text\"\n\t\t\tthis.text = this.getValueAsText();\n\t\t\tbreak;\n\t}\n};\n\n/*\nThe various formatter functions are baked into this widget for the moment. Eventually they will be replaced by macro functions\n*/\n\n/*\nRetrieve the value of the widget. Options are:\nasString: Optionally return the value as a string\n*/\nViewWidget.prototype.getValue = function(options) {\n\toptions = options || {};\n\tvar value = options.asString ? \"\" : undefined;\n\tif(this.viewIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.viewTitle,this.viewIndex);\n\t} else {\n\t\tvar tiddler;\n\t\tif(this.viewSubtiddler) {\n\t\t\ttiddler = this.wiki.getSubTiddler(this.viewTitle,this.viewSubtiddler);\t\n\t\t} else {\n\t\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\t\t}\n\t\tif(tiddler) {\n\t\t\tif(this.viewField === \"text\" && !this.viewSubtiddler) {\n\t\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\t\tvalue = this.wiki.getTiddlerText(this.viewTitle);\n\t\t\t} else {\n\t\t\t\tif($tw.utils.hop(tiddler.fields,this.viewField)) {\n\t\t\t\t\tif(options.asString) {\n\t\t\t\t\t\tvalue = tiddler.getFieldString(this.viewField);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = tiddler.fields[this.viewField];\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif(this.viewField === \"title\") {\n\t\t\t\tvalue = this.viewTitle;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n\nViewWidget.prototype.getValueAsText = function() {\n\treturn this.getValue({asString: true});\n};\n\nViewWidget.prototype.getValueAsHtmlWikified = function() {\n\treturn this.wiki.renderText(\"text/html\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{parentWidget: this});\n};\n\nViewWidget.prototype.getValueAsPlainWikified = function() {\n\treturn this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{parentWidget: this});\n};\n\nViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function() {\n\treturn $tw.utils.htmlEncode(this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{parentWidget: this}));\n};\n\nViewWidget.prototype.getValueAsHtmlEncoded = function() {\n\treturn $tw.utils.htmlEncode(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsUrlEncoded = function() {\n\treturn encodeURIComponent(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsDoubleUrlEncoded = function() {\n\treturn encodeURIComponent(encodeURIComponent(this.getValueAsText()));\n};\n\nViewWidget.prototype.getValueAsDate = function(format) {\n\tformat = format || \"YYYY MM DD 0hh:0mm\";\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.formatDateString(value,format);\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsRelativeDate = function(format) {\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsStrippedComments = function() {\n\tvar lines = this.getValueAsText().split(\"\\n\"),\n\t\tout = [];\n\tfor(var line=0; line<lines.length; line++) {\n\t\tvar text = lines[line];\n\t\tif(!/^\\s*\\/\\/#/.test(text)) {\n\t\t\tout.push(text);\n\t\t}\n\t}\n\treturn out.join(\"\\n\");\n};\n\nViewWidget.prototype.getValueAsJsEncoded = function() {\n\treturn $tw.utils.stringify(this.getValueAsText());\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nViewWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.template || changedAttributes.format || changedTiddlers[this.viewTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports.view = ViewWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/view.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/widget.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/widget.js\ntype: application/javascript\nmodule-type: widget\n\nWidget base class\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate a widget object for a parse tree node\n\tparseTreeNode: reference to the parse tree node to be rendered\n\toptions: see below\nOptions include:\n\twiki: mandatory reference to wiki associated with this render tree\n\tparentWidget: optional reference to a parent renderer node for the context chain\n\tdocument: optional document object to use instead of global document\n*/\nvar Widget = function(parseTreeNode,options) {\n\tif(arguments.length > 0) {\n\t\tthis.initialise(parseTreeNode,options);\n\t}\n};\n\n/*\nInitialise widget properties. These steps are pulled out of the constructor so that we can reuse them in subclasses\n*/\nWidget.prototype.initialise = function(parseTreeNode,options) {\n\toptions = options || {};\n\t// Save widget info\n\tthis.parseTreeNode = parseTreeNode;\n\tthis.wiki = options.wiki;\n\tthis.parentWidget = options.parentWidget;\n\tthis.variablesConstructor = function() {};\n\tthis.variablesConstructor.prototype = this.parentWidget ? this.parentWidget.variables : {};\n\tthis.variables = new this.variablesConstructor();\n\tthis.document = options.document;\n\tthis.attributes = {};\n\tthis.children = [];\n\tthis.domNodes = [];\n\tthis.eventListeners = {};\n\t// Hashmap of the widget classes\n\tif(!this.widgetClasses) {\n\t\tWidget.prototype.widgetClasses = $tw.modules.applyMethods(\"widget\");\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nWidget.prototype.execute = function() {\n\tthis.makeChildWidgets();\n};\n\n/*\nSet the value of a context variable\nname: name of the variable\nvalue: value of the variable\nparams: array of {name:, default:} for each parameter\n*/\nWidget.prototype.setVariable = function(name,value,params) {\n\tthis.variables[name] = {value: value, params: params};\n};\n\n/*\nGet the prevailing value of a context variable\nname: name of variable\noptions: see below\nOptions include\nparams: array of {name:, value:} for each parameter\ndefaultValue: default value if the variable is not defined\n*/\nWidget.prototype.getVariable = function(name,options) {\n\toptions = options || {};\n\tvar actualParams = options.params || [],\n\t\tparentWidget = this.parentWidget;\n\t// Check for the variable defined in the parent widget (or an ancestor in the prototype chain)\n\tif(parentWidget && name in parentWidget.variables) {\n\t\tvar variable = parentWidget.variables[name],\n\t\t\tvalue = variable.value;\n\t\t// Substitute any parameters specified in the definition\n\t\tvalue = this.substituteVariableParameters(value,variable.params,actualParams);\n\t\tvalue = this.substituteVariableReferences(value);\n\t\treturn value;\n\t}\n\t// If the variable doesn't exist in the parent widget then look for a macro module\n\treturn this.evaluateMacroModule(name,actualParams,options.defaultValue);\n};\n\nWidget.prototype.substituteVariableParameters = function(text,formalParams,actualParams) {\n\tif(formalParams) {\n\t\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\t\tparamInfo, paramValue;\n\t\t// Step through each of the parameters in the macro definition\n\t\tfor(var p=0; p<formalParams.length; p++) {\n\t\t\t// Check if we've got a macro call parameter with the same name\n\t\t\tparamInfo = formalParams[p];\n\t\t\tparamValue = undefined;\n\t\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If not, use the next available anonymous macro call parameter\n\t\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\t\tnextAnonParameter++;\n\t\t\t}\n\t\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t\t}\n\t\t\t// If we've still not got a value, use the default, if any\n\t\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t\t// Replace any instances of this parameter\n\t\t\ttext = $tw.utils.replaceString(text,new RegExp(\"\\\\$\" + $tw.utils.escapeRegExp(paramInfo.name) + \"\\\\$\",\"mg\"),paramValue);\n\t\t}\n\t}\n\treturn text;\n};\n\nWidget.prototype.substituteVariableReferences = function(text) {\n\tvar self = this;\n\treturn (text || \"\").replace(/\\$\\(([^\\)\\$]+)\\)\\$/g,function(match,p1,offset,string) {\n\t\treturn self.getVariable(p1,{defaultValue: \"\"});\n\t});\n};\n\nWidget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue) {\n\tif($tw.utils.hop($tw.macros,name)) {\n\t\tvar macro = $tw.macros[name],\n\t\t\targs = [];\n\t\tif(macro.params.length > 0) {\n\t\t\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\t\t\tparamInfo, paramValue;\n\t\t\t// Step through each of the parameters in the macro definition\n\t\t\tfor(var p=0; p<macro.params.length; p++) {\n\t\t\t\t// Check if we've got a macro call parameter with the same name\n\t\t\t\tparamInfo = macro.params[p];\n\t\t\t\tparamValue = undefined;\n\t\t\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If not, use the next available anonymous macro call parameter\n\t\t\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\t\t\tnextAnonParameter++;\n\t\t\t\t}\n\t\t\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t\t\t}\n\t\t\t\t// If we've still not got a value, use the default, if any\n\t\t\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t\t\t// Save the parameter\n\t\t\t\targs.push(paramValue);\n\t\t\t}\n\t\t}\n\t\telse for(var i=0; i<actualParams.length; ++i) {\n\t\t\targs.push(actualParams[i].value);\n\t\t}\n\t\treturn (macro.run.apply(this,args) || \"\").toString();\n\t} else {\n\t\treturn defaultValue;\n\t}\n};\n\n/*\nCheck whether a given context variable value exists in the parent chain\n*/\nWidget.prototype.hasVariable = function(name,value) {\n\tvar node = this;\n\twhile(node) {\n\t\tif($tw.utils.hop(node.variables,name) && node.variables[name].value === value) {\n\t\t\treturn true;\n\t\t}\n\t\tnode = node.parentWidget;\n\t}\n\treturn false;\n};\n\n/*\nConstruct a qualifying string based on a hash of concatenating the values of a given variable in the parent chain\n*/\nWidget.prototype.getStateQualifier = function(name) {\n\tthis.qualifiers = this.qualifiers || Object.create(null);\n\tname = name || \"transclusion\";\n\tif(this.qualifiers[name]) {\n\t\treturn this.qualifiers[name];\n\t} else {\n\t\tvar output = [],\n\t\t\tnode = this;\n\t\twhile(node && node.parentWidget) {\n\t\t\tif($tw.utils.hop(node.parentWidget.variables,name)) {\n\t\t\t\toutput.push(node.getVariable(name));\n\t\t\t}\n\t\t\tnode = node.parentWidget;\n\t\t}\n\t\tvar value = $tw.utils.hashString(output.join(\"\"));\n\t\tthis.qualifiers[name] = value;\n\t\treturn value;\n\t}\n};\n\n/*\nCompute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed\n*/\nWidget.prototype.computeAttributes = function() {\n\tvar changedAttributes = {},\n\t\tself = this,\n\t\tvalue;\n\t$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {\n\t\tif(attribute.type === \"filtered\") {\n\t\t\tvalue = self.wiki.filterTiddlers(attribute.filter,self)[0] || \"\";\n\t\t} else if(attribute.type === \"indirect\") {\n\t\t\tvalue = self.wiki.getTextReference(attribute.textReference,\"\",self.getVariable(\"currentTiddler\"));\n\t\t} else if(attribute.type === \"macro\") {\n\t\t\tvalue = self.getVariable(attribute.value.name,{params: attribute.value.params});\n\t\t} else { // String attribute\n\t\t\tvalue = attribute.value;\n\t\t}\n\t\t// Check whether the attribute has changed\n\t\tif(self.attributes[name] !== value) {\n\t\t\tself.attributes[name] = value;\n\t\t\tchangedAttributes[name] = true;\n\t\t}\n\t});\n\treturn changedAttributes;\n};\n\n/*\nCheck for the presence of an attribute\n*/\nWidget.prototype.hasAttribute = function(name) {\n\treturn $tw.utils.hop(this.attributes,name);\n};\n\n/*\nGet the value of an attribute\n*/\nWidget.prototype.getAttribute = function(name,defaultText) {\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\treturn this.attributes[name];\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nAssign the computed attributes of the widget to a domNode\noptions include:\nexcludeEventAttributes: ignores attributes whose name begins with \"on\"\n*/\nWidget.prototype.assignAttributes = function(domNode,options) {\n\toptions = options || {};\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(v,a) {\n\t\t// Check exclusions\n\t\tif(options.excludeEventAttributes && a.substr(0,2) === \"on\") {\n\t\t\tv = undefined;\n\t\t}\n\t\tif(v !== undefined) {\n\t\t\tvar b = a.split(\":\");\n\t\t\t// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)\n\t\t\ttry {\n\t\t\t\tif (b.length == 2 && b[0] == \"xlink\"){\n\t\t\t\t\tdomNode.setAttributeNS(\"http://www.w3.org/1999/xlink\",b[1],v);\n\t\t\t\t} else {\n\t\t\t\t\tdomNode.setAttributeNS(null,a,v);\n\t\t\t\t}\n\t\t\t} catch(e) {\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nMake child widgets correspondng to specified parseTreeNodes\n*/\nWidget.prototype.makeChildWidgets = function(parseTreeNodes) {\n\tthis.children = [];\n\tvar self = this;\n\t$tw.utils.each(parseTreeNodes || (this.parseTreeNode && this.parseTreeNode.children),function(childNode) {\n\t\tself.children.push(self.makeChildWidget(childNode));\n\t});\n};\n\n/*\nConstruct the widget object for a parse tree node\n*/\nWidget.prototype.makeChildWidget = function(parseTreeNode) {\n\tvar WidgetClass = this.widgetClasses[parseTreeNode.type];\n\tif(!WidgetClass) {\n\t\tWidgetClass = this.widgetClasses.text;\n\t\tparseTreeNode = {type: \"text\", text: \"Undefined widget '\" + parseTreeNode.type + \"'\"};\n\t}\n\treturn new WidgetClass(parseTreeNode,{\n\t\twiki: this.wiki,\n\t\tvariables: {},\n\t\tparentWidget: this,\n\t\tdocument: this.document\n\t});\n};\n\n/*\nGet the next sibling of this widget\n*/\nWidget.prototype.nextSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index < this.parentWidget.children.length-1) {\n\t\t\treturn this.parentWidget.children[index+1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGet the previous sibling of this widget\n*/\nWidget.prototype.previousSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index > 0) {\n\t\t\treturn this.parentWidget.children[index-1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRender the children of this widget into the DOM\n*/\nWidget.prototype.renderChildren = function(parent,nextSibling) {\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\tchildWidget.render(parent,nextSibling);\n\t});\n};\n\n/*\nAdd a list of event listeners from an array [{type:,handler:},...]\n*/\nWidget.prototype.addEventListeners = function(listeners) {\n\tvar self = this;\n\t$tw.utils.each(listeners,function(listenerInfo) {\n\t\tself.addEventListener(listenerInfo.type,listenerInfo.handler);\n\t});\n};\n\n/*\nAdd an event listener\n*/\nWidget.prototype.addEventListener = function(type,handler) {\n\tvar self = this;\n\tif(typeof handler === \"string\") { // The handler is a method name on this widget\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn self[handler].call(self,event);\n\t\t};\n\t} else { // The handler is a function\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn handler.call(self,event);\n\t\t};\n\t}\n};\n\n/*\nDispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget\n*/\nWidget.prototype.dispatchEvent = function(event) {\n\t// Dispatch the event if this widget handles it\n\tvar listener = this.eventListeners[event.type];\n\tif(listener) {\n\t\t// Don't propagate the event if the listener returned false\n\t\tif(!listener(event)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Dispatch the event to the parent widget\n\tif(this.parentWidget) {\n\t\treturn this.parentWidget.dispatchEvent(event);\n\t}\n\treturn true;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nRebuild a previously rendered widget\n*/\nWidget.prototype.refreshSelf = function() {\n\tvar nextSibling = this.findNextSiblingDomNode();\n\tthis.removeChildDomNodes();\n\tthis.render(this.parentDomNode,nextSibling);\n};\n\n/*\nRefresh all the children of a widget\n*/\nWidget.prototype.refreshChildren = function(changedTiddlers) {\n\tvar self = this,\n\t\trefreshed = false;\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\trefreshed = childWidget.refresh(changedTiddlers) || refreshed;\n\t});\n\treturn refreshed;\n};\n\n/*\nFind the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node\n*/\nWidget.prototype.findNextSiblingDomNode = function(startIndex) {\n\t// Refer to this widget by its index within its parents children\n\tvar parent = this.parentWidget,\n\t\tindex = startIndex !== undefined ? startIndex : parent.children.indexOf(this);\nif(index === -1) {\n\tthrow \"node not found in parents children\";\n}\n\t// Look for a DOM node in the later siblings\n\twhile(++index < parent.children.length) {\n\t\tvar domNode = parent.children[index].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\t// Go back and look for later siblings of our parent if it has the same parent dom node\n\tvar grandParent = parent.parentWidget;\n\tif(grandParent && parent.parentDomNode === this.parentDomNode) {\n\t\tindex = grandParent.children.indexOf(parent);\n\t\tif(index !== -1) {\n\t\t\treturn parent.findNextSiblingDomNode(index);\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nFind the first DOM node generated by a widget or its children\n*/\nWidget.prototype.findFirstDomNode = function() {\n\t// Return the first dom node of this widget, if we've got one\n\tif(this.domNodes.length > 0) {\n\t\treturn this.domNodes[0];\n\t}\n\t// Otherwise, recursively call our children\n\tfor(var t=0; t<this.children.length; t++) {\n\t\tvar domNode = this.children[t].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRemove any DOM nodes created by this widget or its children\n*/\nWidget.prototype.removeChildDomNodes = function() {\n\t// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case\n\tif(this.domNodes.length > 0) {\n\t\t$tw.utils.each(this.domNodes,function(domNode) {\n\t\t\tdomNode.parentNode.removeChild(domNode);\n\t\t});\n\t\tthis.domNodes = [];\n\t} else {\n\t\t// Otherwise, ask the child widgets to delete their DOM nodes\n\t\t$tw.utils.each(this.children,function(childWidget) {\n\t\t\tchildWidget.removeChildDomNodes();\n\t\t});\n\t}\n};\n\n/*\nInvoke the action widgets that are descendents of the current widget.\n*/\nWidget.prototype.invokeActions = function(triggeringWidget,event) {\n\tvar handled = false;\n\t// For each child widget\n\tfor(var t=0; t<this.children.length; t++) {\n\t\tvar child = this.children[t];\n\t\t// Invoke the child if it is an action widget\n\t\tif(child.invokeAction) {\n\t\t\tchild.refreshSelf();\n\t\t\tif(child.invokeAction(triggeringWidget,event)) {\n\t\t\t\thandled = true;\n\t\t\t}\n\t\t}\n\t\t// Propagate through through the child if it permits it\n\t\tif(child.allowActionPropagation() && child.invokeActions(triggeringWidget,event)) {\n\t\t\thandled = true;\n\t\t}\n\t}\n\treturn handled;\n};\n\n/*\nInvoke the action widgets defined in a string\n*/\nWidget.prototype.invokeActionString = function(actions,triggeringWidget,event,variables) {\n\tactions = actions || \"\";\n\tvar parser = this.wiki.parseText(\"text/vnd.tiddlywiki\",actions,{\n\t\t\tparentWidget: this,\n\t\t\tdocument: this.document\n\t\t}),\n\t\twidgetNode = this.wiki.makeWidget(parser,{\n\t\t\tparentWidget: this,\n\t\t\tdocument: this.document,\n\t\t\tvariables: variables\n\t\t});\n\tvar container = this.document.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn widgetNode.invokeActions(this,event);\n};\n\nWidget.prototype.allowActionPropagation = function() {\n\treturn true;\n};\n\nexports.widget = Widget;\n\n})();\n",
"title": "$:/core/modules/widgets/widget.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/wikify.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/wikify.js\ntype: application/javascript\nmodule-type: widget\n\nWidget to wikify text into a variable\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar WikifyWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nWikifyWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nWikifyWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nWikifyWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.wikifyName = this.getAttribute(\"name\");\n\tthis.wikifyText = this.getAttribute(\"text\");\n\tthis.wikifyType = this.getAttribute(\"type\");\n\tthis.wikifyMode = this.getAttribute(\"mode\",\"block\");\n\tthis.wikifyOutput = this.getAttribute(\"output\",\"text\");\n\t// Create the parse tree\n\tthis.wikifyParser = this.wiki.parseText(this.wikifyType,this.wikifyText,{\n\t\t\tparseAsInline: this.wikifyMode === \"inline\"\n\t\t});\n\t// Create the widget tree \n\tthis.wikifyWidgetNode = this.wiki.makeWidget(this.wikifyParser,{\n\t\t\tdocument: $tw.fakeDocument,\n\t\t\tparentWidget: this\n\t\t});\n\t// Render the widget tree to the container\n\tthis.wikifyContainer = $tw.fakeDocument.createElement(\"div\");\n\tthis.wikifyWidgetNode.render(this.wikifyContainer,null);\n\tthis.wikifyResult = this.getResult();\n\t// Set context variable\n\tthis.setVariable(this.wikifyName,this.wikifyResult);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nReturn the result string\n*/\nWikifyWidget.prototype.getResult = function() {\n\tvar result;\n\tswitch(this.wikifyOutput) {\n\t\tcase \"text\":\n\t\t\tresult = this.wikifyContainer.textContent;\n\t\t\tbreak;\n\t\tcase \"formattedtext\":\n\t\t\tresult = this.wikifyContainer.formattedTextContent;\n\t\t\tbreak;\n\t\tcase \"html\":\n\t\t\tresult = this.wikifyContainer.innerHTML;\n\t\t\tbreak;\n\t\tcase \"parsetree\":\n\t\t\tresult = JSON.stringify(this.wikifyParser.tree,0,$tw.config.preferences.jsonSpaces);\n\t\t\tbreak;\n\t\tcase \"widgettree\":\n\t\t\tresult = JSON.stringify(this.getWidgetTree(),0,$tw.config.preferences.jsonSpaces);\n\t\t\tbreak;\n\t}\n\treturn result;\n};\n\n/*\nReturn a string of the widget tree\n*/\nWikifyWidget.prototype.getWidgetTree = function() {\n\tvar copyNode = function(widgetNode,resultNode) {\n\t\t\tvar type = widgetNode.parseTreeNode.type;\n\t\t\tresultNode.type = type;\n\t\t\tswitch(type) {\n\t\t\t\tcase \"element\":\n\t\t\t\t\tresultNode.tag = widgetNode.parseTreeNode.tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"text\":\n\t\t\t\t\tresultNode.text = widgetNode.parseTreeNode.text;\n\t\t\t\t\tbreak;\t\n\t\t\t}\n\t\t\tif(Object.keys(widgetNode.attributes || {}).length > 0) {\n\t\t\t\tresultNode.attributes = {};\n\t\t\t\t$tw.utils.each(widgetNode.attributes,function(attr,attrName) {\n\t\t\t\t\tresultNode.attributes[attrName] = widgetNode.getAttribute(attrName);\n\t\t\t\t});\n\t\t\t}\n\t\t\tif(Object.keys(widgetNode.children || {}).length > 0) {\n\t\t\t\tresultNode.children = [];\n\t\t\t\t$tw.utils.each(widgetNode.children,function(widgetChildNode) {\n\t\t\t\t\tvar node = {};\n\t\t\t\t\tresultNode.children.push(node);\n\t\t\t\t\tcopyNode(widgetChildNode,node);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresults = {};\n\tcopyNode(this.wikifyWidgetNode,results);\n\treturn results;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nWikifyWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Refresh ourselves entirely if any of our attributes have changed\n\tif(changedAttributes.name || changedAttributes.text || changedAttributes.type || changedAttributes.mode || changedAttributes.output) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\t// Refresh the widget tree\n\t\tif(this.wikifyWidgetNode.refresh(changedTiddlers)) {\n\t\t\t// Check if there was any change\n\t\t\tvar result = this.getResult();\n\t\t\tif(result !== this.wikifyResult) {\n\t\t\t\t// If so, save the change\n\t\t\t\tthis.wikifyResult = result;\n\t\t\t\tthis.setVariable(this.wikifyName,this.wikifyResult);\n\t\t\t\t// Refresh each of our child widgets\n\t\t\t\t$tw.utils.each(this.children,function(childWidget) {\n\t\t\t\t\tchildWidget.refreshSelf();\n\t\t\t\t});\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// Just refresh the children\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.wikify = WikifyWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/wikify.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/wiki-bulkops.js": {
"text": "/*\\\ntitle: $:/core/modules/wiki-bulkops.js\ntype: application/javascript\nmodule-type: wikimethod\n\nBulk tiddler operations such as rename.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRename a tiddler, and relink any tags or lists that reference it.\n*/\nfunction renameTiddler(fromTitle,toTitle,options) {\n\tfromTitle = (fromTitle || \"\").trim();\n\ttoTitle = (toTitle || \"\").trim();\n\toptions = options || {};\n\tif(fromTitle && toTitle && fromTitle !== toTitle) {\n\t\t// Rename the tiddler itself\n\t\tvar oldTiddler = this.getTiddler(fromTitle),\n\t\t\tnewTiddler = new $tw.Tiddler(oldTiddler,{title: toTitle},this.getModificationFields());\n\t\tnewTiddler = $tw.hooks.invokeHook(\"th-renaming-tiddler\",newTiddler,oldTiddler);\n\t\tthis.addTiddler(newTiddler);\n\t\tthis.deleteTiddler(fromTitle);\n\t\t// Rename any tags or lists that reference it\n\t\tthis.relinkTiddler(fromTitle,toTitle,options)\n\t}\n}\n\n/*\nRelink any tags or lists that reference a given tiddler\n*/\nfunction relinkTiddler(fromTitle,toTitle,options) {\n\tvar self = this;\n\tfromTitle = (fromTitle || \"\").trim();\n\ttoTitle = (toTitle || \"\").trim();\n\toptions = options || {};\n\tif(fromTitle && toTitle && fromTitle !== toTitle) {\n\t\tthis.each(function(tiddler,title) {\n\t\t\tvar type = tiddler.fields.type || \"\";\n\t\t\t// Don't touch plugins or JavaScript modules\n\t\t\tif(!tiddler.fields[\"plugin-type\"] && type !== \"application/javascript\") {\n\t\t\t\tvar tags = (tiddler.fields.tags || []).slice(0),\n\t\t\t\t\tlist = (tiddler.fields.list || []).slice(0),\n\t\t\t\t\tisModified = false;\n\t\t\t\tif(!options.dontRenameInTags) {\n\t\t\t\t\t// Rename tags\n\t\t\t\t\t$tw.utils.each(tags,function (title,index) {\n\t\t\t\t\t\tif(title === fromTitle) {\nconsole.log(\"Renaming tag '\" + tags[index] + \"' to '\" + toTitle + \"' of tiddler '\" + tiddler.fields.title + \"'\");\n\t\t\t\t\t\t\ttags[index] = toTitle;\n\t\t\t\t\t\t\tisModified = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(!options.dontRenameInLists) {\n\t\t\t\t\t// Rename lists\n\t\t\t\t\t$tw.utils.each(list,function (title,index) {\n\t\t\t\t\t\tif(title === fromTitle) {\nconsole.log(\"Renaming list item '\" + list[index] + \"' to '\" + toTitle + \"' of tiddler '\" + tiddler.fields.title + \"'\");\n\t\t\t\t\t\t\tlist[index] = toTitle;\n\t\t\t\t\t\t\tisModified = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(isModified) {\n\t\t\t\t\tvar newTiddler = new $tw.Tiddler(tiddler,{tags: tags, list: list},self.getModificationFields())\n\t\t\t\t\tnewTiddler = $tw.hooks.invokeHook(\"th-relinking-tiddler\",newTiddler,tiddler);\n\t\t\t\t\tself.addTiddler(newTiddler);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.renameTiddler = renameTiddler;\nexports.relinkTiddler = relinkTiddler;\n\n})();\n",
"title": "$:/core/modules/wiki-bulkops.js",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/modules/wiki.js": {
"text": "/*\\\ntitle: $:/core/modules/wiki.js\ntype: application/javascript\nmodule-type: wikimethod\n\nExtension methods for the $tw.Wiki object\n\nAdds the following properties to the wiki object:\n\n* `eventListeners` is a hashmap by type of arrays of listener functions\n* `changedTiddlers` is a hashmap describing changes to named tiddlers since wiki change events were last dispatched. Each entry is a hashmap containing two fields:\n\tmodified: true/false\n\tdeleted: true/false\n* `changeCount` is a hashmap by tiddler title containing a numerical index that starts at zero and is incremented each time a tiddler is created changed or deleted\n* `caches` is a hashmap by tiddler title containing a further hashmap of named cache objects. Caches are automatically cleared when a tiddler is modified or deleted\n* `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar USER_NAME_TITLE = \"$:/status/UserName\",\n\tTIMESTAMP_DISABLE_TITLE = \"$:/config/TimestampDisable\";\n\n/*\nGet the value of a text reference. Text references can have any of these forms:\n\t<tiddlertitle>\n\t<tiddlertitle>!!<fieldname>\n\t!!<fieldname> - specifies a field of the current tiddlers\n\t<tiddlertitle>##<index>\n*/\nexports.getTextReference = function(textRef,defaultText,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle = tr.title || currTiddlerTitle;\n\tif(tr.field) {\n\t\tvar tiddler = this.getTiddler(title);\n\t\tif(tr.field === \"title\") { // Special case so we can return the title of a non-existent tiddler\n\t\t\treturn title;\n\t\t} else if(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\treturn tiddler.getFieldString(tr.field);\n\t\t} else {\n\t\t\treturn defaultText;\n\t\t}\n\t} else if(tr.index) {\n\t\treturn this.extractTiddlerDataItem(title,tr.index,defaultText);\n\t} else {\n\t\treturn this.getTiddlerText(title,defaultText);\n\t}\n};\n\nexports.setTextReference = function(textRef,value,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle = tr.title || currTiddlerTitle;\n\tthis.setText(title,tr.field,tr.index,value);\n};\n\nexports.setText = function(title,field,index,value,options) {\n\toptions = options || {};\n\tvar creationFields = options.suppressTimestamp ? {} : this.getCreationFields(),\n\t\tmodificationFields = options.suppressTimestamp ? {} : this.getModificationFields();\n\t// Check if it is a reference to a tiddler field\n\tif(index) {\n\t\tvar data = this.getTiddlerData(title,Object.create(null));\n\t\tif(value !== undefined) {\n\t\t\tdata[index] = value;\n\t\t} else {\n\t\t\tdelete data[index];\n\t\t}\n\t\tthis.setTiddlerData(title,data,modificationFields);\n\t} else {\n\t\tvar tiddler = this.getTiddler(title),\n\t\t\tfields = {title: title};\n\t\tfields[field || \"text\"] = value;\n\t\tthis.addTiddler(new $tw.Tiddler(creationFields,tiddler,fields,modificationFields));\n\t}\n};\n\nexports.deleteTextReference = function(textRef,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle,tiddler,fields;\n\t// Check if it is a reference to a tiddler\n\tif(tr.title && !tr.field) {\n\t\tthis.deleteTiddler(tr.title);\n\t// Else check for a field reference\n\t} else if(tr.field) {\n\t\ttitle = tr.title || currTiddlerTitle;\n\t\ttiddler = this.getTiddler(title);\n\t\tif(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\tfields = Object.create(null);\n\t\t\tfields[tr.field] = undefined;\n\t\t\tthis.addTiddler(new $tw.Tiddler(tiddler,fields,this.getModificationFields()));\n\t\t}\n\t}\n};\n\nexports.addEventListener = function(type,listener) {\n\tthis.eventListeners = this.eventListeners || {};\n\tthis.eventListeners[type] = this.eventListeners[type] || [];\n\tthis.eventListeners[type].push(listener);\t\n};\n\nexports.removeEventListener = function(type,listener) {\n\tvar listeners = this.eventListeners[type];\n\tif(listeners) {\n\t\tvar p = listeners.indexOf(listener);\n\t\tif(p !== -1) {\n\t\t\tlisteners.splice(p,1);\n\t\t}\n\t}\n};\n\nexports.dispatchEvent = function(type /*, args */) {\n\tvar args = Array.prototype.slice.call(arguments,1),\n\t\tlisteners = this.eventListeners[type];\n\tif(listeners) {\n\t\tfor(var p=0; p<listeners.length; p++) {\n\t\t\tvar listener = listeners[p];\n\t\t\tlistener.apply(listener,args);\n\t\t}\n\t}\n};\n\n/*\nCauses a tiddler to be marked as changed, incrementing the change count, and triggers event handlers.\nThis method should be called after the changes it describes have been made to the wiki.tiddlers[] array.\n\ttitle: Title of tiddler\n\tisDeleted: defaults to false (meaning the tiddler has been created or modified),\n\t\ttrue if the tiddler has been deleted\n*/\nexports.enqueueTiddlerEvent = function(title,isDeleted) {\n\t// Record the touch in the list of changed tiddlers\n\tthis.changedTiddlers = this.changedTiddlers || Object.create(null);\n\tthis.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null);\n\tthis.changedTiddlers[title][isDeleted ? \"deleted\" : \"modified\"] = true;\n\t// Increment the change count\n\tthis.changeCount = this.changeCount || Object.create(null);\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\tthis.changeCount[title]++;\n\t} else {\n\t\tthis.changeCount[title] = 1;\n\t}\n\t// Trigger events\n\tthis.eventListeners = this.eventListeners || {};\n\tif(!this.eventsTriggered) {\n\t\tvar self = this;\n\t\t$tw.utils.nextTick(function() {\n\t\t\tvar changes = self.changedTiddlers;\n\t\t\tself.changedTiddlers = Object.create(null);\n\t\t\tself.eventsTriggered = false;\n\t\t\tif($tw.utils.count(changes) > 0) {\n\t\t\t\tself.dispatchEvent(\"change\",changes);\n\t\t\t}\n\t\t});\n\t\tthis.eventsTriggered = true;\n\t}\n};\n\nexports.getSizeOfTiddlerEventQueue = function() {\n\treturn $tw.utils.count(this.changedTiddlers);\n};\n\nexports.clearTiddlerEventQueue = function() {\n\tthis.changedTiddlers = Object.create(null);\n\tthis.changeCount = Object.create(null);\n};\n\nexports.getChangeCount = function(title) {\n\tthis.changeCount = this.changeCount || Object.create(null);\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\treturn this.changeCount[title];\n\t} else {\n\t\treturn 0;\n\t}\n};\n\n/*\nGenerate an unused title from the specified base\n*/\nexports.generateNewTitle = function(baseTitle,options) {\n\toptions = options || {};\n\tvar c = 0,\n\t\ttitle = baseTitle;\n\twhile(this.tiddlerExists(title) || this.isShadowTiddler(title) || this.findDraft(title)) {\n\t\ttitle = baseTitle + \n\t\t\t(options.prefix || \" \") + \n\t\t\t(++c);\n\t}\n\treturn title;\n};\n\nexports.isSystemTiddler = function(title) {\n\treturn title && title.indexOf(\"$:/\") === 0;\n};\n\nexports.isTemporaryTiddler = function(title) {\n\treturn title && title.indexOf(\"$:/temp/\") === 0;\n};\n\nexports.isImageTiddler = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\t\t\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/vnd.tiddlywiki\"];\n\t\treturn !!contentTypeInfo && contentTypeInfo.flags.indexOf(\"image\") !== -1;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLike addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported\n*/\nexports.importTiddler = function(tiddler) {\n\tvar existingTiddler = this.getTiddler(tiddler.fields.title);\n\t// Check if we're dealing with a plugin\n\tif(tiddler && tiddler.hasField(\"plugin-type\") && tiddler.hasField(\"version\") && existingTiddler && existingTiddler.hasField(\"plugin-type\") && existingTiddler.hasField(\"version\")) {\n\t\t// Reject the incoming plugin if it is older\n\t\tif(!$tw.utils.checkVersions(tiddler.fields.version,existingTiddler.fields.version)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Fall through to adding the tiddler\n\tthis.addTiddler(tiddler);\n\treturn true;\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is created\n*/\nexports.getCreationFields = function() {\n\tif(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,\"\").toLowerCase() !== \"yes\") {\n\t\tvar fields = {\n\t\t\t\tcreated: new Date()\n\t\t\t},\n\t\t\tcreator = this.getTiddlerText(USER_NAME_TITLE);\n\t\tif(creator) {\n\t\t\tfields.creator = creator;\n\t\t}\n\t\treturn fields;\n\t} else {\n\t\treturn {};\n\t}\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is modified\n*/\nexports.getModificationFields = function() {\n\tif(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,\"\").toLowerCase() !== \"yes\") {\n\t\tvar fields = Object.create(null),\n\t\t\tmodifier = this.getTiddlerText(USER_NAME_TITLE);\n\t\tfields.modified = new Date();\n\t\tif(modifier) {\n\t\t\tfields.modifier = modifier;\n\t\t}\n\t\treturn fields;\n\t} else {\n\t\treturn {};\n\t}\n};\n\n/*\nReturn a sorted array of tiddler titles. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.getTiddlers = function(options) {\n\toptions = options || Object.create(null);\n\tvar self = this,\n\t\tsortField = options.sortField || \"title\",\n\t\ttiddlers = [], t, titles = [];\n\tthis.each(function(tiddler,title) {\n\t\tif(options.includeSystem || !self.isSystemTiddler(title)) {\n\t\t\tif(!options.excludeTag || !tiddler.hasTag(options.excludeTag)) {\n\t\t\t\ttiddlers.push(tiddler);\n\t\t\t}\n\t\t}\n\t});\n\ttiddlers.sort(function(a,b) {\n\t\tvar aa = a.fields[sortField].toLowerCase() || \"\",\n\t\t\tbb = b.fields[sortField].toLowerCase() || \"\";\n\t\tif(aa < bb) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(aa > bb) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n\tfor(t=0; t<tiddlers.length; t++) {\n\t\ttitles.push(tiddlers[t].fields.title);\n\t}\n\treturn titles;\n};\n\nexports.countTiddlers = function(excludeTag) {\n\tvar tiddlers = this.getTiddlers({excludeTag: excludeTag});\n\treturn $tw.utils.count(tiddlers);\n};\n\n/*\nReturns a function iterator(callback) that iterates through the specified titles, and invokes the callback with callback(tiddler,title)\n*/\nexports.makeTiddlerIterator = function(titles) {\n\tvar self = this;\n\tif(!$tw.utils.isArray(titles)) {\n\t\ttitles = Object.keys(titles);\n\t} else {\n\t\ttitles = titles.slice(0);\n\t}\n\treturn function(callback) {\n\t\ttitles.forEach(function(title) {\n\t\t\tcallback(self.getTiddler(title),title);\n\t\t});\n\t};\n};\n\n/*\nSort an array of tiddler titles by a specified field\n\ttitles: array of titles (sorted in place)\n\tsortField: name of field to sort by\n\tisDescending: true if the sort should be descending\n\tisCaseSensitive: true if the sort should consider upper and lower case letters to be different\n*/\nexports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric) {\n\tvar self = this;\n\ttitles.sort(function(a,b) {\n\t\tvar x,y,\n\t\t\tcompareNumbers = function(x,y) {\n\t\t\t\tvar result = \n\t\t\t\t\tisNaN(x) && !isNaN(y) ? (isDescending ? -1 : 1) :\n\t\t\t\t\t!isNaN(x) && isNaN(y) ? (isDescending ? 1 : -1) :\n\t\t\t\t\t\t\t\t\t\t\t(isDescending ? y - x : x - y);\n\t\t\t\treturn result;\n\t\t\t};\n\t\tif(sortField !== \"title\") {\n\t\t\tvar tiddlerA = self.getTiddler(a),\n\t\t\t\ttiddlerB = self.getTiddler(b);\n\t\t\tif(tiddlerA) {\n\t\t\t\ta = tiddlerA.fields[sortField] || \"\";\n\t\t\t} else {\n\t\t\t\ta = \"\";\n\t\t\t}\n\t\t\tif(tiddlerB) {\n\t\t\t\tb = tiddlerB.fields[sortField] || \"\";\n\t\t\t} else {\n\t\t\t\tb = \"\";\n\t\t\t}\n\t\t}\n\t\tx = Number(a);\n\t\ty = Number(b);\n\t\tif(isNumeric && (!isNaN(x) || !isNaN(y))) {\n\t\t\treturn compareNumbers(x,y);\n\t\t} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {\n\t\t\treturn isDescending ? b - a : a - b;\n\t\t} else {\n\t\t\ta = String(a);\n\t\t\tb = String(b);\n\t\t\tif(!isCaseSensitive) {\n\t\t\t\ta = a.toLowerCase();\n\t\t\t\tb = b.toLowerCase();\n\t\t\t}\n\t\t\treturn isDescending ? b.localeCompare(a) : a.localeCompare(b);\n\t\t}\n\t});\n};\n\n/*\nFor every tiddler invoke a callback(title,tiddler) with `this` set to the wiki object. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.forEachTiddler = function(/* [options,]callback */) {\n\tvar arg = 0,\n\t\toptions = arguments.length >= 2 ? arguments[arg++] : {},\n\t\tcallback = arguments[arg++],\n\t\ttitles = this.getTiddlers(options),\n\t\tt, tiddler;\n\tfor(t=0; t<titles.length; t++) {\n\t\ttiddler = this.getTiddler(titles[t]);\n\t\tif(tiddler) {\n\t\t\tcallback.call(this,tiddler.fields.title,tiddler);\n\t\t}\n\t}\n};\n\n/*\nReturn an array of tiddler titles that are directly linked from the specified tiddler\n*/\nexports.getTiddlerLinks = function(title) {\n\tvar self = this;\n\t// We'll cache the links so they only get computed if the tiddler changes\n\treturn this.getCacheForTiddler(title,\"links\",function() {\n\t\t// Parse the tiddler\n\t\tvar parser = self.parseTiddler(title);\n\t\t// Count up the links\n\t\tvar links = [],\n\t\t\tcheckParseTree = function(parseTree) {\n\t\t\t\tfor(var t=0; t<parseTree.length; t++) {\n\t\t\t\t\tvar parseTreeNode = parseTree[t];\n\t\t\t\t\tif(parseTreeNode.type === \"link\" && parseTreeNode.attributes.to && parseTreeNode.attributes.to.type === \"string\") {\n\t\t\t\t\t\tvar value = parseTreeNode.attributes.to.value;\n\t\t\t\t\t\tif(links.indexOf(value) === -1) {\n\t\t\t\t\t\t\tlinks.push(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(parseTreeNode.children) {\n\t\t\t\t\t\tcheckParseTree(parseTreeNode.children);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\tif(parser) {\n\t\t\tcheckParseTree(parser.tree);\n\t\t}\n\t\treturn links;\n\t});\n};\n\n/*\nReturn an array of tiddler titles that link to the specified tiddler\n*/\nexports.getTiddlerBacklinks = function(targetTitle) {\n\tvar self = this,\n\t\tbacklinks = [];\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\tif(links.indexOf(targetTitle) !== -1) {\n\t\t\tbacklinks.push(title);\n\t\t}\n\t});\n\treturn backlinks;\n};\n\n/*\nReturn a hashmap of tiddler titles that are referenced but not defined. Each value is the number of times the missing tiddler is referenced\n*/\nexports.getMissingTitles = function() {\n\tvar self = this,\n\t\tmissing = [];\n// We should cache the missing tiddler list, even if we recreate it every time any tiddler is modified\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tif((!self.tiddlerExists(link) && !self.isShadowTiddler(link)) && missing.indexOf(link) === -1) {\n\t\t\t\tmissing.push(link);\n\t\t\t}\n\t\t});\n\t});\n\treturn missing;\n};\n\nexports.getOrphanTitles = function() {\n\tvar self = this,\n\t\torphans = this.getTiddlers();\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tvar p = orphans.indexOf(link);\n\t\t\tif(p !== -1) {\n\t\t\t\torphans.splice(p,1);\n\t\t\t}\n\t\t});\n\t});\n\treturn orphans; // Todo\n};\n\n/*\nRetrieves a list of the tiddler titles that are tagged with a given tag\n*/\nexports.getTiddlersWithTag = function(tag) {\n\tvar self = this;\n\treturn this.getGlobalCache(\"taglist-\" + tag,function() {\n\t\tvar tagmap = self.getTagMap();\n\t\treturn self.sortByList(tagmap[tag],tag);\n\t});\n};\n\n/*\nGet a hashmap by tag of arrays of tiddler titles\n*/\nexports.getTagMap = function() {\n\tvar self = this;\n\treturn this.getGlobalCache(\"tagmap\",function() {\n\t\tvar tags = Object.create(null),\n\t\t\tstoreTags = function(tagArray,title) {\n\t\t\t\tif(tagArray) {\n\t\t\t\t\tfor(var index=0; index<tagArray.length; index++) {\n\t\t\t\t\t\tvar tag = tagArray[index];\n\t\t\t\t\t\tif($tw.utils.hop(tags,tag)) {\n\t\t\t\t\t\t\ttags[tag].push(title);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttags[tag] = [title];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\ttitle, tiddler;\n\t\t// Collect up all the tags\n\t\tself.eachShadow(function(tiddler,title) {\n\t\t\tif(!self.tiddlerExists(title)) {\n\t\t\t\ttiddler = self.getTiddler(title);\n\t\t\t\tstoreTags(tiddler.fields.tags,title);\n\t\t\t}\n\t\t});\n\t\tself.each(function(tiddler,title) {\n\t\t\tstoreTags(tiddler.fields.tags,title);\n\t\t});\n\t\treturn tags;\n\t});\n};\n\n/*\nLookup a given tiddler and return a list of all the tiddlers that include it in the specified list field\n*/\nexports.findListingsOfTiddler = function(targetTitle,fieldName) {\n\tfieldName = fieldName || \"list\";\n\tvar titles = [];\n\tthis.each(function(tiddler,title) {\n\t\tvar list = $tw.utils.parseStringArray(tiddler.fields[fieldName]);\n\t\tif(list && list.indexOf(targetTitle) !== -1) {\n\t\t\ttitles.push(title);\n\t\t}\n\t});\n\treturn titles;\n};\n\n/*\nSorts an array of tiddler titles according to an ordered list\n*/\nexports.sortByList = function(array,listTitle) {\n\tvar list = this.getTiddlerList(listTitle);\n\tif(!array || array.length === 0) {\n\t\treturn [];\n\t} else {\n\t\tvar titles = [], t, title;\n\t\t// First place any entries that are present in the list\n\t\tfor(t=0; t<list.length; t++) {\n\t\t\ttitle = list[t];\n\t\t\tif(array.indexOf(title) !== -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\t// Then place any remaining entries\n\t\tfor(t=0; t<array.length; t++) {\n\t\t\ttitle = array[t];\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\t// Finally obey the list-before and list-after fields of each tiddler in turn\n\t\tvar sortedTitles = titles.slice(0);\n\t\tfor(t=0; t<sortedTitles.length; t++) {\n\t\t\ttitle = sortedTitles[t];\n\t\t\tvar currPos = titles.indexOf(title),\n\t\t\t\tnewPos = -1,\n\t\t\t\ttiddler = this.getTiddler(title);\n\t\t\tif(tiddler) {\n\t\t\t\tvar beforeTitle = tiddler.fields[\"list-before\"],\n\t\t\t\t\tafterTitle = tiddler.fields[\"list-after\"];\n\t\t\t\tif(beforeTitle === \"\") {\n\t\t\t\t\tnewPos = 0;\n\t\t\t\t} else if(beforeTitle) {\n\t\t\t\t\tnewPos = titles.indexOf(beforeTitle);\n\t\t\t\t} else if(afterTitle) {\n\t\t\t\t\tnewPos = titles.indexOf(afterTitle);\n\t\t\t\t\tif(newPos >= 0) {\n\t\t\t\t\t\t++newPos;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(newPos === -1) {\n\t\t\t\t\tnewPos = currPos;\n\t\t\t\t}\n\t\t\t\tif(newPos !== currPos) {\n\t\t\t\t\ttitles.splice(currPos,1);\n\t\t\t\t\tif(newPos >= currPos) {\n\t\t\t\t\t\tnewPos--;\n\t\t\t\t\t}\n\t\t\t\t\ttitles.splice(newPos,0,title);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn titles;\n\t}\n};\n\nexports.getSubTiddler = function(title,subTiddlerTitle) {\n\tvar bundleInfo = this.getPluginInfo(title) || this.getTiddlerDataCached(title);\n\tif(bundleInfo && bundleInfo.tiddlers) {\n\t\tvar subTiddler = bundleInfo.tiddlers[subTiddlerTitle];\n\t\tif(subTiddler) {\n\t\t\treturn new $tw.Tiddler(subTiddler);\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRetrieve a tiddler as a JSON string of the fields\n*/\nexports.getTiddlerAsJson = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\tvar fields = Object.create(null);\n\t\t$tw.utils.each(tiddler.fields,function(value,name) {\n\t\t\tfields[name] = tiddler.getFieldString(name);\n\t\t});\n\t\treturn JSON.stringify(fields);\n\t} else {\n\t\treturn JSON.stringify({title: title});\n\t}\n};\n\n/*\nGet the content of a tiddler as a JavaScript object. How this is done depends on the type of the tiddler:\n\napplication/json: the tiddler JSON is parsed into an object\napplication/x-tiddler-dictionary: the tiddler is parsed as sequence of name:value pairs\n\nOther types currently just return null.\n\ntitleOrTiddler: string tiddler title or a tiddler object\ndefaultData: default data to be returned if the tiddler is missing or doesn't contain data\n\nNote that the same value is returned for repeated calls for the same tiddler data. The value is frozen to prevent modification; otherwise modifications would be visible to all callers\n*/\nexports.getTiddlerDataCached = function(titleOrTiddler,defaultData) {\n\tvar self = this,\n\t\ttiddler = titleOrTiddler;\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = this.getTiddler(tiddler);\t\n\t}\n\tif(tiddler) {\n\t\treturn this.getCacheForTiddler(tiddler.fields.title,\"data\",function() {\n\t\t\t// Return the frozen value\n\t\t\tvar value = self.getTiddlerData(tiddler.fields.title,undefined);\n\t\t\t$tw.utils.deepFreeze(value);\n\t\t\treturn value;\n\t\t}) || defaultData;\n\t} else {\n\t\treturn defaultData;\n\t}\n};\n\n/*\nAlternative, uncached version of getTiddlerDataCached(). The return value can be mutated freely and reused\n*/\nexports.getTiddlerData = function(titleOrTiddler,defaultData) {\n\tvar tiddler = titleOrTiddler,\n\t\tdata;\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = this.getTiddler(tiddler);\t\n\t}\n\tif(tiddler && tiddler.fields.text) {\n\t\tswitch(tiddler.fields.type) {\n\t\t\tcase \"application/json\":\n\t\t\t\t// JSON tiddler\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(tiddler.fields.text);\n\t\t\t\t} catch(ex) {\n\t\t\t\t\treturn defaultData;\n\t\t\t\t}\n\t\t\t\treturn data;\n\t\t\tcase \"application/x-tiddler-dictionary\":\n\t\t\t\treturn $tw.utils.parseFields(tiddler.fields.text);\n\t\t}\n\t}\n\treturn defaultData;\n};\n\n/*\nExtract an indexed field from within a data tiddler\n*/\nexports.extractTiddlerDataItem = function(titleOrTiddler,index,defaultText) {\n\tvar data = this.getTiddlerDataCached(titleOrTiddler,Object.create(null)),\n\t\ttext;\n\tif(data && $tw.utils.hop(data,index)) {\n\t\ttext = data[index];\n\t}\n\tif(typeof text === \"string\" || typeof text === \"number\") {\n\t\treturn text.toString();\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nSet a tiddlers content to a JavaScript object. Currently this is done by setting the tiddler's type to \"application/json\" and setting the text to the JSON text of the data.\ntitle: title of tiddler\ndata: object that can be serialised to JSON\nfields: optional hashmap of additional tiddler fields to be set\n*/\nexports.setTiddlerData = function(title,data,fields) {\n\tvar existingTiddler = this.getTiddler(title),\n\t\tnewFields = {\n\t\t\ttitle: title\n\t};\n\tif(existingTiddler && existingTiddler.fields.type === \"application/x-tiddler-dictionary\") {\n\t\tnewFields.text = $tw.utils.makeTiddlerDictionary(data);\n\t} else {\n\t\tnewFields.type = \"application/json\";\n\t\tnewFields.text = JSON.stringify(data,null,$tw.config.preferences.jsonSpaces);\n\t}\n\tthis.addTiddler(new $tw.Tiddler(this.getCreationFields(),existingTiddler,fields,newFields,this.getModificationFields()));\n};\n\n/*\nReturn the content of a tiddler as an array containing each line\n*/\nexports.getTiddlerList = function(title,field,index) {\n\tif(index) {\n\t\treturn $tw.utils.parseStringArray(this.extractTiddlerDataItem(title,index,\"\"));\n\t}\n\tfield = field || \"list\";\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\treturn ($tw.utils.parseStringArray(tiddler.fields[field]) || []).slice(0);\n\t}\n\treturn [];\n};\n\n// Return a named global cache object. Global cache objects are cleared whenever a tiddler change occurs\nexports.getGlobalCache = function(cacheName,initializer) {\n\tthis.globalCache = this.globalCache || Object.create(null);\n\tif($tw.utils.hop(this.globalCache,cacheName)) {\n\t\treturn this.globalCache[cacheName];\n\t} else {\n\t\tthis.globalCache[cacheName] = initializer();\n\t\treturn this.globalCache[cacheName];\n\t}\n};\n\nexports.clearGlobalCache = function() {\n\tthis.globalCache = Object.create(null);\n};\n\n// Return the named cache object for a tiddler. If the cache doesn't exist then the initializer function is invoked to create it\nexports.getCacheForTiddler = function(title,cacheName,initializer) {\n\tthis.caches = this.caches || Object.create(null);\n\tvar caches = this.caches[title];\n\tif(caches && caches[cacheName]) {\n\t\treturn caches[cacheName];\n\t} else {\n\t\tif(!caches) {\n\t\t\tcaches = Object.create(null);\n\t\t\tthis.caches[title] = caches;\n\t\t}\n\t\tcaches[cacheName] = initializer();\n\t\treturn caches[cacheName];\n\t}\n};\n\n// Clear all caches associated with a particular tiddler, or, if the title is null, clear all the caches for all the tiddlers\nexports.clearCache = function(title) {\n\tif(title) {\n\t\tthis.caches = this.caches || Object.create(null);\n\t\tif($tw.utils.hop(this.caches,title)) {\n\t\t\tdelete this.caches[title];\n\t\t}\n\t} else {\n\t\tthis.caches = Object.create(null);\n\t}\n};\n\nexports.initParsers = function(moduleType) {\n\t// Install the parser modules\n\t$tw.Wiki.parsers = {};\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(\"parser\",function(title,module) {\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\t$tw.Wiki.parsers[f] = module[f]; // Store the parser class\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nParse a block of text of a specified MIME type\n\ttype: content type of text to be parsed\n\ttext: text\n\toptions: see below\nOptions include:\n\tparseAsInline: if true, the text of the tiddler will be parsed as an inline run\n\t_canonical_uri: optional string of the canonical URI of this content\n*/\nexports.parseText = function(type,text,options) {\n\ttext = text || \"\";\n\toptions = options || {};\n\t// Select a parser\n\tvar Parser = $tw.Wiki.parsers[type];\n\tif(!Parser && $tw.utils.getFileExtensionInfo(type)) {\n\t\tParser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];\n\t}\n\tif(!Parser) {\n\t\tParser = $tw.Wiki.parsers[options.defaultType || \"text/vnd.tiddlywiki\"];\n\t}\n\tif(!Parser) {\n\t\treturn null;\n\t}\n\t// Return the parser instance\n\treturn new Parser(type,text,{\n\t\tparseAsInline: options.parseAsInline,\n\t\twiki: this,\n\t\t_canonical_uri: options._canonical_uri\n\t});\n};\n\n/*\nParse a tiddler according to its MIME type\n*/\nexports.parseTiddler = function(title,options) {\n\toptions = $tw.utils.extend({},options);\n\tvar cacheType = options.parseAsInline ? \"inlineParseTree\" : \"blockParseTree\",\n\t\ttiddler = this.getTiddler(title),\n\t\tself = this;\n\treturn tiddler ? this.getCacheForTiddler(title,cacheType,function() {\n\t\t\tif(tiddler.hasField(\"_canonical_uri\")) {\n\t\t\t\toptions._canonical_uri = tiddler.fields._canonical_uri;\n\t\t\t}\n\t\t\treturn self.parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t}) : null;\n};\n\nexports.parseTextReference = function(title,field,index,options) {\n\tvar tiddler,text;\n\tif(options.subTiddler) {\n\t\ttiddler = this.getSubTiddler(title,options.subTiddler);\n\t} else {\n\t\ttiddler = this.getTiddler(title);\n\t\tif(field === \"text\" || (!field && !index)) {\n\t\t\tthis.getTiddlerText(title); // Force the tiddler to be lazily loaded\n\t\t\treturn this.parseTiddler(title,options);\n\t\t}\n\t}\n\tif(field === \"text\" || (!field && !index)) {\n\t\tif(tiddler && tiddler.fields) {\n\t\t\treturn this.parseText(tiddler.fields.type || \"text/vnd.tiddlywiki\",tiddler.fields.text,options);\t\t\t\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t} else if(field) {\n\t\tif(field === \"title\") {\n\t\t\ttext = title;\n\t\t} else {\n\t\t\tif(!tiddler || !tiddler.hasField(field)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttext = tiddler.fields[field];\n\t\t}\n\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text.toString(),options);\n\t} else if(index) {\n\t\tthis.getTiddlerText(title); // Force the tiddler to be lazily loaded\n\t\ttext = this.extractTiddlerDataItem(tiddler,index,undefined);\n\t\tif(text === undefined) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text,options);\n\t}\n};\n\n/*\nMake a widget tree for a parse tree\nparser: parser object\noptions: see below\nOptions include:\ndocument: optional document to use\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.makeWidget = function(parser,options) {\n\toptions = options || {};\n\tvar widgetNode = {\n\t\t\ttype: \"widget\",\n\t\t\tchildren: []\n\t\t},\n\t\tcurrWidgetNode = widgetNode;\n\t// Create set variable widgets for each variable\n\t$tw.utils.each(options.variables,function(value,name) {\n\t\tvar setVariableWidget = {\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: name},\n\t\t\t\tvalue: {type: \"string\", value: value}\n\t\t\t},\n\t\t\tchildren: []\n\t\t};\n\t\tcurrWidgetNode.children = [setVariableWidget];\n\t\tcurrWidgetNode = setVariableWidget;\n\t});\n\t// Add in the supplied parse tree nodes\n\tcurrWidgetNode.children = parser ? parser.tree : [];\n\t// Create the widget\n\treturn new widget.widget(widgetNode,{\n\t\twiki: this,\n\t\tdocument: options.document || $tw.fakeDocument,\n\t\tparentWidget: options.parentWidget\n\t});\n};\n\n/*\nMake a widget tree for transclusion\ntitle: target tiddler title\noptions: as for wiki.makeWidget() plus:\noptions.field: optional field to transclude (defaults to \"text\")\noptions.mode: transclusion mode \"inline\" or \"block\"\noptions.children: optional array of children for the transclude widget\noptions.importVariables: optional importvariables filter string for macros to be included\noptions.importPageMacros: optional boolean; if true, equivalent to passing \"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\" to options.importVariables\n*/\nexports.makeTranscludeWidget = function(title,options) {\n\toptions = options || {};\n\tvar parseTreeDiv = {tree: [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"div\",\n\t\t\tchildren: []}]},\n\t\tparseTreeImportVariables = {\n\t\t\ttype: \"importvariables\",\n\t\t\tattributes: {\n\t\t\t\tfilter: {\n\t\t\t\t\tname: \"filter\",\n\t\t\t\t\ttype: \"string\"\n\t\t\t\t}\n\t\t\t},\n\t\t\tisBlock: false,\n\t\t\tchildren: []},\n\t\tparseTreeTransclude = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {\n\t\t\t\t\tname: \"tiddler\",\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: title}},\n\t\t\tisBlock: !options.parseAsInline};\n\tif(options.importVariables || options.importPageMacros) {\n\t\tif(options.importVariables) {\n\t\t\tparseTreeImportVariables.attributes.filter.value = options.importVariables;\n\t\t} else if(options.importPageMacros) {\n\t\t\tparseTreeImportVariables.attributes.filter.value = \"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\";\n\t\t}\n\t\tparseTreeDiv.tree[0].children.push(parseTreeImportVariables);\n\t\tparseTreeImportVariables.children.push(parseTreeTransclude);\n\t} else {\n\t\tparseTreeDiv.tree[0].children.push(parseTreeTransclude);\n\t}\n\tif(options.field) {\n\t\tparseTreeTransclude.attributes.field = {type: \"string\", value: options.field};\n\t}\n\tif(options.mode) {\n\t\tparseTreeTransclude.attributes.mode = {type: \"string\", value: options.mode};\n\t}\n\tif(options.children) {\n\t\tparseTreeTransclude.children = options.children;\n\t}\n\treturn $tw.wiki.makeWidget(parseTreeDiv,options);\n};\n\n/*\nParse text in a specified format and render it into another format\n\toutputType: content type for the output\n\ttextType: content type of the input text\n\ttext: input text\n\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderText = function(outputType,textType,text,options) {\n\toptions = options || {};\n\tvar parser = this.parseText(textType,text,options),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.fakeDocument.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn outputType === \"text/html\" ? container.innerHTML : container.textContent;\n};\n\n/*\nParse text from a tiddler and render it into another format\n\toutputType: content type for the output\n\ttitle: title of the tiddler to be rendered\n\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderTiddler = function(outputType,title,options) {\n\toptions = options || {};\n\tvar parser = this.parseTiddler(title,options),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.fakeDocument.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn outputType === \"text/html\" ? container.innerHTML : (outputType === \"text/plain-formatted\" ? container.formattedTextContent : container.textContent);\n};\n\n/*\nReturn an array of tiddler titles that match a search string\n\ttext: The text string to search for\n\toptions: see below\nOptions available:\n\tsource: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)\n\texclude: An array of tiddler titles to exclude from the search\n\tinvert: If true returns tiddlers that do not contain the specified string\n\tcaseSensitive: If true forces a case sensitive search\n\tliteral: If true, searches for literal string, rather than separate search terms\n\tfield: If specified, restricts the search to the specified field\n*/\nexports.search = function(text,options) {\n\toptions = options || {};\n\tvar self = this,\n\t\tt,\n\t\tinvert = !!options.invert;\n\t// Convert the search string into a regexp for each term\n\tvar terms, searchTermsRegExps,\n\t\tflags = options.caseSensitive ? \"\" : \"i\";\n\tif(options.literal) {\n\t\tif(text.length === 0) {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [new RegExp(\"(\" + $tw.utils.escapeRegExp(text) + \")\",flags)];\n\t\t}\n\t} else {\n\t\tterms = text.split(/ +/);\n\t\tif(terms.length === 1 && terms[0] === \"\") {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [];\n\t\t\tfor(t=0; t<terms.length; t++) {\n\t\t\t\tsearchTermsRegExps.push(new RegExp(\"(\" + $tw.utils.escapeRegExp(terms[t]) + \")\",flags));\n\t\t\t}\n\t\t}\n\t}\n\t// Function to check a given tiddler for the search term\n\tvar searchTiddler = function(title) {\n\t\tif(!searchTermsRegExps) {\n\t\t\treturn true;\n\t\t}\n\t\tvar tiddler = self.getTiddler(title);\n\t\tif(!tiddler) {\n\t\t\ttiddler = new $tw.Tiddler({title: title, text: \"\", type: \"text/vnd.tiddlywiki\"});\n\t\t}\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo[\"text/vnd.tiddlywiki\"],\n\t\t\tmatch;\n\t\tfor(var t=0; t<searchTermsRegExps.length; t++) {\n\t\t\tmatch = false;\n\t\t\tif(options.field) {\n\t\t\t\tmatch = searchTermsRegExps[t].test(tiddler.getFieldString(options.field));\n\t\t\t} else {\n\t\t\t\t// Search title, tags and body\n\t\t\t\tif(contentTypeInfo.encoding === \"utf8\") {\n\t\t\t\t\tmatch = match || searchTermsRegExps[t].test(tiddler.fields.text);\n\t\t\t\t}\n\t\t\t\tvar tags = tiddler.fields.tags ? tiddler.fields.tags.join(\"\\0\") : \"\";\n\t\t\t\tmatch = match || searchTermsRegExps[t].test(tags) || searchTermsRegExps[t].test(tiddler.fields.title);\n\t\t\t}\n\t\t\tif(!match) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t};\n\t// Loop through all the tiddlers doing the search\n\tvar results = [],\n\t\tsource = options.source || this.each;\n\tsource(function(tiddler,title) {\n\t\tif(searchTiddler(title) !== options.invert) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\t// Remove any of the results we have to exclude\n\tif(options.exclude) {\n\t\tfor(t=0; t<options.exclude.length; t++) {\n\t\t\tvar p = results.indexOf(options.exclude[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tresults.splice(p,1);\n\t\t\t}\n\t\t}\n\t}\n\treturn results;\n};\n\n/*\nTrigger a load for a tiddler if it is skinny. Returns the text, or undefined if the tiddler is missing, null if the tiddler is being lazily loaded.\n*/\nexports.getTiddlerText = function(title,defaultText) {\n\tvar tiddler = this.getTiddler(title);\n\t// Return undefined if the tiddler isn't found\n\tif(!tiddler) {\n\t\treturn defaultText;\n\t}\n\tif(tiddler.fields.text !== undefined) {\n\t\t// Just return the text if we've got it\n\t\treturn tiddler.fields.text;\n\t} else {\n\t\t// Tell any listeners about the need to lazily load this tiddler\n\t\tthis.dispatchEvent(\"lazyLoad\",title);\n\t\t// Indicate that the text is being loaded\n\t\treturn null;\n\t}\n};\n\n/*\nCheck whether the text of a tiddler matches a given value. By default, the comparison is case insensitive, and any spaces at either end of the tiddler text is trimmed\n*/\nexports.checkTiddlerText = function(title,targetText,options) {\n\toptions = options || {};\n\tvar text = this.getTiddlerText(title,\"\");\n\tif(!options.noTrim) {\n\t\ttext = text.trim();\n\t}\n\tif(!options.caseSensitive) {\n\t\ttext = text.toLowerCase();\n\t\ttargetText = targetText.toLowerCase();\n\t}\n\treturn text === targetText;\n}\n\n/*\nRead an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read\n*/\nexports.readFiles = function(files,callback) {\n\tvar result = [],\n\t\toutstanding = files.length;\n\tfor(var f=0; f<files.length; f++) {\n\t\tthis.readFile(files[f],function(tiddlerFieldsArray) {\n\t\t\tresult.push.apply(result,tiddlerFieldsArray);\n\t\t\tif(--outstanding === 0) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t});\n\t}\n\treturn files.length;\n};\n\n/*\nRead a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects\n*/\nexports.readFile = function(file,callback) {\n\t// Get the type, falling back to the filename extension\n\tvar self = this,\n\t\ttype = file.type;\n\tif(type === \"\" || !type) {\n\t\tvar dotPos = file.name.lastIndexOf(\".\");\n\t\tif(dotPos !== -1) {\n\t\t\tvar fileExtensionInfo = $tw.utils.getFileExtensionInfo(file.name.substr(dotPos));\n\t\t\tif(fileExtensionInfo) {\n\t\t\t\ttype = fileExtensionInfo.type;\n\t\t\t}\n\t\t}\n\t}\n\t// Figure out if we're reading a binary file\n\tvar contentTypeInfo = $tw.config.contentTypeInfo[type],\n\t\tisBinary = contentTypeInfo ? contentTypeInfo.encoding === \"base64\" : false;\n\t// Log some debugging information\n\tif($tw.log.IMPORT) {\n\t\tconsole.log(\"Importing file '\" + file.name + \"', type: '\" + type + \"', isBinary: \" + isBinary);\n\t}\n\t// Create the FileReader\n\tvar reader = new FileReader();\n\t// Onload\n\treader.onload = function(event) {\n\t\tvar text = event.target.result,\n\t\t\ttiddlerFields = {title: file.name || \"Untitled\", type: type};\n\t\tif(isBinary) {\n\t\t\tvar commaPos = text.indexOf(\",\");\n\t\t\tif(commaPos !== -1) {\n\t\t\t\ttext = text.substr(commaPos + 1);\n\t\t\t}\n\t\t}\n\t\t// Check whether this is an encrypted TiddlyWiki file\n\t\tvar encryptedJson = $tw.utils.extractEncryptedStoreArea(text);\n\t\tif(encryptedJson) {\n\t\t\t// If so, attempt to decrypt it with the current password\n\t\t\t$tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) {\n\t\t\t\tcallback(tiddlers);\n\t\t\t});\n\t\t} else {\n\t\t\t// Otherwise, just try to deserialise any tiddlers in the file\n\t\t\tcallback(self.deserializeTiddlers(type,text,tiddlerFields));\n\t\t}\n\t};\n\t// Kick off the read\n\tif(isBinary) {\n\t\treader.readAsDataURL(file);\n\t} else {\n\t\treader.readAsText(file);\n\t}\n};\n\n/*\nFind any existing draft of a specified tiddler\n*/\nexports.findDraft = function(targetTitle) {\n\tvar draftTitle = undefined;\n\tthis.forEachTiddler({includeSystem: true},function(title,tiddler) {\n\t\tif(tiddler.fields[\"draft.title\"] && tiddler.fields[\"draft.of\"] === targetTitle) {\n\t\t\tdraftTitle = title;\n\t\t}\n\t});\n\treturn draftTitle;\n}\n\n/*\nCheck whether the specified draft tiddler has been modified.\nIf the original tiddler doesn't exist, create a vanilla tiddler variable,\nto check if additional fields have been added.\n*/\nexports.isDraftModified = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(!tiddler.isDraft()) {\n\t\treturn false;\n\t}\n\tvar ignoredFields = [\"created\", \"modified\", \"title\", \"draft.title\", \"draft.of\"],\n\t\torigTiddler = this.getTiddler(tiddler.fields[\"draft.of\"]) || new $tw.Tiddler({text:\"\", tags:[]}),\n\t\ttitleModified = tiddler.fields[\"draft.title\"] !== tiddler.fields[\"draft.of\"];\n\treturn titleModified || !tiddler.isEqual(origTiddler,ignoredFields);\n};\n\n/*\nAdd a new record to the top of the history stack\ntitle: a title string or an array of title strings\nfromPageRect: page coordinates of the origin of the navigation\nhistoryTitle: title of history tiddler (defaults to $:/HistoryList)\n*/\nexports.addToHistory = function(title,fromPageRect,historyTitle) {\n\tvar story = new $tw.Story({wiki: this, historyTitle: historyTitle});\n\tstory.addToHistory(title,fromPageRect);\n};\n\n/*\nInvoke the available upgrader modules\ntitles: array of tiddler titles to be processed\ntiddlers: hashmap by title of tiddler fields of pending import tiddlers. These can be modified by the upgraders. An entry with no fields indicates a tiddler that was pending import has been suppressed. When entries are added to the pending import the tiddlers hashmap may have entries that are not present in the titles array\nReturns a hashmap of messages keyed by tiddler title.\n*/\nexports.invokeUpgraders = function(titles,tiddlers) {\n\t// Collect up the available upgrader modules\n\tvar self = this;\n\tif(!this.upgraderModules) {\n\t\tthis.upgraderModules = [];\n\t\t$tw.modules.forEachModuleOfType(\"upgrader\",function(title,module) {\n\t\t\tif(module.upgrade) {\n\t\t\t\tself.upgraderModules.push(module);\n\t\t\t}\n\t\t});\n\t}\n\t// Invoke each upgrader in turn\n\tvar messages = {};\n\tfor(var t=0; t<this.upgraderModules.length; t++) {\n\t\tvar upgrader = this.upgraderModules[t],\n\t\t\tupgraderMessages = upgrader.upgrade(this,titles,tiddlers);\n\t\t$tw.utils.extend(messages,upgraderMessages);\n\t}\n\treturn messages;\n};\n\n})();\n\n",
"title": "$:/core/modules/wiki.js",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/palettes/Blanca": {
"title": "$:/palettes/Blanca",
"name": "Blanca",
"description": "A clean white palette to let you focus",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #66cccc\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #ffffff\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #7897f3\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ccc\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #ffffff\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #7897f3\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #eeeeee\ntab-border-selected: #cccccc\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ffeedd\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: #eee\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #ff9900\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Blue": {
"title": "$:/palettes/Blue",
"name": "Blue",
"description": "A blue theme",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #fff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour foreground>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333353\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #ddddff\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ffffff\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: <<colour page-background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #5959c0\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: #ccccdd\ntab-border-selected: #ccccdd\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #eeeeff\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #666666\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #ffffff\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #ffffff\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #5959c0\ntoolbar-new-button: #5eb95e\ntoolbar-options-button: rgb(128, 88, 165)\ntoolbar-save-button: #0e90d2\ntoolbar-info-button: #0e90d2\ntoolbar-edit-button: rgb(243, 123, 29)\ntoolbar-close-button: #dd514c\ntoolbar-delete-button: #dd514c\ntoolbar-cancel-button: rgb(243, 123, 29)\ntoolbar-done-button: #5eb95e\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Muted": {
"title": "$:/palettes/Muted",
"name": "Muted",
"description": "Bright tiddlers on a muted background",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #bbb\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #6f6f70\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #29a6ee\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #c2c1c2\nsidebar-foreground-shadow: rgba(255,255,255,0)\nsidebar-foreground: #d3d2d4\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #6f6f70\nsidebar-tab-background: #666667\nsidebar-tab-border-selected: #999\nsidebar-tab-border: #515151\nsidebar-tab-divider: #999\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: #999\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #d1d0d2\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #d5ad34\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/ContrastLight": {
"title": "$:/palettes/ContrastLight",
"name": "Contrast (Light)",
"description": "High contrast and unambiguous (light version)",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #f00\nalert-border: <<colour background>>\nalert-highlight: <<colour foreground>>\nalert-muted-foreground: #800\nbackground: #fff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: <<colour background>>\nbutton-foreground: <<colour foreground>>\nbutton-border: <<colour foreground>>\ncode-background: <<colour background>>\ncode-border: <<colour foreground>>\ncode-foreground: <<colour foreground>>\ndirty-indicator: #f00\ndownload-background: #080\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: <<colour foreground>>\ndropdown-tab-background: <<colour foreground>>\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #00a\nexternal-link-foreground: #00e\nforeground: #000\nmessage-background: <<colour foreground>>\nmessage-border: <<colour background>>\nmessage-foreground: <<colour background>>\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: <<colour foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour foreground>>\nmodal-header-border: <<colour foreground>>\nmuted-foreground: <<colour foreground>>\nnotification-background: <<colour background>>\nnotification-border: <<colour foreground>>\npage-background: <<colour background>>\npre-background: <<colour background>>\npre-border: <<colour foreground>>\nprimary: #00f\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: <<colour background>>\nsidebar-controls-foreground: <<colour foreground>>\nsidebar-foreground-shadow: rgba(0,0,0, 0)\nsidebar-foreground: <<colour foreground>>\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: <<colour foreground>>\nsidebar-tab-background-selected: <<colour background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: <<colour foreground>>\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: <<colour foreground>>\nsidebar-tiddler-link-foreground: <<colour primary>>\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: <<colour foreground>>\ntab-border-selected: <<colour foreground>>\ntab-border: <<colour foreground>>\ntab-divider: <<colour foreground>>\ntab-foreground-selected: <<colour foreground>>\ntab-foreground: <<colour background>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #000\ntag-foreground: #fff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour foreground>>\ntiddler-controls-foreground-hover: #ddd\ntiddler-controls-foreground-selected: #fdd\ntiddler-controls-foreground: <<colour foreground>>\ntiddler-editor-background: <<colour background>>\ntiddler-editor-border-image: <<colour foreground>>\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: <<colour background>>\ntiddler-editor-fields-odd: <<colour background>>\ntiddler-info-background: <<colour background>>\ntiddler-info-border: <<colour foreground>>\ntiddler-info-tab-background: <<colour background>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour foreground>>\ntiddler-title-foreground: <<colour foreground>>\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour foreground>>\nvery-muted-foreground: #888888\n"
},
"$:/palettes/ContrastDark": {
"title": "$:/palettes/ContrastDark",
"name": "Contrast (Dark)",
"description": "High contrast and unambiguous (dark version)",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #f00\nalert-border: <<colour background>>\nalert-highlight: <<colour foreground>>\nalert-muted-foreground: #800\nbackground: #000\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: <<colour background>>\nbutton-foreground: <<colour foreground>>\nbutton-border: <<colour foreground>>\ncode-background: <<colour background>>\ncode-border: <<colour foreground>>\ncode-foreground: <<colour foreground>>\ndirty-indicator: #f00\ndownload-background: #080\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: <<colour foreground>>\ndropdown-tab-background: <<colour foreground>>\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #00a\nexternal-link-foreground: #00e\nforeground: #fff\nmessage-background: <<colour foreground>>\nmessage-border: <<colour background>>\nmessage-foreground: <<colour background>>\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: <<colour foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour foreground>>\nmodal-header-border: <<colour foreground>>\nmuted-foreground: <<colour foreground>>\nnotification-background: <<colour background>>\nnotification-border: <<colour foreground>>\npage-background: <<colour background>>\npre-background: <<colour background>>\npre-border: <<colour foreground>>\nprimary: #00f\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: <<colour background>>\nsidebar-controls-foreground: <<colour foreground>>\nsidebar-foreground-shadow: rgba(0,0,0, 0)\nsidebar-foreground: <<colour foreground>>\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: <<colour foreground>>\nsidebar-tab-background-selected: <<colour background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: <<colour foreground>>\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: <<colour foreground>>\nsidebar-tiddler-link-foreground: <<colour primary>>\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: <<colour foreground>>\ntab-border-selected: <<colour foreground>>\ntab-border: <<colour foreground>>\ntab-divider: <<colour foreground>>\ntab-foreground-selected: <<colour foreground>>\ntab-foreground: <<colour background>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #fff\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour foreground>>\ntiddler-controls-foreground-hover: #ddd\ntiddler-controls-foreground-selected: #fdd\ntiddler-controls-foreground: <<colour foreground>>\ntiddler-editor-background: <<colour background>>\ntiddler-editor-border-image: <<colour foreground>>\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: <<colour background>>\ntiddler-editor-fields-odd: <<colour background>>\ntiddler-info-background: <<colour background>>\ntiddler-info-border: <<colour foreground>>\ntiddler-info-tab-background: <<colour background>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour foreground>>\ntiddler-title-foreground: <<colour foreground>>\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour foreground>>\nvery-muted-foreground: #888888\n"
},
"$:/palettes/DarkPhotos": {
"created": "20150402111612188",
"description": "Good with dark photo backgrounds",
"modified": "20150402112344080",
"name": "DarkPhotos",
"tags": "$:/tags/Palette",
"title": "$:/palettes/DarkPhotos",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: \nbutton-foreground: \nbutton-border: \ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #ddd\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #336438\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #ccf\nsidebar-controls-foreground: #fff\nsidebar-foreground-shadow: rgba(0,0,0, 0.5)\nsidebar-foreground: #fff\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #eee\nsidebar-tab-background-selected: rgba(255,255,255, 0.8)\nsidebar-tab-background: rgba(255,255,255, 0.4)\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: rgba(255,255,255, 0.2)\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #aaf\nsidebar-tiddler-link-foreground: #ddf\nsite-title-foreground: #fff\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ec6\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Rocker": {
"title": "$:/palettes/Rocker",
"name": "Rocker",
"description": "A dark theme",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #000\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #cc0000\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ffffff\nsidebar-foreground-shadow: rgba(255,255,255, 0.0)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #000\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #ffbb99\nsidebar-tiddler-link-foreground: #cc0000\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ffbb99\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #cc0000\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/SolarFlare": {
"title": "$:/palettes/SolarFlare",
"name": "Solar Flare",
"description": "Warm, relaxing earth colours",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": ": Background Tones\n\nbase03: #002b36\nbase02: #073642\n\n: Content Tones\n\nbase01: #586e75\nbase00: #657b83\nbase0: #839496\nbase1: #93a1a1\n\n: Background Tones\n\nbase2: #eee8d5\nbase3: #fdf6e3\n\n: Accent Colors\n\nyellow: #b58900\norange: #cb4b16\nred: #dc322f\nmagenta: #d33682\nviolet: #6c71c4\nblue: #268bd2\ncyan: #2aa198\ngreen: #859900\n\n: Additional Tones (RA)\n\nbase10: #c0c4bb\nviolet-muted: #7c81b0\nblue-muted: #4e7baa\n\nyellow-hot: #ffcc44\norange-hot: #eb6d20\nred-hot: #ff2222\nblue-hot: #2298ee\ngreen-hot: #98ee22\n\n: Palette\n\n: Do not use colour macro for background and foreground\nbackground: #fdf6e3\n download-foreground: <<colour background>>\n dragger-foreground: <<colour background>>\n dropdown-background: <<colour background>>\n modal-background: <<colour background>>\n sidebar-foreground-shadow: <<colour background>>\n tiddler-background: <<colour background>>\n tiddler-border: <<colour background>>\n tiddler-link-background: <<colour background>>\n tab-background-selected: <<colour background>>\n dropdown-tab-background-selected: <<colour tab-background-selected>>\nforeground: #657b83\n dragger-background: <<colour foreground>>\n tab-foreground: <<colour foreground>>\n tab-foreground-selected: <<colour tab-foreground>>\n sidebar-tab-foreground-selected: <<colour tab-foreground-selected>>\n sidebar-tab-foreground: <<colour tab-foreground>>\n sidebar-button-foreground: <<colour foreground>>\n sidebar-controls-foreground: <<colour foreground>>\n sidebar-foreground: <<colour foreground>>\n: base03\n: base02\n: base01\n alert-muted-foreground: <<colour base01>>\n: base00\n code-foreground: <<colour base00>>\n message-foreground: <<colour base00>>\n tag-foreground: <<colour base00>>\n: base0\n sidebar-tiddler-link-foreground: <<colour base0>>\n: base1\n muted-foreground: <<colour base1>>\n blockquote-bar: <<colour muted-foreground>>\n dropdown-border: <<colour muted-foreground>>\n sidebar-muted-foreground: <<colour muted-foreground>>\n tiddler-title-foreground: <<colour muted-foreground>>\n site-title-foreground: <<colour tiddler-title-foreground>>\n: base2\n modal-footer-background: <<colour base2>>\n page-background: <<colour base2>>\n modal-backdrop: <<colour page-background>>\n notification-background: <<colour page-background>>\n code-background: <<colour page-background>>\n code-border: <<colour code-background>>\n pre-background: <<colour page-background>>\n pre-border: <<colour pre-background>>\n sidebar-tab-background-selected: <<colour page-background>>\n table-header-background: <<colour base2>>\n tag-background: <<colour base2>>\n tiddler-editor-background: <<colour base2>>\n tiddler-info-background: <<colour base2>>\n tiddler-info-tab-background: <<colour base2>>\n tab-background: <<colour base2>>\n dropdown-tab-background: <<colour tab-background>>\n: base3\n alert-background: <<colour base3>>\n message-background: <<colour base3>>\n: yellow\n: orange\n: red\n: magenta\n alert-highlight: <<colour magenta>>\n: violet\n external-link-foreground: <<colour violet>>\n: blue\n: cyan\n: green\n: base10\n tiddler-controls-foreground: <<colour base10>>\n: violet-muted\n external-link-foreground-visited: <<colour violet-muted>>\n: blue-muted\n primary: <<colour blue-muted>>\n download-background: <<colour primary>>\n tiddler-link-foreground: <<colour primary>>\n\nalert-border: #b99e2f\ndirty-indicator: #ff0000\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nmessage-border: #cfd6e6\nmodal-border: #999999\nsidebar-controls-foreground-hover:\nsidebar-muted-foreground-hover:\nsidebar-tab-background: #ded8c5\nsidebar-tiddler-link-foreground-hover:\nstatic-alert-foreground: #aaaaaa\ntab-border: #cccccc\n modal-footer-border: <<colour tab-border>>\n modal-header-border: <<colour tab-border>>\n notification-border: <<colour tab-border>>\n sidebar-tab-border: <<colour tab-border>>\n tab-border-selected: <<colour tab-border>>\n sidebar-tab-border-selected: <<colour tab-border-selected>>\ntab-divider: #d8d8d8\n sidebar-tab-divider: <<colour tab-divider>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-border: #dddddd\ntiddler-subtitle-foreground: #c0c0c0\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Vanilla": {
"title": "$:/palettes/Vanilla",
"name": "Vanilla",
"description": "Pale and unobtrusive",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #bbb\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #f4f4f4\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #aaaaaa\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #f4f4f4\nsidebar-tab-background: #e0e0e0\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: #e4e4e4\nsidebar-tab-foreground-selected:\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #999999\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ec6\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/core/readme": {
"title": "$:/core/readme",
"text": "This plugin contains TiddlyWiki's core components, comprising:\n\n* JavaScript code modules\n* Icons\n* Templates needed to create TiddlyWiki's user interface\n* British English (''en-GB'') translations of the localisable strings used by the core\n"
},
"$:/library/sjcl.js/license": {
"title": "$:/library/sjcl.js/license",
"type": "text/plain",
"text": "SJCL is open. You can use, modify and redistribute it under a BSD\nlicense or under the GNU GPL, version 2.0.\n\n---------------------------------------------------------------------\n\nhttp://opensource.org/licenses/BSD-2-Clause\n\nCopyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at\nStanford University. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n---------------------------------------------------------------------\n\nhttp://opensource.org/licenses/GPL-2.0\n\nThe Stanford Javascript Crypto Library (hosted here on GitHub) is a\nproject by the Stanford Computer Security Lab to build a secure,\npowerful, fast, small, easy-to-use, cross-browser library for\ncryptography in Javascript.\n\nCopyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at\nStanford University.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at your\noption) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
},
"$:/core/templates/MOTW.html": {
"title": "$:/core/templates/MOTW.html",
"text": "\\rules only filteredtranscludeinline transcludeinline entity\n<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->\n<!-- saved from url=(0021)http://tiddlywiki.com --> "
},
"$:/core/templates/alltiddlers.template.html": {
"title": "$:/core/templates/alltiddlers.template.html",
"type": "text/vnd.tiddlywiki-html",
"text": "<!-- This template is provided for backwards compatibility with older versions of TiddlyWiki -->\n\n<$set name=\"exportFilter\" value=\"[!is[system]sort[title]]\">\n\n{{$:/core/templates/exporters/StaticRiver}}\n\n</$set>\n"
},
"$:/core/templates/canonical-uri-external-image": {
"title": "$:/core/templates/canonical-uri-external-image",
"text": "<!--\n\nThis template is used to assign the ''_canonical_uri'' field to external images.\n\nChange the `./images/` part to a different base URI. The URI can be relative or absolute.\n\n-->\n./images/<$view field=\"title\" format=\"doubleurlencoded\"/>"
},
"$:/core/templates/canonical-uri-external-text": {
"title": "$:/core/templates/canonical-uri-external-text",
"text": "<!--\n\nThis template is used to assign the ''_canonical_uri'' field to external text files.\n\nChange the `./text/` part to a different base URI. The URI can be relative or absolute.\n\n-->\n./text/<$view field=\"title\" format=\"doubleurlencoded\"/>.tid"
},
"$:/core/templates/css-tiddler": {
"title": "$:/core/templates/css-tiddler",
"text": "<!--\n\nThis template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.\n\n-->`<style`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/css\">`<$view field=\"text\" format=\"text\" />`</style>`"
},
"$:/core/templates/exporters/CsvFile": {
"title": "$:/core/templates/exporters/CsvFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/CsvFile}}",
"extension": ".csv",
"text": "\\define renderContent()\n<$text text=<<csvtiddlers filter:\"\"\"$(exportFilter)$\"\"\" format:\"quoted-comma-sep\">>/>\n\\end\n<<renderContent>>\n"
},
"$:/core/templates/exporters/JsonFile": {
"title": "$:/core/templates/exporters/JsonFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/JsonFile}}",
"extension": ".json",
"text": "\\define renderContent()\n<$text text=<<jsontiddlers filter:\"\"\"$(exportFilter)$\"\"\">>/>\n\\end\n<<renderContent>>\n"
},
"$:/core/templates/exporters/StaticRiver": {
"title": "$:/core/templates/exporters/StaticRiver",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/StaticRiver}}",
"extension": ".html",
"text": "\\define tv-wikilink-template() #$uri_encoded$\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<style type=\"text/css\">\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n</style>\n</head>\n<body class=\"tc-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n<section class=\"tc-story-river\">\n{{$:/core/templates/exporters/StaticRiver/Content||$:/core/templates/html-tiddler}}\n</section>\n</body>\n</html>\n"
},
"$:/core/templates/exporters/StaticRiver/Content": {
"title": "$:/core/templates/exporters/StaticRiver/Content",
"text": "\\define renderContent()\n{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}\n\\end\n<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n<<renderContent>>\n</$importvariables>\n"
},
"$:/core/templates/exporters/TidFile": {
"title": "$:/core/templates/exporters/TidFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/TidFile}}",
"extension": ".tid",
"text": "\\define renderContent()\n{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}\n\\end\n<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\"><<renderContent>></$importvariables>"
},
"$:/core/templates/html-div-tiddler": {
"title": "$:/core/templates/html-div-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.\n\n-->`<div`<$fields template=' $name$=\"$encoded_value$\"'></$fields>`>\n<pre>`<$view field=\"text\" format=\"htmlencoded\" />`</pre>\n</div>`\n"
},
"$:/core/templates/html-tiddler": {
"title": "$:/core/templates/html-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as raw HTML\n\n--><$view field=\"text\" format=\"htmlwikified\" />"
},
"$:/core/templates/javascript-tiddler": {
"title": "$:/core/templates/javascript-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\">`<$view field=\"text\" format=\"text\" />`</script>`"
},
"$:/core/templates/json-tiddler": {
"title": "$:/core/templates/json-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as raw JSON\n\n--><$text text=<<jsontiddler>>/>"
},
"$:/core/templates/module-tiddler": {
"title": "$:/core/templates/module-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\" data-module=\"yes\">$tw.modules.define(\"`<$view field=\"title\" format=\"jsencoded\" />`\",\"`<$view field=\"module-type\" format=\"jsencoded\" />`\",function(module,exports,require) {`<$view field=\"text\" format=\"text\" />`});\n</script>`"
},
"$:/core/templates/plain-text-tiddler": {
"title": "$:/core/templates/plain-text-tiddler",
"text": "<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/raw-static-tiddler": {
"title": "$:/core/templates/raw-static-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as static HTML\n\n--><$view field=\"text\" format=\"plainwikified\" />"
},
"$:/core/save/all": {
"title": "$:/core/save/all",
"text": "\\define saveTiddlerFilter()\n[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/empty": {
"title": "$:/core/save/empty",
"text": "\\define saveTiddlerFilter()\n[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/lazy-all": {
"title": "$:/core/save/lazy-all",
"text": "\\define saveTiddlerFilter()\n[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] \n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/lazy-images": {
"title": "$:/core/save/lazy-images",
"text": "\\define saveTiddlerFilter()\n[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]] \n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/templates/single.tiddler.window": {
"title": "$:/core/templates/single.tiddler.window",
"text": "<$set name=\"themeTitle\" value={{$:/view}}>\n\n<$set name=\"tempCurrentTiddler\" value=<<currentTiddler>>>\n\n<$set name=\"currentTiddler\" value={{$:/language}}>\n\n<$set name=\"languageTitle\" value={{!!name}}>\n\n<$set name=\"currentTiddler\" value=<<tempCurrentTiddler>>>\n\n<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n\n<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\">\n\n<$transclude mode=\"block\"/>\n\n</$navigator>\n\n</$importvariables>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n"
},
"$:/core/templates/split-recipe": {
"title": "$:/core/templates/split-recipe",
"text": "<$list filter=\"[!is[system]]\">\ntiddler: <$view field=\"title\" format=\"urlencoded\"/>.tid\n</$list>\n"
},
"$:/core/templates/static-tiddler": {
"title": "$:/core/templates/static-tiddler",
"text": "<a name=<<currentTiddler>>>\n<$transclude tiddler=\"$:/core/ui/ViewTemplate\"/>\n</a>"
},
"$:/core/templates/static.area": {
"title": "$:/core/templates/static.area",
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawStaticContent]!has[draft.of]] ||$:/core/templates/raw-static-tiddler}}}\n{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\nThis file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.\n</$reveal>\n"
},
"$:/core/templates/static.content": {
"title": "$:/core/templates/static.content",
"type": "text/vnd.tiddlywiki",
"text": "<!-- For Google, and people without JavaScript-->\nThis [[TiddlyWiki|http://tiddlywiki.com]] contains the following tiddlers:\n\n<ul>\n<$list filter=<<saveTiddlerFilter>>>\n<li><$view field=\"title\" format=\"text\"></$view></li>\n</$list>\n</ul>\n"
},
"$:/core/templates/static.template.css": {
"title": "$:/core/templates/static.template.css",
"text": "{{$:/boot/boot.css||$:/core/templates/plain-text-tiddler}}\n\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n"
},
"$:/core/templates/static.template.html": {
"title": "$:/core/templates/static.template.html",
"type": "text/vnd.tiddlywiki-html",
"text": "\\define tv-wikilink-template() static/$uri_doubleencoded$.html\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<style type=\"text/css\">\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n</style>\n</head>\n<body class=\"tc-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n{{$:/core/ui/PageTemplate||$:/core/templates/html-tiddler}}\n</body>\n</html>\n"
},
"$:/core/templates/static.tiddler.html": {
"title": "$:/core/templates/static.tiddler.html",
"text": "\\define tv-wikilink-template() $uri_doubleencoded$.html\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n`<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"`{{$:/core/templates/version}}`\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<link rel=\"stylesheet\" href=\"static.css\">\n<title>`<$view field=\"caption\"><$view field=\"title\"/></$view>: {{$:/core/wiki/title}}`</title>\n</head>\n<body class=\"tc-body\">\n`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`\n<section class=\"tc-story-river\">\n`<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n<$view tiddler=\"$:/core/ui/ViewTemplate\" format=\"htmlwikified\"/>\n</$importvariables>`\n</section>\n</body>\n</html>\n`"
},
"$:/core/templates/store.area.template.html": {
"title": "$:/core/templates/store.area.template.html",
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n`<div id=\"storeArea\" style=\"display:none;\">`\n<$list filter=<<saveTiddlerFilter>> template=\"$:/core/templates/html-div-tiddler\"/>\n`</div>`\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\n`<!--~~ Encrypted tiddlers ~~-->`\n`<pre id=\"encryptedStoreArea\" type=\"text/plain\" style=\"display:none;\">`\n<$encrypt filter=<<saveTiddlerFilter>>/>\n`</pre>`\n</$reveal>"
},
"$:/core/templates/tid-tiddler": {
"title": "$:/core/templates/tid-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers in TiddlyWeb *.tid format\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>`\n`<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/tiddler-metadata": {
"title": "$:/core/templates/tiddler-metadata",
"text": "<!--\n\nThis template is used for saving tiddler metadata *.meta files\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>"
},
"$:/core/templates/tiddlywiki5.html": {
"title": "$:/core/templates/tiddlywiki5.html",
"text": "\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n{{$:/core/templates/MOTW.html}}<html>\n<head>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"application-name\" content=\"TiddlyWiki\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\" />\n<meta name=\"copyright\" content=\"{{$:/core/copyright.txt}}\" />\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->\n\n<!--~~ Raw markup ~~-->\n{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}\n</head>\n<body class=\"tc-body\">\n<!--~~ Static styles ~~-->\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<!--~~ Static content for Google and browsers without JavaScript ~~-->\n<noscript>\n<div id=\"splashArea\">\n{{$:/core/templates/static.area}}\n</div>\n</noscript>\n<!--~~ Ordinary tiddlers ~~-->\n{{$:/core/templates/store.area.template.html}}\n<!--~~ Library modules ~~-->\n<div id=\"libraryModules\" style=\"display:none;\">\n{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/javascript-tiddler}}}\n</div>\n<!--~~ Boot kernel prologue ~~-->\n<div id=\"bootKernelPrefix\" style=\"display:none;\">\n{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}\n</div>\n<!--~~ Boot kernel ~~-->\n<div id=\"bootKernel\" style=\"display:none;\">\n{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}\n</div>\n</body>\n</html>\n"
},
"$:/core/templates/version": {
"title": "$:/core/templates/version",
"text": "<<version>>"
},
"$:/core/templates/wikified-tiddler": {
"title": "$:/core/templates/wikified-tiddler",
"text": "<$transclude />"
},
"$:/core/ui/AboveStory/tw2-plugin-check": {
"title": "$:/core/ui/AboveStory/tw2-plugin-check",
"tags": "$:/tags/AboveStory",
"text": "\\define lingo-base() $:/language/AboveStory/ClassicPlugin/\n<$list filter=\"[all[system+tiddlers]tag[systemConfig]limit[1]]\">\n\n<div class=\"tc-message-box\">\n\n<<lingo Warning>>\n\n<ul>\n\n<$list filter=\"[all[system+tiddlers]tag[systemConfig]]\">\n\n<li>\n\n<$link><$view field=\"title\"/></$link>\n\n</li>\n\n</$list>\n\n</ul>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/AdvancedSearch/Filter": {
"title": "$:/core/ui/AdvancedSearch/Filter",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Filter/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n<<lingo Filter/Hint>>\n\n<div class=\"tc-search tc-advanced-search\">\n<$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterButton]!has[draft.of]]\"><$transclude/></$list>\n</div>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$set name=\"resultCount\" value=\"\"\"<$count filter={{$:/temp/advancedsearch}}/>\"\"\">\n<div class=\"tc-search-results\">\n<<lingo Filter/Matches>>\n<$list filter={{$:/temp/advancedsearch}} template=\"$:/core/ui/ListItemTemplate\"/>\n</div>\n</$set>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/clear": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/clear",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/delete": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/delete",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button popup=<<qualify \"$:/state/filterDeleteDropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/delete-button}}\n</$button>\n</$reveal>\n\n<$reveal state=<<qualify \"$:/state/filterDeleteDropdown\">> type=\"popup\" position=\"belowleft\" animate=\"yes\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<div class=\"tc-dropdown-item-plain\">\n<$set name=\"resultCount\" value=\"\"\"<$count filter={{$:/temp/advancedsearch}}/>\"\"\">\nAre you sure you wish to delete <<resultCount>> tiddler(s)?\n</$set>\n</div>\n<div class=\"tc-dropdown-item-plain\">\n<$button class=\"tc-btn\">\n<$action-deletetiddler $filter={{$:/temp/advancedsearch}}/>\nDelete these tiddlers\n</$button>\n</div>\n</div>\n</div>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/filterDropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n</$button>\n</span>\n\n<$reveal state=<<qualify \"$:/state/filterDropdown\">> type=\"popup\" position=\"belowleft\" animate=\"yes\">\n<$linkcatcher to=\"$:/temp/advancedsearch\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Filter]]\"><$link to={{!!filter}}><$transclude field=\"description\"/></$link>\n</$list>\n</div>\n</div>\n</$linkcatcher>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/export": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/export",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$macrocall $name=\"exportButton\" exportFilter={{$:/temp/advancedsearch}} lingoBase=\"$:/language/Buttons/ExportTiddlers/\"/>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Shadows": {
"title": "$:/core/ui/AdvancedSearch/Shadows",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Shadows/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n<$linkcatcher to=\"$:/temp/advancedsearch\">\n\n<<lingo Shadows/Hint>>\n\n<div class=\"tc-search\">\n<$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[all[shadows]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]\"/>\"\"\">\n\n<div class=\"tc-search-results\">\n\n<<lingo Shadows/Matches>>\n\n<$list filter=\"[all[shadows]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n</div>\n\n</$set>\n\n</$list>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Standard": {
"title": "$:/core/ui/AdvancedSearch/Standard",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Standard/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n<$linkcatcher to=\"$:/temp/advancedsearch\">\n\n<<lingo Standard/Hint>>\n\n<div class=\"tc-search\">\n<$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n<$set name=\"searchTiddler\" value=\"$:/temp/advancedsearch\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]\" emptyMessage=\"\"\"\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\">\n<$transclude/>\n</$list>\n\"\"\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\" default={{$:/config/SearchResults/Default}}/>\n</$list>\n</$set>\n</$list>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/System": {
"title": "$:/core/ui/AdvancedSearch/System",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/System/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n<$linkcatcher to=\"$:/temp/advancedsearch\">\n\n<<lingo System/Hint>>\n\n<div class=\"tc-search\">\n<$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[is[system]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]\"/>\"\"\">\n\n<div class=\"tc-search-results\">\n\n<<lingo System/Matches>>\n\n<$list filter=\"[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n</div>\n\n</$set>\n\n</$list>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n"
},
"$:/AdvancedSearch": {
"title": "$:/AdvancedSearch",
"icon": "$:/core/images/advanced-search-button",
"color": "#bbb",
"text": "<div class=\"tc-advanced-search\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch]!has[draft.of]]\" \"$:/core/ui/AdvancedSearch/System\">>\n</div>\n"
},
"$:/core/ui/AlertTemplate": {
"title": "$:/core/ui/AlertTemplate",
"text": "<div class=\"tc-alert\">\n<div class=\"tc-alert-toolbar\">\n<$button class=\"tc-btn-invisible\"><$action-deletetiddler $tiddler=<<currentTiddler>>/>{{$:/core/images/delete-button}}</$button>\n</div>\n<div class=\"tc-alert-subtitle\">\n<$view field=\"component\"/> - <$view field=\"modified\" format=\"date\" template=\"0hh:0mm:0ss DD MM YYYY\"/> <$reveal type=\"nomatch\" state=\"!!count\" text=\"\"><span class=\"tc-alert-highlight\">({{$:/language/Count}}: <$view field=\"count\"/>)</span></$reveal>\n</div>\n<div class=\"tc-alert-body\">\n\n<$transclude/>\n\n</div>\n</div>\n"
},
"$:/core/ui/BinaryWarning": {
"title": "$:/core/ui/BinaryWarning",
"text": "\\define lingo-base() $:/language/BinaryWarning/\n<div class=\"tc-binary-warning\">\n\n<<lingo Prompt>>\n\n</div>\n"
},
"$:/core/ui/Components/plugin-info": {
"title": "$:/core/ui/Components/plugin-info",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n\\define popup-state-macro()\n$(qualified-state)$-$(currentTiddler)$\n\\end\n\n\\define tabs-state-macro()\n$(popup-state)$-$(pluginInfoType)$\n\\end\n\n\\define plugin-icon-title()\n$(currentTiddler)$/icon\n\\end\n\n\\define plugin-disable-title()\n$:/config/Plugins/Disabled/$(currentTiddler)$\n\\end\n\n\\define plugin-table-body(type,disabledMessage,default-popup-state)\n<div class=\"tc-plugin-info-chunk tc-small-icon\">\n<$reveal type=\"nomatch\" state=<<popup-state>> text=\"yes\" default=\"\"\"$default-popup-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"yes\">\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<popup-state>> text=\"yes\" default=\"\"\"$default-popup-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"no\">\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n</div>\n<div class=\"tc-plugin-info-chunk\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<plugin-icon-title>>>\n<$transclude tiddler=\"$:/core/images/plugin-generic-$type$\"/>\n</$transclude>\n</div>\n<div class=\"tc-plugin-info-chunk\">\n<h1>\n''<$view field=\"description\"><$view field=\"title\"/></$view>'' $disabledMessage$\n</h1>\n<h2>\n<$view field=\"title\"/>\n</h2>\n<h2>\n<div><em><$view field=\"version\"/></em></div>\n</h2>\n</div>\n\\end\n\n\\define plugin-info(type,default-popup-state)\n<$set name=\"popup-state\" value=<<popup-state-macro>>>\n<$reveal type=\"nomatch\" state=<<plugin-disable-title>> text=\"yes\">\n<$link to={{!!title}} class=\"tc-plugin-info\">\n<<plugin-table-body type:\"$type$\" default-popup-state:\"\"\"$default-popup-state$\"\"\">>\n</$link>\n</$reveal>\n<$reveal type=\"match\" state=<<plugin-disable-title>> text=\"yes\">\n<$link to={{!!title}} class=\"tc-plugin-info tc-plugin-info-disabled\">\n<<plugin-table-body type:\"$type$\" default-popup-state:\"\"\"$default-popup-state$\"\"\" disabledMessage:\"<$macrocall $name='lingo' title='Disabled/Status'/>\">>\n</$link>\n</$reveal>\n<$reveal type=\"match\" text=\"yes\" state=<<popup-state>> default=\"\"\"$default-popup-state$\"\"\">\n<div class=\"tc-plugin-info-dropdown\">\n<div class=\"tc-plugin-info-dropdown-body\">\n<$list filter=\"[all[current]] -[[$:/core]]\">\n<div style=\"float:right;\">\n<$reveal type=\"nomatch\" state=<<plugin-disable-title>> text=\"yes\">\n<$button set=<<plugin-disable-title>> setTo=\"yes\" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}>\n<<lingo Disable/Caption>>\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<plugin-disable-title>> text=\"yes\">\n<$button set=<<plugin-disable-title>> setTo=\"no\" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}>\n<<lingo Enable/Caption>>\n</$button>\n</$reveal>\n</div>\n</$list>\n<$reveal type=\"nomatch\" text=\"\" state=\"!!list\">\n<$set name=\"tabsList\" filter=\"[<currentTiddler>list[]] contents\">\n<$macrocall $name=\"tabs\" state=<<tabs-state-macro>> tabsList=<<tabsList>> default=\"readme\" template=\"$:/core/ui/PluginInfo\"/>\n</$set>\n</$reveal>\n<$reveal type=\"match\" text=\"\" state=\"!!list\">\n<<lingo NoInformation/Hint>>\n</$reveal>\n</div>\n</div>\n</$reveal>\n</$set>\n\\end\n\n<$macrocall $name=\"plugin-info\" type=<<plugin-type>> default-popup-state=<<default-popup-state>>/>\n"
},
"$:/core/ui/Components/tag-link": {
"title": "$:/core/ui/Components/tag-link",
"text": "<$link>\n<$set name=\"backgroundColor\" value={{!!color}}>\n<span style=<<tag-styles>> class=\"tc-tag-label\">\n<$view field=\"title\" format=\"text\"/>\n</span>\n</$set>\n</$link>"
},
"$:/core/ui/ControlPanel/Advanced": {
"title": "$:/core/ui/ControlPanel/Advanced",
"tags": "$:/tags/ControlPanel/Info",
"caption": "{{$:/language/ControlPanel/Advanced/Caption}}",
"text": "{{$:/language/ControlPanel/Advanced/Hint}}\n\n<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Advanced]!has[draft.of]]\" \"$:/core/ui/ControlPanel/TiddlerFields\">>\n</div>\n"
},
"$:/core/ui/ControlPanel/Appearance": {
"title": "$:/core/ui/ControlPanel/Appearance",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Appearance/Caption}}",
"text": "{{$:/language/ControlPanel/Appearance/Hint}}\n\n<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Appearance]!has[draft.of]]\" \"$:/core/ui/ControlPanel/Theme\">>\n</div>\n"
},
"$:/core/ui/ControlPanel/Basics": {
"title": "$:/core/ui/ControlPanel/Basics",
"tags": "$:/tags/ControlPanel/Info",
"caption": "{{$:/language/ControlPanel/Basics/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Basics/\n\n\\define show-filter-count(filter)\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $value=\"\"\"$filter$\"\"\"/>\n<$action-setfield $tiddler=\"$:/state/tab--1498284803\" $value=\"$:/core/ui/AdvancedSearch/Filter\"/>\n<$action-navigate $to=\"$:/AdvancedSearch\"/>\n''<$count filter=\"\"\"$filter$\"\"\"/>''\n{{$:/core/images/advanced-search-button}}\n</$button>\n\\end\n\n|<<lingo Version/Prompt>> |''<<version>>'' |\n|<$link to=\"$:/SiteTitle\"><<lingo Title/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteTitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/SiteSubtitle\"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteSubtitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/status/UserName\"><<lingo Username/Prompt>></$link> |<$edit-text tiddler=\"$:/status/UserName\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/config/AnimationDuration\"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler=\"$:/config/AnimationDuration\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/DefaultTiddlers\"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag=\"textarea\" tiddler=\"$:/DefaultTiddlers\" class=\"tc-edit-texteditor\"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |\n|<$link to=\"$:/config/NewJournal/Title\"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler=\"$:/config/NewJournal/Title\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/config/NewJournal/Text\"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler=\"$:/config/NewJournal/Text\" tag=\"textarea\" class=\"tc-edit-texteditor\" default=\"\"/> |\n|<$link to=\"$:/config/NewJournal/Tags\"><<lingo NewJournal/Tags/Prompt>></$link> |<$edit-text tiddler=\"$:/config/NewJournal/Tags\" default=\"\" tag=\"input\"/> |\n|<<lingo Language/Prompt>> |{{$:/snippets/minilanguageswitcher}} |\n|<<lingo Tiddlers/Prompt>> |<<show-filter-count \"[!is[system]sort[title]]\">> |\n|<<lingo Tags/Prompt>> |<<show-filter-count \"[tags[]sort[title]]\">> |\n|<<lingo SystemTiddlers/Prompt>> |<<show-filter-count \"[is[system]sort[title]]\">> |\n|<<lingo ShadowTiddlers/Prompt>> |<<show-filter-count \"[all[shadows]sort[title]]\">> |\n|<<lingo OverriddenShadowTiddlers/Prompt>> |<<show-filter-count \"[is[tiddler]is[shadow]sort[title]]\">> |\n"
},
"$:/core/ui/ControlPanel/EditorTypes": {
"title": "$:/core/ui/ControlPanel/EditorTypes",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/EditorTypes/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/EditorTypes/\n\n<<lingo Hint>>\n\n<table>\n<tbody>\n<tr>\n<th><<lingo Type/Caption>></th>\n<th><<lingo Editor/Caption>></th>\n</tr>\n<$list filter=\"[all[shadows+tiddlers]prefix[$:/config/EditorTypeMappings/]sort[title]]\">\n<tr>\n<td>\n<$link>\n<$list filter=\"[all[current]removeprefix[$:/config/EditorTypeMappings/]]\">\n<$text text={{!!title}}/>\n</$list>\n</$link>\n</td>\n<td>\n<$view field=\"text\"/>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ControlPanel/Info": {
"title": "$:/core/ui/ControlPanel/Info",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Info/Caption}}",
"text": "{{$:/language/ControlPanel/Info/Hint}}\n\n<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Info]!has[draft.of]]\" \"$:/core/ui/ControlPanel/Basics\">>\n</div>\n"
},
"$:/core/ui/ControlPanel/KeyboardShortcuts": {
"title": "$:/core/ui/ControlPanel/KeyboardShortcuts",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/KeyboardShortcuts/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/KeyboardShortcuts/\n\n\\define new-shortcut(title)\n<div class=\"tc-dropdown-item-plain\">\n<$edit-shortcut tiddler=\"$title$\" placeholder={{$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt}} style=\"width:auto;\"/> <$button>\n<<lingo Add/Caption>>\n<$action-listops\n\t$tiddler=\"$(shortcutTitle)$\"\n\t$field=\"text\"\n\t$subfilter=\"[{$title$}]\"\n/>\n<$action-deletetiddler\n\t$tiddler=\"$title$\"\n/>\n</$button>\n</div>\n\\end\n\n\\define shortcut-list-item(caption)\n<td>\n</td>\n<td style=\"text-align:right;font-size:0.7em;\">\n<<lingo Platform/$caption$>>\n</td>\n<td>\n<div style=\"position:relative;\">\n<$button popup=<<qualify \"$:/state/dropdown/$(shortcutTitle)$\">> class=\"tc-btn-invisible\">\n{{$:/core/images/edit-button}}\n</$button>\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts={{$(shortcutTitle)$}} prefix=\"<kbd>\" separator=\"</kbd> <kbd>\" suffix=\"</kbd>\"/>\n\n<$reveal state=<<qualify \"$:/state/dropdown/$(shortcutTitle)$\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown tc-popup-keep\">\n<$list filter=\"[list[$(shortcutTitle)$!!text]sort[title]]\" variable=\"shortcut\" emptyMessage=\"\"\"\n<div class=\"tc-dropdown-item-plain\">\n//<<lingo NoShortcuts/Caption>>//\n</div>\n\"\"\">\n<div class=\"tc-dropdown-item-plain\">\n<$button class=\"tc-btn-invisible\" tooltip=<<lingo Remove/Hint>>>\n<$action-listops\n\t$tiddler=\"$(shortcutTitle)$\"\n\t$field=\"text\"\n\t$subfilter=\"+[remove<shortcut>]\"\n/>\n×\n</$button>\n<kbd>\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts=<<shortcut>>/>\n</kbd>\n</div>\n</$list>\n<hr/>\n<$macrocall $name=\"new-shortcut\" title=<<qualify \"$:/state/new-shortcut/$(shortcutTitle)$\">>/>\n</div>\n</div>\n</$reveal>\n</div>\n</td>\n\\end\n\n\\define shortcut-list(caption,prefix)\n<tr>\n<$list filter=\"[all[tiddlers+shadows][$prefix$$(shortcutName)$]]\" variable=\"shortcutTitle\">\n<<shortcut-list-item \"$caption$\">>\n</$list>\n</tr>\n\\end\n\n\\define shortcut-editor()\n<<shortcut-list \"All\" \"$:/config/shortcuts/\">>\n<<shortcut-list \"Mac\" \"$:/config/shortcuts-mac/\">>\n<<shortcut-list \"NonMac\" \"$:/config/shortcuts-not-mac/\">>\n<<shortcut-list \"Linux\" \"$:/config/shortcuts-linux/\">>\n<<shortcut-list \"NonLinux\" \"$:/config/shortcuts-not-linux/\">>\n<<shortcut-list \"Windows\" \"$:/config/shortcuts-windows/\">>\n<<shortcut-list \"NonWindows\" \"$:/config/shortcuts-not-windows/\">>\n\\end\n\n\\define shortcut-preview()\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts={{$(shortcutPrefix)$$(shortcutName)$}} prefix=\"<kbd>\" separator=\"</kbd> <kbd>\" suffix=\"</kbd>\"/>\n\\end\n\n\\define shortcut-item-inner()\n<tr>\n<td>\n<$reveal type=\"nomatch\" state=<<dropdownStateTitle>> text=\"open\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield\n\t$tiddler=<<dropdownStateTitle>>\n\t$value=\"open\"\n/>\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<dropdownStateTitle>> text=\"open\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield\n\t$tiddler=<<dropdownStateTitle>>\n\t$value=\"close\"\n/>\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n''<$text text=<<shortcutName>>/>''\n</td>\n<td>\n<$transclude tiddler=\"$:/config/ShortcutInfo/$(shortcutName)$\"/>\n</td>\n<td>\n<$list filter=\"$:/config/shortcuts/ $:/config/shortcuts-mac/ $:/config/shortcuts-not-mac/ $:/config/shortcuts-linux/ $:/config/shortcuts-not-linux/ $:/config/shortcuts-windows/ $:/config/shortcuts-not-windows/\" variable=\"shortcutPrefix\">\n<<shortcut-preview>>\n</$list>\n</td>\n</tr>\n<$set name=\"dropdownState\" value={{$(dropdownStateTitle)$}}>\n<$list filter=\"[<dropdownState>prefix[open]]\" variable=\"listItem\">\n<<shortcut-editor>>\n</$list>\n</$set>\n\\end\n\n\\define shortcut-item()\n<$set name=\"dropdownStateTitle\" value=<<qualify \"$:/state/dropdown/keyboardshortcut/$(shortcutName)$\">>>\n<<shortcut-item-inner>>\n</$set>\n\\end\n\n<table>\n<tbody>\n<$list filter=\"[all[shadows+tiddlers]removeprefix[$:/config/ShortcutInfo/]]\" variable=\"shortcutName\">\n<<shortcut-item>>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ControlPanel/LoadedModules": {
"title": "$:/core/ui/ControlPanel/LoadedModules",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/LoadedModules/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n<<lingo LoadedModules/Hint>>\n\n{{$:/snippets/modules}}\n"
},
"$:/core/ui/ControlPanel/Modals/AddPlugins": {
"title": "$:/core/ui/ControlPanel/Modals/AddPlugins",
"subtitle": "{{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/Add/Caption}}",
"text": "\\define install-plugin-button()\n<$button>\n<$action-sendmessage $message=\"tm-load-plugin-from-library\" url={{!!url}} title={{$(assetInfo)$!!original-title}}/>\n<$list filter=\"[<assetInfo>get[original-title]get[version]]\" variable=\"installedVersion\" emptyMessage=\"\"\"{{$:/language/ControlPanel/Plugins/Install/Caption}}\"\"\">\n{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}\n</$list>\n</$button>\n\\end\n\n\\define popup-state-macro()\n$:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$\n\\end\n\n\\define display-plugin-info(type)\n<$set name=\"popup-state\" value=<<popup-state-macro>>>\n<div class=\"tc-plugin-info\">\n<div class=\"tc-plugin-info-chunk tc-small-icon\">\n<$reveal type=\"nomatch\" state=<<popup-state>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"yes\">\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<popup-state>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"no\">\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n</div>\n<div class=\"tc-plugin-info-chunk\">\n<$list filter=\"[<assetInfo>has[icon]]\" emptyMessage=\"\"\"<$transclude tiddler=\"$:/core/images/plugin-generic-$type$\"/>\"\"\">\n<img src={{$(assetInfo)$!!icon}}/>\n</$list>\n</div>\n<div class=\"tc-plugin-info-chunk\">\n<h1><$view tiddler=<<assetInfo>> field=\"description\"/></h1>\n<h2><$view tiddler=<<assetInfo>> field=\"original-title\"/></h2>\n<div><em><$view tiddler=<<assetInfo>> field=\"version\"/></em></div>\n</div>\n<div class=\"tc-plugin-info-chunk\">\n<<install-plugin-button>>\n</div>\n</div>\n<$reveal type=\"match\" text=\"yes\" state=<<popup-state>>>\n<div class=\"tc-plugin-info-dropdown\">\n<div class=\"tc-plugin-info-dropdown-message\">\n<$list filter=\"[<assetInfo>get[original-title]get[version]]\" variable=\"installedVersion\" emptyMessage=\"\"\"{{$:/language/ControlPanel/Plugins/NotInstalled/Hint}}\"\"\">\n<em>\n{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}\n</em>\n</$list>\n</div>\n<div class=\"tc-plugin-info-dropdown-body\">\n<$transclude tiddler=<<assetInfo>> field=\"readme\" mode=\"block\"/>\n</div>\n</div>\n</$reveal>\n</$set>\n\\end\n\n\\define load-plugin-library-button()\n<$button class=\"tc-btn-big-green\">\n<$action-sendmessage $message=\"tm-load-plugin-library\" url={{!!url}} infoTitlePrefix=\"$:/temp/RemoteAssetInfo/\"/>\n{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Plugins/OpenPluginLibrary}}\n</$button>\n\\end\n\n\\define display-server-assets(type)\n{{$:/language/Search/Search}}: <$edit-text tiddler=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" default=\"\" type=\"search\" tag=\"input\"/>\n<$reveal state=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n<div class=\"tc-plugin-library-listing\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]search{$:/temp/RemoteAssetSearch/$(currentTiddler)$}sort[description]]\" variable=\"assetInfo\">\n<<display-plugin-info \"$type$\">>\n</$list>\n</div>\n\\end\n\n\\define display-server-connection()\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/ServerConnection]suffix{!!url}]\" variable=\"connectionTiddler\" emptyMessage=<<load-plugin-library-button>>>\n\n<<tabs \"[[$:/core/ui/ControlPanel/Plugins/Add/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Add/Themes]] [[$:/core/ui/ControlPanel/Plugins/Add/Languages]]\" \"$:/core/ui/ControlPanel/Plugins/Add/Plugins\">>\n\n</$list>\n\\end\n\n\\define close-library-button()\n<$reveal type='nomatch' state='$:/temp/ServerConnection/$(PluginLibraryURL)$' text=''>\n<$button class='tc-btn-big-green'>\n<$action-sendmessage $message=\"tm-unload-plugin-library\" url={{!!url}}/>\n{{$:/core/images/chevron-left}} {{$:/language/ControlPanel/Plugins/ClosePluginLibrary}}\n<$action-deletetiddler $filter=\"[prefix[$:/temp/ServerConnection/$(PluginLibraryURL)$]][prefix[$:/temp/RemoteAssetInfo/$(PluginLibraryURL)$]]\"/>\n</$button>\n</$reveal>\n\\end\n\n\\define plugin-library-listing()\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]\">\n<div class=\"tc-plugin-library\">\n\n!! <$link><$transclude field=\"caption\"><$view field=\"title\"/></$transclude></$link>\n\n//<$view field=\"url\"/>//\n\n<$transclude/>\n\n<$set name=PluginLibraryURL value={{!!url}}>\n<<close-library-button>>\n</$set>\n\n<<display-server-connection>>\n</div>\n</$list>\n\\end\n\n<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n\n<div>\n<<plugin-library-listing>>\n</div>\n\n</$importvariables>\n"
},
"$:/core/ui/ControlPanel/Palette": {
"title": "$:/core/ui/ControlPanel/Palette",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Palette/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Palette/\n\n{{$:/snippets/paletteswitcher}}\n\n<$reveal type=\"nomatch\" state=\"$:/state/ShowPaletteEditor\" text=\"yes\">\n\n<$button set=\"$:/state/ShowPaletteEditor\" setTo=\"yes\"><<lingo ShowEditor/Caption>></$button>\n\n</$reveal>\n\n<$reveal type=\"match\" state=\"$:/state/ShowPaletteEditor\" text=\"yes\">\n\n<$button set=\"$:/state/ShowPaletteEditor\" setTo=\"no\"><<lingo HideEditor/Caption>></$button>\n{{$:/snippets/paletteeditor}}\n\n</$reveal>\n\n"
},
"$:/core/ui/ControlPanel/Parsing": {
"title": "$:/core/ui/ControlPanel/Parsing",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/Parsing/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Parsing/\n\n\\define toggle(Type)\n<$checkbox\ntiddler=\"\"\"$:/config/WikiParserRules/$Type$/$(rule)$\"\"\"\nfield=\"text\"\nchecked=\"enable\"\nunchecked=\"disable\"\ndefault=\"enable\">\n<<rule>>\n</$checkbox>\n\\end\n\n\\define rules(type,Type)\n<$list filter=\"[wikiparserrules[$type$]]\" variable=\"rule\">\n<dd><<toggle $Type$>></dd>\n</$list>\n\\end\n\n<<lingo Hint>>\n\n<dl>\n<dt><<lingo Pragma/Caption>></dt>\n<<rules pragma Pragma>>\n<dt><<lingo Inline/Caption>></dt>\n<<rules inline Inline>>\n<dt><<lingo Block/Caption>></dt>\n<<rules block Block>>\n</dl>"
},
"$:/core/ui/ControlPanel/Plugins/Add/Languages": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Languages",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[language]]\"/>)",
"text": "<<display-server-assets language>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Add/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[plugin]]\"/>)",
"text": "<<display-server-assets plugin>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Add/Themes": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Themes",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[theme]]\"/>)",
"text": "<<display-server-assets theme>>\n"
},
"$:/core/ui/ControlPanel/Plugins/AddPlugins": {
"title": "$:/core/ui/ControlPanel/Plugins/AddPlugins",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n<$button message=\"tm-modal\" param=\"$:/core/ui/ControlPanel/Modals/AddPlugins\" tooltip={{$:/language/ControlPanel/Plugins/Add/Hint}} class=\"tc-btn-big-green\" style=\"background:blue;\">\n{{$:/core/images/download-button}} <<lingo Add/Caption>>\n</$button>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Languages": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Languages",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[language]]\"/>)",
"text": "<<plugin-table language>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[plugin]]\"/>)",
"text": "<<plugin-table plugin>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Themes": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Themes",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[theme]]\"/>)",
"text": "<<plugin-table theme>>\n"
},
"$:/core/ui/ControlPanel/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Plugins/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n\\define plugin-table(type)\n<$set name=\"plugin-type\" value=\"\"\"$type$\"\"\">\n<$set name=\"qualified-state\" value=<<qualify \"$:/state/plugin-info\">>>\n<$list filter=\"[!has[draft.of]plugin-type[$type$]sort[description]]\" emptyMessage=<<lingo \"Empty/Hint\">> template=\"$:/core/ui/Components/plugin-info\"/>\n</$set>\n</$set>\n\\end\n\n{{$:/core/ui/ControlPanel/Plugins/AddPlugins}}\n\n<<lingo Installed/Hint>>\n\n<<tabs \"[[$:/core/ui/ControlPanel/Plugins/Installed/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Installed/Themes]] [[$:/core/ui/ControlPanel/Plugins/Installed/Languages]]\" \"$:/core/ui/ControlPanel/Plugins/Installed/Plugins\">>\n"
},
"$:/core/ui/ControlPanel/Saving/DownloadSaver": {
"title": "$:/core/ui/ControlPanel/Saving/DownloadSaver",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/DownloadSaver/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/DownloadSaver/\n\n<<lingo Hint>>\n\n!! <$link to=\"$:/config/DownloadSaver/AutoSave\"><<lingo AutoSave/Hint>></$link>\n\n<$checkbox tiddler=\"$:/config/DownloadSaver/AutoSave\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <<lingo AutoSave/Description>> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Saving/General": {
"title": "$:/core/ui/ControlPanel/Saving/General",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/General/Caption}}",
"list-before": "",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/\n\n{{$:/language/ControlPanel/Saving/General/Hint}}\n\n!! <$link to=\"$:/config/AutoSave\"><<lingo AutoSave/Caption>></$link>\n\n<<lingo AutoSave/Hint>>\n\n<$radio tiddler=\"$:/config/AutoSave\" value=\"yes\"> <<lingo AutoSave/Enabled/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/AutoSave\" value=\"no\"> <<lingo AutoSave/Disabled/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Saving/TiddlySpot": {
"title": "$:/core/ui/ControlPanel/Saving/TiddlySpot",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/TiddlySpot/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/TiddlySpot/\n\n\\define backupURL()\nhttp://$(userName)$.tiddlyspot.com/backup/\n\\end\n\\define backupLink()\n<$reveal type=\"nomatch\" state=\"$:/UploadName\" text=\"\">\n<$set name=\"userName\" value={{$:/UploadName}}>\n<$reveal type=\"match\" state=\"$:/UploadURL\" text=\"\">\n<<backupURL>>\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/UploadURL\" text=\"\">\n<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>>\n</$reveal>\n</$set>\n</$reveal>\n\\end\n\n<<lingo Description>>\n\n|<<lingo UserName>> |<$edit-text tiddler=\"$:/UploadName\" default=\"\" tag=\"input\"/> |\n|<<lingo Password>> |<$password name=\"upload\"/> |\n|<<lingo Backups>> |<<backupLink>> |\n\n''<<lingo Advanced/Heading>>''\n\n|<<lingo ServerURL>> |<$edit-text tiddler=\"$:/UploadURL\" default=\"\" tag=\"input\"/> |\n|<<lingo Filename>> |<$edit-text tiddler=\"$:/UploadFilename\" default=\"index.html\" tag=\"input\"/> |\n|<<lingo UploadDir>> |<$edit-text tiddler=\"$:/UploadDir\" default=\".\" tag=\"input\"/> |\n|<<lingo BackupDir>> |<$edit-text tiddler=\"$:/UploadBackupDir\" default=\".\" tag=\"input\"/> |\n\n<<lingo TiddlySpot/Hint>>"
},
"$:/core/ui/ControlPanel/Saving": {
"title": "$:/core/ui/ControlPanel/Saving",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Saving/Caption}}",
"text": "{{$:/language/ControlPanel/Saving/Hint}}\n\n<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Saving]!has[draft.of]]\" \"$:/core/ui/ControlPanel/Saving/General\">>\n</div>\n"
},
"$:/core/buttonstyles/Borderless": {
"title": "$:/core/buttonstyles/Borderless",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless}}",
"text": "tc-btn-invisible"
},
"$:/core/buttonstyles/Boxed": {
"title": "$:/core/buttonstyles/Boxed",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed}}",
"text": "tc-btn-boxed"
},
"$:/core/buttonstyles/Rounded": {
"title": "$:/core/buttonstyles/Rounded",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded}}",
"text": "tc-btn-rounded"
},
"$:/core/ui/ControlPanel/Settings/CamelCase": {
"title": "$:/core/ui/ControlPanel/Settings/CamelCase",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/CamelCase/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/CamelCase/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/WikiParserRules/Inline/wikilink\" field=\"text\" checked=\"enable\" unchecked=\"disable\" default=\"enable\"> <$link to=\"$:/config/WikiParserRules/Inline/wikilink\"><<lingo Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings/DefaultSidebarTab": {
"caption": "{{$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption}}",
"tags": "$:/tags/ControlPanel/Settings",
"title": "$:/core/ui/ControlPanel/Settings/DefaultSidebarTab",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/DefaultSidebarTab/\n\n<$link to=\"$:/config/DefaultSidebarTab\"><<lingo Hint>></$link>\n\n<$select tiddler=\"$:/config/DefaultSidebarTab\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\">\n<option value=<<currentTiddler>>><$transclude field=\"caption\"><$text text=<<currentTiddler>>/></$transclude></option>\n</$list>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/EditorToolbar": {
"title": "$:/core/ui/ControlPanel/Settings/EditorToolbar",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/EditorToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/TextEditor/EnableToolbar\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/TextEditor/EnableToolbar\"><<lingo Description>></$link> </$checkbox>\n\n"
},
"$:/core/ui/ControlPanel/Settings/InfoPanelMode": {
"title": "$:/core/ui/ControlPanel/Settings/InfoPanelMode",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/InfoPanelMode/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/InfoPanelMode/\n<$link to=\"$:/config/TiddlerInfo/Mode\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/TiddlerInfo/Mode\" value=\"popup\"> <<lingo Popup/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/TiddlerInfo/Mode\" value=\"sticky\"> <<lingo Sticky/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/LinkToBehaviour": {
"title": "$:/core/ui/ControlPanel/Settings/LinkToBehaviour",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/LinkToBehaviour/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/LinkToBehaviour/\n\n<$link to=\"$:/config/Navigation/openLinkFromInsideRiver\"><<lingo \"InsideRiver/Hint\">></$link>\n\n<$select tiddler=\"$:/config/Navigation/openLinkFromInsideRiver\">\n <option value=\"above\"><<lingo \"OpenAbove\">></option>\n <option value=\"below\"><<lingo \"OpenBelow\">></option>\n <option value=\"top\"><<lingo \"OpenAtTop\">></option>\n <option value=\"bottom\"><<lingo \"OpenAtBottom\">></option>\n</$select>\n\n<$link to=\"$:/config/Navigation/openLinkFromOutsideRiver\"><<lingo \"OutsideRiver/Hint\">></$link>\n\n<$select tiddler=\"$:/config/Navigation/openLinkFromOutsideRiver\">\n <option value=\"top\"><<lingo \"OpenAtTop\">></option>\n <option value=\"bottom\"><<lingo \"OpenAtBottom\">></option>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/MissingLinks": {
"title": "$:/core/ui/ControlPanel/Settings/MissingLinks",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/MissingLinks/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/MissingLinks/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/MissingLinks\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/MissingLinks\"><<lingo Description>></$link> </$checkbox>\n\n"
},
"$:/core/ui/ControlPanel/Settings/NavigationAddressBar": {
"title": "$:/core/ui/ControlPanel/Settings/NavigationAddressBar",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/NavigationAddressBar/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/NavigationAddressBar/\n\n<$link to=\"$:/config/Navigation/UpdateAddressBar\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"permaview\"> <<lingo Permaview/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"permalink\"> <<lingo Permalink/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/NavigationHistory": {
"title": "$:/core/ui/ControlPanel/Settings/NavigationHistory",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/NavigationHistory/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/NavigationHistory/\n<$link to=\"$:/config/Navigation/UpdateHistory\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateHistory\" value=\"yes\"> <<lingo Yes/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateHistory\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/PerformanceInstrumentation": {
"title": "$:/core/ui/ControlPanel/Settings/PerformanceInstrumentation",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/PerformanceInstrumentation/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/Performance/Instrumentation\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <$link to=\"$:/config/Performance/Instrumentation\"><<lingo Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings/TitleLinks": {
"title": "$:/core/ui/ControlPanel/Settings/TitleLinks",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/TitleLinks/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/TitleLinks/\n<$link to=\"$:/config/Tiddlers/TitleLinks\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"yes\"> <<lingo Yes/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/ToolbarButtonStyle": {
"title": "$:/core/ui/ControlPanel/Settings/ToolbarButtonStyle",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtonStyle/\n<$link to=\"$:/config/Toolbar/ButtonClass\"><<lingo \"Hint\">></$link>\n\n<$select tiddler=\"$:/config/Toolbar/ButtonClass\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ToolbarButtonStyle]]\">\n<option value={{!!text}}>{{!!caption}}</option>\n</$list>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/ToolbarButtons": {
"title": "$:/core/ui/ControlPanel/Settings/ToolbarButtons",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtons/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtons/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/Toolbar/Icons\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/Toolbar/Icons\"><<lingo Icons/Description>></$link> </$checkbox>\n\n<$checkbox tiddler=\"$:/config/Toolbar/Text\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <$link to=\"$:/config/Toolbar/Text\"><<lingo Text/Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings": {
"title": "$:/core/ui/ControlPanel/Settings",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Settings/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/\n\n<<lingo Hint>>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]\">\n\n<div style=\"border-top:1px solid #eee;\">\n\n!! <$link><$transclude field=\"caption\"/></$link>\n\n<$transclude/>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/ControlPanel/StoryView": {
"title": "$:/core/ui/ControlPanel/StoryView",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/StoryView/Caption}}",
"text": "{{$:/snippets/viewswitcher}}\n"
},
"$:/core/ui/ControlPanel/Theme": {
"title": "$:/core/ui/ControlPanel/Theme",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Theme/Caption}}",
"text": "{{$:/snippets/themeswitcher}}\n"
},
"$:/core/ui/ControlPanel/TiddlerFields": {
"title": "$:/core/ui/ControlPanel/TiddlerFields",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/TiddlerFields/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n\n<<lingo TiddlerFields/Hint>>\n\n{{$:/snippets/allfields}}"
},
"$:/core/ui/ControlPanel/Toolbars/EditToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/EditToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/EditToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/EditToolbar/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/EditToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>"
},
"$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate",
"text": "\\define config-title()\n$(config-base)$$(currentTiddler)$\n\\end\n\n<$draggable tiddler=<<currentTiddler>>>\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <span class=\"tc-icon-wrapper\"><$transclude tiddler={{!!icon}}/></span> <$transclude field=\"caption\"/> -- <i class=\"tc-muted\"><$transclude field=\"description\"/></i>\n</$draggable>\n"
},
"$:/core/ui/ControlPanel/Toolbars/EditorToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditorToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/EditorToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/EditorToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/EditorToolbar/Hint}}\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/EditorToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate\"/>\n"
},
"$:/core/ui/ControlPanel/Toolbars/ItemTemplate": {
"title": "$:/core/ui/ControlPanel/Toolbars/ItemTemplate",
"text": "\\define config-title()\n$(config-base)$$(currentTiddler)$\n\\end\n\n<$draggable tiddler=<<currentTiddler>>>\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <span class=\"tc-icon-wrapper\"> <$transclude field=\"caption\"/> <i class=\"tc-muted\">-- <$transclude field=\"description\"/></i></span>\n</$draggable>\n"
},
"$:/core/ui/ControlPanel/Toolbars/PageControls": {
"title": "$:/core/ui/ControlPanel/Toolbars/PageControls",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/PageControls/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/PageControlButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/PageControls/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/PageControls\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/ControlPanel/Toolbars/ViewToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/ViewToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/ViewToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/ViewToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/ViewToolbar/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/ViewToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/ControlPanel/Toolbars": {
"title": "$:/core/ui/ControlPanel/Toolbars",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Toolbars/Caption}}",
"text": "{{$:/language/ControlPanel/Toolbars/Hint}}\n\n<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Toolbars]!has[draft.of]]\" \"$:/core/ui/ControlPanel/Toolbars/ViewToolbar\" \"$:/state/tabs/controlpanel/toolbars\" \"tc-vertical\">>\n</div>\n"
},
"$:/ControlPanel": {
"title": "$:/ControlPanel",
"icon": "$:/core/images/options-button",
"color": "#bbb",
"text": "<div class=\"tc-control-panel\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/ControlPanel]!has[draft.of]]\" \"$:/core/ui/ControlPanel/Info\">>\n</div>\n"
},
"$:/core/ui/DefaultSearchResultList": {
"title": "$:/core/ui/DefaultSearchResultList",
"tags": "$:/tags/SearchResults",
"caption": "{{$:/language/Search/DefaultResults/Caption}}",
"text": "\\define searchResultList()\n//<small>{{$:/language/Search/Matches/Title}}</small>//\n\n<$list filter=\"[!is[system]search:title{$(searchTiddler)$}sort[title]limit[250]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n//<small>{{$:/language/Search/Matches/All}}</small>//\n\n<$list filter=\"[!is[system]search{$(searchTiddler)$}sort[title]limit[250]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n\\end\n<<searchResultList>>\n"
},
"$:/core/ui/EditTemplate/body/preview/output": {
"title": "$:/core/ui/EditTemplate/body/preview/output",
"tags": "$:/tags/EditPreview",
"caption": "{{$:/language/EditTemplate/Body/Preview/Type/Output}}",
"text": "<$set name=\"tv-tiddler-preview\" value=\"yes\">\n\n<$transclude />\n\n</$set>\n"
},
"$:/core/ui/EditTemplate/body/editor": {
"title": "$:/core/ui/EditTemplate/body/editor",
"text": "<$edit\n\n field=\"text\"\n class=\"tc-edit-texteditor\"\n placeholder={{$:/language/EditTemplate/Body/Placeholder}}\n\n><$set\n\n name=\"targetTiddler\"\n value=<<currentTiddler>>\n\n><$list\n\n filter=\"[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]\"\n\n><$reveal\n\n type=\"nomatch\"\n state=<<config-visibility-title>>\n text=\"hide\"\n class=\"tc-text-editor-toolbar-item-wrapper\"\n\n><$transclude\n\n tiddler=\"$:/core/ui/EditTemplate/body/toolbar/button\"\n mode=\"inline\"\n\n/></$reveal></$list></$set></$edit>\n"
},
"$:/core/ui/EditTemplate/body/toolbar/button": {
"title": "$:/core/ui/EditTemplate/body/toolbar/button",
"text": "\\define toolbar-button-icon()\n<$list\n\n filter=\"[all[current]!has[custom-icon]]\"\n variable=\"no-custom-icon\"\n\n><$transclude\n\n tiddler={{!!icon}}\n\n/></$list>\n\\end\n\n\\define toolbar-button-tooltip()\n{{!!description}}<$macrocall $name=\"displayshortcuts\" $output=\"text/plain\" shortcuts={{!!shortcuts}} prefix=\"` - [\" separator=\"] [\" suffix=\"]`\"/>\n\\end\n\n\\define toolbar-button()\n<$list\n\n filter={{!!condition}}\n variable=\"list-condition\"\n\n><$wikify\n\n name=\"tooltip-text\"\n text=<<toolbar-button-tooltip>>\n mode=\"inline\"\n output=\"text\"\n\n><$list\n\n filter=\"[all[current]!has[dropdown]]\"\n variable=\"no-dropdown\"\n\n><$button\n\n class=\"tc-btn-invisible $(buttonClasses)$\"\n tooltip=<<tooltip-text>>\n\n><span\n\n data-tw-keyboard-shortcut={{!!shortcuts}}\n\n/><<toolbar-button-icon>><$transclude\n\n tiddler=<<currentTiddler>>\n field=\"text\"\n\n/></$button></$list><$list\n\n filter=\"[all[current]has[dropdown]]\"\n variable=\"dropdown\"\n\n><$set\n\n name=\"dropdown-state\"\n value=<<qualify \"$:/state/EditorToolbarDropdown\">>\n\n><$button\n\n popup=<<dropdown-state>>\n class=\"tc-popup-keep tc-btn-invisible $(buttonClasses)$\"\n selectedClass=\"tc-selected\"\n tooltip=<<tooltip-text>>\n\n><span\n\n data-tw-keyboard-shortcut={{!!shortcuts}}\n\n/><<toolbar-button-icon>><$transclude\n\n tiddler=<<currentTiddler>>\n field=\"text\"\n\n/></$button><$reveal\n\n state=<<dropdown-state>>\n type=\"popup\"\n position=\"below\"\n animate=\"yes\"\n tag=\"span\"\n\n><div\n\n class=\"tc-drop-down tc-popup-keep\"\n\n><$transclude\n\n tiddler={{!!dropdown}}\n mode=\"block\"\n\n/></div></$reveal></$set></$list></$wikify></$list>\n\\end\n\n\\define toolbar-button-outer()\n<$set\n\n name=\"buttonClasses\"\n value={{!!button-classes}}\n\n><<toolbar-button>></$set>\n\\end\n\n<<toolbar-button-outer>>"
},
"$:/core/ui/EditTemplate/body": {
"title": "$:/core/ui/EditTemplate/body",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/Body/\n\\define config-visibility-title()\n$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$\n\\end\n<$list filter=\"[is[current]has[_canonical_uri]]\">\n\n<div class=\"tc-message-box\">\n\n<<lingo External/Hint>>\n\n<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>\n\n<$edit-text field=\"_canonical_uri\" class=\"tc-edit-fields\"></$edit-text>\n\n</div>\n\n</$list>\n\n<$list filter=\"[is[current]!has[_canonical_uri]]\">\n\n<$reveal state=\"$:/state/showeditpreview\" type=\"match\" text=\"yes\">\n\n<div class=\"tc-tiddler-preview\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/editor\" mode=\"inline\"/>\n\n<div class=\"tc-tiddler-preview-preview\">\n\n<$transclude tiddler={{$:/state/editpreviewtype}} mode=\"inline\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/preview/output\" mode=\"inline\"/>\n\n</$transclude>\n\n</div>\n\n</div>\n\n</$reveal>\n\n<$reveal state=\"$:/state/showeditpreview\" type=\"nomatch\" text=\"yes\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/editor\" mode=\"inline\"/>\n\n</$reveal>\n\n</$list>\n"
},
"$:/core/ui/EditTemplate/controls": {
"title": "$:/core/ui/EditTemplate/controls",
"tags": "$:/tags/EditTemplate",
"text": "\\define config-title()\n$:/config/EditToolbarButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-tiddler-title tc-tiddler-edit-title\">\n<$view field=\"title\"/>\n<span class=\"tc-tiddler-controls tc-titlebar\"><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]\" variable=\"listItem\"><$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\"><$transclude tiddler=<<listItem>>/></$reveal></$list></span>\n<div style=\"clear: both;\"></div>\n</div>\n"
},
"$:/core/ui/EditTemplate/fields": {
"title": "$:/core/ui/EditTemplate/fields",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/\n\\define config-title()\n$:/config/EditTemplateFields/Visibility/$(currentField)$\n\\end\n\n\\define config-filter()\n[[hide]] -[title{$(config-title)$}]\n\\end\n\n\\define new-field-inner()\n<$reveal type=\"nomatch\" text=\"\" default=<<name>>>\n<$button>\n<$action-sendmessage $message=\"tm-add-field\" $name=<<name>> $value=<<value>>/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldname\"/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldvalue\"/>\n<<lingo Fields/Add/Button>>\n</$button>\n</$reveal>\n<$reveal type=\"match\" text=\"\" default=<<name>>>\n<$button>\n<<lingo Fields/Add/Button>>\n</$button>\n</$reveal>\n\\end\n\n\\define new-field()\n<$set name=\"name\" value={{$:/temp/newfieldname}}>\n<$set name=\"value\" value={{$:/temp/newfieldvalue}}>\n<<new-field-inner>>\n</$set>\n</$set>\n\\end\n\n<div class=\"tc-edit-fields\">\n<table class=\"tc-edit-fields\">\n<tbody>\n<$list filter=\"[all[current]fields[]] +[sort[title]]\" variable=\"currentField\">\n<$list filter=<<config-filter>> variable=\"temp\">\n<tr class=\"tc-edit-field\">\n<td class=\"tc-edit-field-name\">\n<$text text=<<currentField>>/>:</td>\n<td class=\"tc-edit-field-value\">\n<$edit-text tiddler=<<currentTiddler>> field=<<currentField>> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}}/>\n</td>\n<td class=\"tc-edit-field-remove\">\n<$button class=\"tc-btn-invisible\" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>\n<$action-deletefield $field=<<currentField>>/>\n{{$:/core/images/delete-button}}\n</$button>\n</td>\n</tr>\n</$list>\n</$list>\n</tbody>\n</table>\n</div>\n\n<$fieldmangler>\n<div class=\"tc-edit-field-add\">\n<em class=\"tc-edit\">\n<<lingo Fields/Add/Prompt>>\n</em>\n<span class=\"tc-edit-field-add-name\">\n<$edit-text tiddler=\"$:/temp/newfieldname\" tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}} focusPopup=<<qualify \"$:/state/popup/field-dropdown\">> class=\"tc-edit-texteditor tc-popup-handle\"/>\n</span>\n<$button popup=<<qualify \"$:/state/popup/field-dropdown\">> class=\"tc-btn-invisible tc-btn-dropdown\" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>\n<$reveal state=<<qualify \"$:/state/popup/field-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$linkcatcher to=\"$:/temp/newfieldname\">\n<div class=\"tc-dropdown-item\">\n<<lingo Fields/Add/Dropdown/User>>\n</div>\n<$list filter=\"[!is[shadow]!is[system]fields[]search:title{$:/temp/newfieldname}sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type\" variable=\"currentField\">\n<$link to=<<currentField>>>\n<<currentField>>\n</$link>\n</$list>\n<div class=\"tc-dropdown-item\">\n<<lingo Fields/Add/Dropdown/System>>\n</div>\n<$list filter=\"[fields[]search:title{$:/temp/newfieldname}sort[]] -[!is[shadow]!is[system]fields[]]\" variable=\"currentField\">\n<$link to=<<currentField>>>\n<<currentField>>\n</$link>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>\n<span class=\"tc-edit-field-add-value\">\n<$edit-text tiddler=\"$:/temp/newfieldvalue\" tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class=\"tc-edit-texteditor\"/>\n</span>\n<span class=\"tc-edit-field-add-button\">\n<$macrocall $name=\"new-field\"/>\n</span>\n</div>\n</$fieldmangler>\n"
},
"$:/core/ui/EditTemplate/shadow": {
"title": "$:/core/ui/EditTemplate/shadow",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/Shadow/\n\\define pluginLinkBody()\n<$link to=\"\"\"$(pluginTitle)$\"\"\">\n<$text text=\"\"\"$(pluginTitle)$\"\"\"/>\n</$link>\n\\end\n<$list filter=\"[all[current]get[draft.of]is[shadow]!is[tiddler]]\">\n\n<$list filter=\"[all[current]shadowsource[]]\" variable=\"pluginTitle\">\n\n<$set name=\"pluginLink\" value=<<pluginLinkBody>>>\n<div class=\"tc-message-box\">\n\n<<lingo Warning>>\n\n</div>\n</$set>\n</$list>\n\n</$list>\n\n<$list filter=\"[all[current]get[draft.of]is[shadow]is[tiddler]]\">\n\n<$list filter=\"[all[current]shadowsource[]]\" variable=\"pluginTitle\">\n\n<$set name=\"pluginLink\" value=<<pluginLinkBody>>>\n<div class=\"tc-message-box\">\n\n<<lingo OverriddenWarning>>\n\n</div>\n</$set>\n</$list>\n\n</$list>"
},
"$:/core/ui/EditTemplate/tags": {
"title": "$:/core/ui/EditTemplate/tags",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/\n\n\\define tag-styles()\nbackground-color:$(backgroundColor)$;\nfill:$(foregroundColor)$;\ncolor:$(foregroundColor)$;\n\\end\n\n\\define tag-body-inner(colour,fallbackTarget,colourA,colourB)\n<$vars foregroundColor=<<contrastcolour target:\"\"\"$colour$\"\"\" fallbackTarget:\"\"\"$fallbackTarget$\"\"\" colourA:\"\"\"$colourA$\"\"\" colourB:\"\"\"$colourB$\"\"\">> backgroundColor=\"\"\"$colour$\"\"\">\n<span style=<<tag-styles>> class=\"tc-tag-label\">\n<$view field=\"title\" format=\"text\" />\n<$button message=\"tm-remove-tag\" param={{!!title}} class=\"tc-btn-invisible tc-remove-tag-button\">×</$button>\n</span>\n</$vars>\n\\end\n\n\\define tag-body(colour,palette)\n<$macrocall $name=\"tag-body-inner\" colour=\"\"\"$colour$\"\"\" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/>\n\\end\n\n\\define tag-picker-actions()\n<$action-listops\n\t$tiddler=<<currentTiddler>>\n\t$field=\"tags\"\n\t$subfilter=\"[<tag>] [all[current]tags[]]\"\n/>\n\\end\n\n<div class=\"tc-edit-tags\">\n<$fieldmangler>\n<$list filter=\"[all[current]tags[]sort[title]]\" storyview=\"pop\">\n<$macrocall $name=\"tag-body\" colour={{!!color}} palette={{$:/palette}}/>\n</$list>\n</$fieldmangler>\n<$macrocall $name=\"tag-picker\" actions=<<tag-picker-actions>>/>\n</div>\n"
},
"$:/core/ui/EditTemplate/title": {
"title": "$:/core/ui/EditTemplate/title",
"tags": "$:/tags/EditTemplate",
"text": "<$edit-text field=\"draft.title\" class=\"tc-titlebar tc-edit-texteditor\" focus=\"true\"/>\n\n<$vars pattern=\"\"\"[\\|\\[\\]{}]\"\"\" bad-chars=\"\"\"`| [ ] { }`\"\"\">\n\n<$list filter=\"[is[current]regexp:draft.title<pattern>]\" variable=\"listItem\">\n\n<div class=\"tc-message-box\">\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}\n\n</div>\n\n</$list>\n\n</$vars>\n\n<$reveal state=\"!!draft.title\" type=\"nomatch\" text={{!!draft.of}} tag=\"div\">\n\n<$list filter=\"[{!!draft.title}!is[missing]]\" variable=\"listItem\">\n\n<div class=\"tc-message-box\">\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/Exists/Prompt}}\n\n</div>\n\n</$list>\n\n<$list filter=\"[{!!draft.of}!is[missing]]\" variable=\"listItem\">\n\n<$vars fromTitle={{!!draft.of}} toTitle={{!!draft.title}}>\n\n<$checkbox tiddler=\"$:/config/RelinkOnRename\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> {{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>\n\n</$vars>\n\n</$list>\n\n</$reveal>\n\n\n"
},
"$:/core/ui/EditTemplate/type": {
"title": "$:/core/ui/EditTemplate/type",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/\n<div class=\"tc-type-selector\"><$fieldmangler>\n<em class=\"tc-edit\"><<lingo Type/Prompt>></em> <$edit-text field=\"type\" tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify \"$:/state/popup/type-dropdown\">> class=\"tc-edit-typeeditor tc-popup-handle\"/> <$button popup=<<qualify \"$:/state/popup/type-dropdown\">> class=\"tc-btn-invisible tc-btn-dropdown\" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button> <$button message=\"tm-remove-field\" param=\"type\" class=\"tc-btn-invisible tc-btn-icon\" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}</$button>\n</$fieldmangler></div>\n\n<div class=\"tc-block-dropdown-wrapper\">\n<$reveal state=<<qualify \"$:/state/popup/type-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$linkcatcher to=\"!!type\">\n<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group-sort]]'>\n<div class=\"tc-dropdown-item\">\n<$text text={{!!group}}/>\n</div>\n<$list filter=\"[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] +[sort[description]]\"><$link to={{!!name}}><$view field=\"description\"/> (<$view field=\"name\"/>)</$link>\n</$list>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>\n</div>"
},
"$:/core/ui/EditTemplate": {
"title": "$:/core/ui/EditTemplate",
"text": "\\define actions()\n<$action-sendmessage $message=\"tm-add-tag\" $param={{$:/temp/NewTagName}}/>\n<$action-deletetiddler $tiddler=\"$:/temp/NewTagName\"/>\n<$action-sendmessage $message=\"tm-add-field\" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldname\"/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldvalue\"/>\n<$action-sendmessage $message=\"tm-save-tiddler\"/>\n\\end\n\\define frame-classes()\ntc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$\n\\end\n<div class=<<frame-classes>>>\n<$fieldmangler>\n<$set name=\"storyTiddler\" value=<<currentTiddler>>>\n<$keyboard key=\"((cancel-edit-tiddler))\" message=\"tm-cancel-tiddler\">\n<$keyboard key=\"((save-tiddler))\" actions=<<actions>>>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]\" variable=\"listItem\">\n<$transclude tiddler=<<listItem>>/>\n</$list>\n</$keyboard>\n</$keyboard>\n</$set>\n</$fieldmangler>\n</div>\n"
},
"$:/core/ui/Buttons/cancel": {
"title": "$:/core/ui/Buttons/cancel",
"tags": "$:/tags/EditToolbar",
"caption": "{{$:/core/images/cancel-button}} {{$:/language/Buttons/Cancel/Caption}}",
"description": "{{$:/language/Buttons/Cancel/Hint}}",
"text": "<$button message=\"tm-cancel-tiddler\" tooltip={{$:/language/Buttons/Cancel/Hint}} aria-label={{$:/language/Buttons/Cancel/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/cancel-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Cancel/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/delete": {
"title": "$:/core/ui/Buttons/delete",
"tags": "$:/tags/EditToolbar $:/tags/ViewToolbar",
"caption": "{{$:/core/images/delete-button}} {{$:/language/Buttons/Delete/Caption}}",
"description": "{{$:/language/Buttons/Delete/Hint}}",
"text": "<$button message=\"tm-delete-tiddler\" tooltip={{$:/language/Buttons/Delete/Hint}} aria-label={{$:/language/Buttons/Delete/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/delete-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Delete/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/save": {
"title": "$:/core/ui/Buttons/save",
"tags": "$:/tags/EditToolbar",
"caption": "{{$:/core/images/done-button}} {{$:/language/Buttons/Save/Caption}}",
"description": "{{$:/language/Buttons/Save/Hint}}",
"text": "<$fieldmangler><$button tooltip={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-add-tag\" $param={{$:/temp/NewTagName}}/>\n<$action-deletetiddler $tiddler=\"$:/temp/NewTagName\"/>\n<$action-sendmessage $message=\"tm-add-field\" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldname\"/>\n<$action-deletetiddler $tiddler=\"$:/temp/newfieldvalue\"/>\n<$action-sendmessage $message=\"tm-save-tiddler\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/done-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Save/Caption}}/></span>\n</$list>\n</$button>\n</$fieldmangler>\n"
},
"$:/core/ui/EditorToolbar/bold": {
"title": "$:/core/ui/EditorToolbar/bold",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/bold",
"caption": "{{$:/language/Buttons/Bold/Caption}}",
"description": "{{$:/language/Buttons/Bold/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((bold))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"''\"\n\tsuffix=\"''\"\n/>\n"
},
"$:/core/ui/EditorToolbar/clear-dropdown": {
"title": "$:/core/ui/EditorToolbar/clear-dropdown",
"text": "''{{$:/language/Buttons/Clear/Hint}}''\n\n<div class=\"tc-colour-chooser\">\n\n<$macrocall $name=\"colour-picker\" actions=\"\"\"\n\n<$action-sendmessage\n\t$message=\"tm-edit-bitmap-operation\"\n\t$param=\"clear\"\n\tcolour=<<colour-picker-value>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n\n</div>\n"
},
"$:/core/ui/EditorToolbar/clear": {
"title": "$:/core/ui/EditorToolbar/clear",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/erase",
"caption": "{{$:/language/Buttons/Clear/Caption}}",
"description": "{{$:/language/Buttons/Clear/Hint}}",
"condition": "[<targetTiddler>is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/clear-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/editor-height-dropdown": {
"title": "$:/core/ui/EditorToolbar/editor-height-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/EditorHeight/\n''<<lingo Hint>>''\n\n<$radio tiddler=\"$:/config/TextEditor/EditorHeight/Mode\" value=\"auto\"> {{$:/core/images/auto-height}} <<lingo Caption/Auto>></$radio>\n\n<$radio tiddler=\"$:/config/TextEditor/EditorHeight/Mode\" value=\"fixed\"> {{$:/core/images/fixed-height}} <<lingo Caption/Fixed>> <$edit-text tag=\"input\" tiddler=\"$:/config/TextEditor/EditorHeight/Height\" default=\"100px\"/></$radio>\n"
},
"$:/core/ui/EditorToolbar/editor-height": {
"title": "$:/core/ui/EditorToolbar/editor-height",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/fixed-height",
"custom-icon": "yes",
"caption": "{{$:/language/Buttons/EditorHeight/Caption}}",
"description": "{{$:/language/Buttons/EditorHeight/Hint}}",
"condition": "[<targetTiddler>!is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/editor-height-dropdown",
"text": "<$reveal tag=\"span\" state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"fixed\">\n{{$:/core/images/fixed-height}}\n</$reveal>\n<$reveal tag=\"span\" state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"auto\">\n{{$:/core/images/auto-height}}\n</$reveal>\n"
},
"$:/core/ui/EditorToolbar/excise-dropdown": {
"title": "$:/core/ui/EditorToolbar/excise-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Excise/\n\n\\define body(config-title)\n''<<lingo Hint>>''\n\n<<lingo Caption/NewTitle>> <$edit-text tag=\"input\" tiddler=\"$config-title$/new-title\" default=\"\" focus=\"true\"/>\n\n<$set name=\"new-title\" value={{$config-title$/new-title}}>\n<$list filter=\"\"\"[<new-title>is[tiddler]]\"\"\">\n<div class=\"tc-error\">\n<<lingo Caption/TiddlerExists>>\n</div>\n</$list>\n</$set>\n\n<$checkbox tiddler=\"\"\"$config-title$/tagnew\"\"\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"false\"> <<lingo Caption/Tag>></$checkbox>\n\n<<lingo Caption/Replace>> <$select tiddler=\"\"\"$config-title$/type\"\"\" default=\"transclude\">\n<option value=\"link\"><<lingo Caption/Replace/Link>></option>\n<option value=\"transclude\"><<lingo Caption/Replace/Transclusion>></option>\n<option value=\"macro\"><<lingo Caption/Replace/Macro>></option>\n</$select>\n\n<$reveal state=\"\"\"$config-title$/type\"\"\" type=\"match\" text=\"macro\">\n<<lingo Caption/MacroName>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/macro-title\"\"\" default=\"translink\"/>\n</$reveal>\n\n<$button>\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"excise\"\n\ttitle={{$config-title$/new-title}}\n\ttype={{$config-title$/type}}\n\tmacro={{$config-title$/macro-title}}\n\ttagnew={{$config-title$/tagnew}}\n/>\n<$action-deletetiddler\n\t$tiddler=\"$config-title$/new-title\"\n/>\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n<<lingo Caption/Excise>>\n</$button>\n\\end\n\n<$macrocall $name=\"body\" config-title=<<qualify \"$:/state/Excise/\">>/>\n"
},
"$:/core/ui/EditorToolbar/excise": {
"title": "$:/core/ui/EditorToolbar/excise",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/excise",
"caption": "{{$:/language/Buttons/Excise/Caption}}",
"description": "{{$:/language/Buttons/Excise/Hint}}",
"condition": "[<targetTiddler>!is[image]]",
"shortcuts": "((excise))",
"dropdown": "$:/core/ui/EditorToolbar/excise-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/heading-1": {
"title": "$:/core/ui/EditorToolbar/heading-1",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-1",
"caption": "{{$:/language/Buttons/Heading1/Caption}}",
"description": "{{$:/language/Buttons/Heading1/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((heading-1))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-2": {
"title": "$:/core/ui/EditorToolbar/heading-2",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-2",
"caption": "{{$:/language/Buttons/Heading2/Caption}}",
"description": "{{$:/language/Buttons/Heading2/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-2))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"2\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-3": {
"title": "$:/core/ui/EditorToolbar/heading-3",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-3",
"caption": "{{$:/language/Buttons/Heading3/Caption}}",
"description": "{{$:/language/Buttons/Heading3/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-3))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"3\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-4": {
"title": "$:/core/ui/EditorToolbar/heading-4",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-4",
"caption": "{{$:/language/Buttons/Heading4/Caption}}",
"description": "{{$:/language/Buttons/Heading4/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-4))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"4\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-5": {
"title": "$:/core/ui/EditorToolbar/heading-5",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-5",
"caption": "{{$:/language/Buttons/Heading5/Caption}}",
"description": "{{$:/language/Buttons/Heading5/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-5))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"5\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-6": {
"title": "$:/core/ui/EditorToolbar/heading-6",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-6",
"caption": "{{$:/language/Buttons/Heading6/Caption}}",
"description": "{{$:/language/Buttons/Heading6/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-6))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"6\"\n/>\n"
},
"$:/core/ui/EditorToolbar/italic": {
"title": "$:/core/ui/EditorToolbar/italic",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/italic",
"caption": "{{$:/language/Buttons/Italic/Caption}}",
"description": "{{$:/language/Buttons/Italic/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((italic))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"//\"\n\tsuffix=\"//\"\n/>\n"
},
"$:/core/ui/EditorToolbar/line-width-dropdown": {
"title": "$:/core/ui/EditorToolbar/line-width-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/LineWidth/\n\n\\define toolbar-line-width-inner()\n<$button tag=\"a\" tooltip=\"\"\"$(line-width)$\"\"\">\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/LineWidth\"\n\t$value=\"$(line-width)$\"\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<div style=\"display: inline-block; margin: 4px calc(80px - $(line-width)$); background-color: #000; width: calc(100px + $(line-width)$ * 2); height: $(line-width)$; border-radius: 120px; vertical-align: middle;\"/>\n\n<span style=\"margin-left: 8px;\">\n\n<$text text=\"\"\"$(line-width)$\"\"\"/>\n\n<$reveal state=\"$:/config/BitmapEditor/LineWidth\" type=\"match\" text=\"\"\"$(line-width)$\"\"\" tag=\"span\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</span>\n\n</$button>\n\\end\n\n''<<lingo Hint>>''\n\n<$list filter={{$:/config/BitmapEditor/LineWidths}} variable=\"line-width\">\n\n<<toolbar-line-width-inner>>\n\n</$list>\n"
},
"$:/core/ui/EditorToolbar/line-width": {
"title": "$:/core/ui/EditorToolbar/line-width",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/line-width",
"caption": "{{$:/language/Buttons/LineWidth/Caption}}",
"description": "{{$:/language/Buttons/LineWidth/Hint}}",
"condition": "[<targetTiddler>is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/line-width-dropdown",
"text": "<$text text={{$:/config/BitmapEditor/LineWidth}}/>"
},
"$:/core/ui/EditorToolbar/link-dropdown": {
"title": "$:/core/ui/EditorToolbar/link-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Link/\n\n\\define link-actions()\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"make-link\"\n\ttext={{$(linkTiddler)$}}\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<searchTiddler>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<linkTiddler>>\n/>\n\\end\n\n\\define external-link()\n<$button class=\"tc-btn-invisible\" style=\"width: auto; display: inline-block; background-colour: inherit;\">\n<$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"make-link\" text={{$(searchTiddler)$}}\n/>\n{{$:/core/images/chevron-right}}\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<searchTiddler>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<linkTiddler>>\n/>\n</$button>\n\\end\n\n\n\\define body(config-title)\n''<<lingo Hint>>''\n\n<$vars searchTiddler=\"\"\"$config-title$/search\"\"\" linkTiddler=\"\"\"$config-title$/link\"\"\" linktext=\"\" >\n\n<$edit-text tiddler=<<searchTiddler>> type=\"search\" tag=\"input\" focus=\"true\" placeholder={{$:/language/Search/Search}} default=\"\"/>\n<$reveal tag=\"span\" state=<<searchTiddler>> type=\"nomatch\" text=\"\">\n<<external-link>>\n<$button class=\"tc-btn-invisible\" style=\"width: auto; display: inline-block; background-colour: inherit;\">\n<$action-setfield $tiddler=<<searchTiddler>> text=\"\" />\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n\n<$reveal tag=\"div\" state=<<searchTiddler>> type=\"nomatch\" text=\"\">\n\n<$linkcatcher actions=<<link-actions>> to=<<linkTiddler>>>\n\n{{$:/core/ui/SearchResults}}\n\n</$linkcatcher>\n\n</$reveal>\n\n</$vars>\n\n\\end\n\n<$macrocall $name=\"body\" config-title=<<qualify \"$:/state/Link/\">>/>"
},
"$:/core/ui/EditorToolbar/link": {
"title": "$:/core/ui/EditorToolbar/link",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/link",
"caption": "{{$:/language/Buttons/Link/Caption}}",
"description": "{{$:/language/Buttons/Link/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((link))",
"dropdown": "$:/core/ui/EditorToolbar/link-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/list-bullet": {
"title": "$:/core/ui/EditorToolbar/list-bullet",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-bullet",
"caption": "{{$:/language/Buttons/ListBullet/Caption}}",
"description": "{{$:/language/Buttons/ListBullet/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((list-bullet))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"*\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/list-number": {
"title": "$:/core/ui/EditorToolbar/list-number",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-number",
"caption": "{{$:/language/Buttons/ListNumber/Caption}}",
"description": "{{$:/language/Buttons/ListNumber/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((list-number))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/mono-block": {
"title": "$:/core/ui/EditorToolbar/mono-block",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/mono-block",
"caption": "{{$:/language/Buttons/MonoBlock/Caption}}",
"description": "{{$:/language/Buttons/MonoBlock/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((mono-block))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-lines\"\n\tprefix=\"\n```\"\n\tsuffix=\"```\"\n/>\n"
},
"$:/core/ui/EditorToolbar/mono-line": {
"title": "$:/core/ui/EditorToolbar/mono-line",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/mono-line",
"caption": "{{$:/language/Buttons/MonoLine/Caption}}",
"description": "{{$:/language/Buttons/MonoLine/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((mono-line))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"`\"\n\tsuffix=\"`\"\n/>\n"
},
"$:/core/ui/EditorToolbar/more-dropdown": {
"title": "$:/core/ui/EditorToolbar/more-dropdown",
"text": "\\define config-title()\n$:/config/EditorToolbarButtons/Visibility/$(toolbarItem)$\n\\end\n\n\\define conditional-button()\n<$list filter={{$(toolbarItem)$!!condition}} variable=\"condition\">\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/toolbar/button\" mode=\"inline\"/> <$transclude tiddler=<<toolbarItem>> field=\"description\"/>\n</$list>\n\\end\n\n<div class=\"tc-text-editor-toolbar-more\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]] -[[$:/core/ui/EditorToolbar/more]]\">\n<$reveal type=\"match\" state=<<config-visibility-title>> text=\"hide\" tag=\"div\">\n<<conditional-button>>\n</$reveal>\n</$list>\n</div>\n"
},
"$:/core/ui/EditorToolbar/more": {
"title": "$:/core/ui/EditorToolbar/more",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/down-arrow",
"caption": "{{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"condition": "[<targetTiddler>]",
"dropdown": "$:/core/ui/EditorToolbar/more-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/opacity-dropdown": {
"title": "$:/core/ui/EditorToolbar/opacity-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Opacity/\n\n\\define toolbar-opacity-inner()\n<$button tag=\"a\" tooltip=\"\"\"$(opacity)$\"\"\">\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/Opacity\"\n\t$value=\"$(opacity)$\"\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<div style=\"display: inline-block; vertical-align: middle; background-color: $(current-paint-colour)$; opacity: $(opacity)$; width: 1em; height: 1em; border-radius: 50%;\"/>\n\n<span style=\"margin-left: 8px;\">\n\n<$text text=\"\"\"$(opacity)$\"\"\"/>\n\n<$reveal state=\"$:/config/BitmapEditor/Opacity\" type=\"match\" text=\"\"\"$(opacity)$\"\"\" tag=\"span\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</span>\n\n</$button>\n\\end\n\n\\define toolbar-opacity()\n''<<lingo Hint>>''\n\n<$list filter={{$:/config/BitmapEditor/Opacities}} variable=\"opacity\">\n\n<<toolbar-opacity-inner>>\n\n</$list>\n\\end\n\n<$set name=\"current-paint-colour\" value={{$:/config/BitmapEditor/Colour}}>\n\n<$set name=\"current-opacity\" value={{$:/config/BitmapEditor/Opacity}}>\n\n<<toolbar-opacity>>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/EditorToolbar/opacity": {
"title": "$:/core/ui/EditorToolbar/opacity",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/opacity",
"caption": "{{$:/language/Buttons/Opacity/Caption}}",
"description": "{{$:/language/Buttons/Opacity/Hint}}",
"condition": "[<targetTiddler>is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/opacity-dropdown",
"text": "<$text text={{$:/config/BitmapEditor/Opacity}}/>\n"
},
"$:/core/ui/EditorToolbar/paint-dropdown": {
"title": "$:/core/ui/EditorToolbar/paint-dropdown",
"text": "''{{$:/language/Buttons/Paint/Hint}}''\n\n<$macrocall $name=\"colour-picker\" actions=\"\"\"\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/Colour\"\n\t$value=<<colour-picker-value>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n"
},
"$:/core/ui/EditorToolbar/paint": {
"title": "$:/core/ui/EditorToolbar/paint",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/paint",
"caption": "{{$:/language/Buttons/Paint/Caption}}",
"description": "{{$:/language/Buttons/Paint/Hint}}",
"condition": "[<targetTiddler>is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/paint-dropdown",
"text": "\\define toolbar-paint()\n<div style=\"display: inline-block; vertical-align: middle; background-color: $(colour-picker-value)$; width: 1em; height: 1em; border-radius: 50%;\"/>\n\\end\n<$set name=\"colour-picker-value\" value={{$:/config/BitmapEditor/Colour}}>\n<<toolbar-paint>>\n</$set>\n"
},
"$:/core/ui/EditorToolbar/picture-dropdown": {
"title": "$:/core/ui/EditorToolbar/picture-dropdown",
"text": "\\define replacement-text()\n[img[$(imageTitle)$]]\n\\end\n\n''{{$:/language/Buttons/Picture/Hint}}''\n\n<$macrocall $name=\"image-picker\" actions=\"\"\"\n\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"replace-selection\"\n\ttext=<<replacement-text>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n"
},
"$:/core/ui/EditorToolbar/picture": {
"title": "$:/core/ui/EditorToolbar/picture",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/picture",
"caption": "{{$:/language/Buttons/Picture/Caption}}",
"description": "{{$:/language/Buttons/Picture/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((picture))",
"dropdown": "$:/core/ui/EditorToolbar/picture-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/preview-type-dropdown": {
"title": "$:/core/ui/EditorToolbar/preview-type-dropdown",
"text": "\\define preview-type-button()\n<$button tag=\"a\">\n\n<$action-setfield $tiddler=\"$:/state/editpreviewtype\" $value=\"$(previewType)$\"/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$transclude tiddler=<<previewType>> field=\"caption\" mode=\"inline\">\n\n<$view tiddler=<<previewType>> field=\"title\" mode=\"inline\"/>\n\n</$transclude> \n\n<$reveal tag=\"span\" state=\"$:/state/editpreviewtype\" type=\"match\" text=<<previewType>> default=\"$:/core/ui/EditTemplate/body/preview/output\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</$button>\n\\end\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]]\" variable=\"previewType\">\n\n<<preview-type-button>>\n\n</$list>\n"
},
"$:/core/ui/EditorToolbar/preview-type": {
"title": "$:/core/ui/EditorToolbar/preview-type",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/chevron-down",
"caption": "{{$:/language/Buttons/PreviewType/Caption}}",
"description": "{{$:/language/Buttons/PreviewType/Hint}}",
"condition": "[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]butfirst[]limit[1]]",
"button-classes": "tc-text-editor-toolbar-item-adjunct",
"dropdown": "$:/core/ui/EditorToolbar/preview-type-dropdown"
},
"$:/core/ui/EditorToolbar/preview": {
"title": "$:/core/ui/EditorToolbar/preview",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/preview-open",
"custom-icon": "yes",
"caption": "{{$:/language/Buttons/Preview/Caption}}",
"description": "{{$:/language/Buttons/Preview/Hint}}",
"condition": "[<targetTiddler>]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((preview))",
"text": "<$reveal state=\"$:/state/showeditpreview\" type=\"match\" text=\"yes\" tag=\"span\">\n{{$:/core/images/preview-open}}\n<$action-setfield $tiddler=\"$:/state/showeditpreview\" $value=\"no\"/>\n</$reveal>\n<$reveal state=\"$:/state/showeditpreview\" type=\"nomatch\" text=\"yes\" tag=\"span\">\n{{$:/core/images/preview-closed}}\n<$action-setfield $tiddler=\"$:/state/showeditpreview\" $value=\"yes\"/>\n</$reveal>\n"
},
"$:/core/ui/EditorToolbar/quote": {
"title": "$:/core/ui/EditorToolbar/quote",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/quote",
"caption": "{{$:/language/Buttons/Quote/Caption}}",
"description": "{{$:/language/Buttons/Quote/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((quote))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-lines\"\n\tprefix=\"\n<<<\"\n\tsuffix=\"<<<\"\n/>\n"
},
"$:/core/ui/EditorToolbar/size-dropdown": {
"title": "$:/core/ui/EditorToolbar/size-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Size/\n\n\\define toolbar-button-size-preset(config-title)\n<$set name=\"width\" filter=\"$(sizePair)$ +[first[]]\">\n\n<$set name=\"height\" filter=\"$(sizePair)$ +[last[]]\">\n\n<$button tag=\"a\">\n\n<$action-setfield\n\t$tiddler=\"\"\"$config-title$/new-width\"\"\"\n\t$value=<<width>>\n/>\n\n<$action-setfield\n\t$tiddler=\"\"\"$config-title$/new-height\"\"\"\n\t$value=<<height>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/presets-popup\"\"\"\n/>\n\n<$text text=<<width>>/> × <$text text=<<height>>/>\n\n</$button>\n\n</$set>\n\n</$set>\n\\end\n\n\\define toolbar-button-size(config-title)\n''{{$:/language/Buttons/Size/Hint}}''\n\n<<lingo Caption/Width>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/new-width\"\"\" default=<<tv-bitmap-editor-width>> focus=\"true\" size=\"8\"/> <<lingo Caption/Height>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/new-height\"\"\" default=<<tv-bitmap-editor-height>> size=\"8\"/> <$button popup=\"\"\"$config-title$/presets-popup\"\"\" class=\"tc-btn-invisible tc-popup-keep\" style=\"width: auto; display: inline-block; background-colour: inherit;\" selectedClass=\"tc-selected\">\n{{$:/core/images/down-arrow}}\n</$button>\n\n<$reveal tag=\"span\" state=\"\"\"$config-title$/presets-popup\"\"\" type=\"popup\" position=\"belowleft\" animate=\"yes\">\n\n<div class=\"tc-drop-down tc-popup-keep\">\n\n<$list filter={{$:/config/BitmapEditor/ImageSizes}} variable=\"sizePair\">\n\n<$macrocall $name=\"toolbar-button-size-preset\" config-title=\"$config-title$\"/>\n\n</$list>\n\n</div>\n\n</$reveal>\n\n<$button>\n<$action-sendmessage\n\t$message=\"tm-edit-bitmap-operation\"\n\t$param=\"resize\"\n\twidth={{$config-title$/new-width}}\n\theight={{$config-title$/new-height}}\n/>\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/new-width\"\"\"\n/>\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/new-height\"\"\"\n/>\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n<<lingo Caption/Resize>>\n</$button>\n\\end\n\n<$macrocall $name=\"toolbar-button-size\" config-title=<<qualify \"$:/state/Size/\">>/>\n"
},
"$:/core/ui/EditorToolbar/size": {
"title": "$:/core/ui/EditorToolbar/size",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/size",
"caption": "{{$:/language/Buttons/Size/Caption}}",
"description": "{{$:/language/Buttons/Size/Hint}}",
"condition": "[<targetTiddler>is[image]]",
"dropdown": "$:/core/ui/EditorToolbar/size-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/stamp-dropdown": {
"title": "$:/core/ui/EditorToolbar/stamp-dropdown",
"text": "\\define toolbar-button-stamp-inner()\n<$button tag=\"a\">\n\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"replace-selection\"\n\ttext={{$(snippetTitle)$}}\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$view tiddler=<<snippetTitle>> field=\"caption\" mode=\"inline\">\n\n<$view tiddler=<<snippetTitle>> field=\"title\" mode=\"inline\"/>\n\n</$view>\n\n</$button>\n\\end\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TextEditor/Snippet]!has[draft.of]sort[caption]]\" variable=\"snippetTitle\">\n\n<<toolbar-button-stamp-inner>>\n\n</$list>\n\n----\n\n<$button tag=\"a\">\n\n<$action-sendmessage\n\t$message=\"tm-new-tiddler\"\n\ttags=\"$:/tags/TextEditor/Snippet\"\n\tcaption={{$:/language/Buttons/Stamp/New/Title}}\n\ttext={{$:/language/Buttons/Stamp/New/Text}}\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<em>\n\n<$text text={{$:/language/Buttons/Stamp/Caption/New}}/>\n\n</em>\n\n</$button>\n"
},
"$:/core/ui/EditorToolbar/stamp": {
"title": "$:/core/ui/EditorToolbar/stamp",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/stamp",
"caption": "{{$:/language/Buttons/Stamp/Caption}}",
"description": "{{$:/language/Buttons/Stamp/Hint}}",
"condition": "[<targetTiddler>!is[image]]",
"shortcuts": "((stamp))",
"dropdown": "$:/core/ui/EditorToolbar/stamp-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/strikethrough": {
"title": "$:/core/ui/EditorToolbar/strikethrough",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/strikethrough",
"caption": "{{$:/language/Buttons/Strikethrough/Caption}}",
"description": "{{$:/language/Buttons/Strikethrough/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((strikethrough))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"~~\"\n\tsuffix=\"~~\"\n/>\n"
},
"$:/core/ui/EditorToolbar/subscript": {
"title": "$:/core/ui/EditorToolbar/subscript",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/subscript",
"caption": "{{$:/language/Buttons/Subscript/Caption}}",
"description": "{{$:/language/Buttons/Subscript/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((subscript))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\",,\"\n\tsuffix=\",,\"\n/>\n"
},
"$:/core/ui/EditorToolbar/superscript": {
"title": "$:/core/ui/EditorToolbar/superscript",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/superscript",
"caption": "{{$:/language/Buttons/Superscript/Caption}}",
"description": "{{$:/language/Buttons/Superscript/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((superscript))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"^^\"\n\tsuffix=\"^^\"\n/>\n"
},
"$:/core/ui/EditorToolbar/underline": {
"title": "$:/core/ui/EditorToolbar/underline",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/underline",
"caption": "{{$:/language/Buttons/Underline/Caption}}",
"description": "{{$:/language/Buttons/Underline/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((underline))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"__\"\n\tsuffix=\"__\"\n/>\n"
},
"$:/core/Filters/AllTags": {
"title": "$:/core/Filters/AllTags",
"tags": "$:/tags/Filter",
"filter": "[tags[]!is[system]sort[title]]",
"description": "{{$:/language/Filters/AllTags}}",
"text": ""
},
"$:/core/Filters/AllTiddlers": {
"title": "$:/core/Filters/AllTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]sort[title]]",
"description": "{{$:/language/Filters/AllTiddlers}}",
"text": ""
},
"$:/core/Filters/Drafts": {
"title": "$:/core/Filters/Drafts",
"tags": "$:/tags/Filter",
"filter": "[has[draft.of]sort[title]]",
"description": "{{$:/language/Filters/Drafts}}",
"text": ""
},
"$:/core/Filters/Missing": {
"title": "$:/core/Filters/Missing",
"tags": "$:/tags/Filter",
"filter": "[all[missing]sort[title]]",
"description": "{{$:/language/Filters/Missing}}",
"text": ""
},
"$:/core/Filters/Orphans": {
"title": "$:/core/Filters/Orphans",
"tags": "$:/tags/Filter",
"filter": "[all[orphans]sort[title]]",
"description": "{{$:/language/Filters/Orphans}}",
"text": ""
},
"$:/core/Filters/OverriddenShadowTiddlers": {
"title": "$:/core/Filters/OverriddenShadowTiddlers",
"tags": "$:/tags/Filter",
"filter": "[is[shadow]]",
"description": "{{$:/language/Filters/OverriddenShadowTiddlers}}",
"text": ""
},
"$:/core/Filters/RecentSystemTiddlers": {
"title": "$:/core/Filters/RecentSystemTiddlers",
"tags": "$:/tags/Filter",
"filter": "[has[modified]!sort[modified]limit[50]]",
"description": "{{$:/language/Filters/RecentSystemTiddlers}}",
"text": ""
},
"$:/core/Filters/RecentTiddlers": {
"title": "$:/core/Filters/RecentTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]has[modified]!sort[modified]limit[50]]",
"description": "{{$:/language/Filters/RecentTiddlers}}",
"text": ""
},
"$:/core/Filters/ShadowTiddlers": {
"title": "$:/core/Filters/ShadowTiddlers",
"tags": "$:/tags/Filter",
"filter": "[all[shadows]sort[title]]",
"description": "{{$:/language/Filters/ShadowTiddlers}}",
"text": ""
},
"$:/core/Filters/StoryList": {
"title": "$:/core/Filters/StoryList",
"tags": "$:/tags/Filter",
"filter": "[list[$:/StoryList]] -$:/AdvancedSearch",
"description": "{{$:/language/Filters/StoryList}}",
"text": ""
},
"$:/core/Filters/SystemTags": {
"title": "$:/core/Filters/SystemTags",
"tags": "$:/tags/Filter",
"filter": "[all[shadows+tiddlers]tags[]is[system]sort[title]]",
"description": "{{$:/language/Filters/SystemTags}}",
"text": ""
},
"$:/core/Filters/SystemTiddlers": {
"title": "$:/core/Filters/SystemTiddlers",
"tags": "$:/tags/Filter",
"filter": "[is[system]sort[title]]",
"description": "{{$:/language/Filters/SystemTiddlers}}",
"text": ""
},
"$:/core/Filters/TypedTiddlers": {
"title": "$:/core/Filters/TypedTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]has[type]each[type]sort[type]] -[type[text/vnd.tiddlywiki]]",
"description": "{{$:/language/Filters/TypedTiddlers}}",
"text": ""
},
"$:/core/ui/ImportListing": {
"title": "$:/core/ui/ImportListing",
"text": "\\define lingo-base() $:/language/Import/\n\n\\define messageField()\nmessage-$(payloadTiddler)$\n\\end\n\n\\define selectionField()\nselection-$(payloadTiddler)$\n\\end\n\n\\define previewPopupState()\n$(currentTiddler)$!!popup-$(payloadTiddler)$\n\\end\n\n\\define select-all-actions()\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" variable=\"payloadTiddler\">\n<$action-setfield $field={{{ [<payloadTiddler>addprefix[selection-]] }}} $value={{$:/state/import/select-all}}/>\n</$list>\n\\end\n\n<table>\n<tbody>\n<tr>\n<th>\n<$checkbox tiddler=\"$:/state/import/select-all\" field=\"text\" checked=\"checked\" unchecked=\"unchecked\" default=\"checked\" actions=<<select-all-actions>>>\n<<lingo Listing/Select/Caption>>\n</$checkbox>\n</th>\n<th>\n<<lingo Listing/Title/Caption>>\n</th>\n<th>\n<<lingo Listing/Status/Caption>>\n</th>\n</tr>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" variable=\"payloadTiddler\">\n<tr>\n<td>\n<$checkbox field=<<selectionField>> checked=\"checked\" unchecked=\"unchecked\" default=\"checked\"/>\n</td>\n<td>\n<$reveal type=\"nomatch\" state=<<previewPopupState>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<previewPopupState>> setTo=\"yes\">\n{{$:/core/images/right-arrow}} <$text text=<<payloadTiddler>>/>\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<previewPopupState>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<previewPopupState>> setTo=\"no\">\n{{$:/core/images/down-arrow}} <$text text=<<payloadTiddler>>/>\n</$button>\n</$reveal>\n</td>\n<td>\n<$view field=<<messageField>>/>\n</td>\n</tr>\n<tr>\n<td colspan=\"3\">\n<$reveal type=\"match\" text=\"yes\" state=<<previewPopupState>>>\n<$transclude subtiddler=<<payloadTiddler>> mode=\"block\"/>\n</$reveal>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ListItemTemplate": {
"title": "$:/core/ui/ListItemTemplate",
"text": "<div class=\"tc-menu-list-item\">\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</div>"
},
"$:/Manager/ItemMain/Fields": {
"title": "$:/Manager/ItemMain/Fields",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/Fields}}",
"text": "<table>\n<tbody>\n<$list filter=\"[all[current]fields[]sort[title]] -text\" template=\"$:/core/ui/TiddlerFieldTemplate\" variable=\"listItem\"/>\n</tbody>\n</table>\n"
},
"$:/Manager/ItemMain/RawText": {
"title": "$:/Manager/ItemMain/RawText",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/RawText}}",
"text": "<pre><code><$view/></code></pre>\n"
},
"$:/Manager/ItemMain/WikifiedText": {
"title": "$:/Manager/ItemMain/WikifiedText",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/WikifiedText}}",
"text": "<$transclude mode=\"block\"/>\n"
},
"$:/Manager/ItemSidebar/Colour": {
"title": "$:/Manager/ItemSidebar/Colour",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Colour}}",
"text": "\\define swatch-styles()\nheight: 1em;\nbackground-color: $(colour)$\n\\end\n\n<$vars colour={{!!color}}>\n<p style=<<swatch-styles>>/>\n</$vars>\n<p>\n<$edit-text field=\"color\" tag=\"input\" type=\"color\"/> / <$edit-text field=\"color\" tag=\"input\" type=\"text\" size=\"9\"/>\n</p>\n"
},
"$:/Manager/ItemSidebar/Icon": {
"title": "$:/Manager/ItemSidebar/Icon",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Icon}}",
"text": "<p>\n<div class=\"tc-manager-icon-editor\">\n<$button popup=<<qualify \"$:/state/popup/image-picker\">> class=\"tc-btn-invisible\">\n<$transclude tiddler={{!!icon}}>\n{{$:/language/Manager/Item/Icon/None}}\n</$transclude>\n</$button>\n<div class=\"tc-block-dropdown-wrapper\" style=\"position: static;\">\n<$reveal state=<<qualify \"$:/state/popup/image-picker\">> type=\"nomatch\" text=\"\" default=\"\" tag=\"div\" class=\"tc-popup\">\n<div class=\"tc-block-dropdown tc-popup-keep\" style=\"width: 80%; left: 10%; right: 10%; padding: 0.5em;\">\n<$macrocall $name=\"image-picker-include-tagged-images\" actions=\"\"\"\n<$action-setfield $field=\"icon\" $value=<<imageTitle>>/>\n<$action-deletetiddler $tiddler=<<qualify \"$:/state/popup/image-picker\">>/>\n\"\"\"/>\n</div>\n</$reveal>\n</div>\n</div>\n</p>\n"
},
"$:/Manager/ItemSidebar/Tags": {
"title": "$:/Manager/ItemSidebar/Tags",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Tags}}",
"text": "\\define tag-checkbox-actions()\n<$action-listops\n\t$tiddler=\"$:/config/Manager/RecentTags\"\n\t$subfilter=\"[<tag>] [list[$:/config/Manager/RecentTags]] +[limit[12]]\"\n/>\n\\end\n\n\\define tag-picker-actions()\n<<tag-checkbox-actions>>\n<$action-listops\n\t$tiddler=<<currentTiddler>>\n\t$field=\"tags\"\n\t$subfilter=\"[<tag>] [all[current]tags[]]\"\n/>\n\\end\n\n<p>\n<$list filter=\"[is[current]tags[]] [list[$:/config/Manager/RecentTags]] +[sort[title]] \" variable=\"tag\">\n<div>\n<$checkbox tiddler=<<currentTiddler>> tag=<<tag>> actions=<<tag-checkbox-actions>>>\n<$macrocall $name=\"tag-pill\" tag=<<tag>>/>\n</$checkbox>\n</div>\n</$list>\n</p>\n<p>\n<$macrocall $name=\"tag-picker\" actions=<<tag-picker-actions>>/>\n</p>\n"
},
"$:/Manager/ItemSidebar/Tools": {
"title": "$:/Manager/ItemSidebar/Tools",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Tools}}",
"text": "<p>\n<$button to=<<currentTiddler>>>{{$:/core/images/link}} open</$button>\n</p>\n<p>\n<$button message=\"tm-edit-tiddler\" param=<<currentTiddler>>>{{$:/core/images/edit-button}} edit</$button>\n</p>\n"
},
"$:/Manager": {
"title": "$:/Manager",
"icon": "$:/core/images/list",
"color": "#bbb",
"text": "\\define lingo-base() $:/language/Manager/\n\n\\define list-item-content-item()\n<div class=\"tc-manager-list-item-content-item\">\n\t<$vars state-title=\"\"\"$:/state/popup/manager/item/$(listItem)$\"\"\">\n\t\t<$reveal state=<<state-title>> type=\"match\" text=\"show\" default=\"show\" tag=\"div\">\n\t\t\t<$button set=<<state-title>> setTo=\"hide\" class=\"tc-btn-invisible tc-manager-list-item-content-item-heading\">\n\t\t\t\t{{$:/core/images/down-arrow}} <$transclude tiddler=<<listItem>> field=\"caption\"/>\n\t\t\t</$button>\n\t\t</$reveal>\n\t\t<$reveal state=<<state-title>> type=\"nomatch\" text=\"show\" default=\"show\" tag=\"div\">\n\t\t\t<$button set=<<state-title>> setTo=\"show\" class=\"tc-btn-invisible tc-manager-list-item-content-item-heading\">\n\t\t\t\t{{$:/core/images/right-arrow}} <$transclude tiddler=<<listItem>> field=\"caption\"/>\n\t\t\t</$button>\n\t\t</$reveal>\n\t\t<$reveal state=<<state-title>> type=\"match\" text=\"show\" default=\"show\" tag=\"div\" class=\"tc-manager-list-item-content-item-body\">\n\t\t\t<$transclude tiddler=<<listItem>>/>\n\t\t</$reveal>\n\t</$vars>\n</div>\n\\end\n\n<div class=\"tc-manager-wrapper\">\n\t<div class=\"tc-manager-controls\">\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Show/Prompt>> <$select tiddler=\"$:/config/Manager/Show\" default=\"tiddlers\">\n\t\t\t\t<option value=\"tiddlers\"><<lingo Controls/Show/Option/Tiddlers>></option>\n\t\t\t\t<option value=\"tags\"><<lingo Controls/Show/Option/Tags>></option>\n\t\t\t</$select>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Search/Prompt>> <$edit-text tiddler=\"$:/config/Manager/Filter\" tag=\"input\" default=\"\" placeholder={{$:/language/Manager/Controls/Search/Placeholder}}/>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/FilterByTag/Prompt>> <$select tiddler=\"$:/config/Manager/Tag\" default=\"\">\n\t\t\t\t<option value=\"\"><<lingo Controls/FilterByTag/None>></option>\n\t\t\t\t<$list filter=\"[!is{$:/config/Manager/System}tags[]!is[system]sort[title]]\" variable=\"tag\">\n\t\t\t\t\t<option value=<<tag>>><$text text=<<tag>>/></option>\n\t\t\t\t</$list>\n\t\t\t</$select>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Sort/Prompt>> <$select tiddler=\"$:/config/Manager/Sort\" default=\"title\">\n\t\t\t\t<optgroup label=\"Common\">\n\t\t\t\t\t<$list filter=\"title modified modifier created creator created\" variable=\"field\">\n\t\t\t\t\t\t<option value=<<field>>><$text text=<<field>>/></option>\n\t\t\t\t\t</$list>\n\t\t\t\t</optgroup>\n\t\t\t\t<optgroup label=\"All\">\n\t\t\t\t\t<$list filter=\"[all{$:/config/Manager/Show}!is{$:/config/Manager/System}fields[]sort[title]] -title -modified -modifier -created -creator -created\" variable=\"field\">\n\t\t\t\t\t\t<option value=<<field>>><$text text=<<field>>/></option>\n\t\t\t\t\t</$list>\n\t\t\t\t</optgroup>\n\t\t\t</$select>\n\t\t\t<$checkbox tiddler=\"$:/config/Manager/Order\" field=\"text\" checked=\"reverse\" unchecked=\"forward\" default=\"forward\">\n\t\t\t\t<<lingo Controls/Order/Prompt>>\n\t\t\t</$checkbox>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<$checkbox tiddler=\"$:/config/Manager/System\" field=\"text\" checked=\"\" unchecked=\"system\" default=\"system\">\n\t\t\t\t{{$:/language/SystemTiddlers/Include/Prompt}}\n\t\t\t</$checkbox>\n\t\t</div>\n\t</div>\n\t<div class=\"tc-manager-list\">\n\t\t<$list filter=\"[all{$:/config/Manager/Show}!is{$:/config/Manager/System}search{$:/config/Manager/Filter}tag:strict{$:/config/Manager/Tag}sort{$:/config/Manager/Sort}order{$:/config/Manager/Order}]\">\n\t\t\t<$vars transclusion=<<currentTiddler>>>\n\t\t\t\t<div style=\"tc-manager-list-item\">\n\t\t\t\t\t<$button popup=<<qualify \"$:/state/manager/popup\">> class=\"tc-btn-invisible tc-manager-list-item-heading\" selectedClass=\"tc-manager-list-item-heading-selected\">\n\t\t\t\t\t\t<$text text=<<currentTiddler>>/>\n\t\t\t\t\t</$button>\n\t\t\t\t\t<$reveal state=<<qualify \"$:/state/manager/popup\">> type=\"nomatch\" text=\"\" default=\"\" tag=\"div\" class=\"tc-manager-list-item-content tc-popup-handle\">\n\t\t\t\t\t\t<div class=\"tc-manager-list-item-content-tiddler\">\n\t\t\t\t\t\t\t<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Manager/ItemMain]!has[draft.of]]\" variable=\"listItem\">\n\t\t\t\t\t\t\t\t<<list-item-content-item>>\n\t\t\t\t\t\t\t</$list>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"tc-manager-list-item-content-sidebar\">\n\t\t\t\t\t\t\t<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Manager/ItemSidebar]!has[draft.of]]\" variable=\"listItem\">\n\t\t\t\t\t\t\t\t<<list-item-content-item>>\n\t\t\t\t\t\t\t</$list>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</$reveal>\n\t\t\t\t</div>\n\t\t\t</$vars>\n\t\t</$list>\n\t</div>\n</div>\n"
},
"$:/core/ui/MissingTemplate": {
"title": "$:/core/ui/MissingTemplate",
"text": "<div class=\"tc-tiddler-missing\">\n<$button popup=<<qualify \"$:/state/popup/missing\">> class=\"tc-btn-invisible tc-missing-tiddler-label\">\n<$view field=\"title\" format=\"text\" />\n</$button>\n<$reveal state=<<qualify \"$:/state/popup/missing\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n<hr>\n<$list filter=\"[all[current]backlinks[]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div>\n</$reveal>\n</div>\n"
},
"$:/core/ui/MoreSideBar/All": {
"title": "$:/core/ui/MoreSideBar/All",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/All/Caption}}",
"text": "<$list filter={{$:/core/Filters/AllTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Drafts": {
"title": "$:/core/ui/MoreSideBar/Drafts",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Drafts/Caption}}",
"text": "<$list filter={{$:/core/Filters/Drafts!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Missing": {
"title": "$:/core/ui/MoreSideBar/Missing",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Missing/Caption}}",
"text": "<$list filter={{$:/core/Filters/Missing!!filter}} template=\"$:/core/ui/MissingTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Orphans": {
"title": "$:/core/ui/MoreSideBar/Orphans",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Orphans/Caption}}",
"text": "<$list filter={{$:/core/Filters/Orphans!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Plugins": {
"title": "$:/core/ui/MoreSideBar/Plugins",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/ControlPanel/Plugins/Caption}}",
"text": "\n{{$:/language/ControlPanel/Plugins/Installed/Hint}}\n\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/MoreSideBar/Plugins]!has[draft.of]]\" \"$:/core/ui/MoreSideBar/Plugins/Plugins\">>\n"
},
"$:/core/ui/MoreSideBar/Recent": {
"title": "$:/core/ui/MoreSideBar/Recent",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Recent/Caption}}",
"text": "<$macrocall $name=\"timeline\" format={{$:/language/RecentChanges/DateFormat}}/>\n"
},
"$:/core/ui/MoreSideBar/Shadows": {
"title": "$:/core/ui/MoreSideBar/Shadows",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Shadows/Caption}}",
"text": "<$list filter={{$:/core/Filters/ShadowTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/System": {
"title": "$:/core/ui/MoreSideBar/System",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/System/Caption}}",
"text": "<$list filter={{$:/core/Filters/SystemTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Tags": {
"title": "$:/core/ui/MoreSideBar/Tags",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Tags/Caption}}",
"text": "<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n{{$:/core/ui/Buttons/tag-manager}}\n\n</$set>\n\n</$set>\n\n</$set>\n\n<$list filter={{$:/core/Filters/AllTags!!filter}}>\n\n<$transclude tiddler=\"$:/core/ui/TagTemplate\"/>\n\n</$list>\n\n<hr class=\"tc-untagged-separator\">\n\n{{$:/core/ui/UntaggedTemplate}}\n"
},
"$:/core/ui/MoreSideBar/Types": {
"title": "$:/core/ui/MoreSideBar/Types",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Types/Caption}}",
"text": "<$list filter={{$:/core/Filters/TypedTiddlers!!filter}}>\n<div class=\"tc-menu-list-item\">\n<$view field=\"type\"/>\n<$list filter=\"[type{!!type}!is[system]sort[title]]\">\n<div class=\"tc-menu-list-subitem\">\n<$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>\n</$list>\n</div>\n</$list>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Languages": {
"title": "$:/core/ui/MoreSideBar/Plugins/Languages",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[language]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Plugins": {
"title": "$:/core/ui/MoreSideBar/Plugins/Plugins",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[plugin]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}>>/>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Theme": {
"title": "$:/core/ui/MoreSideBar/Plugins/Theme",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[theme]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>\n"
},
"$:/core/ui/Buttons/advanced-search": {
"title": "$:/core/ui/Buttons/advanced-search",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/advanced-search-button}} {{$:/language/Buttons/AdvancedSearch/Caption}}",
"description": "{{$:/language/Buttons/AdvancedSearch/Hint}}",
"text": "\\define control-panel-button(class)\n<$button to=\"$:/AdvancedSearch\" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/advanced-search-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/AdvancedSearch/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/AdvancedSearch]]\" emptyMessage=<<control-panel-button>>>\n<<control-panel-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/close-all": {
"title": "$:/core/ui/Buttons/close-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/close-all-button}} {{$:/language/Buttons/CloseAll/Caption}}",
"description": "{{$:/language/Buttons/CloseAll/Hint}}",
"text": "<$button message=\"tm-close-all-tiddlers\" tooltip={{$:/language/Buttons/CloseAll/Hint}} aria-label={{$:/language/Buttons/CloseAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/close-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/CloseAll/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/control-panel": {
"title": "$:/core/ui/Buttons/control-panel",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/options-button}} {{$:/language/Buttons/ControlPanel/Caption}}",
"description": "{{$:/language/Buttons/ControlPanel/Hint}}",
"text": "\\define control-panel-button(class)\n<$button to=\"$:/ControlPanel\" tooltip={{$:/language/Buttons/ControlPanel/Hint}} aria-label={{$:/language/Buttons/ControlPanel/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/options-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/ControlPanel/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/ControlPanel]]\" emptyMessage=<<control-panel-button>>>\n<<control-panel-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/encryption": {
"title": "$:/core/ui/Buttons/encryption",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/locked-padlock}} {{$:/language/Buttons/Encryption/Caption}}",
"description": "{{$:/language/Buttons/Encryption/Hint}}",
"text": "<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\n<$button message=\"tm-clear-password\" tooltip={{$:/language/Buttons/Encryption/ClearPassword/Hint}} aria-label={{$:/language/Buttons/Encryption/ClearPassword/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/locked-padlock}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Encryption/ClearPassword/Caption}}/></span>\n</$list>\n</$button>\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n<$button message=\"tm-set-password\" tooltip={{$:/language/Buttons/Encryption/SetPassword/Hint}} aria-label={{$:/language/Buttons/Encryption/SetPassword/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/unlocked-padlock}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Encryption/SetPassword/Caption}}/></span>\n</$list>\n</$button>\n</$reveal>"
},
"$:/core/ui/Buttons/export-page": {
"title": "$:/core/ui/Buttons/export-page",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/export-button}} {{$:/language/Buttons/ExportPage/Caption}}",
"description": "{{$:/language/Buttons/ExportPage/Hint}}",
"text": "<$macrocall $name=\"exportButton\" exportFilter=\"[!is[system]sort[title]]\" lingoBase=\"$:/language/Buttons/ExportPage/\"/>"
},
"$:/core/ui/Buttons/fold-all": {
"title": "$:/core/ui/Buttons/fold-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/fold-all-button}} {{$:/language/Buttons/FoldAll/Caption}}",
"description": "{{$:/language/Buttons/FoldAll/Hint}}",
"text": "<$button tooltip={{$:/language/Buttons/FoldAll/Hint}} aria-label={{$:/language/Buttons/FoldAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-all-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/FoldAll/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/full-screen": {
"title": "$:/core/ui/Buttons/full-screen",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/full-screen-button}} {{$:/language/Buttons/FullScreen/Caption}}",
"description": "{{$:/language/Buttons/FullScreen/Hint}}",
"text": "<$button message=\"tm-full-screen\" tooltip={{$:/language/Buttons/FullScreen/Hint}} aria-label={{$:/language/Buttons/FullScreen/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/full-screen-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/FullScreen/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/home": {
"title": "$:/core/ui/Buttons/home",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/home-button}} {{$:/language/Buttons/Home/Caption}}",
"description": "{{$:/language/Buttons/Home/Hint}}",
"text": "<$button message=\"tm-home\" tooltip={{$:/language/Buttons/Home/Hint}} aria-label={{$:/language/Buttons/Home/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/home-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Home/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/import": {
"title": "$:/core/ui/Buttons/import",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/import-button}} {{$:/language/Buttons/Import/Caption}}",
"description": "{{$:/language/Buttons/Import/Hint}}",
"text": "<div class=\"tc-file-input-wrapper\">\n<$button tooltip={{$:/language/Buttons/Import/Hint}} aria-label={{$:/language/Buttons/Import/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/import-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Import/Caption}}/></span>\n</$list>\n</$button>\n<$browse tooltip={{$:/language/Buttons/Import/Hint}}/>\n</div>"
},
"$:/core/ui/Buttons/language": {
"title": "$:/core/ui/Buttons/language",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/globe}} {{$:/language/Buttons/Language/Caption}}",
"description": "{{$:/language/Buttons/Language/Hint}}",
"text": "\\define flag-title()\n$(languagePluginTitle)$/icon\n\\end\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/language\">> tooltip={{$:/language/Buttons/Language/Hint}} aria-label={{$:/language/Buttons/Language/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n<span class=\"tc-image-button\">\n<$set name=\"languagePluginTitle\" value={{$:/language}}>\n<$image source=<<flag-title>>/>\n</$set>\n</span>\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Language/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/language\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down tc-drop-down-language-chooser\">\n<$linkcatcher to=\"$:/language\">\n<$list filter=\"[[$:/languages/en-GB]] [plugin-type[language]sort[description]]\">\n<$link>\n<span class=\"tc-drop-down-bullet\">\n<$reveal type=\"match\" state=\"$:/language\" text=<<currentTiddler>>>\n•\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/language\" text=<<currentTiddler>>>\n \n</$reveal>\n</span>\n<span class=\"tc-image-button\">\n<$set name=\"languagePluginTitle\" value=<<currentTiddler>>>\n<$transclude subtiddler=<<flag-title>>>\n<$list filter=\"[all[current]field:title[$:/languages/en-GB]]\">\n<$transclude tiddler=\"$:/languages/en-GB/icon\"/>\n</$list>\n</$transclude>\n</$set>\n</span>\n<$view field=\"description\">\n<$view field=\"name\">\n<$view field=\"title\"/>\n</$view>\n</$view>\n</$link>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>"
},
"$:/core/ui/Buttons/manager": {
"title": "$:/core/ui/Buttons/manager",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/list}} {{$:/language/Buttons/Manager/Caption}}",
"description": "{{$:/language/Buttons/Manager/Hint}}",
"text": "\\define manager-button(class)\n<$button to=\"$:/Manager\" tooltip={{$:/language/Buttons/Manager/Hint}} aria-label={{$:/language/Buttons/Manager/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/list}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Manager/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/Manager]]\" emptyMessage=<<manager-button>>>\n<<manager-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/more-page-actions": {
"title": "$:/core/ui/Buttons/more-page-actions",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"text": "\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n<$button popup=<<qualify \"$:/state/popup/more\">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/down-arrow}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/More/Caption}}/></span>\n</$list>\n</$button><$reveal state=<<qualify \"$:/state/popup/more\">> type=\"popup\" position=\"below\" animate=\"yes\">\n\n<div class=\"tc-drop-down\">\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"tc-btn-invisible\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]] -[[$:/core/ui/Buttons/more-page-actions]]\" variable=\"listItem\">\n\n<$reveal type=\"match\" state=<<config-title>> text=\"hide\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$reveal>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</div>\n\n</$reveal>"
},
"$:/core/ui/Buttons/new-image": {
"title": "$:/core/ui/Buttons/new-image",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-image-button}} {{$:/language/Buttons/NewImage/Caption}}",
"description": "{{$:/language/Buttons/NewImage/Hint}}",
"text": "<$button tooltip={{$:/language/Buttons/NewImage/Hint}} aria-label={{$:/language/Buttons/NewImage/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-new-tiddler\" type=\"image/jpeg\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/new-image-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewImage/Caption}}/></span>\n</$list>\n</$button>\n"
},
"$:/core/ui/Buttons/new-journal": {
"title": "$:/core/ui/Buttons/new-journal",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-journal-button}} {{$:/language/Buttons/NewJournal/Caption}}",
"description": "{{$:/language/Buttons/NewJournal/Hint}}",
"text": "\\define journalButton()\n<$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-new-tiddler\" title=<<now \"$(journalTitleTemplate)$\">> tags=\"$(journalTags)$\" text=\"$(journalText)$\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/new-journal-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewJournal/Caption}}/></span>\n</$list>\n</$button>\n\\end\n<$set name=\"journalTitleTemplate\" value={{$:/config/NewJournal/Title}}>\n<$set name=\"journalTags\" value={{$:/config/NewJournal/Tags}}>\n<$set name=\"journalText\" value={{$:/config/NewJournal/Text}}>\n<<journalButton>>\n</$set></$set></$set>"
},
"$:/core/ui/Buttons/new-tiddler": {
"title": "$:/core/ui/Buttons/new-tiddler",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-button}} {{$:/language/Buttons/NewTiddler/Caption}}",
"description": "{{$:/language/Buttons/NewTiddler/Hint}}",
"text": "<$button message=\"tm-new-tiddler\" tooltip={{$:/language/Buttons/NewTiddler/Hint}} aria-label={{$:/language/Buttons/NewTiddler/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/new-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewTiddler/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/palette": {
"title": "$:/core/ui/Buttons/palette",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/palette}} {{$:/language/Buttons/Palette/Caption}}",
"description": "{{$:/language/Buttons/Palette/Hint}}",
"text": "<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/palette\">> tooltip={{$:/language/Buttons/Palette/Hint}} aria-label={{$:/language/Buttons/Palette/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/palette}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Palette/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/palette\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\" style=\"font-size:0.7em;\">\n{{$:/snippets/paletteswitcher}}\n</div>\n</$reveal>"
},
"$:/core/ui/Buttons/print": {
"title": "$:/core/ui/Buttons/print",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/print-button}} {{$:/language/Buttons/Print/Caption}}",
"description": "{{$:/language/Buttons/Print/Hint}}",
"text": "<$button message=\"tm-print\" tooltip={{$:/language/Buttons/Print/Hint}} aria-label={{$:/language/Buttons/Print/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/print-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Print/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/refresh": {
"title": "$:/core/ui/Buttons/refresh",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/refresh-button}} {{$:/language/Buttons/Refresh/Caption}}",
"description": "{{$:/language/Buttons/Refresh/Hint}}",
"text": "<$button message=\"tm-browser-refresh\" tooltip={{$:/language/Buttons/Refresh/Hint}} aria-label={{$:/language/Buttons/Refresh/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/refresh-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Refresh/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/save-wiki": {
"title": "$:/core/ui/Buttons/save-wiki",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/save-button}} {{$:/language/Buttons/SaveWiki/Caption}}",
"description": "{{$:/language/Buttons/SaveWiki/Hint}}",
"text": "<$button message=\"tm-save-wiki\" param={{$:/config/SaveWikiButton/Template}} tooltip={{$:/language/Buttons/SaveWiki/Hint}} aria-label={{$:/language/Buttons/SaveWiki/Caption}} class=<<tv-config-toolbar-class>>>\n<span class=\"tc-dirty-indicator\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/save-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/SaveWiki/Caption}}/></span>\n</$list>\n</span>\n</$button>"
},
"$:/core/ui/Buttons/storyview": {
"title": "$:/core/ui/Buttons/storyview",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/storyview-classic}} {{$:/language/Buttons/StoryView/Caption}}",
"description": "{{$:/language/Buttons/StoryView/Hint}}",
"text": "\\define icon()\n$:/core/images/storyview-$(storyview)$\n\\end\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/storyview\">> tooltip={{$:/language/Buttons/StoryView/Hint}} aria-label={{$:/language/Buttons/StoryView/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n<$set name=\"storyview\" value={{$:/view}}>\n<$transclude tiddler=<<icon>>/>\n</$set>\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/StoryView/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/storyview\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$linkcatcher to=\"$:/view\">\n<$list filter=\"[storyviews[]]\" variable=\"storyview\">\n<$link to=<<storyview>>>\n<span class=\"tc-drop-down-bullet\">\n<$reveal type=\"match\" state=\"$:/view\" text=<<storyview>>>\n•\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/view\" text=<<storyview>>>\n \n</$reveal>\n</span>\n<$transclude tiddler=<<icon>>/>\n<$text text=<<storyview>>/></$link>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>"
},
"$:/core/ui/Buttons/tag-manager": {
"title": "$:/core/ui/Buttons/tag-manager",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/tag-button}} {{$:/language/Buttons/TagManager/Caption}}",
"description": "{{$:/language/Buttons/TagManager/Hint}}",
"text": "\\define control-panel-button(class)\n<$button to=\"$:/TagManager\" tooltip={{$:/language/Buttons/TagManager/Hint}} aria-label={{$:/language/Buttons/TagManager/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/tag-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/TagManager/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/TagManager]]\" emptyMessage=<<control-panel-button>>>\n<<control-panel-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/theme": {
"title": "$:/core/ui/Buttons/theme",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/theme-button}} {{$:/language/Buttons/Theme/Caption}}",
"description": "{{$:/language/Buttons/Theme/Hint}}",
"text": "<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/theme\">> tooltip={{$:/language/Buttons/Theme/Hint}} aria-label={{$:/language/Buttons/Theme/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/theme-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Theme/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/theme\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$linkcatcher to=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\" variable=\"themeTitle\">\n<$link to=<<themeTitle>>>\n<span class=\"tc-drop-down-bullet\">\n<$reveal type=\"match\" state=\"$:/theme\" text=<<themeTitle>>>\n•\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/theme\" text=<<themeTitle>>>\n \n</$reveal>\n</span>\n<$view tiddler=<<themeTitle>> field=\"name\"/>\n</$link>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>"
},
"$:/core/ui/Buttons/timestamp": {
"title": "$:/core/ui/Buttons/timestamp",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/timestamp-on}} {{$:/language/Buttons/Timestamp/Caption}}",
"description": "{{$:/language/Buttons/Timestamp/Hint}}",
"text": "<$reveal type=\"nomatch\" state=\"$:/config/TimestampDisable\" text=\"yes\">\n<$button tooltip={{$:/language/Buttons/Timestamp/On/Hint}} aria-label={{$:/language/Buttons/Timestamp/On/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-setfield $tiddler=\"$:/config/TimestampDisable\" $value=\"yes\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/timestamp-on}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Timestamp/On/Caption}}/></span>\n</$list>\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/config/TimestampDisable\" text=\"yes\">\n<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-setfield $tiddler=\"$:/config/TimestampDisable\" $value=\"no\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/timestamp-off}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/></span>\n</$list>\n</$button>\n</$reveal>"
},
"$:/core/ui/Buttons/unfold-all": {
"title": "$:/core/ui/Buttons/unfold-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/unfold-all-button}} {{$:/language/Buttons/UnfoldAll/Caption}}",
"description": "{{$:/language/Buttons/UnfoldAll/Hint}}",
"text": "<$button tooltip={{$:/language/Buttons/UnfoldAll/Hint}} aria-label={{$:/language/Buttons/UnfoldAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-unfold-all-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\" variable=\"listItem\">\n{{$:/core/images/unfold-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/UnfoldAll/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/PageTemplate/pagecontrols": {
"title": "$:/core/ui/PageTemplate/pagecontrols",
"text": "\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-page-controls\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]\" variable=\"listItem\">\n<$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\">\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n</$reveal>\n</$list>\n</div>\n\n"
},
"$:/core/ui/PageStylesheet": {
"title": "$:/core/ui/PageStylesheet",
"text": "<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n\n<$set name=\"currentTiddler\" value={{$:/language}}>\n\n<$set name=\"languageTitle\" value={{!!name}}>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]\">\n<$transclude mode=\"block\"/>\n</$list>\n\n</$set>\n\n</$set>\n\n</$importvariables>\n"
},
"$:/core/ui/PageTemplate/alerts": {
"title": "$:/core/ui/PageTemplate/alerts",
"tags": "$:/tags/PageTemplate",
"text": "<div class=\"tc-alerts\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Alert]!has[draft.of]]\" template=\"$:/core/ui/AlertTemplate\" storyview=\"pop\"/>\n\n</div>\n"
},
"$:/core/ui/PageTemplate/pluginreloadwarning": {
"title": "$:/core/ui/PageTemplate/pluginreloadwarning",
"tags": "$:/tags/PageTemplate",
"text": "\\define lingo-base() $:/language/\n\n<$list filter=\"[has[plugin-type]haschanged[]!plugin-type[import]limit[1]]\">\n\n<$reveal type=\"nomatch\" state=\"$:/temp/HidePluginWarning\" text=\"yes\">\n\n<div class=\"tc-plugin-reload-warning\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<<lingo PluginReloadWarning>> <$button set=\"$:/temp/HidePluginWarning\" setTo=\"yes\" class=\"tc-btn-invisible\">{{$:/core/images/close-button}}</$button>\n\n</$set>\n\n</div>\n\n</$reveal>\n\n</$list>\n"
},
"$:/core/ui/PageTemplate/sidebar": {
"title": "$:/core/ui/PageTemplate/sidebar",
"tags": "$:/tags/PageTemplate",
"text": "<$scrollable fallthrough=\"no\" class=\"tc-sidebar-scrollable\">\n\n<div class=\"tc-sidebar-header\">\n\n<$reveal state=\"$:/state/sidebar\" type=\"match\" text=\"yes\" default=\"yes\" retain=\"yes\" animate=\"yes\">\n\n<h1 class=\"tc-site-title\">\n\n<$transclude tiddler=\"$:/SiteTitle\" mode=\"inline\"/>\n\n</h1>\n\n<div class=\"tc-site-subtitle\">\n\n<$transclude tiddler=\"$:/SiteSubtitle\" mode=\"inline\"/>\n\n</div>\n\n{{||$:/core/ui/PageTemplate/pagecontrols}}\n\n<$transclude tiddler=\"$:/core/ui/SideBarLists\" mode=\"inline\"/>\n\n</$reveal>\n\n</div>\n\n</$scrollable>"
},
"$:/core/ui/PageTemplate/story": {
"title": "$:/core/ui/PageTemplate/story",
"tags": "$:/tags/PageTemplate",
"text": "<section class=\"tc-story-river\">\n\n<section class=\"story-backdrop\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/AboveStory]!has[draft.of]]\">\n\n<$transclude/>\n\n</$list>\n\n</section>\n\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" template=\"$:/core/ui/ViewTemplate\" editTemplate=\"$:/core/ui/EditTemplate\" storyview={{$:/view}} emptyMessage={{$:/config/EmptyStoryMessage}}/>\n\n<section class=\"story-frontdrop\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/BelowStory]!has[draft.of]]\">\n\n<$transclude/>\n\n</$list>\n\n</section>\n\n</section>\n"
},
"$:/core/ui/PageTemplate/topleftbar": {
"title": "$:/core/ui/PageTemplate/topleftbar",
"tags": "$:/tags/PageTemplate",
"text": "<span class=\"tc-topbar tc-topbar-left\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TopLeftBar]!has[draft.of]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$list>\n\n</span>\n"
},
"$:/core/ui/PageTemplate/toprightbar": {
"title": "$:/core/ui/PageTemplate/toprightbar",
"tags": "$:/tags/PageTemplate",
"text": "<span class=\"tc-topbar tc-topbar-right\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TopRightBar]!has[draft.of]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$list>\n\n</span>\n"
},
"$:/core/ui/PageTemplate": {
"title": "$:/core/ui/PageTemplate",
"text": "\\define containerClasses()\ntc-page-container tc-page-view-$(themeTitle)$ tc-language-$(languageTitle)$\n\\end\n\n<$importvariables filter=\"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\">\n\n<$set name=\"tv-config-toolbar-icons\" value={{$:/config/Toolbar/Icons}}>\n\n<$set name=\"tv-config-toolbar-text\" value={{$:/config/Toolbar/Text}}>\n\n<$set name=\"tv-config-toolbar-class\" value={{$:/config/Toolbar/ButtonClass}}>\n\n<$set name=\"themeTitle\" value={{$:/view}}>\n\n<$set name=\"currentTiddler\" value={{$:/language}}>\n\n<$set name=\"languageTitle\" value={{!!name}}>\n\n<$set name=\"currentTiddler\" value=\"\">\n\n<div class=<<containerClasses>>>\n\n<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\n\n<$dropzone>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageTemplate]!has[draft.of]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>>/>\n\n</$list>\n\n</$dropzone>\n\n</$navigator>\n\n</div>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</$importvariables>\n"
},
"$:/core/ui/PluginInfo": {
"title": "$:/core/ui/PluginInfo",
"text": "\\define localised-info-tiddler-title()\n$(currentTiddler)$/$(languageTitle)$/$(currentTab)$\n\\end\n\\define info-tiddler-title()\n$(currentTiddler)$/$(currentTab)$\n\\end\n\\define default-tiddler-title()\n$:/core/ui/PluginInfo/Default/$(currentTab)$\n\\end\n<$transclude tiddler=<<localised-info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<localised-info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<default-tiddler-title>> mode=\"block\">\n{{$:/language/ControlPanel/Plugin/NoInfoFound/Hint}}\n</$transclude>\n</$transclude>\n</$transclude>\n</$transclude>\n"
},
"$:/core/ui/PluginInfo/Default/contents": {
"title": "$:/core/ui/PluginInfo/Default/contents",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/\n<<lingo Hint>>\n<ul>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" emptyMessage=<<lingo Empty/Hint>>>\n<li>\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</li>\n</$list>\n</ul>\n"
},
"$:/core/ui/PluginListItemTemplate": {
"title": "$:/core/ui/PluginListItemTemplate",
"text": "<div class=\"tc-menu-list-item\">\n<$link to={{!!title}}>\n<$view field=\"description\">\n<$view field=\"title\"/>\n</$view>\n</$link>\n</div>"
},
"$:/core/ui/SearchResults": {
"title": "$:/core/ui/SearchResults",
"text": "<div class=\"tc-search-results\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]\" emptyMessage=\"\"\"\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\">\n<$transclude mode=\"block\"/>\n</$list>\n\"\"\">\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\" default={{$:/config/SearchResults/Default}}/>\n\n</$list>\n\n</div>\n"
},
"$:/core/ui/SideBar/More": {
"title": "$:/core/ui/SideBar/More",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/More/Caption}}",
"text": "<div class=\"tc-more-sidebar\">\n<<tabs \"[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]\" \"$:/core/ui/MoreSideBar/Tags\" \"$:/state/tab/moresidebar\" \"tc-vertical\">>\n</div>\n"
},
"$:/core/ui/SideBar/Open": {
"title": "$:/core/ui/SideBar/Open",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Open/Caption}}",
"text": "\\define lingo-base() $:/language/CloseAll/\n\n\\define drop-actions()\n<$action-listops $tiddler=\"$:/StoryList\" $subfilter=\"+[insertbefore:currentTiddler<actionTiddler>]\"/>\n\\end\n\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" storyview=\"pop\">\n<div style=\"position: relative;\">\n<$droppable actions=<<drop-actions>>>\n<div class=\"tc-droppable-placeholder\">\n \n</div>\n<div>\n<$button message=\"tm-close-tiddler\" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class=\"tc-btn-invisible tc-btn-mini\">×</$button> <$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>\n</$droppable>\n</div>\n</$list>\n<$tiddler tiddler=\"\">\n<$droppable actions=<<drop-actions>>>\n<div class=\"tc-droppable-placeholder\">\n \n</div>\n<$button message=\"tm-close-all-tiddlers\" class=\"tc-btn-invisible tc-btn-mini\"><<lingo Button>></$button>\n</$droppable>\n</$tiddler>\n"
},
"$:/core/ui/SideBar/Recent": {
"title": "$:/core/ui/SideBar/Recent",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Recent/Caption}}",
"text": "<$macrocall $name=\"timeline\" format={{$:/language/RecentChanges/DateFormat}}/>\n"
},
"$:/core/ui/SideBar/Tools": {
"title": "$:/core/ui/SideBar/Tools",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Tools/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n\n<<lingo Basics/Version/Prompt>> <<version>>\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]\" variable=\"listItem\">\n\n<div style=\"position:relative;\">\n\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <$transclude tiddler=<<listItem>>/> <i class=\"tc-muted\"><$transclude tiddler=<<listItem>> field=\"description\"/></i>\n\n</div>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/SideBarLists": {
"title": "$:/core/ui/SideBarLists",
"text": "<div class=\"tc-sidebar-lists\">\n\n<$set name=\"searchTiddler\" value=\"$:/temp/search\">\n<div class=\"tc-search\">\n<$edit-text tiddler=\"$:/temp/search\" type=\"search\" tag=\"input\" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify \"$:/state/popup/search-dropdown\">> class=\"tc-popup-handle\"/>\n<$reveal state=\"$:/temp/search\" type=\"nomatch\" text=\"\">\n<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" text={{$:/temp/search}}/>\n<$action-setfield $tiddler=\"$:/temp/search\" text=\"\"/>\n<$action-navigate $to=\"$:/AdvancedSearch\"/>\n{{$:/core/images/advanced-search-button}}\n</$button>\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/search\" text=\"\" />\n{{$:/core/images/close-button}}\n</$button>\n<$button popup=<<qualify \"$:/state/popup/search-dropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n<$list filter=\"[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]\" variable=\"listItem\">\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[!is[system]search{$(searchTiddler)$}]\"/>\"\"\">\n{{$:/language/Search/Matches}}\n</$set>\n</$list>\n</$button>\n</$reveal>\n<$reveal state=\"$:/temp/search\" type=\"match\" text=\"\">\n<$button to=\"$:/AdvancedSearch\" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"tc-btn-invisible\">\n{{$:/core/images/advanced-search-button}}\n</$button>\n</$reveal>\n</div>\n\n<$reveal tag=\"div\" class=\"tc-block-dropdown-wrapper\" state=\"$:/temp/search\" type=\"nomatch\" text=\"\">\n\n<$reveal tag=\"div\" class=\"tc-block-dropdown tc-search-drop-down tc-popup-handle\" state=<<qualify \"$:/state/popup/search-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n\n<$list filter=\"[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n{{$:/core/ui/SearchResults}}\n\n</$list>\n\n</$reveal>\n\n</$reveal>\n\n</$set>\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\" default={{$:/config/DefaultSidebarTab}} state=\"$:/state/tab/sidebar\" />\n\n</div>\n"
},
"$:/TagManager": {
"title": "$:/TagManager",
"icon": "$:/core/images/tag-button",
"color": "#bbb",
"caption": "{{$:/language/TagManager/Caption}}",
"text": "\\define lingo-base() $:/language/TagManager/\n\\define iconEditorTab(type)\n<$list filter=\"[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[sort[title]] +[$type$is[system]]\">\n<$link to={{!!title}}>\n<$transclude/> <$view field=\"title\"/>\n</$link>\n</$list>\n\\end\n\\define iconEditor(title)\n<div class=\"tc-drop-down-wrapper\">\n<$button popup=<<qualify \"$:/state/popup/icon/$title$\">> class=\"tc-btn-invisible tc-btn-dropdown\">{{$:/core/images/down-arrow}}</$button>\n<$reveal state=<<qualify \"$:/state/popup/icon/$title$\">> type=\"popup\" position=\"belowleft\" text=\"\" default=\"\">\n<div class=\"tc-drop-down\">\n<$linkcatcher to=\"$title$!!icon\">\n<<iconEditorTab type:\"!\">>\n<hr/>\n<<iconEditorTab type:\"\">>\n</$linkcatcher>\n</div>\n</$reveal>\n</div>\n\\end\n\\define qualifyTitle(title)\n$title$$(currentTiddler)$\n\\end\n\\define toggleButton(state)\n<$reveal state=\"$state$\" type=\"match\" text=\"closed\" default=\"closed\">\n<$button set=\"$state$\" setTo=\"open\" class=\"tc-btn-invisible tc-btn-dropdown\" selectedClass=\"tc-selected\">\n{{$:/core/images/info-button}}\n</$button>\n</$reveal>\n<$reveal state=\"$state$\" type=\"match\" text=\"open\" default=\"closed\">\n<$button set=\"$state$\" setTo=\"closed\" class=\"tc-btn-invisible tc-btn-dropdown\" selectedClass=\"tc-selected\">\n{{$:/core/images/info-button}}\n</$button>\n</$reveal>\n\\end\n<table class=\"tc-tag-manager-table\">\n<tbody>\n<tr>\n<th><<lingo Colour/Heading>></th>\n<th class=\"tc-tag-manager-tag\"><<lingo Tag/Heading>></th>\n<th><<lingo Count/Heading>></th>\n<th><<lingo Icon/Heading>></th>\n<th><<lingo Info/Heading>></th>\n</tr>\n<$list filter=\"[tags[]!is[system]sort[title]]\">\n<tr>\n<td><$edit-text field=\"color\" tag=\"input\" type=\"color\"/></td>\n<td><$macrocall $name=\"tag\" tag=<<currentTiddler>>/></td>\n<td><$count filter=\"[all[current]tagging[]]\"/></td>\n<td>\n<$macrocall $name=\"iconEditor\" title={{!!title}}/>\n</td>\n<td>\n<$macrocall $name=\"toggleButton\" state=<<qualifyTitle \"$:/state/tag-manager/\">> /> \n</td>\n</tr>\n<tr>\n<td></td>\n<td colspan=\"4\">\n<$reveal state=<<qualifyTitle \"$:/state/tag-manager/\">> type=\"match\" text=\"open\" default=\"\">\n<table>\n<tbody>\n<tr><td><<lingo Colour/Heading>></td><td><$edit-text field=\"color\" tag=\"input\" type=\"text\" size=\"9\"/></td></tr>\n<tr><td><<lingo Icon/Heading>></td><td><$edit-text field=\"icon\" tag=\"input\" size=\"45\"/></td></tr>\n</tbody>\n</table>\n</$reveal>\n</td>\n</tr>\n</$list>\n<tr>\n<td></td>\n<td>\n{{$:/core/ui/UntaggedTemplate}}\n</td>\n<td>\n<small class=\"tc-menu-list-count\"><$count filter=\"[untagged[]!is[system]] -[tags[]]\"/></small>\n</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n"
},
"$:/core/ui/TagTemplate": {
"title": "$:/core/ui/TagTemplate",
"text": "<span class=\"tc-tag-list-item\">\n<$set name=\"transclusion\" value=<<currentTiddler>>>\n<$macrocall $name=\"tag-pill-body\" tag=<<currentTiddler>> icon={{!!icon}} colour={{!!color}} palette={{$:/palette}} element-tag=\"\"\"$button\"\"\" element-attributes=\"\"\"popup=<<qualify \"$:/state/popup/tag\">> dragFilter='[all[current]tagging[]]' tag='span'\"\"\"/>\n<$reveal state=<<qualify \"$:/state/popup/tag\">> type=\"popup\" position=\"below\" animate=\"yes\" class=\"tc-drop-down\">\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]\" variable=\"listItem\"> \n<$transclude tiddler=<<listItem>>/> \n</$list>\n<hr>\n<$macrocall $name=\"list-tagged-draggable\" tag=<<currentTiddler>>/>\n</$reveal>\n</$set>\n</span>\n"
},
"$:/core/ui/TiddlerFieldTemplate": {
"title": "$:/core/ui/TiddlerFieldTemplate",
"text": "<tr class=\"tc-view-field\">\n<td class=\"tc-view-field-name\">\n<$text text=<<listItem>>/>\n</td>\n<td class=\"tc-view-field-value\">\n<$view field=<<listItem>>/>\n</td>\n</tr>"
},
"$:/core/ui/TiddlerFields": {
"title": "$:/core/ui/TiddlerFields",
"text": "<table class=\"tc-view-field-table\">\n<tbody>\n<$list filter=\"[all[current]fields[]sort[title]] -text\" template=\"$:/core/ui/TiddlerFieldTemplate\" variable=\"listItem\"/>\n</tbody>\n</table>\n"
},
"$:/core/ui/TiddlerInfo/Advanced/PluginInfo": {
"title": "$:/core/ui/TiddlerInfo/Advanced/PluginInfo",
"tags": "$:/tags/TiddlerInfo/Advanced",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/\n<$list filter=\"[all[current]has[plugin-type]]\">\n\n! <<lingo Heading>>\n\n<<lingo Hint>>\n<ul>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" emptyMessage=<<lingo Empty/Hint>>>\n<li>\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</li>\n</$list>\n</ul>\n\n</$list>\n"
},
"$:/core/ui/TiddlerInfo/Advanced/ShadowInfo": {
"title": "$:/core/ui/TiddlerInfo/Advanced/ShadowInfo",
"tags": "$:/tags/TiddlerInfo/Advanced",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/ShadowInfo/\n<$set name=\"infoTiddler\" value=<<currentTiddler>>>\n\n''<<lingo Heading>>''\n\n<$list filter=\"[all[current]!is[shadow]]\">\n\n<<lingo NotShadow/Hint>>\n\n</$list>\n\n<$list filter=\"[all[current]is[shadow]]\">\n\n<<lingo Shadow/Hint>>\n\n<$list filter=\"[all[current]shadowsource[]]\">\n\n<$set name=\"pluginTiddler\" value=<<currentTiddler>>>\n<<lingo Shadow/Source>>\n</$set>\n\n</$list>\n\n<$list filter=\"[all[current]is[shadow]is[tiddler]]\">\n\n<<lingo OverriddenShadow/Hint>>\n\n</$list>\n\n\n</$list>\n</$set>\n"
},
"$:/core/ui/TiddlerInfo/Advanced": {
"title": "$:/core/ui/TiddlerInfo/Advanced",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Advanced/Caption}}",
"text": "<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo/Advanced]!has[draft.of]]\" variable=\"listItem\">\n<$transclude tiddler=<<listItem>>/>\n\n</$list>\n"
},
"$:/core/ui/TiddlerInfo/Fields": {
"title": "$:/core/ui/TiddlerInfo/Fields",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Fields/Caption}}",
"text": "<$transclude tiddler=\"$:/core/ui/TiddlerFields\"/>\n"
},
"$:/core/ui/TiddlerInfo/List": {
"title": "$:/core/ui/TiddlerInfo/List",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/List/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[list{!!title}]\" emptyMessage=<<lingo List/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/Listed": {
"title": "$:/core/ui/TiddlerInfo/Listed",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Listed/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]listed[]!is[system]]\" emptyMessage=<<lingo Listed/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/References": {
"title": "$:/core/ui/TiddlerInfo/References",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/References/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]backlinks[]sort[title]]\" emptyMessage=<<lingo References/Empty>> template=\"$:/core/ui/ListItemTemplate\">\n</$list>\n"
},
"$:/core/ui/TiddlerInfo/Tagging": {
"title": "$:/core/ui/TiddlerInfo/Tagging",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Tagging/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]tagging[]]\" emptyMessage=<<lingo Tagging/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/Tools": {
"title": "$:/core/ui/TiddlerInfo/Tools",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Tools/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]\" variable=\"listItem\">\n\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <$transclude tiddler=<<listItem>>/> <i class=\"tc-muted\"><$transclude tiddler=<<listItem>> field=\"description\"/></i>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/TiddlerInfo": {
"title": "$:/core/ui/TiddlerInfo",
"text": "<div style=\"position:relative;\">\n<div class=\"tc-tiddler-controls\" style=\"position:absolute;right:0;\">\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"sticky\">\n<$button set=<<tiddlerInfoState>> setTo=\"\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=\"tc-btn-invisible\">\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n</div>\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]\" default={{$:/config/TiddlerInfo/Default}}/>"
},
"$:/core/ui/TopBar/menu": {
"title": "$:/core/ui/TopBar/menu",
"tags": "$:/tags/TopRightBar",
"text": "<$reveal state=\"$:/state/sidebar\" type=\"nomatch\" text=\"no\">\n<$button set=\"$:/state/sidebar\" setTo=\"no\" tooltip={{$:/language/Buttons/HideSideBar/Hint}} aria-label={{$:/language/Buttons/HideSideBar/Caption}} class=\"tc-btn-invisible\">{{$:/core/images/chevron-right}}</$button>\n</$reveal>\n<$reveal state=\"$:/state/sidebar\" type=\"match\" text=\"no\">\n<$button set=\"$:/state/sidebar\" setTo=\"yes\" tooltip={{$:/language/Buttons/ShowSideBar/Hint}} aria-label={{$:/language/Buttons/ShowSideBar/Caption}} class=\"tc-btn-invisible\">{{$:/core/images/chevron-left}}</$button>\n</$reveal>\n"
},
"$:/core/ui/UntaggedTemplate": {
"title": "$:/core/ui/UntaggedTemplate",
"text": "\\define lingo-base() $:/language/SideBar/\n<$button popup=<<qualify \"$:/state/popup/tag\">> class=\"tc-btn-invisible tc-untagged-label tc-tag-label\">\n<<lingo Tags/Untagged/Caption>>\n</$button>\n<$reveal state=<<qualify \"$:/state/popup/tag\">> type=\"popup\" position=\"below\">\n<div class=\"tc-drop-down\">\n<$list filter=\"[untagged[]!is[system]] -[tags[]] +[sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/body": {
"title": "$:/core/ui/ViewTemplate/body",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal tag=\"div\" class=\"tc-tiddler-body\" type=\"nomatch\" state=<<folded-state>> text=\"hide\" retain=\"yes\" animate=\"yes\">\n\n<$list filter=\"[all[current]!has[plugin-type]!field:hide-body[yes]]\">\n\n<$transclude>\n\n<$transclude tiddler=\"$:/language/MissingTiddler/Hint\"/>\n\n</$transclude>\n\n</$list>\n\n</$reveal>"
},
"$:/core/ui/ViewTemplate/classic": {
"title": "$:/core/ui/ViewTemplate/classic",
"tags": "$:/tags/ViewTemplate $:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/ClassicWarning/\n<$list filter=\"[all[current]type[text/x-tiddlywiki]]\">\n<div class=\"tc-message-box\">\n\n<<lingo Hint>>\n\n<$button set=\"!!type\" setTo=\"text/vnd.tiddlywiki\"><<lingo Upgrade/Caption>></$button>\n\n</div>\n</$list>\n"
},
"$:/core/ui/ViewTemplate/import": {
"title": "$:/core/ui/ViewTemplate/import",
"tags": "$:/tags/ViewTemplate",
"text": "\\define lingo-base() $:/language/Import/\n\n<$list filter=\"[all[current]field:plugin-type[import]]\">\n\n<div class=\"tc-import\">\n\n<<lingo Listing/Hint>>\n\n<$button message=\"tm-delete-tiddler\" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>\n<$button message=\"tm-perform-import\" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>\n\n{{||$:/core/ui/ImportListing}}\n\n<$button message=\"tm-delete-tiddler\" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>\n<$button message=\"tm-perform-import\" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/ViewTemplate/plugin": {
"title": "$:/core/ui/ViewTemplate/plugin",
"tags": "$:/tags/ViewTemplate",
"text": "<$list filter=\"[all[current]has[plugin-type]] -[all[current]field:plugin-type[import]]\">\n<$set name=\"plugin-type\" value={{!!plugin-type}}>\n<$set name=\"default-popup-state\" value=\"yes\">\n<$set name=\"qualified-state\" value=<<qualify \"$:/state/plugin-info\">>>\n{{||$:/core/ui/Components/plugin-info}}\n</$set>\n</$set>\n</$set>\n</$list>\n"
},
"$:/core/ui/ViewTemplate/subtitle": {
"title": "$:/core/ui/ViewTemplate/subtitle",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal type=\"nomatch\" state=<<folded-state>> text=\"hide\" tag=\"div\" retain=\"yes\" animate=\"yes\">\n<div class=\"tc-subtitle\">\n<$link to={{!!modifier}}>\n<$view field=\"modifier\"/>\n</$link> <$view field=\"modified\" format=\"date\" template={{$:/language/Tiddler/DateFormat}}/>\n</div>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/tags": {
"title": "$:/core/ui/ViewTemplate/tags",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal type=\"nomatch\" state=<<folded-state>> text=\"hide\" tag=\"div\" retain=\"yes\" animate=\"yes\">\n<div class=\"tc-tags-wrapper\"><$list filter=\"[all[current]tags[]sort[title]]\" template=\"$:/core/ui/TagTemplate\" storyview=\"pop\"/></div>\n</$reveal>"
},
"$:/core/ui/ViewTemplate/title": {
"title": "$:/core/ui/ViewTemplate/title",
"tags": "$:/tags/ViewTemplate",
"text": "\\define title-styles()\nfill:$(foregroundColor)$;\n\\end\n\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-tiddler-title\">\n<div class=\"tc-titlebar\">\n<span class=\"tc-tiddler-controls\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]\" variable=\"listItem\"><$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\"><$transclude tiddler=<<listItem>>/></$reveal></$list>\n</span>\n<$set name=\"tv-wikilinks\" value={{$:/config/Tiddlers/TitleLinks}}>\n<$link>\n<$set name=\"foregroundColor\" value={{!!color}}>\n<span class=\"tc-tiddler-title-icon\" style=<<title-styles>>>\n<$transclude tiddler={{!!icon}}/>\n</span>\n</$set>\n<$list filter=\"[all[current]removeprefix[$:/]]\">\n<h2 class=\"tc-title\" title={{$:/language/SystemTiddler/Tooltip}}>\n<span class=\"tc-system-title-prefix\">$:/</span><$text text=<<currentTiddler>>/>\n</h2>\n</$list>\n<$list filter=\"[all[current]!prefix[$:/]]\">\n<h2 class=\"tc-title\">\n<$view field=\"title\"/>\n</h2>\n</$list>\n</$link>\n</$set>\n</div>\n\n<$reveal type=\"nomatch\" text=\"\" default=\"\" state=<<tiddlerInfoState>> class=\"tc-tiddler-info tc-popup-handle\" animate=\"yes\" retain=\"yes\">\n\n<$transclude tiddler=\"$:/core/ui/TiddlerInfo\"/>\n\n</$reveal>\n</div>"
},
"$:/core/ui/ViewTemplate/unfold": {
"title": "$:/core/ui/ViewTemplate/unfold",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal tag=\"div\" type=\"nomatch\" state=\"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar\" text=\"hide\">\n<$reveal tag=\"div\" type=\"nomatch\" state=<<folded-state>> text=\"hide\" default=\"show\" retain=\"yes\" animate=\"yes\">\n<$button tooltip={{$:/language/Buttons/Fold/Hint}} aria-label={{$:/language/Buttons/Fold/Caption}} class=\"tc-fold-banner\">\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n{{$:/core/images/chevron-up}}\n</$button>\n</$reveal>\n<$reveal tag=\"div\" type=\"nomatch\" state=<<folded-state>> text=\"show\" default=\"show\" retain=\"yes\" animate=\"yes\">\n<$button tooltip={{$:/language/Buttons/Unfold/Hint}} aria-label={{$:/language/Buttons/Unfold/Caption}} class=\"tc-unfold-banner\">\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n{{$:/core/images/chevron-down}}\n</$button>\n</$reveal>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate": {
"title": "$:/core/ui/ViewTemplate",
"text": "\\define frame-classes()\ntc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$\n\\end\n\\define folded-state()\n$:/state/folded/$(currentTiddler)$\n\\end\n<$set name=\"storyTiddler\" value=<<currentTiddler>>><$set name=\"tiddlerInfoState\" value=<<qualify \"$:/state/popup/tiddler-info\">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list>\n</div>\n</$tiddler></$set></$set>\n"
},
"$:/core/ui/Buttons/clone": {
"title": "$:/core/ui/Buttons/clone",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/clone-button}} {{$:/language/Buttons/Clone/Caption}}",
"description": "{{$:/language/Buttons/Clone/Hint}}",
"text": "<$button message=\"tm-new-tiddler\" param=<<currentTiddler>> tooltip={{$:/language/Buttons/Clone/Hint}} aria-label={{$:/language/Buttons/Clone/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/clone-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Clone/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/close-others": {
"title": "$:/core/ui/Buttons/close-others",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/close-others-button}} {{$:/language/Buttons/CloseOthers/Caption}}",
"description": "{{$:/language/Buttons/CloseOthers/Hint}}",
"text": "<$button message=\"tm-close-other-tiddlers\" param=<<currentTiddler>> tooltip={{$:/language/Buttons/CloseOthers/Hint}} aria-label={{$:/language/Buttons/CloseOthers/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/close-others-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/CloseOthers/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/close": {
"title": "$:/core/ui/Buttons/close",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/close-button}} {{$:/language/Buttons/Close/Caption}}",
"description": "{{$:/language/Buttons/Close/Hint}}",
"text": "<$button message=\"tm-close-tiddler\" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/close-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Close/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/edit": {
"title": "$:/core/ui/Buttons/edit",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/edit-button}} {{$:/language/Buttons/Edit/Caption}}",
"description": "{{$:/language/Buttons/Edit/Hint}}",
"text": "<$button message=\"tm-edit-tiddler\" tooltip={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/edit-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Edit/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/export-tiddler": {
"title": "$:/core/ui/Buttons/export-tiddler",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/export-button}} {{$:/language/Buttons/ExportTiddler/Caption}}",
"description": "{{$:/language/Buttons/ExportTiddler/Hint}}",
"text": "\\define makeExportFilter()\n[[$(currentTiddler)$]]\n\\end\n<$macrocall $name=\"exportButton\" exportFilter=<<makeExportFilter>> lingoBase=\"$:/language/Buttons/ExportTiddler/\" baseFilename=<<currentTiddler>>/>"
},
"$:/core/ui/Buttons/fold-bar": {
"title": "$:/core/ui/Buttons/fold-bar",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/chevron-up}} {{$:/language/Buttons/Fold/FoldBar/Caption}}",
"description": "{{$:/language/Buttons/Fold/FoldBar/Hint}}",
"text": "<!-- This dummy toolbar button is here to allow visibility of the fold-bar to be controlled as if it were a toolbar button -->"
},
"$:/core/ui/Buttons/fold-others": {
"title": "$:/core/ui/Buttons/fold-others",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/fold-others-button}} {{$:/language/Buttons/FoldOthers/Caption}}",
"description": "{{$:/language/Buttons/FoldOthers/Hint}}",
"text": "<$button tooltip={{$:/language/Buttons/FoldOthers/Hint}} aria-label={{$:/language/Buttons/FoldOthers/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-other-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-others-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/FoldOthers/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/fold": {
"title": "$:/core/ui/Buttons/fold",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/fold-button}} {{$:/language/Buttons/Fold/Caption}}",
"description": "{{$:/language/Buttons/Fold/Hint}}",
"text": "<$reveal type=\"nomatch\" state=<<folded-state>> text=\"hide\" default=\"show\"><$button tooltip={{$:/language/Buttons/Fold/Hint}} aria-label={{$:/language/Buttons/Fold/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Fold/Caption}}/>\n</span>\n</$list>\n</$button></$reveal><$reveal type=\"match\" state=<<folded-state>> text=\"hide\" default=\"show\"><$button tooltip={{$:/language/Buttons/Unfold/Hint}} aria-label={{$:/language/Buttons/Unfold/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\" variable=\"listItem\">\n{{$:/core/images/unfold-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Unfold/Caption}}/>\n</span>\n</$list>\n</$button></$reveal>"
},
"$:/core/ui/Buttons/info": {
"title": "$:/core/ui/Buttons/info",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/info-button}} {{$:/language/Buttons/Info/Caption}}",
"description": "{{$:/language/Buttons/Info/Hint}}",
"text": "\\define button-content()\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/info-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Info/Caption}}/></span>\n</$list>\n\\end\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"popup\">\n<$button popup=<<tiddlerInfoState>> tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"sticky\">\n<$reveal state=<<tiddlerInfoState>> type=\"match\" text=\"\" default=\"\">\n<$button set=<<tiddlerInfoState>> setTo=\"yes\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n<$reveal state=<<tiddlerInfoState>> type=\"nomatch\" text=\"\" default=\"\">\n<$button set=<<tiddlerInfoState>> setTo=\"\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n</$reveal>"
},
"$:/core/ui/Buttons/more-tiddler-actions": {
"title": "$:/core/ui/Buttons/more-tiddler-actions",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"text": "\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<$button popup=<<qualify \"$:/state/popup/more\">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/down-arrow}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/More/Caption}}/></span>\n</$list>\n</$button><$reveal state=<<qualify \"$:/state/popup/more\">> type=\"popup\" position=\"below\" animate=\"yes\">\n\n<div class=\"tc-drop-down\">\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"tc-btn-invisible\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] -[[$:/core/ui/Buttons/more-tiddler-actions]]\" variable=\"listItem\">\n\n<$reveal type=\"match\" state=<<config-title>> text=\"hide\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$reveal>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</div>\n\n</$reveal>"
},
"$:/core/ui/Buttons/new-here": {
"title": "$:/core/ui/Buttons/new-here",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/new-here-button}} {{$:/language/Buttons/NewHere/Caption}}",
"description": "{{$:/language/Buttons/NewHere/Hint}}",
"text": "\\define newHereButtonTags()\n[[$(currentTiddler)$]]\n\\end\n\\define newHereButton()\n<$button tooltip={{$:/language/Buttons/NewHere/Hint}} aria-label={{$:/language/Buttons/NewHere/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-new-tiddler\" tags=<<newHereButtonTags>>/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/new-here-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewHere/Caption}}/></span>\n</$list>\n</$button>\n\\end\n<<newHereButton>>"
},
"$:/core/ui/Buttons/new-journal-here": {
"title": "$:/core/ui/Buttons/new-journal-here",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/new-journal-button}} {{$:/language/Buttons/NewJournalHere/Caption}}",
"description": "{{$:/language/Buttons/NewJournalHere/Hint}}",
"text": "\\define journalButtonTags()\n[[$(currentTiddlerTag)$]] $(journalTags)$\n\\end\n\\define journalButton()\n<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-new-tiddler\" title=<<now \"$(journalTitleTemplate)$\">> tags=<<journalButtonTags>>/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/new-journal-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewJournalHere/Caption}}/></span>\n</$list>\n</$button>\n\\end\n<$set name=\"journalTitleTemplate\" value={{$:/config/NewJournal/Title}}>\n<$set name=\"journalTags\" value={{$:/config/NewJournal/Tags}}>\n<$set name=\"currentTiddlerTag\" value=<<currentTiddler>>>\n<<journalButton>>\n</$set></$set></$set>"
},
"$:/core/ui/Buttons/open-window": {
"title": "$:/core/ui/Buttons/open-window",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/open-window}} {{$:/language/Buttons/OpenWindow/Caption}}",
"description": "{{$:/language/Buttons/OpenWindow/Hint}}",
"text": "<$button message=\"tm-open-window\" tooltip={{$:/language/Buttons/OpenWindow/Hint}} aria-label={{$:/language/Buttons/OpenWindow/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/open-window}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/OpenWindow/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/permalink": {
"title": "$:/core/ui/Buttons/permalink",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/permalink-button}} {{$:/language/Buttons/Permalink/Caption}}",
"description": "{{$:/language/Buttons/Permalink/Hint}}",
"text": "<$button message=\"tm-permalink\" tooltip={{$:/language/Buttons/Permalink/Hint}} aria-label={{$:/language/Buttons/Permalink/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/permalink-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Permalink/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/permaview": {
"title": "$:/core/ui/Buttons/permaview",
"tags": "$:/tags/ViewToolbar $:/tags/PageControls",
"caption": "{{$:/core/images/permaview-button}} {{$:/language/Buttons/Permaview/Caption}}",
"description": "{{$:/language/Buttons/Permaview/Hint}}",
"text": "<$button message=\"tm-permaview\" tooltip={{$:/language/Buttons/Permaview/Hint}} aria-label={{$:/language/Buttons/Permaview/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/permaview-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Permaview/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/DefaultTiddlers": {
"title": "$:/DefaultTiddlers",
"text": "GettingStarted\n"
},
"$:/temp/advancedsearch": {
"title": "$:/temp/advancedsearch",
"text": ""
},
"$:/snippets/allfields": {
"title": "$:/snippets/allfields",
"text": "\\define renderfield(title)\n<tr class=\"tc-view-field\"><td class=\"tc-view-field-name\">''$title$'':</td><td class=\"tc-view-field-value\">//{{$:/language/Docs/Fields/$title$}}//</td></tr>\n\\end\n<table class=\"tc-view-field-table\"><tbody><$list filter=\"[fields[]sort[title]]\" variable=\"listItem\"><$macrocall $name=\"renderfield\" title=<<listItem>>/></$list>\n</tbody></table>\n"
},
"$:/config/AnimationDuration": {
"title": "$:/config/AnimationDuration",
"text": "400"
},
"$:/config/AutoSave": {
"title": "$:/config/AutoSave",
"text": "yes"
},
"$:/config/BitmapEditor/Colour": {
"title": "$:/config/BitmapEditor/Colour",
"text": "#444"
},
"$:/config/BitmapEditor/ImageSizes": {
"title": "$:/config/BitmapEditor/ImageSizes",
"text": "[[62px 100px]] [[100px 62px]] [[124px 200px]] [[200px 124px]] [[248px 400px]] [[371px 600px]] [[400px 248px]] [[556px 900px]] [[600px 371px]] [[742px 1200px]] [[900px 556px]] [[1200px 742px]]"
},
"$:/config/BitmapEditor/LineWidth": {
"title": "$:/config/BitmapEditor/LineWidth",
"text": "3px"
},
"$:/config/BitmapEditor/LineWidths": {
"title": "$:/config/BitmapEditor/LineWidths",
"text": "0.25px 0.5px 1px 2px 3px 4px 6px 8px 10px 16px 20px 28px 40px 56px 80px"
},
"$:/config/BitmapEditor/Opacities": {
"title": "$:/config/BitmapEditor/Opacities",
"text": "0.01 0.025 0.05 0.075 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0"
},
"$:/config/BitmapEditor/Opacity": {
"title": "$:/config/BitmapEditor/Opacity",
"text": "1.0"
},
"$:/config/DefaultSidebarTab": {
"title": "$:/config/DefaultSidebarTab",
"text": "$:/core/ui/SideBar/Open"
},
"$:/config/DownloadSaver/AutoSave": {
"title": "$:/config/DownloadSaver/AutoSave",
"text": "no"
},
"$:/config/Drafts/TypingTimeout": {
"title": "$:/config/Drafts/TypingTimeout",
"text": "400"
},
"$:/config/EditTemplateFields/Visibility/title": {
"title": "$:/config/EditTemplateFields/Visibility/title",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/tags": {
"title": "$:/config/EditTemplateFields/Visibility/tags",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/text": {
"title": "$:/config/EditTemplateFields/Visibility/text",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/creator": {
"title": "$:/config/EditTemplateFields/Visibility/creator",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/created": {
"title": "$:/config/EditTemplateFields/Visibility/created",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/modified": {
"title": "$:/config/EditTemplateFields/Visibility/modified",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/modifier": {
"title": "$:/config/EditTemplateFields/Visibility/modifier",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/type": {
"title": "$:/config/EditTemplateFields/Visibility/type",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/draft.title": {
"title": "$:/config/EditTemplateFields/Visibility/draft.title",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/draft.of": {
"title": "$:/config/EditTemplateFields/Visibility/draft.of",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/revision": {
"title": "$:/config/EditTemplateFields/Visibility/revision",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/bag": {
"title": "$:/config/EditTemplateFields/Visibility/bag",
"text": "hide"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-4": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-4",
"text": "hide"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-5": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-5",
"text": "hide"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-6": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-6",
"text": "hide"
},
"$:/config/EditorTypeMappings/image/gif": {
"title": "$:/config/EditorTypeMappings/image/gif",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/jpeg": {
"title": "$:/config/EditorTypeMappings/image/jpeg",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/jpg": {
"title": "$:/config/EditorTypeMappings/image/jpg",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/png": {
"title": "$:/config/EditorTypeMappings/image/png",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/x-icon": {
"title": "$:/config/EditorTypeMappings/image/x-icon",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/text/vnd.tiddlywiki": {
"title": "$:/config/EditorTypeMappings/text/vnd.tiddlywiki",
"text": "text"
},
"$:/config/Manager/Show": {
"title": "$:/config/Manager/Show",
"text": "tiddlers"
},
"$:/config/Manager/Filter": {
"title": "$:/config/Manager/Filter",
"text": ""
},
"$:/config/Manager/Order": {
"title": "$:/config/Manager/Order",
"text": "forward"
},
"$:/config/Manager/Sort": {
"title": "$:/config/Manager/Sort",
"text": "title"
},
"$:/config/Manager/System": {
"title": "$:/config/Manager/System",
"text": "system"
},
"$:/config/Manager/Tag": {
"title": "$:/config/Manager/Tag",
"text": ""
},
"$:/state/popup/manager/item/$:/Manager/ItemMain/RawText": {
"title": "$:/state/popup/manager/item/$:/Manager/ItemMain/RawText",
"text": "hide"
},
"$:/config/MissingLinks": {
"title": "$:/config/MissingLinks",
"text": "yes"
},
"$:/config/Navigation/UpdateAddressBar": {
"title": "$:/config/Navigation/UpdateAddressBar",
"text": "no"
},
"$:/config/Navigation/UpdateHistory": {
"title": "$:/config/Navigation/UpdateHistory",
"text": "no"
},
"$:/config/OfficialPluginLibrary": {
"title": "$:/config/OfficialPluginLibrary",
"tags": "$:/tags/PluginLibrary",
"url": "http://tiddlywiki.com/library/v5.1.14/index.html",
"caption": "{{$:/language/OfficialPluginLibrary}}",
"text": "{{$:/language/OfficialPluginLibrary/Hint}}\n"
},
"$:/config/Navigation/openLinkFromInsideRiver": {
"title": "$:/config/Navigation/openLinkFromInsideRiver",
"text": "below"
},
"$:/config/Navigation/openLinkFromOutsideRiver": {
"title": "$:/config/Navigation/openLinkFromOutsideRiver",
"text": "top"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/advanced-search": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/advanced-search",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/encryption": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/encryption",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/fold-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/fold-all",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/refresh": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/refresh",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/import": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/import",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/language": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/language",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/tag-manager": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/tag-manager",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-journal": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-journal",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-image": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-image",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/palette": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/palette",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/permaview": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/permaview",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/print": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/print",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/storyview": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/storyview",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/timestamp": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/timestamp",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/theme": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/theme",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/unfold-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/unfold-all",
"text": "hide"
},
"$:/config/Performance/Instrumentation": {
"title": "$:/config/Performance/Instrumentation",
"text": "no"
},
"$:/config/SaveWikiButton/Template": {
"title": "$:/config/SaveWikiButton/Template",
"text": "$:/core/save/all"
},
"$:/config/SaverFilter": {
"title": "$:/config/SaverFilter",
"text": "[all[]] -[[$:/HistoryList]] -[[$:/StoryList]] -[[$:/Import]] -[[$:/isEncrypted]] -[[$:/UploadName]] -[prefix[$:/state/]] -[prefix[$:/temp/]]"
},
"$:/config/Search/AutoFocus": {
"title": "$:/config/Search/AutoFocus",
"text": "true"
},
"$:/config/Search/MinLength": {
"title": "$:/config/Search/MinLength",
"text": "3"
},
"$:/config/SearchResults/Default": {
"title": "$:/config/SearchResults/Default",
"text": "$:/core/ui/DefaultSearchResultList"
},
"$:/config/ShortcutInfo/bold": {
"title": "$:/config/ShortcutInfo/bold",
"text": "{{$:/language/Buttons/Bold/Hint}}"
},
"$:/config/ShortcutInfo/cancel-edit-tiddler": {
"title": "$:/config/ShortcutInfo/cancel-edit-tiddler",
"text": "{{$:/language/Buttons/Cancel/Hint}}"
},
"$:/config/ShortcutInfo/excise": {
"title": "$:/config/ShortcutInfo/excise",
"text": "{{$:/language/Buttons/Excise/Hint}}"
},
"$:/config/ShortcutInfo/heading-1": {
"title": "$:/config/ShortcutInfo/heading-1",
"text": "{{$:/language/Buttons/Heading1/Hint}}"
},
"$:/config/ShortcutInfo/heading-2": {
"title": "$:/config/ShortcutInfo/heading-2",
"text": "{{$:/language/Buttons/Heading2/Hint}}"
},
"$:/config/ShortcutInfo/heading-3": {
"title": "$:/config/ShortcutInfo/heading-3",
"text": "{{$:/language/Buttons/Heading3/Hint}}"
},
"$:/config/ShortcutInfo/heading-4": {
"title": "$:/config/ShortcutInfo/heading-4",
"text": "{{$:/language/Buttons/Heading4/Hint}}"
},
"$:/config/ShortcutInfo/heading-5": {
"title": "$:/config/ShortcutInfo/heading-5",
"text": "{{$:/language/Buttons/Heading5/Hint}}"
},
"$:/config/ShortcutInfo/heading-6": {
"title": "$:/config/ShortcutInfo/heading-6",
"text": "{{$:/language/Buttons/Heading6/Hint}}"
},
"$:/config/ShortcutInfo/italic": {
"title": "$:/config/ShortcutInfo/italic",
"text": "{{$:/language/Buttons/Italic/Hint}}"
},
"$:/config/ShortcutInfo/link": {
"title": "$:/config/ShortcutInfo/link",
"text": "{{$:/language/Buttons/Link/Hint}}"
},
"$:/config/ShortcutInfo/list-bullet": {
"title": "$:/config/ShortcutInfo/list-bullet",
"text": "{{$:/language/Buttons/ListBullet/Hint}}"
},
"$:/config/ShortcutInfo/list-number": {
"title": "$:/config/ShortcutInfo/list-number",
"text": "{{$:/language/Buttons/ListNumber/Hint}}"
},
"$:/config/ShortcutInfo/mono-block": {
"title": "$:/config/ShortcutInfo/mono-block",
"text": "{{$:/language/Buttons/MonoBlock/Hint}}"
},
"$:/config/ShortcutInfo/mono-line": {
"title": "$:/config/ShortcutInfo/mono-line",
"text": "{{$:/language/Buttons/MonoLine/Hint}}"
},
"$:/config/ShortcutInfo/picture": {
"title": "$:/config/ShortcutInfo/picture",
"text": "{{$:/language/Buttons/Picture/Hint}}"
},
"$:/config/ShortcutInfo/preview": {
"title": "$:/config/ShortcutInfo/preview",
"text": "{{$:/language/Buttons/Preview/Hint}}"
},
"$:/config/ShortcutInfo/quote": {
"title": "$:/config/ShortcutInfo/quote",
"text": "{{$:/language/Buttons/Quote/Hint}}"
},
"$:/config/ShortcutInfo/save-tiddler": {
"title": "$:/config/ShortcutInfo/save-tiddler",
"text": "{{$:/language/Buttons/Save/Hint}}"
},
"$:/config/ShortcutInfo/stamp": {
"title": "$:/config/ShortcutInfo/stamp",
"text": "{{$:/language/Buttons/Stamp/Hint}}"
},
"$:/config/ShortcutInfo/strikethrough": {
"title": "$:/config/ShortcutInfo/strikethrough",
"text": "{{$:/language/Buttons/Strikethrough/Hint}}"
},
"$:/config/ShortcutInfo/subscript": {
"title": "$:/config/ShortcutInfo/subscript",
"text": "{{$:/language/Buttons/Subscript/Hint}}"
},
"$:/config/ShortcutInfo/superscript": {
"title": "$:/config/ShortcutInfo/superscript",
"text": "{{$:/language/Buttons/Superscript/Hint}}"
},
"$:/config/ShortcutInfo/underline": {
"title": "$:/config/ShortcutInfo/underline",
"text": "{{$:/language/Buttons/Underline/Hint}}"
},
"$:/config/SyncFilter": {
"title": "$:/config/SyncFilter",
"text": "[is[tiddler]] -[[$:/HistoryList]] -[[$:/Import]] -[[$:/isEncrypted]] -[prefix[$:/status/]] -[prefix[$:/state/]] -[prefix[$:/temp/]]"
},
"$:/config/TextEditor/EditorHeight/Height": {
"title": "$:/config/TextEditor/EditorHeight/Height",
"text": "400px"
},
"$:/config/TextEditor/EditorHeight/Mode": {
"title": "$:/config/TextEditor/EditorHeight/Mode",
"text": "auto"
},
"$:/config/TiddlerInfo/Default": {
"title": "$:/config/TiddlerInfo/Default",
"text": "$:/core/ui/TiddlerInfo/Fields"
},
"$:/config/TiddlerInfo/Mode": {
"title": "$:/config/TiddlerInfo/Mode",
"text": "popup"
},
"$:/config/Tiddlers/TitleLinks": {
"title": "$:/config/Tiddlers/TitleLinks",
"text": "no"
},
"$:/config/Toolbar/ButtonClass": {
"title": "$:/config/Toolbar/ButtonClass",
"text": "tc-btn-invisible"
},
"$:/config/Toolbar/Icons": {
"title": "$:/config/Toolbar/Icons",
"text": "yes"
},
"$:/config/Toolbar/Text": {
"title": "$:/config/Toolbar/Text",
"text": "no"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/info": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/info",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions",
"text": "show"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-here": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-here",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-journal-here": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-journal-here",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permalink": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permalink",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permaview": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permaview",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/delete": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/delete",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-others": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-others",
"text": "hide"
},
"$:/config/shortcuts-mac/bold": {
"title": "$:/config/shortcuts-mac/bold",
"text": "meta-B"
},
"$:/config/shortcuts-mac/italic": {
"title": "$:/config/shortcuts-mac/italic",
"text": "meta-I"
},
"$:/config/shortcuts-mac/underline": {
"title": "$:/config/shortcuts-mac/underline",
"text": "meta-U"
},
"$:/config/shortcuts-not-mac/bold": {
"title": "$:/config/shortcuts-not-mac/bold",
"text": "ctrl-B"
},
"$:/config/shortcuts-not-mac/italic": {
"title": "$:/config/shortcuts-not-mac/italic",
"text": "ctrl-I"
},
"$:/config/shortcuts-not-mac/underline": {
"title": "$:/config/shortcuts-not-mac/underline",
"text": "ctrl-U"
},
"$:/config/shortcuts/cancel-edit-tiddler": {
"title": "$:/config/shortcuts/cancel-edit-tiddler",
"text": "escape"
},
"$:/config/shortcuts/excise": {
"title": "$:/config/shortcuts/excise",
"text": "ctrl-E"
},
"$:/config/shortcuts/heading-1": {
"title": "$:/config/shortcuts/heading-1",
"text": "ctrl-1"
},
"$:/config/shortcuts/heading-2": {
"title": "$:/config/shortcuts/heading-2",
"text": "ctrl-2"
},
"$:/config/shortcuts/heading-3": {
"title": "$:/config/shortcuts/heading-3",
"text": "ctrl-3"
},
"$:/config/shortcuts/heading-4": {
"title": "$:/config/shortcuts/heading-4",
"text": "ctrl-4"
},
"$:/config/shortcuts/heading-5": {
"title": "$:/config/shortcuts/heading-5",
"text": "ctrl-5"
},
"$:/config/shortcuts/heading-6": {
"title": "$:/config/shortcuts/heading-6",
"text": "ctrl-6"
},
"$:/config/shortcuts/link": {
"title": "$:/config/shortcuts/link",
"text": "ctrl-L"
},
"$:/config/shortcuts/list-bullet": {
"title": "$:/config/shortcuts/list-bullet",
"text": "ctrl-shift-L"
},
"$:/config/shortcuts/list-number": {
"title": "$:/config/shortcuts/list-number",
"text": "ctrl-shift-N"
},
"$:/config/shortcuts/mono-block": {
"title": "$:/config/shortcuts/mono-block",
"text": "ctrl-shift-M"
},
"$:/config/shortcuts/mono-line": {
"title": "$:/config/shortcuts/mono-line",
"text": "ctrl-M"
},
"$:/config/shortcuts/picture": {
"title": "$:/config/shortcuts/picture",
"text": "ctrl-shift-I"
},
"$:/config/shortcuts/preview": {
"title": "$:/config/shortcuts/preview",
"text": "alt-P"
},
"$:/config/shortcuts/quote": {
"title": "$:/config/shortcuts/quote",
"text": "ctrl-Q"
},
"$:/config/shortcuts/save-tiddler": {
"title": "$:/config/shortcuts/save-tiddler",
"text": "ctrl+enter"
},
"$:/config/shortcuts/stamp": {
"title": "$:/config/shortcuts/stamp",
"text": "ctrl-S"
},
"$:/config/shortcuts/strikethrough": {
"title": "$:/config/shortcuts/strikethrough",
"text": "ctrl-T"
},
"$:/config/shortcuts/subscript": {
"title": "$:/config/shortcuts/subscript",
"text": "ctrl-shift-B"
},
"$:/config/shortcuts/superscript": {
"title": "$:/config/shortcuts/superscript",
"text": "ctrl-shift-P"
},
"$:/config/WikiParserRules/Inline/wikilink": {
"title": "$:/config/WikiParserRules/Inline/wikilink",
"text": "enable"
},
"$:/snippets/currpalettepreview": {
"title": "$:/snippets/currpalettepreview",
"text": "\\define swatchStyle()\nbackground-color: $(swatchColour)$;\n\\end\n\\define swatch(colour)\n<$set name=\"swatchColour\" value={{##$colour$}}>\n<div class=\"tc-swatch\" style=<<swatchStyle>>/>\n</$set>\n\\end\n<div class=\"tc-swatches-horiz\">\n<<swatch foreground>>\n<<swatch background>>\n<<swatch muted-foreground>>\n<<swatch primary>>\n<<swatch page-background>>\n<<swatch tab-background>>\n<<swatch tiddler-info-background>>\n</div>\n"
},
"$:/snippets/download-wiki-button": {
"title": "$:/snippets/download-wiki-button",
"text": "\\define lingo-base() $:/language/ControlPanel/Tools/Download/\n<$button class=\"tc-btn-big-green\">\n<$action-sendmessage $message=\"tm-download-file\" $param=\"$:/core/save/all\" filename=\"index.html\"/>\n<<lingo Full/Caption>> {{$:/core/images/save-button}}\n</$button>"
},
"$:/language": {
"title": "$:/language",
"text": "$:/languages/en-GB"
},
"$:/snippets/languageswitcher": {
"title": "$:/snippets/languageswitcher",
"text": "{{$:/language/ControlPanel/Basics/Language/Prompt}} <$select tiddler=\"$:/language\">\n<$list filter=\"[[$:/languages/en-GB]] [plugin-type[language]sort[description]]\">\n<option value=<<currentTiddler>>><$view field=\"description\"><$view field=\"name\"><$view field=\"title\"/></$view></$view></option>\n</$list>\n</$select>"
},
"$:/core/macros/CSS": {
"title": "$:/core/macros/CSS",
"tags": "$:/tags/Macro",
"text": "\\define colour(name)\n<$transclude tiddler={{$:/palette}} index=\"$name$\"><$transclude tiddler=\"$:/palettes/Vanilla\" index=\"$name$\"/></$transclude>\n\\end\n\n\\define color(name)\n<<colour $name$>>\n\\end\n\n\\define box-shadow(shadow)\n``\n -webkit-box-shadow: $shadow$;\n -moz-box-shadow: $shadow$;\n box-shadow: $shadow$;\n``\n\\end\n\n\\define filter(filter)\n``\n -webkit-filter: $filter$;\n -moz-filter: $filter$;\n filter: $filter$;\n``\n\\end\n\n\\define transition(transition)\n``\n -webkit-transition: $transition$;\n -moz-transition: $transition$;\n transition: $transition$;\n``\n\\end\n\n\\define transform-origin(origin)\n``\n -webkit-transform-origin: $origin$;\n -moz-transform-origin: $origin$;\n transform-origin: $origin$;\n``\n\\end\n\n\\define background-linear-gradient(gradient)\n``\nbackground-image: linear-gradient($gradient$);\nbackground-image: -o-linear-gradient($gradient$);\nbackground-image: -moz-linear-gradient($gradient$);\nbackground-image: -webkit-linear-gradient($gradient$);\nbackground-image: -ms-linear-gradient($gradient$);\n``\n\\end\n\n\\define column-count(columns)\n``\n-moz-column-count: $columns$;\n-webkit-column-count: $columns$;\ncolumn-count: $columns$;\n``\n\\end\n\n\\define datauri(title)\n<$macrocall $name=\"makedatauri\" type={{$title$!!type}} text={{$title$}}/>\n\\end\n\n\\define if-sidebar(text)\n<$reveal state=\"$:/state/sidebar\" type=\"match\" text=\"yes\" default=\"yes\">$text$</$reveal>\n\\end\n\n\\define if-no-sidebar(text)\n<$reveal state=\"$:/state/sidebar\" type=\"nomatch\" text=\"yes\" default=\"yes\">$text$</$reveal>\n\\end\n"
},
"$:/core/macros/colour-picker": {
"title": "$:/core/macros/colour-picker",
"tags": "$:/tags/Macro",
"text": "\\define colour-picker-update-recent()\n<$action-listops\n\t$tiddler=\"$:/config/ColourPicker/Recent\"\n\t$subfilter=\"$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]\"\n/>\n\\end\n\n\\define colour-picker-inner(actions)\n<$button tag=\"a\" tooltip=\"\"\"$(colour-picker-value)$\"\"\">\n\n$(colour-picker-update-recent)$\n\n$actions$\n\n<div style=\"background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;\"/>\n\n</$button>\n\\end\n\n\\define colour-picker-recent-inner(actions)\n<$set name=\"colour-picker-value\" value=\"$(recentColour)$\">\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$set>\n\\end\n\n\\define colour-picker-recent(actions)\n{{$:/language/ColourPicker/Recent}} <$list filter=\"[list[$:/config/ColourPicker/Recent]]\" variable=\"recentColour\">\n<$macrocall $name=\"colour-picker-recent-inner\" actions=\"\"\"$actions$\"\"\"/></$list>\n\\end\n\n\\define colour-picker(actions)\n<div class=\"tc-colour-chooser\">\n\n<$macrocall $name=\"colour-picker-recent\" actions=\"\"\"$actions$\"\"\"/>\n\n---\n\n<$list filter=\"LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black\" variable=\"colour-picker-value\">\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$list>\n\n---\n\n<$edit-text tiddler=\"$:/config/ColourPicker/New\" tag=\"input\" default=\"\" placeholder=\"\"/> \n<$edit-text tiddler=\"$:/config/ColourPicker/New\" type=\"color\" tag=\"input\"/>\n<$set name=\"colour-picker-value\" value={{$:/config/ColourPicker/New}}>\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$set>\n\n</div>\n\n\\end\n"
},
"$:/core/macros/export": {
"title": "$:/core/macros/export",
"tags": "$:/tags/Macro",
"text": "\\define exportButtonFilename(baseFilename)\n$baseFilename$$(extension)$\n\\end\n\n\\define exportButton(exportFilter:\"[!is[system]sort[title]]\",lingoBase,baseFilename:\"tiddlers\")\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/export\">> tooltip={{$lingoBase$Hint}} aria-label={{$lingoBase$Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/core/images/export-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$lingoBase$Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/export\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Exporter]]\">\n<$set name=\"extension\" value={{!!extension}}>\n<$button class=\"tc-btn-invisible\">\n<$action-sendmessage $message=\"tm-download-file\" $param=<<currentTiddler>> exportFilter=\"\"\"$exportFilter$\"\"\" filename=<<exportButtonFilename \"\"\"$baseFilename$\"\"\">>/>\n<$action-deletetiddler $tiddler=<<qualify \"$:/state/popup/export\">>/>\n<$transclude field=\"description\"/>\n</$button>\n</$set>\n</$list>\n</div>\n</$reveal>\n\\end\n"
},
"$:/core/macros/image-picker": {
"title": "$:/core/macros/image-picker",
"tags": "$:/tags/Macro",
"text": "\\define image-picker-thumbnail(actions)\n<$button tag=\"a\" tooltip=\"\"\"$(imageTitle)$\"\"\">\n$actions$\n<$transclude tiddler=<<imageTitle>>/>\n</$button>\n\\end\n\n\\define image-picker-list(filter,actions)\n<$list filter=\"\"\"$filter$\"\"\" variable=\"imageTitle\">\n<$macrocall $name=\"image-picker-thumbnail\" actions=\"\"\"$actions$\"\"\"/>\n</$list>\n\\end\n\n\\define image-picker(actions,filter:\"[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]\")\n<div class=\"tc-image-chooser\">\n<$vars state-system=<<qualify \"$:/state/image-picker/system\">>>\n<$checkbox tiddler=<<state-system>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"hide\">\n{{$:/language/SystemTiddlers/Include/Prompt}}\n</$checkbox>\n<$reveal state=<<state-system>> type=\"match\" text=\"hide\" default=\"hide\" tag=\"div\">\n<$macrocall $name=\"image-picker-list\" filter=\"\"\"$filter$ +[!is[system]]\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</$reveal>\n<$reveal state=<<state-system>> type=\"nomatch\" text=\"hide\" default=\"hide\" tag=\"div\">\n<$macrocall $name=\"image-picker-list\" filter=\"\"\"$filter$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</$reveal>\n</$vars>\n</div>\n\\end\n\n\\define image-picker-include-tagged-images(actions)\n<$macrocall $name=\"image-picker\" filter=\"[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]\" actions=\"\"\"$actions$\"\"\"/>\n\\end\n"
},
"$:/core/macros/lingo": {
"title": "$:/core/macros/lingo",
"tags": "$:/tags/Macro",
"text": "\\define lingo-base()\n$:/language/\n\\end\n\n\\define lingo(title)\n{{$(lingo-base)$$title$}}\n\\end\n"
},
"$:/core/macros/list": {
"title": "$:/core/macros/list",
"tags": "$:/tags/Macro",
"text": "\\define list-links(filter,type:\"ul\",subtype:\"li\",class:\"\")\n<$type$ class=\"$class$\">\n<$list filter=\"$filter$\">\n<$subtype$>\n<$link to={{!!title}}>\n<$transclude field=\"caption\">\n<$view field=\"title\"/>\n</$transclude>\n</$link>\n</$subtype$>\n</$list>\n</$type$>\n\\end\n\n\\define list-links-draggable-drop-actions()\n<$action-listops $tiddler=<<targetTiddler>> $field=<<targetField>> $subfilter=\"+[insertbefore:currentTiddler<actionTiddler>]\"/>\n\\end\n\n\\define list-links-draggable(tiddler,field:\"list\",type:\"ul\",subtype:\"li\",class:\"\",itemTemplate)\n<$vars targetTiddler=\"\"\"$tiddler$\"\"\" targetField=\"\"\"$field$\"\"\">\n<$type$ class=\"$class$\">\n<$list filter=\"[list[$tiddler$!!$field$]]\">\n<$droppable actions=<<list-links-draggable-drop-actions>> tag=\"\"\"$subtype$\"\"\">\n<div class=\"tc-droppable-placeholder\">\n \n</div>\n<div>\n<$link to={{!!title}}>\n<$transclude tiddler=\"\"\"$itemTemplate$\"\"\">\n<$transclude field=\"caption\">\n<$view field=\"title\"/>\n</$transclude>\n</$transclude>\n</$link>\n</div>\n</$droppable>\n</$list>\n<$tiddler tiddler=\"\">\n<$droppable actions=<<list-links-draggable-drop-actions>> tag=\"\"\"$subtype$\"\"\">\n<div class=\"tc-droppable-placeholder\">\n \n</div>\n<div>\n \n</div>\n</$droppable>\n</$tiddler>\n</$type$>\n</$vars>\n\\end\n\n\\define list-tagged-draggable-drop-actions()\n<!-- Save the current ordering of the tiddlers with this tag -->\n<$set name=\"order\" filter=\"[<tag>tagging[]]\">\n<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->\n<$list filter=\"[<tag>tagging[]]\">\n<$action-deletefield $field=\"list-before\"/>\n<$action-deletefield $field=\"list-after\"/>\n</$list>\n<!-- Assign the list field of the tag with the current ordering -->\n<$action-setfield $tiddler=<<tag>> $field=\"list\" $value=<<order>>/>\n<!-- Add the newly inserted item to the list -->\n<$action-listops $tiddler=<<tag>> $field=\"list\" $subfilter=\"+[insertbefore:currentTiddler<actionTiddler>]\"/>\n<!-- Make sure the newly added item has the right tag -->\n<$action-listops $tiddler=<<actionTiddler>> $tags=\"[<tag>]\"/>\n</$set>\n\\end\n\n\\define list-tagged-draggable(tag,itemTemplate,elementTag:\"div\")\n<$set name=\"tag\" value=\"\"\"$tag$\"\"\">\n<$list filter=\"[<tag>tagging[]]\">\n<$elementTag$ class=\"tc-menu-list-item\">\n<$droppable actions=<<list-tagged-draggable-drop-actions>>>\n<$elementTag$ class=\"tc-droppable-placeholder\">\n \n</$elementTag$>\n<$elementTag$>\n<$transclude tiddler=\"\"\"$itemTemplate$\"\"\">\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</$transclude>\n</$elementTag$>\n</$droppable>\n</$elementTag$>\n</$list>\n<$tiddler tiddler=\"\">\n<$droppable actions=<<list-tagged-draggable-drop-actions>>>\n<$elementTag$ class=\"tc-droppable-placeholder\">\n \n</$elementTag$>\n<$elementTag$ style=\"height:0.5em;\">\n</$elementTag$>\n</$droppable>\n</$tiddler>\n</$set>\n\\end\n"
},
"$:/core/macros/tabs": {
"title": "$:/core/macros/tabs",
"tags": "$:/tags/Macro",
"text": "\\define tabs(tabsList,default,state:\"$:/state/tab\",class,template)\n<div class=\"tc-tab-set $class$\">\n<div class=\"tc-tab-buttons $class$\">\n<$list filter=\"$tabsList$\" variable=\"currentTab\"><$set name=\"save-currentTiddler\" value=<<currentTiddler>>><$tiddler tiddler=<<currentTab>>><$button set=<<qualify \"$state$\">> setTo=<<currentTab>> default=\"$default$\" selectedClass=\"tc-tab-selected\" tooltip={{!!tooltip}}>\n<$tiddler tiddler=<<save-currentTiddler>>>\n<$set name=\"tv-wikilinks\" value=\"no\">\n<$transclude tiddler=<<currentTab>> field=\"caption\">\n<$macrocall $name=\"currentTab\" $type=\"text/plain\" $output=\"text/plain\"/>\n</$transclude>\n</$set></$tiddler></$button></$tiddler></$set></$list>\n</div>\n<div class=\"tc-tab-divider $class$\"/>\n<div class=\"tc-tab-content $class$\">\n<$list filter=\"$tabsList$\" variable=\"currentTab\">\n\n<$reveal type=\"match\" state=<<qualify \"$state$\">> text=<<currentTab>> default=\"$default$\">\n\n<$transclude tiddler=\"$template$\" mode=\"block\">\n\n<$transclude tiddler=<<currentTab>> mode=\"block\"/>\n\n</$transclude>\n\n</$reveal>\n\n</$list>\n</div>\n</div>\n\\end\n"
},
"$:/core/macros/tag-picker": {
"title": "$:/core/macros/tag-picker",
"tags": "$:/tags/Macro",
"text": "\\define add-tag-actions()\n<$action-sendmessage $message=\"tm-add-tag\" $param={{$:/temp/NewTagName}}/>\n<$action-deletetiddler $tiddler=\"$:/temp/NewTagName\"/>\n\\end\n\n\\define tag-button()\n<$button class=\"tc-btn-invisible\" tag=\"a\">\n$(actions)$\n<$action-deletetiddler $tiddler=\"$:/temp/NewTagName\"/>\n<$macrocall $name=\"tag-pill\" tag=<<tag>>/>\n</$button>\n\\end\n\n\\define tag-picker(actions)\n<$set name=\"actions\" value=\"\"\"$actions$\"\"\">\n<div class=\"tc-edit-add-tag\">\n<span class=\"tc-add-tag-name\">\n<$keyboard key=\"ENTER\" actions=<<add-tag-actions>>>\n<$edit-text tiddler=\"$:/temp/NewTagName\" tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify \"$:/state/popup/tags-auto-complete\">> class=\"tc-edit-texteditor tc-popup-handle\"/>\n</$keyboard>\n</span> <$button popup=<<qualify \"$:/state/popup/tags-auto-complete\">> class=\"tc-btn-invisible\" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button> <span class=\"tc-add-tag-button\">\n<$set name=\"tag\" value={{$:/temp/NewTagName}}>\n<$button set=\"$:/temp/NewTagName\" setTo=\"\" class=\"\">\n$actions$\n<$action-deletetiddler $tiddler=\"$:/temp/NewTagName\"/>\n{{$:/language/EditTemplate/Tags/Add/Button}}\n</$button>\n</$set>\n</span>\n</div>\n<div class=\"tc-block-dropdown-wrapper\">\n<$reveal state=<<qualify \"$:/state/popup/tags-auto-complete\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown\">\n<$list filter=\"[tags[]!is[system]search:title{$:/temp/NewTagName}sort[]]\" variable=\"tag\">\n<<tag-button>>\n</$list>\n<hr>\n<$list filter=\"[tags[]is[system]search:title{$:/temp/NewTagName}sort[]]\" variable=\"tag\">\n<<tag-button>>\n</$list>\n</div>\n</$reveal>\n</div>\n</$set>\n\\end\n"
},
"$:/core/macros/tag": {
"title": "$:/core/macros/tag",
"tags": "$:/tags/Macro",
"text": "\\define tag-pill-styles()\nbackground-color:$(backgroundColor)$;\nfill:$(foregroundColor)$;\ncolor:$(foregroundColor)$;\n\\end\n\n\\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)\n<$vars foregroundColor=<<contrastcolour target:\"\"\"$colour$\"\"\" fallbackTarget:\"\"\"$fallbackTarget$\"\"\" colourA:\"\"\"$colourA$\"\"\" colourB:\"\"\"$colourB$\"\"\">> backgroundColor=\"\"\"$colour$\"\"\">\n<$element-tag$ $element-attributes$ class=\"tc-tag-label tc-btn-invisible\" style=<<tag-pill-styles>>>\n$actions$<$transclude tiddler=\"\"\"$icon$\"\"\"/> <$view tiddler=\"\"\"$tag$\"\"\" field=\"title\" format=\"text\" />\n</$element-tag$>\n</$vars>\n\\end\n\n\\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)\n<$macrocall $name=\"tag-pill-inner\" tag=\"\"\"$tag$\"\"\" icon=\"\"\"$icon$\"\"\" colour=\"\"\"$colour$\"\"\" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} element-tag=\"\"\"$element-tag$\"\"\" element-attributes=\"\"\"$element-attributes$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n\\end\n\n\\define tag-pill(tag,element-tag:\"span\",element-attributes:\"\",actions:\"\")\n<span class=\"tc-tag-list-item\">\n<$macrocall $name=\"tag-pill-body\" tag=\"\"\"$tag$\"\"\" icon={{$tag$!!icon}} colour={{$tag$!!color}} palette={{$:/palette}} element-tag=\"\"\"$element-tag$\"\"\" element-attributes=\"\"\"$element-attributes$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</span>\n\\end\n\n\\define tag(tag)\n{{$tag$||$:/core/ui/TagTemplate}}\n\\end\n"
},
"$:/core/macros/thumbnails": {
"title": "$:/core/macros/thumbnails",
"tags": "$:/tags/Macro",
"text": "\\define thumbnail(link,icon,color,background-color,image,caption,width:\"280\",height:\"157\")\n<$link to=\"\"\"$link$\"\"\"><div class=\"tc-thumbnail-wrapper\">\n<div class=\"tc-thumbnail-image\" style=\"width:$width$px;height:$height$px;\"><$reveal type=\"nomatch\" text=\"\" default=\"\"\"$image$\"\"\" tag=\"div\" style=\"width:$width$px;height:$height$px;\">\n[img[$image$]]\n</$reveal><$reveal type=\"match\" text=\"\" default=\"\"\"$image$\"\"\" tag=\"div\" class=\"tc-thumbnail-background\" style=\"width:$width$px;height:$height$px;background-color:$background-color$;\"></$reveal></div><div class=\"tc-thumbnail-icon\" style=\"fill:$color$;color:$color$;\">\n$icon$\n</div><div class=\"tc-thumbnail-caption\">\n$caption$\n</div>\n</div></$link>\n\\end\n\n\\define thumbnail-right(link,icon,color,background-color,image,caption,width:\"280\",height:\"157\")\n<div class=\"tc-thumbnail-right-wrapper\"><<thumbnail \"\"\"$link$\"\"\" \"\"\"$icon$\"\"\" \"\"\"$color$\"\"\" \"\"\"$background-color$\"\"\" \"\"\"$image$\"\"\" \"\"\"$caption$\"\"\" \"\"\"$width$\"\"\" \"\"\"$height$\"\"\">></div>\n\\end\n\n\\define list-thumbnails(filter,width:\"280\",height:\"157\")\n<$list filter=\"\"\"$filter$\"\"\"><$macrocall $name=\"thumbnail\" link={{!!link}} icon={{!!icon}} color={{!!color}} background-color={{!!background-color}} image={{!!image}} caption={{!!caption}} width=\"\"\"$width$\"\"\" height=\"\"\"$height$\"\"\"/></$list>\n\\end\n"
},
"$:/core/macros/timeline": {
"created": "20141212105914482",
"modified": "20141212110330815",
"tags": "$:/tags/Macro",
"title": "$:/core/macros/timeline",
"type": "text/vnd.tiddlywiki",
"text": "\\define timeline-title()\n<!-- Override this macro with a global macro \n of the same name if you need to change \n how titles are displayed on the timeline \n -->\n<$view field=\"title\"/>\n\\end\n\\define timeline(limit:\"100\",format:\"DDth MMM YYYY\",subfilter:\"\",dateField:\"modified\")\n<div class=\"tc-timeline\">\n<$list filter=\"[!is[system]$subfilter$has[$dateField$]!sort[$dateField$]limit[$limit$]eachday[$dateField$]]\">\n<div class=\"tc-menu-list-item\">\n<$view field=\"$dateField$\" format=\"date\" template=\"$format$\"/>\n<$list filter=\"[sameday:$dateField${!!$dateField$}!is[system]$subfilter$!sort[$dateField$]]\">\n<div class=\"tc-menu-list-subitem\">\n<$link to={{!!title}}>\n<<timeline-title>>\n</$link>\n</div>\n</$list>\n</div>\n</$list>\n</div>\n\\end\n"
},
"$:/core/macros/toc": {
"title": "$:/core/macros/toc",
"tags": "$:/tags/Macro",
"text": "\\define toc-caption()\n<$set name=\"tv-wikilinks\" value=\"no\">\n <$transclude field=\"caption\">\n <$view field=\"title\"/>\n </$transclude>\n</$set>\n\\end\n\n\\define toc-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<ol class=\"tc-toc\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] $exclude$\"\"\">\n <$vars item=<<currentTiddler>> path=\"\"\"$path$/$tag$\"\"\" excluded=\"\"\"$exclude$ -[[$tag$]]\"\"\">\n <$set name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\" emptyValue=\"toc-item\" value=\"toc-item-selected\">\n <li class=<<toc-item-class>>>\n <$list filter=\"[all[current]toc-link[no]]\" emptyMessage=\"<$link><$view field='caption'><$view field='title'/></$view></$link>\">\n <<toc-caption>>\n </$list>\n <$macrocall $name=\"toc-body\" tag=<<item>> sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=<<excluded>> path=<<path>>/>\n </li>\n </$set>\n </$vars>\n </$list>\n</ol>\n\\end\n\n\\define toc(tag,sort:\"\",itemClassFilter:\" \")\n<<toc-body tag:\"\"\"$tag$\"\"\" sort:\"\"\"$sort$\"\"\" itemClassFilter:\"\"\"$itemClassFilter$\"\"\">>\n\\end\n\n\\define toc-linked-expandable-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<!-- helper function -->\n<$set name=\"toc-state\" value=<<qualify \"\"\"$:/state/toc$path$-$(currentTiddler)$\"\"\">>>\n <$set name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\" emptyValue=\"toc-item\" value=\"toc-item-selected\">\n <li class=<<toc-item-class>>>\n <$link>\n <$reveal type=\"nomatch\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible\">\n {{$:/core/images/right-arrow}}\n </$button>\n </$reveal>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible\">\n {{$:/core/images/down-arrow}}\n </$button>\n </$reveal>\n <<toc-caption>>\n </$link>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-expandable\" tag=<<currentTiddler>> sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=\"\"\"$exclude$\"\"\" path=\"\"\"$path$\"\"\"/>\n </$reveal>\n </li>\n </$set>\n</$set>\n\\end\n\n\\define toc-unlinked-expandable-body(tag,sort:\"\",itemClassFilter:\" \",exclude,path)\n<!-- helper function -->\n<$set name=\"toc-state\" value=<<qualify \"\"\"$:/state/toc$path$-$(currentTiddler)$\"\"\">>>\n <$set name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\" emptyValue=\"toc-item\" value=\"toc-item-selected\">\n <li class=<<toc-item-class>>>\n <$reveal type=\"nomatch\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible\">\n {{$:/core/images/right-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible\">\n {{$:/core/images/down-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-expandable\" tag=<<currentTiddler>> sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=\"\"\"$exclude$\"\"\" path=\"\"\"$path$\"\"\"/>\n </$reveal>\n </li>\n </$set>\n</$set>\n\\end\n\n\\define toc-expandable-empty-message()\n<<toc-linked-expandable-body tag:\"\"\"$(tag)$\"\"\" sort:\"\"\"$(sort)$\"\"\" itemClassFilter:\"\"\"$(itemClassFilter)$\"\"\" exclude:\"\"\"$(excluded)$\"\"\" path:\"\"\"$(path)$\"\"\">>\n\\end\n\n\\define toc-expandable(tag,sort:\"\",itemClassFilter:\" \",exclude,path)\n<$vars tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" excluded=\"\"\"$exclude$ -[[$tag$]]\"\"\" path=\"\"\"$path$/$tag$\"\"\">\n <ol class=\"tc-toc toc-expandable\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] $exclude$\"\"\">\n <$list filter=\"[all[current]toc-link[no]]\" emptyMessage=<<toc-expandable-empty-message>> >\n <$macrocall $name=\"toc-unlinked-expandable-body\" tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"itemClassFilter\"\"\" exclude=<<excluded>> path=<<path>> />\n </$list>\n </$list>\n </ol>\n</$vars>\n\\end\n\n\\define toc-linked-selective-expandable-body(tag,sort:\"\",itemClassFilter:\" \",exclude,path)\n<$set name=\"toc-state\" value=<<qualify \"\"\"$:/state/toc$path$-$(currentTiddler)$\"\"\">>>\n <$set name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\" emptyValue=\"toc-item\" value=\"toc-item-selected\" >\n <li class=<<toc-item-class>>>\n <$link>\n <$list filter=\"[all[current]tagging[]limit[1]]\" variable=\"ignore\" emptyMessage=\"<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>\">\n <$reveal type=\"nomatch\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible\">\n {{$:/core/images/right-arrow}}\n </$button>\n </$reveal>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible\">\n {{$:/core/images/down-arrow}}\n </$button>\n </$reveal>\n </$list>\n <<toc-caption>>\n </$link>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-selective-expandable\" tag=<<currentTiddler>> sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=\"\"\"$exclude$\"\"\" path=\"\"\"$path$\"\"\"/>\n </$reveal>\n </li>\n </$set>\n</$set>\n\\end\n\n\\define toc-unlinked-selective-expandable-body(tag,sort:\"\",itemClassFilter:\" \",exclude,path)\n<$set name=\"toc-state\" value=<<qualify \"\"\"$:/state/toc$path$-$(currentTiddler)$\"\"\">>>\n <$set name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\" emptyValue=\"toc-item\" value=\"toc-item-selected\">\n <li class=<<toc-item-class>>>\n <$list filter=\"[all[current]tagging[]limit[1]]\" variable=\"ignore\" emptyMessage=\"<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>\">\n <$reveal type=\"nomatch\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible\">\n {{$:/core/images/right-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$button set=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible\">\n {{$:/core/images/down-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n </$list>\n <$reveal type=\"match\" state=<<toc-state>> text=\"open\">\n <$macrocall $name=\"\"\"toc-selective-expandable\"\"\" tag=<<currentTiddler>> sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=\"\"\"$exclude$\"\"\" path=\"\"\"$path$\"\"\"/>\n </$reveal>\n </li>\n </$set>\n</$set>\n\\end\n\n\\define toc-selective-expandable-empty-message()\n<<toc-linked-selective-expandable-body tag:\"\"\"$(tag)$\"\"\" sort:\"\"\"$(sort)$\"\"\" itemClassFilter:\"\"\"$(itemClassFilter)$\"\"\" exclude:\"\"\"$(excluded)$\"\"\" path:\"\"\"$(path)$\"\"\">>\n\\end\n\n\\define toc-selective-expandable(tag,sort:\"\",itemClassFilter,exclude,path)\n<$vars tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" excluded=\"\"\"$exclude$ -[[$tag$]]\"\"\" path=\"\"\"$path$/$tag$\"\"\">\n <ol class=\"tc-toc toc-selective-expandable\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] $exclude$\"\"\">\n <$list filter=\"[all[current]toc-link[no]]\" variable=\"ignore\" emptyMessage=<<toc-selective-expandable-empty-message>> >\n <$macrocall $name=toc-unlinked-selective-expandable-body tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" itemClassFilter=\"\"\"$itemClassFilter$\"\"\" exclude=<<excluded>> path=<<path>> >\n </$list>\n </$list>\n </ol>\n</$vars>\n\\end\n\n\\define toc-tabbed-selected-item-filter(selectedTiddler)\n[all[current]field:title{$selectedTiddler$}]\n\\end\n\n\\define toc-tabbed-external-nav(tag,sort:\"\",selectedTiddler:\"$:/temp/toc/selectedTiddler\",unselectedText,missingText,template:\"\")\n<$tiddler tiddler={{$selectedTiddler$}}>\n <div class=\"tc-tabbed-table-of-contents\">\n <$linkcatcher to=\"$selectedTiddler$\">\n <div class=\"tc-table-of-contents\">\n <$macrocall $name=\"toc-selective-expandable\" tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" itemClassFilter=<<toc-tabbed-selected-item-filter selectedTiddler:\"\"\"$selectedTiddler$\"\"\">>/>\n </div>\n </$linkcatcher>\n <div class=\"tc-tabbed-table-of-contents-content\">\n <$reveal state=\"\"\"$selectedTiddler$\"\"\" type=\"nomatch\" text=\"\">\n <$transclude mode=\"block\" tiddler=\"$template$\">\n <h1><<toc-caption>></h1>\n <$transclude mode=\"block\">$missingText$</$transclude>\n </$transclude>\n </$reveal>\n <$reveal state=\"\"\"$selectedTiddler$\"\"\" type=\"match\" text=\"\">\n $unselectedText$\n </$reveal>\n </div>\n </div>\n</$tiddler>\n\\end\n\n\\define toc-tabbed-internal-nav(tag,sort:\"\",selectedTiddler:\"$:/temp/toc/selectedTiddler\",unselectedText,missingText,template:\"\")\n<$linkcatcher to=\"\"\"$selectedTiddler$\"\"\">\n <$macrocall $name=\"toc-tabbed-external-nav\" tag=\"\"\"$tag$\"\"\" sort=\"\"\"$sort$\"\"\" selectedTiddler=\"\"\"$selectedTiddler$\"\"\" unselectedText=\"\"\"$unselectedText$\"\"\" missingText=\"\"\"$missingText$\"\"\" template=\"\"\"$template$\"\"\"/>\n</$linkcatcher>\n\\end\n\n"
},
"$:/core/macros/translink": {
"title": "$:/core/macros/translink",
"tags": "$:/tags/Macro",
"text": "\\define translink(title,mode:\"block\")\n<div style=\"border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;\">\n<$link to=\"\"\"$title$\"\"\">\n<$text text=\"\"\"$title$\"\"\"/>\n</$link>\n<div style=\"border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;\">\n<$transclude tiddler=\"\"\"$title$\"\"\" mode=\"$mode$\">\n\"<$text text=\"\"\"$title$\"\"\"/>\" is missing\n</$transclude>\n</div>\n</div>\n\\end\n"
},
"$:/snippets/minilanguageswitcher": {
"title": "$:/snippets/minilanguageswitcher",
"text": "<$select tiddler=\"$:/language\">\n<$list filter=\"[[$:/languages/en-GB]] [plugin-type[language]sort[title]]\">\n<option value=<<currentTiddler>>><$view field=\"description\"><$view field=\"name\"><$view field=\"title\"/></$view></$view></option>\n</$list>\n</$select>"
},
"$:/snippets/minithemeswitcher": {
"title": "$:/snippets/minithemeswitcher",
"text": "\\define lingo-base() $:/language/ControlPanel/Theme/\n<<lingo Prompt>> <$select tiddler=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\">\n<option value=<<currentTiddler>>><$view field=\"name\"><$view field=\"title\"/></$view></option>\n</$list>\n</$select>"
},
"$:/snippets/modules": {
"title": "$:/snippets/modules",
"text": "\\define describeModuleType(type)\n{{$:/language/Docs/ModuleTypes/$type$}}\n\\end\n<$list filter=\"[moduletypes[]]\">\n\n!! <$macrocall $name=\"currentTiddler\" $type=\"text/plain\" $output=\"text/plain\"/>\n\n<$macrocall $name=\"describeModuleType\" type=<<currentTiddler>>/>\n\n<ul><$list filter=\"[all[current]modules[]]\"><li><$link><<currentTiddler>></$link>\n</li>\n</$list>\n</ul>\n</$list>\n"
},
"$:/palette": {
"title": "$:/palette",
"text": "$:/palettes/Vanilla"
},
"$:/snippets/paletteeditor": {
"title": "$:/snippets/paletteeditor",
"text": "\\define lingo-base() $:/language/ControlPanel/Palette/Editor/\n\\define describePaletteColour(colour)\n<$transclude tiddler=\"$:/language/Docs/PaletteColours/$colour$\"><$text text=\"$colour$\"/></$transclude>\n\\end\n<$set name=\"currentTiddler\" value={{$:/palette}}>\n\n<<lingo Prompt>> <$link to={{$:/palette}}><$macrocall $name=\"currentTiddler\" $output=\"text/plain\"/></$link>\n\n<$list filter=\"[all[current]is[shadow]is[tiddler]]\" variable=\"listItem\">\n<<lingo Prompt/Modified>>\n<$button message=\"tm-delete-tiddler\" param={{$:/palette}}><<lingo Reset/Caption>></$button>\n</$list>\n\n<$list filter=\"[all[current]is[shadow]!is[tiddler]]\" variable=\"listItem\">\n<<lingo Clone/Prompt>>\n</$list>\n\n<$button message=\"tm-new-tiddler\" param={{$:/palette}}><<lingo Clone/Caption>></$button>\n\n<table>\n<tbody>\n<$list filter=\"[all[current]indexes[]]\" variable=\"colourName\">\n<tr>\n<td>\n''<$macrocall $name=\"describePaletteColour\" colour=<<colourName>>/>''<br/>\n<$macrocall $name=\"colourName\" $output=\"text/plain\"/>\n</td>\n<td>\n<$edit-text index=<<colourName>> tag=\"input\"/>\n<br>\n<$edit-text index=<<colourName>> type=\"color\" tag=\"input\"/>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n</$set>\n"
},
"$:/snippets/palettepreview": {
"title": "$:/snippets/palettepreview",
"text": "<$set name=\"currentTiddler\" value={{$:/palette}}>\n<$transclude tiddler=\"$:/snippets/currpalettepreview\"/>\n</$set>\n"
},
"$:/snippets/paletteswitcher": {
"title": "$:/snippets/paletteswitcher",
"text": "\\define lingo-base() $:/language/ControlPanel/Palette/\n<div class=\"tc-prompt\">\n<<lingo Prompt>> <$view tiddler={{$:/palette}} field=\"name\"/>\n</div>\n\n<$linkcatcher to=\"$:/palette\">\n<div class=\"tc-chooser\"><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Palette]sort[description]]\"><div class=\"tc-chooser-item\"><$link to={{!!title}}><div><$reveal state=\"$:/palette\" type=\"match\" text={{!!title}}>•</$reveal><$reveal state=\"$:/palette\" type=\"nomatch\" text={{!!title}}> </$reveal> ''<$view field=\"name\" format=\"text\"/>'' - <$view field=\"description\" format=\"text\"/></div><$transclude tiddler=\"$:/snippets/currpalettepreview\"/></$link></div>\n</$list>\n</div>\n</$linkcatcher>"
},
"$:/temp/search": {
"title": "$:/temp/search",
"text": ""
},
"$:/tags/AdvancedSearch": {
"title": "$:/tags/AdvancedSearch",
"list": "[[$:/core/ui/AdvancedSearch/Standard]] [[$:/core/ui/AdvancedSearch/System]] [[$:/core/ui/AdvancedSearch/Shadows]] [[$:/core/ui/AdvancedSearch/Filter]]"
},
"$:/tags/AdvancedSearch/FilterButton": {
"title": "$:/tags/AdvancedSearch/FilterButton",
"list": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown $:/core/ui/AdvancedSearch/Filter/FilterButtons/clear $:/core/ui/AdvancedSearch/Filter/FilterButtons/export $:/core/ui/AdvancedSearch/Filter/FilterButtons/delete"
},
"$:/tags/ControlPanel": {
"title": "$:/tags/ControlPanel",
"list": "$:/core/ui/ControlPanel/Info $:/core/ui/ControlPanel/Appearance $:/core/ui/ControlPanel/Settings $:/core/ui/ControlPanel/Saving $:/core/ui/ControlPanel/Plugins $:/core/ui/ControlPanel/Tools $:/core/ui/ControlPanel/Internals"
},
"$:/tags/ControlPanel/Info": {
"title": "$:/tags/ControlPanel/Info",
"list": "$:/core/ui/ControlPanel/Basics $:/core/ui/ControlPanel/Advanced"
},
"$:/tags/ControlPanel/Plugins": {
"title": "$:/tags/ControlPanel/Plugins",
"list": "[[$:/core/ui/ControlPanel/Plugins/Installed]] [[$:/core/ui/ControlPanel/Plugins/Add]]"
},
"$:/tags/EditTemplate": {
"title": "$:/tags/EditTemplate",
"list": "[[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/shadow]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]"
},
"$:/tags/EditToolbar": {
"title": "$:/tags/EditToolbar",
"list": "[[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/cancel]] [[$:/core/ui/Buttons/save]]"
},
"$:/tags/EditorToolbar": {
"title": "$:/tags/EditorToolbar",
"list": "$:/core/ui/EditorToolbar/paint $:/core/ui/EditorToolbar/opacity $:/core/ui/EditorToolbar/line-width $:/core/ui/EditorToolbar/clear $:/core/ui/EditorToolbar/bold $:/core/ui/EditorToolbar/italic $:/core/ui/EditorToolbar/strikethrough $:/core/ui/EditorToolbar/underline $:/core/ui/EditorToolbar/superscript $:/core/ui/EditorToolbar/subscript $:/core/ui/EditorToolbar/mono-line $:/core/ui/EditorToolbar/mono-block $:/core/ui/EditorToolbar/quote $:/core/ui/EditorToolbar/list-bullet $:/core/ui/EditorToolbar/list-number $:/core/ui/EditorToolbar/heading-1 $:/core/ui/EditorToolbar/heading-2 $:/core/ui/EditorToolbar/heading-3 $:/core/ui/EditorToolbar/heading-4 $:/core/ui/EditorToolbar/heading-5 $:/core/ui/EditorToolbar/heading-6 $:/core/ui/EditorToolbar/link $:/core/ui/EditorToolbar/excise $:/core/ui/EditorToolbar/picture $:/core/ui/EditorToolbar/stamp $:/core/ui/EditorToolbar/size $:/core/ui/EditorToolbar/editor-height $:/core/ui/EditorToolbar/more $:/core/ui/EditorToolbar/preview $:/core/ui/EditorToolbar/preview-type"
},
"$:/tags/Manager/ItemMain": {
"title": "$:/tags/Manager/ItemMain",
"list": "$:/Manager/ItemMain/WikifiedText $:/Manager/ItemMain/RawText $:/Manager/ItemMain/Fields"
},
"$:/tags/Manager/ItemSidebar": {
"title": "$:/tags/Manager/ItemSidebar",
"list": "$:/Manager/ItemSidebar/Tags $:/Manager/ItemSidebar/Colour $:/Manager/ItemSidebar/Icon $:/Manager/ItemSidebar/Tools"
},
"$:/tags/MoreSideBar": {
"title": "$:/tags/MoreSideBar",
"list": "[[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] [[$:/core/ui/MoreSideBar/Plugins]]",
"text": ""
},
"$:/tags/PageControls": {
"title": "$:/tags/PageControls",
"list": "[[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]"
},
"$:/tags/PageTemplate": {
"title": "$:/tags/PageTemplate",
"list": "[[$:/core/ui/PageTemplate/topleftbar]] [[$:/core/ui/PageTemplate/toprightbar]] [[$:/core/ui/PageTemplate/sidebar]] [[$:/core/ui/PageTemplate/story]] [[$:/core/ui/PageTemplate/alerts]]",
"text": ""
},
"$:/tags/SideBar": {
"title": "$:/tags/SideBar",
"list": "[[$:/core/ui/SideBar/Open]] [[$:/core/ui/SideBar/Recent]] [[$:/core/ui/SideBar/Tools]] [[$:/core/ui/SideBar/More]]",
"text": ""
},
"$:/tags/TiddlerInfo": {
"title": "$:/tags/TiddlerInfo",
"list": "[[$:/core/ui/TiddlerInfo/Tools]] [[$:/core/ui/TiddlerInfo/References]] [[$:/core/ui/TiddlerInfo/Tagging]] [[$:/core/ui/TiddlerInfo/List]] [[$:/core/ui/TiddlerInfo/Listed]] [[$:/core/ui/TiddlerInfo/Fields]]",
"text": ""
},
"$:/tags/TiddlerInfo/Advanced": {
"title": "$:/tags/TiddlerInfo/Advanced",
"list": "[[$:/core/ui/TiddlerInfo/Advanced/ShadowInfo]] [[$:/core/ui/TiddlerInfo/Advanced/PluginInfo]]"
},
"$:/tags/ViewTemplate": {
"title": "$:/tags/ViewTemplate",
"list": "[[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/unfold]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/ViewTemplate/body]]"
},
"$:/tags/ViewToolbar": {
"title": "$:/tags/ViewToolbar",
"list": "[[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]] [[$:/core/ui/Buttons/fold-others]] [[$:/core/ui/Buttons/fold]]"
},
"$:/snippets/themeswitcher": {
"title": "$:/snippets/themeswitcher",
"text": "\\define lingo-base() $:/language/ControlPanel/Theme/\n<<lingo Prompt>> <$view tiddler={{$:/theme}} field=\"name\"/>\n\n<$linkcatcher to=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\"><div><$reveal state=\"$:/theme\" type=\"match\" text={{!!title}}>•</$reveal><$reveal state=\"$:/theme\" type=\"nomatch\" text={{!!title}}> </$reveal> <$link to={{!!title}}>''<$view field=\"name\" format=\"text\"/>'' <$view field=\"description\" format=\"text\"/></$link></div>\n</$list>\n</$linkcatcher>"
},
"$:/core/wiki/title": {
"title": "$:/core/wiki/title",
"type": "text/vnd.tiddlywiki",
"text": "{{$:/SiteTitle}} --- {{$:/SiteSubtitle}}"
},
"$:/view": {
"title": "$:/view",
"text": "classic"
},
"$:/snippets/viewswitcher": {
"title": "$:/snippets/viewswitcher",
"text": "\\define lingo-base() $:/language/ControlPanel/StoryView/\n<<lingo Prompt>> <$select tiddler=\"$:/view\">\n<$list filter=\"[storyviews[]]\">\n<option><$view field=\"title\"/></option>\n</$list>\n</$select>"
}
}
}
[[Eve tiddlywiki plugin]]
[[Storing eve state in tiddlers]]
counter.eve
{
"tiddlers": {
"$:/plugins/tiddlywiki/markdown/EditorToolbar/bold": {
"title": "$:/plugins/tiddlywiki/markdown/EditorToolbar/bold",
"list-after": "$:/core/ui/EditorToolbar/bold",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/bold",
"caption": "{{$:/language/Buttons/Bold/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Bold/Hint}}",
"condition": "[<targetTiddler>type[text/x-markdown]]",
"shortcuts": "((bold))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"**\"\n\tsuffix=\"**\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-1": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-1",
"list-after": "$:/core/ui/EditorToolbar/heading-1",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-1",
"caption": "{{$:/language/Buttons/Heading1/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading1/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-1))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"1\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-2": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-2",
"list-after": "$:/core/ui/EditorToolbar/heading-2",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-2",
"caption": "{{$:/language/Buttons/Heading2/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading2/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-2))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"2\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-3": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-3",
"list-after": "$:/core/ui/EditorToolbar/heading-3",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-3",
"caption": "{{$:/language/Buttons/Heading3/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading3/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-3))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"3\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-4": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-4",
"list-after": "$:/core/ui/EditorToolbar/heading-4",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-4",
"caption": "{{$:/language/Buttons/Heading4/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading4/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-4))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"4\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-5": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-5",
"list-after": "$:/core/ui/EditorToolbar/heading-5",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-5",
"caption": "{{$:/language/Buttons/Heading5/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading5/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-5))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"5\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/heading-6": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/heading-6",
"list-after": "$:/core/ui/EditorToolbar/heading-6",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-6",
"caption": "{{$:/language/Buttons/Heading6/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Heading6/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((heading-6))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"6\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/italic": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/italic",
"list-after": "$:/core/ui/EditorToolbar/italic",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/italic",
"caption": "{{$:/language/Buttons/Italic/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Italic/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((italic))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"*\"\n\tsuffix=\"*\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/list-bullet": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/list-bullet",
"list-after": "$:/core/ui/EditorToolbar/list-bullet",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-bullet",
"caption": "{{$:/language/Buttons/ListBullet/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/ListBullet/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((list-bullet))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"*\"\n\tcount=\"1\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/list-number": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/list-number",
"list-after": "$:/core/ui/EditorToolbar/list-number",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-number",
"caption": "{{$:/language/Buttons/ListNumber/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/ListNumber/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((list-number))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"1.\"\n\tcount=\"1\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/mono-line": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/mono-line",
"list-after": "$:/core/ui/EditorToolbar/mono-line",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/mono-line",
"caption": "{{$:/language/Buttons/MonoLine/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/MonoLine/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((mono-line))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"`\"\n\tsuffix=\"`\"\n/>\n"
},
"$:/plugins/btheado/markdown/EditorToolbar/quote": {
"title": "$:/plugins/btheado/markdown/EditorToolbar/quote",
"list-after": "$:/core/ui/EditorToolbar/quote",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/quote",
"caption": "{{$:/language/Buttons/Quote/Caption}} (Markdown)",
"description": "{{$:/language/Buttons/Quote/Hint}}",
"condition": "[<targetTiddler>type[text/x-gfm]]",
"shortcuts": "((quote))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\">\"\n\tcount=\"1\"\n/>\n"
},
"$:/language/Docs/Types/text/x-gfm": {
"title": "$:/language/Docs/Types/text/x-gfm",
"description": "Github Flavored Markdown",
"name": "text/x-gfm",
"group": "Text"
},
"$:/plugins/btheado/markdown/markdown-it.js": {
"text": "/*! markdown-it 8.3.1 https://github.com//markdown-it/markdown-it @license MIT */\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var r;r=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this,r.markdownit=e()}}(function(){var e;return function e(r,t,n){function s(i,a){if(!t[i]){if(!r[i]){var c=\"function\"==typeof require&&require;if(!a&&c)return c(i,!0);if(o)return o(i,!0);var l=new Error(\"Cannot find module '\"+i+\"'\");throw l.code=\"MODULE_NOT_FOUND\",l}var u=t[i]={exports:{}};r[i][0].call(u.exports,function(e){var t=r[i][1][e];return s(t?t:e)},u,u.exports,e,r,t,n)}return t[i].exports}for(var o=\"function\"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(e,r,t){\"use strict\";r.exports=e(\"entities/maps/entities.json\")},{\"entities/maps/entities.json\":52}],2:[function(e,r,t){\"use strict\";r.exports=[\"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\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hr\",\"html\",\"iframe\",\"legend\",\"li\",\"link\",\"main\",\"menu\",\"menuitem\",\"meta\",\"nav\",\"noframes\",\"ol\",\"optgroup\",\"option\",\"p\",\"param\",\"pre\",\"section\",\"source\",\"title\",\"summary\",\"table\",\"tbody\",\"td\",\"tfoot\",\"th\",\"thead\",\"title\",\"tr\",\"track\",\"ul\"]},{}],3:[function(e,r,t){\"use strict\";var n=\"<[A-Za-z][A-Za-z0-9\\\\-]*(?:\\\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\\\s*=\\\\s*(?:[^\\\"'=<>`\\\\x00-\\\\x20]+|'[^']*'|\\\"[^\\\"]*\\\"))?)*\\\\s*\\\\/?>\",s=\"<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>\",o=new RegExp(\"^(?:\"+n+\"|\"+s+\"|<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->|<[?].*?[?]>|<![A-Z]+\\\\s+[^>]*>|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>)\"),i=new RegExp(\"^(?:\"+n+\"|\"+s+\")\");r.exports.HTML_TAG_RE=o,r.exports.HTML_OPEN_CLOSE_TAG_RE=i},{}],4:[function(e,r,t){\"use strict\";function n(e){return Object.prototype.toString.call(e)}function s(e){return\"[object String]\"===n(e)}function o(e,r){return y.call(e,r)}function i(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(r){if(\"object\"!=typeof r)throw new TypeError(r+\"must be object\");Object.keys(r).forEach(function(t){e[t]=r[t]})}}),e}function a(e,r,t){return[].concat(e.slice(0,r),t,e.slice(r+1))}function c(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var r=55296+(e>>10),t=56320+(1023&e);return String.fromCharCode(r,t)}return String.fromCharCode(e)}function u(e,r){var t=0;return o(w,r)?w[r]:35===r.charCodeAt(0)&&A.test(r)&&(t=\"x\"===r[1].toLowerCase()?parseInt(r.slice(2),16):parseInt(r.slice(1),10),c(t))?l(t):e}function p(e){return e.indexOf(\"\\\\\")<0?e:e.replace(x,\"$1\")}function h(e){return e.indexOf(\"\\\\\")<0&&e.indexOf(\"&\")<0?e:e.replace(C,function(e,r,t){return r?r:u(e,t)})}function f(e){return q[e]}function d(e){return D.test(e)?e.replace(/[&<>\"]/g,f):e}function m(e){return e.replace(/[.?*+^$[\\]\\\\(){}|-]/g,\"\\\\$&\")}function _(e){switch(e){case 9:case 32:return!0}return!1}function g(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function b(e){return E.test(e)}function k(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function v(e){return e.trim().replace(/\\s+/g,\" \").toUpperCase()}var y=Object.prototype.hasOwnProperty,x=/\\\\([!\"#$%&'()*+,\\-.\\/:;<=>?@[\\\\\\]^_`{|}~])/g,C=new RegExp(x.source+\"|\"+/&([a-z#][a-z0-9]{1,31});/gi.source,\"gi\"),A=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,w=e(\"./entities\"),D=/[&<>\"]/,q={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\"},E=e(\"uc.micro/categories/P/regex\");t.lib={},t.lib.mdurl=e(\"mdurl\"),t.lib.ucmicro=e(\"uc.micro\"),t.assign=i,t.isString=s,t.has=o,t.unescapeMd=p,t.unescapeAll=h,t.isValidEntityCode=c,t.fromCodePoint=l,t.escapeHtml=d,t.arrayReplaceAt=a,t.isSpace=_,t.isWhiteSpace=g,t.isMdAsciiPunct=k,t.isPunctChar=b,t.escapeRE=m,t.normalizeReference=v},{\"./entities\":1,mdurl:58,\"uc.micro\":65,\"uc.micro/categories/P/regex\":63}],5:[function(e,r,t){\"use strict\";t.parseLinkLabel=e(\"./parse_link_label\"),t.parseLinkDestination=e(\"./parse_link_destination\"),t.parseLinkTitle=e(\"./parse_link_title\")},{\"./parse_link_destination\":6,\"./parse_link_label\":7,\"./parse_link_title\":8}],6:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").isSpace,s=e(\"../common/utils\").unescapeAll;r.exports=function(e,r,t){var o,i,a=r,c={ok:!1,pos:0,lines:0,str:\"\"};if(60===e.charCodeAt(r)){for(r++;r<t;){if(10===(o=e.charCodeAt(r))||n(o))return c;if(62===o)return c.pos=r+1,c.str=s(e.slice(a+1,r)),c.ok=!0,c;92===o&&r+1<t?r+=2:r++}return c}for(i=0;r<t&&32!==(o=e.charCodeAt(r))&&!(o<32||127===o);)if(92===o&&r+1<t)r+=2;else{if(40===o&&++i>1)break;if(41===o&&--i<0)break;r++}return a===r?c:(c.str=s(e.slice(a,r)),c.lines=0,c.pos=r,c.ok=!0,c)}},{\"../common/utils\":4}],7:[function(e,r,t){\"use strict\";r.exports=function(e,r,t){var n,s,o,i,a=-1,c=e.posMax,l=e.pos;for(e.pos=r+1,n=1;e.pos<c;){if(93===(o=e.src.charCodeAt(e.pos))&&0===--n){s=!0;break}if(i=e.pos,e.md.inline.skipToken(e),91===o)if(i===e.pos-1)n++;else if(t)return e.pos=l,-1}return s&&(a=e.pos),e.pos=l,a}},{}],8:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").unescapeAll;r.exports=function(e,r,t){var s,o,i=0,a=r,c={ok:!1,pos:0,lines:0,str:\"\"};if(r>=t)return c;if(34!==(o=e.charCodeAt(r))&&39!==o&&40!==o)return c;for(r++,40===o&&(o=41);r<t;){if((s=e.charCodeAt(r))===o)return c.pos=r+1,c.lines=i,c.str=n(e.slice(a+1,r)),c.ok=!0,c;10===s?i++:92===s&&r+1<t&&(r++,10===e.charCodeAt(r)&&i++),r++}return c}},{\"../common/utils\":4}],9:[function(e,r,t){\"use strict\";function n(e){var r=e.trim().toLowerCase();return!g.test(r)||!!b.test(r)}function s(e){var r=d.parse(e,!0);if(r.hostname&&(!r.protocol||k.indexOf(r.protocol)>=0))try{r.hostname=m.toASCII(r.hostname)}catch(e){}return d.encode(d.format(r))}function o(e){var r=d.parse(e,!0);if(r.hostname&&(!r.protocol||k.indexOf(r.protocol)>=0))try{r.hostname=m.toUnicode(r.hostname)}catch(e){}return d.decode(d.format(r))}function i(e,r){if(!(this instanceof i))return new i(e,r);r||a.isString(e)||(r=e||{},e=\"default\"),this.inline=new h,this.block=new p,this.core=new u,this.renderer=new l,this.linkify=new f,this.validateLink=n,this.normalizeLink=s,this.normalizeLinkText=o,this.utils=a,this.helpers=a.assign({},c),this.options={},this.configure(e),r&&this.set(r)}var a=e(\"./common/utils\"),c=e(\"./helpers\"),l=e(\"./renderer\"),u=e(\"./parser_core\"),p=e(\"./parser_block\"),h=e(\"./parser_inline\"),f=e(\"linkify-it\"),d=e(\"mdurl\"),m=e(\"punycode\"),_={default:e(\"./presets/default\"),zero:e(\"./presets/zero\"),commonmark:e(\"./presets/commonmark\")},g=/^(vbscript|javascript|file|data):/,b=/^data:image\\/(gif|png|jpeg|webp);/,k=[\"http:\",\"https:\",\"mailto:\"];i.prototype.set=function(e){return a.assign(this.options,e),this},i.prototype.configure=function(e){var r,t=this;if(a.isString(e)&&(r=e,!(e=_[r])))throw new Error('Wrong `markdown-it` preset \"'+r+'\", check name');if(!e)throw new Error(\"Wrong `markdown-it` preset, can't be empty\");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)}),this},i.prototype.enable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),[\"core\",\"block\",\"inline\"].forEach(function(r){t=t.concat(this[r].ruler.enable(e,!0))},this),t=t.concat(this.inline.ruler2.enable(e,!0));var n=e.filter(function(e){return t.indexOf(e)<0});if(n.length&&!r)throw new Error(\"MarkdownIt. Failed to enable unknown rule(s): \"+n);return this},i.prototype.disable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),[\"core\",\"block\",\"inline\"].forEach(function(r){t=t.concat(this[r].ruler.disable(e,!0))},this),t=t.concat(this.inline.ruler2.disable(e,!0));var n=e.filter(function(e){return t.indexOf(e)<0});if(n.length&&!r)throw new Error(\"MarkdownIt. Failed to disable unknown rule(s): \"+n);return this},i.prototype.use=function(e){var r=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,r),this},i.prototype.parse=function(e,r){if(\"string\"!=typeof e)throw new Error(\"Input data should be a String\");var t=new this.core.State(e,this,r);return this.core.process(t),t.tokens},i.prototype.render=function(e,r){return r=r||{},this.renderer.render(this.parse(e,r),this.options,r)},i.prototype.parseInline=function(e,r){var t=new this.core.State(e,this,r);return t.inlineMode=!0,this.core.process(t),t.tokens},i.prototype.renderInline=function(e,r){return r=r||{},this.renderer.render(this.parseInline(e,r),this.options,r)},r.exports=i},{\"./common/utils\":4,\"./helpers\":5,\"./parser_block\":10,\"./parser_core\":11,\"./parser_inline\":12,\"./presets/commonmark\":13,\"./presets/default\":14,\"./presets/zero\":15,\"./renderer\":16,\"linkify-it\":53,mdurl:58,punycode:60}],10:[function(e,r,t){\"use strict\";function n(){this.ruler=new s;for(var e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1],{alt:(o[e][2]||[]).slice()})}var s=e(\"./ruler\"),o=[[\"table\",e(\"./rules_block/table\"),[\"paragraph\",\"reference\"]],[\"code\",e(\"./rules_block/code\")],[\"fence\",e(\"./rules_block/fence\"),[\"paragraph\",\"reference\",\"blockquote\",\"list\"]],[\"blockquote\",e(\"./rules_block/blockquote\"),[\"paragraph\",\"reference\",\"list\"]],[\"hr\",e(\"./rules_block/hr\"),[\"paragraph\",\"reference\",\"blockquote\",\"list\"]],[\"list\",e(\"./rules_block/list\"),[\"paragraph\",\"reference\",\"blockquote\"]],[\"reference\",e(\"./rules_block/reference\")],[\"heading\",e(\"./rules_block/heading\"),[\"paragraph\",\"reference\",\"blockquote\"]],[\"lheading\",e(\"./rules_block/lheading\")],[\"html_block\",e(\"./rules_block/html_block\"),[\"paragraph\",\"reference\",\"blockquote\"]],[\"paragraph\",e(\"./rules_block/paragraph\")]];n.prototype.tokenize=function(e,r,t){for(var n,s=this.ruler.getRules(\"\"),o=s.length,i=r,a=!1,c=e.md.options.maxNesting;i<t&&(e.line=i=e.skipEmptyLines(i),!(i>=t))&&!(e.sCount[i]<e.blkIndent);){if(e.level>=c){e.line=t;break}for(n=0;n<o&&!s[n](e,i,t,!1);n++);e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),(i=e.line)<t&&e.isEmpty(i)&&(a=!0,i++,e.line=i)}},n.prototype.parse=function(e,r,t,n){var s;e&&(s=new this.State(e,r,t,n),this.tokenize(s,s.line,s.lineMax))},n.prototype.State=e(\"./rules_block/state_block\"),r.exports=n},{\"./ruler\":17,\"./rules_block/blockquote\":18,\"./rules_block/code\":19,\"./rules_block/fence\":20,\"./rules_block/heading\":21,\"./rules_block/hr\":22,\"./rules_block/html_block\":23,\"./rules_block/lheading\":24,\"./rules_block/list\":25,\"./rules_block/paragraph\":26,\"./rules_block/reference\":27,\"./rules_block/state_block\":28,\"./rules_block/table\":29}],11:[function(e,r,t){\"use strict\";function n(){this.ruler=new s;for(var e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1])}var s=e(\"./ruler\"),o=[[\"normalize\",e(\"./rules_core/normalize\")],[\"block\",e(\"./rules_core/block\")],[\"inline\",e(\"./rules_core/inline\")],[\"linkify\",e(\"./rules_core/linkify\")],[\"replacements\",e(\"./rules_core/replacements\")],[\"smartquotes\",e(\"./rules_core/smartquotes\")]];n.prototype.process=function(e){var r,t,n;for(n=this.ruler.getRules(\"\"),r=0,t=n.length;r<t;r++)n[r](e)},n.prototype.State=e(\"./rules_core/state_core\"),r.exports=n},{\"./ruler\":17,\"./rules_core/block\":30,\"./rules_core/inline\":31,\"./rules_core/linkify\":32,\"./rules_core/normalize\":33,\"./rules_core/replacements\":34,\"./rules_core/smartquotes\":35,\"./rules_core/state_core\":36}],12:[function(e,r,t){\"use strict\";function n(){var e;for(this.ruler=new s,e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1]);for(this.ruler2=new s,e=0;e<i.length;e++)this.ruler2.push(i[e][0],i[e][1])}var s=e(\"./ruler\"),o=[[\"text\",e(\"./rules_inline/text\")],[\"newline\",e(\"./rules_inline/newline\")],[\"escape\",e(\"./rules_inline/escape\")],[\"backticks\",e(\"./rules_inline/backticks\")],[\"strikethrough\",e(\"./rules_inline/strikethrough\").tokenize],[\"emphasis\",e(\"./rules_inline/emphasis\").tokenize],[\"link\",e(\"./rules_inline/link\")],[\"image\",e(\"./rules_inline/image\")],[\"autolink\",e(\"./rules_inline/autolink\")],[\"html_inline\",e(\"./rules_inline/html_inline\")],[\"entity\",e(\"./rules_inline/entity\")]],i=[[\"balance_pairs\",e(\"./rules_inline/balance_pairs\")],[\"strikethrough\",e(\"./rules_inline/strikethrough\").postProcess],[\"emphasis\",e(\"./rules_inline/emphasis\").postProcess],[\"text_collapse\",e(\"./rules_inline/text_collapse\")]];n.prototype.skipToken=function(e){var r,t,n=e.pos,s=this.ruler.getRules(\"\"),o=s.length,i=e.md.options.maxNesting,a=e.cache;if(void 0!==a[n])return void(e.pos=a[n]);if(e.level<i)for(t=0;t<o&&(e.level++,r=s[t](e,!0),e.level--,!r);t++);else e.pos=e.posMax;r||e.pos++,a[n]=e.pos},n.prototype.tokenize=function(e){for(var r,t,n=this.ruler.getRules(\"\"),s=n.length,o=e.posMax,i=e.md.options.maxNesting;e.pos<o;){if(e.level<i)for(t=0;t<s&&!(r=n[t](e,!1));t++);if(r){if(e.pos>=o)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},n.prototype.parse=function(e,r,t,n){var s,o,i,a=new this.State(e,r,t,n);for(this.tokenize(a),o=this.ruler2.getRules(\"\"),i=o.length,s=0;s<i;s++)o[s](a)},n.prototype.State=e(\"./rules_inline/state_inline\"),r.exports=n},{\"./ruler\":17,\"./rules_inline/autolink\":37,\"./rules_inline/backticks\":38,\"./rules_inline/balance_pairs\":39,\"./rules_inline/emphasis\":40,\"./rules_inline/entity\":41,\"./rules_inline/escape\":42,\"./rules_inline/html_inline\":43,\"./rules_inline/image\":44,\"./rules_inline/link\":45,\"./rules_inline/newline\":46,\"./rules_inline/state_inline\":47,\"./rules_inline/strikethrough\":48,\"./rules_inline/text\":49,\"./rules_inline/text_collapse\":50}],13:[function(e,r,t){\"use strict\";r.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:\"language-\",linkify:!1,typographer:!1,quotes:\"\\u201c\\u201d\\u2018\\u2019\",highlight:null,maxNesting:20},components:{core:{rules:[\"normalize\",\"block\",\"inline\"]},block:{rules:[\"blockquote\",\"code\",\"fence\",\"heading\",\"hr\",\"html_block\",\"lheading\",\"list\",\"reference\",\"paragraph\"]},inline:{rules:[\"autolink\",\"backticks\",\"emphasis\",\"entity\",\"escape\",\"html_inline\",\"image\",\"link\",\"newline\",\"text\"],rules2:[\"balance_pairs\",\"emphasis\",\"text_collapse\"]}}}},{}],14:[function(e,r,t){\"use strict\";r.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:\"language-\",linkify:!1,typographer:!1,quotes:\"\\u201c\\u201d\\u2018\\u2019\",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},{}],15:[function(e,r,t){\"use strict\";r.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:\"language-\",linkify:!1,typographer:!1,quotes:\"\\u201c\\u201d\\u2018\\u2019\",highlight:null,maxNesting:20},components:{core:{rules:[\"normalize\",\"block\",\"inline\"]},block:{rules:[\"paragraph\"]},inline:{rules:[\"text\"],rules2:[\"balance_pairs\",\"text_collapse\"]}}}},{}],16:[function(e,r,t){\"use strict\";function n(){this.rules=s({},a)}var s=e(\"./common/utils\").assign,o=e(\"./common/utils\").unescapeAll,i=e(\"./common/utils\").escapeHtml,a={};a.code_inline=function(e,r,t,n,s){var o=e[r];return\"<code\"+s.renderAttrs(o)+\">\"+i(e[r].content)+\"</code>\"},a.code_block=function(e,r,t,n,s){var o=e[r];return\"<pre\"+s.renderAttrs(o)+\"><code>\"+i(e[r].content)+\"</code></pre>\\n\"},a.fence=function(e,r,t,n,s){var a,c,l,u,p=e[r],h=p.info?o(p.info).trim():\"\",f=\"\";return h&&(f=h.split(/\\s+/g)[0]),a=t.highlight?t.highlight(p.content,f)||i(p.content):i(p.content),0===a.indexOf(\"<pre\")?a+\"\\n\":h?(c=p.attrIndex(\"class\"),l=p.attrs?p.attrs.slice():[],c<0?l.push([\"class\",t.langPrefix+f]):l[c][1]+=\" \"+t.langPrefix+f,u={attrs:l},\"<pre><code\"+s.renderAttrs(u)+\">\"+a+\"</code></pre>\\n\"):\"<pre><code\"+s.renderAttrs(p)+\">\"+a+\"</code></pre>\\n\"},a.image=function(e,r,t,n,s){var o=e[r];return o.attrs[o.attrIndex(\"alt\")][1]=s.renderInlineAsText(o.children,t,n),s.renderToken(e,r,t)},a.hardbreak=function(e,r,t){return t.xhtmlOut?\"<br />\\n\":\"<br>\\n\"},a.softbreak=function(e,r,t){return t.breaks?t.xhtmlOut?\"<br />\\n\":\"<br>\\n\":\"\\n\"},a.text=function(e,r){return i(e[r].content)},a.html_block=function(e,r){return e[r].content},a.html_inline=function(e,r){return e[r].content},n.prototype.renderAttrs=function(e){var r,t,n;if(!e.attrs)return\"\";for(n=\"\",r=0,t=e.attrs.length;r<t;r++)n+=\" \"+i(e.attrs[r][0])+'=\"'+i(e.attrs[r][1])+'\"';return n},n.prototype.renderToken=function(e,r,t){var n,s=\"\",o=!1,i=e[r];return i.hidden?\"\":(i.block&&i.nesting!==-1&&r&&e[r-1].hidden&&(s+=\"\\n\"),s+=(i.nesting===-1?\"</\":\"<\")+i.tag,s+=this.renderAttrs(i),0===i.nesting&&t.xhtmlOut&&(s+=\" /\"),i.block&&(o=!0,1===i.nesting&&r+1<e.length&&(n=e[r+1],\"inline\"===n.type||n.hidden?o=!1:n.nesting===-1&&n.tag===i.tag&&(o=!1))),s+=o?\">\\n\":\">\")},n.prototype.renderInline=function(e,r,t){for(var n,s=\"\",o=this.rules,i=0,a=e.length;i<a;i++)n=e[i].type,s+=void 0!==o[n]?o[n](e,i,r,t,this):this.renderToken(e,i,r);return s},n.prototype.renderInlineAsText=function(e,r,t){for(var n=\"\",s=0,o=e.length;s<o;s++)\"text\"===e[s].type?n+=e[s].content:\"image\"===e[s].type&&(n+=this.renderInlineAsText(e[s].children,r,t));return n},n.prototype.render=function(e,r,t){var n,s,o,i=\"\",a=this.rules;for(n=0,s=e.length;n<s;n++)o=e[n].type,i+=\"inline\"===o?this.renderInline(e[n].children,r,t):void 0!==a[o]?a[e[n].type](e,n,r,t,this):this.renderToken(e,n,r,t);return i},r.exports=n},{\"./common/utils\":4}],17:[function(e,r,t){\"use strict\";function n(){this.__rules__=[],this.__cache__=null}n.prototype.__find__=function(e){for(var r=0;r<this.__rules__.length;r++)if(this.__rules__[r].name===e)return r;return-1},n.prototype.__compile__=function(){var e=this,r=[\"\"];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){r.indexOf(e)<0&&r.push(e)})}),e.__cache__={},r.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(t){t.enabled&&(r&&t.alt.indexOf(r)<0||e.__cache__[r].push(t.fn))})})},n.prototype.at=function(e,r,t){var n=this.__find__(e),s=t||{};if(n===-1)throw new Error(\"Parser rule not found: \"+e);this.__rules__[n].fn=r,this.__rules__[n].alt=s.alt||[],this.__cache__=null},n.prototype.before=function(e,r,t,n){var s=this.__find__(e),o=n||{};if(s===-1)throw new Error(\"Parser rule not found: \"+e);this.__rules__.splice(s,0,{name:r,enabled:!0,fn:t,alt:o.alt||[]}),this.__cache__=null},n.prototype.after=function(e,r,t,n){var s=this.__find__(e),o=n||{};if(s===-1)throw new Error(\"Parser rule not found: \"+e);this.__rules__.splice(s+1,0,{name:r,enabled:!0,fn:t,alt:o.alt||[]}),this.__cache__=null},n.prototype.push=function(e,r,t){var n=t||{};this.__rules__.push({name:e,enabled:!0,fn:r,alt:n.alt||[]}),this.__cache__=null},n.prototype.enable=function(e,r){Array.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e){var n=this.__find__(e);if(n<0){if(r)return;throw new Error(\"Rules manager: invalid rule name \"+e)}this.__rules__[n].enabled=!0,t.push(e)},this),this.__cache__=null,t},n.prototype.enableOnly=function(e,r){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,r)},n.prototype.disable=function(e,r){Array.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e){var n=this.__find__(e);if(n<0){if(r)return;throw new Error(\"Rules manager: invalid rule name \"+e)}this.__rules__[n].enabled=!1,t.push(e)},this),this.__cache__=null,t},n.prototype.getRules=function(e){return null===this.__cache__&&this.__compile__(),this.__cache__[e]||[]},r.exports=n},{}],18:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,y,x,C,A,w=e.lineMax,D=e.bMarks[r]+e.tShift[r],q=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(62!==e.src.charCodeAt(D++))return!1;if(s)return!0;for(c=d=e.sCount[r]+D-(e.bMarks[r]+e.tShift[r]),32===e.src.charCodeAt(D)?(D++,c++,d++,o=!1,y=!0):9===e.src.charCodeAt(D)?(y=!0,(e.bsCount[r]+d)%4==3?(D++,c++,d++,o=!1):o=!0):y=!1,m=[e.bMarks[r]],e.bMarks[r]=D;D<q&&(i=e.src.charCodeAt(D),n(i));)9===i?d+=4-(d+e.bsCount[r]+(o?1:0))%4:d++,D++;for(_=[e.bsCount[r]],e.bsCount[r]=e.sCount[r]+1+(y?1:0),p=D>=q,k=[e.sCount[r]],e.sCount[r]=d-c,v=[e.tShift[r]],e.tShift[r]=D-e.bMarks[r],C=e.md.block.ruler.getRules(\"blockquote\"),b=e.parentType,e.parentType=\"blockquote\",f=r+1;f<t&&(l=e.sCount[f]<e.blkIndent,D=e.bMarks[f]+e.tShift[f],q=e.eMarks[f],!(D>=q));f++)if(62!==e.src.charCodeAt(D++)||l){if(p)break;for(x=!1,a=0,u=C.length;a<u;a++)if(C[a](e,f,t,!0)){x=!0;break}if(x){e.lineMax=f,0!==e.blkIndent&&(m.push(e.bMarks[f]),_.push(e.bsCount[f]),v.push(e.tShift[f]),k.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}if(l)break;m.push(e.bMarks[f]),_.push(e.bsCount[f]),v.push(e.tShift[f]),k.push(e.sCount[f]),e.sCount[f]=-1}else{for(c=d=e.sCount[f]+D-(e.bMarks[f]+e.tShift[f]),32===e.src.charCodeAt(D)?(D++,c++,d++,o=!1,y=!0):9===e.src.charCodeAt(D)?(y=!0,(e.bsCount[f]+d)%4==3?(D++,c++,d++,o=!1):o=!0):y=!1,m.push(e.bMarks[f]),e.bMarks[f]=D;D<q&&(i=e.src.charCodeAt(D),n(i));)9===i?d+=4-(d+e.bsCount[f]+(o?1:0))%4:d++,D++;p=D>=q,_.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(y?1:0),k.push(e.sCount[f]),e.sCount[f]=d-c,v.push(e.tShift[f]),e.tShift[f]=D-e.bMarks[f]}for(g=e.blkIndent,e.blkIndent=0,A=e.push(\"blockquote_open\",\"blockquote\",1),A.markup=\">\",A.map=h=[r,0],e.md.block.tokenize(e,r,f),A=e.push(\"blockquote_close\",\"blockquote\",-1),A.markup=\">\",e.lineMax=w,e.parentType=b,h[1]=e.line,a=0;a<v.length;a++)e.bMarks[a+r]=m[a],e.tShift[a+r]=v[a],e.sCount[a+r]=k[a],e.bsCount[a+r]=_[a];return e.blkIndent=g,!0}},{\"../common/utils\":4}],19:[function(e,r,t){\"use strict\";r.exports=function(e,r,t){var n,s,o;if(e.sCount[r]-e.blkIndent<4)return!1;for(s=n=r+1;n<t;)if(e.isEmpty(n))n++;else{if(!(e.sCount[n]-e.blkIndent>=4))break;n++,s=n}return e.line=s,o=e.push(\"code_block\",\"code\",0),o.content=e.getLines(r,s,4+e.blkIndent,!0),o.map=[r,e.line],!0}},{}],20:[function(e,r,t){\"use strict\";r.exports=function(e,r,t,n){var s,o,i,a,c,l,u,p=!1,h=e.bMarks[r]+e.tShift[r],f=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(s=e.src.charCodeAt(h))&&96!==s)return!1;if(c=h,h=e.skipChars(h,s),(o=h-c)<3)return!1;if(u=e.src.slice(c,h),i=e.src.slice(h,f),i.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;for(a=r;!(++a>=t)&&(h=c=e.bMarks[a]+e.tShift[a],f=e.eMarks[a],!(h<f&&e.sCount[a]<e.blkIndent));)if(e.src.charCodeAt(h)===s&&!(e.sCount[a]-e.blkIndent>=4||(h=e.skipChars(h,s))-c<o||(h=e.skipSpaces(h))<f)){p=!0;break}return o=e.sCount[r],e.line=a+(p?1:0),l=e.push(\"fence\",\"code\",0),l.info=i,l.content=e.getLines(r+1,a,o,!0),l.markup=u,l.map=[r,e.line],!0}},{}],21:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(35!==(o=e.src.charCodeAt(l))||l>=u)return!1;for(i=1,o=e.src.charCodeAt(++l);35===o&&l<u&&i<=6;)i++,o=e.src.charCodeAt(++l);return!(i>6||l<u&&!n(o))&&(!!s||(u=e.skipSpacesBack(u,l),a=e.skipCharsBack(u,35,l),a>l&&n(e.src.charCodeAt(a-1))&&(u=a),e.line=r+1,c=e.push(\"heading_open\",\"h\"+String(i),1),c.markup=\"########\".slice(0,i),c.map=[r,e.line],c=e.push(\"inline\",\"\",0),c.content=e.src.slice(l,u).trim(),c.map=[r,e.line],c.children=[],c=e.push(\"heading_close\",\"h\"+String(i),-1),c.markup=\"########\".slice(0,i),!0))}},{\"../common/utils\":4}],22:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(42!==(o=e.src.charCodeAt(l++))&&45!==o&&95!==o)return!1;for(i=1;l<u;){if((a=e.src.charCodeAt(l++))!==o&&!n(a))return!1;a===o&&i++}return!(i<3)&&(!!s||(e.line=r+1,c=e.push(\"hr\",\"hr\",0),c.map=[r,e.line],c.markup=Array(i+1).join(String.fromCharCode(o)),!0))}},{\"../common/utils\":4}],23:[function(e,r,t){\"use strict\";var n=e(\"../common/html_blocks\"),s=e(\"../common/html_re\").HTML_OPEN_CLOSE_TAG_RE,o=[[/^<(script|pre|style)(?=(\\s|>|$))/i,/<\\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\\?/,/\\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\\[CDATA\\[/,/\\]\\]>/,!0],[new RegExp(\"^</?(\"+n.join(\"|\")+\")(?=(\\\\s|/?>|$))\",\"i\"),/^$/,!0],[new RegExp(s.source+\"\\\\s*$\"),/^$/,!1]];r.exports=function(e,r,t,n){var s,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(!e.md.options.html)return!1;if(60!==e.src.charCodeAt(l))return!1;for(c=e.src.slice(l,u),s=0;s<o.length&&!o[s][0].test(c);s++);if(s===o.length)return!1;if(n)return o[s][2];if(i=r+1,!o[s][1].test(c))for(;i<t&&!(e.sCount[i]<e.blkIndent);i++)if(l=e.bMarks[i]+e.tShift[i],u=e.eMarks[i],c=e.src.slice(l,u),o[s][1].test(c)){0!==c.length&&i++;break}return e.line=i,a=e.push(\"html_block\",\"\",0),a.map=[r,i],a.content=e.getLines(r,i,e.blkIndent,!0),!0}},{\"../common/html_blocks\":2,\"../common/html_re\":3}],24:[function(e,r,t){\"use strict\";r.exports=function(e,r,t){var n,s,o,i,a,c,l,u,p,h,f=r+1,d=e.md.block.ruler.getRules(\"paragraph\");if(e.sCount[r]-e.blkIndent>=4)return!1;for(h=e.parentType,e.parentType=\"paragraph\";f<t&&!e.isEmpty(f);f++)if(!(e.sCount[f]-e.blkIndent>3)){if(e.sCount[f]>=e.blkIndent&&(c=e.bMarks[f]+e.tShift[f],l=e.eMarks[f],c<l&&(45===(p=e.src.charCodeAt(c))||61===p)&&(c=e.skipChars(c,p),(c=e.skipSpaces(c))>=l))){u=61===p?1:2;break}if(!(e.sCount[f]<0)){for(s=!1,o=0,i=d.length;o<i;o++)if(d[o](e,f,t,!0)){s=!0;break}if(s)break}}return!!u&&(n=e.getLines(r,f,e.blkIndent,!1).trim(),e.line=f+1,a=e.push(\"heading_open\",\"h\"+String(u),1),a.markup=String.fromCharCode(p),a.map=[r,e.line],a=e.push(\"inline\",\"\",0),a.content=n,a.map=[r,e.line-1],a.children=[],a=e.push(\"heading_close\",\"h\"+String(u),-1),a.markup=String.fromCharCode(p),e.parentType=h,!0)}},{}],25:[function(e,r,t){\"use strict\";function n(e,r){var t,n,s,o;return n=e.bMarks[r]+e.tShift[r],s=e.eMarks[r],t=e.src.charCodeAt(n++),42!==t&&45!==t&&43!==t?-1:n<s&&(o=e.src.charCodeAt(n),!i(o))?-1:n}function s(e,r){var t,n=e.bMarks[r]+e.tShift[r],s=n,o=e.eMarks[r];if(s+1>=o)return-1;if((t=e.src.charCodeAt(s++))<48||t>57)return-1;for(;;){if(s>=o)return-1;t=e.src.charCodeAt(s++);{if(!(t>=48&&t<=57)){if(41===t||46===t)break;return-1}if(s-n>=10)return-1}}return s<o&&(t=e.src.charCodeAt(s),!i(t))?-1:s}function o(e,r){var t,n,s=e.level+2;for(t=r+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===s&&\"paragraph_open\"===e.tokens[t].type&&(e.tokens[t+2].hidden=!0,e.tokens[t].hidden=!0,t+=2)}var i=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,a){var c,l,u,p,h,f,d,m,_,g,b,k,v,y,x,C,A,w,D,q,E,S,F,L,z,T,I,R,M=!1,B=!0;if(e.sCount[r]-e.blkIndent>=4)return!1;if(a&&\"paragraph\"===e.parentType&&e.tShift[r]>=e.blkIndent&&(M=!0),(F=s(e,r))>=0){if(d=!0,z=e.bMarks[r]+e.tShift[r],v=Number(e.src.substr(z,F-z-1)),M&&1!==v)return!1}else{if(!((F=n(e,r))>=0))return!1;d=!1}if(M&&e.skipSpaces(F)>=e.eMarks[r])return!1;if(k=e.src.charCodeAt(F-1),a)return!0;for(b=e.tokens.length,d?(R=e.push(\"ordered_list_open\",\"ol\",1),1!==v&&(R.attrs=[[\"start\",v]])):R=e.push(\"bullet_list_open\",\"ul\",1),R.map=g=[r,0],R.markup=String.fromCharCode(k),x=r,L=!1,I=e.md.block.ruler.getRules(\"list\"),D=e.parentType,e.parentType=\"list\";x<t;){for(S=F,y=e.eMarks[x],f=C=e.sCount[x]+F-(e.bMarks[r]+e.tShift[r]);S<y&&(c=e.src.charCodeAt(S),i(c));)9===c?C+=4-(C+e.bsCount[x])%4:C++,S++;if(l=S,h=l>=y?1:C-f,h>4&&(h=1),p=f+h,R=e.push(\"list_item_open\",\"li\",1),R.markup=String.fromCharCode(k),R.map=m=[r,0],A=e.blkIndent,E=e.tight,q=e.tShift[r],w=e.sCount[r],e.blkIndent=p,e.tight=!0,e.tShift[r]=l-e.bMarks[r],e.sCount[r]=C,l>=y&&e.isEmpty(r+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,r,t,!0),e.tight&&!L||(B=!1),L=e.line-r>1&&e.isEmpty(e.line-1),e.blkIndent=A,e.tShift[r]=q,e.sCount[r]=w,e.tight=E,R=e.push(\"list_item_close\",\"li\",-1),R.markup=String.fromCharCode(k),x=r=e.line,m[1]=x,l=e.bMarks[r],x>=t)break;if(e.sCount[x]<e.blkIndent)break;for(T=!1,u=0,_=I.length;u<_;u++)if(I[u](e,x,t,!0)){T=!0;break}if(T)break;if(d){if((F=s(e,x))<0)break}else if((F=n(e,x))<0)break;if(k!==e.src.charCodeAt(F-1))break}return R=d?e.push(\"ordered_list_close\",\"ol\",-1):e.push(\"bullet_list_close\",\"ul\",-1),R.markup=String.fromCharCode(k),g[1]=x,e.line=x,e.parentType=D,B&&o(e,b),!0}},{\"../common/utils\":4}],26:[function(e,r,t){\"use strict\";r.exports=function(e,r){var t,n,s,o,i,a,c=r+1,l=e.md.block.ruler.getRules(\"paragraph\"),u=e.lineMax;for(a=e.parentType,e.parentType=\"paragraph\";c<u&&!e.isEmpty(c);c++)if(!(e.sCount[c]-e.blkIndent>3||e.sCount[c]<0)){for(n=!1,s=0,o=l.length;s<o;s++)if(l[s](e,c,u,!0)){n=!0;break}if(n)break}return t=e.getLines(r,c,e.blkIndent,!1).trim(),e.line=c,i=e.push(\"paragraph_open\",\"p\",1),i.map=[r,e.line],i=e.push(\"inline\",\"\",0),i.content=t,i.map=[r,e.line],i.children=[],i=e.push(\"paragraph_close\",\"p\",-1),e.parentType=a,!0}},{}],27:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").normalizeReference,s=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,o){var i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,y,x=0,C=e.bMarks[r]+e.tShift[r],A=e.eMarks[r],w=r+1;if(e.sCount[r]-e.blkIndent>=4)return!1;if(91!==e.src.charCodeAt(C))return!1;for(;++C<A;)if(93===e.src.charCodeAt(C)&&92!==e.src.charCodeAt(C-1)){if(C+1===A)return!1;if(58!==e.src.charCodeAt(C+1))return!1;break}for(l=e.lineMax,v=e.md.block.ruler.getRules(\"reference\"),m=e.parentType,e.parentType=\"reference\";w<l&&!e.isEmpty(w);w++)if(!(e.sCount[w]-e.blkIndent>3||e.sCount[w]<0)){for(k=!1,p=0,h=v.length;p<h;p++)if(v[p](e,w,l,!0)){k=!0;break}if(k)break}for(b=e.getLines(r,w,e.blkIndent,!1).trim(),A=b.length,C=1;C<A;C++){if(91===(i=b.charCodeAt(C)))return!1;if(93===i){d=C;break}10===i?x++:92===i&&++C<A&&10===b.charCodeAt(C)&&x++}if(d<0||58!==b.charCodeAt(d+1))return!1;for(C=d+2;C<A;C++)if(10===(i=b.charCodeAt(C)))x++;else if(!s(i))break;if(_=e.md.helpers.parseLinkDestination(b,C,A),!_.ok)return!1;if(u=e.md.normalizeLink(_.str),!e.md.validateLink(u))return!1;for(C=_.pos,x+=_.lines,a=C,c=x,g=C;C<A;C++)if(10===(i=b.charCodeAt(C)))x++;else if(!s(i))break;for(_=e.md.helpers.parseLinkTitle(b,C,A),C<A&&g!==C&&_.ok?(y=_.str,C=_.pos,x+=_.lines):(y=\"\",C=a,x=c);C<A&&(i=b.charCodeAt(C),s(i));)C++;if(C<A&&10!==b.charCodeAt(C)&&y)for(y=\"\",C=a,x=c;C<A&&(i=b.charCodeAt(C),s(i));)C++;return!(C<A&&10!==b.charCodeAt(C))&&(!!(f=n(b.slice(1,d)))&&(!!o||(void 0===e.env.references&&(e.env.references={}),void 0===e.env.references[f]&&(e.env.references[f]={title:y,href:u}),e.parentType=m,e.line=r+x+1,!0)))}},{\"../common/utils\":4}],28:[function(e,r,t){\"use strict\";function n(e,r,t,n){var s,i,a,c,l,u,p,h;for(this.src=e,this.md=r,this.env=t,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.parentType=\"root\",this.level=0,this.result=\"\",i=this.src,h=!1,a=c=u=p=0,l=i.length;c<l;c++){if(s=i.charCodeAt(c),!h){if(o(s)){u++,9===s?p+=4-p%4:p++;continue}h=!0}10!==s&&c!==l-1||(10!==s&&c++,this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(u),this.sCount.push(p),this.bsCount.push(0),h=!1,u=0,p=0,a=c+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}var s=e(\"../token\"),o=e(\"../common/utils\").isSpace;n.prototype.push=function(e,r,t){var n=new s(e,r,t);return n.block=!0,t<0&&this.level--,n.level=this.level,t>0&&this.level++,this.tokens.push(n),n},n.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},n.prototype.skipEmptyLines=function(e){for(var r=this.lineMax;e<r&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},n.prototype.skipSpaces=function(e){for(var r,t=this.src.length;e<t&&(r=this.src.charCodeAt(e),o(r));e++);return e},n.prototype.skipSpacesBack=function(e,r){if(e<=r)return e;for(;e>r;)if(!o(this.src.charCodeAt(--e)))return e+1;return e},n.prototype.skipChars=function(e,r){for(var t=this.src.length;e<t&&this.src.charCodeAt(e)===r;e++);return e},n.prototype.skipCharsBack=function(e,r,t){if(e<=t)return e;for(;e>t;)if(r!==this.src.charCodeAt(--e))return e+1;return e},n.prototype.getLines=function(e,r,t,n){var s,i,a,c,l,u,p,h=e;if(e>=r)return\"\";for(u=new Array(r-e),s=0;h<r;h++,s++){for(i=0,p=c=this.bMarks[h],\nl=h+1<r||n?this.eMarks[h]+1:this.eMarks[h];c<l&&i<t;){if(a=this.src.charCodeAt(c),o(a))9===a?i+=4-(i+this.bsCount[h])%4:i++;else{if(!(c-p<this.tShift[h]))break;i++}c++}u[s]=i>t?new Array(i-t+1).join(\" \")+this.src.slice(c,l):this.src.slice(c,l)}return u.join(\"\")},n.prototype.Token=s,r.exports=n},{\"../common/utils\":4,\"../token\":51}],29:[function(e,r,t){\"use strict\";function n(e,r){var t=e.bMarks[r]+e.blkIndent,n=e.eMarks[r];return e.src.substr(t,n-t)}function s(e){var r,t=[],n=0,s=e.length,o=0,i=0,a=!1,c=0;for(r=e.charCodeAt(n);n<s;)96===r?a?(a=!1,c=n):o%2==0&&(a=!0,c=n):124!==r||o%2!=0||a||(t.push(e.substring(i,n)),i=n+1),92===r?o++:o=0,n++,n===s&&a&&(a=!1,n=c+1),r=e.charCodeAt(n);return t.push(e.substring(i)),t}var o=e(\"../common/utils\").isSpace;r.exports=function(e,r,t,i){var a,c,l,u,p,h,f,d,m,_,g,b;if(r+2>t)return!1;if(p=r+1,e.sCount[p]<e.blkIndent)return!1;if(e.sCount[p]-e.blkIndent>=4)return!1;if((l=e.bMarks[p]+e.tShift[p])>=e.eMarks[p])return!1;if(124!==(a=e.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l<e.eMarks[p];){if(124!==(a=e.src.charCodeAt(l))&&45!==a&&58!==a&&!o(a))return!1;l++}for(c=n(e,r+1),h=c.split(\"|\"),m=[],u=0;u<h.length;u++){if(!(_=h[u].trim())){if(0===u||u===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(_))return!1;58===_.charCodeAt(_.length-1)?m.push(58===_.charCodeAt(0)?\"center\":\"right\"):58===_.charCodeAt(0)?m.push(\"left\"):m.push(\"\")}if(c=n(e,r).trim(),c.indexOf(\"|\")===-1)return!1;if(e.sCount[r]-e.blkIndent>=4)return!1;if(h=s(c.replace(/^\\||\\|$/g,\"\")),(f=h.length)>m.length)return!1;if(i)return!0;for(d=e.push(\"table_open\",\"table\",1),d.map=g=[r,0],d=e.push(\"thead_open\",\"thead\",1),d.map=[r,r+1],d=e.push(\"tr_open\",\"tr\",1),d.map=[r,r+1],u=0;u<h.length;u++)d=e.push(\"th_open\",\"th\",1),d.map=[r,r+1],m[u]&&(d.attrs=[[\"style\",\"text-align:\"+m[u]]]),d=e.push(\"inline\",\"\",0),d.content=h[u].trim(),d.map=[r,r+1],d.children=[],d=e.push(\"th_close\",\"th\",-1);for(d=e.push(\"tr_close\",\"tr\",-1),d=e.push(\"thead_close\",\"thead\",-1),d=e.push(\"tbody_open\",\"tbody\",1),d.map=b=[r+2,0],p=r+2;p<t&&!(e.sCount[p]<e.blkIndent)&&(c=n(e,p).trim(),c.indexOf(\"|\")!==-1)&&!(e.sCount[p]-e.blkIndent>=4);p++){for(h=s(c.replace(/^\\||\\|$/g,\"\")),d=e.push(\"tr_open\",\"tr\",1),u=0;u<f;u++)d=e.push(\"td_open\",\"td\",1),m[u]&&(d.attrs=[[\"style\",\"text-align:\"+m[u]]]),d=e.push(\"inline\",\"\",0),d.content=h[u]?h[u].trim():\"\",d.children=[],d=e.push(\"td_close\",\"td\",-1);d=e.push(\"tr_close\",\"tr\",-1)}return d=e.push(\"tbody_close\",\"tbody\",-1),d=e.push(\"table_close\",\"table\",-1),g[1]=b[1]=p,e.line=p,!0}},{\"../common/utils\":4}],30:[function(e,r,t){\"use strict\";r.exports=function(e){var r;e.inlineMode?(r=new e.Token(\"inline\",\"\",0),r.content=e.src,r.map=[0,1],r.children=[],e.tokens.push(r)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}},{}],31:[function(e,r,t){\"use strict\";r.exports=function(e){var r,t,n,s=e.tokens;for(t=0,n=s.length;t<n;t++)r=s[t],\"inline\"===r.type&&e.md.inline.parse(r.content,e.md,e.env,r.children)}},{}],32:[function(e,r,t){\"use strict\";function n(e){return/^<a[>\\s]/i.test(e)}function s(e){return/^<\\/a\\s*>/i.test(e)}var o=e(\"../common/utils\").arrayReplaceAt;r.exports=function(e){var r,t,i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,y=e.tokens;if(e.md.options.linkify)for(t=0,i=y.length;t<i;t++)if(\"inline\"===y[t].type&&e.md.linkify.pretest(y[t].content))for(a=y[t].children,_=0,r=a.length-1;r>=0;r--)if(l=a[r],\"link_close\"!==l.type){if(\"html_inline\"===l.type&&(n(l.content)&&_>0&&_--,s(l.content)&&_++),!(_>0)&&\"text\"===l.type&&e.md.linkify.test(l.content)){for(h=l.content,v=e.md.linkify.match(h),u=[],m=l.level,d=0,p=0;p<v.length;p++)g=v[p].url,b=e.md.normalizeLink(g),e.md.validateLink(b)&&(k=v[p].text,k=v[p].schema?\"mailto:\"!==v[p].schema||/^mailto:/i.test(k)?e.md.normalizeLinkText(k):e.md.normalizeLinkText(\"mailto:\"+k).replace(/^mailto:/,\"\"):e.md.normalizeLinkText(\"http://\"+k).replace(/^http:\\/\\//,\"\"),f=v[p].index,f>d&&(c=new e.Token(\"text\",\"\",0),c.content=h.slice(d,f),c.level=m,u.push(c)),c=new e.Token(\"link_open\",\"a\",1),c.attrs=[[\"href\",b]],c.level=m++,c.markup=\"linkify\",c.info=\"auto\",u.push(c),c=new e.Token(\"text\",\"\",0),c.content=k,c.level=m,u.push(c),c=new e.Token(\"link_close\",\"a\",-1),c.level=--m,c.markup=\"linkify\",c.info=\"auto\",u.push(c),d=v[p].lastIndex);d<h.length&&(c=new e.Token(\"text\",\"\",0),c.content=h.slice(d),c.level=m,u.push(c)),y[t].children=a=o(a,r,u)}}else for(r--;a[r].level!==l.level&&\"link_open\"!==a[r].type;)r--}},{\"../common/utils\":4}],33:[function(e,r,t){\"use strict\";r.exports=function(e){var r;r=e.src.replace(/\\r[\\n\\u0085]?|[\\u2424\\u2028\\u0085]/g,\"\\n\"),r=r.replace(/\\u0000/g,\"\\ufffd\"),e.src=r}},{}],34:[function(e,r,t){\"use strict\";function n(e,r){return c[r.toLowerCase()]}function s(e){var r,t,s=0;for(r=e.length-1;r>=0;r--)t=e[r],\"text\"!==t.type||s||(t.content=t.content.replace(/\\((c|tm|r|p)\\)/gi,n)),\"link_open\"===t.type&&\"auto\"===t.info&&s--,\"link_close\"===t.type&&\"auto\"===t.info&&s++}function o(e){var r,t,n=0;for(r=e.length-1;r>=0;r--)t=e[r],\"text\"!==t.type||n||i.test(t.content)&&(t.content=t.content.replace(/\\+-/g,\"\\xb1\").replace(/\\.{2,}/g,\"\\u2026\").replace(/([?!])\\u2026/g,\"$1..\").replace(/([?!]){4,}/g,\"$1$1$1\").replace(/,{2,}/g,\",\").replace(/(^|[^-])---([^-]|$)/gm,\"$1\\u2014$2\").replace(/(^|\\s)--(\\s|$)/gm,\"$1\\u2013$2\").replace(/(^|[^-\\s])--([^-\\s]|$)/gm,\"$1\\u2013$2\")),\"link_open\"===t.type&&\"auto\"===t.info&&n--,\"link_close\"===t.type&&\"auto\"===t.info&&n++}var i=/\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/,a=/\\((c|tm|r|p)\\)/i,c={c:\"\\xa9\",r:\"\\xae\",p:\"\\xa7\",tm:\"\\u2122\"};r.exports=function(e){var r;if(e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)\"inline\"===e.tokens[r].type&&(a.test(e.tokens[r].content)&&s(e.tokens[r].children),i.test(e.tokens[r].content)&&o(e.tokens[r].children))}},{}],35:[function(e,r,t){\"use strict\";function n(e,r,t){return e.substr(0,r)+t+e.substr(r+1)}function s(e,r){var t,s,c,u,p,h,f,d,m,_,g,b,k,v,y,x,C,A,w,D,q;for(w=[],t=0;t<e.length;t++){for(s=e[t],f=e[t].level,C=w.length-1;C>=0&&!(w[C].level<=f);C--);if(w.length=C+1,\"text\"===s.type){c=s.content,p=0,h=c.length;e:for(;p<h&&(l.lastIndex=p,u=l.exec(c));){if(y=x=!0,p=u.index+1,A=\"'\"===u[0],m=32,u.index-1>=0)m=c.charCodeAt(u.index-1);else for(C=t-1;C>=0;C--)if(\"text\"===e[C].type){m=e[C].content.charCodeAt(e[C].content.length-1);break}if(_=32,p<h)_=c.charCodeAt(p);else for(C=t+1;C<e.length;C++)if(\"text\"===e[C].type){_=e[C].content.charCodeAt(0);break}if(g=a(m)||i(String.fromCharCode(m)),b=a(_)||i(String.fromCharCode(_)),k=o(m),v=o(_),v?y=!1:b&&(k||g||(y=!1)),k?x=!1:g&&(v||b||(x=!1)),34===_&&'\"'===u[0]&&m>=48&&m<=57&&(x=y=!1),y&&x&&(y=!1,x=b),y||x){if(x)for(C=w.length-1;C>=0&&(d=w[C],!(w[C].level<f));C--)if(d.single===A&&w[C].level===f){d=w[C],A?(D=r.md.options.quotes[2],q=r.md.options.quotes[3]):(D=r.md.options.quotes[0],q=r.md.options.quotes[1]),s.content=n(s.content,u.index,q),e[d.token].content=n(e[d.token].content,d.pos,D),p+=q.length-1,d.token===t&&(p+=D.length-1),c=s.content,h=c.length,w.length=C;continue e}y?w.push({token:t,pos:u.index,single:A,level:f}):x&&A&&(s.content=n(s.content,u.index,\"\\u2019\"))}else A&&(s.content=n(s.content,u.index,\"\\u2019\"))}}}}var o=e(\"../common/utils\").isWhiteSpace,i=e(\"../common/utils\").isPunctChar,a=e(\"../common/utils\").isMdAsciiPunct,c=/['\"]/,l=/['\"]/g;r.exports=function(e){var r;if(e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)\"inline\"===e.tokens[r].type&&c.test(e.tokens[r].content)&&s(e.tokens[r].children,e)}},{\"../common/utils\":4}],36:[function(e,r,t){\"use strict\";function n(e,r,t){this.src=e,this.env=t,this.tokens=[],this.inlineMode=!1,this.md=r}var s=e(\"../token\");n.prototype.Token=s,r.exports=n},{\"../token\":51}],37:[function(e,r,t){\"use strict\";var n=/^<([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])?)*)>/,s=/^<([a-zA-Z][a-zA-Z0-9+.\\-]{1,31}):([^<>\\x00-\\x20]*)>/;r.exports=function(e,r){var t,o,i,a,c,l,u=e.pos;return 60===e.src.charCodeAt(u)&&(t=e.src.slice(u),!(t.indexOf(\">\")<0)&&(s.test(t)?(o=t.match(s),a=o[0].slice(1,-1),c=e.md.normalizeLink(a),!!e.md.validateLink(c)&&(r||(l=e.push(\"link_open\",\"a\",1),l.attrs=[[\"href\",c]],l.markup=\"autolink\",l.info=\"auto\",l=e.push(\"text\",\"\",0),l.content=e.md.normalizeLinkText(a),l=e.push(\"link_close\",\"a\",-1),l.markup=\"autolink\",l.info=\"auto\"),e.pos+=o[0].length,!0)):!!n.test(t)&&(i=t.match(n),a=i[0].slice(1,-1),c=e.md.normalizeLink(\"mailto:\"+a),!!e.md.validateLink(c)&&(r||(l=e.push(\"link_open\",\"a\",1),l.attrs=[[\"href\",c]],l.markup=\"autolink\",l.info=\"auto\",l=e.push(\"text\",\"\",0),l.content=e.md.normalizeLinkText(a),l=e.push(\"link_close\",\"a\",-1),l.markup=\"autolink\",l.info=\"auto\"),e.pos+=i[0].length,!0))))}},{}],38:[function(e,r,t){\"use strict\";r.exports=function(e,r){var t,n,s,o,i,a,c=e.pos;if(96!==e.src.charCodeAt(c))return!1;for(t=c,c++,n=e.posMax;c<n&&96===e.src.charCodeAt(c);)c++;for(s=e.src.slice(t,c),o=i=c;(o=e.src.indexOf(\"`\",i))!==-1;){for(i=o+1;i<n&&96===e.src.charCodeAt(i);)i++;if(i-o===s.length)return r||(a=e.push(\"code_inline\",\"code\",0),a.markup=s,a.content=e.src.slice(c,o).replace(/[ \\n]+/g,\" \").trim()),e.pos=i,!0}return r||(e.pending+=s),e.pos+=s.length,!0}},{}],39:[function(e,r,t){\"use strict\";r.exports=function(e){var r,t,n,s,o=e.delimiters,i=e.delimiters.length;for(r=0;r<i;r++)if(n=o[r],n.close)for(t=r-n.jump-1;t>=0;){if(s=o[t],s.open&&s.marker===n.marker&&s.end<0&&s.level===n.level){var a=(s.close||n.open)&&void 0!==s.length&&void 0!==n.length&&(s.length+n.length)%3==0;if(!a){n.jump=r-t,n.open=!1,s.end=r,s.jump=0;break}}t-=s.jump+1}}},{}],40:[function(e,r,t){\"use strict\";r.exports.tokenize=function(e,r){var t,n,s,o=e.pos,i=e.src.charCodeAt(o);if(r)return!1;if(95!==i&&42!==i)return!1;for(n=e.scanDelims(e.pos,42===i),t=0;t<n.length;t++)s=e.push(\"text\",\"\",0),s.content=String.fromCharCode(i),e.delimiters.push({marker:i,length:n.length,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:n.can_open,close:n.can_close});return e.pos+=n.length,!0},r.exports.postProcess=function(e){var r,t,n,s,o,i,a=e.delimiters,c=e.delimiters.length;for(r=0;r<c;r++)t=a[r],95!==t.marker&&42!==t.marker||t.end!==-1&&(n=a[t.end],i=r+1<c&&a[r+1].end===t.end-1&&a[r+1].token===t.token+1&&a[t.end-1].token===n.token-1&&a[r+1].marker===t.marker,o=String.fromCharCode(t.marker),s=e.tokens[t.token],s.type=i?\"strong_open\":\"em_open\",s.tag=i?\"strong\":\"em\",s.nesting=1,s.markup=i?o+o:o,s.content=\"\",s=e.tokens[n.token],s.type=i?\"strong_close\":\"em_close\",s.tag=i?\"strong\":\"em\",s.nesting=-1,s.markup=i?o+o:o,s.content=\"\",i&&(e.tokens[a[r+1].token].content=\"\",e.tokens[a[t.end-1].token].content=\"\",r++))}},{}],41:[function(e,r,t){\"use strict\";var n=e(\"../common/entities\"),s=e(\"../common/utils\").has,o=e(\"../common/utils\").isValidEntityCode,i=e(\"../common/utils\").fromCodePoint;r.exports=function(e,r){var t,a,c=e.pos,l=e.posMax;if(38!==e.src.charCodeAt(c))return!1;if(c+1<l)if(35===e.src.charCodeAt(c+1)){if(a=e.src.slice(c).match(/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i))return r||(t=\"x\"===a[1][0].toLowerCase()?parseInt(a[1].slice(1),16):parseInt(a[1],10),e.pending+=i(o(t)?t:65533)),e.pos+=a[0].length,!0}else if((a=e.src.slice(c).match(/^&([a-z][a-z0-9]{1,31});/i))&&s(n,a[1]))return r||(e.pending+=n[a[1]]),e.pos+=a[0].length,!0;return r||(e.pending+=\"&\"),e.pos++,!0}},{\"../common/entities\":1,\"../common/utils\":4}],42:[function(e,r,t){\"use strict\";for(var n=e(\"../common/utils\").isSpace,s=[],o=0;o<256;o++)s.push(0);\"\\\\!\\\"#$%&'()*+,./:;<=>?@[]^_`{|}~-\".split(\"\").forEach(function(e){s[e.charCodeAt(0)]=1}),r.exports=function(e,r){var t,o=e.pos,i=e.posMax;if(92!==e.src.charCodeAt(o))return!1;if(++o<i){if((t=e.src.charCodeAt(o))<256&&0!==s[t])return r||(e.pending+=e.src[o]),e.pos+=2,!0;if(10===t){for(r||e.push(\"hardbreak\",\"br\",0),o++;o<i&&(t=e.src.charCodeAt(o),n(t));)o++;return e.pos=o,!0}}return r||(e.pending+=\"\\\\\"),e.pos++,!0}},{\"../common/utils\":4}],43:[function(e,r,t){\"use strict\";function n(e){var r=32|e;return r>=97&&r<=122}var s=e(\"../common/html_re\").HTML_TAG_RE;r.exports=function(e,r){var t,o,i,a,c=e.pos;return!!e.md.options.html&&(i=e.posMax,!(60!==e.src.charCodeAt(c)||c+2>=i)&&(!(33!==(t=e.src.charCodeAt(c+1))&&63!==t&&47!==t&&!n(t))&&(!!(o=e.src.slice(c).match(s))&&(r||(a=e.push(\"html_inline\",\"\",0),a.content=e.src.slice(c,c+o[0].length)),e.pos+=o[0].length,!0))))}},{\"../common/html_re\":3}],44:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").normalizeReference,s=e(\"../common/utils\").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f,d,m,_,g=\"\",b=e.pos,k=e.posMax;if(33!==e.src.charCodeAt(e.pos))return!1;if(91!==e.src.charCodeAt(e.pos+1))return!1;if(l=e.pos+2,(c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1))<0)return!1;if((u=c+1)<k&&40===e.src.charCodeAt(u)){for(u++;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);if(u>=k)return!1;for(_=u,h=e.md.helpers.parseLinkDestination(e.src,u,e.posMax),h.ok&&(g=e.md.normalizeLink(h.str),e.md.validateLink(g)?u=h.pos:g=\"\"),_=u;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);if(h=e.md.helpers.parseLinkTitle(e.src,u,e.posMax),u<k&&_!==u&&h.ok)for(f=h.str,u=h.pos;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);else f=\"\";if(u>=k||41!==e.src.charCodeAt(u))return e.pos=b,!1;u++}else{if(void 0===e.env.references)return!1;if(u<k&&91===e.src.charCodeAt(u)?(_=u+1,u=e.md.helpers.parseLinkLabel(e,u),u>=0?a=e.src.slice(_,u++):u=c+1):u=c+1,a||(a=e.src.slice(l,c)),!(p=e.env.references[n(a)]))return e.pos=b,!1;g=p.href,f=p.title}return r||(i=e.src.slice(l,c),e.md.inline.parse(i,e.md,e.env,m=[]),d=e.push(\"image\",\"img\",0),d.attrs=t=[[\"src\",g],[\"alt\",\"\"]],d.children=m,d.content=i,f&&t.push([\"title\",f])),e.pos=u,e.posMax=k,!0}},{\"../common/utils\":4}],45:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").normalizeReference,s=e(\"../common/utils\").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f,d=\"\",m=e.pos,_=e.posMax,g=e.pos,b=!0;if(91!==e.src.charCodeAt(e.pos))return!1;if(c=e.pos+1,(a=e.md.helpers.parseLinkLabel(e,e.pos,!0))<0)return!1;if((l=a+1)<_&&40===e.src.charCodeAt(l)){for(b=!1,l++;l<_&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);if(l>=_)return!1;for(g=l,u=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),u.ok&&(d=e.md.normalizeLink(u.str),e.md.validateLink(d)?l=u.pos:d=\"\"),g=l;l<_&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);if(u=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<_&&g!==l&&u.ok)for(h=u.str,l=u.pos;l<_&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);else h=\"\";(l>=_||41!==e.src.charCodeAt(l))&&(b=!0),l++}if(b){if(void 0===e.env.references)return!1;if(l<_&&91===e.src.charCodeAt(l)?(g=l+1,l=e.md.helpers.parseLinkLabel(e,l),l>=0?i=e.src.slice(g,l++):l=a+1):l=a+1,i||(i=e.src.slice(c,a)),!(p=e.env.references[n(i)]))return e.pos=m,!1;d=p.href,h=p.title}return r||(e.pos=c,e.posMax=a,f=e.push(\"link_open\",\"a\",1),f.attrs=t=[[\"href\",d]],h&&t.push([\"title\",h]),e.md.inline.tokenize(e),f=e.push(\"link_close\",\"a\",-1)),e.pos=l,e.posMax=_,!0}},{\"../common/utils\":4}],46:[function(e,r,t){\"use strict\";var n=e(\"../common/utils\").isSpace;r.exports=function(e,r){var t,s,o=e.pos;if(10!==e.src.charCodeAt(o))return!1;for(t=e.pending.length-1,s=e.posMax,r||(t>=0&&32===e.pending.charCodeAt(t)?t>=1&&32===e.pending.charCodeAt(t-1)?(e.pending=e.pending.replace(/ +$/,\"\"),e.push(\"hardbreak\",\"br\",0)):(e.pending=e.pending.slice(0,-1),e.push(\"softbreak\",\"br\",0)):e.push(\"softbreak\",\"br\",0)),o++;o<s&&n(e.src.charCodeAt(o));)o++;return e.pos=o,!0}},{\"../common/utils\":4}],47:[function(e,r,t){\"use strict\";function n(e,r,t,n){this.src=e,this.env=t,this.md=r,this.tokens=n,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=\"\",this.pendingLevel=0,this.cache={},this.delimiters=[]}var s=e(\"../token\"),o=e(\"../common/utils\").isWhiteSpace,i=e(\"../common/utils\").isPunctChar,a=e(\"../common/utils\").isMdAsciiPunct;n.prototype.pushPending=function(){var e=new s(\"text\",\"\",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=\"\",e},n.prototype.push=function(e,r,t){this.pending&&this.pushPending();var n=new s(e,r,t);return t<0&&this.level--,n.level=this.level,t>0&&this.level++,this.pendingLevel=this.level,this.tokens.push(n),n},n.prototype.scanDelims=function(e,r){var t,n,s,c,l,u,p,h,f,d=e,m=!0,_=!0,g=this.posMax,b=this.src.charCodeAt(e);for(t=e>0?this.src.charCodeAt(e-1):32;d<g&&this.src.charCodeAt(d)===b;)d++;return s=d-e,n=d<g?this.src.charCodeAt(d):32,p=a(t)||i(String.fromCharCode(t)),f=a(n)||i(String.fromCharCode(n)),u=o(t),h=o(n),h?m=!1:f&&(u||p||(m=!1)),u?_=!1:p&&(h||f||(_=!1)),r?(c=m,l=_):(c=m&&(!_||p),l=_&&(!m||f)),{can_open:c,can_close:l,length:s}},n.prototype.Token=s,r.exports=n},{\"../common/utils\":4,\"../token\":51}],48:[function(e,r,t){\"use strict\";r.exports.tokenize=function(e,r){var t,n,s,o,i,a=e.pos,c=e.src.charCodeAt(a);if(r)return!1;if(126!==c)return!1;if(n=e.scanDelims(e.pos,!0),o=n.length,i=String.fromCharCode(c),o<2)return!1;for(o%2&&(s=e.push(\"text\",\"\",0),s.content=i,o--),t=0;t<o;t+=2)s=e.push(\"text\",\"\",0),s.content=i+i,e.delimiters.push({marker:c,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:n.can_open,close:n.can_close});return e.pos+=n.length,!0},r.exports.postProcess=function(e){var r,t,n,s,o,i=[],a=e.delimiters,c=e.delimiters.length;for(r=0;r<c;r++)n=a[r],126===n.marker&&n.end!==-1&&(s=a[n.end],o=e.tokens[n.token],o.type=\"s_open\",o.tag=\"s\",o.nesting=1,o.markup=\"~~\",o.content=\"\",o=e.tokens[s.token],o.type=\"s_close\",o.tag=\"s\",o.nesting=-1,o.markup=\"~~\",o.content=\"\",\"text\"===e.tokens[s.token-1].type&&\"~\"===e.tokens[s.token-1].content&&i.push(s.token-1));for(;i.length;){for(r=i.pop(),t=r+1;t<e.tokens.length&&\"s_close\"===e.tokens[t].type;)t++;t--,r!==t&&(o=e.tokens[t],e.tokens[t]=e.tokens[r],e.tokens[r]=o)}}},{}],49:[function(e,r,t){\"use strict\";function n(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}r.exports=function(e,r){for(var t=e.pos;t<e.posMax&&!n(e.src.charCodeAt(t));)t++;return t!==e.pos&&(r||(e.pending+=e.src.slice(e.pos,t)),e.pos=t,!0)}},{}],50:[function(e,r,t){\"use strict\";r.exports=function(e){var r,t,n=0,s=e.tokens,o=e.tokens.length;for(r=t=0;r<o;r++)n+=s[r].nesting,s[r].level=n,\"text\"===s[r].type&&r+1<o&&\"text\"===s[r+1].type?s[r+1].content=s[r].content+s[r+1].content:(r!==t&&(s[t]=s[r]),t++);r!==t&&(s.length=t)}},{}],51:[function(e,r,t){\"use strict\";function n(e,r,t){this.type=e,this.tag=r,this.attrs=null,this.map=null,this.nesting=t,this.level=0,this.children=null,this.content=\"\",this.markup=\"\",this.info=\"\",this.meta=null,this.block=!1,this.hidden=!1}n.prototype.attrIndex=function(e){var r,t,n;if(!this.attrs)return-1;for(r=this.attrs,t=0,n=r.length;t<n;t++)if(r[t][0]===e)return t;return-1},n.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},n.prototype.attrSet=function(e,r){var t=this.attrIndex(e),n=[e,r];t<0?this.attrPush(n):this.attrs[t]=n},n.prototype.attrGet=function(e){var r=this.attrIndex(e),t=null;return r>=0&&(t=this.attrs[r][1]),t},n.prototype.attrJoin=function(e,r){var t=this.attrIndex(e);t<0?this.attrPush([e,r]):this.attrs[t][1]=this.attrs[t][1]+\" \"+r},r.exports=n},{}],52:[function(e,r,t){r.exports={Aacute:\"\\xc1\",aacute:\"\\xe1\",Abreve:\"\\u0102\",abreve:\"\\u0103\",ac:\"\\u223e\",acd:\"\\u223f\",acE:\"\\u223e\\u0333\",Acirc:\"\\xc2\",acirc:\"\\xe2\",acute:\"\\xb4\",Acy:\"\\u0410\",acy:\"\\u0430\",AElig:\"\\xc6\",aelig:\"\\xe6\",af:\"\\u2061\",Afr:\"\\ud835\\udd04\",afr:\"\\ud835\\udd1e\",Agrave:\"\\xc0\",agrave:\"\\xe0\",alefsym:\"\\u2135\",aleph:\"\\u2135\",Alpha:\"\\u0391\",alpha:\"\\u03b1\",Amacr:\"\\u0100\",amacr:\"\\u0101\",amalg:\"\\u2a3f\",amp:\"&\",AMP:\"&\",andand:\"\\u2a55\",And:\"\\u2a53\",and:\"\\u2227\",andd:\"\\u2a5c\",andslope:\"\\u2a58\",andv:\"\\u2a5a\",ang:\"\\u2220\",ange:\"\\u29a4\",angle:\"\\u2220\",angmsdaa:\"\\u29a8\",angmsdab:\"\\u29a9\",angmsdac:\"\\u29aa\",angmsdad:\"\\u29ab\",angmsdae:\"\\u29ac\",angmsdaf:\"\\u29ad\",angmsdag:\"\\u29ae\",angmsdah:\"\\u29af\",angmsd:\"\\u2221\",angrt:\"\\u221f\",angrtvb:\"\\u22be\",angrtvbd:\"\\u299d\",angsph:\"\\u2222\",angst:\"\\xc5\",angzarr:\"\\u237c\",Aogon:\"\\u0104\",aogon:\"\\u0105\",Aopf:\"\\ud835\\udd38\",aopf:\"\\ud835\\udd52\",apacir:\"\\u2a6f\",ap:\"\\u2248\",apE:\"\\u2a70\",ape:\"\\u224a\",apid:\"\\u224b\",apos:\"'\",ApplyFunction:\"\\u2061\",approx:\"\\u2248\",approxeq:\"\\u224a\",Aring:\"\\xc5\",aring:\"\\xe5\",Ascr:\"\\ud835\\udc9c\",ascr:\"\\ud835\\udcb6\",Assign:\"\\u2254\",ast:\"*\",asymp:\"\\u2248\",asympeq:\"\\u224d\",Atilde:\"\\xc3\",atilde:\"\\xe3\",Auml:\"\\xc4\",auml:\"\\xe4\",awconint:\"\\u2233\",awint:\"\\u2a11\",backcong:\"\\u224c\",backepsilon:\"\\u03f6\",backprime:\"\\u2035\",backsim:\"\\u223d\",backsimeq:\"\\u22cd\",Backslash:\"\\u2216\",Barv:\"\\u2ae7\",barvee:\"\\u22bd\",barwed:\"\\u2305\",Barwed:\"\\u2306\",barwedge:\"\\u2305\",bbrk:\"\\u23b5\",bbrktbrk:\"\\u23b6\",bcong:\"\\u224c\",Bcy:\"\\u0411\",bcy:\"\\u0431\",bdquo:\"\\u201e\",becaus:\"\\u2235\",because:\"\\u2235\",Because:\"\\u2235\",bemptyv:\"\\u29b0\",bepsi:\"\\u03f6\",bernou:\"\\u212c\",Bernoullis:\"\\u212c\",Beta:\"\\u0392\",beta:\"\\u03b2\",beth:\"\\u2136\",between:\"\\u226c\",Bfr:\"\\ud835\\udd05\",bfr:\"\\ud835\\udd1f\",bigcap:\"\\u22c2\",bigcirc:\"\\u25ef\",bigcup:\"\\u22c3\",bigodot:\"\\u2a00\",bigoplus:\"\\u2a01\",bigotimes:\"\\u2a02\",bigsqcup:\"\\u2a06\",bigstar:\"\\u2605\",bigtriangledown:\"\\u25bd\",bigtriangleup:\"\\u25b3\",biguplus:\"\\u2a04\",bigvee:\"\\u22c1\",bigwedge:\"\\u22c0\",bkarow:\"\\u290d\",blacklozenge:\"\\u29eb\",blacksquare:\"\\u25aa\",blacktriangle:\"\\u25b4\",blacktriangledown:\"\\u25be\",blacktriangleleft:\"\\u25c2\",blacktriangleright:\"\\u25b8\",blank:\"\\u2423\",blk12:\"\\u2592\",blk14:\"\\u2591\",blk34:\"\\u2593\",block:\"\\u2588\",bne:\"=\\u20e5\",bnequiv:\"\\u2261\\u20e5\",bNot:\"\\u2aed\",bnot:\"\\u2310\",Bopf:\"\\ud835\\udd39\",bopf:\"\\ud835\\udd53\",bot:\"\\u22a5\",bottom:\"\\u22a5\",bowtie:\"\\u22c8\",boxbox:\"\\u29c9\",boxdl:\"\\u2510\",boxdL:\"\\u2555\",boxDl:\"\\u2556\",boxDL:\"\\u2557\",boxdr:\"\\u250c\",boxdR:\"\\u2552\",boxDr:\"\\u2553\",boxDR:\"\\u2554\",boxh:\"\\u2500\",boxH:\"\\u2550\",boxhd:\"\\u252c\",boxHd:\"\\u2564\",boxhD:\"\\u2565\",boxHD:\"\\u2566\",boxhu:\"\\u2534\",boxHu:\"\\u2567\",boxhU:\"\\u2568\",boxHU:\"\\u2569\",boxminus:\"\\u229f\",boxplus:\"\\u229e\",boxtimes:\"\\u22a0\",boxul:\"\\u2518\",boxuL:\"\\u255b\",boxUl:\"\\u255c\",boxUL:\"\\u255d\",boxur:\"\\u2514\",boxuR:\"\\u2558\",boxUr:\"\\u2559\",boxUR:\"\\u255a\",boxv:\"\\u2502\",boxV:\"\\u2551\",boxvh:\"\\u253c\",boxvH:\"\\u256a\",boxVh:\"\\u256b\",boxVH:\"\\u256c\",boxvl:\"\\u2524\",boxvL:\"\\u2561\",boxVl:\"\\u2562\",boxVL:\"\\u2563\",boxvr:\"\\u251c\",boxvR:\"\\u255e\",boxVr:\"\\u255f\",boxVR:\"\\u2560\",bprime:\"\\u2035\",breve:\"\\u02d8\",Breve:\"\\u02d8\",brvbar:\"\\xa6\",bscr:\"\\ud835\\udcb7\",Bscr:\"\\u212c\",bsemi:\"\\u204f\",bsim:\"\\u223d\",bsime:\"\\u22cd\",bsolb:\"\\u29c5\",bsol:\"\\\\\",bsolhsub:\"\\u27c8\",bull:\"\\u2022\",bullet:\"\\u2022\",bump:\"\\u224e\",bumpE:\"\\u2aae\",bumpe:\"\\u224f\",Bumpeq:\"\\u224e\",bumpeq:\"\\u224f\",Cacute:\"\\u0106\",cacute:\"\\u0107\",capand:\"\\u2a44\",capbrcup:\"\\u2a49\",capcap:\"\\u2a4b\",cap:\"\\u2229\",Cap:\"\\u22d2\",capcup:\"\\u2a47\",capdot:\"\\u2a40\",CapitalDifferentialD:\"\\u2145\",caps:\"\\u2229\\ufe00\",caret:\"\\u2041\",caron:\"\\u02c7\",Cayleys:\"\\u212d\",ccaps:\"\\u2a4d\",Ccaron:\"\\u010c\",ccaron:\"\\u010d\",Ccedil:\"\\xc7\",ccedil:\"\\xe7\",Ccirc:\"\\u0108\",ccirc:\"\\u0109\",Cconint:\"\\u2230\",ccups:\"\\u2a4c\",ccupssm:\"\\u2a50\",Cdot:\"\\u010a\",cdot:\"\\u010b\",cedil:\"\\xb8\",Cedilla:\"\\xb8\",cemptyv:\"\\u29b2\",cent:\"\\xa2\",centerdot:\"\\xb7\",CenterDot:\"\\xb7\",cfr:\"\\ud835\\udd20\",Cfr:\"\\u212d\",CHcy:\"\\u0427\",chcy:\"\\u0447\",check:\"\\u2713\",checkmark:\"\\u2713\",Chi:\"\\u03a7\",chi:\"\\u03c7\",circ:\"\\u02c6\",circeq:\"\\u2257\",circlearrowleft:\"\\u21ba\",circlearrowright:\"\\u21bb\",circledast:\"\\u229b\",circledcirc:\"\\u229a\",circleddash:\"\\u229d\",CircleDot:\"\\u2299\",circledR:\"\\xae\",circledS:\"\\u24c8\",CircleMinus:\"\\u2296\",CirclePlus:\"\\u2295\",CircleTimes:\"\\u2297\",cir:\"\\u25cb\",cirE:\"\\u29c3\",cire:\"\\u2257\",cirfnint:\"\\u2a10\",cirmid:\"\\u2aef\",cirscir:\"\\u29c2\",ClockwiseContourIntegral:\"\\u2232\",CloseCurlyDoubleQuote:\"\\u201d\",CloseCurlyQuote:\"\\u2019\",clubs:\"\\u2663\",clubsuit:\"\\u2663\",colon:\":\",Colon:\"\\u2237\",Colone:\"\\u2a74\",colone:\"\\u2254\",coloneq:\"\\u2254\",comma:\",\",commat:\"@\",comp:\"\\u2201\",compfn:\"\\u2218\",complement:\"\\u2201\",complexes:\"\\u2102\",cong:\"\\u2245\",congdot:\"\\u2a6d\",Congruent:\"\\u2261\",conint:\"\\u222e\",Conint:\"\\u222f\",ContourIntegral:\"\\u222e\",copf:\"\\ud835\\udd54\",Copf:\"\\u2102\",coprod:\"\\u2210\",Coproduct:\"\\u2210\",copy:\"\\xa9\",COPY:\"\\xa9\",copysr:\"\\u2117\",CounterClockwiseContourIntegral:\"\\u2233\",crarr:\"\\u21b5\",cross:\"\\u2717\",Cross:\"\\u2a2f\",Cscr:\"\\ud835\\udc9e\",cscr:\"\\ud835\\udcb8\",csub:\"\\u2acf\",csube:\"\\u2ad1\",csup:\"\\u2ad0\",csupe:\"\\u2ad2\",ctdot:\"\\u22ef\",cudarrl:\"\\u2938\",cudarrr:\"\\u2935\",cuepr:\"\\u22de\",cuesc:\"\\u22df\",cularr:\"\\u21b6\",cularrp:\"\\u293d\",cupbrcap:\"\\u2a48\",cupcap:\"\\u2a46\",CupCap:\"\\u224d\",cup:\"\\u222a\",Cup:\"\\u22d3\",cupcup:\"\\u2a4a\",cupdot:\"\\u228d\",cupor:\"\\u2a45\",cups:\"\\u222a\\ufe00\",curarr:\"\\u21b7\",curarrm:\"\\u293c\",curlyeqprec:\"\\u22de\",curlyeqsucc:\"\\u22df\",curlyvee:\"\\u22ce\",curlywedge:\"\\u22cf\",curren:\"\\xa4\",curvearrowleft:\"\\u21b6\",curvearrowright:\"\\u21b7\",cuvee:\"\\u22ce\",cuwed:\"\\u22cf\",cwconint:\"\\u2232\",cwint:\"\\u2231\",cylcty:\"\\u232d\",dagger:\"\\u2020\",Dagger:\"\\u2021\",daleth:\"\\u2138\",darr:\"\\u2193\",Darr:\"\\u21a1\",dArr:\"\\u21d3\",dash:\"\\u2010\",Dashv:\"\\u2ae4\",dashv:\"\\u22a3\",dbkarow:\"\\u290f\",dblac:\"\\u02dd\",Dcaron:\"\\u010e\",dcaron:\"\\u010f\",Dcy:\"\\u0414\",dcy:\"\\u0434\",ddagger:\"\\u2021\",ddarr:\"\\u21ca\",DD:\"\\u2145\",dd:\"\\u2146\",DDotrahd:\"\\u2911\",ddotseq:\"\\u2a77\",deg:\"\\xb0\",Del:\"\\u2207\",Delta:\"\\u0394\",delta:\"\\u03b4\",demptyv:\"\\u29b1\",dfisht:\"\\u297f\",Dfr:\"\\ud835\\udd07\",dfr:\"\\ud835\\udd21\",dHar:\"\\u2965\",dharl:\"\\u21c3\",dharr:\"\\u21c2\",DiacriticalAcute:\"\\xb4\",DiacriticalDot:\"\\u02d9\",DiacriticalDoubleAcute:\"\\u02dd\",DiacriticalGrave:\"`\",DiacriticalTilde:\"\\u02dc\",diam:\"\\u22c4\",diamond:\"\\u22c4\",Diamond:\"\\u22c4\",diamondsuit:\"\\u2666\",diams:\"\\u2666\",die:\"\\xa8\",DifferentialD:\"\\u2146\",digamma:\"\\u03dd\",disin:\"\\u22f2\",div:\"\\xf7\",divide:\"\\xf7\",divideontimes:\"\\u22c7\",divonx:\"\\u22c7\",DJcy:\"\\u0402\",djcy:\"\\u0452\",dlcorn:\"\\u231e\",dlcrop:\"\\u230d\",dollar:\"$\",Dopf:\"\\ud835\\udd3b\",dopf:\"\\ud835\\udd55\",Dot:\"\\xa8\",dot:\"\\u02d9\",DotDot:\"\\u20dc\",doteq:\"\\u2250\",doteqdot:\"\\u2251\",DotEqual:\"\\u2250\",dotminus:\"\\u2238\",dotplus:\"\\u2214\",dotsquare:\"\\u22a1\",doublebarwedge:\"\\u2306\",DoubleContourIntegral:\"\\u222f\",DoubleDot:\"\\xa8\",DoubleDownArrow:\"\\u21d3\",DoubleLeftArrow:\"\\u21d0\",DoubleLeftRightArrow:\"\\u21d4\",DoubleLeftTee:\"\\u2ae4\",DoubleLongLeftArrow:\"\\u27f8\",DoubleLongLeftRightArrow:\"\\u27fa\",DoubleLongRightArrow:\"\\u27f9\",DoubleRightArrow:\"\\u21d2\",DoubleRightTee:\"\\u22a8\",DoubleUpArrow:\"\\u21d1\",DoubleUpDownArrow:\"\\u21d5\",DoubleVerticalBar:\"\\u2225\",DownArrowBar:\"\\u2913\",downarrow:\"\\u2193\",DownArrow:\"\\u2193\",Downarrow:\"\\u21d3\",DownArrowUpArrow:\"\\u21f5\",DownBreve:\"\\u0311\",downdownarrows:\"\\u21ca\",downharpoonleft:\"\\u21c3\",downharpoonright:\"\\u21c2\",DownLeftRightVector:\"\\u2950\",DownLeftTeeVector:\"\\u295e\",DownLeftVectorBar:\"\\u2956\",DownLeftVector:\"\\u21bd\",DownRightTeeVector:\"\\u295f\",DownRightVectorBar:\"\\u2957\",DownRightVector:\"\\u21c1\",DownTeeArrow:\"\\u21a7\",DownTee:\"\\u22a4\",drbkarow:\"\\u2910\",drcorn:\"\\u231f\",drcrop:\"\\u230c\",Dscr:\"\\ud835\\udc9f\",dscr:\"\\ud835\\udcb9\",DScy:\"\\u0405\",dscy:\"\\u0455\",dsol:\"\\u29f6\",Dstrok:\"\\u0110\",dstrok:\"\\u0111\",dtdot:\"\\u22f1\",dtri:\"\\u25bf\",dtrif:\"\\u25be\",duarr:\"\\u21f5\",duhar:\"\\u296f\",dwangle:\"\\u29a6\",DZcy:\"\\u040f\",dzcy:\"\\u045f\",dzigrarr:\"\\u27ff\",Eacute:\"\\xc9\",eacute:\"\\xe9\",easter:\"\\u2a6e\",Ecaron:\"\\u011a\",ecaron:\"\\u011b\",Ecirc:\"\\xca\",ecirc:\"\\xea\",ecir:\"\\u2256\",ecolon:\"\\u2255\",Ecy:\"\\u042d\",ecy:\"\\u044d\",eDDot:\"\\u2a77\",Edot:\"\\u0116\",edot:\"\\u0117\",eDot:\"\\u2251\",ee:\"\\u2147\",efDot:\"\\u2252\",Efr:\"\\ud835\\udd08\",efr:\"\\ud835\\udd22\",eg:\"\\u2a9a\",Egrave:\"\\xc8\",egrave:\"\\xe8\",egs:\"\\u2a96\",egsdot:\"\\u2a98\",el:\"\\u2a99\",Element:\"\\u2208\",elinters:\"\\u23e7\",ell:\"\\u2113\",els:\"\\u2a95\",elsdot:\"\\u2a97\",Emacr:\"\\u0112\",emacr:\"\\u0113\",empty:\"\\u2205\",emptyset:\"\\u2205\",EmptySmallSquare:\"\\u25fb\",emptyv:\"\\u2205\",EmptyVerySmallSquare:\"\\u25ab\",emsp13:\"\\u2004\",emsp14:\"\\u2005\",emsp:\"\\u2003\",ENG:\"\\u014a\",eng:\"\\u014b\",ensp:\"\\u2002\",Eogon:\"\\u0118\",eogon:\"\\u0119\",Eopf:\"\\ud835\\udd3c\",eopf:\"\\ud835\\udd56\",epar:\"\\u22d5\",eparsl:\"\\u29e3\",eplus:\"\\u2a71\",epsi:\"\\u03b5\",Epsilon:\"\\u0395\",epsilon:\"\\u03b5\",epsiv:\"\\u03f5\",eqcirc:\"\\u2256\",eqcolon:\"\\u2255\",eqsim:\"\\u2242\",eqslantgtr:\"\\u2a96\",eqslantless:\"\\u2a95\",Equal:\"\\u2a75\",equals:\"=\",EqualTilde:\"\\u2242\",equest:\"\\u225f\",Equilibrium:\"\\u21cc\",equiv:\"\\u2261\",equivDD:\"\\u2a78\",eqvparsl:\"\\u29e5\",erarr:\"\\u2971\",erDot:\"\\u2253\",escr:\"\\u212f\",Escr:\"\\u2130\",esdot:\"\\u2250\",Esim:\"\\u2a73\",esim:\"\\u2242\",Eta:\"\\u0397\",eta:\"\\u03b7\",ETH:\"\\xd0\",eth:\"\\xf0\",Euml:\"\\xcb\",euml:\"\\xeb\",euro:\"\\u20ac\",excl:\"!\",exist:\"\\u2203\",Exists:\"\\u2203\",expectation:\"\\u2130\",exponentiale:\"\\u2147\",ExponentialE:\"\\u2147\",fallingdotseq:\"\\u2252\",Fcy:\"\\u0424\",fcy:\"\\u0444\",female:\"\\u2640\",ffilig:\"\\ufb03\",fflig:\"\\ufb00\",ffllig:\"\\ufb04\",Ffr:\"\\ud835\\udd09\",ffr:\"\\ud835\\udd23\",filig:\"\\ufb01\",FilledSmallSquare:\"\\u25fc\",FilledVerySmallSquare:\"\\u25aa\",fjlig:\"fj\",flat:\"\\u266d\",fllig:\"\\ufb02\",fltns:\"\\u25b1\",fnof:\"\\u0192\",Fopf:\"\\ud835\\udd3d\",fopf:\"\\ud835\\udd57\",forall:\"\\u2200\",ForAll:\"\\u2200\",fork:\"\\u22d4\",forkv:\"\\u2ad9\",Fouriertrf:\"\\u2131\",fpartint:\"\\u2a0d\",frac12:\"\\xbd\",frac13:\"\\u2153\",frac14:\"\\xbc\",frac15:\"\\u2155\",frac16:\"\\u2159\",frac18:\"\\u215b\",frac23:\"\\u2154\",frac25:\"\\u2156\",frac34:\"\\xbe\",frac35:\"\\u2157\",frac38:\"\\u215c\",frac45:\"\\u2158\",frac56:\"\\u215a\",frac58:\"\\u215d\",frac78:\"\\u215e\",frasl:\"\\u2044\",frown:\"\\u2322\",fscr:\"\\ud835\\udcbb\",Fscr:\"\\u2131\",gacute:\"\\u01f5\",Gamma:\"\\u0393\",gamma:\"\\u03b3\",Gammad:\"\\u03dc\",gammad:\"\\u03dd\",gap:\"\\u2a86\",Gbreve:\"\\u011e\",gbreve:\"\\u011f\",Gcedil:\"\\u0122\",Gcirc:\"\\u011c\",gcirc:\"\\u011d\",Gcy:\"\\u0413\",gcy:\"\\u0433\",Gdot:\"\\u0120\",gdot:\"\\u0121\",ge:\"\\u2265\",gE:\"\\u2267\",gEl:\"\\u2a8c\",gel:\"\\u22db\",geq:\"\\u2265\",geqq:\"\\u2267\",geqslant:\"\\u2a7e\",gescc:\"\\u2aa9\",ges:\"\\u2a7e\",gesdot:\"\\u2a80\",gesdoto:\"\\u2a82\",gesdotol:\"\\u2a84\",gesl:\"\\u22db\\ufe00\",gesles:\"\\u2a94\",Gfr:\"\\ud835\\udd0a\",gfr:\"\\ud835\\udd24\",gg:\"\\u226b\",Gg:\"\\u22d9\",ggg:\"\\u22d9\",gimel:\"\\u2137\",GJcy:\"\\u0403\",gjcy:\"\\u0453\",gla:\"\\u2aa5\",gl:\"\\u2277\",glE:\"\\u2a92\",glj:\"\\u2aa4\",gnap:\"\\u2a8a\",gnapprox:\"\\u2a8a\",gne:\"\\u2a88\",gnE:\"\\u2269\",gneq:\"\\u2a88\",gneqq:\"\\u2269\",gnsim:\"\\u22e7\",Gopf:\"\\ud835\\udd3e\",gopf:\"\\ud835\\udd58\",grave:\"`\",GreaterEqual:\"\\u2265\",GreaterEqualLess:\"\\u22db\",GreaterFullEqual:\"\\u2267\",GreaterGreater:\"\\u2aa2\",GreaterLess:\"\\u2277\",GreaterSlantEqual:\"\\u2a7e\",GreaterTilde:\"\\u2273\",Gscr:\"\\ud835\\udca2\",gscr:\"\\u210a\",gsim:\"\\u2273\",gsime:\"\\u2a8e\",gsiml:\"\\u2a90\",gtcc:\"\\u2aa7\",gtcir:\"\\u2a7a\",gt:\">\",GT:\">\",Gt:\"\\u226b\",gtdot:\"\\u22d7\",gtlPar:\"\\u2995\",gtquest:\"\\u2a7c\",gtrapprox:\"\\u2a86\",gtrarr:\"\\u2978\",gtrdot:\"\\u22d7\",gtreqless:\"\\u22db\",gtreqqless:\"\\u2a8c\",gtrless:\"\\u2277\",gtrsim:\"\\u2273\",gvertneqq:\"\\u2269\\ufe00\",gvnE:\"\\u2269\\ufe00\",Hacek:\"\\u02c7\",hairsp:\"\\u200a\",half:\"\\xbd\",hamilt:\"\\u210b\",HARDcy:\"\\u042a\",hardcy:\"\\u044a\",harrcir:\"\\u2948\",harr:\"\\u2194\",hArr:\"\\u21d4\",harrw:\"\\u21ad\",Hat:\"^\",hbar:\"\\u210f\",Hcirc:\"\\u0124\",hcirc:\"\\u0125\",hearts:\"\\u2665\",heartsuit:\"\\u2665\",hellip:\"\\u2026\",hercon:\"\\u22b9\",hfr:\"\\ud835\\udd25\",Hfr:\"\\u210c\",HilbertSpace:\"\\u210b\",hksearow:\"\\u2925\",hkswarow:\"\\u2926\",hoarr:\"\\u21ff\",homtht:\"\\u223b\",hookleftarrow:\"\\u21a9\",hookrightarrow:\"\\u21aa\",hopf:\"\\ud835\\udd59\",Hopf:\"\\u210d\",horbar:\"\\u2015\",HorizontalLine:\"\\u2500\",hscr:\"\\ud835\\udcbd\",Hscr:\"\\u210b\",hslash:\"\\u210f\",Hstrok:\"\\u0126\",hstrok:\"\\u0127\",HumpDownHump:\"\\u224e\",HumpEqual:\"\\u224f\",hybull:\"\\u2043\",hyphen:\"\\u2010\",Iacute:\"\\xcd\",iacute:\"\\xed\",ic:\"\\u2063\",Icirc:\"\\xce\",icirc:\"\\xee\",Icy:\"\\u0418\",icy:\"\\u0438\",Idot:\"\\u0130\",IEcy:\"\\u0415\",iecy:\"\\u0435\",iexcl:\"\\xa1\",iff:\"\\u21d4\",ifr:\"\\ud835\\udd26\",Ifr:\"\\u2111\",Igrave:\"\\xcc\",igrave:\"\\xec\",ii:\"\\u2148\",iiiint:\"\\u2a0c\",iiint:\"\\u222d\",iinfin:\"\\u29dc\",iiota:\"\\u2129\",IJlig:\"\\u0132\",ijlig:\"\\u0133\",Imacr:\"\\u012a\",imacr:\"\\u012b\",image:\"\\u2111\",ImaginaryI:\"\\u2148\",imagline:\"\\u2110\",imagpart:\"\\u2111\",imath:\"\\u0131\",Im:\"\\u2111\",imof:\"\\u22b7\",imped:\"\\u01b5\",Implies:\"\\u21d2\",incare:\"\\u2105\",in:\"\\u2208\",infin:\"\\u221e\",infintie:\"\\u29dd\",inodot:\"\\u0131\",intcal:\"\\u22ba\",int:\"\\u222b\",Int:\"\\u222c\",integers:\"\\u2124\",Integral:\"\\u222b\",intercal:\"\\u22ba\",Intersection:\"\\u22c2\",intlarhk:\"\\u2a17\",intprod:\"\\u2a3c\",InvisibleComma:\"\\u2063\",InvisibleTimes:\"\\u2062\",IOcy:\"\\u0401\",iocy:\"\\u0451\",Iogon:\"\\u012e\",iogon:\"\\u012f\",Iopf:\"\\ud835\\udd40\",iopf:\"\\ud835\\udd5a\",Iota:\"\\u0399\",iota:\"\\u03b9\",iprod:\"\\u2a3c\",iquest:\"\\xbf\",iscr:\"\\ud835\\udcbe\",Iscr:\"\\u2110\",isin:\"\\u2208\",isindot:\"\\u22f5\",isinE:\"\\u22f9\",isins:\"\\u22f4\",isinsv:\"\\u22f3\",isinv:\"\\u2208\",it:\"\\u2062\",Itilde:\"\\u0128\",itilde:\"\\u0129\",Iukcy:\"\\u0406\",iukcy:\"\\u0456\",Iuml:\"\\xcf\",iuml:\"\\xef\",Jcirc:\"\\u0134\",jcirc:\"\\u0135\",Jcy:\"\\u0419\",jcy:\"\\u0439\",Jfr:\"\\ud835\\udd0d\",jfr:\"\\ud835\\udd27\",jmath:\"\\u0237\",Jopf:\"\\ud835\\udd41\",\njopf:\"\\ud835\\udd5b\",Jscr:\"\\ud835\\udca5\",jscr:\"\\ud835\\udcbf\",Jsercy:\"\\u0408\",jsercy:\"\\u0458\",Jukcy:\"\\u0404\",jukcy:\"\\u0454\",Kappa:\"\\u039a\",kappa:\"\\u03ba\",kappav:\"\\u03f0\",Kcedil:\"\\u0136\",kcedil:\"\\u0137\",Kcy:\"\\u041a\",kcy:\"\\u043a\",Kfr:\"\\ud835\\udd0e\",kfr:\"\\ud835\\udd28\",kgreen:\"\\u0138\",KHcy:\"\\u0425\",khcy:\"\\u0445\",KJcy:\"\\u040c\",kjcy:\"\\u045c\",Kopf:\"\\ud835\\udd42\",kopf:\"\\ud835\\udd5c\",Kscr:\"\\ud835\\udca6\",kscr:\"\\ud835\\udcc0\",lAarr:\"\\u21da\",Lacute:\"\\u0139\",lacute:\"\\u013a\",laemptyv:\"\\u29b4\",lagran:\"\\u2112\",Lambda:\"\\u039b\",lambda:\"\\u03bb\",lang:\"\\u27e8\",Lang:\"\\u27ea\",langd:\"\\u2991\",langle:\"\\u27e8\",lap:\"\\u2a85\",Laplacetrf:\"\\u2112\",laquo:\"\\xab\",larrb:\"\\u21e4\",larrbfs:\"\\u291f\",larr:\"\\u2190\",Larr:\"\\u219e\",lArr:\"\\u21d0\",larrfs:\"\\u291d\",larrhk:\"\\u21a9\",larrlp:\"\\u21ab\",larrpl:\"\\u2939\",larrsim:\"\\u2973\",larrtl:\"\\u21a2\",latail:\"\\u2919\",lAtail:\"\\u291b\",lat:\"\\u2aab\",late:\"\\u2aad\",lates:\"\\u2aad\\ufe00\",lbarr:\"\\u290c\",lBarr:\"\\u290e\",lbbrk:\"\\u2772\",lbrace:\"{\",lbrack:\"[\",lbrke:\"\\u298b\",lbrksld:\"\\u298f\",lbrkslu:\"\\u298d\",Lcaron:\"\\u013d\",lcaron:\"\\u013e\",Lcedil:\"\\u013b\",lcedil:\"\\u013c\",lceil:\"\\u2308\",lcub:\"{\",Lcy:\"\\u041b\",lcy:\"\\u043b\",ldca:\"\\u2936\",ldquo:\"\\u201c\",ldquor:\"\\u201e\",ldrdhar:\"\\u2967\",ldrushar:\"\\u294b\",ldsh:\"\\u21b2\",le:\"\\u2264\",lE:\"\\u2266\",LeftAngleBracket:\"\\u27e8\",LeftArrowBar:\"\\u21e4\",leftarrow:\"\\u2190\",LeftArrow:\"\\u2190\",Leftarrow:\"\\u21d0\",LeftArrowRightArrow:\"\\u21c6\",leftarrowtail:\"\\u21a2\",LeftCeiling:\"\\u2308\",LeftDoubleBracket:\"\\u27e6\",LeftDownTeeVector:\"\\u2961\",LeftDownVectorBar:\"\\u2959\",LeftDownVector:\"\\u21c3\",LeftFloor:\"\\u230a\",leftharpoondown:\"\\u21bd\",leftharpoonup:\"\\u21bc\",leftleftarrows:\"\\u21c7\",leftrightarrow:\"\\u2194\",LeftRightArrow:\"\\u2194\",Leftrightarrow:\"\\u21d4\",leftrightarrows:\"\\u21c6\",leftrightharpoons:\"\\u21cb\",leftrightsquigarrow:\"\\u21ad\",LeftRightVector:\"\\u294e\",LeftTeeArrow:\"\\u21a4\",LeftTee:\"\\u22a3\",LeftTeeVector:\"\\u295a\",leftthreetimes:\"\\u22cb\",LeftTriangleBar:\"\\u29cf\",LeftTriangle:\"\\u22b2\",LeftTriangleEqual:\"\\u22b4\",LeftUpDownVector:\"\\u2951\",LeftUpTeeVector:\"\\u2960\",LeftUpVectorBar:\"\\u2958\",LeftUpVector:\"\\u21bf\",LeftVectorBar:\"\\u2952\",LeftVector:\"\\u21bc\",lEg:\"\\u2a8b\",leg:\"\\u22da\",leq:\"\\u2264\",leqq:\"\\u2266\",leqslant:\"\\u2a7d\",lescc:\"\\u2aa8\",les:\"\\u2a7d\",lesdot:\"\\u2a7f\",lesdoto:\"\\u2a81\",lesdotor:\"\\u2a83\",lesg:\"\\u22da\\ufe00\",lesges:\"\\u2a93\",lessapprox:\"\\u2a85\",lessdot:\"\\u22d6\",lesseqgtr:\"\\u22da\",lesseqqgtr:\"\\u2a8b\",LessEqualGreater:\"\\u22da\",LessFullEqual:\"\\u2266\",LessGreater:\"\\u2276\",lessgtr:\"\\u2276\",LessLess:\"\\u2aa1\",lesssim:\"\\u2272\",LessSlantEqual:\"\\u2a7d\",LessTilde:\"\\u2272\",lfisht:\"\\u297c\",lfloor:\"\\u230a\",Lfr:\"\\ud835\\udd0f\",lfr:\"\\ud835\\udd29\",lg:\"\\u2276\",lgE:\"\\u2a91\",lHar:\"\\u2962\",lhard:\"\\u21bd\",lharu:\"\\u21bc\",lharul:\"\\u296a\",lhblk:\"\\u2584\",LJcy:\"\\u0409\",ljcy:\"\\u0459\",llarr:\"\\u21c7\",ll:\"\\u226a\",Ll:\"\\u22d8\",llcorner:\"\\u231e\",Lleftarrow:\"\\u21da\",llhard:\"\\u296b\",lltri:\"\\u25fa\",Lmidot:\"\\u013f\",lmidot:\"\\u0140\",lmoustache:\"\\u23b0\",lmoust:\"\\u23b0\",lnap:\"\\u2a89\",lnapprox:\"\\u2a89\",lne:\"\\u2a87\",lnE:\"\\u2268\",lneq:\"\\u2a87\",lneqq:\"\\u2268\",lnsim:\"\\u22e6\",loang:\"\\u27ec\",loarr:\"\\u21fd\",lobrk:\"\\u27e6\",longleftarrow:\"\\u27f5\",LongLeftArrow:\"\\u27f5\",Longleftarrow:\"\\u27f8\",longleftrightarrow:\"\\u27f7\",LongLeftRightArrow:\"\\u27f7\",Longleftrightarrow:\"\\u27fa\",longmapsto:\"\\u27fc\",longrightarrow:\"\\u27f6\",LongRightArrow:\"\\u27f6\",Longrightarrow:\"\\u27f9\",looparrowleft:\"\\u21ab\",looparrowright:\"\\u21ac\",lopar:\"\\u2985\",Lopf:\"\\ud835\\udd43\",lopf:\"\\ud835\\udd5d\",loplus:\"\\u2a2d\",lotimes:\"\\u2a34\",lowast:\"\\u2217\",lowbar:\"_\",LowerLeftArrow:\"\\u2199\",LowerRightArrow:\"\\u2198\",loz:\"\\u25ca\",lozenge:\"\\u25ca\",lozf:\"\\u29eb\",lpar:\"(\",lparlt:\"\\u2993\",lrarr:\"\\u21c6\",lrcorner:\"\\u231f\",lrhar:\"\\u21cb\",lrhard:\"\\u296d\",lrm:\"\\u200e\",lrtri:\"\\u22bf\",lsaquo:\"\\u2039\",lscr:\"\\ud835\\udcc1\",Lscr:\"\\u2112\",lsh:\"\\u21b0\",Lsh:\"\\u21b0\",lsim:\"\\u2272\",lsime:\"\\u2a8d\",lsimg:\"\\u2a8f\",lsqb:\"[\",lsquo:\"\\u2018\",lsquor:\"\\u201a\",Lstrok:\"\\u0141\",lstrok:\"\\u0142\",ltcc:\"\\u2aa6\",ltcir:\"\\u2a79\",lt:\"<\",LT:\"<\",Lt:\"\\u226a\",ltdot:\"\\u22d6\",lthree:\"\\u22cb\",ltimes:\"\\u22c9\",ltlarr:\"\\u2976\",ltquest:\"\\u2a7b\",ltri:\"\\u25c3\",ltrie:\"\\u22b4\",ltrif:\"\\u25c2\",ltrPar:\"\\u2996\",lurdshar:\"\\u294a\",luruhar:\"\\u2966\",lvertneqq:\"\\u2268\\ufe00\",lvnE:\"\\u2268\\ufe00\",macr:\"\\xaf\",male:\"\\u2642\",malt:\"\\u2720\",maltese:\"\\u2720\",Map:\"\\u2905\",map:\"\\u21a6\",mapsto:\"\\u21a6\",mapstodown:\"\\u21a7\",mapstoleft:\"\\u21a4\",mapstoup:\"\\u21a5\",marker:\"\\u25ae\",mcomma:\"\\u2a29\",Mcy:\"\\u041c\",mcy:\"\\u043c\",mdash:\"\\u2014\",mDDot:\"\\u223a\",measuredangle:\"\\u2221\",MediumSpace:\"\\u205f\",Mellintrf:\"\\u2133\",Mfr:\"\\ud835\\udd10\",mfr:\"\\ud835\\udd2a\",mho:\"\\u2127\",micro:\"\\xb5\",midast:\"*\",midcir:\"\\u2af0\",mid:\"\\u2223\",middot:\"\\xb7\",minusb:\"\\u229f\",minus:\"\\u2212\",minusd:\"\\u2238\",minusdu:\"\\u2a2a\",MinusPlus:\"\\u2213\",mlcp:\"\\u2adb\",mldr:\"\\u2026\",mnplus:\"\\u2213\",models:\"\\u22a7\",Mopf:\"\\ud835\\udd44\",mopf:\"\\ud835\\udd5e\",mp:\"\\u2213\",mscr:\"\\ud835\\udcc2\",Mscr:\"\\u2133\",mstpos:\"\\u223e\",Mu:\"\\u039c\",mu:\"\\u03bc\",multimap:\"\\u22b8\",mumap:\"\\u22b8\",nabla:\"\\u2207\",Nacute:\"\\u0143\",nacute:\"\\u0144\",nang:\"\\u2220\\u20d2\",nap:\"\\u2249\",napE:\"\\u2a70\\u0338\",napid:\"\\u224b\\u0338\",napos:\"\\u0149\",napprox:\"\\u2249\",natural:\"\\u266e\",naturals:\"\\u2115\",natur:\"\\u266e\",nbsp:\"\\xa0\",nbump:\"\\u224e\\u0338\",nbumpe:\"\\u224f\\u0338\",ncap:\"\\u2a43\",Ncaron:\"\\u0147\",ncaron:\"\\u0148\",Ncedil:\"\\u0145\",ncedil:\"\\u0146\",ncong:\"\\u2247\",ncongdot:\"\\u2a6d\\u0338\",ncup:\"\\u2a42\",Ncy:\"\\u041d\",ncy:\"\\u043d\",ndash:\"\\u2013\",nearhk:\"\\u2924\",nearr:\"\\u2197\",neArr:\"\\u21d7\",nearrow:\"\\u2197\",ne:\"\\u2260\",nedot:\"\\u2250\\u0338\",NegativeMediumSpace:\"\\u200b\",NegativeThickSpace:\"\\u200b\",NegativeThinSpace:\"\\u200b\",NegativeVeryThinSpace:\"\\u200b\",nequiv:\"\\u2262\",nesear:\"\\u2928\",nesim:\"\\u2242\\u0338\",NestedGreaterGreater:\"\\u226b\",NestedLessLess:\"\\u226a\",NewLine:\"\\n\",nexist:\"\\u2204\",nexists:\"\\u2204\",Nfr:\"\\ud835\\udd11\",nfr:\"\\ud835\\udd2b\",ngE:\"\\u2267\\u0338\",nge:\"\\u2271\",ngeq:\"\\u2271\",ngeqq:\"\\u2267\\u0338\",ngeqslant:\"\\u2a7e\\u0338\",nges:\"\\u2a7e\\u0338\",nGg:\"\\u22d9\\u0338\",ngsim:\"\\u2275\",nGt:\"\\u226b\\u20d2\",ngt:\"\\u226f\",ngtr:\"\\u226f\",nGtv:\"\\u226b\\u0338\",nharr:\"\\u21ae\",nhArr:\"\\u21ce\",nhpar:\"\\u2af2\",ni:\"\\u220b\",nis:\"\\u22fc\",nisd:\"\\u22fa\",niv:\"\\u220b\",NJcy:\"\\u040a\",njcy:\"\\u045a\",nlarr:\"\\u219a\",nlArr:\"\\u21cd\",nldr:\"\\u2025\",nlE:\"\\u2266\\u0338\",nle:\"\\u2270\",nleftarrow:\"\\u219a\",nLeftarrow:\"\\u21cd\",nleftrightarrow:\"\\u21ae\",nLeftrightarrow:\"\\u21ce\",nleq:\"\\u2270\",nleqq:\"\\u2266\\u0338\",nleqslant:\"\\u2a7d\\u0338\",nles:\"\\u2a7d\\u0338\",nless:\"\\u226e\",nLl:\"\\u22d8\\u0338\",nlsim:\"\\u2274\",nLt:\"\\u226a\\u20d2\",nlt:\"\\u226e\",nltri:\"\\u22ea\",nltrie:\"\\u22ec\",nLtv:\"\\u226a\\u0338\",nmid:\"\\u2224\",NoBreak:\"\\u2060\",NonBreakingSpace:\"\\xa0\",nopf:\"\\ud835\\udd5f\",Nopf:\"\\u2115\",Not:\"\\u2aec\",not:\"\\xac\",NotCongruent:\"\\u2262\",NotCupCap:\"\\u226d\",NotDoubleVerticalBar:\"\\u2226\",NotElement:\"\\u2209\",NotEqual:\"\\u2260\",NotEqualTilde:\"\\u2242\\u0338\",NotExists:\"\\u2204\",NotGreater:\"\\u226f\",NotGreaterEqual:\"\\u2271\",NotGreaterFullEqual:\"\\u2267\\u0338\",NotGreaterGreater:\"\\u226b\\u0338\",NotGreaterLess:\"\\u2279\",NotGreaterSlantEqual:\"\\u2a7e\\u0338\",NotGreaterTilde:\"\\u2275\",NotHumpDownHump:\"\\u224e\\u0338\",NotHumpEqual:\"\\u224f\\u0338\",notin:\"\\u2209\",notindot:\"\\u22f5\\u0338\",notinE:\"\\u22f9\\u0338\",notinva:\"\\u2209\",notinvb:\"\\u22f7\",notinvc:\"\\u22f6\",NotLeftTriangleBar:\"\\u29cf\\u0338\",NotLeftTriangle:\"\\u22ea\",NotLeftTriangleEqual:\"\\u22ec\",NotLess:\"\\u226e\",NotLessEqual:\"\\u2270\",NotLessGreater:\"\\u2278\",NotLessLess:\"\\u226a\\u0338\",NotLessSlantEqual:\"\\u2a7d\\u0338\",NotLessTilde:\"\\u2274\",NotNestedGreaterGreater:\"\\u2aa2\\u0338\",NotNestedLessLess:\"\\u2aa1\\u0338\",notni:\"\\u220c\",notniva:\"\\u220c\",notnivb:\"\\u22fe\",notnivc:\"\\u22fd\",NotPrecedes:\"\\u2280\",NotPrecedesEqual:\"\\u2aaf\\u0338\",NotPrecedesSlantEqual:\"\\u22e0\",NotReverseElement:\"\\u220c\",NotRightTriangleBar:\"\\u29d0\\u0338\",NotRightTriangle:\"\\u22eb\",NotRightTriangleEqual:\"\\u22ed\",NotSquareSubset:\"\\u228f\\u0338\",NotSquareSubsetEqual:\"\\u22e2\",NotSquareSuperset:\"\\u2290\\u0338\",NotSquareSupersetEqual:\"\\u22e3\",NotSubset:\"\\u2282\\u20d2\",NotSubsetEqual:\"\\u2288\",NotSucceeds:\"\\u2281\",NotSucceedsEqual:\"\\u2ab0\\u0338\",NotSucceedsSlantEqual:\"\\u22e1\",NotSucceedsTilde:\"\\u227f\\u0338\",NotSuperset:\"\\u2283\\u20d2\",NotSupersetEqual:\"\\u2289\",NotTilde:\"\\u2241\",NotTildeEqual:\"\\u2244\",NotTildeFullEqual:\"\\u2247\",NotTildeTilde:\"\\u2249\",NotVerticalBar:\"\\u2224\",nparallel:\"\\u2226\",npar:\"\\u2226\",nparsl:\"\\u2afd\\u20e5\",npart:\"\\u2202\\u0338\",npolint:\"\\u2a14\",npr:\"\\u2280\",nprcue:\"\\u22e0\",nprec:\"\\u2280\",npreceq:\"\\u2aaf\\u0338\",npre:\"\\u2aaf\\u0338\",nrarrc:\"\\u2933\\u0338\",nrarr:\"\\u219b\",nrArr:\"\\u21cf\",nrarrw:\"\\u219d\\u0338\",nrightarrow:\"\\u219b\",nRightarrow:\"\\u21cf\",nrtri:\"\\u22eb\",nrtrie:\"\\u22ed\",nsc:\"\\u2281\",nsccue:\"\\u22e1\",nsce:\"\\u2ab0\\u0338\",Nscr:\"\\ud835\\udca9\",nscr:\"\\ud835\\udcc3\",nshortmid:\"\\u2224\",nshortparallel:\"\\u2226\",nsim:\"\\u2241\",nsime:\"\\u2244\",nsimeq:\"\\u2244\",nsmid:\"\\u2224\",nspar:\"\\u2226\",nsqsube:\"\\u22e2\",nsqsupe:\"\\u22e3\",nsub:\"\\u2284\",nsubE:\"\\u2ac5\\u0338\",nsube:\"\\u2288\",nsubset:\"\\u2282\\u20d2\",nsubseteq:\"\\u2288\",nsubseteqq:\"\\u2ac5\\u0338\",nsucc:\"\\u2281\",nsucceq:\"\\u2ab0\\u0338\",nsup:\"\\u2285\",nsupE:\"\\u2ac6\\u0338\",nsupe:\"\\u2289\",nsupset:\"\\u2283\\u20d2\",nsupseteq:\"\\u2289\",nsupseteqq:\"\\u2ac6\\u0338\",ntgl:\"\\u2279\",Ntilde:\"\\xd1\",ntilde:\"\\xf1\",ntlg:\"\\u2278\",ntriangleleft:\"\\u22ea\",ntrianglelefteq:\"\\u22ec\",ntriangleright:\"\\u22eb\",ntrianglerighteq:\"\\u22ed\",Nu:\"\\u039d\",nu:\"\\u03bd\",num:\"#\",numero:\"\\u2116\",numsp:\"\\u2007\",nvap:\"\\u224d\\u20d2\",nvdash:\"\\u22ac\",nvDash:\"\\u22ad\",nVdash:\"\\u22ae\",nVDash:\"\\u22af\",nvge:\"\\u2265\\u20d2\",nvgt:\">\\u20d2\",nvHarr:\"\\u2904\",nvinfin:\"\\u29de\",nvlArr:\"\\u2902\",nvle:\"\\u2264\\u20d2\",nvlt:\"<\\u20d2\",nvltrie:\"\\u22b4\\u20d2\",nvrArr:\"\\u2903\",nvrtrie:\"\\u22b5\\u20d2\",nvsim:\"\\u223c\\u20d2\",nwarhk:\"\\u2923\",nwarr:\"\\u2196\",nwArr:\"\\u21d6\",nwarrow:\"\\u2196\",nwnear:\"\\u2927\",Oacute:\"\\xd3\",oacute:\"\\xf3\",oast:\"\\u229b\",Ocirc:\"\\xd4\",ocirc:\"\\xf4\",ocir:\"\\u229a\",Ocy:\"\\u041e\",ocy:\"\\u043e\",odash:\"\\u229d\",Odblac:\"\\u0150\",odblac:\"\\u0151\",odiv:\"\\u2a38\",odot:\"\\u2299\",odsold:\"\\u29bc\",OElig:\"\\u0152\",oelig:\"\\u0153\",ofcir:\"\\u29bf\",Ofr:\"\\ud835\\udd12\",ofr:\"\\ud835\\udd2c\",ogon:\"\\u02db\",Ograve:\"\\xd2\",ograve:\"\\xf2\",ogt:\"\\u29c1\",ohbar:\"\\u29b5\",ohm:\"\\u03a9\",oint:\"\\u222e\",olarr:\"\\u21ba\",olcir:\"\\u29be\",olcross:\"\\u29bb\",oline:\"\\u203e\",olt:\"\\u29c0\",Omacr:\"\\u014c\",omacr:\"\\u014d\",Omega:\"\\u03a9\",omega:\"\\u03c9\",Omicron:\"\\u039f\",omicron:\"\\u03bf\",omid:\"\\u29b6\",ominus:\"\\u2296\",Oopf:\"\\ud835\\udd46\",oopf:\"\\ud835\\udd60\",opar:\"\\u29b7\",OpenCurlyDoubleQuote:\"\\u201c\",OpenCurlyQuote:\"\\u2018\",operp:\"\\u29b9\",oplus:\"\\u2295\",orarr:\"\\u21bb\",Or:\"\\u2a54\",or:\"\\u2228\",ord:\"\\u2a5d\",order:\"\\u2134\",orderof:\"\\u2134\",ordf:\"\\xaa\",ordm:\"\\xba\",origof:\"\\u22b6\",oror:\"\\u2a56\",orslope:\"\\u2a57\",orv:\"\\u2a5b\",oS:\"\\u24c8\",Oscr:\"\\ud835\\udcaa\",oscr:\"\\u2134\",Oslash:\"\\xd8\",oslash:\"\\xf8\",osol:\"\\u2298\",Otilde:\"\\xd5\",otilde:\"\\xf5\",otimesas:\"\\u2a36\",Otimes:\"\\u2a37\",otimes:\"\\u2297\",Ouml:\"\\xd6\",ouml:\"\\xf6\",ovbar:\"\\u233d\",OverBar:\"\\u203e\",OverBrace:\"\\u23de\",OverBracket:\"\\u23b4\",OverParenthesis:\"\\u23dc\",para:\"\\xb6\",parallel:\"\\u2225\",par:\"\\u2225\",parsim:\"\\u2af3\",parsl:\"\\u2afd\",part:\"\\u2202\",PartialD:\"\\u2202\",Pcy:\"\\u041f\",pcy:\"\\u043f\",percnt:\"%\",period:\".\",permil:\"\\u2030\",perp:\"\\u22a5\",pertenk:\"\\u2031\",Pfr:\"\\ud835\\udd13\",pfr:\"\\ud835\\udd2d\",Phi:\"\\u03a6\",phi:\"\\u03c6\",phiv:\"\\u03d5\",phmmat:\"\\u2133\",phone:\"\\u260e\",Pi:\"\\u03a0\",pi:\"\\u03c0\",pitchfork:\"\\u22d4\",piv:\"\\u03d6\",planck:\"\\u210f\",planckh:\"\\u210e\",plankv:\"\\u210f\",plusacir:\"\\u2a23\",plusb:\"\\u229e\",pluscir:\"\\u2a22\",plus:\"+\",plusdo:\"\\u2214\",plusdu:\"\\u2a25\",pluse:\"\\u2a72\",PlusMinus:\"\\xb1\",plusmn:\"\\xb1\",plussim:\"\\u2a26\",plustwo:\"\\u2a27\",pm:\"\\xb1\",Poincareplane:\"\\u210c\",pointint:\"\\u2a15\",popf:\"\\ud835\\udd61\",Popf:\"\\u2119\",pound:\"\\xa3\",prap:\"\\u2ab7\",Pr:\"\\u2abb\",pr:\"\\u227a\",prcue:\"\\u227c\",precapprox:\"\\u2ab7\",prec:\"\\u227a\",preccurlyeq:\"\\u227c\",Precedes:\"\\u227a\",PrecedesEqual:\"\\u2aaf\",PrecedesSlantEqual:\"\\u227c\",PrecedesTilde:\"\\u227e\",preceq:\"\\u2aaf\",precnapprox:\"\\u2ab9\",precneqq:\"\\u2ab5\",precnsim:\"\\u22e8\",pre:\"\\u2aaf\",prE:\"\\u2ab3\",precsim:\"\\u227e\",prime:\"\\u2032\",Prime:\"\\u2033\",primes:\"\\u2119\",prnap:\"\\u2ab9\",prnE:\"\\u2ab5\",prnsim:\"\\u22e8\",prod:\"\\u220f\",Product:\"\\u220f\",profalar:\"\\u232e\",profline:\"\\u2312\",profsurf:\"\\u2313\",prop:\"\\u221d\",Proportional:\"\\u221d\",Proportion:\"\\u2237\",propto:\"\\u221d\",prsim:\"\\u227e\",prurel:\"\\u22b0\",Pscr:\"\\ud835\\udcab\",pscr:\"\\ud835\\udcc5\",Psi:\"\\u03a8\",psi:\"\\u03c8\",puncsp:\"\\u2008\",Qfr:\"\\ud835\\udd14\",qfr:\"\\ud835\\udd2e\",qint:\"\\u2a0c\",qopf:\"\\ud835\\udd62\",Qopf:\"\\u211a\",qprime:\"\\u2057\",Qscr:\"\\ud835\\udcac\",qscr:\"\\ud835\\udcc6\",quaternions:\"\\u210d\",quatint:\"\\u2a16\",quest:\"?\",questeq:\"\\u225f\",quot:'\"',QUOT:'\"',rAarr:\"\\u21db\",race:\"\\u223d\\u0331\",Racute:\"\\u0154\",racute:\"\\u0155\",radic:\"\\u221a\",raemptyv:\"\\u29b3\",rang:\"\\u27e9\",Rang:\"\\u27eb\",rangd:\"\\u2992\",range:\"\\u29a5\",rangle:\"\\u27e9\",raquo:\"\\xbb\",rarrap:\"\\u2975\",rarrb:\"\\u21e5\",rarrbfs:\"\\u2920\",rarrc:\"\\u2933\",rarr:\"\\u2192\",Rarr:\"\\u21a0\",rArr:\"\\u21d2\",rarrfs:\"\\u291e\",rarrhk:\"\\u21aa\",rarrlp:\"\\u21ac\",rarrpl:\"\\u2945\",rarrsim:\"\\u2974\",Rarrtl:\"\\u2916\",rarrtl:\"\\u21a3\",rarrw:\"\\u219d\",ratail:\"\\u291a\",rAtail:\"\\u291c\",ratio:\"\\u2236\",rationals:\"\\u211a\",rbarr:\"\\u290d\",rBarr:\"\\u290f\",RBarr:\"\\u2910\",rbbrk:\"\\u2773\",rbrace:\"}\",rbrack:\"]\",rbrke:\"\\u298c\",rbrksld:\"\\u298e\",rbrkslu:\"\\u2990\",Rcaron:\"\\u0158\",rcaron:\"\\u0159\",Rcedil:\"\\u0156\",rcedil:\"\\u0157\",rceil:\"\\u2309\",rcub:\"}\",Rcy:\"\\u0420\",rcy:\"\\u0440\",rdca:\"\\u2937\",rdldhar:\"\\u2969\",rdquo:\"\\u201d\",rdquor:\"\\u201d\",rdsh:\"\\u21b3\",real:\"\\u211c\",realine:\"\\u211b\",realpart:\"\\u211c\",reals:\"\\u211d\",Re:\"\\u211c\",rect:\"\\u25ad\",reg:\"\\xae\",REG:\"\\xae\",ReverseElement:\"\\u220b\",ReverseEquilibrium:\"\\u21cb\",ReverseUpEquilibrium:\"\\u296f\",rfisht:\"\\u297d\",rfloor:\"\\u230b\",rfr:\"\\ud835\\udd2f\",Rfr:\"\\u211c\",rHar:\"\\u2964\",rhard:\"\\u21c1\",rharu:\"\\u21c0\",rharul:\"\\u296c\",Rho:\"\\u03a1\",rho:\"\\u03c1\",rhov:\"\\u03f1\",RightAngleBracket:\"\\u27e9\",RightArrowBar:\"\\u21e5\",rightarrow:\"\\u2192\",RightArrow:\"\\u2192\",Rightarrow:\"\\u21d2\",RightArrowLeftArrow:\"\\u21c4\",rightarrowtail:\"\\u21a3\",RightCeiling:\"\\u2309\",RightDoubleBracket:\"\\u27e7\",RightDownTeeVector:\"\\u295d\",RightDownVectorBar:\"\\u2955\",RightDownVector:\"\\u21c2\",RightFloor:\"\\u230b\",rightharpoondown:\"\\u21c1\",rightharpoonup:\"\\u21c0\",rightleftarrows:\"\\u21c4\",rightleftharpoons:\"\\u21cc\",rightrightarrows:\"\\u21c9\",rightsquigarrow:\"\\u219d\",RightTeeArrow:\"\\u21a6\",RightTee:\"\\u22a2\",RightTeeVector:\"\\u295b\",rightthreetimes:\"\\u22cc\",RightTriangleBar:\"\\u29d0\",RightTriangle:\"\\u22b3\",RightTriangleEqual:\"\\u22b5\",RightUpDownVector:\"\\u294f\",RightUpTeeVector:\"\\u295c\",RightUpVectorBar:\"\\u2954\",RightUpVector:\"\\u21be\",RightVectorBar:\"\\u2953\",RightVector:\"\\u21c0\",ring:\"\\u02da\",risingdotseq:\"\\u2253\",rlarr:\"\\u21c4\",rlhar:\"\\u21cc\",rlm:\"\\u200f\",rmoustache:\"\\u23b1\",rmoust:\"\\u23b1\",rnmid:\"\\u2aee\",roang:\"\\u27ed\",roarr:\"\\u21fe\",robrk:\"\\u27e7\",ropar:\"\\u2986\",ropf:\"\\ud835\\udd63\",Ropf:\"\\u211d\",roplus:\"\\u2a2e\",rotimes:\"\\u2a35\",RoundImplies:\"\\u2970\",rpar:\")\",rpargt:\"\\u2994\",rppolint:\"\\u2a12\",rrarr:\"\\u21c9\",Rrightarrow:\"\\u21db\",rsaquo:\"\\u203a\",rscr:\"\\ud835\\udcc7\",Rscr:\"\\u211b\",rsh:\"\\u21b1\",Rsh:\"\\u21b1\",rsqb:\"]\",rsquo:\"\\u2019\",rsquor:\"\\u2019\",rthree:\"\\u22cc\",rtimes:\"\\u22ca\",rtri:\"\\u25b9\",rtrie:\"\\u22b5\",rtrif:\"\\u25b8\",rtriltri:\"\\u29ce\",RuleDelayed:\"\\u29f4\",ruluhar:\"\\u2968\",rx:\"\\u211e\",Sacute:\"\\u015a\",sacute:\"\\u015b\",sbquo:\"\\u201a\",scap:\"\\u2ab8\",Scaron:\"\\u0160\",scaron:\"\\u0161\",Sc:\"\\u2abc\",sc:\"\\u227b\",sccue:\"\\u227d\",sce:\"\\u2ab0\",scE:\"\\u2ab4\",Scedil:\"\\u015e\",scedil:\"\\u015f\",Scirc:\"\\u015c\",scirc:\"\\u015d\",scnap:\"\\u2aba\",scnE:\"\\u2ab6\",scnsim:\"\\u22e9\",scpolint:\"\\u2a13\",scsim:\"\\u227f\",Scy:\"\\u0421\",scy:\"\\u0441\",sdotb:\"\\u22a1\",sdot:\"\\u22c5\",sdote:\"\\u2a66\",searhk:\"\\u2925\",searr:\"\\u2198\",seArr:\"\\u21d8\",searrow:\"\\u2198\",sect:\"\\xa7\",semi:\";\",seswar:\"\\u2929\",setminus:\"\\u2216\",setmn:\"\\u2216\",sext:\"\\u2736\",Sfr:\"\\ud835\\udd16\",sfr:\"\\ud835\\udd30\",sfrown:\"\\u2322\",sharp:\"\\u266f\",SHCHcy:\"\\u0429\",shchcy:\"\\u0449\",SHcy:\"\\u0428\",shcy:\"\\u0448\",ShortDownArrow:\"\\u2193\",ShortLeftArrow:\"\\u2190\",shortmid:\"\\u2223\",shortparallel:\"\\u2225\",ShortRightArrow:\"\\u2192\",ShortUpArrow:\"\\u2191\",shy:\"\\xad\",Sigma:\"\\u03a3\",sigma:\"\\u03c3\",sigmaf:\"\\u03c2\",sigmav:\"\\u03c2\",sim:\"\\u223c\",simdot:\"\\u2a6a\",sime:\"\\u2243\",simeq:\"\\u2243\",simg:\"\\u2a9e\",simgE:\"\\u2aa0\",siml:\"\\u2a9d\",simlE:\"\\u2a9f\",simne:\"\\u2246\",simplus:\"\\u2a24\",simrarr:\"\\u2972\",slarr:\"\\u2190\",SmallCircle:\"\\u2218\",smallsetminus:\"\\u2216\",smashp:\"\\u2a33\",smeparsl:\"\\u29e4\",smid:\"\\u2223\",smile:\"\\u2323\",smt:\"\\u2aaa\",smte:\"\\u2aac\",smtes:\"\\u2aac\\ufe00\",SOFTcy:\"\\u042c\",softcy:\"\\u044c\",solbar:\"\\u233f\",solb:\"\\u29c4\",sol:\"/\",Sopf:\"\\ud835\\udd4a\",sopf:\"\\ud835\\udd64\",spades:\"\\u2660\",spadesuit:\"\\u2660\",spar:\"\\u2225\",sqcap:\"\\u2293\",sqcaps:\"\\u2293\\ufe00\",sqcup:\"\\u2294\",sqcups:\"\\u2294\\ufe00\",Sqrt:\"\\u221a\",sqsub:\"\\u228f\",sqsube:\"\\u2291\",sqsubset:\"\\u228f\",sqsubseteq:\"\\u2291\",sqsup:\"\\u2290\",sqsupe:\"\\u2292\",sqsupset:\"\\u2290\",sqsupseteq:\"\\u2292\",square:\"\\u25a1\",Square:\"\\u25a1\",SquareIntersection:\"\\u2293\",SquareSubset:\"\\u228f\",SquareSubsetEqual:\"\\u2291\",SquareSuperset:\"\\u2290\",SquareSupersetEqual:\"\\u2292\",SquareUnion:\"\\u2294\",squarf:\"\\u25aa\",squ:\"\\u25a1\",squf:\"\\u25aa\",srarr:\"\\u2192\",Sscr:\"\\ud835\\udcae\",sscr:\"\\ud835\\udcc8\",ssetmn:\"\\u2216\",ssmile:\"\\u2323\",sstarf:\"\\u22c6\",Star:\"\\u22c6\",star:\"\\u2606\",starf:\"\\u2605\",straightepsilon:\"\\u03f5\",straightphi:\"\\u03d5\",strns:\"\\xaf\",sub:\"\\u2282\",Sub:\"\\u22d0\",subdot:\"\\u2abd\",subE:\"\\u2ac5\",sube:\"\\u2286\",subedot:\"\\u2ac3\",submult:\"\\u2ac1\",subnE:\"\\u2acb\",subne:\"\\u228a\",subplus:\"\\u2abf\",subrarr:\"\\u2979\",subset:\"\\u2282\",Subset:\"\\u22d0\",subseteq:\"\\u2286\",subseteqq:\"\\u2ac5\",SubsetEqual:\"\\u2286\",subsetneq:\"\\u228a\",subsetneqq:\"\\u2acb\",subsim:\"\\u2ac7\",subsub:\"\\u2ad5\",subsup:\"\\u2ad3\",succapprox:\"\\u2ab8\",succ:\"\\u227b\",succcurlyeq:\"\\u227d\",Succeeds:\"\\u227b\",SucceedsEqual:\"\\u2ab0\",SucceedsSlantEqual:\"\\u227d\",SucceedsTilde:\"\\u227f\",succeq:\"\\u2ab0\",succnapprox:\"\\u2aba\",succneqq:\"\\u2ab6\",succnsim:\"\\u22e9\",succsim:\"\\u227f\",SuchThat:\"\\u220b\",sum:\"\\u2211\",Sum:\"\\u2211\",sung:\"\\u266a\",sup1:\"\\xb9\",sup2:\"\\xb2\",sup3:\"\\xb3\",sup:\"\\u2283\",Sup:\"\\u22d1\",supdot:\"\\u2abe\",supdsub:\"\\u2ad8\",supE:\"\\u2ac6\",supe:\"\\u2287\",supedot:\"\\u2ac4\",Superset:\"\\u2283\",SupersetEqual:\"\\u2287\",suphsol:\"\\u27c9\",suphsub:\"\\u2ad7\",suplarr:\"\\u297b\",supmult:\"\\u2ac2\",supnE:\"\\u2acc\",supne:\"\\u228b\",supplus:\"\\u2ac0\",supset:\"\\u2283\",Supset:\"\\u22d1\",supseteq:\"\\u2287\",supseteqq:\"\\u2ac6\",supsetneq:\"\\u228b\",supsetneqq:\"\\u2acc\",supsim:\"\\u2ac8\",supsub:\"\\u2ad4\",supsup:\"\\u2ad6\",swarhk:\"\\u2926\",swarr:\"\\u2199\",swArr:\"\\u21d9\",swarrow:\"\\u2199\",swnwar:\"\\u292a\",szlig:\"\\xdf\",Tab:\"\\t\",target:\"\\u2316\",Tau:\"\\u03a4\",tau:\"\\u03c4\",tbrk:\"\\u23b4\",Tcaron:\"\\u0164\",tcaron:\"\\u0165\",Tcedil:\"\\u0162\",tcedil:\"\\u0163\",Tcy:\"\\u0422\",tcy:\"\\u0442\",tdot:\"\\u20db\",telrec:\"\\u2315\",Tfr:\"\\ud835\\udd17\",tfr:\"\\ud835\\udd31\",there4:\"\\u2234\",therefore:\"\\u2234\",Therefore:\"\\u2234\",Theta:\"\\u0398\",theta:\"\\u03b8\",thetasym:\"\\u03d1\",thetav:\"\\u03d1\",thickapprox:\"\\u2248\",thicksim:\"\\u223c\",ThickSpace:\"\\u205f\\u200a\",ThinSpace:\"\\u2009\",thinsp:\"\\u2009\",thkap:\"\\u2248\",thksim:\"\\u223c\",THORN:\"\\xde\",thorn:\"\\xfe\",tilde:\"\\u02dc\",Tilde:\"\\u223c\",TildeEqual:\"\\u2243\",TildeFullEqual:\"\\u2245\",TildeTilde:\"\\u2248\",timesbar:\"\\u2a31\",timesb:\"\\u22a0\",times:\"\\xd7\",timesd:\"\\u2a30\",tint:\"\\u222d\",toea:\"\\u2928\",topbot:\"\\u2336\",topcir:\"\\u2af1\",top:\"\\u22a4\",Topf:\"\\ud835\\udd4b\",topf:\"\\ud835\\udd65\",topfork:\"\\u2ada\",tosa:\"\\u2929\",tprime:\"\\u2034\",trade:\"\\u2122\",TRADE:\"\\u2122\",triangle:\"\\u25b5\",triangledown:\"\\u25bf\",triangleleft:\"\\u25c3\",trianglelefteq:\"\\u22b4\",triangleq:\"\\u225c\",triangleright:\"\\u25b9\",trianglerighteq:\"\\u22b5\",tridot:\"\\u25ec\",trie:\"\\u225c\",triminus:\"\\u2a3a\",TripleDot:\"\\u20db\",triplus:\"\\u2a39\",trisb:\"\\u29cd\",tritime:\"\\u2a3b\",trpezium:\"\\u23e2\",Tscr:\"\\ud835\\udcaf\",tscr:\"\\ud835\\udcc9\",TScy:\"\\u0426\",tscy:\"\\u0446\",TSHcy:\"\\u040b\",tshcy:\"\\u045b\",Tstrok:\"\\u0166\",tstrok:\"\\u0167\",twixt:\"\\u226c\",twoheadleftarrow:\"\\u219e\",twoheadrightarrow:\"\\u21a0\",Uacute:\"\\xda\",uacute:\"\\xfa\",uarr:\"\\u2191\",Uarr:\"\\u219f\",uArr:\"\\u21d1\",Uarrocir:\"\\u2949\",Ubrcy:\"\\u040e\",ubrcy:\"\\u045e\",Ubreve:\"\\u016c\",ubreve:\"\\u016d\",Ucirc:\"\\xdb\",ucirc:\"\\xfb\",Ucy:\"\\u0423\",ucy:\"\\u0443\",udarr:\"\\u21c5\",Udblac:\"\\u0170\",udblac:\"\\u0171\",udhar:\"\\u296e\",ufisht:\"\\u297e\",Ufr:\"\\ud835\\udd18\",ufr:\"\\ud835\\udd32\",Ugrave:\"\\xd9\",ugrave:\"\\xf9\",uHar:\"\\u2963\",uharl:\"\\u21bf\",uharr:\"\\u21be\",uhblk:\"\\u2580\",ulcorn:\"\\u231c\",ulcorner:\"\\u231c\",ulcrop:\"\\u230f\",ultri:\"\\u25f8\",Umacr:\"\\u016a\",umacr:\"\\u016b\",uml:\"\\xa8\",UnderBar:\"_\",UnderBrace:\"\\u23df\",UnderBracket:\"\\u23b5\",UnderParenthesis:\"\\u23dd\",Union:\"\\u22c3\",UnionPlus:\"\\u228e\",Uogon:\"\\u0172\",uogon:\"\\u0173\",Uopf:\"\\ud835\\udd4c\",uopf:\"\\ud835\\udd66\",UpArrowBar:\"\\u2912\",uparrow:\"\\u2191\",UpArrow:\"\\u2191\",Uparrow:\"\\u21d1\",UpArrowDownArrow:\"\\u21c5\",updownarrow:\"\\u2195\",UpDownArrow:\"\\u2195\",Updownarrow:\"\\u21d5\",UpEquilibrium:\"\\u296e\",upharpoonleft:\"\\u21bf\",upharpoonright:\"\\u21be\",uplus:\"\\u228e\",UpperLeftArrow:\"\\u2196\",UpperRightArrow:\"\\u2197\",upsi:\"\\u03c5\",Upsi:\"\\u03d2\",upsih:\"\\u03d2\",Upsilon:\"\\u03a5\",upsilon:\"\\u03c5\",UpTeeArrow:\"\\u21a5\",UpTee:\"\\u22a5\",upuparrows:\"\\u21c8\",urcorn:\"\\u231d\",urcorner:\"\\u231d\",urcrop:\"\\u230e\",Uring:\"\\u016e\",uring:\"\\u016f\",urtri:\"\\u25f9\",Uscr:\"\\ud835\\udcb0\",uscr:\"\\ud835\\udcca\",utdot:\"\\u22f0\",Utilde:\"\\u0168\",utilde:\"\\u0169\",utri:\"\\u25b5\",utrif:\"\\u25b4\",uuarr:\"\\u21c8\",Uuml:\"\\xdc\",uuml:\"\\xfc\",uwangle:\"\\u29a7\",vangrt:\"\\u299c\",varepsilon:\"\\u03f5\",varkappa:\"\\u03f0\",varnothing:\"\\u2205\",varphi:\"\\u03d5\",varpi:\"\\u03d6\",varpropto:\"\\u221d\",varr:\"\\u2195\",vArr:\"\\u21d5\",varrho:\"\\u03f1\",varsigma:\"\\u03c2\",varsubsetneq:\"\\u228a\\ufe00\",varsubsetneqq:\"\\u2acb\\ufe00\",varsupsetneq:\"\\u228b\\ufe00\",varsupsetneqq:\"\\u2acc\\ufe00\",vartheta:\"\\u03d1\",vartriangleleft:\"\\u22b2\",vartriangleright:\"\\u22b3\",vBar:\"\\u2ae8\",Vbar:\"\\u2aeb\",vBarv:\"\\u2ae9\",Vcy:\"\\u0412\",vcy:\"\\u0432\",vdash:\"\\u22a2\",vDash:\"\\u22a8\",Vdash:\"\\u22a9\",VDash:\"\\u22ab\",Vdashl:\"\\u2ae6\",veebar:\"\\u22bb\",vee:\"\\u2228\",Vee:\"\\u22c1\",veeeq:\"\\u225a\",vellip:\"\\u22ee\",verbar:\"|\",Verbar:\"\\u2016\",vert:\"|\",Vert:\"\\u2016\",VerticalBar:\"\\u2223\",VerticalLine:\"|\",VerticalSeparator:\"\\u2758\",VerticalTilde:\"\\u2240\",VeryThinSpace:\"\\u200a\",Vfr:\"\\ud835\\udd19\",vfr:\"\\ud835\\udd33\",vltri:\"\\u22b2\",vnsub:\"\\u2282\\u20d2\",vnsup:\"\\u2283\\u20d2\",Vopf:\"\\ud835\\udd4d\",vopf:\"\\ud835\\udd67\",vprop:\"\\u221d\",vrtri:\"\\u22b3\",Vscr:\"\\ud835\\udcb1\",vscr:\"\\ud835\\udccb\",vsubnE:\"\\u2acb\\ufe00\",vsubne:\"\\u228a\\ufe00\",vsupnE:\"\\u2acc\\ufe00\",vsupne:\"\\u228b\\ufe00\",Vvdash:\"\\u22aa\",vzigzag:\"\\u299a\",Wcirc:\"\\u0174\",wcirc:\"\\u0175\",wedbar:\"\\u2a5f\",wedge:\"\\u2227\",Wedge:\"\\u22c0\",wedgeq:\"\\u2259\",weierp:\"\\u2118\",Wfr:\"\\ud835\\udd1a\",wfr:\"\\ud835\\udd34\",Wopf:\"\\ud835\\udd4e\",wopf:\"\\ud835\\udd68\",wp:\"\\u2118\",wr:\"\\u2240\",wreath:\"\\u2240\",Wscr:\"\\ud835\\udcb2\",wscr:\"\\ud835\\udccc\",xcap:\"\\u22c2\",xcirc:\"\\u25ef\",xcup:\"\\u22c3\",xdtri:\"\\u25bd\",Xfr:\"\\ud835\\udd1b\",xfr:\"\\ud835\\udd35\",xharr:\"\\u27f7\",xhArr:\"\\u27fa\",Xi:\"\\u039e\",xi:\"\\u03be\",xlarr:\"\\u27f5\",xlArr:\"\\u27f8\",xmap:\"\\u27fc\",xnis:\"\\u22fb\",xodot:\"\\u2a00\",Xopf:\"\\ud835\\udd4f\",xopf:\"\\ud835\\udd69\",xoplus:\"\\u2a01\",xotime:\"\\u2a02\",xrarr:\"\\u27f6\",xrArr:\"\\u27f9\",Xscr:\"\\ud835\\udcb3\",xscr:\"\\ud835\\udccd\",xsqcup:\"\\u2a06\",xuplus:\"\\u2a04\",xutri:\"\\u25b3\",xvee:\"\\u22c1\",xwedge:\"\\u22c0\",Yacute:\"\\xdd\",yacute:\"\\xfd\",YAcy:\"\\u042f\",yacy:\"\\u044f\",Ycirc:\"\\u0176\",ycirc:\"\\u0177\",Ycy:\"\\u042b\",ycy:\"\\u044b\",yen:\"\\xa5\",Yfr:\"\\ud835\\udd1c\",yfr:\"\\ud835\\udd36\",YIcy:\"\\u0407\",yicy:\"\\u0457\",Yopf:\"\\ud835\\udd50\",yopf:\"\\ud835\\udd6a\",Yscr:\"\\ud835\\udcb4\",yscr:\"\\ud835\\udcce\",YUcy:\"\\u042e\",yucy:\"\\u044e\",yuml:\"\\xff\",Yuml:\"\\u0178\",Zacute:\"\\u0179\",zacute:\"\\u017a\",Zcaron:\"\\u017d\",zcaron:\"\\u017e\",Zcy:\"\\u0417\",zcy:\"\\u0437\",Zdot:\"\\u017b\",zdot:\"\\u017c\",zeetrf:\"\\u2128\",ZeroWidthSpace:\"\\u200b\",Zeta:\"\\u0396\",zeta:\"\\u03b6\",zfr:\"\\ud835\\udd37\",Zfr:\"\\u2128\",ZHcy:\"\\u0416\",zhcy:\"\\u0436\",zigrarr:\"\\u21dd\",zopf:\"\\ud835\\udd6b\",Zopf:\"\\u2124\",Zscr:\"\\ud835\\udcb5\",zscr:\"\\ud835\\udccf\",zwj:\"\\u200d\",zwnj:\"\\u200c\"}},{}],53:[function(e,r,t){\"use strict\";function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){r&&Object.keys(r).forEach(function(t){e[t]=r[t]})}),e}function s(e){return Object.prototype.toString.call(e)}function o(e){return\"[object String]\"===s(e)}function i(e){return\"[object Object]\"===s(e)}function a(e){return\"[object RegExp]\"===s(e)}function c(e){return\"[object Function]\"===s(e)}function l(e){return e.replace(/[.?*+^$[\\]\\\\(){}|-]/g,\"\\\\$&\")}function u(e){return Object.keys(e||{}).reduce(function(e,r){return e||b.hasOwnProperty(r)},!1)}function p(e){e.__index__=-1,e.__text_cache__=\"\"}function h(e){return function(r,t){var n=r.slice(t);return e.test(n)?n.match(e)[0].length:0}}function f(){return function(e,r){r.normalize(e)}}function d(r){function t(e){return e.replace(\"%TLDS%\",s.src_tlds)}function n(e,r){throw new Error('(LinkifyIt) Invalid schema \"'+e+'\": '+r)}var s=r.re=e(\"./lib/re\")(r.__opts__),u=r.__tlds__.slice();r.onCompile(),r.__tlds_replaced__||u.push(\"a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]\"),u.push(s.src_xn),s.src_tlds=u.join(\"|\"),s.email_fuzzy=RegExp(t(s.tpl_email_fuzzy),\"i\"),s.link_fuzzy=RegExp(t(s.tpl_link_fuzzy),\"i\"),s.link_no_ip_fuzzy=RegExp(t(s.tpl_link_no_ip_fuzzy),\"i\"),s.host_fuzzy_test=RegExp(t(s.tpl_host_fuzzy_test),\"i\");var d=[];r.__compiled__={},Object.keys(r.__schemas__).forEach(function(e){var t=r.__schemas__[e];if(null!==t){var s={validate:null,link:null};return r.__compiled__[e]=s,i(t)?(a(t.validate)?s.validate=h(t.validate):c(t.validate)?s.validate=t.validate:n(e,t),void(c(t.normalize)?s.normalize=t.normalize:t.normalize?n(e,t):s.normalize=f())):o(t)?void d.push(e):void n(e,t)}}),d.forEach(function(e){r.__compiled__[r.__schemas__[e]]&&(r.__compiled__[e].validate=r.__compiled__[r.__schemas__[e]].validate,r.__compiled__[e].normalize=r.__compiled__[r.__schemas__[e]].normalize)}),r.__compiled__[\"\"]={validate:null,normalize:f()};var m=Object.keys(r.__compiled__).filter(function(e){return e.length>0&&r.__compiled__[e]}).map(l).join(\"|\");r.re.schema_test=RegExp(\"(^|(?!_)(?:[><\\uff5c]|\"+s.src_ZPCc+\"))(\"+m+\")\",\"i\"),r.re.schema_search=RegExp(\"(^|(?!_)(?:[><\\uff5c]|\"+s.src_ZPCc+\"))(\"+m+\")\",\"ig\"),r.re.pretest=RegExp(\"(\"+r.re.schema_test.source+\")|(\"+r.re.host_fuzzy_test.source+\")|@\",\"i\"),p(r)}function m(e,r){var t=e.__index__,n=e.__last_index__,s=e.__text_cache__.slice(t,n);this.schema=e.__schema__.toLowerCase(),this.index=t+r,this.lastIndex=n+r,this.raw=s,this.text=s,this.url=s}function _(e,r){var t=new m(e,r);return e.__compiled__[t.schema].normalize(t,e),t}function g(e,r){if(!(this instanceof g))return new g(e,r);r||u(e)&&(r=e,e={}),this.__opts__=n({},b,r),this.__index__=-1,this.__last_index__=-1,this.__schema__=\"\",this.__text_cache__=\"\",this.__schemas__=n({},k,e),this.__compiled__={},this.__tlds__=v,this.__tlds_replaced__=!1,this.re={},d(this)}var b={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},k={\"http:\":{validate:function(e,r,t){var n=e.slice(r);return t.re.http||(t.re.http=new RegExp(\"^\\\\/\\\\/\"+t.re.src_auth+t.re.src_host_port_strict+t.re.src_path,\"i\")),t.re.http.test(n)?n.match(t.re.http)[0].length:0}},\"https:\":\"http:\",\"ftp:\":\"http:\",\"//\":{validate:function(e,r,t){var n=e.slice(r);return t.re.no_http||(t.re.no_http=new RegExp(\"^\"+t.re.src_auth+\"(?:localhost|(?:(?:\"+t.re.src_domain+\")\\\\.)+\"+t.re.src_domain_root+\")\"+t.re.src_port+t.re.src_host_terminator+t.re.src_path,\"i\")),t.re.no_http.test(n)?r>=3&&\":\"===e[r-3]?0:r>=3&&\"/\"===e[r-3]?0:n.match(t.re.no_http)[0].length:0}},\"mailto:\":{validate:function(e,r,t){var n=e.slice(r);return t.re.mailto||(t.re.mailto=new RegExp(\"^\"+t.re.src_email_name+\"@\"+t.re.src_host_strict,\"i\")),t.re.mailto.test(n)?n.match(t.re.mailto)[0].length:0}}},v=\"biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\\u0440\\u0444\".split(\"|\");g.prototype.add=function(e,r){return this.__schemas__[e]=r,d(this),this},g.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},g.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,t,n,s,o,i,a,c;if(this.re.schema_test.test(e))for(a=this.re.schema_search,a.lastIndex=0;null!==(r=a.exec(e));)if(s=this.testSchemaAt(e,r[2],a.lastIndex)){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+s;break}return this.__opts__.fuzzyLink&&this.__compiled__[\"http:\"]&&(c=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c<this.__index__)&&null!==(t=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(o=t.index+t[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__=\"\",this.__index__=o,this.__last_index__=t.index+t[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__[\"mailto:\"]&&e.indexOf(\"@\")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(o=n.index+n[1].length,i=n.index+n[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&i>this.__last_index__)&&(this.__schema__=\"mailto:\",this.__index__=o,this.__last_index__=i)),this.__index__>=0},g.prototype.pretest=function(e){return this.re.pretest.test(e)},g.prototype.testSchemaAt=function(e,r,t){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,t,this):0},g.prototype.match=function(e){var r=0,t=[];this.__index__>=0&&this.__text_cache__===e&&(t.push(_(this,r)),r=this.__last_index__);for(var n=r?e.slice(r):e;this.test(n);)t.push(_(this,r)),n=n.slice(this.__last_index__),r+=this.__last_index__;return t.length?t:null},g.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,r,t){return e!==t[r-1]}).reverse(),d(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,d(this),this)},g.prototype.normalize=function(e){e.schema||(e.url=\"http://\"+e.url),\"mailto:\"!==e.schema||/^mailto:/i.test(e.url)||(e.url=\"mailto:\"+e.url)},g.prototype.onCompile=function(){},r.exports=g},{\"./lib/re\":54}],54:[function(e,r,t){\"use strict\";r.exports=function(r){var t={};t.src_Any=e(\"uc.micro/properties/Any/regex\").source,t.src_Cc=e(\"uc.micro/categories/Cc/regex\").source,t.src_Z=e(\"uc.micro/categories/Z/regex\").source,t.src_P=e(\"uc.micro/categories/P/regex\").source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(\"|\"),t.src_ZCc=[t.src_Z,t.src_Cc].join(\"|\");return t.src_pseudo_letter=\"(?:(?![><\\uff5c]|\"+t.src_ZPCc+\")\"+t.src_Any+\")\",t.src_ip4=\"(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\",t.src_auth=\"(?:(?:(?!\"+t.src_ZCc+\"|[@/\\\\[\\\\]()]).)+@)?\",t.src_port=\"(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?\",t.src_host_terminator=\"(?=$|[><\\uff5c]|\"+t.src_ZPCc+\")(?!-|_|:\\\\d|\\\\.-|\\\\.(?!$|\"+t.src_ZPCc+\"))\",t.src_path=\"(?:[/?#](?:(?!\"+t.src_ZCc+\"|[><\\uff5c]|[()[\\\\]{}.,\\\"'?!\\\\-]).|\\\\[(?:(?!\"+t.src_ZCc+\"|\\\\]).)*\\\\]|\\\\((?:(?!\"+t.src_ZCc+\"|[)]).)*\\\\)|\\\\{(?:(?!\"+t.src_ZCc+'|[}]).)*\\\\}|\\\\\"(?:(?!'+t.src_ZCc+'|[\"]).)+\\\\\"|\\\\\\'(?:(?!'+t.src_ZCc+\"|[']).)+\\\\'|\\\\'(?=\"+t.src_pseudo_letter+\"|[-]).|\\\\.{2,3}[a-zA-Z0-9%/]|\\\\.(?!\"+t.src_ZCc+\"|[.]).|\"+(r&&r[\"---\"]?\"\\\\-(?!--(?:[^-]|$))(?:-*)|\":\"\\\\-+|\")+\"\\\\,(?!\"+t.src_ZCc+\").|\\\\!(?!\"+t.src_ZCc+\"|[!]).|\\\\?(?!\"+t.src_ZCc+\"|[?]).)+|\\\\/)?\",t.src_email_name='[\\\\-;:&=\\\\+\\\\$,\\\\\"\\\\.a-zA-Z0-9_]+',t.src_xn=\"xn--[a-z0-9\\\\-]{1,59}\",t.src_domain_root=\"(?:\"+t.src_xn+\"|\"+t.src_pseudo_letter+\"{1,63})\",t.src_domain=\"(?:\"+t.src_xn+\"|(?:\"+t.src_pseudo_letter+\")|(?:\"+t.src_pseudo_letter+\"(?:-(?!-)|\"+t.src_pseudo_letter+\"){0,61}\"+t.src_pseudo_letter+\"))\",t.src_host=\"(?:(?:(?:(?:\"+t.src_domain+\")\\\\.)*\"+t.src_domain+\"))\",t.tpl_host_fuzzy=\"(?:\"+t.src_ip4+\"|(?:(?:(?:\"+t.src_domain+\")\\\\.)+(?:%TLDS%)))\",t.tpl_host_no_ip_fuzzy=\"(?:(?:(?:\"+t.src_domain+\")\\\\.)+(?:%TLDS%))\",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=\"localhost|www\\\\.|\\\\.\\\\d{1,3}\\\\.|(?:\\\\.(?:%TLDS%)(?:\"+t.src_ZPCc+\"|>|$))\",t.tpl_email_fuzzy=\"(^|[><\\uff5c]|\\\\(|\"+t.src_ZCc+\")(\"+t.src_email_name+\"@\"+t.tpl_host_fuzzy_strict+\")\",t.tpl_link_fuzzy=\"(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|\"+t.src_ZPCc+\"))((?![$+<=>^`|\\uff5c])\"+t.tpl_host_port_fuzzy_strict+t.src_path+\")\",t.tpl_link_no_ip_fuzzy=\"(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|\"+t.src_ZPCc+\"))((?![$+<=>^`|\\uff5c])\"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+\")\",t}},{\n\"uc.micro/categories/Cc/regex\":61,\"uc.micro/categories/P/regex\":63,\"uc.micro/categories/Z/regex\":64,\"uc.micro/properties/Any/regex\":66}],55:[function(e,r,t){\"use strict\";function n(e){var r,t,n=o[e];if(n)return n;for(n=o[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),n.push(t);for(r=0;r<e.length;r++)t=e.charCodeAt(r),n[t]=\"%\"+(\"0\"+t.toString(16).toUpperCase()).slice(-2);return n}function s(e,r){var t;return\"string\"!=typeof r&&(r=s.defaultChars),t=n(r),e.replace(/(%[a-f0-9]{2})+/gi,function(e){var r,n,s,o,i,a,c,l=\"\";for(r=0,n=e.length;r<n;r+=3)s=parseInt(e.slice(r+1,r+3),16),s<128?l+=t[s]:192==(224&s)&&r+3<n&&128==(192&(o=parseInt(e.slice(r+4,r+6),16)))?(c=s<<6&1984|63&o,l+=c<128?\"\\ufffd\\ufffd\":String.fromCharCode(c),r+=3):224==(240&s)&&r+6<n&&(o=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),128==(192&o)&&128==(192&i))?(c=s<<12&61440|o<<6&4032|63&i,l+=c<2048||c>=55296&&c<=57343?\"\\ufffd\\ufffd\\ufffd\":String.fromCharCode(c),r+=6):240==(248&s)&&r+9<n&&(o=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),a=parseInt(e.slice(r+10,r+12),16),128==(192&o)&&128==(192&i)&&128==(192&a))?(c=s<<18&1835008|o<<12&258048|i<<6&4032|63&a,c<65536||c>1114111?l+=\"\\ufffd\\ufffd\\ufffd\\ufffd\":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),r+=9):l+=\"\\ufffd\";return l})}var o={};s.defaultChars=\";/?:@&=+$,#\",s.componentChars=\"\",r.exports=s},{}],56:[function(e,r,t){\"use strict\";function n(e){var r,t,n=o[e];if(n)return n;for(n=o[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),/^[0-9a-z]$/i.test(t)?n.push(t):n.push(\"%\"+(\"0\"+r.toString(16).toUpperCase()).slice(-2));for(r=0;r<e.length;r++)n[e.charCodeAt(r)]=e[r];return n}function s(e,r,t){var o,i,a,c,l,u=\"\";for(\"string\"!=typeof r&&(t=r,r=s.defaultChars),void 0===t&&(t=!0),l=n(r),o=0,i=e.length;o<i;o++)if(a=e.charCodeAt(o),t&&37===a&&o+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(o+1,o+3)))u+=e.slice(o,o+3),o+=2;else if(a<128)u+=l[a];else if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1<i&&(c=e.charCodeAt(o+1))>=56320&&c<=57343){u+=encodeURIComponent(e[o]+e[o+1]),o++;continue}u+=\"%EF%BF%BD\"}else u+=encodeURIComponent(e[o]);return u}var o={};s.defaultChars=\";/?:@&=+$,-_.!~*'()#\",s.componentChars=\"-_.!~*'()\",r.exports=s},{}],57:[function(e,r,t){\"use strict\";r.exports=function(e){var r=\"\";return r+=e.protocol||\"\",r+=e.slashes?\"//\":\"\",r+=e.auth?e.auth+\"@\":\"\",r+=e.hostname&&e.hostname.indexOf(\":\")!==-1?\"[\"+e.hostname+\"]\":e.hostname||\"\",r+=e.port?\":\"+e.port:\"\",r+=e.pathname||\"\",r+=e.search||\"\",r+=e.hash||\"\"}},{}],58:[function(e,r,t){\"use strict\";r.exports.encode=e(\"./encode\"),r.exports.decode=e(\"./decode\"),r.exports.format=e(\"./format\"),r.exports.parse=e(\"./parse\")},{\"./decode\":55,\"./encode\":56,\"./format\":57,\"./parse\":59}],59:[function(e,r,t){\"use strict\";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}function s(e,r){if(e&&e instanceof n)return e;var t=new n;return t.parse(e,r),t}var o=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,a=/^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,c=[\"<\",\">\",'\"',\"`\",\" \",\"\\r\",\"\\n\",\"\\t\"],l=[\"{\",\"}\",\"|\",\"\\\\\",\"^\",\"`\"].concat(c),u=[\"'\"].concat(l),p=[\"%\",\"/\",\"?\",\";\",\"#\"].concat(u),h=[\"/\",\"?\",\"#\"],f={javascript:!0,\"javascript:\":!0},d={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,\"http:\":!0,\"https:\":!0,\"ftp:\":!0,\"gopher:\":!0,\"file:\":!0};n.prototype.parse=function(e,r){var t,n,s,i,c,l=e;if(l=l.trim(),!r&&1===e.split(\"#\").length){var u=a.exec(l);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}var m=o.exec(l);if(m&&(m=m[0],s=m.toLowerCase(),this.protocol=m,l=l.substr(m.length)),(r||m||l.match(/^\\/\\/[^@\\/]+@[^@\\/]+/))&&(!(c=\"//\"===l.substr(0,2))||m&&f[m]||(l=l.substr(2),this.slashes=!0)),!f[m]&&(c||m&&!d[m])){var _=-1;for(t=0;t<h.length;t++)(i=l.indexOf(h[t]))!==-1&&(_===-1||i<_)&&(_=i);var g,b;for(b=_===-1?l.lastIndexOf(\"@\"):l.lastIndexOf(\"@\",_),b!==-1&&(g=l.slice(0,b),l=l.slice(b+1),this.auth=g),_=-1,t=0;t<p.length;t++)(i=l.indexOf(p[t]))!==-1&&(_===-1||i<_)&&(_=i);_===-1&&(_=l.length),\":\"===l[_-1]&&_--;var k=l.slice(0,_);l=l.slice(_),this.parseHost(k),this.hostname=this.hostname||\"\";var v=\"[\"===this.hostname[0]&&\"]\"===this.hostname[this.hostname.length-1];if(!v){var y=this.hostname.split(/\\./);for(t=0,n=y.length;t<n;t++){var x=y[t];if(x&&!x.match(/^[+a-z0-9A-Z_-]{0,63}$/)){for(var C=\"\",A=0,w=x.length;A<w;A++)C+=x.charCodeAt(A)>127?\"x\":x[A];if(!C.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var D=y.slice(0,t),q=y.slice(t+1),E=x.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);E&&(D.push(E[1]),q.unshift(E[2])),q.length&&(l=q.join(\".\")+l),this.hostname=D.join(\".\");break}}}}this.hostname.length>255&&(this.hostname=\"\"),v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var S=l.indexOf(\"#\");S!==-1&&(this.hash=l.substr(S),l=l.slice(0,S));var F=l.indexOf(\"?\");return F!==-1&&(this.search=l.substr(F),l=l.slice(0,F)),l&&(this.pathname=l),d[s]&&this.hostname&&!this.pathname&&(this.pathname=\"\"),this},n.prototype.parseHost=function(e){var r=i.exec(e);r&&(r=r[0],\":\"!==r&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)},r.exports=s},{}],60:[function(r,t,n){(function(r){!function(s){function o(e){throw new RangeError(w[e])}function i(e,r){for(var t=e.length,n=[];t--;)n[t]=r(e[t]);return n}function a(e,r){var t=e.split(\"@\"),n=\"\";return t.length>1&&(n=t[0]+\"@\",e=t[1]),e=e.replace(/[\\x2E\\u3002\\uFF0E\\uFF61]/g,\".\"),n+i(e.split(\".\"),r).join(\".\")}function c(e){for(var r,t,n=[],s=0,o=e.length;s<o;)r=e.charCodeAt(s++),r>=55296&&r<=56319&&s<o?(t=e.charCodeAt(s++),56320==(64512&t)?n.push(((1023&r)<<10)+(1023&t)+65536):(n.push(r),s--)):n.push(r);return n}function l(e){return i(e,function(e){var r=\"\";return e>65535&&(e-=65536,r+=q(e>>>10&1023|55296),e=56320|1023&e),r+=q(e)}).join(\"\")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36}function p(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function h(e,r,t){var n=0;for(e=t?D(e/700):e>>1,e+=D(e/r);e>455;n+=36)e=D(e/35);return D(n+36*e/(e+38))}function f(e){var r,t,n,s,i,a,c,p,f,d,m=[],_=e.length,g=0,b=128,k=72;for(t=e.lastIndexOf(\"-\"),t<0&&(t=0),n=0;n<t;++n)e.charCodeAt(n)>=128&&o(\"not-basic\"),m.push(e.charCodeAt(n));for(s=t>0?t+1:0;s<_;){for(i=g,a=1,c=36;s>=_&&o(\"invalid-input\"),p=u(e.charCodeAt(s++)),(p>=36||p>D((x-g)/a))&&o(\"overflow\"),g+=p*a,f=c<=k?1:c>=k+26?26:c-k,!(p<f);c+=36)d=36-f,a>D(x/d)&&o(\"overflow\"),a*=d;r=m.length+1,k=h(g-i,r,0==i),D(g/r)>x-b&&o(\"overflow\"),b+=D(g/r),g%=r,m.splice(g++,0,b)}return l(m)}function d(e){var r,t,n,s,i,a,l,u,f,d,m,_,g,b,k,v=[];for(e=c(e),_=e.length,r=128,t=0,i=72,a=0;a<_;++a)(m=e[a])<128&&v.push(q(m));for(n=s=v.length,s&&v.push(\"-\");n<_;){for(l=x,a=0;a<_;++a)(m=e[a])>=r&&m<l&&(l=m);for(g=n+1,l-r>D((x-t)/g)&&o(\"overflow\"),t+=(l-r)*g,r=l,a=0;a<_;++a)if(m=e[a],m<r&&++t>x&&o(\"overflow\"),m==r){for(u=t,f=36;d=f<=i?1:f>=i+26?26:f-i,!(u<d);f+=36)k=u-d,b=36-d,v.push(q(p(d+k%b,0))),u=D(k/b);v.push(q(p(u,0))),i=h(t,g,n==s),t=0,++n}++t,++r}return v.join(\"\")}function m(e){return a(e,function(e){return C.test(e)?f(e.slice(4).toLowerCase()):e})}function _(e){return a(e,function(e){return A.test(e)?\"xn--\"+d(e):e})}var g=\"object\"==typeof n&&n&&!n.nodeType&&n,b=\"object\"==typeof t&&t&&!t.nodeType&&t,k=\"object\"==typeof r&&r;k.global!==k&&k.window!==k&&k.self!==k||(s=k);var v,y,x=2147483647,C=/^xn--/,A=/[^\\x20-\\x7E]/,w={overflow:\"Overflow: input needs wider integers to process\",\"not-basic\":\"Illegal input >= 0x80 (not a basic code point)\",\"invalid-input\":\"Invalid input\"},D=Math.floor,q=String.fromCharCode;if(v={version:\"1.4.1\",ucs2:{decode:c,encode:l},decode:f,encode:d,toASCII:_,toUnicode:m},\"function\"==typeof e&&\"object\"==typeof e.amd&&e.amd)e(\"punycode\",function(){return v});else if(g&&b)if(t.exports==g)b.exports=v;else for(y in v)v.hasOwnProperty(y)&&(g[y]=v[y]);else s.punycode=v}(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],61:[function(e,r,t){r.exports=/[\\0-\\x1F\\x7F-\\x9F]/},{}],62:[function(e,r,t){r.exports=/[\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB]|\\uD804\\uDCBD|\\uD82F[\\uDCA0-\\uDCA3]|\\uD834[\\uDD73-\\uDD7A]|\\uDB40[\\uDC01\\uDC20-\\uDC7F]/},{}],63:[function(e,r,t){r.exports=/[!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E44\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC9\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDC4B-\\uDC4F\\uDC5B\\uDC5D\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDE60-\\uDE6C\\uDF3C-\\uDF3E]|\\uD807[\\uDC41-\\uDC45\\uDC70\\uDC71]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]|\\uD83A[\\uDD5E\\uDD5F]/},{}],64:[function(e,r,t){r.exports=/[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/},{}],65:[function(e,r,t){\"use strict\";t.Any=e(\"./properties/Any/regex\"),t.Cc=e(\"./categories/Cc/regex\"),t.Cf=e(\"./categories/Cf/regex\"),t.P=e(\"./categories/P/regex\"),t.Z=e(\"./categories/Z/regex\")},{\"./categories/Cc/regex\":61,\"./categories/Cf/regex\":62,\"./categories/P/regex\":63,\"./categories/Z/regex\":64,\"./properties/Any/regex\":66}],66:[function(e,r,t){r.exports=/[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/},{}],67:[function(e,r,t){\"use strict\";r.exports=e(\"./lib/\")},{\"./lib/\":9}]},{},[67])(67)});\n",
"type": "application/javascript",
"title": "$:/plugins/btheado/markdown/markdown-it.js",
"module-type": "library"
},
"$:/plugins/btheado/markdown/images/new-markdown-button": {
"title": "$:/plugins/btheado/markdown/images/new-markdown-button",
"tags": "$:/tags/Image",
"text": "<svg class=\"tc-image-new-markdown-button tc-image-button\" viewBox=\"0 0 128 128\" width=\"22pt\" height=\"22pt\">\n <g fill-rule=\"evenodd\">\n <rect x=\"80\" y=\"96\" width=\"48\" height=\"16\" rx=\"8\"></rect>\n <rect x=\"96\" y=\"80\" width=\"16\" height=\"48\" rx=\"8\"></rect>\n <path d=\"M3.23876972,39.5396716 C3.23876972,35.9653274 6.13586353,33.0691646 9.7141757,33.0691646 L98.1283744,33.0691646 C101.706101,33.0691646 104.60378,35.9646626 104.60378,39.5396716 L104.60378,84.8296213 C104.60378,88.4039654 101.706687,91.3001282 98.1283744,91.3001282 L9.7141757,91.3001282 C6.13644944,91.3001282 3.23876972,88.4046302 3.23876972,84.8296213 L3.23876972,39.5396716 L3.23876972,39.5396716 Z M-2.15298617,39.5396716 L-2.15298617,84.8296213 C-2.15298617,91.3833243 3.15957363,96.6918841 9.7141757,96.6918841 L98.1283744,96.6918841 C104.684083,96.6918841 109.995536,91.382138 109.995536,84.8296213 L109.995536,39.5396716 C109.995536,32.9859686 104.682977,27.6774087 98.1283744,27.6774087 L9.7141757,27.6774087 C3.15846686,27.6774087 -2.15298617,32.9871549 -2.15298617,39.5396716 Z M14.0222815,80.5166164 L14.0222815,43.8526764 L24.8057933,43.8526764 L35.589305,57.3320661 L46.3728168,43.8526764 L57.1563286,43.8526764 L57.1563286,80.5166164 L46.3728168,80.5166164 L46.3728168,59.4887685 L35.589305,72.9681582 L24.8057933,59.4887685 L24.8057933,80.5166164 L14.0222815,80.5166164 Z M81.4192301,80.5166164 L65.2439624,62.723822 L76.0274742,62.723822 L76.0274742,43.8526764 L86.810986,43.8526764 L86.810986,62.723822 L97.5944978,62.723822 L81.4192301,80.5166164 Z\"transform=\"translate(53.921275, 62.184646) rotate(-60.000000) translate(-53.921275, -62.184646) \"></path>\n </g>\n</svg>\n"
},
"$:/plugins/btheado/markdown/new-markdown-button": {
"title": "$:/plugins/btheado/markdown/new-markdown-button",
"tags": "$:/tags/PageControls",
"caption": "{{$:/plugins/btheado/markdown/images/new-markdown-button}} {{$:/language/Buttons/NewMarkdown/Caption}}",
"description": "{{$:/language/Buttons/NewMarkdown/Hint}}",
"list-after": "$:/core/ui/Buttons/new-tiddler",
"text": "<$button tooltip={{$:/language/Buttons/NewMarkdown/Hint}} aria-label={{$:/language/Buttons/NewMarkdown/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-new-tiddler\" type=\"text/x-gfm\"/>\n<$list filter=\"[<tv-config-toolbar-icons>prefix[yes]]\">\n{{$:/plugins/btheado/markdown/images/new-markdown-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>prefix[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/NewMarkdown/Caption}}/></span>\n</$list>\n</$button>\n"
},
"$:/plugins/btheado/markdown/readme": {
"title": "$:/plugins/btheado/markdown/readme",
"text": "This is a TiddlyWiki plugin for parsing Markdown text, based on the [[markdown-it|https://github.com/markdown-it/markdown-it]] project.\n\n[[Source code|https://github.com/btheado/tweve/blob/master/src/plugins/btheado/markdown]]\n"
},
"$:/plugins/btheado/markdown/usage": {
"title": "$:/plugins/btheado/markdown/usage",
"text": "Create tiddler with type=x-gfm and the markdown contents will be rendered\n\nSee https://markdown-it.github.io/ for information on the supported markdown\n\nThis plugin depends on the highlightjs plugin being installed.\n"
},
"$:/plugins/btheado/markdown/wrapper.js": {
"text": "/*\\\ntitle: $:/plugins/btheado/markdown/wrapper.js\ntype: application/javascript\nmodule-type: parser\n\nWraps up the markdown-it parser for use in TiddlyWiki5\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar markdown = require(\"$:/plugins/btheado/markdown/markdown-it.js\");\nvar WikiParser = require(\"$:/core/modules/parsers/wikiparser/wikiparser.js\")[\"text/vnd.tiddlywiki\"];\n\n/*\n * The TW markdown parser at http://tiddlywiki.com/plugins/tiddlywiki/markdown/ uses the markdown-js library\n * which does not support code blocks. This one uses markdown-it (https://markdown-it.github.io/)\n * which does support code blocks.\n *\n * The other TW parser makes use of the intermediate json representation of the markdown and converts\n * to a TW parse tree using that. The markdown-it library returns an html string. In order to\n * convert that into the TW parse tree, I'm using quite a bit of a hack here. I'm creating an instance\n * of full TW parser and removing all except for the html parsing. I figure the TW html parser should\n * be able to handle most everything which comes out of the markdown parse.\n */\nvar MarkdownParser = function(type,text,options) {\n var md, html, myparser;\n md = new markdown();\n\n // Replace the codeblock rule to just return a tiddlywiki codeblock which\n // will be parsed with the TW parser. This is to get the highlightjs code\n // highlighting to work. I tried calling highlightjs directly but it\n // resulted in extra html escaping I couldn't figure out. By doing it this\n // way, the normal TW highlightjs plugin can be used without having to explicitly\n // require it here.\n md.renderer.rules.fence = function(tokens, idx) {\n var token = tokens[idx];\n return \"\\n```\" + token.info + \"\\n\" + token.content + \"\\n```\\n\";\n }\n\n // Render the markdown to html and create a TW parser\n html = md.render(text),\n myparser = Object.create(WikiParser.prototype);\n\n // Remove all rules except for html parsing and codeblock\n myparser.pragmaRuleClasses = {};\n myparser.blockRuleClasses = {\n \"codeblock\": myparser.blockRuleClasses.codeblock,\n \"html\": myparser.blockRuleClasses.html\n };\n myparser.inlineRuleClasses = {\"html\": myparser.inlineRuleClasses.html};\n\n // Call the constructor and save the parse tree results\n WikiParser.apply(myparser, [\"text/vnd.tiddlywiki\", html, options]);\n this.tree = myparser.tree;\n};\n\n// I'd rather use text/x-markdown here, but to get syntax highlighting using the\n// codemirror plugin, it needs to be text/x-gfm (i.e. github flavored markdown)\nexports[\"text/x-gfm\"] = MarkdownParser;\n\n})();\n\n",
"title": "$:/plugins/btheado/markdown/wrapper.js",
"type": "application/javascript",
"module-type": "parser"
}
}
}
{
"tiddlers": {
"$:/plugins/btheado/tweve/codemirror-highlightblock.js": {
"text": "/*\\\ntitle: $:/plugins/btheado/tweve/codemirror-highlightblock.js\ntype: application/javascript\nmodule-type: widget\n\nWraps up the fenced code blocks parser for highlight and use in TiddlyWiki5\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n//var TYPE_MAPPINGS_BASE = \"$:/config/HighlightPlugin/TypeMappings/\";\n\nvar CodeBlockWidget = require(\"$:/core/modules/widgets/codeblock.js\").codeblock;\n\n// Skip if the codemirror plugin is not loaded or if not running in browser\nvar tiddler = $tw.wiki.getTiddler(\"$:/plugins/tiddlywiki/codemirror/lib/codemirror.js\");\nif($tw.browser && tiddler) {\n var CodeMirror = require(\"$:/plugins/tiddlywiki/codemirror/lib/codemirror.js\");\n\n // TODO: This will not play nice if user has highlightjs plugin loaded\n CodeBlockWidget.prototype.postRender = function() {\n var domNode = this.domNodes[0],\n language = this.language;\n if(language && CodeMirror.modes.hasOwnProperty(language)) {\n domNode.className = \"cm-s-default\";\n if($tw.browser && !domNode.isTiddlyWikiFakeDom) {\n CodeMirror.runMode(domNode.textContent, language, domNode);\n } else {\n // TODO: I don't understand what this code is trying to do. This is the\n // highlightjs version and I'm not sure what it should do for\n // codemirror runmode.\n /*\n var text = domNode.textContent;\n domNode.children[0].innerHTML = hljs.fixMarkup(hljs.highlight(language,text).value);\n // If we're using the fakedom then specially save the original raw text\n if(domNode.isTiddlyWikiFakeDom) {\n domNode.children[0].textInnerHTML = text;\n }\n */\n }\n }\n };\n}\n\n})();\n",
"title": "$:/plugins/btheado/tweve/codemirror-highlightblock.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/config/EditorTypeMappings/text/x-gfm": {
"created": "20170626012710251",
"creator": "0.0.0.0",
"modified": "20170626012720957",
"modifier": "0.0.0.0",
"tags": "",
"title": "$:/config/EditorTypeMappings/text/x-gfm",
"type": "text/vnd.tiddlywiki",
"text": "codemirror"
},
"$:/plugins/btheado/eve/eve-base.css": {
"text": "/* From https://raw.githubusercontent.com/witheve/eve-starter/25690f64a5ac5262068bab397008072b8e073a9a/assets/css/base.css */\n* {box-sizing: border-box;}\nhtml { height: 100%; }\nbody { min-height: 100%; }\nbody { background: #f5f5f5; color: #555; font-family: Avenir, \"Helvetica neue\", sans-serif; display: flex; flex-direction: column; margin:0; width: 100%; }\n\n/******************************************************************************\\\n * UI Components *\n\\******************************************************************************/\n\nrow { display: flex; flex-direction: row; }\ncolumn {display: flex;flex-direction: column;align-items: stretch;}\n\nspacer { display: flex; flex: 1; }\n\ntext { display: inline-block; white-space: pre-wrap; }\n\n.button { display: flex; flex-direction: row; padding: 5px 10px; background: transparent; border: none; outline: none; -webkit-appearance: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; background-clip: padding-box !important; }\n\n.button:before { align-self: center; }\n\n.button:not(:empty):before { margin-right: 10px; }\n\n.button { background: #f0f0f0; border-radius: 4px; border: 1px solid #e5e5e5; }\n.button:hover { background: #e9e9e9; }\n.button:active { background: #e0e0e0; }\n\n.button.inset { border-radius: 4px; background: #EEE; border: 1px solid rgba(0, 0, 0, 0.1); }\n.button.inset:not(.disabled):hover { background: #EEE; box-shadow: inset 0 0 1000px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(0, 0, 0, 0.25); border-top-color: rgba(0, 0, 0, 0.2); }\n.button.inset:not(.disabled):active { background: #EEE; box-shadow: inset 0 0 1000px rgba(0, 0, 0, 0.1), inset 0 2px 1px rgba(0, 0, 0, 0.25); border-top-color: rgba(0, 0, 0, 0.3); }\n\n.button.flat { background: transparent; border: none; border-radius: 0; }\n.button.flat:not(.disabled):hover { background: rgba(0, 0, 0, 0.05); }\n.button.flat:not(.disabled):active { background: rgba(0, 0, 0, 0.1); }\n\n.dark .button.flat:not(.disabled):hover { background: rgba(255, 255, 255, 0.1); }\n.dark .button.flat:not(.disabled):active { background: rgba(255, 255, 255, 0.2); }\n\n.ui-field-table {border-collapse: collapse;}\n.ui-field-table td {padding: 0;margin: 0;vertical-align: top; border: 1px solid #ccc;}\n.ui-field-table .ui-field-table-attribute {}\n.ui-field-table .ui-field-table-value-set {display: flex;flex-direction: column;}\n.ui-field-table .ui-field-table-cell { padding: 0 10; margin: 0; }\n.ui-field-table .ui-field-table-cell + .ui-field-table-cell { border-top: 1px solid #ccc; }\n\n.ui-field-table input.ui-field-table-cell {min-width:100%;font-size: 1em;font-weight: inherit;font-family: inherit;background: transparent;border: none;color: inherit;}\n.ui-field-table input::-webkit-input-placeholder { font-weight: 300; }\n.ui-field-table input.ui-field-table-attribute {padding-right: 0;}\n\n.ui-autocomplete { position: relative; flex: 0 0 auto; width: 200px; }\n.ui-autocomplete-matches { position: absolute; top: 100%; width: 100%; flex: 0 0 auto; z-index: 5; background: white; border-top: 0px solid #f0f0f0; border-radius: 4px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2); }\n.ui-autocomplete[open=\"true\"] .ui-autocomplete-matches { border-top-width: 1px; }\n\n.ui-autocomplete-match { padding: 0 10px; height: 0; overflow: hidden; }\n.ui-autocomplete[open=\"true\"] .ui-autocomplete-match { padding: 0 10px; height: 100%; overflow: hidden; }\n.ui-autocomplete-match:hover { background: #f9f9f9; }\n.ui-autocomplete-match:active { background: #f0f0f0; }\n\n/******************************************************************************\\\n * Shape *\n\\******************************************************************************/\n.shape-hexagon {position: relative;}\n.shape-hexagon > canvas {position: absolute;top: 0;left: 0;width: 100%;height: 100%;}\n.shape-hexagon > div { display: flex; flex-direction: column; justify-content: center; align-items: center; position: absolute; }\n\n/******************************************************************************\\\n * compiler\n\\******************************************************************************/\n\n.eve-compiler-error { background:#333; color: #ccc; margin:20px; padding:10px 20px; align-self:center; width:700px; border-radius:3px; box-shadow:2px 2px 8px #999; }\n.eve-compiler-line-info { margin-right:20px; color: #999; margin-right: 20px; padding-right: 20px; color: #888; border-right: 1px solid #666; justify-content: center;}\n.eve-compiler-error-sample { font-family:\"Inconsolata\", \"Monaco\", \"Consolas\", \"Ubuntu Mono\", monospace; margin-top:10px; background:#444; padding:10px; border-radius:3px; }\n.eve-compiler-error-message-line { font-size:20pt; color: #ff8c24; }\n.eve-compiler-error-message { color: #ff8c24; }\n.eve-compiler-error-content {padding: 5px; flex: 1;}\n",
"type": "text/css",
"title": "$:/plugins/btheado/eve/eve-base.css",
"tags": "$:/tags/Stylesheet"
},
"$:/plugins/btheado/eve/eve-widget.js": {
"text": "if($tw.browser){\n(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 92);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/*\n Utils using lodash style API. (not necessarily 100% compliant) for functional and other utils.\n These utils should replace usage of lodash in the production code base. not because they are any better...\n but for the purpose of being a dependency free library.\n\n The hotspots in the code are already written in imperative style for performance reasons.\n so writing several dozen utils which may be slower than the original lodash, does not matter as much\n considering they will not be invoked in hotspots...\n */\nfunction isEmpty(arr) {\n return arr && arr.length === 0;\n}\nexports.isEmpty = isEmpty;\nfunction keys(obj) {\n return Object.keys(obj);\n}\nexports.keys = keys;\nfunction values(obj) {\n var vals = [];\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n vals.push(obj[keys[i]]);\n }\n return vals;\n}\nexports.values = values;\nfunction mapValues(obj, callback) {\n var result = [];\n var objKeys = keys(obj);\n for (var idx = 0; idx < objKeys.length; idx++) {\n var currKey = objKeys[idx];\n result.push(callback.call(null, obj[currKey], currKey));\n }\n return result;\n}\nexports.mapValues = mapValues;\nfunction map(arr, callback) {\n var result = [];\n for (var idx = 0; idx < arr.length; idx++) {\n result.push(callback.call(null, arr[idx], idx));\n }\n return result;\n}\nexports.map = map;\nfunction flatten(arr) {\n var result = [];\n for (var idx = 0; idx < arr.length; idx++) {\n var currItem = arr[idx];\n if (Array.isArray(currItem)) {\n result = result.concat(flatten(currItem));\n }\n else {\n result.push(currItem);\n }\n }\n return result;\n}\nexports.flatten = flatten;\nfunction first(arr) {\n return isEmpty(arr) ? undefined : arr[0];\n}\nexports.first = first;\nfunction last(arr) {\n var len = arr && arr.length;\n return len ? arr[len - 1] : undefined;\n}\nexports.last = last;\nfunction forEach(collection, iteratorCallback) {\n if (Array.isArray(collection)) {\n for (var i = 0; i < collection.length; i++) {\n iteratorCallback.call(null, collection[i], i);\n }\n }\n else if (isObject(collection)) {\n var colKeys = keys(collection);\n for (var i = 0; i < colKeys.length; i++) {\n var key = colKeys[i];\n var value = collection[key];\n iteratorCallback.call(null, value, key);\n }\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.forEach = forEach;\nfunction isString(item) {\n return typeof item === \"string\";\n}\nexports.isString = isString;\nfunction isUndefined(item) {\n return item === undefined;\n}\nexports.isUndefined = isUndefined;\nfunction isFunction(item) {\n return item instanceof Function;\n}\nexports.isFunction = isFunction;\nfunction drop(arr, howMuch) {\n if (howMuch === void 0) { howMuch = 1; }\n return arr.slice(howMuch, arr.length);\n}\nexports.drop = drop;\nfunction dropRight(arr, howMuch) {\n if (howMuch === void 0) { howMuch = 1; }\n return arr.slice(0, arr.length - howMuch);\n}\nexports.dropRight = dropRight;\nfunction filter(arr, predicate) {\n var result = [];\n if (Array.isArray(arr)) {\n for (var i = 0; i < arr.length; i++) {\n var item = arr[i];\n if (predicate.call(null, item)) {\n result.push(item);\n }\n }\n }\n return result;\n}\nexports.filter = filter;\nfunction reject(arr, predicate) {\n return filter(arr, function (item) { return !predicate(item); });\n}\nexports.reject = reject;\nfunction pick(obj, predicate) {\n var keys = Object.keys(obj);\n var result = {};\n for (var i = 0; i < keys.length; i++) {\n var currKey = keys[i];\n var currItem = obj[currKey];\n if (predicate(currItem)) {\n result[currKey] = currItem;\n }\n }\n return result;\n}\nexports.pick = pick;\nfunction has(obj, prop) {\n if (isObject(obj)) {\n return obj.hasOwnProperty(prop);\n }\n return false;\n}\nexports.has = has;\nfunction contains(arr, item) {\n return find(arr, function (currItem) { return currItem === item; }) !== undefined ? true : false;\n}\nexports.contains = contains;\n/**\n * shallow clone\n */\nfunction cloneArr(arr) {\n var newArr = [];\n for (var i = 0; i < arr.length; i++) {\n newArr.push(arr[i]);\n }\n return newArr;\n}\nexports.cloneArr = cloneArr;\n/**\n * shallow clone\n */\nfunction cloneObj(obj) {\n var clonedObj = {};\n for (var key in obj) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clonedObj[key] = obj[key];\n }\n }\n return clonedObj;\n}\nexports.cloneObj = cloneObj;\nfunction find(arr, predicate) {\n for (var i = 0; i < arr.length; i++) {\n var item = arr[i];\n if (predicate.call(null, item)) {\n return item;\n }\n }\n return undefined;\n}\nexports.find = find;\nfunction findAll(arr, predicate) {\n var found = [];\n for (var i = 0; i < arr.length; i++) {\n var item = arr[i];\n if (predicate.call(null, item)) {\n found.push(item);\n }\n }\n return found;\n}\nexports.findAll = findAll;\nfunction reduce(arrOrObj, iterator, initial) {\n var vals = Array.isArray(arrOrObj) ? arrOrObj : values(arrOrObj);\n var accumulator = initial;\n for (var i = 0; i < vals.length; i++) {\n accumulator = iterator.call(null, accumulator, vals[i], i);\n }\n return accumulator;\n}\nexports.reduce = reduce;\nfunction compact(arr) {\n return reject(arr, function (item) { return item === null || item === undefined; });\n}\nexports.compact = compact;\nfunction uniq(arr, identity) {\n if (identity === void 0) { identity = function (item) { return item; }; }\n var identities = [];\n return reduce(arr, function (result, currItem) {\n var currIdentity = identity(currItem);\n if (contains(identities, currIdentity)) {\n return result;\n }\n else {\n identities.push(currIdentity);\n return result.concat(currItem);\n }\n }, []);\n}\nexports.uniq = uniq;\nfunction partial(func) {\n var restArgs = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n restArgs[_i - 1] = arguments[_i];\n }\n var firstArg = [null];\n var allArgs = firstArg.concat(restArgs);\n return Function.bind.apply(func, allArgs);\n}\nexports.partial = partial;\nfunction isArray(obj) {\n return Array.isArray(obj);\n}\nexports.isArray = isArray;\nfunction isRegExp(obj) {\n return obj instanceof RegExp;\n}\nexports.isRegExp = isRegExp;\nfunction isObject(obj) {\n return obj instanceof Object;\n}\nexports.isObject = isObject;\nfunction every(arr, predicate) {\n for (var i = 0; i < arr.length; i++) {\n if (!predicate(arr[i], i)) {\n return false;\n }\n }\n return true;\n}\nexports.every = every;\nfunction difference(arr, values) {\n return reject(arr, function (item) { return contains(values, item); });\n}\nexports.difference = difference;\nfunction some(arr, predicate) {\n for (var i = 0; i < arr.length; i++) {\n if (predicate(arr[i])) {\n return true;\n }\n }\n return false;\n}\nexports.some = some;\nfunction indexOf(arr, value) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === value) {\n return i;\n }\n }\n return -1;\n}\nexports.indexOf = indexOf;\nfunction sortBy(arr, orderFunc) {\n var result = cloneArr(arr);\n result.sort(function (a, b) { return orderFunc(a) - orderFunc(b); });\n return result;\n}\nexports.sortBy = sortBy;\nfunction zipObject(keys, values) {\n if (keys.length !== values.length) {\n throw Error(\"can't zipObject with different number of keys and values!\");\n }\n var result = {};\n for (var i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n return result;\n}\nexports.zipObject = zipObject;\n/**\n * mutates! (and returns) target\n */\nfunction assign(target) {\n var sources = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n sources[_i - 1] = arguments[_i];\n }\n for (var i = 0; i < sources.length; i++) {\n var curSource = sources[i];\n var currSourceKeys = keys(curSource);\n for (var j = 0; j < currSourceKeys.length; j++) {\n var currKey = currSourceKeys[j];\n target[currKey] = curSource[currKey];\n }\n }\n return target;\n}\nexports.assign = assign;\n/**\n * mutates! (and returns) target\n */\nfunction assignNoOverwrite(target) {\n var sources = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n sources[_i - 1] = arguments[_i];\n }\n for (var i = 0; i < sources.length; i++) {\n var curSource = sources[i];\n var currSourceKeys = keys(curSource);\n for (var j = 0; j < currSourceKeys.length; j++) {\n var currKey = currSourceKeys[j];\n if (!has(target, currKey)) {\n target[currKey] = curSource[currKey];\n }\n }\n }\n return target;\n}\nexports.assignNoOverwrite = assignNoOverwrite;\nfunction groupBy(arr, groupKeyFunc) {\n var result = {};\n forEach(arr, function (item) {\n var currGroupKey = groupKeyFunc(item);\n var currGroupArr = result[currGroupKey];\n if (currGroupArr) {\n currGroupArr.push(item);\n }\n else {\n result[currGroupKey] = [item];\n }\n });\n return result;\n}\nexports.groupBy = groupBy;\n/**\n * Merge obj2 into obj1.\n * Will overwrite existing properties with the same name\n */\nfunction merge(obj1, obj2) {\n var result = cloneObj(obj1);\n var keys2 = keys(obj2);\n for (var i = 0; i < keys2.length; i++) {\n var key = keys2[i];\n var value = obj2[key];\n result[key] = value;\n }\n return result;\n}\nexports.merge = merge;\nfunction NOOP() { }\nexports.NOOP = NOOP;\nfunction IDENTITY(item) {\n return item;\n}\nexports.IDENTITY = IDENTITY;\nfunction getSuperClass(clazz) {\n return Object.getPrototypeOf(clazz.prototype).constructor;\n}\nexports.getSuperClass = getSuperClass;\n//# sourceMappingURL=utils.js.map\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar runtime_1 = __webpack_require__(4);\nvar dsl2_1 = __webpack_require__(37);\nexports.Program = dsl2_1.Program;\nvar uuid_1 = __webpack_require__(7);\n//------------------------------------------------------------------------------\n// Watcher\n//------------------------------------------------------------------------------\nvar Watcher = (function () {\n function Watcher(_program) {\n this._program = _program;\n this.setup();\n }\n Watcher.register = function (id, watcher) {\n if (this._registry[id]) {\n if (this._registry[id] === watcher)\n return;\n throw new Error(\"Attempting to overwrite existing watcher with id '\" + id + \"'\");\n }\n this._registry[id] = watcher;\n };\n Watcher.unregister = function (id) {\n delete this._registry[id];\n };\n Watcher.get = function (id) {\n var watcher = this._registry[id];\n if (watcher)\n return watcher;\n };\n Object.defineProperty(Watcher.prototype, \"program\", {\n get: function () { return this._program; },\n enumerable: true,\n configurable: true\n });\n Watcher.prototype.setup = function () { };\n Watcher._registry = {};\n return Watcher;\n}());\nexports.Watcher = Watcher;\n;\n;\n;\nvar Exporter = (function () {\n function Exporter() {\n var _this = this;\n this._diffTriggers = {};\n this._objectTriggers = {};\n this._blocks = [];\n this.handle = function (blockChanges) {\n for (var _i = 0, _a = _this._blocks; _i < _a.length; _i++) {\n var blockId = _a[_i];\n var changes = blockChanges[blockId];\n if (changes && changes.length) {\n var diffTriggers = _this._diffTriggers[blockId];\n if (diffTriggers) {\n var output = { adds: [], removes: [] };\n for (var _b = 0, changes_1 = changes; _b < changes_1.length; _b++) {\n var change = changes_1[_b];\n var eav = change.toRawEAV();\n if (change.count > 0) {\n output.adds.push(eav);\n }\n else {\n output.removes.push(eav);\n }\n }\n for (var _c = 0, diffTriggers_1 = diffTriggers; _c < diffTriggers_1.length; _c++) {\n var trigger = diffTriggers_1[_c];\n trigger(output);\n }\n }\n var objectTriggers = _this._objectTriggers[blockId];\n if (objectTriggers) {\n var output = _this.accumulateChangesAs(changes);\n for (var _d = 0, objectTriggers_1 = objectTriggers; _d < objectTriggers_1.length; _d++) {\n var trigger = objectTriggers_1[_d];\n trigger(output);\n }\n }\n }\n }\n };\n }\n Exporter.prototype.triggerOnDiffs = function (blockId, handler) {\n if (!this._diffTriggers[blockId])\n this._diffTriggers[blockId] = runtime_1.createArray();\n if (this._diffTriggers[blockId].indexOf(handler) === -1) {\n this._diffTriggers[blockId].push(handler);\n }\n if (this._blocks.indexOf(blockId) === -1) {\n this._blocks.push(blockId);\n }\n };\n Exporter.prototype.triggerOnObjects = function (blockId, handler) {\n if (!this._objectTriggers[blockId])\n this._objectTriggers[blockId] = runtime_1.createArray();\n if (this._objectTriggers[blockId].indexOf(handler) === -1) {\n this._objectTriggers[blockId].push(handler);\n }\n if (this._blocks.indexOf(blockId) === -1) {\n this._blocks.push(blockId);\n }\n };\n Exporter.prototype.accumulateChangesAs = function (changes) {\n var adds = {};\n var removes = {};\n for (var _i = 0, changes_2 = changes; _i < changes_2.length; _i++) {\n var change = changes_2[_i];\n var _a = change.reverse(), e = _a.e, a = _a.a, v = _a.v, count = _a.count;\n if (count === 1) {\n var record = adds[e] = adds[e] || Object.create(null);\n if (record[a])\n throw new Error(\"@FIXME: accumulateChanges supports only a single value per attribute.\");\n record[a] = v;\n }\n else {\n var record = removes[e] = removes[e] || Object.create(null);\n if (record[a])\n throw new Error(\"@FIXME: accumulateChanges supports only a single value per attribute.\");\n record[a] = v;\n }\n }\n return { adds: adds, removes: removes };\n };\n return Exporter;\n}());\nexports.Exporter = Exporter;\n//------------------------------------------------------------------------------\n// Convenience Diff Handlers\n//------------------------------------------------------------------------------\nfunction _isId(value) {\n return (\"\" + value).indexOf(\"|\") != -1;\n}\nexports._isId = _isId;\nfunction maybeIntern(value) {\n if (value === undefined)\n return value;\n return _isId(value) ? runtime_1.GlobalInterner.get(value) : value;\n}\nexports.maybeIntern = maybeIntern;\nfunction asJS(value) {\n if (typeof value === \"number\")\n return value;\n if (value === \"true\")\n return true;\n if (value === \"false\")\n return false;\n return value;\n}\nexports.asJS = asJS;\nfunction forwardDiffs(destination, name, debug) {\n if (name === void 0) { name = \"Unnamed\"; }\n if (debug === void 0) { debug = false; }\n return function (diffs) {\n var eavs = [];\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n eavs.push([e, a, v, -1]);\n }\n for (var _c = 0, _d = diffs.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], v = _e[2];\n eavs.push([e, a, v, 1]);\n }\n if (eavs.length) {\n if (debug) {\n console.log(\"FWD\", name, \"=>\", destination.name);\n console.log(eavs.map(function (c) { return \"[\" + c.map(maybeIntern).join(\", \") + \"]\"; }).join(\"\\n\"));\n }\n destination.inputEAVs(eavs);\n }\n };\n}\nexports.forwardDiffs = forwardDiffs;\n//--------------------------------------------------------------------\n// Watcher / Program Utils\n//--------------------------------------------------------------------\nfunction createId() {\n return \"|\" + uuid_1.v4();\n}\nexports.createId = createId;\nfunction isRawValue(x) {\n return x !== undefined && (typeof x === \"string\" || typeof x === \"number\");\n}\nexports.isRawValue = isRawValue;\nfunction isRawValueArray(x) {\n if (x && x.constructor === Array) {\n for (var _i = 0, x_1 = x; _i < x_1.length; _i++) {\n var value = x_1[_i];\n if (!isRawValue(value))\n return false;\n }\n return true;\n }\n return false;\n}\nexports.isRawValueArray = isRawValueArray;\nfunction isRawEAVArray(x) {\n if (x && x.constructor === Array) {\n for (var _i = 0, x_2 = x; _i < x_2.length; _i++) {\n var value = x_2[_i];\n if (!isRawValueArray(value))\n return false;\n if (value.length !== 3)\n return false;\n }\n return true;\n }\n return false;\n}\nexports.isRawEAVArray = isRawEAVArray;\nfunction isRawEAVArraySet(x) {\n return x && x.constructor === Array && isRawEAVArray(x[0]);\n}\nexports.isRawEAVArraySet = isRawEAVArraySet;\nfunction isRecord(x) {\n return x && typeof x === \"object\" && x.constructor !== Array;\n}\nexports.isRecord = isRecord;\nfunction isRecordSet(x) {\n return x && x.constructor === Array && isRecord(x[0]);\n}\nexports.isRecordSet = isRecordSet;\nfunction appendAsEAVs(eavs, record, id) {\n if (id === void 0) { id = createId(); }\n for (var attr in record) {\n var value = record[attr];\n if (isRawValue(value)) {\n eavs.push([id, attr, value]);\n }\n else if (isRawValueArray(value)) {\n // We have a set of scalars\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\n var val = value_1[_i];\n eavs.push([id, attr, val]);\n }\n }\n else if (isRawEAVArray(value)) {\n // We have a single nested sub-object (i.e. a set of EAVs).\n var childEAVs = value;\n var childId = childEAVs[0][0];\n eavs.push([id, attr, childId]);\n for (var _a = 0, childEAVs_1 = childEAVs; _a < childEAVs_1.length; _a++) {\n var childEAV = childEAVs_1[_a];\n eavs.push(childEAV);\n }\n }\n else if (isRawEAVArraySet(value)) {\n // We have a set of nested sub-objects.\n for (var _b = 0, value_2 = value; _b < value_2.length; _b++) {\n var childEAVs = value_2[_b];\n var childId = childEAVs[0][0];\n eavs.push([id, attr, childId]);\n for (var _c = 0, childEAVs_2 = childEAVs; _c < childEAVs_2.length; _c++) {\n var childEAV = childEAVs_2[_c];\n eavs.push(childEAV);\n }\n }\n }\n else if (isRecord(value)) {\n var ix = eavs.length;\n appendAsEAVs(eavs, value);\n var childId = eavs[ix][0];\n eavs.push([id, attr, childId]);\n }\n else if (isRecordSet(value)) {\n for (var _d = 0, value_3 = value; _d < value_3.length; _d++) {\n var record_1 = value_3[_d];\n var ix = eavs.length;\n appendAsEAVs(eavs, record_1);\n var childId = eavs[ix][0];\n eavs.push([id, attr, childId]);\n }\n }\n }\n return eavs;\n}\nexports.appendAsEAVs = appendAsEAVs;\n//# sourceMappingURL=watcher.js.map\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar tokens_public_1 = __webpack_require__(3);\nvar gast;\n(function (gast) {\n var AbstractProduction = (function () {\n function AbstractProduction(definition) {\n this.definition = definition;\n }\n AbstractProduction.prototype.accept = function (visitor) {\n visitor.visit(this);\n utils_1.forEach(this.definition, function (prod) {\n prod.accept(visitor);\n });\n };\n return AbstractProduction;\n }());\n gast.AbstractProduction = AbstractProduction;\n var NonTerminal = (function (_super) {\n __extends(NonTerminal, _super);\n function NonTerminal(nonTerminalName, referencedRule, occurrenceInParent, implicitOccurrenceIndex) {\n if (referencedRule === void 0) { referencedRule = undefined; }\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, []) /* istanbul ignore next */ || this;\n _this.nonTerminalName = nonTerminalName;\n _this.referencedRule = referencedRule;\n _this.occurrenceInParent = occurrenceInParent;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n Object.defineProperty(NonTerminal.prototype, \"definition\", {\n get: function () {\n if (this.referencedRule !== undefined) {\n return this.referencedRule.definition;\n }\n return [];\n },\n set: function (definition) {\n // immutable\n },\n enumerable: true,\n configurable: true\n });\n NonTerminal.prototype.accept = function (visitor) {\n visitor.visit(this);\n // don't visit children of a reference, we will get cyclic infinite loops if we do so\n };\n return NonTerminal;\n }(AbstractProduction));\n gast.NonTerminal = NonTerminal;\n var Rule = (function (_super) {\n __extends(Rule, _super);\n function Rule(name, definition, orgText) {\n if (orgText === void 0) { orgText = \"\"; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.name = name;\n _this.orgText = orgText;\n return _this;\n }\n return Rule;\n }(AbstractProduction));\n gast.Rule = Rule;\n var Flat = (function (_super) {\n __extends(Flat, _super);\n // A named Flat production is used to indicate a Nested Rule in an alternation\n function Flat(definition, name) {\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.name = name;\n return _this;\n }\n return Flat;\n }(AbstractProduction));\n gast.Flat = Flat;\n var Option = (function (_super) {\n __extends(Option, _super);\n function Option(definition, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return Option;\n }(AbstractProduction));\n gast.Option = Option;\n var RepetitionMandatory = (function (_super) {\n __extends(RepetitionMandatory, _super);\n function RepetitionMandatory(definition, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return RepetitionMandatory;\n }(AbstractProduction));\n gast.RepetitionMandatory = RepetitionMandatory;\n var RepetitionMandatoryWithSeparator = (function (_super) {\n __extends(RepetitionMandatoryWithSeparator, _super);\n function RepetitionMandatoryWithSeparator(definition, separator, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.separator = separator;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return RepetitionMandatoryWithSeparator;\n }(AbstractProduction));\n gast.RepetitionMandatoryWithSeparator = RepetitionMandatoryWithSeparator;\n var Repetition = (function (_super) {\n __extends(Repetition, _super);\n function Repetition(definition, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return Repetition;\n }(AbstractProduction));\n gast.Repetition = Repetition;\n var RepetitionWithSeparator = (function (_super) {\n __extends(RepetitionWithSeparator, _super);\n function RepetitionWithSeparator(definition, separator, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.separator = separator;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return RepetitionWithSeparator;\n }(AbstractProduction));\n gast.RepetitionWithSeparator = RepetitionWithSeparator;\n var Alternation = (function (_super) {\n __extends(Alternation, _super);\n function Alternation(definition, occurrenceInParent, name, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n var _this = _super.call(this, definition) /* istanbul ignore next */ || this;\n _this.occurrenceInParent = occurrenceInParent;\n _this.name = name;\n _this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n return _this;\n }\n return Alternation;\n }(AbstractProduction));\n gast.Alternation = Alternation;\n var Terminal = (function () {\n function Terminal(terminalType, occurrenceInParent, implicitOccurrenceIndex) {\n if (occurrenceInParent === void 0) { occurrenceInParent = 1; }\n if (implicitOccurrenceIndex === void 0) { implicitOccurrenceIndex = false; }\n this.terminalType = terminalType;\n this.occurrenceInParent = occurrenceInParent;\n this.implicitOccurrenceIndex = implicitOccurrenceIndex;\n }\n Terminal.prototype.accept = function (visitor) {\n visitor.visit(this);\n };\n return Terminal;\n }());\n gast.Terminal = Terminal;\n var GAstVisitor = (function () {\n function GAstVisitor() {\n }\n GAstVisitor.prototype.visit = function (node) {\n if (node instanceof NonTerminal) {\n return this.visitNonTerminal(node);\n }\n else if (node instanceof Flat) {\n return this.visitFlat(node);\n }\n else if (node instanceof Option) {\n return this.visitOption(node);\n }\n else if (node instanceof RepetitionMandatory) {\n return this.visitRepetitionMandatory(node);\n }\n else if (node instanceof RepetitionMandatoryWithSeparator) {\n return this.visitRepetitionMandatoryWithSeparator(node);\n }\n else if (node instanceof RepetitionWithSeparator) {\n return this.visitRepetitionWithSeparator(node);\n }\n else if (node instanceof Repetition) {\n return this.visitRepetition(node);\n }\n else if (node instanceof Alternation) {\n return this.visitAlternation(node);\n }\n else if (node instanceof Terminal) {\n return this.visitTerminal(node);\n }/* istanbul ignore else */ \n else if (node instanceof Rule) {\n return this.visitRule(node);\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n };\n GAstVisitor.prototype.visitNonTerminal = function (node) { };\n GAstVisitor.prototype.visitFlat = function (node) { };\n GAstVisitor.prototype.visitOption = function (node) { };\n GAstVisitor.prototype.visitRepetition = function (node) { };\n GAstVisitor.prototype.visitRepetitionMandatory = function (node) { };\n GAstVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) { };\n GAstVisitor.prototype.visitRepetitionWithSeparator = function (node) { };\n GAstVisitor.prototype.visitAlternation = function (node) { };\n GAstVisitor.prototype.visitTerminal = function (node) { };\n GAstVisitor.prototype.visitRule = function (node) { };\n return GAstVisitor;\n }());\n gast.GAstVisitor = GAstVisitor;\n function serializeGrammar(topRules) {\n return utils_1.map(topRules, serializeProduction);\n }\n gast.serializeGrammar = serializeGrammar;\n function serializeProduction(node) {\n function convertDefinition(definition) {\n return utils_1.map(definition, serializeProduction);\n }\n if (node instanceof NonTerminal) {\n return {\n type: \"NonTerminal\",\n name: node.nonTerminalName,\n occurrenceInParent: node.occurrenceInParent\n };\n }\n else if (node instanceof Flat) {\n return {\n type: \"Flat\",\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof Option) {\n return {\n type: \"Option\",\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof RepetitionMandatory) {\n return {\n type: \"RepetitionMandatory\",\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof RepetitionMandatoryWithSeparator) {\n return {\n type: \"RepetitionMandatoryWithSeparator\",\n separator: serializeProduction(new Terminal(node.separator)),\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof RepetitionWithSeparator) {\n return {\n type: \"RepetitionWithSeparator\",\n separator: serializeProduction(new Terminal(node.separator)),\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof Repetition) {\n return {\n type: \"Repetition\",\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof Alternation) {\n return {\n type: \"Alternation\",\n definition: convertDefinition(node.definition)\n };\n }\n else if (node instanceof Terminal) {\n var serializedTerminal = {\n type: \"Terminal\",\n name: tokens_public_1.tokenName(node.terminalType),\n label: tokens_public_1.tokenLabel(node.terminalType),\n occurrenceInParent: node.occurrenceInParent\n };\n var pattern = node.terminalType.PATTERN;\n if (node.terminalType.PATTERN) {\n serializedTerminal.pattern = utils_1.isRegExp(pattern) ? pattern.source : pattern;\n }\n return serializedTerminal;\n }/* istanbul ignore else */ \n else if (node instanceof Rule) {\n return { type: \"Rule\", name: node.name, definition: convertDefinition(node.definition) };\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n }\n gast.serializeProduction = serializeProduction;\n})(gast = exports.gast || (exports.gast = {}));\n//# sourceMappingURL=gast_public.js.map\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar lang_extensions_1 = __webpack_require__(5);\nvar lexer_public_1 = __webpack_require__(15);\nvar tokens_1 = __webpack_require__(16);\n/**\n * This can be used to improve the quality/readability of error messages or syntax diagrams.\n *\n * @param {Function} clazz - A constructor for a Token subclass\n * @returns {string} - The Human readable label for a Token if it exists.\n */\nfunction tokenLabel(clazz) {\n if (hasTokenLabel(clazz)) {\n return clazz.LABEL;\n }\n else {\n return tokenName(clazz);\n }\n}\nexports.tokenLabel = tokenLabel;\nfunction hasTokenLabel(clazz) {\n return utils_1.isString(clazz.LABEL) && clazz.LABEL !== \"\";\n}\nexports.hasTokenLabel = hasTokenLabel;\nfunction tokenName(clazz) {\n // The tokenName property is needed under some old versions of node.js (0.10/0.12)\n // where the Function.prototype.name property is not defined as a 'configurable' property\n // enable producing readable error messages.\n /* istanbul ignore if -> will only run in old versions of node.js */\n if (utils_1.isObject(clazz) && clazz.hasOwnProperty(\"tokenName\") && utils_1.isString(clazz.tokenName)) {\n return clazz.tokenName;\n }\n else {\n return lang_extensions_1.functionName(clazz);\n }\n}\nexports.tokenName = tokenName;\nvar PARENT = \"parent\";\nvar LABEL = \"label\";\nvar GROUP = \"group\";\nvar PUSH_MODE = \"push_mode\";\nvar POP_MODE = \"pop_mode\";\nvar LONGER_ALT = \"longer_alt\";\n/**\n * @param {ITokenConfig} config - The configuration for\n * @returns {TokenConstructor} - A constructor for the new Token subclass\n */\nfunction createToken(config) {\n if (!utils_1.has(config, PARENT)) {\n config.parent = Token;\n }\n return createTokenInternal(config);\n}\nexports.createToken = createToken;\n/**\n *\n * @deprecated - Use the new CreateToken API\n *\n * utility to help the poor souls who are still stuck writing pure javascript 5.1\n * extend and create Token subclasses in a less verbose manner\n *\n * @param {string} tokenName - The name of the new TokenClass\n * @param {RegExp|CustomPatternMatcherFunc|Function} patternOrParent - RegExp Pattern or Parent Token Constructor\n * @param {Function} parentConstructor - The Token class to be extended\n * @returns {Function} - A constructor for the new extended Token subclass\n */\nfunction extendToken(tokenName, patternOrParent, parentConstructor) {\n if (patternOrParent === void 0) { patternOrParent = undefined; }\n if (parentConstructor === void 0) { parentConstructor = Token; }\n var pattern;\n if (utils_1.isRegExp(patternOrParent) ||\n patternOrParent === lexer_public_1.Lexer.SKIPPED ||\n patternOrParent === lexer_public_1.Lexer.NA ||\n utils_1.isString(patternOrParent)) {\n pattern = patternOrParent;\n }\n else if (utils_1.isFunction(patternOrParent)) {\n parentConstructor = patternOrParent;\n pattern = undefined;\n }\n return createTokenInternal({ name: tokenName, parent: parentConstructor, pattern: pattern });\n}\nexports.extendToken = extendToken;\nfunction createTokenInternal(config) {\n var tokenName = config.name;\n var parentConstructor = config.parent;\n var pattern = config.pattern;\n var derivedConstructor = function () {\n parentConstructor.apply(this, arguments);\n };\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n /* istanbul ignore if -> will only run in old versions of node.js */\n if (!lang_extensions_1.defineNameProp(derivedConstructor, tokenName)) {\n // hack to save the tokenName in situations where the constructor's name property cannot be reconfigured\n derivedConstructor.tokenName = tokenName;\n }\n derivedConstructor.prototype = Object.create(parentConstructor.prototype);\n derivedConstructor.prototype.constructor = derivedConstructor;\n if (!utils_1.isUndefined(pattern)) {\n derivedConstructor.PATTERN = pattern;\n }\n tokens_1.augmentTokenClasses([derivedConstructor]);\n // static properties mixing\n derivedConstructor = utils_1.assignNoOverwrite(derivedConstructor, parentConstructor);\n if (utils_1.has(config, LABEL)) {\n derivedConstructor.LABEL = config[LABEL];\n }\n if (utils_1.has(config, GROUP)) {\n derivedConstructor.GROUP = config[GROUP];\n }\n if (utils_1.has(config, POP_MODE)) {\n derivedConstructor.POP_MODE = config[POP_MODE];\n }\n if (utils_1.has(config, PUSH_MODE)) {\n derivedConstructor.PUSH_MODE = config[PUSH_MODE];\n }\n if (utils_1.has(config, LONGER_ALT)) {\n derivedConstructor.LONGER_ALT = config[LONGER_ALT];\n }\n return derivedConstructor;\n}\nvar Token = (function () {\n /**\n * This class is never meant to be initialized.\n * The class hierarchy is used to organize Token metadata, not to create instances of Tokens.\n * Tokens are simple JavaScript objects which are NOT created using the <new> operator.\n * To get the class of a Token \"instance\" use <getTokenConstructor>.\n */\n function Token() {\n // this marks if a Token does not really exist and has been inserted \"artificially\" during parsing in rule error recovery\n this.isInsertedInRecovery = false;\n }\n return Token;\n}());\n/**\n * A \"human readable\" Label for a Token.\n * Subclasses of Token may define their own static LABEL property.\n * This label will be used in error messages and drawing syntax diagrams.\n *\n * For example a Token constructor may be called LCurly, which is short for LeftCurlyBrackets, These names are either too short\n * or too unwieldy to be used in error messages.\n *\n * Imagine : \"expecting LCurly but found ')'\" or \"expecting LeftCurlyBrackets but found ')'\"\n *\n * However if a static property LABEL with the value '{' exists on LCurly class, that error message will be:\n * \"expecting '{' but found ')'\"\n */\nToken.LABEL = undefined;\nexports.Token = Token;\nvar EOF = (function (_super) {\n __extends(EOF, _super);\n function EOF() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n return EOF;\n}(Token));\nexports.EOF = EOF;\ntokens_1.augmentTokenClasses([EOF]);\n/**\n * Utility to create Chevrotain Token \"instances\"\n * Note that Chevrotain tokens are not real instances, and thus the instanceOf cannot be used.\n *\n * @param tokClass\n * @param image\n * @param startOffset\n * @param endOffset\n * @param startLine\n * @param endLine\n * @param startColumn\n * @param endColumn\n * @returns {{image: string,\n * startOffset: number,\n * endOffset: number,\n * startLine: number,\n * endLine: number,\n * startColumn: number,\n * endColumn: number,\n * tokenType}}\n */\nfunction createTokenInstance(tokClass, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {\n return {\n image: image,\n startOffset: startOffset,\n endOffset: endOffset,\n startLine: startLine,\n endLine: endLine,\n startColumn: startColumn,\n endColumn: endColumn,\n tokenType: tokClass.tokenType,\n };\n}\nexports.createTokenInstance = createTokenInstance;\n/**\n * Given a Token instance, will return the Token Constructor.\n * Note that this function is not just for convenience, Because a Token \"instance'\n * Does not use standard prototype inheritance and thus it's constructor cannot be accessed\n * by traversing the prototype chain.\n *\n * @param tokenInstance {IToken}\n * @returns {TokenConstructor}\n */\nfunction getTokenConstructor(tokenInstance) {\n var tokenIdx;\n tokenIdx = tokenInstance.tokenType;\n return tokens_1.tokenIdxToClass.get(tokenIdx);\n}\nexports.getTokenConstructor = getTokenConstructor;\n/**\n * A Utility method to check if a token is of the type of the argument Token class.\n * Not that while this utility has similar semantics to ECMAScript \"instanceOf\"\n * As Chevrotain tokens support inheritance.\n *\n * It is not actually implemented using the \"instanceOf\" operator because\n * Chevrotain Tokens have their own performance optimized inheritance mechanism.\n *\n * @param tokInstance {IToken}\n * @param tokClass {TokenConstructor}\n * @returns {boolean}\n */\nfunction tokenMatcher(tokInstance, tokClass) {\n return tokens_1.tokenStructuredMatcher(tokInstance, tokClass);\n}\nexports.tokenMatcher = tokenMatcher;\n//# sourceMappingURL=tokens_public.js.map\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar indexes_1 = __webpack_require__(38);\nvar trace_1 = __webpack_require__(84);\n//------------------------------------------------------------------------\n// debugging utilities\n//------------------------------------------------------------------------\nvar TRACE = false;\n// Turning this on causes all of the debug(.*) statements to print to the\n// console. This is useful to see exactly what the runtime is doing as it\n// evaluates a transaction, but it incurs both a pretty serious performance\n// cost and prints a lot of stuff.\nvar DEBUG = false;\nexports.debug = function () { };\nif (DEBUG) {\n exports.debug = function () {\n console.log.apply(console, arguments);\n };\n}\nfunction indent(text, level) {\n var padding = new Array(level + 1).join(\" \");\n return text.split(\"\\n\").join(\"\\n\" + padding);\n}\nfunction printField(field) {\n if (isRegister(field))\n return \"[\" + field.offset + \"]\";\n if (field === undefined || field === null)\n return field;\n var raw = maybeReverse(field);\n return typeof raw === \"string\" ? \"\\\"\" + raw + \"\\\"\" : raw;\n}\nexports.printField = printField;\nfunction printFieldArray(fields) {\n return \"[\" + fields.map(printField).join(\", \") + \"]\";\n}\nexports.printFieldArray = printFieldArray;\nfunction printPrefix(prefix) {\n return prefix.map(function (v) { return exports.GlobalInterner.reverse(v); });\n}\nexports.printPrefix = printPrefix;\nfunction toString(x) {\n if (x && x.toString)\n return x.toString();\n console.warn(\"No toString specified for\", x);\n return \"\";\n}\nfunction printBlock(block) {\n return block.toString();\n}\nexports.printBlock = printBlock;\nglobal.printBlock = printBlock;\nfunction maybeReverse(value) {\n if (value === undefined)\n return value;\n var raw = exports.GlobalInterner.reverse(value);\n return (\"\" + raw).indexOf(\"|\") === -1 ? raw : value;\n}\nexports.maybeReverse = maybeReverse;\n//------------------------------------------------------------------------\n// Allocations\n//------------------------------------------------------------------------\n// As this is a language runtime, we want to get insight into how we're using\n// memory and what allocation costs we're eating as we run. To track that, we\n// use createHash and createArray to give us some rough numbers. The JIT will\n// inline these functions, so the cost over just using {} or [], is fairly\n// negligible. In a release build we can also strip the allocation tracking.\nexports.ALLOCATION_COUNT = {};\nfunction createHash(place) {\n if (place === void 0) { place = \"unknown-hash\"; }\n if (!exports.ALLOCATION_COUNT[place])\n exports.ALLOCATION_COUNT[place] = 0;\n exports.ALLOCATION_COUNT[place]++;\n return Object.create(null);\n}\nexports.createHash = createHash;\nfunction createArray(place) {\n if (place === void 0) { place = \"unknown\"; }\n if (!exports.ALLOCATION_COUNT[place])\n exports.ALLOCATION_COUNT[place] = 0;\n exports.ALLOCATION_COUNT[place]++;\n return [];\n}\nexports.createArray = createArray;\nfunction copyArray(arr, place) {\n if (place === void 0) { place = \"unknown\"; }\n if (!exports.ALLOCATION_COUNT[place])\n exports.ALLOCATION_COUNT[place] = 0;\n exports.ALLOCATION_COUNT[place]++;\n return arr.slice();\n}\nexports.copyArray = copyArray;\nfunction copyHash(hash, place) {\n if (place === void 0) { place = \"unknown\"; }\n if (!exports.ALLOCATION_COUNT[place])\n exports.ALLOCATION_COUNT[place] = 0;\n exports.ALLOCATION_COUNT[place]++;\n var neue = {};\n for (var _i = 0, _a = Object.keys(hash); _i < _a.length; _i++) {\n var key = _a[_i];\n neue[key] = hash[key];\n }\n return neue;\n}\nexports.copyHash = copyHash;\n// given two arrays, append the second's items on to the first\nfunction concatArray(arr, arr2) {\n var ix = arr.length;\n for (var _i = 0, arr2_1 = arr2; _i < arr2_1.length; _i++) {\n var elem = arr2_1[_i];\n arr[ix] = elem;\n ix++;\n }\n return arr;\n}\nexports.concatArray = concatArray;\n// overwrite the first array with the values of the second array\n// and fix the length if it's different\nfunction moveArray(arr, arr2) {\n var ix = 0;\n for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {\n var elem = arr_1[_i];\n arr2[ix] = arr[ix];\n }\n if (arr2.length !== arr.length)\n arr2.length = arr.length;\n return arr2;\n}\nexports.moveArray = moveArray;\n//------------------------------------------------------------------------\n// Iterator\n//------------------------------------------------------------------------\n// To reduce allocations as much as possible, we want to reuse arrays as much\n// as possible. If we reused the array by setting its length to 0 or to some\n// new size that is smaller than its current length, we eat the cost of\n// deallocating some chunk of memory as well as the potential cost in\n// fragmentation. Instead, the Iterator class never changes the size of its\n// backing array, and instead keeps its own length. You iterate through the\n// array using the next() method:\n//\n// let current;\n// while((current = iterator.next()) !== undefined) {\n// ...\n// }\n//\n// Through the magic of the JIT, this has no performance penalty over using a\n// standard for loop. You can get some of those \"zero-cost abstractions\" in JS\n// too!\nvar Iterator = (function () {\n function Iterator() {\n this.array = [];\n this.length = 0;\n this.ix = 0;\n }\n Iterator.prototype.push = function (value) {\n this.array[this.length++] = value;\n };\n Iterator.prototype.clear = function () {\n this.length = 0;\n this.reset();\n };\n Iterator.prototype.reset = function () {\n this.ix = 0;\n };\n Iterator.prototype.next = function () {\n if (this.ix < this.length)\n return this.array[this.ix++];\n return;\n };\n Iterator.prototype.iter = function () {\n return new ReadOnlyIterator(this.array, this.length);\n };\n return Iterator;\n}());\nexports.Iterator = Iterator;\nvar ReadOnlyIterator = (function (_super) {\n __extends(ReadOnlyIterator, _super);\n function ReadOnlyIterator(arr, length) {\n var _this = _super.call(this) || this;\n _this.array = arr;\n _this.length = length;\n return _this;\n }\n ReadOnlyIterator.prototype.push = function (value) {\n throw new Error(\"Cannot write to a readonly iterator\");\n };\n return ReadOnlyIterator;\n}(Iterator));\nexports.ReadOnlyIterator = ReadOnlyIterator;\nfunction isNumber(thing) {\n return typeof thing === \"number\";\n}\nvar Interner = (function () {\n function Interner() {\n // IDs are only positive integers so that they can be used as array indexes\n // for efficient lookup.\n this.currentID = 0;\n // We currently only have two value types in Eve at the moment, strings and\n // numbers. Because keys in a javascript object are always converted to\n // strings, we have to keep dictionaries for the two types separate,\n // otherwise the number 1 and the string \"1\" would end up being the same\n // value;\n this.strings = createHash();\n this.numbers = createHash();\n // We use this array as a lookup from an integer ID to a RawValue since the\n // IDs are guaranteed to be densely packed, this gives us much better\n // performance than using another hash.\n this.IDs = createArray();\n // This is used as another lookup from ID to the number of references this ID\n // has in the system. As the ref count goes to zero, we can add the ID to the\n // free list so that it can be reused.\n this.IDRefCount = createArray();\n this.IDFreeList = createArray();\n // During the course of evaluation, we might allocate a bunch of intermediate\n // IDs whose values might just be thrown away. For example if we generate a\n // value just to use as a filter, there's no sense in us keeping the value in\n // the interned space. Arenas are named groups of allocations that we may\n // want to dereference all together. Note that just because we may\n // dereference it once, that doesn't mean the ID should be released - other\n // uses of the ID may exist.\n this.arenas = createHash();\n // The only arena we *know* we want from the beginning is for the output of functions.\n this.arenas[\"functionOutput\"] = new Iterator();\n }\n Interner.prototype._getFreeID = function () {\n return this.IDFreeList.pop() || this.currentID++;\n };\n Interner.prototype.reference = function (id) {\n this.IDRefCount[id]++;\n };\n // Intern takes a value and gives you the ID associated with it. If there isn't an\n // ID it should create one for this value and in either case it should add a reference.\n Interner.prototype.intern = function (value) {\n var coll;\n if (isNumber(value)) {\n coll = this.numbers;\n }\n else {\n coll = this.strings;\n }\n var found = coll[value];\n if (found === undefined) {\n found = this._getFreeID();\n coll[value] = found;\n this.IDs[found] = value;\n this.IDRefCount[found] = 1;\n }\n else {\n this.IDRefCount[found]++;\n }\n return found;\n };\n // Get neither creates an ID nor adds a reference to the ID, it only looks up the\n // ID for a value if it exists.\n Interner.prototype.get = function (value) {\n var coll;\n if (isNumber(value)) {\n coll = this.numbers;\n }\n else {\n coll = this.strings;\n }\n return coll[value];\n };\n // Go from an ID to the RawValue\n Interner.prototype.reverse = function (id) {\n return this.IDs[id];\n };\n // Dereference an ID and if there are no remaining references, add it to the freelist.\n Interner.prototype.release = function (id) {\n if (id === undefined)\n return;\n this.IDRefCount[id]--;\n if (!this.IDRefCount[id]) {\n var value = this.IDs[id];\n var coll = void 0;\n if (isNumber(value)) {\n coll = this.numbers;\n }\n else {\n coll = this.strings;\n }\n coll[value] = undefined;\n this.IDs[id] = undefined;\n this.IDFreeList.push(id);\n }\n };\n Interner.prototype.arenaIntern = function (arenaName, value) {\n // @FIXME: Unfortunately we can't use arena intern at the moment due to the\n // fact that while we can know what values end up in the primary indexes,\n // we don't know what values might be hiding in intermediate indexes that\n // runtime nodes sometimes need to keep. If we *did* deallocate an arena\n // and the value didn't make it to a primary index, but ended up in an\n // intermediate one, we'd have effectively corrupted our program. The ID\n // would be freed, and then used for some completely different value. Until\n // we can find an accurate (and cheap!) way to track what values are still\n // hanging around, we'll just have to eat the cost of interning all the\n // values we've seen. Keep in mind that this isn't as bad as it sounds, as\n // the only values that would actually be freed this way are values that\n // are calculated but never end up touching the primary indexes. This is\n // rare enough that in practice, this probably isn't a big deal.\n throw new Error(\"Arena interning isn't ready for primetime yet.\");\n // let arena = this.arenas[arenaName];\n // if(!arena) {\n // arena = this.arenas[arenaName] = new Iterator<ID>();\n // }\n // // @NOTE: for performance reasons it might make more sense to prevent duplicates\n // // from ending up in the list. If that's the case, we could either keep a seen\n // // hash or do a get and only intern if it hasn't been seen. This is (probably?)\n // // a pretty big performance gain in the case where a bunch of rows might repeat\n // // the same function output over and over.\n // let id = this.intern(value);\n // arena.push(id);\n // return id;\n };\n Interner.prototype.releaseArena = function (arenaName) {\n var arena = this.arenas[arenaName];\n if (!arena) {\n console.warn(\"Trying to release unknown arena: \" + arenaName);\n return;\n }\n var id;\n while ((id = arena.next()) !== undefined) {\n this.release(id);\n }\n arena.clear();\n };\n return Interner;\n}());\nexports.Interner = Interner;\n// The runtime uses a single global interner so that all values remain comparable.\nexports.GlobalInterner = new Interner();\nglobal[\"GlobalInterner\"] = exports.GlobalInterner;\n// It's often useful to know just the sign of a multiplicity\nfunction sign(x) {\n return typeof x === 'number' ? x ? x < 0 ? -1 : 1 : x === x ? 0 : NaN : NaN;\n}\nvar Change = (function () {\n // Change expects that all values have already been interned.\n function Change(e, a, v, n, transaction, round, count) {\n this.e = e;\n this.a = a;\n this.v = v;\n this.n = n;\n this.transaction = transaction;\n this.round = round;\n this.count = count;\n }\n // As a convenience, you can generate a change from values that haven't been\n // interned yet.\n Change.fromValues = function (e, a, v, n, transaction, round, count) {\n return new Change(exports.GlobalInterner.intern(e), exports.GlobalInterner.intern(a), exports.GlobalInterner.intern(v), exports.GlobalInterner.intern(n), transaction, round, count);\n };\n Change.prototype.toString = function () {\n // let e = GlobalInterner.reverse(this.e);\n var e = this.e;\n return \"Change(\" + e + \", \" + exports.GlobalInterner.reverse(this.a) + \", \" + maybeReverse(this.v) + \", \" + this.n + \", \" + this.transaction + \", \" + this.round + \", \" + this.count + \")\";\n };\n // For testing purposes, you often want to compare two Changes ignoring their\n // node, as you don't know exactly what node will generate a value when you\n // run. withoutE is also used in testing to check if a triple whose entity\n // may have been generated by the program *could* match this change.\n Change.prototype.equal = function (other, withoutNode, withoutE) {\n return (withoutE || this.e == other.e) &&\n this.a == other.a &&\n this.v == other.v &&\n (withoutNode || this.n == other.n) &&\n this.transaction == other.transaction &&\n this.round == other.round &&\n this.count == other.count;\n };\n Change.prototype.reverse = function (interner) {\n if (interner === void 0) { interner = exports.GlobalInterner; }\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n return new RawChange(interner.reverse(e), interner.reverse(a), interner.reverse(v), interner.reverse(n), transaction, round, count);\n };\n Change.prototype.toRawEAV = function (interner) {\n if (interner === void 0) { interner = exports.GlobalInterner; }\n var _a = this, e = _a.e, a = _a.a, v = _a.v;\n return [interner.reverse(e), interner.reverse(a), interner.reverse(v)];\n };\n Change.prototype.clone = function () {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n return new Change(e, a, v, n, transaction, round, count);\n };\n return Change;\n}());\nexports.Change = Change;\nvar BLOCK_REMOVE = new Change(0, 0, 0, 0, 0, 0, -1);\nvar BLOCK_ADD = new Change(0, 0, 0, 0, 0, 0, 1);\nvar RemoveChange = (function (_super) {\n __extends(RemoveChange, _super);\n function RemoveChange() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RemoveChange.prototype.toString = function () {\n // let e = GlobalInterner.reverse(this.e);\n var e = this.e;\n return \"RemoveChange(\" + e + \", \" + exports.GlobalInterner.reverse(this.a) + \", \" + maybeReverse(this.v) + \", \" + this.n + \", \" + this.transaction + \", \" + this.round + \", \" + this.count + \")\";\n };\n RemoveChange.prototype.clone = function () {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n return new RemoveChange(e, a, v, n, transaction, round, count);\n };\n return RemoveChange;\n}(Change));\nexports.RemoveChange = RemoveChange;\nvar RemoveVsChange = (function (_super) {\n __extends(RemoveVsChange, _super);\n function RemoveVsChange() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RemoveVsChange.prototype.toRemoveChanges = function (context, changes) {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n var index = context.index, distinctIndex = context.distinctIndex;\n var matches = index.get(e, a, exports.IGNORE_REG, exports.IGNORE_REG, this.transaction, Infinity);\n for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {\n var v_1 = matches_1[_i].v;\n var rounds = index.getDiffs(e, a, v_1, exports.IGNORE_REG);\n for (var _b = 0, rounds_1 = rounds; _b < rounds_1.length; _b++) {\n var round = rounds_1[_b];\n var count = this.count * (round > 0 ? 1 : -1);\n var changeRound = Math.max(this.round, Math.abs(round) - 1);\n var change = new RemoveChange(e, a, v_1, n, this.transaction, changeRound, count);\n changes.push(change);\n }\n }\n };\n RemoveVsChange.prototype.clone = function () {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n return new RemoveVsChange(e, a, v, n, transaction, round, count);\n };\n return RemoveVsChange;\n}(RemoveChange));\nexports.RemoveVsChange = RemoveVsChange;\nvar RemoveAVsChange = (function (_super) {\n __extends(RemoveAVsChange, _super);\n function RemoveAVsChange() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RemoveAVsChange.prototype.toRemoveChanges = function (context, changes) {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n var index = context.index, distinctIndex = context.distinctIndex;\n var matches = index.get(e, exports.IGNORE_REG, exports.IGNORE_REG, exports.IGNORE_REG, this.transaction, Infinity);\n for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) {\n var _b = matches_2[_i], a_1 = _b.a, v_2 = _b.v;\n var rounds = index.getDiffs(e, a_1, v_2, exports.IGNORE_REG);\n for (var _c = 0, rounds_2 = rounds; _c < rounds_2.length; _c++) {\n var round = rounds_2[_c];\n var count = this.count * (round > 0 ? 1 : -1);\n var changeRound = Math.max(this.round, Math.abs(round) - 1);\n var change = new RemoveChange(e, a_1, v_2, n, this.transaction, changeRound, count);\n changes.push(change);\n }\n }\n };\n RemoveAVsChange.prototype.clone = function () {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n return new RemoveAVsChange(e, a, v, n, transaction, round, count);\n };\n return RemoveAVsChange;\n}(RemoveVsChange));\nexports.RemoveAVsChange = RemoveAVsChange;\n// When interacting with the outside world, we need to pass changes around that\n// are no longer interned. A RawChange is the same as Change, but all the\n// information in the triple has been converted back into RawValues instead of\n// interned IDs.\nvar RawChange = (function () {\n function RawChange(e, a, v, n, transaction, round, count) {\n this.e = e;\n this.a = a;\n this.v = v;\n this.n = n;\n this.transaction = transaction;\n this.round = round;\n this.count = count;\n }\n RawChange.prototype.toString = function () {\n var _a = this, e = _a.e, a = _a.a, v = _a.v, n = _a.n, transaction = _a.transaction, round = _a.round, count = _a.count;\n var internedE = exports.GlobalInterner.get(e);\n var internedV = exports.GlobalInterner.get(v);\n return \"RawChange(\" + internedE + \", \" + a + \", \" + (maybeReverse(internedV) || v) + \", \" + n + \", \" + transaction + \", \" + round + \", \" + count + \")\";\n };\n return RawChange;\n}());\nexports.RawChange = RawChange;\n// A register is a numerical offset into a prefix. We can't just make this a\n// type alias to number because we need to be able to tell the difference between\n// IDs which represent static values and registers which represent dynamic values\n// in the prefix. For example I might have a constraint that looks for the\n// pattern (register1, \"tag\", \"person\"), which if we treated Registers as numbers\n// might just look like (1, 2, 3) after the values have been interned. Instead\n// we make Register a class.\nvar Register = (function () {\n function Register(offset) {\n this.offset = offset;\n }\n return Register;\n}());\nexports.Register = Register;\nfunction isRegister(x) {\n return x && x.constructor === Register;\n}\nexports.isRegister = isRegister;\n// In some cases we have a constraint whose value we may want to ignore.\n// IGNORE_REG is a sentinel value that tells us we don't care what the value of\n// something is when we're solving.\nexports.IGNORE_REG = null;\nvar ApplyInputState;\n(function (ApplyInputState) {\n ApplyInputState[ApplyInputState[\"pass\"] = 0] = \"pass\";\n ApplyInputState[ApplyInputState[\"fail\"] = 1] = \"fail\";\n ApplyInputState[ApplyInputState[\"none\"] = 2] = \"none\";\n})(ApplyInputState = exports.ApplyInputState || (exports.ApplyInputState = {}));\nvar EAVN = (function () {\n function EAVN(e, a, v, n) {\n this.e = e;\n this.a = a;\n this.v = v;\n this.n = n;\n }\n return EAVN;\n}());\nexports.EAVN = EAVN;\n;\n//------------------------------------------------------------------------\n// Move Constraint\n//------------------------------------------------------------------------\nvar MoveConstraint = (function () {\n function MoveConstraint(from, to) {\n this.from = from;\n this.to = to;\n this.shouldApplyInput = false;\n this.proposal = { cardinality: 1, forFields: new Iterator(), forRegisters: new Iterator(), proposer: this };\n this.registers = createArray(\"MoveConstriantRegisters\");\n this.resolved = createArray(\"MoveConstraintResolved\");\n this.isInput = false;\n this.isStatic = true;\n }\n MoveConstraint.prototype.toString = function () {\n return \"Move(\" + printField(this.from) + \", \" + printField(this.to) + \")\";\n };\n MoveConstraint.prototype.setup = function () {\n if (isRegister(this.from)) {\n this.isStatic = false;\n }\n this.registers.push(this.to);\n // we are always only proposing for our to register\n this.proposal.forRegisters.clear();\n this.proposal.forRegisters.push(this.to);\n };\n MoveConstraint.prototype.resolve = function (prefix) {\n if (isRegister(this.from)) {\n this.resolved[0] = prefix[this.from.offset];\n }\n else {\n this.resolved[0] = this.from;\n }\n this.resolved[1] = prefix[this.to.offset];\n return this.resolved;\n };\n MoveConstraint.prototype.getRegisters = function () {\n return this.registers;\n };\n MoveConstraint.prototype.isAffected = function (input) {\n if (this.shouldApplyInput) {\n return ApplyInputState.pass;\n }\n return ApplyInputState.none;\n };\n MoveConstraint.prototype.applyInput = function (input, prefix) {\n if (this.shouldApplyInput) {\n var value = void 0;\n if (isRegister(this.from)) {\n value = prefix[this.from.offset];\n }\n else {\n value = this.from;\n }\n var current = prefix[this.to.offset];\n if (value !== undefined && (current === undefined || current == value)) {\n prefix[this.to.offset] = value;\n }\n else {\n return ApplyInputState.fail;\n }\n return ApplyInputState.pass;\n }\n return ApplyInputState.none;\n };\n MoveConstraint.prototype.propose = function (context, prefix, transaction, round, results) {\n var _a = this.resolve(prefix), from = _a[0], to = _a[1];\n this.proposal.skip = true;\n if (from !== undefined && to === undefined) {\n this.proposal.skip = false;\n }\n return this.proposal;\n };\n MoveConstraint.prototype.resolveProposal = function (context, prefix, proposal, transaction, round, results) {\n var _a = this.resolve(prefix), from = _a[0], to = _a[1];\n var arr = createArray(\"MoveResult\");\n arr[0] = from;\n return arr;\n };\n MoveConstraint.prototype.accept = function (context, prefix, transaction, round, solvingFor) {\n var _a = this.resolve(prefix), from = _a[0], to = _a[1];\n if (from !== undefined && to !== undefined) {\n return from == to;\n }\n return true;\n };\n MoveConstraint.prototype.acceptInput = function (context, input, prefix, transaction, round) {\n return this.accept(context, prefix, transaction, round, this.registers);\n };\n MoveConstraint.prototype.getDiffs = function (context, prefix) {\n throw new Error(\"Asking for Diffs from MoveConstraint\");\n };\n return MoveConstraint;\n}());\nexports.MoveConstraint = MoveConstraint;\n//------------------------------------------------------------------------\n// Scans\n//------------------------------------------------------------------------\n/**\n * A scan maps a set of bound variables to unbound variables.\n */\nvar Scan = (function () {\n function Scan(e, a, v, n) {\n this.e = e;\n this.a = a;\n this.v = v;\n this.n = n;\n this.resolved = { e: undefined, a: undefined, v: undefined, n: undefined };\n this.registers = createArray();\n this.registerLookup = createArray();\n this.isInput = false;\n this.proposal = { cardinality: 0, forFields: new Iterator(), forRegisters: new Iterator(), proposer: this };\n }\n Scan.prototype.toString = function () {\n return \"Scan(\" + printField(this.e) + \" \" + printField(this.a) + \" \" + printField(this.v) + \" \" + printField(this.n) + \")\";\n };\n Scan.prototype.toKey = function () {\n var e = isRegister(this.e) ? \"$reg(\" + this.e.offset + \")\" : this.e;\n var a = isRegister(this.a) ? \"$reg(\" + this.a.offset + \")\" : this.a;\n var v = isRegister(this.v) ? \"$reg(\" + this.v.offset + \")\" : this.v;\n return e + \"|\" + a + \"|\" + v;\n };\n /**\n * Resolve each scan field.\n * The resolved object may contain one of three possible value types:\n * - IGNORE_REG -- this field is entirely ignored by the scan.\n * - undefined -- this field is a register that hasn't been filled in yet.\n * We'll fill it if possible.\n * - ID -- this field contains a static or already solved value.\n */\n Scan.prototype.resolve = function (prefix) {\n var resolved = this.resolved;\n if (isRegister(this.e)) {\n resolved.e = prefix[this.e.offset];\n }\n else {\n resolved.e = this.e;\n }\n if (isRegister(this.a)) {\n resolved.a = prefix[this.a.offset];\n }\n else {\n resolved.a = this.a;\n }\n if (isRegister(this.v)) {\n resolved.v = prefix[this.v.offset];\n }\n else {\n resolved.v = this.v;\n }\n if (isRegister(this.n)) {\n resolved.n = prefix[this.n.offset];\n }\n else {\n resolved.n = this.n;\n }\n return resolved;\n };\n /**\n * A field is unresolved if it is completely ignored by the scan or\n * is an output of the scan.\n */\n Scan.prototype.fieldUnresolved = function (resolved, key) {\n return resolved[key] === exports.IGNORE_REG || resolved[key] === undefined;\n };\n /**\n * A field is not a static match if it is ignored, not a static\n * field, or the input value does not match the static value.\n */\n Scan.prototype.notStaticMatch = function (input, key) {\n return this[key] !== exports.IGNORE_REG && !isRegister(this[key]) && this[key] !== input[key];\n };\n Scan.prototype.isAffected = function (input) {\n // If this change isn't relevant to this scan, skip it.\n if (this.notStaticMatch(input, \"e\"))\n return ApplyInputState.none;\n if (this.notStaticMatch(input, \"a\"))\n return ApplyInputState.none;\n if (this.notStaticMatch(input, \"v\"))\n return ApplyInputState.none;\n if (this.notStaticMatch(input, \"n\"))\n return ApplyInputState.none;\n return ApplyInputState.pass;\n };\n /**\n * Apply new changes that may affect this scan to the prefix to\n * derive only the results affected by this change. If the change\n * was successfully applied or irrelevant we'll return true. If the\n * change was relevant but invalid (i.e., this scan could not be\n * satisfied due to proposals from previous scans) we'll return\n * false.\n */\n Scan.prototype.applyInput = function (input, prefix) {\n // For each register field of this scan:\n // if the required value is impossible fail,\n // else add this new value to the appropriate prefix register.\n // @NOTE: Technically, we republish existing values here too.\n // In practice, that's harmless and eliminates the need for a branch.\n if (isRegister(this.e)) {\n if (prefix[this.e.offset] !== undefined && prefix[this.e.offset] !== input.e)\n return ApplyInputState.fail;\n prefix[this.e.offset] = input.e;\n }\n if (isRegister(this.a)) {\n if (prefix[this.a.offset] !== undefined && prefix[this.a.offset] !== input.a)\n return ApplyInputState.fail;\n prefix[this.a.offset] = input.a;\n }\n if (isRegister(this.v)) {\n if (prefix[this.v.offset] !== undefined && prefix[this.v.offset] !== input.v)\n return ApplyInputState.fail;\n prefix[this.v.offset] = input.v;\n }\n if (isRegister(this.n)) {\n if (prefix[this.n.offset] !== undefined && prefix[this.n.offset] !== input.n)\n return ApplyInputState.fail;\n prefix[this.n.offset] = input.n;\n }\n return ApplyInputState.pass;\n };\n Scan.prototype.propose = function (context, prefix, transaction, round, results) {\n var index = context.index;\n var _a = this.resolve(prefix), e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n this.proposal.skip = false;\n var proposal = index.propose(this.proposal, e, a, v, n, transaction, round);\n var forRegisters = proposal.forRegisters, forFields = proposal.forFields;\n forRegisters.clear();\n var field;\n while ((field = forFields.next()) !== undefined) {\n forRegisters.push(this[field]);\n }\n if (proposal.forFields.length === 0)\n proposal.skip = true;\n return proposal;\n };\n Scan.prototype.resolveProposal = function (context, prefix, proposal, transaction, round, results) {\n var index = context.index;\n return index.resolveProposal(proposal);\n };\n Scan.prototype.accept = function (context, prefix, transaction, round, solvingFor) {\n // Before we start trying to accept, we check if we care about the\n // registers we are currently solving.\n var solving = false;\n for (var _i = 0, solvingFor_1 = solvingFor; _i < solvingFor_1.length; _i++) {\n var register = solvingFor_1[_i];\n if (this.registerLookup[register.offset]) {\n solving = true;\n break;\n }\n }\n // If we aren't looking at any of these registers, then we just\n // say we accept.\n if (!solving)\n return true;\n var _a = this.resolve(prefix), e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n return context.index.check(e, a, v, n, transaction, round);\n };\n Scan.prototype.acceptInput = function (context, input, prefix, transaction, round) {\n var _a = this.resolve(prefix), e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n if ((e === exports.IGNORE_REG || input.e === e) &&\n (a === exports.IGNORE_REG || input.a === a) &&\n (v === exports.IGNORE_REG || input.v === v) &&\n (n === exports.IGNORE_REG || input.n === n)) {\n return true;\n }\n else {\n return this.accept(context, prefix, transaction, round, this.registers);\n }\n };\n Scan.prototype.setupRegister = function (field, parts) {\n var value = this[field];\n if (isRegister(value)) {\n this.registers.push(value);\n parts.push(\"resolved.\" + field + \" = prefix[\" + value.offset + \"];\");\n }\n else {\n this.resolved[field] = value;\n }\n };\n Scan.prototype.setupIsAffected = function () {\n var fields = [\"e\", \"a\", \"v\", \"n\"];\n var parts = [];\n for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {\n var field = fields_1[_i];\n var value = this[field];\n if (!isRegister(value) && value !== exports.IGNORE_REG) {\n parts.push(\"if(\" + value + \" !== change[\\\"\" + field + \"\\\"]) return \" + ApplyInputState.none + \";\");\n }\n }\n this.isAffected = new Function(\"change\", parts.join(\"\\n\"));\n };\n Scan.prototype.setupApplyInput = function () {\n var fields = [\"e\", \"a\", \"v\", \"n\"];\n var parts = [];\n for (var _i = 0, fields_2 = fields; _i < fields_2.length; _i++) {\n var field = fields_2[_i];\n var value = this[field];\n if (isRegister(value)) {\n parts.push(\"if(prefix[\" + value.offset + \"] !== undefined && prefix[\" + value.offset + \"] !== input.\" + field + \") return \" + ApplyInputState.fail + \";\\n prefix[\" + value.offset + \"] = input.\" + field + \";\");\n }\n }\n parts.push(\"return \" + ApplyInputState.pass);\n this.applyInput = new Function(\"input\", \"prefix\", parts.join(\"\\n\"));\n };\n // We precompute the registers we're interested in for fast accepts.\n Scan.prototype.setup = function () {\n var parts = [\"var resolved = this.resolved;\"];\n this.setupRegister(\"e\", parts);\n this.setupRegister(\"a\", parts);\n this.setupRegister(\"v\", parts);\n this.setupRegister(\"n\", parts);\n parts.push(\"return resolved\");\n this.resolve = new Function(\"prefix\", parts.join(\"\\n\"));\n this.setupIsAffected();\n this.setupApplyInput();\n for (var _i = 0, _a = this.registers; _i < _a.length; _i++) {\n var register = _a[_i];\n this.registerLookup[register.offset] = true;\n }\n };\n Scan.prototype.getRegisters = function () {\n return this.registers;\n };\n Scan.prototype.getDiffs = function (context, prefix) {\n var _a = this.resolve(prefix), e = _a.e, a = _a.a, v = _a.v, n = _a.n;\n return context.index.getDiffs(e, a, v, n);\n };\n return Scan;\n}());\nexports.Scan = Scan;\nvar FunctionConstraint = (function () {\n function FunctionConstraint(fields, restFields) {\n this.fields = fields;\n this.restFields = restFields;\n this.multi = false;\n this.isInput = false;\n this.proposal = { cardinality: 0, forFields: new Iterator(), forRegisters: new Iterator(), proposer: this };\n this.resolved = {};\n this.resolvedRest = createArray();\n this.registers = createArray();\n this.registerLookup = createArray();\n this.applyInputs = createArray();\n this.applyRestInputs = createArray();\n }\n FunctionConstraint.register = function (name, klass) {\n FunctionConstraint.registered[name] = klass;\n };\n FunctionConstraint.fetchInfo = function (name) {\n var info = FunctionConstraint.registered[name];\n if (!info)\n throw new Error(\"No function info for: \" + name);\n return info;\n };\n FunctionConstraint.create = function (name, fields, restFields) {\n if (restFields === void 0) { restFields = createArray(); }\n var cur = FunctionConstraint.registered[name];\n if (!cur) {\n throw new Error(\"No function named \" + name + \" is registered.\");\n }\n if (restFields.length && !cur.variadic) {\n console.error(\"The \" + name + \" function is not variadic, so may not accept restFields.\");\n restFields = createArray();\n }\n var created = new cur(fields, restFields);\n return created;\n };\n FunctionConstraint.prototype.toString = function () {\n var _this = this;\n var params = this.fieldNames.map(function (v) { return v + \": \" + printField(_this.fields[v]); }).join(\", \");\n var restParams = this.restFields.map(printField).join(\", \");\n return \"FunctionConstraint(\\\"\" + this.name + \"\\\", \" + params + \" \" + (restParams ? \", [\" + restParams + \"]\" : \"\") + \")\";\n };\n // We precompute the registers we're interested in for fast accepts.\n FunctionConstraint.prototype.setup = function () {\n this.fieldNames = Object.keys(this.fields);\n for (var _i = 0, _a = this.fieldNames; _i < _a.length; _i++) {\n var fieldName = _a[_i];\n var field = this.fields[fieldName];\n if (isRegister(field))\n this.registers.push(field);\n }\n for (var _b = 0, _c = this.restFields; _b < _c.length; _b++) {\n var field = _c[_b];\n if (isRegister(field))\n this.registers.push(field);\n }\n for (var _d = 0, _e = this.registers; _d < _e.length; _d++) {\n var register = _e[_d];\n this.registerLookup[register.offset] = true;\n }\n this.setupResolve();\n this.setupResolveRest();\n };\n FunctionConstraint.prototype.setupResolve = function () {\n var resolved = this.resolved;\n var parts = [\"var resolved = this.resolved;\"];\n for (var _i = 0, _a = this.fieldNames; _i < _a.length; _i++) {\n var fieldName = _a[_i];\n var field = this.fields[fieldName];\n if (isRegister(field)) {\n parts.push(\"resolved[\\\"\" + fieldName + \"\\\"] = prefix[\" + field.offset + \"];\");\n }\n else {\n resolved[fieldName] = field;\n }\n }\n parts.push(\"return resolved\");\n this.resolve = new Function(\"prefix\", parts.join(\"\\n\"));\n };\n FunctionConstraint.prototype.setupResolveRest = function () {\n var resolvedRest = this.resolvedRest;\n var parts = [\"var resolvedRest = this.resolvedRest;\"];\n var ix = 0;\n for (var _i = 0, _a = this.restFields; _i < _a.length; _i++) {\n var field = _a[_i];\n if (isRegister(field)) {\n parts.push(\"resolvedRest[\" + ix + \"] = prefix[\" + field.offset + \"]\");\n }\n else {\n resolvedRest[ix] = field;\n }\n ix++;\n }\n parts.push(\"return resolvedRest;\");\n this.resolveRest = new Function(\"prefix\", parts.join(\"\\n\"));\n };\n FunctionConstraint.prototype.getRegisters = function () {\n return this.registers;\n };\n /**\n * Similar to `Scan.resolve`, but resolving a map of the function's\n * fields rather than an EAVN.\n */\n FunctionConstraint.prototype.resolve = function (prefix) {\n var resolved = this.resolved;\n for (var _i = 0, _a = this.fieldNames; _i < _a.length; _i++) {\n var fieldName = _a[_i];\n var field = this.fields[fieldName];\n if (isRegister(field)) {\n resolved[fieldName] = prefix[field.offset];\n }\n else {\n resolved[fieldName] = field;\n }\n }\n return resolved;\n };\n /**\n * If a function is variadic, we need to resolve its rest fields as well.\n */\n FunctionConstraint.prototype.resolveRest = function (prefix) {\n var resolvedRest = this.resolvedRest;\n var ix = 0;\n for (var _i = 0, _a = this.restFields; _i < _a.length; _i++) {\n var field = _a[_i];\n if (isRegister(field)) {\n resolvedRest[ix] = prefix[field.offset];\n }\n else {\n resolvedRest[ix] = field;\n }\n ix++;\n }\n return resolvedRest;\n };\n // Function constraints have nothing to apply to the input, so they\n // always return ApplyInputState.none\n FunctionConstraint.prototype.isAffected = function (input) { return ApplyInputState.none; };\n FunctionConstraint.prototype.applyInput = function (input, prefix) { return ApplyInputState.none; };\n FunctionConstraint.prototype.propose = function (context, prefix, transaction, round, results) {\n var proposal = this.proposal;\n proposal.forRegisters.clear();\n var resolved = this.resolve(prefix);\n // If none of our returns are unbound\n // @NOTE: We don't need to worry about the filter case here, since he'll be\n var unresolvedOutput = false;\n for (var _i = 0, _a = this.returnNames; _i < _a.length; _i++) {\n var output = _a[_i];\n if (resolved[output] === undefined) {\n unresolvedOutput = true;\n var field = this.fields[output];\n if (isRegister(field)) {\n proposal.forRegisters.push(field);\n }\n }\n }\n if (!unresolvedOutput) {\n proposal.skip = true;\n return proposal;\n }\n // If any of our args aren't resolved yet, we can't compute results either.\n // @NOTE: This'll need to be touched up when we add optional support if they\n // co-inhabit the args object.\n for (var _b = 0, _c = this.argNames; _b < _c.length; _b++) {\n var input = _c[_b];\n if (resolved[input] === undefined) {\n proposal.skip = true;\n return proposal;\n }\n }\n // Similarly, if we're variadic we need to check that all of our\n // variadic inputs bound to registers are resolved too.\n // @NOTE: We really need to bend over backwards at the moment to\n // convince TS to check a static member of the current class...\n if (this.constructor.variadic) {\n var resolvedRest = this.resolveRest(prefix);\n for (var _d = 0, resolvedRest_1 = resolvedRest; _d < resolvedRest_1.length; _d++) {\n var field = resolvedRest_1[_d];\n if (field === undefined) {\n proposal.skip = true;\n return proposal;\n }\n }\n }\n // Otherwise, we're ready to propose.\n proposal.skip = false;\n if (this.estimate) {\n // If the function provides a cardinality estimator, invoke that.\n proposal.cardinality = this.estimate(context, prefix, transaction, round);\n }\n else {\n // Otherwise, we'll just return 1 for now, since computing a\n // function is almost always cheaper than a scan.\n // @NOTE: If this is an issue, we can just behave like scans and\n // compute ourselves here, caching the results.\n proposal.cardinality = 1;\n }\n return proposal;\n };\n /**\n * Pack the resolved register values for the functions argument\n * fields into an array.\n */\n FunctionConstraint.prototype.packInputs = function (prefix) {\n var resolved = this.resolve(prefix);\n var inputs = this.applyInputs;\n var argIx = 0;\n for (var _i = 0, _a = this.argNames; _i < _a.length; _i++) {\n var argName = _a[_i];\n // If we're asked to resolve the propoal we know that we've\n // proposed, and we'll only propose if these are resolved.\n inputs[argIx] = exports.GlobalInterner.reverse(resolved[argName]);\n argIx++;\n }\n // If we're variadic, we also need to pack our var-args up and\n // attach them as the last argument.\n if (this.constructor.variadic) {\n var resolvedRest = this.resolveRest(prefix);\n var restInputs = this.applyRestInputs;\n restInputs.length = 0;\n var ix = 0;\n for (var _b = 0, resolvedRest_2 = resolvedRest; _b < resolvedRest_2.length; _b++) {\n var value = resolvedRest_2[_b];\n if (value !== undefined) {\n restInputs[ix] = exports.GlobalInterner.reverse(value);\n }\n ix++;\n }\n inputs[argIx] = restInputs;\n }\n return inputs;\n };\n FunctionConstraint.prototype.unpackOutputs = function (outputs) {\n for (var ix = 0; ix < outputs.length; ix++) {\n // @NOTE: we'd like to use arenaIntern here, but because of intermediate values\n // that's not currently a possibility. We should revisit this if a practical solution\n // for arenas surfaces.\n outputs[ix] = exports.GlobalInterner.intern(outputs[ix]);\n }\n return outputs;\n };\n FunctionConstraint.prototype.getResult = function (prefix, outputs) {\n // Finally, if we had results, we create the result prefixes and pass them along.\n var result = createArray(\"functionResult\");\n var ix = 0;\n for (var _i = 0, _a = this.returnNames; _i < _a.length; _i++) {\n var returnName = _a[_i];\n var field = this.fields[returnName];\n if (isRegister(field) && !prefix[field.offset]) {\n result[ix] = outputs[ix];\n }\n ix++;\n }\n return result;\n };\n FunctionConstraint.prototype.checkResult = function (prefix, outputs) {\n // Finally, we make sure every return register matches up with our outputs.\n // @NOTE: If we just use solvingFor then we don't know the offsets into the outputs array,\n // so we check everything...\n var ix = 0;\n for (var _i = 0, _a = this.returnNames; _i < _a.length; _i++) {\n var returnName = _a[_i];\n var field = this.fields[returnName];\n var value = isRegister(field) ? prefix[field.offset] : field;\n if (value !== outputs[ix]) {\n return false;\n }\n ix++;\n }\n return true;\n };\n FunctionConstraint.prototype.resolveProposal = function (context, prefix, proposal, transaction, round, results) {\n // First we build the args array to provide the apply function.\n var inputs = this.packInputs(prefix);\n // Then we actually apply it and then unpack the outputs.\n var computed = this.apply.apply(this, inputs);\n if (!computed)\n return results;\n if (!this.multi) {\n // If it's not a multi-returning function, it has a single result.\n var outputs = this.unpackOutputs(computed);\n var result = this.getResult(prefix, outputs);\n results.push(result);\n }\n else {\n for (var _i = 0, computed_1 = computed; _i < computed_1.length; _i++) {\n var row = computed_1[_i];\n // Otherwise it has N results.\n var outputs = this.unpackOutputs(row);\n var result = this.getResult(prefix, outputs);\n results.push(result);\n }\n }\n return results;\n };\n FunctionConstraint.prototype.accept = function (context, prefix, transaction, round, solvingFor) {\n // If none of the registers we're solving for intersect our inputs\n // or outputs, we're not relevant to the solution.\n var isRelevant = false;\n for (var _i = 0, solvingFor_2 = solvingFor; _i < solvingFor_2.length; _i++) {\n var register = solvingFor_2[_i];\n if (this.registerLookup[register.offset]) {\n isRelevant = true;\n break;\n }\n }\n if (!isRelevant)\n return true;\n // If we're missing a field, we can't verify our output yet so we preliminarily accept.\n for (var _a = 0, _b = this.fieldNames; _a < _b.length; _a++) {\n var fieldName = _b[_a];\n var field = this.fields[fieldName];\n if (isRegister(field) && prefix[field.offset] === undefined)\n return true;\n }\n // First we build the args array to provide the apply function.\n var inputs = this.packInputs(prefix);\n // Then we actually apply it and then unpack the outputs.\n var computed = this.apply.apply(this, inputs);\n if (!computed)\n return false;\n if (!this.multi) {\n // If it's not a multi-returning function we only need to check against the single result.\n var outputs = this.unpackOutputs(computed);\n return this.checkResult(prefix, outputs);\n }\n else {\n // Otherwise we match against any of the results.\n for (var _c = 0, computed_2 = computed; _c < computed_2.length; _c++) {\n var row = computed_2[_c];\n var outputs = this.unpackOutputs(row);\n if (this.checkResult(prefix, outputs))\n return true;\n }\n return false;\n }\n };\n FunctionConstraint.prototype.acceptInput = function (context, input, prefix, transaction, round) {\n return this.accept(context, prefix, transaction, round, this.registers);\n };\n FunctionConstraint.prototype.getDiffs = function (context, prefix) {\n return [];\n };\n FunctionConstraint.registered = {};\n FunctionConstraint.filter = false;\n FunctionConstraint.variadic = false;\n return FunctionConstraint;\n}());\nexports.FunctionConstraint = FunctionConstraint;\nfunction _makeFunction(_a) {\n var name = _a.name, _b = _a.variadic, variadic = _b === void 0 ? false : _b, args = _a.args, returns = _a.returns, apply = _a.apply, estimate = _a.estimate, initialState = _a.initialState, _c = _a.multi, multi = _c === void 0 ? false : _c;\n var NewFunctionConstraint = (function (_super) {\n __extends(NewFunctionConstraint, _super);\n function NewFunctionConstraint() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.name = name;\n _this.args = args;\n _this.argNames = Object.keys(args);\n _this.returnNames = Object.keys(returns);\n _this.returns = returns;\n _this.apply = apply;\n _this.state = initialState;\n _this.multi = multi;\n return _this;\n }\n NewFunctionConstraint.variadic = variadic;\n NewFunctionConstraint.filter = Object.keys(returns).length === 0;\n NewFunctionConstraint.argNames = Object.keys(args);\n NewFunctionConstraint.returnNames = Object.keys(returns);\n return NewFunctionConstraint;\n }(FunctionConstraint));\n FunctionConstraint.register(name, NewFunctionConstraint);\n}\nfunction makeFunction(args) {\n return _makeFunction(args);\n}\nexports.makeFunction = makeFunction;\nfunction makeMultiFunction(args) {\n args.multi = true;\n return _makeFunction(args);\n}\nexports.makeMultiFunction = makeMultiFunction;\n//------------------------------------------------------------------------\n// Nodes\n//------------------------------------------------------------------------\n/**\n * Base class for nodes, the building blocks of blocks.\n */\nvar Node = (function () {\n function Node() {\n this.ID = Node.NodeID++;\n this.results = new Iterator();\n }\n Node.prototype.toBranchString = function () {\n return this.toString();\n };\n Node.NodeID = 0;\n return Node;\n}());\nexports.Node = Node;\n/**\n * The JoinNode implements generic join across multiple constraints.\n * Since our system is incremental, we need to do something slightly\n * fancier than we did in the previous runtime. For each new change\n * that enters the system, we ask each of our constraints whether they\n * are capable of producing a new result. In the case where a single\n * constraint can, we presolve that constraint and then run the rest\n * normally, limited to only producing results that match the first\n * constraint. However, if multiple constraints might apply the input,\n * we need to run for each *combination* of heads. E.g.:\n *\n * Given a join node with constraints [A, B, C, and D], where A and D\n * can both apply the input, we must combine the results of the\n * following computations to get the full result set:\n *\n * Apply {A} -> Do {B, C, D}\n * Apply {A, D} -> Do {B, C}\n * Apply {D} -> Do {A, B, C}\n *\n * We calculate this using the power set in exec.\n *\n * We then apply each of these combinations by running a genericJoin\n * over the remaining unresolved registers. We ask each un-applied\n * constraint to propose a register to be solved. If a constraint is\n * capable of resolving one, it returns the set of registers it can\n * resolve and an estimate of the result set's cardinality. Generic\n * Join chooses the cheapest proposal, which the winning constraint\n * then fully computes (or retrieves from cache and returns). Next it\n * asks each other constraint to accept or reject the proposal. If the\n * constraint doesn't apply to the solved registers, it accepts. If\n * the solution contains results that match the output of the\n * constraint, it also accepts. Otherwise, it must reject the solution\n * and that particular run yields no results.\n */\nvar JoinNode = (function (_super) {\n __extends(JoinNode, _super);\n function JoinNode(constraints) {\n var _this = _super.call(this) || this;\n _this.constraints = constraints;\n _this.traceType = trace_1.TraceNode.Join;\n _this.isStatic = false;\n _this.dormant = false;\n _this.registerLength = 0;\n _this.emptyProposal = { cardinality: Infinity, forFields: new Iterator(), forRegisters: new Iterator(), skip: true, proposer: {} };\n _this.affectedConstraints = new Iterator();\n // We need to find all the registers contained in our scans so that\n // we know how many rounds of Generic Join we need to do.\n var registerLength = 0;\n var registerLookup = [];\n var registers = createArray();\n var proposedResultsArrays = createArray();\n var hasOnlyMoves = true;\n var hasNoScans = true;\n var onlyStatic = true;\n for (var _i = 0, constraints_1 = constraints; _i < constraints_1.length; _i++) {\n var constraint = constraints_1[_i];\n constraint.setup();\n if (!(constraint instanceof MoveConstraint))\n hasOnlyMoves = false;\n else if (!constraint.isStatic)\n onlyStatic = false;\n if (constraint instanceof Scan)\n hasNoScans = false;\n for (var _a = 0, _b = constraint.getRegisters(); _a < _b.length; _a++) {\n var register = _b[_a];\n if (!registerLookup[register.offset]) {\n registers.push(createArray());\n proposedResultsArrays.push(createArray());\n registerLookup[register.offset] = true;\n registerLength++;\n }\n }\n }\n if (hasOnlyMoves) {\n for (var _c = 0, _d = constraints; _c < _d.length; _c++) {\n var constraint = _d[_c];\n constraint.shouldApplyInput = true;\n }\n _this.isStatic = onlyStatic;\n }\n if (hasNoScans) {\n _this.exec = JoinNode.prototype.downStreamExec;\n }\n _this.registerLookup = registerLookup;\n _this.registerArrays = registers;\n _this.registerLength = registerLength;\n _this.proposedResultsArrays = proposedResultsArrays;\n return _this;\n }\n JoinNode.prototype.toString = function () {\n return \"JoinNode([\\n \" + this.constraints.map(toString).join(\"\\n \") + \"\\n])\";\n };\n JoinNode.prototype.findAffectedConstraints = function (input, prefix) {\n // @TODO: Hoist me out.\n var affectedConstraints = this.affectedConstraints;\n affectedConstraints.clear();\n for (var ix = 0, len = this.constraints.length; ix < len; ix++) {\n var constraint = this.constraints[ix];\n var result = constraint.isAffected(input);\n if (result !== ApplyInputState.none) {\n affectedConstraints.push(constraint);\n }\n }\n return affectedConstraints;\n };\n JoinNode.prototype.applyCombination = function (context, input, prefix, transaction, round, results) {\n // debug(\" Join combo:\", prefix.slice());\n var countOfSolved = 0;\n for (var ix = 0; ix < this.registerLookup.length; ix++) {\n if (!this.registerLookup[ix])\n continue;\n if (prefix[ix] !== undefined)\n countOfSolved++;\n }\n var remainingToSolve = this.registerLength - countOfSolved;\n // context.tracer.tracker.blockTime(\"PresolveCheck\");\n var valid = this.presolveCheck(context, input, prefix, transaction, round);\n // context.tracer.tracker.blockTimeEnd(\"PresolveCheck\");\n // debug(\" Join combo valid:\", valid, remainingToSolve, countOfSolved, this.registerLength);\n if (!valid) {\n // do nothing\n return false;\n }\n else if (!remainingToSolve) {\n // if it is valid and there's nothing left to solve, then we've found\n // a full result and we should just continue\n this.prefixToResults(context, this.constraints, prefix, round, results);\n // debug(\" Join combo result:\", results);\n return true;\n }\n else {\n // debug(\" GJ:\", remainingToSolve, this.constraints);\n // For each node, find the new results that match the prefix.\n this.genericJoin(context, prefix, transaction, round, results, remainingToSolve);\n // context.tracer.tracker.blockTimeEnd(\"GenericJoin\");\n return true;\n }\n };\n JoinNode.prototype.unapplyConstraint = function (constraint, prefix) {\n for (var _i = 0, _a = constraint.getRegisters(); _i < _a.length; _i++) {\n var register = _a[_i];\n prefix[register.offset] = undefined;\n }\n };\n JoinNode.prototype.presolveCheck = function (context, input, prefix, transaction, round) {\n var constraints = this.constraints;\n // window[\"counts\"][window[\"active\"]]++;\n for (var _i = 0, constraints_2 = constraints; _i < constraints_2.length; _i++) {\n var constraint = constraints_2[_i];\n var valid = constraint.acceptInput(context, input, prefix, transaction, round);\n if (!valid) {\n // debug(\" INVALID:\", constraint);\n return false;\n }\n }\n return true;\n };\n JoinNode.prototype.computeMultiplicities = function (context, results, prefix, currentRound, diffs, diffIndex) {\n if (diffIndex === void 0) { diffIndex = -1; }\n if (diffIndex === -1) {\n prefix[prefix.length - 2] = currentRound;\n prefix[prefix.length - 1] = this.inputCount;\n this.computeMultiplicities(context, results, prefix, currentRound, diffs, diffIndex + 1);\n prefix[prefix.length - 2] = undefined;\n prefix[prefix.length - 1] = undefined;\n }\n else if (diffIndex === diffs.length) {\n var result = copyArray(prefix, \"gjResultsArray\");\n context.tracer.capturePrefix(result);\n //debug(\" GJ -> \", result);\n results.push(result);\n }\n else {\n var startingRound = prefix[prefix.length - 2];\n var startingMultiplicity = prefix[prefix.length - 1];\n var rounds = diffs[diffIndex];\n var roundToMultiplicity = {};\n var maxRound = currentRound;\n var ix = 0;\n var currentRoundCount = 0;\n for (var _i = 0, rounds_3 = rounds; _i < rounds_3.length; _i++) {\n var round = rounds_3[_i];\n if (Math.abs(round) - 1 > currentRound) {\n break;\n }\n currentRoundCount += round > 0 ? 1 : -1;\n ix++;\n }\n if (currentRoundCount) {\n prefix[prefix.length - 2] = Math.max(currentRound, startingRound);\n prefix[prefix.length - 1] = startingMultiplicity * currentRoundCount;\n this.computeMultiplicities(context, results, prefix, currentRound, diffs, diffIndex + 1);\n }\n for (; ix < rounds.length; ix++) {\n var round = rounds[ix];\n var count = round > 0 ? 1 : -1;\n prefix[prefix.length - 2] = Math.max(Math.abs(round) - 1, startingRound);\n prefix[prefix.length - 1] = startingMultiplicity * count;\n this.computeMultiplicities(context, results, prefix, currentRound, diffs, diffIndex + 1);\n }\n prefix[prefix.length - 2] = startingRound;\n prefix[prefix.length - 1] = startingMultiplicity;\n }\n return results;\n };\n JoinNode.prototype.prefixToResults = function (context, constraints, prefix, round, results) {\n var diffs = [];\n for (var _i = 0, constraints_3 = constraints; _i < constraints_3.length; _i++) {\n var constraint = constraints_3[_i];\n if (constraint.isInput || !(constraint instanceof Scan))\n continue;\n var cur = constraint.getDiffs(context, prefix);\n diffs.push(cur);\n }\n this.computeMultiplicities(context, results, prefix, round, diffs);\n };\n JoinNode.prototype.genericJoin = function (context, prefix, transaction, round, results, roundIx) {\n if (roundIx === void 0) { roundIx = this.registerLength; }\n var _a = this, constraints = _a.constraints, emptyProposal = _a.emptyProposal;\n var proposedResults = this.proposedResultsArrays[roundIx - 1];\n var forRegisters = this.registerArrays[roundIx - 1];\n proposedResults.length = 0;\n var bestProposal = emptyProposal;\n for (var _i = 0, constraints_4 = constraints; _i < constraints_4.length; _i++) {\n var constraint = constraints_4[_i];\n var current = constraint.propose(context, prefix, transaction, round, proposedResults);\n if (!current.skip && current.cardinality === 0) {\n return results;\n }\n else if (current.cardinality < bestProposal.cardinality && !current.skip) {\n bestProposal = current;\n }\n }\n if (bestProposal.skip) {\n // debug(\" BAILING\", bestProposal);\n return results;\n }\n var proposer = bestProposal.proposer;\n // We have to copy here because we need to keep a reference to this even if later\n // rounds might overwrite the proposal\n moveArray(bestProposal.forRegisters.array, forRegisters);\n var resolved = proposer.resolveProposal(context, prefix, bestProposal, transaction, round, proposedResults);\n if (resolved[0] && resolved[0].constructor === Array) {\n resultLoop: for (var _b = 0, resolved_1 = resolved; _b < resolved_1.length; _b++) {\n var result = resolved_1[_b];\n var ix = 0;\n for (var _c = 0, forRegisters_1 = forRegisters; _c < forRegisters_1.length; _c++) {\n var register = forRegisters_1[_c];\n prefix[register.offset] = +result[ix];\n ix++;\n }\n for (var _d = 0, constraints_5 = constraints; _d < constraints_5.length; _d++) {\n var constraint = constraints_5[_d];\n if (constraint === proposer)\n continue;\n if (!constraint.accept(context, prefix, transaction, round, forRegisters)) {\n // debug(\" BAILING\", printConstraint(constraint));\n continue resultLoop;\n }\n }\n if (roundIx === 1) {\n this.prefixToResults(context, constraints, prefix, round, results);\n }\n else {\n this.genericJoin(context, prefix, transaction, round, results, roundIx - 1);\n }\n }\n }\n else {\n var register = forRegisters[0];\n resultLoop: for (var _e = 0, resolved_2 = resolved; _e < resolved_2.length; _e++) {\n var result = resolved_2[_e];\n prefix[register.offset] = +result;\n for (var _f = 0, constraints_6 = constraints; _f < constraints_6.length; _f++) {\n var constraint = constraints_6[_f];\n if (constraint === proposer)\n continue;\n if (!constraint.accept(context, prefix, transaction, round, forRegisters)) {\n // debug(\" BAILING\", printConstraint(constraint));\n continue resultLoop;\n }\n }\n if (roundIx === 1) {\n this.prefixToResults(context, constraints, prefix, round, results);\n }\n else {\n this.genericJoin(context, prefix, transaction, round, results, roundIx - 1);\n }\n }\n }\n for (var _g = 0, forRegisters_2 = forRegisters; _g < forRegisters_2.length; _g++) {\n var register = forRegisters_2[_g];\n // @NOTE: marking this as any is spoopy at best, but since we should never\n // iterate over the prefix, but instead use it almost like a hash, this\n // should be fine.\n prefix[register.offset] = undefined;\n }\n return results;\n };\n JoinNode.prototype.downStreamExec = function (context, input, prefix, transaction, round, results) {\n if (this.isStatic && this.dormant)\n return false;\n this.inputCount = prefix[prefix.length - 1] !== undefined ? prefix[prefix.length - 1] : input.count;\n var inputRound = prefix[prefix.length - 2] !== undefined ? prefix[prefix.length - 2] : input.round;\n var didSomething = this.applyCombination(context, input, prefix, transaction, inputRound, results);\n if (this.isStatic && didSomething) {\n this.dormant = true;\n }\n return didSomething;\n };\n JoinNode.prototype.exec = function (context, input, prefix, transaction, round, results) {\n var didSomething = false;\n this.inputCount = input.count;\n // if we are removing the block, we need the join to compute all the results currently\n // being generated by this block and undo them. We do this by sending a blank prefix\n // through with an input count of -1.\n if (input === BLOCK_REMOVE) {\n didSomething = this.applyCombination(context, input, prefix, transaction, round, results);\n }\n else if (this.isStatic && this.dormant) {\n return false;\n }\n else if (input === BLOCK_ADD) {\n didSomething = this.applyCombination(context, input, prefix, transaction, round, results);\n }\n else {\n this.inputCount = input.count;\n var affectedConstraints = this.findAffectedConstraints(input, prefix);\n var combinationCount = Math.pow(2, affectedConstraints.length);\n for (var comboIx = combinationCount - 1; comboIx > 0; comboIx--) {\n //console.log(\" Combo:\", comboIx);\n var shouldApply = true;\n for (var constraintIx = 0; constraintIx < affectedConstraints.length; constraintIx++) {\n var mask = 1 << constraintIx;\n var isIncluded = (comboIx & mask) !== 0;\n var constraint_1 = affectedConstraints.array[constraintIx];\n constraint_1.isInput = isIncluded;\n if (isIncluded) {\n var valid = constraint_1.applyInput(input, prefix);\n // debug(\" included\", printConstraint(constraint));\n // If any member of the input constraints fails, this whole combination is doomed.\n if (valid === ApplyInputState.fail) {\n shouldApply = false;\n break;\n }\n //console.log(\" \" + printConstraint(constraint));\n }\n }\n //console.log(\" \", printPrefix(prefix));\n if (shouldApply) {\n didSomething = this.applyCombination(context, input, prefix, transaction, round, results) || didSomething;\n }\n var constraint_2 = void 0;\n affectedConstraints.reset();\n while ((constraint_2 = affectedConstraints.next()) !== undefined) {\n this.unapplyConstraint(constraint_2, prefix);\n }\n }\n affectedConstraints.reset();\n var constraint = void 0;\n while ((constraint = affectedConstraints.next()) !== undefined) {\n constraint.isInput = false;\n }\n }\n if (this.isStatic && didSomething) {\n this.dormant = true;\n }\n return didSomething;\n };\n return JoinNode;\n}(Node));\nexports.JoinNode = JoinNode;\nvar DownstreamJoinNode = (function (_super) {\n __extends(DownstreamJoinNode, _super);\n function DownstreamJoinNode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DownstreamJoinNode.prototype.exec = function (context, input, prefix, transaction, round, results) {\n return this.downStreamExec(context, input, prefix, transaction, round, results);\n };\n return DownstreamJoinNode;\n}(JoinNode));\nexports.DownstreamJoinNode = DownstreamJoinNode;\nvar NoopJoinNode = (function (_super) {\n __extends(NoopJoinNode, _super);\n function NoopJoinNode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NoopJoinNode.prototype.exec = function (context, input, prefix, transaction, round, results) {\n if (!this.dormant) {\n this.prefixToResults(context, this.constraints, prefix, round, results);\n this.dormant = true;\n return true;\n }\n return false;\n };\n return NoopJoinNode;\n}(JoinNode));\nexports.NoopJoinNode = NoopJoinNode;\nvar WatchNode = (function (_super) {\n __extends(WatchNode, _super);\n function WatchNode(e, a, v, n, blockId) {\n var _this = _super.call(this) || this;\n _this.e = e;\n _this.a = a;\n _this.v = v;\n _this.n = n;\n _this.blockId = blockId;\n _this.traceType = trace_1.TraceNode.Watch;\n _this.resolved = {};\n _this.resolve = Scan.prototype.resolve;\n return _this;\n }\n WatchNode.prototype.toString = function () {\n return \"WatchNode(\" + printField(this.e) + \", \" + printField(this.a) + \", \" + printField(this.v) + \", \" + printField(this.n) + \")\";\n };\n WatchNode.prototype.exec = function (context, input, prefix, transactionId, round, results, transaction) {\n var resolved = this.resolve(prefix);\n var e = resolved.e, a = resolved.a, v = resolved.v, n = resolved.n;\n // @NOTE: This is wasteful.\n results.push(prefix);\n if (e === undefined || a === undefined || v === undefined || n === undefined) {\n throw new Error(\"Unable to produce an output with an undefined EAVN field [\" + e + \", \" + a + \", \" + v + \", \" + n + \"]\");\n }\n var prefixRound = prefix[prefix.length - 2];\n var prefixCount = prefix[prefix.length - 1];\n // @FIXME: Make sure I still work now that I'm sending all my deltas. I think I still need to use local intermediates.\n var change = new Change(e, a, v, n, transactionId, prefixRound + 1, prefixCount);\n transaction.export(context, this.blockId, change);\n return true;\n };\n return WatchNode;\n}(Node));\nexports.WatchNode = WatchNode;\nvar OutputWrapperNode = (function (_super) {\n __extends(OutputWrapperNode, _super);\n function OutputWrapperNode(nodes) {\n var _this = _super.call(this) || this;\n _this.nodes = nodes;\n _this.traceType = trace_1.TraceNode.Output;\n _this.binds = new Iterator();\n _this.commits = new Iterator();\n return _this;\n }\n OutputWrapperNode.prototype.toString = function () {\n return \"OutputWrapper([\" + (this.nodes.length ? \"\\n \" : \"\") + indent(this.nodes.map(toString).join(\"\\n\"), 2) + \"])\";\n };\n OutputWrapperNode.prototype.exec = function (context, input, prefix, transactionId, round, results, transaction) {\n var tracer = context.tracer;\n var _a = this, binds = _a.binds, commits = _a.commits;\n binds.clear();\n commits.clear();\n for (var _i = 0, _b = this.nodes; _i < _b.length; _i++) {\n var node = _b[_i];\n node.exec(context, input, prefix, transactionId, round, binds, commits);\n }\n binds.reset();\n var change;\n while (change = binds.next()) {\n transaction.output(context, change);\n }\n commits.reset();\n while (change = commits.next()) {\n transaction.commit(context, change);\n }\n return true;\n };\n return OutputWrapperNode;\n}(Node));\nexports.OutputWrapperNode = OutputWrapperNode;\nvar InsertNode = (function () {\n function InsertNode(e, a, v, n) {\n this.e = e;\n this.a = a;\n this.v = v;\n this.n = n;\n this.multiplier = 1;\n // We precompute the registers we're interested in for fast accepts.\n this.resolved = { e: undefined, a: undefined, v: undefined, n: undefined };\n var parts = [\"var resolved = this.resolved;\"];\n this.setupRegister(\"e\", parts);\n this.setupRegister(\"a\", parts);\n this.setupRegister(\"v\", parts);\n this.setupRegister(\"n\", parts);\n parts.push(\"return resolved\");\n this.resolve = new Function(\"prefix\", parts.join(\"\\n\"));\n }\n InsertNode.prototype.toString = function () {\n return \"InsertNode(\" + printField(this.e) + \", \" + printField(this.a) + \", \" + printField(this.v) + \", \" + printField(this.n) + \")\";\n };\n InsertNode.prototype.setupRegister = function (field, parts) {\n var value = this[field];\n if (isRegister(value)) {\n parts.push(\"resolved.\" + field + \" = prefix[this.\" + field + \".offset];\");\n }\n else {\n this.resolved[field] = value;\n }\n };\n InsertNode.prototype.output = function (change, binds, commits) {\n binds.push(change);\n };\n InsertNode.prototype.exec = function (context, input, prefix, transactionId, round, binds, commits) {\n var resolved = this.resolve(prefix);\n var e = resolved.e, a = resolved.a, v = resolved.v, n = resolved.n;\n if (e === undefined || a === undefined || v === undefined || n === undefined) {\n throw new Error(\"Unable to produce an output with an undefined EAVN field [\" + e + \", \" + a + \", \" + v + \", \" + n + \"]\");\n }\n var prefixRound = prefix[prefix.length - 2];\n var prefixCount = prefix[prefix.length - 1];\n var change = new Change(e, a, v, n, transactionId, prefixRound + 1, prefixCount * this.multiplier);\n this.output(change, binds, commits);\n return true;\n };\n return InsertNode;\n}());\nexports.InsertNode = InsertNode;\nvar CommitInsertNode = (function (_super) {\n __extends(CommitInsertNode, _super);\n function CommitInsertNode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CommitInsertNode.prototype.toString = function () {\n return \"CommitInsertNode(\" + printField(this.e) + \", \" + printField(this.a) + \", \" + printField(this.v) + \", \" + printField(this.n) + \")\";\n };\n CommitInsertNode.prototype.output = function (change, binds, commits) {\n commits.push(change);\n };\n return CommitInsertNode;\n}(InsertNode));\nexports.CommitInsertNode = CommitInsertNode;\nvar RemoveNode = (function (_super) {\n __extends(RemoveNode, _super);\n function RemoveNode() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.multiplier = -1;\n return _this;\n }\n RemoveNode.prototype.toString = function () {\n return \"RemoveNode(\" + printField(this.e) + \", \" + printField(this.a) + \", \" + printField(this.v) + \", \" + printField(this.n) + \")\";\n };\n RemoveNode.prototype.exec = function (context, input, prefix, transactionId, round, binds, commits) {\n var resolved = this.resolve(prefix);\n var e = resolved.e, a = resolved.a, v = resolved.v, n = resolved.n;\n if (e === undefined || a === undefined || (v === undefined && this.v !== exports.IGNORE_REG) || n === undefined) {\n return false;\n }\n var prefixRound = prefix[prefix.length - 2];\n var prefixCount = prefix[prefix.length - 1];\n if (this.v !== exports.IGNORE_REG) {\n var change = new RemoveChange(e, a, v, n, transactionId, prefixRound + 1, prefixCount * this.multiplier);\n this.output(change, binds, commits);\n }\n else if (this.a !== exports.IGNORE_REG) {\n var change = new RemoveVsChange(e, a, v, n, transactionId, prefixRound + 1, prefixCount * this.multiplier);\n this.output(change, binds, commits);\n }\n else {\n var change = new RemoveAVsChange(e, a, v, n, transactionId, prefixRound + 1, prefixCount * this.multiplier);\n this.output(change, binds, commits);\n }\n return true;\n };\n return RemoveNode;\n}(InsertNode));\nexports.RemoveNode = RemoveNode;\nvar CommitRemoveNode = (function (_super) {\n __extends(CommitRemoveNode, _super);\n function CommitRemoveNode() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.multiplier = -1;\n _this._exec = RemoveNode.prototype.exec;\n return _this;\n }\n CommitRemoveNode.prototype.toString = function () {\n return \"CommitRemoveNode(\" + printField(this.e) + \", \" + printField(this.a) + \", \" + printField(this.v) + \", \" + printField(this.n) + \")\";\n };\n CommitRemoveNode.prototype.exec = function (context, input, prefix, transactionId, round, binds, commits) {\n return this._exec(context, input, prefix, transactionId, round, binds, commits);\n };\n return CommitRemoveNode;\n}(CommitInsertNode));\nexports.CommitRemoveNode = CommitRemoveNode;\n//------------------------------------------------------------------------------\n// LinearFlow\n//------------------------------------------------------------------------------\nvar LinearFlow = (function (_super) {\n __extends(LinearFlow, _super);\n function LinearFlow(nodes) {\n var _this = _super.call(this) || this;\n _this.nodes = nodes;\n _this.traceType = trace_1.TraceNode.LinearFlow;\n _this.results = new Iterator();\n _this.initialResults = new Iterator();\n return _this;\n }\n LinearFlow.prototype.toString = function () {\n var content = this.nodes.map(toString).join(\",\\n\");\n return \"LinearFlow([\\n \" + indent(content, 2) + \"\\n])\";\n };\n LinearFlow.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n this.initialResults.clear();\n this.initialResults.push(prefix);\n // We populate the prefix with values from the input change so we only derive the\n // results affected by it.\n var curPrefix;\n var iter = this.initialResults;\n for (var _i = 0, _a = this.nodes; _i < _a.length; _i++) {\n var node = _a[_i];\n if (iter.length === 0)\n return false;\n node.results.clear();\n while (curPrefix = iter.next()) {\n context.tracer.node(node, curPrefix);\n var valid = node.exec(context, input, curPrefix, transaction, round, node.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n }\n iter = node.results.iter();\n }\n while (curPrefix = iter.next()) {\n results.push(curPrefix);\n }\n return true;\n };\n return LinearFlow;\n}(Node));\nexports.LinearFlow = LinearFlow;\nvar IntermediateIndexIterator = (function () {\n function IntermediateIndexIterator() {\n this.valueIx = 0;\n this.countIx = 0;\n this.round = 0;\n this.count = 0;\n this.minRound = 0;\n }\n IntermediateIndexIterator.prototype.reset = function (values, minRound) {\n if (minRound === void 0) { minRound = 0; }\n this.values = values;\n this.valueIx = 0;\n this.countIx = 0;\n this.round = 0;\n this.count = 0;\n this.minRound = minRound + 1;\n this.valueKeys = Object.keys(values);\n this.currentCounts = values[this.valueKeys[0]];\n return this;\n };\n IntermediateIndexIterator.prototype.next = function () {\n var _a = this, currentCounts = _a.currentCounts, countIx = _a.countIx, minRound = _a.minRound;\n if (!currentCounts)\n return;\n countIx++;\n if (countIx >= currentCounts.length) {\n this.valueIx++;\n var nextValue = this.valueKeys[this.valueIx];\n currentCounts = this.currentCounts = this.values[nextValue];\n if (!currentCounts)\n return;\n countIx = 1;\n }\n var count = 0;\n if (countIx < minRound) {\n var total = 0;\n for (; countIx <= minRound; countIx++) {\n var cur = currentCounts[countIx];\n if (!cur)\n continue;\n total += cur;\n }\n count = total;\n countIx = minRound;\n }\n else {\n for (; countIx < currentCounts.length; countIx++) {\n var cur = currentCounts[countIx];\n if (cur) {\n count = cur;\n break;\n }\n }\n }\n this.round = countIx - 1;\n this.count = count;\n this.countIx = countIx;\n if (count == 0)\n return this.next();\n return currentCounts[0];\n };\n return IntermediateIndexIterator;\n}());\nexports.IntermediateIndexIterator = IntermediateIndexIterator;\nvar IntermediateIndex = (function () {\n function IntermediateIndex() {\n this.index = {};\n this.iterator = new IntermediateIndexIterator();\n }\n IntermediateIndex.CreateKeyFunction = function (registers) {\n var items = registers.map(function (reg) {\n return \"prefix[\" + reg.offset + \"]\";\n });\n var code = \"\\n return \\\"\\\" \" + (items.length ? \"+\" : \"\") + \" \" + items.join(' + \"|\" + ') + \";\\n \";\n return new Function(\"prefix\", code);\n };\n IntermediateIndex.prototype.insert = function (key, prefix) {\n var values = this.index[key];\n if (!values)\n values = this.index[key] = createHash(\"intermediateIndexValues\");\n var valueKey = this.hashPrefix(prefix);\n var counts = values[valueKey];\n if (!counts) {\n counts = values[valueKey] = createArray(\"intermediateIndexCounts\");\n counts[0] = prefix;\n }\n var round = prefix[prefix.length - 2] + 1;\n var count = prefix[prefix.length - 1];\n counts[round] = count + (counts[round] || 0);\n if (!counts[round]) {\n var shouldRemove = true;\n for (var ix = 1, len = counts.length; ix < len; ix++) {\n if (counts[ix]) {\n shouldRemove = false;\n break;\n }\n }\n if (shouldRemove) {\n delete values[valueKey];\n }\n }\n };\n IntermediateIndex.prototype.iter = function (key, round) {\n var values = this.index[key];\n if (values)\n return this.iterator.reset(values, round);\n };\n IntermediateIndex.prototype.hashPrefix = function (prefix) {\n var round = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n prefix[prefix.length - 2] = undefined;\n prefix[prefix.length - 1] = undefined;\n var key = prefix.join(\"|\");\n prefix[prefix.length - 2] = round;\n prefix[prefix.length - 1] = count;\n return key;\n };\n return IntermediateIndex;\n}());\nexports.IntermediateIndex = IntermediateIndex;\nvar ZeroingIterator = (function () {\n function ZeroingIterator() {\n this.roundIx = -1;\n this.countSum = 0;\n this.minRound = 0;\n this.count = 1;\n }\n ZeroingIterator.prototype.reset = function (counts, minRound) {\n if (minRound === void 0) { minRound = 0; }\n this.counts = counts;\n this.minRound = minRound;\n this.roundIx = -1;\n this.countSum = 0;\n this.count = 1;\n return this;\n };\n ZeroingIterator.prototype.next = function () {\n var _a = this, roundIx = _a.roundIx, counts = _a.counts, countSum = _a.countSum, minRound = _a.minRound;\n var countsLength = counts.length;\n roundIx++;\n if (roundIx >= countsLength)\n return;\n var final;\n if (roundIx <= minRound) {\n if (minRound >= countsLength)\n countsLength = minRound + 1;\n for (; roundIx < countsLength; roundIx++) {\n var cur = counts[roundIx];\n if (cur) {\n countSum += cur;\n }\n if (roundIx >= minRound && countSum === 0) {\n final = roundIx;\n break;\n }\n }\n }\n else {\n for (; roundIx <= countsLength; roundIx++) {\n var cur = counts[roundIx];\n if (!cur)\n continue;\n countSum += cur;\n if ((this.countSum === 0 && countSum > 0) ||\n (this.countSum > 0 && countSum === 0)) {\n final = roundIx;\n break;\n }\n }\n }\n this.roundIx = roundIx;\n this.countSum = countSum;\n this.count = 1;\n if (countSum !== 0) {\n this.count = -1;\n }\n return final;\n };\n return ZeroingIterator;\n}());\nexports.ZeroingIterator = ZeroingIterator;\nvar KeyOnlyIntermediateIndex = (function () {\n function KeyOnlyIntermediateIndex() {\n this.index = {};\n this.iterator = new ZeroingIterator();\n }\n KeyOnlyIntermediateIndex.prototype.insert = function (key, prefix) {\n var counts = this.index[key];\n if (!counts)\n counts = this.index[key] = createArray(\"KeyOnlyIntermediateIndex\");\n var round = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n var prev = counts[round] || 0;\n counts[round] = count + prev;\n if (!counts[round]) {\n var shouldRemove = true;\n for (var ix = 0, len = counts.length; ix < len; ix++) {\n if (counts[ix]) {\n shouldRemove = false;\n break;\n }\n }\n if (shouldRemove) {\n delete this.index[key];\n }\n }\n };\n KeyOnlyIntermediateIndex.prototype.has = function (key) {\n return this.index[key] ? true : false;\n };\n KeyOnlyIntermediateIndex.prototype.iter = function (key, round) {\n var values = this.index[key];\n if (values)\n return this.iterator.reset(values, round);\n };\n return KeyOnlyIntermediateIndex;\n}());\nexports.KeyOnlyIntermediateIndex = KeyOnlyIntermediateIndex;\nvar BinaryFlow = (function (_super) {\n __extends(BinaryFlow, _super);\n function BinaryFlow(left, right) {\n var _this = _super.call(this) || this;\n _this.left = left;\n _this.right = right;\n _this.traceType = trace_1.TraceNode.BinaryJoin;\n return _this;\n }\n BinaryFlow.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var _a = this, left = _a.left, right = _a.right;\n left.results.clear();\n context.tracer.node(left, prefix);\n left.exec(context, input, prefix, transaction, round, left.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n right.results.clear();\n context.tracer.node(right, prefix);\n right.exec(context, input, prefix, transaction, round, right.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n var result;\n var leftResults = left.results.iter();\n var rightResults = right.results.iter();\n while ((result = leftResults.next()) !== undefined) {\n this.onLeft(context, result, transaction, round, results);\n }\n while ((result = rightResults.next()) !== undefined) {\n this.onRight(context, result, transaction, round, results);\n }\n return true;\n };\n return BinaryFlow;\n}(Node));\nexports.BinaryFlow = BinaryFlow;\nvar BinaryJoinRight = (function (_super) {\n __extends(BinaryJoinRight, _super);\n function BinaryJoinRight(left, right, keyRegisters, registersToMerge) {\n var _this = _super.call(this, left, right) || this;\n _this.left = left;\n _this.right = right;\n _this.keyRegisters = keyRegisters;\n _this.registersToMerge = registersToMerge;\n _this.leftIndex = new IntermediateIndex();\n _this.rightIndex = new IntermediateIndex();\n _this._nodeName = \"BinaryJoinRight\";\n _this.keyFunc = IntermediateIndex.CreateKeyFunction(keyRegisters);\n return _this;\n }\n BinaryJoinRight.prototype.toString = function () {\n var keys = \"[\" + this.keyRegisters.map(function (r) { return \"[\" + r.offset + \"]\"; }).join(\", \") + \"]\";\n var merge = \"[\" + this.registersToMerge.map(function (r) { return \"[\" + r.offset + \"]\"; }).join(\", \") + \"]\";\n return this._nodeName + \"({\\n keys: \" + keys + \",\\n merge: \" + merge + \",\\n left: \" + indent(toString(this.left), 2) + \",\\n right: \" + indent(toString(this.right), 2) + \"\\n})\";\n };\n BinaryJoinRight.prototype.toBranchString = function () {\n var keys = \"[\" + this.keyRegisters.map(function (r) { return \"[\" + r.offset + \"]\"; }).join(\", \") + \"]\";\n var merge = \"[\" + this.registersToMerge.map(function (r) { return \"[\" + r.offset + \"]\"; }).join(\", \") + \"]\";\n return this._nodeName + \"({\\n keys: \" + keys + \",\\n merge: \" + merge + \",\\n right: \" + indent(toString(this.right), 2) + \"\\n})\";\n };\n BinaryJoinRight.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n // debug(\" Binary Join Right:\")\n var _a = this, left = _a.left, right = _a.right;\n right.results.clear();\n context.tracer.node(right, prefix);\n right.exec(context, input, prefix, transaction, round, right.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n var leftResults = left.results.iter();\n var rightResults = right.results.iter();\n var result;\n while ((result = leftResults.next()) !== undefined) {\n this.onLeft(context, result, transaction, round, results);\n }\n while ((result = rightResults.next()) !== undefined) {\n this.onRight(context, result, transaction, round, results);\n }\n // debug(\" results:\", results.array.slice());\n return true;\n };\n BinaryJoinRight.prototype.merge = function (left, right) {\n for (var _i = 0, _a = this.registersToMerge; _i < _a.length; _i++) {\n var register = _a[_i];\n var leftValue = left[register.offset];\n var rightValue = right[register.offset];\n if (leftValue === undefined || leftValue === rightValue) {\n left[register.offset] = rightValue;\n }\n else {\n return false;\n }\n }\n return true;\n };\n BinaryJoinRight.prototype.onLeft = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n this.leftIndex.insert(key, prefix);\n var diffs = this.rightIndex.iter(key, round);\n // debug(\" join left\", key, printPrefix(prefix), diffs);\n if (!diffs)\n return;\n var rightPrefix;\n while (rightPrefix = diffs.next()) {\n var result = copyArray(prefix, \"BinaryJoinResult\");\n if (this.merge(result, rightPrefix)) {\n result[result.length - 2] = Math.max(prefixRound, diffs.round);\n result[result.length - 1] = count * diffs.count;\n context.tracer.capturePrefix(result);\n results.push(result);\n // debug(\" join left -> \", printPrefix(result), diffs.round, count, diffs.count);\n }\n }\n };\n BinaryJoinRight.prototype.onRight = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n this.rightIndex.insert(key, prefix);\n var diffs = this.leftIndex.iter(key, round);\n // debug(\" join right\", key, this.rightIndex.index[key]);\n if (!diffs)\n return;\n var leftPrefix;\n while (leftPrefix = diffs.next()) {\n var result = copyArray(leftPrefix, \"BinaryJoinResult\");\n if (this.merge(result, prefix)) {\n result[result.length - 2] = Math.max(prefixRound, diffs.round);\n result[result.length - 1] = count * diffs.count;\n context.tracer.capturePrefix(result);\n results.push(result);\n // debug(\" join right -> \", printPrefix(result.slice()), diffs.round, count, diffs.count);\n }\n }\n };\n return BinaryJoinRight;\n}(BinaryFlow));\nexports.BinaryJoinRight = BinaryJoinRight;\nvar AntiJoin = (function (_super) {\n __extends(AntiJoin, _super);\n function AntiJoin(left, right, keyRegisters) {\n var _this = _super.call(this, left, right) || this;\n _this.left = left;\n _this.right = right;\n _this.keyRegisters = keyRegisters;\n _this.traceType = trace_1.TraceNode.AntiJoin;\n _this.leftIndex = new IntermediateIndex();\n _this.rightIndex = new KeyOnlyIntermediateIndex();\n _this.distinct = new indexes_1.DistinctIndex();\n _this.keyFunc = IntermediateIndex.CreateKeyFunction(keyRegisters);\n return _this;\n }\n AntiJoin.prototype.toString = function () {\n var left = indent(toString(this.left), 2);\n var right = indent(toString(this.right), 2);\n return \"Antijoin({\\n left: \" + left + \",\\n right: \" + right + \"\\n})\";\n };\n AntiJoin.prototype.toBranchString = function () {\n var right = indent(toString(this.right), 2);\n return \"Antijoin({\\n right: \" + right + \"\\n})\";\n };\n AntiJoin.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n // debug(\" antijoin:\")\n return _super.prototype.exec.call(this, context, input, prefix, transaction, round, results, changes);\n };\n AntiJoin.prototype.onLeft = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n this.leftIndex.insert(key, prefix);\n var diffs = this.rightIndex.iter(key, prefixRound);\n // debug(\" left:\", key, count, this.rightIndex.index[key] && copyArray(this.rightIndex.index[key]), prefix);\n if (!diffs) {\n // debug(\" left ->\", key, count, diffs)\n return results.push(prefix);\n }\n else {\n var currentRound = void 0;\n while ((currentRound = diffs.next()) !== undefined) {\n var result = copyArray(prefix, \"AntiJoinResult\");\n result[result.length - 2] = currentRound;\n result[result.length - 1] = diffs.count * count;\n context.tracer.capturePrefix(result);\n results.push(result);\n // debug(\" left ->\", key, count, currentRound, result[result.length - 1])\n }\n }\n };\n AntiJoin.prototype.onRight = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n this.rightIndex.insert(key, prefix);\n var neue = new Iterator();\n this.distinct.distinctKey(key, prefixRound, count, neue);\n var diffs = this.leftIndex.iter(key, prefixRound);\n var copy = function (thing) {\n var neue = copyHash(thing);\n for (var key_1 in thing) {\n neue[key_1] = thing[key_1].slice();\n }\n return neue;\n };\n // debug(\" right:\", key, count, this.leftIndex.index[key] && copy(this.leftIndex.index[key]));\n // debug(\" right distinct: \", this.distinct.index[key], neue);\n if (!diffs || !neue.length)\n return;\n var leftPrefix;\n var rightDelta;\n while (rightDelta = neue.next()) {\n var rightRound = rightDelta[0], rightCount = rightDelta[1];\n diffs = this.leftIndex.iter(key, prefixRound); // We already checked for this above.\n while (leftPrefix = diffs.next()) {\n var result = copyArray(leftPrefix, \"AntiJoinResult\");\n var maxRound = Math.max(diffs.round, rightRound);\n result[result.length - 2] = maxRound;\n result[result.length - 1] = rightCount * diffs.count * -1;\n context.tracer.capturePrefix(result);\n results.push(result);\n // debug(\" right ->\", key, maxRound, rightCount, diffs.count, result[result.length - 1])\n }\n }\n };\n return AntiJoin;\n}(BinaryFlow));\nexports.AntiJoin = AntiJoin;\nvar AntiJoinPresolvedRight = (function (_super) {\n __extends(AntiJoinPresolvedRight, _super);\n function AntiJoinPresolvedRight() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.traceType = trace_1.TraceNode.AntiJoinPresolvedRight;\n return _this;\n }\n AntiJoinPresolvedRight.prototype.toString = function () {\n return \"AntiJoinPresolvedRight(\" + toString(this.left) + \")\";\n };\n AntiJoinPresolvedRight.prototype.toBranchString = function () {\n return \"AntiJoinPresolvedRight(\" + this.left.toBranchString() + \")\";\n };\n AntiJoinPresolvedRight.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var _a = this, left = _a.left, right = _a.right;\n left.results.clear();\n context.tracer.node(left, prefix);\n left.exec(context, input, prefix, transaction, round, left.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n var leftResults = left.results.iter();\n var rightResults = right.results.iter();\n var result;\n while ((result = leftResults.next()) !== undefined) {\n this.onLeft(context, result, transaction, round, results);\n }\n while ((result = rightResults.next()) !== undefined) {\n this.onRight(context, result, transaction, round, results);\n }\n return true;\n };\n return AntiJoinPresolvedRight;\n}(AntiJoin));\nexports.AntiJoinPresolvedRight = AntiJoinPresolvedRight;\nvar UnionFlow = (function (_super) {\n __extends(UnionFlow, _super);\n function UnionFlow(left, branches, keyRegisters, registersToMerge, extraOuterJoins) {\n var _this = _super.call(this) || this;\n _this.left = left;\n _this.keyRegisters = keyRegisters;\n _this.registersToMerge = registersToMerge;\n _this.extraOuterJoins = extraOuterJoins;\n _this.traceType = trace_1.TraceNode.Union;\n _this.branches = [];\n _this.emptyResults = new Iterator();\n var ix = 0;\n for (var _i = 0, branches_1 = branches; _i < branches_1.length; _i++) {\n var branch = branches_1[_i];\n _this.branches.push(new BinaryJoinRight(left, branch, keyRegisters[ix].concat(extraOuterJoins), registersToMerge));\n ix++;\n }\n return _this;\n }\n UnionFlow.prototype.toString = function () {\n var name;\n var branchText = this.branches.map(function (branch) { return indent(branch.toBranchString(), 4); }).join(\",\\n \");\n return \"UnionFlow({\\n left: \" + indent(toString(this.left), 2) + \",\\n branches: [\\n \" + branchText + \"\\n)}]\\n})\";\n };\n UnionFlow.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var left = this.left;\n var tracer = context.tracer;\n var tempLeftResults = left.results;\n left.results.clear();\n tracer.node(left, prefix);\n left.exec(context, input, prefix, transaction, round, left.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n var leftPrefix;\n var leftResults = left.results.iter();\n for (var _i = 0, _a = this.branches; _i < _a.length; _i++) {\n var node = _a[_i];\n node.results.clear();\n tracer.node(node, prefix);\n node.exec(context, input, prefix, transaction, round, node.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n // Because we've already run this node once, we don't want it to potentially see the left's\n // results multiple times. As such, we temporarily set the results to an empty iterator\n // so that downstream nodes see nothing and we set it back once we've gone through\n // all the left prefixes.\n left.results = this.emptyResults;\n leftResults.reset();\n if (node.keyRegisters.length && input !== BLOCK_ADD && input !== BLOCK_REMOVE) {\n while ((leftPrefix = leftResults.next()) !== undefined) {\n tracer.node(node, leftPrefix);\n node.exec(context, input, copyArray(leftPrefix, \"UnionLeftPrefixCopy\"), transaction, round, node.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n }\n }\n // set the left results back to the real results\n left.results = tempLeftResults;\n var branchResults = node.results.iter();\n var result = void 0;\n while ((result = branchResults.next())) {\n results.push(result);\n }\n }\n return true;\n };\n return UnionFlow;\n}(Node));\nexports.UnionFlow = UnionFlow;\nvar ChooseFlow = (function (_super) {\n __extends(ChooseFlow, _super);\n function ChooseFlow(left, initialBranches, keyRegisters, registersToMerge, extraOuterJoins) {\n var _this = _super.call(this) || this;\n _this.left = left;\n _this.keyRegisters = keyRegisters;\n _this.registersToMerge = registersToMerge;\n _this.extraOuterJoins = extraOuterJoins;\n _this.traceType = trace_1.TraceNode.Choose;\n _this.leftResults = new Iterator();\n _this.emptyResults = new Iterator();\n _this.branches = [];\n var allKeys = [];\n for (var _i = 0, keyRegisters_1 = keyRegisters; _i < keyRegisters_1.length; _i++) {\n var keySet = keyRegisters_1[_i];\n var _loop_1 = function (key) {\n if (!allKeys.some(function (r) { return r.offset === key.offset; })) {\n allKeys.push(key);\n }\n };\n for (var _a = 0, keySet_1 = keySet; _a < keySet_1.length; _a++) {\n var key = keySet_1[_a];\n _loop_1(key);\n }\n }\n var branches = _this.branches;\n var prev;\n var ix = 0;\n for (var _b = 0, initialBranches_1 = initialBranches; _b < initialBranches_1.length; _b++) {\n var branch = initialBranches_1[_b];\n var myKeys = keyRegisters[ix].concat(extraOuterJoins);\n var join = void 0;\n if (prev) {\n join = new BinaryJoinRight(left, branch, myKeys, registersToMerge);\n var antijoin = new AntiJoinPresolvedRight(join, _this, allKeys);\n branches.push(antijoin);\n }\n else {\n join = new BinaryJoinRight(left, branch, myKeys, registersToMerge);\n branches.push(join);\n }\n prev = join;\n ix++;\n }\n return _this;\n }\n ChooseFlow.prototype.toString = function () {\n var name;\n var branchText = this.branches.map(function (branch) { return indent(branch.toBranchString(), 4); }).join(\",\\n \");\n return \"ChooseFlow({\\n left: \" + indent(toString(this.left), 2) + \",\\n branches: [\\n \" + branchText + \"\\n)}]\\n})\";\n };\n ChooseFlow.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var tracer = context.tracer;\n var _a = this, branches = _a.branches, left = _a.left;\n var prev;\n var ix = 0;\n var tempResults = this.results;\n var tempLeftResults = left.results;\n left.results.clear();\n tracer.node(left, prefix);\n left.exec(context, input, prefix, transaction, round, left.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n var leftResults = left.results.iter();\n var leftPrefix;\n for (var _i = 0, branches_2 = branches; _i < branches_2.length; _i++) {\n var node = branches_2[_i];\n node.results.clear();\n tracer.node(node, prefix);\n node.exec(context, input, prefix, transaction, round, node.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n // Because we've already run this node once, we don't want it to potentially see our\n // results multiple times. As such, we temporarily set our results to an empty iterator\n // so that downstream nodes see nothing and we set it back once we've gone through\n // all the left prefixes. This ensures that AntiJoinPresolvedRight only sees the previous\n // branches' results once. We also need to do this for our left's results, since we'll have\n // seen those as well and would otherwise double count them.\n this.results = this.emptyResults;\n left.results = this.emptyResults;\n leftResults.reset();\n if (node.keyRegisters.length && input !== BLOCK_ADD && input !== BLOCK_REMOVE) {\n while ((leftPrefix = leftResults.next()) !== undefined) {\n tracer.node(node, leftPrefix);\n node.exec(context, input, copyArray(leftPrefix, \"ChooseLeftPrefixCopy\"), transaction, round, node.results, changes);\n tracer.pop(trace_1.TraceFrameType.Node);\n }\n }\n // per above, make sure we set our results back to the real iterator\n this.results = tempResults;\n left.results = tempLeftResults;\n var branchResult = node.results.iter();\n var result = void 0;\n while ((result = branchResult.next()) !== undefined) {\n tracer.capturePrefix(result);\n results.push(result);\n }\n }\n return true;\n };\n return ChooseFlow;\n}(Node));\nexports.ChooseFlow = ChooseFlow;\nvar MergeAggregateFlow = (function (_super) {\n __extends(MergeAggregateFlow, _super);\n function MergeAggregateFlow() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._nodeName = \"MergeAggregateFlow\";\n return _this;\n }\n MergeAggregateFlow.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n // debug(\" AGG MERGE\");\n var result;\n var _a = this, left = _a.left, right = _a.right;\n left.results.clear();\n left.exec(context, input, prefix, transaction, round, left.results, changes);\n // debug(\" left results: \", leftResults);\n var leftResults = left.results.iter();\n // we run the left's results through the aggregate to capture all the aggregate updates\n right.results.clear();\n while ((result = leftResults.next()) !== undefined) {\n // debug(\" left result: \", result.slice());\n right.exec(context, input, result, transaction, round, right.results, changes);\n }\n // now we go through all the lefts and rights like normal\n leftResults.reset();\n while ((result = leftResults.next()) !== undefined) {\n this.onLeft(context, result, transaction, round, results);\n }\n var rightResults = right.results.iter();\n while ((result = rightResults.next()) !== undefined) {\n this.onRight(context, result, transaction, round, results);\n }\n return true;\n };\n return MergeAggregateFlow;\n}(BinaryJoinRight));\nexports.MergeAggregateFlow = MergeAggregateFlow;\n// This node is a bit strange, but is required to make sure that aggregates\n// that are inside of a choose don't end up seeing results that wouldn't actually\n// join with the outer scope of the choose. For example if we have the following rule:\n//\n// prog.block(\"count the names of people\", ({find, gather, record, choose}) => {\n// let person = find(\"person\");\n// let [sort] = choose(() => {\n// return gather(person.name).count();\n// }, () => \"yo yo yo\");\n// return [person.add(\"next\", sort)];\n// });\n//\n// If we join the choose branch to the outer *after* we've aggregated, then we're\n// going to count everything with a name whether they're a person or not. Instead\n// we need to make sure there is a join with the outer scope before it makes it to\n// the choose. To do that, the AggregateOuterLookup node just keeps track of every\n// value it has seen from the outer and makes sure that each right has a join with\n// it.\nvar AggregateOuterLookup = (function (_super) {\n __extends(AggregateOuterLookup, _super);\n function AggregateOuterLookup(left, right, keyRegisters) {\n var _this = _super.call(this, left, right) || this;\n _this.left = left;\n _this.right = right;\n _this.keyRegisters = keyRegisters;\n _this._nodeName = \"AggregateOuterLookup\";\n _this.traceType = trace_1.TraceNode.AggregateOuterLookup;\n _this.leftIndex = new KeyOnlyIntermediateIndex();\n _this.rightIndex = new IntermediateIndex();\n _this.keyFunc = IntermediateIndex.CreateKeyFunction(keyRegisters);\n return _this;\n }\n AggregateOuterLookup.prototype.toString = function () {\n var keys = \"[\" + this.keyRegisters.map(function (r) { return \"[\" + r.offset + \"]\"; }).join(\", \") + \"]\";\n //${indent(this.left.toString(), 2)},\n return \"AggregateOuterLookup({\\n keys: \" + keys + \",\\n left: '*snip*',\\n right: \" + indent(this.right.toString(), 2) + \"\\n})\";\n };\n AggregateOuterLookup.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var _a = this, left = _a.left, right = _a.right;\n right.results.clear();\n context.tracer.node(right, prefix);\n right.exec(context, input, prefix, transaction, round, right.results, changes);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n var result;\n var leftResults = left.results.iter();\n while ((result = leftResults.next()) !== undefined) {\n this.onLeft(context, result, transaction, round, results);\n }\n var rightResults = right.results.iter();\n while ((result = rightResults.next()) !== undefined) {\n this.onRight(context, result, transaction, round, results);\n }\n return true;\n };\n AggregateOuterLookup.prototype.onLeft = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n var exists = this.leftIndex.has(key);\n this.leftIndex.insert(key, prefix);\n var afterExists = this.leftIndex.has(key);\n var diffs = this.rightIndex.iter(key, 0);\n if (exists && afterExists || !diffs)\n return;\n var multiplier = 1;\n if (exists && !afterExists) {\n // remove\n multiplier = -1;\n }\n var rightPrefix;\n while (rightPrefix = diffs.next()) {\n var result = copyArray(rightPrefix, \"aggregateLookupResult\");\n result[result.length - 2] = diffs.round;\n result[result.length - 1] = diffs.count * multiplier;\n context.tracer.capturePrefix(result);\n results.push(result);\n }\n };\n AggregateOuterLookup.prototype.onRight = function (context, prefix, transaction, round, results) {\n var key = this.keyFunc(prefix);\n this.rightIndex.insert(key, prefix);\n if (this.leftIndex.has(key)) {\n results.push(prefix);\n }\n };\n return AggregateOuterLookup;\n}(BinaryFlow));\nexports.AggregateOuterLookup = AggregateOuterLookup;\nvar AggregateNode = (function (_super) {\n __extends(AggregateNode, _super);\n // @TODO: allow for multiple returns\n function AggregateNode(groupRegisters, projectRegisters, inputs, resultRegisters) {\n var _this = _super.call(this) || this;\n _this.groupRegisters = groupRegisters;\n _this.projectRegisters = projectRegisters;\n _this.inputs = inputs;\n _this.resultRegisters = resultRegisters;\n _this.traceType = trace_1.TraceNode.Aggregate;\n _this.groups = {};\n _this.resolved = [];\n _this.registerLookup = [];\n _this.groupKey = IntermediateIndex.CreateKeyFunction(groupRegisters);\n _this.projectKey = IntermediateIndex.CreateKeyFunction(projectRegisters);\n for (var _i = 0, groupRegisters_1 = groupRegisters; _i < groupRegisters_1.length; _i++) {\n var reg = groupRegisters_1[_i];\n _this.registerLookup[reg.offset] = true;\n }\n for (var _a = 0, resultRegisters_1 = resultRegisters; _a < resultRegisters_1.length; _a++) {\n var reg = resultRegisters_1[_a];\n _this.registerLookup[reg.offset] = true;\n }\n return _this;\n }\n AggregateNode.prototype.toString = function () {\n var groups = printFieldArray(this.groupRegisters);\n var projects = printFieldArray(this.projectRegisters);\n var inputs = printFieldArray(this.inputs);\n var results = printFieldArray(this.resultRegisters);\n return \"AggregateNode(\" + this.name + \", \" + groups + \", \" + projects + \", \" + inputs + \", \" + results + \")\";\n };\n AggregateNode.prototype.groupPrefix = function (group, prefix) {\n var projection = this.projectKey(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var prefixCount = prefix[prefix.length - 1];\n var delta = 0;\n var found = this.groups[group];\n if (!found) {\n found = this.groups[group] = { result: [] };\n }\n var counts = found[projection] || [];\n var totalCount = 0;\n var countIx = 0;\n for (var _i = 0, counts_1 = counts; _i < counts_1.length; _i++) {\n var count = counts_1[_i];\n // we need the total up to our current round\n if (countIx > prefixRound)\n break;\n countIx++;\n if (!count)\n continue;\n totalCount += count;\n }\n if (totalCount && totalCount + prefixCount <= 0) {\n // subtract\n delta = -1;\n }\n else if (totalCount === 0 && totalCount + prefixCount > 0) {\n // add\n delta = 1;\n }\n else if (totalCount + prefixCount < 0) {\n // we have removed more values than exist?\n throw new Error(\"Negative total count for an aggregate projection\");\n }\n else {\n // otherwise this change doesn't impact the projected count, we've just added\n // or removed a support.\n }\n counts[prefixRound] = (counts[prefixRound] || 0) + prefixCount;\n found[projection] = counts;\n return delta;\n };\n AggregateNode.prototype.getResultPrefix = function (prefix, result, count) {\n var neue = copyArray(prefix, \"aggregateResult\");\n neue[this.resultRegisters[0].offset] = result;\n neue[neue.length - 1] = count;\n var ix = 0;\n while (ix < neue.length - 2) {\n if (!this.registerLookup[ix]) {\n neue[ix] = undefined;\n }\n ix++;\n }\n return neue;\n };\n AggregateNode.prototype.resolve = function (prefix) {\n var resolved = this.resolved;\n var ix = 0;\n for (var _i = 0, _a = this.inputs; _i < _a.length; _i++) {\n var field = _a[_i];\n if (isRegister(field)) {\n resolved[ix] = exports.GlobalInterner.reverse(prefix[field.offset]);\n }\n else {\n resolved[ix] = exports.GlobalInterner.reverse(field);\n }\n ix++;\n }\n return resolved;\n };\n AggregateNode.prototype.stateToResult = function (state) {\n var current = this.getResult(state);\n return exports.GlobalInterner.intern(current);\n };\n AggregateNode.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var group = this.groupKey(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var delta = this.groupPrefix(group, prefix);\n var op = this.add;\n if (!delta)\n return false;\n if (delta < 0)\n op = this.remove;\n var groupStates = this.groups[group].result;\n var currentState = groupStates[prefixRound];\n if (!currentState) {\n // otherwise we have to find the most recent result that we've seen\n for (var ix = 0, len = Math.min(groupStates.length, prefixRound); ix < len; ix++) {\n var current = groupStates[ix];\n if (current === undefined)\n continue;\n currentState = copyHash(current, \"AggregateState\");\n }\n }\n var resolved = this.resolve(prefix);\n var start = prefixRound;\n groupStates[prefixRound] = currentState;\n if (!currentState) {\n currentState = groupStates[prefixRound] = op(this.newResultState(), resolved);\n var cur = this.getResultPrefix(prefix, this.stateToResult(currentState), 1);\n results.push(cur);\n start = prefixRound + 1;\n }\n for (var ix = start, len = Math.max(groupStates.length, prefixRound + 1); ix < len; ix++) {\n var current = groupStates[ix];\n if (current === undefined)\n continue;\n var prevResult = this.getResultPrefix(prefix, this.stateToResult(current), -1);\n current = groupStates[prefixRound] = op(current, resolved);\n var neueResult = this.getResultPrefix(prefix, this.stateToResult(current), 1);\n results.push(prevResult);\n results.push(neueResult);\n }\n return true;\n };\n return AggregateNode;\n}(Node));\nexports.AggregateNode = AggregateNode;\n//------------------------------------------------------------------------------\n// SortNode\n//------------------------------------------------------------------------------\nvar SortNode = (function (_super) {\n __extends(SortNode, _super);\n // @TODO: allow for multiple returns\n function SortNode(groupRegisters, projectRegisters, directions, resultRegisters) {\n var _this = _super.call(this) || this;\n _this.groupRegisters = groupRegisters;\n _this.projectRegisters = projectRegisters;\n _this.directions = directions;\n _this.resultRegisters = resultRegisters;\n _this.name = \"Sort\";\n _this.traceType = trace_1.TraceNode.Aggregate;\n _this.groups = {};\n _this.resolved = [];\n _this.resolvedDirections = [];\n _this.add = function (state, resolved, round, results) {\n var resultPrefix = _this.resultPrefix;\n var neue = copyArray(resolved, \"SortIntermediate\");\n var ix = 0;\n for (var _i = 0, _a = state.sorted; _i < _a.length; _i++) {\n var item = _a[_i];\n if (_this.isGreater(item, resolved)) {\n break;\n }\n ix++;\n }\n var outOffset = _this.resultRegisters[0].offset;\n state.sorted.splice(ix, 0, neue);\n results.push(resultPrefix(neue, outOffset, ix, round, 1));\n ix++;\n for (; ix < state.sorted.length; ix++) {\n var cur = state.sorted[ix];\n results.push(resultPrefix(cur, outOffset, ix - 1, round, -1));\n results.push(resultPrefix(cur, outOffset, ix, round, 1));\n }\n return state;\n };\n _this.remove = function (state, resolved, round, results) {\n var resultPrefix = _this.resultPrefix;\n var ix = 0;\n var found = false;\n for (var _i = 0, _a = state.sorted; _i < _a.length; _i++) {\n var item = _a[_i];\n if (_this.prefixEqual(item, resolved)) {\n break;\n }\n ix++;\n }\n state.sorted.splice(ix, 1);\n var outOffset = _this.resultRegisters[0].offset;\n results.push(resultPrefix(resolved, outOffset, ix, round, -1));\n for (; ix < state.sorted.length; ix++) {\n var cur = state.sorted[ix];\n results.push(resultPrefix(cur, outOffset, ix + 1, round, -1));\n results.push(resultPrefix(cur, outOffset, ix, round, 1));\n }\n return state;\n };\n _this.groupKey = IntermediateIndex.CreateKeyFunction(groupRegisters);\n _this.projectKey = IntermediateIndex.CreateKeyFunction(projectRegisters);\n _this.sortRegisters = groupRegisters.concat(projectRegisters).filter(isRegister);\n return _this;\n }\n SortNode.prototype.groupPrefix = function (group, prefix) {\n var projection = this.projectKey(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var prefixCount = prefix[prefix.length - 1];\n var delta = 0;\n var found = this.groups[group];\n if (!found) {\n found = this.groups[group] = { result: [] };\n }\n var counts = found[projection] || [];\n var totalCount = 0;\n var countIx = 0;\n for (var _i = 0, counts_2 = counts; _i < counts_2.length; _i++) {\n var count = counts_2[_i];\n // we need the total up to our current round\n if (countIx > prefixRound)\n break;\n countIx++;\n if (!count)\n continue;\n totalCount += count;\n }\n if (totalCount && totalCount + prefixCount <= 0) {\n // subtract\n delta = -1;\n }\n else if (totalCount === 0 && totalCount + prefixCount > 0) {\n // add\n delta = 1;\n }\n else if (totalCount + prefixCount < 0) {\n // we have removed more values than exist?\n throw new Error(\"Negative total count for an aggregate projection\");\n }\n else {\n // otherwise this change doesn't impact the projected count, we've just added\n // or removed a support.\n }\n counts[prefixRound] = (counts[prefixRound] || 0) + prefixCount;\n found[projection] = counts;\n return delta;\n };\n SortNode.prototype.resolve = function (prefix) {\n var _a = this, resolved = _a.resolved, resolvedDirections = _a.resolvedDirections;\n if (resolved.length < prefix.length)\n resolved.length = prefix.length;\n for (var _i = 0, _b = this.sortRegisters; _i < _b.length; _i++) {\n var field = _b[_i];\n if (isRegister(field)) {\n resolved[field.offset] = prefix[field.offset];\n }\n }\n var ix = 0;\n for (var _c = 0, _d = this.directions; _c < _d.length; _c++) {\n var field = _d[_c];\n if (isRegister(field)) {\n resolvedDirections[ix] = exports.GlobalInterner.reverse(prefix[field.offset]);\n }\n else {\n resolvedDirections[ix] = exports.GlobalInterner.reverse(field);\n }\n ix++;\n }\n return resolved;\n };\n SortNode.prototype.isGreater = function (a, b) {\n var resolvedDirections = this.resolvedDirections;\n var dirIx = 0;\n var dir = resolvedDirections[dirIx] || \"up\";\n for (var _i = 0, _a = this.projectRegisters; _i < _a.length; _i++) {\n var register = _a[_i];\n var offset = register.offset;\n var aV = exports.GlobalInterner.reverse(a[offset]);\n var bV = exports.GlobalInterner.reverse(b[offset]);\n if ((dir === \"up\" && aV > bV) ||\n (dir === \"down\" && aV < bV)) {\n return dir;\n }\n else if (aV !== bV) {\n return false;\n }\n dirIx++;\n dir = resolvedDirections[dirIx] || dir;\n }\n return false;\n };\n SortNode.prototype.prefixEqual = function (a, b) {\n var ix = -1;\n for (var _i = 0, a_2 = a; _i < a_2.length; _i++) {\n var field = a_2[_i];\n ix++;\n if (field !== b[ix]) {\n return false;\n }\n }\n return true;\n };\n SortNode.prototype.exec = function (context, input, prefix, transaction, round, results, changes) {\n var group = this.groupKey(prefix);\n var prefixRound = prefix[prefix.length - 2];\n var delta = this.groupPrefix(group, prefix);\n var op = this.add;\n if (!delta)\n return false;\n if (delta < 0)\n op = this.remove;\n var groupStates = this.groups[group].result;\n var currentState = groupStates[prefixRound];\n if (!currentState) {\n // otherwise we have to find the most recent result that we've seen\n for (var ix = 0, len = Math.min(groupStates.length, prefixRound); ix < len; ix++) {\n var current = groupStates[ix];\n if (current === undefined)\n continue;\n currentState = copyHash(current, \"SortState\");\n }\n }\n var resolved = this.resolve(prefix);\n var start = prefixRound;\n groupStates[prefixRound] = currentState;\n if (!currentState) {\n currentState = groupStates[prefixRound] = op(this.newResultState(), resolved, prefixRound, results);\n start = prefixRound + 1;\n }\n for (var ix = start, len = Math.max(groupStates.length, prefixRound + 1); ix < len; ix++) {\n var current = groupStates[ix];\n if (current === undefined)\n continue;\n current = groupStates[prefixRound] = op(current, resolved, ix, results);\n }\n return true;\n };\n SortNode.prototype.resultPrefix = function (prefix, outOffset, pos, round, count) {\n var item = copyArray(prefix, \"SortResult\");\n // add one here because we're one indexed\n item[outOffset] = exports.GlobalInterner.intern(pos + 1);\n item[item.length - 2] = round;\n item[item.length - 1] = count;\n return item;\n };\n SortNode.prototype.newResultState = function () {\n return { sorted: [], sortLookup: {} };\n };\n return SortNode;\n}(Node));\nexports.SortNode = SortNode;\n//------------------------------------------------------------------------------\n// Block\n//------------------------------------------------------------------------------\nvar Block = (function () {\n function Block(name, nodes, totalRegisters) {\n this.name = name;\n this.nodes = nodes;\n this.totalRegisters = totalRegisters;\n this.results = new Iterator();\n this.initial = createArray();\n for (var ix = 0; ix < this.totalRegisters + 2; ix++) {\n this.initial[ix] = undefined;\n }\n }\n Block.prototype.toString = function () {\n var content = this.nodes.map(toString).join(\",\\n\");\n return \"Block(\\\"\" + this.name + \"\\\", [\\n \" + indent(content, 2) + \"\\n])\";\n };\n Block.prototype.exec = function (context, input, transaction) {\n this.results.clear();\n this.results.push(this.initial.slice());\n var prefix;\n var iter = this.results;\n for (var _i = 0, _a = this.nodes; _i < _a.length; _i++) {\n var node = _a[_i];\n node.results.clear();\n if (iter.length === 0) {\n if (node instanceof AntiJoin) {\n node.exec(context, input, this.initial.slice(), transaction.transaction, transaction.round, node.results, transaction);\n iter = node.results.iter();\n }\n }\n else {\n while ((prefix = iter.next()) !== undefined) {\n context.tracer.node(node, prefix);\n node.exec(context, input, prefix, transaction.transaction, transaction.round, node.results, transaction);\n context.tracer.pop(trace_1.TraceFrameType.Node);\n }\n iter = node.results.iter();\n }\n }\n return true;\n };\n return Block;\n}());\nexports.Block = Block;\n//------------------------------------------------------------------------------\n// EvaluationContext\n//------------------------------------------------------------------------------\nvar EvaluationContext = (function () {\n function EvaluationContext(index) {\n this.index = index;\n this.distinctIndex = new indexes_1.DistinctIndex();\n this.intermediates = {};\n this.exportIndex = {};\n this.tracer = TRACE ? new trace_1.Tracer(this) : new trace_1.NoopTracer(this);\n }\n return EvaluationContext;\n}());\nexports.EvaluationContext = EvaluationContext;\nvar Transaction = (function () {\n function Transaction(context, transaction, blocks, exportHandler) {\n this.context = context;\n this.transaction = transaction;\n this.blocks = blocks;\n this.exportHandler = exportHandler;\n this.round = -1;\n this.changes = [];\n this.lastFrame = 0;\n this.outputs = new Iterator();\n this.roundChanges = [];\n this.frameCommits = [];\n this.framePartialCommits = [];\n this.exportedChanges = {};\n context.tracer.transaction(transaction);\n }\n Transaction.prototype.output = function (context, change) {\n // debug(\" E~\", change.toString(), context.tracker.activeBlock);\n var outputs = this.outputs;\n var distinctIndex = context.distinctIndex, tracer = context.tracer;\n tracer.maybeOutput(change);\n outputs.clear();\n distinctIndex.distinct(change, outputs);\n tracer.postDistinct();\n outputs.reset();\n var output;\n while (output = outputs.next()) {\n tracer.output(output);\n // debug(\" <-\", output.toString())\n var cur = this.roundChanges[output.round] || createArray(\"roundChangesArray\");\n cur.push(output);\n this.roundChanges[output.round] = cur;\n }\n tracer.pop(trace_1.TraceFrameType.MaybeOutput);\n };\n Transaction.prototype.commit = function (context, change) {\n context.tracer.commit(change);\n var outputs = this.outputs;\n if (change instanceof RemoveVsChange) {\n this.framePartialCommits.push(change);\n }\n else {\n this.frameCommits.push(change);\n }\n // debug(\" <-!\", change.toString())\n };\n Transaction.prototype.export = function (context, blockId, change) {\n if (!this.exportedChanges[blockId])\n this.exportedChanges[blockId] = [change];\n else\n this.exportedChanges[blockId].push(change);\n };\n Transaction.prototype.prepareRound = function (context, changeIx) {\n var _a = this, roundChanges = _a.roundChanges, changes = _a.changes;\n var next = changes[changeIx];\n var maxRound = roundChanges.length;\n var oldLength = changes.length;\n if (!next && this.round < maxRound) {\n for (var ix = this.round + 1; ix < maxRound; ix++) {\n var nextRoundChanges = roundChanges[ix];\n if (nextRoundChanges) {\n this.collapseMultiplicity(nextRoundChanges, changes);\n // If we've got new changes to go through, we're done\n if (oldLength < changes.length)\n return;\n }\n }\n }\n var _b = this, frameCommits = _b.frameCommits, framePartialCommits = _b.framePartialCommits;\n if (!next && (frameCommits.length || framePartialCommits.length)) {\n for (var _i = 0, framePartialCommits_1 = framePartialCommits; _i < framePartialCommits_1.length; _i++) {\n var commit = framePartialCommits_1[_i];\n commit.toRemoveChanges(context, frameCommits);\n }\n var collapsedCommits = [];\n this.collapseCommits(this.frameCommits, collapsedCommits);\n var collapsedChanges = [];\n this.collapseMultiplicity(collapsedCommits, collapsedChanges);\n if (collapsedChanges.length) {\n context.tracer.frame(collapsedChanges);\n this.lastFrame = this.changes.length;\n this.round = -1;\n this.roundChanges = [];\n this.frameCommits = [];\n this.framePartialCommits = [];\n for (var _c = 0, collapsedChanges_1 = collapsedChanges; _c < collapsedChanges_1.length; _c++) {\n var commit = collapsedChanges_1[_c];\n if (commit.count > 0)\n commit.count = Infinity;\n else if (commit.count < 0)\n commit.count = -Infinity;\n // debug(\" ->! \", commit.toString())\n this.output(context, commit);\n }\n this.prepareRound(context, changeIx);\n // debug(\" ---------------- NEW FRAME -------------------\")\n }\n }\n };\n Transaction.prototype.collapseCommits = function (changes, results /* output */) {\n // We sort the changes to group all the same EAVs together.\n changes.sort(function (a, b) {\n var nodeDiff = a.n - b.n;\n if (!nodeDiff) {\n var eDiff = a.e - b.e;\n if (!eDiff) {\n var aDiff = a.a - b.a;\n if (!aDiff) {\n var vDiff = a.v - b.v;\n return vDiff;\n }\n return aDiff;\n }\n return eDiff;\n }\n return nodeDiff;\n });\n var changeIx = 0;\n for (var changeIx_1 = 0; changeIx_1 < changes.length; changeIx_1++) {\n var current = changes[changeIx_1];\n var currentType = current instanceof RemoveChange ? true : false;\n if (currentType) {\n current = new RemoveChange(current.e, current.a, current.v, current.n, current.transaction, current.round, current.count);\n }\n else {\n current = new Change(current.e, current.a, current.v, current.n, current.transaction, current.round, current.count);\n }\n // Collapse each subsequent matching EAV's multiplicity into the current one's.\n while (changeIx_1 + 1 < changes.length) {\n var next = changes[changeIx_1 + 1];\n if (current.n === next.n && next.e == current.e && next.a == current.a && next.v == current.v) {\n current.count += next.count;\n changeIx_1++;\n }\n else {\n break;\n }\n }\n current.round = 0;\n if (currentType && current.count < 0) {\n results.push(current);\n }\n else if (!currentType && current.count > 0) {\n results.push(current);\n }\n }\n return results;\n };\n Transaction.prototype.collapseMultiplicity = function (changes, results /* output */, createNew) {\n if (createNew === void 0) { createNew = false; }\n // We sort the changes to group all the same EAVs together.\n changes.sort(function (a, b) {\n var eDiff = a.e - b.e;\n if (!eDiff) {\n var aDiff = a.a - b.a;\n if (!aDiff) {\n return a.v - b.v;\n }\n return aDiff;\n }\n return eDiff;\n });\n var changeIx = 0;\n for (var changeIx_2 = 0; changeIx_2 < changes.length; changeIx_2++) {\n var current = changes[changeIx_2];\n if (createNew) {\n current = new Change(current.e, current.a, current.v, current.n, current.transaction, current.round, current.count);\n }\n // Collapse each subsequent matching EAV's multiplicity into the current one's.\n while (changeIx_2 + 1 < changes.length) {\n var next = changes[changeIx_2 + 1];\n if (next.e == current.e && next.a == current.a && next.v == current.v) {\n current.count += next.count;\n changeIx_2++;\n }\n else {\n break;\n }\n }\n if (current.count !== 0)\n results.push(current);\n }\n return results;\n };\n Transaction.prototype.exec = function (context) {\n var _a = this, changes = _a.changes, roundChanges = _a.roundChanges;\n var index = context.index, tracer = context.tracer;\n tracer.frame([]);\n var total = 0;\n var frames = 0;\n var changeIx = 0;\n var iterationLimit = 10000;\n this.prepareRound(context, changeIx);\n while (changeIx < changes.length) {\n var change = changes[changeIx];\n tracer.input(change);\n total++;\n if (total > iterationLimit) {\n console.error(\"Error: Program failed to fixpoint after \" + iterationLimit + \" iterations. This is likely due to an unbounded cycle in the program.\");\n break;\n }\n if (this.round !== 0 && change.round === 0) {\n frames++;\n if (frames > 10) {\n console.error(\"Failed to terminate\");\n break;\n }\n }\n this.round = change.round;\n // debug(\"Round:\", this.round);\n // debug(\" <- \", change.toString())\n for (var _i = 0, _b = this.blocks; _i < _b.length; _i++) {\n var block = _b[_i];\n tracer.block(block.name);\n //debug(\" \", block.name);\n block.exec(context, change, this);\n tracer.pop(trace_1.TraceFrameType.Block);\n }\n // debug(\"\");\n index.insert(change);\n tracer.pop(trace_1.TraceFrameType.Input);\n changeIx++;\n this.prepareRound(context, changeIx);\n }\n var exportingBlocks = Object.keys(this.exportedChanges);\n if (exportingBlocks.length) {\n if (!this.exportHandler)\n throw new Error(\"Unable to export changes without export handler.\");\n for (var _c = 0, exportingBlocks_1 = exportingBlocks; _c < exportingBlocks_1.length; _c++) {\n var blockId = exportingBlocks_1[_c];\n var rawExports = createArray(\"rawExportsArray\");\n this.collapseMultiplicity(this.exportedChanges[+blockId], rawExports);\n var exports_1 = createArray(\"exportsArray\");\n for (var _d = 0, rawExports_1 = rawExports; _d < rawExports_1.length; _d++) {\n var change = rawExports_1[_d];\n var e = change.e, a = change.a, v = change.v, count = change.count;\n var beav = blockId + \"|\" + e + \"|\" + a + \"|\" + v;\n var old = context.exportIndex[beav] || 0;\n var neue = old + count;\n var delta = 0;\n context.exportIndex[beav] = neue;\n // Once you go negative you don't go back.\n if (old === 0 && neue > 0)\n delta = 1;\n else if (old > 0 && neue === 0)\n delta = -1;\n if (delta) {\n var exportedChange = new Change(e, a, v, change.n, this.transaction, 0, delta);\n exports_1.push(exportedChange);\n }\n }\n this.exportedChanges[+blockId] = exports_1;\n }\n try {\n this.exportHandler(this.exportedChanges);\n }\n catch (e) {\n tracer.pop(trace_1.TraceFrameType.Transaction);\n throw e;\n }\n }\n // Once the transaction is effectively done, we need to clean up after ourselves. We\n // arena allocated a bunch of IDs related to function call outputs, which we can now\n // safely release.\n exports.GlobalInterner.releaseArena(\"functionOutput\");\n tracer.pop(trace_1.TraceFrameType.Transaction);\n };\n return Transaction;\n}());\nexports.Transaction = Transaction;\nvar BlockChangeTransaction = (function (_super) {\n __extends(BlockChangeTransaction, _super);\n function BlockChangeTransaction(context, transaction, added, removed, blocks, exportHandler) {\n var _this = _super.call(this, context, transaction, blocks, exportHandler) || this;\n _this.context = context;\n _this.transaction = transaction;\n _this.added = added;\n _this.removed = removed;\n _this.blocks = blocks;\n _this.exportHandler = exportHandler;\n return _this;\n }\n BlockChangeTransaction.prototype.exec = function (context) {\n // To remove a block, we run a change with negative count through the system that\n // is meant to compute all the results the block has generated and remove them.\n for (var _i = 0, _a = this.removed; _i < _a.length; _i++) {\n var remove = _a[_i];\n remove.exec(context, BLOCK_REMOVE, this);\n }\n // To add a block, we do the same as remove, but with a positive change that causes\n // the block to compute all results based on the state of the indexes\n for (var _b = 0, _c = this.added; _b < _c.length; _b++) {\n var add = _c[_b];\n add.exec(context, BLOCK_ADD, this);\n }\n _super.prototype.exec.call(this, context);\n };\n return BlockChangeTransaction;\n}(Transaction));\nexports.BlockChangeTransaction = BlockChangeTransaction;\n// window[\"counts\"] = {};\n//# sourceMappingURL=runtime.js.map\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils = __webpack_require__(0);\nvar utils_1 = __webpack_require__(0);\nfunction classNameFromInstance(instance) {\n return functionName(instance.constructor);\n}\nexports.classNameFromInstance = classNameFromInstance;\nvar FUNC_NAME_REGEXP = /^\\s*function\\s*(\\S*)\\s*\\(/;\nvar NAME = \"name\";\n/* istanbul ignore next too many hacks for IE/old versions of node.js here*/\nfunction functionName(func) {\n // Engines that support Function.prototype.name OR the nth (n>1) time after\n // the name has been computed in the following else block.\n var existingNameProp = func.name;\n if (existingNameProp) {\n return existingNameProp;\n }\n // hack for IE and engines that do not support Object.defineProperty on function.name (Node.js 0.10 && 0.12)\n var computedName = func.toString().match(FUNC_NAME_REGEXP)[1];\n return computedName;\n}\nexports.functionName = functionName;\n/**\n * @returns {boolean} - has the property been successfully defined\n */\nfunction defineNameProp(obj, nameValue) {\n var namePropDescriptor = Object.getOwnPropertyDescriptor(obj, NAME);\n /* istanbul ignore else -> will only run in old versions of node.js */\n if (utils_1.isUndefined(namePropDescriptor) ||\n namePropDescriptor.configurable) {\n Object.defineProperty(obj, NAME, {\n enumerable: false,\n configurable: true,\n writable: false,\n value: nameValue\n });\n return true;\n }\n /* istanbul ignore next -> will only run in old versions of node.js */\n return false;\n}\nexports.defineNameProp = defineNameProp;\n/**\n * simple Hashtable between a string and some generic value\n * this should be removed once typescript supports ES6 style Hashtable\n */\nvar HashTable = (function () {\n function HashTable() {\n this._state = {};\n }\n HashTable.prototype.keys = function () {\n return utils.keys(this._state);\n };\n HashTable.prototype.values = function () {\n return utils.values(this._state);\n };\n HashTable.prototype.put = function (key, value) {\n this._state[key] = value;\n };\n HashTable.prototype.putAll = function (other) {\n this._state = utils.assign(this._state, other._state);\n };\n HashTable.prototype.get = function (key) {\n // To avoid edge case with a key called \"hasOwnProperty\" we need to perform the commented out check below\n // -> if (Object.prototype.hasOwnProperty.call(this._state, key)) { ... } <-\n // however this costs nearly 25% of the parser's runtime.\n // if someone decides to name their Parser class \"hasOwnProperty\" they deserve what they will get :)\n return this._state[key];\n };\n HashTable.prototype.containsKey = function (key) {\n return utils.has(this._state, key);\n };\n HashTable.prototype.clear = function () {\n this._state = {};\n };\n return HashTable;\n}());\nexports.HashTable = HashTable;\n//# sourceMappingURL=lang_extensions.js.map\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar encode = __webpack_require__(73);\nvar decode = __webpack_require__(72);\n\nvar C_BACKSLASH = 92;\n\nvar decodeHTML = __webpack_require__(30).decodeHTML;\n\nvar ENTITY = \"&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});\";\n\nvar TAGNAME = '[A-Za-z][A-Za-z0-9-]*';\nvar ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\nvar UNQUOTEDVALUE = \"[^\\\"'=<>`\\\\x00-\\\\x20]+\";\nvar SINGLEQUOTEDVALUE = \"'[^']*'\";\nvar DOUBLEQUOTEDVALUE = '\"[^\"]*\"';\nvar ATTRIBUTEVALUE = \"(?:\" + UNQUOTEDVALUE + \"|\" + SINGLEQUOTEDVALUE + \"|\" + DOUBLEQUOTEDVALUE + \")\";\nvar ATTRIBUTEVALUESPEC = \"(?:\" + \"\\\\s*=\" + \"\\\\s*\" + ATTRIBUTEVALUE + \")\";\nvar ATTRIBUTE = \"(?:\" + \"\\\\s+\" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + \"?)\";\nvar OPENTAG = \"<\" + TAGNAME + ATTRIBUTE + \"*\" + \"\\\\s*/?>\";\nvar CLOSETAG = \"</\" + TAGNAME + \"\\\\s*[>]\";\nvar HTMLCOMMENT = \"<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->\";\nvar PROCESSINGINSTRUCTION = \"[<][?].*?[?][>]\";\nvar DECLARATION = \"<![A-Z]+\" + \"\\\\s+[^>]*>\";\nvar CDATA = \"<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>\";\nvar HTMLTAG = \"(?:\" + OPENTAG + \"|\" + CLOSETAG + \"|\" + HTMLCOMMENT + \"|\" +\n PROCESSINGINSTRUCTION + \"|\" + DECLARATION + \"|\" + CDATA + \")\";\nvar reHtmlTag = new RegExp('^' + HTMLTAG, 'i');\n\nvar reBackslashOrAmp = /[\\\\&]/;\n\nvar ESCAPABLE = '[!\"#$%&\\'()*+,./:;<=>?@[\\\\\\\\\\\\]^_`{|}~-]';\n\nvar reEntityOrEscapedChar = new RegExp('\\\\\\\\' + ESCAPABLE + '|' + ENTITY, 'gi');\n\nvar XMLSPECIAL = '[&<>\"]';\n\nvar reXmlSpecial = new RegExp(XMLSPECIAL, 'g');\n\nvar reXmlSpecialOrEntity = new RegExp(ENTITY + '|' + XMLSPECIAL, 'gi');\n\nvar unescapeChar = function(s) {\n if (s.charCodeAt(0) === C_BACKSLASH) {\n return s.charAt(1);\n } else {\n return decodeHTML(s);\n }\n};\n\n// Replace entities and backslash escapes with literal characters.\nvar unescapeString = function(s) {\n if (reBackslashOrAmp.test(s)) {\n return s.replace(reEntityOrEscapedChar, unescapeChar);\n } else {\n return s;\n }\n};\n\nvar normalizeURI = function(uri) {\n try {\n return encode(decode(uri));\n }\n catch(err) {\n return uri;\n }\n};\n\nvar replaceUnsafeChar = function(s) {\n switch (s) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n default:\n return s;\n }\n};\n\nvar escapeXml = function(s, preserve_entities) {\n if (reXmlSpecial.test(s)) {\n if (preserve_entities) {\n return s.replace(reXmlSpecialOrEntity, replaceUnsafeChar);\n } else {\n return s.replace(reXmlSpecial, replaceUnsafeChar);\n }\n } else {\n return s;\n }\n};\n\nmodule.exports = { unescapeString: unescapeString,\n normalizeURI: normalizeURI,\n escapeXml: escapeXml,\n reHtmlTag: reHtmlTag,\n OPENTAG: OPENTAG,\n CLOSETAG: CLOSETAG,\n ENTITY: ENTITY,\n ESCAPABLE: ESCAPABLE\n };\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar v1 = __webpack_require__(78);\nvar v4 = __webpack_require__(79);\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * module used to cache static information about parsers,\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lang_extensions_1 = __webpack_require__(5);\nvar utils_1 = __webpack_require__(0);\nexports.CLASS_TO_DEFINITION_ERRORS = new lang_extensions_1.HashTable();\nexports.CLASS_TO_SELF_ANALYSIS_DONE = new lang_extensions_1.HashTable();\nexports.CLASS_TO_GRAMMAR_PRODUCTIONS = new lang_extensions_1.HashTable();\nfunction getProductionsForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_GRAMMAR_PRODUCTIONS);\n}\nexports.getProductionsForClass = getProductionsForClass;\nexports.CLASS_TO_RESYNC_FOLLOW_SETS = new lang_extensions_1.HashTable();\nfunction getResyncFollowsForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_RESYNC_FOLLOW_SETS);\n}\nexports.getResyncFollowsForClass = getResyncFollowsForClass;\nfunction setResyncFollowsForClass(className, followSet) {\n exports.CLASS_TO_RESYNC_FOLLOW_SETS.put(className, followSet);\n}\nexports.setResyncFollowsForClass = setResyncFollowsForClass;\nexports.CLASS_TO_LOOKAHEAD_FUNCS = new lang_extensions_1.HashTable();\nfunction getLookaheadFuncsForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_LOOKAHEAD_FUNCS);\n}\nexports.getLookaheadFuncsForClass = getLookaheadFuncsForClass;\nexports.CLASS_TO_FIRST_AFTER_REPETITION = new lang_extensions_1.HashTable();\nfunction getFirstAfterRepForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_FIRST_AFTER_REPETITION);\n}\nexports.getFirstAfterRepForClass = getFirstAfterRepForClass;\nexports.CLASS_TO_PRODUCTION_OVERRIDEN = new lang_extensions_1.HashTable();\nfunction getProductionOverriddenForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_PRODUCTION_OVERRIDEN);\n}\nexports.getProductionOverriddenForClass = getProductionOverriddenForClass;\nexports.CLASS_TO_CST_DICT_DEF_PER_RULE = new lang_extensions_1.HashTable();\nfunction getCstDictDefPerRuleForClass(className) {\n return getFromNestedHashTable(className, exports.CLASS_TO_CST_DICT_DEF_PER_RULE);\n}\nexports.getCstDictDefPerRuleForClass = getCstDictDefPerRuleForClass;\nexports.CLASS_TO_BASE_CST_VISITOR = new lang_extensions_1.HashTable();\nexports.CLASS_TO_BASE_CST_VISITOR_WITH_DEFAULTS = new lang_extensions_1.HashTable();\nexports.CLASS_TO_ALL_RULE_NAMES = new lang_extensions_1.HashTable();\n// TODO reflective test to verify this has not changed, for example (OPTION6 added)\nexports.MAX_OCCURRENCE_INDEX = 5;\nfunction getFromNestedHashTable(className, hashTable) {\n var result = hashTable.get(className);\n if (result === undefined) {\n hashTable.put(className, new lang_extensions_1.HashTable());\n result = hashTable.get(className);\n }\n return result;\n}\nfunction clearCache() {\n var hasTables = utils_1.filter(utils_1.values(module.exports), function (currHashTable) { return currHashTable instanceof lang_extensions_1.HashTable; });\n utils_1.forEach(hasTables, function (currHashTable) { return currHashTable.clear(); });\n}\nexports.clearCache = clearCache;\n//# sourceMappingURL=cache.js.map\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar gast_public_1 = __webpack_require__(2);\nvar gast_1 = __webpack_require__(11);\nvar utils_1 = __webpack_require__(0);\nfunction first(prod) {\n if (prod instanceof gast_public_1.gast.NonTerminal) {\n // this could in theory cause infinite loops if\n // (1) prod A refs prod B.\n // (2) prod B refs prod A\n // (3) AB can match the empty set\n // in other words a cycle where everything is optional so the first will keep\n // looking ahead for the next optional part and will never exit\n // currently there is no safeguard for this unique edge case because\n // (1) not sure a grammar in which this can happen is useful for anything (productive)\n return first(prod.referencedRule);\n }\n else if (prod instanceof gast_public_1.gast.Terminal) {\n return firstForTerminal(prod);\n }\n else if (gast_1.isSequenceProd(prod)) {\n return firstForSequence(prod);\n }/* istanbul ignore else */ \n else if (gast_1.isBranchingProd(prod)) {\n return firstForBranching(prod);\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.first = first;\nfunction firstForSequence(prod) {\n var firstSet = [];\n var seq = prod.definition;\n var nextSubProdIdx = 0;\n var hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n var currSubProd;\n // so we enter the loop at least once (if the definition is not empty\n var isLastInnerProdOptional = true;\n // scan a sequence until it's end or until we have found a NONE optional production in it\n while (hasInnerProdsRemaining && isLastInnerProdOptional) {\n currSubProd = seq[nextSubProdIdx];\n isLastInnerProdOptional = gast_1.isOptionalProd(currSubProd);\n firstSet = firstSet.concat(first(currSubProd));\n nextSubProdIdx = nextSubProdIdx + 1;\n hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n }\n return utils_1.uniq(firstSet);\n}\nexports.firstForSequence = firstForSequence;\nfunction firstForBranching(prod) {\n var allAlternativesFirsts = utils_1.map(prod.definition, function (innerProd) {\n return first(innerProd);\n });\n return utils_1.uniq(utils_1.flatten(allAlternativesFirsts));\n}\nexports.firstForBranching = firstForBranching;\nfunction firstForTerminal(terminal) {\n return [terminal.terminalType];\n}\nexports.firstForTerminal = firstForTerminal;\n//# sourceMappingURL=first.js.map\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\nfunction isSequenceProd(prod) {\n return prod instanceof gast_public_1.gast.Flat ||\n prod instanceof gast_public_1.gast.Option ||\n prod instanceof gast_public_1.gast.Repetition ||\n prod instanceof gast_public_1.gast.RepetitionMandatory ||\n prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator ||\n prod instanceof gast_public_1.gast.RepetitionWithSeparator ||\n prod instanceof gast_public_1.gast.Terminal ||\n prod instanceof gast_public_1.gast.Rule;\n}\nexports.isSequenceProd = isSequenceProd;\nfunction isOptionalProd(prod, alreadyVisited) {\n if (alreadyVisited === void 0) { alreadyVisited = []; }\n var isDirectlyOptional = prod instanceof gast_public_1.gast.Option ||\n prod instanceof gast_public_1.gast.Repetition ||\n prod instanceof gast_public_1.gast.RepetitionWithSeparator;\n if (isDirectlyOptional) {\n return true;\n }\n // note that this can cause infinite loop if one optional empty TOP production has a cyclic dependency with another\n // empty optional top rule\n // may be indirectly optional ((A?B?C?) | (D?E?F?))\n if (prod instanceof gast_public_1.gast.Alternation) {\n // for OR its enough for just one of the alternatives to be optional\n return utils_1.some(prod.definition, function (subProd) {\n return isOptionalProd(subProd, alreadyVisited);\n });\n }\n else if (prod instanceof gast_public_1.gast.NonTerminal && utils_1.contains(alreadyVisited, prod)) {\n // avoiding stack overflow due to infinite recursion\n return false;\n }\n else if (prod instanceof gast_public_1.gast.AbstractProduction) {\n if (prod instanceof gast_public_1.gast.NonTerminal) {\n alreadyVisited.push(prod);\n }\n return utils_1.every(prod.definition, function (subProd) {\n return isOptionalProd(subProd, alreadyVisited);\n });\n }\n else {\n return false;\n }\n}\nexports.isOptionalProd = isOptionalProd;\nfunction isBranchingProd(prod) {\n return prod instanceof gast_public_1.gast.Alternation;\n}\nexports.isBranchingProd = isBranchingProd;\nfunction getProductionDslName(prod) {\n if (prod instanceof gast_public_1.gast.NonTerminal) {\n return \"SUBRULE\";\n }\n else if (prod instanceof gast_public_1.gast.Option) {\n return \"OPTION\";\n }\n else if (prod instanceof gast_public_1.gast.Alternation) {\n return \"OR\";\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatory) {\n return \"AT_LEAST_ONE\";\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator) {\n return \"AT_LEAST_ONE_SEP\";\n }\n else if (prod instanceof gast_public_1.gast.RepetitionWithSeparator) {\n return \"MANY_SEP\";\n }\n else if (prod instanceof gast_public_1.gast.Repetition) {\n return \"MANY\";\n }/* istanbul ignore else */ \n else if (prod instanceof gast_public_1.gast.Terminal) {\n return \"CONSUME\";\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.getProductionDslName = getProductionDslName;\nvar GastCloneVisitor = (function (_super) {\n __extends(GastCloneVisitor, _super);\n function GastCloneVisitor() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n GastCloneVisitor.prototype.visitNonTerminal = function (node) {\n return new gast_public_1.gast.NonTerminal(node.nonTerminalName, undefined, node.occurrenceInParent, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitFlat = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.Flat(definition, node.name);\n };\n GastCloneVisitor.prototype.visitOption = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.Option(definition, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitRepetition = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.Repetition(definition, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitRepetitionMandatory = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.RepetitionMandatory(definition, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.RepetitionMandatoryWithSeparator(definition, node.separator, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitRepetitionWithSeparator = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.RepetitionWithSeparator(definition, node.separator, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitAlternation = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.Alternation(definition, node.occurrenceInParent, node.name, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitTerminal = function (node) {\n return new gast_public_1.gast.Terminal(node.terminalType, node.occurrenceInParent, node.implicitOccurrenceIndex);\n };\n GastCloneVisitor.prototype.visitRule = function (node) {\n var _this = this;\n var definition = utils_1.map(node.definition, function (currSubDef) { return _this.visit(currSubDef); });\n return new gast_public_1.gast.Rule(node.name, definition, node.orgText);\n };\n return GastCloneVisitor;\n}(gast_public_1.gast.GAstVisitor));\nfunction cloneProduction(prod) {\n var cloningVisitor = new GastCloneVisitor();\n return cloningVisitor.visit(prod);\n}\nexports.cloneProduction = cloneProduction;\n//# sourceMappingURL=gast.js.map\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* tslint:disable:no-use-before-declare */\nvar rest_1 = __webpack_require__(13);\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\nvar tokens_public_1 = __webpack_require__(3);\nvar first_1 = __webpack_require__(10);\n/* tslint:enable:no-use-before-declare */\nvar AbstractNextPossibleTokensWalker = (function (_super) {\n __extends(AbstractNextPossibleTokensWalker, _super);\n function AbstractNextPossibleTokensWalker(topProd, path) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.path = path;\n _this.possibleTokTypes = [];\n _this.nextProductionName = \"\";\n _this.nextProductionOccurrence = 0;\n _this.found = false;\n _this.isAtEndOfPath = false;\n return _this;\n }\n AbstractNextPossibleTokensWalker.prototype.startWalking = function () {\n this.found = false;\n if (this.path.ruleStack[0] !== this.topProd.name) {\n throw Error(\"The path does not start with the walker's top Rule!\");\n }\n // immutable for the win\n this.ruleStack = (utils_1.cloneArr(this.path.ruleStack)).reverse(); // intelij bug requires assertion\n this.occurrenceStack = (utils_1.cloneArr(this.path.occurrenceStack)).reverse(); // intelij bug requires assertion\n // already verified that the first production is valid, we now seek the 2nd production\n this.ruleStack.pop();\n this.occurrenceStack.pop();\n this.updateExpectedNext();\n this.walk(this.topProd);\n return this.possibleTokTypes;\n };\n AbstractNextPossibleTokensWalker.prototype.walk = function (prod, prevRest) {\n if (prevRest === void 0) { prevRest = []; }\n // stop scanning once we found the path\n if (!this.found) {\n _super.prototype.walk.call(this, prod, prevRest);\n }\n };\n AbstractNextPossibleTokensWalker.prototype.walkProdRef = function (refProd, currRest, prevRest) {\n // found the next production, need to keep walking in it\n if (refProd.referencedRule.name === this.nextProductionName &&\n refProd.occurrenceInParent === this.nextProductionOccurrence) {\n var fullRest = currRest.concat(prevRest);\n this.updateExpectedNext();\n this.walk(refProd.referencedRule, fullRest);\n }\n };\n AbstractNextPossibleTokensWalker.prototype.updateExpectedNext = function () {\n // need to consume the Terminal\n if (utils_1.isEmpty(this.ruleStack)) {\n // must reset nextProductionXXX to avoid walking down another Top Level production while what we are\n // really seeking is the last Terminal...\n this.nextProductionName = \"\";\n this.nextProductionOccurrence = 0;\n this.isAtEndOfPath = true;\n }\n else {\n this.nextProductionName = this.ruleStack.pop();\n this.nextProductionOccurrence = this.occurrenceStack.pop();\n }\n };\n return AbstractNextPossibleTokensWalker;\n}(rest_1.RestWalker));\nexports.AbstractNextPossibleTokensWalker = AbstractNextPossibleTokensWalker;\nvar NextAfterTokenWalker = (function (_super) {\n __extends(NextAfterTokenWalker, _super);\n function NextAfterTokenWalker(topProd, path) {\n var _this = _super.call(this, topProd, path) /* istanbul ignore next */ || this;\n _this.path = path;\n _this.nextTerminalName = \"\";\n _this.nextTerminalOccurrence = 0;\n _this.nextTerminalName = tokens_public_1.tokenName(_this.path.lastTok);\n _this.nextTerminalOccurrence = _this.path.lastTokOccurrence;\n return _this;\n }\n NextAfterTokenWalker.prototype.walkTerminal = function (terminal, currRest, prevRest) {\n if (this.isAtEndOfPath && tokens_public_1.tokenName(terminal.terminalType) === this.nextTerminalName &&\n terminal.occurrenceInParent === this.nextTerminalOccurrence && !(this.found)) {\n var fullRest = currRest.concat(prevRest);\n var restProd = new gast_public_1.gast.Flat(fullRest);\n this.possibleTokTypes = first_1.first(restProd);\n this.found = true;\n }\n };\n return NextAfterTokenWalker;\n}(AbstractNextPossibleTokensWalker));\nexports.NextAfterTokenWalker = NextAfterTokenWalker;\n/**\n * This walker only \"walks\" a single \"TOP\" level in the Grammar Ast, this means\n * it never \"follows\" production refs\n */\nvar AbstractNextTerminalAfterProductionWalker = (function (_super) {\n __extends(AbstractNextTerminalAfterProductionWalker, _super);\n function AbstractNextTerminalAfterProductionWalker(topRule, occurrence) {\n var _this = _super.call(this) || this;\n _this.topRule = topRule;\n _this.occurrence = occurrence;\n _this.result = { token: undefined, occurrence: undefined, isEndOfRule: undefined };\n return _this;\n }\n AbstractNextTerminalAfterProductionWalker.prototype.startWalking = function () {\n this.walk(this.topRule);\n return this.result;\n };\n return AbstractNextTerminalAfterProductionWalker;\n}(rest_1.RestWalker));\nexports.AbstractNextTerminalAfterProductionWalker = AbstractNextTerminalAfterProductionWalker;\nvar NextTerminalAfterManyWalker = (function (_super) {\n __extends(NextTerminalAfterManyWalker, _super);\n function NextTerminalAfterManyWalker() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n NextTerminalAfterManyWalker.prototype.walkMany = function (manyProd, currRest, prevRest) {\n if (manyProd.occurrenceInParent === this.occurrence) {\n var firstAfterMany = utils_1.first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterMany === undefined;\n if (firstAfterMany instanceof gast_public_1.gast.Terminal) {\n this.result.token = firstAfterMany.terminalType;\n this.result.occurrence = firstAfterMany.occurrenceInParent;\n }\n }\n else {\n _super.prototype.walkMany.call(this, manyProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterManyWalker;\n}(AbstractNextTerminalAfterProductionWalker));\nexports.NextTerminalAfterManyWalker = NextTerminalAfterManyWalker;\nvar NextTerminalAfterManySepWalker = (function (_super) {\n __extends(NextTerminalAfterManySepWalker, _super);\n function NextTerminalAfterManySepWalker() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n NextTerminalAfterManySepWalker.prototype.walkManySep = function (manySepProd, currRest, prevRest) {\n if (manySepProd.occurrenceInParent === this.occurrence) {\n var firstAfterManySep = utils_1.first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterManySep === undefined;\n if (firstAfterManySep instanceof gast_public_1.gast.Terminal) {\n this.result.token = firstAfterManySep.terminalType;\n this.result.occurrence = firstAfterManySep.occurrenceInParent;\n }\n }\n else {\n _super.prototype.walkManySep.call(this, manySepProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterManySepWalker;\n}(AbstractNextTerminalAfterProductionWalker));\nexports.NextTerminalAfterManySepWalker = NextTerminalAfterManySepWalker;\nvar NextTerminalAfterAtLeastOneWalker = (function (_super) {\n __extends(NextTerminalAfterAtLeastOneWalker, _super);\n function NextTerminalAfterAtLeastOneWalker() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n NextTerminalAfterAtLeastOneWalker.prototype.walkAtLeastOne = function (atLeastOneProd, currRest, prevRest) {\n if (atLeastOneProd.occurrenceInParent === this.occurrence) {\n var firstAfterAtLeastOne = utils_1.first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterAtLeastOne === undefined;\n if (firstAfterAtLeastOne instanceof gast_public_1.gast.Terminal) {\n this.result.token = firstAfterAtLeastOne.terminalType;\n this.result.occurrence = firstAfterAtLeastOne.occurrenceInParent;\n }\n }\n else {\n _super.prototype.walkAtLeastOne.call(this, atLeastOneProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterAtLeastOneWalker;\n}(AbstractNextTerminalAfterProductionWalker));\nexports.NextTerminalAfterAtLeastOneWalker = NextTerminalAfterAtLeastOneWalker;\n// TODO: reduce code duplication in the AfterWalkers\nvar NextTerminalAfterAtLeastOneSepWalker = (function (_super) {\n __extends(NextTerminalAfterAtLeastOneSepWalker, _super);\n function NextTerminalAfterAtLeastOneSepWalker() {\n return _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n }\n NextTerminalAfterAtLeastOneSepWalker.prototype.walkAtLeastOneSep = function (atleastOneSepProd, currRest, prevRest) {\n if (atleastOneSepProd.occurrenceInParent === this.occurrence) {\n var firstAfterfirstAfterAtLeastOneSep = utils_1.first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === undefined;\n if (firstAfterfirstAfterAtLeastOneSep instanceof gast_public_1.gast.Terminal) {\n this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType;\n this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.occurrenceInParent;\n }\n }\n else {\n _super.prototype.walkAtLeastOneSep.call(this, atleastOneSepProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterAtLeastOneSepWalker;\n}(AbstractNextTerminalAfterProductionWalker));\nexports.NextTerminalAfterAtLeastOneSepWalker = NextTerminalAfterAtLeastOneSepWalker;\nfunction possiblePathsFrom(targetDef, maxLength, currPath) {\n if (currPath === void 0) { currPath = []; }\n // avoid side effects\n currPath = utils_1.cloneArr(currPath);\n var result = [];\n var i = 0;\n function remainingPathWith(nextDef) {\n return nextDef.concat(utils_1.drop(targetDef, i + 1));\n }\n function getAlternativesForProd(prod) {\n var alternatives = possiblePathsFrom(remainingPathWith(prod.definition), maxLength, currPath);\n return result.concat(alternatives);\n }\n /**\n * Mandatory productions will halt the loop as the paths computed from their recursive calls will already contain the\n * following (rest) of the targetDef.\n *\n * For optional productions (Option/Repetition/...) the loop will continue to represent the paths that do not include the\n * the optional production.\n */\n while (currPath.length < maxLength && i < targetDef.length) {\n var prod = targetDef[i];\n if (prod instanceof gast_public_1.gast.Flat) {\n return getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.NonTerminal) {\n return getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.Option) {\n result = getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatory) {\n return getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator) {\n return getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionWithSeparator) {\n result = getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.Repetition) {\n result = getAlternativesForProd(prod);\n }\n else if (prod instanceof gast_public_1.gast.Alternation) {\n utils_1.forEach(prod.definition, function (currAlt) {\n result = getAlternativesForProd(currAlt);\n });\n return result;\n }/* istanbul ignore else */ \n else if (prod instanceof gast_public_1.gast.Terminal) {\n currPath.push(prod.terminalType);\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n i++;\n }\n result.push({\n partialPath: currPath,\n suffixDef: utils_1.drop(targetDef, 1)\n });\n return result;\n}\nexports.possiblePathsFrom = possiblePathsFrom;\nfunction nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {\n var EXIT_NON_TERMINAL = \"EXIT_NONE_TERMINAL\";\n // to avoid creating a new Array each time.\n var EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL];\n var EXIT_ALTERNATIVE = \"EXIT_ALTERNATIVE\";\n var foundCompletePath = false;\n var tokenVectorLength = tokenVector.length;\n var minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1;\n var result = [];\n var possiblePaths = [];\n possiblePaths.push({ idx: -1, def: initialDef, ruleStack: [], occurrenceStack: [] });\n while (!utils_1.isEmpty(possiblePaths)) {\n var currPath = possiblePaths.pop();\n // skip alternatives if no more results can be found (assuming deterministic grammar with fixed lookahead)\n if (currPath === EXIT_ALTERNATIVE) {\n if (foundCompletePath &&\n utils_1.last(possiblePaths).idx <= minimalAlternativesIndex) {\n // remove irrelevant alternative\n possiblePaths.pop();\n }\n continue;\n }\n var currDef = currPath.def;\n var currIdx = currPath.idx;\n var currRuleStack = currPath.ruleStack;\n var currOccurrenceStack = currPath.occurrenceStack;\n // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT\n if (utils_1.isEmpty(currDef)) {\n continue;\n }\n var prod = currDef[0];\n if (prod === EXIT_NON_TERMINAL) {\n var nextPath = {\n idx: currIdx,\n def: utils_1.drop(currDef),\n ruleStack: utils_1.dropRight(currRuleStack),\n occurrenceStack: utils_1.dropRight(currOccurrenceStack)\n };\n possiblePaths.push(nextPath);\n }\n else if (prod instanceof gast_public_1.gast.Terminal) {\n if (currIdx < tokenVectorLength - 1) {\n var nextIdx = currIdx + 1;\n var actualToken = tokenVector[nextIdx];\n if (tokMatcher(actualToken, prod.terminalType)) {\n var nextPath = {\n idx: nextIdx,\n def: utils_1.drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n }\n // end of the line\n }/* istanbul ignore else */ \n else if (currIdx === tokenVectorLength - 1) {\n \n result.push({\n nextTokenType: prod.terminalType,\n nextTokenOccurrence: prod.occurrenceInParent,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n });\n foundCompletePath = true;\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n }\n else if (prod instanceof gast_public_1.gast.NonTerminal) {\n var newRuleStack = utils_1.cloneArr(currRuleStack);\n newRuleStack.push(prod.nonTerminalName);\n var newOccurrenceStack = utils_1.cloneArr(currOccurrenceStack);\n newOccurrenceStack.push(prod.occurrenceInParent);\n var nextPath = {\n idx: currIdx,\n def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, utils_1.drop(currDef)),\n ruleStack: newRuleStack,\n occurrenceStack: newOccurrenceStack\n };\n possiblePaths.push(nextPath);\n }\n else if (prod instanceof gast_public_1.gast.Option) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n var nextPathWithout = {\n idx: currIdx,\n def: utils_1.drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n var nextPathWith = {\n idx: currIdx,\n def: prod.definition.concat(utils_1.drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatory) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n var secondIteration = new gast_public_1.gast.Repetition(prod.definition, prod.occurrenceInParent);\n var nextDef = prod.definition.concat([secondIteration], utils_1.drop(currDef));\n var nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n var separatorGast = new gast_public_1.gast.Terminal(prod.separator);\n var secondIteration = new gast_public_1.gast.Repetition([separatorGast].concat(prod.definition), prod.occurrenceInParent);\n var nextDef = prod.definition.concat([secondIteration], utils_1.drop(currDef));\n var nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n }\n else if (prod instanceof gast_public_1.gast.RepetitionWithSeparator) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n var nextPathWithout = {\n idx: currIdx,\n def: utils_1.drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n var separatorGast = new gast_public_1.gast.Terminal(prod.separator);\n var nthRepetition = new gast_public_1.gast.Repetition([separatorGast].concat(prod.definition), prod.occurrenceInParent);\n var nextDef = prod.definition.concat([nthRepetition], utils_1.drop(currDef));\n var nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n }\n else if (prod instanceof gast_public_1.gast.Repetition) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n var nextPathWithout = {\n idx: currIdx,\n def: utils_1.drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n // TODO: an empty repetition will cause infinite loops here, will the parser detect this in selfAnalysis?\n var nthRepetition = new gast_public_1.gast.Repetition(prod.definition, prod.occurrenceInParent);\n var nextDef = prod.definition.concat([nthRepetition], utils_1.drop(currDef));\n var nextPathWith = {\n idx: currIdx, def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n }\n else if (prod instanceof gast_public_1.gast.Alternation) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n for (var i = prod.definition.length - 1; i >= 0; i--) {\n var currAlt = prod.definition[i];\n var currAltPath = {\n idx: currIdx,\n def: currAlt.definition.concat(utils_1.drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(currAltPath);\n possiblePaths.push(EXIT_ALTERNATIVE);\n }\n }\n else if (prod instanceof gast_public_1.gast.Flat) {\n possiblePaths.push({\n idx: currIdx,\n def: prod.definition.concat(utils_1.drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n });\n }/* istanbul ignore else */ \n else if (prod instanceof gast_public_1.gast.Rule) {\n possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack));\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n }\n return result;\n}\nexports.nextPossibleTokensAfter = nextPossibleTokensAfter;\nfunction expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {\n var newRuleStack = utils_1.cloneArr(currRuleStack);\n newRuleStack.push(topRule.name);\n var newCurrOccurrenceStack = utils_1.cloneArr(currOccurrenceStack);\n // top rule is always assumed to have been called with occurrence index 1\n newCurrOccurrenceStack.push(1);\n return {\n idx: currIdx,\n def: topRule.definition,\n ruleStack: newRuleStack,\n occurrenceStack: newCurrOccurrenceStack\n };\n}\n//# sourceMappingURL=interpreter.js.map\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\n/**\n * A Grammar Walker that computes the \"remaining\" grammar \"after\" a productions in the grammar.\n */\nvar RestWalker = (function () {\n function RestWalker() {\n }\n RestWalker.prototype.walk = function (prod, prevRest) {\n var _this = this;\n if (prevRest === void 0) { prevRest = []; }\n utils_1.forEach(prod.definition, function (subProd, index) {\n var currRest = utils_1.drop(prod.definition, index + 1);\n if (subProd instanceof gast_public_1.gast.NonTerminal) {\n _this.walkProdRef(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.Terminal) {\n _this.walkTerminal(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.Flat) {\n _this.walkFlat(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.Option) {\n _this.walkOption(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.RepetitionMandatory) {\n _this.walkAtLeastOne(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator) {\n _this.walkAtLeastOneSep(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.RepetitionWithSeparator) {\n _this.walkManySep(subProd, currRest, prevRest);\n }\n else if (subProd instanceof gast_public_1.gast.Repetition) {\n _this.walkMany(subProd, currRest, prevRest);\n }/* istanbul ignore else */ \n else if (subProd instanceof gast_public_1.gast.Alternation) {\n _this.walkOr(subProd, currRest, prevRest);\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n });\n };\n RestWalker.prototype.walkTerminal = function (terminal, currRest, prevRest) { };\n RestWalker.prototype.walkProdRef = function (refProd, currRest, prevRest) { };\n RestWalker.prototype.walkFlat = function (flatProd, currRest, prevRest) {\n // ABCDEF => after the D the rest is EF\n var fullOrRest = currRest.concat(prevRest);\n this.walk(flatProd, fullOrRest);\n };\n RestWalker.prototype.walkOption = function (optionProd, currRest, prevRest) {\n // ABC(DE)?F => after the (DE)? the rest is F\n var fullOrRest = currRest.concat(prevRest);\n this.walk(optionProd, fullOrRest);\n };\n RestWalker.prototype.walkAtLeastOne = function (atLeastOneProd, currRest, prevRest) {\n // ABC(DE)+F => after the (DE)+ the rest is (DE)?F\n var fullAtLeastOneRest = [new gast_public_1.gast.Option(atLeastOneProd.definition)].concat(currRest, prevRest);\n this.walk(atLeastOneProd, fullAtLeastOneRest);\n };\n RestWalker.prototype.walkAtLeastOneSep = function (atLeastOneSepProd, currRest, prevRest) {\n // ABC DE(,DE)* F => after the (,DE)+ the rest is (,DE)?F\n var fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest);\n this.walk(atLeastOneSepProd, fullAtLeastOneSepRest);\n };\n RestWalker.prototype.walkMany = function (manyProd, currRest, prevRest) {\n // ABC(DE)*F => after the (DE)* the rest is (DE)?F\n var fullManyRest = [new gast_public_1.gast.Option(manyProd.definition)].concat(currRest, prevRest);\n this.walk(manyProd, fullManyRest);\n };\n RestWalker.prototype.walkManySep = function (manySepProd, currRest, prevRest) {\n // ABC (DE(,DE)*)? F => after the (,DE)* the rest is (,DE)?F\n var fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest);\n this.walk(manySepProd, fullManySepRest);\n };\n RestWalker.prototype.walkOr = function (orProd, currRest, prevRest) {\n var _this = this;\n // ABC(D|E|F)G => when finding the (D|E|F) the rest is G\n var fullOrRest = currRest.concat(prevRest);\n // walk all different alternatives\n utils_1.forEach(orProd.definition, function (alt) {\n // wrapping each alternative in a single definition wrapper\n // to avoid errors in computing the rest of that alternative in the invocation to computeInProdFollows\n // (otherwise for OR([alt1,alt2]) alt2 will be considered in 'rest' of alt1\n var prodWrapper = new gast_public_1.gast.Flat([alt]);\n _this.walk(prodWrapper, fullOrRest);\n });\n };\n return RestWalker;\n}());\nexports.RestWalker = RestWalker;\nfunction restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {\n var repSepRest = [new gast_public_1.gast.Option([new gast_public_1.gast.Terminal(repSepProd.separator)].concat(repSepProd.definition))];\n var fullRepSepRest = repSepRest.concat(currRest, prevRest);\n return fullRepSepRest;\n}\n//# sourceMappingURL=rest.js.map\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar cache = __webpack_require__(9);\nvar cache_1 = __webpack_require__(9);\nvar exceptions_public_1 = __webpack_require__(25);\nvar lang_extensions_1 = __webpack_require__(5);\nvar resolver_1 = __webpack_require__(51);\nvar checks_1 = __webpack_require__(26);\nvar utils_1 = __webpack_require__(0);\nvar follow_1 = __webpack_require__(50);\nvar tokens_public_1 = __webpack_require__(3);\nvar lookahead_1 = __webpack_require__(28);\nvar gast_builder_1 = __webpack_require__(49);\nvar interpreter_1 = __webpack_require__(12);\nvar constants_1 = __webpack_require__(23);\nvar gast_public_1 = __webpack_require__(2);\nvar gast_1 = __webpack_require__(11);\nvar tokens_1 = __webpack_require__(16);\nvar cst_1 = __webpack_require__(24);\nvar keys_1 = __webpack_require__(27);\nvar cst_visitor_1 = __webpack_require__(48);\nvar serializeGrammar = gast_public_1.gast.serializeGrammar;\nvar ParserDefinitionErrorType;\n(function (ParserDefinitionErrorType) {\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_RULE_NAME\"] = 0] = \"INVALID_RULE_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"DUPLICATE_RULE_NAME\"] = 1] = \"DUPLICATE_RULE_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_RULE_OVERRIDE\"] = 2] = \"INVALID_RULE_OVERRIDE\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"DUPLICATE_PRODUCTIONS\"] = 3] = \"DUPLICATE_PRODUCTIONS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"UNRESOLVED_SUBRULE_REF\"] = 4] = \"UNRESOLVED_SUBRULE_REF\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"LEFT_RECURSION\"] = 5] = \"LEFT_RECURSION\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"NONE_LAST_EMPTY_ALT\"] = 6] = \"NONE_LAST_EMPTY_ALT\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"AMBIGUOUS_ALTS\"] = 7] = \"AMBIGUOUS_ALTS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"CONFLICT_TOKENS_RULES_NAMESPACE\"] = 8] = \"CONFLICT_TOKENS_RULES_NAMESPACE\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_TOKEN_NAME\"] = 9] = \"INVALID_TOKEN_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_NESTED_RULE_NAME\"] = 10] = \"INVALID_NESTED_RULE_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"DUPLICATE_NESTED_NAME\"] = 11] = \"DUPLICATE_NESTED_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"NO_NON_EMPTY_LOOKAHEAD\"] = 12] = \"NO_NON_EMPTY_LOOKAHEAD\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"AMBIGUOUS_PREFIX_ALTS\"] = 13] = \"AMBIGUOUS_PREFIX_ALTS\";\n})(ParserDefinitionErrorType = exports.ParserDefinitionErrorType || (exports.ParserDefinitionErrorType = {}));\nvar IN_RULE_RECOVERY_EXCEPTION = \"InRuleRecoveryException\";\nvar END_OF_FILE = tokens_public_1.createTokenInstance(tokens_public_1.EOF, \"\", NaN, NaN, NaN, NaN, NaN, NaN);\nObject.freeze(END_OF_FILE);\nvar DEFAULT_PARSER_CONFIG = Object.freeze({\n recoveryEnabled: false,\n maxLookahead: 5,\n ignoredIssues: {},\n dynamicTokensEnabled: false,\n // TODO: Document this breaking change, can it be mitigated?\n // TODO: change to true\n outputCst: false\n});\nvar DEFAULT_RULE_CONFIG = Object.freeze({\n recoveryValueFunc: function () { return undefined; },\n resyncEnabled: true\n});\n/**\n * Convenience used to express an empty alternative in an OR (alternation).\n * can be used to more clearly describe the intent in a case of empty alternation.\n *\n * For example:\n *\n * 1. without using EMPTY_ALT:\n *\n * this.OR([\n * {ALT: () => {\n * this.CONSUME1(OneTok)\n * return \"1\"\n * }},\n * {ALT: () => {\n * this.CONSUME1(TwoTok)\n * return \"2\"\n * }},\n * {ALT: () => { // implicitly empty because there are no invoked grammar rules (OR/MANY/CONSUME...) inside this alternative.\n * return \"666\"\n * }},\n * ])\n *\n *\n * 2. using EMPTY_ALT:\n *\n * this.OR([\n * {ALT: () => {\n * this.CONSUME1(OneTok)\n * return \"1\"\n * }},\n * {ALT: () => {\n * this.CONSUME1(TwoTok)\n * return \"2\"\n * }},\n * {ALT: EMPTY_ALT(\"666\")}, // explicitly empty, clearer intent\n * ])\n *\n */\nfunction EMPTY_ALT(value) {\n if (value === void 0) { value = undefined; }\n return function () {\n return value;\n };\n}\nexports.EMPTY_ALT = EMPTY_ALT;\nvar EOF_FOLLOW_KEY = {};\n/**\n * A Recognizer capable of self analysis to determine it's grammar structure\n * This is used for more advanced features requiring such information.\n * For example: Error Recovery, Automatic lookahead calculation.\n */\nvar Parser = (function () {\n function Parser(input, tokensDictionary, config) {\n if (config === void 0) { config = DEFAULT_PARSER_CONFIG; }\n this._errors = [];\n this._input = [];\n this.inputIdx = -1;\n this.savedTokenIdx = -1;\n this.isBackTrackingStack = [];\n this.RULE_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n this.CST_STACK = [];\n this.tokensMap = undefined;\n this.definedRulesNames = [];\n this.shortRuleNameToFull = new lang_extensions_1.HashTable();\n this.fullRuleNameToShort = new lang_extensions_1.HashTable();\n // The shortName Index must be coded \"after\" the first 8bits to enable building unique lookahead keys\n this.ruleShortNameIdx = 256;\n this.LAST_EXPLICIT_RULE_STACK = [];\n this.selfAnalysisDone = false;\n /**\n * Only used internally for storing productions as they are built for the first time.\n * The final productions should be accessed from the static cache.\n */\n this._productions = new lang_extensions_1.HashTable();\n this._input = input;\n // configuration\n this.recoveryEnabled = utils_1.has(config, \"recoveryEnabled\") ?\n config.recoveryEnabled :\n DEFAULT_PARSER_CONFIG.recoveryEnabled;\n // performance optimization, NOOP will be inlined which\n // effectively means that this optional feature does not exist\n // when not used.\n if (!this.recoveryEnabled) {\n this.attemptInRepetitionRecovery = utils_1.NOOP;\n }\n this.dynamicTokensEnabled = utils_1.has(config, \"dynamicTokensEnabled\") ?\n config.dynamicTokensEnabled :\n DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;\n this.maxLookahead = utils_1.has(config, \"maxLookahead\") ?\n config.maxLookahead :\n DEFAULT_PARSER_CONFIG.maxLookahead;\n this.ignoredIssues = utils_1.has(config, \"ignoredIssues\") ?\n config.ignoredIssues :\n DEFAULT_PARSER_CONFIG.ignoredIssues;\n this.outputCst = utils_1.has(config, \"outputCst\") ?\n config.outputCst :\n DEFAULT_PARSER_CONFIG.outputCst;\n if (!this.outputCst) {\n this.cstInvocationStateUpdate = utils_1.NOOP;\n this.cstFinallyStateUpdate = utils_1.NOOP;\n this.cstPostTerminal = utils_1.NOOP;\n this.cstPostNonTerminal = utils_1.NOOP;\n this.getLastExplicitRuleShortName = this.getLastExplicitRuleShortNameNoCst;\n this.getPreviousExplicitRuleShortName = this.getPreviousExplicitRuleShortNameNoCst;\n this.getPreviousExplicitRuleOccurenceIndex = this.getPreviousExplicitRuleOccurenceIndexNoCst;\n this.manyInternal = this.manyInternalNoCst;\n this.orInternal = this.orInternalNoCst;\n this.optionInternal = this.optionInternalNoCst;\n this.atLeastOneInternal = this.atLeastOneInternalNoCst;\n this.manySepFirstInternal = this.manySepFirstInternalNoCst;\n this.atLeastOneSepFirstInternal = this.atLeastOneSepFirstInternalNoCst;\n this.invokeRuleNoTry = this.invokeRuleNoTryNoCst;\n }\n this.className = lang_extensions_1.classNameFromInstance(this);\n this.firstAfterRepMap = cache.getFirstAfterRepForClass(this.className);\n this.classLAFuncs = cache.getLookaheadFuncsForClass(this.className);\n this.cstDictDefForRule = cache.getCstDictDefPerRuleForClass(this.className);\n if (!cache.CLASS_TO_DEFINITION_ERRORS.containsKey(this.className)) {\n this.definitionErrors = [];\n cache.CLASS_TO_DEFINITION_ERRORS.put(this.className, this.definitionErrors);\n }\n else {\n this.definitionErrors = cache.CLASS_TO_DEFINITION_ERRORS.get(this.className);\n }\n if (utils_1.isArray(tokensDictionary)) {\n this.tokensMap = utils_1.reduce(tokensDictionary, function (acc, tokenClazz) {\n acc[tokens_public_1.tokenName(tokenClazz)] = tokenClazz;\n return acc;\n }, {});\n }\n else if (utils_1.has(tokensDictionary, \"modes\") && utils_1.every(utils_1.flatten(utils_1.values(tokensDictionary.modes)), tokens_1.isExtendingTokenType)) {\n var allTokenTypes = utils_1.flatten(utils_1.values(tokensDictionary.modes));\n var uniqueTokens = utils_1.uniq(allTokenTypes);\n this.tokensMap = utils_1.reduce(uniqueTokens, function (acc, tokenClazz) {\n acc[tokens_public_1.tokenName(tokenClazz)] = tokenClazz;\n return acc;\n }, {});\n }\n else if (utils_1.isObject(tokensDictionary)) {\n this.tokensMap = utils_1.cloneObj(tokensDictionary);\n }\n else {\n throw new Error(\"<tokensDictionary> argument must be An Array of Token constructors\" +\n \" A dictionary of Token constructors or an IMultiModeLexerDefinition\");\n }\n this.tokenMatcher = tokens_1.tokenStructuredMatcher;\n this.tokenClassIdentityFunc = tokens_1.tokenStructuredIdentity;\n // same IdentityFunc used in structured Mode\n this.tokenInstanceIdentityFunc = tokens_1.tokenStructuredIdentity;\n // always add EOF to the tokenNames -> constructors map. it is useful to assure all the input has been\n // parsed with a clear error message (\"expecting EOF but found ...\")\n /* tslint:disable */\n this.tokensMap[\"EOF\"] = tokens_public_1.EOF;\n /* tslint:enable */\n // Because ES2015+ syntax should be supported for creating Token classes\n // We cannot assume that the Token classes were created using the \"extendToken\" utilities\n // Therefore we must augment the Token classes both on Lexer initialization and on Parser initialization\n tokens_1.augmentTokenClasses(utils_1.values(this.tokensMap));\n }\n Parser.performSelfAnalysis = function (parserInstance) {\n var definitionErrors = [];\n var defErrorsMsgs;\n parserInstance.selfAnalysisDone = true;\n var className = lang_extensions_1.classNameFromInstance(parserInstance);\n if (className === \"\") {\n // just a simple \"throw Error\" without any fancy \"definition error\" because the logic below relies on a unique parser name to\n // save/access those definition errors...\n throw Error(\"A Parser's constructor may not be an anonymous Function, it must be a named function\\n\" +\n \"The constructor's name is used at runtime for performance (caching) purposes.\");\n }\n // this information should only be computed once\n if (!cache.CLASS_TO_SELF_ANALYSIS_DONE.containsKey(className)) {\n cache.CLASS_TO_SELF_ANALYSIS_DONE.put(className, true);\n var orgProductions_1 = parserInstance._productions;\n var clonedProductions_1 = new lang_extensions_1.HashTable();\n // clone the grammar productions to support grammar inheritance. requirements:\n // 1. We want to avoid rebuilding the grammar every time so a cache for the productions is used.\n // 2. We need to collect the production from multiple grammars in an inheritance scenario during constructor invocation\n // so the myGast variable is used.\n // 3. If a Production has been overridden references to it in the GAST must also be updated.\n utils_1.forEach(orgProductions_1.keys(), function (key) {\n var value = orgProductions_1.get(key);\n clonedProductions_1.put(key, gast_1.cloneProduction(value));\n });\n cache.getProductionsForClass(className).putAll(clonedProductions_1);\n // assumes this cache has been initialized (in the relevant parser's constructor)\n // TODO: consider making the self analysis a member method to resolve this.\n // that way it won't be callable before the constructor has been invoked...\n definitionErrors = cache.CLASS_TO_DEFINITION_ERRORS.get(className);\n var resolverErrors = resolver_1.resolveGrammar(clonedProductions_1);\n definitionErrors.push.apply(definitionErrors, resolverErrors); // mutability for the win?\n // only perform additional grammar validations IFF no resolving errors have occurred.\n // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations.\n if (utils_1.isEmpty(resolverErrors)) {\n var validationErrors = checks_1.validateGrammar(clonedProductions_1.values(), parserInstance.maxLookahead, utils_1.values(parserInstance.tokensMap), parserInstance.ignoredIssues);\n definitionErrors.push.apply(definitionErrors, validationErrors); // mutability for the win?\n }\n if (!utils_1.isEmpty(definitionErrors) && !Parser.DEFER_DEFINITION_ERRORS_HANDLING) {\n defErrorsMsgs = utils_1.map(definitionErrors, function (defError) { return defError.message; });\n throw new Error(\"Parser Definition Errors detected\\n: \" + defErrorsMsgs.join(\"\\n-------------------------------\\n\"));\n }\n if (utils_1.isEmpty(definitionErrors)) {\n var allFollows = follow_1.computeAllProdsFollows(clonedProductions_1.values());\n cache.setResyncFollowsForClass(className, allFollows);\n }\n var cstAnalysisResult = cst_1.analyzeCst(clonedProductions_1.values(), parserInstance.fullRuleNameToShort);\n cache.getCstDictDefPerRuleForClass(className).putAll(cstAnalysisResult.dictDef);\n cache.CLASS_TO_ALL_RULE_NAMES.put(className, cstAnalysisResult.allRuleNames);\n }\n // reThrow the validation errors each time an erroneous parser is instantiated\n if (!utils_1.isEmpty(cache.CLASS_TO_DEFINITION_ERRORS.get(className)) && !Parser.DEFER_DEFINITION_ERRORS_HANDLING) {\n defErrorsMsgs = utils_1.map(cache.CLASS_TO_DEFINITION_ERRORS.get(className), function (defError) { return defError.message; });\n throw new Error(\"Parser Definition Errors detected\\n: \" + defErrorsMsgs.join(\"\\n-------------------------------\\n\"));\n }\n };\n Object.defineProperty(Parser.prototype, \"errors\", {\n get: function () {\n return utils_1.cloneArr(this._errors);\n },\n set: function (newErrors) {\n this._errors = newErrors;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Parser.prototype, \"input\", {\n get: function () {\n return utils_1.cloneArr(this._input);\n },\n set: function (newInput) {\n this.reset();\n this._input = newInput;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Resets the parser state, should be overridden for custom parsers which \"carry\" additional state.\n * When overriding, remember to also invoke the super implementation!\n */\n Parser.prototype.reset = function () {\n this.resetLexerState();\n this.isBackTrackingStack = [];\n this.errors = [];\n this._input = [];\n this.RULE_STACK = [];\n this.LAST_EXPLICIT_RULE_STACK = [];\n this.CST_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n };\n Parser.prototype.isAtEndOfInput = function () {\n return this.tokenMatcher(this.LA(1), tokens_public_1.EOF);\n };\n Parser.prototype.getBaseCstVisitorConstructor = function () {\n var cachedConstructor = cache_1.CLASS_TO_BASE_CST_VISITOR.get(this.className);\n if (utils_1.isUndefined(cachedConstructor)) {\n var allRuleNames = cache_1.CLASS_TO_ALL_RULE_NAMES.get(this.className);\n cachedConstructor = cst_visitor_1.createBaseSemanticVisitorConstructor(this.className, allRuleNames);\n cache_1.CLASS_TO_BASE_CST_VISITOR.put(this.className, cachedConstructor);\n }\n return cachedConstructor;\n };\n Parser.prototype.getBaseCstVisitorConstructorWithDefaults = function () {\n var cachedConstructor = cache_1.CLASS_TO_BASE_CST_VISITOR_WITH_DEFAULTS.get(this.className);\n if (utils_1.isUndefined(cachedConstructor)) {\n var allRuleNames = cache_1.CLASS_TO_ALL_RULE_NAMES.get(this.className);\n var baseConstructor = this.getBaseCstVisitorConstructor();\n cachedConstructor = cst_visitor_1.createBaseVisitorConstructorWithDefaults(this.className, allRuleNames, baseConstructor);\n cache_1.CLASS_TO_BASE_CST_VISITOR_WITH_DEFAULTS.put(this.className, cachedConstructor);\n }\n return cachedConstructor;\n };\n Parser.prototype.getGAstProductions = function () {\n return cache.getProductionsForClass(this.className);\n };\n // This is more than a convenience method.\n // It is mostly used to draw the diagrams and having this method present on the parser instance\n // can avoid certain situations in which the serialization logic would fail due to multiple versions of chevrotain\n // bundled (due to multiple prototype chains and \"instanceof\" usage).\n Parser.prototype.getSerializedGastProductions = function () {\n return serializeGrammar(cache.getProductionsForClass(this.className).values());\n };\n /**\n * @param startRuleName {string}\n * @param precedingInput {IToken[]} - The token vector up to (not including) the content assist point\n * @returns {ISyntacticContentAssistPath[]}\n */\n Parser.prototype.computeContentAssist = function (startRuleName, precedingInput) {\n var startRuleGast = cache.getProductionsForClass(this.className).get(startRuleName);\n if (utils_1.isUndefined(startRuleGast)) {\n throw Error(\"Rule ->\" + startRuleName + \"<- does not exist in this grammar.\");\n }\n return interpreter_1.nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead);\n };\n Parser.prototype.isBackTracking = function () {\n return !(utils_1.isEmpty(this.isBackTrackingStack));\n };\n Parser.prototype.getCurrRuleFullName = function () {\n var shortName = this.getLastExplicitRuleShortName();\n return this.shortRuleNameToFull.get(shortName);\n };\n Parser.prototype.shortRuleNameToFullName = function (shortName) {\n return this.shortRuleNameToFull.get(shortName);\n };\n Parser.prototype.getHumanReadableRuleStack = function () {\n var _this = this;\n if (!utils_1.isEmpty(this.LAST_EXPLICIT_RULE_STACK)) {\n return utils_1.map(this.LAST_EXPLICIT_RULE_STACK, function (currIdx) { return _this.shortRuleNameToFullName(_this.RULE_STACK[currIdx]); });\n }\n else {\n return utils_1.map(this.RULE_STACK, function (currShortName) { return _this.shortRuleNameToFullName(currShortName); });\n }\n };\n Parser.prototype.SAVE_ERROR = function (error) {\n if (exceptions_public_1.exceptions.isRecognitionException(error)) {\n error.context = {\n ruleStack: this.getHumanReadableRuleStack(),\n ruleOccurrenceStack: utils_1.cloneArr(this.RULE_OCCURRENCE_STACK)\n };\n this._errors.push(error);\n return error;\n }\n else {\n throw Error(\"Trying to save an Error which is not a RecognitionException\");\n }\n };\n /**\n * @param grammarRule - The rule to try and parse in backtracking mode.\n * @param isValid - A predicate that given the result of the parse attempt will \"decide\" if the parse was successfully or not.\n *\n * @return {Function():boolean} a lookahead function that will try to parse the given grammarRule and will return true if succeed.\n */\n Parser.prototype.BACKTRACK = function (grammarRule, isValid) {\n return function () {\n // save org state\n this.isBackTrackingStack.push(1);\n var orgState = this.saveRecogState();\n try {\n var ruleResult = grammarRule.call(this);\n return isValid(ruleResult);\n }\n catch (e) {\n if (exceptions_public_1.exceptions.isRecognitionException(e)) {\n return false;\n }\n else {\n throw e;\n }\n }\n finally {\n this.reloadRecogState(orgState);\n this.isBackTrackingStack.pop();\n }\n };\n };\n // skips a token and returns the next token\n Parser.prototype.SKIP_TOKEN = function () {\n // example: assume 45 tokens in the input, if input index is 44 it means that NEXT_TOKEN will return\n // input[45] which is the 46th item and no longer exists,\n // so in this case the largest valid input index is 43 (input.length - 2 )\n if (this.inputIdx <= this._input.length - 2) {\n this.consumeToken();\n return this.LA(1);\n }\n else {\n return END_OF_FILE;\n }\n };\n // Parsing DSL\n /**\n * Convenience method equivalent to CONSUME1.\n * @see CONSUME1\n */\n Parser.prototype.CONSUME = function (tokClass) {\n return this.CONSUME1(tokClass);\n };\n /**\n *\n * A Parsing DSL method use to consume a single terminal Token.\n * a Token will be consumed, IFF the next token in the token vector is an instanceof tokClass.\n * otherwise the parser will attempt to perform error recovery.\n *\n * The index in the method name indicates the unique occurrence of a terminal consumption\n * inside a the top level rule. What this means is that if a terminal appears\n * more than once in a single rule, each appearance must have a difference index.\n *\n * for example:\n *\n * function parseQualifiedName() {\n * this.CONSUME1(Identifier);\n * this.MANY(()=> {\n * this.CONSUME1(Dot);\n * this.CONSUME2(Identifier); // <-- here we use CONSUME2 because the terminal\n * }); // 'Identifier' has already appeared previously in the\n * // the rule 'parseQualifiedName'\n * }\n *\n * @param {Function} tokClass - A constructor function specifying the type of token to be consumed.\n *\n * @returns {Token} - The consumed token.\n */\n Parser.prototype.CONSUME1 = function (tokClass) {\n return this.consumeInternal(tokClass, 1);\n };\n /**\n * @see CONSUME1\n */\n Parser.prototype.CONSUME2 = function (tokClass) {\n return this.consumeInternal(tokClass, 2);\n };\n /**\n * @see CONSUME1\n */\n Parser.prototype.CONSUME3 = function (tokClass) {\n return this.consumeInternal(tokClass, 3);\n };\n /**\n * @see CONSUME1\n */\n Parser.prototype.CONSUME4 = function (tokClass) {\n return this.consumeInternal(tokClass, 4);\n };\n /**\n * @see CONSUME1\n */\n Parser.prototype.CONSUME5 = function (tokClass) {\n return this.consumeInternal(tokClass, 5);\n };\n /**\n * Convenience method equivalent to SUBRULE1\n * @see SUBRULE1\n */\n Parser.prototype.SUBRULE = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 1, args);\n };\n /**\n * The Parsing DSL Method is used by one rule to call another.\n *\n * This may seem redundant as it does not actually do much.\n * However using it is mandatory for all sub rule invocations.\n * calling another rule without wrapping in SUBRULE(...)\n * will cause errors/mistakes in the Recognizer's self analysis,\n * which will lead to errors in error recovery/automatic lookahead calculation\n * and any other functionality relying on the Recognizer's self analysis\n * output.\n *\n * As in CONSUME the index in the method name indicates the occurrence\n * of the sub rule invocation in its rule.\n *\n * @param {Function} ruleToCall - The rule to invoke.\n * @param {*[]} args - The arguments to pass to the invoked subrule.\n * @returns {*} - The result of invoking ruleToCall.\n */\n Parser.prototype.SUBRULE1 = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 1, args);\n };\n /**\n * @see SUBRULE1\n */\n Parser.prototype.SUBRULE2 = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 2, args);\n };\n /**\n * @see SUBRULE1\n */\n Parser.prototype.SUBRULE3 = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 3, args);\n };\n /**\n * @see SUBRULE1\n */\n Parser.prototype.SUBRULE4 = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 4, args);\n };\n /**\n * @see SUBRULE1\n */\n Parser.prototype.SUBRULE5 = function (ruleToCall, args) {\n if (args === void 0) { args = undefined; }\n return this.subruleInternal(ruleToCall, 5, args);\n };\n /**\n * Convenience method equivalent to OPTION1.\n * @see OPTION1\n */\n Parser.prototype.OPTION = function (actionORMethodDef) {\n return this.OPTION1(actionORMethodDef);\n };\n /**\n * Parsing DSL Method that Indicates an Optional production\n * in EBNF notation: [...].\n *\n * Note that there are two syntax forms:\n * - Passing the grammar action directly:\n * this.OPTION(()=> {\n * this.CONSUME(Digit)}\n * );\n *\n * - using an \"options\" object:\n * this.OPTION({\n * GATE:predicateFunc,\n * DEF: ()=>{\n * this.CONSUME(Digit)\n * }});\n *\n * The optional 'GATE' property in \"options\" object form can be used to add constraints\n * to invoking the grammar action.\n *\n * As in CONSUME the index in the method name indicates the occurrence\n * of the optional production in it's top rule.\n *\n * @param actionORMethodDef - The grammar action to optionally invoke once\n * or an \"OPTIONS\" object describing the grammar action and optional properties.\n *\n * @returns {OUT}\n */\n Parser.prototype.OPTION1 = function (actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 1);\n };\n /**\n * @see OPTION1\n */\n Parser.prototype.OPTION2 = function (actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 2);\n };\n /**\n * @see OPTION1\n */\n Parser.prototype.OPTION3 = function (actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 3);\n };\n /**\n * @see OPTION1\n */\n Parser.prototype.OPTION4 = function (actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 4);\n };\n /**\n * @see OPTION1\n */\n Parser.prototype.OPTION5 = function (actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 5);\n };\n /**\n * Convenience method equivalent to OR1.\n * @see OR1\n */\n Parser.prototype.OR = function (altsOrOpts) {\n return this.OR1(altsOrOpts);\n };\n /**\n * Parsing DSL method that indicates a choice between a set of alternatives must be made.\n * This is equivalent to EBNF alternation (A | B | C | D ...)\n *\n * There are a couple of syntax forms for the inner alternatives array.\n *\n * Passing alternatives array directly:\n * this.OR([\n * {ALT:()=>{this.CONSUME(One)}},\n * {ALT:()=>{this.CONSUME(Two)}},\n * {ALT:()=>{this.CONSUME(Three)}}\n * ])\n *\n * Passing alternative array directly with predicates (GATE).\n * this.OR([\n * {GATE: predicateFunc1, ALT:()=>{this.CONSUME(One)}},\n * {GATE: predicateFuncX, ALT:()=>{this.CONSUME(Two)}},\n * {GATE: predicateFuncX, ALT:()=>{this.CONSUME(Three)}}\n * ])\n *\n * These syntax forms can also be mixed:\n * this.OR([\n * {GATE: predicateFunc1, ALT:()=>{this.CONSUME(One)}},\n * {ALT:()=>{this.CONSUME(Two)}},\n * {ALT:()=>{this.CONSUME(Three)}}\n * ])\n *\n * Additionally an \"options\" object may be used:\n * this.OR({\n * DEF:[\n * {ALT:()=>{this.CONSUME(One)}},\n * {ALT:()=>{this.CONSUME(Two)}},\n * {ALT:()=>{this.CONSUME(Three)}}\n * ],\n * // OPTIONAL property\n * ERR_MSG: \"A Number\"\n * })\n *\n * The 'predicateFuncX' in the long form can be used to add constraints to choosing the alternative.\n *\n * As in CONSUME the index in the method name indicates the occurrence\n * of the alternation production in it's top rule.\n *\n * @param altsOrOpts - A set of alternatives or an \"OPTIONS\" object describing the alternatives and optional properties.\n *\n * @returns {*} - The result of invoking the chosen alternative.\n */\n Parser.prototype.OR1 = function (altsOrOpts) {\n return this.orInternal(altsOrOpts, 1);\n };\n /**\n * @see OR1\n */\n Parser.prototype.OR2 = function (altsOrOpts) {\n return this.orInternal(altsOrOpts, 2);\n };\n /**\n * @see OR1\n */\n Parser.prototype.OR3 = function (altsOrOpts) {\n return this.orInternal(altsOrOpts, 3);\n };\n /**\n * @see OR1\n */\n Parser.prototype.OR4 = function (altsOrOpts) {\n return this.orInternal(altsOrOpts, 4);\n };\n /**\n * @see OR1\n */\n Parser.prototype.OR5 = function (altsOrOpts) {\n return this.orInternal(altsOrOpts, 5);\n };\n /**\n * Convenience method equivalent to MANY1.\n * @see MANY1\n */\n Parser.prototype.MANY = function (actionORMethodDef) {\n return this.MANY1(actionORMethodDef);\n };\n /**\n * Parsing DSL method, that indicates a repetition of zero or more.\n * This is equivalent to EBNF repetition {...}.\n *\n * Note that there are two syntax forms:\n * - Passing the grammar action directly:\n * this.MANY(()=>{\n * this.CONSUME(Comma)\n * this.CONSUME(Digit)\n * })\n *\n * - using an \"options\" object:\n * this.MANY({\n * GATE: predicateFunc,\n * DEF: () => {\n * this.CONSUME(Comma)\n * this.CONSUME(Digit)\n * }\n * });\n *\n * The optional 'GATE' property in \"options\" object form can be used to add constraints\n * to invoking the grammar action.\n *\n * As in CONSUME the index in the method name indicates the occurrence\n * of the repetition production in it's top rule.\n *\n * @param {Function} actionORMethodDef - The grammar action to optionally invoke multiple times\n * or an \"OPTIONS\" object describing the grammar action and optional properties.\n *\n * @returns {OUT[]}\n */\n Parser.prototype.MANY1 = function (actionORMethodDef) {\n return this.manyInternal(1, actionORMethodDef, []);\n };\n /**\n * @see MANY1\n */\n Parser.prototype.MANY2 = function (actionORMethodDef) {\n return this.manyInternal(2, actionORMethodDef, []);\n };\n /**\n * @see MANY1\n */\n Parser.prototype.MANY3 = function (actionORMethodDef) {\n return this.manyInternal(3, actionORMethodDef, []);\n };\n /**\n * @see MANY1\n */\n Parser.prototype.MANY4 = function (actionORMethodDef) {\n return this.manyInternal(4, actionORMethodDef, []);\n };\n /**\n * @see MANY1\n */\n Parser.prototype.MANY5 = function (actionORMethodDef) {\n return this.manyInternal(5, actionORMethodDef, []);\n };\n /**\n * Convenience method equivalent to MANY_SEP1.\n * @see MANY_SEP1\n */\n Parser.prototype.MANY_SEP = function (options) {\n return this.MANY_SEP1(options);\n };\n /**\n * Parsing DSL method, that indicates a repetition of zero or more with a separator\n * Token between the repetitions.\n *\n * Example:\n *\n * this.MANY_SEP({\n * SEP:Comma,\n * DEF: () => {\n * this.CONSUME(Number};\n * ...\n * );\n * })\n *\n * Note that because this DSL method always requires more than one argument the options object is always required\n * and it is not possible to use a shorter form like in the MANY DSL method.\n *\n * Note that for the purposes of deciding on whether or not another iteration exists\n * Only a single Token is examined (The separator). Therefore if the grammar being implemented is\n * so \"crazy\" to require multiple tokens to identify an item separator please use the more basic DSL methods\n * to implement it.\n *\n * As in CONSUME the index in the method name indicates the occurrence\n * of the repetition production in it's top rule.\n *\n * Note that due to current limitations in the implementation the \"SEP\" property must appear BEFORE the \"DEF\" property.\n *\n * @param options - An object defining the grammar of each iteration and the separator between iterations\n *\n * @return {ISeparatedIterationResult<OUT>}\n */\n Parser.prototype.MANY_SEP1 = function (options) {\n return this.manySepFirstInternal(1, options, { values: [], separators: [] });\n };\n /**\n * @see MANY_SEP1\n */\n Parser.prototype.MANY_SEP2 = function (options) {\n return this.manySepFirstInternal(2, options, { values: [], separators: [] });\n };\n /**\n * @see MANY_SEP1\n */\n Parser.prototype.MANY_SEP3 = function (options) {\n return this.manySepFirstInternal(3, options, { values: [], separators: [] });\n };\n /**\n * @see MANY_SEP1\n */\n Parser.prototype.MANY_SEP4 = function (options) {\n return this.manySepFirstInternal(4, options, { values: [], separators: [] });\n };\n /**\n * @see MANY_SEP1\n */\n Parser.prototype.MANY_SEP5 = function (options) {\n return this.manySepFirstInternal(5, options, { values: [], separators: [] });\n };\n /**\n * Convenience method equivalent to AT_LEAST_ONE1.\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE = function (actionORMethodDef) {\n return this.AT_LEAST_ONE1(actionORMethodDef);\n };\n /**\n * Convenience method, same as MANY but the repetition is of one or more.\n * failing to match at least one repetition will result in a parsing error and\n * cause a parsing error.\n *\n * @see MANY1\n *\n * @param actionORMethodDef - The grammar action to optionally invoke multiple times\n * or an \"OPTIONS\" object describing the grammar action and optional properties.\n *\n * @return {OUT[]}\n */\n Parser.prototype.AT_LEAST_ONE1 = function (actionORMethodDef) {\n return this.atLeastOneInternal(1, actionORMethodDef, []);\n };\n /**\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE2 = function (actionORMethodDef) {\n return this.atLeastOneInternal(2, actionORMethodDef, []);\n };\n /**\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE3 = function (actionORMethodDef) {\n return this.atLeastOneInternal(3, actionORMethodDef, []);\n };\n /**\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE4 = function (actionORMethodDef) {\n return this.atLeastOneInternal(4, actionORMethodDef, []);\n };\n /**\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE5 = function (actionORMethodDef) {\n return this.atLeastOneInternal(5, actionORMethodDef, []);\n };\n /**\n * Convenience method equivalent to AT_LEAST_ONE_SEP1.\n * @see AT_LEAST_ONE1\n */\n Parser.prototype.AT_LEAST_ONE_SEP = function (options) {\n return this.AT_LEAST_ONE_SEP1(options);\n };\n /**\n * Convenience method, same as MANY_SEP but the repetition is of one or more.\n * failing to match at least one repetition will result in a parsing error and\n * cause the parser to attempt error recovery.\n *\n * Note that an additional optional property ERR_MSG can be used to provide custom error messages.\n *\n * @see MANY_SEP1\n *\n * @param options - An object defining the grammar of each iteration and the separator between iterations\n *\n * @return {ISeparatedIterationResult<OUT>}\n */\n Parser.prototype.AT_LEAST_ONE_SEP1 = function (options) {\n return this.atLeastOneSepFirstInternal(1, options, { values: [], separators: [] });\n };\n /**\n * @see AT_LEAST_ONE_SEP1\n */\n Parser.prototype.AT_LEAST_ONE_SEP2 = function (options) {\n return this.atLeastOneSepFirstInternal(2, options, { values: [], separators: [] });\n };\n /**\n * @see AT_LEAST_ONE_SEP1\n */\n Parser.prototype.AT_LEAST_ONE_SEP3 = function (options) {\n return this.atLeastOneSepFirstInternal(3, options, { values: [], separators: [] });\n };\n /**\n * @see AT_LEAST_ONE_SEP1\n */\n Parser.prototype.AT_LEAST_ONE_SEP4 = function (options) {\n return this.atLeastOneSepFirstInternal(4, options, { values: [], separators: [] });\n };\n /**\n * @see AT_LEAST_ONE_SEP1\n */\n Parser.prototype.AT_LEAST_ONE_SEP5 = function (options) {\n return this.atLeastOneSepFirstInternal(5, options, { values: [], separators: [] });\n };\n /**\n *\n * @param {string} name - The name of the rule.\n * @param {Function} implementation - The implementation of the rule.\n * @param {IRuleConfig} [config] - The rule's optional configuration.\n *\n * @returns {Function} - The parsing rule which is the production implementation wrapped with the parsing logic that handles\n * Parser state / error recovery&reporting/ ...\n */\n Parser.prototype.RULE = function (name, implementation, \n // TODO: how to describe the optional return type of CSTNode? T|CstNode is not good because it is not backward\n // compatible, T|any is very general...\n config) {\n // TODO: how to describe the optional return type of CSTNode? T|CstNode is not good because it is not backward\n // compatible, T|any is very general...\n if (config === void 0) { config = DEFAULT_RULE_CONFIG; }\n var ruleErrors = checks_1.validateRuleName(name);\n ruleErrors = ruleErrors.concat(checks_1.validateRuleDoesNotAlreadyExist(name, this.definedRulesNames, this.className));\n this.definedRulesNames.push(name);\n this.definitionErrors.push.apply(this.definitionErrors, ruleErrors); // mutability for the win\n // only build the gast representation once.\n if (!(this._productions.containsKey(name))) {\n var gastProduction = gast_builder_1.buildTopProduction(implementation.toString(), name, this.tokensMap);\n this._productions.put(name, gastProduction);\n }\n else {\n var parserClassProductions = cache.getProductionsForClass(this.className);\n var cachedProduction = parserClassProductions.get(name);\n // in case of duplicate rules the cache will not be filled at this point.\n if (!utils_1.isUndefined(cachedProduction)) {\n // filling up the _productions is always needed to inheriting grammars can access it (as an instance member)\n // otherwise they will be unaware of productions defined in super grammars.\n this._productions.put(name, cachedProduction);\n }\n }\n var ruleImplementation = this.defineRule(name, implementation, config);\n this[name] = ruleImplementation;\n return ruleImplementation;\n };\n /**\n * @See RULE\n * Same as RULE, but should only be used in \"extending\" grammars to override rules/productions\n * from the super grammar.\n */\n Parser.prototype.OVERRIDE_RULE = function (name, impl, config) {\n if (config === void 0) { config = DEFAULT_RULE_CONFIG; }\n var ruleErrors = checks_1.validateRuleName(name);\n ruleErrors = ruleErrors.concat(checks_1.validateRuleIsOverridden(name, this.definedRulesNames, this.className));\n this.definitionErrors.push.apply(this.definitionErrors, ruleErrors); // mutability for the win\n var alreadyOverridden = cache.getProductionOverriddenForClass(this.className);\n // only build the GAST of an overridden rule once.\n if (!alreadyOverridden.containsKey(name)) {\n alreadyOverridden.put(name, true);\n var gastProduction = gast_builder_1.buildTopProduction(impl.toString(), name, this.tokensMap);\n this._productions.put(name, gastProduction);\n }\n else {\n var parserClassProductions = cache.getProductionsForClass(this.className);\n // filling up the _productions is always needed to inheriting grammars can access it (as an instance member)\n // otherwise they will be unaware of productions defined in super grammars.\n this._productions.put(name, parserClassProductions.get(name));\n }\n return this.defineRule(name, impl, config);\n };\n Parser.prototype.ruleInvocationStateUpdate = function (shortName, fullName, idxInCallingRule) {\n this.RULE_OCCURRENCE_STACK.push(idxInCallingRule);\n this.RULE_STACK.push(shortName);\n // NOOP when cst is disabled\n this.cstInvocationStateUpdate(fullName, shortName);\n };\n Parser.prototype.ruleFinallyStateUpdate = function () {\n this.RULE_STACK.pop();\n this.RULE_OCCURRENCE_STACK.pop();\n // NOOP when cst is disabled\n this.cstFinallyStateUpdate();\n if ((this.RULE_STACK.length === 0) && !this.isAtEndOfInput()) {\n var firstRedundantTok = this.LA(1);\n this.SAVE_ERROR(new exceptions_public_1.exceptions.NotAllInputParsedException(\"Redundant input, expecting EOF but found: \" + firstRedundantTok.image, firstRedundantTok));\n }\n };\n Parser.prototype.nestedRuleInvocationStateUpdate = function (nestedRuleName, shortNameKey) {\n this.RULE_OCCURRENCE_STACK.push(1);\n this.RULE_STACK.push(shortNameKey);\n this.cstNestedInvocationStateUpdate(nestedRuleName, shortNameKey);\n };\n Parser.prototype.nestedRuleFinallyStateUpdate = function () {\n this.RULE_STACK.pop();\n this.RULE_OCCURRENCE_STACK.pop();\n // NOOP when cst is disabled\n this.cstNestedFinallyStateUpdate();\n };\n /**\n * Returns an \"imaginary\" Token to insert when Single Token Insertion is done\n * Override this if you require special behavior in your grammar.\n * For example if an IntegerToken is required provide one with the image '0' so it would be valid syntactically.\n */\n Parser.prototype.getTokenToInsert = function (tokClass) {\n var tokToInsert = tokens_public_1.createTokenInstance(tokClass, \"\", NaN, NaN, NaN, NaN, NaN, NaN);\n tokToInsert.isInsertedInRecovery = true;\n return tokToInsert;\n };\n /**\n * By default all tokens type may be inserted. This behavior may be overridden in inheriting Recognizers\n * for example: One may decide that only punctuation tokens may be inserted automatically as they have no additional\n * semantic value. (A mandatory semicolon has no additional semantic meaning, but an Integer may have additional meaning\n * depending on its int value and context (Inserting an integer 0 in cardinality: \"[1..]\" will cause semantic issues\n * as the max of the cardinality will be greater than the min value (and this is a false error!).\n */\n Parser.prototype.canTokenTypeBeInsertedInRecovery = function (tokClass) {\n return true;\n };\n /**\n * @param {Token} actualToken - The actual unexpected (mismatched) Token instance encountered.\n * @param {Function} expectedTokType - The Class of the expected Token.\n * @returns {string} - The error message saved as part of a MismatchedTokenException.\n */\n Parser.prototype.getMisMatchTokenErrorMessage = function (expectedTokType, actualToken) {\n var hasLabel = tokens_public_1.hasTokenLabel(expectedTokType);\n var expectedMsg = hasLabel ?\n \"--> \" + tokens_public_1.tokenLabel(expectedTokType) + \" <--\" :\n \"token of type --> \" + tokens_public_1.tokenName(expectedTokType) + \" <--\";\n var msg = \"Expecting \" + expectedMsg + \" but found --> '\" + actualToken.image + \"' <--\";\n return msg;\n };\n Parser.prototype.getCurrentGrammarPath = function (tokClass, tokIdxInRule) {\n var pathRuleStack = this.getHumanReadableRuleStack();\n var pathOccurrenceStack = utils_1.cloneArr(this.RULE_OCCURRENCE_STACK);\n var grammarPath = {\n ruleStack: pathRuleStack,\n occurrenceStack: pathOccurrenceStack,\n lastTok: tokClass,\n lastTokOccurrence: tokIdxInRule\n };\n return grammarPath;\n };\n // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...\n // TODO: should this be more explicitly part of the public API?\n Parser.prototype.getNextPossibleTokenTypes = function (grammarPath) {\n var topRuleName = utils_1.first(grammarPath.ruleStack);\n var gastProductions = this.getGAstProductions();\n var topProduction = gastProductions.get(topRuleName);\n var nextPossibleTokenTypes = new interpreter_1.NextAfterTokenWalker(topProduction, grammarPath).startWalking();\n return nextPossibleTokenTypes;\n };\n Parser.prototype.subruleInternal = function (ruleToCall, idx, args) {\n var ruleResult = ruleToCall.call(this, idx, args);\n this.cstPostNonTerminal(ruleResult, ruleToCall.ruleName);\n return ruleResult;\n };\n /**\n * @param tokClass - The Type of Token we wish to consume (Reference to its constructor function).\n * @param idx - Occurrence index of consumed token in the invoking parser rule text\n * for example:\n * IDENT (DOT IDENT)*\n * the first ident will have idx 1 and the second one idx 2\n * * note that for the second ident the idx is always 2 even if its invoked 30 times in the same rule\n * the idx is about the position in grammar (source code) and has nothing to do with a specific invocation\n * details.\n *\n * @returns {Token} - The consumed Token.\n */\n Parser.prototype.consumeInternal = function (tokClass, idx) {\n // TODO: this is an hack to avoid try catch block in V8, should be removed once V8 supports try/catch optimizations.\n // as the IF/ELSE itself has some overhead.\n var consumedToken;\n if (!this.recoveryEnabled) {\n consumedToken = this.consumeInternalOptimized(tokClass);\n }\n else {\n consumedToken = this.consumeInternalWithTryCatch(tokClass, idx);\n }\n this.cstPostTerminal(tokClass, consumedToken);\n return consumedToken;\n };\n Parser.prototype.consumeInternalWithTryCatch = function (tokClass, idx) {\n try {\n return this.consumeInternalOptimized(tokClass);\n }\n catch (eFromConsumption) {\n // no recovery allowed during backtracking, otherwise backtracking may recover invalid syntax and accept it\n // but the original syntax could have been parsed successfully without any backtracking + recovery\n if (this.recoveryEnabled &&\n // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?\n eFromConsumption.name === \"MismatchedTokenException\" && !this.isBackTracking()) {\n var follows = this.getFollowsForInRuleRecovery(tokClass, idx);\n try {\n return this.tryInRuleRecovery(tokClass, follows);\n }\n catch (eFromInRuleRecovery) {\n if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {\n // failed in RuleRecovery.\n // throw the original error in order to trigger reSync error recovery\n throw eFromConsumption;\n }\n else {\n throw eFromInRuleRecovery;\n }\n }\n }\n else {\n throw eFromConsumption;\n }\n }\n };\n /**\n * Convenience method equivalent to LA(1)\n * It is no longer used directly in chevrotain due to\n * performance considerations (avoid the need for inlining optimizations).\n *\n * But it is maintained for backward compatibility reasons.\n *\n * @deprecated\n */\n Parser.prototype.NEXT_TOKEN = function () {\n return this.LA(1);\n };\n // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers\n // or lexers dependent on parser context.\n Parser.prototype.LA = function (howMuch) {\n if (this._input.length <= this.inputIdx + howMuch) {\n return END_OF_FILE;\n }\n else {\n return this._input[this.inputIdx + howMuch];\n }\n };\n Parser.prototype.consumeToken = function () {\n this.inputIdx++;\n };\n Parser.prototype.saveLexerState = function () {\n this.savedTokenIdx = this.inputIdx;\n };\n Parser.prototype.restoreLexerState = function () {\n this.inputIdx = this.savedTokenIdx;\n };\n Parser.prototype.resetLexerState = function () {\n this.inputIdx = -1;\n };\n Parser.prototype.moveLexerStateToEnd = function () {\n this.inputIdx = this.input.length - 1;\n };\n // other functionality\n Parser.prototype.saveRecogState = function () {\n // errors is a getter which will clone the errors array\n var savedErrors = this.errors;\n var savedRuleStack = utils_1.cloneArr(this.RULE_STACK);\n return {\n errors: savedErrors,\n lexerState: this.inputIdx,\n RULE_STACK: savedRuleStack,\n CST_STACK: this.CST_STACK,\n LAST_EXPLICIT_RULE_STACK: this.LAST_EXPLICIT_RULE_STACK\n };\n };\n Parser.prototype.reloadRecogState = function (newState) {\n this.errors = newState.errors;\n this.inputIdx = newState.lexerState;\n this.RULE_STACK = newState.RULE_STACK;\n };\n Parser.prototype.invokeRuleNoTryNoCst = function (args, impl) {\n var result = impl.apply(this, args);\n this.ruleFinallyStateUpdate();\n return result;\n };\n Parser.prototype.invokeRuleNoTry = function (args, impl) {\n impl.apply(this, args);\n var result = this.CST_STACK[this.CST_STACK.length - 1];\n this.ruleFinallyStateUpdate();\n return result;\n };\n Parser.prototype.defineRule = function (ruleName, impl, config) {\n if (this.selfAnalysisDone) {\n throw Error(\"Grammar rule <\" + ruleName + \"> may not be defined after the 'performSelfAnalysis' method has been called'\\n\" +\n \"Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.\");\n }\n var resyncEnabled = utils_1.has(config, \"resyncEnabled\") ?\n config.resyncEnabled :\n DEFAULT_RULE_CONFIG.resyncEnabled;\n var recoveryValueFunc = utils_1.has(config, \"recoveryValueFunc\") ?\n config.recoveryValueFunc :\n DEFAULT_RULE_CONFIG.recoveryValueFunc;\n // performance optimization: Use small integers as keys for the longer human readable \"full\" rule names.\n // this greatly improves Map access time (as much as 8% for some performance benchmarks).\n /* tslint:disable */\n var shortName = this.ruleShortNameIdx << (keys_1.BITS_FOR_METHOD_IDX + keys_1.BITS_FOR_OCCURRENCE_IDX);\n /* tslint:enable */\n this.ruleShortNameIdx++;\n this.shortRuleNameToFull.put(shortName, ruleName);\n this.fullRuleNameToShort.put(ruleName, shortName);\n function invokeRuleWithTry(args, isFirstRule) {\n try {\n // TODO: dynamically get rid of this?\n if (this.outputCst) {\n impl.apply(this, args);\n return this.CST_STACK[this.CST_STACK.length - 1];\n }\n else {\n return impl.apply(this, args);\n }\n }\n catch (e) {\n // TODO: this is part of a Performance hack for V8 due to lack of support\n // of try/catch optimizations. Should be removed once V8 supports that.\n // This is needed because in case of an error during a nested subRule\n // there will be no \"finally\" block to perform the \"ruleFinallyStateUpdate\"\n // So this block properly rewinds the parser's state in the case error recovery is disabled.\n if (isFirstRule) {\n for (var i = this.RULE_STACK.length; i > 1; i--) {\n this.ruleFinallyStateUpdate();\n }\n }\n var isFirstInvokedRule = (this.RULE_STACK.length === 1);\n // note the reSync is always enabled for the first rule invocation, because we must always be able to\n // reSync with EOF and just output some INVALID ParseTree\n // during backtracking reSync recovery is disabled, otherwise we can't be certain the backtracking\n // path is really the most valid one\n var reSyncEnabled = resyncEnabled && !this.isBackTracking() && this.recoveryEnabled;\n if (exceptions_public_1.exceptions.isRecognitionException(e)) {\n if (reSyncEnabled) {\n var reSyncTokType = this.findReSyncTokenType();\n if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {\n e.resyncedTokens = this.reSyncTo(reSyncTokType);\n if (this.outputCst) {\n var partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n return partialCstResult;\n }\n else {\n return recoveryValueFunc();\n }\n }\n else {\n if (this.outputCst) {\n // recovery is only for \"real\" non nested rules\n var prevRuleShortName = this.getLastExplicitRuleShortNameNoCst();\n var preRuleFullName = this.shortRuleNameToFull.get(prevRuleShortName);\n var partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n this.cstPostNonTerminalRecovery(partialCstResult, preRuleFullName);\n }\n // to be handled farther up the call stack\n throw e;\n }\n }\n else if (isFirstInvokedRule) {\n // otherwise a Redundant input error will be created as well and we cannot guarantee that this is indeed the case\n this.moveLexerStateToEnd();\n // the parser should never throw one of its own errors outside its flow.\n // even if error recovery is disabled\n return recoveryValueFunc();\n }\n else {\n // to be handled farther up the call stack\n throw e;\n }\n }\n else {\n // some other Error type which we don't know how to handle (for example a built in JavaScript Error)\n throw e;\n }\n }\n finally {\n this.ruleFinallyStateUpdate();\n }\n }\n var wrappedGrammarRule;\n if (this.recoveryEnabled) {\n wrappedGrammarRule = function (idxInCallingRule, args) {\n if (idxInCallingRule === void 0) { idxInCallingRule = 1; }\n this.ruleInvocationStateUpdate(shortName, ruleName, idxInCallingRule);\n // TODO: performance hack due to V8 lack of try/catch optimizations.\n // should be removed once V8 support those.\n var isFirstRule = this.RULE_STACK.length === 1;\n return invokeRuleWithTry.call(this, args, isFirstRule);\n };\n }\n else {\n wrappedGrammarRule = function (idxInCallingRule, args) {\n if (idxInCallingRule === void 0) { idxInCallingRule = 1; }\n this.ruleInvocationStateUpdate(shortName, ruleName, idxInCallingRule);\n // TODO: performance hack due to V8 lack of try/catch optimizations.\n // should be removed once V8 support those.\n var isFirstRule = this.RULE_STACK.length === 1;\n if (!isFirstRule) {\n return this.invokeRuleNoTry(args, impl);\n }\n else {\n return invokeRuleWithTry.call(this, args, isFirstRule);\n }\n };\n }\n var ruleNamePropName = \"ruleName\";\n wrappedGrammarRule[ruleNamePropName] = ruleName;\n return wrappedGrammarRule;\n };\n Parser.prototype.tryInRepetitionRecovery = function (grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {\n var _this = this;\n // TODO: can the resyncTokenType be cached?\n var reSyncTokType = this.findReSyncTokenType();\n this.saveLexerState();\n var resyncedTokens = [];\n var passedResyncPoint = false;\n var nextTokenWithoutResync = this.LA(1);\n var currToken = this.LA(1);\n var generateErrorMessage = function () {\n // we are preemptively re-syncing before an error has been detected, therefor we must reproduce\n // the error that would have been thrown\n var msg = _this.getMisMatchTokenErrorMessage(expectedTokType, nextTokenWithoutResync);\n var error = new exceptions_public_1.exceptions.MismatchedTokenException(msg, nextTokenWithoutResync);\n // the first token here will be the original cause of the error, this is not part of the resyncedTokens property.\n error.resyncedTokens = utils_1.dropRight(resyncedTokens);\n _this.SAVE_ERROR(error);\n };\n while (!passedResyncPoint) {\n // re-synced to a point where we can safely exit the repetition/\n if (this.tokenMatcher(currToken, expectedTokType)) {\n generateErrorMessage();\n return; // must return here to avoid reverting the inputIdx\n }\n else if (lookAheadFunc.call(this)) {\n generateErrorMessage();\n // recursive invocation in other to support multiple re-syncs in the same top level repetition grammar rule\n grammarRule.apply(this, grammarRuleArgs);\n return; // must return here to avoid reverting the inputIdx\n }\n else if (this.tokenMatcher(currToken, reSyncTokType)) {\n passedResyncPoint = true;\n }\n else {\n currToken = this.SKIP_TOKEN();\n this.addToResyncTokens(currToken, resyncedTokens);\n }\n }\n // we were unable to find a CLOSER point to resync inside the Repetition, reset the state.\n // The parsing exception we were trying to prevent will happen in the NEXT parsing step. it may be handled by\n // \"between rules\" resync recovery later in the flow.\n this.restoreLexerState();\n };\n Parser.prototype.shouldInRepetitionRecoveryBeTried = function (expectTokAfterLastMatch, nextTokIdx) {\n // arguments to try and perform resync into the next iteration of the many are missing\n if (expectTokAfterLastMatch === undefined || nextTokIdx === undefined) {\n return false;\n }\n // no need to recover, next token is what we expect...\n if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {\n return false;\n }\n // error recovery is disabled during backtracking as it can make the parser ignore a valid grammar path\n // and prefer some backtracking path that includes recovered errors.\n if (this.isBackTracking()) {\n return false;\n }\n // if we can perform inRule recovery (single token insertion or deletion) we always prefer that recovery algorithm\n // because if it works, it makes the least amount of changes to the input stream (greedy algorithm)\n //noinspection RedundantIfStatementJS\n if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) {\n return false;\n }\n return true;\n };\n // Error Recovery functionality\n Parser.prototype.getFollowsForInRuleRecovery = function (tokClass, tokIdxInRule) {\n var grammarPath = this.getCurrentGrammarPath(tokClass, tokIdxInRule);\n var follows = this.getNextPossibleTokenTypes(grammarPath);\n return follows;\n };\n Parser.prototype.tryInRuleRecovery = function (expectedTokType, follows) {\n if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {\n var tokToInsert = this.getTokenToInsert(expectedTokType);\n return tokToInsert;\n }\n if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {\n var nextTok = this.SKIP_TOKEN();\n this.consumeToken();\n return nextTok;\n }\n throw new InRuleRecoveryException(\"sad sad panda\");\n };\n Parser.prototype.canPerformInRuleRecovery = function (expectedToken, follows) {\n return this.canRecoverWithSingleTokenInsertion(expectedToken, follows) ||\n this.canRecoverWithSingleTokenDeletion(expectedToken);\n };\n Parser.prototype.canRecoverWithSingleTokenInsertion = function (expectedTokType, follows) {\n var _this = this;\n if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {\n return false;\n }\n // must know the possible following tokens to perform single token insertion\n if (utils_1.isEmpty(follows)) {\n return false;\n }\n var mismatchedTok = this.LA(1);\n var isMisMatchedTokInFollows = utils_1.find(follows, function (possibleFollowsTokType) {\n return _this.tokenMatcher(mismatchedTok, possibleFollowsTokType);\n }) !== undefined;\n return isMisMatchedTokInFollows;\n };\n Parser.prototype.canRecoverWithSingleTokenDeletion = function (expectedTokType) {\n var isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType);\n return isNextTokenWhatIsExpected;\n };\n Parser.prototype.isInCurrentRuleReSyncSet = function (tokenType) {\n var followKey = this.getCurrFollowKey();\n var currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey);\n return utils_1.contains(currentRuleReSyncSet, tokenType);\n };\n Parser.prototype.findReSyncTokenType = function () {\n var allPossibleReSyncTokTypes = this.flattenFollowSet();\n // this loop will always terminate as EOF is always in the follow stack and also always (virtually) in the input\n var nextToken = this.LA(1);\n var k = 2;\n while (true) {\n var nextTokenType = tokens_public_1.getTokenConstructor(nextToken);\n if (utils_1.contains(allPossibleReSyncTokTypes, nextTokenType)) {\n return nextTokenType;\n }\n nextToken = this.LA(k);\n k++;\n }\n };\n Parser.prototype.getCurrFollowKey = function () {\n // the length is at least one as we always add the ruleName to the stack before invoking the rule.\n if (this.RULE_STACK.length === 1) {\n return EOF_FOLLOW_KEY;\n }\n var currRuleShortName = this.getLastExplicitRuleShortName();\n var prevRuleShortName = this.getPreviousExplicitRuleShortName();\n var prevRuleIdx = this.getPreviousExplicitRuleOccurenceIndex();\n return {\n ruleName: this.shortRuleNameToFullName(currRuleShortName),\n idxInCallingRule: prevRuleIdx,\n inRule: this.shortRuleNameToFullName(prevRuleShortName)\n };\n };\n Parser.prototype.buildFullFollowKeyStack = function () {\n var _this = this;\n var explicitRuleStack = this.RULE_STACK;\n var explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK;\n if (!utils_1.isEmpty(this.LAST_EXPLICIT_RULE_STACK)) {\n explicitRuleStack = utils_1.map(this.LAST_EXPLICIT_RULE_STACK, function (idx) { return _this.RULE_STACK[idx]; });\n explicitOccurrenceStack = utils_1.map(this.LAST_EXPLICIT_RULE_STACK, function (idx) { return _this.RULE_OCCURRENCE_STACK[idx]; });\n }\n // TODO: only iterate over explicit rules here\n return utils_1.map(explicitRuleStack, function (ruleName, idx) {\n if (idx === 0) {\n return EOF_FOLLOW_KEY;\n }\n return {\n ruleName: _this.shortRuleNameToFullName(ruleName),\n idxInCallingRule: explicitOccurrenceStack[idx],\n inRule: _this.shortRuleNameToFullName(explicitRuleStack[idx - 1])\n };\n });\n };\n Parser.prototype.flattenFollowSet = function () {\n var _this = this;\n var followStack = utils_1.map(this.buildFullFollowKeyStack(), function (currKey) {\n return _this.getFollowSetFromFollowKey(currKey);\n });\n return utils_1.flatten(followStack);\n };\n Parser.prototype.getFollowSetFromFollowKey = function (followKey) {\n if (followKey === EOF_FOLLOW_KEY) {\n return [tokens_public_1.EOF];\n }\n var followName = followKey.ruleName + followKey.idxInCallingRule + constants_1.IN + followKey.inRule;\n return cache.getResyncFollowsForClass(this.className).get(followName);\n };\n // It does not make any sense to include a virtual EOF token in the list of resynced tokens\n // as EOF does not really exist and thus does not contain any useful information (line/column numbers)\n Parser.prototype.addToResyncTokens = function (token, resyncTokens) {\n if (!this.tokenMatcher(token, tokens_public_1.EOF)) {\n resyncTokens.push(token);\n }\n return resyncTokens;\n };\n Parser.prototype.reSyncTo = function (tokClass) {\n var resyncedTokens = [];\n var nextTok = this.LA(1);\n while ((this.tokenMatcher(nextTok, tokClass)) === false) {\n nextTok = this.SKIP_TOKEN();\n this.addToResyncTokens(nextTok, resyncedTokens);\n }\n // the last token is not part of the error.\n return utils_1.dropRight(resyncedTokens);\n };\n Parser.prototype.attemptInRepetitionRecovery = function (prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker) {\n var key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence);\n var firstAfterRepInfo = this.firstAfterRepMap.get(key);\n if (firstAfterRepInfo === undefined) {\n var currRuleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions().get(currRuleName);\n var walker = new nextToksWalker(ruleGrammar, prodOccurrence);\n firstAfterRepInfo = walker.startWalking();\n this.firstAfterRepMap.put(key, firstAfterRepInfo);\n }\n var expectTokAfterLastMatch = firstAfterRepInfo.token;\n var nextTokIdx = firstAfterRepInfo.occurrence;\n var isEndOfRule = firstAfterRepInfo.isEndOfRule;\n // special edge case of a TOP most repetition after which the input should END.\n // this will force an attempt for inRule recovery in that scenario.\n if (this.RULE_STACK.length === 1 &&\n isEndOfRule &&\n expectTokAfterLastMatch === undefined) {\n expectTokAfterLastMatch = tokens_public_1.EOF;\n nextTokIdx = 1;\n }\n if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx)) {\n // TODO: performance optimization: instead of passing the original args here, we modify\n // the args param (or create a new one) and make sure the lookahead func is explicitly provided\n // to avoid searching the cache for it once more.\n this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch);\n }\n };\n Parser.prototype.cstNestedInvocationStateUpdate = function (nestedName, shortName) {\n var initDef = this.cstDictDefForRule.get(shortName);\n this.CST_STACK.push({\n name: nestedName,\n fullName: this.shortRuleNameToFull.get(this.getLastExplicitRuleShortName()) + nestedName,\n children: initDef()\n });\n };\n Parser.prototype.cstInvocationStateUpdate = function (fullRuleName, shortName) {\n this.LAST_EXPLICIT_RULE_STACK.push(this.RULE_STACK.length - 1);\n var initDef = this.cstDictDefForRule.get(shortName);\n this.CST_STACK.push({\n name: fullRuleName,\n children: initDef()\n });\n };\n Parser.prototype.cstFinallyStateUpdate = function () {\n this.LAST_EXPLICIT_RULE_STACK.pop();\n this.CST_STACK.pop();\n };\n Parser.prototype.cstNestedFinallyStateUpdate = function () {\n this.CST_STACK.pop();\n };\n // Implementation of parsing DSL\n Parser.prototype.optionInternal = function (actionORMethodDef, occurrence) {\n var key = this.getKeyForAutomaticLookahead(keys_1.OPTION_IDX, occurrence);\n var nestedName = this.nestedRuleBeforeClause(actionORMethodDef, key);\n try {\n return this.optionInternalLogic(actionORMethodDef, occurrence, key);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(key, nestedName);\n }\n }\n };\n Parser.prototype.optionInternalNoCst = function (actionORMethodDef, occurrence) {\n var key = this.getKeyForAutomaticLookahead(keys_1.OPTION_IDX, occurrence);\n return this.optionInternalLogic(actionORMethodDef, occurrence, key);\n };\n Parser.prototype.optionInternalLogic = function (actionORMethodDef, occurrence, key) {\n var _this = this;\n var lookAheadFunc = this.getLookaheadFuncForOption(key, occurrence);\n var action;\n var predicate;\n if (actionORMethodDef.DEF !== undefined) {\n action = actionORMethodDef.DEF;\n predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n var orgLookaheadFunction_1 = lookAheadFunc;\n lookAheadFunc = function () {\n return predicate.call(_this) &&\n orgLookaheadFunction_1.call(_this);\n };\n }\n }\n else {\n action = actionORMethodDef;\n }\n if ((lookAheadFunc).call(this)) {\n return action.call(this);\n }\n return undefined;\n };\n Parser.prototype.atLeastOneInternal = function (prodOccurrence, actionORMethodDef, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_IDX, prodOccurrence);\n var nestedName = this.nestedRuleBeforeClause(actionORMethodDef, laKey);\n try {\n return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, result, laKey);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(laKey, nestedName);\n }\n }\n };\n Parser.prototype.atLeastOneInternalNoCst = function (prodOccurrence, actionORMethodDef, result) {\n var key = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_IDX, prodOccurrence);\n return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, result, key);\n };\n Parser.prototype.atLeastOneInternalLogic = function (prodOccurrence, actionORMethodDef, result, key) {\n var _this = this;\n var lookAheadFunc = this.getLookaheadFuncForAtLeastOne(key, prodOccurrence);\n var action;\n var predicate;\n if (actionORMethodDef.DEF !== undefined) {\n action = actionORMethodDef.DEF;\n predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n var orgLookaheadFunction_2 = lookAheadFunc;\n lookAheadFunc = function () {\n return predicate.call(_this) &&\n orgLookaheadFunction_2.call(_this);\n };\n }\n }\n else {\n action = actionORMethodDef;\n }\n if (lookAheadFunc.call(this)) {\n result.push(action.call(this));\n while (lookAheadFunc.call(this)) {\n result.push(action.call(this));\n }\n }\n else {\n throw this.raiseEarlyExitException(prodOccurrence, lookahead_1.PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG);\n }\n // note that while it may seem that this can cause an error because by using a recursive call to\n // AT_LEAST_ONE we change the grammar to AT_LEAST_TWO, AT_LEAST_THREE ... , the possible recursive call\n // from the tryInRepetitionRecovery(...) will only happen IFF there really are TWO/THREE/.... items.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef, result], lookAheadFunc, keys_1.AT_LEAST_ONE_IDX, prodOccurrence, interpreter_1.NextTerminalAfterAtLeastOneWalker);\n return result;\n };\n Parser.prototype.atLeastOneSepFirstInternal = function (prodOccurrence, options, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence);\n var nestedName = this.nestedRuleBeforeClause(options, laKey);\n try {\n return this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, result, laKey);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(laKey, nestedName);\n }\n }\n };\n Parser.prototype.atLeastOneSepFirstInternalNoCst = function (prodOccurrence, options, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence);\n return this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, result, laKey);\n };\n Parser.prototype.atLeastOneSepFirstInternalLogic = function (prodOccurrence, options, result, key) {\n var _this = this;\n var action = options.DEF;\n var separator = options.SEP;\n var firstIterationLookaheadFunc = this.getLookaheadFuncForAtLeastOneSep(key, prodOccurrence);\n var values = result.values;\n var separators = result.separators;\n // 1st iteration\n if (firstIterationLookaheadFunc.call(this)) {\n values.push(action.call(this));\n var separatorLookAheadFunc = function () { return _this.tokenMatcher(_this.LA(1), separator); };\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator)) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n separators.push(this.CONSUME(separator));\n values.push(action.call(this));\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [prodOccurrence, separator, separatorLookAheadFunc, action, interpreter_1.NextTerminalAfterAtLeastOneSepWalker, result], separatorLookAheadFunc, keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence, interpreter_1.NextTerminalAfterAtLeastOneSepWalker);\n }\n else {\n throw this.raiseEarlyExitException(prodOccurrence, lookahead_1.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options.ERR_MSG);\n }\n return result;\n };\n Parser.prototype.manyInternal = function (prodOccurrence, actionORMethodDef, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_IDX, prodOccurrence);\n var nestedName = this.nestedRuleBeforeClause(actionORMethodDef, laKey);\n try {\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, result, laKey);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(laKey, nestedName);\n }\n }\n };\n Parser.prototype.manyInternalNoCst = function (prodOccurrence, actionORMethodDef, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_IDX, prodOccurrence);\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, result, laKey);\n };\n Parser.prototype.manyInternalLogic = function (prodOccurrence, actionORMethodDef, result, key) {\n var _this = this;\n var lookaheadFunction = this.getLookaheadFuncForMany(key, prodOccurrence);\n var action;\n var predicate;\n if (actionORMethodDef.DEF !== undefined) {\n action = actionORMethodDef.DEF;\n predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n var orgLookaheadFunction_3 = lookaheadFunction;\n lookaheadFunction = function () {\n return predicate.call(_this) &&\n orgLookaheadFunction_3.call(_this);\n };\n }\n }\n else {\n action = actionORMethodDef;\n }\n while (lookaheadFunction.call(this)) {\n result.push(action.call(this));\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(this.manyInternal, [prodOccurrence, actionORMethodDef, result], lookaheadFunction, keys_1.MANY_IDX, prodOccurrence, interpreter_1.NextTerminalAfterManyWalker);\n return result;\n };\n Parser.prototype.manySepFirstInternal = function (prodOccurrence, options, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_SEP_IDX, prodOccurrence);\n var nestedName = this.nestedRuleBeforeClause(options, laKey);\n try {\n return this.manySepFirstInternalLogic(prodOccurrence, options, result, laKey);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(laKey, nestedName);\n }\n }\n };\n Parser.prototype.manySepFirstInternalNoCst = function (prodOccurrence, options, result) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_SEP_IDX, prodOccurrence);\n return this.manySepFirstInternalLogic(prodOccurrence, options, result, laKey);\n };\n Parser.prototype.manySepFirstInternalLogic = function (prodOccurrence, options, result, key) {\n var _this = this;\n var action = options.DEF;\n var separator = options.SEP;\n var firstIterationLaFunc = this.getLookaheadFuncForManySep(key, prodOccurrence);\n var values = result.values;\n var separators = result.separators;\n // 1st iteration\n if (firstIterationLaFunc.call(this)) {\n values.push(action.call(this));\n var separatorLookAheadFunc = function () { return _this.tokenMatcher(_this.LA(1), separator); };\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator)) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n separators.push(this.CONSUME(separator));\n values.push(action.call(this));\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [prodOccurrence, separator, separatorLookAheadFunc, action, interpreter_1.NextTerminalAfterManySepWalker, result], separatorLookAheadFunc, keys_1.MANY_SEP_IDX, prodOccurrence, interpreter_1.NextTerminalAfterManySepWalker);\n }\n return result;\n };\n Parser.prototype.repetitionSepSecondInternal = function (prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker, result) {\n while (separatorLookAheadFunc()) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n result.separators.push(this.CONSUME(separator));\n result.values.push(action.call(this));\n }\n // we can only arrive to this function after an error\n // has occurred (hence the name 'second') so the following\n // IF will always be entered, its possible to remove it...\n // however it is kept to avoid confusion and be consistent.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n /* istanbul ignore else */\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker, result], separatorLookAheadFunc, keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker);\n };\n Parser.prototype.orInternalNoCst = function (altsOrOpts, occurrence) {\n var alts = utils_1.isArray(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;\n var laFunc = this.getLookaheadFuncForOr(occurrence, alts);\n var altIdxToTake = laFunc.call(this, alts);\n if (altIdxToTake !== undefined) {\n var chosenAlternative = alts[altIdxToTake];\n return chosenAlternative.ALT.call(this);\n }\n this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG);\n };\n Parser.prototype.orInternal = function (altsOrOpts, occurrence) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.OR_IDX, occurrence);\n var nestedName = this.nestedRuleBeforeClause(altsOrOpts, laKey);\n try {\n var alts = utils_1.isArray(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;\n var laFunc = this.getLookaheadFuncForOr(occurrence, alts);\n var altIdxToTake = laFunc.call(this, alts);\n if (altIdxToTake !== undefined) {\n var chosenAlternative = alts[altIdxToTake];\n var nestedAltBeforeClauseResult = this.nestedAltBeforeClause(chosenAlternative, occurrence, keys_1.OR_IDX, altIdxToTake);\n try {\n return chosenAlternative.ALT.call(this);\n }\n finally {\n if (nestedAltBeforeClauseResult !== undefined) {\n this.nestedRuleFinallyClause(nestedAltBeforeClauseResult.shortName, nestedAltBeforeClauseResult.nestedName);\n }\n }\n }\n this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG);\n }\n finally {\n if (nestedName !== undefined) {\n this.nestedRuleFinallyClause(laKey, nestedName);\n }\n }\n };\n // to enable optimizations this logic has been extract to a method as its invoker contains try/catch\n Parser.prototype.consumeInternalOptimized = function (expectedTokClass) {\n var nextToken = this.LA(1);\n if (this.tokenMatcher(nextToken, expectedTokClass)) {\n this.consumeToken();\n return nextToken;\n }\n else {\n var msg = this.getMisMatchTokenErrorMessage(expectedTokClass, nextToken);\n throw this.SAVE_ERROR(new exceptions_public_1.exceptions.MismatchedTokenException(msg, nextToken));\n }\n };\n // this actually returns a number, but it is always used as a string (object prop key)\n Parser.prototype.getKeyForAutomaticLookahead = function (dslMethodIdx, occurrence) {\n var currRuleShortName = this.getLastExplicitRuleShortName();\n /* tslint:disable */\n return keys_1.getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence);\n /* tslint:enable */\n };\n Parser.prototype.getLookaheadFuncForOr = function (occurrence, alts) {\n var key = this.getKeyForAutomaticLookahead(keys_1.OR_IDX, occurrence);\n var laFunc = this.classLAFuncs.get(key);\n if (laFunc === undefined) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions().get(ruleName);\n // note that hasPredicates is only computed once.\n var hasPredicates = utils_1.some(alts, function (currAlt) { return utils_1.isFunction(currAlt.GATE); });\n laFunc = lookahead_1.buildLookaheadFuncForOr(occurrence, ruleGrammar, this.maxLookahead, hasPredicates, this.tokenMatcher, this.tokenClassIdentityFunc, this.tokenInstanceIdentityFunc, this.dynamicTokensEnabled);\n this.classLAFuncs.put(key, laFunc);\n return laFunc;\n }\n else {\n return laFunc;\n }\n };\n // Automatic lookahead calculation\n Parser.prototype.getLookaheadFuncForOption = function (key, occurrence) {\n return this.getLookaheadFuncFor(key, occurrence, lookahead_1.buildLookaheadForOption, this.maxLookahead);\n };\n Parser.prototype.getLookaheadFuncForMany = function (key, occurrence) {\n return this.getLookaheadFuncFor(key, occurrence, lookahead_1.buildLookaheadForMany, this.maxLookahead);\n };\n Parser.prototype.getLookaheadFuncForManySep = function (key, occurrence) {\n return this.getLookaheadFuncFor(key, occurrence, lookahead_1.buildLookaheadForManySep, this.maxLookahead);\n };\n Parser.prototype.getLookaheadFuncForAtLeastOne = function (key, occurrence) {\n return this.getLookaheadFuncFor(key, occurrence, lookahead_1.buildLookaheadForAtLeastOne, this.maxLookahead);\n };\n Parser.prototype.getLookaheadFuncForAtLeastOneSep = function (key, occurrence) {\n return this.getLookaheadFuncFor(key, occurrence, lookahead_1.buildLookaheadForAtLeastOneSep, this.maxLookahead);\n };\n // TODO: consider caching the error message computed information\n Parser.prototype.raiseNoAltException = function (occurrence, errMsgTypes) {\n var errSuffix = \"\\nbut found: '\" + this.LA(1).image + \"'\";\n if (errMsgTypes === undefined) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions().get(ruleName);\n // TODO: getLookaheadPathsForOr can be slow for large enough maxLookahead and certain grammars, consider caching ?\n var lookAheadPathsPerAlternative = lookahead_1.getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead);\n var allLookAheadPaths = utils_1.reduce(lookAheadPathsPerAlternative, function (result, currAltPaths) { return result.concat(currAltPaths); }, []);\n var nextValidTokenSequences = utils_1.map(allLookAheadPaths, function (currPath) {\n return \"[\" + utils_1.map(currPath, function (currTokenClass) { return tokens_public_1.tokenLabel(currTokenClass); }).join(\", \") + \"]\";\n });\n var nextValidSequenceItems = utils_1.map(nextValidTokenSequences, function (itemMsg, idx) { return \" \" + (idx + 1) + \". \" + itemMsg; });\n errMsgTypes = \"one of these possible Token sequences:\\n\" + nextValidSequenceItems.join(\"\\n\");\n }\n throw this.SAVE_ERROR(new exceptions_public_1.exceptions.NoViableAltException(\"Expecting: \" + errMsgTypes + errSuffix, this.LA(1)));\n };\n Parser.prototype.getLookaheadFuncFor = function (key, occurrence, laFuncBuilder, maxLookahead) {\n var laFunc = this.classLAFuncs.get(key);\n if (laFunc === undefined) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions().get(ruleName);\n laFunc = laFuncBuilder.apply(null, [occurrence, ruleGrammar, maxLookahead, this.tokenMatcher,\n this.tokenClassIdentityFunc, this.tokenInstanceIdentityFunc, this.dynamicTokensEnabled]);\n this.classLAFuncs.put(key, laFunc);\n return laFunc;\n }\n else {\n return laFunc;\n }\n };\n // TODO: consider caching the error message computed information\n Parser.prototype.raiseEarlyExitException = function (occurrence, prodType, userDefinedErrMsg) {\n var errSuffix = \" but found: '\" + this.LA(1).image + \"'\";\n if (userDefinedErrMsg === undefined) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions().get(ruleName);\n var lookAheadPathsPerAlternative = lookahead_1.getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, this.maxLookahead);\n var insideProdPaths = lookAheadPathsPerAlternative[0];\n var nextValidTokenSequences = utils_1.map(insideProdPaths, function (currPath) {\n return \"[\" + utils_1.map(currPath, function (currTokenClass) { return tokens_public_1.tokenLabel(currTokenClass); }).join(\",\") + \"]\";\n });\n userDefinedErrMsg = \"expecting at least one iteration which starts with one of these possible Token sequences::\\n \" +\n (\"<\" + nextValidTokenSequences.join(\" ,\") + \">\");\n }\n else {\n userDefinedErrMsg = \"Expecting at least one \" + userDefinedErrMsg;\n }\n throw this.SAVE_ERROR(new exceptions_public_1.exceptions.EarlyExitException(userDefinedErrMsg + errSuffix, this.LA(1)));\n };\n Parser.prototype.getLastExplicitRuleShortName = function () {\n var lastExplictIndex = this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length - 1];\n return this.RULE_STACK[lastExplictIndex];\n };\n Parser.prototype.getLastExplicitRuleShortNameNoCst = function () {\n var ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 1];\n };\n Parser.prototype.getPreviousExplicitRuleShortName = function () {\n var lastExplicitIndex = this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length - 2];\n return this.RULE_STACK[lastExplicitIndex];\n };\n Parser.prototype.getPreviousExplicitRuleShortNameNoCst = function () {\n var ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 2];\n };\n Parser.prototype.getPreviousExplicitRuleOccurenceIndex = function () {\n var lastExplicitIndex = this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length - 2];\n return this.RULE_OCCURRENCE_STACK[lastExplicitIndex];\n };\n Parser.prototype.getPreviousExplicitRuleOccurenceIndexNoCst = function () {\n var occurrenceStack = this.RULE_OCCURRENCE_STACK;\n return occurrenceStack[occurrenceStack.length - 2];\n };\n Parser.prototype.nestedRuleBeforeClause = function (methodOpts, laKey) {\n var nestedName;\n if (methodOpts.NAME !== undefined) {\n nestedName = methodOpts.NAME;\n this.nestedRuleInvocationStateUpdate(nestedName, laKey);\n return nestedName;\n }\n else {\n return undefined;\n }\n };\n Parser.prototype.nestedAltBeforeClause = function (methodOpts, occurrence, methodKeyIdx, altIdx) {\n var ruleIdx = this.getLastExplicitRuleShortName();\n var shortName = keys_1.getKeyForAltIndex(ruleIdx, methodKeyIdx, occurrence, altIdx);\n var nestedName;\n if (methodOpts.NAME !== undefined) {\n nestedName = methodOpts.NAME;\n this.nestedRuleInvocationStateUpdate(nestedName, shortName);\n return {\n shortName: shortName,\n nestedName: nestedName\n };\n }\n else {\n return undefined;\n }\n };\n Parser.prototype.nestedRuleFinallyClause = function (laKey, nestedName) {\n var cstStack = this.CST_STACK;\n var nestedRuleCst = cstStack[cstStack.length - 1];\n this.nestedRuleFinallyStateUpdate();\n // this return a different result than the previous invocation because \"nestedRuleFinallyStateUpdate\" pops the cst stack\n var parentCstNode = cstStack[cstStack.length - 1];\n cst_1.addNoneTerminalToCst(parentCstNode, nestedName, nestedRuleCst);\n };\n Parser.prototype.cstPostTerminal = function (tokClass, consumedToken) {\n var currTokTypeName = tokClass.tokenName;\n var rootCst = this.CST_STACK[this.CST_STACK.length - 1];\n cst_1.addTerminalToCst(rootCst, consumedToken, currTokTypeName);\n };\n Parser.prototype.cstPostNonTerminal = function (ruleCstResult, ruleName) {\n cst_1.addNoneTerminalToCst(this.CST_STACK[this.CST_STACK.length - 1], ruleName, ruleCstResult);\n };\n Parser.prototype.cstPostNonTerminalRecovery = function (ruleCstResult, ruleName) {\n // TODO: assumes not first rule, is this assumption always correct?\n cst_1.addNoneTerminalToCst(this.CST_STACK[this.CST_STACK.length - 2], ruleName, ruleCstResult);\n };\n return Parser;\n}());\nParser.NO_RESYNC = false;\n// Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected.\n// (normally during the parser's constructor).\n// This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors,\n// for example: duplicate rule names, referencing an unresolved subrule, ect...\n// This flag should not be enabled during normal usage, it is used in special situations, for example when\n// needing to display the parser definition errors in some GUI(online playground).\nParser.DEFER_DEFINITION_ERRORS_HANDLING = false;\nexports.Parser = Parser;\nfunction InRuleRecoveryException(message) {\n this.name = IN_RULE_RECOVERY_EXCEPTION;\n this.message = message;\n}\nInRuleRecoveryException.prototype = Error.prototype;\n//# sourceMappingURL=parser_public.js.map\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tokens_public_1 = __webpack_require__(3);\nvar lexer_1 = __webpack_require__(52);\nvar utils_1 = __webpack_require__(0);\nvar tokens_1 = __webpack_require__(16);\nvar LexerDefinitionErrorType;\n(function (LexerDefinitionErrorType) {\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MISSING_PATTERN\"] = 0] = \"MISSING_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"INVALID_PATTERN\"] = 1] = \"INVALID_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"EOI_ANCHOR_FOUND\"] = 2] = \"EOI_ANCHOR_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"UNSUPPORTED_FLAGS_FOUND\"] = 3] = \"UNSUPPORTED_FLAGS_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"DUPLICATE_PATTERNS_FOUND\"] = 4] = \"DUPLICATE_PATTERNS_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"INVALID_GROUP_TYPE_FOUND\"] = 5] = \"INVALID_GROUP_TYPE_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"PUSH_MODE_DOES_NOT_EXIST\"] = 6] = \"PUSH_MODE_DOES_NOT_EXIST\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\"] = 7] = \"MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\"] = 8] = \"MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\"] = 9] = \"MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\"] = 10] = \"LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"SOI_ANCHOR_FOUND\"] = 11] = \"SOI_ANCHOR_FOUND\";\n})(LexerDefinitionErrorType = exports.LexerDefinitionErrorType || (exports.LexerDefinitionErrorType = {}));\nvar DEFAULT_LEXER_CONFIG = {\n deferDefinitionErrorsHandling: false,\n positionTracking: \"full\",\n debug: false\n};\nObject.freeze(DEFAULT_LEXER_CONFIG);\nvar Lexer = (function () {\n /**\n * @param {SingleModeLexerDefinition | IMultiModeLexerDefinition} lexerDefinition -\n * Structure composed of constructor functions for the Tokens types this lexer will support.\n *\n * In the case of {SingleModeLexerDefinition} the structure is simply an array of Token constructors.\n * In the case of {IMultiModeLexerDefinition} the structure is an object with two properties:\n * 1. a \"modes\" property where each value is an array of Token.\n * 2. a \"defaultMode\" property specifying the initial lexer mode.\n *\n * constructors.\n *\n * for example:\n * {\n * \"modes\" : {\n * \"modeX\" : [Token1, Token2]\n * \"modeY\" : [Token3, Token4]\n * }\n *\n * \"defaultMode\" : \"modeY\"\n * }\n *\n * A lexer with {MultiModesDefinition} is simply multiple Lexers where only one (mode) can be active at the same time.\n * This is useful for lexing languages where there are different lexing rules depending on context.\n *\n * The current lexing mode is selected via a \"mode stack\".\n * The last (peek) value in the stack will be the current mode of the lexer.\n *\n * Each Token class can define that it will cause the Lexer to (after consuming an instance of the Token):\n * 1. PUSH_MODE : push a new mode to the \"mode stack\"\n * 2. POP_MODE : pop the last mode from the \"mode stack\"\n *\n * Examples:\n * export class Attribute extends Token {\n * static PATTERN = ...\n * static PUSH_MODE = \"modeY\"\n * }\n *\n * export class EndAttribute extends Token {\n * static PATTERN = ...\n * static POP_MODE = true\n * }\n *\n * The Token constructors must be in one of these forms:\n *\n * 1. With a PATTERN property that has a RegExp value for tokens to match:\n * example: -->class Integer extends Token { static PATTERN = /[1-9]\\d }<--\n *\n * 2. With a PATTERN property that has the value of the var Lexer.NA defined above.\n * This is a convenience form used to avoid matching Token classes that only act as categories.\n * example: -->class Keyword extends Token { static PATTERN = NA }<--\n *\n *\n * The following RegExp patterns are not supported:\n * a. '$' for match at end of input\n * b. /b global flag\n * c. /m multi-line flag\n *\n * The Lexer will identify the first pattern that matches, Therefor the order of Token Constructors may be significant.\n * For example when one pattern may match a prefix of another pattern.\n *\n * Note that there are situations in which we may wish to order the longer pattern after the shorter one.\n * For example: keywords vs Identifiers.\n * 'do'(/do/) and 'donald'(/w+)\n *\n * * If the Identifier pattern appears before the 'do' pattern, both 'do' and 'donald'\n * will be lexed as an Identifier.\n *\n * * If the 'do' pattern appears before the Identifier pattern 'do' will be lexed correctly as a keyword.\n * however 'donald' will be lexed as TWO separate tokens: keyword 'do' and identifier 'nald'.\n *\n * To resolve this problem, add a static property on the keyword's constructor named: LONGER_ALT\n * example:\n *\n * export class Identifier extends Keyword { static PATTERN = /[_a-zA-Z][_a-zA-Z0-9]/ }\n * export class Keyword extends Token {\n * static PATTERN = lex.NA\n * static LONGER_ALT = Identifier\n * }\n * export class Do extends Keyword { static PATTERN = /do/ }\n * export class While extends Keyword { static PATTERN = /while/ }\n * export class Return extends Keyword { static PATTERN = /return/ }\n *\n * The lexer will then also attempt to match a (longer) Identifier each time a keyword is matched.\n *\n *\n * @param {ILexerConfig} [config=DEFAULT_LEXER_CONFIG] -\n * The Lexer's configuration @see {ILexerConfig} for details.\n */\n function Lexer(lexerDefinition, config) {\n if (config === void 0) { config = DEFAULT_LEXER_CONFIG; }\n var _this = this;\n this.lexerDefinition = lexerDefinition;\n this.lexerDefinitionErrors = [];\n this.patternIdxToConfig = {};\n this.modes = [];\n this.emptyGroups = {};\n this.config = undefined;\n this.trackStartLines = true;\n this.trackEndLines = true;\n if (typeof config === \"boolean\") {\n throw Error(\"The second argument to the Lexer constructor is now an ILexerConfig Object.\\n\" +\n \"a boolean 2nd argument is no longer supported\");\n }\n this.config = utils_1.merge(DEFAULT_LEXER_CONFIG, config);\n if (this.config.debug === true) {\n console.log(\"Running the Lexer in Debug Mode, DO NOT ENABLE THIS IN PRODUCTIVE ENV!\");\n }\n this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking);\n this.trackEndLines = /full/i.test(this.config.positionTracking);\n var hasOnlySingleMode = true;\n var actualDefinition;\n // Convert SingleModeLexerDefinition into a IMultiModeLexerDefinition.\n if (utils_1.isArray(lexerDefinition)) {\n actualDefinition = { modes: {} };\n actualDefinition.modes[lexer_1.DEFAULT_MODE] = utils_1.cloneArr(lexerDefinition);\n actualDefinition[lexer_1.DEFAULT_MODE] = lexer_1.DEFAULT_MODE;\n }\n else {\n hasOnlySingleMode = false;\n actualDefinition = utils_1.cloneObj(lexerDefinition);\n }\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(lexer_1.performRuntimeChecks(actualDefinition));\n // for extra robustness to avoid throwing an none informative error message\n actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {};\n // an error of undefined TokenClasses will be detected in \"performRuntimeChecks\" above.\n // this transformation is to increase robustness in the case of partially invalid lexer definition.\n utils_1.forEach(actualDefinition.modes, function (currModeValue, currModeName) {\n actualDefinition.modes[currModeName] = utils_1.reject(currModeValue, function (currTokClass) { return utils_1.isUndefined(currTokClass); });\n });\n var allModeNames = utils_1.keys(actualDefinition.modes);\n utils_1.forEach(actualDefinition.modes, function (currModDef, currModName) {\n _this.modes.push(currModName);\n _this.lexerDefinitionErrors = _this.lexerDefinitionErrors.concat(lexer_1.validatePatterns(currModDef, allModeNames));\n // If definition errors were encountered, the analysis phase may fail unexpectedly/\n // Considering a lexer with definition errors may never be used, there is no point\n // to performing the analysis anyhow...\n if (utils_1.isEmpty(_this.lexerDefinitionErrors)) {\n tokens_1.augmentTokenClasses(currModDef);\n var currAnalyzeResult = lexer_1.analyzeTokenClasses(currModDef);\n _this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig;\n _this.emptyGroups = utils_1.merge(_this.emptyGroups, currAnalyzeResult.emptyGroups);\n }\n });\n this.defaultMode = actualDefinition.defaultMode;\n if (!utils_1.isEmpty(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {\n var allErrMessages = utils_1.map(this.lexerDefinitionErrors, function (error) {\n return error.message;\n });\n var allErrMessagesString = allErrMessages.join(\"-----------------------\\n\");\n throw new Error(\"Errors detected in definition of Lexer:\\n\" + allErrMessagesString);\n }\n if (lexer_1.SUPPORT_STICKY) {\n this.chopInput = utils_1.IDENTITY;\n }\n else {\n this.updateLastIndex = utils_1.NOOP;\n }\n if (hasOnlySingleMode) {\n this.handleModes = utils_1.NOOP;\n }\n if (this.trackStartLines === false) {\n this.computeNewColumn = utils_1.IDENTITY;\n }\n if (this.trackEndLines === false) {\n this.updateTokenEndLineColumnLocation = utils_1.NOOP;\n }\n if (/full/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createFullToken;\n }\n else if (/onlyStart/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createStartOnlyToken;\n }\n else if (/onlyOffset/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createOffsetOnlyToken;\n }\n else {\n throw Error(\"Invalid <positionTracking> config option: \\\"\" + this.config.positionTracking + \"\\\"\");\n }\n }\n /**\n * Will lex(Tokenize) a string.\n * Note that this can be called repeatedly on different strings as this method\n * does not modify the state of the Lexer.\n *\n * @param {string} text - The string to lex\n * @param {string} [initialMode] - The initial Lexer Mode to start with, by default this will be the first mode in the lexer's\n * definition. If the lexer has no explicit modes it will be the implicit single 'default_mode' mode.\n *\n * @returns {ILexingResult}\n */\n Lexer.prototype.tokenize = function (text, initialMode) {\n if (initialMode === void 0) { initialMode = this.defaultMode; }\n if (!utils_1.isEmpty(this.lexerDefinitionErrors)) {\n var allErrMessages = utils_1.map(this.lexerDefinitionErrors, function (error) {\n return error.message;\n });\n var allErrMessagesString = allErrMessages.join(\"-----------------------\\n\");\n throw new Error(\"Unable to Tokenize because Errors detected in definition of Lexer:\\n\" + allErrMessagesString);\n }\n var lexResult = this.tokenizeInternal(text, initialMode);\n if (this.config.debug === true) {\n this.addTokenTypeNamesToResult(lexResult);\n }\n return lexResult;\n };\n // There is quite a bit of duplication between this and \"tokenizeInternalLazy\"\n // This is intentional due to performance considerations.\n Lexer.prototype.tokenizeInternal = function (text, initialMode) {\n var _this = this;\n var i, j, matchAltImage, longerAltIdx, matchedImage, imageLength, group, tokType, newToken, errLength, droppedChar, lastLTIdx, msg, match;\n var orgText = text;\n var orgLength = orgText.length;\n var offset = 0;\n var matchedTokens = [];\n var errors = [];\n var line = this.trackStartLines ? 1 : undefined;\n var column = this.trackStartLines ? 1 : undefined;\n var groups = lexer_1.cloneEmptyGroups(this.emptyGroups);\n var trackLines = this.trackStartLines;\n var currModePatternsLength = 0;\n var patternIdxToConfig = [];\n var modeStack = [];\n var pop_mode = function (popToken) {\n // TODO: perhaps avoid this error in the edge case there is no more input?\n if (modeStack.length === 1) {\n // if we try to pop the last mode there lexer will no longer have ANY mode.\n // thus the pop is ignored, an error will be created and the lexer will continue parsing in the previous mode.\n var msg_1 = \"Unable to pop Lexer Mode after encountering Token ->\" + popToken.image + \"<- The Mode Stack is empty\";\n errors.push({\n offset: popToken.startOffset,\n line: popToken.startLine !== undefined ? popToken.startLine : undefined,\n column: popToken.startColumn !== undefined ? popToken.startColumn : undefined,\n length: popToken.image.length,\n message: msg_1\n });\n }\n else {\n modeStack.pop();\n var newMode = utils_1.last(modeStack);\n patternIdxToConfig = _this.patternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n }\n };\n function push_mode(newMode) {\n modeStack.push(newMode);\n patternIdxToConfig = this.patternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n }\n // this pattern seems to avoid a V8 de-optimization, although that de-optimization does not\n // seem to matter performance wise.\n push_mode.call(this, initialMode);\n var currConfig;\n while (offset < orgLength) {\n matchedImage = null;\n for (i = 0; i < currModePatternsLength; i++) {\n currConfig = patternIdxToConfig[i];\n var currPattern = currConfig.pattern;\n // manually in-lined because > 600 chars won't be in-lined in V8\n var singleCharCode = currConfig.short;\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n // single character string\n matchedImage = currPattern;\n }\n }\n else if (currConfig.isCustom === true) {\n match = currPattern.exec(orgText, offset, matchedTokens, groups);\n matchedImage = match !== null ? match[0] : match;\n }\n else {\n this.updateLastIndex(currPattern, offset);\n match = currPattern.exec(text);\n matchedImage = match !== null ? match[0] : match;\n }\n if (matchedImage !== null) {\n // even though this pattern matched we must try a another longer alternative.\n // this can be used to prioritize keywords over identifiers\n longerAltIdx = currConfig.longerAlt;\n if (longerAltIdx !== undefined) {\n // TODO: micro optimize, avoid extra prop access\n // by saving/linking longerAlt on the original config?\n var longerAltConfig = patternIdxToConfig[longerAltIdx];\n var longerAltPattern = longerAltConfig.pattern;\n // single Char can never be a longer alt so no need to test it.\n // manually in-lined because > 600 chars won't be in-lined in V8\n if (longerAltConfig.isCustom === true) {\n match = longerAltPattern.exec(orgText, offset, matchedTokens, groups);\n matchAltImage = match !== null ? match[0] : match;\n }\n else {\n this.updateLastIndex(longerAltPattern, offset);\n match = longerAltPattern.exec(text);\n matchAltImage = match !== null ? match[0] : match;\n }\n if (matchAltImage && matchAltImage.length > matchedImage.length) {\n matchedImage = matchAltImage;\n currConfig = longerAltConfig;\n }\n }\n break;\n }\n }\n // successful match\n if (matchedImage !== null) {\n // matchedImage = match[0]\n imageLength = matchedImage.length;\n group = currConfig.group;\n if (group !== undefined) {\n tokType = currConfig.tokenType;\n // TODO: \"offset + imageLength\" and the new column may be computed twice in case of \"full\" location information inside\n // createFullToken method\n newToken = this.createTokenInstance(matchedImage, offset, tokType, line, column, imageLength);\n if (group === false) {\n matchedTokens.push(newToken);\n }\n else {\n groups[group].push(newToken);\n }\n }\n text = this.chopInput(text, imageLength);\n offset = offset + imageLength;\n // TODO: with newlines the column may be assigned twice\n column = this.computeNewColumn(column, imageLength);\n if (trackLines === true && currConfig.canLineTerminator === true) {\n var numOfLTsInMatch = 0;\n var imageOffset = 0;\n var imageLengthMinusOne = imageLength - 1;\n while (imageOffset < matchedImage.length) {\n var c = matchedImage.charCodeAt(imageOffset);\n if (c === 10) {\n numOfLTsInMatch++;\n lastLTIdx = imageOffset;\n }\n else if (c === 13) {\n if (imageOffset !== imageLengthMinusOne &&\n matchedImage.charCodeAt(imageOffset + 1) === 10) {\n }\n else {\n numOfLTsInMatch++;\n lastLTIdx = imageOffset;\n }\n }\n imageOffset++;\n }\n if (numOfLTsInMatch !== 0) {\n line = line + numOfLTsInMatch;\n column = imageLength - lastLTIdx;\n this.updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength);\n }\n }\n // will be NOOP if no modes present\n this.handleModes(i, currConfig, pop_mode, push_mode, newToken);\n }\n else {\n var errorStartOffset = offset;\n var errorLine = line;\n var errorColumn = column;\n var foundResyncPoint = false;\n while (!foundResyncPoint && offset < orgLength) {\n // drop chars until we succeed in matching something\n droppedChar = orgText.charCodeAt(offset);\n if (droppedChar === 10 ||\n (droppedChar === 13 &&\n (offset === orgLength - 1 ||\n (offset < orgLength - 1 && orgText.charCodeAt(offset + 1) !== 10)))) {\n // followed by\n // '\\n'\n line++;\n column = 1;\n }\n else {\n // either when skipping the next char, or when consuming the following pattern\n // (which will have to start in a '\\n' if we manage to consume it)\n column++;\n }\n // Identity Func (when sticky flag is enabled)\n text = this.chopInput(text, 1);\n offset++;\n for (j = 0; j < currModePatternsLength; j++) {\n var currConfig_1 = patternIdxToConfig[j];\n var currPattern = currConfig_1.pattern;\n // manually in-lined because > 600 chars won't be in-lined in V8\n var singleCharCode = currConfig_1.short;\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n // single character string\n foundResyncPoint = true;\n }\n }\n else if (currConfig_1.isCustom === true) {\n foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null;\n }\n else {\n this.updateLastIndex(currPattern, offset);\n foundResyncPoint = currPattern.exec(text) !== null;\n }\n if (foundResyncPoint === true) {\n break;\n }\n }\n }\n errLength = offset - errorStartOffset;\n // at this point we either re-synced or reached the end of the input text\n msg = \"unexpected character: ->\" + orgText.charAt(errorStartOffset) + \"<- at offset: \" + errorStartOffset + \",\" +\n (\" skipped \" + (offset - errorStartOffset) + \" characters.\");\n errors.push({ offset: errorStartOffset, line: errorLine, column: errorColumn, length: errLength, message: msg });\n }\n }\n return { tokens: matchedTokens, groups: groups, errors: errors };\n };\n Lexer.prototype.handleModes = function (i, config, pop_mode, push_mode, newToken) {\n if (config.pop === true) {\n // need to save the PUSH_MODE property as if the mode is popped\n // patternIdxToPopMode is updated to reflect the new mode after popping the stack\n var pushMode = config.push;\n pop_mode(newToken);\n if (pushMode !== undefined) {\n push_mode.call(this, pushMode);\n }\n }\n else if (config.push !== undefined) {\n push_mode.call(this, config.push);\n }\n };\n Lexer.prototype.chopInput = function (text, length) {\n return text.substring(length);\n };\n Lexer.prototype.updateLastIndex = function (regExp, newLastIndex) {\n regExp.lastIndex = newLastIndex;\n };\n // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler\n Lexer.prototype.updateTokenEndLineColumnLocation = function (newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {\n var lastCharIsLT, fixForEndingInLT;\n if (group !== undefined) {\n lastCharIsLT = lastLTIdx === imageLength - 1;\n fixForEndingInLT = lastCharIsLT ?\n -1 :\n 0;\n if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {\n // if a token ends in a LT that last LT only affects the line numbering of following Tokens\n newToken.endLine = line + fixForEndingInLT;\n // the last LT in a token does not affect the endColumn either as the [columnStart ... columnEnd)\n // inclusive to exclusive range.\n newToken.endColumn = column - 1 + -fixForEndingInLT;\n }\n // else single LT in the last character of a token, no need to modify the endLine/EndColumn\n }\n };\n Lexer.prototype.computeNewColumn = function (oldColumn, imageLength) {\n return oldColumn + imageLength;\n };\n // Place holder, will be replaced by the correct variant according to the locationTracking option at runtime.\n /* istanbul ignore next - place holder */\n Lexer.prototype.createTokenInstance = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return null;\n };\n Lexer.prototype.createOffsetOnlyToken = function (image, startOffset, tokenType) {\n return {\n image: image,\n startOffset: startOffset,\n tokenType: tokenType\n };\n };\n Lexer.prototype.createStartOnlyToken = function (image, startOffset, tokenType, startLine, startColumn) {\n return {\n image: image,\n startOffset: startOffset,\n startLine: startLine,\n startColumn: startColumn,\n tokenType: tokenType\n };\n };\n Lexer.prototype.createFullToken = function (image, startOffset, tokenType, startLine, startColumn, imageLength) {\n return {\n image: image,\n startOffset: startOffset,\n endOffset: startOffset + imageLength - 1,\n startLine: startLine,\n endLine: startLine,\n startColumn: startColumn,\n endColumn: startColumn + imageLength - 1,\n tokenType: tokenType\n };\n };\n Lexer.prototype.addTokenTypeNamesToResult = function (lexResult) {\n utils_1.forEach(lexResult.tokens, function (currToken) {\n currToken.tokenClassName = tokens_public_1.tokenName(tokens_public_1.getTokenConstructor(currToken));\n });\n utils_1.forEach(lexResult.groups, function (currGroup) {\n utils_1.forEach(currGroup, function (currToken) {\n currToken.tokenClassName = tokens_public_1.tokenName(tokens_public_1.getTokenConstructor(currToken));\n });\n });\n };\n return Lexer;\n}());\nLexer.SKIPPED = \"This marks a skipped Token pattern, this means each token identified by it will\" +\n \"be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.\";\nLexer.NA = /NOT_APPLICABLE/;\nexports.Lexer = Lexer;\n//# sourceMappingURL=lexer_public.js.map\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar tokens_public_1 = __webpack_require__(3);\nvar lang_extensions_1 = __webpack_require__(5);\n// TODO: rename \"tokenInstanceOf\" ?\nfunction tokenStructuredMatcher(tokInstance, tokConstructor) {\n if (tokInstance.tokenType === tokConstructor.tokenType) {\n return true;\n }\n else if (tokConstructor.extendingTokenTypes.length > 0) {\n var extendingTokenTypes = tokConstructor.extendingTokenTypes;\n var extendingTokenTypesLength = extendingTokenTypes.length;\n for (var i = 0; i < extendingTokenTypesLength; i++) {\n if (extendingTokenTypes[i] === tokInstance.tokenType) {\n return true;\n }\n }\n return false;\n }\n else {\n return false;\n }\n}\nexports.tokenStructuredMatcher = tokenStructuredMatcher;\nfunction tokenClassIdentity(tokenConstructor) {\n return tokenConstructor.tokenType;\n}\nexports.tokenClassIdentity = tokenClassIdentity;\nfunction tokenStructuredIdentity(token) {\n return token.tokenType;\n}\nexports.tokenStructuredIdentity = tokenStructuredIdentity;\nfunction isBaseTokenOrObject(tokClass) {\n return isBaseTokenClass(tokClass) || tokClass === Object;\n}\nexports.isBaseTokenOrObject = isBaseTokenOrObject;\nfunction isBaseTokenClass(tokClass) {\n return tokClass === tokens_public_1.Token;\n}\nexports.isBaseTokenClass = isBaseTokenClass;\nexports.tokenShortNameIdx = 1;\nexports.tokenIdxToClass = new lang_extensions_1.HashTable();\nfunction augmentTokenClasses(tokenClasses) {\n // 1. collect the parent Token classes as well.\n var tokenClassesAndParents = expandTokenHierarchy(tokenClasses);\n // 2. add required tokenType and extendingTokenTypes properties\n assignTokenDefaultProps(tokenClassesAndParents);\n // 3. fill up the extendingTokenTypes\n assignExtendingTokensProp(tokenClassesAndParents);\n}\nexports.augmentTokenClasses = augmentTokenClasses;\nfunction expandTokenHierarchy(tokenClasses) {\n var tokenClassesAndParents = utils_1.cloneArr(tokenClasses);\n utils_1.forEach(tokenClasses, function (currTokClass) {\n var currParentClass = utils_1.getSuperClass(currTokClass);\n while (!isBaseTokenOrObject(currParentClass)) {\n if (!utils_1.contains(tokenClassesAndParents, currParentClass)) {\n tokenClassesAndParents.push(currParentClass);\n }\n currParentClass = utils_1.getSuperClass(currParentClass);\n }\n });\n return tokenClassesAndParents;\n}\nexports.expandTokenHierarchy = expandTokenHierarchy;\nfunction assignTokenDefaultProps(tokenClasses) {\n utils_1.forEach(tokenClasses, function (currTokClass) {\n if (!hasShortKeyProperty(currTokClass)) {\n exports.tokenIdxToClass.put(exports.tokenShortNameIdx, currTokClass);\n currTokClass.tokenType = exports.tokenShortNameIdx++;\n }\n if (!hasExtendingTokensTypesProperty(currTokClass)) {\n currTokClass.extendingTokenTypes = [];\n }\n if (!hasTokenNameProperty(currTokClass)) {\n // saved for fast access during CST building.\n currTokClass.tokenName = tokens_public_1.tokenName(currTokClass);\n }\n });\n}\nexports.assignTokenDefaultProps = assignTokenDefaultProps;\nfunction assignExtendingTokensProp(tokenClasses) {\n utils_1.forEach(tokenClasses, function (currTokClass) {\n var currSubClassesExtendingTypes = [currTokClass.tokenType];\n var currParentClass = utils_1.getSuperClass(currTokClass);\n while (!isBaseTokenClass(currParentClass) && currParentClass !== Object) {\n var newExtendingTypes = utils_1.difference(currSubClassesExtendingTypes, currParentClass.extendingTokenTypes);\n currParentClass.extendingTokenTypes = currParentClass.extendingTokenTypes.concat(newExtendingTypes);\n currSubClassesExtendingTypes.push(currParentClass.tokenType);\n currParentClass = utils_1.getSuperClass(currParentClass);\n }\n });\n}\nexports.assignExtendingTokensProp = assignExtendingTokensProp;\nfunction hasShortKeyProperty(tokClass) {\n return utils_1.has(tokClass, \"tokenType\");\n}\nexports.hasShortKeyProperty = hasShortKeyProperty;\nfunction hasExtendingTokensTypesProperty(tokClass) {\n return utils_1.has(tokClass, \"extendingTokenTypes\");\n}\nexports.hasExtendingTokensTypesProperty = hasExtendingTokensTypesProperty;\nfunction hasTokenNameProperty(tokClass) {\n return utils_1.has(tokClass, \"tokenName\");\n}\nexports.hasTokenNameProperty = hasTokenNameProperty;\nfunction isExtendingTokenType(tokType) {\n return tokens_public_1.Token.prototype.isPrototypeOf(tokType.prototype);\n}\nexports.isExtendingTokenType = isExtendingTokenType;\n//# sourceMappingURL=tokens.js.map\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction isContainer(node) {\n switch (node._type) {\n case 'document':\n case 'block_quote':\n case 'list':\n case 'item':\n case 'paragraph':\n case 'heading':\n case 'emph':\n case 'strong':\n case 'link':\n case 'image':\n case 'custom_inline':\n case 'custom_block':\n return true;\n default:\n return false;\n }\n}\n\nvar resumeAt = function(node, entering) {\n this.current = node;\n this.entering = (entering === true);\n};\n\nvar next = function(){\n var cur = this.current;\n var entering = this.entering;\n\n if (cur === null) {\n return null;\n }\n\n var container = isContainer(cur);\n\n if (entering && container) {\n if (cur._firstChild) {\n this.current = cur._firstChild;\n this.entering = true;\n } else {\n // stay on node but exit\n this.entering = false;\n }\n\n } else if (cur === this.root) {\n this.current = null;\n\n } else if (cur._next === null) {\n this.current = cur._parent;\n this.entering = false;\n\n } else {\n this.current = cur._next;\n this.entering = true;\n }\n\n return {entering: entering, node: cur};\n};\n\nvar NodeWalker = function(root) {\n return { current: root,\n root: root,\n entering: true,\n next: next,\n resumeAt: resumeAt };\n};\n\nvar Node = function(nodeType, sourcepos) {\n this._type = nodeType;\n this._parent = null;\n this._firstChild = null;\n this._lastChild = null;\n this._prev = null;\n this._next = null;\n this._sourcepos = sourcepos;\n this._lastLineBlank = false;\n this._open = true;\n this._string_content = null;\n this._literal = null;\n this._listData = {};\n this._info = null;\n this._destination = null;\n this._title = null;\n this._isFenced = false;\n this._fenceChar = null;\n this._fenceLength = 0;\n this._fenceOffset = null;\n this._level = null;\n this._onEnter = null;\n this._onExit = null;\n};\n\nvar proto = Node.prototype;\n\nObject.defineProperty(proto, 'isContainer', {\n get: function () { return isContainer(this); }\n});\n\nObject.defineProperty(proto, 'type', {\n get: function() { return this._type; }\n});\n\nObject.defineProperty(proto, 'firstChild', {\n get: function() { return this._firstChild; }\n});\n\nObject.defineProperty(proto, 'lastChild', {\n get: function() { return this._lastChild; }\n});\n\nObject.defineProperty(proto, 'next', {\n get: function() { return this._next; }\n});\n\nObject.defineProperty(proto, 'prev', {\n get: function() { return this._prev; }\n});\n\nObject.defineProperty(proto, 'parent', {\n get: function() { return this._parent; }\n});\n\nObject.defineProperty(proto, 'sourcepos', {\n get: function() { return this._sourcepos; }\n});\n\nObject.defineProperty(proto, 'literal', {\n get: function() { return this._literal; },\n set: function(s) { this._literal = s; }\n});\n\nObject.defineProperty(proto, 'destination', {\n get: function() { return this._destination; },\n set: function(s) { this._destination = s; }\n});\n\nObject.defineProperty(proto, 'title', {\n get: function() { return this._title; },\n set: function(s) { this._title = s; }\n});\n\nObject.defineProperty(proto, 'info', {\n get: function() { return this._info; },\n set: function(s) { this._info = s; }\n});\n\nObject.defineProperty(proto, 'level', {\n get: function() { return this._level; },\n set: function(s) { this._level = s; }\n});\n\nObject.defineProperty(proto, 'listType', {\n get: function() { return this._listData.type; },\n set: function(t) { this._listData.type = t; }\n});\n\nObject.defineProperty(proto, 'listTight', {\n get: function() { return this._listData.tight; },\n set: function(t) { this._listData.tight = t; }\n});\n\nObject.defineProperty(proto, 'listStart', {\n get: function() { return this._listData.start; },\n set: function(n) { this._listData.start = n; }\n});\n\nObject.defineProperty(proto, 'listDelimiter', {\n get: function() { return this._listData.delimiter; },\n set: function(delim) { this._listData.delimiter = delim; }\n});\n\nObject.defineProperty(proto, 'onEnter', {\n get: function() { return this._onEnter; },\n set: function(s) { this._onEnter = s; }\n});\n\nObject.defineProperty(proto, 'onExit', {\n get: function() { return this._onExit; },\n set: function(s) { this._onExit = s; }\n});\n\nNode.prototype.appendChild = function(child) {\n child.unlink();\n child._parent = this;\n if (this._lastChild) {\n this._lastChild._next = child;\n child._prev = this._lastChild;\n this._lastChild = child;\n } else {\n this._firstChild = child;\n this._lastChild = child;\n }\n};\n\nNode.prototype.prependChild = function(child) {\n child.unlink();\n child._parent = this;\n if (this._firstChild) {\n this._firstChild._prev = child;\n child._next = this._firstChild;\n this._firstChild = child;\n } else {\n this._firstChild = child;\n this._lastChild = child;\n }\n};\n\nNode.prototype.unlink = function() {\n if (this._prev) {\n this._prev._next = this._next;\n } else if (this._parent) {\n this._parent._firstChild = this._next;\n }\n if (this._next) {\n this._next._prev = this._prev;\n } else if (this._parent) {\n this._parent._lastChild = this._prev;\n }\n this._parent = null;\n this._next = null;\n this._prev = null;\n};\n\nNode.prototype.insertAfter = function(sibling) {\n sibling.unlink();\n sibling._next = this._next;\n if (sibling._next) {\n sibling._next._prev = sibling;\n }\n sibling._prev = this;\n this._next = sibling;\n sibling._parent = this._parent;\n if (!sibling._next) {\n sibling._parent._lastChild = sibling;\n }\n};\n\nNode.prototype.insertBefore = function(sibling) {\n sibling.unlink();\n sibling._prev = this._prev;\n if (sibling._prev) {\n sibling._prev._next = sibling;\n }\n sibling._next = this;\n this._prev = sibling;\n sibling._parent = this._parent;\n if (!sibling._prev) {\n sibling._parent._firstChild = sibling;\n }\n};\n\nNode.prototype.walker = function() {\n var walker = new NodeWalker(this);\n return walker;\n};\n\nmodule.exports = Node;\n\n\n/* Example of use of walker:\n\n var walker = w.walker();\n var event;\n\n while (event = walker.next()) {\n console.log(event.entering, event.node.type);\n }\n\n */\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\n__webpack_require__(34);\nexports.setImmediate = setImmediate;\nexports.clearImmediate = clearImmediate;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n//-----------------------------------------------------------\n// Parser\n//-----------------------------------------------------------\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar commonmark = __webpack_require__(56);\nvar chev = __webpack_require__(22);\nvar errors_1 = __webpack_require__(82);\nvar Lexer = chev.Lexer, tokenMatcher = chev.tokenMatcher;\nexports.Token = chev.Token;\nvar uuid = __webpack_require__(7);\n//-----------------------------------------------------------\n// Utils\n//-----------------------------------------------------------\nfunction cleanString(str) {\n var cleaned = str\n .replace(/\\\\n/g, \"\\n\")\n .replace(/\\\\t/g, \"\\t\")\n .replace(/\\\\r/g, \"\\r\")\n .replace(/\\\\\"/g, \"\\\"\")\n .replace(/\\\\{/g, \"{\")\n .replace(/\\\\}/g, \"}\");\n return cleaned;\n}\nfunction toEnd(node) {\n if (node && node.tokenType !== undefined) {\n return node.endOffset + 1;\n }\n return node.endOffset;\n}\n//-----------------------------------------------------------\n// Markdown\n//-----------------------------------------------------------\nvar markdownParser = new commonmark.Parser();\nfunction parseMarkdown(markdown, docId) {\n var parsed = markdownParser.parse(markdown);\n var walker = parsed.walker();\n var cur;\n var tokenId = 0;\n var text = [];\n var extraInfo = {};\n var pos = 0;\n var lastLine = 1;\n var spans = [];\n var context = [];\n var blocks = [];\n while (cur = walker.next()) {\n var node = cur.node;\n if (cur.entering) {\n while (node.sourcepos && node.sourcepos[0][0] > lastLine) {\n lastLine++;\n pos++;\n text.push(\"\\n\");\n }\n if (node.type !== \"text\") {\n context.push({ node: node, start: pos });\n }\n if (node.type == \"text\" || node.type === \"code_block\" || node.type == \"code\") {\n text.push(node.literal);\n pos += node.literal.length;\n }\n if (node.type == \"softbreak\") {\n text.push(\"\\n\");\n pos += 1;\n lastLine++;\n context.pop();\n }\n if (node.type == \"code_block\") {\n var spanId = docId + \"|block|\" + tokenId++;\n var start = context.pop().start;\n node.id = spanId;\n node.startOffset = start;\n var type = node.type;\n if (!node._isFenced) {\n type = \"indented_code_block\";\n }\n else {\n blocks.push(node);\n }\n spans.push(start, pos, node.type, spanId);\n lastLine = node.sourcepos[1][0] + 1;\n }\n if (node.type == \"code\") {\n var spanId = docId + \"|\" + tokenId++;\n var start = context.pop().start;\n spans.push(start, pos, node.type, spanId);\n }\n }\n else {\n var info = context.pop();\n if (node !== info.node) {\n throw new Error(\"Common mark is exiting a node that doesn't agree with the context stack\");\n }\n if (node.type == \"emph\" || node.type == \"strong\" || node.type == \"link\") {\n var spanId = docId + \"|\" + tokenId++;\n spans.push(info.start, pos, node.type, spanId);\n if (node.type === \"link\") {\n extraInfo[spanId] = { destination: node._destination };\n }\n }\n else if (node.type == \"heading\" || node.type == \"item\") {\n var spanId = docId + \"|\" + tokenId++;\n spans.push(info.start, info.start, node.type, spanId);\n extraInfo[spanId] = { level: node._level, listData: node._listData };\n }\n }\n }\n return { text: text.join(\"\"), spans: spans, blocks: blocks, extraInfo: extraInfo };\n}\n//-----------------------------------------------------------\n// Tokens\n//-----------------------------------------------------------\nvar breakChars = \"@#\\\\.,\\\\(\\\\)\\\\[\\\\]\\\\{\\\\}⦑⦒:\\\\\\\"\";\n// Markdown\nvar DocContent = (function (_super) {\n __extends(DocContent, _super);\n function DocContent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DocContent.PATTERN = /[^\\n]+/;\n return DocContent;\n}(exports.Token));\nexports.DocContent = DocContent;\nvar Fence = (function (_super) {\n __extends(Fence, _super);\n function Fence() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Fence.PATTERN = /```|~~~/;\n Fence.PUSH_MODE = \"code\";\n return Fence;\n}(exports.Token));\nexports.Fence = Fence;\nvar CloseFence = (function (_super) {\n __extends(CloseFence, _super);\n function CloseFence() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CloseFence.PATTERN = /```|~~~/;\n CloseFence.POP_MODE = true;\n return CloseFence;\n}(exports.Token));\nexports.CloseFence = CloseFence;\n// Comments\nvar CommentLine = (function (_super) {\n __extends(CommentLine, _super);\n function CommentLine() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"comment\";\n return _this;\n }\n CommentLine.PATTERN = /\\/\\/.*\\n/;\n CommentLine.GROUP = \"comments\";\n return CommentLine;\n}(exports.Token));\nexports.CommentLine = CommentLine;\n// Operators\nvar Equality = (function (_super) {\n __extends(Equality, _super);\n function Equality() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"equality\";\n return _this;\n }\n Equality.PATTERN = /:|=/;\n return Equality;\n}(exports.Token));\nexports.Equality = Equality;\nvar Comparison = (function (_super) {\n __extends(Comparison, _super);\n function Comparison() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"comparison\";\n return _this;\n }\n Comparison.PATTERN = />=|<=|!=|>|</;\n return Comparison;\n}(exports.Token));\nexports.Comparison = Comparison;\nvar AddInfix = (function (_super) {\n __extends(AddInfix, _super);\n function AddInfix() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"infix\";\n return _this;\n }\n AddInfix.PATTERN = /\\+|-/;\n return AddInfix;\n}(exports.Token));\nexports.AddInfix = AddInfix;\nvar MultInfix = (function (_super) {\n __extends(MultInfix, _super);\n function MultInfix() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"infix\";\n return _this;\n }\n MultInfix.PATTERN = /\\*|\\//;\n return MultInfix;\n}(exports.Token));\nexports.MultInfix = MultInfix;\nvar Merge = (function (_super) {\n __extends(Merge, _super);\n function Merge() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"merge\";\n return _this;\n }\n Merge.PATTERN = /<-/;\n return Merge;\n}(exports.Token));\nexports.Merge = Merge;\nvar Set = (function (_super) {\n __extends(Set, _super);\n function Set() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"set\";\n return _this;\n }\n Set.PATTERN = /:=/;\n return Set;\n}(exports.Token));\nexports.Set = Set;\nvar Mutate = (function (_super) {\n __extends(Mutate, _super);\n function Mutate() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"mutate\";\n return _this;\n }\n Mutate.PATTERN = /\\+=|-=/;\n return Mutate;\n}(exports.Token));\nexports.Mutate = Mutate;\nvar Dot = (function (_super) {\n __extends(Dot, _super);\n function Dot() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"dot\";\n return _this;\n }\n Dot.PATTERN = /\\./;\n return Dot;\n}(exports.Token));\nexports.Dot = Dot;\nvar Pipe = (function (_super) {\n __extends(Pipe, _super);\n function Pipe() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"pipe\";\n return _this;\n }\n Pipe.PATTERN = /\\|/;\n return Pipe;\n}(exports.Token));\nexports.Pipe = Pipe;\n// Identifier\nvar Identifier = (function (_super) {\n __extends(Identifier, _super);\n function Identifier() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"identifier\";\n return _this;\n }\n Identifier.PATTERN = new RegExp(\"([\\\\+-/\\\\*][^\\\\s\" + breakChars + \"]+|[^\\\\d\" + breakChars + \"\\\\+-/\\\\*][^\\\\s\" + breakChars + \"]*)(?=[^\\\\[])\");\n return Identifier;\n}(exports.Token));\nexports.Identifier = Identifier;\nvar FunctionIdentifier = (function (_super) {\n __extends(FunctionIdentifier, _super);\n function FunctionIdentifier() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"functionIdentifier\";\n return _this;\n }\n FunctionIdentifier.PATTERN = new RegExp(\"([\\\\+-/\\\\*][^\\\\s\" + breakChars + \"]+|[^\\\\d\" + breakChars + \"\\\\+-/\\\\*][^\\\\s\" + breakChars + \"]*)(?=\\\\[)\");\n return FunctionIdentifier;\n}(exports.Token));\nexports.FunctionIdentifier = FunctionIdentifier;\n// Keywords\nvar Keyword = (function (_super) {\n __extends(Keyword, _super);\n function Keyword() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Keyword.PATTERN = Lexer.NA;\n Keyword.LONGER_ALT = Identifier;\n return Keyword;\n}(exports.Token));\nexports.Keyword = Keyword;\nvar Lookup = (function (_super) {\n __extends(Lookup, _super);\n function Lookup() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"lookup\";\n return _this;\n }\n Lookup.PATTERN = /lookup(?=\\[)/;\n return Lookup;\n}(Keyword));\nexports.Lookup = Lookup;\nvar Action = (function (_super) {\n __extends(Action, _super);\n function Action() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"action\";\n return _this;\n }\n Action.PATTERN = /bind|commit/;\n return Action;\n}(Keyword));\nexports.Action = Action;\nvar Search = (function (_super) {\n __extends(Search, _super);\n function Search() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"search\";\n return _this;\n }\n Search.PATTERN = /search/;\n return Search;\n}(Keyword));\nexports.Search = Search;\nvar If = (function (_super) {\n __extends(If, _super);\n function If() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"if\";\n return _this;\n }\n If.PATTERN = /if/;\n return If;\n}(Keyword));\nexports.If = If;\nvar Else = (function (_super) {\n __extends(Else, _super);\n function Else() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"else\";\n return _this;\n }\n Else.PATTERN = /else/;\n return Else;\n}(Keyword));\nexports.Else = Else;\nvar Then = (function (_super) {\n __extends(Then, _super);\n function Then() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"then\";\n return _this;\n }\n Then.PATTERN = /then/;\n return Then;\n}(Keyword));\nexports.Then = Then;\nvar Not = (function (_super) {\n __extends(Not, _super);\n function Not() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"not\";\n return _this;\n }\n Not.PATTERN = /not/;\n return Not;\n}(Keyword));\nexports.Not = Not;\n// Values\nvar Bool = (function (_super) {\n __extends(Bool, _super);\n function Bool() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"bool\";\n return _this;\n }\n Bool.PATTERN = /true|false/;\n return Bool;\n}(Keyword));\nexports.Bool = Bool;\nvar Num = (function (_super) {\n __extends(Num, _super);\n function Num() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"num\";\n return _this;\n }\n Num.PATTERN = /-?\\d+(\\.\\d+)?/;\n return Num;\n}(exports.Token));\nexports.Num = Num;\nvar None = (function (_super) {\n __extends(None, _super);\n function None() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"none\";\n return _this;\n }\n None.PATTERN = /none/;\n return None;\n}(Keyword));\nexports.None = None;\nvar Name = (function (_super) {\n __extends(Name, _super);\n function Name() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"name\";\n return _this;\n }\n Name.PATTERN = /@/;\n return Name;\n}(exports.Token));\nexports.Name = Name;\nvar Tag = (function (_super) {\n __extends(Tag, _super);\n function Tag() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"tag\";\n return _this;\n }\n Tag.PATTERN = /#/;\n return Tag;\n}(exports.Token));\nexports.Tag = Tag;\n// Delimiters\nvar OpenBracket = (function (_super) {\n __extends(OpenBracket, _super);\n function OpenBracket() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"open-bracket\";\n return _this;\n }\n OpenBracket.PATTERN = /\\[/;\n return OpenBracket;\n}(exports.Token));\nexports.OpenBracket = OpenBracket;\nvar CloseBracket = (function (_super) {\n __extends(CloseBracket, _super);\n function CloseBracket() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"close-bracket\";\n return _this;\n }\n CloseBracket.PATTERN = /\\]/;\n return CloseBracket;\n}(exports.Token));\nexports.CloseBracket = CloseBracket;\nvar OpenParen = (function (_super) {\n __extends(OpenParen, _super);\n function OpenParen() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"open-paren\";\n return _this;\n }\n OpenParen.PATTERN = /\\(/;\n return OpenParen;\n}(exports.Token));\nexports.OpenParen = OpenParen;\nvar CloseParen = (function (_super) {\n __extends(CloseParen, _super);\n function CloseParen() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"close-paren\";\n return _this;\n }\n CloseParen.PATTERN = /\\)/;\n return CloseParen;\n}(exports.Token));\nexports.CloseParen = CloseParen;\n// Strings\nvar StringChars = (function (_super) {\n __extends(StringChars, _super);\n function StringChars() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"string\";\n return _this;\n }\n StringChars.PATTERN = /(\\\\.|{(?=[^{])|[^\"\\\\{])+/;\n return StringChars;\n}(exports.Token));\nexports.StringChars = StringChars;\nvar OpenString = (function (_super) {\n __extends(OpenString, _super);\n function OpenString() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"quote\";\n return _this;\n }\n OpenString.PATTERN = /\"/;\n OpenString.PUSH_MODE = \"string\";\n return OpenString;\n}(exports.Token));\nexports.OpenString = OpenString;\nvar CloseString = (function (_super) {\n __extends(CloseString, _super);\n function CloseString() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"quote\";\n return _this;\n }\n CloseString.PATTERN = /\"/;\n CloseString.POP_MODE = true;\n return CloseString;\n}(exports.Token));\nexports.CloseString = CloseString;\n// String Embeds\nvar StringEmbedOpen = (function (_super) {\n __extends(StringEmbedOpen, _super);\n function StringEmbedOpen() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"string-embed-open\";\n return _this;\n }\n StringEmbedOpen.PATTERN = /{{/;\n StringEmbedOpen.PUSH_MODE = \"code\";\n return StringEmbedOpen;\n}(exports.Token));\nexports.StringEmbedOpen = StringEmbedOpen;\nvar StringEmbedClose = (function (_super) {\n __extends(StringEmbedClose, _super);\n function StringEmbedClose() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.label = \"string-embed-close\";\n return _this;\n }\n StringEmbedClose.PATTERN = /}}/;\n StringEmbedClose.POP_MODE = true;\n return StringEmbedClose;\n}(exports.Token));\nexports.StringEmbedClose = StringEmbedClose;\n// Whitespace\nvar WhiteSpace = (function (_super) {\n __extends(WhiteSpace, _super);\n function WhiteSpace() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WhiteSpace.PATTERN = /\\s+|,/;\n WhiteSpace.GROUP = Lexer.SKIPPED;\n return WhiteSpace;\n}(exports.Token));\nexports.WhiteSpace = WhiteSpace;\n//-----------------------------------------------------------\n// Lexers\n//-----------------------------------------------------------\nvar codeTokens = [\n CloseFence, WhiteSpace, CommentLine, OpenBracket, CloseBracket, OpenParen,\n CloseParen, StringEmbedClose, OpenString, Bool, Action, Set, Equality, Dot, Pipe, Merge,\n Mutate, Comparison, Num, Search, Lookup, If, Else, Then,\n Not, None, Name, Tag, FunctionIdentifier, Identifier, AddInfix, MultInfix\n];\nvar stringEmbedTokens = [StringEmbedClose].concat(codeTokens);\nvar LexerModes = {\n \"doc\": [WhiteSpace, Fence, DocContent],\n \"code\": codeTokens,\n \"string\": [CloseString, StringEmbedOpen, StringChars],\n};\nvar allTokens = codeTokens.concat([Fence, DocContent, CloseString, StringEmbedOpen, StringEmbedClose, StringChars]);\nvar EveDocLexer = new Lexer({ modes: LexerModes, defaultMode: \"doc\" });\nvar EveBlockLexer = new Lexer({ modes: LexerModes, defaultMode: \"code\" });\nvar ParseBlock = (function () {\n function ParseBlock(id, variableLookup) {\n this.nodeId = 0;\n this.variables = {};\n this.equalities = [];\n this.scanLike = [];\n this.expressions = [];\n this.binds = [];\n this.commits = [];\n this.links = [];\n this.searchScopes = [];\n this.id = id;\n this.variableLookup = variableLookup || {};\n }\n ParseBlock.prototype.toVariable = function (name, generated) {\n if (generated === void 0) { generated = false; }\n var variable = this.variableLookup[name];\n if (!variable) {\n this.variableLookup[name] = this.makeNode(\"variable\", { name: name, from: [], generated: generated });\n }\n variable = this.variables[name] = this.variableLookup[name];\n return { id: variable.id, type: \"variable\", name: name, from: [], generated: generated };\n };\n ParseBlock.prototype.addUsage = function (variable, usage) {\n var global = this.variableLookup[variable.name];\n global.from.push(usage);\n if (global.from.length === 1) {\n global.startOffset = usage.startOffset;\n global.endOffset = toEnd(usage);\n }\n variable.from.push(usage);\n variable.startOffset = usage.startOffset;\n variable.endOffset = toEnd(usage);\n this.links.push(variable.id, usage.id);\n };\n ParseBlock.prototype.equality = function (a, b) {\n this.equalities.push([a, b]);\n };\n ParseBlock.prototype.commit = function (node) {\n this.commits.push(node);\n };\n ParseBlock.prototype.bind = function (node) {\n this.binds.push(node);\n };\n ParseBlock.prototype.expression = function (node) {\n this.expressions.push(node);\n };\n ParseBlock.prototype.scan = function (node) {\n this.scanLike.push(node);\n };\n ParseBlock.prototype.makeNode = function (type, node) {\n if (!node.id) {\n node.id = this.id + \"|node|\" + this.nodeId++;\n }\n for (var _i = 0, _a = node.from; _i < _a.length; _i++) {\n var from = _a[_i];\n this.links.push(node.id, from.id);\n }\n if (node.from.length) {\n node.startOffset = node.from[0].startOffset;\n node.endOffset = toEnd(node.from[node.from.length - 1]);\n }\n node.type = type;\n return node;\n };\n ParseBlock.prototype.addSearchScopes = function (scopes) {\n for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) {\n var scope = scopes_1[_i];\n if (this.searchScopes.indexOf(scope) === -1) {\n this.searchScopes.push(scope);\n }\n }\n };\n ParseBlock.prototype.subBlock = function () {\n var neue = new ParseBlock(this.id + \"|sub\" + this.nodeId++, this.variableLookup);\n neue.parent = this;\n return neue;\n };\n return ParseBlock;\n}());\nexports.ParseBlock = ParseBlock;\n//-----------------------------------------------------------\n// Parser\n//-----------------------------------------------------------\nvar Parser = (function (_super) {\n __extends(Parser, _super);\n function Parser(input) {\n var _this = _super.call(this, input, allTokens, {}) || this;\n var self = _this;\n var asValue = function (node) {\n if (node.type === \"constant\" || node.type === \"variable\" || node.type === \"parenthesis\") {\n return node;\n }\n else if (node.variable) {\n return node.variable;\n }\n throw new Error(\"Tried to get value of a node that is neither a constant nor a variable.\\n\\n\" + JSON.stringify(node));\n };\n var ifOutputs = function (expression) {\n var outputs = [];\n if (expression.type === \"parenthesis\") {\n for (var _i = 0, _a = expression.items; _i < _a.length; _i++) {\n var item = _a[_i];\n outputs.push(asValue(item));\n }\n }\n else {\n outputs.push(asValue(expression));\n }\n return outputs;\n };\n var makeNode = function (type, node) {\n return self.block.makeNode(type, node);\n };\n var blockStack = [];\n var pushBlock = function (blockId) {\n var block;\n var prev = blockStack[blockStack.length - 1];\n if (prev) {\n block = prev.subBlock();\n }\n else {\n block = new ParseBlock(blockId || \"block\");\n }\n blockStack.push(block);\n self.block = block;\n return block;\n };\n var popBlock = function () {\n var popped = blockStack.pop();\n self.block = blockStack[blockStack.length - 1];\n return popped;\n };\n //-----------------------------------------------------------\n // Doc rules\n //-----------------------------------------------------------\n self.RULE(\"doc\", function () {\n var doc = {\n full: [],\n content: [],\n blocks: [],\n };\n self.MANY(function () {\n self.OR([\n { ALT: function () {\n var content = self.CONSUME(DocContent);\n doc.full.push(content);\n doc.content.push(content);\n } },\n { ALT: function () {\n var block = self.SUBRULE(self.fencedBlock);\n if (doc.content.length) {\n block.name = doc.content[doc.content.length - 1].image;\n }\n else {\n block.name = \"Unnamed block\";\n }\n doc.full.push(block);\n doc.blocks.push(block);\n } },\n ]);\n });\n return doc;\n });\n self.RULE(\"fencedBlock\", function () {\n self.CONSUME(Fence);\n var block = self.SUBRULE(self.codeBlock);\n var fence = self.CONSUME(CloseFence);\n return block;\n });\n //-----------------------------------------------------------\n // Blocks\n //-----------------------------------------------------------\n self.RULE(\"codeBlock\", function (blockId) {\n if (blockId === void 0) { blockId = \"block\"; }\n blockStack = [];\n var block = pushBlock(blockId);\n self.MANY(function () { self.SUBRULE(self.section); });\n return popBlock();\n });\n self.RULE(\"section\", function () {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.searchSection); } },\n { ALT: function () { return self.SUBRULE(self.actionSection); } },\n { ALT: function () { return self.CONSUME(CommentLine); } },\n ]);\n });\n //-----------------------------------------------------------\n // Scope declaration\n //-----------------------------------------------------------\n self.RULE(\"scopeDeclaration\", function () {\n var scopes = [];\n self.OR([\n { ALT: function () {\n self.CONSUME(OpenParen);\n self.AT_LEAST_ONE(function () {\n var name = self.SUBRULE(self.name);\n scopes.push(name.name);\n });\n self.CONSUME(CloseParen);\n } },\n { ALT: function () {\n self.AT_LEAST_ONE2(function () {\n var name = self.SUBRULE2(self.name);\n scopes.push(name.name);\n });\n } },\n ]);\n return scopes;\n });\n //-----------------------------------------------------------\n // Search section\n //-----------------------------------------------------------\n self.RULE(\"searchSection\", function () {\n // @TODO fill in from\n var from = [];\n self.CONSUME(Search);\n var scopes = [\"session\"];\n self.OPTION(function () { scopes = self.SUBRULE(self.scopeDeclaration); });\n self.activeScopes = scopes;\n self.currentAction = \"match\";\n self.block.addSearchScopes(scopes);\n var statements = [];\n self.MANY(function () {\n var statement = self.SUBRULE(self.statement);\n if (statement) {\n statements.push(statement);\n statement.scopes = scopes;\n }\n });\n return makeNode(\"searchSection\", { statements: statements, scopes: scopes, from: from });\n });\n self.RULE(\"statement\", function () {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.comparison); } },\n { ALT: function () { return self.SUBRULE(self.notStatement); } },\n ]);\n });\n //-----------------------------------------------------------\n // Action section\n //-----------------------------------------------------------\n self.RULE(\"actionSection\", function () {\n // @TODO fill in from\n var from = [];\n var action = self.CONSUME(Action).image;\n var actionKey = action;\n var scopes = [\"session\"];\n self.OPTION(function () { scopes = self.SUBRULE(self.scopeDeclaration); });\n self.activeScopes = scopes;\n self.currentAction = action;\n var statements = [];\n self.MANY(function () {\n var statement = self.SUBRULE(self.actionStatement, [actionKey]);\n if (statement) {\n statements.push(statement);\n statement.scopes = scopes;\n }\n });\n return makeNode(\"actionSection\", { statements: statements, scopes: scopes, from: from });\n });\n self.RULE(\"actionStatement\", function (actionKey) {\n return self.OR([\n { ALT: function () {\n var record = self.SUBRULE(self.record, [false, actionKey, \"+=\"]);\n return record;\n } },\n { ALT: function () { return self.SUBRULE(self.actionEqualityRecord, [actionKey]); } },\n { ALT: function () {\n var record = self.SUBRULE(self.actionOperation, [actionKey]);\n self.block[actionKey](record);\n return record;\n } },\n { ALT: function () { return self.SUBRULE(self.actionLookup, [actionKey]); } },\n ]);\n });\n //-----------------------------------------------------------\n // Action operations\n //-----------------------------------------------------------\n self.RULE(\"actionOperation\", function (actionKey) {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.recordOperation, [actionKey]); } },\n { ALT: function () { return self.SUBRULE(self.attributeOperation, [actionKey]); } },\n ]);\n });\n self.RULE(\"attributeOperation\", function (actionKey) {\n var mutator = self.SUBRULE(self.attributeMutator);\n var attribute = mutator.attribute, parent = mutator.parent;\n return self.OR([\n { ALT: function () {\n var variable = self.block.toVariable(attribute.image + \"|\" + attribute.startLine + \"|\" + attribute.startColumn, true);\n var scan = makeNode(\"scan\", { entity: parent, attribute: makeNode(\"constant\", { value: attribute.image, from: [attribute] }), value: variable, scopes: self.activeScopes, from: [mutator] });\n self.block.addUsage(variable, scan);\n self.block.scan(scan);\n self.CONSUME(Merge);\n var record = self.SUBRULE(self.record, [true, actionKey, \"+=\", undefined, variable]);\n record.variable = variable;\n record.action = \"<-\";\n return record;\n } },\n { ALT: function () {\n var op = self.CONSUME(Set);\n var none = self.CONSUME(None);\n return makeNode(\"action\", { action: \"erase\", entity: asValue(parent), attribute: attribute.image, from: [mutator, op, none] });\n } },\n { ALT: function () {\n var op = self.CONSUME2(Set);\n var value = self.SUBRULE(self.infix);\n return makeNode(\"action\", { action: op.image, entity: asValue(parent), attribute: attribute.image, value: asValue(value), from: [mutator, op, value] });\n } },\n { ALT: function () {\n var op = self.CONSUME3(Set);\n var value = self.SUBRULE2(self.record, [false, actionKey, \"+=\", parent]);\n return makeNode(\"action\", { action: op.image, entity: asValue(parent), attribute: attribute.image, value: asValue(value), from: [mutator, op, value] });\n } },\n { ALT: function () {\n var variable = self.block.toVariable(attribute.image + \"|\" + attribute.startLine + \"|\" + attribute.startColumn, true);\n var scan = makeNode(\"scan\", { entity: parent, attribute: makeNode(\"constant\", { value: attribute.image, from: [attribute] }), value: variable, scopes: self.activeScopes, from: [mutator] });\n self.block.addUsage(variable, scan);\n self.block.scan(scan);\n var op = self.CONSUME(Mutate);\n var tag = self.SUBRULE(self.tag);\n return makeNode(\"action\", { action: op.image, entity: variable, attribute: \"tag\", value: makeNode(\"constant\", { value: tag.tag, from: [tag] }), from: [mutator, op, tag] });\n } },\n { ALT: function () {\n var op = self.CONSUME2(Mutate);\n var value = self.SUBRULE2(self.actionAttributeExpression, [actionKey, op.image, parent]);\n if (value.type === \"record\" && !value.extraProjection) {\n value.extraProjection = [parent];\n }\n if (value.type === \"parenthesis\") {\n var autoIndex = 0;\n for (var _i = 0, _a = value.items; _i < _a.length; _i++) {\n var item = _a[_i];\n if (item.type === \"record\" && !value.extraProjection) {\n item.extraProjection = [parent];\n }\n if (item.from[0] && item.from[0].type === \"record\") {\n var record = item.from[0];\n record.attributes.push(makeNode(\"attribute\", { attribute: \"eve-auto-index\", value: makeNode(\"constant\", { value: autoIndex, from: [record] }), from: [record] }));\n autoIndex++;\n }\n }\n }\n return makeNode(\"action\", { action: op.image, entity: asValue(parent), attribute: attribute.image, value: asValue(value), from: [mutator, op, value] });\n } },\n ]);\n });\n self.RULE(\"recordOperation\", function (actionKey) {\n var variable = self.SUBRULE(self.variable);\n return self.OR([\n { ALT: function () {\n var set = self.CONSUME(Set);\n var none = self.CONSUME(None);\n return makeNode(\"action\", { action: \"erase\", entity: asValue(variable), from: [variable, set, none] });\n } },\n { ALT: function () {\n self.CONSUME(Merge);\n var record = self.SUBRULE(self.record, [true, actionKey, \"+=\", undefined, variable]);\n record.needsEntity = true;\n record.action = \"<-\";\n return record;\n } },\n { ALT: function () {\n var op = self.CONSUME(Mutate);\n var tag = self.SUBRULE(self.tag);\n return makeNode(\"action\", { action: op.image, entity: asValue(variable), attribute: \"tag\", value: makeNode(\"constant\", { value: tag.tag, from: [tag] }), from: [variable, op, tag] });\n } },\n ]);\n });\n self.RULE(\"actionLookup\", function (actionKey) {\n var lookup = self.CONSUME(Lookup);\n var record = self.SUBRULE(self.record, [true]);\n var info = {};\n for (var _i = 0, _a = record.attributes; _i < _a.length; _i++) {\n var attribute = _a[_i];\n info[attribute.attribute] = attribute.value;\n }\n var actionType = \"+=\";\n self.OPTION(function () {\n self.CONSUME(Set);\n self.CONSUME(None);\n if (info[\"value\"] !== undefined) {\n actionType = \"-=\";\n }\n else {\n actionType = \"erase\";\n }\n });\n var action = makeNode(\"action\", { action: actionType, entity: info.record, attribute: info.attribute, value: info.value, node: info.node, scopes: self.activeScopes, from: [lookup, record] });\n self.block[actionKey](action);\n return action;\n });\n self.RULE(\"actionAttributeExpression\", function (actionKey, action, parent) {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.record, [false, actionKey, action, parent]); } },\n { ALT: function () { return self.SUBRULE(self.infix); } },\n ]);\n });\n self.RULE(\"actionEqualityRecord\", function (actionKey) {\n var variable = self.SUBRULE(self.variable);\n self.CONSUME(Equality);\n var record = self.SUBRULE(self.record, [true, actionKey, \"+=\"]);\n record.variable = variable;\n self.block[actionKey](record);\n return record;\n });\n //-----------------------------------------------------------\n // Record + attribute\n //-----------------------------------------------------------\n self.RULE(\"record\", function (noVar, blockKey, action, parent, passedVariable) {\n if (noVar === void 0) { noVar = false; }\n if (blockKey === void 0) { blockKey = \"scan\"; }\n if (action === void 0) { action = false; }\n var attributes = [];\n var start = self.CONSUME(OpenBracket);\n var from = [start];\n var info = { attributes: attributes, action: action, scopes: self.activeScopes, from: from };\n if (parent) {\n info.extraProjection = [parent];\n }\n if (passedVariable) {\n info.variable = passedVariable;\n info.variable.nonProjecting = true;\n }\n else if (!noVar) {\n info.variable = self.block.toVariable(\"record|\" + start.startLine + \"|\" + start.startColumn, true);\n info.variable.nonProjecting = true;\n }\n var nonProjecting = false;\n self.MANY(function () {\n self.OR([\n { ALT: function () {\n var attribute = self.SUBRULE(self.attribute, [false, blockKey, action, info.variable]);\n // Inline handles attributes itself and so won't return any attribute for us to add\n // to this object\n if (!attribute)\n return;\n if (attribute.constructor === Array) {\n for (var _i = 0, _a = attribute; _i < _a.length; _i++) {\n var attr = _a[_i];\n attr.nonProjecting = nonProjecting;\n attributes.push(attr);\n from.push(attr);\n }\n }\n else {\n attribute.nonProjecting = nonProjecting;\n attributes.push(attribute);\n from.push(attribute);\n }\n } },\n { ALT: function () {\n nonProjecting = true;\n var pipe = self.CONSUME(Pipe);\n from.push(pipe);\n return pipe;\n } },\n ]);\n });\n from.push(self.CONSUME(CloseBracket));\n var record = makeNode(\"record\", info);\n if (!noVar) {\n self.block.addUsage(info.variable, record);\n self.block[blockKey](record);\n }\n return record;\n });\n self.RULE(\"attribute\", function (noVar, blockKey, action, recordVariable) {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.attributeEquality, [noVar, blockKey, action, recordVariable]); } },\n { ALT: function () { return self.SUBRULE(self.attributeComparison); } },\n { ALT: function () { return self.SUBRULE(self.attributeNot, [recordVariable]); } },\n { ALT: function () { return self.SUBRULE(self.singularAttribute); } },\n { ALT: function () {\n var value = self.SUBRULE(self.value);\n var token = value.from[0];\n var message = \"Value missing attribute\";\n if (value.hasOwnProperty(\"value\")) {\n message = \"\\\"\" + value.value + \"\\\" needs to be labeled with an attribute\";\n }\n self.customErrors.push({\n message: message,\n name: \"Unlabeled value\",\n resyncedTokens: [],\n context: {\n ruleOccurrenceStack: [],\n ruleStack: []\n },\n token: token\n });\n } },\n ]);\n });\n self.RULE(\"singularAttribute\", function (forceGenerate) {\n return self.OR([\n { ALT: function () {\n var tag = self.SUBRULE(self.tag);\n return makeNode(\"attribute\", { attribute: \"tag\", value: makeNode(\"constant\", { value: tag.tag, from: [tag] }), from: [tag] });\n } },\n { ALT: function () {\n var variable = self.SUBRULE(self.variable, [forceGenerate]);\n return makeNode(\"attribute\", { attribute: variable.from[0].image, value: variable, from: [variable] });\n } },\n ]);\n });\n self.RULE(\"attributeMutator\", function () {\n var scans = [];\n var entity, attribute, value;\n var needsEntity = true;\n var from = [];\n entity = self.SUBRULE(self.variable);\n var dot = self.CONSUME(Dot);\n from.push(entity, dot);\n self.MANY(function () {\n attribute = self.CONSUME(Identifier);\n from.push(attribute);\n from.push(self.CONSUME2(Dot));\n value = self.block.toVariable(attribute.image + \"|\" + attribute.startLine + \"|\" + attribute.startColumn, true);\n self.block.addUsage(value, attribute);\n var scopes = self.activeScopes;\n if (self.currentAction !== \"match\") {\n scopes = self.block.searchScopes;\n }\n var scan = makeNode(\"scan\", { entity: entity, attribute: makeNode(\"constant\", { value: attribute.image, from: [value] }), value: value, needsEntity: needsEntity, scopes: scopes, from: [entity, dot, attribute] });\n self.block.scan(scan);\n needsEntity = false;\n entity = value;\n });\n attribute = self.CONSUME2(Identifier);\n from.push(attribute);\n return makeNode(\"attributeMutator\", { attribute: attribute, parent: entity, from: from });\n });\n self.RULE(\"attributeAccess\", function () {\n var scans = [];\n var entity, attribute, value;\n var needsEntity = true;\n entity = self.SUBRULE(self.variable);\n var parentId = entity.name;\n self.AT_LEAST_ONE(function () {\n var dot = self.CONSUME(Dot);\n attribute = self.CONSUME(Identifier);\n parentId = parentId + \"|\" + attribute.image;\n value = self.block.toVariable(parentId, true);\n self.block.addUsage(value, attribute);\n var scopes = self.activeScopes;\n if (self.currentAction !== \"match\") {\n scopes = self.block.searchScopes;\n }\n var scan = makeNode(\"scan\", { entity: entity, attribute: makeNode(\"constant\", { value: attribute.image, from: [attribute] }), value: value, needsEntity: needsEntity, scopes: scopes, from: [entity, dot, attribute] });\n self.block.scan(scan);\n needsEntity = false;\n entity = value;\n });\n return value;\n });\n self.RULE(\"attributeEquality\", function (noVar, blockKey, action, parent) {\n var attributes = [];\n var autoIndex = 1;\n var attributeNode;\n var attribute = self.OR([\n { ALT: function () {\n attributeNode = self.CONSUME(Identifier);\n return attributeNode.image;\n } },\n { ALT: function () {\n attributeNode = self.CONSUME(Num);\n return parseFloat(attributeNode.image);\n } }\n ]);\n var equality = self.CONSUME(Equality);\n var result;\n self.OR2([\n { ALT: function () {\n result = self.SUBRULE(self.infix);\n // if the result is a parenthesis, we have to make sure that if there are sub-records\n // inside that they get eve-auto-index set on them and they also have the parent transfered\n // down to them. If we don't do this, we'll end up with children that are shared between\n // the parents instead of one child per parent.\n if (result.type === \"parenthesis\") {\n for (var _i = 0, _a = result.items; _i < _a.length; _i++) {\n var item = _a[_i];\n // this is a bit sad, but by the time we see the parenthesis, the records have been replaced\n // with their variables. Those variables are created from the record object though, so we can\n // check the from of the variable for a reference to the record.\n if (item.type === \"variable\" && item.from[0] && item.from[0].type === \"record\") {\n var record = item.from[0];\n // if we have a parent, we need to make sure it ends up part of our extraProjection set\n if (parent && !item.extraProjection) {\n record.extraProjection = [parent];\n }\n else if (parent) {\n record.extraProjection.push(parent);\n }\n // Lastly we need to add the eve-auto-index attribute to make sure this is consistent with the case\n // where we leave the parenthesis off and just put records one after another.\n record.attributes.push(makeNode(\"attribute\", { attribute: \"eve-auto-index\", value: makeNode(\"constant\", { value: autoIndex, from: [record] }), from: [record] }));\n autoIndex++;\n }\n }\n }\n } },\n { ALT: function () {\n result = self.SUBRULE(self.record, [noVar, blockKey, action, parent]);\n self.MANY(function () {\n autoIndex++;\n var record = self.SUBRULE2(self.record, [noVar, blockKey, action, parent]);\n record.attributes.push(makeNode(\"attribute\", { attribute: \"eve-auto-index\", value: makeNode(\"constant\", { value: autoIndex, from: [record] }), from: [record] }));\n attributes.push(makeNode(\"attribute\", { attribute: attribute, value: asValue(record), from: [attributeNode, equality, record] }));\n });\n if (autoIndex > 1) {\n result.attributes.push(makeNode(\"attribute\", { attribute: \"eve-auto-index\", value: makeNode(\"constant\", { value: 1, from: [result] }), from: [result] }));\n }\n } },\n ]);\n attributes.push(makeNode(\"attribute\", { attribute: attribute, value: asValue(result), from: [attributeNode, equality, result] }));\n return attributes;\n });\n self.RULE(\"attributeComparison\", function () {\n var attribute = self.CONSUME(Identifier);\n var comparator = self.CONSUME(Comparison);\n var result = self.SUBRULE(self.expression);\n var variable = self.block.toVariable(\"attribute|\" + attribute.startLine + \"|\" + attribute.startColumn, true);\n var expression = makeNode(\"expression\", { op: \"compare/\" + comparator.image, args: [asValue(variable), asValue(result)], from: [attribute, comparator, result] });\n self.block.addUsage(variable, expression);\n self.block.expression(expression);\n return makeNode(\"attribute\", { attribute: attribute.image, value: variable, from: [attribute, comparator, expression] });\n });\n self.RULE(\"attributeNot\", function (recordVariable) {\n var block = pushBlock();\n block.type = \"not\";\n var not = self.CONSUME(Not);\n var start = self.CONSUME(OpenParen);\n var attribute = self.OR([\n { ALT: function () { return self.SUBRULE(self.attributeComparison); } },\n { ALT: function () { return self.SUBRULE(self.singularAttribute, [true]); } },\n ]);\n var end = self.CONSUME(CloseParen);\n // we have to add a record for this guy\n var scan = makeNode(\"scan\", { entity: recordVariable, attribute: makeNode(\"constant\", { value: attribute.attribute, from: [attribute] }), value: attribute.value, needsEntity: true, scopes: self.activeScopes, from: [attribute] });\n block.variables[recordVariable.name] = recordVariable;\n block.scan(scan);\n block.from = [not, start, attribute, end];\n block.startOffset = not.startOffset;\n block.endOffset = toEnd(end);\n popBlock();\n self.block.scan(block);\n return;\n });\n //-----------------------------------------------------------\n // Name and tag\n //-----------------------------------------------------------\n self.RULE(\"name\", function () {\n var at = self.CONSUME(Name);\n var name = self.CONSUME(Identifier);\n self.customErrors.push({ message: \"Databases have been deprecated, so @\" + name.image + \" has no meaning here\", name: \"Database deprecation\", resyncedTokens: [], context: { ruleOccurrenceStack: [], ruleStack: [] }, token: name });\n return makeNode(\"name\", { name: name.image, from: [at, name] });\n });\n self.RULE(\"tag\", function () {\n var hash = self.CONSUME(Tag);\n var tag = self.CONSUME(Identifier);\n return makeNode(\"tag\", { tag: tag.image, from: [hash, tag] });\n });\n //-----------------------------------------------------------\n // Function\n //-----------------------------------------------------------\n self.RULE(\"functionRecord\", function () {\n var name = self.OR([\n { ALT: function () { return self.CONSUME(FunctionIdentifier); } },\n { ALT: function () { return self.CONSUME(Lookup); } }\n ]);\n var record = self.SUBRULE(self.record, [true]);\n if (name.image === \"lookup\") {\n var info = {};\n for (var _i = 0, _a = record.attributes; _i < _a.length; _i++) {\n var attribute = _a[_i];\n info[attribute.attribute] = attribute.value;\n }\n var scan = makeNode(\"scan\", { entity: info.record, attribute: info.attribute, value: info.value, node: info.node, scopes: self.activeScopes, from: [name, record] });\n self.block.scan(scan);\n return scan;\n }\n else {\n var variable = self.block.toVariable(\"return|\" + name.startLine + \"|\" + name.startColumn, true);\n var functionRecord = makeNode(\"functionRecord\", { op: name.image, record: record, variable: variable, from: [name, record] });\n self.block.addUsage(variable, functionRecord);\n self.block.expression(functionRecord);\n return functionRecord;\n }\n });\n //-----------------------------------------------------------\n // Comparison\n //-----------------------------------------------------------\n self.RULE(\"comparison\", function (nonFiltering) {\n var left = self.SUBRULE(self.expression);\n var from = [left];\n var rights = [];\n self.MANY(function () {\n var comparator = self.OR([\n { ALT: function () { return self.CONSUME(Comparison); } },\n { ALT: function () { return self.CONSUME(Equality); } }\n ]);\n var value = self.OR2([\n { ALT: function () { return self.SUBRULE2(self.expression); } },\n { ALT: function () { return self.SUBRULE(self.ifExpression); } }\n ]);\n from.push(comparator, value);\n rights.push({ comparator: comparator, value: value });\n });\n if (rights.length) {\n var expressions = [];\n var curLeft = left;\n for (var _i = 0, rights_1 = rights; _i < rights_1.length; _i++) {\n var pair = rights_1[_i];\n var comparator = pair.comparator, value = pair.value;\n var expression = null;\n // if this is a nonFiltering comparison, then we return an expression\n // with a variable for its return value\n if (nonFiltering) {\n var variable = self.block.toVariable(\"comparison|\" + comparator.startLine + \"|\" + comparator.startColumn, true);\n expression = makeNode(\"expression\", { variable: variable, op: \"compare/\" + comparator.image, args: [asValue(curLeft), asValue(value)], from: [curLeft, comparator, value] });\n self.block.addUsage(variable, expression);\n self.block.expression(expression);\n }\n else if (tokenMatcher(comparator, Equality)) {\n if (value.type === \"choose\" || value.type === \"union\") {\n value.outputs = ifOutputs(left);\n self.block.scan(value);\n }\n else if (value.type === \"functionRecord\" && curLeft.type === \"parenthesis\") {\n value.returns = curLeft.items.map(asValue);\n self.block.equality(asValue(value.returns[0]), asValue(value));\n }\n else if (curLeft.type === \"parenthesis\") {\n throw new Error(\"Left hand parenthesis without an if or function on the right\");\n }\n else {\n self.block.equality(asValue(curLeft), asValue(value));\n }\n }\n else {\n expression = makeNode(\"expression\", { op: \"compare/\" + comparator.image, args: [asValue(curLeft), asValue(value)], from: [curLeft, comparator, value] });\n self.block.expression(expression);\n }\n curLeft = value;\n if (expression) {\n expressions.push(expression);\n }\n }\n return makeNode(\"comparison\", { expressions: expressions, from: from });\n }\n ;\n return left;\n });\n //-----------------------------------------------------------\n // Special Forms\n //-----------------------------------------------------------\n self.RULE(\"notStatement\", function () {\n var block = pushBlock();\n block.type = \"not\";\n var from = [\n self.CONSUME(Not),\n self.CONSUME(OpenParen),\n ];\n self.MANY(function () {\n from.push(self.SUBRULE(self.statement));\n });\n from.push(self.CONSUME(CloseParen));\n popBlock();\n block.from = from;\n block.startOffset = from[0].startOffset;\n block.endOffset = toEnd(from[from.length - 1]);\n self.block.scan(block);\n return;\n });\n //-----------------------------------------------------------\n // If ... then\n //-----------------------------------------------------------\n self.RULE(\"ifExpression\", function () {\n var branches = [];\n var exclusive = false;\n var from = branches;\n branches.push(self.SUBRULE(self.ifBranch));\n self.MANY(function () {\n branches.push(self.OR([\n { ALT: function () { return self.SUBRULE2(self.ifBranch); } },\n { ALT: function () {\n exclusive = true;\n return self.SUBRULE(self.elseIfBranch);\n } },\n ]));\n });\n self.OPTION(function () {\n exclusive = true;\n branches.push(self.SUBRULE(self.elseBranch));\n });\n var expressionType = exclusive ? \"choose\" : \"union\";\n return makeNode(expressionType, { branches: branches, from: from });\n });\n self.RULE(\"ifBranch\", function () {\n var block = pushBlock();\n var from = [\n self.CONSUME(If)\n ];\n self.AT_LEAST_ONE(function () {\n var statement = self.SUBRULE(self.statement);\n if (statement) {\n from.push(statement);\n }\n });\n from.push(self.CONSUME(Then));\n var expression = self.SUBRULE(self.expression);\n from.push(expression);\n block.startOffset = from[0].startOffset;\n block.endOffset = toEnd(from[from.length - 1]);\n popBlock();\n return makeNode(\"ifBranch\", { block: block, outputs: ifOutputs(expression), exclusive: false, from: from });\n });\n self.RULE(\"elseIfBranch\", function () {\n var block = pushBlock();\n var from = [\n self.CONSUME(Else),\n self.CONSUME(If),\n ];\n self.AT_LEAST_ONE(function () {\n var statement = self.SUBRULE(self.statement);\n if (statement) {\n from.push(statement);\n }\n });\n from.push(self.CONSUME(Then));\n var expression = self.SUBRULE(self.expression);\n from.push(expression);\n block.startOffset = from[0].startOffset;\n block.endOffset = toEnd(from[from.length - 1]);\n popBlock();\n return makeNode(\"ifBranch\", { block: block, outputs: ifOutputs(expression), exclusive: true, from: from });\n });\n self.RULE(\"elseBranch\", function () {\n var block = pushBlock();\n var from = [self.CONSUME(Else)];\n var expression = self.SUBRULE(self.expression);\n from.push(expression);\n block.startOffset = from[0].startOffset;\n block.endOffset = toEnd(from[from.length - 1]);\n popBlock();\n return makeNode(\"ifBranch\", { block: block, outputs: ifOutputs(expression), exclusive: true, from: from });\n });\n //-----------------------------------------------------------\n // Infix and operator precedence\n //-----------------------------------------------------------\n self.RULE(\"infix\", function () {\n return self.SUBRULE(self.addition);\n });\n self.RULE(\"addition\", function () {\n var left = self.SUBRULE(self.multiplication);\n var from = [left];\n var ops = [];\n self.MANY(function () {\n var op = self.CONSUME(AddInfix);\n var right = self.SUBRULE2(self.multiplication);\n from.push(op, right);\n ops.push({ op: op, right: right });\n });\n if (!ops.length) {\n return left;\n }\n else {\n var expressions = [];\n var curVar = void 0;\n var curLeft = left;\n for (var _i = 0, ops_1 = ops; _i < ops_1.length; _i++) {\n var pair = ops_1[_i];\n var op = pair.op, right = pair.right;\n curVar = self.block.toVariable(\"addition|\" + op.startLine + \"|\" + op.startColumn, true);\n var expression = makeNode(\"expression\", { op: \"math/\" + op.image, args: [asValue(curLeft), asValue(right)], variable: curVar, from: [curLeft, op, right] });\n expressions.push(expression);\n self.block.addUsage(curVar, expression);\n self.block.expression(expression);\n curLeft = expression;\n }\n return makeNode(\"addition\", { expressions: expressions, variable: curVar, from: from });\n }\n });\n self.RULE(\"multiplication\", function () {\n var left = self.SUBRULE(self.infixValue);\n var from = [left];\n var ops = [];\n self.MANY(function () {\n var op = self.CONSUME(MultInfix);\n var right = self.SUBRULE2(self.infixValue);\n from.push(op, right);\n ops.push({ op: op, right: right });\n });\n if (!ops.length) {\n return left;\n }\n else {\n var expressions = [];\n var curVar = void 0;\n var curLeft = left;\n for (var _i = 0, ops_2 = ops; _i < ops_2.length; _i++) {\n var pair = ops_2[_i];\n var op = pair.op, right = pair.right;\n curVar = self.block.toVariable(\"addition|\" + op.startLine + \"|\" + op.startColumn, true);\n var expression = makeNode(\"expression\", { op: \"math/\" + op.image, args: [asValue(curLeft), asValue(right)], variable: curVar, from: [curLeft, op, right] });\n expressions.push(expression);\n self.block.addUsage(curVar, expression);\n self.block.expression(expression);\n curLeft = expression;\n }\n return makeNode(\"multiplication\", { expressions: expressions, variable: curVar, from: from });\n }\n });\n self.RULE(\"parenthesis\", function () {\n var items = [];\n var from = [];\n from.push(self.CONSUME(OpenParen));\n self.AT_LEAST_ONE(function () {\n var item = self.SUBRULE(self.expression);\n items.push(asValue(item));\n from.push(item);\n });\n from.push(self.CONSUME(CloseParen));\n if (items.length === 1) {\n return items[0];\n }\n return makeNode(\"parenthesis\", { items: items, from: from });\n });\n self.RULE(\"infixValue\", function () {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.attributeAccess); } },\n { ALT: function () { return self.SUBRULE(self.functionRecord); } },\n { ALT: function () { return self.SUBRULE(self.variable); } },\n { ALT: function () { return self.SUBRULE(self.value); } },\n { ALT: function () { return self.SUBRULE(self.parenthesis); } },\n ]);\n });\n //-----------------------------------------------------------\n // Expression\n //-----------------------------------------------------------\n self.RULE(\"expression\", function () {\n var blockKey, action;\n if (self.currentAction !== \"match\") {\n blockKey = self.currentAction;\n action = \"+=\";\n }\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.infix); } },\n { ALT: function () { return self.SUBRULE(self.record, [false, blockKey, action]); } },\n ]);\n });\n //-----------------------------------------------------------\n // Variable\n //-----------------------------------------------------------\n self.RULE(\"variable\", function (forceGenerate) {\n if (forceGenerate === void 0) { forceGenerate = false; }\n var token = self.CONSUME(Identifier);\n var name = token.image;\n if (forceGenerate) {\n name = token.image + \"-\" + token.startLine + \"-\" + token.startColumn;\n }\n var variable = self.block.toVariable(name, forceGenerate);\n self.block.addUsage(variable, token);\n return variable;\n });\n //-----------------------------------------------------------\n // Values\n //-----------------------------------------------------------\n self.RULE(\"stringInterpolation\", function () {\n var args = [];\n var start = self.CONSUME(OpenString);\n var from = [start];\n self.MANY(function () {\n var arg = self.OR([\n { ALT: function () {\n var str = self.CONSUME(StringChars);\n return makeNode(\"constant\", { value: cleanString(str.image), from: [str] });\n } },\n { ALT: function () {\n self.CONSUME(StringEmbedOpen);\n var expression = self.SUBRULE(self.infix);\n self.CONSUME(StringEmbedClose);\n return expression;\n } },\n ]);\n args.push(asValue(arg));\n from.push(arg);\n });\n from.push(self.CONSUME(CloseString));\n if (args.length === 1 && args[0].type === \"constant\") {\n return args[0];\n }\n else if (args.length === 0) {\n return makeNode(\"constant\", { value: \"\", from: from });\n }\n var variable = self.block.toVariable(\"concat|\" + start.startLine + \"|\" + start.startColumn, true);\n var expression = makeNode(\"expression\", { op: \"eve/internal/concat\", args: args, variable: variable, from: from });\n self.block.addUsage(variable, expression);\n self.block.expression(expression);\n return expression;\n });\n self.RULE(\"value\", function () {\n return self.OR([\n { ALT: function () { return self.SUBRULE(self.stringInterpolation); } },\n { ALT: function () { return self.SUBRULE(self.num); } },\n { ALT: function () { return self.SUBRULE(self.bool); } },\n ]);\n });\n self.RULE(\"bool\", function () {\n var value = self.CONSUME(Bool);\n return makeNode(\"constant\", { value: value.image === \"true\", from: [value] });\n });\n self.RULE(\"num\", function () {\n var num = self.CONSUME(Num);\n return makeNode(\"constant\", { value: parseFloat(num.image), from: [num] });\n });\n //-----------------------------------------------------------\n // Chevrotain analysis\n //-----------------------------------------------------------\n Parser.performSelfAnalysis(_this);\n return _this;\n }\n return Parser;\n}(chev.Parser));\nexports.Parser = Parser;\n//-----------------------------------------------------------\n// Public API\n//-----------------------------------------------------------\nfunction nodeToBoundaries(node, offset) {\n if (offset === void 0) { offset = 0; }\n return [node.startOffset, toEnd(node)];\n}\nexports.nodeToBoundaries = nodeToBoundaries;\nvar eveParser = new Parser([]);\nfunction parseBlock(block, blockId, offset, spans, extraInfo) {\n if (offset === void 0) { offset = 0; }\n if (spans === void 0) { spans = []; }\n if (extraInfo === void 0) { extraInfo = {}; }\n var lex = EveBlockLexer.tokenize(block);\n var token;\n var tokenIx = 0;\n for (var _i = 0, _a = lex.tokens; _i < _a.length; _i++) {\n token = _a[_i];\n var tokenId = blockId + \"|token|\" + tokenIx++;\n token.id = tokenId;\n token.startOffset += offset;\n spans.push(token.startOffset, token.startOffset + token.image.length, token.label, tokenId);\n }\n for (var _b = 0, _c = lex.groups.comments; _b < _c.length; _b++) {\n token = _c[_b];\n var tokenId = blockId + \"|token|\" + tokenIx++;\n token.id = tokenId;\n token.startOffset += offset;\n spans.push(token.startOffset, token.startOffset + token.image.length, token.label, tokenId);\n }\n eveParser.input = lex.tokens;\n var results;\n try {\n eveParser.customErrors = [];\n // The parameters here are a strange quirk of how Chevrotain works, I believe the\n // 1 tells chevrotain what level the rule is starting at, we then pass our params\n // to the codeBlock parser function as an array\n results = eveParser.codeBlock(1, [blockId]);\n }\n catch (e) {\n console.error(\"The parser threw an error: \" + e);\n }\n if (results) {\n results.start = offset;\n results.startOffset = offset;\n results.tokens = lex.tokens;\n for (var _d = 0, _e = results.scanLike; _d < _e.length; _d++) {\n var scan = _e[_d];\n var type = \"scan-boundary\";\n if (scan.type === \"record\") {\n type = \"record-boundary\";\n }\n spans.push(scan.startOffset, scan.endOffset, type, scan.id);\n }\n for (var _f = 0, _g = results.binds; _f < _g.length; _f++) {\n var action = _g[_f];\n var type = \"action-boundary\";\n if (action.type === \"record\") {\n type = \"action-record-boundary\";\n }\n spans.push(action.startOffset, action.endOffset, type, action.id);\n extraInfo[action.id] = { kind: \"bind\" };\n }\n for (var _h = 0, _j = results.commits; _h < _j.length; _h++) {\n var action = _j[_h];\n var type = \"action-boundary\";\n if (action.type === \"record\") {\n type = \"action-record-boundary\";\n }\n spans.push(action.startOffset, action.endOffset, type, action.id);\n extraInfo[action.id] = { kind: \"commits\" };\n }\n }\n var errors = errors_1.parserErrors(eveParser.errors.concat(eveParser.customErrors), { blockId: blockId, blockStart: offset, spans: spans, extraInfo: extraInfo, tokens: lex.tokens });\n lex.groups.comments.length = 0;\n return {\n results: results,\n lex: lex,\n errors: errors,\n };\n}\nexports.parseBlock = parseBlock;\nvar docIx = 0;\nfunction parseDoc(doc, docId) {\n if (docId === void 0) { docId = \"doc|\" + docIx++; }\n var _a = parseMarkdown(doc, docId), text = _a.text, spans = _a.spans, blocks = _a.blocks, extraInfo = _a.extraInfo;\n var parsedBlocks = [];\n var allErrors = [];\n for (var _i = 0, blocks_1 = blocks; _i < blocks_1.length; _i++) {\n var block = blocks_1[_i];\n extraInfo[block.id] = { info: block.info, block: block };\n if (block.info.indexOf(\"disabled\") > -1) {\n extraInfo[block.id].disabled = true;\n }\n if (block.info !== \"\" && block.info.indexOf(\"eve\") === -1)\n continue;\n var _b = parseBlock(block.literal, block.id, block.startOffset, spans, extraInfo), results = _b.results, lex = _b.lex, errors = _b.errors;\n // if this block is disabled, we want the parsed spans and such, but we don't want\n // the block to be in the set sent to the builder\n if (!extraInfo[block.id].disabled) {\n if (errors.length) {\n allErrors.push(errors);\n }\n else if (results) {\n results.endOffset = block.endOffset;\n parsedBlocks.push(results);\n }\n }\n }\n var eavs = [];\n for (var _c = 0, parsedBlocks_1 = parsedBlocks; _c < parsedBlocks_1.length; _c++) {\n var block = parsedBlocks_1[_c];\n //if(typeof process === \"undefined\") console.log(block);\n toFacts(eavs, block);\n }\n for (var _d = 0, allErrors_1 = allErrors; _d < allErrors_1.length; _d++) {\n var errorSet = allErrors_1[_d];\n for (var _e = 0, errorSet_1 = errorSet; _e < errorSet_1.length; _e++) {\n var error = errorSet_1[_e];\n errorToFacts(eavs, error, extraInfo[error.blockId].block);\n }\n }\n return {\n results: { blocks: parsedBlocks, text: text, spans: spans, extraInfo: extraInfo, eavs: eavs },\n errors: allErrors,\n };\n}\nexports.parseDoc = parseDoc;\nfunction errorToFacts(eavs, error, block) {\n var text = block.literal;\n var offset = block.startOffset;\n var blockStartLine = block.sourcepos[0][0];\n var blockLines = text.split(\"\\n\");\n var pos = 0;\n var start = error.start - offset;\n var stop = error.stop - offset;\n if (isNaN(stop))\n stop = text.length + offset;\n if (isNaN(start))\n start = offset;\n var curLine = 0;\n var startLine = 0;\n var startChar = 0;\n var stopLine = 0;\n var stopChar = 0;\n while (curLine < blockLines.length && pos < start) {\n pos += blockLines[curLine++].length + 1;\n }\n startLine = blockStartLine + curLine;\n startChar = start - (pos - (blockLines[curLine - 1] || \"\").length) + 2;\n while (curLine < blockLines.length && pos < stop) {\n pos += (blockLines[curLine++] || \"\").length + 1;\n }\n stopLine = blockStartLine + curLine;\n stopChar = stop - (pos - (blockLines[curLine - 1] || \"\").length) + 2;\n var sampleText = [];\n var relativeStart = startLine - blockStartLine;\n var relativeStop = stopLine - blockStartLine;\n if (relativeStart != 0) {\n sampleText.push(blockLines[relativeStart - 1]);\n sampleText.push(blockLines[relativeStart]);\n }\n if (relativeStop > relativeStart) {\n var cur = relativeStart;\n while (cur <= relativeStop) {\n sampleText.push(blockLines[cur]);\n cur++;\n }\n }\n if (relativeStop < blockLines.length && blockLines[relativeStop + 1]) {\n sampleText.push(blockLines[relativeStop + 1]);\n }\n var errorId = uuid();\n var startId = uuid();\n var stopId = uuid();\n eavs.push([errorId, \"tag\", \"eve/compiler/error\"]);\n eavs.push([errorId, \"message\", error.message]);\n eavs.push([errorId, \"start\", startId]);\n eavs.push([startId, \"line\", startLine]);\n eavs.push([startId, \"char\", startChar]);\n eavs.push([errorId, \"stop\", stopId]);\n eavs.push([stopId, \"line\", stopLine]);\n eavs.push([stopId, \"char\", stopChar]);\n eavs.push([errorId, \"sample\", sampleText.join(\"\\n\")]);\n}\nexports.errorToFacts = errorToFacts;\nfunction recordToFacts(eavs, vars, scanLike) {\n var rec = uuid();\n eavs.push([rec, \"tag\", \"eve/compiler/record\"]);\n eavs.push([rec, \"record\", vars[scanLike.variable.name]]);\n for (var _i = 0, _a = scanLike.attributes; _i < _a.length; _i++) {\n var attr = _a[_i];\n if (attr.type === \"attribute\") {\n var values = void 0;\n if (attr.value && attr.value.type === \"parenthesis\") {\n values = attr.value.items;\n }\n else {\n values = [attr.value];\n }\n for (var _b = 0, values_1 = values; _b < values_1.length; _b++) {\n var value = values_1[_b];\n var attrId = uuid();\n eavs.push([attrId, \"attribute\", attr.attribute]);\n eavs.push([attrId, \"value\", asFactValue(vars, value)]);\n eavs.push([rec, \"attribute\", attrId]);\n }\n }\n }\n return rec;\n}\nexports.recordToFacts = recordToFacts;\nfunction asFactValue(vars, value) {\n if (typeof value !== \"object\")\n return value;\n return value.type == \"constant\" ? value.value : vars[value.name];\n}\nfunction outputToFacts(eavs, vars, scanLike, blockId) {\n var rec = uuid();\n eavs.push([rec, \"tag\", \"eve/compiler/output\"]);\n eavs.push([rec, \"record\", vars[scanLike.variable.name]]);\n if (scanLike.action === \"-=\" || scanLike.action === \"erase\") {\n eavs.push([rec, \"tag\", \"eve/compiler/remove\"]);\n }\n else if (scanLike.action === \":=\" || scanLike.action === \"<-\") {\n var attrs = [];\n for (var _i = 0, _a = scanLike.attributes; _i < _a.length; _i++) {\n var attribute = _a[_i];\n attribute.nonProjecting = true;\n if (attribute.type === \"attribute\") {\n if (scanLike.action === \":=\" || (attribute.attribute !== \"tag\")) {\n attrs.push({ type: \"attribute\", attribute: attribute.attribute, nonProjecting: true });\n }\n }\n }\n outputToFacts(eavs, vars, { variable: scanLike.variable, action: \"erase\", attributes: attrs }, blockId);\n }\n for (var _b = 0, _c = scanLike.attributes; _b < _c.length; _b++) {\n var attr = _c[_b];\n if (attr.type === \"attribute\") {\n var values = void 0;\n if (attr.value && attr.value.type === \"parenthesis\") {\n values = attr.value.items;\n }\n else {\n values = [attr.value];\n }\n for (var _d = 0, values_2 = values; _d < values_2.length; _d++) {\n var value = values_2[_d];\n var attrId = uuid();\n eavs.push([attrId, \"attribute\", asFactValue(vars, attr.attribute)]);\n if (value) {\n eavs.push([attrId, \"value\", asFactValue(vars, value)]);\n }\n if (attr.nonProjecting) {\n eavs.push([attrId, \"tag\", \"eve/compiler/attribute/non-identity\"]);\n }\n eavs.push([rec, \"attribute\", attrId]);\n }\n }\n }\n eavs.push([blockId, \"constraint\", rec]);\n return rec;\n}\nexports.outputToFacts = outputToFacts;\nfunction subBlockToFacts(eavs, vars, blockId, block) {\n for (var _i = 0, _a = block.equalities; _i < _a.length; _i++) {\n var _b = _a[_i], left = _b[0], right = _b[1];\n var eqId = uuid();\n eavs.push([eqId, \"tag\", \"eve/compiler/equality\"]);\n eavs.push([eqId, \"left\", asFactValue(vars, left)]);\n eavs.push([eqId, \"right\", asFactValue(vars, right)]);\n eavs.push([blockId, \"constraint\", eqId]);\n }\n for (var _c = 0, _d = block.scanLike; _c < _d.length; _c++) {\n var scanLike = _d[_c];\n switch (scanLike.type) {\n case \"record\":\n var constraint = recordToFacts(eavs, vars, scanLike);\n eavs.push([blockId, \"constraint\", constraint]);\n break;\n case \"scan\":\n var lookupId = uuid();\n eavs.push([lookupId, \"tag\", \"eve/compiler/lookup\"]);\n eavs.push([lookupId, \"record\", asFactValue(vars, scanLike.entity)]);\n eavs.push([lookupId, \"attribute\", asFactValue(vars, scanLike.attribute)]);\n eavs.push([lookupId, \"value\", asFactValue(vars, scanLike.value)]);\n eavs.push([blockId, \"constraint\", lookupId]);\n break;\n case \"not\":\n var notId = uuid();\n eavs.push([notId, \"tag\", \"eve/compiler/not\"]);\n eavs.push([notId, \"tag\", \"eve/compiler/block\"]);\n eavs.push([blockId, \"constraint\", notId]);\n subBlockToFacts(eavs, vars, notId, scanLike);\n break;\n case \"choose\":\n case \"union\":\n var chooseId = uuid();\n if (scanLike.type === \"choose\") {\n eavs.push([chooseId, \"tag\", \"eve/compiler/choose\"]);\n }\n else {\n eavs.push([chooseId, \"tag\", \"eve/compiler/union\"]);\n }\n eavs.push([chooseId, \"tag\", \"eve/compiler/branch-set\"]);\n eavs.push([blockId, \"constraint\", chooseId]);\n for (var _e = 0, _f = scanLike.branches; _e < _f.length; _e++) {\n var branch = _f[_e];\n var branchId = uuid();\n eavs.push([chooseId, \"branch\", branchId]);\n eavs.push([branchId, \"tag\", \"eve/compiler/block\"]);\n subBlockToFacts(eavs, vars, branchId, branch.block);\n var ix_1 = 1;\n for (var _g = 0, _h = branch.outputs; _g < _h.length; _g++) {\n var output = _h[_g];\n var outputId = uuid();\n eavs.push([branchId, \"output\", outputId]);\n eavs.push([outputId, \"value\", asFactValue(vars, output)]);\n eavs.push([outputId, \"index\", ix_1]);\n ix_1++;\n }\n }\n var ix = 1;\n for (var _j = 0, _k = scanLike.outputs; _j < _k.length; _j++) {\n var output = _k[_j];\n var outputId = uuid();\n eavs.push([chooseId, \"output\", outputId]);\n eavs.push([outputId, \"value\", asFactValue(vars, output)]);\n eavs.push([outputId, \"index\", ix]);\n ix++;\n }\n break;\n }\n }\n for (var _l = 0, _m = block.expressions; _l < _m.length; _l++) {\n var expr = _m[_l];\n var exprId = uuid();\n var isAggregate = expr.op.indexOf(\"gather/\") === 0;\n eavs.push([blockId, \"constraint\", exprId]);\n eavs.push([exprId, \"tag\", \"eve/compiler/expression\"]);\n if (isAggregate) {\n eavs.push([exprId, \"tag\", \"eve/compiler/aggregate\"]);\n }\n eavs.push([exprId, \"op\", expr.op]);\n if (expr.type === \"expression\") {\n var ix = 1;\n for (var _o = 0, _p = expr.args; _o < _p.length; _o++) {\n var arg = _p[_o];\n var argId = uuid();\n eavs.push([exprId, \"arg\", argId]);\n eavs.push([argId, \"index\", ix]);\n eavs.push([argId, \"value\", asFactValue(vars, arg)]);\n ix++;\n }\n if (expr.variable) {\n var returnId = uuid();\n eavs.push([exprId, \"return\", returnId]);\n eavs.push([returnId, \"index\", 1]);\n eavs.push([returnId, \"value\", asFactValue(vars, expr.variable)]);\n }\n }\n else if (expr.type === \"functionRecord\") {\n for (var _q = 0, _r = expr.record.attributes; _q < _r.length; _q++) {\n var arg = _r[_q];\n var ix = 1;\n if (arg.value.type === \"parenthesis\") {\n for (var _s = 0, _t = arg.value.items; _s < _t.length; _s++) {\n var value = _t[_s];\n var argId = uuid();\n eavs.push([exprId, \"arg\", argId]);\n eavs.push([argId, \"name\", arg.attribute]);\n eavs.push([argId, \"value\", asFactValue(vars, value)]);\n eavs.push([argId, \"index\", ix]);\n ix++;\n }\n }\n else {\n var argId = uuid();\n eavs.push([exprId, \"arg\", argId]);\n eavs.push([argId, \"name\", arg.attribute]);\n eavs.push([argId, \"value\", asFactValue(vars, arg.value)]);\n eavs.push([argId, \"index\", ix]);\n }\n }\n if (expr.returns) {\n var ix = 1;\n for (var _u = 0, _v = expr.returns; _u < _v.length; _u++) {\n var ret = _v[_u];\n var returnId = uuid();\n eavs.push([exprId, \"return\", returnId]);\n eavs.push([returnId, \"index\", ix]);\n eavs.push([returnId, \"value\", asFactValue(vars, ret.value)]);\n ix++;\n }\n }\n else if (expr.variable) {\n var returnId = uuid();\n eavs.push([exprId, \"return\", returnId]);\n eavs.push([returnId, \"index\", 1]);\n eavs.push([returnId, \"value\", asFactValue(vars, expr.variable)]);\n }\n }\n }\n}\nfunction toFacts(eavs, block) {\n var blockId = uuid();\n eavs.push([blockId, \"tag\", \"eve/compiler/rule\"]);\n eavs.push([blockId, \"tag\", \"eve/compiler/block\"]);\n eavs.push([blockId, \"name\", block.id]);\n var blockType = \"bind\";\n if (block.commits.length) {\n blockType = \"commit\";\n }\n eavs.push([blockId, \"type\", blockType]);\n var vars = {};\n for (var variable in block.variableLookup) {\n var varId = uuid();\n vars[variable] = varId;\n eavs.push([varId, \"tag\", \"eve/compiler/var\"]);\n }\n subBlockToFacts(eavs, vars, blockId, block);\n var outputs = block.binds.concat(block.commits);\n for (var _i = 0, outputs_1 = outputs; _i < outputs_1.length; _i++) {\n var output = outputs_1[_i];\n switch (output.type) {\n case \"record\":\n outputToFacts(eavs, vars, output, blockId);\n break;\n case \"action\":\n outputToFacts(eavs, vars, {\n action: output.action,\n variable: output.entity,\n attributes: [{ type: \"attribute\", attribute: output.attribute, value: output.value, nonProjecting: true }]\n }, blockId);\n break;\n }\n }\n return eavs;\n // let lookup = find(\"eve/compiler/lookup\");\n // let {record:rec, attribute, value} = lookup;\n}\nexports.toFacts = toFacts;\n//# sourceMappingURL=parser.js.map\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar runtime_1 = __webpack_require__(4);\nvar dateformat = __webpack_require__(62);\n//--------------------------------------------------------------------\n// Comparisons\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"compare/>\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a > b) ? [] : undefined;\n }\n});\nruntime_1.makeFunction({\n name: \"compare/>=\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a >= b) ? [] : undefined;\n }\n});\nruntime_1.makeFunction({\n name: \"compare/<\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a < b) ? [] : undefined;\n }\n});\nruntime_1.makeFunction({\n name: \"compare/<=\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a <= b) ? [] : undefined;\n }\n});\nruntime_1.makeFunction({\n name: \"compare/!=\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a != b) ? [] : undefined;\n }\n});\nruntime_1.makeFunction({\n name: \"compare/==\",\n args: { a: \"number\", b: \"number\" },\n returns: {},\n apply: function (a, b) {\n return (a == b) ? [] : undefined;\n }\n});\n//--------------------------------------------------------------------\n// Math\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"math/+\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [a + b];\n }\n});\nruntime_1.makeFunction({\n name: \"math/-\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [a - b];\n }\n});\nruntime_1.makeFunction({\n name: \"math/*\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [a * b];\n }\n});\nruntime_1.makeFunction({\n name: \"math//\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [a / b];\n }\n});\nruntime_1.makeFunction({\n name: \"math/floor\",\n args: { value: \"number\" },\n returns: { result: \"number\" },\n apply: function (value) {\n return [Math.floor(value)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/ceiling\",\n args: { value: \"number\" },\n returns: { result: \"number\" },\n apply: function (value) {\n return [Math.ceil(value)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/round\",\n args: { value: \"number\" },\n returns: { result: \"number\" },\n apply: function (value) {\n return [Math.round(value)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/sin\",\n args: { degrees: \"number\" },\n returns: { result: \"number\" },\n apply: function (degrees) {\n return [Math.sin(degrees / 180 * Math.PI)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/cos\",\n args: { degrees: \"number\" },\n returns: { result: \"number\" },\n apply: function (degrees) {\n return [Math.cos(degrees / 180 * Math.PI)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/tan\",\n args: { degrees: \"number\" },\n returns: { result: \"number\" },\n apply: function (degrees) {\n return [Math.tan(degrees / 180 * Math.PI)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/max\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [Math.max(a, b)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/min\",\n args: { a: \"number\", b: \"number\" },\n returns: { result: \"number\" },\n apply: function (a, b) {\n return [Math.min(a, b)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/mod\",\n args: { value: \"number\", by: \"number\" },\n returns: { result: \"number\" },\n apply: function (value, by) {\n return [value % by];\n }\n});\nruntime_1.makeFunction({\n name: \"math/absolute\",\n args: { value: \"number\" },\n returns: { result: \"number\" },\n apply: function (value) {\n return [Math.abs(value)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/pow\",\n args: { value: \"number\", exponent: \"number\" },\n returns: { result: \"number\" },\n apply: function (value, exponent) {\n return [Math.pow(value, exponent)];\n }\n});\nruntime_1.makeFunction({\n name: \"math/to-fixed\",\n args: { value: \"number\", to: \"number\" },\n returns: { result: \"string\" },\n apply: function (value, to) {\n if (typeof value === \"number\") {\n return [value.toFixed(to)];\n }\n }\n});\nruntime_1.makeFunction({\n name: \"math/convert-base\",\n args: { value: \"number\", to: \"number\" },\n returns: { result: \"string\" },\n apply: function (value, to) {\n if (typeof value === \"number\" && to > 1 && to < 37) {\n return [value.toString(to)];\n }\n }\n});\nruntime_1.makeMultiFunction({\n name: \"math/range\",\n args: { start: \"number\", stop: \"number\" },\n returns: { result: \"string\" },\n estimate: function (context, prefix) {\n var _a = this.resolve(prefix), start = _a.start, stop = _a.stop;\n if (typeof start !== \"number\" || typeof stop !== \"number\")\n return 0;\n if (start > stop) {\n return start - stop;\n }\n else {\n return stop - start;\n }\n },\n apply: function (start, stop, step) {\n if (step === void 0) { step = 1; }\n if (typeof start !== \"number\" || typeof stop !== \"number\" || typeof step !== \"number\")\n return;\n if (start > stop) {\n _a = [start, stop], stop = _a[0], start = _a[1];\n }\n var outputs = [];\n for (var ix = start; ix <= stop; ix += step) {\n outputs.push([ix]);\n }\n return outputs;\n var _a;\n }\n});\n//--------------------------------------------------------------------\n// String\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"string/replace\",\n args: { text: \"string\", replace: \"string\", with: \"string\" },\n returns: { result: \"string\" },\n apply: function (text, replace, _with) {\n var result = text.split(replace).join(_with);\n return [result];\n }\n});\nruntime_1.makeFunction({\n name: \"string/get\",\n args: { text: \"string\", at: \"number\" },\n returns: { result: \"string\" },\n apply: function (text, at) {\n if (at > text.length)\n return;\n return [text[at - 1]];\n }\n});\nruntime_1.makeFunction({\n name: \"string/uppercase\",\n args: { text: \"string\" },\n returns: { result: \"string\" },\n apply: function (text) {\n return [text.toLocaleUpperCase()];\n }\n});\nruntime_1.makeFunction({\n name: \"string/lowercase\",\n args: { text: \"string\" },\n returns: { result: \"string\" },\n apply: function (text) {\n return [text.toLocaleLowerCase()];\n }\n});\nruntime_1.makeFunction({\n name: \"string/index-of\",\n args: { text: \"string\", substring: \"string\" },\n returns: { result: \"number\" },\n apply: function (text, substring) {\n var ix = (\"\" + text).indexOf(substring);\n if (ix == -1)\n return;\n return [ix];\n }\n});\nruntime_1.makeFunction({\n name: \"string/codepoint-length\",\n args: { text: \"string\" },\n returns: { result: \"number\" },\n apply: function (text) {\n if (typeof text !== \"string\")\n return;\n return [text.length];\n }\n});\n//--------------------------------------------------------------------\n// Random\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"random/number\",\n args: { seed: \"any\" },\n returns: { result: \"number\" },\n initialState: {},\n apply: function (seed) {\n var state = this.state;\n var result = state[seed];\n if (result === undefined) {\n result = state[seed] = Math.random();\n }\n return [result];\n }\n});\n//--------------------------------------------------------------------\n// Logic\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"logic/toggle\",\n args: { value: \"string\" },\n returns: { result: \"string\" },\n apply: function (value) {\n if (value === \"true\")\n return [\"false\"];\n if (value === \"false\")\n return [\"true\"];\n return [];\n }\n});\n//--------------------------------------------------------------------\n// Date\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"date/format\",\n args: { timestamp: \"number\", format: \"string\" },\n returns: { result: \"string\" },\n apply: function (timestamp, format) {\n return [dateformat(timestamp, format)];\n }\n});\n//--------------------------------------------------------------------\n// Eve internal\n//--------------------------------------------------------------------\nruntime_1.makeFunction({\n name: \"eve/internal/gen-id\",\n args: {},\n variadic: true,\n returns: { result: \"string\" },\n apply: function (values) {\n // @FIXME: This is going to be busted in subtle cases.\n // If a record exists with a \"1\" and 1 value for the same\n // attribute, they'll collapse for gen-id, but won't join\n // elsewhere. This means aggregate cardinality will disagree with\n // action node cardinality.\n return [values.join(\"|\")];\n }\n});\nruntime_1.makeFunction({\n name: \"eve/internal/concat\",\n args: {},\n variadic: true,\n returns: { result: \"string\" },\n apply: function (values) {\n return [values.join(\"\")];\n }\n});\nvar SumAggregate = (function (_super) {\n __extends(SumAggregate, _super);\n function SumAggregate() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.name = \"Sum\";\n return _this;\n }\n SumAggregate.prototype.add = function (state, resolved) {\n state.total += resolved[0];\n return state;\n };\n SumAggregate.prototype.remove = function (state, resolved) {\n state.total -= resolved[0];\n return state;\n };\n SumAggregate.prototype.getResult = function (state) {\n return state.total;\n };\n SumAggregate.prototype.newResultState = function () {\n return { total: 0 };\n };\n ;\n return SumAggregate;\n}(runtime_1.AggregateNode));\nexports.SumAggregate = SumAggregate;\n//# sourceMappingURL=stdlib.js.map\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar uuid_1 = __webpack_require__(7);\nvar UIWatcher = (function (_super) {\n __extends(UIWatcher, _super);\n function UIWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.helpers = UIWatcher.helpers;\n return _this;\n }\n UIWatcher._addAttrs = function (id, attrs, eavs) {\n if (eavs === void 0) { eavs = []; }\n if (attrs) {\n for (var attr in attrs) {\n if (attrs[attr].constructor !== Array) {\n eavs.push([id, attr, attrs[attr]]);\n }\n else {\n var vals = attrs[attr];\n // We have a nested sub-object (i.e. a set of EAVs).\n if (vals[0].constructor === Array) {\n var childEAVs = vals;\n var childId = childEAVs[0][0];\n eavs.push([id, attr, childId]);\n for (var _i = 0, childEAVs_1 = childEAVs; _i < childEAVs_1.length; _i++) {\n var childEAV = childEAVs_1[_i];\n eavs.push(childEAV);\n }\n }\n else {\n for (var _a = 0, _b = vals; _a < _b.length; _a++) {\n var val = _b[_a];\n eavs.push([id, attr, val]);\n }\n }\n }\n }\n }\n return eavs;\n };\n UIWatcher.$elem = function (tag, attrs) {\n var id = uuid_1.v4();\n var eavs = [\n [id, \"tag\", tag],\n ];\n UIWatcher._addAttrs(id, attrs, eavs);\n return eavs;\n };\n UIWatcher._makeContainer = function (tag) {\n function $container(attrsOrChildren, maybeChildren) {\n var attrs;\n var children;\n if (maybeChildren) {\n attrs = attrsOrChildren;\n children = maybeChildren;\n }\n else {\n children = attrsOrChildren;\n }\n var eavs = UIWatcher.$elem(tag, attrs);\n var id = eavs[0][0];\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var child = children_1[_i];\n var childId = child[0][0];\n eavs.push([id, \"children\", childId]);\n for (var _a = 0, child_1 = child; _a < child_1.length; _a++) {\n var childEAV = child_1[_a];\n eavs.push(childEAV);\n }\n }\n return eavs;\n }\n return $container;\n };\n UIWatcher.prototype.setup = function () {\n this.program.attach(\"html\");\n this.program\n .bind(\"Decorate row elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/row\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"row\")];\n })\n .bind(\"Decorate column elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/column\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"column\")];\n })\n .bind(\"Decorate spacer elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/spacer\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"spacer\")];\n })\n .bind(\"Decorate input elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/input\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"input\")];\n })\n .bind(\"Decorate text elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/text\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"text\")];\n })\n .bind(\"Decorate a elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/a\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"a\")];\n })\n .bind(\"Decorate style elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/style\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"style\")];\n })\n .bind(\"Decorate link elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/link\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"link\")];\n })\n .bind(\"Decorate div elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/div\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"div\")];\n })\n .bind(\"Decorate span elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/span\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"span\")];\n })\n .bind(\"Decorate img elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/img\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"img\")];\n })\n .bind(\"Decorate h1 elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/h1\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"h1\")];\n })\n .bind(\"Decorate h2 elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/h2\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"h2\")];\n })\n .bind(\"Decorate h3 elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/h3\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"h3\")];\n })\n .bind(\"Decorate ul elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/ul\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"ul\")];\n })\n .bind(\"Decorate ol elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/ol\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"ol\")];\n })\n .bind(\"Decorate li elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/li\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"li\")];\n });\n // Buttons\n this.program\n .bind(\"Decorate button elements as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/button\");\n return [elem.add(\"tag\", \"html/element\").add(\"tagname\", \"div\").add(\"class\", \"button\")];\n })\n .bind(\"Decorate button elements with icons.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/button\");\n return [elem.add(\"class\", \"iconic\").add(\"class\", \"ion-\" + elem.icon)];\n });\n //--------------------------------------------------------------------\n // Field Table\n //--------------------------------------------------------------------\n this.program\n .bind(\"Decorate field tables as html.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elem = find(\"ui/field-table\");\n return [elem.add({ tag: \"html/element\", tagname: \"table\", cellspacing: 0 })];\n })\n .bind(\"Field tables have a value_row for each AV pair in their fields.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var table = find(\"ui/field-table\");\n var field = table.field;\n var attribute = field.attribute, value = field.value;\n var editable = choose(function () { field.editable == \"value\"; return \"true\"; }, function () { return \"false\"; })[0];\n return [table.add(\"value_row\", [\n record({ field: field, attribute: attribute, value: value })\n .add(\"editable\", editable)\n ])];\n })\n .bind(\"If a table is editable: all attach each specific editing mode.\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var table = find(\"ui/field-table\", \"ui/editable\");\n return [table.add(\"editable\", [\n // Modify existing\n \"value\",\n \"attribute\",\n // Create new,\n \"row\",\n \"field\"\n ])];\n })\n .bind(\"A table's fields inherit the editing mode of their table if they don't specify their own.\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var table = find(\"ui/field-table\");\n var field = table.field;\n var editable = choose(function () { return field.editable; }, function () { return table.editable; })[0];\n return [field.add(\"editable\", editable)];\n })\n .bind(\"Create a row for each unique field.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var table = find(\"ui/field-table\");\n var field = table.field;\n return [\n table.add(\"children\", [\n record(\"ui/field-table/row\", { table: table, field: field })\n ])\n ];\n })\n .commit(\"If a field is row editable, add value_rows for the field when no empty ones exist.\", function (_a) {\n var find = _a.find, not = _a.not, gather = _a.gather, choose = _a.choose, record = _a.record;\n var table = find(\"ui/field-table\");\n var field = table.field;\n field.editable == \"row\";\n not(function () { return find(\"ui/field-table/cell\", { table: table, field: field, column: \"value\", value: \"\" }); });\n var count = choose(function () {\n var cell = find(\"ui/field-table/cell\", { field: field });\n return gather(cell).per(field).count() + 1;\n }, function () { return 1; })[0];\n return [\n table.add(\"value_row\", [\n record(\"ui/field-table/value-row/new\", { sort: \"zz\" + count, field: field, attribute: field.attribute, value: \"\" })\n .add(\"editable\", \"true\")\n ])\n ];\n })\n .commit(\"If a field is row editable, clear any excess empty rows.\", function (_a) {\n var find = _a.find, record = _a.record;\n var table = find(\"ui/field-table\");\n var field = table.field;\n field.editable == \"row\";\n var cell = find(\"ui/field-table/cell\", { table: table, field: field, column: \"value\", value: \"\" });\n var other = find(\"ui/field-table/cell\", { table: table, field: field, column: \"value\", value: \"\" });\n other.sort > cell.sort;\n return [other.value_row.remove()];\n })\n .commit(\"If a table is field editable, add a field when no empty ones exist.\", function (_a) {\n var find = _a.find, not = _a.not, gather = _a.gather, choose = _a.choose, record = _a.record;\n var table = find(\"ui/field-table\", { editable: \"field\" });\n not(function () { return find(\"ui/field-table/attribute\", { table: table, column: \"attribute\", value: \"\" }); });\n var count = choose(function () {\n table == find(\"ui/field-table\"); // @FIXME: Hackaround aggregate bug.\n return gather(table.field).per(table).count() + 1;\n }, function () { return 1; })[0];\n return [\n table.add(\"field\", [\n record(\"ui/field-table/field/new\", { sort: \"zz\" + count, attribute: \"\", value: \"\" })\n .add(\"editable\", table.editable)\n .add(\"editable\", [\"attribute\", \"value\"])\n ])\n ];\n })\n .commit(\"If a table is field editable, clear any excess empty fields.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, not = _a.not, choose = _a.choose, record = _a.record;\n var table = find(\"ui/field-table\", { editable: \"field\" });\n var table_alias = find(\"ui/field-table\", { editable: \"field\" });\n table == table_alias;\n // Two new fields exist\n var field = find(\"ui/field-table/field/new\");\n var other_field = find(\"ui/field-table/field/new\");\n // In the same table\n table.field == field;\n table_alias.field == other_field;\n // Both are empty\n not(function () { return table.change.field == field; });\n not(function () { return table_alias.change.field == other_field; });\n // And the other is before this one.\n other_field.sort < field.sort;\n return [field.remove()];\n })\n .bind(\"Each field row has an attribute and a value set.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var field_row = find(\"ui/field-table/row\");\n var table = field_row.table, field = field_row.field;\n var sort = choose(function () { return field.sort; }, function () { return field.attribute; }, function () { return 1; })[0];\n var editable = choose(function () { field.editable == \"attribute\"; return \"true\"; }, function () { return \"false\"; })[0];\n return [\n field_row.add({ tag: \"html/element\", tagname: \"tr\", sort: sort }).add(\"children\", [\n record(\"html/element\", { sort: 1, tagname: \"td\", table: table, field: field }).add(\"children\", [\n record(\"ui/field-table/attribute\", \"ui/field-table/cell\", { table: table, field: field, value_row: field, column: \"attribute\" })\n .add(\"editable\", editable)\n ]),\n record(\"html/element\", { sort: 2, tagname: \"td\", table: table, field: field }).add(\"children\", [\n record(\"ui/field-table/value-set\", \"ui/column\", { table: table, field: field })\n ])\n ])\n ];\n })\n .bind(\"Create a value for each field value in the value set.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var value_set = find(\"ui/field-table/value-set\");\n var table = value_set.table, field = value_set.field;\n var value_row = table.value_row;\n value_row.field == field;\n var value = value_row.value, editable = value_row.editable;\n var sort = choose(function () { return value_row.sort; }, function () { return value; })[0];\n return [\n value_set.add(\"children\", [\n record(\"ui/field-table/value\", \"ui/field-table/cell\", { sort: sort, table: table, field: field, value_row: value_row, column: \"value\", editable: editable }),\n ])\n ];\n })\n .bind(\"The initial value of a cell is pulled off it's value_row or field.\", function (_a) {\n var find = _a.find, choose = _a.choose, not = _a.not, lookup = _a.lookup, record = _a.record;\n var cell = find(\"ui/field-table/cell\");\n var field = cell.field, value_row = cell.value_row, column = cell.column;\n var _b = lookup(value_row), attribute = _b.attribute, initial = _b.value;\n attribute == column;\n return [cell.add(\"initial\", initial)];\n })\n .bind(\"Draw field cells as text if they're not editable.\", function (_a) {\n var find = _a.find;\n var cell = find(\"ui/field-table/cell\", { editable: \"false\" });\n var field = cell.field, column = cell.column, initial = cell.initial;\n return [cell.add({ tag: \"ui/text\", text: initial })];\n })\n .bind(\"Draw field cells as inputs when they're editable.\", function (_a) {\n var find = _a.find;\n var cell = find(\"ui/field-table/cell\", { editable: \"true\" });\n var field = cell.field, column = cell.column, initial = cell.initial;\n return [cell.add({ tag: [\"ui/input\", \"html/autosize-input\"], placeholder: column + \"...\" })];\n })\n .bind(\"When a cell changes value, update the tables changes list.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var cell = find(\"ui/field-table/cell\");\n var table = cell.table, field = cell.field, column = cell.column, value = cell.value, value_row = cell.value_row, initial = cell.initial;\n field.editable == column;\n value != initial;\n return [table.add(\"change\", [\n record(\"ui/field-change\", { field: field }).add(\"cell\", [\n record({ column: column, initial: initial, value: value })\n ])\n ])];\n });\n this.autocomplete();\n };\n //--------------------------------------------------------------------\n // Autocomplete\n //--------------------------------------------------------------------\n UIWatcher.prototype.autocomplete = function () {\n this.program\n .bind(\"Decorate autocompletes.\", function (_a) {\n var find = _a.find, record = _a.record;\n var autocomplete = find(\"ui/autocomplete\");\n return [\n autocomplete.add({ tag: \"ui/column\" }).add(\"children\", [\n record(\"ui/autocomplete/input\", \"ui/input\", { sort: 1, autocomplete: autocomplete })\n ])\n ];\n })\n .bind(\"Copy input placeholder.\", function (_a) {\n var find = _a.find;\n var input = find(\"ui/autocomplete/input\");\n return [input.add({ placeholder: input.autocomplete.placeholder })];\n })\n .bind(\"Copy input initial.\", function (_a) {\n var find = _a.find;\n var input = find(\"ui/autocomplete/input\");\n return [input.add({ initial: input.autocomplete.initial })];\n })\n .bind(\"Copy trigger focus.\", function (_a) {\n var find = _a.find;\n var autocomplete = find(\"ui/autocomplete\", \"html/trigger/focus\");\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n return [input.add({ tag: \"html/trigger/focus\" })];\n })\n .bind(\"Copy autosize input.\", function (_a) {\n var find = _a.find;\n var autocomplete = find(\"ui/autocomplete\", \"html/autosize-input\");\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n return [input.add({ tag: \"html/autosize-input\" })];\n })\n .bind(\"An autocompletes value is it's input's.\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var input = find(\"ui/autocomplete/input\");\n var value = choose(function () { return input.value; }, function () { return \"\"; })[0];\n return [input.autocomplete.add(\"value\", value)];\n })\n .commit(\"If an autocomplete's value disagrees with it's selected, clear the selected.\", function (_a) {\n var find = _a.find;\n var autocomplete = find(\"ui/autocomplete\");\n var selected = autocomplete.selected, value = autocomplete.value;\n selected.text != value;\n return [autocomplete.remove(\"selected\")];\n })\n .bind(\"Completions that match the current input value are matches.\", function (_a) {\n var find = _a.find, string = _a.lib.string;\n var autocomplete = find(\"ui/autocomplete\");\n var value = autocomplete.value, completion = autocomplete.completion;\n var ix = string[\"index-of\"](string.lowercase(completion.text), string.lowercase(value));\n return [autocomplete.add(\"match\", completion)];\n })\n .bind(\"Matches are sorted by length.\", function (_a) {\n var find = _a.find, string = _a.lib.string;\n var autocomplete = find(\"ui/autocomplete\");\n var match = autocomplete.match;\n var sort = string[\"codepoint-length\"](match.text);\n return [match.add(\"sort\", sort)];\n })\n .bind(\"Show the matches in a popout beneath the input.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var autocomplete = find(\"ui/autocomplete\");\n var match = autocomplete.match;\n var _b = lookup(match), attribute = _b.attribute, value = _b.value;\n attribute != \"tag\";\n return [\n autocomplete.add(\"children\", [\n record(\"ui/autocomplete/matches\", \"ui/column\", { sort: 2, autocomplete: autocomplete }).add(\"children\", [\n record(\"ui/autocomplete/match\", \"ui/text\", { autocomplete: autocomplete, match: match, sort: match.sort }).add(attribute, value)\n ])\n ])\n ];\n });\n //--------------------------------------------------------------------\n // Autocomplete Interaction\n //--------------------------------------------------------------------\n this.program\n .commit(\"Clicking a match updates the selected and value of the autocomplete.\", function (_a) {\n var find = _a.find, record = _a.record;\n var ui_match = find(\"ui/autocomplete/match\");\n find(\"html/event/mouse-down\", { element: ui_match });\n var autocomplete = ui_match.autocomplete, match = ui_match.match;\n return [\n record(\"ui/event/select\", { autocomplete: autocomplete, selected: match }),\n ];\n })\n .commit(\"Focusing an autocomplete input opens the autocomplete.\", function (_a) {\n var find = _a.find, record = _a.record;\n var input = find(\"ui/autocomplete/input\");\n find(\"html/event/focus\", { element: input });\n return [record(\"ui/event/open\", { autocomplete: input.autocomplete })];\n })\n .commit(\"Blurring an autocomplete input closes the autocomplete.\", function (_a) {\n var find = _a.find, record = _a.record;\n var input = find(\"ui/autocomplete/input\");\n find(\"html/event/blur\", { element: input });\n return [record(\"ui/event/close\", { autocomplete: input.autocomplete })];\n })\n .commit(\"If the value matches perfectly on blur, select that match.\", function (_a) {\n var find = _a.find, string = _a.lib.string, record = _a.record;\n var input = find(\"ui/autocomplete/input\");\n var value = find(\"html/event/blur\", { element: input }).value;\n var autocomplete = input.autocomplete;\n var match = autocomplete.match;\n string.lowercase(match.text) == string.lowercase(value);\n return [record(\"ui/event/select\", { autocomplete: autocomplete, selected: match })];\n })\n .commit(\"Pressing escape in an open autocomplete closes it.\", function (_a) {\n var find = _a.find, not = _a.not, record = _a.record;\n var autocomplete = find(\"ui/autocomplete\", { open: \"true\" });\n find(\"html/event/key-down\", { key: \"escape\", element: autocomplete });\n return [record(\"ui/event/close\", { autocomplete: autocomplete })];\n })\n .commit(\"Pressing enter in an open autocomplete submits it.\", function (_a) {\n var find = _a.find, record = _a.record;\n var autocomplete = find(\"ui/autocomplete\", { open: \"true\" });\n find(\"html/event/key-down\", { key: \"enter\", element: autocomplete });\n return [\n record(\"ui/event/submit\", { autocomplete: autocomplete }),\n record(\"ui/event/close\", { autocomplete: autocomplete })\n ];\n })\n .commit(\"Pressing tab in an open autocomplete selects the top match.\", function (_a) {\n var find = _a.find, gather = _a.gather, record = _a.record;\n var autocomplete = find(\"ui/autocomplete\", { open: \"true\" });\n find(\"html/event/key-down\", { key: \"tab\", element: autocomplete });\n var match = autocomplete.match;\n 1 == gather(match.sort).per(autocomplete).sort();\n return [\n record(\"ui/event/select\", { autocomplete: autocomplete, selected: match }),\n record(\"ui/event/close\", { autocomplete: autocomplete })\n ];\n });\n //--------------------------------------------------------------------\n // Autocomplete Events\n //--------------------------------------------------------------------\n this.program\n .commit(\"Clear the specified autocomplete.\", function (_a) {\n var find = _a.find;\n var event = find(\"ui/event/clear\");\n var autocomplete = event.autocomplete;\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n return [\n input.remove(\"value\"),\n event.remove()\n ];\n })\n .commit(\"When an autocomplete is opened, store it's previous value.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var event = find(\"ui/event/open\");\n var autocomplete = event.autocomplete;\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n var value = choose(function () { return autocomplete.previous; }, function () { return autocomplete.value; }, function () { return \"\"; })[0];\n return [\n autocomplete.remove(\"open\").add({ open: \"true\", previous: value }),\n input.remove(\"tag\", \"html/trigger/blur\"),\n event.remove()\n ];\n })\n .commit(\"When an autocomplete is closed, erase it's previous value.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var event = find(\"ui/event/close\");\n var autocomplete = event.autocomplete;\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n return [\n autocomplete.remove(\"open\").remove(\"previous\"),\n input.add(\"tag\", \"html/trigger/blur\"),\n autocomplete.remove(\"tag\", \"html/trigger/focus\"),\n event.remove()\n ];\n })\n .commit(\"When an autocomplete is closed, and it's value is changed, emit a change event.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var event = find(\"ui/event/close\");\n var autocomplete = event.autocomplete;\n autocomplete.value != autocomplete.previous;\n return [\n record(\"ui/event/change\", { autocomplete: autocomplete, value: autocomplete.value })\n ];\n })\n .commit(\"Selecting a completion updates the autocomplete.\", function (_a) {\n var find = _a.find, record = _a.record;\n var event = find(\"ui/event/select\");\n var autocomplete = event.autocomplete, selected = event.selected;\n var input = find(\"ui/autocomplete/input\", { autocomplete: autocomplete });\n return [\n input.remove(\"value\").add(\"value\", selected.text),\n autocomplete.remove(\"selected\").add(\"selected\", selected),\n event.remove()\n ];\n })\n .commit(\"When a selection is made and it's different from the previous value, emit a change event.\", function (_a) {\n var find = _a.find, record = _a.record;\n var event = find(\"ui/event/select\");\n var autocomplete = event.autocomplete, selected = event.selected;\n selected.text != autocomplete.previous;\n return [\n record(\"ui/event/change\", { autocomplete: autocomplete, value: selected.text })\n ];\n })\n .commit(\"Clear the autocomplete change event.\", function (_a) {\n var find = _a.find, record = _a.record;\n var event = find(\"ui/event/change\");\n var autocomplete = event.autocomplete;\n return [event.remove()];\n });\n };\n UIWatcher.helpers = {\n $style: function (attrs) {\n return UIWatcher._addAttrs(uuid_1.v4(), attrs);\n },\n $elem: UIWatcher.$elem,\n $text: function (text, attrs) {\n var eavs = UIWatcher.$elem(\"ui/text\", attrs);\n var id = eavs[0][0];\n eavs.push([id, \"text\", text]);\n return eavs;\n },\n $button: function (attrs) {\n return UIWatcher.$elem(\"ui/button\", attrs);\n },\n $row: UIWatcher._makeContainer(\"ui/row\"),\n $column: UIWatcher._makeContainer(\"ui/column\"),\n };\n return UIWatcher;\n}(watcher_1.Watcher));\nexports.UIWatcher = UIWatcher;\nwatcher_1.Watcher.register(\"ui\", UIWatcher);\n//# sourceMappingURL=ui.js.map\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar parser_public_1 = __webpack_require__(14);\nvar lexer_public_1 = __webpack_require__(15);\nvar tokens_public_1 = __webpack_require__(3);\nvar exceptions_public_1 = __webpack_require__(25);\nvar gast_public_1 = __webpack_require__(2);\nvar cache_public_1 = __webpack_require__(47);\nvar interpreter_1 = __webpack_require__(12);\nvar version_1 = __webpack_require__(29);\n/**\n * defines the public API of\n * changes here may require major version change. (semVer)\n */\nvar API = {};\n// semantic version\nAPI.VERSION = version_1.VERSION;\n// runtime API\nAPI.Parser = parser_public_1.Parser;\nAPI.ParserDefinitionErrorType = parser_public_1.ParserDefinitionErrorType;\nAPI.Lexer = lexer_public_1.Lexer;\nAPI.LexerDefinitionErrorType = lexer_public_1.LexerDefinitionErrorType;\nAPI.Token = tokens_public_1.Token;\nAPI.EOF = tokens_public_1.EOF;\n// Tokens utilities\nAPI.tokenName = tokens_public_1.tokenName;\nAPI.tokenLabel = tokens_public_1.tokenLabel;\nAPI.tokenMatcher = tokens_public_1.tokenMatcher;\nAPI.createToken = tokens_public_1.createToken;\nAPI.extendToken = tokens_public_1.extendToken;\nAPI.createTokenInstance = tokens_public_1.createTokenInstance;\nAPI.getTokenConstructor = tokens_public_1.getTokenConstructor;\n// Other Utilities\nAPI.EMPTY_ALT = parser_public_1.EMPTY_ALT;\nAPI.exceptions = {};\nAPI.exceptions.isRecognitionException = exceptions_public_1.exceptions.isRecognitionException;\nAPI.exceptions.EarlyExitException = exceptions_public_1.exceptions.EarlyExitException;\nAPI.exceptions.MismatchedTokenException = exceptions_public_1.exceptions.MismatchedTokenException;\nAPI.exceptions.NotAllInputParsedException = exceptions_public_1.exceptions.NotAllInputParsedException;\nAPI.exceptions.NoViableAltException = exceptions_public_1.exceptions.NoViableAltException;\n// grammar reflection API\nAPI.gast = {};\nAPI.gast.GAstVisitor = gast_public_1.gast.GAstVisitor;\nAPI.gast.Flat = gast_public_1.gast.Flat;\nAPI.gast.Repetition = gast_public_1.gast.Repetition;\nAPI.gast.RepetitionWithSeparator = gast_public_1.gast.RepetitionWithSeparator;\nAPI.gast.RepetitionMandatory = gast_public_1.gast.RepetitionMandatory;\nAPI.gast.RepetitionMandatoryWithSeparator = gast_public_1.gast.RepetitionMandatoryWithSeparator;\nAPI.gast.Option = gast_public_1.gast.Option;\nAPI.gast.Alternation = gast_public_1.gast.Alternation;\nAPI.gast.NonTerminal = gast_public_1.gast.NonTerminal;\nAPI.gast.Terminal = gast_public_1.gast.Terminal;\nAPI.gast.Rule = gast_public_1.gast.Rule;\nAPI.gast.serializeGrammar = gast_public_1.gast.serializeGrammar;\nAPI.gast.serializeProduction = gast_public_1.gast.serializeProduction;\nAPI.interperter = {};\nAPI.interperter.NextAfterTokenWalker = interpreter_1.NextAfterTokenWalker;\nAPI.clearCache = cache_public_1.clearCache;\nmodule.exports = API;\n//# sourceMappingURL=api.js.map\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// TODO: can this be removed? where is it used?\nexports.IN = \"_~IN~_\";\n//# sourceMappingURL=constants.js.map\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tokens_public_1 = __webpack_require__(3);\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\nvar lang_extensions_1 = __webpack_require__(5);\nvar keys_1 = __webpack_require__(27);\nvar GAstVisitor = gast_public_1.gast.GAstVisitor;\nfunction addTerminalToCst(node, token, tokenTypeName) {\n node.children[tokenTypeName].push(token);\n}\nexports.addTerminalToCst = addTerminalToCst;\nfunction addNoneTerminalToCst(node, ruleName, ruleResult) {\n node.children[ruleName].push(ruleResult);\n}\nexports.addNoneTerminalToCst = addNoneTerminalToCst;\nvar NamedDSLMethodsCollectorVisitor = (function (_super) {\n __extends(NamedDSLMethodsCollectorVisitor, _super);\n function NamedDSLMethodsCollectorVisitor(ruleIdx) {\n var _this = _super.call(this) || this;\n _this.result = [];\n _this.ruleIdx = ruleIdx;\n return _this;\n }\n NamedDSLMethodsCollectorVisitor.prototype.collectNamedDSLMethod = function (node, newNodeConstructor, methodIdx) {\n if (!utils_1.isUndefined(node.name)) {\n // copy without name so this will indeed be processed later.\n var nameLessNode = void 0;\n if (utils_1.has(node, \"separator\")) {\n // hack to avoid code duplication and refactoring the Gast type declaration / constructors arguments order.\n nameLessNode = new newNodeConstructor(node.definition, node.separator, node.occurrenceInParent);\n }\n else {\n nameLessNode = new newNodeConstructor(node.definition, node.occurrenceInParent);\n }\n var def = [nameLessNode];\n var key = keys_1.getKeyForAutomaticLookahead(this.ruleIdx, methodIdx, node.occurrenceInParent);\n this.result.push({ def: def, key: key, name: node.name });\n }\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitOption = function (node) {\n this.collectNamedDSLMethod(node, gast_public_1.gast.Option, keys_1.OPTION_IDX);\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitRepetition = function (node) {\n this.collectNamedDSLMethod(node, gast_public_1.gast.Repetition, keys_1.MANY_IDX);\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitRepetitionMandatory = function (node) {\n this.collectNamedDSLMethod(node, gast_public_1.gast.RepetitionMandatory, keys_1.AT_LEAST_ONE_IDX);\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) {\n this.collectNamedDSLMethod(node, gast_public_1.gast.RepetitionMandatoryWithSeparator, keys_1.AT_LEAST_ONE_SEP_IDX);\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitRepetitionWithSeparator = function (node) {\n this.collectNamedDSLMethod(node, gast_public_1.gast.RepetitionWithSeparator, keys_1.MANY_SEP_IDX);\n };\n NamedDSLMethodsCollectorVisitor.prototype.visitAlternation = function (node) {\n var _this = this;\n this.collectNamedDSLMethod(node, gast_public_1.gast.Alternation, keys_1.OR_IDX);\n var hasMoreThanOneAlternative = node.definition.length > 1;\n utils_1.forEach(node.definition, function (currFlatAlt, altIdx) {\n if (!utils_1.isUndefined(currFlatAlt.name)) {\n var def = currFlatAlt.definition;\n if (hasMoreThanOneAlternative) {\n def = [new gast_public_1.gast.Option(currFlatAlt.definition)];\n }\n else {\n def = currFlatAlt.definition;\n }\n var key = keys_1.getKeyForAltIndex(_this.ruleIdx, keys_1.OR_IDX, node.occurrenceInParent, altIdx);\n _this.result.push({ def: def, key: key, name: currFlatAlt.name });\n }\n });\n };\n return NamedDSLMethodsCollectorVisitor;\n}(GAstVisitor));\nexports.NamedDSLMethodsCollectorVisitor = NamedDSLMethodsCollectorVisitor;\nfunction analyzeCst(topRules, fullToShortName) {\n var result = { dictDef: new lang_extensions_1.HashTable(), allRuleNames: [] };\n utils_1.forEach(topRules, function (currTopRule) {\n var currChildrenNames = buildChildDictionaryDef(currTopRule.definition);\n var currTopRuleShortName = fullToShortName.get(currTopRule.name);\n result.dictDef.put(currTopRuleShortName, buildInitDefFunc(currChildrenNames));\n result.allRuleNames.push(currTopRule.name);\n var namedCollectorVisitor = new NamedDSLMethodsCollectorVisitor(currTopRuleShortName);\n currTopRule.accept(namedCollectorVisitor);\n utils_1.forEach(namedCollectorVisitor.result, function (_a) {\n var def = _a.def, key = _a.key, name = _a.name;\n var currNestedChildrenNames = buildChildDictionaryDef(def);\n result.dictDef.put(key, buildInitDefFunc(currNestedChildrenNames));\n result.allRuleNames.push(currTopRule.name + name);\n });\n });\n return result;\n}\nexports.analyzeCst = analyzeCst;\nfunction buildInitDefFunc(childrenNames) {\n var funcString = \"return {\\n\";\n funcString += utils_1.map(childrenNames, function (currName) { return \"\\\"\" + currName + \"\\\" : []\"; }).join(\",\\n\");\n funcString += \"}\";\n // major performance optimization, faster to create the children dictionary this way\n // versus iterating over the childrenNames each time.\n return Function(funcString);\n}\nfunction buildChildDictionaryDef(initialDef) {\n var result = [];\n var possiblePaths = [];\n possiblePaths.push({ def: initialDef });\n var currDef;\n var currInIteration;\n var currInOption;\n var currResult;\n function addSingleItemToResult(itemName) {\n result.push(itemName);\n var nextPath = {\n def: utils_1.drop(currDef),\n inIteration: currInIteration,\n inOption: currInOption,\n currResult: utils_1.cloneObj(currResult)\n };\n possiblePaths.push(nextPath);\n }\n while (!utils_1.isEmpty(possiblePaths)) {\n var currPath = possiblePaths.pop();\n currDef = currPath.def;\n currInIteration = currPath.inIteration;\n currInOption = currPath.inOption;\n currResult = currPath.currResult;\n // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT\n if (utils_1.isEmpty(currDef)) {\n continue;\n }\n var prod = currDef[0];\n if (prod instanceof gast_public_1.gast.Terminal) {\n var terminalName = tokens_public_1.tokenName(prod.terminalType);\n addSingleItemToResult(terminalName);\n }\n else if (prod instanceof gast_public_1.gast.NonTerminal) {\n var nonTerminalName = prod.nonTerminalName;\n addSingleItemToResult(nonTerminalName);\n }\n else if (prod instanceof gast_public_1.gast.Option) {\n if (!utils_1.isUndefined(prod.name)) {\n addSingleItemToResult(prod.name);\n }\n else {\n var nextPathWith = {\n def: prod.definition.concat(utils_1.drop(currDef)),\n };\n possiblePaths.push(nextPathWith);\n }\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatory || prod instanceof gast_public_1.gast.Repetition) {\n if (!utils_1.isUndefined(prod.name)) {\n addSingleItemToResult(prod.name);\n }\n else {\n var nextDef = prod.definition.concat(utils_1.drop(currDef));\n var nextPath = {\n def: nextDef\n };\n possiblePaths.push(nextPath);\n }\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator || prod instanceof gast_public_1.gast.RepetitionWithSeparator) {\n if (!utils_1.isUndefined(prod.name)) {\n addSingleItemToResult(prod.name);\n }\n else {\n var separatorGast = new gast_public_1.gast.Terminal(prod.separator);\n var secondIteration = new gast_public_1.gast.Repetition([separatorGast].concat(prod.definition), prod.occurrenceInParent);\n // Hack: X (, X)* --> (, X) because it is identical in terms of identifying \"isCollection?\"\n var nextDef = [secondIteration].concat(utils_1.drop(currDef));\n var nextPath = {\n def: nextDef\n };\n possiblePaths.push(nextPath);\n }\n }/* istanbul ignore else */ \n else if (prod instanceof gast_public_1.gast.Alternation) {\n \n if (!utils_1.isUndefined(prod.name)) {\n addSingleItemToResult(prod.name);\n }\n else {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n for (var i = prod.definition.length - 1; i >= 0; i--) {\n var currAlt = prod.definition[i];\n // named alternatives\n if (!utils_1.isUndefined(currAlt.name)) {\n addSingleItemToResult(currAlt.name);\n }\n else {\n var newDef = currAlt.definition.concat(utils_1.drop(currDef));\n var currAltPath = {\n def: newDef\n };\n possiblePaths.push(currAltPath);\n }\n }\n }\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n }\n return result;\n}\nexports.buildChildDictionaryDef = buildChildDictionaryDef;\n//# sourceMappingURL=cst.js.map\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar exceptions;\n(function (exceptions) {\n var MISMATCHED_TOKEN_EXCEPTION = \"MismatchedTokenException\";\n var NO_VIABLE_ALT_EXCEPTION = \"NoViableAltException\";\n var EARLY_EXIT_EXCEPTION = \"EarlyExitException\";\n var NOT_ALL_INPUT_PARSED_EXCEPTION = \"NotAllInputParsedException\";\n var RECOGNITION_EXCEPTION_NAMES = [\n MISMATCHED_TOKEN_EXCEPTION,\n NO_VIABLE_ALT_EXCEPTION,\n EARLY_EXIT_EXCEPTION,\n NOT_ALL_INPUT_PARSED_EXCEPTION\n ];\n Object.freeze(RECOGNITION_EXCEPTION_NAMES);\n // hacks to bypass no support for custom Errors in javascript/typescript\n function isRecognitionException(error) {\n // can't do instanceof on hacked custom js exceptions\n return utils_1.contains(RECOGNITION_EXCEPTION_NAMES, error.name);\n }\n exceptions.isRecognitionException = isRecognitionException;\n function MismatchedTokenException(message, token) {\n this.name = MISMATCHED_TOKEN_EXCEPTION;\n this.message = message;\n this.token = token;\n this.resyncedTokens = [];\n }\n exceptions.MismatchedTokenException = MismatchedTokenException;\n // must use the \"Error.prototype\" instead of \"new Error\"\n // because the stack trace points to where \"new Error\" was invoked\"\n MismatchedTokenException.prototype = Error.prototype;\n function NoViableAltException(message, token) {\n this.name = NO_VIABLE_ALT_EXCEPTION;\n this.message = message;\n this.token = token;\n this.resyncedTokens = [];\n }\n exceptions.NoViableAltException = NoViableAltException;\n NoViableAltException.prototype = Error.prototype;\n function NotAllInputParsedException(message, token) {\n this.name = NOT_ALL_INPUT_PARSED_EXCEPTION;\n this.message = message;\n this.token = token;\n this.resyncedTokens = [];\n }\n exceptions.NotAllInputParsedException = NotAllInputParsedException;\n NotAllInputParsedException.prototype = Error.prototype;\n function EarlyExitException(message, token) {\n this.name = EARLY_EXIT_EXCEPTION;\n this.message = message;\n this.token = token;\n this.resyncedTokens = [];\n }\n exceptions.EarlyExitException = EarlyExitException;\n EarlyExitException.prototype = Error.prototype;\n})(exceptions = exports.exceptions || (exports.exceptions = {}));\n//# sourceMappingURL=exceptions_public.js.map\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils = __webpack_require__(0);\nvar utils_1 = __webpack_require__(0);\nvar parser_public_1 = __webpack_require__(14);\nvar gast_public_1 = __webpack_require__(2);\nvar gast_1 = __webpack_require__(11);\nvar tokens_public_1 = __webpack_require__(3);\nvar first_1 = __webpack_require__(10);\nvar lookahead_1 = __webpack_require__(28);\nvar version_1 = __webpack_require__(29);\nvar cst_1 = __webpack_require__(24);\nfunction validateGrammar(topLevels, maxLookahead, tokens, ignoredIssues) {\n var duplicateErrors = utils.map(topLevels, validateDuplicateProductions);\n var leftRecursionErrors = utils.map(topLevels, function (currTopRule) { return validateNoLeftRecursion(currTopRule, currTopRule); });\n var emptyAltErrors = [];\n var ambiguousAltsErrors = [];\n // left recursion could cause infinite loops in the following validations.\n // It is safest to first have the user fix the left recursion errors first and only then examine farther issues.\n if (utils_1.every(leftRecursionErrors, utils_1.isEmpty)) {\n emptyAltErrors = utils_1.map(topLevels, validateEmptyOrAlternative);\n ambiguousAltsErrors = utils_1.map(topLevels, function (currTopRule) {\n return validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, ignoredIssues);\n });\n }\n var ruleNames = utils_1.map(topLevels, function (currTopLevel) { return currTopLevel.name; });\n var tokenNames = utils_1.map(tokens, function (currToken) { return tokens_public_1.tokenName(currToken); });\n var termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(ruleNames, tokenNames);\n var tokenNameErrors = utils.map(tokenNames, validateTokenName);\n var nestedRulesNameErrors = validateNestedRulesNames(topLevels);\n var nestedRulesDuplicateErrors = validateDuplicateNestedRules(topLevels);\n var emptyRepetitionErrors = validateSomeNonEmptyLookaheadPath(topLevels, maxLookahead);\n return utils.flatten(duplicateErrors.concat(tokenNameErrors, nestedRulesNameErrors, nestedRulesDuplicateErrors, emptyRepetitionErrors, leftRecursionErrors, emptyAltErrors, ambiguousAltsErrors, termsNamespaceConflictErrors));\n}\nexports.validateGrammar = validateGrammar;\nfunction validateNestedRulesNames(topLevels) {\n var result = [];\n utils_1.forEach(topLevels, function (curTopLevel) {\n var namedCollectorVisitor = new cst_1.NamedDSLMethodsCollectorVisitor(\"\");\n curTopLevel.accept(namedCollectorVisitor);\n var nestedNamesPerRule = utils_1.map(namedCollectorVisitor.result, function (currItem) { return currItem.name; });\n var currTopRuleName = curTopLevel.name;\n result.push(utils_1.map(nestedNamesPerRule, function (currNestedName) { return validateNestedRuleName(currNestedName, currTopRuleName); }));\n });\n return utils_1.flatten(result);\n}\nfunction validateDuplicateProductions(topLevelRule) {\n var collectorVisitor = new OccurrenceValidationCollector();\n topLevelRule.accept(collectorVisitor);\n var allRuleProductions = collectorVisitor.allProductions;\n var productionGroups = utils.groupBy(allRuleProductions, identifyProductionForDuplicates);\n var duplicates = utils.pick(productionGroups, function (currGroup) {\n return currGroup.length > 1;\n });\n var errors = utils.map(utils.values(duplicates), function (currDuplicates) {\n var firstProd = utils.first(currDuplicates);\n var msg = createDuplicatesErrorMessage(currDuplicates, topLevelRule.name);\n var dslName = gast_1.getProductionDslName(firstProd);\n var defError = {\n message: msg,\n type: parser_public_1.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,\n ruleName: topLevelRule.name,\n dslName: dslName,\n occurrence: firstProd.occurrenceInParent\n };\n var param = getExtraProductionArgument(firstProd);\n if (param) {\n defError.parameter = param;\n }\n return defError;\n });\n return errors;\n}\nfunction createDuplicatesErrorMessage(duplicateProds, topLevelName) {\n var firstProd = utils.first(duplicateProds);\n var index = firstProd.occurrenceInParent;\n var dslName = gast_1.getProductionDslName(firstProd);\n var extraArgument = getExtraProductionArgument(firstProd);\n var msg = \"->\" + dslName + \"<- with occurrence index: ->\" + index + \"<-\\n \" + (extraArgument ? \"and argument: \" + extraArgument : \"\") + \"\\n appears more than once (\" + duplicateProds.length + \" times) in the top level rule: \" + topLevelName + \".\\n \" + (index === 1 ? \"note that \" + dslName + \" and \" + dslName + \"1 both have the same occurrence index 1}\" : \"\") + \"}\\n to fix this make sure each usage of \" + dslName + \" \" + (extraArgument ? \"with the argument: \" + extraArgument : \"\") + \"\\n in the rule \" + topLevelName + \" has a different occurrence index (1-5), as that combination acts as a unique\\n position key in the grammar, which is needed by the parsing engine.\";\n // white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...\n msg = msg.replace(/[ \\t]+/g, \" \");\n msg = msg.replace(/\\s\\s+/g, \"\\n\");\n return msg;\n}\nfunction identifyProductionForDuplicates(prod) {\n return gast_1.getProductionDslName(prod) + \"_#_\" + prod.occurrenceInParent + \"_#_\" + getExtraProductionArgument(prod);\n}\nexports.identifyProductionForDuplicates = identifyProductionForDuplicates;\nfunction getExtraProductionArgument(prod) {\n if (prod instanceof gast_public_1.gast.Terminal) {\n return tokens_public_1.tokenName(prod.terminalType);\n }\n else if (prod instanceof gast_public_1.gast.NonTerminal) {\n return prod.nonTerminalName;\n }\n else {\n return \"\";\n }\n}\nvar OccurrenceValidationCollector = (function (_super) {\n __extends(OccurrenceValidationCollector, _super);\n function OccurrenceValidationCollector() {\n var _this = _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n _this.allProductions = [];\n return _this;\n }\n OccurrenceValidationCollector.prototype.visitNonTerminal = function (subrule) {\n this.allProductions.push(subrule);\n };\n OccurrenceValidationCollector.prototype.visitOption = function (option) {\n this.allProductions.push(option);\n };\n OccurrenceValidationCollector.prototype.visitRepetitionWithSeparator = function (manySep) {\n this.allProductions.push(manySep);\n };\n OccurrenceValidationCollector.prototype.visitRepetitionMandatory = function (atLeastOne) {\n this.allProductions.push(atLeastOne);\n };\n OccurrenceValidationCollector.prototype.visitRepetitionMandatoryWithSeparator = function (atLeastOneSep) {\n this.allProductions.push(atLeastOneSep);\n };\n OccurrenceValidationCollector.prototype.visitRepetition = function (many) {\n this.allProductions.push(many);\n };\n OccurrenceValidationCollector.prototype.visitAlternation = function (or) {\n this.allProductions.push(or);\n };\n OccurrenceValidationCollector.prototype.visitTerminal = function (terminal) {\n this.allProductions.push(terminal);\n };\n return OccurrenceValidationCollector;\n}(gast_public_1.gast.GAstVisitor));\nexports.OccurrenceValidationCollector = OccurrenceValidationCollector;\nexports.validTermsPattern = /^[a-zA-Z_]\\w*$/;\nexports.validNestedRuleName = new RegExp(exports.validTermsPattern.source.replace(\"^\", \"^\\\\$\"));\nfunction validateRuleName(ruleName) {\n var errors = [];\n var errMsg;\n if (!ruleName.match(exports.validTermsPattern)) {\n errMsg = \"Invalid Grammar rule name: ->\" + ruleName + \"<- it must match the pattern: ->\" + exports.validTermsPattern.toString() + \"<-\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.INVALID_RULE_NAME,\n ruleName: ruleName\n });\n }\n return errors;\n}\nexports.validateRuleName = validateRuleName;\nfunction validateNestedRuleName(nestedRuleName, containingRuleName) {\n var errors = [];\n var errMsg;\n if (!nestedRuleName.match(exports.validNestedRuleName)) {\n errMsg = \"Invalid nested rule name: ->\" + nestedRuleName + \"<- inside rule: ->\" + containingRuleName + \"<-\\n\" +\n (\"it must match the pattern: ->\" + exports.validNestedRuleName.toString() + \"<-.\\n\") +\n \"Note that this means a nested rule name must start with the '$'(dollar) sign.\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.INVALID_NESTED_RULE_NAME,\n ruleName: nestedRuleName\n });\n }\n return errors;\n}\nexports.validateNestedRuleName = validateNestedRuleName;\nfunction validateTokenName(tokenNAme) {\n var errors = [];\n var errMsg;\n if (!tokenNAme.match(exports.validTermsPattern)) {\n errMsg = \"Invalid Grammar Token name: ->\" + tokenNAme + \"<- it must match the pattern: ->\" + exports.validTermsPattern.toString() + \"<-\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.INVALID_TOKEN_NAME\n });\n }\n return errors;\n}\nexports.validateTokenName = validateTokenName;\nfunction validateRuleDoesNotAlreadyExist(ruleName, definedRulesNames, className) {\n var errors = [];\n var errMsg;\n if ((utils.contains(definedRulesNames, ruleName))) {\n errMsg = \"Duplicate definition, rule: ->\" + ruleName + \"<- is already defined in the grammar: ->\" + className + \"<-\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: ruleName\n });\n }\n return errors;\n}\nexports.validateRuleDoesNotAlreadyExist = validateRuleDoesNotAlreadyExist;\n// TODO: is there anyway to get only the rule names of rules inherited from the super grammars?\nfunction validateRuleIsOverridden(ruleName, definedRulesNames, className) {\n var errors = [];\n var errMsg;\n if (!(utils.contains(definedRulesNames, ruleName))) {\n errMsg = \"Invalid rule override, rule: ->\" + ruleName + \"<- cannot be overridden in the grammar: ->\" + className + \"<-\" +\n \"as it is not defined in any of the super grammars \";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,\n ruleName: ruleName\n });\n }\n return errors;\n}\nexports.validateRuleIsOverridden = validateRuleIsOverridden;\nfunction validateNoLeftRecursion(topRule, currRule, path) {\n if (path === void 0) { path = []; }\n var errors = [];\n var nextNonTerminals = getFirstNoneTerminal(currRule.definition);\n if (utils.isEmpty(nextNonTerminals)) {\n return [];\n }\n else {\n var ruleName = topRule.name;\n var foundLeftRecursion = utils.contains(nextNonTerminals, topRule);\n var pathNames = utils.map(path, function (currRule) { return currRule.name; });\n var leftRecursivePath = ruleName + \" --> \" + pathNames.concat([ruleName]).join(\" --> \");\n if (foundLeftRecursion) {\n var errMsg = \"Left Recursion found in grammar.\\n\" +\n (\"rule: <\" + ruleName + \"> can be invoked from itself (directly or indirectly)\\n\") +\n (\"without consuming any Tokens. The grammar path that causes this is: \\n \" + leftRecursivePath + \"\\n\") +\n \" To fix this refactor your grammar to remove the left recursion.\\n\" +\n \"see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.LEFT_RECURSION,\n ruleName: ruleName\n });\n }\n // we are only looking for cyclic paths leading back to the specific topRule\n // other cyclic paths are ignored, we still need this difference to avoid infinite loops...\n var validNextSteps = utils.difference(nextNonTerminals, path.concat([topRule]));\n var errorsFromNextSteps = utils.map(validNextSteps, function (currRefRule) {\n var newPath = utils.cloneArr(path);\n newPath.push(currRefRule);\n return validateNoLeftRecursion(topRule, currRefRule, newPath);\n });\n return errors.concat(utils.flatten(errorsFromNextSteps));\n }\n}\nexports.validateNoLeftRecursion = validateNoLeftRecursion;\nfunction getFirstNoneTerminal(definition) {\n var result = [];\n if (utils.isEmpty(definition)) {\n return result;\n }\n var firstProd = utils.first(definition);\n if (firstProd instanceof gast_public_1.gast.NonTerminal) {\n result.push(firstProd.referencedRule);\n }\n else if (firstProd instanceof gast_public_1.gast.Flat ||\n firstProd instanceof gast_public_1.gast.Option ||\n firstProd instanceof gast_public_1.gast.RepetitionMandatory ||\n firstProd instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator ||\n firstProd instanceof gast_public_1.gast.RepetitionWithSeparator ||\n firstProd instanceof gast_public_1.gast.Repetition) {\n result = result.concat(getFirstNoneTerminal(firstProd.definition));\n }\n else if (firstProd instanceof gast_public_1.gast.Alternation) {\n // each sub definition in alternation is a FLAT\n result = utils.flatten(utils.map(firstProd.definition, function (currSubDef) { return getFirstNoneTerminal(currSubDef.definition); }));\n }/* istanbul ignore else */ \n else if (firstProd instanceof gast_public_1.gast.Terminal) {\n // nothing to see, move along\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n var isFirstOptional = gast_1.isOptionalProd(firstProd);\n var hasMore = definition.length > 1;\n if (isFirstOptional && hasMore) {\n var rest = utils.drop(definition);\n return result.concat(getFirstNoneTerminal(rest));\n }\n else {\n return result;\n }\n}\nexports.getFirstNoneTerminal = getFirstNoneTerminal;\nvar OrCollector = (function (_super) {\n __extends(OrCollector, _super);\n function OrCollector() {\n var _this = _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n _this.alternations = [];\n return _this;\n }\n OrCollector.prototype.visitAlternation = function (node) {\n this.alternations.push(node);\n };\n return OrCollector;\n}(gast_public_1.gast.GAstVisitor));\nfunction validateEmptyOrAlternative(topLevelRule) {\n var orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n var ors = orCollector.alternations;\n var errors = utils.reduce(ors, function (errors, currOr) {\n var exceptLast = utils.dropRight(currOr.definition);\n var currErrors = utils.map(exceptLast, function (currAlternative, currAltIdx) {\n if (utils.isEmpty(first_1.first(currAlternative))) {\n return {\n message: \"Ambiguous empty alternative: <\" + (currAltIdx + 1) + \">\" +\n (\" in <OR\" + currOr.occurrenceInParent + \"> inside <\" + topLevelRule.name + \"> Rule.\\n\") +\n \"Only the last alternative may be an empty alternative.\",\n type: parser_public_1.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,\n ruleName: topLevelRule.name,\n occurrence: currOr.occurrenceInParent,\n alternative: currAltIdx + 1\n };\n }\n else {\n return null;\n }\n });\n return errors.concat(utils.compact(currErrors));\n }, []);\n return errors;\n}\nexports.validateEmptyOrAlternative = validateEmptyOrAlternative;\nfunction validateAmbiguousAlternationAlternatives(topLevelRule, maxLookahead, ignoredIssues) {\n var orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n var ors = orCollector.alternations;\n var ignoredIssuesForCurrentRule = ignoredIssues[topLevelRule.name];\n if (ignoredIssuesForCurrentRule) {\n ors = utils_1.reject(ors, function (currOr) { return ignoredIssuesForCurrentRule[gast_1.getProductionDslName(currOr) + currOr.occurrenceInParent]; });\n }\n var errors = utils.reduce(ors, function (result, currOr) {\n var currOccurrence = currOr.occurrenceInParent;\n var alternatives = lookahead_1.getLookaheadPathsForOr(currOccurrence, topLevelRule, maxLookahead);\n var altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule.name);\n var altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule.name);\n return result.concat(altsAmbiguityErrors, altsPrefixAmbiguityErrors);\n }, []);\n return errors;\n}\nexports.validateAmbiguousAlternationAlternatives = validateAmbiguousAlternationAlternatives;\nvar RepetionCollector = (function (_super) {\n __extends(RepetionCollector, _super);\n function RepetionCollector() {\n var _this = _super !== null && _super.apply(this, arguments) /* istanbul ignore next */ || this;\n _this.allProductions = [];\n return _this;\n }\n RepetionCollector.prototype.visitRepetitionWithSeparator = function (manySep) {\n this.allProductions.push(manySep);\n };\n RepetionCollector.prototype.visitRepetitionMandatory = function (atLeastOne) {\n this.allProductions.push(atLeastOne);\n };\n RepetionCollector.prototype.visitRepetitionMandatoryWithSeparator = function (atLeastOneSep) {\n this.allProductions.push(atLeastOneSep);\n };\n RepetionCollector.prototype.visitRepetition = function (many) {\n this.allProductions.push(many);\n };\n return RepetionCollector;\n}(gast_public_1.gast.GAstVisitor));\nexports.RepetionCollector = RepetionCollector;\nfunction validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead) {\n var errors = [];\n utils_1.forEach(topLevelRules, function (currTopRule) {\n var collectorVisitor = new RepetionCollector();\n currTopRule.accept(collectorVisitor);\n var allRuleProductions = collectorVisitor.allProductions;\n utils_1.forEach(allRuleProductions, function (currProd) {\n var prodType = lookahead_1.getProdType(currProd);\n var currOccurrence = currProd.occurrenceInParent;\n var paths = lookahead_1.getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, maxLookahead);\n var pathsInsideProduction = paths[0];\n if (utils_1.isEmpty(utils_1.flatten(pathsInsideProduction))) {\n var implicitOccurrence = currProd.implicitOccurrenceIndex;\n var dslName = gast_1.getProductionDslName(currProd);\n if (!implicitOccurrence) {\n dslName += currOccurrence;\n }\n var errMsg = \"The repetition <\" + dslName + \"> within Rule <\" + currTopRule.name + \"> can never consume any tokens.\\n\" +\n \"This could lead to an infinite loop.\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,\n ruleName: currTopRule.name\n });\n }\n });\n });\n return errors;\n}\nexports.validateSomeNonEmptyLookaheadPath = validateSomeNonEmptyLookaheadPath;\nfunction checkAlternativesAmbiguities(alternatives, alternation, topRuleName) {\n var foundAmbiguousPaths = [];\n var identicalAmbiguities = utils_1.reduce(alternatives, function (result, currAlt, currAltIdx) {\n utils_1.forEach(currAlt, function (currPath) {\n var altsCurrPathAppearsIn = [currAltIdx];\n utils_1.forEach(alternatives, function (currOtherAlt, currOtherAltIdx) {\n if (currAltIdx !== currOtherAltIdx && lookahead_1.containsPath(currOtherAlt, currPath)) {\n altsCurrPathAppearsIn.push(currOtherAltIdx);\n }\n });\n if (altsCurrPathAppearsIn.length > 1 && !lookahead_1.containsPath(foundAmbiguousPaths, currPath)) {\n foundAmbiguousPaths.push(currPath);\n result.push({\n alts: altsCurrPathAppearsIn,\n path: currPath\n });\n }\n });\n return result;\n }, []);\n var currErrors = utils.map(identicalAmbiguities, function (currAmbDescriptor) {\n var ambgIndices = utils_1.map(currAmbDescriptor.alts, function (currAltIdx) { return currAltIdx + 1; });\n var pathMsg = utils_1.map(currAmbDescriptor.path, function (currtok) { return tokens_public_1.tokenLabel(currtok); }).join(\", \");\n var occurrence = alternation.implicitOccurrenceIndex ? \"\" : alternation.occurrenceInParent;\n var currMessage = \"Ambiguous alternatives: <\" + ambgIndices.join(\" ,\") + \"> in <OR\" + occurrence + \">\" +\n (\" inside <\" + topRuleName + \"> Rule,\\n\") +\n (\"<\" + pathMsg + \"> may appears as a prefix path in all these alternatives.\\n\");\n var docs_version = version_1.VERSION.replace(/\\./g, \"_\");\n // Should this information be on the error message or in some common errors docs?\n currMessage = currMessage + \"To Resolve this, try one of of the following: \\n\" +\n \"1. Refactor your grammar to be LL(K) for the current value of k (by default k=5)\\n\" +\n \"2. Increase the value of K for your grammar by providing a larger 'maxLookahead' value in the parser's config\\n\" +\n \"3. This issue can be ignored (if you know what you are doing...), see\" +\n \" http://sap.github.io/chevrotain/documentation/\" + docs_version + \"/interfaces/iparserconfig.html#ignoredissues for more\" +\n \" details\\n\";\n return {\n message: currMessage,\n type: parser_public_1.ParserDefinitionErrorType.AMBIGUOUS_ALTS,\n ruleName: topRuleName,\n occurrence: alternation.occurrenceInParent,\n alternatives: [currAmbDescriptor.alts]\n };\n });\n return currErrors;\n}\nfunction checkPrefixAlternativesAmbiguities(alternatives, alternation, ruleName) {\n var errors = [];\n // flatten\n var pathsAndIndices = utils_1.reduce(alternatives, function (result, currAlt, idx) {\n var currPathsAndIdx = utils_1.map(currAlt, function (currPath) {\n return { idx: idx, path: currPath };\n });\n return result.concat(currPathsAndIdx);\n }, []);\n utils_1.forEach(pathsAndIndices, function (currPathAndIdx) {\n var targetIdx = currPathAndIdx.idx;\n var targetPath = currPathAndIdx.path;\n var prefixAmbiguitiesPathsAndIndices = utils_1.findAll(pathsAndIndices, function (searchPathAndIdx) {\n // prefix ambiguity can only be created from lower idx (higher priority) path\n return searchPathAndIdx.idx < targetIdx &&\n // checking for strict prefix because identical lookaheads\n // will be be detected using a different validation.\n lookahead_1.isStrictPrefixOfPath(searchPathAndIdx.path, targetPath);\n });\n var currPathPrefixErrors = utils_1.map(prefixAmbiguitiesPathsAndIndices, function (currAmbPathAndIdx) {\n var ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1];\n var pathMsg = utils_1.map(currAmbPathAndIdx.path, function (currTok) { return tokens_public_1.tokenLabel(currTok); }).join(\", \");\n var occurrence = alternation.implicitOccurrenceIndex ? \"\" : alternation.occurrenceInParent;\n var currMessage = \"Ambiguous alternatives: <\" + ambgIndices.join(\" ,\") + \"> due to common lookahead prefix\\n\" +\n (\"in <OR\" + occurrence + \"> inside <\" + ruleName + \"> Rule,\\n\") +\n (\"<\" + pathMsg + \"> may appears as a prefix path in all these alternatives.\\n\") +\n \"See https://github.com/SAP/chevrotain/blob/master/docs/resolving_grammar_errors.md#COMMON_PREFIX\\n\" +\n \"For farther details.\";\n return {\n message: currMessage,\n type: parser_public_1.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,\n ruleName: ruleName,\n occurrence: occurrence,\n alternatives: ambgIndices\n };\n });\n errors = errors.concat(currPathPrefixErrors);\n });\n return errors;\n}\nfunction checkTerminalAndNoneTerminalsNameSpace(ruleNames, terminalNames) {\n var errors = [];\n utils_1.forEach(ruleNames, function (currRuleName) {\n if (utils_1.contains(terminalNames, currRuleName)) {\n var errMsg = \"Namespace conflict found in grammar.\\n\" +\n (\"The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <\" + currRuleName + \">.\\n\") +\n \"To resolve this make sure each Terminal and Non-Terminal names are unique\\n\" +\n \"This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\\n\" +\n \"and Non-Terminal names start with a lower case letter.\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,\n ruleName: currRuleName\n });\n }\n });\n return errors;\n}\nfunction validateDuplicateNestedRules(topLevelRules) {\n var errors = [];\n utils_1.forEach(topLevelRules, function (currTopRule) {\n var namedCollectorVisitor = new cst_1.NamedDSLMethodsCollectorVisitor(\"\");\n currTopRule.accept(namedCollectorVisitor);\n var nestedNames = utils_1.map(namedCollectorVisitor.result, function (currItem) { return currItem.name; });\n var namesGroups = utils_1.groupBy(nestedNames, function (item) { return item; });\n var duplicates = utils_1.pick(namesGroups, function (currGroup) {\n return currGroup.length > 1;\n });\n utils_1.forEach(utils_1.values(duplicates), function (currDuplicates) {\n var duplicateName = utils.first(currDuplicates);\n var errMsg = \"Duplicate nested rule name: ->\" + duplicateName + \"<- inside rule: ->\" + currTopRule.name + \"<-\\n\" +\n \"A nested name must be unique in the scope of a top level grammar rule.\";\n errors.push({\n message: errMsg,\n type: parser_public_1.ParserDefinitionErrorType.DUPLICATE_NESTED_NAME,\n ruleName: currTopRule.name\n });\n });\n });\n return errors;\n}\n//# sourceMappingURL=checks.js.map\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n// Lookahead keys are 32Bit integers in the form\n// TTTTTTTTT-ZZZZZZZZZZZZZZZ-YYYY-XXXX\n// XXXX -> Occurrence Index bitmap.\n// YYYY -> DSL Method Name bitmap.\n// ZZZZZZZZZZZZZZZ -> Rule short Index bitmap.\n// TTTTTTTTT -> alternation alternative index bitmap\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BITS_FOR_METHOD_IDX = 4;\nexports.BITS_FOR_OCCURRENCE_IDX = 4;\nexports.BITS_FOR_RULE_IDX = 24;\n// TODO: validation, this means that there may at most 2^8 --> 256 alternatives for an alternation.\nexports.BITS_FOR_ALT_IDX = 8;\n// short string used as part of mapping keys.\n// being short improves the performance when composing KEYS for maps out of these\n// The 5 - 8 bits (16 possible values, are reserved for the DSL method indices)\n/* tslint:disable */\nexports.OR_IDX = 1 << exports.BITS_FOR_METHOD_IDX;\nexports.OPTION_IDX = 2 << exports.BITS_FOR_METHOD_IDX;\nexports.MANY_IDX = 3 << exports.BITS_FOR_METHOD_IDX;\nexports.AT_LEAST_ONE_IDX = 4 << exports.BITS_FOR_METHOD_IDX;\nexports.MANY_SEP_IDX = 5 << exports.BITS_FOR_METHOD_IDX;\nexports.AT_LEAST_ONE_SEP_IDX = 6 << exports.BITS_FOR_METHOD_IDX;\n/* tslint:enable */\n// this actually returns a number, but it is always used as a string (object prop key)\nfunction getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {\n /* tslint:disable */\n return occurrence | dslMethodIdx | ruleIdx;\n /* tslint:enable */\n}\nexports.getKeyForAutomaticLookahead = getKeyForAutomaticLookahead;\nvar BITS_START_FOR_ALT_IDX = 32 - exports.BITS_FOR_ALT_IDX;\nfunction getKeyForAltIndex(ruleIdx, dslMethodIdx, occurrence, altIdx) {\n /* tslint:disable */\n // alternative indices are zero based, thus must always add one (turn on one bit) to guarantee uniqueness.\n var altIdxBitMap = (altIdx + 1) << BITS_START_FOR_ALT_IDX;\n return getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) | altIdxBitMap;\n /* tslint:enable */\n}\nexports.getKeyForAltIndex = getKeyForAltIndex;\n//# sourceMappingURL=keys.js.map\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar gast_public_1 = __webpack_require__(2);\nvar interpreter_1 = __webpack_require__(12);\nvar rest_1 = __webpack_require__(13);\nvar PROD_TYPE;\n(function (PROD_TYPE) {\n PROD_TYPE[PROD_TYPE[\"OPTION\"] = 0] = \"OPTION\";\n PROD_TYPE[PROD_TYPE[\"REPETITION\"] = 1] = \"REPETITION\";\n PROD_TYPE[PROD_TYPE[\"REPETITION_MANDATORY\"] = 2] = \"REPETITION_MANDATORY\";\n PROD_TYPE[PROD_TYPE[\"REPETITION_MANDATORY_WITH_SEPARATOR\"] = 3] = \"REPETITION_MANDATORY_WITH_SEPARATOR\";\n PROD_TYPE[PROD_TYPE[\"REPETITION_WITH_SEPARATOR\"] = 4] = \"REPETITION_WITH_SEPARATOR\";\n PROD_TYPE[PROD_TYPE[\"ALTERNATION\"] = 5] = \"ALTERNATION\";\n})(PROD_TYPE = exports.PROD_TYPE || (exports.PROD_TYPE = {}));\nfunction getProdType(prod) {\n if (prod instanceof gast_public_1.gast.Option) {\n return PROD_TYPE.OPTION;\n }\n else if (prod instanceof gast_public_1.gast.Repetition) {\n return PROD_TYPE.REPETITION;\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatory) {\n return PROD_TYPE.REPETITION_MANDATORY;\n }\n else if (prod instanceof gast_public_1.gast.RepetitionMandatoryWithSeparator) {\n return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;\n }\n else if (prod instanceof gast_public_1.gast.RepetitionWithSeparator) {\n return PROD_TYPE.REPETITION_WITH_SEPARATOR;\n }/* istanbul ignore else */ \n else if (prod instanceof gast_public_1.gast.Alternation) {\n return PROD_TYPE.ALTERNATION;\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.getProdType = getProdType;\nfunction buildLookaheadFuncForOr(occurrence, ruleGrammar, k, hasPredicates, tokenMatcher, tokenClassIdentityFunc, tokenIdentityFunc, dynamicTokensEnabled) {\n var lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, k);\n return buildAlternativesLookAheadFunc(lookAheadPaths, hasPredicates, tokenMatcher, tokenClassIdentityFunc, tokenIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadFuncForOr = buildLookaheadFuncForOr;\n/**\n * When dealing with an Optional production (OPTION/MANY/2nd iteration of AT_LEAST_ONE/...) we need to compare\n * the lookahead \"inside\" the production and the lookahead immediately \"after\" it in the same top level rule (context free).\n *\n * Example: given a production:\n * ABC(DE)?DF\n *\n * The optional '(DE)?' should only be entered if we see 'DE'. a single Token 'D' is not sufficient to distinguish between the two\n * alternatives.\n *\n * @returns A Lookahead function which will return true IFF the parser should parse the Optional production.\n */\nfunction buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, prodType, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n var lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k);\n return buildSingleAlternativeLookaheadFunction(lookAheadPaths[0], tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadFuncForOptionalProd = buildLookaheadFuncForOptionalProd;\nfunction buildLookaheadForOption(optionOccurrence, ruleGrammar, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n return buildLookaheadFuncForOptionalProd(optionOccurrence, ruleGrammar, PROD_TYPE.OPTION, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadForOption = buildLookaheadForOption;\nfunction buildLookaheadForMany(optionOccurrence, ruleGrammar, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n return buildLookaheadFuncForOptionalProd(optionOccurrence, ruleGrammar, PROD_TYPE.REPETITION, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadForMany = buildLookaheadForMany;\nfunction buildLookaheadForManySep(optionOccurrence, ruleGrammar, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n return buildLookaheadFuncForOptionalProd(optionOccurrence, ruleGrammar, PROD_TYPE.REPETITION_WITH_SEPARATOR, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadForManySep = buildLookaheadForManySep;\nfunction buildLookaheadForAtLeastOne(optionOccurrence, ruleGrammar, k, tokenMatcher, tokenIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n return buildLookaheadFuncForOptionalProd(optionOccurrence, ruleGrammar, PROD_TYPE.REPETITION_MANDATORY, k, tokenMatcher, tokenIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadForAtLeastOne = buildLookaheadForAtLeastOne;\nfunction buildLookaheadForAtLeastOneSep(optionOccurrence, ruleGrammar, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n return buildLookaheadFuncForOptionalProd(optionOccurrence, ruleGrammar, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, k, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled);\n}\nexports.buildLookaheadForAtLeastOneSep = buildLookaheadForAtLeastOneSep;\nfunction buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n var numOfAlts = alts.length;\n var areAllOneTokenLookahead = utils_1.every(alts, function (currAlt) {\n return utils_1.every(currAlt, function (currPath) {\n return currPath.length === 1;\n });\n });\n // This version takes into account the predicates as well.\n if (hasPredicates) {\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (orAlts) {\n // unfortunately the predicates must be extracted every single time\n // as they cannot be cached due to keep references to parameters(vars) which are no longer valid.\n // note that in the common case of no predicates, no cpu time will be wasted on this (see else block)\n var predicates = utils_1.map(orAlts, function (currAlt) { return currAlt.GATE; });\n for (var t = 0; t < numOfAlts; t++) {\n var currAlt = alts[t];\n var currNumOfPaths = currAlt.length;\n var currPredicate = predicates[t];\n if (currPredicate && !currPredicate.call(this)) {\n // if the predicate does not match there is no point in checking the paths\n continue;\n }\n nextPath: for (var j = 0; j < currNumOfPaths; j++) {\n var currPath = currAlt[j];\n var currPathLength = currPath.length;\n for (var i = 0; i < currPathLength; i++) {\n var nextToken = this.LA(i + 1);\n if (!tokenMatcher(nextToken, currPath[i])) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t;\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined;\n };\n }\n else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n var singleTokenAlts = utils_1.map(alts, function (currAlt) {\n return utils_1.flatten(currAlt);\n });\n var choiceToAlt_1 = utils_1.reduce(singleTokenAlts, function (result, currAlt, idx) {\n utils_1.forEach(currAlt, function (currTokClass) {\n if (!utils_1.has(result, tokenClassIdentityFunc(currTokClass))) {\n result[tokenClassIdentityFunc(currTokClass)] = idx;\n }\n utils_1.forEach(currTokClass.extendingTokenTypes, function (currExtendingType) {\n if (!utils_1.has(result, currExtendingType)) {\n result[currExtendingType] = idx;\n }\n });\n });\n return result;\n }, {});\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n var nextToken = this.LA(1);\n return choiceToAlt_1[tokenInstanceIdentityFunc(nextToken)];\n };\n }\n else {\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n for (var t = 0; t < numOfAlts; t++) {\n var currAlt = alts[t];\n var currNumOfPaths = currAlt.length;\n nextPath: for (var j = 0; j < currNumOfPaths; j++) {\n var currPath = currAlt[j];\n var currPathLength = currPath.length;\n for (var i = 0; i < currPathLength; i++) {\n var nextToken = this.LA(i + 1);\n if (!(tokenMatcher(nextToken, currPath[i]))) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t;\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined;\n };\n }\n}\nexports.buildAlternativesLookAheadFunc = buildAlternativesLookAheadFunc;\nfunction buildSingleAlternativeLookaheadFunction(alt, tokenMatcher, tokenClassIdentityFunc, tokenInstanceIdentityFunc, dynamicTokensEnabled) {\n var areAllOneTokenLookahead = utils_1.every(alt, function (currPath) {\n return currPath.length === 1;\n });\n var numOfPaths = alt.length;\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead.\n if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n var singleTokensClasses = utils_1.flatten(alt);\n if (singleTokensClasses.length === 1 && utils_1.isEmpty(singleTokensClasses[0].extendingTokenTypes)) {\n var expectedTokenType = singleTokensClasses[0];\n var expectedTokenUniqueKey_1 = tokenClassIdentityFunc(expectedTokenType);\n return function () {\n return tokenInstanceIdentityFunc(this.LA(1)) === expectedTokenUniqueKey_1;\n };\n }\n else {\n var choiceToAlt_2 = utils_1.reduce(singleTokensClasses, function (result, currTokClass, idx) {\n result[tokenClassIdentityFunc(currTokClass)] = true;\n utils_1.forEach(currTokClass.extendingTokenTypes, function (currExtendingType) {\n result[currExtendingType] = true;\n });\n return result;\n }, {});\n return function () {\n var nextToken = this.LA(1);\n return choiceToAlt_2[tokenInstanceIdentityFunc(nextToken)] === true ? true : false;\n };\n }\n }\n else {\n return function () {\n nextPath: for (var j = 0; j < numOfPaths; j++) {\n var currPath = alt[j];\n var currPathLength = currPath.length;\n for (var i = 0; i < currPathLength; i++) {\n var nextToken = this.LA(i + 1);\n if (!(tokenMatcher(nextToken, currPath[i]))) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n return true;\n }\n // none of the paths matched\n return false;\n };\n }\n}\nexports.buildSingleAlternativeLookaheadFunction = buildSingleAlternativeLookaheadFunction;\nvar RestDefinitionFinderWalker = (function (_super) {\n __extends(RestDefinitionFinderWalker, _super);\n function RestDefinitionFinderWalker(topProd, targetOccurrence, targetProdType) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.targetOccurrence = targetOccurrence;\n _this.targetProdType = targetProdType;\n return _this;\n }\n RestDefinitionFinderWalker.prototype.startWalking = function () {\n this.walk(this.topProd);\n return this.restDef;\n };\n RestDefinitionFinderWalker.prototype.checkIsTarget = function (node, expectedProdType, currRest, prevRest) {\n if (node.occurrenceInParent === this.targetOccurrence &&\n this.targetProdType === expectedProdType) {\n this.restDef = currRest.concat(prevRest);\n return true;\n }\n // performance optimization, do not iterate over the entire Grammar ast after we have found the target\n return false;\n };\n RestDefinitionFinderWalker.prototype.walkOption = function (optionProd, currRest, prevRest) {\n if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, optionProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker.prototype.walkAtLeastOne = function (atLeastOneProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, atLeastOneProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker.prototype.walkAtLeastOneSep = function (atLeastOneSepProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, atLeastOneSepProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker.prototype.walkMany = function (manyProd, currRest, prevRest) {\n if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, manyProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker.prototype.walkManySep = function (manySepProd, currRest, prevRest) {\n if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, manySepProd, currRest, prevRest);\n }\n };\n return RestDefinitionFinderWalker;\n}(rest_1.RestWalker));\n/**\n * Returns the definition of a target production in a top level level rule.\n */\nvar InsideDefinitionFinderVisitor = (function (_super) {\n __extends(InsideDefinitionFinderVisitor, _super);\n function InsideDefinitionFinderVisitor(targetOccurrence, targetProdType) {\n var _this = _super.call(this) || this;\n _this.targetOccurrence = targetOccurrence;\n _this.targetProdType = targetProdType;\n _this.result = [];\n return _this;\n }\n InsideDefinitionFinderVisitor.prototype.checkIsTarget = function (node, expectedProdName) {\n if (node.occurrenceInParent === this.targetOccurrence &&\n this.targetProdType === expectedProdName) {\n this.result = node.definition;\n }\n };\n InsideDefinitionFinderVisitor.prototype.visitOption = function (node) {\n this.checkIsTarget(node, PROD_TYPE.OPTION);\n };\n InsideDefinitionFinderVisitor.prototype.visitRepetition = function (node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION);\n };\n InsideDefinitionFinderVisitor.prototype.visitRepetitionMandatory = function (node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY);\n };\n InsideDefinitionFinderVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR);\n };\n InsideDefinitionFinderVisitor.prototype.visitRepetitionWithSeparator = function (node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR);\n };\n InsideDefinitionFinderVisitor.prototype.visitAlternation = function (node) {\n this.checkIsTarget(node, PROD_TYPE.ALTERNATION);\n };\n return InsideDefinitionFinderVisitor;\n}(gast_public_1.gast.GAstVisitor));\nfunction lookAheadSequenceFromAlternatives(altsDefs, k) {\n function getOtherPaths(pathsAndSuffixes, filterIdx) {\n return utils_1.reduce(pathsAndSuffixes, function (result, currPathsAndSuffixes, currIdx) {\n if (currIdx !== filterIdx) {\n var currPartialPaths = utils_1.map(currPathsAndSuffixes, function (singlePathAndSuffix) { return singlePathAndSuffix.partialPath; });\n return result.concat(currPartialPaths);\n }\n return result;\n }, []);\n }\n function isUniquePrefix(arr, item) {\n return utils_1.find(arr, function (currOtherPath) {\n return utils_1.every(item, function (currPathTok, idx) {\n return currPathTok === currOtherPath[idx];\n });\n }) === undefined;\n }\n function initializeArrayOfArrays(size) {\n var result = [];\n for (var i = 0; i < size; i++) {\n result.push([]);\n }\n return result;\n }\n var partialAlts = utils_1.map(altsDefs, function (currAlt) { return interpreter_1.possiblePathsFrom([currAlt], 1); });\n var finalResult = initializeArrayOfArrays(partialAlts.length);\n var newData = partialAlts;\n // maxLookahead loop\n for (var pathLength = 1; pathLength <= k; pathLength++) {\n var currDataset = newData;\n newData = initializeArrayOfArrays(currDataset.length);\n // alternatives loop\n for (var resultIdx = 0; resultIdx < currDataset.length; resultIdx++) {\n var currAltPathsAndSuffixes = currDataset[resultIdx];\n var otherPaths = getOtherPaths(currDataset, resultIdx);\n // paths in current alternative loop\n for (var currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {\n var currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath;\n var suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef;\n var isUnique = isUniquePrefix(otherPaths, currPathPrefix);\n // even if a path is not unique, but there are no longer alternatives to try\n // or if we have reached the maximum lookahead (k) permitted.\n if (isUnique ||\n utils_1.isEmpty(suffixDef) ||\n currPathPrefix.length === k) {\n var currAltResult = finalResult[resultIdx];\n if (!containsPath(currAltResult, currPathPrefix)) {\n currAltResult.push(currPathPrefix);\n }\n }\n else {\n var newPartialPathsAndSuffixes = interpreter_1.possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix);\n newData[resultIdx] = newData[resultIdx].concat(newPartialPathsAndSuffixes);\n }\n }\n }\n }\n return finalResult;\n}\nexports.lookAheadSequenceFromAlternatives = lookAheadSequenceFromAlternatives;\nfunction getLookaheadPathsForOr(occurrence, ruleGrammar, k) {\n var visitor = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION);\n ruleGrammar.accept(visitor);\n return lookAheadSequenceFromAlternatives(visitor.result, k);\n}\nexports.getLookaheadPathsForOr = getLookaheadPathsForOr;\nfunction getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) {\n var insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType);\n ruleGrammar.accept(insideDefVisitor);\n var insideDef = insideDefVisitor.result;\n var afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType);\n var afterDef = afterDefWalker.startWalking();\n var insideFlat = new gast_public_1.gast.Flat(insideDef);\n var afterFlat = new gast_public_1.gast.Flat(afterDef);\n return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k);\n}\nexports.getLookaheadPathsForOptionalProd = getLookaheadPathsForOptionalProd;\nfunction containsPath(alternative, path) {\n var found = utils_1.find(alternative, function (otherPath) {\n return path.length === otherPath.length &&\n utils_1.every(path, function (targetItem, idx) {\n return targetItem === otherPath[idx];\n });\n });\n return found !== undefined;\n}\nexports.containsPath = containsPath;\nfunction isStrictPrefixOfPath(prefix, other) {\n return prefix.length < other.length &&\n utils_1.every(prefix, function (tokType, idx) {\n return tokType === other[idx];\n });\n}\nexports.isStrictPrefixOfPath = isStrictPrefixOfPath;\n//# sourceMappingURL=lookahead.js.map\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// needs a separate module as this is required inside chevrotain productive code\n// and also in the entry point for webpack(api.ts).\n// A separate file avoids cyclic dependencies and webpack errors.\nexports.VERSION = \"0.28.2\";\n//# sourceMappingURL=version.js.map\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar encode = __webpack_require__(65),\n decode = __webpack_require__(63);\n\nexports.decode = function(data, level){\n\treturn (!level || level <= 0 ? decode.XML : decode.HTML)(data);\n};\n\nexports.decodeStrict = function(data, level){\n\treturn (!level || level <= 0 ? decode.XML : decode.HTMLStrict)(data);\n};\n\nexports.encode = function(data, level){\n\treturn (!level || level <= 0 ? encode.XML : encode.HTML)(data);\n};\n\nexports.encodeXML = encode.XML;\n\nexports.encodeHTML4 =\nexports.encodeHTML5 =\nexports.encodeHTML = encode.HTML;\n\nexports.decodeXML =\nexports.decodeXMLStrict = decode.XML;\n\nexports.decodeHTML4 =\nexports.decodeHTML5 =\nexports.decodeHTML = decode.HTML;\n\nexports.decodeHTML4Strict =\nexports.decodeHTML5Strict =\nexports.decodeHTMLStrict = decode.HTMLStrict;\n\nexports.escape = encode.escape;\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports) {\n\nmodule.exports = {\n\t\"Aacute\": \"Á\",\n\t\"aacute\": \"á\",\n\t\"Abreve\": \"Ă\",\n\t\"abreve\": \"ă\",\n\t\"ac\": \"∾\",\n\t\"acd\": \"∿\",\n\t\"acE\": \"∾̳\",\n\t\"Acirc\": \"Â\",\n\t\"acirc\": \"â\",\n\t\"acute\": \"´\",\n\t\"Acy\": \"А\",\n\t\"acy\": \"а\",\n\t\"AElig\": \"Æ\",\n\t\"aelig\": \"æ\",\n\t\"af\": \"\",\n\t\"Afr\": \"𝔄\",\n\t\"afr\": \"𝔞\",\n\t\"Agrave\": \"À\",\n\t\"agrave\": \"à\",\n\t\"alefsym\": \"ℵ\",\n\t\"aleph\": \"ℵ\",\n\t\"Alpha\": \"Α\",\n\t\"alpha\": \"α\",\n\t\"Amacr\": \"Ā\",\n\t\"amacr\": \"ā\",\n\t\"amalg\": \"⨿\",\n\t\"amp\": \"&\",\n\t\"AMP\": \"&\",\n\t\"andand\": \"⩕\",\n\t\"And\": \"⩓\",\n\t\"and\": \"∧\",\n\t\"andd\": \"⩜\",\n\t\"andslope\": \"⩘\",\n\t\"andv\": \"⩚\",\n\t\"ang\": \"∠\",\n\t\"ange\": \"⦤\",\n\t\"angle\": \"∠\",\n\t\"angmsdaa\": \"⦨\",\n\t\"angmsdab\": \"⦩\",\n\t\"angmsdac\": \"⦪\",\n\t\"angmsdad\": \"⦫\",\n\t\"angmsdae\": \"⦬\",\n\t\"angmsdaf\": \"⦭\",\n\t\"angmsdag\": \"⦮\",\n\t\"angmsdah\": \"⦯\",\n\t\"angmsd\": \"∡\",\n\t\"angrt\": \"∟\",\n\t\"angrtvb\": \"⊾\",\n\t\"angrtvbd\": \"⦝\",\n\t\"angsph\": \"∢\",\n\t\"angst\": \"Å\",\n\t\"angzarr\": \"⍼\",\n\t\"Aogon\": \"Ą\",\n\t\"aogon\": \"ą\",\n\t\"Aopf\": \"𝔸\",\n\t\"aopf\": \"𝕒\",\n\t\"apacir\": \"⩯\",\n\t\"ap\": \"≈\",\n\t\"apE\": \"⩰\",\n\t\"ape\": \"≊\",\n\t\"apid\": \"≋\",\n\t\"apos\": \"'\",\n\t\"ApplyFunction\": \"\",\n\t\"approx\": \"≈\",\n\t\"approxeq\": \"≊\",\n\t\"Aring\": \"Å\",\n\t\"aring\": \"å\",\n\t\"Ascr\": \"𝒜\",\n\t\"ascr\": \"𝒶\",\n\t\"Assign\": \"≔\",\n\t\"ast\": \"*\",\n\t\"asymp\": \"≈\",\n\t\"asympeq\": \"≍\",\n\t\"Atilde\": \"Ã\",\n\t\"atilde\": \"ã\",\n\t\"Auml\": \"Ä\",\n\t\"auml\": \"ä\",\n\t\"awconint\": \"∳\",\n\t\"awint\": \"⨑\",\n\t\"backcong\": \"≌\",\n\t\"backepsilon\": \"϶\",\n\t\"backprime\": \"‵\",\n\t\"backsim\": \"∽\",\n\t\"backsimeq\": \"⋍\",\n\t\"Backslash\": \"∖\",\n\t\"Barv\": \"⫧\",\n\t\"barvee\": \"⊽\",\n\t\"barwed\": \"⌅\",\n\t\"Barwed\": \"⌆\",\n\t\"barwedge\": \"⌅\",\n\t\"bbrk\": \"⎵\",\n\t\"bbrktbrk\": \"⎶\",\n\t\"bcong\": \"≌\",\n\t\"Bcy\": \"Б\",\n\t\"bcy\": \"б\",\n\t\"bdquo\": \"„\",\n\t\"becaus\": \"∵\",\n\t\"because\": \"∵\",\n\t\"Because\": \"∵\",\n\t\"bemptyv\": \"⦰\",\n\t\"bepsi\": \"϶\",\n\t\"bernou\": \"ℬ\",\n\t\"Bernoullis\": \"ℬ\",\n\t\"Beta\": \"Β\",\n\t\"beta\": \"β\",\n\t\"beth\": \"ℶ\",\n\t\"between\": \"≬\",\n\t\"Bfr\": \"𝔅\",\n\t\"bfr\": \"𝔟\",\n\t\"bigcap\": \"⋂\",\n\t\"bigcirc\": \"◯\",\n\t\"bigcup\": \"⋃\",\n\t\"bigodot\": \"⨀\",\n\t\"bigoplus\": \"⨁\",\n\t\"bigotimes\": \"⨂\",\n\t\"bigsqcup\": \"⨆\",\n\t\"bigstar\": \"★\",\n\t\"bigtriangledown\": \"▽\",\n\t\"bigtriangleup\": \"△\",\n\t\"biguplus\": \"⨄\",\n\t\"bigvee\": \"⋁\",\n\t\"bigwedge\": \"⋀\",\n\t\"bkarow\": \"⤍\",\n\t\"blacklozenge\": \"⧫\",\n\t\"blacksquare\": \"▪\",\n\t\"blacktriangle\": \"▴\",\n\t\"blacktriangledown\": \"▾\",\n\t\"blacktriangleleft\": \"◂\",\n\t\"blacktriangleright\": \"▸\",\n\t\"blank\": \"␣\",\n\t\"blk12\": \"▒\",\n\t\"blk14\": \"░\",\n\t\"blk34\": \"▓\",\n\t\"block\": \"█\",\n\t\"bne\": \"=⃥\",\n\t\"bnequiv\": \"≡⃥\",\n\t\"bNot\": \"⫭\",\n\t\"bnot\": \"⌐\",\n\t\"Bopf\": \"𝔹\",\n\t\"bopf\": \"𝕓\",\n\t\"bot\": \"⊥\",\n\t\"bottom\": \"⊥\",\n\t\"bowtie\": \"⋈\",\n\t\"boxbox\": \"⧉\",\n\t\"boxdl\": \"┐\",\n\t\"boxdL\": \"╕\",\n\t\"boxDl\": \"╖\",\n\t\"boxDL\": \"╗\",\n\t\"boxdr\": \"┌\",\n\t\"boxdR\": \"╒\",\n\t\"boxDr\": \"╓\",\n\t\"boxDR\": \"╔\",\n\t\"boxh\": \"─\",\n\t\"boxH\": \"═\",\n\t\"boxhd\": \"┬\",\n\t\"boxHd\": \"╤\",\n\t\"boxhD\": \"╥\",\n\t\"boxHD\": \"╦\",\n\t\"boxhu\": \"┴\",\n\t\"boxHu\": \"╧\",\n\t\"boxhU\": \"╨\",\n\t\"boxHU\": \"╩\",\n\t\"boxminus\": \"⊟\",\n\t\"boxplus\": \"⊞\",\n\t\"boxtimes\": \"⊠\",\n\t\"boxul\": \"┘\",\n\t\"boxuL\": \"╛\",\n\t\"boxUl\": \"╜\",\n\t\"boxUL\": \"╝\",\n\t\"boxur\": \"└\",\n\t\"boxuR\": \"╘\",\n\t\"boxUr\": \"╙\",\n\t\"boxUR\": \"╚\",\n\t\"boxv\": \"│\",\n\t\"boxV\": \"║\",\n\t\"boxvh\": \"┼\",\n\t\"boxvH\": \"╪\",\n\t\"boxVh\": \"╫\",\n\t\"boxVH\": \"╬\",\n\t\"boxvl\": \"┤\",\n\t\"boxvL\": \"╡\",\n\t\"boxVl\": \"╢\",\n\t\"boxVL\": \"╣\",\n\t\"boxvr\": \"├\",\n\t\"boxvR\": \"╞\",\n\t\"boxVr\": \"╟\",\n\t\"boxVR\": \"╠\",\n\t\"bprime\": \"‵\",\n\t\"breve\": \"˘\",\n\t\"Breve\": \"˘\",\n\t\"brvbar\": \"¦\",\n\t\"bscr\": \"𝒷\",\n\t\"Bscr\": \"ℬ\",\n\t\"bsemi\": \"⁏\",\n\t\"bsim\": \"∽\",\n\t\"bsime\": \"⋍\",\n\t\"bsolb\": \"⧅\",\n\t\"bsol\": \"\\\\\",\n\t\"bsolhsub\": \"⟈\",\n\t\"bull\": \"•\",\n\t\"bullet\": \"•\",\n\t\"bump\": \"≎\",\n\t\"bumpE\": \"⪮\",\n\t\"bumpe\": \"≏\",\n\t\"Bumpeq\": \"≎\",\n\t\"bumpeq\": \"≏\",\n\t\"Cacute\": \"Ć\",\n\t\"cacute\": \"ć\",\n\t\"capand\": \"⩄\",\n\t\"capbrcup\": \"⩉\",\n\t\"capcap\": \"⩋\",\n\t\"cap\": \"∩\",\n\t\"Cap\": \"⋒\",\n\t\"capcup\": \"⩇\",\n\t\"capdot\": \"⩀\",\n\t\"CapitalDifferentialD\": \"ⅅ\",\n\t\"caps\": \"∩︀\",\n\t\"caret\": \"⁁\",\n\t\"caron\": \"ˇ\",\n\t\"Cayleys\": \"ℭ\",\n\t\"ccaps\": \"⩍\",\n\t\"Ccaron\": \"Č\",\n\t\"ccaron\": \"č\",\n\t\"Ccedil\": \"Ç\",\n\t\"ccedil\": \"ç\",\n\t\"Ccirc\": \"Ĉ\",\n\t\"ccirc\": \"ĉ\",\n\t\"Cconint\": \"∰\",\n\t\"ccups\": \"⩌\",\n\t\"ccupssm\": \"⩐\",\n\t\"Cdot\": \"Ċ\",\n\t\"cdot\": \"ċ\",\n\t\"cedil\": \"¸\",\n\t\"Cedilla\": \"¸\",\n\t\"cemptyv\": \"⦲\",\n\t\"cent\": \"¢\",\n\t\"centerdot\": \"·\",\n\t\"CenterDot\": \"·\",\n\t\"cfr\": \"𝔠\",\n\t\"Cfr\": \"ℭ\",\n\t\"CHcy\": \"Ч\",\n\t\"chcy\": \"ч\",\n\t\"check\": \"✓\",\n\t\"checkmark\": \"✓\",\n\t\"Chi\": \"Χ\",\n\t\"chi\": \"χ\",\n\t\"circ\": \"ˆ\",\n\t\"circeq\": \"≗\",\n\t\"circlearrowleft\": \"↺\",\n\t\"circlearrowright\": \"↻\",\n\t\"circledast\": \"⊛\",\n\t\"circledcirc\": \"⊚\",\n\t\"circleddash\": \"⊝\",\n\t\"CircleDot\": \"⊙\",\n\t\"circledR\": \"®\",\n\t\"circledS\": \"Ⓢ\",\n\t\"CircleMinus\": \"⊖\",\n\t\"CirclePlus\": \"⊕\",\n\t\"CircleTimes\": \"⊗\",\n\t\"cir\": \"○\",\n\t\"cirE\": \"⧃\",\n\t\"cire\": \"≗\",\n\t\"cirfnint\": \"⨐\",\n\t\"cirmid\": \"⫯\",\n\t\"cirscir\": \"⧂\",\n\t\"ClockwiseContourIntegral\": \"∲\",\n\t\"CloseCurlyDoubleQuote\": \"”\",\n\t\"CloseCurlyQuote\": \"’\",\n\t\"clubs\": \"♣\",\n\t\"clubsuit\": \"♣\",\n\t\"colon\": \":\",\n\t\"Colon\": \"∷\",\n\t\"Colone\": \"⩴\",\n\t\"colone\": \"≔\",\n\t\"coloneq\": \"≔\",\n\t\"comma\": \",\",\n\t\"commat\": \"@\",\n\t\"comp\": \"∁\",\n\t\"compfn\": \"∘\",\n\t\"complement\": \"∁\",\n\t\"complexes\": \"ℂ\",\n\t\"cong\": \"≅\",\n\t\"congdot\": \"⩭\",\n\t\"Congruent\": \"≡\",\n\t\"conint\": \"∮\",\n\t\"Conint\": \"∯\",\n\t\"ContourIntegral\": \"∮\",\n\t\"copf\": \"𝕔\",\n\t\"Copf\": \"ℂ\",\n\t\"coprod\": \"∐\",\n\t\"Coproduct\": \"∐\",\n\t\"copy\": \"©\",\n\t\"COPY\": \"©\",\n\t\"copysr\": \"℗\",\n\t\"CounterClockwiseContourIntegral\": \"∳\",\n\t\"crarr\": \"↵\",\n\t\"cross\": \"✗\",\n\t\"Cross\": \"⨯\",\n\t\"Cscr\": \"𝒞\",\n\t\"cscr\": \"𝒸\",\n\t\"csub\": \"⫏\",\n\t\"csube\": \"⫑\",\n\t\"csup\": \"⫐\",\n\t\"csupe\": \"⫒\",\n\t\"ctdot\": \"⋯\",\n\t\"cudarrl\": \"⤸\",\n\t\"cudarrr\": \"⤵\",\n\t\"cuepr\": \"⋞\",\n\t\"cuesc\": \"⋟\",\n\t\"cularr\": \"↶\",\n\t\"cularrp\": \"⤽\",\n\t\"cupbrcap\": \"⩈\",\n\t\"cupcap\": \"⩆\",\n\t\"CupCap\": \"≍\",\n\t\"cup\": \"∪\",\n\t\"Cup\": \"⋓\",\n\t\"cupcup\": \"⩊\",\n\t\"cupdot\": \"⊍\",\n\t\"cupor\": \"⩅\",\n\t\"cups\": \"∪︀\",\n\t\"curarr\": \"↷\",\n\t\"curarrm\": \"⤼\",\n\t\"curlyeqprec\": \"⋞\",\n\t\"curlyeqsucc\": \"⋟\",\n\t\"curlyvee\": \"⋎\",\n\t\"curlywedge\": \"⋏\",\n\t\"curren\": \"¤\",\n\t\"curvearrowleft\": \"↶\",\n\t\"curvearrowright\": \"↷\",\n\t\"cuvee\": \"⋎\",\n\t\"cuwed\": \"⋏\",\n\t\"cwconint\": \"∲\",\n\t\"cwint\": \"∱\",\n\t\"cylcty\": \"⌭\",\n\t\"dagger\": \"†\",\n\t\"Dagger\": \"‡\",\n\t\"daleth\": \"ℸ\",\n\t\"darr\": \"↓\",\n\t\"Darr\": \"↡\",\n\t\"dArr\": \"⇓\",\n\t\"dash\": \"‐\",\n\t\"Dashv\": \"⫤\",\n\t\"dashv\": \"⊣\",\n\t\"dbkarow\": \"⤏\",\n\t\"dblac\": \"˝\",\n\t\"Dcaron\": \"Ď\",\n\t\"dcaron\": \"ď\",\n\t\"Dcy\": \"Д\",\n\t\"dcy\": \"д\",\n\t\"ddagger\": \"‡\",\n\t\"ddarr\": \"⇊\",\n\t\"DD\": \"ⅅ\",\n\t\"dd\": \"ⅆ\",\n\t\"DDotrahd\": \"⤑\",\n\t\"ddotseq\": \"⩷\",\n\t\"deg\": \"°\",\n\t\"Del\": \"∇\",\n\t\"Delta\": \"Δ\",\n\t\"delta\": \"δ\",\n\t\"demptyv\": \"⦱\",\n\t\"dfisht\": \"⥿\",\n\t\"Dfr\": \"𝔇\",\n\t\"dfr\": \"𝔡\",\n\t\"dHar\": \"⥥\",\n\t\"dharl\": \"⇃\",\n\t\"dharr\": \"⇂\",\n\t\"DiacriticalAcute\": \"´\",\n\t\"DiacriticalDot\": \"˙\",\n\t\"DiacriticalDoubleAcute\": \"˝\",\n\t\"DiacriticalGrave\": \"`\",\n\t\"DiacriticalTilde\": \"˜\",\n\t\"diam\": \"⋄\",\n\t\"diamond\": \"⋄\",\n\t\"Diamond\": \"⋄\",\n\t\"diamondsuit\": \"♦\",\n\t\"diams\": \"♦\",\n\t\"die\": \"¨\",\n\t\"DifferentialD\": \"ⅆ\",\n\t\"digamma\": \"ϝ\",\n\t\"disin\": \"⋲\",\n\t\"div\": \"÷\",\n\t\"divide\": \"÷\",\n\t\"divideontimes\": \"⋇\",\n\t\"divonx\": \"⋇\",\n\t\"DJcy\": \"Ђ\",\n\t\"djcy\": \"ђ\",\n\t\"dlcorn\": \"⌞\",\n\t\"dlcrop\": \"⌍\",\n\t\"dollar\": \"$\",\n\t\"Dopf\": \"𝔻\",\n\t\"dopf\": \"𝕕\",\n\t\"Dot\": \"¨\",\n\t\"dot\": \"˙\",\n\t\"DotDot\": \"⃜\",\n\t\"doteq\": \"≐\",\n\t\"doteqdot\": \"≑\",\n\t\"DotEqual\": \"≐\",\n\t\"dotminus\": \"∸\",\n\t\"dotplus\": \"∔\",\n\t\"dotsquare\": \"⊡\",\n\t\"doublebarwedge\": \"⌆\",\n\t\"DoubleContourIntegral\": \"∯\",\n\t\"DoubleDot\": \"¨\",\n\t\"DoubleDownArrow\": \"⇓\",\n\t\"DoubleLeftArrow\": \"⇐\",\n\t\"DoubleLeftRightArrow\": \"⇔\",\n\t\"DoubleLeftTee\": \"⫤\",\n\t\"DoubleLongLeftArrow\": \"⟸\",\n\t\"DoubleLongLeftRightArrow\": \"⟺\",\n\t\"DoubleLongRightArrow\": \"⟹\",\n\t\"DoubleRightArrow\": \"⇒\",\n\t\"DoubleRightTee\": \"⊨\",\n\t\"DoubleUpArrow\": \"⇑\",\n\t\"DoubleUpDownArrow\": \"⇕\",\n\t\"DoubleVerticalBar\": \"∥\",\n\t\"DownArrowBar\": \"⤓\",\n\t\"downarrow\": \"↓\",\n\t\"DownArrow\": \"↓\",\n\t\"Downarrow\": \"⇓\",\n\t\"DownArrowUpArrow\": \"⇵\",\n\t\"DownBreve\": \"̑\",\n\t\"downdownarrows\": \"⇊\",\n\t\"downharpoonleft\": \"⇃\",\n\t\"downharpoonright\": \"⇂\",\n\t\"DownLeftRightVector\": \"⥐\",\n\t\"DownLeftTeeVector\": \"⥞\",\n\t\"DownLeftVectorBar\": \"⥖\",\n\t\"DownLeftVector\": \"↽\",\n\t\"DownRightTeeVector\": \"⥟\",\n\t\"DownRightVectorBar\": \"⥗\",\n\t\"DownRightVector\": \"⇁\",\n\t\"DownTeeArrow\": \"↧\",\n\t\"DownTee\": \"⊤\",\n\t\"drbkarow\": \"⤐\",\n\t\"drcorn\": \"⌟\",\n\t\"drcrop\": \"⌌\",\n\t\"Dscr\": \"𝒟\",\n\t\"dscr\": \"𝒹\",\n\t\"DScy\": \"Ѕ\",\n\t\"dscy\": \"ѕ\",\n\t\"dsol\": \"⧶\",\n\t\"Dstrok\": \"Đ\",\n\t\"dstrok\": \"đ\",\n\t\"dtdot\": \"⋱\",\n\t\"dtri\": \"▿\",\n\t\"dtrif\": \"▾\",\n\t\"duarr\": \"⇵\",\n\t\"duhar\": \"⥯\",\n\t\"dwangle\": \"⦦\",\n\t\"DZcy\": \"Џ\",\n\t\"dzcy\": \"џ\",\n\t\"dzigrarr\": \"⟿\",\n\t\"Eacute\": \"É\",\n\t\"eacute\": \"é\",\n\t\"easter\": \"⩮\",\n\t\"Ecaron\": \"Ě\",\n\t\"ecaron\": \"ě\",\n\t\"Ecirc\": \"Ê\",\n\t\"ecirc\": \"ê\",\n\t\"ecir\": \"≖\",\n\t\"ecolon\": \"≕\",\n\t\"Ecy\": \"Э\",\n\t\"ecy\": \"э\",\n\t\"eDDot\": \"⩷\",\n\t\"Edot\": \"Ė\",\n\t\"edot\": \"ė\",\n\t\"eDot\": \"≑\",\n\t\"ee\": \"ⅇ\",\n\t\"efDot\": \"≒\",\n\t\"Efr\": \"𝔈\",\n\t\"efr\": \"𝔢\",\n\t\"eg\": \"⪚\",\n\t\"Egrave\": \"È\",\n\t\"egrave\": \"è\",\n\t\"egs\": \"⪖\",\n\t\"egsdot\": \"⪘\",\n\t\"el\": \"⪙\",\n\t\"Element\": \"∈\",\n\t\"elinters\": \"⏧\",\n\t\"ell\": \"ℓ\",\n\t\"els\": \"⪕\",\n\t\"elsdot\": \"⪗\",\n\t\"Emacr\": \"Ē\",\n\t\"emacr\": \"ē\",\n\t\"empty\": \"∅\",\n\t\"emptyset\": \"∅\",\n\t\"EmptySmallSquare\": \"◻\",\n\t\"emptyv\": \"∅\",\n\t\"EmptyVerySmallSquare\": \"▫\",\n\t\"emsp13\": \" \",\n\t\"emsp14\": \" \",\n\t\"emsp\": \" \",\n\t\"ENG\": \"Ŋ\",\n\t\"eng\": \"ŋ\",\n\t\"ensp\": \" \",\n\t\"Eogon\": \"Ę\",\n\t\"eogon\": \"ę\",\n\t\"Eopf\": \"𝔼\",\n\t\"eopf\": \"𝕖\",\n\t\"epar\": \"⋕\",\n\t\"eparsl\": \"⧣\",\n\t\"eplus\": \"⩱\",\n\t\"epsi\": \"ε\",\n\t\"Epsilon\": \"Ε\",\n\t\"epsilon\": \"ε\",\n\t\"epsiv\": \"ϵ\",\n\t\"eqcirc\": \"≖\",\n\t\"eqcolon\": \"≕\",\n\t\"eqsim\": \"≂\",\n\t\"eqslantgtr\": \"⪖\",\n\t\"eqslantless\": \"⪕\",\n\t\"Equal\": \"⩵\",\n\t\"equals\": \"=\",\n\t\"EqualTilde\": \"≂\",\n\t\"equest\": \"≟\",\n\t\"Equilibrium\": \"⇌\",\n\t\"equiv\": \"≡\",\n\t\"equivDD\": \"⩸\",\n\t\"eqvparsl\": \"⧥\",\n\t\"erarr\": \"⥱\",\n\t\"erDot\": \"≓\",\n\t\"escr\": \"ℯ\",\n\t\"Escr\": \"ℰ\",\n\t\"esdot\": \"≐\",\n\t\"Esim\": \"⩳\",\n\t\"esim\": \"≂\",\n\t\"Eta\": \"Η\",\n\t\"eta\": \"η\",\n\t\"ETH\": \"Ð\",\n\t\"eth\": \"ð\",\n\t\"Euml\": \"Ë\",\n\t\"euml\": \"ë\",\n\t\"euro\": \"€\",\n\t\"excl\": \"!\",\n\t\"exist\": \"∃\",\n\t\"Exists\": \"∃\",\n\t\"expectation\": \"ℰ\",\n\t\"exponentiale\": \"ⅇ\",\n\t\"ExponentialE\": \"ⅇ\",\n\t\"fallingdotseq\": \"≒\",\n\t\"Fcy\": \"Ф\",\n\t\"fcy\": \"ф\",\n\t\"female\": \"♀\",\n\t\"ffilig\": \"ffi\",\n\t\"fflig\": \"ff\",\n\t\"ffllig\": \"ffl\",\n\t\"Ffr\": \"𝔉\",\n\t\"ffr\": \"𝔣\",\n\t\"filig\": \"fi\",\n\t\"FilledSmallSquare\": \"◼\",\n\t\"FilledVerySmallSquare\": \"▪\",\n\t\"fjlig\": \"fj\",\n\t\"flat\": \"♭\",\n\t\"fllig\": \"fl\",\n\t\"fltns\": \"▱\",\n\t\"fnof\": \"ƒ\",\n\t\"Fopf\": \"𝔽\",\n\t\"fopf\": \"𝕗\",\n\t\"forall\": \"∀\",\n\t\"ForAll\": \"∀\",\n\t\"fork\": \"⋔\",\n\t\"forkv\": \"⫙\",\n\t\"Fouriertrf\": \"ℱ\",\n\t\"fpartint\": \"⨍\",\n\t\"frac12\": \"½\",\n\t\"frac13\": \"⅓\",\n\t\"frac14\": \"¼\",\n\t\"frac15\": \"⅕\",\n\t\"frac16\": \"⅙\",\n\t\"frac18\": \"⅛\",\n\t\"frac23\": \"⅔\",\n\t\"frac25\": \"⅖\",\n\t\"frac34\": \"¾\",\n\t\"frac35\": \"⅗\",\n\t\"frac38\": \"⅜\",\n\t\"frac45\": \"⅘\",\n\t\"frac56\": \"⅚\",\n\t\"frac58\": \"⅝\",\n\t\"frac78\": \"⅞\",\n\t\"frasl\": \"⁄\",\n\t\"frown\": \"⌢\",\n\t\"fscr\": \"𝒻\",\n\t\"Fscr\": \"ℱ\",\n\t\"gacute\": \"ǵ\",\n\t\"Gamma\": \"Γ\",\n\t\"gamma\": \"γ\",\n\t\"Gammad\": \"Ϝ\",\n\t\"gammad\": \"ϝ\",\n\t\"gap\": \"⪆\",\n\t\"Gbreve\": \"Ğ\",\n\t\"gbreve\": \"ğ\",\n\t\"Gcedil\": \"Ģ\",\n\t\"Gcirc\": \"Ĝ\",\n\t\"gcirc\": \"ĝ\",\n\t\"Gcy\": \"Г\",\n\t\"gcy\": \"г\",\n\t\"Gdot\": \"Ġ\",\n\t\"gdot\": \"ġ\",\n\t\"ge\": \"≥\",\n\t\"gE\": \"≧\",\n\t\"gEl\": \"⪌\",\n\t\"gel\": \"⋛\",\n\t\"geq\": \"≥\",\n\t\"geqq\": \"≧\",\n\t\"geqslant\": \"⩾\",\n\t\"gescc\": \"⪩\",\n\t\"ges\": \"⩾\",\n\t\"gesdot\": \"⪀\",\n\t\"gesdoto\": \"⪂\",\n\t\"gesdotol\": \"⪄\",\n\t\"gesl\": \"⋛︀\",\n\t\"gesles\": \"⪔\",\n\t\"Gfr\": \"𝔊\",\n\t\"gfr\": \"𝔤\",\n\t\"gg\": \"≫\",\n\t\"Gg\": \"⋙\",\n\t\"ggg\": \"⋙\",\n\t\"gimel\": \"ℷ\",\n\t\"GJcy\": \"Ѓ\",\n\t\"gjcy\": \"ѓ\",\n\t\"gla\": \"⪥\",\n\t\"gl\": \"≷\",\n\t\"glE\": \"⪒\",\n\t\"glj\": \"⪤\",\n\t\"gnap\": \"⪊\",\n\t\"gnapprox\": \"⪊\",\n\t\"gne\": \"⪈\",\n\t\"gnE\": \"≩\",\n\t\"gneq\": \"⪈\",\n\t\"gneqq\": \"≩\",\n\t\"gnsim\": \"⋧\",\n\t\"Gopf\": \"𝔾\",\n\t\"gopf\": \"𝕘\",\n\t\"grave\": \"`\",\n\t\"GreaterEqual\": \"≥\",\n\t\"GreaterEqualLess\": \"⋛\",\n\t\"GreaterFullEqual\": \"≧\",\n\t\"GreaterGreater\": \"⪢\",\n\t\"GreaterLess\": \"≷\",\n\t\"GreaterSlantEqual\": \"⩾\",\n\t\"GreaterTilde\": \"≳\",\n\t\"Gscr\": \"𝒢\",\n\t\"gscr\": \"ℊ\",\n\t\"gsim\": \"≳\",\n\t\"gsime\": \"⪎\",\n\t\"gsiml\": \"⪐\",\n\t\"gtcc\": \"⪧\",\n\t\"gtcir\": \"⩺\",\n\t\"gt\": \">\",\n\t\"GT\": \">\",\n\t\"Gt\": \"≫\",\n\t\"gtdot\": \"⋗\",\n\t\"gtlPar\": \"⦕\",\n\t\"gtquest\": \"⩼\",\n\t\"gtrapprox\": \"⪆\",\n\t\"gtrarr\": \"⥸\",\n\t\"gtrdot\": \"⋗\",\n\t\"gtreqless\": \"⋛\",\n\t\"gtreqqless\": \"⪌\",\n\t\"gtrless\": \"≷\",\n\t\"gtrsim\": \"≳\",\n\t\"gvertneqq\": \"≩︀\",\n\t\"gvnE\": \"≩︀\",\n\t\"Hacek\": \"ˇ\",\n\t\"hairsp\": \" \",\n\t\"half\": \"½\",\n\t\"hamilt\": \"ℋ\",\n\t\"HARDcy\": \"Ъ\",\n\t\"hardcy\": \"ъ\",\n\t\"harrcir\": \"⥈\",\n\t\"harr\": \"↔\",\n\t\"hArr\": \"⇔\",\n\t\"harrw\": \"↭\",\n\t\"Hat\": \"^\",\n\t\"hbar\": \"ℏ\",\n\t\"Hcirc\": \"Ĥ\",\n\t\"hcirc\": \"ĥ\",\n\t\"hearts\": \"♥\",\n\t\"heartsuit\": \"♥\",\n\t\"hellip\": \"…\",\n\t\"hercon\": \"⊹\",\n\t\"hfr\": \"𝔥\",\n\t\"Hfr\": \"ℌ\",\n\t\"HilbertSpace\": \"ℋ\",\n\t\"hksearow\": \"⤥\",\n\t\"hkswarow\": \"⤦\",\n\t\"hoarr\": \"⇿\",\n\t\"homtht\": \"∻\",\n\t\"hookleftarrow\": \"↩\",\n\t\"hookrightarrow\": \"↪\",\n\t\"hopf\": \"𝕙\",\n\t\"Hopf\": \"ℍ\",\n\t\"horbar\": \"―\",\n\t\"HorizontalLine\": \"─\",\n\t\"hscr\": \"𝒽\",\n\t\"Hscr\": \"ℋ\",\n\t\"hslash\": \"ℏ\",\n\t\"Hstrok\": \"Ħ\",\n\t\"hstrok\": \"ħ\",\n\t\"HumpDownHump\": \"≎\",\n\t\"HumpEqual\": \"≏\",\n\t\"hybull\": \"⁃\",\n\t\"hyphen\": \"‐\",\n\t\"Iacute\": \"Í\",\n\t\"iacute\": \"í\",\n\t\"ic\": \"\",\n\t\"Icirc\": \"Î\",\n\t\"icirc\": \"î\",\n\t\"Icy\": \"И\",\n\t\"icy\": \"и\",\n\t\"Idot\": \"İ\",\n\t\"IEcy\": \"Е\",\n\t\"iecy\": \"е\",\n\t\"iexcl\": \"¡\",\n\t\"iff\": \"⇔\",\n\t\"ifr\": \"𝔦\",\n\t\"Ifr\": \"ℑ\",\n\t\"Igrave\": \"Ì\",\n\t\"igrave\": \"ì\",\n\t\"ii\": \"ⅈ\",\n\t\"iiiint\": \"⨌\",\n\t\"iiint\": \"∭\",\n\t\"iinfin\": \"⧜\",\n\t\"iiota\": \"℩\",\n\t\"IJlig\": \"IJ\",\n\t\"ijlig\": \"ij\",\n\t\"Imacr\": \"Ī\",\n\t\"imacr\": \"ī\",\n\t\"image\": \"ℑ\",\n\t\"ImaginaryI\": \"ⅈ\",\n\t\"imagline\": \"ℐ\",\n\t\"imagpart\": \"ℑ\",\n\t\"imath\": \"ı\",\n\t\"Im\": \"ℑ\",\n\t\"imof\": \"⊷\",\n\t\"imped\": \"Ƶ\",\n\t\"Implies\": \"⇒\",\n\t\"incare\": \"℅\",\n\t\"in\": \"∈\",\n\t\"infin\": \"∞\",\n\t\"infintie\": \"⧝\",\n\t\"inodot\": \"ı\",\n\t\"intcal\": \"⊺\",\n\t\"int\": \"∫\",\n\t\"Int\": \"∬\",\n\t\"integers\": \"ℤ\",\n\t\"Integral\": \"∫\",\n\t\"intercal\": \"⊺\",\n\t\"Intersection\": \"⋂\",\n\t\"intlarhk\": \"⨗\",\n\t\"intprod\": \"⨼\",\n\t\"InvisibleComma\": \"\",\n\t\"InvisibleTimes\": \"\",\n\t\"IOcy\": \"Ё\",\n\t\"iocy\": \"ё\",\n\t\"Iogon\": \"Į\",\n\t\"iogon\": \"į\",\n\t\"Iopf\": \"𝕀\",\n\t\"iopf\": \"𝕚\",\n\t\"Iota\": \"Ι\",\n\t\"iota\": \"ι\",\n\t\"iprod\": \"⨼\",\n\t\"iquest\": \"¿\",\n\t\"iscr\": \"𝒾\",\n\t\"Iscr\": \"ℐ\",\n\t\"isin\": \"∈\",\n\t\"isindot\": \"⋵\",\n\t\"isinE\": \"⋹\",\n\t\"isins\": \"⋴\",\n\t\"isinsv\": \"⋳\",\n\t\"isinv\": \"∈\",\n\t\"it\": \"\",\n\t\"Itilde\": \"Ĩ\",\n\t\"itilde\": \"ĩ\",\n\t\"Iukcy\": \"І\",\n\t\"iukcy\": \"і\",\n\t\"Iuml\": \"Ï\",\n\t\"iuml\": \"ï\",\n\t\"Jcirc\": \"Ĵ\",\n\t\"jcirc\": \"ĵ\",\n\t\"Jcy\": \"Й\",\n\t\"jcy\": \"й\",\n\t\"Jfr\": \"𝔍\",\n\t\"jfr\": \"𝔧\",\n\t\"jmath\": \"ȷ\",\n\t\"Jopf\": \"𝕁\",\n\t\"jopf\": \"𝕛\",\n\t\"Jscr\": \"𝒥\",\n\t\"jscr\": \"𝒿\",\n\t\"Jsercy\": \"Ј\",\n\t\"jsercy\": \"ј\",\n\t\"Jukcy\": \"Є\",\n\t\"jukcy\": \"є\",\n\t\"Kappa\": \"Κ\",\n\t\"kappa\": \"κ\",\n\t\"kappav\": \"ϰ\",\n\t\"Kcedil\": \"Ķ\",\n\t\"kcedil\": \"ķ\",\n\t\"Kcy\": \"К\",\n\t\"kcy\": \"к\",\n\t\"Kfr\": \"𝔎\",\n\t\"kfr\": \"𝔨\",\n\t\"kgreen\": \"ĸ\",\n\t\"KHcy\": \"Х\",\n\t\"khcy\": \"х\",\n\t\"KJcy\": \"Ќ\",\n\t\"kjcy\": \"ќ\",\n\t\"Kopf\": \"𝕂\",\n\t\"kopf\": \"𝕜\",\n\t\"Kscr\": \"𝒦\",\n\t\"kscr\": \"𝓀\",\n\t\"lAarr\": \"⇚\",\n\t\"Lacute\": \"Ĺ\",\n\t\"lacute\": \"ĺ\",\n\t\"laemptyv\": \"⦴\",\n\t\"lagran\": \"ℒ\",\n\t\"Lambda\": \"Λ\",\n\t\"lambda\": \"λ\",\n\t\"lang\": \"⟨\",\n\t\"Lang\": \"⟪\",\n\t\"langd\": \"⦑\",\n\t\"langle\": \"⟨\",\n\t\"lap\": \"⪅\",\n\t\"Laplacetrf\": \"ℒ\",\n\t\"laquo\": \"«\",\n\t\"larrb\": \"⇤\",\n\t\"larrbfs\": \"⤟\",\n\t\"larr\": \"←\",\n\t\"Larr\": \"↞\",\n\t\"lArr\": \"⇐\",\n\t\"larrfs\": \"⤝\",\n\t\"larrhk\": \"↩\",\n\t\"larrlp\": \"↫\",\n\t\"larrpl\": \"⤹\",\n\t\"larrsim\": \"⥳\",\n\t\"larrtl\": \"↢\",\n\t\"latail\": \"⤙\",\n\t\"lAtail\": \"⤛\",\n\t\"lat\": \"⪫\",\n\t\"late\": \"⪭\",\n\t\"lates\": \"⪭︀\",\n\t\"lbarr\": \"⤌\",\n\t\"lBarr\": \"⤎\",\n\t\"lbbrk\": \"❲\",\n\t\"lbrace\": \"{\",\n\t\"lbrack\": \"[\",\n\t\"lbrke\": \"⦋\",\n\t\"lbrksld\": \"⦏\",\n\t\"lbrkslu\": \"⦍\",\n\t\"Lcaron\": \"Ľ\",\n\t\"lcaron\": \"ľ\",\n\t\"Lcedil\": \"Ļ\",\n\t\"lcedil\": \"ļ\",\n\t\"lceil\": \"⌈\",\n\t\"lcub\": \"{\",\n\t\"Lcy\": \"Л\",\n\t\"lcy\": \"л\",\n\t\"ldca\": \"⤶\",\n\t\"ldquo\": \"“\",\n\t\"ldquor\": \"„\",\n\t\"ldrdhar\": \"⥧\",\n\t\"ldrushar\": \"⥋\",\n\t\"ldsh\": \"↲\",\n\t\"le\": \"≤\",\n\t\"lE\": \"≦\",\n\t\"LeftAngleBracket\": \"⟨\",\n\t\"LeftArrowBar\": \"⇤\",\n\t\"leftarrow\": \"←\",\n\t\"LeftArrow\": \"←\",\n\t\"Leftarrow\": \"⇐\",\n\t\"LeftArrowRightArrow\": \"⇆\",\n\t\"leftarrowtail\": \"↢\",\n\t\"LeftCeiling\": \"⌈\",\n\t\"LeftDoubleBracket\": \"⟦\",\n\t\"LeftDownTeeVector\": \"⥡\",\n\t\"LeftDownVectorBar\": \"⥙\",\n\t\"LeftDownVector\": \"⇃\",\n\t\"LeftFloor\": \"⌊\",\n\t\"leftharpoondown\": \"↽\",\n\t\"leftharpoonup\": \"↼\",\n\t\"leftleftarrows\": \"⇇\",\n\t\"leftrightarrow\": \"↔\",\n\t\"LeftRightArrow\": \"↔\",\n\t\"Leftrightarrow\": \"⇔\",\n\t\"leftrightarrows\": \"⇆\",\n\t\"leftrightharpoons\": \"⇋\",\n\t\"leftrightsquigarrow\": \"↭\",\n\t\"LeftRightVector\": \"⥎\",\n\t\"LeftTeeArrow\": \"↤\",\n\t\"LeftTee\": \"⊣\",\n\t\"LeftTeeVector\": \"⥚\",\n\t\"leftthreetimes\": \"⋋\",\n\t\"LeftTriangleBar\": \"⧏\",\n\t\"LeftTriangle\": \"⊲\",\n\t\"LeftTriangleEqual\": \"⊴\",\n\t\"LeftUpDownVector\": \"⥑\",\n\t\"LeftUpTeeVector\": \"⥠\",\n\t\"LeftUpVectorBar\": \"⥘\",\n\t\"LeftUpVector\": \"↿\",\n\t\"LeftVectorBar\": \"⥒\",\n\t\"LeftVector\": \"↼\",\n\t\"lEg\": \"⪋\",\n\t\"leg\": \"⋚\",\n\t\"leq\": \"≤\",\n\t\"leqq\": \"≦\",\n\t\"leqslant\": \"⩽\",\n\t\"lescc\": \"⪨\",\n\t\"les\": \"⩽\",\n\t\"lesdot\": \"⩿\",\n\t\"lesdoto\": \"⪁\",\n\t\"lesdotor\": \"⪃\",\n\t\"lesg\": \"⋚︀\",\n\t\"lesges\": \"⪓\",\n\t\"lessapprox\": \"⪅\",\n\t\"lessdot\": \"⋖\",\n\t\"lesseqgtr\": \"⋚\",\n\t\"lesseqqgtr\": \"⪋\",\n\t\"LessEqualGreater\": \"⋚\",\n\t\"LessFullEqual\": \"≦\",\n\t\"LessGreater\": \"≶\",\n\t\"lessgtr\": \"≶\",\n\t\"LessLess\": \"⪡\",\n\t\"lesssim\": \"≲\",\n\t\"LessSlantEqual\": \"⩽\",\n\t\"LessTilde\": \"≲\",\n\t\"lfisht\": \"⥼\",\n\t\"lfloor\": \"⌊\",\n\t\"Lfr\": \"𝔏\",\n\t\"lfr\": \"𝔩\",\n\t\"lg\": \"≶\",\n\t\"lgE\": \"⪑\",\n\t\"lHar\": \"⥢\",\n\t\"lhard\": \"↽\",\n\t\"lharu\": \"↼\",\n\t\"lharul\": \"⥪\",\n\t\"lhblk\": \"▄\",\n\t\"LJcy\": \"Љ\",\n\t\"ljcy\": \"љ\",\n\t\"llarr\": \"⇇\",\n\t\"ll\": \"≪\",\n\t\"Ll\": \"⋘\",\n\t\"llcorner\": \"⌞\",\n\t\"Lleftarrow\": \"⇚\",\n\t\"llhard\": \"⥫\",\n\t\"lltri\": \"◺\",\n\t\"Lmidot\": \"Ŀ\",\n\t\"lmidot\": \"ŀ\",\n\t\"lmoustache\": \"⎰\",\n\t\"lmoust\": \"⎰\",\n\t\"lnap\": \"⪉\",\n\t\"lnapprox\": \"⪉\",\n\t\"lne\": \"⪇\",\n\t\"lnE\": \"≨\",\n\t\"lneq\": \"⪇\",\n\t\"lneqq\": \"≨\",\n\t\"lnsim\": \"⋦\",\n\t\"loang\": \"⟬\",\n\t\"loarr\": \"⇽\",\n\t\"lobrk\": \"⟦\",\n\t\"longleftarrow\": \"⟵\",\n\t\"LongLeftArrow\": \"⟵\",\n\t\"Longleftarrow\": \"⟸\",\n\t\"longleftrightarrow\": \"⟷\",\n\t\"LongLeftRightArrow\": \"⟷\",\n\t\"Longleftrightarrow\": \"⟺\",\n\t\"longmapsto\": \"⟼\",\n\t\"longrightarrow\": \"⟶\",\n\t\"LongRightArrow\": \"⟶\",\n\t\"Longrightarrow\": \"⟹\",\n\t\"looparrowleft\": \"↫\",\n\t\"looparrowright\": \"↬\",\n\t\"lopar\": \"⦅\",\n\t\"Lopf\": \"𝕃\",\n\t\"lopf\": \"𝕝\",\n\t\"loplus\": \"⨭\",\n\t\"lotimes\": \"⨴\",\n\t\"lowast\": \"∗\",\n\t\"lowbar\": \"_\",\n\t\"LowerLeftArrow\": \"↙\",\n\t\"LowerRightArrow\": \"↘\",\n\t\"loz\": \"◊\",\n\t\"lozenge\": \"◊\",\n\t\"lozf\": \"⧫\",\n\t\"lpar\": \"(\",\n\t\"lparlt\": \"⦓\",\n\t\"lrarr\": \"⇆\",\n\t\"lrcorner\": \"⌟\",\n\t\"lrhar\": \"⇋\",\n\t\"lrhard\": \"⥭\",\n\t\"lrm\": \"\",\n\t\"lrtri\": \"⊿\",\n\t\"lsaquo\": \"‹\",\n\t\"lscr\": \"𝓁\",\n\t\"Lscr\": \"ℒ\",\n\t\"lsh\": \"↰\",\n\t\"Lsh\": \"↰\",\n\t\"lsim\": \"≲\",\n\t\"lsime\": \"⪍\",\n\t\"lsimg\": \"⪏\",\n\t\"lsqb\": \"[\",\n\t\"lsquo\": \"‘\",\n\t\"lsquor\": \"‚\",\n\t\"Lstrok\": \"Ł\",\n\t\"lstrok\": \"ł\",\n\t\"ltcc\": \"⪦\",\n\t\"ltcir\": \"⩹\",\n\t\"lt\": \"<\",\n\t\"LT\": \"<\",\n\t\"Lt\": \"≪\",\n\t\"ltdot\": \"⋖\",\n\t\"lthree\": \"⋋\",\n\t\"ltimes\": \"⋉\",\n\t\"ltlarr\": \"⥶\",\n\t\"ltquest\": \"⩻\",\n\t\"ltri\": \"◃\",\n\t\"ltrie\": \"⊴\",\n\t\"ltrif\": \"◂\",\n\t\"ltrPar\": \"⦖\",\n\t\"lurdshar\": \"⥊\",\n\t\"luruhar\": \"⥦\",\n\t\"lvertneqq\": \"≨︀\",\n\t\"lvnE\": \"≨︀\",\n\t\"macr\": \"¯\",\n\t\"male\": \"♂\",\n\t\"malt\": \"✠\",\n\t\"maltese\": \"✠\",\n\t\"Map\": \"⤅\",\n\t\"map\": \"↦\",\n\t\"mapsto\": \"↦\",\n\t\"mapstodown\": \"↧\",\n\t\"mapstoleft\": \"↤\",\n\t\"mapstoup\": \"↥\",\n\t\"marker\": \"▮\",\n\t\"mcomma\": \"⨩\",\n\t\"Mcy\": \"М\",\n\t\"mcy\": \"м\",\n\t\"mdash\": \"—\",\n\t\"mDDot\": \"∺\",\n\t\"measuredangle\": \"∡\",\n\t\"MediumSpace\": \" \",\n\t\"Mellintrf\": \"ℳ\",\n\t\"Mfr\": \"𝔐\",\n\t\"mfr\": \"𝔪\",\n\t\"mho\": \"℧\",\n\t\"micro\": \"µ\",\n\t\"midast\": \"*\",\n\t\"midcir\": \"⫰\",\n\t\"mid\": \"∣\",\n\t\"middot\": \"·\",\n\t\"minusb\": \"⊟\",\n\t\"minus\": \"−\",\n\t\"minusd\": \"∸\",\n\t\"minusdu\": \"⨪\",\n\t\"MinusPlus\": \"∓\",\n\t\"mlcp\": \"⫛\",\n\t\"mldr\": \"…\",\n\t\"mnplus\": \"∓\",\n\t\"models\": \"⊧\",\n\t\"Mopf\": \"𝕄\",\n\t\"mopf\": \"𝕞\",\n\t\"mp\": \"∓\",\n\t\"mscr\": \"𝓂\",\n\t\"Mscr\": \"ℳ\",\n\t\"mstpos\": \"∾\",\n\t\"Mu\": \"Μ\",\n\t\"mu\": \"μ\",\n\t\"multimap\": \"⊸\",\n\t\"mumap\": \"⊸\",\n\t\"nabla\": \"∇\",\n\t\"Nacute\": \"Ń\",\n\t\"nacute\": \"ń\",\n\t\"nang\": \"∠⃒\",\n\t\"nap\": \"≉\",\n\t\"napE\": \"⩰̸\",\n\t\"napid\": \"≋̸\",\n\t\"napos\": \"ʼn\",\n\t\"napprox\": \"≉\",\n\t\"natural\": \"♮\",\n\t\"naturals\": \"ℕ\",\n\t\"natur\": \"♮\",\n\t\"nbsp\": \" \",\n\t\"nbump\": \"≎̸\",\n\t\"nbumpe\": \"≏̸\",\n\t\"ncap\": \"⩃\",\n\t\"Ncaron\": \"Ň\",\n\t\"ncaron\": \"ň\",\n\t\"Ncedil\": \"Ņ\",\n\t\"ncedil\": \"ņ\",\n\t\"ncong\": \"≇\",\n\t\"ncongdot\": \"⩭̸\",\n\t\"ncup\": \"⩂\",\n\t\"Ncy\": \"Н\",\n\t\"ncy\": \"н\",\n\t\"ndash\": \"–\",\n\t\"nearhk\": \"⤤\",\n\t\"nearr\": \"↗\",\n\t\"neArr\": \"⇗\",\n\t\"nearrow\": \"↗\",\n\t\"ne\": \"≠\",\n\t\"nedot\": \"≐̸\",\n\t\"NegativeMediumSpace\": \"\",\n\t\"NegativeThickSpace\": \"\",\n\t\"NegativeThinSpace\": \"\",\n\t\"NegativeVeryThinSpace\": \"\",\n\t\"nequiv\": \"≢\",\n\t\"nesear\": \"⤨\",\n\t\"nesim\": \"≂̸\",\n\t\"NestedGreaterGreater\": \"≫\",\n\t\"NestedLessLess\": \"≪\",\n\t\"NewLine\": \"\\n\",\n\t\"nexist\": \"∄\",\n\t\"nexists\": \"∄\",\n\t\"Nfr\": \"𝔑\",\n\t\"nfr\": \"𝔫\",\n\t\"ngE\": \"≧̸\",\n\t\"nge\": \"≱\",\n\t\"ngeq\": \"≱\",\n\t\"ngeqq\": \"≧̸\",\n\t\"ngeqslant\": \"⩾̸\",\n\t\"nges\": \"⩾̸\",\n\t\"nGg\": \"⋙̸\",\n\t\"ngsim\": \"≵\",\n\t\"nGt\": \"≫⃒\",\n\t\"ngt\": \"≯\",\n\t\"ngtr\": \"≯\",\n\t\"nGtv\": \"≫̸\",\n\t\"nharr\": \"↮\",\n\t\"nhArr\": \"⇎\",\n\t\"nhpar\": \"⫲\",\n\t\"ni\": \"∋\",\n\t\"nis\": \"⋼\",\n\t\"nisd\": \"⋺\",\n\t\"niv\": \"∋\",\n\t\"NJcy\": \"Њ\",\n\t\"njcy\": \"њ\",\n\t\"nlarr\": \"↚\",\n\t\"nlArr\": \"⇍\",\n\t\"nldr\": \"‥\",\n\t\"nlE\": \"≦̸\",\n\t\"nle\": \"≰\",\n\t\"nleftarrow\": \"↚\",\n\t\"nLeftarrow\": \"⇍\",\n\t\"nleftrightarrow\": \"↮\",\n\t\"nLeftrightarrow\": \"⇎\",\n\t\"nleq\": \"≰\",\n\t\"nleqq\": \"≦̸\",\n\t\"nleqslant\": \"⩽̸\",\n\t\"nles\": \"⩽̸\",\n\t\"nless\": \"≮\",\n\t\"nLl\": \"⋘̸\",\n\t\"nlsim\": \"≴\",\n\t\"nLt\": \"≪⃒\",\n\t\"nlt\": \"≮\",\n\t\"nltri\": \"⋪\",\n\t\"nltrie\": \"⋬\",\n\t\"nLtv\": \"≪̸\",\n\t\"nmid\": \"∤\",\n\t\"NoBreak\": \"\",\n\t\"NonBreakingSpace\": \" \",\n\t\"nopf\": \"𝕟\",\n\t\"Nopf\": \"ℕ\",\n\t\"Not\": \"⫬\",\n\t\"not\": \"¬\",\n\t\"NotCongruent\": \"≢\",\n\t\"NotCupCap\": \"≭\",\n\t\"NotDoubleVerticalBar\": \"∦\",\n\t\"NotElement\": \"∉\",\n\t\"NotEqual\": \"≠\",\n\t\"NotEqualTilde\": \"≂̸\",\n\t\"NotExists\": \"∄\",\n\t\"NotGreater\": \"≯\",\n\t\"NotGreaterEqual\": \"≱\",\n\t\"NotGreaterFullEqual\": \"≧̸\",\n\t\"NotGreaterGreater\": \"≫̸\",\n\t\"NotGreaterLess\": \"≹\",\n\t\"NotGreaterSlantEqual\": \"⩾̸\",\n\t\"NotGreaterTilde\": \"≵\",\n\t\"NotHumpDownHump\": \"≎̸\",\n\t\"NotHumpEqual\": \"≏̸\",\n\t\"notin\": \"∉\",\n\t\"notindot\": \"⋵̸\",\n\t\"notinE\": \"⋹̸\",\n\t\"notinva\": \"∉\",\n\t\"notinvb\": \"⋷\",\n\t\"notinvc\": \"⋶\",\n\t\"NotLeftTriangleBar\": \"⧏̸\",\n\t\"NotLeftTriangle\": \"⋪\",\n\t\"NotLeftTriangleEqual\": \"⋬\",\n\t\"NotLess\": \"≮\",\n\t\"NotLessEqual\": \"≰\",\n\t\"NotLessGreater\": \"≸\",\n\t\"NotLessLess\": \"≪̸\",\n\t\"NotLessSlantEqual\": \"⩽̸\",\n\t\"NotLessTilde\": \"≴\",\n\t\"NotNestedGreaterGreater\": \"⪢̸\",\n\t\"NotNestedLessLess\": \"⪡̸\",\n\t\"notni\": \"∌\",\n\t\"notniva\": \"∌\",\n\t\"notnivb\": \"⋾\",\n\t\"notnivc\": \"⋽\",\n\t\"NotPrecedes\": \"⊀\",\n\t\"NotPrecedesEqual\": \"⪯̸\",\n\t\"NotPrecedesSlantEqual\": \"⋠\",\n\t\"NotReverseElement\": \"∌\",\n\t\"NotRightTriangleBar\": \"⧐̸\",\n\t\"NotRightTriangle\": \"⋫\",\n\t\"NotRightTriangleEqual\": \"⋭\",\n\t\"NotSquareSubset\": \"⊏̸\",\n\t\"NotSquareSubsetEqual\": \"⋢\",\n\t\"NotSquareSuperset\": \"⊐̸\",\n\t\"NotSquareSupersetEqual\": \"⋣\",\n\t\"NotSubset\": \"⊂⃒\",\n\t\"NotSubsetEqual\": \"⊈\",\n\t\"NotSucceeds\": \"⊁\",\n\t\"NotSucceedsEqual\": \"⪰̸\",\n\t\"NotSucceedsSlantEqual\": \"⋡\",\n\t\"NotSucceedsTilde\": \"≿̸\",\n\t\"NotSuperset\": \"⊃⃒\",\n\t\"NotSupersetEqual\": \"⊉\",\n\t\"NotTilde\": \"≁\",\n\t\"NotTildeEqual\": \"≄\",\n\t\"NotTildeFullEqual\": \"≇\",\n\t\"NotTildeTilde\": \"≉\",\n\t\"NotVerticalBar\": \"∤\",\n\t\"nparallel\": \"∦\",\n\t\"npar\": \"∦\",\n\t\"nparsl\": \"⫽⃥\",\n\t\"npart\": \"∂̸\",\n\t\"npolint\": \"⨔\",\n\t\"npr\": \"⊀\",\n\t\"nprcue\": \"⋠\",\n\t\"nprec\": \"⊀\",\n\t\"npreceq\": \"⪯̸\",\n\t\"npre\": \"⪯̸\",\n\t\"nrarrc\": \"⤳̸\",\n\t\"nrarr\": \"↛\",\n\t\"nrArr\": \"⇏\",\n\t\"nrarrw\": \"↝̸\",\n\t\"nrightarrow\": \"↛\",\n\t\"nRightarrow\": \"⇏\",\n\t\"nrtri\": \"⋫\",\n\t\"nrtrie\": \"⋭\",\n\t\"nsc\": \"⊁\",\n\t\"nsccue\": \"⋡\",\n\t\"nsce\": \"⪰̸\",\n\t\"Nscr\": \"𝒩\",\n\t\"nscr\": \"𝓃\",\n\t\"nshortmid\": \"∤\",\n\t\"nshortparallel\": \"∦\",\n\t\"nsim\": \"≁\",\n\t\"nsime\": \"≄\",\n\t\"nsimeq\": \"≄\",\n\t\"nsmid\": \"∤\",\n\t\"nspar\": \"∦\",\n\t\"nsqsube\": \"⋢\",\n\t\"nsqsupe\": \"⋣\",\n\t\"nsub\": \"⊄\",\n\t\"nsubE\": \"⫅̸\",\n\t\"nsube\": \"⊈\",\n\t\"nsubset\": \"⊂⃒\",\n\t\"nsubseteq\": \"⊈\",\n\t\"nsubseteqq\": \"⫅̸\",\n\t\"nsucc\": \"⊁\",\n\t\"nsucceq\": \"⪰̸\",\n\t\"nsup\": \"⊅\",\n\t\"nsupE\": \"⫆̸\",\n\t\"nsupe\": \"⊉\",\n\t\"nsupset\": \"⊃⃒\",\n\t\"nsupseteq\": \"⊉\",\n\t\"nsupseteqq\": \"⫆̸\",\n\t\"ntgl\": \"≹\",\n\t\"Ntilde\": \"Ñ\",\n\t\"ntilde\": \"ñ\",\n\t\"ntlg\": \"≸\",\n\t\"ntriangleleft\": \"⋪\",\n\t\"ntrianglelefteq\": \"⋬\",\n\t\"ntriangleright\": \"⋫\",\n\t\"ntrianglerighteq\": \"⋭\",\n\t\"Nu\": \"Ν\",\n\t\"nu\": \"ν\",\n\t\"num\": \"#\",\n\t\"numero\": \"№\",\n\t\"numsp\": \" \",\n\t\"nvap\": \"≍⃒\",\n\t\"nvdash\": \"⊬\",\n\t\"nvDash\": \"⊭\",\n\t\"nVdash\": \"⊮\",\n\t\"nVDash\": \"⊯\",\n\t\"nvge\": \"≥⃒\",\n\t\"nvgt\": \">⃒\",\n\t\"nvHarr\": \"⤄\",\n\t\"nvinfin\": \"⧞\",\n\t\"nvlArr\": \"⤂\",\n\t\"nvle\": \"≤⃒\",\n\t\"nvlt\": \"<⃒\",\n\t\"nvltrie\": \"⊴⃒\",\n\t\"nvrArr\": \"⤃\",\n\t\"nvrtrie\": \"⊵⃒\",\n\t\"nvsim\": \"∼⃒\",\n\t\"nwarhk\": \"⤣\",\n\t\"nwarr\": \"↖\",\n\t\"nwArr\": \"⇖\",\n\t\"nwarrow\": \"↖\",\n\t\"nwnear\": \"⤧\",\n\t\"Oacute\": \"Ó\",\n\t\"oacute\": \"ó\",\n\t\"oast\": \"⊛\",\n\t\"Ocirc\": \"Ô\",\n\t\"ocirc\": \"ô\",\n\t\"ocir\": \"⊚\",\n\t\"Ocy\": \"О\",\n\t\"ocy\": \"о\",\n\t\"odash\": \"⊝\",\n\t\"Odblac\": \"Ő\",\n\t\"odblac\": \"ő\",\n\t\"odiv\": \"⨸\",\n\t\"odot\": \"⊙\",\n\t\"odsold\": \"⦼\",\n\t\"OElig\": \"Œ\",\n\t\"oelig\": \"œ\",\n\t\"ofcir\": \"⦿\",\n\t\"Ofr\": \"𝔒\",\n\t\"ofr\": \"𝔬\",\n\t\"ogon\": \"˛\",\n\t\"Ograve\": \"Ò\",\n\t\"ograve\": \"ò\",\n\t\"ogt\": \"⧁\",\n\t\"ohbar\": \"⦵\",\n\t\"ohm\": \"Ω\",\n\t\"oint\": \"∮\",\n\t\"olarr\": \"↺\",\n\t\"olcir\": \"⦾\",\n\t\"olcross\": \"⦻\",\n\t\"oline\": \"‾\",\n\t\"olt\": \"⧀\",\n\t\"Omacr\": \"Ō\",\n\t\"omacr\": \"ō\",\n\t\"Omega\": \"Ω\",\n\t\"omega\": \"ω\",\n\t\"Omicron\": \"Ο\",\n\t\"omicron\": \"ο\",\n\t\"omid\": \"⦶\",\n\t\"ominus\": \"⊖\",\n\t\"Oopf\": \"𝕆\",\n\t\"oopf\": \"𝕠\",\n\t\"opar\": \"⦷\",\n\t\"OpenCurlyDoubleQuote\": \"“\",\n\t\"OpenCurlyQuote\": \"‘\",\n\t\"operp\": \"⦹\",\n\t\"oplus\": \"⊕\",\n\t\"orarr\": \"↻\",\n\t\"Or\": \"⩔\",\n\t\"or\": \"∨\",\n\t\"ord\": \"⩝\",\n\t\"order\": \"ℴ\",\n\t\"orderof\": \"ℴ\",\n\t\"ordf\": \"ª\",\n\t\"ordm\": \"º\",\n\t\"origof\": \"⊶\",\n\t\"oror\": \"⩖\",\n\t\"orslope\": \"⩗\",\n\t\"orv\": \"⩛\",\n\t\"oS\": \"Ⓢ\",\n\t\"Oscr\": \"𝒪\",\n\t\"oscr\": \"ℴ\",\n\t\"Oslash\": \"Ø\",\n\t\"oslash\": \"ø\",\n\t\"osol\": \"⊘\",\n\t\"Otilde\": \"Õ\",\n\t\"otilde\": \"õ\",\n\t\"otimesas\": \"⨶\",\n\t\"Otimes\": \"⨷\",\n\t\"otimes\": \"⊗\",\n\t\"Ouml\": \"Ö\",\n\t\"ouml\": \"ö\",\n\t\"ovbar\": \"⌽\",\n\t\"OverBar\": \"‾\",\n\t\"OverBrace\": \"⏞\",\n\t\"OverBracket\": \"⎴\",\n\t\"OverParenthesis\": \"⏜\",\n\t\"para\": \"¶\",\n\t\"parallel\": \"∥\",\n\t\"par\": \"∥\",\n\t\"parsim\": \"⫳\",\n\t\"parsl\": \"⫽\",\n\t\"part\": \"∂\",\n\t\"PartialD\": \"∂\",\n\t\"Pcy\": \"П\",\n\t\"pcy\": \"п\",\n\t\"percnt\": \"%\",\n\t\"period\": \".\",\n\t\"permil\": \"‰\",\n\t\"perp\": \"⊥\",\n\t\"pertenk\": \"‱\",\n\t\"Pfr\": \"𝔓\",\n\t\"pfr\": \"𝔭\",\n\t\"Phi\": \"Φ\",\n\t\"phi\": \"φ\",\n\t\"phiv\": \"ϕ\",\n\t\"phmmat\": \"ℳ\",\n\t\"phone\": \"☎\",\n\t\"Pi\": \"Π\",\n\t\"pi\": \"π\",\n\t\"pitchfork\": \"⋔\",\n\t\"piv\": \"ϖ\",\n\t\"planck\": \"ℏ\",\n\t\"planckh\": \"ℎ\",\n\t\"plankv\": \"ℏ\",\n\t\"plusacir\": \"⨣\",\n\t\"plusb\": \"⊞\",\n\t\"pluscir\": \"⨢\",\n\t\"plus\": \"+\",\n\t\"plusdo\": \"∔\",\n\t\"plusdu\": \"⨥\",\n\t\"pluse\": \"⩲\",\n\t\"PlusMinus\": \"±\",\n\t\"plusmn\": \"±\",\n\t\"plussim\": \"⨦\",\n\t\"plustwo\": \"⨧\",\n\t\"pm\": \"±\",\n\t\"Poincareplane\": \"ℌ\",\n\t\"pointint\": \"⨕\",\n\t\"popf\": \"𝕡\",\n\t\"Popf\": \"ℙ\",\n\t\"pound\": \"£\",\n\t\"prap\": \"⪷\",\n\t\"Pr\": \"⪻\",\n\t\"pr\": \"≺\",\n\t\"prcue\": \"≼\",\n\t\"precapprox\": \"⪷\",\n\t\"prec\": \"≺\",\n\t\"preccurlyeq\": \"≼\",\n\t\"Precedes\": \"≺\",\n\t\"PrecedesEqual\": \"⪯\",\n\t\"PrecedesSlantEqual\": \"≼\",\n\t\"PrecedesTilde\": \"≾\",\n\t\"preceq\": \"⪯\",\n\t\"precnapprox\": \"⪹\",\n\t\"precneqq\": \"⪵\",\n\t\"precnsim\": \"⋨\",\n\t\"pre\": \"⪯\",\n\t\"prE\": \"⪳\",\n\t\"precsim\": \"≾\",\n\t\"prime\": \"′\",\n\t\"Prime\": \"″\",\n\t\"primes\": \"ℙ\",\n\t\"prnap\": \"⪹\",\n\t\"prnE\": \"⪵\",\n\t\"prnsim\": \"⋨\",\n\t\"prod\": \"∏\",\n\t\"Product\": \"∏\",\n\t\"profalar\": \"⌮\",\n\t\"profline\": \"⌒\",\n\t\"profsurf\": \"⌓\",\n\t\"prop\": \"∝\",\n\t\"Proportional\": \"∝\",\n\t\"Proportion\": \"∷\",\n\t\"propto\": \"∝\",\n\t\"prsim\": \"≾\",\n\t\"prurel\": \"⊰\",\n\t\"Pscr\": \"𝒫\",\n\t\"pscr\": \"𝓅\",\n\t\"Psi\": \"Ψ\",\n\t\"psi\": \"ψ\",\n\t\"puncsp\": \" \",\n\t\"Qfr\": \"𝔔\",\n\t\"qfr\": \"𝔮\",\n\t\"qint\": \"⨌\",\n\t\"qopf\": \"𝕢\",\n\t\"Qopf\": \"ℚ\",\n\t\"qprime\": \"⁗\",\n\t\"Qscr\": \"𝒬\",\n\t\"qscr\": \"𝓆\",\n\t\"quaternions\": \"ℍ\",\n\t\"quatint\": \"⨖\",\n\t\"quest\": \"?\",\n\t\"questeq\": \"≟\",\n\t\"quot\": \"\\\"\",\n\t\"QUOT\": \"\\\"\",\n\t\"rAarr\": \"⇛\",\n\t\"race\": \"∽̱\",\n\t\"Racute\": \"Ŕ\",\n\t\"racute\": \"ŕ\",\n\t\"radic\": \"√\",\n\t\"raemptyv\": \"⦳\",\n\t\"rang\": \"⟩\",\n\t\"Rang\": \"⟫\",\n\t\"rangd\": \"⦒\",\n\t\"range\": \"⦥\",\n\t\"rangle\": \"⟩\",\n\t\"raquo\": \"»\",\n\t\"rarrap\": \"⥵\",\n\t\"rarrb\": \"⇥\",\n\t\"rarrbfs\": \"⤠\",\n\t\"rarrc\": \"⤳\",\n\t\"rarr\": \"→\",\n\t\"Rarr\": \"↠\",\n\t\"rArr\": \"⇒\",\n\t\"rarrfs\": \"⤞\",\n\t\"rarrhk\": \"↪\",\n\t\"rarrlp\": \"↬\",\n\t\"rarrpl\": \"⥅\",\n\t\"rarrsim\": \"⥴\",\n\t\"Rarrtl\": \"⤖\",\n\t\"rarrtl\": \"↣\",\n\t\"rarrw\": \"↝\",\n\t\"ratail\": \"⤚\",\n\t\"rAtail\": \"⤜\",\n\t\"ratio\": \"∶\",\n\t\"rationals\": \"ℚ\",\n\t\"rbarr\": \"⤍\",\n\t\"rBarr\": \"⤏\",\n\t\"RBarr\": \"⤐\",\n\t\"rbbrk\": \"❳\",\n\t\"rbrace\": \"}\",\n\t\"rbrack\": \"]\",\n\t\"rbrke\": \"⦌\",\n\t\"rbrksld\": \"⦎\",\n\t\"rbrkslu\": \"⦐\",\n\t\"Rcaron\": \"Ř\",\n\t\"rcaron\": \"ř\",\n\t\"Rcedil\": \"Ŗ\",\n\t\"rcedil\": \"ŗ\",\n\t\"rceil\": \"⌉\",\n\t\"rcub\": \"}\",\n\t\"Rcy\": \"Р\",\n\t\"rcy\": \"р\",\n\t\"rdca\": \"⤷\",\n\t\"rdldhar\": \"⥩\",\n\t\"rdquo\": \"”\",\n\t\"rdquor\": \"”\",\n\t\"rdsh\": \"↳\",\n\t\"real\": \"ℜ\",\n\t\"realine\": \"ℛ\",\n\t\"realpart\": \"ℜ\",\n\t\"reals\": \"ℝ\",\n\t\"Re\": \"ℜ\",\n\t\"rect\": \"▭\",\n\t\"reg\": \"®\",\n\t\"REG\": \"®\",\n\t\"ReverseElement\": \"∋\",\n\t\"ReverseEquilibrium\": \"⇋\",\n\t\"ReverseUpEquilibrium\": \"⥯\",\n\t\"rfisht\": \"⥽\",\n\t\"rfloor\": \"⌋\",\n\t\"rfr\": \"𝔯\",\n\t\"Rfr\": \"ℜ\",\n\t\"rHar\": \"⥤\",\n\t\"rhard\": \"⇁\",\n\t\"rharu\": \"⇀\",\n\t\"rharul\": \"⥬\",\n\t\"Rho\": \"Ρ\",\n\t\"rho\": \"ρ\",\n\t\"rhov\": \"ϱ\",\n\t\"RightAngleBracket\": \"⟩\",\n\t\"RightArrowBar\": \"⇥\",\n\t\"rightarrow\": \"→\",\n\t\"RightArrow\": \"→\",\n\t\"Rightarrow\": \"⇒\",\n\t\"RightArrowLeftArrow\": \"⇄\",\n\t\"rightarrowtail\": \"↣\",\n\t\"RightCeiling\": \"⌉\",\n\t\"RightDoubleBracket\": \"⟧\",\n\t\"RightDownTeeVector\": \"⥝\",\n\t\"RightDownVectorBar\": \"⥕\",\n\t\"RightDownVector\": \"⇂\",\n\t\"RightFloor\": \"⌋\",\n\t\"rightharpoondown\": \"⇁\",\n\t\"rightharpoonup\": \"⇀\",\n\t\"rightleftarrows\": \"⇄\",\n\t\"rightleftharpoons\": \"⇌\",\n\t\"rightrightarrows\": \"⇉\",\n\t\"rightsquigarrow\": \"↝\",\n\t\"RightTeeArrow\": \"↦\",\n\t\"RightTee\": \"⊢\",\n\t\"RightTeeVector\": \"⥛\",\n\t\"rightthreetimes\": \"⋌\",\n\t\"RightTriangleBar\": \"⧐\",\n\t\"RightTriangle\": \"⊳\",\n\t\"RightTriangleEqual\": \"⊵\",\n\t\"RightUpDownVector\": \"⥏\",\n\t\"RightUpTeeVector\": \"⥜\",\n\t\"RightUpVectorBar\": \"⥔\",\n\t\"RightUpVector\": \"↾\",\n\t\"RightVectorBar\": \"⥓\",\n\t\"RightVector\": \"⇀\",\n\t\"ring\": \"˚\",\n\t\"risingdotseq\": \"≓\",\n\t\"rlarr\": \"⇄\",\n\t\"rlhar\": \"⇌\",\n\t\"rlm\": \"\",\n\t\"rmoustache\": \"⎱\",\n\t\"rmoust\": \"⎱\",\n\t\"rnmid\": \"⫮\",\n\t\"roang\": \"⟭\",\n\t\"roarr\": \"⇾\",\n\t\"robrk\": \"⟧\",\n\t\"ropar\": \"⦆\",\n\t\"ropf\": \"𝕣\",\n\t\"Ropf\": \"ℝ\",\n\t\"roplus\": \"⨮\",\n\t\"rotimes\": \"⨵\",\n\t\"RoundImplies\": \"⥰\",\n\t\"rpar\": \")\",\n\t\"rpargt\": \"⦔\",\n\t\"rppolint\": \"⨒\",\n\t\"rrarr\": \"⇉\",\n\t\"Rrightarrow\": \"⇛\",\n\t\"rsaquo\": \"›\",\n\t\"rscr\": \"𝓇\",\n\t\"Rscr\": \"ℛ\",\n\t\"rsh\": \"↱\",\n\t\"Rsh\": \"↱\",\n\t\"rsqb\": \"]\",\n\t\"rsquo\": \"’\",\n\t\"rsquor\": \"’\",\n\t\"rthree\": \"⋌\",\n\t\"rtimes\": \"⋊\",\n\t\"rtri\": \"▹\",\n\t\"rtrie\": \"⊵\",\n\t\"rtrif\": \"▸\",\n\t\"rtriltri\": \"⧎\",\n\t\"RuleDelayed\": \"⧴\",\n\t\"ruluhar\": \"⥨\",\n\t\"rx\": \"℞\",\n\t\"Sacute\": \"Ś\",\n\t\"sacute\": \"ś\",\n\t\"sbquo\": \"‚\",\n\t\"scap\": \"⪸\",\n\t\"Scaron\": \"Š\",\n\t\"scaron\": \"š\",\n\t\"Sc\": \"⪼\",\n\t\"sc\": \"≻\",\n\t\"sccue\": \"≽\",\n\t\"sce\": \"⪰\",\n\t\"scE\": \"⪴\",\n\t\"Scedil\": \"Ş\",\n\t\"scedil\": \"ş\",\n\t\"Scirc\": \"Ŝ\",\n\t\"scirc\": \"ŝ\",\n\t\"scnap\": \"⪺\",\n\t\"scnE\": \"⪶\",\n\t\"scnsim\": \"⋩\",\n\t\"scpolint\": \"⨓\",\n\t\"scsim\": \"≿\",\n\t\"Scy\": \"С\",\n\t\"scy\": \"с\",\n\t\"sdotb\": \"⊡\",\n\t\"sdot\": \"⋅\",\n\t\"sdote\": \"⩦\",\n\t\"searhk\": \"⤥\",\n\t\"searr\": \"↘\",\n\t\"seArr\": \"⇘\",\n\t\"searrow\": \"↘\",\n\t\"sect\": \"§\",\n\t\"semi\": \";\",\n\t\"seswar\": \"⤩\",\n\t\"setminus\": \"∖\",\n\t\"setmn\": \"∖\",\n\t\"sext\": \"✶\",\n\t\"Sfr\": \"𝔖\",\n\t\"sfr\": \"𝔰\",\n\t\"sfrown\": \"⌢\",\n\t\"sharp\": \"♯\",\n\t\"SHCHcy\": \"Щ\",\n\t\"shchcy\": \"щ\",\n\t\"SHcy\": \"Ш\",\n\t\"shcy\": \"ш\",\n\t\"ShortDownArrow\": \"↓\",\n\t\"ShortLeftArrow\": \"←\",\n\t\"shortmid\": \"∣\",\n\t\"shortparallel\": \"∥\",\n\t\"ShortRightArrow\": \"→\",\n\t\"ShortUpArrow\": \"↑\",\n\t\"shy\": \"\",\n\t\"Sigma\": \"Σ\",\n\t\"sigma\": \"σ\",\n\t\"sigmaf\": \"ς\",\n\t\"sigmav\": \"ς\",\n\t\"sim\": \"∼\",\n\t\"simdot\": \"⩪\",\n\t\"sime\": \"≃\",\n\t\"simeq\": \"≃\",\n\t\"simg\": \"⪞\",\n\t\"simgE\": \"⪠\",\n\t\"siml\": \"⪝\",\n\t\"simlE\": \"⪟\",\n\t\"simne\": \"≆\",\n\t\"simplus\": \"⨤\",\n\t\"simrarr\": \"⥲\",\n\t\"slarr\": \"←\",\n\t\"SmallCircle\": \"∘\",\n\t\"smallsetminus\": \"∖\",\n\t\"smashp\": \"⨳\",\n\t\"smeparsl\": \"⧤\",\n\t\"smid\": \"∣\",\n\t\"smile\": \"⌣\",\n\t\"smt\": \"⪪\",\n\t\"smte\": \"⪬\",\n\t\"smtes\": \"⪬︀\",\n\t\"SOFTcy\": \"Ь\",\n\t\"softcy\": \"ь\",\n\t\"solbar\": \"⌿\",\n\t\"solb\": \"⧄\",\n\t\"sol\": \"/\",\n\t\"Sopf\": \"𝕊\",\n\t\"sopf\": \"𝕤\",\n\t\"spades\": \"♠\",\n\t\"spadesuit\": \"♠\",\n\t\"spar\": \"∥\",\n\t\"sqcap\": \"⊓\",\n\t\"sqcaps\": \"⊓︀\",\n\t\"sqcup\": \"⊔\",\n\t\"sqcups\": \"⊔︀\",\n\t\"Sqrt\": \"√\",\n\t\"sqsub\": \"⊏\",\n\t\"sqsube\": \"⊑\",\n\t\"sqsubset\": \"⊏\",\n\t\"sqsubseteq\": \"⊑\",\n\t\"sqsup\": \"⊐\",\n\t\"sqsupe\": \"⊒\",\n\t\"sqsupset\": \"⊐\",\n\t\"sqsupseteq\": \"⊒\",\n\t\"square\": \"□\",\n\t\"Square\": \"□\",\n\t\"SquareIntersection\": \"⊓\",\n\t\"SquareSubset\": \"⊏\",\n\t\"SquareSubsetEqual\": \"⊑\",\n\t\"SquareSuperset\": \"⊐\",\n\t\"SquareSupersetEqual\": \"⊒\",\n\t\"SquareUnion\": \"⊔\",\n\t\"squarf\": \"▪\",\n\t\"squ\": \"□\",\n\t\"squf\": \"▪\",\n\t\"srarr\": \"→\",\n\t\"Sscr\": \"𝒮\",\n\t\"sscr\": \"𝓈\",\n\t\"ssetmn\": \"∖\",\n\t\"ssmile\": \"⌣\",\n\t\"sstarf\": \"⋆\",\n\t\"Star\": \"⋆\",\n\t\"star\": \"☆\",\n\t\"starf\": \"★\",\n\t\"straightepsilon\": \"ϵ\",\n\t\"straightphi\": \"ϕ\",\n\t\"strns\": \"¯\",\n\t\"sub\": \"⊂\",\n\t\"Sub\": \"⋐\",\n\t\"subdot\": \"⪽\",\n\t\"subE\": \"⫅\",\n\t\"sube\": \"⊆\",\n\t\"subedot\": \"⫃\",\n\t\"submult\": \"⫁\",\n\t\"subnE\": \"⫋\",\n\t\"subne\": \"⊊\",\n\t\"subplus\": \"⪿\",\n\t\"subrarr\": \"⥹\",\n\t\"subset\": \"⊂\",\n\t\"Subset\": \"⋐\",\n\t\"subseteq\": \"⊆\",\n\t\"subseteqq\": \"⫅\",\n\t\"SubsetEqual\": \"⊆\",\n\t\"subsetneq\": \"⊊\",\n\t\"subsetneqq\": \"⫋\",\n\t\"subsim\": \"⫇\",\n\t\"subsub\": \"⫕\",\n\t\"subsup\": \"⫓\",\n\t\"succapprox\": \"⪸\",\n\t\"succ\": \"≻\",\n\t\"succcurlyeq\": \"≽\",\n\t\"Succeeds\": \"≻\",\n\t\"SucceedsEqual\": \"⪰\",\n\t\"SucceedsSlantEqual\": \"≽\",\n\t\"SucceedsTilde\": \"≿\",\n\t\"succeq\": \"⪰\",\n\t\"succnapprox\": \"⪺\",\n\t\"succneqq\": \"⪶\",\n\t\"succnsim\": \"⋩\",\n\t\"succsim\": \"≿\",\n\t\"SuchThat\": \"∋\",\n\t\"sum\": \"∑\",\n\t\"Sum\": \"∑\",\n\t\"sung\": \"♪\",\n\t\"sup1\": \"¹\",\n\t\"sup2\": \"²\",\n\t\"sup3\": \"³\",\n\t\"sup\": \"⊃\",\n\t\"Sup\": \"⋑\",\n\t\"supdot\": \"⪾\",\n\t\"supdsub\": \"⫘\",\n\t\"supE\": \"⫆\",\n\t\"supe\": \"⊇\",\n\t\"supedot\": \"⫄\",\n\t\"Superset\": \"⊃\",\n\t\"SupersetEqual\": \"⊇\",\n\t\"suphsol\": \"⟉\",\n\t\"suphsub\": \"⫗\",\n\t\"suplarr\": \"⥻\",\n\t\"supmult\": \"⫂\",\n\t\"supnE\": \"⫌\",\n\t\"supne\": \"⊋\",\n\t\"supplus\": \"⫀\",\n\t\"supset\": \"⊃\",\n\t\"Supset\": \"⋑\",\n\t\"supseteq\": \"⊇\",\n\t\"supseteqq\": \"⫆\",\n\t\"supsetneq\": \"⊋\",\n\t\"supsetneqq\": \"⫌\",\n\t\"supsim\": \"⫈\",\n\t\"supsub\": \"⫔\",\n\t\"supsup\": \"⫖\",\n\t\"swarhk\": \"⤦\",\n\t\"swarr\": \"↙\",\n\t\"swArr\": \"⇙\",\n\t\"swarrow\": \"↙\",\n\t\"swnwar\": \"⤪\",\n\t\"szlig\": \"ß\",\n\t\"Tab\": \"\\t\",\n\t\"target\": \"⌖\",\n\t\"Tau\": \"Τ\",\n\t\"tau\": \"τ\",\n\t\"tbrk\": \"⎴\",\n\t\"Tcaron\": \"Ť\",\n\t\"tcaron\": \"ť\",\n\t\"Tcedil\": \"Ţ\",\n\t\"tcedil\": \"ţ\",\n\t\"Tcy\": \"Т\",\n\t\"tcy\": \"т\",\n\t\"tdot\": \"⃛\",\n\t\"telrec\": \"⌕\",\n\t\"Tfr\": \"𝔗\",\n\t\"tfr\": \"𝔱\",\n\t\"there4\": \"∴\",\n\t\"therefore\": \"∴\",\n\t\"Therefore\": \"∴\",\n\t\"Theta\": \"Θ\",\n\t\"theta\": \"θ\",\n\t\"thetasym\": \"ϑ\",\n\t\"thetav\": \"ϑ\",\n\t\"thickapprox\": \"≈\",\n\t\"thicksim\": \"∼\",\n\t\"ThickSpace\": \" \",\n\t\"ThinSpace\": \" \",\n\t\"thinsp\": \" \",\n\t\"thkap\": \"≈\",\n\t\"thksim\": \"∼\",\n\t\"THORN\": \"Þ\",\n\t\"thorn\": \"þ\",\n\t\"tilde\": \"˜\",\n\t\"Tilde\": \"∼\",\n\t\"TildeEqual\": \"≃\",\n\t\"TildeFullEqual\": \"≅\",\n\t\"TildeTilde\": \"≈\",\n\t\"timesbar\": \"⨱\",\n\t\"timesb\": \"⊠\",\n\t\"times\": \"×\",\n\t\"timesd\": \"⨰\",\n\t\"tint\": \"∭\",\n\t\"toea\": \"⤨\",\n\t\"topbot\": \"⌶\",\n\t\"topcir\": \"⫱\",\n\t\"top\": \"⊤\",\n\t\"Topf\": \"𝕋\",\n\t\"topf\": \"𝕥\",\n\t\"topfork\": \"⫚\",\n\t\"tosa\": \"⤩\",\n\t\"tprime\": \"‴\",\n\t\"trade\": \"™\",\n\t\"TRADE\": \"™\",\n\t\"triangle\": \"▵\",\n\t\"triangledown\": \"▿\",\n\t\"triangleleft\": \"◃\",\n\t\"trianglelefteq\": \"⊴\",\n\t\"triangleq\": \"≜\",\n\t\"triangleright\": \"▹\",\n\t\"trianglerighteq\": \"⊵\",\n\t\"tridot\": \"◬\",\n\t\"trie\": \"≜\",\n\t\"triminus\": \"⨺\",\n\t\"TripleDot\": \"⃛\",\n\t\"triplus\": \"⨹\",\n\t\"trisb\": \"⧍\",\n\t\"tritime\": \"⨻\",\n\t\"trpezium\": \"⏢\",\n\t\"Tscr\": \"𝒯\",\n\t\"tscr\": \"𝓉\",\n\t\"TScy\": \"Ц\",\n\t\"tscy\": \"ц\",\n\t\"TSHcy\": \"Ћ\",\n\t\"tshcy\": \"ћ\",\n\t\"Tstrok\": \"Ŧ\",\n\t\"tstrok\": \"ŧ\",\n\t\"twixt\": \"≬\",\n\t\"twoheadleftarrow\": \"↞\",\n\t\"twoheadrightarrow\": \"↠\",\n\t\"Uacute\": \"Ú\",\n\t\"uacute\": \"ú\",\n\t\"uarr\": \"↑\",\n\t\"Uarr\": \"↟\",\n\t\"uArr\": \"⇑\",\n\t\"Uarrocir\": \"⥉\",\n\t\"Ubrcy\": \"Ў\",\n\t\"ubrcy\": \"ў\",\n\t\"Ubreve\": \"Ŭ\",\n\t\"ubreve\": \"ŭ\",\n\t\"Ucirc\": \"Û\",\n\t\"ucirc\": \"û\",\n\t\"Ucy\": \"У\",\n\t\"ucy\": \"у\",\n\t\"udarr\": \"⇅\",\n\t\"Udblac\": \"Ű\",\n\t\"udblac\": \"ű\",\n\t\"udhar\": \"⥮\",\n\t\"ufisht\": \"⥾\",\n\t\"Ufr\": \"𝔘\",\n\t\"ufr\": \"𝔲\",\n\t\"Ugrave\": \"Ù\",\n\t\"ugrave\": \"ù\",\n\t\"uHar\": \"⥣\",\n\t\"uharl\": \"↿\",\n\t\"uharr\": \"↾\",\n\t\"uhblk\": \"▀\",\n\t\"ulcorn\": \"⌜\",\n\t\"ulcorner\": \"⌜\",\n\t\"ulcrop\": \"⌏\",\n\t\"ultri\": \"◸\",\n\t\"Umacr\": \"Ū\",\n\t\"umacr\": \"ū\",\n\t\"uml\": \"¨\",\n\t\"UnderBar\": \"_\",\n\t\"UnderBrace\": \"⏟\",\n\t\"UnderBracket\": \"⎵\",\n\t\"UnderParenthesis\": \"⏝\",\n\t\"Union\": \"⋃\",\n\t\"UnionPlus\": \"⊎\",\n\t\"Uogon\": \"Ų\",\n\t\"uogon\": \"ų\",\n\t\"Uopf\": \"𝕌\",\n\t\"uopf\": \"𝕦\",\n\t\"UpArrowBar\": \"⤒\",\n\t\"uparrow\": \"↑\",\n\t\"UpArrow\": \"↑\",\n\t\"Uparrow\": \"⇑\",\n\t\"UpArrowDownArrow\": \"⇅\",\n\t\"updownarrow\": \"↕\",\n\t\"UpDownArrow\": \"↕\",\n\t\"Updownarrow\": \"⇕\",\n\t\"UpEquilibrium\": \"⥮\",\n\t\"upharpoonleft\": \"↿\",\n\t\"upharpoonright\": \"↾\",\n\t\"uplus\": \"⊎\",\n\t\"UpperLeftArrow\": \"↖\",\n\t\"UpperRightArrow\": \"↗\",\n\t\"upsi\": \"υ\",\n\t\"Upsi\": \"ϒ\",\n\t\"upsih\": \"ϒ\",\n\t\"Upsilon\": \"Υ\",\n\t\"upsilon\": \"υ\",\n\t\"UpTeeArrow\": \"↥\",\n\t\"UpTee\": \"⊥\",\n\t\"upuparrows\": \"⇈\",\n\t\"urcorn\": \"⌝\",\n\t\"urcorner\": \"⌝\",\n\t\"urcrop\": \"⌎\",\n\t\"Uring\": \"Ů\",\n\t\"uring\": \"ů\",\n\t\"urtri\": \"◹\",\n\t\"Uscr\": \"𝒰\",\n\t\"uscr\": \"𝓊\",\n\t\"utdot\": \"⋰\",\n\t\"Utilde\": \"Ũ\",\n\t\"utilde\": \"ũ\",\n\t\"utri\": \"▵\",\n\t\"utrif\": \"▴\",\n\t\"uuarr\": \"⇈\",\n\t\"Uuml\": \"Ü\",\n\t\"uuml\": \"ü\",\n\t\"uwangle\": \"⦧\",\n\t\"vangrt\": \"⦜\",\n\t\"varepsilon\": \"ϵ\",\n\t\"varkappa\": \"ϰ\",\n\t\"varnothing\": \"∅\",\n\t\"varphi\": \"ϕ\",\n\t\"varpi\": \"ϖ\",\n\t\"varpropto\": \"∝\",\n\t\"varr\": \"↕\",\n\t\"vArr\": \"⇕\",\n\t\"varrho\": \"ϱ\",\n\t\"varsigma\": \"ς\",\n\t\"varsubsetneq\": \"⊊︀\",\n\t\"varsubsetneqq\": \"⫋︀\",\n\t\"varsupsetneq\": \"⊋︀\",\n\t\"varsupsetneqq\": \"⫌︀\",\n\t\"vartheta\": \"ϑ\",\n\t\"vartriangleleft\": \"⊲\",\n\t\"vartriangleright\": \"⊳\",\n\t\"vBar\": \"⫨\",\n\t\"Vbar\": \"⫫\",\n\t\"vBarv\": \"⫩\",\n\t\"Vcy\": \"В\",\n\t\"vcy\": \"в\",\n\t\"vdash\": \"⊢\",\n\t\"vDash\": \"⊨\",\n\t\"Vdash\": \"⊩\",\n\t\"VDash\": \"⊫\",\n\t\"Vdashl\": \"⫦\",\n\t\"veebar\": \"⊻\",\n\t\"vee\": \"∨\",\n\t\"Vee\": \"⋁\",\n\t\"veeeq\": \"≚\",\n\t\"vellip\": \"⋮\",\n\t\"verbar\": \"|\",\n\t\"Verbar\": \"‖\",\n\t\"vert\": \"|\",\n\t\"Vert\": \"‖\",\n\t\"VerticalBar\": \"∣\",\n\t\"VerticalLine\": \"|\",\n\t\"VerticalSeparator\": \"❘\",\n\t\"VerticalTilde\": \"≀\",\n\t\"VeryThinSpace\": \" \",\n\t\"Vfr\": \"𝔙\",\n\t\"vfr\": \"𝔳\",\n\t\"vltri\": \"⊲\",\n\t\"vnsub\": \"⊂⃒\",\n\t\"vnsup\": \"⊃⃒\",\n\t\"Vopf\": \"𝕍\",\n\t\"vopf\": \"𝕧\",\n\t\"vprop\": \"∝\",\n\t\"vrtri\": \"⊳\",\n\t\"Vscr\": \"𝒱\",\n\t\"vscr\": \"𝓋\",\n\t\"vsubnE\": \"⫋︀\",\n\t\"vsubne\": \"⊊︀\",\n\t\"vsupnE\": \"⫌︀\",\n\t\"vsupne\": \"⊋︀\",\n\t\"Vvdash\": \"⊪\",\n\t\"vzigzag\": \"⦚\",\n\t\"Wcirc\": \"Ŵ\",\n\t\"wcirc\": \"ŵ\",\n\t\"wedbar\": \"⩟\",\n\t\"wedge\": \"∧\",\n\t\"Wedge\": \"⋀\",\n\t\"wedgeq\": \"≙\",\n\t\"weierp\": \"℘\",\n\t\"Wfr\": \"𝔚\",\n\t\"wfr\": \"𝔴\",\n\t\"Wopf\": \"𝕎\",\n\t\"wopf\": \"𝕨\",\n\t\"wp\": \"℘\",\n\t\"wr\": \"≀\",\n\t\"wreath\": \"≀\",\n\t\"Wscr\": \"𝒲\",\n\t\"wscr\": \"𝓌\",\n\t\"xcap\": \"⋂\",\n\t\"xcirc\": \"◯\",\n\t\"xcup\": \"⋃\",\n\t\"xdtri\": \"▽\",\n\t\"Xfr\": \"𝔛\",\n\t\"xfr\": \"𝔵\",\n\t\"xharr\": \"⟷\",\n\t\"xhArr\": \"⟺\",\n\t\"Xi\": \"Ξ\",\n\t\"xi\": \"ξ\",\n\t\"xlarr\": \"⟵\",\n\t\"xlArr\": \"⟸\",\n\t\"xmap\": \"⟼\",\n\t\"xnis\": \"⋻\",\n\t\"xodot\": \"⨀\",\n\t\"Xopf\": \"𝕏\",\n\t\"xopf\": \"𝕩\",\n\t\"xoplus\": \"⨁\",\n\t\"xotime\": \"⨂\",\n\t\"xrarr\": \"⟶\",\n\t\"xrArr\": \"⟹\",\n\t\"Xscr\": \"𝒳\",\n\t\"xscr\": \"𝓍\",\n\t\"xsqcup\": \"⨆\",\n\t\"xuplus\": \"⨄\",\n\t\"xutri\": \"△\",\n\t\"xvee\": \"⋁\",\n\t\"xwedge\": \"⋀\",\n\t\"Yacute\": \"Ý\",\n\t\"yacute\": \"ý\",\n\t\"YAcy\": \"Я\",\n\t\"yacy\": \"я\",\n\t\"Ycirc\": \"Ŷ\",\n\t\"ycirc\": \"ŷ\",\n\t\"Ycy\": \"Ы\",\n\t\"ycy\": \"ы\",\n\t\"yen\": \"¥\",\n\t\"Yfr\": \"𝔜\",\n\t\"yfr\": \"𝔶\",\n\t\"YIcy\": \"Ї\",\n\t\"yicy\": \"ї\",\n\t\"Yopf\": \"𝕐\",\n\t\"yopf\": \"𝕪\",\n\t\"Yscr\": \"𝒴\",\n\t\"yscr\": \"𝓎\",\n\t\"YUcy\": \"Ю\",\n\t\"yucy\": \"ю\",\n\t\"yuml\": \"ÿ\",\n\t\"Yuml\": \"Ÿ\",\n\t\"Zacute\": \"Ź\",\n\t\"zacute\": \"ź\",\n\t\"Zcaron\": \"Ž\",\n\t\"zcaron\": \"ž\",\n\t\"Zcy\": \"З\",\n\t\"zcy\": \"з\",\n\t\"Zdot\": \"Ż\",\n\t\"zdot\": \"ż\",\n\t\"zeetrf\": \"ℨ\",\n\t\"ZeroWidthSpace\": \"\",\n\t\"Zeta\": \"Ζ\",\n\t\"zeta\": \"ζ\",\n\t\"zfr\": \"𝔷\",\n\t\"Zfr\": \"ℨ\",\n\t\"ZHcy\": \"Ж\",\n\t\"zhcy\": \"ж\",\n\t\"zigrarr\": \"⇝\",\n\t\"zopf\": \"𝕫\",\n\t\"Zopf\": \"ℤ\",\n\t\"Zscr\": \"𝒵\",\n\t\"zscr\": \"𝓏\",\n\t\"zwj\": \"\",\n\t\"zwnj\": \"\"\n};\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports) {\n\nmodule.exports = {\n\t\"amp\": \"&\",\n\t\"apos\": \"'\",\n\t\"gt\": \">\",\n\t\"lt\": \"<\",\n\t\"quot\": \"\\\"\"\n};\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(33)))\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports) {\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\nmodule.exports = bytesToUuid;\n\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\nvar rng;\n\nvar crypto = global.crypto || global.msCrypto; // for IE 11\nif (crypto && crypto.getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n rng = function whatwgRNG() {\n crypto.getRandomValues(rnds8);\n return rnds8;\n };\n}\n\nif (!rng) {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n rng = function() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n\nmodule.exports = rng;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n//@FIXME: This doesn't currently handle chooses/unions that rely on eachother.\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//--------------------------------------------------------------------\n// Javascript DSL for writing Eve programs\n//--------------------------------------------------------------------\nvar runtime_1 = __webpack_require__(4);\nvar Runtime = __webpack_require__(4);\nvar indexes = __webpack_require__(38);\nvar watcher_1 = __webpack_require__(1);\nvar Parser = __webpack_require__(19);\n__webpack_require__(20);\nvar stdlib_1 = __webpack_require__(20);\nvar uuid_1 = __webpack_require__(7);\nvar falafel = __webpack_require__(68);\nvar UNASSIGNED = -1;\nvar operators = {\n \"+\": \"math['+']\",\n \"-\": \"math['-']\",\n \"*\": \"math['*']\",\n \"/\": \"math['/']\",\n \">\": \"compare['>']\",\n \">=\": \"compare['>=']\",\n \"<\": \"compare['<']\",\n \"<=\": \"compare['<=']\",\n \"!=\": \"compare['!=']\",\n \"==\": \"compare['==']\",\n \"concat\": \"eve.internal.concat\",\n};\nfunction isArray(v) {\n return v && v.constructor === Array;\n}\nfunction isASTString(thing) {\n return thing.value && typeof thing.value === \"string\";\n}\nfunction macro(func, transform) {\n var code = func.toString();\n // trim the function(...) { from the start and capture the arg names\n var name = \"\";\n code = code.replace(/function\\s*(\\w*)\\s*/, function (str, funcName) {\n name = funcName;\n return \"\";\n });\n var functionArgs = [];\n code = code.replace(/\\((.*)\\)\\s*\\{/m, function (str, args) {\n functionArgs.push.apply(functionArgs, args.split(\",\").map(function (str) { return str.trim(); }));\n return \"\";\n });\n // trim the final } since we removed the function bit\n code = code.substring(0, code.length - 1);\n code = transform(code, functionArgs, name);\n var neueFunc = (new Function(\"\\n return function \" + name + \"(\" + functionArgs.join(\", \") + \") {\\n \" + code + \"\\n };\\n \"))();\n return neueFunc;\n}\nfunction isRawValue(v) {\n return (typeof v === \"string\" || typeof v === \"number\");\n}\nfunction isReference(v) {\n return (v instanceof Reference);\n}\nvar Reference = (function () {\n function Reference(__context, __owner) {\n this.__context = __context;\n this.__owner = __owner;\n this.__ID = Reference.ReferenceID++;\n this.__forceRegister = false;\n var proxied = this.__proxy();\n __context.register(proxied);\n this.__owner = __owner || null;\n return proxied;\n }\n Reference.create = function (context, value) {\n if (typeof value !== \"object\") {\n var neue = new Reference(context);\n if (value !== undefined)\n context.equality(neue, value);\n return neue;\n }\n return new Reference(context, value);\n };\n Reference.prototype.add = function (attrMapOrAttr, value) {\n if (!this.__owner) {\n this.__owner = new Record(this.__context, [], {}, this);\n }\n if (this.__owner instanceof Record) {\n // we only allow you to call add at the root context\n if (this.__context.parent)\n throw new Error(\"Add can't be called in a sub-block\");\n if (isRawValue(attrMapOrAttr) || isReference(attrMapOrAttr)) {\n var attribute = attrMapOrAttr;\n if (value === undefined)\n throw new Error(\"Can't call add without a value.\");\n this.__owner.add(this.__context, attribute, value);\n }\n else {\n for (var _i = 0, _a = Object.keys(attrMapOrAttr); _i < _a.length; _i++) {\n var attribute = _a[_i];\n var value_1 = attrMapOrAttr[attribute];\n this.__owner.add(this.__context, attribute, value_1);\n }\n }\n return this;\n }\n else {\n throw new Error(\"Can't call add on a non-record\");\n }\n };\n // @TODO: allow free A's and V's here\n Reference.prototype.remove = function (attribute, value) {\n if (!this.__owner) {\n this.__owner = new Record(this.__context, [], {}, this);\n }\n if (this.__owner instanceof Record) {\n // we only allow you to call remove at the root context\n if (this.__context.parent)\n throw new Error(\"Add can't be called in a sub-block\");\n this.__owner.remove(this.__context, attribute, value);\n return this;\n }\n else {\n throw new Error(\"Can't call add on a non-record\");\n }\n };\n Reference.prototype.toString = function () {\n return this.__context.ID + \".\" + this.__ID;\n };\n Reference.prototype.__proxy = function () {\n var _this = this;\n return new Proxy(this, {\n get: function (obj, prop) {\n if (obj[prop] !== undefined)\n return obj[prop];\n if (typeof prop === \"symbol\")\n return function () {\n return \"uh oh\";\n };\n var active = _this.__context.getActive();\n if (!active) {\n return;\n }\n if (!_this.__owner) {\n _this.__owner = new Record(active, [], {}, _this);\n }\n return _this.__owner.access(_this.__context, active, prop);\n },\n set: function (obj, prop, value) {\n if (obj[prop] !== undefined) {\n obj[prop] = value;\n return true;\n }\n throw new Error(\"Cannot set a value on a reference\");\n }\n });\n };\n Reference.ReferenceID = 0;\n return Reference;\n}());\nexports.Reference = Reference;\n//--------------------------------------------------------------------\n// ReferenceContext\n//--------------------------------------------------------------------\nvar ReferenceContext = (function () {\n function ReferenceContext(parent, flow) {\n this.parent = parent;\n this.references = [];\n this.equalities = [];\n this.forcedMoves = [];\n this.referenceValues = [];\n this.totalRegisters = 0;\n this.maxRegisters = 0;\n this.ID = ReferenceContext.IDs++;\n this.flow = flow || new LinearFlow(function (x) { return []; });\n }\n ReferenceContext.push = function (context) {\n ReferenceContext.stack.push(context);\n };\n ReferenceContext.pop = function () {\n ReferenceContext.stack.pop();\n };\n ReferenceContext.prototype.register = function (ref) {\n // if this reference is not owned by this context, we have to walk up the context\n // stack and register this for our parents until we find a layer that *does* own it\n // so that it can be considered an input to that context.\n var parent = this.parent;\n if (!this.owns(ref) && parent) {\n while (parent && parent !== ref.__context) {\n parent.register(ref);\n parent = parent.parent;\n }\n }\n if (!this.owns(ref) && parent !== ref.__context) {\n console.error(\"Reference with no owner in the parent stack: \", ref);\n throw new Error(\"Reference with no owner in the parent stack\");\n }\n if (!this.references[ref.__ID])\n this.references[ref.__ID] = ref;\n };\n ReferenceContext.prototype.equality = function (a, b) {\n if (a instanceof Reference) {\n this.register(a);\n }\n if (b instanceof Reference) {\n this.register(b);\n }\n this.equalities.push([a, b]);\n };\n ReferenceContext.prototype.getActive = function () {\n return ReferenceContext.stack[ReferenceContext.stack.length - 1];\n };\n ReferenceContext.prototype.owns = function (ref) {\n return ref.__context === this;\n };\n ReferenceContext.prototype.getValue = function (ref, orGenerateRegister) {\n if (isRawValue(ref))\n return ref;\n var val = this.referenceValues[ref.__ID];\n if (val === undefined) {\n if (!this.owns(ref) && this.parent)\n return this.parent.getValue(ref);\n if (orGenerateRegister) {\n val = new runtime_1.Register(UNASSIGNED);\n this.referenceValues[ref.__ID] = val;\n }\n }\n if (val === undefined)\n throw new Error(\"Unable to resolve reference: \" + ref.__ID);\n return val;\n };\n ReferenceContext.prototype.interned = function (ref) {\n var value = this.getValue(ref);\n if (isRawValue(value))\n return runtime_1.GlobalInterner.intern(value);\n return value;\n };\n ReferenceContext.prototype.maybeInterned = function (ref) {\n if (ref === undefined)\n return;\n var value = this.getValue(ref);\n if (isRawValue(value))\n return runtime_1.GlobalInterner.intern(value);\n return value;\n };\n ReferenceContext.prototype.selectReference = function (refIds, ref, ref2) {\n var refID = refIds[ref.__ID] || ref.__ID;\n var ref2ID = refIds[ref2.__ID] || ref2.__ID;\n if (!this.owns(ref) && !this.owns(ref2)) {\n if (ref2ID < refID)\n return ref2;\n return ref;\n }\n if (!this.owns(ref))\n return ref;\n if (!this.owns(ref2))\n return ref2;\n if (ref2ID < refID)\n return ref2;\n return ref;\n };\n ReferenceContext.prototype.unify = function () {\n var equalities = this.equalities;\n var values = this.referenceValues;\n var forcedMoves = [];\n var changed = equalities.length > 0;\n var refIds = {};\n var round = 0;\n var maxRound = Math.pow(this.equalities.length + 1, 2);\n for (var _i = 0, _a = this.references; _i < _a.length; _i++) {\n var ref = _a[_i];\n if (!ref)\n continue;\n this.getValue(ref, true);\n }\n while (changed && round < maxRound) {\n round++;\n changed = false;\n for (var _b = 0, equalities_1 = equalities; _b < equalities_1.length; _b++) {\n var _c = equalities_1[_b], a = _c[0], b = _c[1];\n var aValue = isReference(a) ? this.getValue(a, true) : a;\n var bValue = isReference(b) ? this.getValue(b, true) : b;\n var neueA = aValue;\n var neueB = bValue;\n if (a.__forceRegister || b.__forceRegister) {\n forcedMoves.push([a, b]);\n }\n else if (!runtime_1.isRegister(neueB) && !runtime_1.isRegister(neueA) && neueA != neueB) {\n throw new Error(\"Attempting to unify two disparate static values: `\" + neueA + \"` and `\" + neueB + \"`\");\n }\n else if (isReference(a) && !runtime_1.isRegister(neueB)) {\n neueA = bValue;\n }\n else if (isReference(b) && !runtime_1.isRegister(neueA)) {\n neueB = aValue;\n }\n else if (isReference(a) && isReference(b)) {\n if (this.selectReference(refIds, a, b) === b) {\n neueA = bValue;\n refIds[a.__ID] = refIds[b.__ID] || b.__ID;\n }\n else {\n neueB = aValue;\n refIds[b.__ID] = refIds[a.__ID] || a.__ID;\n }\n }\n else if (isReference(a)) {\n neueA = bValue;\n }\n else if (isReference(b)) {\n neueB = aValue;\n }\n else if (a !== b) {\n throw new Error(\"Attempting to unify two disparate static values: `\" + a + \"` and `\" + b + \"`\");\n }\n if (aValue !== neueA) {\n // console.log(\"Unifying A\", a.toString(), b.toString(), neueA, neueB);\n values[a.__ID] = neueA;\n changed = true;\n }\n if (bValue !== neueB) {\n // console.log(\"Unifying B\", a.toString(), b.toString(), neueA, neueB);\n values[b.__ID] = neueB;\n changed = true;\n }\n }\n }\n if (round >= maxRound) {\n throw new Error(\"Unable to unify variables. This is almost certainly an implementation error.\");\n }\n this.assignRegisters();\n this.forcedMoves = forcedMoves;\n };\n ReferenceContext.prototype.getMoves = function () {\n var moves = [];\n for (var _i = 0, _a = this.forcedMoves; _i < _a.length; _i++) {\n var _b = _a[_i], a = _b[0], b = _b[1];\n var to = isReference(a) ? a : b;\n var from = to === a ? b : a;\n moves.push(new Move(this, from, to));\n }\n for (var _c = 0, _d = this.references; _c < _d.length; _c++) {\n var ref = _d[_c];\n if (ref === undefined || this.owns(ref))\n continue;\n var local = this.getValue(ref);\n var parent_1 = ref.__context.getValue(ref);\n if (local !== parent_1) {\n moves.push(new Move(this, ref));\n }\n }\n return moves;\n };\n ReferenceContext.prototype.getInputReferences = function () {\n var refs = [];\n for (var _i = 0, _a = this.references; _i < _a.length; _i++) {\n var reference = _a[_i];\n if (!reference || this.owns(reference))\n continue;\n refs.push(reference);\n }\n return refs;\n };\n ReferenceContext.prototype.getInputRegisters = function () {\n var _this = this;\n return this.getInputReferences().map(function (v) { return _this.getValue(v); }).filter(runtime_1.isRegister);\n };\n ReferenceContext.prototype.updateMaxRegisters = function (maybeMax) {\n var parent = this;\n while (parent) {\n parent.maxRegisters = Math.max(parent.maxRegisters, maybeMax);\n parent = parent.parent;\n }\n };\n ReferenceContext.prototype.assignRegisters = function () {\n var startIx = this.parent ? this.parent.totalRegisters : 0;\n for (var _i = 0, _a = this.references; _i < _a.length; _i++) {\n var ref = _a[_i];\n if (ref === undefined)\n continue;\n var local = this.getValue(ref);\n if (runtime_1.isRegister(local)) {\n if (local.offset >= startIx)\n throw new Error(\"Trying to assign a register that already has a higher offset\");\n if (local.offset === UNASSIGNED) {\n local.offset = startIx++;\n }\n }\n }\n this.totalRegisters = startIx;\n this.updateMaxRegisters(startIx);\n };\n ReferenceContext.IDs = 0;\n ReferenceContext.stack = [];\n return ReferenceContext;\n}());\nexports.ReferenceContext = ReferenceContext;\nvar FlowLevel = (function () {\n function FlowLevel() {\n this.records = [];\n this.lookups = [];\n this.functions = [];\n this.aggregates = [];\n this.inserts = [];\n this.nots = [];\n this.chooses = [];\n this.unions = [];\n this.moves = [];\n }\n FlowLevel.prototype.collect = function (node) {\n if (node instanceof Insert) {\n this.inserts.push(node);\n }\n else if (node instanceof Record) {\n this.records.push(node);\n }\n else if (node instanceof Lookup) {\n this.lookups.push(node);\n }\n else if (node instanceof Fn) {\n this.functions.push(node);\n }\n else if (node instanceof Aggregate) {\n this.aggregates.push(node);\n }\n else if (node instanceof Not) {\n this.nots.push(node);\n }\n else if (node instanceof Choose) {\n this.chooses.push(node);\n }\n else if (node instanceof Union) {\n this.unions.push(node);\n }\n else if (node instanceof Move) {\n if (!this.moves.some(function (v) { return v.toKey() == node.toKey(); })) {\n this.moves.push(node);\n }\n }\n else {\n console.error(\"Don't know how to collect this type of node: \", node);\n throw new Error(\"Unknown node type sent to collect\");\n }\n };\n FlowLevel.prototype.findReference = function (node) {\n var ref = node.reference();\n var items;\n if (node instanceof Record) {\n items = this.records;\n }\n else {\n console.error(\"Don't know how to lookup a: \", node);\n throw new Error(\"Unknown node type sent to findReference\");\n }\n for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {\n var item = items_1[_i];\n if (item.reference() === ref)\n return item;\n }\n };\n FlowLevel.prototype.toConstraints = function (injections) {\n var items = [];\n runtime_1.concatArray(items, injections);\n runtime_1.concatArray(items, this.functions);\n runtime_1.concatArray(items, this.records);\n runtime_1.concatArray(items, this.lookups);\n runtime_1.concatArray(items, this.moves);\n return items;\n };\n FlowLevel.prototype.compile = function (nodes, injections, toPass) {\n var items = this.toConstraints(injections);\n var seen = {};\n var constraints = [];\n for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {\n var toCompile = items_2[_i];\n var compiled = toCompile.compile();\n for (var _a = 0, compiled_1 = compiled; _a < compiled_1.length; _a++) {\n var item = compiled_1[_a];\n if (!(item instanceof Runtime.Scan)) {\n constraints.push(item);\n }\n else {\n var key = item.toKey();\n if (!seen[key]) {\n seen[key] = true;\n constraints.push(item);\n }\n }\n }\n }\n var join;\n if (!nodes.length && constraints.length) {\n join = new Runtime.JoinNode(constraints);\n if (!this.records.length && !this.lookups.length && !this.moves.length) {\n join.isStatic = true;\n }\n }\n else if (constraints.length) {\n join = new Runtime.DownstreamJoinNode(constraints);\n }\n else if (nodes.length) {\n join = nodes.pop();\n }\n else {\n join = new Runtime.NoopJoinNode([]);\n }\n // @NOTE: We need to unify all of our sub-blocks along with ourselves\n // before the root node can allocate registers.\n for (var _b = 0, _c = this.nots; _b < _c.length; _b++) {\n var not = _c[_b];\n // All sub blocks take their parents' items and embed them into\n // the sub block. This is to make sure that the sub only computes the\n // results that might actually join with the parent instead of the possibly\n // very large set of unjoined results. This isn't guaranteed to be optimal\n // and may very well cause us to do more work than necessary. For example if\n // the results of the inner join with many outers, we'll still enumerate the\n // whole set. This *may* be necessary for getting the correct multiplicities\n // anyways, so this is what we're doing.\n var notNodes = not.compile(toPass.concat(items));\n // @TODO: once we have multiple nodes in a not (e.g. aggs, or recursive not/choose/union)\n // this won't be sufficient.\n var notJoinNode = notNodes[0];\n join = new Runtime.AntiJoin(join, notJoinNode, not.getInputRegisters());\n }\n for (var _d = 0, _e = this.chooses; _d < _e.length; _d++) {\n var choose = _e[_d];\n // For why we pass items down, see the comment about not\n join = choose.compile(join);\n }\n for (var _f = 0, _g = this.unions; _f < _g.length; _f++) {\n var union = _g[_f];\n // For why we pass items down, see the comment about not\n join = union.compile(join);\n }\n for (var _h = 0, _j = this.aggregates; _h < _j.length; _h++) {\n var aggregate = _j[_h];\n var aggregateNode = aggregate.compile();\n join = new Runtime.MergeAggregateFlow(join, aggregateNode, aggregate.getJoinRegisters(), aggregate.getOutputRegisters());\n }\n nodes.push(join);\n return nodes;\n };\n FlowLevel.prototype.split = function (context) {\n var maxLevel = 0;\n // if a register can be filled from the database, it doesn't need to be up-leveled,\n // since we always have a value for it from the beginning. Let's find all of those\n // registers so we can ignore them in our functions\n var databaseSupported = runtime_1.concatArray([], this.records);\n runtime_1.concatArray(databaseSupported, this.lookups);\n var supported = [];\n for (var _i = 0, _a = this.records; _i < _a.length; _i++) {\n var item = _a[_i];\n var registers = item.getRegisters();\n for (var _b = 0, registers_1 = registers; _b < registers_1.length; _b++) {\n var register = registers_1[_b];\n supported[register.offset] = true;\n }\n }\n // Every register that's an input to this level is supported by the outer context,\n // so we don't need to level its output.\n for (var _c = 0, _d = context.getInputRegisters(); _c < _d.length; _c++) {\n var register = _d[_c];\n supported[register.offset] = true;\n }\n // Any move whose `from` is supported, has their `to` supported as well\n for (var _e = 0, _f = this.moves; _e < _f.length; _e++) {\n var move = _f[_e];\n var from = move.getInputRegisters()[0];\n var to = move.getOutputRegisters()[0];\n if (from && supported[from.offset]) {\n supported[to.offset] = true;\n }\n }\n // choose, union, and aggregates can cause us to need multiple levels\n // if there's something that relies on an output from one of those, it\n // has to come in a level after that thing is computed.\n var changed = false;\n var leveledRegisters = {};\n var providerToLevel = {};\n var items = runtime_1.concatArray([], this.chooses);\n runtime_1.concatArray(items, this.unions);\n runtime_1.concatArray(items, this.aggregates);\n for (var _g = 0, items_3 = items; _g < items_3.length; _g++) {\n var item = items_3[_g];\n for (var _h = 0, _j = item.getOutputRegisters(); _h < _j.length; _h++) {\n var result = _j[_h];\n var offset = result.offset;\n if (!supported[offset]) {\n var found = leveledRegisters[offset];\n if (!found) {\n found = leveledRegisters[offset] = { level: 1, providers: [] };\n }\n leveledRegisters[offset].providers.push(item);\n providerToLevel[item.ID] = 0;\n changed = true;\n maxLevel = 1;\n }\n }\n }\n // go through all the functions, nots, chooses, and unions to see if they rely on\n // a register that has been leveled, if so, they need to move to a level after\n // the provider's heighest\n runtime_1.concatArray(items, this.functions);\n runtime_1.concatArray(items, this.nots);\n runtime_1.concatArray(items, this.moves);\n var remaining = items.length * items.length;\n while (changed && remaining > -1) {\n changed = false;\n for (var _k = 0, items_4 = items; _k < items_4.length; _k++) {\n var item = items_4[_k];\n remaining--;\n if (!item)\n continue;\n var changedProvider = false;\n var providerLevel = providerToLevel[item.ID] || 0;\n var regs = item.getInputRegisters();\n for (var _l = 0, regs_1 = regs; _l < regs_1.length; _l++) {\n var input = regs_1[_l];\n var inputInfo = leveledRegisters[input.offset];\n if (inputInfo && inputInfo.level > providerLevel) {\n changedProvider = true;\n providerLevel = inputInfo.level;\n }\n }\n if (changedProvider) {\n providerToLevel[item.ID] = providerLevel;\n // level my outputs\n if (item.getOutputRegisters) {\n for (var _m = 0, _o = item.getOutputRegisters(); _m < _o.length; _m++) {\n var output = _o[_m];\n if (supported[output.offset])\n continue;\n var outputInfo = leveledRegisters[output.offset];\n if (!outputInfo) {\n outputInfo = leveledRegisters[output.offset] = { level: 0, providers: [] };\n }\n if (outputInfo.providers.indexOf(item) === -1) {\n outputInfo.providers.push(item);\n }\n if (outputInfo.level <= providerLevel) {\n outputInfo.level = providerLevel + 1;\n }\n }\n }\n maxLevel = Math.max(maxLevel, providerLevel);\n changed = true;\n }\n }\n }\n if (remaining === -1) {\n // we couldn't stratify\n throw new Error(\"Unstratifiable program: cyclic dependency\");\n }\n // now we put all our children into a series of objects that\n // represent each level\n var levels = [];\n for (var ix = 0; ix <= maxLevel; ix++) {\n levels[ix] = new FlowLevel();\n }\n // @FIXME: An implementation issue in 0.3.0 causes stratified subblocks (nots, unions, and chooses) to\n // break in several edge cases. To prevent foot-shootiness until we've resolved the problem, we disallow\n // any orderings which are potentially dangerous.\n var dangerousOrdering = false;\n // all database scans are at the first level\n for (var _p = 0, _q = this.records; _p < _q.length; _p++) {\n var record = _q[_p];\n levels[0].records.push(record);\n }\n for (var _r = 0, _s = this.lookups; _r < _s.length; _r++) {\n var lookup = _s[_r];\n levels[0].lookups.push(lookup);\n }\n // functions/nots/chooses/unions can all be in different levels\n for (var _t = 0, _u = this.functions; _t < _u.length; _t++) {\n var func = _u[_t];\n if (!func)\n continue;\n var level = providerToLevel[func.ID] || 0;\n levels[level].functions.push(func);\n }\n for (var _v = 0, _w = this.nots; _v < _w.length; _v++) {\n var not = _w[_v];\n var level = providerToLevel[not.ID] || 0;\n if (level > 0)\n dangerousOrdering = true;\n levels[level].nots.push(not);\n }\n for (var _x = 0, _y = this.chooses; _x < _y.length; _x++) {\n var choose = _y[_x];\n var level = providerToLevel[choose.ID] || 0;\n if (level > 0)\n dangerousOrdering = true;\n levels[level].chooses.push(choose);\n }\n for (var _z = 0, _0 = this.unions; _z < _0.length; _z++) {\n var union = _0[_z];\n var level = providerToLevel[union.ID] || 0;\n if (level > 0)\n dangerousOrdering = true;\n levels[level].unions.push(union);\n }\n for (var _1 = 0, _2 = this.aggregates; _1 < _2.length; _1++) {\n var aggregate = _2[_1];\n var level = providerToLevel[aggregate.ID] || 0;\n levels[level].aggregates.push(aggregate);\n }\n for (var _3 = 0, _4 = this.moves; _3 < _4.length; _3++) {\n var move = _4[_3];\n var level = providerToLevel[move.ID] || 0;\n levels[level].moves.push(move);\n }\n if (dangerousOrdering)\n throw new Error(\"Refusing to compile potentially dangerous ordering with stratified subblock(s). This is avoids an implementation issue in the 0.3 runtime. Until it's lifted, you can work around it by splitting any subblocks (nots, unions, or chooses) that depend directly on other subblocks into separate blocks. Please contact the Eve team on the mailing list for further assistance.\");\n return levels;\n };\n return FlowLevel;\n}());\nexports.FlowLevel = FlowLevel;\nvar DSLBase = (function () {\n function DSLBase() {\n this.ID = DSLBase.CurrentID++;\n }\n DSLBase.CurrentID = 1;\n return DSLBase;\n}());\nexports.DSLBase = DSLBase;\nvar LinearFlow = (function (_super) {\n __extends(LinearFlow, _super);\n function LinearFlow(func, parent) {\n var _this = _super.call(this) || this;\n _this.collector = new FlowLevel();\n _this.levels = [];\n //------------------------------------------------------------------\n // End user API\n //------------------------------------------------------------------\n _this.find = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var tags = args;\n var attributes = tags.pop();\n if (typeof attributes === \"string\") {\n tags.push(attributes);\n attributes = undefined;\n }\n var active = _this.context.getActive();\n var record = new Record(active, tags, attributes);\n return record.reference();\n };\n _this.lookup = function (record) {\n var active = _this.context.getActive();\n var lookup = new Lookup(active, record);\n return lookup.output();\n };\n _this.record = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var tags = args;\n var attributes = tags.pop();\n if (typeof attributes === \"string\") {\n tags.push(attributes);\n attributes = undefined;\n }\n var active = _this.context.getActive();\n var insert = new Insert(active, tags, attributes);\n return insert.reference();\n };\n _this.not = function (func) {\n var active = _this.context.getActive();\n var not = new Not(func, active.flow.parent || _this);\n return;\n };\n _this.union = function () {\n var branches = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n branches[_i] = arguments[_i];\n }\n var active = _this.context.getActive();\n var union = new Union(active, branches, active.flow.parent || _this);\n return union.results.slice();\n };\n _this.choose = function () {\n var branches = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n branches[_i] = arguments[_i];\n }\n var active = _this.context.getActive();\n var choose = new Choose(active, branches, active.flow.parent || _this);\n return choose.results.slice();\n };\n _this.gather = function () {\n var projection = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n projection[_i] = arguments[_i];\n }\n var active = _this.context.getActive();\n return new AggregateBuilder(active, projection);\n };\n _this.transformCode = function (code, functionArgs) {\n if (!functionArgs[0])\n throw new Error(\"Trying to create a block that has no args with code:\\n\\n```\\n\" + code + \"\\n```\");\n var output = falafel(\"function f() { var $___eve_block$ = \" + functionArgs[0] + \"; \" + code + \" }\", function (node) {\n if (node.type === 'BinaryExpression') {\n var func = operators[node.operator];\n if (node.operator === \"+\" && (isASTString(node.left) || isASTString(node.right))) {\n func = operators[\"concat\"];\n }\n if (func) {\n node.update(\"$___eve_block$.lib.\" + func + \"(\" + node.left.source() + \", \" + node.right.source() + \")\");\n }\n }\n });\n var updated = output.toString();\n updated = updated.replace(\"function f() {\", \"\");\n updated = updated.substring(0, updated.length - 1);\n return updated;\n };\n var parentContext = parent ? parent.context : undefined;\n _this.parent = parent;\n _this.createLib();\n _this.context = new ReferenceContext(parentContext, _this);\n var transformed = func;\n if (!parent) {\n transformed = _this.transform(func);\n }\n ReferenceContext.push(_this.context);\n var results = transformed.call(func, _this);\n if (isArray(results))\n _this.results = results;\n else if (results === undefined)\n _this.results = [];\n else\n _this.results = [results];\n for (var _i = 0, _a = _this.results; _i < _a.length; _i++) {\n var result = _a[_i];\n if (isReference(result)) {\n _this.context.register(result);\n }\n }\n ReferenceContext.pop();\n return _this;\n }\n LinearFlow.prototype.createLib = function () {\n var _this = this;\n var lib = {};\n var registered = Runtime.FunctionConstraint.registered;\n var _loop_1 = function (name_1) {\n var parts = name_1.replace(/\\/\\//gi, \"/slash\").split(\"/\").map(function (v) { return v === \"slash\" ? \"/\" : v; });\n var final = parts.pop();\n var found = lib;\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n var next = found[part];\n if (!next)\n next = found[part] = {};\n found = next;\n }\n found[final] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var fn = new Fn(_this.context.getActive(), name_1, args);\n return fn.reference();\n };\n };\n for (var name_1 in registered) {\n _loop_1(name_1);\n }\n lib.compare[\"==\"] = function (a, b) {\n _this.context.getActive().equality(a, b);\n return b;\n };\n this.lib = lib;\n };\n //------------------------------------------------------------------\n // Collector interactions\n //------------------------------------------------------------------\n LinearFlow.prototype.collect = function (node) {\n this.collector.collect(node);\n };\n LinearFlow.prototype.findReference = function (node) {\n this.collector.findReference(node);\n };\n //------------------------------------------------------------------\n // Inputs/outputs\n //------------------------------------------------------------------\n LinearFlow.prototype.getInputRegisters = function () {\n return this.context.getInputRegisters();\n };\n //------------------------------------------------------------------\n // Compile\n //------------------------------------------------------------------\n LinearFlow.prototype.unify = function () {\n this.context.unify();\n };\n LinearFlow.prototype.compile = function (_) {\n if (_ === void 0) { _ = []; }\n var items = [];\n this.unify();\n var nodes = [];\n for (var _i = 0, _a = this.context.getMoves(); _i < _a.length; _i++) {\n var move = _a[_i];\n this.collect(move);\n }\n // Split our collector into levels\n var levels = this.collector.split(this.context);\n var localItems = items.slice();\n for (var _b = 0, levels_1 = levels; _b < levels_1.length; _b++) {\n var level = levels_1[_b];\n nodes = level.compile(nodes, items, localItems);\n runtime_1.concatArray(localItems, level.toConstraints([]));\n }\n // all the inputs end up at the end\n var outputs = [];\n for (var _c = 0, _d = this.collector.inserts; _c < _d.length; _c++) {\n var record = _d[_c];\n var compiled = record.compile();\n for (var _e = 0, compiled_2 = compiled; _e < compiled_2.length; _e++) {\n var node = compiled_2[_e];\n if (node instanceof Runtime.WatchNode) {\n nodes.push(node);\n }\n else {\n outputs.push(node); // @FIXME: types\n }\n }\n }\n if (outputs.length) {\n nodes.push(new Runtime.OutputWrapperNode(outputs));\n }\n this.levels = levels;\n return nodes;\n };\n //------------------------------------------------------------------\n // Function transformation\n //------------------------------------------------------------------\n LinearFlow.prototype.transform = function (func) {\n return macro(func, this.transformCode);\n };\n return LinearFlow;\n}(DSLBase));\nexports.LinearFlow = LinearFlow;\n//--------------------------------------------------------------------\n// WatchFlow\n//--------------------------------------------------------------------\nvar WatchFlow = (function (_super) {\n __extends(WatchFlow, _super);\n function WatchFlow() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WatchFlow.prototype.collect = function (node) {\n if (!(node instanceof Watch) && node instanceof Insert) {\n node = node.toWatch();\n return;\n }\n _super.prototype.collect.call(this, node);\n };\n return WatchFlow;\n}(LinearFlow));\nexports.WatchFlow = WatchFlow;\n//--------------------------------------------------------------------\n// CommitFlow\n//--------------------------------------------------------------------\nvar CommitFlow = (function (_super) {\n __extends(CommitFlow, _super);\n function CommitFlow() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CommitFlow.prototype.collect = function (node) {\n if (!(node instanceof CommitInsert) && !(node instanceof CommitRemove) && node instanceof Insert) {\n node = node.toCommit();\n return;\n }\n _super.prototype.collect.call(this, node);\n };\n return CommitFlow;\n}(LinearFlow));\nexports.CommitFlow = CommitFlow;\n//--------------------------------------------------------------------\n// DSL runtime types\n//--------------------------------------------------------------------\n//--------------------------------------------------------------------\n// Record\n//--------------------------------------------------------------------\nvar Record = (function (_super) {\n __extends(Record, _super);\n function Record(context, tags, attributes, record) {\n if (tags === void 0) { tags = []; }\n if (attributes === void 0) { attributes = {}; }\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.record = record;\n if (!record) {\n _this.record = _this.createReference();\n }\n else {\n context.register(record);\n }\n var attrs = [];\n for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) {\n var tag = tags_1[_i];\n attrs.push(\"tag\", tag);\n }\n var keys = Object.keys(attributes).sort();\n for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) {\n var attr = keys_1[_a];\n var value = attributes[attr];\n if (isArray(value)) {\n for (var _b = 0, value_2 = value; _b < value_2.length; _b++) {\n var current = value_2[_b];\n if (isReference(current))\n context.register(current);\n attrs.push(attr, current);\n }\n }\n else {\n if (isReference(value))\n context.register(value);\n attrs.push(attr, value);\n }\n }\n _this.attributes = attrs;\n context.flow.collect(_this);\n return _this;\n }\n Record.prototype.createReference = function () {\n return Reference.create(this.context, this);\n };\n Record.prototype.createSub = function (context, record) {\n return new Record(context, undefined, undefined, record);\n };\n Record.prototype.reference = function () {\n return this.record;\n };\n Record.prototype.add = function (context, attribute, value) {\n var insert = new Insert(context, [], {}, this.reference());\n if (!isArray(value)) {\n insert.add(context, attribute, value);\n }\n else {\n for (var _i = 0, value_3 = value; _i < value_3.length; _i++) {\n var v = value_3[_i];\n insert.add(context, attribute, v);\n }\n }\n };\n Record.prototype.remove = function (context, attribute, value) {\n var insert = new Insert(context, [], {}, this.reference());\n if (!isArray(value)) {\n insert.remove(context, attribute, value);\n }\n else {\n for (var _i = 0, value_4 = value; _i < value_4.length; _i++) {\n var v = value_4[_i];\n insert.remove(context, attribute, v);\n }\n }\n };\n Record.prototype.copyToContext = function (activeContext) {\n var found = activeContext.flow.findReference(this);\n if (found)\n return found;\n var neue = this.createSub(activeContext, this.record);\n activeContext.register(this.record);\n return neue;\n };\n Record.prototype.findAttribute = function (name) {\n var attributes = this.attributes;\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var attrName = attributes[ix];\n var value = attributes[ix + 1];\n if (attrName === name && isReference(value))\n return value;\n }\n };\n Record.prototype.access = function (refContext, activeContext, prop) {\n var record = this;\n if (refContext !== activeContext) {\n record = this.copyToContext(activeContext);\n }\n var found = record.findAttribute(prop);\n if (found)\n return found;\n // we need to add this attribute to us and return that\n var attrRecord = this.createSub(activeContext);\n var attrRef = attrRecord.reference();\n record.attributes.push(prop, attrRef);\n return attrRef;\n };\n Record.prototype.getRegisters = function () {\n var _this = this;\n var values = [this.record];\n var attributes = this.attributes;\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n values.push(a, v);\n }\n return values.map(function (v) { return _this.context.getValue(v); }).filter(runtime_1.isRegister);\n };\n Record.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var constraints = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n constraints.push(new Runtime.Scan(e, context.interned(a), context.interned(v), Runtime.IGNORE_REG));\n }\n return constraints;\n };\n return Record;\n}(DSLBase));\nexports.Record = Record;\n//--------------------------------------------------------------------\n// Lookup\n//--------------------------------------------------------------------\nvar Lookup = (function (_super) {\n __extends(Lookup, _super);\n function Lookup(context, record) {\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.record = record;\n if (isReference(record)) {\n context.register(record);\n }\n var attribute = new Record(context);\n var value = new Record(context);\n _this.attribute = attribute.reference();\n _this.value = value.reference();\n context.flow.collect(_this);\n return _this;\n }\n Lookup.prototype.reference = function () {\n return this.record;\n };\n Lookup.prototype.output = function () {\n return { attribute: this.attribute, value: this.value };\n };\n Lookup.prototype.compile = function () {\n var scans = [];\n var context = this.context;\n scans.push(new Runtime.Scan(context.interned(this.record), context.interned(this.attribute), context.interned(this.value), Runtime.IGNORE_REG));\n return scans;\n };\n return Lookup;\n}(DSLBase));\nexports.Lookup = Lookup;\n//--------------------------------------------------------------------\n// Move\n//--------------------------------------------------------------------\nvar Move = (function (_super) {\n __extends(Move, _super);\n function Move(context, from, to) {\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.from = from;\n if (isReference(from)) {\n context.register(from);\n }\n if (!to) {\n if (!isReference(from))\n throw new Error(\"Move where the to is not a reference\");\n _this.to = from;\n }\n else {\n _this.to = to;\n }\n return _this;\n }\n Move.prototype.toKey = function () {\n var from = isReference(this.from) ? \"[\" + this.from.__ID + \"]\" : this.from;\n var to = isReference(this.to) ? \"[\" + this.to.__ID + \"]\" : this.to;\n return from + \"|\" + to;\n };\n Move.prototype.getInputRegisters = function () {\n var value = this.context.getValue(this.from);\n if (runtime_1.isRegister(value)) {\n return [value];\n }\n return [];\n };\n Move.prototype.getOutputRegisters = function () {\n var to = this.to;\n var parent = to.__context.getValue(to);\n return [parent];\n };\n Move.prototype.compile = function () {\n var _a = this, from = _a.from, to = _a.to;\n var local = this.context.interned(from);\n var parent = to.__context.getValue(to);\n return [new Runtime.MoveConstraint(local, parent)];\n };\n return Move;\n}(DSLBase));\nexports.Move = Move;\n//--------------------------------------------------------------------\n// Insert\n//--------------------------------------------------------------------\nvar Insert = (function (_super) {\n __extends(Insert, _super);\n function Insert(context, tags, attributes, record) {\n if (tags === void 0) { tags = []; }\n if (attributes === void 0) { attributes = {}; }\n var _this = _super.call(this, context, tags, attributes, record) || this;\n _this.context = context;\n if (!record) {\n // we have to make our ID generation function\n var args = [];\n for (var ix = 0, len = _this.attributes.length; ix < len; ix += 2) {\n var a = _this.attributes[ix];\n var v = _this.attributes[ix + 1];\n args.push(a, v);\n }\n var genId = new Fn(context, \"eve/internal/gen-id\", args, _this.reference());\n }\n return _this;\n }\n Insert.prototype.createReference = function () {\n // @TODO: create an InsertReference type and return that here\n return Reference.create(this.context, this);\n };\n Insert.prototype.createSub = function (context, record) {\n return new Insert(context, undefined, undefined, record);\n };\n Insert.prototype.add = function (context, attribute, value) {\n if (!isArray(value)) {\n this.attributes.push(attribute, value);\n }\n else {\n for (var _i = 0, value_5 = value; _i < value_5.length; _i++) {\n var v = value_5[_i];\n this.attributes.push(attribute, v);\n }\n }\n return this.reference();\n };\n Insert.prototype.remove = function (context, attribute, value) {\n var remove = new Remove(context, [], {}, this.record);\n if (!isArray(value)) {\n remove.attributes.push(attribute, value);\n }\n else {\n for (var _i = 0, value_6 = value; _i < value_6.length; _i++) {\n var v = value_6[_i];\n remove.attributes.push(attribute, v);\n }\n }\n return this.reference();\n };\n Insert.prototype.toWatch = function () {\n var watch = new Watch(this.context, [], {}, this.record);\n watch.attributes = this.attributes;\n return watch;\n };\n Insert.prototype.toCommit = function () {\n var commit = new CommitInsert(this.context, [], {}, this.record);\n commit.attributes = this.attributes;\n return commit;\n };\n Insert.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var nodes = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n var n = uuid_1.v4();\n nodes.push(new Runtime.InsertNode(e, context.interned(a), context.interned(v), context.interned(n)));\n }\n return nodes;\n };\n return Insert;\n}(Record));\nexports.Insert = Insert;\n//--------------------------------------------------------------------\n// Remove\n//--------------------------------------------------------------------\nvar Remove = (function (_super) {\n __extends(Remove, _super);\n function Remove() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Remove.prototype.toCommit = function () {\n var commit = new CommitRemove(this.context, [], {}, this.record);\n commit.attributes = this.attributes;\n return commit;\n };\n Remove.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var nodes = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n var n = uuid_1.v4();\n var internedV = context.maybeInterned(v); // @FIXME\n internedV = internedV !== undefined ? internedV : Runtime.IGNORE_REG;\n var internedA = context.maybeInterned(a); // @FIXME\n internedA = internedA !== undefined ? internedA : Runtime.IGNORE_REG;\n nodes.push(new Runtime.RemoveNode(e, internedA, internedV, context.interned(n)));\n }\n return nodes;\n };\n return Remove;\n}(Insert));\nexports.Remove = Remove;\n//--------------------------------------------------------------------\n// Watch\n//--------------------------------------------------------------------\nvar Watch = (function (_super) {\n __extends(Watch, _super);\n function Watch() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Watch.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var nodes = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n var n = uuid_1.v4();\n nodes.push(new Runtime.WatchNode(e, context.interned(a), context.interned(v), context.interned(n), context.flow.ID));\n }\n return nodes;\n };\n return Watch;\n}(Insert));\nexports.Watch = Watch;\n//--------------------------------------------------------------------\n// CommitInsert\n//--------------------------------------------------------------------\nvar CommitInsert = (function (_super) {\n __extends(CommitInsert, _super);\n function CommitInsert() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CommitInsert.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var nodes = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n var n = uuid_1.v4();\n nodes.push(new Runtime.CommitInsertNode(e, context.interned(a), context.interned(v), context.interned(n)));\n }\n return nodes;\n };\n return CommitInsert;\n}(Insert));\nexports.CommitInsert = CommitInsert;\n//--------------------------------------------------------------------\n// CommitRemove\n//--------------------------------------------------------------------\nvar CommitRemove = (function (_super) {\n __extends(CommitRemove, _super);\n function CommitRemove() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CommitRemove.prototype.compile = function () {\n var _a = this, attributes = _a.attributes, context = _a.context;\n var nodes = [];\n var e = context.interned(this.record);\n for (var ix = 0, len = attributes.length; ix < len; ix += 2) {\n var a = attributes[ix];\n var v = attributes[ix + 1];\n // @TODO: get a real node id\n var n = uuid_1.v4();\n var internedV = context.maybeInterned(v); // @FIXME\n internedV = internedV !== undefined ? internedV : Runtime.IGNORE_REG;\n var internedA = context.maybeInterned(a); // @FIXME\n internedA = internedA !== undefined ? internedA : Runtime.IGNORE_REG;\n nodes.push(new Runtime.CommitRemoveNode(e, internedA, internedV, context.interned(n)));\n }\n return nodes;\n };\n return CommitRemove;\n}(Remove));\nexports.CommitRemove = CommitRemove;\n//--------------------------------------------------------------------\n// Fn\n//--------------------------------------------------------------------\nvar Fn = (function (_super) {\n __extends(Fn, _super);\n function Fn(context, name, args, output) {\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.name = name;\n _this.args = args;\n var filter = Runtime.FunctionConstraint.fetchInfo(name).filter;\n if (output) {\n _this.output = output;\n }\n else if (filter) {\n _this.output = args[args.length - 1];\n }\n else {\n _this.output = Reference.create(context, _this);\n }\n for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {\n var arg = args_1[_i];\n if (isReference(arg)) {\n context.register(arg);\n }\n }\n context.flow.collect(_this);\n return _this;\n }\n Fn.prototype.reference = function () {\n return this.output;\n };\n Fn.prototype.access = function (refContext, activeContext, prop) {\n throw new Error(\"Implement me!\");\n };\n Fn.prototype.getInputRegisters = function () {\n var context = this.context;\n return this.args.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n };\n Fn.prototype.getOutputRegisters = function () {\n var registers = [];\n var value = this.context.getValue(this.output);\n if (runtime_1.isRegister(value)) {\n registers.push(value);\n }\n return registers;\n };\n Fn.prototype.compile = function () {\n var constraints = [];\n var _a = this, context = _a.context, name = _a.name;\n var values = this.args.map(function (v) { return context.interned(v); });\n var _b = Runtime.FunctionConstraint.fetchInfo(name), variadic = _b.variadic, filter = _b.filter;\n var returns = {};\n if (!filter) {\n returns.result = context.interned(this.output);\n }\n var constraint;\n if (variadic) {\n constraint = Runtime.FunctionConstraint.create(name, returns, values);\n }\n else {\n constraint = Runtime.FunctionConstraint.create(name, returns, []);\n var ix = 0;\n for (var _i = 0, _c = constraint.argNames; _i < _c.length; _i++) {\n var arg = _c[_i];\n constraint.fields[arg] = values[ix];\n ix++;\n }\n }\n constraints.push(constraint);\n return constraints;\n };\n return Fn;\n}(DSLBase));\nexports.Fn = Fn;\n//--------------------------------------------------------------------\n// Aggregate\n//--------------------------------------------------------------------\nvar Aggregate = (function (_super) {\n __extends(Aggregate, _super);\n function Aggregate(context, aggregate, projection, group, args, output) {\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.aggregate = aggregate;\n _this.projection = projection;\n _this.group = group;\n _this.args = args;\n if (output) {\n _this.output = output;\n }\n else {\n _this.output = Reference.create(context, _this);\n }\n _this.output.__forceRegister = true;\n // add all of our args to our projection\n for (var _i = 0, args_2 = args; _i < args_2.length; _i++) {\n var arg = args_2[_i];\n if (isReference(arg)) {\n projection.push(arg);\n }\n }\n context.flow.collect(_this);\n return _this;\n }\n Aggregate.prototype.getJoinRegisters = function () {\n var context = this.context;\n var items = []; //concatArray([], this.args);\n if (this.aggregate === Runtime.SortNode) {\n runtime_1.concatArray(items, this.projection);\n }\n runtime_1.concatArray(items, this.group);\n return items.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n };\n Aggregate.prototype.getInputRegisters = function () {\n var context = this.context;\n var items = runtime_1.concatArray([], this.args);\n runtime_1.concatArray(items, this.projection);\n runtime_1.concatArray(items, this.group);\n return items.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n };\n Aggregate.prototype.getOutputRegisters = function () {\n // @TODO: should this blow up if it doesn't resolve to a register?\n var value = this.context.getValue(this.output);\n return [value];\n };\n Aggregate.prototype.compile = function () {\n var context = this.context;\n var groupRegisters = this.group.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n var projectRegisters = this.projection.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n var inputs = this.args.map(function (v) { return context.interned(v); });\n var agg = new this.aggregate(groupRegisters, projectRegisters, inputs, this.getOutputRegisters());\n return agg;\n };\n Aggregate.prototype.reference = function () {\n return this.output;\n };\n Aggregate.prototype.per = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var _a = 0, args_3 = args; _a < args_3.length; _a++) {\n var arg = args_3[_a];\n this.group.push(arg);\n }\n };\n return Aggregate;\n}(DSLBase));\nexports.Aggregate = Aggregate;\nvar AggregateBuilder = (function () {\n function AggregateBuilder(context, projection) {\n this.context = context;\n this.projection = projection;\n this.group = [];\n }\n AggregateBuilder.prototype.per = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var _a = 0, args_4 = args; _a < args_4.length; _a++) {\n var arg = args_4[_a];\n this.group.push(arg);\n }\n return this;\n };\n AggregateBuilder.prototype.checkBlock = function () {\n var active = this.context.getActive();\n if (active !== this.context)\n throw new Error(\"Cannot gather in one scope and aggregate in another\");\n };\n AggregateBuilder.prototype.sum = function (value) {\n this.checkBlock();\n var agg = new Aggregate(this.context, stdlib_1.SumAggregate, this.projection, this.group, [value]);\n return agg.reference();\n };\n AggregateBuilder.prototype.count = function () {\n this.checkBlock();\n var agg = new Aggregate(this.context, stdlib_1.SumAggregate, this.projection, this.group, [1]);\n return agg.reference();\n };\n AggregateBuilder.prototype.sort = function () {\n var directions = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n directions[_i] = arguments[_i];\n }\n this.checkBlock();\n var agg = new Aggregate(this.context, Runtime.SortNode, this.projection, this.group, directions);\n return agg.reference();\n };\n return AggregateBuilder;\n}());\nexports.AggregateBuilder = AggregateBuilder;\n//--------------------------------------------------------------------\n// Not\n//--------------------------------------------------------------------\nvar Not = (function (_super) {\n __extends(Not, _super);\n function Not(func, parent) {\n var _this = _super.call(this, func, parent) || this;\n parent.collect(_this);\n return _this;\n }\n return Not;\n}(LinearFlow));\nexports.Not = Not;\n//--------------------------------------------------------------------\n// Union\n//--------------------------------------------------------------------\nvar Union = (function (_super) {\n __extends(Union, _super);\n function Union(context, branchFunctions, parent, existingResults) {\n var _this = _super.call(this) || this;\n _this.context = context;\n _this.branches = [];\n _this.results = [];\n _this.inputs = [];\n _this.branchInputs = [];\n var _a = _this, branches = _a.branches, results = _a.results;\n var resultCount;\n if (existingResults) {\n resultCount = existingResults.length;\n _this.results = existingResults.slice();\n results = _this.results;\n for (var _i = 0, results_1 = results; _i < results_1.length; _i++) {\n var result = results_1[_i];\n if (isReference(result)) {\n result.__forceRegister = true;\n }\n else {\n throw new Error(\"Non-reference choose/union result\");\n }\n }\n }\n var ix = 0;\n for (var _b = 0, branchFunctions_1 = branchFunctions; _b < branchFunctions_1.length; _b++) {\n var branch = branchFunctions_1[_b];\n var flow = new LinearFlow(branch, parent);\n var branchResultCount = _this.resultCount(flow.results);\n if (resultCount === undefined) {\n resultCount = branchResultCount;\n for (var resultIx_1 = 0; resultIx_1 < resultCount; resultIx_1++) {\n var ref = Reference.create(context);\n ref.__forceRegister = true;\n results.push(ref);\n }\n }\n else if (resultCount !== branchResultCount) {\n throw new Error(\"Choose branch \" + ix + \" doesn't have the right number of returns. I expected \" + resultCount + \", but got \" + branchResultCount);\n }\n _this.setBranchInputs(ix, flow.context.getInputReferences());\n var resultIx = 0;\n for (var _c = 0, results_2 = results; _c < results_2.length; _c++) {\n var result = results_2[_c];\n flow.collect(new Move(flow.context, flow.results[resultIx], result));\n resultIx++;\n }\n branches.push(flow);\n ix++;\n }\n context.flow.collect(_this);\n return _this;\n }\n Union.prototype.setBranchInputs = function (branchIx, inputs) {\n var branchInputs = this.branchInputs[branchIx] = [];\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var ref = inputs_1[_i];\n if (this.inputs.indexOf(ref) === -1) {\n this.inputs.push(ref);\n }\n branchInputs.push(ref);\n }\n };\n Union.prototype.getInputRegisters = function () {\n var context = this.context;\n var inputs = this.inputs.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n return inputs;\n };\n Union.prototype.getOutputRegisters = function () {\n var context = this.context;\n return this.results.map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n };\n Union.prototype.resultCount = function (result) {\n if (result && result.constructor === Array) {\n return result.length;\n }\n else if (result) {\n return 1;\n }\n return 0;\n };\n Union.prototype.build = function (left, nodes, inputs, outputs, extraOuterJoins) {\n return new Runtime.UnionFlow(left, nodes, inputs, outputs, extraOuterJoins);\n };\n Union.prototype.compile = function (join) {\n var _a = this, context = _a.context, branchInputs = _a.branchInputs;\n var nodes = [];\n var inputs = [];\n var outputs = this.getOutputRegisters();\n var ix = 0;\n var _loop_2 = function (flow) {\n if (flow.collector.chooses.length > 0 || flow.collector.unions.length > 0) {\n throw new Error(\"Nested chooses and unions are not currently supported\");\n }\n var compiled = flow.compile();\n // @NOTE: Not sure why TS isn't correctly pegging this as filtered to only Registers already.\n var flowInputs = branchInputs[ix].map(function (v) { return context.getValue(v); }).filter(runtime_1.isRegister);\n if (compiled.length > 1) {\n // if this branch has an aggregate in it, we need to do some surgery to make sure that\n // the JoinNode gets wrapped in an AggregateOuterLookup. For the motivation see the\n // comment about the definition for AggregateOuterLookup.\n if (flow.collector.aggregates.length > 0) {\n var aggMerge_1 = compiled[0];\n // we have to make sure that the outer lookup fields are actually used in the join node for\n // the aggregate merge otherwise they will never join. For example if you have:\n //\n // board = [#board size: N, not(winner)]\n // winner = if N = gather/count[for: cell, per: col]\n // cell = [#bar board col player]\n // then player\n //\n // N is both the input to the branch as well as the output of the aggregate, but it won't\n // be available when doing the join *before* the aggregate. If it's included in the outer\n // lookup we'll join the board size with undefined every time and always fail.\n var outerLookupInputs = flowInputs.filter(function (v) {\n var next = aggMerge_1.left;\n if (next instanceof Runtime.JoinNode) {\n return next.registerLookup[v.offset];\n }\n else {\n throw new Error(\"Don't know how to handle multi-node aggregates that don't start with a join\");\n }\n });\n aggMerge_1.left = new Runtime.AggregateOuterLookup(join, aggMerge_1.left, outerLookupInputs);\n }\n nodes.push(new Runtime.LinearFlow(compiled));\n }\n else {\n nodes.push(compiled[0]);\n }\n inputs.push(flowInputs);\n ix++;\n };\n for (var _i = 0, _b = this.branches; _i < _b.length; _i++) {\n var flow = _b[_i];\n _loop_2(flow);\n }\n var extraJoins = [];\n for (var _c = 0, _d = this.results; _c < _d.length; _c++) {\n var result = _d[_c];\n if (result.__owner && result.__owner instanceof Record && result.__owner.attributes.length) {\n var maybeReg = context.getValue(result);\n if (runtime_1.isRegister(maybeReg)) {\n extraJoins.push(maybeReg);\n }\n }\n }\n return this.build(join, nodes, inputs, this.getOutputRegisters(), extraJoins);\n };\n return Union;\n}(DSLBase));\nexports.Union = Union;\n//--------------------------------------------------------------------\n// Choose\n//--------------------------------------------------------------------\nvar Choose = (function (_super) {\n __extends(Choose, _super);\n function Choose() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Choose.prototype.build = function (left, nodes, inputs, outputs, extraOuterJoins) {\n return new Runtime.ChooseFlow(left, nodes, inputs, outputs, extraOuterJoins);\n };\n return Choose;\n}(Union));\nexports.Choose = Choose;\nvar Program = (function () {\n function Program(name) {\n this.name = name;\n this.blocks = [];\n this.flows = [];\n this.nodeCount = 0;\n this.nextTransactionId = 0;\n this.exporter = new watcher_1.Exporter();\n this.watchers = {};\n this.index = new indexes.HashIndex();\n this.context = new Runtime.EvaluationContext(this.index);\n }\n Program.prototype.constants = function (obj) {\n if (!this._constants)\n this._constants = {};\n for (var constant in obj) {\n if (this._constants[constant] && this._constants[constant] !== obj[constant]) {\n // throw new Error(\"Unable to rebind existing constant\");\n }\n this._constants[constant] = obj[constant];\n }\n return this;\n };\n Program.prototype.injectConstants = function (func) {\n var _this = this;\n if (!this._constants)\n return func;\n return macro(func, function (code) {\n var constants = _this._constants;\n for (var constant in constants) {\n code = code.replace(new RegExp(\"{{\" + constant + \"}}\", \"gm\"), \"\" + constants[constant]);\n }\n return code;\n });\n };\n Program.prototype.clear = function () {\n this.index = new indexes.HashIndex();\n this.context = new Runtime.EvaluationContext(this.index);\n };\n Program.prototype._bind = function (name, flow) {\n var nodes = flow.compile();\n var block = new Runtime.Block(name, nodes, flow.context.maxRegisters);\n this.flows.push(flow);\n this.blocks.push(block);\n return block;\n };\n Program.prototype.bind = function (name, func) {\n var flow = new LinearFlow(this.injectConstants(func));\n this._bind(name, flow);\n return this;\n };\n Program.prototype.blockChangeTransaction = function (added, removed) {\n for (var _i = 0, removed_1 = removed; _i < removed_1.length; _i++) {\n var remove = removed_1[_i];\n var ix = this.blocks.indexOf(remove);\n this.blocks.splice(ix, 1);\n }\n // console.time(\"input\");\n var trans = new Runtime.BlockChangeTransaction(this.context, this.nextTransactionId++, added, removed, this.blocks, this.lastWatch ? this.exporter.handle : undefined);\n trans.exec(this.context);\n // console.timeEnd(\"input\");\n // console.info(trans.changes.map((change, ix) => ` <- ${change}`).join(\"\\n\"));\n return trans;\n };\n Program.prototype.input = function (changes) {\n // console.time(\"input\");\n if (changes[0].transaction >= this.nextTransactionId)\n this.nextTransactionId = changes[0].transaction + 1;\n var trans = new Runtime.Transaction(this.context, changes[0].transaction, this.blocks, this.lastWatch ? this.exporter.handle : undefined);\n for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {\n var change = changes_1[_i];\n trans.output(this.context, change);\n }\n trans.exec(this.context);\n // console.timeEnd(\"input\");\n // console.info(trans.changes.map((change, ix) => ` <- ${change}`).join(\"\\n\"));\n // let g:any = global;\n // let filterPrefix = \"eve/compiler/\";\n // let filteredIds = g.filteredIds = g.filteredIds || [];\n // for(let change of trans.changes) {\n // if(change.a == GlobalInterner.get(\"tag\") && (\"\"+GlobalInterner.reverse(change.v)).indexOf(filterPrefix) == 0) {\n // filteredIds.push(change.e);\n // }\n // }\n // let filtered = trans.changes.filter((c) => filteredIds.indexOf(c.e) !== -1);\n // if(filtered.length) {\n // console.log(\"---------------INPUT-----------\")\n // console.log(filtered.map((change, ix) => ` <- ${change}`).join(\"\\n\"));\n // }\n return trans;\n };\n Program.prototype.inputEAVs = function (eavcs) {\n var changes = [];\n var transactionId = this.nextTransactionId++;\n for (var _i = 0, _a = eavcs; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2], _c = _b[3], c = _c === void 0 ? 1 : _c;\n changes.push(runtime_1.Change.fromValues(e, a, v, \"input\", transactionId, 0, c));\n }\n return this.input(changes);\n };\n Program.prototype.test = function (transaction, eavns) {\n if (\"group\" in console)\n console.group(this.name + \" test \" + transaction);\n if (transaction >= this.nextTransactionId)\n this.nextTransactionId = transaction + 1;\n var trans = new Runtime.Transaction(this.context, transaction, this.blocks, this.lastWatch ? this.exporter.handle : undefined);\n for (var _i = 0, _a = eavns; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2], _c = _b[3], round = _c === void 0 ? 0 : _c, _d = _b[4], count = _d === void 0 ? 1 : _d;\n var change = Runtime.Change.fromValues(e, a, v, \"input\", transaction, round, count);\n trans.output(this.context, change);\n }\n trans.exec(this.context);\n console.info(trans.changes.map(function (change, ix) { return \" <- \" + change; }).join(\"\\n\"));\n if (\"group\" in console)\n console.groupEnd();\n return this;\n };\n Program.prototype._commit = function (name, flow) {\n var nodes = flow.compile();\n var block = new Runtime.Block(name, nodes, flow.context.maxRegisters);\n this.flows.push(flow);\n this.blocks.push(block);\n return block;\n };\n Program.prototype.commit = function (name, func) {\n var flow = new CommitFlow(this.injectConstants(func));\n this._commit(name, flow);\n return this;\n };\n Program.prototype.attach = function (id) {\n var WatcherConstructor = watcher_1.Watcher.get(id);\n if (!WatcherConstructor)\n throw new Error(\"Unable to attach unknown watcher '\" + id + \"'.\");\n if (this.watchers[id])\n return this.watchers[id];\n var watcher = new WatcherConstructor(this);\n this.watchers[id] = watcher;\n return watcher;\n };\n Program.prototype._watch = function (name, flow) {\n var nodes = flow.compile();\n var block = new Runtime.Block(name, nodes, flow.context.maxRegisters);\n this.lastWatch = flow.ID;\n this.flows.push(flow);\n this.blocks.push(block);\n return block;\n };\n Program.prototype.watch = function (name, func) {\n var flow = new WatchFlow(this.injectConstants(func));\n this._watch(name, flow);\n return this;\n };\n Program.prototype.asDiffs = function (handler) {\n if (!this.lastWatch)\n throw new Error(\"Must have at least one watch block to export as diffs.\");\n this.exporter.triggerOnDiffs(this.lastWatch, handler);\n return this;\n };\n Program.prototype.asObjects = function (handler) {\n if (!this.exporter || !this.lastWatch)\n throw new Error(\"Must have at least one watch block to export as diffs.\");\n this.exporter.triggerOnObjects(this.lastWatch, handler);\n return this;\n };\n Program.prototype.load = function (str) {\n var results = Parser.parseDoc(str);\n this.attach(\"ui\");\n this.attach(\"html\");\n this.attach(\"compiler\");\n if (results.results.eavs.length) {\n this.inputEAVs(results.results.eavs);\n }\n };\n return Program;\n}());\nexports.Program = Program;\n//# sourceMappingURL=dsl2.js.map\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar runtime_1 = __webpack_require__(4);\n//------------------------------------------------------------------------\n// Utils\n//------------------------------------------------------------------------\nfunction isResolved(field) {\n return !!field || field === 0;\n}\nfunction sumTimes(roundArray, transaction, round) {\n if (!roundArray)\n return 0;\n var total = 0;\n for (var _i = 0, roundArray_1 = roundArray; _i < roundArray_1.length; _i++) {\n var cur = roundArray_1[_i];\n if (Math.abs(cur) - 1 <= round) {\n total += cur > 0 ? 1 : -1;\n }\n }\n return total;\n}\nvar HashIndex = (function () {\n function HashIndex() {\n this.eavIndex = runtime_1.createHash();\n this.aveIndex = runtime_1.createHash();\n this.cardinality = 0;\n }\n HashIndex.prototype.getOrCreateHash = function (parent, key) {\n var found = parent[key];\n if (!found) {\n found = parent[key] = runtime_1.createHash(\"hashLevel\");\n }\n return found;\n };\n HashIndex.prototype.getOrCreateArray = function (parent, key) {\n var found = parent[key];\n if (!found) {\n found = parent[key] = runtime_1.createArray(\"hashVix\");\n }\n return found;\n };\n HashIndex.prototype.roundArrayInsert = function (arr, change) {\n var round = change.round + 1;\n var neue = round * change.count;\n var ix = 0;\n var handled = false;\n for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {\n var cur = arr_1[_i];\n var curRound = Math.abs(cur);\n if (curRound === round) {\n var updated = cur + neue;\n if (updated === 0) {\n arr.splice(ix, 1);\n }\n else {\n arr[ix] = updated;\n }\n handled = true;\n break;\n }\n else if (curRound > round) {\n arr.splice(ix, 0, neue);\n handled = true;\n break;\n }\n ix++;\n }\n if (!handled)\n arr.push(neue);\n };\n HashIndex.prototype.insert = function (change) {\n var _a = this, getOrCreateHash = _a.getOrCreateHash, getOrCreateArray = _a.getOrCreateArray;\n var eIx = getOrCreateHash(this.eavIndex, change.e);\n var aIx = getOrCreateHash(eIx, change.a);\n var vIx = getOrCreateArray(aIx, change.v);\n this.roundArrayInsert(vIx, change);\n var shouldRemove = false;\n if (!vIx.length) {\n this.cardinality--;\n delete aIx[change.v];\n if (!Object.keys(aIx).length) {\n delete eIx[change.a];\n if (!Object.keys(eIx).length) {\n delete this.eavIndex[change.e];\n }\n }\n shouldRemove = true;\n }\n aIx = getOrCreateHash(this.aveIndex, change.a);\n vIx = getOrCreateHash(aIx, change.v);\n eIx = getOrCreateArray(vIx, change.e);\n if (shouldRemove) {\n delete vIx[change.e];\n if (!Object.keys(vIx).length) {\n delete aIx[change.v];\n if (!Object.keys(aIx).length) {\n delete this.aveIndex[change.a];\n }\n }\n }\n else {\n this.roundArrayInsert(eIx, change);\n this.cardinality++;\n }\n };\n HashIndex.prototype.resolveProposal = function (proposal) {\n return proposal.info;\n };\n HashIndex.prototype.propose = function (proposal, e, a, v, n, transaction, round) {\n var forFields = proposal.forFields;\n forFields.clear();\n if (isResolved(e)) {\n return this.walkPropose(proposal, this.eavIndex, e, a, v, n, \"a\", \"v\", transaction, round);\n }\n else if (isResolved(a)) {\n return this.walkPropose(proposal, this.aveIndex, a, v, e, n, \"v\", \"e\", transaction, round);\n }\n else {\n // propose for attribute since that's likely to be the smallest\n forFields.push(\"a\");\n proposal.info = Object.keys(this.aveIndex);\n proposal.cardinality = proposal.info.length;\n }\n return proposal;\n };\n HashIndex.prototype.walkPropose = function (proposal, index, a, b, c, n, fieldB, fieldC, transaction, round) {\n var forFields = proposal.forFields;\n forFields.clear();\n var bIx = index[a];\n if (!bIx) {\n proposal.cardinality = 0;\n return proposal;\n }\n if (isResolved(b)) {\n var cIx = bIx[b];\n if (!cIx) {\n proposal.cardinality = 0;\n return proposal;\n }\n if (isResolved(c)) {\n var roundArray = cIx[c];\n if (roundArray) {\n proposal.skip = true;\n return proposal;\n }\n proposal.cardinality = 0;\n return proposal;\n }\n else {\n forFields.push(fieldC);\n proposal.info = Object.keys(cIx);\n proposal.cardinality = proposal.info.length;\n return proposal;\n }\n }\n else {\n forFields.push(fieldB);\n proposal.info = Object.keys(bIx);\n proposal.cardinality = proposal.info.length;\n return proposal;\n }\n };\n // This function checks that there is at least one value in the index that matches the\n // given pattern. If a level is free, we have to run through the potential values\n // until we come across one that could match or we run out of values to check.\n HashIndex.prototype.walkCheck = function (index, a, b, c, n, transaction, round) {\n var bIx = index[a];\n if (!bIx)\n return false;\n if (isResolved(b)) {\n var cIx = bIx[b];\n if (!cIx)\n return false;\n if (isResolved(c)) {\n var roundArray = cIx[c];\n if (roundArray) {\n return true;\n }\n return false;\n }\n else {\n return Object.keys(cIx).length !== 0;\n }\n }\n else {\n for (var _i = 0, _a = Object.keys(bIx); _i < _a.length; _i++) {\n var key = _a[_i];\n var cIx = bIx[key];\n if (!cIx)\n continue;\n if (isResolved(c)) {\n var roundArray = cIx[c];\n if (roundArray) {\n return true;\n }\n return false;\n }\n else if (Object.keys(cIx).length !== 0) {\n return true;\n }\n }\n }\n return false;\n };\n HashIndex.prototype.check = function (e, a, v, n, transaction, round) {\n if (isResolved(e)) {\n return this.walkCheck(this.eavIndex, e, a, v, n, transaction, round);\n }\n else if (isResolved(a)) {\n return this.walkCheck(this.aveIndex, a, v, e, n, transaction, round);\n }\n return true;\n };\n // This function finds all EAVs in the index that match the given\n // pattern at the stated time. If a level is free, we have to run\n // through the potential values until we come across one that could\n // match or we run out of values to check.\n HashIndex.prototype.walkGet = function (index, a, b, c, n, fieldB, fieldC, transaction, round) {\n var fieldA = \"e\";\n if (fieldB === \"e\")\n fieldA = \"a\";\n var results = runtime_1.createArray(\"IndexWalkGet\");\n var bIx = index[a];\n if (!bIx)\n return results;\n if (isResolved(b)) {\n var cIx = bIx[b];\n if (!cIx)\n return results;\n if (isResolved(c)) {\n if (sumTimes(cIx[c], transaction, round) > 0) {\n results.push((_a = {}, _a[fieldA] = +a, _a[fieldB] = +b, _a[fieldC] = +c, _a.n = n, _a));\n }\n return results;\n }\n else {\n for (var _i = 0, _b = Object.keys(cIx); _i < _b.length; _i++) {\n var c_1 = _b[_i];\n if (sumTimes(cIx[c_1], transaction, round) > 0) {\n results.push((_c = {}, _c[fieldA] = +a, _c[fieldB] = +b, _c[fieldC] = +c_1, _c.n = n, _c));\n }\n }\n return results;\n }\n }\n else {\n for (var _d = 0, _e = Object.keys(bIx); _d < _e.length; _d++) {\n var b_1 = _e[_d];\n var cIx = bIx[b_1];\n if (!cIx)\n continue;\n if (isResolved(c)) {\n if (sumTimes(cIx[c], transaction, round) > 0) {\n results.push((_f = {}, _f[fieldA] = +a, _f[fieldB] = +b_1, _f[fieldC] = +c, _f.n = n, _f));\n }\n }\n else {\n for (var _g = 0, _h = Object.keys(cIx); _g < _h.length; _g++) {\n var c_2 = _h[_g];\n if (sumTimes(cIx[c_2], transaction, round) > 0) {\n results.push((_j = {}, _j[fieldA] = +a, _j[fieldB] = +b_1, _j[fieldC] = +c_2, _j.n = n, _j));\n }\n }\n }\n }\n return results;\n }\n var _a, _c, _f, _j;\n // throw new Error(\"HashIndex.walkGet eav not implemented.\");\n };\n HashIndex.prototype.get = function (e, a, v, n, transaction, round) {\n if (isResolved(e)) {\n return this.walkGet(this.eavIndex, e, a, v, n, \"a\", \"v\", transaction, round);\n }\n else if (isResolved(a)) {\n return this.walkGet(this.aveIndex, a, v, e, n, \"v\", \"e\", transaction, round);\n }\n else\n throw new Error(\"HashIndex.get eaV not implemented.\");\n };\n HashIndex.prototype.getDiffs = function (e, a, v, n) {\n var aIx = this.eavIndex[e];\n if (aIx) {\n var vIx = aIx[a];\n if (vIx && vIx[v]) {\n return vIx[v];\n }\n }\n return runtime_1.createArray();\n };\n return HashIndex;\n}());\nexports.HashIndex = HashIndex;\n//------------------------------------------------------------------------\n// Bit Matrix index\n//------------------------------------------------------------------------\nvar BitMatrixIndex = (function () {\n function BitMatrixIndex() {\n }\n BitMatrixIndex.prototype.insert = function (change) {\n throw new Error(\"not implemented\");\n };\n BitMatrixIndex.prototype.propose = function (proposal, e, a, v, n, transaction, round) {\n throw new Error(\"not implemented\");\n };\n BitMatrixIndex.prototype.resolveProposal = function (proposal) {\n throw new Error(\"not implemented\");\n };\n BitMatrixIndex.prototype.check = function (e, a, v, n, transaction, round) {\n throw new Error(\"not implemented\");\n };\n BitMatrixIndex.prototype.getDiffs = function (e, a, v, n) {\n throw new Error(\"not implemented\");\n };\n BitMatrixIndex.prototype.get = function (e, a, v, n, transaction, round) {\n throw new Error(\"not implemented\");\n };\n return BitMatrixIndex;\n}());\nexports.BitMatrixIndex = BitMatrixIndex;\n//------------------------------------------------------------------------\n// DistinctIndex\n//------------------------------------------------------------------------\nvar DistinctIndex = (function () {\n function DistinctIndex() {\n this.index = {};\n }\n DistinctIndex.prototype.getDelta = function (last, next) {\n var delta = 0;\n if (last == 0 && next > 0)\n delta = 1;\n if (last > 0 && next == 0)\n delta = -1;\n if (last > 0 && next < 0)\n delta = -1;\n if (last < 0 && next > 0)\n delta = 1;\n return delta;\n };\n DistinctIndex.prototype.shouldOutput = function (key, prefixRound, prefixCount) {\n var index = this.index;\n var roundCounts = index[key] || runtime_1.createArray(\"Insert intermediate counts\");\n index[key] = roundCounts;\n var curCount = 0;\n var startingCount = roundCounts[prefixRound] = roundCounts[prefixRound] || 0;\n var minRound = Math.min(roundCounts.length, prefixRound + 1);\n for (var roundIx = 0; roundIx < minRound; roundIx++) {\n var prevCount = roundCounts[roundIx];\n if (!prevCount)\n continue;\n curCount += prevCount;\n }\n var deltas = [];\n // We only need delta changed here because if there's a round delta, it\n // would have been applied already.\n if (prefixCount === -Infinity) {\n if (curCount === Infinity) {\n curCount = 1;\n startingCount = 1;\n }\n prefixCount = -curCount;\n }\n var nextCount = curCount + prefixCount;\n var delta = this.getDelta(curCount, nextCount);\n if (delta) {\n deltas.push(prefixRound, delta);\n }\n curCount = nextCount;\n roundCounts[prefixRound] = startingCount + prefixCount;\n for (var roundIx = prefixRound + 1; roundIx < roundCounts.length; roundIx++) {\n var roundCount = roundCounts[roundIx];\n if (roundCount === undefined || roundCount === 0)\n continue;\n var lastCount = curCount - prefixCount;\n var nextCount_1 = lastCount + roundCount;\n var delta_1 = this.getDelta(lastCount, nextCount_1);\n var lastCountChanged = curCount;\n var nextCountChanged = curCount + roundCount;\n var deltaChanged = this.getDelta(lastCountChanged, nextCountChanged);\n // let finalDelta = deltaChanged - delta;\n var finalDelta = 0;\n if (delta_1 && delta_1 !== deltaChanged) {\n // undo delta\n finalDelta = -delta_1;\n }\n else if (delta_1 !== deltaChanged) {\n finalDelta = deltaChanged;\n }\n if (finalDelta) {\n deltas.push(roundIx, finalDelta);\n }\n curCount = nextCountChanged;\n }\n return deltas;\n };\n DistinctIndex.prototype.distinct = function (input, results) {\n var e = input.e, a = input.a, v = input.v, n = input.n, round = input.round, count = input.count;\n // @FIXME: When we start to unintern, we'll have invalid keys left in this index,\n // so we'll need to delete the keys themselves from the index\n var key = e + \"|\" + a + \"|\" + v;\n var deltas = this.shouldOutput(key, round, count);\n for (var deltaIx = 0; deltaIx < deltas.length; deltaIx += 2) {\n var deltaRound = deltas[deltaIx];\n var delta = deltas[deltaIx + 1];\n var change = new runtime_1.Change(e, a, v, n, input.transaction, deltaRound, delta);\n results.push(change);\n }\n return deltas.length > 0;\n };\n DistinctIndex.prototype.distinctKey = function (key, round, count, results) {\n var deltas = this.shouldOutput(key, round, count);\n for (var deltaIx = 0; deltaIx < deltas.length; deltaIx += 2) {\n var deltaRound = deltas[deltaIx];\n var delta = deltas[deltaIx + 1];\n results.push([deltaRound, delta]);\n }\n return deltas.length > 0;\n };\n DistinctIndex.prototype.getCounts = function (change) {\n var e = change.e, a = change.a, v = change.v;\n var key = e + \"|\" + a + \"|\" + v;\n return this.index[key];\n };\n DistinctIndex.prototype.sanityCheck = function () {\n var failed = false;\n var index = this.index;\n for (var key in index) {\n var counts = index[key];\n var sum = 0;\n for (var _i = 0, counts_1 = counts; _i < counts_1.length; _i++) {\n var c = counts_1[_i];\n if (!c)\n continue;\n sum += c;\n if (sum < 0) {\n failed = true;\n console.error(\"# Negative postDistinct: \", key, counts.slice());\n }\n }\n }\n if (failed)\n throw new Error(\"Distinct sanity check failed.\");\n };\n return DistinctIndex;\n}());\nexports.DistinctIndex = DistinctIndex;\n//# sourceMappingURL=indexes.js.map\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(setImmediate) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nfunction asValue(value) {\n if (typeof value == \"string\") {\n if (value == \"true\")\n return true;\n if (value == \"false\")\n return false;\n }\n return value;\n}\nfunction ixComparator(idMap) {\n return function (a, b) {\n return idMap[a].ix - idMap[b].ix;\n };\n}\nvar operationFields = {\n moveTo: [\"x\", \"y\"],\n lineTo: [\"x\", \"y\"],\n bezierQuadraticCurveTo: [\"cp1x\", \"cp1y\", \"cp2x\", \"cp2y\", \"x\", \"y\"],\n quadraticCurveTo: [\"cpx\", \"cpy\", \"x\", \"y\"],\n arc: [\"x\", \"y\", \"radius\", \"startAngle\", \"endAngle\", \"anticlockwise\"],\n arcTo: [\"x1\", \"y1\", \"x2\", \"y2\", \"radius\"],\n ellipse: [\"x\", \"y\", \"radiusX\", \"radiusY\", \"rotation\", \"startAngle\", \"endAngle\", \"anticlockwise\"],\n rect: [\"x\", \"y\", \"width\", \"height\"],\n closePath: []\n};\nfunction isOperationType(val) {\n return !!operationFields[val];\n}\nvar EMPTY = {};\n;\n;\nvar CanvasWatcher = (function (_super) {\n __extends(CanvasWatcher, _super);\n function CanvasWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.canvases = {};\n _this.paths = {};\n _this.operations = {};\n _this.canvasPaths = {};\n _this.pathToCanvases = {};\n _this.pathStyles = {};\n _this.pathCache = {};\n _this.dirty = {};\n _this.changed = function () {\n var dirtyPaths = Object.keys(_this.dirty);\n _this.updateCache(dirtyPaths);\n _this.rerender(dirtyPaths);\n _this.dirty = {};\n };\n return _this;\n }\n // addCanvas(canvasId:RawValue, instanceId:RawValue) {\n // if(this.canvases[id]) throw new Error(`Recreating canvas instance ${maybeIntern(id)}`);\n // let elements = this.html.elementToInstances[id];\n // // if(!elements || !elements.length) throw new Error(`No matching canvas instance found for ${id}.`);\n // if(!elements || !elements.length) return; // @FIXME: Really seems like this is an error case...\n // if(elements.length > 1) throw new Error(`Multiple canvas instances found for ${id}.`);\n // return this.canvases[id] = this.html.getInstance(elements[0]) as HTMLCanvasElement;\n // }\n // clearCanvas(id:RawValue) {\n // if(!this.canvases[id]) throw new Error(`Missing canvas instance ${maybeIntern(id)}`);\n // this.canvases[id] = undefined;\n // }\n // getCanvas(id:RawValue) {\n // let canvas = this.canvases[id];\n // if(!canvas) throw new Error(`Missing canvas instance ${maybeIntern(id)}`);\n // return canvas;\n // }\n CanvasWatcher.prototype.addCanvasInstance = function (canvasId, instanceId) {\n var instances = this.canvases[canvasId] = this.canvases[canvasId] || [];\n instances.push(instanceId);\n };\n CanvasWatcher.prototype.clearCanvasInstance = function (canvasId, instanceId) {\n var instances = this.canvases[canvasId];\n if (!instances)\n return; // @FIXME: Seems like an error though\n var ix = instances.indexOf(instanceId);\n if (ix !== -1) {\n instances.splice(ix, 1);\n if (!instances.length)\n this.canvases[canvasId] = undefined;\n }\n };\n CanvasWatcher.prototype.getCanvasInstances = function (canvasId) {\n var instances = this.canvases[canvasId];\n if (!instances)\n throw new Error(\"Missing canvas instance(s) for \" + watcher_1.maybeIntern(canvasId));\n return instances;\n };\n CanvasWatcher.prototype.getCanvasPaths = function (canvasId) {\n return this.canvasPaths[canvasId];\n };\n CanvasWatcher.prototype.addPath = function (id) {\n if (this.paths[id])\n throw new Error(\"Recreating path instance \" + watcher_1.maybeIntern(id));\n this.pathStyles[id] = {};\n return this.paths[id] = [];\n };\n CanvasWatcher.prototype.clearPath = function (id) {\n if (!this.paths[id])\n throw new Error(\"Missing path instance \" + watcher_1.maybeIntern(id));\n this.pathStyles[id] = undefined;\n this.paths[id] = undefined;\n };\n CanvasWatcher.prototype.getPath = function (id) {\n var path = this.paths[id];\n if (!path)\n throw new Error(\"Missing path instance \" + watcher_1.maybeIntern(id));\n return path;\n };\n CanvasWatcher.prototype.addOperation = function (id, type) {\n if (this.operations[id])\n throw new Error(\"Recreating operation instance \" + watcher_1.maybeIntern(id));\n if (!isOperationType(type))\n throw new Error(\"Invalid operation type \" + type);\n return this.operations[id] = { type: type, args: {}, paths: [] };\n };\n CanvasWatcher.prototype.clearOperation = function (id) {\n if (!this.operations[id])\n throw new Error(\"Missing operation instance \" + watcher_1.maybeIntern(id));\n this.operations[id] = undefined;\n };\n CanvasWatcher.prototype.getOperation = function (id) {\n var operation = this.operations[id];\n if (!operation)\n throw new Error(\"Missing operation instance \" + watcher_1.maybeIntern(id));\n return operation;\n };\n CanvasWatcher.prototype.getOperationArgs = function (operation) {\n var type = operation.type, args = operation.args;\n var fields = operationFields[type];\n var input = [];\n for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {\n var field = fields_1[_i];\n if (args[field] == undefined)\n return;\n var value = asValue(args[field]);\n input.push(value);\n }\n return input;\n };\n CanvasWatcher.prototype.updateCache = function (dirtyPaths) {\n for (var _i = 0, dirtyPaths_1 = dirtyPaths; _i < dirtyPaths_1.length; _i++) {\n var id = dirtyPaths_1[_i];\n if (!this.dirty[id])\n continue;\n var path = this.paths[id];\n if (!path)\n continue;\n var path2d = this.pathCache[id] = new window.Path2D();\n for (var _a = 0, path_1 = path; _a < path_1.length; _a++) {\n var opId = path_1[_a];\n var operation = this.getOperation(opId);\n var input = this.getOperationArgs(operation);\n if (!input) {\n console.warn(\"Skipping incomplete or invalid operation \" + watcher_1.maybeIntern(opId), operation.type, operation.args);\n continue;\n }\n if (!path2d[operation.type]) {\n console.warn(\"Skipping unavailable operation type \" + operation.type + \". Check your browser's Path2D compatibility.\");\n continue;\n }\n path2d[operation.type].apply(path2d, input);\n }\n }\n };\n CanvasWatcher.prototype.rerender = function (dirtyPaths) {\n var dirtyCanvases = {};\n for (var _i = 0, dirtyPaths_2 = dirtyPaths; _i < dirtyPaths_2.length; _i++) {\n var id = dirtyPaths_2[_i];\n var canvasIds = this.pathToCanvases[id];\n if (!canvasIds)\n continue;\n for (var _a = 0, canvasIds_1 = canvasIds; _a < canvasIds_1.length; _a++) {\n var canvasId = canvasIds_1[_a];\n dirtyCanvases[canvasId] = true;\n }\n }\n for (var _b = 0, _c = Object.keys(dirtyCanvases); _b < _c.length; _b++) {\n var canvasId = _c[_b];\n var pathIds = this.canvasPaths[canvasId];\n for (var _d = 0, _e = this.getCanvasInstances(canvasId); _d < _e.length; _d++) {\n var instanceId = _e[_d];\n var canvas = this.html.getInstance(instanceId);\n var ctx = canvas.getContext(\"2d\");\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (!pathIds)\n continue;\n for (var _f = 0, pathIds_1 = pathIds; _f < pathIds_1.length; _f++) {\n var id = pathIds_1[_f];\n var cached = this.pathCache[id];\n if (!cached)\n continue; // This thing isn't a path (yet?)\n var style = this.pathStyles[id] || EMPTY;\n var _g = style.fillStyle, fillStyle = _g === void 0 ? \"#000000\" : _g, _h = style.strokeStyle, strokeStyle = _h === void 0 ? \"#000000\" : _h, _j = style.lineWidth, lineWidth = _j === void 0 ? 1 : _j, _k = style.lineCap, lineCap = _k === void 0 ? \"butt\" : _k, _l = style.lineJoin, lineJoin = _l === void 0 ? \"miter\" : _l;\n ctx.fillStyle = fillStyle;\n ctx.strokeStyle = strokeStyle;\n ctx.lineWidth = lineWidth;\n ctx.lineCap = lineCap;\n ctx.lineJoin = lineJoin;\n if (style.strokeStyle)\n ctx.stroke(cached);\n if (style.fillStyle || !style.strokeStyle)\n ctx.fill(cached);\n }\n }\n }\n };\n CanvasWatcher.prototype.setup = function () {\n var _this = this;\n this.html = this.program.attach(\"html\");\n this.program\n .bind(\"Canvas roots are html elements.\", function (_a) {\n var find = _a.find;\n var canvas = find(\"canvas/root\");\n return [canvas.add({ tag: \"html/element\", tagname: \"canvas\" })];\n })\n .watch(\"Export canvas instances.\", function (_a) {\n var find = _a.find;\n var canvas = find(\"canvas/root\");\n var instance = find(\"html/instance\", { element: canvas });\n return [canvas.add(\"instance\", instance)];\n })\n .asDiffs(function (diffs) {\n for (var _i = 0, _a = diffs.adds; _i < _a.length; _i++) {\n var _b = _a[_i], canvas = _b[0], _ = _b[1], instance = _b[2];\n _this.addCanvasInstance(canvas, instance);\n }\n for (var _c = 0, _d = diffs.removes; _c < _d.length; _c++) {\n var _e = _d[_c], canvas = _e[0], _ = _e[1], instance = _e[2];\n _this.clearCanvasInstance(canvas, instance);\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export canvas paths.\", function (_a) {\n var find = _a.find;\n var path = find(\"canvas/path\");\n return [path.add(\"tag\", \"canvas/path\")];\n })\n .asDiffs(function (diffs) {\n for (var _i = 0, _a = diffs.adds; _i < _a.length; _i++) {\n var e = _a[_i][0];\n _this.addPath(e);\n _this.dirty[e] = true;\n }\n for (var _b = 0, _c = diffs.removes; _b < _c.length; _b++) {\n var e = _c[_b][0];\n _this.clearPath(e);\n _this.dirty[e] = true;\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export canvas operations.\", function (_a) {\n var find = _a.find;\n var path = find(\"canvas/path\");\n var operation = path.children;\n return [operation.add(\"type\", operation.type)];\n })\n .asDiffs(function (diffs) {\n for (var _i = 0, _a = diffs.adds; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], _ = _b[1], type = _b[2];\n _this.addOperation(e, type);\n }\n for (var _c = 0, _d = diffs.removes; _c < _d.length; _c++) {\n var e = _d[_c][0];\n _this.clearOperation(e);\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export paths of canvas.\", function (_a) {\n var find = _a.find, gather = _a.gather, record = _a.record;\n var canvas = find(\"canvas/root\");\n var child = canvas.children;\n // @FIXME: non-deterministic sort bug :(\n //let ix = gather(child.sort).per(canvas).sort();\n var ix = child.sort;\n return [record({ canvas: canvas, child: child, ix: ix })];\n })\n .asObjects(function (diffs) {\n var removeIds = Object.keys(diffs.removes);\n removeIds.sort(ixComparator(diffs.removes)).reverse();\n for (var _i = 0, removeIds_1 = removeIds; _i < removeIds_1.length; _i++) {\n var removeId = removeIds_1[_i];\n var _a = diffs.removes[removeId], canvasId = _a.canvas, childId = _a.child, ix = _a.ix;\n var instances = _this.canvases[canvasId];\n var paths = _this.canvasPaths[canvasId];\n if (paths)\n paths.splice(ix - 1, 1);\n var canvases = _this.pathToCanvases[childId] = _this.pathToCanvases[childId];\n if (canvases) {\n var ix_1 = canvases.indexOf(canvasId);\n if (ix_1 !== -1)\n canvases.splice(ix_1, 1);\n }\n // @FIXME: need a proper way to indicate dirtyness when an unchanged path is added a canvas.\n // This hack just marks the path dirty, which will rerender any other canvases containing it o_o\n _this.dirty[childId] = true;\n }\n var addIds = Object.keys(diffs.adds);\n addIds.sort(ixComparator(diffs.adds));\n for (var _b = 0, addIds_1 = addIds; _b < addIds_1.length; _b++) {\n var addId = addIds_1[_b];\n var _c = diffs.adds[addId], canvasId = _c.canvas, childId = _c.child, ix = _c.ix;\n var paths = _this.canvasPaths[canvasId] = _this.canvasPaths[canvasId] || [];\n paths.splice(ix - 1, 0, childId);\n var canvases = _this.pathToCanvases[childId] = _this.pathToCanvases[childId] || [];\n canvases.push(canvasId);\n // @FIXME: need a proper way to indicate dirtyness when an unchanged path is added a canvas.\n // This hack just marks the path dirty, which will rerender any other canvases containing it o_o\n _this.dirty[childId] = true;\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export operations of paths.\", function (_a) {\n var find = _a.find, gather = _a.gather, record = _a.record;\n var path = find(\"canvas/path\");\n var child = path.children;\n // @FIXME: non-deterministic sort bug :(\n //let ix = gather(child.sort).per(path).sort();\n var ix = child.sort;\n return [record({ path: path, child: child, ix: ix })];\n })\n .asObjects(function (diffs) {\n var removeIds = Object.keys(diffs.removes);\n removeIds.sort(ixComparator(diffs.removes)).reverse();\n for (var _i = 0, removeIds_2 = removeIds; _i < removeIds_2.length; _i++) {\n var removeId = removeIds_2[_i];\n var _a = diffs.removes[removeId], pathId = _a.path, childId = _a.child, ix = _a.ix;\n var path = _this.paths[pathId];\n if (path)\n path.splice(ix - 1, 1);\n var operation = _this.operations[childId];\n if (operation) {\n var ix_2 = operation.paths.indexOf(pathId);\n if (ix_2 !== -1)\n operation.paths.splice(ix_2, 1);\n }\n _this.dirty[pathId] = true;\n }\n var addIds = Object.keys(diffs.adds);\n addIds.sort(ixComparator(diffs.adds));\n for (var _b = 0, addIds_2 = addIds; _b < addIds_2.length; _b++) {\n var addId = addIds_2[_b];\n var _c = diffs.adds[addId], pathId = _c.path, childId = _c.child, ix = _c.ix;\n var path = _this.getPath(pathId);\n path.splice(ix - 1, 0, childId);\n var operation = _this.getOperation(childId);\n operation.paths.push(pathId);\n _this.dirty[pathId] = true;\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export attributes of operations.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var path = find(\"canvas/path\");\n var child = path.children;\n var _b = lookup(child), attribute = _b.attribute, value = _b.value;\n return [child.add(attribute, value)];\n })\n .asDiffs(function (diffs) {\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], opId = _b[0], attribute = _b[1], value = _b[2];\n var operation = _this.operations[opId];\n if (!operation)\n continue;\n operation.args[attribute] = undefined;\n for (var _c = 0, _d = operation.paths; _c < _d.length; _c++) {\n var pathId = _d[_c];\n _this.dirty[pathId] = true;\n }\n }\n for (var _e = 0, _f = diffs.adds; _e < _f.length; _e++) {\n var _g = _f[_e], opId = _g[0], attribute = _g[1], value = _g[2];\n var operation = _this.operations[opId];\n if (!operation)\n throw new Error(\"Missing operation \" + watcher_1.maybeIntern(opId) + \" for AV \" + attribute + \": $[value}\");\n if (operation.args[attribute])\n throw new Error(\"Attempting to overwrite existing attribute \" + attribute + \" of \" + opId + \": \" + operation.args[attribute] + \" => \" + value);\n operation.args[attribute] = value;\n for (var _h = 0, _j = operation.paths; _h < _j.length; _h++) {\n var pathId = _j[_h];\n _this.dirty[pathId] = true;\n }\n }\n setImmediate(_this.changed);\n })\n .watch(\"Export path styles.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var path = find(\"canvas/path\");\n var _b = lookup(path), attribute = _b.attribute, value = _b.value;\n attribute != \"children\";\n attribute != \"tag\";\n attribute != \"sort\";\n return [path.add(attribute, value)];\n })\n .asDiffs(function (diffs) {\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], pathId = _b[0], attribute = _b[1], value = _b[2];\n var pathStyle = _this.pathStyles[pathId];\n if (!pathStyle)\n continue;\n pathStyle[attribute] = undefined;\n _this.dirty[pathId] = true;\n }\n for (var _c = 0, _d = diffs.adds; _c < _d.length; _c++) {\n var _e = _d[_c], pathId = _e[0], attribute = _e[1], value = _e[2];\n var pathStyle = _this.pathStyles[pathId];\n if (!pathStyle)\n throw new Error(\"Missing path style for \" + pathId + \".\");\n // if(pathStyle[attribute]) throw new Error(`Attempting to overwrite existing attribute ${attribute} of ${pathId}: ${pathStyle[attribute]} => ${value}`);\n pathStyle[attribute] = value;\n _this.dirty[pathId] = true;\n }\n setImmediate(_this.changed);\n });\n };\n return CanvasWatcher;\n}(watcher_1.Watcher));\nexports.CanvasWatcher = CanvasWatcher;\nwatcher_1.Watcher.register(\"canvas\", CanvasWatcher);\n/*\n * [#canvas/root width height children:\n * [#canvas/rect x y width height fill? stroke?]]\n */\n//# sourceMappingURL=canvas.js.map\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).setImmediate))\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(setImmediate) {\n//--------------------------------------------------------------------\n// The Eve compiler as a watcher\n//--------------------------------------------------------------------\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar runtime_1 = __webpack_require__(4);\nvar dsl2_1 = __webpack_require__(37);\nvar stdlib_1 = __webpack_require__(20);\nvar Runtime = __webpack_require__(4);\n__webpack_require__(34);\nvar CompilerWatcher = (function (_super) {\n __extends(CompilerWatcher, _super);\n function CompilerWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.blocksToCompile = {};\n _this.blocksToRemove = {};\n _this.blocks = {};\n _this.items = {};\n _this.watcherFunctions = {};\n _this.programToInjectInto = _this.program;\n //------------------------------------------------------------------\n // Compile queue\n //------------------------------------------------------------------\n _this.queued = false;\n _this.runQueue = function () {\n var adds = [];\n var removes = [];\n for (var ID in _this.blocksToRemove) {\n if (!_this.blocks[ID])\n continue;\n removes.push(_this.blocks[ID]);\n delete _this.blocks[ID];\n }\n for (var ID in _this.blocksToCompile) {\n if (!_this.items[ID])\n continue;\n var neue = _this.compileBlock(ID);\n if (neue) {\n adds.push(neue);\n _this.blocks[ID] = neue;\n }\n }\n _this.programToInjectInto.blockChangeTransaction(adds, removes);\n _this.queued = false;\n _this.blocksToCompile = {};\n _this.blocksToRemove = {};\n };\n _this.compileValue = function (compile, context, value) {\n if (value === undefined)\n return undefined;\n var items = _this.items;\n if (items[value] && items[value].type === \"variable\") {\n var found = void 0;\n var cur = context;\n while (!found && cur) {\n found = compile.variables[cur.ID] && compile.variables[cur.ID][value];\n cur = cur.parent;\n }\n if (!found) {\n if (!compile.variables[context.ID]) {\n compile.variables[context.ID] = {};\n }\n found = compile.variables[context.ID][value] = new dsl2_1.Reference(context);\n }\n return found;\n }\n return value;\n };\n return _this;\n }\n CompilerWatcher.prototype.queue = function (blockID, isAdd) {\n if (isAdd === void 0) { isAdd = true; }\n if (isAdd)\n this.blocksToCompile[blockID] = true;\n this.blocksToRemove[blockID] = true;\n if (!this.queued) {\n this.queued = true;\n setImmediate(this.runQueue);\n }\n };\n //------------------------------------------------------------------\n // Program to inject into\n //------------------------------------------------------------------\n CompilerWatcher.prototype.injectInto = function (prog) {\n this.programToInjectInto = prog;\n };\n //------------------------------------------------------------------\n // Watch functions\n //------------------------------------------------------------------\n CompilerWatcher.prototype.registerWatcherFunction = function (name, consumer) {\n this.watcherFunctions[name] = consumer;\n };\n //------------------------------------------------------------------\n // Compiler\n //------------------------------------------------------------------\n CompilerWatcher.prototype.inContext = function (flow, func) {\n dsl2_1.ReferenceContext.push(flow.context);\n func();\n dsl2_1.ReferenceContext.pop();\n };\n CompilerWatcher.prototype.compileFlow = function (compile, flow, constraints) {\n var _this = this;\n var _a = this, inContext = _a.inContext, items = _a.items, compileValue = _a.compileValue;\n var context = flow.context;\n var subBlocks = [];\n var _loop_1 = function (constraintID) {\n var constraint = items[constraintID];\n if (!constraint)\n return \"continue\";\n if (constraint.type === \"record\") {\n inContext(flow, function () {\n var attrs = {};\n for (var _i = 0, _a = constraint.attributes; _i < _a.length; _i++) {\n var _b = _a[_i], attribute = _b[0], value = _b[1];\n var safeValue = compileValue(compile, context, value);\n var found = attrs[attribute];\n if (!found) {\n found = attrs[attribute] = [];\n }\n found.push(safeValue);\n }\n var recordVar = compileValue(compile, context, constraint.record);\n var record = new dsl2_1.Record(flow.context, [], attrs, recordVar);\n recordVar.__owner = record;\n });\n }\n if (constraint.type === \"output\") {\n inContext(flow, function () {\n var attrs = {};\n for (var _i = 0, _a = constraint.attributes; _i < _a.length; _i++) {\n var _b = _a[_i], attribute = _b[0], value = _b[1];\n var safeValue = compileValue(compile, context, value);\n var found = attrs[attribute];\n if (!found) {\n found = attrs[attribute] = [];\n }\n found.push(safeValue);\n }\n var outputType = dsl2_1.Insert;\n var outputOp = \"add\";\n if (constraint.outputType === \"remove\") {\n outputType = dsl2_1.Remove;\n outputOp = \"remove\";\n }\n var outputVar = compileValue(compile, context, constraint.record);\n var output;\n if (constraint.attributes.length > 0) {\n output = new outputType(flow.context, [], attrs);\n context.equality(output.reference(), outputVar);\n }\n else {\n output = new outputType(flow.context, [], attrs, outputVar);\n }\n var record = output.reference();\n for (var _c = 0, _d = constraint.nonIdentityAttribute; _c < _d.length; _c++) {\n var _e = _d[_c], attribute = _e[0], value = _e[1];\n record[outputOp](compileValue(compile, context, attribute), compileValue(compile, context, value));\n }\n });\n }\n if (constraint.type === \"removeRecord\") {\n inContext(flow, function () {\n var outputVar = compileValue(compile, context, constraint.record);\n var output;\n if (!outputVar.__owner) {\n throw new Error(\"Trying to fully remove a record that doesn't exist\");\n }\n outputVar.remove();\n });\n }\n if (constraint.type === \"lookup\") {\n inContext(flow, function () {\n var lookup = flow.lookup(compileValue(compile, context, constraint.record));\n context.equality(lookup.attribute, compileValue(compile, context, constraint.attribute));\n context.equality(lookup.value, compileValue(compile, context, constraint.value));\n });\n }\n if (constraint.type === \"expression\") {\n inContext(flow, function () {\n var args = constraint.args.map(function (v) { return compileValue(compile, context, v); });\n var returns = constraint.returns.map(function (v) { return compileValue(compile, context, v); })[0];\n var fn = new dsl2_1.Fn(flow.context, constraint.op, args, returns);\n });\n }\n if (constraint.type === \"aggregate\") {\n inContext(flow, function () {\n var projection = [];\n var group = [];\n var args = [];\n for (var arg in constraint.namedArgs) {\n var values = constraint.namedArgs[arg].map(function (v) { return compileValue(compile, context, v); });\n if (arg === \"for\" || arg === \"given\") {\n projection = values;\n }\n else if (arg === \"per\") {\n group = values;\n }\n else if (arg === \"direction\" || arg === \"value\") {\n args = args.concat(values);\n }\n }\n var aggOp = stdlib_1.SumAggregate;\n if (constraint.op === \"gather/sort\") {\n aggOp = Runtime.SortNode;\n }\n else if (constraint.op === \"gather/count\" && args.length === 0) {\n args.push(1);\n }\n var returns = constraint.returns.map(function (v) { return compileValue(compile, context, v); })[0];\n var agg = new dsl2_1.Aggregate(flow.context, aggOp, projection, group, args, returns);\n });\n }\n if (constraint.type === \"equality\") {\n inContext(flow, function () {\n context.equality(compileValue(compile, context, constraint.left), compileValue(compile, context, constraint.right));\n });\n }\n if (constraint.type === \"not\" || constraint.type === \"choose\" || constraint.type === \"union\") {\n subBlocks.push(constraint);\n }\n };\n for (var _i = 0, constraints_1 = constraints; _i < constraints_1.length; _i++) {\n var constraintID = constraints_1[_i];\n _loop_1(constraintID);\n }\n var _loop_2 = function (constraint) {\n if (constraint.type === \"not\") {\n inContext(flow, function () {\n var not = new dsl2_1.Not(function (a) { return []; }, flow);\n _this.compileFlow(compile, not, constraint.constraints);\n });\n }\n if (constraint.type === \"choose\" || constraint.type == \"union\") {\n var builder_1 = constraint.type == \"choose\" ? dsl2_1.Choose : dsl2_1.Union;\n var branchFuncs_1 = [];\n var _loop_3 = function (branchId) {\n var branch = items[branchId];\n branchFuncs_1.push(function (self) {\n return branch.outputs.map(function (v) {\n return compileValue(compile, self.context, v);\n });\n });\n };\n for (var _i = 0, _a = constraint.branches; _i < _a.length; _i++) {\n var branchId = _a[_i];\n _loop_3(branchId);\n }\n inContext(flow, function () {\n var outputs = constraint.outputs.map(function (v) {\n return compileValue(compile, context, v);\n });\n var choose = new builder_1(flow.context, branchFuncs_1, flow, outputs);\n var branchIx = 0;\n var _loop_4 = function (branchId) {\n var branch = items[branchId];\n var compiled = choose.branches[branchIx];\n inContext(compiled, function () {\n _this.compileFlow(compile, compiled, branch.constraints);\n choose.setBranchInputs(branchIx, compiled.context.getInputReferences());\n });\n branchIx++;\n };\n for (var _i = 0, _a = constraint.branches; _i < _a.length; _i++) {\n var branchId = _a[_i];\n _loop_4(branchId);\n }\n });\n }\n };\n for (var _b = 0, subBlocks_1 = subBlocks; _b < subBlocks_1.length; _b++) {\n var constraint = subBlocks_1[_b];\n _loop_2(constraint);\n }\n };\n CompilerWatcher.prototype.compileBlock = function (blockID) {\n var _a = this, inContext = _a.inContext, items = _a.items, compileValue = _a.compileValue;\n var item = items[blockID];\n var name = item.name, constraints = item.constraints, type = item.type;\n var compile = { variables: {} };\n var flow;\n if (type === \"commit\") {\n flow = new dsl2_1.CommitFlow(function (a) { return []; });\n }\n else if (type === \"watch\") {\n flow = new dsl2_1.WatchFlow(function (a) { return []; });\n }\n else if (type === \"bind\") {\n flow = new dsl2_1.LinearFlow(function (a) { return []; });\n }\n else {\n return;\n }\n this.compileFlow(compile, flow, constraints);\n var block = this.programToInjectInto[\"_\" + type](name, flow);\n if (type === \"watch\" && item.watcher) {\n var func = this.watcherFunctions[item.watcher];\n if (!func) {\n console.error(\"No such watcher function registered: \" + item.watcher);\n }\n else {\n this.programToInjectInto.asDiffs(func);\n }\n }\n // if(typeof process === \"undefined\" && console.groupCollapsed) {\n // console.groupCollapsed(\"Compiled: \" + block.name);\n // console.log(block, flow);\n // console.log(printBlock(block));\n // console.groupEnd();\n // }\n return block;\n };\n //------------------------------------------------------------------\n // Compile item extraction via watch blocks\n //------------------------------------------------------------------\n CompilerWatcher.prototype.setup = function () {\n var _this = this;\n var me = this.program;\n me.bind(\"show errors\", function (_a) {\n var find = _a.find, record = _a.record;\n var err = find(\"eve/compiler/error\");\n return [\n record(\"ui/column\", { err: err, class: \"eve-compiler-error\" }).add(\"children\", [\n record(\"ui/row\", { err: err, class: \"eve-compiler-error-message-container\" }).add(\"children\", [\n record(\"ui/column\", { err: err, class: \"eve-compiler-line-info\", sort: 0 }).add(\"children\", [\n record(\"ui/text\", { err: err, text: \"Line\", sort: 0 }),\n record(\"ui/text\", { err: err, class: \"eve-compiler-error-message-line\", text: err.start.line, sort: 1 }),\n ]),\n record(\"ui/column\", { err: err, class: \"eve-compiler-error-content\", sort: 1 }).add(\"children\", [\n record(\"ui/text\", { err: err, class: \"eve-compiler-error-message\", text: err.message, sort: 0 }),\n record(\"ui/text\", { err: err, class: \"eve-compiler-error-sample\", text: err.sample, sort: 1 })\n ]),\n ]),\n ])\n ];\n });\n me.watch(\"get blocks\", function (_a) {\n var find = _a.find, record = _a.record;\n var block = find(\"eve/compiler/rule\");\n var constraint = block.constraint, name = block.name, type = block.type;\n return [\n record({ block: block, constraint: constraint, name: name, type: type })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, name_1 = _b.name, constraint = _b.constraint, type = _b.type;\n var found = items[block];\n if (!found) {\n found = items[block] = { type: type, name: name_1, constraints: [] };\n }\n found.name = name_1;\n if (found.constraints.indexOf(constraint) === -1) {\n found.constraints.push(constraint);\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, name_2 = _c.name, constraint = _c.constraint;\n var found = items[block];\n if (!found) {\n continue;\n }\n var ix = found.constraints.indexOf(constraint);\n if (ix > -1) {\n found.constraints.splice(ix, 1);\n }\n if (found.constraints.length === 0) {\n delete items[block];\n }\n _this.queue(block);\n }\n });\n me.watch(\"get nots\", function (_a) {\n var find = _a.find, record = _a.record;\n var not = find(\"eve/compiler/not\");\n var block = find(\"eve/compiler/block\", { constraint: not });\n return [\n record({ block: block, not: not, constraint: not.constraint })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, not = _b.not, constraint = _b.constraint;\n var found = items[not];\n if (!found) {\n found = items[not] = { type: \"not\", constraints: [] };\n }\n if (found.constraints.indexOf(constraint) === -1) {\n found.constraints.push(constraint);\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, not = _c.not, constraint = _c.constraint;\n var found = items[not];\n if (!found) {\n continue;\n }\n var ix = found.constraints.indexOf(constraint);\n if (ix > -1) {\n found.constraints.splice(ix, 1);\n }\n if (found.constraints.length === 0) {\n delete items[not];\n }\n _this.queue(block);\n }\n });\n me.watch(\"get choose branches\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose;\n var item = find(\"eve/compiler/branch-set\");\n var itemType = choose(function () {\n item.tag == \"eve/compiler/choose\";\n return [\"choose\"];\n }, function () {\n item.tag == \"eve/compiler/union\";\n return [\"union\"];\n })[0];\n var block = find(\"eve/compiler/rule\", { constraint: item });\n return [\n record({ block: block, item: item, itemType: itemType, branch: item.branch })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, item = _b.item, branch = _b.branch, itemType = _b.itemType;\n var found = items[item];\n if (!found) {\n found = items[item] = { type: itemType, branches: [], outputs: [] };\n }\n if (!items[branch]) {\n items[branch] = { type: \"branch\", constraints: [], outputs: [] };\n }\n if (found.branches.indexOf(branch) === -1) {\n found.branches.push(branch);\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, item = _c.item, itemType = _c.itemType, branch = _c.branch;\n var found = items[item];\n if (!found) {\n continue;\n }\n var ix = found.branches.indexOf(branch);\n if (ix > -1) {\n found.branches.splice(ix, 1);\n }\n if (found.branches.length === 0) {\n delete items[item];\n }\n _this.queue(block);\n }\n });\n me.watch(\"get choose outputs\", function (_a) {\n var find = _a.find, record = _a.record;\n var choose = find(\"eve/compiler/branch-set\");\n var block = find(\"eve/compiler/block\", { constraint: choose });\n var _b = choose.output, value = _b.value, index = _b.index;\n return [\n record({ block: block, choose: choose, value: value, index: index })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, choose = _b.choose, value = _b.value, index = _b.index;\n var found = items[choose];\n if (!found) {\n console.error(\"adding output for a branch that doesn't exist\");\n return;\n }\n found.outputs[index - 1] = value;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, choose = _c.choose, value = _c.value, index = _c.index;\n var found = items[choose];\n if (!found) {\n continue;\n }\n var cur = found.outputs[index];\n if (cur === value) {\n found.outputs[index - 1] = undefined;\n }\n _this.queue(block);\n }\n });\n me.watch(\"get choose branch constraints\", function (_a) {\n var find = _a.find, record = _a.record;\n var choose = find(\"eve/compiler/branch-set\");\n var block = find(\"eve/compiler/block\", { constraint: choose });\n var branch = choose.branch;\n return [\n record({ block: block, branch: branch, constraint: branch.constraint })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, constraint = _b.constraint, branch = _b.branch;\n var found = items[branch];\n if (!found) {\n console.error(\"adding constraint for a branch that doesn't exist\");\n return;\n }\n if (found.constraints.indexOf(constraint) === -1) {\n found.constraints.push(constraint);\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, constraint = _c.constraint, branch = _c.branch;\n var found = items[branch];\n if (!found) {\n continue;\n }\n var ix = found.constraints.indexOf(constraint);\n if (ix > -1) {\n found.constraints.splice(ix, 1);\n }\n if (found.constraints.length === 0) {\n delete items[branch];\n }\n _this.queue(block);\n }\n });\n me.watch(\"get choose branch outputs\", function (_a) {\n var find = _a.find, record = _a.record;\n var choose = find(\"eve/compiler/branch-set\");\n var block = find(\"eve/compiler/block\", { constraint: choose });\n var branch = choose.branch;\n var _b = branch.output, value = _b.value, index = _b.index;\n return [\n record({ block: block, branch: branch, value: value, index: index })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, branch = _b.branch, value = _b.value, index = _b.index;\n var found = items[branch];\n if (!found) {\n console.error(\"adding output for a branch that doesn't exist\");\n return;\n }\n found.outputs[index - 1] = value;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, branch = _c.branch, value = _c.value, index = _c.index;\n var found = items[branch];\n if (!found) {\n continue;\n }\n var cur = found.outputs[index];\n if (cur === value) {\n found.outputs[index - 1] = undefined;\n }\n _this.queue(block);\n }\n });\n me.watch(\"get watcher property\", function (_a) {\n var find = _a.find, record = _a.record;\n var block = find(\"eve/compiler/rule\");\n var constraint = block.constraint, name = block.name, type = block.type, watcher = block.watcher;\n return [\n record({ block: block, watcher: watcher })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, watcher = _b.watcher;\n var found = items[block];\n found.watcher = watcher;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, watcher = _c.watcher;\n var found = items[block];\n if (!found) {\n continue;\n }\n found.watcher = undefined;\n _this.queue(block);\n }\n });\n me.watch(\"get variables\", function (_a) {\n var find = _a.find, record = _a.record;\n var variable = find(\"eve/compiler/var\");\n return [\n record({ variable: variable })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var variable = adds[key].variable;\n items[variable] = { type: \"variable\" };\n }\n });\n me.watch(\"get equalities\", function (_a) {\n var find = _a.find, record = _a.record;\n var eq = find(\"eve/compiler/equality\");\n return [\n record({ eq: eq, left: eq.left, right: eq.right })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], eq = _b.eq, left = _b.left, right = _b.right;\n items[eq] = { type: \"equality\", left: left, right: right };\n }\n for (var key in removes) {\n var eq = removes[key].eq;\n items[eq] = undefined;\n }\n });\n me.watch(\"get lookups\", function (_a) {\n var find = _a.find, record = _a.record;\n var lookup = find(\"eve/compiler/lookup\");\n var block = find(\"eve/compiler/block\", { constraint: lookup });\n var rec = lookup.record, attribute = lookup.attribute, value = lookup.value;\n return [\n record({ block: block, id: lookup, record: rec, attribute: attribute, value: value })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, record = _b.record, attribute = _b.attribute, value = _b.value;\n items[id] = { type: \"lookup\", record: record, attribute: attribute, value: value };\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id, record = _c.record, attribute = _c.attribute, value = _c.value;\n delete items[id];\n _this.queue(block);\n }\n });\n me.watch(\"get expressions\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose;\n var expr = find(\"eve/compiler/expression\");\n var type = choose(function () {\n expr.tag == \"eve/compiler/aggregate\";\n return [\"aggregate\"];\n }, function () {\n return [\"expression\"];\n })[0];\n var block = find(\"eve/compiler/block\", { constraint: expr });\n return [\n record({ block: block, id: expr, op: expr.op, type: type })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, op = _b.op, type = _b.type;\n var found = items[id];\n if (!found) {\n found = items[id] = { type: type, op: op, args: [], returns: [], namedArgs: {} };\n }\n found.op = op;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id, op = _c.op;\n var found = items[id];\n if (!found) {\n continue;\n }\n delete items[id];\n _this.queue(block);\n }\n });\n me.watch(\"get expression args\", function (_a) {\n var find = _a.find, record = _a.record;\n var expr = find(\"eve/compiler/expression\");\n var block = find(\"eve/compiler/block\", { constraint: expr });\n var arg = expr.arg;\n return [\n record({ block: block, id: expr, index: arg.index, value: arg.value })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, index = _b.index, value = _b.value;\n var found = items[id];\n if (!found) {\n throw new Error(\"args for a non existent expression\");\n }\n found.args[index - 1] = value;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id, index = _c.index, value = _c.value;\n var found = items[id];\n if (!found) {\n continue;\n }\n if (found.args[index - 1] == value) {\n found.args[index - 1] = undefined;\n }\n _this.queue(block);\n }\n });\n me.watch(\"get expression named args\", function (_a) {\n var find = _a.find, record = _a.record, not = _a.not;\n var expr = find(\"eve/compiler/expression\");\n not(function () {\n expr.tag == \"eve/compiler/aggregate\";\n });\n var block = find(\"eve/compiler/block\", { constraint: expr });\n var arg = expr.arg;\n return [\n record({ block: block, id: expr, name: arg.name, value: arg.value, index: arg.index })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, name_3 = _b.name, value = _b.value, index = _b.index;\n var found = items[id];\n if (!found) {\n throw new Error(\"args for a non existent expression\");\n }\n var _c = runtime_1.FunctionConstraint.fetchInfo(found.op), argNames = _c.argNames, returnNames = _c.returnNames;\n var argIx = argNames.indexOf(name_3);\n var retIx = returnNames.indexOf(name_3);\n if (argIx > -1) {\n found.args[argIx] = value;\n }\n else if (retIx > -1) {\n found.returns[retIx] = value;\n }\n else {\n console.error(\"Unknown arg for expression: \" + found.op + \"[\" + name_3 + \"]\");\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _d = removes[key], block = _d.block, id = _d.id, name_4 = _d.name, value = _d.value;\n var found = items[id];\n if (!found) {\n continue;\n }\n var _e = runtime_1.FunctionConstraint.fetchInfo(found.op), argNames = _e.argNames, returnNames = _e.returnNames;\n var argIx = argNames.indexOf(name_4);\n var retIx = returnNames.indexOf(name_4);\n if (argIx > -1) {\n found.args[argIx] = undefined;\n }\n else if (retIx > -1) {\n found.returns[retIx] = undefined;\n }\n else {\n console.error(\"Unknown arg for expression: \" + found.op + \"[\" + name_4 + \"]\");\n }\n _this.queue(block);\n }\n });\n me.watch(\"get aggregate named args\", function (_a) {\n var find = _a.find, record = _a.record, not = _a.not;\n var expr = find(\"eve/compiler/aggregate\");\n var block = find(\"eve/compiler/block\", { constraint: expr });\n var arg = expr.arg;\n return [\n record({ block: block, id: expr, name: arg.name, value: arg.value, index: arg.index })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, name_5 = _b.name, value = _b.value, index = _b.index;\n var found = items[id];\n if (!found) {\n throw new Error(\"args for a non existent expression\");\n }\n var args = found.namedArgs[name_5] || [];\n args[index - 1] = value;\n found.namedArgs[name_5] = args;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id, name_6 = _c.name, value = _c.value;\n var found = items[id];\n if (!found) {\n continue;\n }\n var args = found.namedArgs[name_6];\n if (args) {\n var ix = args.indexOf(value);\n args.splice(ix, 1);\n }\n _this.queue(block);\n }\n });\n me.watch(\"get expression returns\", function (_a) {\n var find = _a.find, record = _a.record;\n var expr = find(\"eve/compiler/expression\");\n var block = find(\"eve/compiler/block\", { constraint: expr });\n var ret = expr.return;\n return [\n record({ block: block, id: expr, index: ret.index, value: ret.value })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, index = _b.index, value = _b.value;\n var found = items[id];\n if (!found) {\n throw new Error(\"returns for a non existent expression\");\n }\n found.returns[index - 1] = value;\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id, index = _c.index, value = _c.value;\n var found = items[id];\n if (!found) {\n continue;\n }\n if (found.returns[index - 1] == value) {\n found.returns[index - 1] = undefined;\n }\n _this.queue(block);\n }\n });\n me.watch(\"get records\", function (_a) {\n var find = _a.find, record = _a.record;\n var compilerRecord = find(\"eve/compiler/record\");\n var block = find(\"eve/compiler/block\", { constraint: compilerRecord });\n var id = compilerRecord.record, attribute = compilerRecord.attribute;\n return [\n record({ block: block, id: compilerRecord, record: id, attribute: attribute.attribute, value: attribute.value })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, record = _b.record, attribute = _b.attribute, value = _b.value;\n var found = items[id];\n if (!found) {\n found = items[id] = { type: \"record\", attributes: [], record: record };\n }\n found.attributes.push([attribute, value]);\n _this.queue(block);\n }\n var _loop_5 = function (key) {\n var _a = removes[key], block = _a.block, id = _a.id, record = _a.record, attribute = _a.attribute, value = _a.value;\n var found = items[id];\n if (!found) {\n return \"continue\";\n }\n found.attributes = found.attributes.filter(function (_a) {\n var a = _a[0], v = _a[1];\n return a !== attribute || v !== value;\n });\n if (found.attributes.length === 0) {\n delete items[id];\n }\n _this.queue(block);\n };\n for (var key in removes) {\n _loop_5(key);\n }\n });\n me.watch(\"get outputs\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose;\n var compilerRecord = find(\"eve/compiler/output\");\n var block = find(\"eve/compiler/block\", { constraint: compilerRecord });\n var id = compilerRecord.record, attribute = compilerRecord.attribute;\n var attributeType = choose(function () {\n attribute.tag == \"eve/compiler/attribute/non-identity\";\n return \"non-identity\";\n }, function () {\n return \"identity\";\n })[0];\n var outputType = choose(function () {\n compilerRecord.tag == \"eve/compiler/remove\";\n return \"remove\";\n }, function () {\n return \"add\";\n })[0];\n return [\n record({ block: block, id: compilerRecord, record: id, attribute: attribute.attribute, value: attribute.value, attributeType: attributeType, outputType: outputType })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, record = _b.record, attribute = _b.attribute, value = _b.value, attributeType = _b.attributeType, outputType = _b.outputType;\n var found = items[id];\n if (!found) {\n found = items[id] = { type: \"output\", attributes: [], nonIdentityAttribute: [], record: record, outputType: outputType };\n }\n if (attributeType === \"identity\") {\n found.attributes.push([attribute, value]);\n }\n else {\n found.nonIdentityAttribute.push([attribute, value]);\n }\n _this.queue(block);\n }\n var _loop_6 = function (key) {\n var _a = removes[key], block = _a.block, id = _a.id, record = _a.record, attribute = _a.attribute, value = _a.value;\n var found = items[id];\n if (!found) {\n return \"continue\";\n }\n found.attributes = found.attributes.filter(function (_a) {\n var a = _a[0], v = _a[1];\n return a !== attribute || v !== value;\n });\n found.nonIdentityAttribute = found.nonIdentityAttribute.filter(function (_a) {\n var a = _a[0], v = _a[1];\n return a !== attribute || v !== value;\n });\n if (found.attributes.length === 0) {\n delete items[id];\n }\n _this.queue(block);\n };\n for (var key in removes) {\n _loop_6(key);\n }\n });\n me.watch(\"get valueless outputs\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose, not = _a.not;\n var compilerRecord = find(\"eve/compiler/output\");\n var block = find(\"eve/compiler/block\", { constraint: compilerRecord });\n var attribute = compilerRecord.attribute;\n not(function () { return attribute.value; });\n return [\n record({ block: block, id: compilerRecord, record: compilerRecord.record, attribute: attribute.attribute })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, record = _b.record, attribute = _b.attribute;\n var found = items[id];\n if (!found) {\n found = items[id] = { type: \"output\", attributes: [], nonIdentityAttribute: [], record: record, outputType: \"remove\" };\n }\n found.nonIdentityAttribute.push([attribute, undefined]);\n _this.queue(block);\n }\n var _loop_7 = function (key) {\n var _a = removes[key], block = _a.block, id = _a.id, attribute = _a.attribute;\n var found = items[id];\n if (!found) {\n return \"continue\";\n }\n found.nonIdentityAttribute = found.nonIdentityAttribute.filter(function (_a) {\n var a = _a[0], v = _a[1];\n return a !== attribute || v !== undefined;\n });\n if (found.nonIdentityAttribute.length === 0) {\n delete items[id];\n }\n _this.queue(block);\n };\n for (var key in removes) {\n _loop_7(key);\n }\n });\n me.watch(\"get full remove\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose, not = _a.not;\n var compilerRecord = find(\"eve/compiler/remove\");\n var block = find(\"eve/compiler/block\", { constraint: compilerRecord });\n not(function () { return compilerRecord.attribute; });\n return [\n record({ block: block, id: compilerRecord, record: compilerRecord.record })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n var items = _this.items;\n for (var key in adds) {\n var _b = adds[key], block = _b.block, id = _b.id, record = _b.record;\n var found = items[id];\n if (!found) {\n found = items[id] = { type: \"removeRecord\", record: record };\n }\n _this.queue(block);\n }\n for (var key in removes) {\n var _c = removes[key], block = _c.block, id = _c.id;\n var found = items[id];\n if (!found) {\n continue;\n }\n delete items[id];\n _this.queue(block);\n }\n });\n };\n return CompilerWatcher;\n}(watcher_1.Watcher));\nexports.CompilerWatcher = CompilerWatcher;\nwatcher_1.Watcher.register(\"compiler\", CompilerWatcher);\n//# sourceMappingURL=compiler.js.map\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).setImmediate))\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar naturalSort = __webpack_require__(71);\nvar DOMWatcher = (function (_super) {\n __extends(DOMWatcher, _super);\n function DOMWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.styles = Object.create(null);\n _this.roots = Object.create(null);\n _this.instances = Object.create(null);\n _this.elementToInstances = Object.create(null);\n _this.styleToInstances = Object.create(null);\n return _this;\n }\n DOMWatcher.prototype._sendEvent = function (eavs) {\n this.program.inputEAVs(eavs);\n };\n DOMWatcher.prototype.getStyle = function (id) {\n return this.styles[id] = this.styles[id] || { __size: 0 };\n };\n DOMWatcher.prototype.isInstance = function (elem) {\n if (!elem || !(elem instanceof Element))\n return false;\n var instance = elem;\n return instance && !!instance[\"__element\"];\n };\n DOMWatcher.prototype.addInstance = function (id, element, tagname) {\n var instance = this.instances[id] = this.createInstance(id, element, tagname);\n if (!this.elementToInstances[element])\n this.elementToInstances[element] = [];\n this.elementToInstances[element].push(id);\n return instance;\n };\n DOMWatcher.prototype.clearInstance = function (id) {\n var instance = this.instances[id];\n if (instance && instance.parentElement) {\n instance.parentElement.removeChild(instance);\n }\n this.instances[id] = undefined;\n var instances = instance && this.elementToInstances[instance.__element];\n if (instances)\n instances.splice(instances.indexOf(id), 1);\n };\n DOMWatcher.prototype.getRoot = function (id, tagname) {\n if (tagname === void 0) { tagname = \"div\"; }\n return this.roots[id] = this.roots[id];\n };\n DOMWatcher.prototype.clearRoot = function (id) {\n this.clearInstance(id);\n this.roots[id] = undefined;\n };\n DOMWatcher.prototype.insertChild = function (parent, child, at) {\n if (at === void 0) { at = child.__sort; }\n child.__sort = at;\n if (at !== undefined)\n child.setAttribute(\"sort\", \"\" + at);\n if (!parent)\n return;\n var current;\n for (var curIx = 0; curIx < parent.childNodes.length; curIx++) {\n var cur = parent.childNodes[curIx];\n if (cur === child)\n continue;\n if (cur.__sort !== undefined && at !== undefined && naturalSort(cur.__sort, at) > 0) {\n current = cur;\n break;\n }\n }\n if (current) {\n parent.insertBefore(child, current);\n }\n else {\n parent.appendChild(child);\n }\n };\n // @NOTE: This requires styles to have disjoint attribute sets or it'll do bad things.\n // @NOTE: Styles may only have a single value for each attribute due to our inability\n // to express an ordering of non-record values.\n DOMWatcher.prototype.setStyleAttribute = function (styleId, attribute, value, count) {\n var style = this.getStyle(styleId);\n if (count === -1) {\n //if(!style[attribute]) throw new Error(`Cannot remove non-existent attribute '${attribute}'`);\n //if(style[attribute] !== value) throw new Error(`Cannot remove mismatched AV ${attribute}: ${value} (current: ${style[attribute]})`);\n style[attribute] = undefined;\n }\n else {\n if (style[attribute])\n throw new Error(\"Cannot add already present attribute '\" + attribute + \"'\");\n style[attribute] = value;\n }\n style.__size += count;\n // Update all existing instances with this style.\n var instances = this.styleToInstances[styleId];\n if (instances) {\n for (var _i = 0, instances_1 = instances; _i < instances_1.length; _i++) {\n var instanceId = instances_1[_i];\n var instance = this.getInstance(instanceId);\n if (!instance) {\n // We may have removed one instance of multiple subscribed to this style.\n continue;\n }\n instance.style[attribute] = style[attribute];\n }\n }\n };\n DOMWatcher.prototype.addStyleInstance = function (styleId, instanceId) {\n var instance = this.getInstance(instanceId);\n if (!instance)\n throw new Error(\"Orphaned instance '\" + instanceId + \"'\");\n var style = this.getStyle(styleId);\n for (var prop in style) {\n if (prop === \"__size\")\n continue;\n instance.style[prop] = style[prop];\n }\n if (this.styleToInstances[styleId])\n this.styleToInstances[styleId].push(instanceId);\n else\n this.styleToInstances[styleId] = [instanceId];\n if (!instance.__styles)\n instance.__styles = [];\n if (instance.__styles.indexOf(styleId) === -1)\n instance.__styles.push(styleId);\n };\n DOMWatcher.prototype.removeStyleInstance = function (styleId, instanceId) {\n var instance = this.getInstance(instanceId);\n if (!instance)\n return;\n instance.removeAttribute(\"style\");\n var ix = instance.__styles.indexOf(styleId);\n instance.__styles.splice(ix, 1);\n for (var _i = 0, _a = instance.__styles; _i < _a.length; _i++) {\n var otherStyleId = _a[_i];\n var style = this.getStyle(otherStyleId);\n for (var prop in style) {\n if (prop === \"__size\")\n continue;\n instance.style[prop] = style[prop];\n }\n }\n };\n DOMWatcher.prototype.setup = function () {\n var _this = this;\n if (typeof document === \"undefined\")\n return;\n this.program\n .constants({ tagPrefix: this.tagPrefix })\n .commit(\"Remove click events!\", function (_a) {\n var find = _a.find;\n var click = find(\"{{tagPrefix}}/event/click\");\n return [click.remove()];\n })\n .bind(\"Create instances for each root.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib;\n var elem = find(\"{{tagPrefix}}/root\");\n return [\n record(\"{{tagPrefix}}/instance\", { element: elem, tagname: elem.tagname })\n ];\n })\n .bind(\"Create an instance for each child of a rooted parent.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib;\n var elem = find(\"{{tagPrefix}}/element\");\n var parentElem = find(\"{{tagPrefix}}/element\", { children: elem });\n var parent = find(\"{{tagPrefix}}/instance\", { element: parentElem });\n return [\n record(\"{{tagPrefix}}/instance\", { element: elem, tagname: elem.tagname, parent: parent })\n ];\n })\n .watch(\"Export all instances.\", function (_a) {\n var find = _a.find, record = _a.record;\n var instance = find(\"{{tagPrefix}}/instance\");\n return [\n record({ tagname: instance.tagname, element: instance.element, instance: instance })\n ];\n })\n .asObjects(function (diff) {\n for (var _i = 0, _a = Object.keys(diff.removes); _i < _a.length; _i++) {\n var e = _a[_i];\n var instanceId = diff.removes[e].instance;\n _this.clearInstance(instanceId);\n }\n for (var _b = 0, _c = Object.keys(diff.adds); _b < _c.length; _b++) {\n var e = _c[_b];\n var _d = diff.adds[e], instanceId = _d.instance, tagname = _d.tagname, element = _d.element;\n _this.addInstance(instanceId, element, tagname);\n }\n })\n .watch(\"Export roots.\", function (_a) {\n var find = _a.find, record = _a.record;\n var root = find(\"{{tagPrefix}}/root\");\n var instance = find(\"{{tagPrefix}}/instance\", { element: root });\n return [\n record({ instance: instance })\n ];\n })\n .asDiffs(function (diff) {\n for (var _i = 0, _a = diff.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], rootId = _b[2];\n _this.clearRoot(rootId);\n }\n for (var _c = 0, _d = diff.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], rootId = _e[2];\n _this.roots[rootId] = _this.createRoot(rootId);\n }\n })\n .watch(\"Export instance parents.\", function (_a) {\n var find = _a.find, record = _a.record;\n var instance = find(\"{{tagPrefix}}/instance\");\n return [\n record({ instance: instance, parent: instance.parent })\n ];\n })\n .asObjects(function (diff) {\n for (var _i = 0, _a = Object.keys(diff.removes); _i < _a.length; _i++) {\n var e = _a[_i];\n var _b = diff.removes[e], instanceId = _b.instance, parentId = _b.parent;\n var instance = _this.getInstance(instanceId);\n var parent_1 = _this.getInstance(parentId);\n if (!instance || !parent_1)\n continue;\n if (instance && instance.parentElement) {\n instance.parentElement.removeChild(instance);\n }\n }\n for (var _c = 0, _d = Object.keys(diff.adds); _c < _d.length; _c++) {\n var e = _d[_c];\n var _e = diff.adds[e], instanceId = _e.instance, parentId = _e.parent;\n var instance = _this.getInstance(instanceId);\n if (!instance)\n throw new Error(\"Orphaned instance '\" + instanceId + \"'\");\n var parent_2 = _this.getInstance(parentId);\n if (!parent_2)\n throw new Error(\"Missing parent instance '\" + parentId + \"', \" + instanceId);\n _this.insertChild(parent_2, instance);\n }\n })\n .watch(\"Export element styles.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib, lookup = _a.lookup;\n var elem = find(\"{{tagPrefix}}/element\");\n var style = elem.style;\n var _b = lookup(style), attribute = _b.attribute, value = _b.value;\n return [\n style.add(attribute, value)\n ];\n })\n .asDiffs(function (diff) {\n var maybeGC = [];\n for (var _i = 0, _a = diff.removes; _i < _a.length; _i++) {\n var _b = _a[_i], styleId = _b[0], a = _b[1], v = _b[2];\n maybeGC.push(styleId);\n _this.setStyleAttribute(styleId, a, v, -1);\n }\n for (var _c = 0, _d = diff.adds; _c < _d.length; _c++) {\n var _e = _d[_c], styleId = _e[0], a = _e[1], v = _e[2];\n _this.setStyleAttribute(styleId, a, v, 1);\n }\n for (var _f = 0, maybeGC_1 = maybeGC; _f < maybeGC_1.length; _f++) {\n var styleId = maybeGC_1[_f];\n var style = _this.getStyle(styleId);\n if (style.__size === 0) {\n _this.styles[styleId] = undefined;\n }\n }\n })\n .watch(\"Export element attributes.\", function (_a) {\n var find = _a.find, record = _a.record, lookup = _a.lookup;\n var instance = find(\"{{tagPrefix}}/instance\");\n var elem = instance.element;\n var _b = lookup(elem), attribute = _b.attribute, value = _b.value;\n attribute != \"class\";\n return [\n instance.add(attribute, value)\n ];\n })\n .asDiffs(function (diff) {\n for (var _i = 0, _a = diff.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n var instance = _this.getInstance(e);\n if (!instance)\n continue;\n if (a === \"tagname\")\n continue;\n else if (a === \"children\")\n continue;\n else if (a === \"sort\")\n continue; // I guess..?\n else if (a === \"eve-auto-index\")\n continue; // I guess..?\n else if (a === \"text\")\n instance.textContent = null;\n else if (a === \"style\")\n _this.removeStyleInstance(v, e);\n else\n _this.removeAttribute(instance, a, watcher_1.asJS(v));\n }\n for (var _c = 0, _d = diff.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], v = _e[2];\n var instance = _this.getInstance(e);\n if (!instance)\n throw new Error(\"Orphaned instance '\" + e + \"'\");\n else if ((a === \"tagname\"))\n continue;\n else if (a === \"children\")\n continue;\n else if (a === \"sort\")\n _this.insertChild(instance.parentElement, instance, v);\n else if (a === \"eve-auto-index\")\n _this.insertChild(instance.parentElement, instance, v);\n else if (a === \"text\")\n instance.textContent = \"\" + v;\n else if (a === \"style\")\n _this.addStyleInstance(v, e);\n else\n _this.addAttribute(instance, a, watcher_1.asJS(v));\n }\n })\n .watch(\"Export static classes.\", function (_a) {\n var find = _a.find, not = _a.not, lookup = _a.lookup;\n var instance = find(\"{{tagPrefix}}/instance\");\n var elem = instance.element;\n var klass = elem.class;\n not(function () { return lookup(klass); });\n return [instance.add(\"class\", klass)];\n })\n .asDiffs(function (diff) {\n for (var _i = 0, _a = diff.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n var instance = _this.getInstance(e);\n if (!instance)\n continue;\n for (var _c = 0, _d = (\"\" + v).split(\" \"); _c < _d.length; _c++) {\n var klass = _d[_c];\n if (!klass)\n continue;\n instance.classList.remove(klass);\n }\n }\n for (var _e = 0, _f = diff.adds; _e < _f.length; _e++) {\n var _g = _f[_e], e = _g[0], a = _g[1], v = _g[2];\n var instance = _this.getInstance(e);\n if (!instance)\n throw new Error(\"Orphaned instance '\" + e + \"'\");\n for (var _h = 0, _j = (\"\" + v).split(\" \"); _h < _j.length; _h++) {\n var klass = _j[_h];\n if (!klass)\n continue;\n instance.classList.add(klass);\n }\n }\n })\n .bind(\"Elements with a dynamic class record apply classes for each true attribute.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var element = find(\"{{tagPrefix}}/element\");\n var _b = lookup(element.class), attribute = _b.attribute, value = _b.value;\n value == \"true\";\n return [\n element.add(\"class\", attribute)\n ];\n });\n };\n return DOMWatcher;\n}(watcher_1.Watcher));\nexports.DOMWatcher = DOMWatcher;\n//# sourceMappingURL=dom.js.map\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(setImmediate) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar dom_1 = __webpack_require__(41);\nvar HTMLWatcher = (function (_super) {\n __extends(HTMLWatcher, _super);\n function HTMLWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.tagPrefix = \"html\";\n _this._keyMap = {\n 9: \"tab\",\n 13: \"enter\",\n 16: \"shift\",\n 17: \"control\",\n 18: \"alt\",\n 27: \"escape\",\n 37: \"left\",\n 38: \"up\",\n 39: \"right\",\n 40: \"down\",\n 91: \"meta\"\n };\n return _this;\n }\n HTMLWatcher.prototype.addExternalRoot = function (tag, element) {\n var elemId = watcher_1.createId();\n var eavs = [\n [elemId, \"tag\", tag],\n [elemId, \"tag\", \"html/root/external\"]\n ];\n this.instances[elemId] = element;\n this._sendEvent(eavs);\n };\n HTMLWatcher.prototype.createInstance = function (id, element, tagname) {\n var elem;\n if (tagname === \"svg\")\n elem = document.createElementNS(\"http://www.w3.org/2000/svg\", tagname);\n else\n elem = document.createElement(tagname);\n elem.setAttribute(\"instance\", \"\" + watcher_1.maybeIntern(id));\n elem.setAttribute(\"element\", \"\" + watcher_1.maybeIntern(element));\n elem.__element = element;\n elem.__styles = [];\n return elem;\n };\n HTMLWatcher.prototype.getInstance = function (id) {\n return this.instances[id];\n };\n HTMLWatcher.prototype.createRoot = function (id) {\n var elem = this.instances[id];\n if (!elem)\n throw new Error(\"Orphaned instance '\" + id + \"'\");\n document.body.appendChild(elem);\n return elem;\n };\n HTMLWatcher.prototype.addAttribute = function (instance, attribute, value) {\n // @TODO: Error checking to ensure we don't double-set attributes.\n if (attribute == \"value\") {\n if (instance.classList.contains(\"html-autosize-input\") && instance instanceof HTMLInputElement) {\n instance.size = (instance.value || \"\").length || 1;\n }\n instance.value = \"\" + value;\n }\n else if (attribute == \"tag\") {\n if (value === \"html/autosize-input\" && instance instanceof HTMLInputElement) {\n setImmediate(function () { return instance.size = (instance.value || \"\").length || 1; });\n }\n else if (value === \"html/trigger/focus\" && instance instanceof HTMLInputElement) {\n setImmediate(function () { return instance.focus(); });\n }\n else if (value === \"html/trigger/blur\" && instance instanceof HTMLInputElement) {\n setImmediate(function () { return instance.blur(); });\n }\n else {\n instance.setAttribute(attribute, \"\" + value);\n }\n }\n else if (value === false) {\n instance.removeAttribute(attribute);\n }\n else {\n instance.setAttribute(attribute, \"\" + watcher_1.maybeIntern(value));\n }\n };\n HTMLWatcher.prototype.removeAttribute = function (instance, attribute, value) {\n // @TODO: Error checking to ensure we don't double-remove attributes or remove the wrong value.\n instance.removeAttribute(attribute);\n if (attribute === \"value\") {\n var input = instance;\n if (input.value === value)\n input.value = \"\";\n }\n };\n HTMLWatcher.prototype._updateURL = function (tagname) {\n if (tagname === void 0) { tagname = \"url-change\"; }\n var eventId = watcher_1.createId();\n var eavs = [\n [eventId, \"tag\", \"html/event\"],\n [eventId, \"tag\", \"html/event/\" + tagname]\n ];\n var hash = window.location.hash.slice(1);\n var ix = 1;\n for (var _i = 0, _a = hash.split(\"/\"); _i < _a.length; _i++) {\n var segment = _a[_i];\n var segmentId = watcher_1.createId();\n eavs.push([eventId, \"hash-segment\", segmentId], [segmentId, \"index\", ix], [segmentId, \"value\", segment]);\n ix += 1;\n }\n this._sendEvent(eavs);\n };\n //------------------------------------------------------------------\n // Event handlers\n //------------------------------------------------------------------\n HTMLWatcher.prototype._mouseEventHandler = function (tagname) {\n var _this = this;\n return function (event) {\n var target = event.target;\n if (!_this.isInstance(target))\n return;\n var eventId = watcher_1.createId();\n var eavs = [\n [eventId, \"tag\", \"html/event\"],\n [eventId, \"tag\", \"html/event/\" + tagname],\n [eventId, \"page-x\", event.pageX],\n [eventId, \"page-y\", event.pageY],\n [eventId, \"window-x\", event.clientX],\n [eventId, \"window-y\", event.clientY],\n [eventId, \"target\", target.__element]\n ];\n var button = event.button;\n if (button === 0)\n eavs.push([eventId, \"button\", \"left\"]);\n else if (button === 2)\n eavs.push([eventId, \"button\", \"right\"]);\n else if (button === 1)\n eavs.push([eventId, \"button\", \"middle\"]);\n else if (button)\n eavs.push([eventId, \"button\", button]);\n var current = target;\n var elemIds = [];\n var capturesContextMenu = false;\n while (current && _this.isInstance(current)) {\n eavs.push([eventId, \"element\", current.__element]);\n if (button === 2 && current.listeners && current.listeners[\"context-menu\"] === true) {\n capturesContextMenu = true;\n }\n current = current.parentElement;\n }\n // @NOTE: You'll get a mousedown but no mouseup for a right click if you don't capture the context menu,\n // so we throw out the mousedown entirely in that case. :(\n if (button === 2 && !capturesContextMenu)\n return;\n if (eavs.length)\n _this._sendEvent(eavs);\n };\n };\n HTMLWatcher.prototype._captureContextMenuHandler = function () {\n var _this = this;\n return function (event) {\n var captureContextMenu = false;\n var current = event.target;\n while (current && _this.isInstance(current)) {\n if (current.listeners && current.listeners[\"context-menu\"] === true) {\n captureContextMenu = true;\n }\n current = current.parentElement;\n }\n if (captureContextMenu && event.button === 2) {\n event.preventDefault();\n }\n };\n };\n HTMLWatcher.prototype._inputEventHandler = function (tagname) {\n var _this = this;\n return function (event) {\n var target = event.target;\n var elementId = target.__element;\n if (elementId) {\n if (target.classList.contains(\"html-autosize-input\")) {\n target.size = target.value.length || 1;\n }\n var eventId = watcher_1.createId();\n var eavs = [\n [eventId, \"tag\", \"html/event\"],\n [eventId, \"tag\", \"html/event/\" + tagname],\n [eventId, \"element\", elementId],\n [eventId, \"value\", target.value]\n ];\n if (eavs.length)\n _this._sendEvent(eavs);\n }\n };\n };\n HTMLWatcher.prototype._keyEventHandler = function (tagname) {\n var _this = this;\n return function (event) {\n if (event.repeat)\n return;\n var current = event.target;\n var code = event.keyCode;\n var key = _this._keyMap[code];\n var eventId = watcher_1.createId();\n var eavs = [\n [eventId, \"tag\", \"html/event\"],\n [eventId, \"tag\", \"html/event/\" + tagname],\n [eventId, \"key-code\", code]\n ];\n if (key)\n eavs.push([eventId, \"key\", key]);\n while (current && _this.isInstance(current)) {\n var elemId = current.__element;\n eavs.push([eventId, \"element\", elemId]);\n current = current.parentElement;\n }\n ;\n if (eavs.length)\n _this._sendEvent(eavs);\n };\n };\n HTMLWatcher.prototype._focusEventHandler = function (tagname) {\n var _this = this;\n return function (event) {\n var target = event.target;\n var elementId = target.__element;\n if (elementId) {\n var eventId = watcher_1.createId();\n var eavs = [\n [eventId, \"tag\", \"html/event\"],\n [eventId, \"tag\", \"html/event/\" + tagname],\n [eventId, \"element\", elementId]\n ];\n if (target.value !== undefined)\n eavs.push([eventId, \"value\", target.value]);\n if (eavs.length)\n _this._sendEvent(eavs);\n }\n };\n };\n HTMLWatcher.prototype._hoverEventHandler = function (tagname) {\n var _this = this;\n return function (event) {\n var target = event.target;\n if (!_this.isInstance(target))\n return;\n var eavs = [];\n var elemId = target.__element;\n if (target.listeners && target.listeners[\"hover\"]) {\n var eventId = watcher_1.createId();\n eavs.push([eventId, \"tag\", \"html/event\"], [eventId, \"tag\", \"html/event/\" + tagname], [eventId, \"element\", elemId]);\n }\n if (eavs.length)\n _this._sendEvent(eavs);\n };\n };\n HTMLWatcher.prototype._hashChangeHandler = function (tagname) {\n var _this = this;\n return function (event) {\n _this._updateURL(tagname);\n };\n };\n //------------------------------------------------------------------\n // Watcher handlers\n //------------------------------------------------------------------\n HTMLWatcher.prototype.exportListeners = function (_a) {\n var adds = _a.adds, removes = _a.removes;\n for (var _i = 0, _b = Object.keys(adds); _i < _b.length; _i++) {\n var e = _b[_i];\n var _c = adds[e], listener = _c.listener, elemId = _c.elemId, instanceId = _c.instanceId;\n var instance = this.getInstance(instanceId);\n if (!instance.listeners)\n instance.listeners = {};\n instance.listeners[listener] = true;\n }\n for (var _d = 0, _e = Object.keys(removes); _d < _e.length; _d++) {\n var e = _e[_d];\n var _f = removes[e], listener = _f.listener, elemId = _f.elemId, instanceId = _f.instanceId;\n var instance = this.getInstance(instanceId);\n if (!instance || !instance.listeners)\n continue;\n instance.listeners[listener] = false;\n }\n };\n //------------------------------------------------------------------\n // Setup\n //------------------------------------------------------------------\n HTMLWatcher.prototype.setup = function () {\n var _this = this;\n if (typeof window === \"undefined\")\n return;\n this.tagPrefix = \"html\"; // @FIXME: hacky, due to inheritance chain evaluation order.\n _super.prototype.setup.call(this);\n this.program\n .bind(\"All html elements add their tags as classes\", function (_a) {\n var find = _a.find, string = _a.lib.string, record = _a.record;\n var element = find(\"html/element\");\n element.tag != \"html/element\";\n var klass = string.replace(element.tag, \"/\", \"-\");\n return [\n element.add(\"class\", klass)\n ];\n });\n window.addEventListener(\"click\", this._mouseEventHandler(\"click\"));\n window.addEventListener(\"dblclick\", this._mouseEventHandler(\"double-click\"));\n window.addEventListener(\"mousedown\", this._mouseEventHandler(\"mouse-down\"));\n window.addEventListener(\"mouseup\", this._mouseEventHandler(\"mouse-up\"));\n window.addEventListener(\"contextmenu\", this._captureContextMenuHandler());\n window.addEventListener(\"input\", this._inputEventHandler(\"change\"));\n window.addEventListener(\"keydown\", this._keyEventHandler(\"key-down\"));\n window.addEventListener(\"keyup\", this._keyEventHandler(\"key-up\"));\n window.addEventListener(\"focus\", this._focusEventHandler(\"focus\"), true);\n window.addEventListener(\"blur\", this._focusEventHandler(\"blur\"), true);\n document.body.addEventListener(\"mouseenter\", this._hoverEventHandler(\"hover-in\"), true);\n document.body.addEventListener(\"mouseleave\", this._hoverEventHandler(\"hover-out\"), true);\n window.addEventListener(\"hashchange\", this._hashChangeHandler(\"url-change\"));\n this.program\n .bind(\"Elements with no parents are roots.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib, not = _a.not;\n var elem = find(\"html/element\");\n not(function () { return find(\"html/element\", { children: elem }); });\n return [\n elem.add(\"tag\", \"html/root\")\n ];\n })\n .bind(\"Create an instance for each child of an external root.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib, not = _a.not;\n var elem = find(\"html/element\");\n var parent = find(\"html/root/external\", { children: elem });\n return [\n record(\"html/instance\", { element: elem, tagname: elem.tagname, parent: parent }),\n parent.add(\"tag\", \"html/element\")\n ];\n });\n this.program\n .commit(\"Remove html events.\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var event = find(\"html/event\");\n return [event.remove()];\n })\n .bind(\"Inputs with an initial but no value use the initial.\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var input = find(\"html/element\", { tagname: \"input\" });\n var value = choose(function () { return input.value; }, function () { return input.initial; })[0];\n return [input.add(\"value\", value)];\n })\n .commit(\"Apply input value changes.\", function (_a) {\n var find = _a.find;\n var _b = find(\"html/event/change\"), element = _b.element, value = _b.value;\n return [element.remove(\"value\").add(\"value\", value)];\n })\n .commit(\"When an element is entered, mark it hovered.\", function (_a) {\n var find = _a.find, record = _a.record;\n var element = find(\"html/event/hover-in\").element;\n return [element.add(\"tag\", \"html/hovered\")];\n })\n .commit(\"When an element is left, clear it's hovered.\", function (_a) {\n var find = _a.find, record = _a.record;\n var element = find(\"html/event/hover-out\").element;\n return [element.remove(\"tag\", \"html/hovered\")];\n })\n .watch(\"When an element is hoverable, it subscribes to mouseover/mouseout.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elemId = find(\"html/listener/hover\");\n var instanceId = find(\"html/instance\", { element: elemId });\n return [record({ listener: \"hover\", elemId: elemId, instanceId: instanceId })];\n })\n .asObjects(function (diffs) { return _this.exportListeners(diffs); })\n .watch(\"When an element listeners for context-menu, it prevents default on right click.\", function (_a) {\n var find = _a.find, record = _a.record;\n var elemId = find(\"html/listener/context-menu\");\n var instanceId = find(\"html/instance\", { element: elemId });\n return [record({ listener: \"context-menu\", elemId: elemId, instanceId: instanceId })];\n })\n .asObjects(function (diffs) { return _this.exportListeners(diffs); })\n .commit(\"When the url changes, delete its previous segments.\", function (_a) {\n var find = _a.find, record = _a.record;\n var change = find(\"html/event/url-change\");\n var url = find(\"html/url\");\n return [\n url.remove(\"hash-segment\"),\n url[\"hash-segment\"].remove()\n ];\n })\n .commit(\"When the url changes, commit its new state.\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var change = find(\"html/event/url-change\");\n var _b = lookup(change), attribute = _b.attribute, value = _b.value;\n attribute != \"tag\";\n return [\n record(\"html/url\").add(attribute, value)\n ];\n });\n //setTimeout(() => this._updateURL(), 100);\n this._updateURL();\n };\n return HTMLWatcher;\n}(dom_1.DOMWatcher));\nexports.HTMLWatcher = HTMLWatcher;\nwatcher_1.Watcher.register(\"html\", HTMLWatcher);\n//# sourceMappingURL=html.js.map\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).setImmediate))\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar dom_1 = __webpack_require__(41);\nvar SVGWatcher = (function (_super) {\n __extends(SVGWatcher, _super);\n function SVGWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.tagPrefix = \"svg\";\n return _this;\n }\n SVGWatcher.prototype.createInstance = function (id, element, tagname) {\n var elem = document.createElementNS(\"http://www.w3.org/2000/svg\", tagname);\n elem.__element = element;\n elem.__styles = [];\n return elem;\n };\n SVGWatcher.prototype.getInstance = function (id) {\n if (this.instances[id])\n return this.instances[id];\n if (this.html.instances[id])\n return this.html.instances[id];\n };\n SVGWatcher.prototype.createRoot = function (id) {\n // This is delegated to the HTML watcher for #svg/roots, and it's nonsensical to try to make any other svg element a root.\n return undefined;\n };\n SVGWatcher.prototype.addAttribute = function (instance, attribute, value) {\n // @TODO: Namespace attributes as appropriate.\n instance.setAttribute(attribute, value);\n };\n SVGWatcher.prototype.removeAttribute = function (instance, attribute, value) {\n // @TODO: Namespace attributes as appropriate.\n instance.removeAttribute(attribute);\n };\n SVGWatcher.prototype.setup = function () {\n this.html = this.program.attach(\"html\");\n this.tagPrefix = \"svg\";\n _super.prototype.setup.call(this);\n this.program\n .bind(\"Create an instance for each child of an svg/root.\", function (_a) {\n var find = _a.find, record = _a.record, lib = _a.lib;\n var elem = find(\"svg/element\");\n var parentElem = find(\"svg/root\", { children: elem });\n var parent = find(\"html/instance\", { element: parentElem });\n return [\n record(\"svg/instance\", { element: elem, tagname: elem.tagname, parent: parent })\n ];\n })\n .bind(\"Decorate a svg roots as html.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/root\");\n return [elem.add({ tag: \"html/element\", tagname: \"svg\" })];\n })\n .bind(\"Decorate line as svg.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/line\");\n return [elem.add({ tag: \"svg/element\", tagname: \"line\" })];\n })\n .bind(\"Decorate circle as svg.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/circle\");\n return [elem.add({ tag: \"svg/element\", tagname: \"circle\" })];\n })\n .bind(\"Decorate rect as svg.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/rect\");\n return [elem.add({ tag: \"svg/element\", tagname: \"rect\" })];\n })\n .bind(\"Decorate text as svg.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/text\");\n return [elem.add({ tag: \"svg/element\", tagname: \"text\" })];\n })\n .bind(\"Decorate image as svg.\", function (_a) {\n var find = _a.find;\n var elem = find(\"svg/image\");\n return [elem.add({ tag: \"svg/element\", tagname: \"image\" })];\n });\n };\n return SVGWatcher;\n}(dom_1.DOMWatcher));\nexports.SVGWatcher = SVGWatcher;\nwatcher_1.Watcher.register(\"svg\", SVGWatcher);\n//# sourceMappingURL=svg.js.map\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar SystemWatcher = (function (_super) {\n __extends(SystemWatcher, _super);\n function SystemWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.timers = {};\n return _this;\n }\n SystemWatcher.prototype.getTime = function (changes, timer, tick, date) {\n var multiplicity = -1;\n if (!date) {\n multiplicity = 1;\n date = new Date();\n }\n changes.push([timer, \"year\", date.getFullYear(), multiplicity], [timer, \"month\", date.getMonth() + 1, multiplicity], [timer, \"day\", date.getDate(), multiplicity], [timer, \"weekday\", date.getDay() + 1, multiplicity], [timer, \"hour\", date.getHours(), multiplicity], [timer, \"minute\", date.getMinutes(), multiplicity], [timer, \"second\", date.getSeconds(), multiplicity], [timer, \"millisecond\", date.getMilliseconds(), multiplicity], [timer, \"timestamp\", date.getTime(), multiplicity], [timer, \"tick\", tick, multiplicity]);\n return date;\n };\n SystemWatcher.prototype.setup = function () {\n var _this = this;\n var me = this.program;\n me.watch(\"setup timers\", function (_a) {\n var find = _a.find, record = _a.record;\n var timer = find(\"system/timer\");\n return [\n record({ timer: timer, resolution: timer.resolution })\n ];\n });\n me.asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n Object.keys(adds).forEach(function (id) {\n var _a = adds[id], timer = _a.timer, resolution = _a.resolution;\n var prev;\n var timerHandle = setInterval(function () {\n var _a = _this.timers[id], prev = _a.prev, tick = _a.tick;\n var changes = [];\n if (prev) {\n _this.getTime(changes, timer, tick, prev);\n }\n _this.timers[id].tick = ++tick;\n _this.timers[id].prev = _this.getTime(changes, timer, tick);\n me.inputEAVs(changes);\n }, resolution);\n _this.timers[id] = { timer: timerHandle, prev: undefined, tick: 0 };\n });\n console.log(\"GOT TIMER!\", adds);\n });\n };\n return SystemWatcher;\n}(watcher_1.Watcher));\nexports.SystemWatcher = SystemWatcher;\nwatcher_1.Watcher.register(\"system\", SystemWatcher);\n//# sourceMappingURL=system.js.map\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.eve = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n__webpack_require__(39);\n\n__webpack_require__(40);\n\n__webpack_require__(42);\n\n__webpack_require__(43);\n\n__webpack_require__(44);\n\n__webpack_require__(21);\n\nvar _uuid = __webpack_require__(7);\n\nvar _witheve = __webpack_require__(80);\n\nvar _widget = __webpack_require__(91);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // witheve-watchers is defined via webpack alias\n\n\nvar EveWidget = function (_Widget) {\n _inherits(EveWidget, _Widget);\n\n function EveWidget(parseTreeNode, options) {\n _classCallCheck(this, EveWidget);\n\n var _this = _possibleConstructorReturn(this, (EveWidget.__proto__ || Object.getPrototypeOf(EveWidget)).call(this, parseTreeNode, options));\n\n _this.logger = new $tw.utils.Logger('eve-widget');\n return _this;\n }\n\n _createClass(EveWidget, [{\n key: \"render\",\n value: function render(parent, nextSibling) {\n if (!$tw.browser) {\n return;\n }\n this.logger.log('Rendering eve DOM nodes');\n this.computeAttributes();\n this.parentDomNode = parent;\n this.domNode = $tw.utils.domMaker('div', {\n document: this.document,\n class: 'tc-widget'\n });\n parent.insertBefore(this.domNode, nextSibling);\n this.domNodes.push(this.domNode); // So refreshSelf will clean up old domNode\n\n // Creating a new program every time with no cleanup\n // seems like a bad idea. TW requires a workaround in order\n // to cleanup (see https://github.com/Jermolene/TiddlyWiki5/issues/1784)\n // Mabye a differenet approach is needed. For demonstration\n // purposes, this is fine\n this.prog = new _witheve.Program(\"tw eve widget\");\n var htmlWatcher = this.prog.attach(\"html\");\n this.prog.attach(\"canvas\");\n this.prog.attach(\"svg\");\n this.prog.attach(\"system\");\n\n // Define the eve program\n this.eveSource = this.getEveSource(this.getAttribute(\"markdown\"), this.getAttribute(\"filter\"));\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this.eveSource[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var source = _step.value;\n\n try {\n this.prog.load(source);\n } catch (ex) {\n var errorNode = $tw.utils.domMaker('div', {\n document: this.document,\n class: 'eve-compiler-error-message',\n text: 'Parser exception: ' + ex.message\n });\n parent.insertBefore(errorNode, nextSibling);\n this.domNodes.push(errorNode);\n }\n }\n\n // Attach a watcher for persisting data. Only if the user gave a\n // tiddler in which the data should be saved\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var saveTitle = this.getAttribute(\"save-tiddler\");\n if (saveTitle) {\n this.watchForPersistChanges(saveTitle);\n this.loadDataFromTiddler(saveTitle);\n }\n\n // addExternalRoot must come after the program is defined\n // or it won't work\n htmlWatcher.addExternalRoot(\"tw-widget-root\", this.domNode);\n\n // Add unique program record to help disambiguate html events\n // See https://github.com/witheve/Eve/issues/844\n this.prog.inputEAVs([[(0, _uuid.v4)(), \"tag\", \"program\"]]);\n }\n }, {\n key: \"getEveSource\",\n value: function getEveSource(markdown, filter) {\n var eveSource = [];\n if (markdown) {\n eveSource.push(markdown);\n }\n if (filter) {\n var tiddlers = this.wiki.filterTiddlers(filter, this);\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = tiddlers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var title = _step2.value;\n\n var tiddler = this.wiki.getTiddler(title);\n if (tiddler) {\n eveSource.push(tiddler.getFieldString(\"text\"));\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n\n // Append an eve block to the end so any root-less html elements\n // will automatically be attached to the widget rather than to\n // the document body. Code compliments of Josh Cole.\n eveSource.push(\"\\nAny element with no parent (or that is already a child of the widget root) is parented to the widget root.\\n~~~\\n search\\n widget-root = [#tw-widget-root]\\n elem = [#html/element]\\n elem != widget-root\\n not(\\n parent = [#html/element children: elem]\\n parent != [#tw-widget-root]\\n )\\n\\n bind\\n widget-root.children += elem\\n~~~\\n\\nThe extra bit of trickery in the 'not' is required to prevent the block from\\ninvalidating itself. If we kept the existing search logic, it would first match\\na root element, adding it as a child of the widget. Doing so would make it no\\nlonger match, so it would stop being a child. This would allow it to match\\nagain, ad infinitum. Instead, we include the loophole that, if an element's\\nparent is already the widget, we'll continue asserting that.\\n \");\n\n return eveSource;\n }\n\n //\n // With two eve records like this:\n //\n // [#counter #persist sort: 1 count: 0]\n // [#counter #persist sort: 2 count: 0]\n //\n // The eavs come out to the watcher looking like this:\n //\n // [ \"count|0|sort|1|tag|counter|tag|persist\", \"tag\", \"counter\" ],\n // [ \"count|0|sort|1|tag|counter|tag|persist\", \"tag\", \"persist\" ],\n // [ \"count|0|sort|1|tag|counter|tag|persist\", \"sort\", 1 ],\n // [ \"count|0|sort|1|tag|counter|tag|persist\", \"count\", 0 ],\n // [ \"count|0|sort|2|tag|counter|tag|persist\", \"tag\", \"counter\" ],\n // [ \"count|0|sort|2|tag|counter|tag|persist\", \"tag\", \"persist\" ],\n // [ \"count|0|sort|2|tag|counter|tag|persist\", \"sort\", 2 ],\n // [ \"count|0|sort|2|tag|counter|tag|persist\", \"count\", 0 ]\n //\n // The 'e' from the eav is used as the tiddler field name and the attributes and values are\n // grouped together like this:\n //\n // eve-count|0|sort|1|tag|counter|tag|persist - {\"tag\":[\"counter\",\"persist\"],\"sort\":[1],\"count\":[0]}\n // eve-count|0|sort|2|tag|counter|tag|persist - {\"tag\":[\"counter\",\"persist\"],\"sort\":[2],\"count\":[0]}\n //\n\n }, {\n key: \"watchForPersistChanges\",\n value: function watchForPersistChanges(saveTitle) {\n var _this2 = this;\n\n this.prog.watch(\"Export #persist tagged data to a tiddler\", function (_ref) {\n var find = _ref.find,\n record = _ref.record,\n lookup = _ref.lookup;\n\n var rec = find(\"persist\");\n\n var _lookup = lookup(rec),\n attribute = _lookup.attribute,\n value = _lookup.value;\n\n return [rec.add(attribute, value)];\n })\n // Each entity (e) in the eav diffs is used as a tiddler field name with stringified\n // json of the attribute (a) and values (v) stored as the tiddler field value.\n .asDiffs(function (_ref2) {\n var adds = _ref2.adds,\n removes = _ref2.removes;\n\n _this2.logger.log(\"obj add \" + JSON.stringify(adds));\n _this2.logger.log(\"obj rem \" + JSON.stringify(removes));\n var saveTiddler = _this2.wiki.getTiddler(saveTitle);\n\n // The p object is used to build up the tiddler field value pairs related to the\n // eav which have been passed in as adds and removes\n var p = {};\n\n // The outer loop is for handling both the adds and the removes. The code is the same for\n // both except the adds add set elements and the removes delete set elements\n var _arr = [[adds, function (s, v) {\n s.add(v);\n }], [removes, function (s, v) {\n s.delete(v);\n }]];\n for (var _i = 0; _i < _arr.length; _i++) {\n var _ref3 = _arr[_i];\n\n var _ref4 = _slicedToArray(_ref3, 2);\n\n var eav = _ref4[0];\n var setop = _ref4[1];\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = eav[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref5 = _step3.value;\n\n var _ref6 = _slicedToArray(_ref5, 3);\n\n var _e = _ref6[0];\n var _a = _ref6[1];\n var v = _ref6[2];\n\n // Have we already seen this 'e' since the method call started?\n if (!p.hasOwnProperty(_e)) {\n // No. Create it fresh\n p[_e] = {};\n\n // Does the tiddler to which the data will be saved exist yet?\n if (saveTiddler) {\n // Yes. Since the tiddler exists there may be previously\n // persisted values which the diffs need to be \"merged\" with\n // The eve related fields have 'eve-' prefix so the list of\n // fields can be queried later and the non-eve related ones\n // can be filtered out.\n var json = saveTiddler.getFieldString(\"eve-\" + _e);\n\n // Does the 'e' field already exist in the tiddler?\n if (json) {\n // Yes. Parse the key/value json into javascript object\n var avs = JSON.parse(json);\n\n // Each value is a Set, but in json it has to be stored\n // as array, so convert each array into a Set\n for (var key in avs) {\n p[_e][key] = new Set(avs[key]);\n }\n }\n }\n }\n\n // Does the ea already exist from the data in the tiddler?\n if (!p[_e].hasOwnProperty(_a)) {\n // No. Create it fresh\n p[_e][_a] = new Set();\n }\n\n // Either add or remove the element from the ea set\n setop(p[_e][_a], v);\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n }\n //var tw = {};\n\n // Now the diffs have been applied and the data can be written\n // back to the tiddler\n for (var e in p) {\n // In order to serialize to json, convert Set to Array\n for (var a in p[e]) {\n // TODO: if p[e][a] has length zero, then should delete p[e][a]\n p[e][a] = Array.from(p[e][a]);\n }\n // TODO: if p[e] ends up empty, then the tiddler field should be deleted?\n //tw[e] = JSON.stringify(p[e]);\n _this2.wiki.setText(saveTitle, \"eve-\" + e, undefined, JSON.stringify(p[e]));\n }\n //console.log(JSON.stringify(tw));\n });\n }\n }, {\n key: \"loadDataFromTiddler\",\n value: function loadDataFromTiddler(saveTitle) {\n // If the tiddler already exists for the given saveTitle\n // then load the fields\n var saveTiddler = this.wiki.getTiddler(saveTitle);\n if (saveTiddler) {\n // Load the fields from the tiddler into EAVs\n var inputs = [];\n for (var fieldName in saveTiddler.fields) {\n if (fieldName.startsWith(\"eve-\")) {\n var avs = JSON.parse(saveTiddler.getFieldString(fieldName));\n var e = fieldName.substring(4);\n for (var a in avs) {\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = avs[a][Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var v = _step4.value;\n\n //console.log(\"pushing\");\n //console.log([e, a, v]);\n inputs.push([e, a, v]);\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n }\n }\n if (inputs.length > 0) {\n this.prog.inputEAVs(inputs);\n }\n }\n }\n\n // TODO: Also refresh if this.getAttribute(\"save-tiddler\") is in changedTiddlers\n // but need to figure out how to avoid circular updates\n\n }, {\n key: \"refresh\",\n value: function refresh(changedTiddlers) {\n // Refresh if the input sourcecode has changed\n this.computeAttributes();\n if (this.eveSource.join(\"\\n\") != this.getEveSource(this.getAttribute(\"markdown\"), this.getAttribute(\"filter\")).join(\"\\n\")) {\n // Source code has changed, so regenerate and rerender the widget and replace the existing DOM node\n this.prog.clear();\n this.refreshSelf();\n return true;\n } else {\n return false;\n }\n }\n }]);\n\n return EveWidget;\n}(_widget.widget);\n\nexports.eve = EveWidget;\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n(function (global, factory) {\n true ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.acorn = global.acorn || {})));\n}(this, (function (exports) { 'use strict';\n\n// Reserved word lists for various dialects of the language\n\nvar reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n}\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\"\n\nvar keywords = {\n 5: ecma5AndLessKeywords,\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n}\n\n// ## Character categories\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point above 128.\n// Generated by `bin/generate-identifier-regex.js`.\n\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0-\\u08b4\\u08b6-\\u08bd\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c88\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fd5\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7ae\\ua7b0-\\ua7b7\\ua7f7-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab65\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\"\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08d4-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c03\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0d01-\\u0d03\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf2-\\u1cf4\\u1cf8\\u1cf9\\u1dc0-\\u1df5\\u1dfb-\\u1dff\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua900-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\"\n\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\")\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\")\n\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range. They were\n// generated by bin/generate-identifier-regex.js\n\n// eslint-disable-next-line comma-spacing\nvar astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541]\n\n// eslint-disable-next-line comma-spacing\nvar astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239]\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n var pos = 0x10000\n for (var i = 0; i < set.length; i += 2) {\n pos += set[i]\n if (pos > code) return false\n pos += set[i + 1]\n if (pos >= code) return true\n }\n}\n\n// Test whether a given character code starts an identifier.\n\nfunction isIdentifierStart(code, astral) {\n if (code < 65) return code === 36\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nfunction isIdentifierChar(code, astral) {\n if (code < 48) return code === 36\n if (code < 58) return true\n if (code < 65) return false\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nvar TokenType = function TokenType(label, conf) {\n if ( conf === void 0 ) conf = {};\n\n this.label = label\n this.keyword = conf.keyword\n this.beforeExpr = !!conf.beforeExpr\n this.startsExpr = !!conf.startsExpr\n this.isLoop = !!conf.isLoop\n this.isAssign = !!conf.isAssign\n this.prefix = !!conf.prefix\n this.postfix = !!conf.postfix\n this.binop = conf.binop || null\n this.updateContext = null\n};\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nvar beforeExpr = {beforeExpr: true};\nvar startsExpr = {startsExpr: true};\n// Map keyword names to token types.\n\nvar keywordTypes = {}\n\n// Succinct definitions of keyword token types\nfunction kw(name, options) {\n if ( options === void 0 ) options = {};\n\n options.keyword = name\n return keywordTypes[name] = new TokenType(name, options)\n}\n\nvar tt = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"prefix\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=\", 6),\n relational: binop(\"</>\", 7),\n bitShift: binop(\"<</>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\"),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\"),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n}\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/\nvar lineBreakG = new RegExp(lineBreak.source, \"g\")\n\nfunction isNewLine(code) {\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\n}\n\nvar nonASCIIwhitespace = /[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/\n\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g\n\nvar ref = Object.prototype;\nvar hasOwnProperty = ref.hasOwnProperty;\nvar toString = ref.toString;\n\n// Checks if an object has a property.\n\nfunction has(obj, propName) {\n return hasOwnProperty.call(obj, propName)\n}\n\nvar isArray = Array.isArray || (function (obj) { return (\n toString.call(obj) === \"[object Array]\"\n); })\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nvar Position = function Position(line, col) {\n this.line = line\n this.column = col\n};\n\nPosition.prototype.offset = function offset (n) {\n return new Position(this.line, this.column + n)\n};\n\nvar SourceLocation = function SourceLocation(p, start, end) {\n this.start = start\n this.end = end\n if (p.sourceFile !== null) this.source = p.sourceFile\n};\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nfunction getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}\n\n// A second optional argument can be given to further configure\n// the parser process. These options are recognized:\n\nvar defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must\n // be either 3, 5, 6 (2015), 7 (2016), or 8 (2017). This influences support\n // for strict mode, the set of reserved words, and support for\n // new syntax features. The default is 7.\n ecmaVersion: 7,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called\n // when a semicolon is automatically inserted. It will be passed\n // th position of the comma as an offset, and if `locations` is\n // enabled, it is given the location as a `{line, column}` object\n // as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program.\n allowImportExportEverywhere: false,\n // When enabled, hashbang directive in the beginning of file\n // is allowed and treated as a line comment.\n allowHashBang: false,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false,\n plugins: {}\n}\n\n// Interpret and default an options object\n\nfunction getOptions(opts) {\n var options = {}\n\n for (var opt in defaultOptions)\n options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]\n\n if (options.ecmaVersion >= 2015)\n options.ecmaVersion -= 2009\n\n if (options.allowReserved == null)\n options.allowReserved = options.ecmaVersion < 5\n\n if (isArray(options.onToken)) {\n var tokens = options.onToken\n options.onToken = function (token) { return tokens.push(token); }\n }\n if (isArray(options.onComment))\n options.onComment = pushComment(options, options.onComment)\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n var comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n }\n if (options.locations)\n comment.loc = new SourceLocation(this, startLoc, endLoc)\n if (options.ranges)\n comment.range = [start, end]\n array.push(comment)\n }\n}\n\n// Registered plugins\nvar plugins = {}\n\nfunction keywordRegexp(words) {\n return new RegExp(\"^(\" + words.replace(/ /g, \"|\") + \")$\")\n}\n\nvar Parser = function Parser(options, input, startPos) {\n this.options = options = getOptions(options)\n this.sourceFile = options.sourceFile\n this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])\n var reserved = \"\"\n if (!options.allowReserved) {\n for (var v = options.ecmaVersion;; v--)\n if (reserved = reservedWords[v]) break\n if (options.sourceType == \"module\") reserved += \" await\"\n }\n this.reservedWords = keywordRegexp(reserved)\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict\n this.reservedWordsStrict = keywordRegexp(reservedStrict)\n this.reservedWordsStrictBind = keywordRegexp(reservedStrict + \" \" + reservedWords.strictBind)\n this.input = String(input)\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false\n\n // Load plugins\n this.loadPlugins(options.plugins)\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length\n } else {\n this.pos = this.lineStart = 0\n this.curLine = 1\n }\n\n // Properties of the current token:\n // Its type\n this.type = tt.eof\n // For tokens that include more information than their type, the value\n this.value = null\n // Its start and end offset\n this.start = this.end = this.pos\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition()\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null\n this.lastTokStart = this.lastTokEnd = this.pos\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext()\n this.exprAllowed = true\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\"\n this.strict = this.inModule || this.strictDirective(this.pos)\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1\n\n // Flags to track whether we are in a function, a generator, an async function.\n this.inFunction = this.inGenerator = this.inAsync = false\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = 0\n // Labels in scope.\n this.labels = []\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n this.skipLineComment(2)\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = []\n this.enterFunctionScope()\n};\n\n// DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them\nParser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) };\nParser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) };\n\nParser.prototype.extend = function extend (name, f) {\n this[name] = f(this[name])\n};\n\nParser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {\n var this$1 = this;\n\n for (var name in pluginConfigs) {\n var plugin = plugins[name]\n if (!plugin) throw new Error(\"Plugin '\" + name + \"' not found\")\n plugin(this$1, pluginConfigs[name])\n }\n};\n\nParser.prototype.parse = function parse () {\n var node = this.options.program || this.startNode()\n this.nextToken()\n return this.parseTopLevel(node)\n};\n\nvar pp = Parser.prototype\n\n// ## Parser utilities\n\nvar literal = /^(?:'((?:[^']|\\.)*)'|\"((?:[^\"]|\\.)*)\"|;)/\npp.strictDirective = function(start) {\n var this$1 = this;\n\n for (;;) {\n skipWhiteSpace.lastIndex = start\n start += skipWhiteSpace.exec(this$1.input)[0].length\n var match = literal.exec(this$1.input.slice(start))\n if (!match) return false\n if ((match[1] || match[2]) == \"use strict\") return true\n start += match[0].length\n }\n}\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp.eat = function(type) {\n if (this.type === type) {\n this.next()\n return true\n } else {\n return false\n }\n}\n\n// Tests whether parsed token is a contextual keyword.\n\npp.isContextual = function(name) {\n return this.type === tt.name && this.value === name\n}\n\n// Consumes contextual keyword if possible.\n\npp.eatContextual = function(name) {\n return this.value === name && this.eat(tt.name)\n}\n\n// Asserts that following token is given contextual keyword.\n\npp.expectContextual = function(name) {\n if (!this.eatContextual(name)) this.unexpected()\n}\n\n// Test whether a semicolon can be inserted at the current position.\n\npp.canInsertSemicolon = function() {\n return this.type === tt.eof ||\n this.type === tt.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n}\n\npp.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)\n return true\n }\n}\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp.semicolon = function() {\n if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()\n}\n\npp.afterTrailingComma = function(tokType, notNext) {\n if (this.type == tokType) {\n if (this.options.onTrailingComma)\n this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)\n if (!notNext)\n this.next()\n return true\n }\n}\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp.expect = function(type) {\n this.eat(type) || this.unexpected()\n}\n\n// Raise an unexpected token error.\n\npp.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\")\n}\n\nvar DestructuringErrors = function DestructuringErrors() {\n this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = -1\n};\n\npp.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) return\n if (refDestructuringErrors.trailingComma > -1)\n this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\")\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind\n if (parens > -1) this.raiseRecoverable(parens, \"Parenthesized pattern\")\n}\n\npp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n var pos = refDestructuringErrors ? refDestructuringErrors.shorthandAssign : -1\n if (!andThrow) return pos >= 0\n if (pos > -1) this.raise(pos, \"Shorthand property assignments are valid only in destructuring patterns\")\n}\n\npp.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n this.raise(this.yieldPos, \"Yield expression cannot be a default value\")\n if (this.awaitPos)\n this.raise(this.awaitPos, \"Await expression cannot be a default value\")\n}\n\npp.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n return this.isSimpleAssignTarget(expr.expression)\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n}\n\nvar pp$1 = Parser.prototype\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp$1.parseTopLevel = function(node) {\n var this$1 = this;\n\n var exports = {}\n if (!node.body) node.body = []\n while (this.type !== tt.eof) {\n var stmt = this$1.parseStatement(true, true, exports)\n node.body.push(stmt)\n }\n this.next()\n if (this.options.ecmaVersion >= 6) {\n node.sourceType = this.options.sourceType\n }\n return this.finishNode(node, \"Program\")\n}\n\nvar loopLabel = {kind: \"loop\"};\nvar switchLabel = {kind: \"switch\"};\npp$1.isLet = function() {\n if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != \"let\") return false\n skipWhiteSpace.lastIndex = this.pos\n var skip = skipWhiteSpace.exec(this.input)\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next)\n if (nextCh === 91 || nextCh == 123) return true // '{' and '['\n if (isIdentifierStart(nextCh, true)) {\n var pos = next + 1\n while (isIdentifierChar(this.input.charCodeAt(pos), true)) ++pos\n var ident = this.input.slice(next, pos)\n if (!this.isKeyword(ident)) return true\n }\n return false\n}\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp$1.isAsyncFunction = function() {\n if (this.type !== tt.name || this.options.ecmaVersion < 8 || this.value != \"async\")\n return false\n\n skipWhiteSpace.lastIndex = this.pos\n var skip = skipWhiteSpace.exec(this.input)\n var next = this.pos + skip[0].length\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 == this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))\n}\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp$1.parseStatement = function(declaration, topLevel, exports) {\n var starttype = this.type, node = this.startNode(), kind\n\n if (this.isLet()) {\n starttype = tt._var\n kind = \"let\"\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case tt._debugger: return this.parseDebuggerStatement(node)\n case tt._do: return this.parseDoStatement(node)\n case tt._for: return this.parseForStatement(node)\n case tt._function:\n if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()\n return this.parseFunctionStatement(node, false)\n case tt._class:\n if (!declaration) this.unexpected()\n return this.parseClass(node, true)\n case tt._if: return this.parseIfStatement(node)\n case tt._return: return this.parseReturnStatement(node)\n case tt._switch: return this.parseSwitchStatement(node)\n case tt._throw: return this.parseThrowStatement(node)\n case tt._try: return this.parseTryStatement(node)\n case tt._const: case tt._var:\n kind = kind || this.value\n if (!declaration && kind != \"var\") this.unexpected()\n return this.parseVarStatement(node, kind)\n case tt._while: return this.parseWhileStatement(node)\n case tt._with: return this.parseWithStatement(node)\n case tt.braceL: return this.parseBlock()\n case tt.semi: return this.parseEmptyStatement(node)\n case tt._export:\n case tt._import:\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n this.raise(this.start, \"'import' and 'export' may only appear at the top level\")\n if (!this.inModule)\n this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\")\n }\n return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction() && declaration) {\n this.next()\n return this.parseFunctionStatement(node, true)\n }\n\n var maybeName = this.value, expr = this.parseExpression()\n if (starttype === tt.name && expr.type === \"Identifier\" && this.eat(tt.colon))\n return this.parseLabeledStatement(node, maybeName, expr)\n else return this.parseExpressionStatement(node, expr)\n }\n}\n\npp$1.parseBreakContinueStatement = function(node, keyword) {\n var this$1 = this;\n\n var isBreak = keyword == \"break\"\n this.next()\n if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null\n else if (this.type !== tt.name) this.unexpected()\n else {\n node.label = this.parseIdent()\n this.semicolon()\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n var i = 0\n for (; i < this.labels.length; ++i) {\n var lab = this$1.labels[i]\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) break\n if (node.label && isBreak) break\n }\n }\n if (i === this.labels.length) this.raise(node.start, \"Unsyntactic \" + keyword)\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n}\n\npp$1.parseDebuggerStatement = function(node) {\n this.next()\n this.semicolon()\n return this.finishNode(node, \"DebuggerStatement\")\n}\n\npp$1.parseDoStatement = function(node) {\n this.next()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(false)\n this.labels.pop()\n this.expect(tt._while)\n node.test = this.parseParenExpression()\n if (this.options.ecmaVersion >= 6)\n this.eat(tt.semi)\n else\n this.semicolon()\n return this.finishNode(node, \"DoWhileStatement\")\n}\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp$1.parseForStatement = function(node) {\n this.next()\n this.labels.push(loopLabel)\n this.enterLexicalScope()\n this.expect(tt.parenL)\n if (this.type === tt.semi) return this.parseFor(node, null)\n var isLet = this.isLet()\n if (this.type === tt._var || this.type === tt._const || isLet) {\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value\n this.next()\n this.parseVar(init$1, true, kind)\n this.finishNode(init$1, \"VariableDeclaration\")\n if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init$1.declarations.length === 1 &&\n !(kind !== \"var\" && init$1.declarations[0].init))\n return this.parseForIn(node, init$1)\n return this.parseFor(node, init$1)\n }\n var refDestructuringErrors = new DestructuringErrors\n var init = this.parseExpression(true, refDestructuringErrors)\n if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n this.toAssignable(init)\n this.checkLVal(init)\n this.checkPatternErrors(refDestructuringErrors, true)\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true)\n }\n return this.parseFor(node, init)\n}\n\npp$1.parseFunctionStatement = function(node, isAsync) {\n this.next()\n return this.parseFunction(node, true, false, isAsync)\n}\n\npp$1.isFunction = function() {\n return this.type === tt._function || this.isAsyncFunction()\n}\n\npp$1.parseIfStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(!this.strict && this.isFunction())\n node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : null\n return this.finishNode(node, \"IfStatement\")\n}\n\npp$1.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n this.raise(this.start, \"'return' outside of function\")\n this.next()\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null\n else { node.argument = this.parseExpression(); this.semicolon() }\n return this.finishNode(node, \"ReturnStatement\")\n}\n\npp$1.parseSwitchStatement = function(node) {\n var this$1 = this;\n\n this.next()\n node.discriminant = this.parseParenExpression()\n node.cases = []\n this.expect(tt.braceL)\n this.labels.push(switchLabel)\n this.enterLexicalScope()\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n var cur\n for (var sawDefault = false; this.type != tt.braceR;) {\n if (this$1.type === tt._case || this$1.type === tt._default) {\n var isCase = this$1.type === tt._case\n if (cur) this$1.finishNode(cur, \"SwitchCase\")\n node.cases.push(cur = this$1.startNode())\n cur.consequent = []\n this$1.next()\n if (isCase) {\n cur.test = this$1.parseExpression()\n } else {\n if (sawDefault) this$1.raiseRecoverable(this$1.lastTokStart, \"Multiple default clauses\")\n sawDefault = true\n cur.test = null\n }\n this$1.expect(tt.colon)\n } else {\n if (!cur) this$1.unexpected()\n cur.consequent.push(this$1.parseStatement(true))\n }\n }\n this.exitLexicalScope()\n if (cur) this.finishNode(cur, \"SwitchCase\")\n this.next() // Closing brace\n this.labels.pop()\n return this.finishNode(node, \"SwitchStatement\")\n}\n\npp$1.parseThrowStatement = function(node) {\n this.next()\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n this.raise(this.lastTokEnd, \"Illegal newline after throw\")\n node.argument = this.parseExpression()\n this.semicolon()\n return this.finishNode(node, \"ThrowStatement\")\n}\n\n// Reused empty array added for node fields that are always empty.\n\nvar empty = []\n\npp$1.parseTryStatement = function(node) {\n this.next()\n node.block = this.parseBlock()\n node.handler = null\n if (this.type === tt._catch) {\n var clause = this.startNode()\n this.next()\n this.expect(tt.parenL)\n clause.param = this.parseBindingAtom()\n this.enterLexicalScope()\n this.checkLVal(clause.param, \"let\")\n this.expect(tt.parenR)\n clause.body = this.parseBlock(false)\n this.exitLexicalScope()\n node.handler = this.finishNode(clause, \"CatchClause\")\n }\n node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null\n if (!node.handler && !node.finalizer)\n this.raise(node.start, \"Missing catch or finally clause\")\n return this.finishNode(node, \"TryStatement\")\n}\n\npp$1.parseVarStatement = function(node, kind) {\n this.next()\n this.parseVar(node, false, kind)\n this.semicolon()\n return this.finishNode(node, \"VariableDeclaration\")\n}\n\npp$1.parseWhileStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, \"WhileStatement\")\n}\n\npp$1.parseWithStatement = function(node) {\n if (this.strict) this.raise(this.start, \"'with' in strict mode\")\n this.next()\n node.object = this.parseParenExpression()\n node.body = this.parseStatement(false)\n return this.finishNode(node, \"WithStatement\")\n}\n\npp$1.parseEmptyStatement = function(node) {\n this.next()\n return this.finishNode(node, \"EmptyStatement\")\n}\n\npp$1.parseLabeledStatement = function(node, maybeName, expr) {\n var this$1 = this;\n\n for (var i = 0; i < this.labels.length; ++i)\n if (this$1.labels[i].name === maybeName) this$1.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\")\n var kind = this.type.isLoop ? \"loop\" : this.type === tt._switch ? \"switch\" : null\n for (var i$1 = this.labels.length - 1; i$1 >= 0; i$1--) {\n var label = this$1.labels[i$1]\n if (label.statementStart == node.start) {\n label.statementStart = this$1.start\n label.kind = kind\n } else break\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start})\n node.body = this.parseStatement(true)\n if (node.body.type == \"ClassDeclaration\" ||\n node.body.type == \"VariableDeclaration\" && node.body.kind != \"var\" ||\n node.body.type == \"FunctionDeclaration\" && (this.strict || node.body.generator))\n this.raiseRecoverable(node.body.start, \"Invalid labeled declaration\")\n this.labels.pop()\n node.label = expr\n return this.finishNode(node, \"LabeledStatement\")\n}\n\npp$1.parseExpressionStatement = function(node, expr) {\n node.expression = expr\n this.semicolon()\n return this.finishNode(node, \"ExpressionStatement\")\n}\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp$1.parseBlock = function(createNewLexicalScope) {\n var this$1 = this;\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\n\n var node = this.startNode()\n node.body = []\n this.expect(tt.braceL)\n if (createNewLexicalScope) {\n this.enterLexicalScope()\n }\n while (!this.eat(tt.braceR)) {\n var stmt = this$1.parseStatement(true)\n node.body.push(stmt)\n }\n if (createNewLexicalScope) {\n this.exitLexicalScope()\n }\n return this.finishNode(node, \"BlockStatement\")\n}\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp$1.parseFor = function(node, init) {\n node.init = init\n this.expect(tt.semi)\n node.test = this.type === tt.semi ? null : this.parseExpression()\n this.expect(tt.semi)\n node.update = this.type === tt.parenR ? null : this.parseExpression()\n this.expect(tt.parenR)\n this.exitLexicalScope()\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, \"ForStatement\")\n}\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp$1.parseForIn = function(node, init) {\n var type = this.type === tt._in ? \"ForInStatement\" : \"ForOfStatement\"\n this.next()\n node.left = init\n node.right = this.parseExpression()\n this.expect(tt.parenR)\n this.exitLexicalScope()\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, type)\n}\n\n// Parse a list of variable declarations.\n\npp$1.parseVar = function(node, isFor, kind) {\n var this$1 = this;\n\n node.declarations = []\n node.kind = kind\n for (;;) {\n var decl = this$1.startNode()\n this$1.parseVarId(decl, kind)\n if (this$1.eat(tt.eq)) {\n decl.init = this$1.parseMaybeAssign(isFor)\n } else if (kind === \"const\" && !(this$1.type === tt._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual(\"of\")))) {\n this$1.unexpected()\n } else if (decl.id.type != \"Identifier\" && !(isFor && (this$1.type === tt._in || this$1.isContextual(\"of\")))) {\n this$1.raise(this$1.lastTokEnd, \"Complex binding patterns require an initialization value\")\n } else {\n decl.init = null\n }\n node.declarations.push(this$1.finishNode(decl, \"VariableDeclarator\"))\n if (!this$1.eat(tt.comma)) break\n }\n return node\n}\n\npp$1.parseVarId = function(decl, kind) {\n decl.id = this.parseBindingAtom(kind)\n this.checkLVal(decl.id, kind, false)\n}\n\n// Parse a function declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {\n this.initFunction(node)\n if (this.options.ecmaVersion >= 6 && !isAsync)\n node.generator = this.eat(tt.star)\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n if (isStatement) {\n node.id = isStatement === \"nullableID\" && this.type != tt.name ? null : this.parseIdent()\n if (node.id) {\n this.checkLVal(node.id, \"var\")\n }\n }\n\n var oldInGen = this.inGenerator, oldInAsync = this.inAsync,\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\n this.inGenerator = node.generator\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n this.inFunction = true\n this.enterFunctionScope()\n\n if (!isStatement)\n node.id = this.type == tt.name ? this.parseIdent() : null\n\n this.parseFunctionParams(node)\n this.parseFunctionBody(node, allowExpressionBody)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n this.inFunction = oldInFunc\n return this.finishNode(node, isStatement ? \"FunctionDeclaration\" : \"FunctionExpression\")\n}\n\npp$1.parseFunctionParams = function(node) {\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true)\n this.checkYieldAwaitInDefaultParams()\n}\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$1.parseClass = function(node, isStatement) {\n var this$1 = this;\n\n this.next()\n\n this.parseClassId(node, isStatement)\n this.parseClassSuper(node)\n var classBody = this.startNode()\n var hadConstructor = false\n classBody.body = []\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (this$1.eat(tt.semi)) continue\n var method = this$1.startNode()\n var isGenerator = this$1.eat(tt.star)\n var isAsync = false\n var isMaybeStatic = this$1.type === tt.name && this$1.value === \"static\"\n this$1.parsePropertyName(method)\n method.static = isMaybeStatic && this$1.type !== tt.parenL\n if (method.static) {\n if (isGenerator) this$1.unexpected()\n isGenerator = this$1.eat(tt.star)\n this$1.parsePropertyName(method)\n }\n if (this$1.options.ecmaVersion >= 8 && !isGenerator && !method.computed &&\n method.key.type === \"Identifier\" && method.key.name === \"async\" && this$1.type !== tt.parenL &&\n !this$1.canInsertSemicolon()) {\n isAsync = true\n this$1.parsePropertyName(method)\n }\n method.kind = \"method\"\n var isGetSet = false\n if (!method.computed) {\n var key = method.key;\n if (!isGenerator && !isAsync && key.type === \"Identifier\" && this$1.type !== tt.parenL && (key.name === \"get\" || key.name === \"set\")) {\n isGetSet = true\n method.kind = key.name\n key = this$1.parsePropertyName(method)\n }\n if (!method.static && (key.type === \"Identifier\" && key.name === \"constructor\" ||\n key.type === \"Literal\" && key.value === \"constructor\")) {\n if (hadConstructor) this$1.raise(key.start, \"Duplicate constructor in the same class\")\n if (isGetSet) this$1.raise(key.start, \"Constructor can't have get/set modifier\")\n if (isGenerator) this$1.raise(key.start, \"Constructor can't be a generator\")\n if (isAsync) this$1.raise(key.start, \"Constructor can't be an async method\")\n method.kind = \"constructor\"\n hadConstructor = true\n }\n }\n this$1.parseClassMethod(classBody, method, isGenerator, isAsync)\n if (isGetSet) {\n var paramCount = method.kind === \"get\" ? 0 : 1\n if (method.value.params.length !== paramCount) {\n var start = method.value.start\n if (method.kind === \"get\")\n this$1.raiseRecoverable(start, \"getter should have no params\")\n else\n this$1.raiseRecoverable(start, \"setter should have exactly one param\")\n } else {\n if (method.kind === \"set\" && method.value.params[0].type === \"RestElement\")\n this$1.raiseRecoverable(method.value.params[0].start, \"Setter cannot use rest params\")\n }\n }\n }\n node.body = this.finishNode(classBody, \"ClassBody\")\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n}\n\npp$1.parseClassMethod = function(classBody, method, isGenerator, isAsync) {\n method.value = this.parseMethod(isGenerator, isAsync)\n classBody.body.push(this.finishNode(method, \"MethodDefinition\"))\n}\n\npp$1.parseClassId = function(node, isStatement) {\n node.id = this.type === tt.name ? this.parseIdent() : isStatement === true ? this.unexpected() : null\n}\n\npp$1.parseClassSuper = function(node) {\n node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null\n}\n\n// Parses module export declaration.\n\npp$1.parseExport = function(node, exports) {\n var this$1 = this;\n\n this.next()\n // export * from '...'\n if (this.eat(tt.star)) {\n this.expectContextual(\"from\")\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n this.semicolon()\n return this.finishNode(node, \"ExportAllDeclaration\")\n }\n if (this.eat(tt._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart)\n var isAsync\n if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {\n var fNode = this.startNode()\n this.next()\n if (isAsync) this.next()\n node.declaration = this.parseFunction(fNode, \"nullableID\", false, isAsync)\n } else if (this.type === tt._class) {\n var cNode = this.startNode()\n node.declaration = this.parseClass(cNode, \"nullableID\")\n } else {\n node.declaration = this.parseMaybeAssign()\n this.semicolon()\n }\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseStatement(true)\n if (node.declaration.type === \"VariableDeclaration\")\n this.checkVariableExport(exports, node.declaration.declarations)\n else\n this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)\n node.specifiers = []\n node.source = null\n } else { // export { x, y as z } [from '...']\n node.declaration = null\n node.specifiers = this.parseExportSpecifiers(exports)\n if (this.eatContextual(\"from\")) {\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n } else {\n // check for keywords used as local names\n for (var i = 0; i < node.specifiers.length; i++) {\n if (this$1.keywords.test(node.specifiers[i].local.name) || this$1.reservedWords.test(node.specifiers[i].local.name)) {\n this$1.unexpected(node.specifiers[i].local.start)\n }\n }\n\n node.source = null\n }\n this.semicolon()\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n}\n\npp$1.checkExport = function(exports, name, pos) {\n if (!exports) return\n if (has(exports, name))\n this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\")\n exports[name] = true\n}\n\npp$1.checkPatternExport = function(exports, pat) {\n var this$1 = this;\n\n var type = pat.type\n if (type == \"Identifier\")\n this.checkExport(exports, pat.name, pat.start)\n else if (type == \"ObjectPattern\")\n for (var i = 0; i < pat.properties.length; ++i)\n this$1.checkPatternExport(exports, pat.properties[i].value)\n else if (type == \"ArrayPattern\")\n for (var i$1 = 0; i$1 < pat.elements.length; ++i$1) {\n var elt = pat.elements[i$1]\n if (elt) this$1.checkPatternExport(exports, elt)\n }\n else if (type == \"AssignmentPattern\")\n this.checkPatternExport(exports, pat.left)\n else if (type == \"ParenthesizedExpression\")\n this.checkPatternExport(exports, pat.expression)\n}\n\npp$1.checkVariableExport = function(exports, decls) {\n var this$1 = this;\n\n if (!exports) return\n for (var i = 0; i < decls.length; i++)\n this$1.checkPatternExport(exports, decls[i].id)\n}\n\npp$1.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n}\n\n// Parses a comma-separated list of module exports.\n\npp$1.parseExportSpecifiers = function(exports) {\n var this$1 = this;\n\n var nodes = [], first = true\n // export { x, y as z } [from '...']\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this$1.expect(tt.comma)\n if (this$1.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n var node = this$1.startNode()\n node.local = this$1.parseIdent(true)\n node.exported = this$1.eatContextual(\"as\") ? this$1.parseIdent(true) : node.local\n this$1.checkExport(exports, node.exported.name, node.exported.start)\n nodes.push(this$1.finishNode(node, \"ExportSpecifier\"))\n }\n return nodes\n}\n\n// Parses import declaration.\n\npp$1.parseImport = function(node) {\n this.next()\n // import '...'\n if (this.type === tt.string) {\n node.specifiers = empty\n node.source = this.parseExprAtom()\n } else {\n node.specifiers = this.parseImportSpecifiers()\n this.expectContextual(\"from\")\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n }\n this.semicolon()\n return this.finishNode(node, \"ImportDeclaration\")\n}\n\n// Parses a comma-separated list of module imports.\n\npp$1.parseImportSpecifiers = function() {\n var this$1 = this;\n\n var nodes = [], first = true\n if (this.type === tt.name) {\n // import defaultObj, { x, y as z } from '...'\n var node = this.startNode()\n node.local = this.parseIdent()\n this.checkLVal(node.local, \"let\")\n nodes.push(this.finishNode(node, \"ImportDefaultSpecifier\"))\n if (!this.eat(tt.comma)) return nodes\n }\n if (this.type === tt.star) {\n var node$1 = this.startNode()\n this.next()\n this.expectContextual(\"as\")\n node$1.local = this.parseIdent()\n this.checkLVal(node$1.local, \"let\")\n nodes.push(this.finishNode(node$1, \"ImportNamespaceSpecifier\"))\n return nodes\n }\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this$1.expect(tt.comma)\n if (this$1.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n var node$2 = this$1.startNode()\n node$2.imported = this$1.parseIdent(true)\n if (this$1.eatContextual(\"as\")) {\n node$2.local = this$1.parseIdent()\n } else {\n node$2.local = node$2.imported\n if (this$1.isKeyword(node$2.local.name)) this$1.unexpected(node$2.local.start)\n if (this$1.reservedWordsStrict.test(node$2.local.name)) this$1.raiseRecoverable(node$2.local.start, \"The keyword '\" + node$2.local.name + \"' is reserved\")\n }\n this$1.checkLVal(node$2.local, \"let\")\n nodes.push(this$1.finishNode(node$2, \"ImportSpecifier\"))\n }\n return nodes\n}\n\nvar pp$2 = Parser.prototype\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp$2.toAssignable = function(node, isBinding) {\n var this$1 = this;\n\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n this.raise(node.start, \"Can not use 'await' as identifier inside an async function\")\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\"\n for (var i = 0; i < node.properties.length; i++) {\n var prop = node.properties[i]\n if (prop.kind !== \"init\") this$1.raise(prop.key.start, \"Object pattern can't contain getter or setter\")\n this$1.toAssignable(prop.value, isBinding)\n }\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\"\n this.toAssignableList(node.elements, isBinding)\n break\n\n case \"AssignmentExpression\":\n if (node.operator === \"=\") {\n node.type = \"AssignmentPattern\"\n delete node.operator\n this.toAssignable(node.left, isBinding)\n // falls through to AssignmentPattern\n } else {\n this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\")\n break\n }\n\n case \"AssignmentPattern\":\n break\n\n case \"ParenthesizedExpression\":\n node.expression = this.toAssignable(node.expression, isBinding)\n break\n\n case \"MemberExpression\":\n if (!isBinding) break\n\n default:\n this.raise(node.start, \"Assigning to rvalue\")\n }\n }\n return node\n}\n\n// Convert list of expression atoms to binding list.\n\npp$2.toAssignableList = function(exprList, isBinding) {\n var this$1 = this;\n\n var end = exprList.length\n if (end) {\n var last = exprList[end - 1]\n if (last && last.type == \"RestElement\") {\n --end\n } else if (last && last.type == \"SpreadElement\") {\n last.type = \"RestElement\"\n var arg = last.argument\n this.toAssignable(arg, isBinding)\n if (arg.type !== \"Identifier\" && arg.type !== \"MemberExpression\" && arg.type !== \"ArrayPattern\")\n this.unexpected(arg.start)\n --end\n }\n\n if (isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n this.unexpected(last.argument.start)\n }\n for (var i = 0; i < end; i++) {\n var elt = exprList[i]\n if (elt) this$1.toAssignable(elt, isBinding)\n }\n return exprList\n}\n\n// Parses spread element.\n\npp$2.parseSpread = function(refDestructuringErrors) {\n var node = this.startNode()\n this.next()\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors)\n return this.finishNode(node, \"SpreadElement\")\n}\n\npp$2.parseRest = function(allowNonIdent) {\n var node = this.startNode()\n this.next()\n\n // RestElement inside of a function parameter must be an identifier\n if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()\n else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()\n\n return this.finishNode(node, \"RestElement\")\n}\n\n// Parses lvalue (assignable) atom.\n\npp$2.parseBindingAtom = function() {\n if (this.options.ecmaVersion < 6) return this.parseIdent()\n switch (this.type) {\n case tt.name:\n return this.parseIdent()\n\n case tt.bracketL:\n var node = this.startNode()\n this.next()\n node.elements = this.parseBindingList(tt.bracketR, true, true)\n return this.finishNode(node, \"ArrayPattern\")\n\n case tt.braceL:\n return this.parseObj(true)\n\n default:\n this.unexpected()\n }\n}\n\npp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {\n var this$1 = this;\n\n var elts = [], first = true\n while (!this.eat(close)) {\n if (first) first = false\n else this$1.expect(tt.comma)\n if (allowEmpty && this$1.type === tt.comma) {\n elts.push(null)\n } else if (allowTrailingComma && this$1.afterTrailingComma(close)) {\n break\n } else if (this$1.type === tt.ellipsis) {\n var rest = this$1.parseRest(allowNonIdent)\n this$1.parseBindingListItem(rest)\n elts.push(rest)\n if (this$1.type === tt.comma) this$1.raise(this$1.start, \"Comma is not permitted after the rest element\")\n this$1.expect(close)\n break\n } else {\n var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc)\n this$1.parseBindingListItem(elem)\n elts.push(elem)\n }\n }\n return elts\n}\n\npp$2.parseBindingListItem = function(param) {\n return param\n}\n\n// Parses assignment pattern around given atom if possible.\n\npp$2.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom()\n if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left\n var node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.right = this.parseMaybeAssign()\n return this.finishNode(node, \"AssignmentPattern\")\n}\n\n// Verify that a node is an lval — something that can be assigned\n// to.\n// bindingType can be either:\n// 'var' indicating that the lval creates a 'var' binding\n// 'let' indicating that the lval creates a lexical ('let' or 'const') binding\n// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references\n\npp$2.checkLVal = function(expr, bindingType, checkClashes) {\n var this$1 = this;\n\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n this.raiseRecoverable(expr.start, (bindingType ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\")\n if (checkClashes) {\n if (has(checkClashes, expr.name))\n this.raiseRecoverable(expr.start, \"Argument name clash\")\n checkClashes[expr.name] = true\n }\n if (bindingType && bindingType !== \"none\") {\n if (\n bindingType === \"var\" && !this.canDeclareVarName(expr.name) ||\n bindingType !== \"var\" && !this.canDeclareLexicalName(expr.name)\n ) {\n this.raiseRecoverable(expr.start, (\"Identifier '\" + (expr.name) + \"' has already been declared\"))\n }\n if (bindingType === \"var\") {\n this.declareVarName(expr.name)\n } else {\n this.declareLexicalName(expr.name)\n }\n }\n break\n\n case \"MemberExpression\":\n if (bindingType) this.raiseRecoverable(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" member expression\")\n break\n\n case \"ObjectPattern\":\n for (var i = 0; i < expr.properties.length; i++)\n this$1.checkLVal(expr.properties[i].value, bindingType, checkClashes)\n break\n\n case \"ArrayPattern\":\n for (var i$1 = 0; i$1 < expr.elements.length; i$1++) {\n var elem = expr.elements[i$1]\n if (elem) this$1.checkLVal(elem, bindingType, checkClashes)\n }\n break\n\n case \"AssignmentPattern\":\n this.checkLVal(expr.left, bindingType, checkClashes)\n break\n\n case \"RestElement\":\n this.checkLVal(expr.argument, bindingType, checkClashes)\n break\n\n case \"ParenthesizedExpression\":\n this.checkLVal(expr.expression, bindingType, checkClashes)\n break\n\n default:\n this.raise(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" rvalue\")\n }\n}\n\n// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\nvar pp$3 = Parser.prototype\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp$3.checkPropClash = function(prop, propHash) {\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n return\n var key = prop.key;\n var name\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n var kind = prop.kind;\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\")\n propHash.proto = true\n }\n return\n }\n name = \"$\" + name\n var other = propHash[name]\n if (other) {\n var redefinition\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set\n } else {\n redefinition = other.init || other[kind]\n }\n if (redefinition)\n this.raiseRecoverable(key.start, \"Redefinition of property\")\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n }\n }\n other[kind] = true\n}\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp$3.parseExpression = function(noIn, refDestructuringErrors) {\n var this$1 = this;\n\n var startPos = this.start, startLoc = this.startLoc\n var expr = this.parseMaybeAssign(noIn, refDestructuringErrors)\n if (this.type === tt.comma) {\n var node = this.startNodeAt(startPos, startLoc)\n node.expressions = [expr]\n while (this.eat(tt.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors))\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n}\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {\n if (this.inGenerator && this.isContextual(\"yield\")) return this.parseYield()\n\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign\n oldTrailingComma = refDestructuringErrors.trailingComma\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1\n } else {\n refDestructuringErrors = new DestructuringErrors\n ownDestructuringErrors = true\n }\n\n var startPos = this.start, startLoc = this.startLoc\n if (this.type == tt.parenL || this.type == tt.name)\n this.potentialArrowAt = this.start\n var left = this.parseMaybeConditional(noIn, refDestructuringErrors)\n if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)\n if (this.type.isAssign) {\n this.checkPatternErrors(refDestructuringErrors, true)\n if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors)\n var node = this.startNodeAt(startPos, startLoc)\n node.operator = this.value\n node.left = this.type === tt.eq ? this.toAssignable(left) : left\n refDestructuringErrors.shorthandAssign = -1 // reset because shorthand default was used correctly\n this.checkLVal(left)\n this.next()\n node.right = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)\n }\n if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign\n if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma\n return left\n}\n\n// Parse a ternary conditional (`?:`) operator.\n\npp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc\n var expr = this.parseExprOps(noIn, refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n if (this.eat(tt.question)) {\n var node = this.startNodeAt(startPos, startLoc)\n node.test = expr\n node.consequent = this.parseMaybeAssign()\n this.expect(tt.colon)\n node.alternate = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n}\n\n// Start the precedence parser.\n\npp$3.parseExprOps = function(noIn, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc\n var expr = this.parseMaybeUnary(refDestructuringErrors, false)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n return expr.start == startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)\n}\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {\n var prec = this.type.binop\n if (prec != null && (!noIn || this.type !== tt._in)) {\n if (prec > minPrec) {\n var logical = this.type === tt.logicalOR || this.type === tt.logicalAND\n var op = this.value\n this.next()\n var startPos = this.start, startLoc = this.startLoc\n var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)\n }\n }\n return left\n}\n\npp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n var node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.operator = op\n node.right = right\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n}\n\n// Parse unary operators, both prefix and postfix.\n\npp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {\n var this$1 = this;\n\n var startPos = this.start, startLoc = this.startLoc, expr\n if (this.inAsync && this.isContextual(\"await\")) {\n expr = this.parseAwait(refDestructuringErrors)\n sawUnary = true\n } else if (this.type.prefix) {\n var node = this.startNode(), update = this.type === tt.incDec\n node.operator = this.value\n node.prefix = true\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n this.checkExpressionErrors(refDestructuringErrors, true)\n if (update) this.checkLVal(node.argument)\n else if (this.strict && node.operator === \"delete\" &&\n node.argument.type === \"Identifier\")\n this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\")\n else sawUnary = true\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\")\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n while (this.type.postfix && !this.canInsertSemicolon()) {\n var node$1 = this$1.startNodeAt(startPos, startLoc)\n node$1.operator = this$1.value\n node$1.prefix = false\n node$1.argument = expr\n this$1.checkLVal(expr)\n this$1.next()\n expr = this$1.finishNode(node$1, \"UpdateExpression\")\n }\n }\n\n if (!sawUnary && this.eat(tt.starstar))\n return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), \"**\", false)\n else\n return expr\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp$3.parseExprSubscripts = function(refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc\n var expr = this.parseExprAtom(refDestructuringErrors)\n var skipArrowSubscripts = expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\"\n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr\n var result = this.parseSubscripts(expr, startPos, startLoc)\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\n if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1\n if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1\n }\n return result\n}\n\npp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {\n var this$1 = this;\n\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd == base.end && !this.canInsertSemicolon()\n for (var computed;;) {\n if ((computed = this$1.eat(tt.bracketL)) || this$1.eat(tt.dot)) {\n var node = this$1.startNodeAt(startPos, startLoc)\n node.object = base\n node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true)\n node.computed = !!computed\n if (computed) this$1.expect(tt.bracketR)\n base = this$1.finishNode(node, \"MemberExpression\")\n } else if (!noCalls && this$1.eat(tt.parenL)) {\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos\n this$1.yieldPos = 0\n this$1.awaitPos = 0\n var exprList = this$1.parseExprList(tt.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors)\n if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(tt.arrow)) {\n this$1.checkPatternErrors(refDestructuringErrors, false)\n this$1.checkYieldAwaitInDefaultParams()\n this$1.yieldPos = oldYieldPos\n this$1.awaitPos = oldAwaitPos\n return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)\n }\n this$1.checkExpressionErrors(refDestructuringErrors, true)\n this$1.yieldPos = oldYieldPos || this$1.yieldPos\n this$1.awaitPos = oldAwaitPos || this$1.awaitPos\n var node$1 = this$1.startNodeAt(startPos, startLoc)\n node$1.callee = base\n node$1.arguments = exprList\n base = this$1.finishNode(node$1, \"CallExpression\")\n } else if (this$1.type === tt.backQuote) {\n var node$2 = this$1.startNodeAt(startPos, startLoc)\n node$2.tag = base\n node$2.quasi = this$1.parseTemplate()\n base = this$1.finishNode(node$2, \"TaggedTemplateExpression\")\n } else {\n return base\n }\n }\n}\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp$3.parseExprAtom = function(refDestructuringErrors) {\n var node, canBeArrow = this.potentialArrowAt == this.start\n switch (this.type) {\n case tt._super:\n if (!this.inFunction)\n this.raise(this.start, \"'super' outside of function or class\")\n\n case tt._this:\n var type = this.type === tt._this ? \"ThisExpression\" : \"Super\"\n node = this.startNode()\n this.next()\n return this.finishNode(node, type)\n\n case tt.name:\n var startPos = this.start, startLoc = this.startLoc\n var id = this.parseIdent(this.type !== tt.name)\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(tt._function))\n return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true)\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(tt.arrow))\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === tt.name) {\n id = this.parseIdent()\n if (this.canInsertSemicolon() || !this.eat(tt.arrow))\n this.unexpected()\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)\n }\n }\n return id\n\n case tt.regexp:\n var value = this.value\n node = this.parseLiteral(value.value)\n node.regex = {pattern: value.pattern, flags: value.flags}\n return node\n\n case tt.num: case tt.string:\n return this.parseLiteral(this.value)\n\n case tt._null: case tt._true: case tt._false:\n node = this.startNode()\n node.value = this.type === tt._null ? null : this.type === tt._true\n node.raw = this.type.keyword\n this.next()\n return this.finishNode(node, \"Literal\")\n\n case tt.parenL:\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow)\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n refDestructuringErrors.parenthesizedAssign = start\n if (refDestructuringErrors.parenthesizedBind < 0)\n refDestructuringErrors.parenthesizedBind = start\n }\n return expr\n\n case tt.bracketL:\n node = this.startNode()\n this.next()\n node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)\n return this.finishNode(node, \"ArrayExpression\")\n\n case tt.braceL:\n return this.parseObj(false, refDestructuringErrors)\n\n case tt._function:\n node = this.startNode()\n this.next()\n return this.parseFunction(node, false)\n\n case tt._class:\n return this.parseClass(this.startNode(), false)\n\n case tt._new:\n return this.parseNew()\n\n case tt.backQuote:\n return this.parseTemplate()\n\n default:\n this.unexpected()\n }\n}\n\npp$3.parseLiteral = function(value) {\n var node = this.startNode()\n node.value = value\n node.raw = this.input.slice(this.start, this.end)\n this.next()\n return this.finishNode(node, \"Literal\")\n}\n\npp$3.parseParenExpression = function() {\n this.expect(tt.parenL)\n var val = this.parseExpression()\n this.expect(tt.parenR)\n return val\n}\n\npp$3.parseParenAndDistinguishExpression = function(canBeArrow) {\n var this$1 = this;\n\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8\n if (this.options.ecmaVersion >= 6) {\n this.next()\n\n var innerStartPos = this.start, innerStartLoc = this.startLoc\n var exprList = [], first = true, lastIsComma = false\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart, innerParenStart\n this.yieldPos = 0\n this.awaitPos = 0\n while (this.type !== tt.parenR) {\n first ? first = false : this$1.expect(tt.comma)\n if (allowTrailingComma && this$1.afterTrailingComma(tt.parenR, true)) {\n lastIsComma = true\n break\n } else if (this$1.type === tt.ellipsis) {\n spreadStart = this$1.start\n exprList.push(this$1.parseParenItem(this$1.parseRest()))\n if (this$1.type === tt.comma) this$1.raise(this$1.start, \"Comma is not permitted after the rest element\")\n break\n } else {\n if (this$1.type === tt.parenL && !innerParenStart) {\n innerParenStart = this$1.start\n }\n exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem))\n }\n }\n var innerEndPos = this.start, innerEndLoc = this.startLoc\n this.expect(tt.parenR)\n\n if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false)\n this.checkYieldAwaitInDefaultParams()\n if (innerParenStart) this.unexpected(innerParenStart)\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.parseParenArrowList(startPos, startLoc, exprList)\n }\n\n if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)\n if (spreadStart) this.unexpected(spreadStart)\n this.checkExpressionErrors(refDestructuringErrors, true)\n this.yieldPos = oldYieldPos || this.yieldPos\n this.awaitPos = oldAwaitPos || this.awaitPos\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc)\n val.expressions = exprList\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc)\n } else {\n val = exprList[0]\n }\n } else {\n val = this.parseParenExpression()\n }\n\n if (this.options.preserveParens) {\n var par = this.startNodeAt(startPos, startLoc)\n par.expression = val\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n}\n\npp$3.parseParenItem = function(item) {\n return item\n}\n\npp$3.parseParenArrowList = function(startPos, startLoc, exprList) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)\n}\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nvar empty$1 = []\n\npp$3.parseNew = function() {\n var node = this.startNode()\n var meta = this.parseIdent(true)\n if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {\n node.meta = meta\n node.property = this.parseIdent(true)\n if (node.property.name !== \"target\")\n this.raiseRecoverable(node.property.start, \"The only valid meta property for new is new.target\")\n if (!this.inFunction)\n this.raiseRecoverable(node.start, \"new.target can only be used in functions\")\n return this.finishNode(node, \"MetaProperty\")\n }\n var startPos = this.start, startLoc = this.startLoc\n node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)\n if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false)\n else node.arguments = empty$1\n return this.finishNode(node, \"NewExpression\")\n}\n\n// Parse template expression.\n\npp$3.parseTemplateElement = function() {\n var elem = this.startNode()\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n }\n this.next()\n elem.tail = this.type === tt.backQuote\n return this.finishNode(elem, \"TemplateElement\")\n}\n\npp$3.parseTemplate = function() {\n var this$1 = this;\n\n var node = this.startNode()\n this.next()\n node.expressions = []\n var curElt = this.parseTemplateElement()\n node.quasis = [curElt]\n while (!curElt.tail) {\n this$1.expect(tt.dollarBraceL)\n node.expressions.push(this$1.parseExpression())\n this$1.expect(tt.braceR)\n node.quasis.push(curElt = this$1.parseTemplateElement())\n }\n this.next()\n return this.finishNode(node, \"TemplateLiteral\")\n}\n\n// Parse an object literal or binding pattern.\n\npp$3.parseObj = function(isPattern, refDestructuringErrors) {\n var this$1 = this;\n\n var node = this.startNode(), first = true, propHash = {}\n node.properties = []\n this.next()\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this$1.expect(tt.comma)\n if (this$1.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n var prop = this$1.startNode(), isGenerator, isAsync, startPos, startLoc\n if (this$1.options.ecmaVersion >= 6) {\n prop.method = false\n prop.shorthand = false\n if (isPattern || refDestructuringErrors) {\n startPos = this$1.start\n startLoc = this$1.startLoc\n }\n if (!isPattern)\n isGenerator = this$1.eat(tt.star)\n }\n this$1.parsePropertyName(prop)\n if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && !prop.computed &&\n prop.key.type === \"Identifier\" && prop.key.name === \"async\" && this$1.type !== tt.parenL &&\n this$1.type !== tt.colon && !this$1.canInsertSemicolon()) {\n isAsync = true\n this$1.parsePropertyName(prop, refDestructuringErrors)\n } else {\n isAsync = false\n }\n this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors)\n this$1.checkPropClash(prop, propHash)\n node.properties.push(this$1.finishNode(prop, \"Property\"))\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n}\n\npp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {\n if ((isGenerator || isAsync) && this.type === tt.colon)\n this.unexpected()\n\n if (this.eat(tt.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors)\n prop.kind = \"init\"\n } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {\n if (isPattern) this.unexpected()\n prop.kind = \"init\"\n prop.method = true\n prop.value = this.parseMethod(isGenerator, isAsync)\n } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type != tt.comma && this.type != tt.braceR)) {\n if (isGenerator || isAsync || isPattern) this.unexpected()\n prop.kind = prop.key.name\n this.parsePropertyName(prop)\n prop.value = this.parseMethod(false)\n var paramCount = prop.kind === \"get\" ? 0 : 1\n if (prop.value.params.length !== paramCount) {\n var start = prop.value.start\n if (prop.kind === \"get\")\n this.raiseRecoverable(start, \"getter should have no params\")\n else\n this.raiseRecoverable(start, \"setter should have exactly one param\")\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\")\n }\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (this.keywords.test(prop.key.name) ||\n (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) ||\n (this.inGenerator && prop.key.name == \"yield\") ||\n (this.inAsync && prop.key.name == \"await\"))\n this.raiseRecoverable(prop.key.start, \"'\" + prop.key.name + \"' can not be used as shorthand property\")\n prop.kind = \"init\"\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else if (this.type === tt.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n refDestructuringErrors.shorthandAssign = this.start\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else {\n prop.value = prop.key\n }\n prop.shorthand = true\n } else this.unexpected()\n}\n\npp$3.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(tt.bracketL)) {\n prop.computed = true\n prop.key = this.parseMaybeAssign()\n this.expect(tt.bracketR)\n return prop.key\n } else {\n prop.computed = false\n }\n }\n return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true)\n}\n\n// Initialize empty function node.\n\npp$3.initFunction = function(node) {\n node.id = null\n if (this.options.ecmaVersion >= 6) {\n node.generator = false\n node.expression = false\n }\n if (this.options.ecmaVersion >= 8)\n node.async = false\n}\n\n// Parse object or class method.\n\npp$3.parseMethod = function(isGenerator, isAsync) {\n var node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync,\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\n\n this.initFunction(node)\n if (this.options.ecmaVersion >= 6)\n node.generator = isGenerator\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n this.inGenerator = node.generator\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n this.inFunction = true\n this.enterFunctionScope()\n\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)\n this.checkYieldAwaitInDefaultParams()\n this.parseFunctionBody(node, false)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n this.inFunction = oldInFunc\n return this.finishNode(node, \"FunctionExpression\")\n}\n\n// Parse arrow function expression with given parameters.\n\npp$3.parseArrowExpression = function(node, params, isAsync) {\n var oldInGen = this.inGenerator, oldInAsync = this.inAsync,\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\n\n this.enterFunctionScope()\n this.initFunction(node)\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n this.inGenerator = false\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n this.inFunction = true\n\n node.params = this.toAssignableList(params, true)\n this.parseFunctionBody(node, true)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n this.inFunction = oldInFunc\n return this.finishNode(node, \"ArrowFunctionExpression\")\n}\n\n// Parse function body and check parameters.\n\npp$3.parseFunctionBody = function(node, isArrowFunction) {\n var isExpression = isArrowFunction && this.type !== tt.braceL\n var oldStrict = this.strict, useStrict = false\n\n if (isExpression) {\n node.body = this.parseMaybeAssign()\n node.expression = true\n this.checkParams(node, false)\n } else {\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end)\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\")\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n var oldLabels = this.labels\n this.labels = []\n if (useStrict) this.strict = true\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params))\n node.body = this.parseBlock(false)\n node.expression = false\n this.labels = oldLabels\n }\n this.exitFunctionScope()\n\n if (this.strict && node.id) {\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n this.checkLVal(node.id, \"none\")\n }\n this.strict = oldStrict\n}\n\npp$3.isSimpleParamList = function(params) {\n for (var i = 0; i < params.length; i++)\n if (params[i].type !== \"Identifier\") return false\n return true\n}\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp$3.checkParams = function(node, allowDuplicates) {\n var this$1 = this;\n\n var nameHash = {}\n for (var i = 0; i < node.params.length; i++) this$1.checkLVal(node.params[i], \"var\", allowDuplicates ? null : nameHash)\n}\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n var this$1 = this;\n\n var elts = [], first = true\n while (!this.eat(close)) {\n if (!first) {\n this$1.expect(tt.comma)\n if (allowTrailingComma && this$1.afterTrailingComma(close)) break\n } else first = false\n\n var elt\n if (allowEmpty && this$1.type === tt.comma)\n elt = null\n else if (this$1.type === tt.ellipsis) {\n elt = this$1.parseSpread(refDestructuringErrors)\n if (refDestructuringErrors && this$1.type === tt.comma && refDestructuringErrors.trailingComma < 0)\n refDestructuringErrors.trailingComma = this$1.start\n } else {\n elt = this$1.parseMaybeAssign(false, refDestructuringErrors)\n }\n elts.push(elt)\n }\n return elts\n}\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp$3.parseIdent = function(liberal) {\n var node = this.startNode()\n if (liberal && this.options.allowReserved == \"never\") liberal = false\n if (this.type === tt.name) {\n if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) &&\n (this.options.ecmaVersion >= 6 ||\n this.input.slice(this.start, this.end).indexOf(\"\\\\\") == -1))\n this.raiseRecoverable(this.start, \"The keyword '\" + this.value + \"' is reserved\")\n if (this.inGenerator && this.value === \"yield\")\n this.raiseRecoverable(this.start, \"Can not use 'yield' as identifier inside a generator\")\n if (this.inAsync && this.value === \"await\")\n this.raiseRecoverable(this.start, \"Can not use 'await' as identifier inside an async function\")\n node.name = this.value\n } else if (liberal && this.type.keyword) {\n node.name = this.type.keyword\n } else {\n this.unexpected()\n }\n this.next()\n return this.finishNode(node, \"Identifier\")\n}\n\n// Parses yield expression inside generator.\n\npp$3.parseYield = function() {\n if (!this.yieldPos) this.yieldPos = this.start\n\n var node = this.startNode()\n this.next()\n if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {\n node.delegate = false\n node.argument = null\n } else {\n node.delegate = this.eat(tt.star)\n node.argument = this.parseMaybeAssign()\n }\n return this.finishNode(node, \"YieldExpression\")\n}\n\npp$3.parseAwait = function() {\n if (!this.awaitPos) this.awaitPos = this.start\n\n var node = this.startNode()\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n return this.finishNode(node, \"AwaitExpression\")\n}\n\nvar pp$4 = Parser.prototype\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp$4.raise = function(pos, message) {\n var loc = getLineInfo(this.input, pos)\n message += \" (\" + loc.line + \":\" + loc.column + \")\"\n var err = new SyntaxError(message)\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos\n throw err\n}\n\npp$4.raiseRecoverable = pp$4.raise\n\npp$4.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n}\n\nvar pp$5 = Parser.prototype\n\n// Object.assign polyfill\nvar assign = Object.assign || function(target) {\n var sources = [], len = arguments.length - 1;\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\n\n for (var i = 0; i < sources.length; i++) {\n var source = sources[i]\n for (var key in source) {\n if (has(source, key)) {\n target[key] = source[key]\n }\n }\n }\n return target\n}\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp$5.enterFunctionScope = function() {\n // var: a hash of var-declared names in the current lexical scope\n // lexical: a hash of lexically-declared names in the current lexical scope\n // childVar: a hash of var-declared names in all child lexical scopes of the current lexical scope (within the current function scope)\n // parentLexical: a hash of lexically-declared names in all parent lexical scopes of the current lexical scope (within the current function scope)\n this.scopeStack.push({var: {}, lexical: {}, childVar: {}, parentLexical: {}})\n}\n\npp$5.exitFunctionScope = function() {\n this.scopeStack.pop()\n}\n\npp$5.enterLexicalScope = function() {\n var parentScope = this.scopeStack[this.scopeStack.length - 1]\n var childScope = {var: {}, lexical: {}, childVar: {}, parentLexical: {}}\n\n this.scopeStack.push(childScope)\n assign(childScope.parentLexical, parentScope.lexical, parentScope.parentLexical)\n}\n\npp$5.exitLexicalScope = function() {\n var childScope = this.scopeStack.pop()\n var parentScope = this.scopeStack[this.scopeStack.length - 1]\n\n assign(parentScope.childVar, childScope.var, childScope.childVar)\n}\n\n/**\n * A name can be declared with `var` if there are no variables with the same name declared with `let`/`const`\n * in the current lexical scope or any of the parent lexical scopes in this function.\n */\npp$5.canDeclareVarName = function(name) {\n var currentScope = this.scopeStack[this.scopeStack.length - 1]\n\n return !has(currentScope.lexical, name) && !has(currentScope.parentLexical, name)\n}\n\n/**\n * A name can be declared with `let`/`const` if there are no variables with the same name declared with `let`/`const`\n * in the current scope, and there are no variables with the same name declared with `var` in the current scope or in\n * any child lexical scopes in this function.\n */\npp$5.canDeclareLexicalName = function(name) {\n var currentScope = this.scopeStack[this.scopeStack.length - 1]\n\n return !has(currentScope.lexical, name) && !has(currentScope.var, name) && !has(currentScope.childVar, name)\n}\n\npp$5.declareVarName = function(name) {\n this.scopeStack[this.scopeStack.length - 1].var[name] = true\n}\n\npp$5.declareLexicalName = function(name) {\n this.scopeStack[this.scopeStack.length - 1].lexical[name] = true\n}\n\nvar Node = function Node(parser, pos, loc) {\n this.type = \"\"\n this.start = pos\n this.end = 0\n if (parser.options.locations)\n this.loc = new SourceLocation(parser, loc)\n if (parser.options.directSourceFile)\n this.sourceFile = parser.options.directSourceFile\n if (parser.options.ranges)\n this.range = [pos, 0]\n};\n\n// Start an AST node, attaching a start offset.\n\nvar pp$6 = Parser.prototype\n\npp$6.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n}\n\npp$6.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n}\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type\n node.end = pos\n if (this.options.locations)\n node.loc.end = loc\n if (this.options.ranges)\n node.range[1] = pos\n return node\n}\n\npp$6.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n}\n\n// Finish node at given position\n\npp$6.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n}\n\n// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\n this.token = token\n this.isExpr = !!isExpr\n this.preserveSpace = !!preserveSpace\n this.override = override\n this.generator = !!generator\n};\n\nvar types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", true),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.readTmplToken(); }),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n}\n\nvar pp$7 = Parser.prototype\n\npp$7.initialContext = function() {\n return [types.b_stat]\n}\n\npp$7.braceIsBlock = function(prevType) {\n if (prevType === tt.colon) {\n var parent = this.curContext()\n if (parent === types.b_stat || parent === types.b_expr)\n return !parent.isExpr\n }\n if (prevType === tt._return)\n return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR || prevType == tt.arrow)\n return true\n if (prevType == tt.braceL)\n return this.curContext() === types.b_stat\n return !this.exprAllowed\n}\n\npp$7.inGeneratorContext = function() {\n var this$1 = this;\n\n for (var i = this.context.length - 1; i >= 0; i--)\n if (this$1.context[i].generator) return true\n return false\n}\n\npp$7.updateContext = function(prevType) {\n var update, type = this.type\n if (type.keyword && prevType == tt.dot)\n this.exprAllowed = false\n else if (update = type.updateContext)\n update.call(this, prevType)\n else\n this.exprAllowed = type.beforeExpr\n}\n\n// Token-specific context update code\n\ntt.parenR.updateContext = tt.braceR.updateContext = function() {\n if (this.context.length == 1) {\n this.exprAllowed = true\n return\n }\n var out = this.context.pop(), cur\n if (out === types.b_stat && (cur = this.curContext()) && cur.token === \"function\") {\n this.context.pop()\n this.exprAllowed = false\n } else if (out === types.b_tmpl) {\n this.exprAllowed = true\n } else {\n this.exprAllowed = !out.isExpr\n }\n}\n\ntt.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)\n this.exprAllowed = true\n}\n\ntt.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl)\n this.exprAllowed = true\n}\n\ntt.parenL.updateContext = function(prevType) {\n var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while\n this.context.push(statementParens ? types.p_stat : types.p_expr)\n this.exprAllowed = true\n}\n\ntt.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n}\n\ntt._function.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&\n !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))\n this.context.push(types.f_expr)\n this.exprAllowed = false\n}\n\ntt.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n this.context.pop()\n else\n this.context.push(types.q_tmpl)\n this.exprAllowed = false\n}\n\ntt.star.updateContext = function(prevType) {\n if (prevType == tt._function) {\n if (this.curContext() === types.f_expr)\n this.context[this.context.length - 1] = types.f_expr_gen\n else\n this.context.push(types.f_gen)\n }\n this.exprAllowed = true\n}\n\ntt.name.updateContext = function(prevType) {\n var allowed = false\n if (this.options.ecmaVersion >= 6) {\n if (this.value == \"of\" && !this.exprAllowed ||\n this.value == \"yield\" && this.inGeneratorContext())\n allowed = true\n }\n this.exprAllowed = allowed\n}\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nvar Token = function Token(p) {\n this.type = p.type\n this.value = p.value\n this.start = p.start\n this.end = p.end\n if (p.options.locations)\n this.loc = new SourceLocation(p, p.startLoc, p.endLoc)\n if (p.options.ranges)\n this.range = [p.start, p.end]\n};\n\n// ## Tokenizer\n\nvar pp$8 = Parser.prototype\n\n// Are we running under Rhino?\nvar isRhino = typeof Packages == \"object\" && Object.prototype.toString.call(Packages) == \"[object JavaPackage]\"\n\n// Move to the next token\n\npp$8.next = function() {\n if (this.options.onToken)\n this.options.onToken(new Token(this))\n\n this.lastTokEnd = this.end\n this.lastTokStart = this.start\n this.lastTokEndLoc = this.endLoc\n this.lastTokStartLoc = this.startLoc\n this.nextToken()\n}\n\npp$8.getToken = function() {\n this.next()\n return new Token(this)\n}\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n pp$8[Symbol.iterator] = function() {\n var this$1 = this;\n\n return {\n next: function () {\n var token = this$1.getToken()\n return {\n done: token.type === tt.eof,\n value: token\n }\n }\n }\n }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\npp$8.curContext = function() {\n return this.context[this.context.length - 1]\n}\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp$8.nextToken = function() {\n var curContext = this.curContext()\n if (!curContext || !curContext.preserveSpace) this.skipSpace()\n\n this.start = this.pos\n if (this.options.locations) this.startLoc = this.curPosition()\n if (this.pos >= this.input.length) return this.finishToken(tt.eof)\n\n if (curContext.override) return curContext.override(this)\n else this.readToken(this.fullCharCodeAtPos())\n}\n\npp$8.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n return this.readWord()\n\n return this.getTokenFromCode(code)\n}\n\npp$8.fullCharCodeAtPos = function() {\n var code = this.input.charCodeAt(this.pos)\n if (code <= 0xd7ff || code >= 0xe000) return code\n var next = this.input.charCodeAt(this.pos + 1)\n return (code << 10) + next - 0x35fdc00\n}\n\npp$8.skipBlockComment = function() {\n var this$1 = this;\n\n var startLoc = this.options.onComment && this.curPosition()\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2)\n if (end === -1) this.raise(this.pos - 2, \"Unterminated comment\")\n this.pos = end + 2\n if (this.options.locations) {\n lineBreakG.lastIndex = start\n var match\n while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {\n ++this$1.curLine\n this$1.lineStart = match.index + match[0].length\n }\n }\n if (this.options.onComment)\n this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition())\n}\n\npp$8.skipLineComment = function(startSkip) {\n var this$1 = this;\n\n var start = this.pos\n var startLoc = this.options.onComment && this.curPosition()\n var ch = this.input.charCodeAt(this.pos += startSkip)\n while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {\n ++this$1.pos\n ch = this$1.input.charCodeAt(this$1.pos)\n }\n if (this.options.onComment)\n this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition())\n}\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp$8.skipSpace = function() {\n var this$1 = this;\n\n loop: while (this.pos < this.input.length) {\n var ch = this$1.input.charCodeAt(this$1.pos)\n switch (ch) {\n case 32: case 160: // ' '\n ++this$1.pos\n break\n case 13:\n if (this$1.input.charCodeAt(this$1.pos + 1) === 10) {\n ++this$1.pos\n }\n case 10: case 8232: case 8233:\n ++this$1.pos\n if (this$1.options.locations) {\n ++this$1.curLine\n this$1.lineStart = this$1.pos\n }\n break\n case 47: // '/'\n switch (this$1.input.charCodeAt(this$1.pos + 1)) {\n case 42: // '*'\n this$1.skipBlockComment()\n break\n case 47:\n this$1.skipLineComment(2)\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this$1.pos\n } else {\n break loop\n }\n }\n }\n}\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp$8.finishToken = function(type, val) {\n this.end = this.pos\n if (this.options.locations) this.endLoc = this.curPosition()\n var prevType = this.type\n this.type = type\n this.value = val\n\n this.updateContext(prevType)\n}\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp$8.readToken_dot = function() {\n var next = this.input.charCodeAt(this.pos + 1)\n if (next >= 48 && next <= 57) return this.readNumber(true)\n var next2 = this.input.charCodeAt(this.pos + 2)\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3\n return this.finishToken(tt.ellipsis)\n } else {\n ++this.pos\n return this.finishToken(tt.dot)\n }\n}\n\npp$8.readToken_slash = function() { // '/'\n var next = this.input.charCodeAt(this.pos + 1)\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.slash, 1)\n}\n\npp$8.readToken_mult_modulo_exp = function(code) { // '%*'\n var next = this.input.charCodeAt(this.pos + 1)\n var size = 1\n var tokentype = code === 42 ? tt.star : tt.modulo\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && next === 42) {\n ++size\n tokentype = tt.starstar\n next = this.input.charCodeAt(this.pos + 2)\n }\n\n if (next === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tokentype, size)\n}\n\npp$8.readToken_pipe_amp = function(code) { // '|&'\n var next = this.input.charCodeAt(this.pos + 1)\n if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)\n}\n\npp$8.readToken_caret = function() { // '^'\n var next = this.input.charCodeAt(this.pos + 1)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.bitwiseXOR, 1)\n}\n\npp$8.readToken_plus_min = function(code) { // '+-'\n var next = this.input.charCodeAt(this.pos + 1)\n if (next === code) {\n if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&\n lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {\n // A `-->` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp$8.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1)\n var size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&\n this.input.charCodeAt(this.pos + 3) == 45) {\n if (this.inModule) this.unexpected()\n // `<!--`, an XML-style comment that should be interpreted as a line comment\n this.skipLineComment(4)\n this.skipSpace()\n return this.nextToken()\n }\n if (next === 61) size = 2\n return this.finishOp(tt.relational, size)\n}\n\npp$8.readToken_eq_excl = function(code) { // '=!'\n var next = this.input.charCodeAt(this.pos + 1)\n if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2)\n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'\n this.pos += 2\n return this.finishToken(tt.arrow)\n }\n return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1)\n}\n\npp$8.getTokenFromCode = function(code) {\n switch (code) {\n // The interpretation of a dot depends on whether it is followed\n // by a digit or another two dots.\n case 46: // '.'\n return this.readToken_dot()\n\n // Punctuation tokens.\n case 40: ++this.pos; return this.finishToken(tt.parenL)\n case 41: ++this.pos; return this.finishToken(tt.parenR)\n case 59: ++this.pos; return this.finishToken(tt.semi)\n case 44: ++this.pos; return this.finishToken(tt.comma)\n case 91: ++this.pos; return this.finishToken(tt.bracketL)\n case 93: ++this.pos; return this.finishToken(tt.bracketR)\n case 123: ++this.pos; return this.finishToken(tt.braceL)\n case 125: ++this.pos; return this.finishToken(tt.braceR)\n case 58: ++this.pos; return this.finishToken(tt.colon)\n case 63: ++this.pos; return this.finishToken(tt.question)\n\n case 96: // '`'\n if (this.options.ecmaVersion < 6) break\n ++this.pos\n return this.finishToken(tt.backQuote)\n\n case 48: // '0'\n var next = this.input.charCodeAt(this.pos + 1)\n if (next === 120 || next === 88) return this.readRadixNumber(16) // '0x', '0X' - hex number\n if (this.options.ecmaVersion >= 6) {\n if (next === 111 || next === 79) return this.readRadixNumber(8) // '0o', '0O' - octal number\n if (next === 98 || next === 66) return this.readRadixNumber(2) // '0b', '0B' - binary number\n }\n // Anything else beginning with a digit is an integer, octal\n // number, or float.\n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9\n return this.readNumber(false)\n\n // Quotes produce strings.\n case 34: case 39: // '\"', \"'\"\n return this.readString(code)\n\n // Operators are parsed inline in tiny state machines. '=' (61) is\n // often referred to. `finishOp` simply skips the amount of\n // characters it is given as second argument, and returns a token\n // of the type given by its first argument.\n\n case 47: // '/'\n return this.readToken_slash()\n\n case 37: case 42: // '%*'\n return this.readToken_mult_modulo_exp(code)\n\n case 124: case 38: // '|&'\n return this.readToken_pipe_amp(code)\n\n case 94: // '^'\n return this.readToken_caret()\n\n case 43: case 45: // '+-'\n return this.readToken_plus_min(code)\n\n case 60: case 62: // '<>'\n return this.readToken_lt_gt(code)\n\n case 61: case 33: // '=!'\n return this.readToken_eq_excl(code)\n\n case 126: // '~'\n return this.finishOp(tt.prefix, 1)\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\")\n}\n\npp$8.finishOp = function(type, size) {\n var str = this.input.slice(this.pos, this.pos + size)\n this.pos += size\n return this.finishToken(type, str)\n}\n\n// Parse a regular expression. Some context-awareness is necessary,\n// since a '/' inside a '[]' set does not end the expression.\n\nfunction tryCreateRegexp(src, flags, throwErrorAt, parser) {\n try {\n return new RegExp(src, flags)\n } catch (e) {\n if (throwErrorAt !== undefined) {\n if (e instanceof SyntaxError) parser.raise(throwErrorAt, \"Error parsing regular expression: \" + e.message)\n throw e\n }\n }\n}\n\nvar regexpUnicodeSupport = !!tryCreateRegexp(\"\\uffff\", \"u\")\n\npp$8.readRegexp = function() {\n var this$1 = this;\n\n var escaped, inClass, start = this.pos\n for (;;) {\n if (this$1.pos >= this$1.input.length) this$1.raise(start, \"Unterminated regular expression\")\n var ch = this$1.input.charAt(this$1.pos)\n if (lineBreak.test(ch)) this$1.raise(start, \"Unterminated regular expression\")\n if (!escaped) {\n if (ch === \"[\") inClass = true\n else if (ch === \"]\" && inClass) inClass = false\n else if (ch === \"/\" && !inClass) break\n escaped = ch === \"\\\\\"\n } else escaped = false\n ++this$1.pos\n }\n var content = this.input.slice(start, this.pos)\n ++this.pos\n // Need to use `readWord1` because '\\uXXXX' sequences are allowed\n // here (don't ask).\n var mods = this.readWord1()\n var tmp = content, tmpFlags = \"\"\n if (mods) {\n var validFlags = /^[gim]*$/\n if (this.options.ecmaVersion >= 6) validFlags = /^[gimuy]*$/\n if (!validFlags.test(mods)) this.raise(start, \"Invalid regular expression flag\")\n if (mods.indexOf(\"u\") >= 0) {\n if (regexpUnicodeSupport) {\n tmpFlags = \"u\"\n } else {\n // Replace each astral symbol and every Unicode escape sequence that\n // possibly represents an astral symbol or a paired surrogate with a\n // single ASCII symbol to avoid throwing on regular expressions that\n // are only valid in combination with the `/u` flag.\n // Note: replacing with the ASCII symbol `x` might cause false\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n // perfectly valid pattern that is equivalent to `[a-b]`, but it would\n // be replaced by `[x-b]` which throws an error.\n tmp = tmp.replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function (_match, code, offset) {\n code = Number(\"0x\" + code)\n if (code > 0x10FFFF) this$1.raise(start + offset + 3, \"Code point out of bounds\")\n return \"x\"\n })\n tmp = tmp.replace(/\\\\u([a-fA-F0-9]{4})|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, \"x\")\n tmpFlags = tmpFlags.replace(\"u\", \"\")\n }\n }\n }\n // Detect invalid regular expressions.\n var value = null\n // Rhino's regular expression parser is flaky and throws uncatchable exceptions,\n // so don't do detection if we are running under Rhino\n if (!isRhino) {\n tryCreateRegexp(tmp, tmpFlags, start, this)\n // Get a regular expression object for this pattern-flag pair, or `null` in\n // case the current environment doesn't support the flags it uses.\n value = tryCreateRegexp(content, mods)\n }\n return this.finishToken(tt.regexp, {pattern: content, flags: mods, value: value})\n}\n\n// Read an integer in the given radix. Return null if zero digits\n// were read, the integer value otherwise. When `len` is given, this\n// will return `null` unless the integer has exactly `len` digits.\n\npp$8.readInt = function(radix, len) {\n var this$1 = this;\n\n var start = this.pos, total = 0\n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {\n var code = this$1.input.charCodeAt(this$1.pos), val\n if (code >= 97) val = code - 97 + 10 // a\n else if (code >= 65) val = code - 65 + 10 // A\n else if (code >= 48 && code <= 57) val = code - 48 // 0-9\n else val = Infinity\n if (val >= radix) break\n ++this$1.pos\n total = total * radix + val\n }\n if (this.pos === start || len != null && this.pos - start !== len) return null\n\n return total\n}\n\npp$8.readRadixNumber = function(radix) {\n this.pos += 2 // 0x\n var val = this.readInt(radix)\n if (val == null) this.raise(this.start + 2, \"Expected number in radix \" + radix)\n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\n return this.finishToken(tt.num, val)\n}\n\n// Read an integer, octal integer, or floating-point number.\n\npp$8.readNumber = function(startsWithDot) {\n var start = this.pos, isFloat = false, octal = this.input.charCodeAt(this.pos) === 48\n if (!startsWithDot && this.readInt(10) === null) this.raise(start, \"Invalid number\")\n if (octal && this.pos == start + 1) octal = false\n var next = this.input.charCodeAt(this.pos)\n if (next === 46 && !octal) { // '.'\n ++this.pos\n this.readInt(10)\n isFloat = true\n next = this.input.charCodeAt(this.pos)\n }\n if ((next === 69 || next === 101) && !octal) { // 'eE'\n next = this.input.charCodeAt(++this.pos)\n if (next === 43 || next === 45) ++this.pos // '+-'\n if (this.readInt(10) === null) this.raise(start, \"Invalid number\")\n isFloat = true\n }\n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\n\n var str = this.input.slice(start, this.pos), val\n if (isFloat) val = parseFloat(str)\n else if (!octal || str.length === 1) val = parseInt(str, 10)\n else if (/[89]/.test(str) || this.strict) this.raise(start, \"Invalid number\")\n else val = parseInt(str, 8)\n return this.finishToken(tt.num, val)\n}\n\n// Read a string value, interpreting backslash-escapes.\n\npp$8.readCodePoint = function() {\n var ch = this.input.charCodeAt(this.pos), code\n\n if (ch === 123) {\n if (this.options.ecmaVersion < 6) this.unexpected()\n var codePos = ++this.pos\n code = this.readHexChar(this.input.indexOf(\"}\", this.pos) - this.pos)\n ++this.pos\n if (code > 0x10FFFF) this.raise(codePos, \"Code point out of bounds\")\n } else {\n code = this.readHexChar(4)\n }\n return code\n}\n\nfunction codePointToString(code) {\n // UTF-16 Decoding\n if (code <= 0xFFFF) return String.fromCharCode(code)\n code -= 0x10000\n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)\n}\n\npp$8.readString = function(quote) {\n var this$1 = this;\n\n var out = \"\", chunkStart = ++this.pos\n for (;;) {\n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, \"Unterminated string constant\")\n var ch = this$1.input.charCodeAt(this$1.pos)\n if (ch === quote) break\n if (ch === 92) { // '\\'\n out += this$1.input.slice(chunkStart, this$1.pos)\n out += this$1.readEscapedChar(false)\n chunkStart = this$1.pos\n } else {\n if (isNewLine(ch)) this$1.raise(this$1.start, \"Unterminated string constant\")\n ++this$1.pos\n }\n }\n out += this.input.slice(chunkStart, this.pos++)\n return this.finishToken(tt.string, out)\n}\n\n// Reads template string tokens.\n\npp$8.readTmplToken = function() {\n var this$1 = this;\n\n var out = \"\", chunkStart = this.pos\n for (;;) {\n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, \"Unterminated template\")\n var ch = this$1.input.charCodeAt(this$1.pos)\n if (ch === 96 || ch === 36 && this$1.input.charCodeAt(this$1.pos + 1) === 123) { // '`', '${'\n if (this$1.pos === this$1.start && this$1.type === tt.template) {\n if (ch === 36) {\n this$1.pos += 2\n return this$1.finishToken(tt.dollarBraceL)\n } else {\n ++this$1.pos\n return this$1.finishToken(tt.backQuote)\n }\n }\n out += this$1.input.slice(chunkStart, this$1.pos)\n return this$1.finishToken(tt.template, out)\n }\n if (ch === 92) { // '\\'\n out += this$1.input.slice(chunkStart, this$1.pos)\n out += this$1.readEscapedChar(true)\n chunkStart = this$1.pos\n } else if (isNewLine(ch)) {\n out += this$1.input.slice(chunkStart, this$1.pos)\n ++this$1.pos\n switch (ch) {\n case 13:\n if (this$1.input.charCodeAt(this$1.pos) === 10) ++this$1.pos\n case 10:\n out += \"\\n\"\n break\n default:\n out += String.fromCharCode(ch)\n break\n }\n if (this$1.options.locations) {\n ++this$1.curLine\n this$1.lineStart = this$1.pos\n }\n chunkStart = this$1.pos\n } else {\n ++this$1.pos\n }\n }\n}\n\n// Used to read escaped characters\n\npp$8.readEscapedChar = function(inTemplate) {\n var ch = this.input.charCodeAt(++this.pos)\n ++this.pos\n switch (ch) {\n case 110: return \"\\n\" // 'n' -> '\\n'\n case 114: return \"\\r\" // 'r' -> '\\r'\n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'\n case 117: return codePointToString(this.readCodePoint()) // 'u'\n case 116: return \"\\t\" // 't' -> '\\t'\n case 98: return \"\\b\" // 'b' -> '\\b'\n case 118: return \"\\u000b\" // 'v' -> '\\u000b'\n case 102: return \"\\f\" // 'f' -> '\\f'\n case 13: if (this.input.charCodeAt(this.pos) === 10) ++this.pos // '\\r\\n'\n case 10: // ' \\n'\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine }\n return \"\"\n default:\n if (ch >= 48 && ch <= 55) {\n var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]\n var octal = parseInt(octalStr, 8)\n if (octal > 255) {\n octalStr = octalStr.slice(0, -1)\n octal = parseInt(octalStr, 8)\n }\n if (octalStr !== \"0\" && (this.strict || inTemplate)) {\n this.raise(this.pos - 2, \"Octal literal in strict mode\")\n }\n this.pos += octalStr.length - 1\n return String.fromCharCode(octal)\n }\n return String.fromCharCode(ch)\n }\n}\n\n// Used to read character escape sequences ('\\x', '\\u', '\\U').\n\npp$8.readHexChar = function(len) {\n var codePos = this.pos\n var n = this.readInt(16, len)\n if (n === null) this.raise(codePos, \"Bad character escape sequence\")\n return n\n}\n\n// Read an identifier, and return it as a string. Sets `this.containsEsc`\n// to whether the word contained a '\\u' escape.\n//\n// Incrementally adds only escaped chars, adding other chunks as-is\n// as a micro-optimization.\n\npp$8.readWord1 = function() {\n var this$1 = this;\n\n this.containsEsc = false\n var word = \"\", first = true, chunkStart = this.pos\n var astral = this.options.ecmaVersion >= 6\n while (this.pos < this.input.length) {\n var ch = this$1.fullCharCodeAtPos()\n if (isIdentifierChar(ch, astral)) {\n this$1.pos += ch <= 0xffff ? 1 : 2\n } else if (ch === 92) { // \"\\\"\n this$1.containsEsc = true\n word += this$1.input.slice(chunkStart, this$1.pos)\n var escStart = this$1.pos\n if (this$1.input.charCodeAt(++this$1.pos) != 117) // \"u\"\n this$1.raise(this$1.pos, \"Expecting Unicode escape sequence \\\\uXXXX\")\n ++this$1.pos\n var esc = this$1.readCodePoint()\n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))\n this$1.raise(escStart, \"Invalid Unicode escape\")\n word += codePointToString(esc)\n chunkStart = this$1.pos\n } else {\n break\n }\n first = false\n }\n return word + this.input.slice(chunkStart, this.pos)\n}\n\n// Read an identifier or keyword token. Will check for reserved\n// words when necessary.\n\npp$8.readWord = function() {\n var word = this.readWord1()\n var type = tt.name\n if (this.keywords.test(word)) {\n if (this.containsEsc) this.raiseRecoverable(this.start, \"Escape sequence in keyword \" + word)\n type = keywordTypes[word]\n }\n return this.finishToken(type, word)\n}\n\n// Acorn is a tiny, fast JavaScript parser written in JavaScript.\n//\n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and\n// various contributors and released under an MIT license.\n//\n// Git repositories for Acorn are available at\n//\n// http://marijnhaverbeke.nl/git/acorn\n// https://github.com/ternjs/acorn.git\n//\n// Please use the [github bug tracker][ghbt] to report issues.\n//\n// [ghbt]: https://github.com/ternjs/acorn/issues\n//\n// This file defines the main parser interface. The library also comes\n// with a [error-tolerant parser][dammit] and an\n// [abstract syntax tree walker][walk], defined in other files.\n//\n// [dammit]: acorn_loose.js\n// [walk]: util/walk.js\n\nvar version = \"5.0.3\"\n\n// The main exported interface (under `self.acorn` when in the\n// browser) is a `parse` function that takes a code string and\n// returns an abstract syntax tree as specified by [Mozilla parser\n// API][api].\n//\n// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API\n\nfunction parse(input, options) {\n return new Parser(options, input).parse()\n}\n\n// This function tries to parse a single expression at a given\n// offset in a string. Useful for parsing mixed-language formats\n// that embed JavaScript expressions.\n\nfunction parseExpressionAt(input, pos, options) {\n var p = new Parser(options, input, pos)\n p.nextToken()\n return p.parseExpression()\n}\n\n// Acorn is organized as a tokenizer and a recursive-descent parser.\n// The `tokenizer` export provides an interface to the tokenizer.\n\nfunction tokenizer(input, options) {\n return new Parser(options, input)\n}\n\n// This is a terrible kludge to support the existing, pre-ES6\n// interface where the loose parser module retroactively adds exports\n// to this module.\n// eslint-disable-line camelcase\nfunction addLooseExports(parse, Parser, plugins) {\n exports.parse_dammit = parse // eslint-disable-line camelcase\n exports.LooseParser = Parser\n exports.pluginsLoose = plugins\n}\n\nexports.version = version;\nexports.parse = parse;\nexports.parseExpressionAt = parseExpressionAt;\nexports.tokenizer = tokenizer;\nexports.addLooseExports = addLooseExports;\nexports.Parser = Parser;\nexports.plugins = plugins;\nexports.defaultOptions = defaultOptions;\nexports.Position = Position;\nexports.SourceLocation = SourceLocation;\nexports.getLineInfo = getLineInfo;\nexports.Node = Node;\nexports.TokenType = TokenType;\nexports.tokTypes = tt;\nexports.keywordTypes = keywordTypes;\nexports.TokContext = TokContext;\nexports.tokContexts = types;\nexports.isIdentifierChar = isIdentifierChar;\nexports.isIdentifierStart = isIdentifierStart;\nexports.Token = Token;\nexports.isNewLine = isNewLine;\nexports.lineBreak = lineBreak;\nexports.lineBreakG = lineBreakG;\nexports.nonASCIIwhitespace = nonASCIIwhitespace;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar cache_1 = __webpack_require__(9);\n/**\n * Clears the chevrotain internal cache.\n * This should not be used in regular work flows, This is intended for\n * unique use cases for example: online playground where the a parser with the same name is initialized with\n * different implementations multiple times.\n */\nfunction clearCache() {\n cache_1.clearCache();\n}\nexports.clearCache = clearCache;\n//# sourceMappingURL=cache_public.js.map\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = __webpack_require__(0);\nvar lang_extensions_1 = __webpack_require__(5);\nvar checks_1 = __webpack_require__(26);\nfunction defaultVisit(ctx, param) {\n var childrenNames = utils_1.keys(ctx);\n var childrenNamesLength = childrenNames.length;\n for (var i = 0; i < childrenNamesLength; i++) {\n var currChildName = childrenNames[i];\n var currChildArray = ctx[currChildName];\n var currChildArrayLength = currChildArray.length;\n for (var j = 0; j < currChildArrayLength; j++) {\n var currChild = currChildArray[j];\n // distinction between Tokens Children and CstNode children\n if (currChild.tokenType === undefined) {\n if (currChild.fullName !== undefined) {\n this[currChild.fullName](currChild.children, param);\n }\n else {\n this[currChild.name](currChild.children, param);\n }\n }\n }\n }\n // defaultVisit does not support generic out param\n return undefined;\n}\nexports.defaultVisit = defaultVisit;\nfunction createBaseSemanticVisitorConstructor(grammarName, ruleNames) {\n var derivedConstructor = function () { };\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n lang_extensions_1.defineNameProp(derivedConstructor, grammarName + \"BaseSemantics\");\n var semanticProto = {\n visit: function (cstNode, param) {\n // enables writing more concise visitor methods when CstNode has only a single child\n if (utils_1.isArray(cstNode)) {\n if (cstNode.length > 0) {\n cstNode = cstNode[0];\n }\n else {\n return undefined;\n }\n }\n if (cstNode.fullName !== undefined) {\n return this[cstNode.fullName](cstNode.children, param);\n }\n else {\n return this[cstNode.name](cstNode.children, param);\n }\n },\n validateVisitor: function () {\n var semanticDefinitionErrors = validateVisitor(this, ruleNames);\n if (!utils_1.isEmpty(semanticDefinitionErrors)) {\n var errorMessages = utils_1.map(semanticDefinitionErrors, function (currDefError) { return currDefError.msg; });\n throw Error(\"Errors Detected in CST Visitor <\" + lang_extensions_1.functionName(this.constructor) + \">:\\n\\t\" +\n (\"\" + errorMessages.join(\"\\n\\n\").replace(/\\n/g, \"\\n\\t\")));\n }\n }\n };\n derivedConstructor.prototype = semanticProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n derivedConstructor._RULE_NAMES = ruleNames;\n return derivedConstructor;\n}\nexports.createBaseSemanticVisitorConstructor = createBaseSemanticVisitorConstructor;\nfunction createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {\n var derivedConstructor = function () { };\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n lang_extensions_1.defineNameProp(derivedConstructor, grammarName + \"BaseSemanticsWithDefaults\");\n var withDefaultsProto = Object.create(baseConstructor.prototype);\n utils_1.forEach(ruleNames, function (ruleName) {\n withDefaultsProto[ruleName] = defaultVisit;\n });\n derivedConstructor.prototype = withDefaultsProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n return derivedConstructor;\n}\nexports.createBaseVisitorConstructorWithDefaults = createBaseVisitorConstructorWithDefaults;\nvar CstVisitorDefinitionError;\n(function (CstVisitorDefinitionError) {\n CstVisitorDefinitionError[CstVisitorDefinitionError[\"REDUNDANT_METHOD\"] = 0] = \"REDUNDANT_METHOD\";\n CstVisitorDefinitionError[CstVisitorDefinitionError[\"MISSING_METHOD\"] = 1] = \"MISSING_METHOD\";\n})(CstVisitorDefinitionError = exports.CstVisitorDefinitionError || (exports.CstVisitorDefinitionError = {}));\nfunction validateVisitor(visitorInstance, ruleNames) {\n var missingErrors = validateMissingCstMethods(visitorInstance, ruleNames);\n var redundantErrors = validateRedundantMethods(visitorInstance, ruleNames);\n return missingErrors.concat(redundantErrors);\n}\nexports.validateVisitor = validateVisitor;\nfunction validateMissingCstMethods(visitorInstance, ruleNames) {\n var errors = utils_1.map(ruleNames, function (currRuleName) {\n if (!utils_1.isFunction(visitorInstance[currRuleName])) {\n return {\n msg: \"Missing visitor method: <\" + currRuleName + \"> on \" + lang_extensions_1.functionName(visitorInstance.constructor) + \" CST Visitor.\",\n type: CstVisitorDefinitionError.MISSING_METHOD,\n methodName: currRuleName\n };\n }\n });\n return utils_1.compact(errors);\n}\nexports.validateMissingCstMethods = validateMissingCstMethods;\nvar VALID_PROP_NAMES = [\"constructor\", \"visit\", \"validateVisitor\"];\nfunction validateRedundantMethods(visitorInstance, ruleNames) {\n var errors = [];\n for (var prop in visitorInstance) {\n if (checks_1.validTermsPattern.test(prop) &&\n utils_1.isFunction(visitorInstance[prop]) &&\n !utils_1.contains(VALID_PROP_NAMES, prop) &&\n !utils_1.contains(ruleNames, prop)) {\n errors.push({\n msg: \"Redundant visitor method: <\" + prop + \"> on \" + lang_extensions_1.functionName(visitorInstance.constructor) + \" CST Visitor\\n\" +\n \"There is no Grammar Rule corresponding to this method's name.\\n\" +\n (\"For utility methods on visitor classes use methods names that do not match /\" + checks_1.validTermsPattern.source + \"/.\"),\n type: CstVisitorDefinitionError.REDUNDANT_METHOD,\n methodName: prop\n });\n }\n }\n return errors;\n}\nexports.validateRedundantMethods = validateRedundantMethods;\n//# sourceMappingURL=cst_visitor.js.map\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar range_1 = __webpack_require__(53);\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\nvar ProdType;\n(function (ProdType) {\n ProdType[ProdType[\"OPTION\"] = 0] = \"OPTION\";\n ProdType[ProdType[\"OR\"] = 1] = \"OR\";\n ProdType[ProdType[\"MANY\"] = 2] = \"MANY\";\n ProdType[ProdType[\"MANY_SEP\"] = 3] = \"MANY_SEP\";\n ProdType[ProdType[\"AT_LEAST_ONE\"] = 4] = \"AT_LEAST_ONE\";\n ProdType[ProdType[\"AT_LEAST_ONE_SEP\"] = 5] = \"AT_LEAST_ONE_SEP\";\n ProdType[ProdType[\"REF\"] = 6] = \"REF\";\n ProdType[ProdType[\"TERMINAL\"] = 7] = \"TERMINAL\";\n ProdType[ProdType[\"FLAT\"] = 8] = \"FLAT\";\n})(ProdType = exports.ProdType || (exports.ProdType = {}));\nvar namePropRegExp = /(?:\\s*{\\s*NAME\\s*:\\s*[\"'`]([\\w$]*)[\"'`])?/;\nvar namePropRegExpNoCurlyFirstOfTwo = new RegExp(namePropRegExp.source\n .replace(\"{\", \"\")\n .replace(\")?\", \"\\\\s*,)?\"));\nvar terminalRegEx = /\\.\\s*CONSUME(\\d)?\\s*\\(\\s*(?:[a-zA-Z_$]\\w*\\s*\\.\\s*)*([a-zA-Z_$]\\w*)/;\nvar terminalRegGlobal = new RegExp(terminalRegEx.source, \"g\");\nvar refRegEx = /\\.\\s*SUBRULE(\\d)?\\s*\\(\\s*(?:[a-zA-Z_$]\\w*\\s*\\.\\s*)*([a-zA-Z_$]\\w*)/;\nvar refRegExGlobal = new RegExp(refRegEx.source, \"g\");\nvar optionPrefixRegEx = /\\.\\s*OPTION(\\d)?\\s*\\(/;\nvar optionRegEx = new RegExp(optionPrefixRegEx.source + namePropRegExp.source);\nvar optionRegExGlobal = new RegExp(optionPrefixRegEx.source, \"g\");\nvar manyPrefixRegEx = /\\.\\s*MANY(\\d)?\\s*\\(/;\nvar manyRegEx = new RegExp(manyPrefixRegEx.source + namePropRegExp.source);\nvar manyRegExGlobal = new RegExp(manyPrefixRegEx.source, \"g\");\nvar sepPropRegEx = /\\s*SEP\\s*:\\s*(?:[a-zA-Z_$]\\w*\\s*\\.\\s*)*([a-zA-Z_$]\\w*)/;\nvar manySepPrefixRegEx = /\\.\\s*MANY_SEP(\\d)?\\s*\\(\\s*{/;\nvar manyWithSeparatorRegEx = new RegExp(manySepPrefixRegEx.source + namePropRegExpNoCurlyFirstOfTwo.source + sepPropRegEx.source);\nvar manyWithSeparatorRegExGlobal = new RegExp(manyWithSeparatorRegEx.source, \"g\");\nvar atLeastOneSepPrefixRegEx = /\\.\\s*AT_LEAST_ONE_SEP(\\d)?\\s*\\(\\s*{/;\nvar atLeastOneWithSeparatorRegEx = new RegExp(atLeastOneSepPrefixRegEx.source +\n namePropRegExpNoCurlyFirstOfTwo.source +\n sepPropRegEx.source);\nvar atLeastOneWithSeparatorRegExGlobal = new RegExp(atLeastOneWithSeparatorRegEx.source, \"g\");\nvar atLeastOnePrefixRegEx = /\\.\\s*AT_LEAST_ONE(\\d)?\\s*\\(/;\nvar atLeastOneRegEx = new RegExp(atLeastOnePrefixRegEx.source + namePropRegExp.source);\nvar atLeastOneRegExGlobal = new RegExp(atLeastOnePrefixRegEx.source, \"g\");\nvar orPrefixRegEx = /\\.\\s*OR(\\d)?\\s*\\(/;\nvar orRegEx = new RegExp(orPrefixRegEx.source + namePropRegExp.source);\nvar orRegExGlobal = new RegExp(orPrefixRegEx.source, \"g\");\nvar orPartSuffixRegEx = /\\s*(ALT)\\s*:/;\nvar orPartRegEx = new RegExp(namePropRegExpNoCurlyFirstOfTwo.source + orPartSuffixRegEx.source);\nvar orPartRegExGlobal = new RegExp(orPartRegEx.source, \"g\");\nexports.terminalNameToConstructor = {};\nfunction buildTopProduction(impelText, name, terminals) {\n // pseudo state. so little state does not yet mandate the complexity of wrapping in a class...\n // TODO: this is confusing, might be time to create a class..\n exports.terminalNameToConstructor = terminals;\n // the top most range must strictly contain all the other ranges\n // which is why we prefix the text with \" \" (curr Range impel is only for positive ranges)\n var spacedImpelText = \" \" + impelText;\n // TODO: why do we add whitespace twice?\n var txtWithoutComments = removeComments(\" \" + spacedImpelText);\n var textWithoutCommentsAndStrings = removeStringLiterals(txtWithoutComments);\n var prodRanges = createRanges(textWithoutCommentsAndStrings);\n var topRange = new range_1.Range(0, impelText.length + 2);\n var topRule = buildTopLevel(name, topRange, prodRanges, impelText);\n return topRule;\n}\nexports.buildTopProduction = buildTopProduction;\nfunction buildTopLevel(name, topRange, allRanges, orgText) {\n var topLevelProd = new gast_public_1.gast.Rule(name, [], orgText);\n return buildAbstractProd(topLevelProd, topRange, allRanges);\n}\nfunction buildProdGast(prodRange, allRanges) {\n \"use strict\";\n switch (prodRange.type) {\n case ProdType.AT_LEAST_ONE:\n return buildAtLeastOneProd(prodRange, allRanges);\n case ProdType.AT_LEAST_ONE_SEP:\n return buildAtLeastOneSepProd(prodRange, allRanges);\n case ProdType.MANY_SEP:\n return buildManySepProd(prodRange, allRanges);\n case ProdType.MANY:\n return buildManyProd(prodRange, allRanges);\n case ProdType.OPTION:\n return buildOptionProd(prodRange, allRanges);\n case ProdType.OR:\n return buildOrProd(prodRange, allRanges);\n case ProdType.FLAT:\n return buildFlatProd(prodRange, allRanges);\n case ProdType.REF:\n return buildRefProd(prodRange);\n case ProdType.TERMINAL:\n return buildTerminalProd(prodRange);\n /* istanbul ignore next */\n default:\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.buildProdGast = buildProdGast;\nfunction buildRefProd(prodRange) {\n var reResult = refRegEx.exec(prodRange.text);\n var isImplicitOccurrenceIdx = reResult[1] === undefined;\n var refOccurrence = isImplicitOccurrenceIdx ? 1 : parseInt(reResult[1], 10);\n var refProdName = reResult[2];\n var newRef = new gast_public_1.gast.NonTerminal(refProdName, undefined, refOccurrence);\n newRef.implicitOccurrenceIndex = isImplicitOccurrenceIdx;\n return newRef;\n}\nfunction buildTerminalProd(prodRange) {\n var reResult = terminalRegEx.exec(prodRange.text);\n var isImplicitOccurrenceIdx = reResult[1] === undefined;\n var terminalOccurrence = isImplicitOccurrenceIdx ? 1 : parseInt(reResult[1], 10);\n var terminalName = reResult[2];\n var terminalType = exports.terminalNameToConstructor[terminalName];\n if (!terminalType) {\n throw Error(\"Terminal Token name: \" + terminalName + \" not found\");\n }\n var newTerminal = new gast_public_1.gast.Terminal(terminalType, terminalOccurrence);\n newTerminal.implicitOccurrenceIndex = isImplicitOccurrenceIdx;\n return newTerminal;\n}\nfunction buildProdWithOccurrence(regEx, prodInstance, prodRange, allRanges) {\n var reResult = regEx.exec(prodRange.text);\n var isImplicitOccurrenceIdx = reResult[1] === undefined;\n prodInstance.occurrenceInParent = isImplicitOccurrenceIdx ? 1 : parseInt(reResult[1], 10);\n prodInstance.implicitOccurrenceIndex = isImplicitOccurrenceIdx;\n var nestedName = reResult[2];\n if (!utils_1.isUndefined(nestedName)) {\n prodInstance.name = nestedName;\n }\n return buildAbstractProd(prodInstance, prodRange.range, allRanges);\n}\nfunction buildAtLeastOneProd(prodRange, allRanges) {\n return buildProdWithOccurrence(atLeastOneRegEx, new gast_public_1.gast.RepetitionMandatory([]), prodRange, allRanges);\n}\nfunction buildAtLeastOneSepProd(prodRange, allRanges) {\n return buildRepetitionWithSep(prodRange, allRanges, gast_public_1.gast.RepetitionMandatoryWithSeparator, atLeastOneWithSeparatorRegEx);\n}\nfunction buildManyProd(prodRange, allRanges) {\n return buildProdWithOccurrence(manyRegEx, new gast_public_1.gast.Repetition([]), prodRange, allRanges);\n}\nfunction buildManySepProd(prodRange, allRanges) {\n return buildRepetitionWithSep(prodRange, allRanges, gast_public_1.gast.RepetitionWithSeparator, manyWithSeparatorRegEx);\n}\nfunction buildRepetitionWithSep(prodRange, allRanges, repConstructor, regExp) {\n var reResult = regExp.exec(prodRange.text);\n var isImplicitOccurrenceIdx = reResult[1] === undefined;\n var occurrenceIdx = isImplicitOccurrenceIdx ? 1 : parseInt(reResult[1], 10);\n var sepName = reResult[3];\n var separatorType = exports.terminalNameToConstructor[sepName];\n if (!separatorType) {\n throw Error(\"Separator Terminal Token name: \" + sepName + \" not found\");\n }\n var repetitionInstance = new repConstructor([], separatorType, occurrenceIdx);\n repetitionInstance.implicitOccurrenceIndex = isImplicitOccurrenceIdx;\n var nestedName = reResult[2];\n if (!utils_1.isUndefined(nestedName)) {\n repetitionInstance.name = nestedName;\n }\n return buildAbstractProd(repetitionInstance, prodRange.range, allRanges);\n}\nfunction buildOptionProd(prodRange, allRanges) {\n return buildProdWithOccurrence(optionRegEx, new gast_public_1.gast.Option([]), prodRange, allRanges);\n}\nfunction buildOrProd(prodRange, allRanges) {\n return buildProdWithOccurrence(orRegEx, new gast_public_1.gast.Alternation([]), prodRange, allRanges);\n}\nfunction buildFlatProd(prodRange, allRanges) {\n var prodInstance = new gast_public_1.gast.Flat([]);\n var reResult = orPartRegEx.exec(prodRange.text);\n var nestedName = reResult[1];\n if (!utils_1.isUndefined(nestedName)) {\n prodInstance.name = nestedName;\n }\n return buildAbstractProd(prodInstance, prodRange.range, allRanges);\n}\nfunction buildAbstractProd(prod, topLevelRange, allRanges) {\n var secondLevelProds = getDirectlyContainedRanges(topLevelRange, allRanges);\n var secondLevelInOrder = utils_1.sortBy(secondLevelProds, function (prodRng) { return prodRng.range.start; });\n var definition = [];\n utils_1.forEach(secondLevelInOrder, function (prodRng) {\n definition.push(buildProdGast(prodRng, allRanges));\n });\n prod.definition = definition;\n return prod;\n}\nfunction getDirectlyContainedRanges(y, prodRanges) {\n return utils_1.filter(prodRanges, function (x) {\n var isXDescendantOfY = y.strictlyContainsRange(x.range);\n var xDoesNotHaveAnyAncestorWhichIsDecendantOfY = utils_1.every(prodRanges, function (maybeAnotherParent) {\n var isParentOfX = maybeAnotherParent.range.strictlyContainsRange(x.range);\n var isChildOfY = maybeAnotherParent.range.isStrictlyContainedInRange(y);\n return !(isParentOfX && isChildOfY);\n });\n return isXDescendantOfY && xDoesNotHaveAnyAncestorWhichIsDecendantOfY;\n });\n}\nexports.getDirectlyContainedRanges = getDirectlyContainedRanges;\nvar singleLineCommentRegEx = /\\/\\/.*/g;\nvar multiLineCommentRegEx = /\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\//g;\nvar doubleQuoteStringLiteralRegEx = /(NAME\\s*:\\s*)?\"([^\\\\\"]|\\\\([bfnrtv\"\\\\/]|u[0-9a-fA-F]{4}))*\"/g;\nvar singleQuoteStringLiteralRegEx = /(NAME\\s*:\\s*)?'([^\\\\']|\\\\([bfnrtv'\\\\/]|u[0-9a-fA-F]{4}))*'/g;\nfunction removeComments(text) {\n var noSingleLine = text.replace(singleLineCommentRegEx, \"\");\n var noComments = noSingleLine.replace(multiLineCommentRegEx, \"\");\n return noComments;\n}\nexports.removeComments = removeComments;\nfunction replaceWithEmptyStringExceptNestedRules(match, nestedRuleGroup) {\n // do not replace with empty string if a nest rule (NAME:\"bamba\") was detected\n if (nestedRuleGroup !== undefined) {\n return match;\n }\n return \"\";\n}\nfunction removeStringLiterals(text) {\n var noDoubleQuotes = text.replace(doubleQuoteStringLiteralRegEx, replaceWithEmptyStringExceptNestedRules);\n var noSingleQuotes = noDoubleQuotes.replace(singleQuoteStringLiteralRegEx, replaceWithEmptyStringExceptNestedRules);\n return noSingleQuotes;\n}\nexports.removeStringLiterals = removeStringLiterals;\nfunction createRanges(text) {\n var terminalRanges = createTerminalRanges(text);\n var refsRanges = createRefsRanges(text);\n var atLeastOneRanges = createAtLeastOneRanges(text);\n var atLeastOneSepRanges = createAtLeastOneSepRanges(text);\n var manyRanges = createManyRanges(text);\n var manySepRanges = createManySepRanges(text);\n var optionRanges = createOptionRanges(text);\n var orRanges = createOrRanges(text);\n return [].concat(terminalRanges, refsRanges, atLeastOneRanges, atLeastOneSepRanges, manyRanges, manySepRanges, optionRanges, orRanges);\n}\nexports.createRanges = createRanges;\nfunction createTerminalRanges(text) {\n return createRefOrTerminalProdRangeInternal(text, ProdType.TERMINAL, terminalRegGlobal);\n}\nexports.createTerminalRanges = createTerminalRanges;\nfunction createRefsRanges(text) {\n return createRefOrTerminalProdRangeInternal(text, ProdType.REF, refRegExGlobal);\n}\nexports.createRefsRanges = createRefsRanges;\nfunction createAtLeastOneRanges(text) {\n return createOperatorProdRangeParenthesis(text, ProdType.AT_LEAST_ONE, atLeastOneRegExGlobal);\n}\nexports.createAtLeastOneRanges = createAtLeastOneRanges;\nfunction createAtLeastOneSepRanges(text) {\n return createOperatorProdRangeParenthesis(text, ProdType.AT_LEAST_ONE_SEP, atLeastOneWithSeparatorRegExGlobal);\n}\nexports.createAtLeastOneSepRanges = createAtLeastOneSepRanges;\nfunction createManyRanges(text) {\n return createOperatorProdRangeParenthesis(text, ProdType.MANY, manyRegExGlobal);\n}\nexports.createManyRanges = createManyRanges;\nfunction createManySepRanges(text) {\n return createOperatorProdRangeParenthesis(text, ProdType.MANY_SEP, manyWithSeparatorRegExGlobal);\n}\nexports.createManySepRanges = createManySepRanges;\nfunction createOptionRanges(text) {\n return createOperatorProdRangeParenthesis(text, ProdType.OPTION, optionRegExGlobal);\n}\nexports.createOptionRanges = createOptionRanges;\nfunction createOrRanges(text) {\n var orRanges = createOperatorProdRangeParenthesis(text, ProdType.OR, orRegExGlobal);\n // have to split up the OR cases into separate FLAT productions\n // (A |BB | CDE) ==> or.def[0] --> FLAT(A) , or.def[1] --> FLAT(BB) , or.def[2] --> FLAT(CCDE)\n var orSubPartsRanges = createOrPartRanges(orRanges);\n return orRanges.concat(orSubPartsRanges);\n}\nexports.createOrRanges = createOrRanges;\nvar findClosingCurly = utils_1.partial(findClosingOffset, \"{\", \"}\");\nvar findClosingParen = utils_1.partial(findClosingOffset, \"(\", \")\");\nfunction createOrPartRanges(orRanges) {\n var orPartRanges = [];\n utils_1.forEach(orRanges, function (orRange) {\n var currOrParts = createOperatorProdRangeInternal(orRange.text, ProdType.FLAT, orPartRegExGlobal, findClosingCurly);\n var currOrRangeStart = orRange.range.start;\n // fix offsets as we are working on a subset of the text\n utils_1.forEach(currOrParts, function (orPart) {\n orPart.range.start += currOrRangeStart;\n orPart.range.end += currOrRangeStart;\n });\n orPartRanges = orPartRanges.concat(currOrParts);\n });\n var uniqueOrPartRanges = utils_1.uniq(orPartRanges, function (prodRange) {\n // using \"~\" as a separator for the identify function as its not a valid char in javascript\n return prodRange.type + \"~\" + prodRange.range.start + \"~\" + prodRange.range.end + \"~\" + prodRange.text;\n });\n return uniqueOrPartRanges;\n}\nexports.createOrPartRanges = createOrPartRanges;\nfunction createRefOrTerminalProdRangeInternal(text, prodType, pattern) {\n var prodRanges = [];\n var matched;\n while (matched = pattern.exec(text)) {\n var start = matched.index;\n var stop_1 = pattern.lastIndex;\n var currRange = new range_1.Range(start, stop_1);\n var currText = matched[0];\n prodRanges.push({ range: currRange, text: currText, type: prodType });\n }\n return prodRanges;\n}\nfunction createOperatorProdRangeParenthesis(text, prodType, pattern) {\n return createOperatorProdRangeInternal(text, prodType, pattern, findClosingParen);\n}\nfunction createOperatorProdRangeInternal(text, prodType, pattern, findTerminatorOffSet) {\n var operatorRanges = [];\n var matched;\n while (matched = pattern.exec(text)) {\n var start = matched.index;\n // note that (start + matched[0].length) is the first character AFTER the match\n var stop_2 = findTerminatorOffSet(start + matched[0].length, text);\n var currRange = new range_1.Range(start, stop_2);\n var currText = text.substr(start, stop_2 - start + 1);\n operatorRanges.push({ range: currRange, text: currText, type: prodType });\n }\n return operatorRanges;\n}\nfunction findClosingOffset(opening, closing, start, text) {\n var parenthesisStack = [1];\n var i = -1;\n while (!(utils_1.isEmpty(parenthesisStack)) && i + start < text.length) {\n i++;\n var nextChar = text.charAt(start + i);\n if (nextChar === opening) {\n parenthesisStack.push(1);\n }\n else if (nextChar === closing) {\n parenthesisStack.pop();\n }\n }\n // valid termination of the search loop\n if (utils_1.isEmpty(parenthesisStack)) {\n return i + start;\n }\n else {\n throw new Error(\"INVALID INPUT TEXT, UNTERMINATED PARENTHESIS\");\n }\n}\nexports.findClosingOffset = findClosingOffset;\n//# sourceMappingURL=gast_builder.js.map\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar rest_1 = __webpack_require__(13);\nvar lang_extensions_1 = __webpack_require__(5);\nvar gast_public_1 = __webpack_require__(2);\nvar first_1 = __webpack_require__(10);\nvar utils_1 = __webpack_require__(0);\nvar constants_1 = __webpack_require__(23);\nvar tokens_public_1 = __webpack_require__(3);\n// This ResyncFollowsWalker computes all of the follows required for RESYNC\n// (skipping reference production).\nvar ResyncFollowsWalker = (function (_super) {\n __extends(ResyncFollowsWalker, _super);\n function ResyncFollowsWalker(topProd) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.follows = new lang_extensions_1.HashTable();\n return _this;\n }\n ResyncFollowsWalker.prototype.startWalking = function () {\n this.walk(this.topProd);\n return this.follows;\n };\n ResyncFollowsWalker.prototype.walkTerminal = function (terminal, currRest, prevRest) {\n // do nothing! just like in the public sector after 13:00\n };\n ResyncFollowsWalker.prototype.walkProdRef = function (refProd, currRest, prevRest) {\n var followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.occurrenceInParent) + this.topProd.name;\n var fullRest = currRest.concat(prevRest);\n var restProd = new gast_public_1.gast.Flat(fullRest);\n var t_in_topProd_follows = first_1.first(restProd);\n this.follows.put(followName, t_in_topProd_follows);\n };\n return ResyncFollowsWalker;\n}(rest_1.RestWalker));\nexports.ResyncFollowsWalker = ResyncFollowsWalker;\nfunction computeAllProdsFollows(topProductions) {\n var reSyncFollows = new lang_extensions_1.HashTable();\n utils_1.forEach(topProductions, function (topProd) {\n var currRefsFollow = new ResyncFollowsWalker(topProd).startWalking();\n reSyncFollows.putAll(currRefsFollow);\n });\n return reSyncFollows;\n}\nexports.computeAllProdsFollows = computeAllProdsFollows;\nfunction buildBetweenProdsFollowPrefix(inner, occurenceInParent) {\n return inner.name + occurenceInParent + constants_1.IN;\n}\nexports.buildBetweenProdsFollowPrefix = buildBetweenProdsFollowPrefix;\nfunction buildInProdFollowPrefix(terminal) {\n var terminalName = tokens_public_1.tokenName(terminal.terminalType);\n return terminalName + terminal.occurrenceInParent + constants_1.IN;\n}\nexports.buildInProdFollowPrefix = buildInProdFollowPrefix;\n//# sourceMappingURL=follow.js.map\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n /* istanbul ignore next */ \nvar extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) /* istanbul ignore next */ if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n /* istanbul ignore next */ \nd.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar parser_public_1 = __webpack_require__(14);\nvar gast_public_1 = __webpack_require__(2);\nvar utils_1 = __webpack_require__(0);\nfunction resolveGrammar(topLevels) {\n var refResolver = new GastRefResolverVisitor(topLevels);\n refResolver.resolveRefs();\n return refResolver.errors;\n}\nexports.resolveGrammar = resolveGrammar;\nvar GastRefResolverVisitor = (function (_super) {\n __extends(GastRefResolverVisitor, _super);\n function GastRefResolverVisitor(nameToTopRule) {\n var _this = _super.call(this) || this;\n _this.nameToTopRule = nameToTopRule;\n _this.errors = [];\n return _this;\n }\n GastRefResolverVisitor.prototype.resolveRefs = function () {\n var _this = this;\n utils_1.forEach(this.nameToTopRule.values(), function (prod) {\n _this.currTopLevel = prod;\n prod.accept(_this);\n });\n };\n GastRefResolverVisitor.prototype.visitNonTerminal = function (node) {\n var ref = this.nameToTopRule.get(node.nonTerminalName);\n if (!ref) {\n var msg = \"Invalid grammar, reference to a rule which is not defined: ->\" + node.nonTerminalName + \"<-\\n\" +\n \"inside top level rule: ->\" + this.currTopLevel.name + \"<-\";\n this.errors.push({\n message: msg,\n type: parser_public_1.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,\n ruleName: this.currTopLevel.name,\n unresolvedRefName: node.nonTerminalName\n });\n }\n else {\n node.referencedRule = ref;\n }\n };\n return GastRefResolverVisitor;\n}(gast_public_1.gast.GAstVisitor));\nexports.GastRefResolverVisitor = GastRefResolverVisitor;\n//# sourceMappingURL=resolver.js.map\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tokens_public_1 = __webpack_require__(3);\nvar lexer_public_1 = __webpack_require__(15);\nvar utils_1 = __webpack_require__(0);\nvar PATTERN = \"PATTERN\";\nexports.DEFAULT_MODE = \"defaultMode\";\nexports.MODES = \"modes\";\nvar CONTAINS_LINE_TERMINATOR = \"containsLineTerminator\";\nexports.SUPPORT_STICKY = typeof new RegExp(\"(?:)\").sticky === \"boolean\";\nfunction disableSticky() {\n exports.SUPPORT_STICKY = false;\n}\nexports.disableSticky = disableSticky;\nfunction enableSticky() {\n exports.SUPPORT_STICKY = true;\n}\nexports.enableSticky = enableSticky;\nfunction analyzeTokenClasses(tokenClasses, useSticky) {\n if (useSticky === void 0) { useSticky = exports.SUPPORT_STICKY; }\n var onlyRelevantClasses = utils_1.reject(tokenClasses, function (currClass) {\n return currClass[PATTERN] === lexer_public_1.Lexer.NA;\n });\n var allTransformedPatterns = utils_1.map(onlyRelevantClasses, function (currClass) {\n var currPattern = currClass[PATTERN];\n if (utils_1.isRegExp(currPattern)) {\n var regExpSource = currPattern.source;\n if (regExpSource.length === 1 &&\n // only these regExp meta characters which can appear in a length one regExp\n regExpSource !== \"^\" && regExpSource !== \"$\" && regExpSource !== \".\") {\n return regExpSource;\n }\n else if (regExpSource.length === 2 && regExpSource[0] === \"\\\\\" &&\n // not a meta character\n !utils_1.contains([\"d\", \"D\", \"s\", \"S\", \"t\", \"r\", \"n\", \"t\", \"0\", \"c\", \"b\", \"B\", \"f\", \"v\", \"w\", \"W\"], regExpSource[1])) {\n // without the escaping \"\\\"\n return regExpSource[1];\n }\n else {\n return useSticky ?\n addStickyFlag(currPattern) :\n addStartOfInput(currPattern);\n }\n }\n else if (utils_1.isFunction(currPattern)) {\n return { exec: currPattern };\n }/* istanbul ignore else */ \n else if (utils_1.has(currPattern, \"exec\")) {\n return currPattern;\n }\n else if (typeof currPattern === \"string\") {\n \n if (currPattern.length === 1) {\n return currPattern;\n }\n else {\n var escapedRegExpString = currPattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, \"\\\\$&\");\n var wrappedRegExp = new RegExp(escapedRegExpString);\n // TODO: extract the \"?\" expression, it is duplicated\n return useSticky ?\n addStickyFlag(wrappedRegExp) :\n addStartOfInput(wrappedRegExp);\n }\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n });\n var patternIdxToType = utils_1.map(onlyRelevantClasses, function (currClass) { return currClass.tokenType; });\n var patternIdxToGroup = utils_1.map(onlyRelevantClasses, function (clazz) {\n var groupName = clazz.GROUP;\n if (groupName === lexer_public_1.Lexer.SKIPPED) {\n return undefined;\n }\n else if (utils_1.isString(groupName)) {\n return groupName;\n }/* istanbul ignore else */ \n else if (utils_1.isUndefined(groupName)) {\n return false;\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n });\n var patternIdxToLongerAltIdx = utils_1.map(onlyRelevantClasses, function (clazz) {\n var longerAltClass = clazz.LONGER_ALT;\n if (longerAltClass) {\n var longerAltIdx = utils_1.indexOf(onlyRelevantClasses, longerAltClass);\n return longerAltIdx;\n }\n });\n var patternIdxToPushMode = utils_1.map(onlyRelevantClasses, function (clazz) { return clazz.PUSH_MODE; });\n var patternIdxToPopMode = utils_1.map(onlyRelevantClasses, function (clazz) { return utils_1.has(clazz, \"POP_MODE\"); });\n var patternIdxToCanLineTerminator = utils_1.map(allTransformedPatterns, function (pattern) {\n if (utils_1.isRegExp(pattern)) {\n // TODO: unicode escapes of line terminators too?\n return /\\\\n|\\\\r|\\\\s/g.test(pattern.source);\n }\n else if (utils_1.isString(pattern)) {\n // only need to handle single character newline (not /r/n)\n return pattern === \"\\n\" || pattern === \"\\r\";\n }\n else {\n if (utils_1.has(pattern, CONTAINS_LINE_TERMINATOR)) {\n return pattern[CONTAINS_LINE_TERMINATOR];\n }\n return false;\n }\n });\n var patternIdxToIsCustom = utils_1.map(onlyRelevantClasses, isCustomPattern);\n var patternIdxToShort = utils_1.map(allTransformedPatterns, isShortPattern);\n var emptyGroups = utils_1.reduce(onlyRelevantClasses, function (acc, clazz) {\n var groupName = clazz.GROUP;\n if (utils_1.isString(groupName) && !(groupName === lexer_public_1.Lexer.SKIPPED)) {\n acc[groupName] = [];\n }\n return acc;\n }, {});\n var patternIdxToConfig = utils_1.map(allTransformedPatterns, function (x, idx) {\n return {\n pattern: allTransformedPatterns[idx],\n longerAlt: patternIdxToLongerAltIdx[idx],\n canLineTerminator: patternIdxToCanLineTerminator[idx],\n isCustom: patternIdxToIsCustom[idx],\n short: patternIdxToShort[idx],\n group: patternIdxToGroup[idx],\n push: patternIdxToPushMode[idx],\n pop: patternIdxToPopMode[idx],\n tokenType: patternIdxToType[idx]\n };\n });\n return {\n emptyGroups: emptyGroups,\n patternIdxToConfig: patternIdxToConfig\n };\n}\nexports.analyzeTokenClasses = analyzeTokenClasses;\nfunction validatePatterns(tokenClasses, validModesNames) {\n var errors = [];\n var missingResult = findMissingPatterns(tokenClasses);\n errors = errors.concat(missingResult.errors);\n var invalidResult = findInvalidPatterns(missingResult.valid);\n var validTokenClasses = invalidResult.valid;\n errors = errors.concat(invalidResult.errors);\n errors = errors.concat(validateRegExpPattern(validTokenClasses));\n errors = errors.concat(findInvalidGroupType(validTokenClasses));\n errors = errors.concat(findModesThatDoNotExist(validTokenClasses, validModesNames));\n return errors;\n}\nexports.validatePatterns = validatePatterns;\nfunction validateRegExpPattern(tokenClasses) {\n var errors = [];\n var withRegExpPatterns = utils_1.filter(tokenClasses, function (currTokClass) { return utils_1.isRegExp(currTokClass[PATTERN]); });\n errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns));\n errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns));\n errors = errors.concat(findUnsupportedFlags(withRegExpPatterns));\n errors = errors.concat(findDuplicatePatterns(withRegExpPatterns));\n return errors;\n}\nfunction findMissingPatterns(tokenClasses) {\n var tokenClassesWithMissingPattern = utils_1.filter(tokenClasses, function (currClass) {\n return !utils_1.has(currClass, PATTERN);\n });\n var errors = utils_1.map(tokenClassesWithMissingPattern, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) + \"<- missing static 'PATTERN' property\",\n type: lexer_public_1.LexerDefinitionErrorType.MISSING_PATTERN,\n tokenClasses: [currClass]\n };\n });\n var valid = utils_1.difference(tokenClasses, tokenClassesWithMissingPattern);\n return { errors: errors, valid: valid };\n}\nexports.findMissingPatterns = findMissingPatterns;\nfunction findInvalidPatterns(tokenClasses) {\n var tokenClassesWithInvalidPattern = utils_1.filter(tokenClasses, function (currClass) {\n var pattern = currClass[PATTERN];\n return !utils_1.isRegExp(pattern) && !utils_1.isFunction(pattern) && !utils_1.has(pattern, \"exec\") && !utils_1.isString(pattern);\n });\n var errors = utils_1.map(tokenClassesWithInvalidPattern, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) + \"<- static 'PATTERN' can only be a RegExp, a\" +\n \" Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.\",\n type: lexer_public_1.LexerDefinitionErrorType.INVALID_PATTERN,\n tokenClasses: [currClass]\n };\n });\n var valid = utils_1.difference(tokenClasses, tokenClassesWithInvalidPattern);\n return { errors: errors, valid: valid };\n}\nexports.findInvalidPatterns = findInvalidPatterns;\nvar end_of_input = /[^\\\\][\\$]/;\nfunction findEndOfInputAnchor(tokenClasses) {\n var invalidRegex = utils_1.filter(tokenClasses, function (currClass) {\n var pattern = currClass[PATTERN];\n return end_of_input.test(pattern.source);\n });\n var errors = utils_1.map(invalidRegex, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) + \"<- static 'PATTERN' cannot contain end of input anchor '$'\",\n type: lexer_public_1.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,\n tokenClasses: [currClass]\n };\n });\n return errors;\n}\nexports.findEndOfInputAnchor = findEndOfInputAnchor;\nvar start_of_input = /[^\\\\[][\\^]|^\\^/;\nfunction findStartOfInputAnchor(tokenClasses) {\n var invalidRegex = utils_1.filter(tokenClasses, function (currClass) {\n var pattern = currClass[PATTERN];\n return start_of_input.test(pattern.source);\n });\n var errors = utils_1.map(invalidRegex, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) + \"<- static 'PATTERN' cannot contain start of input anchor '^'\",\n type: lexer_public_1.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,\n tokenClasses: [currClass]\n };\n });\n return errors;\n}\nexports.findStartOfInputAnchor = findStartOfInputAnchor;\nfunction findUnsupportedFlags(tokenClasses) {\n var invalidFlags = utils_1.filter(tokenClasses, function (currClass) {\n var pattern = currClass[PATTERN];\n return pattern instanceof RegExp && (pattern.multiline || pattern.global);\n });\n var errors = utils_1.map(invalidFlags, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) +\n \"<- static 'PATTERN' may NOT contain global('g') or multiline('m')\",\n type: lexer_public_1.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,\n tokenClasses: [currClass]\n };\n });\n return errors;\n}\nexports.findUnsupportedFlags = findUnsupportedFlags;\n// This can only test for identical duplicate RegExps, not semantically equivalent ones.\nfunction findDuplicatePatterns(tokenClasses) {\n var found = [];\n var identicalPatterns = utils_1.map(tokenClasses, function (outerClass) {\n return utils_1.reduce(tokenClasses, function (result, innerClass) {\n if ((outerClass.PATTERN.source === innerClass.PATTERN.source) && !utils_1.contains(found, innerClass) &&\n innerClass.PATTERN !== lexer_public_1.Lexer.NA) {\n // this avoids duplicates in the result, each class may only appear in one \"set\"\n // in essence we are creating Equivalence classes on equality relation.\n found.push(innerClass);\n result.push(innerClass);\n return result;\n }\n return result;\n }, []);\n });\n identicalPatterns = utils_1.compact(identicalPatterns);\n var duplicatePatterns = utils_1.filter(identicalPatterns, function (currIdenticalSet) {\n return currIdenticalSet.length > 1;\n });\n var errors = utils_1.map(duplicatePatterns, function (setOfIdentical) {\n var classNames = utils_1.map(setOfIdentical, function (currClass) {\n return tokens_public_1.tokenName(currClass);\n });\n var dupPatternSrc = utils_1.first(setOfIdentical).PATTERN;\n return {\n message: \"The same RegExp pattern ->\" + dupPatternSrc + \"<-\" +\n (\"has been used in all the following classes: \" + classNames.join(\", \") + \" <-\"),\n type: lexer_public_1.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,\n tokenClasses: setOfIdentical\n };\n });\n return errors;\n}\nexports.findDuplicatePatterns = findDuplicatePatterns;\nfunction findInvalidGroupType(tokenClasses) {\n var invalidTypes = utils_1.filter(tokenClasses, function (clazz) {\n if (!utils_1.has(clazz, \"GROUP\")) {\n return false;\n }\n var group = clazz.GROUP;\n return group !== lexer_public_1.Lexer.SKIPPED &&\n group !== lexer_public_1.Lexer.NA && !utils_1.isString(group);\n });\n var errors = utils_1.map(invalidTypes, function (currClass) {\n return {\n message: \"Token class: ->\" + tokens_public_1.tokenName(currClass) + \"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String\",\n type: lexer_public_1.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,\n tokenClasses: [currClass]\n };\n });\n return errors;\n}\nexports.findInvalidGroupType = findInvalidGroupType;\nfunction findModesThatDoNotExist(tokenClasses, validModes) {\n var invalidModes = utils_1.filter(tokenClasses, function (clazz) {\n return clazz.PUSH_MODE !== undefined && !utils_1.contains(validModes, clazz.PUSH_MODE);\n });\n var errors = utils_1.map(invalidModes, function (clazz) {\n var msg = \"Token class: ->\" + tokens_public_1.tokenName(clazz) + \"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->\" + clazz.PUSH_MODE + \"<-\" +\n \"which does not exist\";\n return {\n message: msg,\n type: lexer_public_1.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,\n tokenClasses: [clazz]\n };\n });\n return errors;\n}\nexports.findModesThatDoNotExist = findModesThatDoNotExist;\nfunction addStartOfInput(pattern) {\n var flags = pattern.ignoreCase ?\n \"i\" :\n \"\";\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(\"^(?:\" + pattern.source + \")\", flags);\n}\nexports.addStartOfInput = addStartOfInput;\nfunction addStickyFlag(pattern) {\n var flags = pattern.ignoreCase ?\n \"iy\" :\n \"y\";\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(\"\" + pattern.source, flags);\n}\nexports.addStickyFlag = addStickyFlag;\nfunction performRuntimeChecks(lexerDefinition) {\n var errors = [];\n // some run time checks to help the end users.\n if (!utils_1.has(lexerDefinition, exports.DEFAULT_MODE)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized without a <\" + exports.DEFAULT_MODE + \"> property in its definition\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\n });\n }\n if (!utils_1.has(lexerDefinition, exports.MODES)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized without a <\" + exports.MODES + \"> property in its definition\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\n });\n }\n if (utils_1.has(lexerDefinition, exports.MODES) &&\n utils_1.has(lexerDefinition, exports.DEFAULT_MODE) && !utils_1.has(lexerDefinition.modes, lexerDefinition.defaultMode)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized with a \" + exports.DEFAULT_MODE + \": <\" + lexerDefinition.defaultMode + \">\"\n + \"which does not exist\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\n });\n }\n if (utils_1.has(lexerDefinition, exports.MODES)) {\n utils_1.forEach(lexerDefinition.modes, function (currModeValue, currModeName) {\n utils_1.forEach(currModeValue, function (currTokClass, currIdx) {\n if (utils_1.isUndefined(currTokClass)) {\n errors.push({\n message: \"A Lexer cannot be initialized using an undefined Token Class. Mode:\" +\n (\"<\" + currModeName + \"> at index: <\" + currIdx + \">\\n\"),\n type: lexer_public_1.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\n });\n }\n });\n });\n }\n return errors;\n}\nexports.performRuntimeChecks = performRuntimeChecks;\nfunction cloneEmptyGroups(emptyGroups) {\n var clonedResult = {};\n var groupKeys = utils_1.keys(emptyGroups);\n utils_1.forEach(groupKeys, function (currKey) {\n var currGroupValue = emptyGroups[currKey];\n /* istanbul ignore else */\n if (utils_1.isArray(currGroupValue)) {\n clonedResult[currKey] = [];\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n });\n return clonedResult;\n}\nexports.cloneEmptyGroups = cloneEmptyGroups;\n// TODO: refactor to avoid duplication\nfunction isCustomPattern(tokenType) {\n var pattern = tokenType.PATTERN;\n if (utils_1.isRegExp(pattern)) {\n return false;\n }\n else if (utils_1.isFunction(pattern)) {\n return true;\n }\n else if (utils_1.has(pattern, \"exec\")) {\n return true;\n }/* istanbul ignore else */ \n else if (utils_1.isString(pattern)) {\n return false;\n }\n else {\n /* istanbul ignore next */ throw Error(\"non exhaustive match\");\n }\n}\nexports.isCustomPattern = isCustomPattern;\nfunction isShortPattern(pattern) {\n if (utils_1.isString(pattern) && pattern.length === 1) {\n return pattern.charCodeAt(0);\n }\n else {\n return false;\n }\n}\nexports.isShortPattern = isShortPattern;\n//# sourceMappingURL=lexer.js.map\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Range = (function () {\n function Range(start, end) {\n this.start = start;\n this.end = end;\n if (!isValidRange(start, end)) {\n throw new Error(\"INVALID RANGE\");\n }\n }\n Range.prototype.contains = function (num) {\n return this.start <= num && this.end >= num;\n };\n Range.prototype.containsRange = function (other) {\n return this.start <= other.start && this.end >= other.end;\n };\n Range.prototype.isContainedInRange = function (other) {\n return other.containsRange(this);\n };\n Range.prototype.strictlyContainsRange = function (other) {\n return this.start < other.start && this.end > other.end;\n };\n Range.prototype.isStrictlyContainedInRange = function (other) {\n return other.strictlyContainsRange(this);\n };\n return Range;\n}());\nexports.Range = Range;\nfunction isValidRange(start, end) {\n return !(start < 0 || end < start);\n}\nexports.isValidRange = isValidRange;\n//# sourceMappingURL=range.js.map\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Node = __webpack_require__(17);\nvar unescapeString = __webpack_require__(6).unescapeString;\nvar OPENTAG = __webpack_require__(6).OPENTAG;\nvar CLOSETAG = __webpack_require__(6).CLOSETAG;\n\nvar CODE_INDENT = 4;\n\nvar C_TAB = 9;\nvar C_NEWLINE = 10;\nvar C_GREATERTHAN = 62;\nvar C_LESSTHAN = 60;\nvar C_SPACE = 32;\nvar C_OPEN_BRACKET = 91;\n\nvar InlineParser = __webpack_require__(57);\n\nvar reHtmlBlockOpen = [\n /./, // dummy for 0\n /^<(?:script|pre|style)(?:\\s|>|$)/i,\n /^<!--/,\n /^<[?]/,\n /^<![A-Z]/,\n /^<!\\[CDATA\\[/,\n /^<[/]?(?: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[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\\s|[/]?[>]|$)/i,\n new RegExp('^(?:' + OPENTAG + '|' + CLOSETAG + ')\\\\s*$', 'i')\n];\n\nvar reHtmlBlockClose = [\n /./, // dummy for 0\n /<\\/(?:script|pre|style)>/i,\n /-->/,\n /\\?>/,\n />/,\n /\\]\\]>/\n];\n\nvar reThematicBreak = /^(?:(?:\\*[ \\t]*){3,}|(?:_[ \\t]*){3,}|(?:-[ \\t]*){3,})[ \\t]*$/;\n\nvar reMaybeSpecial = /^[#`~*+_=<>0-9-]/;\n\nvar reNonSpace = /[^ \\t\\f\\v\\r\\n]/;\n\nvar reBulletListMarker = /^[*+-]/;\n\nvar reOrderedListMarker = /^(\\d{1,9})([.)])/;\n\nvar reATXHeadingMarker = /^#{1,6}(?:[ \\t]+|$)/;\n\nvar reCodeFence = /^`{3,}(?!.*`)|^~{3,}(?!.*~)/;\n\nvar reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/;\n\nvar reSetextHeadingLine = /^(?:=+|-+)[ \\t]*$/;\n\nvar reLineEnding = /\\r\\n|\\n|\\r/;\n\n// Returns true if string contains only space characters.\nvar isBlank = function(s) {\n return !(reNonSpace.test(s));\n};\n\nvar isSpaceOrTab = function(c) {\n return c === C_SPACE || c === C_TAB;\n};\n\nvar peek = function(ln, pos) {\n if (pos < ln.length) {\n return ln.charCodeAt(pos);\n } else {\n return -1;\n }\n};\n\n// DOC PARSER\n\n// These are methods of a Parser object, defined below.\n\n// Returns true if block ends with a blank line, descending if needed\n// into lists and sublists.\nvar endsWithBlankLine = function(block) {\n while (block) {\n if (block._lastLineBlank) {\n return true;\n }\n var t = block.type;\n if (t === 'list' || t === 'item') {\n block = block._lastChild;\n } else {\n break;\n }\n }\n return false;\n};\n\n// Add a line to the block at the tip. We assume the tip\n// can accept lines -- that check should be done before calling this.\nvar addLine = function() {\n if (this.partiallyConsumedTab) {\n this.offset += 1; // skip over tab\n // add space characters:\n var charsToTab = 4 - (this.column % 4);\n this.tip._string_content += (' '.repeat(charsToTab));\n }\n this.tip._string_content += this.currentLine.slice(this.offset) + '\\n';\n};\n\n// Add block of type tag as a child of the tip. If the tip can't\n// accept children, close and finalize it and try its parent,\n// and so on til we find a block that can accept children.\nvar addChild = function(tag, offset) {\n while (!this.blocks[this.tip.type].canContain(tag)) {\n this.finalize(this.tip, this.lineNumber - 1);\n }\n\n var column_number = offset + 1; // offset 0 = column 1\n var newBlock = new Node(tag, [[this.lineNumber, column_number], [0, 0]]);\n newBlock._string_content = '';\n this.tip.appendChild(newBlock);\n this.tip = newBlock;\n return newBlock;\n};\n\n// Parse a list marker and return data on the marker (type,\n// start, delimiter, bullet character, padding) or null.\nvar parseListMarker = function(parser, container) {\n var rest = parser.currentLine.slice(parser.nextNonspace);\n var match;\n var nextc;\n var spacesStartCol;\n var spacesStartOffset;\n var data = { type: null,\n tight: true, // lists are tight by default\n bulletChar: null,\n start: null,\n delimiter: null,\n padding: null,\n markerOffset: parser.indent };\n if ((match = rest.match(reBulletListMarker))) {\n data.type = 'bullet';\n data.bulletChar = match[0][0];\n\n } else if ((match = rest.match(reOrderedListMarker)) &&\n (container.type !== 'paragraph' ||\n match[1] === '1')) {\n data.type = 'ordered';\n data.start = parseInt(match[1]);\n data.delimiter = match[2];\n } else {\n return null;\n }\n // make sure we have spaces after\n nextc = peek(parser.currentLine, parser.nextNonspace + match[0].length);\n if (!(nextc === -1 || nextc === C_TAB || nextc === C_SPACE)) {\n return null;\n }\n\n // if it interrupts paragraph, make sure first line isn't blank\n if (container.type === 'paragraph' && !parser.currentLine.slice(parser.nextNonspace + match[0].length).match(reNonSpace)) {\n return null;\n }\n\n // we've got a match! advance offset and calculate padding\n parser.advanceNextNonspace(); // to start of marker\n parser.advanceOffset(match[0].length, true); // to end of marker\n spacesStartCol = parser.column;\n spacesStartOffset = parser.offset;\n do {\n parser.advanceOffset(1, true);\n nextc = peek(parser.currentLine, parser.offset);\n } while (parser.column - spacesStartCol < 5 &&\n isSpaceOrTab(nextc));\n var blank_item = peek(parser.currentLine, parser.offset) === -1;\n var spaces_after_marker = parser.column - spacesStartCol;\n if (spaces_after_marker >= 5 ||\n spaces_after_marker < 1 ||\n blank_item) {\n data.padding = match[0].length + 1;\n parser.column = spacesStartCol;\n parser.offset = spacesStartOffset;\n if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) {\n parser.advanceOffset(1, true);\n }\n } else {\n data.padding = match[0].length + spaces_after_marker;\n }\n return data;\n};\n\n// Returns true if the two list items are of the same type,\n// with the same delimiter and bullet character. This is used\n// in agglomerating list items into lists.\nvar listsMatch = function(list_data, item_data) {\n return (list_data.type === item_data.type &&\n list_data.delimiter === item_data.delimiter &&\n list_data.bulletChar === item_data.bulletChar);\n};\n\n// Finalize and close any unmatched blocks.\nvar closeUnmatchedBlocks = function() {\n if (!this.allClosed) {\n // finalize any blocks not matched\n while (this.oldtip !== this.lastMatchedContainer) {\n var parent = this.oldtip._parent;\n this.finalize(this.oldtip, this.lineNumber - 1);\n this.oldtip = parent;\n }\n this.allClosed = true;\n }\n};\n\n// 'finalize' is run when the block is closed.\n// 'continue' is run to check whether the block is continuing\n// at a certain line and offset (e.g. whether a block quote\n// contains a `>`. It returns 0 for matched, 1 for not matched,\n// and 2 for \"we've dealt with this line completely, go to next.\"\nvar blocks = {\n document: {\n continue: function() { return 0; },\n finalize: function() { return; },\n canContain: function(t) { return (t !== 'item'); },\n acceptsLines: false\n },\n list: {\n continue: function() { return 0; },\n finalize: function(parser, block) {\n var item = block._firstChild;\n while (item) {\n // check for non-final list item ending with blank line:\n if (endsWithBlankLine(item) && item._next) {\n block._listData.tight = false;\n break;\n }\n // recurse into children of list item, to see if there are\n // spaces between any of them:\n var subitem = item._firstChild;\n while (subitem) {\n if (endsWithBlankLine(subitem) &&\n (item._next || subitem._next)) {\n block._listData.tight = false;\n break;\n }\n subitem = subitem._next;\n }\n item = item._next;\n }\n },\n canContain: function(t) { return (t === 'item'); },\n acceptsLines: false\n },\n block_quote: {\n continue: function(parser) {\n var ln = parser.currentLine;\n if (!parser.indented &&\n peek(ln, parser.nextNonspace) === C_GREATERTHAN) {\n parser.advanceNextNonspace();\n parser.advanceOffset(1, false);\n if (isSpaceOrTab(peek(ln, parser.offset))) {\n parser.advanceOffset(1, true);\n }\n } else {\n return 1;\n }\n return 0;\n },\n finalize: function() { return; },\n canContain: function(t) { return (t !== 'item'); },\n acceptsLines: false\n },\n item: {\n continue: function(parser, container) {\n if (parser.blank) {\n if (container._firstChild == null) {\n // Blank line after empty list item\n return 1;\n } else {\n parser.advanceNextNonspace();\n }\n } else if (parser.indent >=\n container._listData.markerOffset +\n container._listData.padding) {\n parser.advanceOffset(container._listData.markerOffset +\n container._listData.padding, true);\n } else {\n return 1;\n }\n return 0;\n },\n finalize: function() { return; },\n canContain: function(t) { return (t !== 'item'); },\n acceptsLines: false\n },\n heading: {\n continue: function() {\n // a heading can never container > 1 line, so fail to match:\n return 1;\n },\n finalize: function() { return; },\n canContain: function() { return false; },\n acceptsLines: false\n },\n thematic_break: {\n continue: function() {\n // a thematic break can never container > 1 line, so fail to match:\n return 1;\n },\n finalize: function() { return; },\n canContain: function() { return false; },\n acceptsLines: false\n },\n code_block: {\n continue: function(parser, container) {\n var ln = parser.currentLine;\n var indent = parser.indent;\n if (container._isFenced) { // fenced\n var match = (indent <= 3 &&\n ln.charAt(parser.nextNonspace) === container._fenceChar &&\n ln.slice(parser.nextNonspace).match(reClosingCodeFence));\n if (match && match[0].length >= container._fenceLength) {\n // closing fence - we're at end of line, so we can return\n parser.finalize(container, parser.lineNumber);\n return 2;\n } else {\n // skip optional spaces of fence offset\n var i = container._fenceOffset;\n while (i > 0 && isSpaceOrTab(peek(ln, parser.offset))) {\n parser.advanceOffset(1, true);\n i--;\n }\n }\n } else { // indented\n if (indent >= CODE_INDENT) {\n parser.advanceOffset(CODE_INDENT, true);\n } else if (parser.blank) {\n parser.advanceNextNonspace();\n } else {\n return 1;\n }\n }\n return 0;\n },\n finalize: function(parser, block) {\n if (block._isFenced) { // fenced\n // first line becomes info string\n var content = block._string_content;\n var newlinePos = content.indexOf('\\n');\n var firstLine = content.slice(0, newlinePos);\n var rest = content.slice(newlinePos + 1);\n block.info = unescapeString(firstLine.trim());\n block._literal = rest;\n } else { // indented\n block._literal = block._string_content.replace(/(\\n *)+$/, '\\n');\n }\n block._string_content = null; // allow GC\n },\n canContain: function() { return false; },\n acceptsLines: true\n },\n html_block: {\n continue: function(parser, container) {\n return ((parser.blank &&\n (container._htmlBlockType === 6 ||\n container._htmlBlockType === 7)) ? 1 : 0);\n },\n finalize: function(parser, block) {\n block._literal = block._string_content.replace(/(\\n *)+$/, '');\n block._string_content = null; // allow GC\n },\n canContain: function() { return false; },\n acceptsLines: true\n },\n paragraph: {\n continue: function(parser) {\n return (parser.blank ? 1 : 0);\n },\n finalize: function(parser, block) {\n var pos;\n var hasReferenceDefs = false;\n\n // try parsing the beginning as link reference definitions:\n while (peek(block._string_content, 0) === C_OPEN_BRACKET &&\n (pos =\n parser.inlineParser.parseReference(block._string_content,\n parser.refmap))) {\n block._string_content = block._string_content.slice(pos);\n hasReferenceDefs = true;\n }\n if (hasReferenceDefs && isBlank(block._string_content)) {\n block.unlink();\n }\n },\n canContain: function() { return false; },\n acceptsLines: true\n }\n};\n\n// block start functions. Return values:\n// 0 = no match\n// 1 = matched container, keep going\n// 2 = matched leaf, no more block starts\nvar blockStarts = [\n // block quote\n function(parser) {\n if (!parser.indented &&\n peek(parser.currentLine, parser.nextNonspace) === C_GREATERTHAN) {\n parser.advanceNextNonspace();\n parser.advanceOffset(1, false);\n // optional following space\n if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) {\n parser.advanceOffset(1, true);\n }\n parser.closeUnmatchedBlocks();\n parser.addChild('block_quote', parser.nextNonspace);\n return 1;\n } else {\n return 0;\n }\n },\n\n // ATX heading\n function(parser) {\n var match;\n if (!parser.indented &&\n (match = parser.currentLine.slice(parser.nextNonspace).match(reATXHeadingMarker))) {\n parser.advanceNextNonspace();\n parser.advanceOffset(match[0].length, false);\n parser.closeUnmatchedBlocks();\n var container = parser.addChild('heading', parser.nextNonspace);\n container.level = match[0].trim().length; // number of #s\n // remove trailing ###s:\n container._string_content =\n parser.currentLine.slice(parser.offset).replace(/^ *#+ *$/, '').replace(/ +#+ *$/, '');\n parser.advanceOffset(parser.currentLine.length - parser.offset);\n return 2;\n } else {\n return 0;\n }\n },\n\n // Fenced code block\n function(parser) {\n var match;\n if (!parser.indented &&\n (match = parser.currentLine.slice(parser.nextNonspace).match(reCodeFence))) {\n var fenceLength = match[0].length;\n parser.closeUnmatchedBlocks();\n var container = parser.addChild('code_block', parser.nextNonspace);\n container._isFenced = true;\n container._fenceLength = fenceLength;\n container._fenceChar = match[0][0];\n container._fenceOffset = parser.indent;\n parser.advanceNextNonspace();\n parser.advanceOffset(fenceLength, false);\n return 2;\n } else {\n return 0;\n }\n },\n\n // HTML block\n function(parser, container) {\n if (!parser.indented &&\n peek(parser.currentLine, parser.nextNonspace) === C_LESSTHAN) {\n var s = parser.currentLine.slice(parser.nextNonspace);\n var blockType;\n\n for (blockType = 1; blockType <= 7; blockType++) {\n if (reHtmlBlockOpen[blockType].test(s) &&\n (blockType < 7 ||\n container.type !== 'paragraph')) {\n parser.closeUnmatchedBlocks();\n // We don't adjust parser.offset;\n // spaces are part of the HTML block:\n var b = parser.addChild('html_block',\n parser.offset);\n b._htmlBlockType = blockType;\n return 2;\n }\n }\n }\n\n return 0;\n\n },\n\n // Setext heading\n function(parser, container) {\n var match;\n if (!parser.indented &&\n container.type === 'paragraph' &&\n ((match = parser.currentLine.slice(parser.nextNonspace).match(reSetextHeadingLine)))) {\n parser.closeUnmatchedBlocks();\n var heading = new Node('heading', container.sourcepos);\n heading.level = match[0][0] === '=' ? 1 : 2;\n heading._string_content = container._string_content;\n container.insertAfter(heading);\n container.unlink();\n parser.tip = heading;\n parser.advanceOffset(parser.currentLine.length - parser.offset, false);\n return 2;\n } else {\n return 0;\n }\n },\n\n // thematic break\n function(parser) {\n if (!parser.indented &&\n reThematicBreak.test(parser.currentLine.slice(parser.nextNonspace))) {\n parser.closeUnmatchedBlocks();\n parser.addChild('thematic_break', parser.nextNonspace);\n parser.advanceOffset(parser.currentLine.length - parser.offset, false);\n return 2;\n } else {\n return 0;\n }\n },\n\n // list item\n function(parser, container) {\n var data;\n\n if ((!parser.indented || container.type === 'list')\n && (data = parseListMarker(parser, container))) {\n parser.closeUnmatchedBlocks();\n\n // add the list if needed\n if (parser.tip.type !== 'list' ||\n !(listsMatch(container._listData, data))) {\n container = parser.addChild('list', parser.nextNonspace);\n container._listData = data;\n }\n\n // add the list item\n container = parser.addChild('item', parser.nextNonspace);\n container._listData = data;\n return 1;\n } else {\n return 0;\n }\n },\n\n // indented code block\n function(parser) {\n if (parser.indented &&\n parser.tip.type !== 'paragraph' &&\n !parser.blank) {\n // indented code\n parser.advanceOffset(CODE_INDENT, true);\n parser.closeUnmatchedBlocks();\n parser.addChild('code_block', parser.offset);\n return 2;\n } else {\n return 0;\n }\n }\n\n];\n\nvar advanceOffset = function(count, columns) {\n var currentLine = this.currentLine;\n var charsToTab, charsToAdvance;\n var c;\n while (count > 0 && (c = currentLine[this.offset])) {\n if (c === '\\t') {\n charsToTab = 4 - (this.column % 4);\n if (columns) {\n this.partiallyConsumedTab = charsToTab > count;\n charsToAdvance = charsToTab > count ? count : charsToTab;\n this.column += charsToAdvance;\n this.offset += this.partiallyConsumedTab ? 0 : 1;\n count -= charsToAdvance;\n } else {\n this.partiallyConsumedTab = false;\n this.column += charsToTab;\n this.offset += 1;\n count -= 1;\n }\n } else {\n this.partiallyConsumedTab = false;\n this.offset += 1;\n this.column += 1; // assume ascii; block starts are ascii\n count -= 1;\n }\n }\n};\n\nvar advanceNextNonspace = function() {\n this.offset = this.nextNonspace;\n this.column = this.nextNonspaceColumn;\n this.partiallyConsumedTab = false;\n};\n\nvar findNextNonspace = function() {\n var currentLine = this.currentLine;\n var i = this.offset;\n var cols = this.column;\n var c;\n\n while ((c = currentLine.charAt(i)) !== '') {\n if (c === ' ') {\n i++;\n cols++;\n } else if (c === '\\t') {\n i++;\n cols += (4 - (cols % 4));\n } else {\n break;\n }\n }\n this.blank = (c === '\\n' || c === '\\r' || c === '');\n this.nextNonspace = i;\n this.nextNonspaceColumn = cols;\n this.indent = this.nextNonspaceColumn - this.column;\n this.indented = this.indent >= CODE_INDENT;\n};\n\n// Analyze a line of text and update the document appropriately.\n// We parse markdown text by calling this on each line of input,\n// then finalizing the document.\nvar incorporateLine = function(ln) {\n var all_matched = true;\n var t;\n\n var container = this.doc;\n this.oldtip = this.tip;\n this.offset = 0;\n this.column = 0;\n this.blank = false;\n this.partiallyConsumedTab = false;\n this.lineNumber += 1;\n\n // replace NUL characters for security\n if (ln.indexOf('\\u0000') !== -1) {\n ln = ln.replace(/\\0/g, '\\uFFFD');\n }\n\n this.currentLine = ln;\n\n // For each containing block, try to parse the associated line start.\n // Bail out on failure: container will point to the last matching block.\n // Set all_matched to false if not all containers match.\n var lastChild;\n while ((lastChild = container._lastChild) && lastChild._open) {\n container = lastChild;\n\n this.findNextNonspace();\n\n switch (this.blocks[container.type].continue(this, container)) {\n case 0: // we've matched, keep going\n break;\n case 1: // we've failed to match a block\n all_matched = false;\n break;\n case 2: // we've hit end of line for fenced code close and can return\n this.lastLineLength = ln.length;\n return;\n default:\n throw 'continue returned illegal value, must be 0, 1, or 2';\n }\n if (!all_matched) {\n container = container._parent; // back up to last matching block\n break;\n }\n }\n\n this.allClosed = (container === this.oldtip);\n this.lastMatchedContainer = container;\n\n var matchedLeaf = container.type !== 'paragraph' &&\n blocks[container.type].acceptsLines;\n var starts = this.blockStarts;\n var startsLen = starts.length;\n // Unless last matched container is a code block, try new container starts,\n // adding children to the last matched container:\n while (!matchedLeaf) {\n\n this.findNextNonspace();\n\n // this is a little performance optimization:\n if (!this.indented &&\n !reMaybeSpecial.test(ln.slice(this.nextNonspace))) {\n this.advanceNextNonspace();\n break;\n }\n\n var i = 0;\n while (i < startsLen) {\n var res = starts[i](this, container);\n if (res === 1) {\n container = this.tip;\n break;\n } else if (res === 2) {\n container = this.tip;\n matchedLeaf = true;\n break;\n } else {\n i++;\n }\n }\n\n if (i === startsLen) { // nothing matched\n this.advanceNextNonspace();\n break;\n }\n }\n\n // What remains at the offset is a text line. Add the text to the\n // appropriate container.\n\n // First check for a lazy paragraph continuation:\n if (!this.allClosed && !this.blank &&\n this.tip.type === 'paragraph') {\n // lazy paragraph continuation\n this.addLine();\n\n } else { // not a lazy continuation\n\n // finalize any blocks not matched\n this.closeUnmatchedBlocks();\n if (this.blank && container.lastChild) {\n container.lastChild._lastLineBlank = true;\n }\n\n t = container.type;\n\n // Block quote lines are never blank as they start with >\n // and we don't count blanks in fenced code for purposes of tight/loose\n // lists or breaking out of lists. We also don't set _lastLineBlank\n // on an empty list item, or if we just closed a fenced block.\n var lastLineBlank = this.blank &&\n !(t === 'block_quote' ||\n (t === 'code_block' && container._isFenced) ||\n (t === 'item' &&\n !container._firstChild &&\n container.sourcepos[0][0] === this.lineNumber));\n\n // propagate lastLineBlank up through parents:\n var cont = container;\n while (cont) {\n cont._lastLineBlank = lastLineBlank;\n cont = cont._parent;\n }\n\n if (this.blocks[t].acceptsLines) {\n this.addLine();\n // if HtmlBlock, check for end condition\n if (t === 'html_block' &&\n container._htmlBlockType >= 1 &&\n container._htmlBlockType <= 5 &&\n reHtmlBlockClose[container._htmlBlockType].test(this.currentLine.slice(this.offset))) {\n this.finalize(container, this.lineNumber);\n }\n\n } else if (this.offset < ln.length && !this.blank) {\n // create paragraph container for line\n container = this.addChild('paragraph', this.offset);\n this.advanceNextNonspace();\n this.addLine();\n }\n }\n this.lastLineLength = ln.length;\n};\n\n// Finalize a block. Close it and do any necessary postprocessing,\n// e.g. creating string_content from strings, setting the 'tight'\n// or 'loose' status of a list, and parsing the beginnings\n// of paragraphs for reference definitions. Reset the tip to the\n// parent of the closed block.\nvar finalize = function(block, lineNumber) {\n var above = block._parent;\n block._open = false;\n block.sourcepos[1] = [lineNumber, this.lastLineLength];\n\n this.blocks[block.type].finalize(this, block);\n\n this.tip = above;\n};\n\n// Walk through a block & children recursively, parsing string content\n// into inline content where appropriate.\nvar processInlines = function(block) {\n var node, event, t;\n var walker = block.walker();\n this.inlineParser.refmap = this.refmap;\n this.inlineParser.options = this.options;\n while ((event = walker.next())) {\n node = event.node;\n t = node.type;\n if (!event.entering && (t === 'paragraph' || t === 'heading')) {\n this.inlineParser.parse(node);\n }\n }\n};\n\nvar Document = function() {\n var doc = new Node('document', [[1, 1], [0, 0]]);\n return doc;\n};\n\n// The main parsing function. Returns a parsed document AST.\nvar parse = function(input) {\n this.doc = new Document();\n this.tip = this.doc;\n this.refmap = {};\n this.lineNumber = 0;\n this.lastLineLength = 0;\n this.offset = 0;\n this.column = 0;\n this.lastMatchedContainer = this.doc;\n this.currentLine = \"\";\n if (this.options.time) { console.time(\"preparing input\"); }\n var lines = input.split(reLineEnding);\n var len = lines.length;\n if (input.charCodeAt(input.length - 1) === C_NEWLINE) {\n // ignore last blank line created by final newline\n len -= 1;\n }\n if (this.options.time) { console.timeEnd(\"preparing input\"); }\n if (this.options.time) { console.time(\"block parsing\"); }\n for (var i = 0; i < len; i++) {\n this.incorporateLine(lines[i]);\n }\n while (this.tip) {\n this.finalize(this.tip, len);\n }\n if (this.options.time) { console.timeEnd(\"block parsing\"); }\n if (this.options.time) { console.time(\"inline parsing\"); }\n this.processInlines(this.doc);\n if (this.options.time) { console.timeEnd(\"inline parsing\"); }\n return this.doc;\n};\n\n\n// The Parser object.\nfunction Parser(options){\n return {\n doc: new Document(),\n blocks: blocks,\n blockStarts: blockStarts,\n tip: this.doc,\n oldtip: this.doc,\n currentLine: \"\",\n lineNumber: 0,\n offset: 0,\n column: 0,\n nextNonspace: 0,\n nextNonspaceColumn: 0,\n indent: 0,\n indented: false,\n blank: false,\n partiallyConsumedTab: false,\n allClosed: true,\n lastMatchedContainer: this.doc,\n refmap: {},\n lastLineLength: 0,\n inlineParser: new InlineParser(options),\n findNextNonspace: findNextNonspace,\n advanceOffset: advanceOffset,\n advanceNextNonspace: advanceNextNonspace,\n addLine: addLine,\n addChild: addChild,\n incorporateLine: incorporateLine,\n finalize: finalize,\n processInlines: processInlines,\n closeUnmatchedBlocks: closeUnmatchedBlocks,\n parse: parse,\n options: options || {}\n };\n}\n\nmodule.exports = Parser;\n\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// derived from https://github.com/mathiasbynens/String.fromCodePoint\n/*! http://mths.be/fromcodepoint v0.2.1 by @mathias */\nif (String.fromCodePoint) {\n module.exports = function (_) {\n try {\n return String.fromCodePoint(_);\n } catch (e) {\n if (e instanceof RangeError) {\n return String.fromCharCode(0xFFFD);\n }\n throw e;\n }\n };\n\n} else {\n\n var stringFromCharCode = String.fromCharCode;\n var floor = Math.floor;\n var fromCodePoint = function() {\n var MAX_SIZE = 0x4000;\n var codeUnits = [];\n var highSurrogate;\n var lowSurrogate;\n var index = -1;\n var length = arguments.length;\n if (!length) {\n return '';\n }\n var result = '';\n while (++index < length) {\n var codePoint = Number(arguments[index]);\n if (\n !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n codePoint < 0 || // not a valid Unicode code point\n codePoint > 0x10FFFF || // not a valid Unicode code point\n floor(codePoint) !== codePoint // not an integer\n ) {\n return String.fromCharCode(0xFFFD);\n }\n if (codePoint <= 0xFFFF) { // BMP code point\n codeUnits.push(codePoint);\n } else { // Astral code point; split in surrogate halves\n // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n codePoint -= 0x10000;\n highSurrogate = (codePoint >> 10) + 0xD800;\n lowSurrogate = (codePoint % 0x400) + 0xDC00;\n codeUnits.push(highSurrogate, lowSurrogate);\n }\n if (index + 1 === length || codeUnits.length > MAX_SIZE) {\n result += stringFromCharCode.apply(null, codeUnits);\n codeUnits.length = 0;\n }\n }\n return result;\n };\n module.exports = fromCodePoint;\n}\n\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// commonmark.js - CommomMark in JavaScript\n// Copyright (C) 2014 John MacFarlane\n// License: BSD3.\n\n// Basic usage:\n//\n// var commonmark = require('commonmark');\n// var parser = new commonmark.Parser();\n// var renderer = new commonmark.HtmlRenderer();\n// console.log(renderer.render(parser.parse('Hello *world*')));\n\nmodule.exports.version = '0.27.0';\nmodule.exports.Node = __webpack_require__(17);\nmodule.exports.Parser = __webpack_require__(54);\n// module.exports.HtmlRenderer = require('./html');\nmodule.exports.HtmlRenderer = __webpack_require__(59);\nmodule.exports.XmlRenderer = __webpack_require__(61);\n\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Node = __webpack_require__(17);\nvar common = __webpack_require__(6);\nvar normalizeReference = __webpack_require__(58);\n\nvar normalizeURI = common.normalizeURI;\nvar unescapeString = common.unescapeString;\nvar fromCodePoint = __webpack_require__(55);\nvar decodeHTML = __webpack_require__(30).decodeHTML;\n__webpack_require__(77); // Polyfill for String.prototype.repeat\n\n// Constants for character codes:\n\nvar C_NEWLINE = 10;\nvar C_ASTERISK = 42;\nvar C_UNDERSCORE = 95;\nvar C_BACKTICK = 96;\nvar C_OPEN_BRACKET = 91;\nvar C_CLOSE_BRACKET = 93;\nvar C_LESSTHAN = 60;\nvar C_BANG = 33;\nvar C_BACKSLASH = 92;\nvar C_AMPERSAND = 38;\nvar C_OPEN_PAREN = 40;\nvar C_CLOSE_PAREN = 41;\nvar C_COLON = 58;\nvar C_SINGLEQUOTE = 39;\nvar C_DOUBLEQUOTE = 34;\n\n// Some regexps used in inline parser:\n\nvar ESCAPABLE = common.ESCAPABLE;\nvar ESCAPED_CHAR = '\\\\\\\\' + ESCAPABLE;\nvar REG_CHAR = '[^\\\\\\\\()\\\\x00-\\\\x20]';\nvar IN_PARENS_NOSP = '\\\\((' + REG_CHAR + '|' + ESCAPED_CHAR + '|\\\\\\\\)*\\\\)';\n\nvar ENTITY = common.ENTITY;\nvar reHtmlTag = common.reHtmlTag;\n\nvar rePunctuation = new RegExp(/[!-#%-\\*,-/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E42\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC9\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDF3C-\\uDF3E]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]/);\n\nvar reLinkTitle = new RegExp(\n '^(?:\"(' + ESCAPED_CHAR + '|[^\"\\\\x00])*\"' +\n '|' +\n '\\'(' + ESCAPED_CHAR + '|[^\\'\\\\x00])*\\'' +\n '|' +\n '\\\\((' + ESCAPED_CHAR + '|[^)\\\\x00])*\\\\))');\n\nvar reLinkDestinationBraces = new RegExp(\n '^(?:[<](?:[^ <>\\\\t\\\\n\\\\\\\\\\\\x00]' + '|' + ESCAPED_CHAR + '|' + '\\\\\\\\)*[>])');\n\nvar reLinkDestination = new RegExp(\n '^(?:' + REG_CHAR + '+|' + ESCAPED_CHAR + '|\\\\\\\\|' + IN_PARENS_NOSP + ')*');\n\nvar reEscapable = new RegExp('^' + ESCAPABLE);\n\nvar reEntityHere = new RegExp('^' + ENTITY, 'i');\n\nvar reTicks = /`+/;\n\nvar reTicksHere = /^`+/;\n\nvar reEllipses = /\\.\\.\\./g;\n\nvar reDash = /--+/g;\n\nvar reEmailAutolink = /^<([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\nvar reAutolink = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\\x00-\\x20]*>/i;\n\nvar reSpnl = /^ *(?:\\n *)?/;\n\nvar reWhitespaceChar = /^[ \\t\\n\\x0b\\x0c\\x0d]/;\n\nvar reWhitespace = /[ \\t\\n\\x0b\\x0c\\x0d]+/g;\n\nvar reUnicodeWhitespaceChar = /^\\s/;\n\nvar reUnicodeWhitespace = /\\s+/g;\n\nvar reFinalSpace = / *$/;\n\nvar reInitialSpace = /^ */;\n\nvar reSpaceAtEndOfLine = /^ *(?:\\n|$)/;\n\nvar reLinkLabel = new RegExp('^\\\\[(?:[^\\\\\\\\\\\\[\\\\]]|' + ESCAPED_CHAR +\n '|\\\\\\\\){0,1000}\\\\]');\n\n// Matches a string of non-special characters.\nvar reMain = /^[^\\n`\\[\\]\\\\!<&*_'\"]+/m;\n\nvar text = function(s) {\n var node = new Node('text');\n node._literal = s;\n return node;\n};\n\n// INLINE PARSER\n\n// These are methods of an InlineParser object, defined below.\n// An InlineParser keeps track of a subject (a string to be\n// parsed) and a position in that subject.\n\n// If re matches at current position in the subject, advance\n// position in subject and return the match; otherwise return null.\nvar match = function(re) {\n var m = re.exec(this.subject.slice(this.pos));\n if (m === null) {\n return null;\n } else {\n this.pos += m.index + m[0].length;\n return m[0];\n }\n};\n\n// Returns the code for the character at the current subject position, or -1\n// there are no more characters.\nvar peek = function() {\n if (this.pos < this.subject.length) {\n return this.subject.charCodeAt(this.pos);\n } else {\n return -1;\n }\n};\n\n// Parse zero or more space characters, including at most one newline\nvar spnl = function() {\n this.match(reSpnl);\n return true;\n};\n\n// All of the parsers below try to match something at the current position\n// in the subject. If they succeed in matching anything, they\n// return the inline matched, advancing the subject.\n\n// Attempt to parse backticks, adding either a backtick code span or a\n// literal sequence of backticks.\nvar parseBackticks = function(block) {\n var ticks = this.match(reTicksHere);\n if (ticks === null) {\n return false;\n }\n var afterOpenTicks = this.pos;\n var matched;\n var node;\n while ((matched = this.match(reTicks)) !== null) {\n if (matched === ticks) {\n node = new Node('code');\n node._literal = this.subject.slice(afterOpenTicks,\n this.pos - ticks.length)\n .trim().replace(reWhitespace, ' ');\n block.appendChild(node);\n return true;\n }\n }\n // If we got here, we didn't match a closing backtick sequence.\n this.pos = afterOpenTicks;\n block.appendChild(text(ticks));\n return true;\n};\n\n// Parse a backslash-escaped special character, adding either the escaped\n// character, a hard line break (if the backslash is followed by a newline),\n// or a literal backslash to the block's children. Assumes current character\n// is a backslash.\nvar parseBackslash = function(block) {\n var subj = this.subject;\n var node;\n this.pos += 1;\n if (this.peek() === C_NEWLINE) {\n this.pos += 1;\n node = new Node('linebreak');\n block.appendChild(node);\n } else if (reEscapable.test(subj.charAt(this.pos))) {\n block.appendChild(text(subj.charAt(this.pos)));\n this.pos += 1;\n } else {\n block.appendChild(text('\\\\'));\n }\n return true;\n};\n\n// Attempt to parse an autolink (URL or email in pointy brackets).\nvar parseAutolink = function(block) {\n var m;\n var dest;\n var node;\n if ((m = this.match(reEmailAutolink))) {\n dest = m.slice(1, m.length - 1);\n node = new Node('link');\n node._destination = normalizeURI('mailto:' + dest);\n node._title = '';\n node.appendChild(text(dest));\n block.appendChild(node);\n return true;\n } else if ((m = this.match(reAutolink))) {\n dest = m.slice(1, m.length - 1);\n node = new Node('link');\n node._destination = normalizeURI(dest);\n node._title = '';\n node.appendChild(text(dest));\n block.appendChild(node);\n return true;\n } else {\n return false;\n }\n};\n\n// Attempt to parse a raw HTML tag.\nvar parseHtmlTag = function(block) {\n var m = this.match(reHtmlTag);\n if (m === null) {\n return false;\n } else {\n var node = new Node('html_inline');\n node._literal = m;\n block.appendChild(node);\n return true;\n }\n};\n\n// Scan a sequence of characters with code cc, and return information about\n// the number of delimiters and whether they are positioned such that\n// they can open and/or close emphasis or strong emphasis. A utility\n// function for strong/emph parsing.\nvar scanDelims = function(cc) {\n var numdelims = 0;\n var char_before, char_after, cc_after;\n var startpos = this.pos;\n var left_flanking, right_flanking, can_open, can_close;\n var after_is_whitespace, after_is_punctuation, before_is_whitespace, before_is_punctuation;\n\n if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) {\n numdelims++;\n this.pos++;\n } else {\n while (this.peek() === cc) {\n numdelims++;\n this.pos++;\n }\n }\n\n if (numdelims === 0) {\n return null;\n }\n\n char_before = startpos === 0 ? '\\n' : this.subject.charAt(startpos - 1);\n\n cc_after = this.peek();\n if (cc_after === -1) {\n char_after = '\\n';\n } else {\n char_after = fromCodePoint(cc_after);\n }\n\n after_is_whitespace = reUnicodeWhitespaceChar.test(char_after);\n after_is_punctuation = rePunctuation.test(char_after);\n before_is_whitespace = reUnicodeWhitespaceChar.test(char_before);\n before_is_punctuation = rePunctuation.test(char_before);\n\n left_flanking = !after_is_whitespace &&\n !(after_is_punctuation && !before_is_whitespace && !before_is_punctuation);\n right_flanking = !before_is_whitespace &&\n !(before_is_punctuation && !after_is_whitespace && !after_is_punctuation);\n if (cc === C_UNDERSCORE) {\n can_open = left_flanking &&\n (!right_flanking || before_is_punctuation);\n can_close = right_flanking &&\n (!left_flanking || after_is_punctuation);\n } else if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) {\n can_open = left_flanking && !right_flanking;\n can_close = right_flanking;\n } else {\n can_open = left_flanking;\n can_close = right_flanking;\n }\n this.pos = startpos;\n return { numdelims: numdelims,\n can_open: can_open,\n can_close: can_close };\n};\n\n// Handle a delimiter marker for emphasis or a quote.\nvar handleDelim = function(cc, block) {\n var res = this.scanDelims(cc);\n if (!res) {\n return false;\n }\n var numdelims = res.numdelims;\n var startpos = this.pos;\n var contents;\n\n this.pos += numdelims;\n if (cc === C_SINGLEQUOTE) {\n contents = \"\\u2019\";\n } else if (cc === C_DOUBLEQUOTE) {\n contents = \"\\u201C\";\n } else {\n contents = this.subject.slice(startpos, this.pos);\n }\n var node = text(contents);\n block.appendChild(node);\n\n // Add entry to stack for this opener\n this.delimiters = { cc: cc,\n numdelims: numdelims,\n node: node,\n previous: this.delimiters,\n next: null,\n can_open: res.can_open,\n can_close: res.can_close };\n if (this.delimiters.previous !== null) {\n this.delimiters.previous.next = this.delimiters;\n }\n\n return true;\n\n};\n\nvar removeDelimiter = function(delim) {\n if (delim.previous !== null) {\n delim.previous.next = delim.next;\n }\n if (delim.next === null) {\n // top of stack\n this.delimiters = delim.previous;\n } else {\n delim.next.previous = delim.previous;\n }\n};\n\nvar removeDelimitersBetween = function(bottom, top) {\n if (bottom.next !== top) {\n bottom.next = top;\n top.previous = bottom;\n }\n};\n\nvar processEmphasis = function(stack_bottom) {\n var opener, closer, old_closer;\n var opener_inl, closer_inl;\n var tempstack;\n var use_delims;\n var tmp, next;\n var opener_found;\n var openers_bottom = [];\n var odd_match = false;\n\n openers_bottom[C_UNDERSCORE] = stack_bottom;\n openers_bottom[C_ASTERISK] = stack_bottom;\n openers_bottom[C_SINGLEQUOTE] = stack_bottom;\n openers_bottom[C_DOUBLEQUOTE] = stack_bottom;\n\n // find first closer above stack_bottom:\n closer = this.delimiters;\n while (closer !== null && closer.previous !== stack_bottom) {\n closer = closer.previous;\n }\n // move forward, looking for closers, and handling each\n while (closer !== null) {\n var closercc = closer.cc;\n if (!closer.can_close) {\n closer = closer.next;\n } else {\n // found emphasis closer. now look back for first matching opener:\n opener = closer.previous;\n opener_found = false;\n while (opener !== null && opener !== stack_bottom &&\n opener !== openers_bottom[closercc]) {\n odd_match = (closer.can_open || opener.can_close) &&\n (opener.numdelims + closer.numdelims) % 3 === 0;\n if (opener.cc === closer.cc && opener.can_open && !odd_match) {\n opener_found = true;\n break;\n }\n opener = opener.previous;\n }\n old_closer = closer;\n\n if (closercc === C_ASTERISK || closercc === C_UNDERSCORE) {\n if (!opener_found) {\n closer = closer.next;\n } else {\n // calculate actual number of delimiters used from closer\n if (closer.numdelims < 3 || opener.numdelims < 3) {\n use_delims = closer.numdelims <= opener.numdelims ?\n closer.numdelims : opener.numdelims;\n } else {\n use_delims = closer.numdelims % 2 === 0 ? 2 : 1;\n }\n\n opener_inl = opener.node;\n closer_inl = closer.node;\n\n // remove used delimiters from stack elts and inlines\n opener.numdelims -= use_delims;\n closer.numdelims -= use_delims;\n opener_inl._literal =\n opener_inl._literal.slice(0,\n opener_inl._literal.length - use_delims);\n closer_inl._literal =\n closer_inl._literal.slice(0,\n closer_inl._literal.length - use_delims);\n\n // build contents for new emph element\n var emph = new Node(use_delims === 1 ? 'emph' : 'strong');\n\n tmp = opener_inl._next;\n while (tmp && tmp !== closer_inl) {\n next = tmp._next;\n tmp.unlink();\n emph.appendChild(tmp);\n tmp = next;\n }\n\n opener_inl.insertAfter(emph);\n\n // remove elts between opener and closer in delimiters stack\n removeDelimitersBetween(opener, closer);\n\n // if opener has 0 delims, remove it and the inline\n if (opener.numdelims === 0) {\n opener_inl.unlink();\n this.removeDelimiter(opener);\n }\n\n if (closer.numdelims === 0) {\n closer_inl.unlink();\n tempstack = closer.next;\n this.removeDelimiter(closer);\n closer = tempstack;\n }\n\n }\n\n } else if (closercc === C_SINGLEQUOTE) {\n closer.node._literal = \"\\u2019\";\n if (opener_found) {\n opener.node._literal = \"\\u2018\";\n }\n closer = closer.next;\n\n } else if (closercc === C_DOUBLEQUOTE) {\n closer.node._literal = \"\\u201D\";\n if (opener_found) {\n opener.node.literal = \"\\u201C\";\n }\n closer = closer.next;\n\n }\n if (!opener_found && !odd_match) {\n // Set lower bound for future searches for openers:\n // We don't do this with odd_match because a **\n // that doesn't match an earlier * might turn into\n // an opener, and the * might be matched by something\n // else.\n openers_bottom[closercc] = old_closer.previous;\n if (!old_closer.can_open) {\n // We can remove a closer that can't be an opener,\n // once we've seen there's no matching opener:\n this.removeDelimiter(old_closer);\n }\n }\n }\n\n }\n\n // remove all delimiters\n while (this.delimiters !== null && this.delimiters !== stack_bottom) {\n this.removeDelimiter(this.delimiters);\n }\n};\n\n// Attempt to parse link title (sans quotes), returning the string\n// or null if no match.\nvar parseLinkTitle = function() {\n var title = this.match(reLinkTitle);\n if (title === null) {\n return null;\n } else {\n // chop off quotes from title and unescape:\n return unescapeString(title.substr(1, title.length - 2));\n }\n};\n\n// Attempt to parse link destination, returning the string or\n// null if no match.\nvar parseLinkDestination = function() {\n var res = this.match(reLinkDestinationBraces);\n if (res === null) {\n res = this.match(reLinkDestination);\n if (res === null) {\n return null;\n } else {\n return normalizeURI(unescapeString(res));\n }\n } else { // chop off surrounding <..>:\n return normalizeURI(unescapeString(res.substr(1, res.length - 2)));\n }\n};\n\n// Attempt to parse a link label, returning number of characters parsed.\nvar parseLinkLabel = function() {\n var m = this.match(reLinkLabel);\n if (m === null || m.length > 1001) {\n return 0;\n } else {\n return m.length;\n }\n};\n\n// Add open bracket to delimiter stack and add a text node to block's children.\nvar parseOpenBracket = function(block) {\n var startpos = this.pos;\n this.pos += 1;\n\n var node = text('[');\n block.appendChild(node);\n\n // Add entry to stack for this opener\n this.addBracket(node, startpos, false);\n return true;\n};\n\n// IF next character is [, and ! delimiter to delimiter stack and\n// add a text node to block's children. Otherwise just add a text node.\nvar parseBang = function(block) {\n var startpos = this.pos;\n this.pos += 1;\n if (this.peek() === C_OPEN_BRACKET) {\n this.pos += 1;\n\n var node = text('![');\n block.appendChild(node);\n\n // Add entry to stack for this opener\n this.addBracket(node, startpos + 1, true);\n } else {\n block.appendChild(text('!'));\n }\n return true;\n};\n\n// Try to match close bracket against an opening in the delimiter\n// stack. Add either a link or image, or a plain [ character,\n// to block's children. If there is a matching delimiter,\n// remove it from the delimiter stack.\nvar parseCloseBracket = function(block) {\n var startpos;\n var is_image;\n var dest;\n var title;\n var matched = false;\n var reflabel;\n var opener;\n\n this.pos += 1;\n startpos = this.pos;\n\n // get last [ or ![\n opener = this.brackets;\n\n if (opener === null) {\n // no matched opener, just return a literal\n block.appendChild(text(']'));\n return true;\n }\n\n if (!opener.active) {\n // no matched opener, just return a literal\n block.appendChild(text(']'));\n // take opener off brackets stack\n this.removeBracket();\n return true;\n }\n\n // If we got here, open is a potential opener\n is_image = opener.image;\n\n // Check to see if we have a link/image\n\n var savepos = this.pos;\n\n // Inline link?\n if (this.peek() === C_OPEN_PAREN) {\n this.pos++;\n if (this.spnl() &&\n ((dest = this.parseLinkDestination()) !== null) &&\n this.spnl() &&\n // make sure there's a space before the title:\n (reWhitespaceChar.test(this.subject.charAt(this.pos - 1)) &&\n (title = this.parseLinkTitle()) || true) &&\n this.spnl() &&\n this.peek() === C_CLOSE_PAREN) {\n this.pos += 1;\n matched = true;\n } else {\n this.pos = savepos;\n }\n }\n\n if (!matched) {\n\n // Next, see if there's a link label\n var beforelabel = this.pos;\n var n = this.parseLinkLabel();\n if (n > 2) {\n reflabel = this.subject.slice(beforelabel, beforelabel + n);\n } else if (!opener.bracketAfter) {\n // Empty or missing second label means to use the first label as the reference.\n // The reference must not contain a bracket. If we know there's a bracket, we don't even bother checking it.\n reflabel = this.subject.slice(opener.index, startpos);\n }\n if (n === 0) {\n // If shortcut reference link, rewind before spaces we skipped.\n this.pos = savepos;\n }\n\n if (reflabel) {\n // lookup rawlabel in refmap\n var link = this.refmap[normalizeReference(reflabel)];\n if (link) {\n dest = link.destination;\n title = link.title;\n matched = true;\n }\n }\n }\n\n if (matched) {\n var node = new Node(is_image ? 'image' : 'link');\n node._destination = dest;\n node._title = title || '';\n\n var tmp, next;\n tmp = opener.node._next;\n while (tmp) {\n next = tmp._next;\n tmp.unlink();\n node.appendChild(tmp);\n tmp = next;\n }\n block.appendChild(node);\n this.processEmphasis(opener.previousDelimiter);\n this.removeBracket();\n opener.node.unlink();\n\n // We remove this bracket and processEmphasis will remove later delimiters.\n // Now, for a link, we also deactivate earlier link openers.\n // (no links in links)\n if (!is_image) {\n opener = this.brackets;\n while (opener !== null) {\n if (!opener.image) {\n opener.active = false; // deactivate this opener\n }\n opener = opener.previous;\n }\n }\n\n return true;\n\n } else { // no match\n\n this.removeBracket(); // remove this opener from stack\n this.pos = startpos;\n block.appendChild(text(']'));\n return true;\n }\n\n};\n\nvar addBracket = function(node, index, image) {\n if (this.brackets !== null) {\n this.brackets.bracketAfter = true;\n }\n this.brackets = { node: node,\n previous: this.brackets,\n previousDelimiter: this.delimiters,\n index: index,\n image: image,\n active: true };\n};\n\nvar removeBracket = function() {\n this.brackets = this.brackets.previous;\n};\n\n// Attempt to parse an entity.\nvar parseEntity = function(block) {\n var m;\n if ((m = this.match(reEntityHere))) {\n block.appendChild(text(decodeHTML(m)));\n return true;\n } else {\n return false;\n }\n};\n\n// Parse a run of ordinary characters, or a single character with\n// a special meaning in markdown, as a plain string.\nvar parseString = function(block) {\n var m;\n if ((m = this.match(reMain))) {\n if (this.options.smart) {\n block.appendChild(text(\n m.replace(reEllipses, \"\\u2026\")\n .replace(reDash, function(chars) {\n var enCount = 0;\n var emCount = 0;\n if (chars.length % 3 === 0) { // If divisible by 3, use all em dashes\n emCount = chars.length / 3;\n } else if (chars.length % 2 === 0) { // If divisible by 2, use all en dashes\n enCount = chars.length / 2;\n } else if (chars.length % 3 === 2) { // If 2 extra dashes, use en dash for last 2; em dashes for rest\n enCount = 1;\n emCount = (chars.length - 2) / 3;\n } else { // Use en dashes for last 4 hyphens; em dashes for rest\n enCount = 2;\n emCount = (chars.length - 4) / 3;\n }\n return \"\\u2014\".repeat(emCount) + \"\\u2013\".repeat(enCount);\n })));\n } else {\n block.appendChild(text(m));\n }\n return true;\n } else {\n return false;\n }\n};\n\n// Parse a newline. If it was preceded by two spaces, return a hard\n// line break; otherwise a soft line break.\nvar parseNewline = function(block) {\n this.pos += 1; // assume we're at a \\n\n // check previous node for trailing spaces\n var lastc = block._lastChild;\n if (lastc && lastc.type === 'text' && lastc._literal[lastc._literal.length - 1] === ' ') {\n var hardbreak = lastc._literal[lastc._literal.length - 2] === ' ';\n lastc._literal = lastc._literal.replace(reFinalSpace, '');\n block.appendChild(new Node(hardbreak ? 'linebreak' : 'softbreak'));\n } else {\n block.appendChild(new Node('softbreak'));\n }\n this.match(reInitialSpace); // gobble leading spaces in next line\n return true;\n};\n\n// Attempt to parse a link reference, modifying refmap.\nvar parseReference = function(s, refmap) {\n this.subject = s;\n this.pos = 0;\n var rawlabel;\n var dest;\n var title;\n var matchChars;\n var startpos = this.pos;\n\n // label:\n matchChars = this.parseLinkLabel();\n if (matchChars === 0) {\n return 0;\n } else {\n rawlabel = this.subject.substr(0, matchChars);\n }\n\n // colon:\n if (this.peek() === C_COLON) {\n this.pos++;\n } else {\n this.pos = startpos;\n return 0;\n }\n\n // link url\n this.spnl();\n\n dest = this.parseLinkDestination();\n if (dest === null || dest.length === 0) {\n this.pos = startpos;\n return 0;\n }\n\n var beforetitle = this.pos;\n this.spnl();\n title = this.parseLinkTitle();\n if (title === null) {\n title = '';\n // rewind before spaces\n this.pos = beforetitle;\n }\n\n // make sure we're at line end:\n var atLineEnd = true;\n if (this.match(reSpaceAtEndOfLine) === null) {\n if (title === '') {\n atLineEnd = false;\n } else {\n // the potential title we found is not at the line end,\n // but it could still be a legal link reference if we\n // discard the title\n title = '';\n // rewind before spaces\n this.pos = beforetitle;\n // and instead check if the link URL is at the line end\n atLineEnd = this.match(reSpaceAtEndOfLine) !== null;\n }\n }\n\n if (!atLineEnd) {\n this.pos = startpos;\n return 0;\n }\n\n var normlabel = normalizeReference(rawlabel);\n if (normlabel === '') {\n // label must contain non-whitespace characters\n this.pos = startpos;\n return 0;\n }\n\n if (!refmap[normlabel]) {\n refmap[normlabel] = { destination: dest, title: title };\n }\n return this.pos - startpos;\n};\n\n// Parse the next inline element in subject, advancing subject position.\n// On success, add the result to block's children and return true.\n// On failure, return false.\nvar parseInline = function(block) {\n var res = false;\n var c = this.peek();\n if (c === -1) {\n return false;\n }\n switch(c) {\n case C_NEWLINE:\n res = this.parseNewline(block);\n break;\n case C_BACKSLASH:\n res = this.parseBackslash(block);\n break;\n case C_BACKTICK:\n res = this.parseBackticks(block);\n break;\n case C_ASTERISK:\n case C_UNDERSCORE:\n res = this.handleDelim(c, block);\n break;\n case C_SINGLEQUOTE:\n case C_DOUBLEQUOTE:\n res = this.options.smart && this.handleDelim(c, block);\n break;\n case C_OPEN_BRACKET:\n res = this.parseOpenBracket(block);\n break;\n case C_BANG:\n res = this.parseBang(block);\n break;\n case C_CLOSE_BRACKET:\n res = this.parseCloseBracket(block);\n break;\n case C_LESSTHAN:\n res = this.parseAutolink(block) || this.parseHtmlTag(block);\n break;\n case C_AMPERSAND:\n res = this.parseEntity(block);\n break;\n default:\n res = this.parseString(block);\n break;\n }\n if (!res) {\n this.pos += 1;\n block.appendChild(text(fromCodePoint(c)));\n }\n\n return true;\n};\n\n// Parse string content in block into inline children,\n// using refmap to resolve references.\nvar parseInlines = function(block) {\n this.subject = block._string_content.trim();\n this.pos = 0;\n this.delimiters = null;\n this.brackets = null;\n while (this.parseInline(block)) {\n }\n block._string_content = null; // allow raw string to be garbage collected\n this.processEmphasis(null);\n};\n\n// The InlineParser object.\nfunction InlineParser(options){\n return {\n subject: '',\n delimiters: null, // used by handleDelim method\n brackets: null,\n pos: 0,\n refmap: {},\n match: match,\n peek: peek,\n spnl: spnl,\n parseBackticks: parseBackticks,\n parseBackslash: parseBackslash,\n parseAutolink: parseAutolink,\n parseHtmlTag: parseHtmlTag,\n scanDelims: scanDelims,\n handleDelim: handleDelim,\n parseLinkTitle: parseLinkTitle,\n parseLinkDestination: parseLinkDestination,\n parseLinkLabel: parseLinkLabel,\n parseOpenBracket: parseOpenBracket,\n parseBang: parseBang,\n parseCloseBracket: parseCloseBracket,\n addBracket: addBracket,\n removeBracket: removeBracket,\n parseEntity: parseEntity,\n parseString: parseString,\n parseNewline: parseNewline,\n parseReference: parseReference,\n parseInline: parseInline,\n processEmphasis: processEmphasis,\n removeDelimiter: removeDelimiter,\n options: options || {},\n parse: parseInlines\n };\n}\n\nmodule.exports = InlineParser;\n\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/* The bulk of this code derives from https://github.com/dmoscrop/fold-case\nBut in addition to case-folding, we also normalize whitespace.\n\nfold-case is Copyright Mathias Bynens <https://mathiasbynens.be/>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/*eslint-disable key-spacing, comma-spacing */\n\nvar regex = /[ \\t\\r\\n]+|[A-Z\\xB5\\xC0-\\xD6\\xD8-\\xDF\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u0149\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u017F\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C5\\u01C7\\u01C8\\u01CA\\u01CB\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F0-\\u01F2\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0345\\u0370\\u0372\\u0376\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03AB\\u03B0\\u03C2\\u03CF-\\u03D1\\u03D5\\u03D6\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F0\\u03F1\\u03F4\\u03F5\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0528\\u052A\\u052C\\u052E\\u0531-\\u0556\\u0587\\u10A0-\\u10C5\\u10C7\\u10CD\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E96-\\u1E9B\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F50\\u1F52\\u1F54\\u1F56\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1F80-\\u1FAF\\u1FB2-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD2\\u1FD3\\u1FD6-\\u1FDB\\u1FE2-\\u1FE4\\u1FE6-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A\\u212B\\u2132\\u2160-\\u216F\\u2183\\u24B6-\\u24CF\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\u2CF2\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA698\\uA69A\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA792\\uA796\\uA798\\uA79A\\uA79C\\uA79E\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uA7AA-\\uA7AD\\uA7B0\\uA7B1\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF21-\\uFF3A]|\\uD801[\\uDC00-\\uDC27]|\\uD806[\\uDCA0-\\uDCBF]/g;\n\nvar map = {'A':'a','B':'b','C':'c','D':'d','E':'e','F':'f','G':'g','H':'h','I':'i','J':'j','K':'k','L':'l','M':'m','N':'n','O':'o','P':'p','Q':'q','R':'r','S':'s','T':'t','U':'u','V':'v','W':'w','X':'x','Y':'y','Z':'z','\\xB5':'\\u03BC','\\xC0':'\\xE0','\\xC1':'\\xE1','\\xC2':'\\xE2','\\xC3':'\\xE3','\\xC4':'\\xE4','\\xC5':'\\xE5','\\xC6':'\\xE6','\\xC7':'\\xE7','\\xC8':'\\xE8','\\xC9':'\\xE9','\\xCA':'\\xEA','\\xCB':'\\xEB','\\xCC':'\\xEC','\\xCD':'\\xED','\\xCE':'\\xEE','\\xCF':'\\xEF','\\xD0':'\\xF0','\\xD1':'\\xF1','\\xD2':'\\xF2','\\xD3':'\\xF3','\\xD4':'\\xF4','\\xD5':'\\xF5','\\xD6':'\\xF6','\\xD8':'\\xF8','\\xD9':'\\xF9','\\xDA':'\\xFA','\\xDB':'\\xFB','\\xDC':'\\xFC','\\xDD':'\\xFD','\\xDE':'\\xFE','\\u0100':'\\u0101','\\u0102':'\\u0103','\\u0104':'\\u0105','\\u0106':'\\u0107','\\u0108':'\\u0109','\\u010A':'\\u010B','\\u010C':'\\u010D','\\u010E':'\\u010F','\\u0110':'\\u0111','\\u0112':'\\u0113','\\u0114':'\\u0115','\\u0116':'\\u0117','\\u0118':'\\u0119','\\u011A':'\\u011B','\\u011C':'\\u011D','\\u011E':'\\u011F','\\u0120':'\\u0121','\\u0122':'\\u0123','\\u0124':'\\u0125','\\u0126':'\\u0127','\\u0128':'\\u0129','\\u012A':'\\u012B','\\u012C':'\\u012D','\\u012E':'\\u012F','\\u0132':'\\u0133','\\u0134':'\\u0135','\\u0136':'\\u0137','\\u0139':'\\u013A','\\u013B':'\\u013C','\\u013D':'\\u013E','\\u013F':'\\u0140','\\u0141':'\\u0142','\\u0143':'\\u0144','\\u0145':'\\u0146','\\u0147':'\\u0148','\\u014A':'\\u014B','\\u014C':'\\u014D','\\u014E':'\\u014F','\\u0150':'\\u0151','\\u0152':'\\u0153','\\u0154':'\\u0155','\\u0156':'\\u0157','\\u0158':'\\u0159','\\u015A':'\\u015B','\\u015C':'\\u015D','\\u015E':'\\u015F','\\u0160':'\\u0161','\\u0162':'\\u0163','\\u0164':'\\u0165','\\u0166':'\\u0167','\\u0168':'\\u0169','\\u016A':'\\u016B','\\u016C':'\\u016D','\\u016E':'\\u016F','\\u0170':'\\u0171','\\u0172':'\\u0173','\\u0174':'\\u0175','\\u0176':'\\u0177','\\u0178':'\\xFF','\\u0179':'\\u017A','\\u017B':'\\u017C','\\u017D':'\\u017E','\\u017F':'s','\\u0181':'\\u0253','\\u0182':'\\u0183','\\u0184':'\\u0185','\\u0186':'\\u0254','\\u0187':'\\u0188','\\u0189':'\\u0256','\\u018A':'\\u0257','\\u018B':'\\u018C','\\u018E':'\\u01DD','\\u018F':'\\u0259','\\u0190':'\\u025B','\\u0191':'\\u0192','\\u0193':'\\u0260','\\u0194':'\\u0263','\\u0196':'\\u0269','\\u0197':'\\u0268','\\u0198':'\\u0199','\\u019C':'\\u026F','\\u019D':'\\u0272','\\u019F':'\\u0275','\\u01A0':'\\u01A1','\\u01A2':'\\u01A3','\\u01A4':'\\u01A5','\\u01A6':'\\u0280','\\u01A7':'\\u01A8','\\u01A9':'\\u0283','\\u01AC':'\\u01AD','\\u01AE':'\\u0288','\\u01AF':'\\u01B0','\\u01B1':'\\u028A','\\u01B2':'\\u028B','\\u01B3':'\\u01B4','\\u01B5':'\\u01B6','\\u01B7':'\\u0292','\\u01B8':'\\u01B9','\\u01BC':'\\u01BD','\\u01C4':'\\u01C6','\\u01C5':'\\u01C6','\\u01C7':'\\u01C9','\\u01C8':'\\u01C9','\\u01CA':'\\u01CC','\\u01CB':'\\u01CC','\\u01CD':'\\u01CE','\\u01CF':'\\u01D0','\\u01D1':'\\u01D2','\\u01D3':'\\u01D4','\\u01D5':'\\u01D6','\\u01D7':'\\u01D8','\\u01D9':'\\u01DA','\\u01DB':'\\u01DC','\\u01DE':'\\u01DF','\\u01E0':'\\u01E1','\\u01E2':'\\u01E3','\\u01E4':'\\u01E5','\\u01E6':'\\u01E7','\\u01E8':'\\u01E9','\\u01EA':'\\u01EB','\\u01EC':'\\u01ED','\\u01EE':'\\u01EF','\\u01F1':'\\u01F3','\\u01F2':'\\u01F3','\\u01F4':'\\u01F5','\\u01F6':'\\u0195','\\u01F7':'\\u01BF','\\u01F8':'\\u01F9','\\u01FA':'\\u01FB','\\u01FC':'\\u01FD','\\u01FE':'\\u01FF','\\u0200':'\\u0201','\\u0202':'\\u0203','\\u0204':'\\u0205','\\u0206':'\\u0207','\\u0208':'\\u0209','\\u020A':'\\u020B','\\u020C':'\\u020D','\\u020E':'\\u020F','\\u0210':'\\u0211','\\u0212':'\\u0213','\\u0214':'\\u0215','\\u0216':'\\u0217','\\u0218':'\\u0219','\\u021A':'\\u021B','\\u021C':'\\u021D','\\u021E':'\\u021F','\\u0220':'\\u019E','\\u0222':'\\u0223','\\u0224':'\\u0225','\\u0226':'\\u0227','\\u0228':'\\u0229','\\u022A':'\\u022B','\\u022C':'\\u022D','\\u022E':'\\u022F','\\u0230':'\\u0231','\\u0232':'\\u0233','\\u023A':'\\u2C65','\\u023B':'\\u023C','\\u023D':'\\u019A','\\u023E':'\\u2C66','\\u0241':'\\u0242','\\u0243':'\\u0180','\\u0244':'\\u0289','\\u0245':'\\u028C','\\u0246':'\\u0247','\\u0248':'\\u0249','\\u024A':'\\u024B','\\u024C':'\\u024D','\\u024E':'\\u024F','\\u0345':'\\u03B9','\\u0370':'\\u0371','\\u0372':'\\u0373','\\u0376':'\\u0377','\\u037F':'\\u03F3','\\u0386':'\\u03AC','\\u0388':'\\u03AD','\\u0389':'\\u03AE','\\u038A':'\\u03AF','\\u038C':'\\u03CC','\\u038E':'\\u03CD','\\u038F':'\\u03CE','\\u0391':'\\u03B1','\\u0392':'\\u03B2','\\u0393':'\\u03B3','\\u0394':'\\u03B4','\\u0395':'\\u03B5','\\u0396':'\\u03B6','\\u0397':'\\u03B7','\\u0398':'\\u03B8','\\u0399':'\\u03B9','\\u039A':'\\u03BA','\\u039B':'\\u03BB','\\u039C':'\\u03BC','\\u039D':'\\u03BD','\\u039E':'\\u03BE','\\u039F':'\\u03BF','\\u03A0':'\\u03C0','\\u03A1':'\\u03C1','\\u03A3':'\\u03C3','\\u03A4':'\\u03C4','\\u03A5':'\\u03C5','\\u03A6':'\\u03C6','\\u03A7':'\\u03C7','\\u03A8':'\\u03C8','\\u03A9':'\\u03C9','\\u03AA':'\\u03CA','\\u03AB':'\\u03CB','\\u03C2':'\\u03C3','\\u03CF':'\\u03D7','\\u03D0':'\\u03B2','\\u03D1':'\\u03B8','\\u03D5':'\\u03C6','\\u03D6':'\\u03C0','\\u03D8':'\\u03D9','\\u03DA':'\\u03DB','\\u03DC':'\\u03DD','\\u03DE':'\\u03DF','\\u03E0':'\\u03E1','\\u03E2':'\\u03E3','\\u03E4':'\\u03E5','\\u03E6':'\\u03E7','\\u03E8':'\\u03E9','\\u03EA':'\\u03EB','\\u03EC':'\\u03ED','\\u03EE':'\\u03EF','\\u03F0':'\\u03BA','\\u03F1':'\\u03C1','\\u03F4':'\\u03B8','\\u03F5':'\\u03B5','\\u03F7':'\\u03F8','\\u03F9':'\\u03F2','\\u03FA':'\\u03FB','\\u03FD':'\\u037B','\\u03FE':'\\u037C','\\u03FF':'\\u037D','\\u0400':'\\u0450','\\u0401':'\\u0451','\\u0402':'\\u0452','\\u0403':'\\u0453','\\u0404':'\\u0454','\\u0405':'\\u0455','\\u0406':'\\u0456','\\u0407':'\\u0457','\\u0408':'\\u0458','\\u0409':'\\u0459','\\u040A':'\\u045A','\\u040B':'\\u045B','\\u040C':'\\u045C','\\u040D':'\\u045D','\\u040E':'\\u045E','\\u040F':'\\u045F','\\u0410':'\\u0430','\\u0411':'\\u0431','\\u0412':'\\u0432','\\u0413':'\\u0433','\\u0414':'\\u0434','\\u0415':'\\u0435','\\u0416':'\\u0436','\\u0417':'\\u0437','\\u0418':'\\u0438','\\u0419':'\\u0439','\\u041A':'\\u043A','\\u041B':'\\u043B','\\u041C':'\\u043C','\\u041D':'\\u043D','\\u041E':'\\u043E','\\u041F':'\\u043F','\\u0420':'\\u0440','\\u0421':'\\u0441','\\u0422':'\\u0442','\\u0423':'\\u0443','\\u0424':'\\u0444','\\u0425':'\\u0445','\\u0426':'\\u0446','\\u0427':'\\u0447','\\u0428':'\\u0448','\\u0429':'\\u0449','\\u042A':'\\u044A','\\u042B':'\\u044B','\\u042C':'\\u044C','\\u042D':'\\u044D','\\u042E':'\\u044E','\\u042F':'\\u044F','\\u0460':'\\u0461','\\u0462':'\\u0463','\\u0464':'\\u0465','\\u0466':'\\u0467','\\u0468':'\\u0469','\\u046A':'\\u046B','\\u046C':'\\u046D','\\u046E':'\\u046F','\\u0470':'\\u0471','\\u0472':'\\u0473','\\u0474':'\\u0475','\\u0476':'\\u0477','\\u0478':'\\u0479','\\u047A':'\\u047B','\\u047C':'\\u047D','\\u047E':'\\u047F','\\u0480':'\\u0481','\\u048A':'\\u048B','\\u048C':'\\u048D','\\u048E':'\\u048F','\\u0490':'\\u0491','\\u0492':'\\u0493','\\u0494':'\\u0495','\\u0496':'\\u0497','\\u0498':'\\u0499','\\u049A':'\\u049B','\\u049C':'\\u049D','\\u049E':'\\u049F','\\u04A0':'\\u04A1','\\u04A2':'\\u04A3','\\u04A4':'\\u04A5','\\u04A6':'\\u04A7','\\u04A8':'\\u04A9','\\u04AA':'\\u04AB','\\u04AC':'\\u04AD','\\u04AE':'\\u04AF','\\u04B0':'\\u04B1','\\u04B2':'\\u04B3','\\u04B4':'\\u04B5','\\u04B6':'\\u04B7','\\u04B8':'\\u04B9','\\u04BA':'\\u04BB','\\u04BC':'\\u04BD','\\u04BE':'\\u04BF','\\u04C0':'\\u04CF','\\u04C1':'\\u04C2','\\u04C3':'\\u04C4','\\u04C5':'\\u04C6','\\u04C7':'\\u04C8','\\u04C9':'\\u04CA','\\u04CB':'\\u04CC','\\u04CD':'\\u04CE','\\u04D0':'\\u04D1','\\u04D2':'\\u04D3','\\u04D4':'\\u04D5','\\u04D6':'\\u04D7','\\u04D8':'\\u04D9','\\u04DA':'\\u04DB','\\u04DC':'\\u04DD','\\u04DE':'\\u04DF','\\u04E0':'\\u04E1','\\u04E2':'\\u04E3','\\u04E4':'\\u04E5','\\u04E6':'\\u04E7','\\u04E8':'\\u04E9','\\u04EA':'\\u04EB','\\u04EC':'\\u04ED','\\u04EE':'\\u04EF','\\u04F0':'\\u04F1','\\u04F2':'\\u04F3','\\u04F4':'\\u04F5','\\u04F6':'\\u04F7','\\u04F8':'\\u04F9','\\u04FA':'\\u04FB','\\u04FC':'\\u04FD','\\u04FE':'\\u04FF','\\u0500':'\\u0501','\\u0502':'\\u0503','\\u0504':'\\u0505','\\u0506':'\\u0507','\\u0508':'\\u0509','\\u050A':'\\u050B','\\u050C':'\\u050D','\\u050E':'\\u050F','\\u0510':'\\u0511','\\u0512':'\\u0513','\\u0514':'\\u0515','\\u0516':'\\u0517','\\u0518':'\\u0519','\\u051A':'\\u051B','\\u051C':'\\u051D','\\u051E':'\\u051F','\\u0520':'\\u0521','\\u0522':'\\u0523','\\u0524':'\\u0525','\\u0526':'\\u0527','\\u0528':'\\u0529','\\u052A':'\\u052B','\\u052C':'\\u052D','\\u052E':'\\u052F','\\u0531':'\\u0561','\\u0532':'\\u0562','\\u0533':'\\u0563','\\u0534':'\\u0564','\\u0535':'\\u0565','\\u0536':'\\u0566','\\u0537':'\\u0567','\\u0538':'\\u0568','\\u0539':'\\u0569','\\u053A':'\\u056A','\\u053B':'\\u056B','\\u053C':'\\u056C','\\u053D':'\\u056D','\\u053E':'\\u056E','\\u053F':'\\u056F','\\u0540':'\\u0570','\\u0541':'\\u0571','\\u0542':'\\u0572','\\u0543':'\\u0573','\\u0544':'\\u0574','\\u0545':'\\u0575','\\u0546':'\\u0576','\\u0547':'\\u0577','\\u0548':'\\u0578','\\u0549':'\\u0579','\\u054A':'\\u057A','\\u054B':'\\u057B','\\u054C':'\\u057C','\\u054D':'\\u057D','\\u054E':'\\u057E','\\u054F':'\\u057F','\\u0550':'\\u0580','\\u0551':'\\u0581','\\u0552':'\\u0582','\\u0553':'\\u0583','\\u0554':'\\u0584','\\u0555':'\\u0585','\\u0556':'\\u0586','\\u10A0':'\\u2D00','\\u10A1':'\\u2D01','\\u10A2':'\\u2D02','\\u10A3':'\\u2D03','\\u10A4':'\\u2D04','\\u10A5':'\\u2D05','\\u10A6':'\\u2D06','\\u10A7':'\\u2D07','\\u10A8':'\\u2D08','\\u10A9':'\\u2D09','\\u10AA':'\\u2D0A','\\u10AB':'\\u2D0B','\\u10AC':'\\u2D0C','\\u10AD':'\\u2D0D','\\u10AE':'\\u2D0E','\\u10AF':'\\u2D0F','\\u10B0':'\\u2D10','\\u10B1':'\\u2D11','\\u10B2':'\\u2D12','\\u10B3':'\\u2D13','\\u10B4':'\\u2D14','\\u10B5':'\\u2D15','\\u10B6':'\\u2D16','\\u10B7':'\\u2D17','\\u10B8':'\\u2D18','\\u10B9':'\\u2D19','\\u10BA':'\\u2D1A','\\u10BB':'\\u2D1B','\\u10BC':'\\u2D1C','\\u10BD':'\\u2D1D','\\u10BE':'\\u2D1E','\\u10BF':'\\u2D1F','\\u10C0':'\\u2D20','\\u10C1':'\\u2D21','\\u10C2':'\\u2D22','\\u10C3':'\\u2D23','\\u10C4':'\\u2D24','\\u10C5':'\\u2D25','\\u10C7':'\\u2D27','\\u10CD':'\\u2D2D','\\u1E00':'\\u1E01','\\u1E02':'\\u1E03','\\u1E04':'\\u1E05','\\u1E06':'\\u1E07','\\u1E08':'\\u1E09','\\u1E0A':'\\u1E0B','\\u1E0C':'\\u1E0D','\\u1E0E':'\\u1E0F','\\u1E10':'\\u1E11','\\u1E12':'\\u1E13','\\u1E14':'\\u1E15','\\u1E16':'\\u1E17','\\u1E18':'\\u1E19','\\u1E1A':'\\u1E1B','\\u1E1C':'\\u1E1D','\\u1E1E':'\\u1E1F','\\u1E20':'\\u1E21','\\u1E22':'\\u1E23','\\u1E24':'\\u1E25','\\u1E26':'\\u1E27','\\u1E28':'\\u1E29','\\u1E2A':'\\u1E2B','\\u1E2C':'\\u1E2D','\\u1E2E':'\\u1E2F','\\u1E30':'\\u1E31','\\u1E32':'\\u1E33','\\u1E34':'\\u1E35','\\u1E36':'\\u1E37','\\u1E38':'\\u1E39','\\u1E3A':'\\u1E3B','\\u1E3C':'\\u1E3D','\\u1E3E':'\\u1E3F','\\u1E40':'\\u1E41','\\u1E42':'\\u1E43','\\u1E44':'\\u1E45','\\u1E46':'\\u1E47','\\u1E48':'\\u1E49','\\u1E4A':'\\u1E4B','\\u1E4C':'\\u1E4D','\\u1E4E':'\\u1E4F','\\u1E50':'\\u1E51','\\u1E52':'\\u1E53','\\u1E54':'\\u1E55','\\u1E56':'\\u1E57','\\u1E58':'\\u1E59','\\u1E5A':'\\u1E5B','\\u1E5C':'\\u1E5D','\\u1E5E':'\\u1E5F','\\u1E60':'\\u1E61','\\u1E62':'\\u1E63','\\u1E64':'\\u1E65','\\u1E66':'\\u1E67','\\u1E68':'\\u1E69','\\u1E6A':'\\u1E6B','\\u1E6C':'\\u1E6D','\\u1E6E':'\\u1E6F','\\u1E70':'\\u1E71','\\u1E72':'\\u1E73','\\u1E74':'\\u1E75','\\u1E76':'\\u1E77','\\u1E78':'\\u1E79','\\u1E7A':'\\u1E7B','\\u1E7C':'\\u1E7D','\\u1E7E':'\\u1E7F','\\u1E80':'\\u1E81','\\u1E82':'\\u1E83','\\u1E84':'\\u1E85','\\u1E86':'\\u1E87','\\u1E88':'\\u1E89','\\u1E8A':'\\u1E8B','\\u1E8C':'\\u1E8D','\\u1E8E':'\\u1E8F','\\u1E90':'\\u1E91','\\u1E92':'\\u1E93','\\u1E94':'\\u1E95','\\u1E9B':'\\u1E61','\\u1EA0':'\\u1EA1','\\u1EA2':'\\u1EA3','\\u1EA4':'\\u1EA5','\\u1EA6':'\\u1EA7','\\u1EA8':'\\u1EA9','\\u1EAA':'\\u1EAB','\\u1EAC':'\\u1EAD','\\u1EAE':'\\u1EAF','\\u1EB0':'\\u1EB1','\\u1EB2':'\\u1EB3','\\u1EB4':'\\u1EB5','\\u1EB6':'\\u1EB7','\\u1EB8':'\\u1EB9','\\u1EBA':'\\u1EBB','\\u1EBC':'\\u1EBD','\\u1EBE':'\\u1EBF','\\u1EC0':'\\u1EC1','\\u1EC2':'\\u1EC3','\\u1EC4':'\\u1EC5','\\u1EC6':'\\u1EC7','\\u1EC8':'\\u1EC9','\\u1ECA':'\\u1ECB','\\u1ECC':'\\u1ECD','\\u1ECE':'\\u1ECF','\\u1ED0':'\\u1ED1','\\u1ED2':'\\u1ED3','\\u1ED4':'\\u1ED5','\\u1ED6':'\\u1ED7','\\u1ED8':'\\u1ED9','\\u1EDA':'\\u1EDB','\\u1EDC':'\\u1EDD','\\u1EDE':'\\u1EDF','\\u1EE0':'\\u1EE1','\\u1EE2':'\\u1EE3','\\u1EE4':'\\u1EE5','\\u1EE6':'\\u1EE7','\\u1EE8':'\\u1EE9','\\u1EEA':'\\u1EEB','\\u1EEC':'\\u1EED','\\u1EEE':'\\u1EEF','\\u1EF0':'\\u1EF1','\\u1EF2':'\\u1EF3','\\u1EF4':'\\u1EF5','\\u1EF6':'\\u1EF7','\\u1EF8':'\\u1EF9','\\u1EFA':'\\u1EFB','\\u1EFC':'\\u1EFD','\\u1EFE':'\\u1EFF','\\u1F08':'\\u1F00','\\u1F09':'\\u1F01','\\u1F0A':'\\u1F02','\\u1F0B':'\\u1F03','\\u1F0C':'\\u1F04','\\u1F0D':'\\u1F05','\\u1F0E':'\\u1F06','\\u1F0F':'\\u1F07','\\u1F18':'\\u1F10','\\u1F19':'\\u1F11','\\u1F1A':'\\u1F12','\\u1F1B':'\\u1F13','\\u1F1C':'\\u1F14','\\u1F1D':'\\u1F15','\\u1F28':'\\u1F20','\\u1F29':'\\u1F21','\\u1F2A':'\\u1F22','\\u1F2B':'\\u1F23','\\u1F2C':'\\u1F24','\\u1F2D':'\\u1F25','\\u1F2E':'\\u1F26','\\u1F2F':'\\u1F27','\\u1F38':'\\u1F30','\\u1F39':'\\u1F31','\\u1F3A':'\\u1F32','\\u1F3B':'\\u1F33','\\u1F3C':'\\u1F34','\\u1F3D':'\\u1F35','\\u1F3E':'\\u1F36','\\u1F3F':'\\u1F37','\\u1F48':'\\u1F40','\\u1F49':'\\u1F41','\\u1F4A':'\\u1F42','\\u1F4B':'\\u1F43','\\u1F4C':'\\u1F44','\\u1F4D':'\\u1F45','\\u1F59':'\\u1F51','\\u1F5B':'\\u1F53','\\u1F5D':'\\u1F55','\\u1F5F':'\\u1F57','\\u1F68':'\\u1F60','\\u1F69':'\\u1F61','\\u1F6A':'\\u1F62','\\u1F6B':'\\u1F63','\\u1F6C':'\\u1F64','\\u1F6D':'\\u1F65','\\u1F6E':'\\u1F66','\\u1F6F':'\\u1F67','\\u1FB8':'\\u1FB0','\\u1FB9':'\\u1FB1','\\u1FBA':'\\u1F70','\\u1FBB':'\\u1F71','\\u1FBE':'\\u03B9','\\u1FC8':'\\u1F72','\\u1FC9':'\\u1F73','\\u1FCA':'\\u1F74','\\u1FCB':'\\u1F75','\\u1FD8':'\\u1FD0','\\u1FD9':'\\u1FD1','\\u1FDA':'\\u1F76','\\u1FDB':'\\u1F77','\\u1FE8':'\\u1FE0','\\u1FE9':'\\u1FE1','\\u1FEA':'\\u1F7A','\\u1FEB':'\\u1F7B','\\u1FEC':'\\u1FE5','\\u1FF8':'\\u1F78','\\u1FF9':'\\u1F79','\\u1FFA':'\\u1F7C','\\u1FFB':'\\u1F7D','\\u2126':'\\u03C9','\\u212A':'k','\\u212B':'\\xE5','\\u2132':'\\u214E','\\u2160':'\\u2170','\\u2161':'\\u2171','\\u2162':'\\u2172','\\u2163':'\\u2173','\\u2164':'\\u2174','\\u2165':'\\u2175','\\u2166':'\\u2176','\\u2167':'\\u2177','\\u2168':'\\u2178','\\u2169':'\\u2179','\\u216A':'\\u217A','\\u216B':'\\u217B','\\u216C':'\\u217C','\\u216D':'\\u217D','\\u216E':'\\u217E','\\u216F':'\\u217F','\\u2183':'\\u2184','\\u24B6':'\\u24D0','\\u24B7':'\\u24D1','\\u24B8':'\\u24D2','\\u24B9':'\\u24D3','\\u24BA':'\\u24D4','\\u24BB':'\\u24D5','\\u24BC':'\\u24D6','\\u24BD':'\\u24D7','\\u24BE':'\\u24D8','\\u24BF':'\\u24D9','\\u24C0':'\\u24DA','\\u24C1':'\\u24DB','\\u24C2':'\\u24DC','\\u24C3':'\\u24DD','\\u24C4':'\\u24DE','\\u24C5':'\\u24DF','\\u24C6':'\\u24E0','\\u24C7':'\\u24E1','\\u24C8':'\\u24E2','\\u24C9':'\\u24E3','\\u24CA':'\\u24E4','\\u24CB':'\\u24E5','\\u24CC':'\\u24E6','\\u24CD':'\\u24E7','\\u24CE':'\\u24E8','\\u24CF':'\\u24E9','\\u2C00':'\\u2C30','\\u2C01':'\\u2C31','\\u2C02':'\\u2C32','\\u2C03':'\\u2C33','\\u2C04':'\\u2C34','\\u2C05':'\\u2C35','\\u2C06':'\\u2C36','\\u2C07':'\\u2C37','\\u2C08':'\\u2C38','\\u2C09':'\\u2C39','\\u2C0A':'\\u2C3A','\\u2C0B':'\\u2C3B','\\u2C0C':'\\u2C3C','\\u2C0D':'\\u2C3D','\\u2C0E':'\\u2C3E','\\u2C0F':'\\u2C3F','\\u2C10':'\\u2C40','\\u2C11':'\\u2C41','\\u2C12':'\\u2C42','\\u2C13':'\\u2C43','\\u2C14':'\\u2C44','\\u2C15':'\\u2C45','\\u2C16':'\\u2C46','\\u2C17':'\\u2C47','\\u2C18':'\\u2C48','\\u2C19':'\\u2C49','\\u2C1A':'\\u2C4A','\\u2C1B':'\\u2C4B','\\u2C1C':'\\u2C4C','\\u2C1D':'\\u2C4D','\\u2C1E':'\\u2C4E','\\u2C1F':'\\u2C4F','\\u2C20':'\\u2C50','\\u2C21':'\\u2C51','\\u2C22':'\\u2C52','\\u2C23':'\\u2C53','\\u2C24':'\\u2C54','\\u2C25':'\\u2C55','\\u2C26':'\\u2C56','\\u2C27':'\\u2C57','\\u2C28':'\\u2C58','\\u2C29':'\\u2C59','\\u2C2A':'\\u2C5A','\\u2C2B':'\\u2C5B','\\u2C2C':'\\u2C5C','\\u2C2D':'\\u2C5D','\\u2C2E':'\\u2C5E','\\u2C60':'\\u2C61','\\u2C62':'\\u026B','\\u2C63':'\\u1D7D','\\u2C64':'\\u027D','\\u2C67':'\\u2C68','\\u2C69':'\\u2C6A','\\u2C6B':'\\u2C6C','\\u2C6D':'\\u0251','\\u2C6E':'\\u0271','\\u2C6F':'\\u0250','\\u2C70':'\\u0252','\\u2C72':'\\u2C73','\\u2C75':'\\u2C76','\\u2C7E':'\\u023F','\\u2C7F':'\\u0240','\\u2C80':'\\u2C81','\\u2C82':'\\u2C83','\\u2C84':'\\u2C85','\\u2C86':'\\u2C87','\\u2C88':'\\u2C89','\\u2C8A':'\\u2C8B','\\u2C8C':'\\u2C8D','\\u2C8E':'\\u2C8F','\\u2C90':'\\u2C91','\\u2C92':'\\u2C93','\\u2C94':'\\u2C95','\\u2C96':'\\u2C97','\\u2C98':'\\u2C99','\\u2C9A':'\\u2C9B','\\u2C9C':'\\u2C9D','\\u2C9E':'\\u2C9F','\\u2CA0':'\\u2CA1','\\u2CA2':'\\u2CA3','\\u2CA4':'\\u2CA5','\\u2CA6':'\\u2CA7','\\u2CA8':'\\u2CA9','\\u2CAA':'\\u2CAB','\\u2CAC':'\\u2CAD','\\u2CAE':'\\u2CAF','\\u2CB0':'\\u2CB1','\\u2CB2':'\\u2CB3','\\u2CB4':'\\u2CB5','\\u2CB6':'\\u2CB7','\\u2CB8':'\\u2CB9','\\u2CBA':'\\u2CBB','\\u2CBC':'\\u2CBD','\\u2CBE':'\\u2CBF','\\u2CC0':'\\u2CC1','\\u2CC2':'\\u2CC3','\\u2CC4':'\\u2CC5','\\u2CC6':'\\u2CC7','\\u2CC8':'\\u2CC9','\\u2CCA':'\\u2CCB','\\u2CCC':'\\u2CCD','\\u2CCE':'\\u2CCF','\\u2CD0':'\\u2CD1','\\u2CD2':'\\u2CD3','\\u2CD4':'\\u2CD5','\\u2CD6':'\\u2CD7','\\u2CD8':'\\u2CD9','\\u2CDA':'\\u2CDB','\\u2CDC':'\\u2CDD','\\u2CDE':'\\u2CDF','\\u2CE0':'\\u2CE1','\\u2CE2':'\\u2CE3','\\u2CEB':'\\u2CEC','\\u2CED':'\\u2CEE','\\u2CF2':'\\u2CF3','\\uA640':'\\uA641','\\uA642':'\\uA643','\\uA644':'\\uA645','\\uA646':'\\uA647','\\uA648':'\\uA649','\\uA64A':'\\uA64B','\\uA64C':'\\uA64D','\\uA64E':'\\uA64F','\\uA650':'\\uA651','\\uA652':'\\uA653','\\uA654':'\\uA655','\\uA656':'\\uA657','\\uA658':'\\uA659','\\uA65A':'\\uA65B','\\uA65C':'\\uA65D','\\uA65E':'\\uA65F','\\uA660':'\\uA661','\\uA662':'\\uA663','\\uA664':'\\uA665','\\uA666':'\\uA667','\\uA668':'\\uA669','\\uA66A':'\\uA66B','\\uA66C':'\\uA66D','\\uA680':'\\uA681','\\uA682':'\\uA683','\\uA684':'\\uA685','\\uA686':'\\uA687','\\uA688':'\\uA689','\\uA68A':'\\uA68B','\\uA68C':'\\uA68D','\\uA68E':'\\uA68F','\\uA690':'\\uA691','\\uA692':'\\uA693','\\uA694':'\\uA695','\\uA696':'\\uA697','\\uA698':'\\uA699','\\uA69A':'\\uA69B','\\uA722':'\\uA723','\\uA724':'\\uA725','\\uA726':'\\uA727','\\uA728':'\\uA729','\\uA72A':'\\uA72B','\\uA72C':'\\uA72D','\\uA72E':'\\uA72F','\\uA732':'\\uA733','\\uA734':'\\uA735','\\uA736':'\\uA737','\\uA738':'\\uA739','\\uA73A':'\\uA73B','\\uA73C':'\\uA73D','\\uA73E':'\\uA73F','\\uA740':'\\uA741','\\uA742':'\\uA743','\\uA744':'\\uA745','\\uA746':'\\uA747','\\uA748':'\\uA749','\\uA74A':'\\uA74B','\\uA74C':'\\uA74D','\\uA74E':'\\uA74F','\\uA750':'\\uA751','\\uA752':'\\uA753','\\uA754':'\\uA755','\\uA756':'\\uA757','\\uA758':'\\uA759','\\uA75A':'\\uA75B','\\uA75C':'\\uA75D','\\uA75E':'\\uA75F','\\uA760':'\\uA761','\\uA762':'\\uA763','\\uA764':'\\uA765','\\uA766':'\\uA767','\\uA768':'\\uA769','\\uA76A':'\\uA76B','\\uA76C':'\\uA76D','\\uA76E':'\\uA76F','\\uA779':'\\uA77A','\\uA77B':'\\uA77C','\\uA77D':'\\u1D79','\\uA77E':'\\uA77F','\\uA780':'\\uA781','\\uA782':'\\uA783','\\uA784':'\\uA785','\\uA786':'\\uA787','\\uA78B':'\\uA78C','\\uA78D':'\\u0265','\\uA790':'\\uA791','\\uA792':'\\uA793','\\uA796':'\\uA797','\\uA798':'\\uA799','\\uA79A':'\\uA79B','\\uA79C':'\\uA79D','\\uA79E':'\\uA79F','\\uA7A0':'\\uA7A1','\\uA7A2':'\\uA7A3','\\uA7A4':'\\uA7A5','\\uA7A6':'\\uA7A7','\\uA7A8':'\\uA7A9','\\uA7AA':'\\u0266','\\uA7AB':'\\u025C','\\uA7AC':'\\u0261','\\uA7AD':'\\u026C','\\uA7B0':'\\u029E','\\uA7B1':'\\u0287','\\uFF21':'\\uFF41','\\uFF22':'\\uFF42','\\uFF23':'\\uFF43','\\uFF24':'\\uFF44','\\uFF25':'\\uFF45','\\uFF26':'\\uFF46','\\uFF27':'\\uFF47','\\uFF28':'\\uFF48','\\uFF29':'\\uFF49','\\uFF2A':'\\uFF4A','\\uFF2B':'\\uFF4B','\\uFF2C':'\\uFF4C','\\uFF2D':'\\uFF4D','\\uFF2E':'\\uFF4E','\\uFF2F':'\\uFF4F','\\uFF30':'\\uFF50','\\uFF31':'\\uFF51','\\uFF32':'\\uFF52','\\uFF33':'\\uFF53','\\uFF34':'\\uFF54','\\uFF35':'\\uFF55','\\uFF36':'\\uFF56','\\uFF37':'\\uFF57','\\uFF38':'\\uFF58','\\uFF39':'\\uFF59','\\uFF3A':'\\uFF5A','\\uD801\\uDC00':'\\uD801\\uDC28','\\uD801\\uDC01':'\\uD801\\uDC29','\\uD801\\uDC02':'\\uD801\\uDC2A','\\uD801\\uDC03':'\\uD801\\uDC2B','\\uD801\\uDC04':'\\uD801\\uDC2C','\\uD801\\uDC05':'\\uD801\\uDC2D','\\uD801\\uDC06':'\\uD801\\uDC2E','\\uD801\\uDC07':'\\uD801\\uDC2F','\\uD801\\uDC08':'\\uD801\\uDC30','\\uD801\\uDC09':'\\uD801\\uDC31','\\uD801\\uDC0A':'\\uD801\\uDC32','\\uD801\\uDC0B':'\\uD801\\uDC33','\\uD801\\uDC0C':'\\uD801\\uDC34','\\uD801\\uDC0D':'\\uD801\\uDC35','\\uD801\\uDC0E':'\\uD801\\uDC36','\\uD801\\uDC0F':'\\uD801\\uDC37','\\uD801\\uDC10':'\\uD801\\uDC38','\\uD801\\uDC11':'\\uD801\\uDC39','\\uD801\\uDC12':'\\uD801\\uDC3A','\\uD801\\uDC13':'\\uD801\\uDC3B','\\uD801\\uDC14':'\\uD801\\uDC3C','\\uD801\\uDC15':'\\uD801\\uDC3D','\\uD801\\uDC16':'\\uD801\\uDC3E','\\uD801\\uDC17':'\\uD801\\uDC3F','\\uD801\\uDC18':'\\uD801\\uDC40','\\uD801\\uDC19':'\\uD801\\uDC41','\\uD801\\uDC1A':'\\uD801\\uDC42','\\uD801\\uDC1B':'\\uD801\\uDC43','\\uD801\\uDC1C':'\\uD801\\uDC44','\\uD801\\uDC1D':'\\uD801\\uDC45','\\uD801\\uDC1E':'\\uD801\\uDC46','\\uD801\\uDC1F':'\\uD801\\uDC47','\\uD801\\uDC20':'\\uD801\\uDC48','\\uD801\\uDC21':'\\uD801\\uDC49','\\uD801\\uDC22':'\\uD801\\uDC4A','\\uD801\\uDC23':'\\uD801\\uDC4B','\\uD801\\uDC24':'\\uD801\\uDC4C','\\uD801\\uDC25':'\\uD801\\uDC4D','\\uD801\\uDC26':'\\uD801\\uDC4E','\\uD801\\uDC27':'\\uD801\\uDC4F','\\uD806\\uDCA0':'\\uD806\\uDCC0','\\uD806\\uDCA1':'\\uD806\\uDCC1','\\uD806\\uDCA2':'\\uD806\\uDCC2','\\uD806\\uDCA3':'\\uD806\\uDCC3','\\uD806\\uDCA4':'\\uD806\\uDCC4','\\uD806\\uDCA5':'\\uD806\\uDCC5','\\uD806\\uDCA6':'\\uD806\\uDCC6','\\uD806\\uDCA7':'\\uD806\\uDCC7','\\uD806\\uDCA8':'\\uD806\\uDCC8','\\uD806\\uDCA9':'\\uD806\\uDCC9','\\uD806\\uDCAA':'\\uD806\\uDCCA','\\uD806\\uDCAB':'\\uD806\\uDCCB','\\uD806\\uDCAC':'\\uD806\\uDCCC','\\uD806\\uDCAD':'\\uD806\\uDCCD','\\uD806\\uDCAE':'\\uD806\\uDCCE','\\uD806\\uDCAF':'\\uD806\\uDCCF','\\uD806\\uDCB0':'\\uD806\\uDCD0','\\uD806\\uDCB1':'\\uD806\\uDCD1','\\uD806\\uDCB2':'\\uD806\\uDCD2','\\uD806\\uDCB3':'\\uD806\\uDCD3','\\uD806\\uDCB4':'\\uD806\\uDCD4','\\uD806\\uDCB5':'\\uD806\\uDCD5','\\uD806\\uDCB6':'\\uD806\\uDCD6','\\uD806\\uDCB7':'\\uD806\\uDCD7','\\uD806\\uDCB8':'\\uD806\\uDCD8','\\uD806\\uDCB9':'\\uD806\\uDCD9','\\uD806\\uDCBA':'\\uD806\\uDCDA','\\uD806\\uDCBB':'\\uD806\\uDCDB','\\uD806\\uDCBC':'\\uD806\\uDCDC','\\uD806\\uDCBD':'\\uD806\\uDCDD','\\uD806\\uDCBE':'\\uD806\\uDCDE','\\uD806\\uDCBF':'\\uD806\\uDCDF','\\xDF':'ss','\\u0130':'i\\u0307','\\u0149':'\\u02BCn','\\u01F0':'j\\u030C','\\u0390':'\\u03B9\\u0308\\u0301','\\u03B0':'\\u03C5\\u0308\\u0301','\\u0587':'\\u0565\\u0582','\\u1E96':'h\\u0331','\\u1E97':'t\\u0308','\\u1E98':'w\\u030A','\\u1E99':'y\\u030A','\\u1E9A':'a\\u02BE','\\u1E9E':'ss','\\u1F50':'\\u03C5\\u0313','\\u1F52':'\\u03C5\\u0313\\u0300','\\u1F54':'\\u03C5\\u0313\\u0301','\\u1F56':'\\u03C5\\u0313\\u0342','\\u1F80':'\\u1F00\\u03B9','\\u1F81':'\\u1F01\\u03B9','\\u1F82':'\\u1F02\\u03B9','\\u1F83':'\\u1F03\\u03B9','\\u1F84':'\\u1F04\\u03B9','\\u1F85':'\\u1F05\\u03B9','\\u1F86':'\\u1F06\\u03B9','\\u1F87':'\\u1F07\\u03B9','\\u1F88':'\\u1F00\\u03B9','\\u1F89':'\\u1F01\\u03B9','\\u1F8A':'\\u1F02\\u03B9','\\u1F8B':'\\u1F03\\u03B9','\\u1F8C':'\\u1F04\\u03B9','\\u1F8D':'\\u1F05\\u03B9','\\u1F8E':'\\u1F06\\u03B9','\\u1F8F':'\\u1F07\\u03B9','\\u1F90':'\\u1F20\\u03B9','\\u1F91':'\\u1F21\\u03B9','\\u1F92':'\\u1F22\\u03B9','\\u1F93':'\\u1F23\\u03B9','\\u1F94':'\\u1F24\\u03B9','\\u1F95':'\\u1F25\\u03B9','\\u1F96':'\\u1F26\\u03B9','\\u1F97':'\\u1F27\\u03B9','\\u1F98':'\\u1F20\\u03B9','\\u1F99':'\\u1F21\\u03B9','\\u1F9A':'\\u1F22\\u03B9','\\u1F9B':'\\u1F23\\u03B9','\\u1F9C':'\\u1F24\\u03B9','\\u1F9D':'\\u1F25\\u03B9','\\u1F9E':'\\u1F26\\u03B9','\\u1F9F':'\\u1F27\\u03B9','\\u1FA0':'\\u1F60\\u03B9','\\u1FA1':'\\u1F61\\u03B9','\\u1FA2':'\\u1F62\\u03B9','\\u1FA3':'\\u1F63\\u03B9','\\u1FA4':'\\u1F64\\u03B9','\\u1FA5':'\\u1F65\\u03B9','\\u1FA6':'\\u1F66\\u03B9','\\u1FA7':'\\u1F67\\u03B9','\\u1FA8':'\\u1F60\\u03B9','\\u1FA9':'\\u1F61\\u03B9','\\u1FAA':'\\u1F62\\u03B9','\\u1FAB':'\\u1F63\\u03B9','\\u1FAC':'\\u1F64\\u03B9','\\u1FAD':'\\u1F65\\u03B9','\\u1FAE':'\\u1F66\\u03B9','\\u1FAF':'\\u1F67\\u03B9','\\u1FB2':'\\u1F70\\u03B9','\\u1FB3':'\\u03B1\\u03B9','\\u1FB4':'\\u03AC\\u03B9','\\u1FB6':'\\u03B1\\u0342','\\u1FB7':'\\u03B1\\u0342\\u03B9','\\u1FBC':'\\u03B1\\u03B9','\\u1FC2':'\\u1F74\\u03B9','\\u1FC3':'\\u03B7\\u03B9','\\u1FC4':'\\u03AE\\u03B9','\\u1FC6':'\\u03B7\\u0342','\\u1FC7':'\\u03B7\\u0342\\u03B9','\\u1FCC':'\\u03B7\\u03B9','\\u1FD2':'\\u03B9\\u0308\\u0300','\\u1FD3':'\\u03B9\\u0308\\u0301','\\u1FD6':'\\u03B9\\u0342','\\u1FD7':'\\u03B9\\u0308\\u0342','\\u1FE2':'\\u03C5\\u0308\\u0300','\\u1FE3':'\\u03C5\\u0308\\u0301','\\u1FE4':'\\u03C1\\u0313','\\u1FE6':'\\u03C5\\u0342','\\u1FE7':'\\u03C5\\u0308\\u0342','\\u1FF2':'\\u1F7C\\u03B9','\\u1FF3':'\\u03C9\\u03B9','\\u1FF4':'\\u03CE\\u03B9','\\u1FF6':'\\u03C9\\u0342','\\u1FF7':'\\u03C9\\u0342\\u03B9','\\u1FFC':'\\u03C9\\u03B9','\\uFB00':'ff','\\uFB01':'fi','\\uFB02':'fl','\\uFB03':'ffi','\\uFB04':'ffl','\\uFB05':'st','\\uFB06':'st','\\uFB13':'\\u0574\\u0576','\\uFB14':'\\u0574\\u0565','\\uFB15':'\\u0574\\u056B','\\uFB16':'\\u057E\\u0576','\\uFB17':'\\u0574\\u056D'};\n\n// Normalize reference label: collapse internal whitespace\n// to single space, remove leading/trailing whitespace, case fold.\nmodule.exports = function(string) {\n return string.slice(1, string.length - 1).trim().replace(regex, function($0) {\n // Note: there is no need to check `hasOwnProperty($0)` here.\n // If character not found in lookup table, it must be whitespace.\n return map[$0] || ' ';\n });\n};\n\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Renderer = __webpack_require__(60);\n\nvar esc = __webpack_require__(6).escapeXml;\n\nvar reUnsafeProtocol = /^javascript:|vbscript:|file:|data:/i;\nvar reSafeDataProtocol = /^data:image\\/(?:png|gif|jpeg|webp)/i;\n\nvar potentiallyUnsafe = function(url) {\n return reUnsafeProtocol.test(url) &&\n !reSafeDataProtocol.test(url);\n};\n\n// Helper function to produce an HTML tag.\nfunction tag(name, attrs, selfclosing) {\n if (this.disableTags > 0) {\n return;\n }\n this.buffer += ('<' + name);\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n this.buffer += (' ' + attrib[0] + '=\"' + attrib[1] + '\"');\n i++;\n }\n }\n if (selfclosing) {\n this.buffer += ' /';\n }\n this.buffer += '>';\n this.lastOut = '>';\n}\n\n\nfunction HtmlRenderer(options) {\n options = options || {};\n // by default, soft breaks are rendered as newlines in HTML\n options.softbreak = options.softbreak || '\\n';\n // set to \"<br />\" to make them hard breaks\n // set to \" \" if you want to ignore line wrapping in source\n\n this.disableTags = 0;\n this.lastOut = \"\\n\";\n this.options = options;\n}\n\n/* Node methods */\n\nfunction text(node) {\n this.out(node.literal);\n}\n\nfunction softbreak() {\n this.lit(this.options.softbreak);\n}\n\nfunction linebreak() {\n this.tag('br', [], true);\n this.cr();\n}\n\nfunction link(node, entering) {\n var attrs = this.attrs(node);\n if (entering) {\n if (!(this.options.safe && potentiallyUnsafe(node.destination))) {\n attrs.push(['href', esc(node.destination, true)]);\n }\n if (node.title) {\n attrs.push(['title', esc(node.title, true)]);\n }\n this.tag('a', attrs);\n } else {\n this.tag('/a');\n }\n}\n\nfunction image(node, entering) {\n if (entering) {\n if (this.disableTags === 0) {\n if (this.options.safe &&\n potentiallyUnsafe(node.destination)) {\n this.lit('<img src=\"\" alt=\"');\n } else {\n this.lit('<img src=\"' + esc(node.destination, true) +\n '\" alt=\"');\n }\n }\n this.disableTags += 1;\n } else {\n this.disableTags -= 1;\n if (this.disableTags === 0) {\n if (node.title) {\n this.lit('\" title=\"' + esc(node.title, true));\n }\n this.lit('\" />');\n }\n }\n}\n\nfunction emph(node, entering) {\n this.tag(entering ? 'em' : '/em');\n}\n\nfunction strong(node, entering) {\n this.tag(entering ? 'strong' : '/strong');\n}\n\nfunction paragraph(node, entering) {\n var grandparent = node.parent.parent\n , attrs = this.attrs(node);\n if (grandparent !== null &&\n grandparent.type === 'list') {\n if (grandparent.listTight) {\n return;\n }\n }\n if (entering) {\n this.cr();\n this.tag('p', attrs);\n } else {\n this.tag('/p');\n this.cr();\n }\n}\n\nfunction heading(node, entering) {\n var tagname = 'h' + node.level\n , attrs = this.attrs(node);\n if (entering) {\n this.cr();\n this.tag(tagname, attrs);\n } else {\n this.tag('/' + tagname);\n this.cr();\n }\n}\n\nfunction code(node) {\n this.tag('code');\n this.out(node.literal);\n this.tag('/code');\n}\n\nfunction code_block(node) {\n var info_words = node.info ? node.info.split(/\\s+/) : []\n , attrs = this.attrs(node);\n if (info_words.length > 0 && info_words[0].length > 0) {\n attrs.push(['class', 'language-' + esc(info_words[0], true)]);\n }\n this.cr();\n this.tag('pre');\n this.tag('code', attrs);\n this.out(node.literal);\n this.tag('/code');\n this.tag('/pre');\n this.cr();\n}\n\nfunction thematic_break(node) {\n var attrs = this.attrs(node);\n this.cr();\n this.tag('hr', attrs, true);\n this.cr();\n}\n\nfunction block_quote(node, entering) {\n var attrs = this.attrs(node);\n if (entering) {\n this.cr();\n this.tag('blockquote', attrs);\n this.cr();\n } else {\n this.cr();\n this.tag('/blockquote');\n this.cr();\n }\n}\n\nfunction list(node, entering) {\n var tagname = node.listType === 'bullet' ? 'ul' : 'ol'\n , attrs = this.attrs(node);\n\n if (entering) {\n var start = node.listStart;\n if (start !== null && start !== 1) {\n attrs.push(['start', start.toString()]);\n }\n this.cr();\n this.tag(tagname, attrs);\n this.cr();\n } else {\n this.cr();\n this.tag('/' + tagname);\n this.cr();\n }\n}\n\nfunction item(node, entering) {\n var attrs = this.attrs(node);\n if (entering) {\n this.tag('li', attrs);\n } else {\n this.tag('/li');\n this.cr();\n }\n}\n\nfunction html_inline(node) {\n if (this.options.safe) {\n this.lit('<!-- raw HTML omitted -->');\n } else {\n this.lit(node.literal);\n }\n}\n\nfunction html_block(node) {\n this.cr();\n if (this.options.safe) {\n this.lit('<!-- raw HTML omitted -->');\n } else {\n this.lit(node.literal);\n }\n this.cr();\n}\n\nfunction custom_inline(node, entering) {\n if (entering && node.onEnter) {\n this.lit(node.onEnter);\n } else if (!entering && node.onExit) {\n this.lit(node.onExit);\n }\n}\n\nfunction custom_block(node, entering) {\n this.cr();\n if (entering && node.onEnter) {\n this.lit(node.onEnter);\n } else if (!entering && node.onExit) {\n this.lit(node.onExit);\n }\n this.cr();\n}\n\n/* Helper methods */\n\nfunction out(s) {\n this.lit(esc(s, false));\n}\n\nfunction attrs (node) {\n var att = [];\n if (this.options.sourcepos) {\n var pos = node.sourcepos;\n if (pos) {\n att.push(['data-sourcepos', String(pos[0][0]) + ':' +\n String(pos[0][1]) + '-' + String(pos[1][0]) + ':' +\n String(pos[1][1])]);\n }\n }\n return att;\n}\n\n// quick browser-compatible inheritance\nHtmlRenderer.prototype = Object.create(Renderer.prototype);\n\nHtmlRenderer.prototype.text = text;\nHtmlRenderer.prototype.html_inline = html_inline;\nHtmlRenderer.prototype.html_block = html_block;\nHtmlRenderer.prototype.softbreak = softbreak;\nHtmlRenderer.prototype.linebreak = linebreak;\nHtmlRenderer.prototype.link = link;\nHtmlRenderer.prototype.image = image;\nHtmlRenderer.prototype.emph = emph;\nHtmlRenderer.prototype.strong = strong;\nHtmlRenderer.prototype.paragraph = paragraph;\nHtmlRenderer.prototype.heading = heading;\nHtmlRenderer.prototype.code = code;\nHtmlRenderer.prototype.code_block = code_block;\nHtmlRenderer.prototype.thematic_break = thematic_break;\nHtmlRenderer.prototype.block_quote = block_quote;\nHtmlRenderer.prototype.list = list;\nHtmlRenderer.prototype.item = item;\nHtmlRenderer.prototype.custom_inline = custom_inline;\nHtmlRenderer.prototype.custom_block = custom_block;\n\nHtmlRenderer.prototype.out = out;\nHtmlRenderer.prototype.tag = tag;\nHtmlRenderer.prototype.attrs = attrs;\n\nmodule.exports = HtmlRenderer;\n\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction Renderer() {}\n\n/**\n * Walks the AST and calls member methods for each Node type.\n *\n * @param ast {Node} The root of the abstract syntax tree.\n */\nfunction render(ast) {\n var walker = ast.walker()\n , event\n , type;\n\n this.buffer = '';\n this.lastOut = '\\n';\n\n while((event = walker.next())) {\n type = event.node.type;\n if (this[type]) {\n this[type](event.node, event.entering);\n }\n }\n return this.buffer;\n}\n\n/**\n * Concatenate a literal string to the buffer.\n *\n * @param str {String} The string to concatenate.\n */\nfunction lit(str) {\n this.buffer += str;\n this.lastOut = str;\n}\n\nfunction cr() {\n if (this.lastOut !== '\\n') {\n this.lit('\\n');\n }\n}\n\n/**\n * Concatenate a string to the buffer possibly escaping the content.\n *\n * Concrete renderer implementations should override this method.\n *\n * @param str {String} The string to concatenate.\n */\nfunction out(str) {\n this.lit(str);\n}\n\nRenderer.prototype.render = render;\nRenderer.prototype.out = out;\nRenderer.prototype.lit = lit;\nRenderer.prototype.cr = cr;\n\nmodule.exports = Renderer;\n\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar escapeXml = __webpack_require__(6).escapeXml;\n\n// Helper function to produce an XML tag.\nvar tag = function(name, attrs, selfclosing) {\n var result = '<' + name;\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n result += ' ' + attrib[0] + '=\"' + escapeXml(attrib[1]) + '\"';\n i++;\n }\n }\n if (selfclosing) {\n result += ' /';\n }\n\n result += '>';\n return result;\n};\n\nvar reXMLTag = /\\<[^>]*\\>/;\n\nvar toTagName = function(s) {\n return s.replace(/([a-z])([A-Z])/g, \"$1_$2\").toLowerCase();\n};\n\nvar renderNodes = function(block) {\n\n var attrs;\n var tagname;\n var walker = block.walker();\n var event, node, entering;\n var buffer = \"\";\n var lastOut = \"\\n\";\n var disableTags = 0;\n var indentLevel = 0;\n var indent = ' ';\n var container;\n var selfClosing;\n var nodetype;\n\n var out = function(s) {\n if (disableTags > 0) {\n buffer += s.replace(reXMLTag, '');\n } else {\n buffer += s;\n }\n lastOut = s;\n };\n var esc = this.escape;\n var cr = function() {\n if (lastOut !== '\\n') {\n buffer += '\\n';\n lastOut = '\\n';\n for (var i = indentLevel; i > 0; i--) {\n buffer += indent;\n }\n }\n };\n\n var options = this.options;\n\n if (options.time) { console.time(\"rendering\"); }\n\n buffer += '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\n buffer += '<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\\n';\n\n while ((event = walker.next())) {\n entering = event.entering;\n node = event.node;\n nodetype = node.type;\n\n container = node.isContainer;\n selfClosing = nodetype === 'thematic_break' || nodetype === 'linebreak' ||\n nodetype === 'softbreak';\n tagname = toTagName(nodetype);\n\n if (entering) {\n\n attrs = [];\n\n switch (nodetype) {\n case 'document':\n attrs.push(['xmlns', 'http://commonmark.org/xml/1.0']);\n break;\n case 'list':\n if (node.listType !== null) {\n attrs.push(['type', node.listType.toLowerCase()]);\n }\n if (node.listStart !== null) {\n attrs.push(['start', String(node.listStart)]);\n }\n if (node.listTight !== null) {\n attrs.push(['tight', (node.listTight ? 'true' : 'false')]);\n }\n var delim = node.listDelimiter;\n if (delim !== null) {\n var delimword = '';\n if (delim === '.') {\n delimword = 'period';\n } else {\n delimword = 'paren';\n }\n attrs.push(['delimiter', delimword]);\n }\n break;\n case 'code_block':\n if (node.info) {\n attrs.push(['info', node.info]);\n }\n break;\n case 'heading':\n attrs.push(['level', String(node.level)]);\n break;\n case 'link':\n case 'image':\n attrs.push(['destination', node.destination]);\n attrs.push(['title', node.title]);\n break;\n case 'custom_inline':\n case 'custom_block':\n attrs.push(['on_enter', node.onEnter]);\n attrs.push(['on_exit', node.onExit]);\n break;\n default:\n break;\n }\n if (options.sourcepos) {\n var pos = node.sourcepos;\n if (pos) {\n attrs.push(['sourcepos', String(pos[0][0]) + ':' +\n String(pos[0][1]) + '-' + String(pos[1][0]) + ':' +\n String(pos[1][1])]);\n }\n }\n\n cr();\n out(tag(tagname, attrs, selfClosing));\n if (container) {\n indentLevel += 1;\n } else if (!container && !selfClosing) {\n var lit = node.literal;\n if (lit) {\n out(esc(lit));\n }\n out(tag('/' + tagname));\n }\n } else {\n indentLevel -= 1;\n cr();\n out(tag('/' + tagname));\n }\n\n\n }\n if (options.time) { console.timeEnd(\"rendering\"); }\n buffer += '\\n';\n return buffer;\n};\n\n// The XmlRenderer object.\nfunction XmlRenderer(options){\n return {\n // default options:\n softbreak: '\\n', // by default, soft breaks are rendered as newlines in HTML\n // set to \"<br />\" to make them hard breaks\n // set to \" \" if you want to ignore line wrapping in source\n escape: escapeXml,\n options: options || {},\n render: renderNodes\n };\n}\n\nmodule.exports = XmlRenderer;\n\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_RESULT__;/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan <stevenlevithan.com>\n * MIT license\n *\n * Includes enhancements by Scott Trenda <scott.trenda.net>\n * and Kris Kowal <cixar.com/~kris.kowal/>\n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\n(function(global) {\n 'use strict';\n\n var dateFormat = (function() {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[LloSZWN]|'[^']*'|'[^']*'/g;\n var timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g;\n var timezoneClip = /[^-+\\dA-Z]/g;\n \n // Regexes and supporting functions are cached through closure\n return function (date, mask, utc, gmt) {\n \n // You can't provide utc if you skip other args (use the 'UTC:' mask prefix)\n if (arguments.length === 1 && kindOf(date) === 'string' && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }\n \n date = date || new Date;\n \n if(!(date instanceof Date)) {\n date = new Date(date);\n }\n \n if (isNaN(date)) {\n throw TypeError('Invalid date');\n }\n \n mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);\n \n // Allow setting the utc/gmt argument via the mask\n var maskSlice = mask.slice(0, 4);\n if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {\n mask = mask.slice(4);\n utc = true;\n if (maskSlice === 'GMT:') {\n gmt = true;\n }\n }\n \n var _ = utc ? 'getUTC' : 'get';\n var d = date[_ + 'Date']();\n var D = date[_ + 'Day']();\n var m = date[_ + 'Month']();\n var y = date[_ + 'FullYear']();\n var H = date[_ + 'Hours']();\n var M = date[_ + 'Minutes']();\n var s = date[_ + 'Seconds']();\n var L = date[_ + 'Milliseconds']();\n var o = utc ? 0 : date.getTimezoneOffset();\n var W = getWeek(date);\n var N = getDayOfWeek(date);\n var flags = {\n d: d,\n dd: pad(d),\n ddd: dateFormat.i18n.dayNames[D],\n dddd: dateFormat.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dateFormat.i18n.monthNames[m],\n mmmm: dateFormat.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(Math.round(L / 10)),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),\n o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],\n W: W,\n N: N\n };\n \n return mask.replace(token, function (match) {\n if (match in flags) {\n return flags[match];\n }\n return match.slice(1, match.length - 1);\n });\n };\n })();\n\n dateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n 'shortDate': 'm/d/yy',\n 'mediumDate': 'mmm d, yyyy',\n 'longDate': 'mmmm d, yyyy',\n 'fullDate': 'dddd, mmmm d, yyyy',\n 'shortTime': 'h:MM TT',\n 'mediumTime': 'h:MM:ss TT',\n 'longTime': 'h:MM:ss TT Z',\n 'isoDate': 'yyyy-mm-dd',\n 'isoTime': 'HH:MM:ss',\n 'isoDateTime': 'yyyy-mm-dd\\'T\\'HH:MM:sso',\n 'isoUtcDateTime': 'UTC:yyyy-mm-dd\\'T\\'HH:MM:ss\\'Z\\'',\n 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'\n };\n\n // Internationalization strings\n dateFormat.i18n = {\n dayNames: [\n 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'\n ],\n monthNames: [\n 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'\n ]\n };\n\nfunction pad(val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) {\n val = '0' + val;\n }\n return val;\n}\n\n/**\n * Get the ISO 8601 week number\n * Based on comments from\n * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html\n *\n * @param {Object} `date`\n * @return {Number}\n */\nfunction getWeek(date) {\n // Remove time components of date\n var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());\n\n // Change date to Thursday same week\n targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);\n\n // Take January 4th as it is always in week 1 (see ISO 8601)\n var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);\n\n // Change date to Thursday same week\n firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);\n\n // Check if daylight-saving-time-switch occured and correct for it\n var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();\n targetThursday.setHours(targetThursday.getHours() - ds);\n\n // Number of weeks between target Thursday and first Thursday\n var weekDiff = (targetThursday - firstThursday) / (86400000*7);\n return 1 + Math.floor(weekDiff);\n}\n\n/**\n * Get ISO-8601 numeric representation of the day of the week\n * 1 (for Monday) through 7 (for Sunday)\n * \n * @param {Object} `date`\n * @return {Number}\n */\nfunction getDayOfWeek(date) {\n var dow = date.getDay();\n if(dow === 0) {\n dow = 7;\n }\n return dow;\n}\n\n/**\n * kind-of shortcut\n * @param {*} val\n * @return {String}\n */\nfunction kindOf(val) {\n if (val === null) {\n return 'null';\n }\n\n if (val === undefined) {\n return 'undefined';\n }\n\n if (typeof val !== 'object') {\n return typeof val;\n }\n\n if (Array.isArray(val)) {\n return 'array';\n }\n\n return {}.toString.call(val)\n .slice(8, -1).toLowerCase();\n};\n\n\n\n if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {\n return dateFormat;\n }.call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports === 'object') {\n module.exports = dateFormat;\n } else {\n global.dateFormat = dateFormat;\n }\n})(this);\n\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar entityMap = __webpack_require__(31),\n legacyMap = __webpack_require__(67),\n xmlMap = __webpack_require__(32),\n decodeCodePoint = __webpack_require__(64);\n\nvar decodeXMLStrict = getStrictDecoder(xmlMap),\n decodeHTMLStrict = getStrictDecoder(entityMap);\n\nfunction getStrictDecoder(map){\n\tvar keys = Object.keys(map).join(\"|\"),\n\t replace = getReplacer(map);\n\n\tkeys += \"|#[xX][\\\\da-fA-F]+|#\\\\d+\";\n\n\tvar re = new RegExp(\"&(?:\" + keys + \");\", \"g\");\n\n\treturn function(str){\n\t\treturn String(str).replace(re, replace);\n\t};\n}\n\nvar decodeHTML = (function(){\n\tvar legacy = Object.keys(legacyMap)\n\t\t.sort(sorter);\n\n\tvar keys = Object.keys(entityMap)\n\t\t.sort(sorter);\n\n\tfor(var i = 0, j = 0; i < keys.length; i++){\n\t\tif(legacy[j] === keys[i]){\n\t\t\tkeys[i] += \";?\";\n\t\t\tj++;\n\t\t} else {\n\t\t\tkeys[i] += \";\";\n\t\t}\n\t}\n\n\tvar re = new RegExp(\"&(?:\" + keys.join(\"|\") + \"|#[xX][\\\\da-fA-F]+;?|#\\\\d+;?)\", \"g\"),\n\t replace = getReplacer(entityMap);\n\n\tfunction replacer(str){\n\t\tif(str.substr(-1) !== \";\") str += \";\";\n\t\treturn replace(str);\n\t}\n\n\t//TODO consider creating a merged map\n\treturn function(str){\n\t\treturn String(str).replace(re, replacer);\n\t};\n}());\n\nfunction sorter(a, b){\n\treturn a < b ? 1 : -1;\n}\n\nfunction getReplacer(map){\n\treturn function replace(str){\n\t\tif(str.charAt(1) === \"#\"){\n\t\t\tif(str.charAt(2) === \"X\" || str.charAt(2) === \"x\"){\n\t\t\t\treturn decodeCodePoint(parseInt(str.substr(3), 16));\n\t\t\t}\n\t\t\treturn decodeCodePoint(parseInt(str.substr(2), 10));\n\t\t}\n\t\treturn map[str.slice(1, -1)];\n\t};\n}\n\nmodule.exports = {\n\tXML: decodeXMLStrict,\n\tHTML: decodeHTML,\n\tHTMLStrict: decodeHTMLStrict\n};\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar decodeMap = __webpack_require__(66);\n\nmodule.exports = decodeCodePoint;\n\n// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119\nfunction decodeCodePoint(codePoint){\n\n\tif((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF){\n\t\treturn \"\\uFFFD\";\n\t}\n\n\tif(codePoint in decodeMap){\n\t\tcodePoint = decodeMap[codePoint];\n\t}\n\n\tvar output = \"\";\n\n\tif(codePoint > 0xFFFF){\n\t\tcodePoint -= 0x10000;\n\t\toutput += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);\n\t\tcodePoint = 0xDC00 | codePoint & 0x3FF;\n\t}\n\n\toutput += String.fromCharCode(codePoint);\n\treturn output;\n}\n\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar inverseXML = getInverseObj(__webpack_require__(32)),\n xmlReplacer = getInverseReplacer(inverseXML);\n\nexports.XML = getInverse(inverseXML, xmlReplacer);\n\nvar inverseHTML = getInverseObj(__webpack_require__(31)),\n htmlReplacer = getInverseReplacer(inverseHTML);\n\nexports.HTML = getInverse(inverseHTML, htmlReplacer);\n\nfunction getInverseObj(obj){\n\treturn Object.keys(obj).sort().reduce(function(inverse, name){\n\t\tinverse[obj[name]] = \"&\" + name + \";\";\n\t\treturn inverse;\n\t}, {});\n}\n\nfunction getInverseReplacer(inverse){\n\tvar single = [],\n\t multiple = [];\n\n\tObject.keys(inverse).forEach(function(k){\n\t\tif(k.length === 1){\n\t\t\tsingle.push(\"\\\\\" + k);\n\t\t} else {\n\t\t\tmultiple.push(k);\n\t\t}\n\t});\n\n\t//TODO add ranges\n\tmultiple.unshift(\"[\" + single.join(\"\") + \"]\");\n\n\treturn new RegExp(multiple.join(\"|\"), \"g\");\n}\n\nvar re_nonASCII = /[^\\0-\\x7F]/g,\n re_astralSymbols = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n\nfunction singleCharReplacer(c){\n\treturn \"&#x\" + c.charCodeAt(0).toString(16).toUpperCase() + \";\";\n}\n\nfunction astralReplacer(c){\n\t// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n\tvar high = c.charCodeAt(0);\n\tvar low = c.charCodeAt(1);\n\tvar codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;\n\treturn \"&#x\" + codePoint.toString(16).toUpperCase() + \";\";\n}\n\nfunction getInverse(inverse, re){\n\tfunction func(name){\n\t\treturn inverse[name];\n\t}\n\n\treturn function(data){\n\t\treturn data\n\t\t\t\t.replace(re, func)\n\t\t\t\t.replace(re_astralSymbols, astralReplacer)\n\t\t\t\t.replace(re_nonASCII, singleCharReplacer);\n\t};\n}\n\nvar re_xmlChars = getInverseReplacer(inverseXML);\n\nfunction escapeXML(data){\n\treturn data\n\t\t\t.replace(re_xmlChars, singleCharReplacer)\n\t\t\t.replace(re_astralSymbols, astralReplacer)\n\t\t\t.replace(re_nonASCII, singleCharReplacer);\n}\n\nexports.escape = escapeXML;\n\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports) {\n\nmodule.exports = {\n\t\"0\": 65533,\n\t\"128\": 8364,\n\t\"130\": 8218,\n\t\"131\": 402,\n\t\"132\": 8222,\n\t\"133\": 8230,\n\t\"134\": 8224,\n\t\"135\": 8225,\n\t\"136\": 710,\n\t\"137\": 8240,\n\t\"138\": 352,\n\t\"139\": 8249,\n\t\"140\": 338,\n\t\"142\": 381,\n\t\"145\": 8216,\n\t\"146\": 8217,\n\t\"147\": 8220,\n\t\"148\": 8221,\n\t\"149\": 8226,\n\t\"150\": 8211,\n\t\"151\": 8212,\n\t\"152\": 732,\n\t\"153\": 8482,\n\t\"154\": 353,\n\t\"155\": 8250,\n\t\"156\": 339,\n\t\"158\": 382,\n\t\"159\": 376\n};\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports) {\n\nmodule.exports = {\n\t\"Aacute\": \"Á\",\n\t\"aacute\": \"á\",\n\t\"Acirc\": \"Â\",\n\t\"acirc\": \"â\",\n\t\"acute\": \"´\",\n\t\"AElig\": \"Æ\",\n\t\"aelig\": \"æ\",\n\t\"Agrave\": \"À\",\n\t\"agrave\": \"à\",\n\t\"amp\": \"&\",\n\t\"AMP\": \"&\",\n\t\"Aring\": \"Å\",\n\t\"aring\": \"å\",\n\t\"Atilde\": \"Ã\",\n\t\"atilde\": \"ã\",\n\t\"Auml\": \"Ä\",\n\t\"auml\": \"ä\",\n\t\"brvbar\": \"¦\",\n\t\"Ccedil\": \"Ç\",\n\t\"ccedil\": \"ç\",\n\t\"cedil\": \"¸\",\n\t\"cent\": \"¢\",\n\t\"copy\": \"©\",\n\t\"COPY\": \"©\",\n\t\"curren\": \"¤\",\n\t\"deg\": \"°\",\n\t\"divide\": \"÷\",\n\t\"Eacute\": \"É\",\n\t\"eacute\": \"é\",\n\t\"Ecirc\": \"Ê\",\n\t\"ecirc\": \"ê\",\n\t\"Egrave\": \"È\",\n\t\"egrave\": \"è\",\n\t\"ETH\": \"Ð\",\n\t\"eth\": \"ð\",\n\t\"Euml\": \"Ë\",\n\t\"euml\": \"ë\",\n\t\"frac12\": \"½\",\n\t\"frac14\": \"¼\",\n\t\"frac34\": \"¾\",\n\t\"gt\": \">\",\n\t\"GT\": \">\",\n\t\"Iacute\": \"Í\",\n\t\"iacute\": \"í\",\n\t\"Icirc\": \"Î\",\n\t\"icirc\": \"î\",\n\t\"iexcl\": \"¡\",\n\t\"Igrave\": \"Ì\",\n\t\"igrave\": \"ì\",\n\t\"iquest\": \"¿\",\n\t\"Iuml\": \"Ï\",\n\t\"iuml\": \"ï\",\n\t\"laquo\": \"«\",\n\t\"lt\": \"<\",\n\t\"LT\": \"<\",\n\t\"macr\": \"¯\",\n\t\"micro\": \"µ\",\n\t\"middot\": \"·\",\n\t\"nbsp\": \" \",\n\t\"not\": \"¬\",\n\t\"Ntilde\": \"Ñ\",\n\t\"ntilde\": \"ñ\",\n\t\"Oacute\": \"Ó\",\n\t\"oacute\": \"ó\",\n\t\"Ocirc\": \"Ô\",\n\t\"ocirc\": \"ô\",\n\t\"Ograve\": \"Ò\",\n\t\"ograve\": \"ò\",\n\t\"ordf\": \"ª\",\n\t\"ordm\": \"º\",\n\t\"Oslash\": \"Ø\",\n\t\"oslash\": \"ø\",\n\t\"Otilde\": \"Õ\",\n\t\"otilde\": \"õ\",\n\t\"Ouml\": \"Ö\",\n\t\"ouml\": \"ö\",\n\t\"para\": \"¶\",\n\t\"plusmn\": \"±\",\n\t\"pound\": \"£\",\n\t\"quot\": \"\\\"\",\n\t\"QUOT\": \"\\\"\",\n\t\"raquo\": \"»\",\n\t\"reg\": \"®\",\n\t\"REG\": \"®\",\n\t\"sect\": \"§\",\n\t\"shy\": \"\",\n\t\"sup1\": \"¹\",\n\t\"sup2\": \"²\",\n\t\"sup3\": \"³\",\n\t\"szlig\": \"ß\",\n\t\"THORN\": \"Þ\",\n\t\"thorn\": \"þ\",\n\t\"times\": \"×\",\n\t\"Uacute\": \"Ú\",\n\t\"uacute\": \"ú\",\n\t\"Ucirc\": \"Û\",\n\t\"ucirc\": \"û\",\n\t\"Ugrave\": \"Ù\",\n\t\"ugrave\": \"ù\",\n\t\"uml\": \"¨\",\n\t\"Uuml\": \"Ü\",\n\t\"uuml\": \"ü\",\n\t\"Yacute\": \"Ý\",\n\t\"yacute\": \"ý\",\n\t\"yen\": \"¥\",\n\t\"yuml\": \"ÿ\"\n};\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar parse = __webpack_require__(46).parse;\nvar isArray = __webpack_require__(69);\nvar objectKeys = __webpack_require__(75);\nvar forEach = __webpack_require__(70);\n\nmodule.exports = function (src, opts, fn) {\n if (typeof opts === 'function') {\n fn = opts;\n opts = {};\n }\n if (src && typeof src === 'object' && src.constructor.name === 'Buffer') {\n src = src.toString();\n }\n else if (src && typeof src === 'object') {\n opts = src;\n src = opts.source;\n delete opts.source;\n }\n src = src === undefined ? opts.source : src;\n if (typeof src !== 'string') src = String(src);\n if (opts.parser) parse = opts.parser.parse;\n var ast = parse(src, opts);\n \n var result = {\n chunks : src.split(''),\n toString : function () { return result.chunks.join('') },\n inspect : function () { return result.toString() }\n };\n var index = 0;\n \n (function walk (node, parent) {\n insertHelpers(node, parent, result.chunks);\n \n forEach(objectKeys(node), function (key) {\n if (key === 'parent') return;\n \n var child = node[key];\n if (isArray(child)) {\n forEach(child, function (c) {\n if (c && typeof c.type === 'string') {\n walk(c, node);\n }\n });\n }\n else if (child && typeof child.type === 'string') {\n walk(child, node);\n }\n });\n fn(node);\n })(ast, undefined);\n \n return result;\n};\n \nfunction insertHelpers (node, parent, chunks) {\n node.parent = parent;\n \n node.source = function () {\n return chunks.slice(node.start, node.end).join('');\n };\n \n if (node.update && typeof node.update === 'object') {\n var prev = node.update;\n forEach(objectKeys(prev), function (key) {\n update[key] = prev[key];\n });\n node.update = update;\n }\n else {\n node.update = update;\n }\n \n function update (s) {\n chunks[node.start] = s;\n for (var i = node.start + 1; i < node.end; i++) {\n chunks[i] = '';\n }\n }\n}\n\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports) {\n\nmodule.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports) {\n\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports) {\n\n/*\r\n * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license\r\n * Author: Jim Palmer (based on chunking idea from Dave Koelle)\r\n */\r\n/*jshint unused:false */\r\nmodule.exports = function naturalSort (a, b) {\r\n\t\"use strict\";\r\n\tvar re = /(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,\r\n\t\tsre = /(^[ ]*|[ ]*$)/g,\r\n\t\tdre = /(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,\r\n\t\thre = /^0x[0-9a-f]+$/i,\r\n\t\tore = /^0/,\r\n\t\ti = function(s) { return naturalSort.insensitive && ('' + s).toLowerCase() || '' + s; },\r\n\t\t// convert all to strings strip whitespace\r\n\t\tx = i(a).replace(sre, '') || '',\r\n\t\ty = i(b).replace(sre, '') || '',\r\n\t\t// chunk/tokenize\r\n\t\txN = x.replace(re, '\\0$1\\0').replace(/\\0$/,'').replace(/^\\0/,'').split('\\0'),\r\n\t\tyN = y.replace(re, '\\0$1\\0').replace(/\\0$/,'').replace(/^\\0/,'').split('\\0'),\r\n\t\t// numeric, hex or date detection\r\n\t\txD = parseInt(x.match(hre), 16) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),\r\n\t\tyD = parseInt(y.match(hre), 16) || xD && y.match(dre) && Date.parse(y) || null,\r\n\t\toFxNcL, oFyNcL;\r\n\t// first try and sort Hex codes or Dates\r\n\tif (yD) {\r\n\t\tif ( xD < yD ) { return -1; }\r\n\t\telse if ( xD > yD ) { return 1; }\r\n\t}\r\n\t// natural sorting through split numeric strings and default strings\r\n\tfor(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {\r\n\t\t// find floats not starting with '0', string or 0 if not defined (Clint Priest)\r\n\t\toFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;\r\n\t\toFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;\r\n\t\t// handle numeric vs string comparison - number < string - (Kyle Adams)\r\n\t\tif (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }\r\n\t\t// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'\r\n\t\telse if (typeof oFxNcL !== typeof oFyNcL) {\r\n\t\t\toFxNcL += '';\r\n\t\t\toFyNcL += '';\r\n\t\t}\r\n\t\tif (oFxNcL < oFyNcL) { return -1; }\r\n\t\tif (oFxNcL > oFyNcL) { return 1; }\r\n\t}\r\n\treturn 0;\r\n};\r\n\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n\n\n/* eslint-disable no-bitwise */\n\nvar decodeCache = {};\n\nfunction getDecodeCache(exclude) {\n var i, ch, cache = decodeCache[exclude];\n if (cache) { return cache; }\n\n cache = decodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n cache.push(ch);\n }\n\n for (i = 0; i < exclude.length; i++) {\n ch = exclude.charCodeAt(i);\n cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);\n }\n\n return cache;\n}\n\n\n// Decode percent-encoded string.\n//\nfunction decode(string, exclude) {\n var cache;\n\n if (typeof exclude !== 'string') {\n exclude = decode.defaultChars;\n }\n\n cache = getDecodeCache(exclude);\n\n return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {\n var i, l, b1, b2, b3, b4, chr,\n result = '';\n\n for (i = 0, l = seq.length; i < l; i += 3) {\n b1 = parseInt(seq.slice(i + 1, i + 3), 16);\n\n if (b1 < 0x80) {\n result += cache[b1];\n continue;\n }\n\n if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {\n // 110xxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n\n if ((b2 & 0xC0) === 0x80) {\n chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);\n\n if (chr < 0x80) {\n result += '\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 3;\n continue;\n }\n }\n\n if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);\n\n if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {\n result += '\\ufffd\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 6;\n continue;\n }\n }\n\n if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {\n // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n b4 = parseInt(seq.slice(i + 10, i + 12), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {\n chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);\n\n if (chr < 0x10000 || chr > 0x10FFFF) {\n result += '\\ufffd\\ufffd\\ufffd\\ufffd';\n } else {\n chr -= 0x10000;\n result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));\n }\n\n i += 9;\n continue;\n }\n }\n\n result += '\\ufffd';\n }\n\n return result;\n });\n}\n\n\ndecode.defaultChars = ';/?:@&=+$,#';\ndecode.componentChars = '';\n\n\nmodule.exports = decode;\n\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n\n\nvar encodeCache = {};\n\n\n// Create a lookup array where anything but characters in `chars` string\n// and alphanumeric chars is percent-encoded.\n//\nfunction getEncodeCache(exclude) {\n var i, ch, cache = encodeCache[exclude];\n if (cache) { return cache; }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n}\n\n\n// Encode unsafe characters with percent-encoding, skipping already\n// encoded sequences.\n//\n// - string - string to encode\n// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)\n// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)\n//\nfunction encode(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}\n\nencode.defaultChars = \";/?:@&=+$,-_.!~*'()#\";\nencode.componentChars = \"-_.!~*'()\";\n\n\nmodule.exports = encode;\n\n\n/***/ }),\n/* 74 */\n/***/ (function(module, exports) {\n\n\n\n/***/ }),\n/* 75 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// modified from https://github.com/es-shims/es5-shim\nvar has = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar slice = Array.prototype.slice;\nvar isArgs = __webpack_require__(76);\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\nvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\nvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\nvar dontEnums = [\n\t'toString',\n\t'toLocaleString',\n\t'valueOf',\n\t'hasOwnProperty',\n\t'isPrototypeOf',\n\t'propertyIsEnumerable',\n\t'constructor'\n];\nvar equalsConstructorPrototype = function (o) {\n\tvar ctor = o.constructor;\n\treturn ctor && ctor.prototype === o;\n};\nvar excludedKeys = {\n\t$console: true,\n\t$external: true,\n\t$frame: true,\n\t$frameElement: true,\n\t$frames: true,\n\t$innerHeight: true,\n\t$innerWidth: true,\n\t$outerHeight: true,\n\t$outerWidth: true,\n\t$pageXOffset: true,\n\t$pageYOffset: true,\n\t$parent: true,\n\t$scrollLeft: true,\n\t$scrollTop: true,\n\t$scrollX: true,\n\t$scrollY: true,\n\t$self: true,\n\t$webkitIndexedDB: true,\n\t$webkitStorageInfo: true,\n\t$window: true\n};\nvar hasAutomationEqualityBug = (function () {\n\t/* global window */\n\tif (typeof window === 'undefined') { return false; }\n\tfor (var k in window) {\n\t\ttry {\n\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\ttry {\n\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}());\nvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t/* global window */\n\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\treturn equalsConstructorPrototype(o);\n\t}\n\ttry {\n\t\treturn equalsConstructorPrototype(o);\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\nvar keysShim = function keys(object) {\n\tvar isObject = object !== null && typeof object === 'object';\n\tvar isFunction = toStr.call(object) === '[object Function]';\n\tvar isArguments = isArgs(object);\n\tvar isString = isObject && toStr.call(object) === '[object String]';\n\tvar theKeys = [];\n\n\tif (!isObject && !isFunction && !isArguments) {\n\t\tthrow new TypeError('Object.keys called on a non-object');\n\t}\n\n\tvar skipProto = hasProtoEnumBug && isFunction;\n\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\ttheKeys.push(String(i));\n\t\t}\n\t}\n\n\tif (isArguments && object.length > 0) {\n\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\ttheKeys.push(String(j));\n\t\t}\n\t} else {\n\t\tfor (var name in object) {\n\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\ttheKeys.push(String(name));\n\t\t\t}\n\t\t}\n\t}\n\n\tif (hasDontEnumBug) {\n\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t}\n\t\t}\n\t}\n\treturn theKeys;\n};\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\treturn (Object.keys(arguments) || '').length === 2;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tvar originalKeys = Object.keys;\n\t\t\tObject.keys = function keys(object) {\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t} else {\n\t\t\t\t\treturn originalKeys(object);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n\n\n/***/ }),\n/* 76 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n\n\n/***/ }),\n/* 77 */\n/***/ (function(module, exports) {\n\n/*! http://mths.be/repeat v0.2.0 by @mathias */\nif (!String.prototype.repeat) {\n\t(function() {\n\t\t'use strict'; // needed to support `apply`/`call` with `undefined`/`null`\n\t\tvar defineProperty = (function() {\n\t\t\t// IE 8 only supports `Object.defineProperty` on DOM elements\n\t\t\ttry {\n\t\t\t\tvar object = {};\n\t\t\t\tvar $defineProperty = Object.defineProperty;\n\t\t\t\tvar result = $defineProperty(object, object, object) && $defineProperty;\n\t\t\t} catch(error) {}\n\t\t\treturn result;\n\t\t}());\n\t\tvar repeat = function(count) {\n\t\t\tif (this == null) {\n\t\t\t\tthrow TypeError();\n\t\t\t}\n\t\t\tvar string = String(this);\n\t\t\t// `ToInteger`\n\t\t\tvar n = count ? Number(count) : 0;\n\t\t\tif (n != n) { // better `isNaN`\n\t\t\t\tn = 0;\n\t\t\t}\n\t\t\t// Account for out-of-bounds indices\n\t\t\tif (n < 0 || n == Infinity) {\n\t\t\t\tthrow RangeError();\n\t\t\t}\n\t\t\tvar result = '';\n\t\t\twhile (n) {\n\t\t\t\tif (n % 2 == 1) {\n\t\t\t\t\tresult += string;\n\t\t\t\t}\n\t\t\t\tif (n > 1) {\n\t\t\t\t\tstring += string;\n\t\t\t\t}\n\t\t\t\tn >>= 1;\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tif (defineProperty) {\n\t\t\tdefineProperty(String.prototype, 'repeat', {\n\t\t\t\t'value': repeat,\n\t\t\t\t'configurable': true,\n\t\t\t\t'writable': true\n\t\t\t});\n\t\t} else {\n\t\t\tString.prototype.repeat = repeat;\n\t\t}\n\t}());\n}\n\n\n/***/ }),\n/* 78 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar rng = __webpack_require__(36);\nvar bytesToUuid = __webpack_require__(35);\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\n// random #'s we need to init node and clockseq\nvar _seedBytes = rng();\n\n// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\nvar _nodeId = [\n _seedBytes[0] | 0x01,\n _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]\n];\n\n// Per 4.2.2, randomize (14 bit) clockseq\nvar _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;\n\n// Previous uuid creation time\nvar _lastMSecs = 0, _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n var node = options.node || _nodeId;\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar rng = __webpack_require__(36);\nvar bytesToUuid = __webpack_require__(35);\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options == 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nexports.Watcher = watcher_1.Watcher;\nexports.Program = watcher_1.Program;\nexports.appendAsEAVs = watcher_1.appendAsEAVs;\nexports.createId = watcher_1.createId;\nvar parser_1 = __webpack_require__(19);\nexports.parseDoc = parser_1.parseDoc;\nexports.watcherPath = \"./build/src/watchers\";\nvar watchers = __webpack_require__(87);\nexports.watchers = watchers;\n//# sourceMappingURL=index.js.map\n\n/***/ }),\n/* 81 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction now() {\n if (window.performance) {\n return window.performance.now();\n }\n return (new Date()).getTime();\n}\nfunction shallowEquals(a, b) {\n if (a === b)\n return true;\n if (!a || !b)\n return false;\n for (var k in a) {\n if (a[k] !== b[k])\n return false;\n }\n for (var k in b) {\n if (b[k] !== a[k])\n return false;\n }\n return true;\n}\nfunction postAnimationRemove(elements) {\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var elem = elements_1[_i];\n if (elem.parentNode)\n elem.parentNode.removeChild(elem);\n }\n}\nvar Renderer = (function () {\n function Renderer() {\n this.content = document.createElement(\"div\");\n this.content.className = \"__root\";\n this.elementCache = { \"__root\": this.content };\n this.prevTree = {};\n this.tree = {};\n this.postRenders = [];\n this.lastDiff = { adds: [], updates: {} };\n var self = this;\n this.handleEvent = function handleEvent(e) {\n var id = (e.currentTarget || e.target)[\"_id\"];\n var elem = self.tree[id];\n if (!elem)\n return;\n var handler = elem[e.type];\n if (handler) {\n handler(e, elem);\n }\n };\n }\n Renderer.compile = function (elem) {\n if (!elem.id)\n throw new Error(\"Cannot compile element with id \" + elem.id);\n var renderer = Renderer._compileRenderer[elem.id];\n if (!renderer)\n renderer = Renderer._compileRenderer[elem.id] = new Renderer();\n renderer.render([elem]);\n return renderer.elementCache[elem.id];\n };\n Renderer.prototype.reset = function () {\n this.prevTree = this.tree;\n this.tree = {};\n this.postRenders = [];\n };\n Renderer.prototype.domify = function () {\n var fakePrev = {}; //create an empty object once instead of every instance of the loop\n var elements = this.tree;\n var prevElements = this.prevTree;\n var diff = this.lastDiff;\n var adds = diff.adds;\n var updates = diff.updates;\n var elemKeys = Object.keys(updates);\n var elementCache = this.elementCache;\n var tempTween = {};\n //Create all the new elements to ensure that they're there when they need to be\n //parented\n for (var i = 0, len = adds.length; i < len; i++) {\n var id = adds[i];\n var cur = elements[id];\n var div;\n if (cur.svg) {\n div = document.createElementNS(\"http://www.w3.org/2000/svg\", cur.t || \"rect\");\n }\n else {\n div = document.createElement(cur.t || \"div\");\n }\n div._id = id;\n elementCache[id] = div;\n if (cur.enter) {\n if (cur.enter.delay) {\n cur.enter.display = \"auto\";\n div.style.display = \"none\";\n }\n Velocity(div, cur.enter, cur.enter);\n }\n }\n for (var i = 0, len = elemKeys.length; i < len; i++) {\n var id = elemKeys[i];\n var cur = elements[id];\n var prev = prevElements[id] || fakePrev;\n var type = updates[id];\n var div;\n if (type === \"replaced\") {\n var me = elementCache[id];\n if (me.parentNode)\n me.parentNode.removeChild(me);\n if (cur.svg) {\n div = document.createElementNS(\"http://www.w3.org/2000/svg\", cur.t || \"rect\");\n }\n else {\n div = document.createElement(cur.t || \"div\");\n }\n prev = fakePrev;\n div._id = id;\n elementCache[id] = div;\n }\n else if (type === \"removed\") {\n //NOTE: Batching the removes such that you only remove the parent\n //didn't actually make this faster surprisingly. Given that this\n //strategy is much simpler and there's no noticable perf difference\n //we'll just do the dumb thing and remove all the children one by one.\n var me = elementCache[id];\n if (prev.leave) {\n prev.leave.complete = postAnimationRemove;\n if (prev.leave.absolute) {\n me.style.position = \"absolute\";\n }\n Velocity(me, prev.leave, prev.leave);\n }\n else if (me.parentNode)\n me.parentNode.removeChild(me);\n elementCache[id] = undefined;\n continue;\n }\n else {\n div = elementCache[id];\n }\n var style = div.style;\n if (cur.c !== prev.c)\n div.className = cur.c;\n if (cur.draggable !== prev.draggable)\n div.draggable = cur.draggable === undefined ? null : \"true\";\n if (cur.spellcheck !== prev.spellcheck)\n div.setAttribute(\"spellcheck\", cur.spellcheck);\n if (cur.contentEditable !== prev.contentEditable)\n div.contentEditable = cur.contentEditable !== undefined ? JSON.stringify(cur.contentEditable) : \"inherit\";\n if (cur.colspan !== prev.colspan)\n div.colSpan = cur.colspan;\n if (cur.placeholder !== prev.placeholder)\n div.setAttribute(\"placeholder\", cur.placeholder);\n if (cur.selected !== prev.selected)\n div.selected = cur.selected;\n if ((cur.value !== prev.value || cur.strictText) && div.value !== cur.value)\n div.value = cur.value;\n if (cur.t === \"input\" && cur.type !== prev.type)\n div.type = cur.type;\n if (cur.t === \"input\" && cur.checked !== prev.checked)\n div.checked = cur.checked;\n if ((cur.text !== prev.text || cur.strictText) && div.textContent !== cur.text)\n div.textContent = cur.text === undefined ? \"\" : cur.text;\n if (cur.tabindex !== prev.tabindex)\n div.setAttribute(\"tabindex\", cur.tabindex);\n if (cur.href !== prev.href)\n div.setAttribute(\"href\", cur.href);\n if (cur.src !== prev.src)\n div.setAttribute(\"src\", cur.src);\n if (cur.target !== prev.target)\n div.setAttribute(\"target\", cur.target);\n if (cur.data !== prev.data)\n div.setAttribute(\"data\", cur.data);\n if (cur.download !== prev.download)\n div.setAttribute(\"download\", cur.download);\n if (cur.allowfullscreen !== prev.allowfullscreen)\n div.setAttribute(\"allowfullscreen\", cur.allowfullscreen);\n // animateable properties\n var tween = cur.tween || tempTween;\n if (cur.flex !== prev.flex) {\n if (tween.flex)\n tempTween.flex = cur.flex;\n else\n style.flex = cur.flex === undefined ? \"\" : cur.flex;\n }\n if (cur.left !== prev.left) {\n if (tween.left)\n tempTween.left = cur.left;\n else\n style.left = cur.left === undefined ? \"\" : cur.left;\n }\n if (cur.top !== prev.top) {\n if (tween.top)\n tempTween.top = cur.top;\n else\n style.top = cur.top === undefined ? \"\" : cur.top;\n }\n if (cur.height !== prev.height) {\n if (tween.height)\n tempTween.height = cur.height;\n else\n style.height = cur.height === undefined ? \"auto\" : cur.height;\n }\n if (cur.width !== prev.width) {\n if (tween.width)\n tempTween.width = cur.width;\n else\n style.width = cur.width === undefined ? \"auto\" : cur.width;\n }\n if (cur.zIndex !== prev.zIndex) {\n if (tween.zIndex)\n tempTween.zIndex = cur.zIndex;\n else\n style.zIndex = cur.zIndex;\n }\n if (cur.backgroundColor !== prev.backgroundColor) {\n if (tween.backgroundColor)\n tempTween.backgroundColor = cur.backgroundColor;\n else\n style.backgroundColor = cur.backgroundColor || \"transparent\";\n }\n if (cur.borderColor !== prev.borderColor) {\n if (tween.borderColor)\n tempTween.borderColor = cur.borderColor;\n else\n style.borderColor = cur.borderColor || \"none\";\n }\n if (cur.borderWidth !== prev.borderWidth) {\n if (tween.borderWidth)\n tempTween.borderWidth = cur.borderWidth;\n else\n style.borderWidth = cur.borderWidth || 0;\n }\n if (cur.borderRadius !== prev.borderRadius) {\n if (tween.borderRadius)\n tempTween.borderRadius = cur.borderRadius;\n else\n style.borderRadius = (cur.borderRadius || 0) + \"px\";\n }\n if (cur.opacity !== prev.opacity) {\n if (tween.opacity)\n tempTween.opacity = cur.opacity;\n else\n style.opacity = cur.opacity === undefined ? 1 : cur.opacity;\n }\n if (cur.fontSize !== prev.fontSize) {\n if (tween.fontSize)\n tempTween.fontSize = cur.fontSize;\n else\n style.fontSize = cur.fontSize;\n }\n if (cur.color !== prev.color) {\n if (tween.color)\n tempTween.color = cur.color;\n else\n style.color = cur.color || \"inherit\";\n }\n var animKeys = Object.keys(tempTween);\n if (animKeys.length) {\n Velocity(div, tempTween, tween);\n tempTween = {};\n }\n // non-animation style properties\n if (cur.backgroundImage !== prev.backgroundImage)\n style.backgroundImage = \"url('\" + cur.backgroundImage + \"')\";\n if (cur.border !== prev.border)\n style.border = cur.border || \"none\";\n if (cur.textAlign !== prev.textAlign) {\n style.alignItems = cur.textAlign;\n if (cur.textAlign === \"center\") {\n style.textAlign = \"center\";\n }\n else if (cur.textAlign === \"flex-end\") {\n style.textAlign = \"right\";\n }\n else {\n style.textAlign = \"left\";\n }\n }\n if (cur.verticalAlign !== prev.verticalAlign)\n style.justifyContent = cur.verticalAlign;\n if (cur.fontFamily !== prev.fontFamily)\n style.fontFamily = cur.fontFamily || \"inherit\";\n if (cur.transform !== prev.transform)\n style.transform = cur.transform || \"none\";\n if (cur.style !== prev.style)\n div.setAttribute(\"style\", cur.style);\n if (cur.dangerouslySetInnerHTML !== prev.dangerouslySetInnerHTML)\n div.innerHTML = cur.dangerouslySetInnerHTML;\n // debug/programmatic properties\n if (cur.semantic !== prev.semantic)\n div.setAttribute(\"data-semantic\", cur.semantic);\n if (cur.debug !== prev.debug)\n div.setAttribute(\"data-debug\", cur.debug);\n // SVG properties\n if (cur.svg) {\n if (cur.fill !== prev.fill)\n div.setAttributeNS(null, \"fill\", cur.fill);\n if (cur.stroke !== prev.stroke)\n div.setAttributeNS(null, \"stroke\", cur.stroke);\n if (cur.strokeWidth !== prev.strokeWidth)\n div.setAttributeNS(null, \"stroke-width\", cur.strokeWidth);\n if (cur.d !== prev.d)\n div.setAttributeNS(null, \"d\", cur.d);\n if (cur.c !== prev.c)\n div.setAttributeNS(null, \"class\", cur.c);\n if (cur.x !== prev.x)\n div.setAttributeNS(null, \"x\", cur.x);\n if (cur.y !== prev.y)\n div.setAttributeNS(null, \"y\", cur.y);\n if (cur.dx !== prev.dx)\n div.setAttributeNS(null, \"dx\", cur.dx);\n if (cur.dy !== prev.dy)\n div.setAttributeNS(null, \"dy\", cur.dy);\n if (cur.cx !== prev.cx)\n div.setAttributeNS(null, \"cx\", cur.cx);\n if (cur.cy !== prev.cy)\n div.setAttributeNS(null, \"cy\", cur.cy);\n if (cur.r !== prev.r)\n div.setAttributeNS(null, \"r\", cur.r);\n if (cur.height !== prev.height)\n div.setAttributeNS(null, \"height\", cur.height);\n if (cur.width !== prev.width)\n div.setAttributeNS(null, \"width\", cur.width);\n if (cur.xlinkhref !== prev.xlinkhref)\n div.setAttributeNS('http://www.w3.org/1999/xlink', \"href\", cur.xlinkhref);\n if (cur.startOffset !== prev.startOffset)\n div.setAttributeNS(null, \"startOffset\", cur.startOffset);\n if (cur.id !== prev.id)\n div.setAttributeNS(null, \"id\", cur.id);\n if (cur.viewBox !== prev.viewBox)\n div.setAttributeNS(null, \"viewBox\", cur.viewBox);\n if (cur.transform !== prev.transform)\n div.setAttributeNS(null, \"transform\", cur.transform);\n if (cur.draggable !== prev.draggable)\n div.setAttributeNS(null, \"draggable\", cur.draggable);\n if (cur.textAnchor !== prev.textAnchor)\n div.setAttributeNS(null, \"text-anchor\", cur.textAnchor);\n }\n //events\n if (cur.dblclick !== prev.dblclick)\n div.ondblclick = cur.dblclick !== undefined ? this.handleEvent : undefined;\n if (cur.click !== prev.click)\n div.onclick = cur.click !== undefined ? this.handleEvent : undefined;\n if (cur.contextmenu !== prev.contextmenu)\n div.oncontextmenu = cur.contextmenu !== undefined ? this.handleEvent : undefined;\n if (cur.mousedown !== prev.mousedown)\n div.onmousedown = cur.mousedown !== undefined ? this.handleEvent : undefined;\n if (cur.mousemove !== prev.mousemove)\n div.onmousemove = cur.mousemove !== undefined ? this.handleEvent : undefined;\n if (cur.mouseup !== prev.mouseup)\n div.onmouseup = cur.mouseup !== undefined ? this.handleEvent : undefined;\n if (cur.mouseover !== prev.mouseover)\n div.onmouseover = cur.mouseover !== undefined ? this.handleEvent : undefined;\n if (cur.mouseout !== prev.mouseout)\n div.onmouseout = cur.mouseout !== undefined ? this.handleEvent : undefined;\n if (cur.mouseleave !== prev.mouseleave)\n div.onmouseleave = cur.mouseleave !== undefined ? this.handleEvent : undefined;\n if (cur.mousewheel !== prev.mousewheel)\n div.onmouseheel = cur.mousewheel !== undefined ? this.handleEvent : undefined;\n if (cur.dragover !== prev.dragover)\n div.ondragover = cur.dragover !== undefined ? this.handleEvent : undefined;\n if (cur.dragstart !== prev.dragstart)\n div.ondragstart = cur.dragstart !== undefined ? this.handleEvent : undefined;\n if (cur.dragend !== prev.dragend)\n div.ondragend = cur.dragend !== undefined ? this.handleEvent : undefined;\n if (cur.drag !== prev.drag)\n div.ondrag = cur.drag !== undefined ? this.handleEvent : undefined;\n if (cur.drop !== prev.drop)\n div.ondrop = cur.drop !== undefined ? this.handleEvent : undefined;\n if (cur.scroll !== prev.scroll)\n div.onscroll = cur.scroll !== undefined ? this.handleEvent : undefined;\n if (cur.focus !== prev.focus)\n div.onfocus = cur.focus !== undefined ? this.handleEvent : undefined;\n if (cur.blur !== prev.blur)\n div.onblur = cur.blur !== undefined ? this.handleEvent : undefined;\n if (cur.input !== prev.input)\n div.oninput = cur.input !== undefined ? this.handleEvent : undefined;\n if (cur.change !== prev.change)\n div.onchange = cur.change !== undefined ? this.handleEvent : undefined;\n if (cur.keyup !== prev.keyup)\n div.onkeyup = cur.keyup !== undefined ? this.handleEvent : undefined;\n if (cur.keydown !== prev.keydown)\n div.onkeydown = cur.keydown !== undefined ? this.handleEvent : undefined;\n if (cur.cut !== prev.cut)\n div.oncut = cur.cut !== undefined ? this.handleEvent : undefined;\n if (cur.copy !== prev.copy)\n div.oncopy = cur.copy !== undefined ? this.handleEvent : undefined;\n if (cur.paste !== prev.paste)\n div.onpaste = cur.paste !== undefined ? this.handleEvent : undefined;\n if (type === \"added\" || type === \"replaced\" || type === \"moved\") {\n var parentEl = elementCache[cur.parent];\n if (parentEl) {\n if (cur.ix >= parentEl.children.length) {\n parentEl.appendChild(div);\n }\n else {\n parentEl.insertBefore(div, parentEl.children[cur.ix]);\n }\n }\n }\n }\n };\n Renderer.prototype.diff = function () {\n var a = this.prevTree;\n var b = this.tree;\n var as = Object.keys(a);\n var bs = Object.keys(b);\n var updated = {};\n var adds = [];\n for (var i = 0, len = as.length; i < len; i++) {\n var id = as[i];\n var curA = a[id];\n var curB = b[id];\n if (curB === undefined) {\n updated[id] = \"removed\";\n continue;\n }\n if (curA.t !== curB.t) {\n updated[id] = \"replaced\";\n continue;\n }\n if (curA.ix !== curB.ix || curA.parent !== curB.parent) {\n updated[id] = \"moved\";\n continue;\n }\n if (!curB.dirty\n && curA.c === curB.c\n && curA.key === curB.key\n && curA.dangerouslySetInnerHTML === curB.dangerouslySetInnerHTML\n && curA.tabindex === curB.tabindex\n && curA.href === curB.href\n && curA.src === curB.src\n && curA.data === curB.data\n && curA.download === curB.download\n && curA.allowfullscreen === curB.allowfullscreen\n && curA.placeholder === curB.placeholder\n && curA.selected === curB.selected\n && curA.draggable === curB.draggable\n && curA.spellcheck === curB.spellcheck\n && curA.contentEditable === curB.contentEditable\n && curA.value === curB.value\n && curA.target === curB.target\n && curA.type === curB.type\n && curA.checked === curB.checked\n && curA.text === curB.text\n && curA.top === curB.top\n && curA.flex === curB.flex\n && curA.left === curB.left\n && curA.width === curB.width\n && curA.height === curB.height\n && curA.zIndex === curB.zIndex\n && curA.backgroundColor === curB.backgroundColor\n && curA.backgroundImage === curB.backgroundImage\n && curA.color === curB.color\n && curA.colspan === curB.colspan\n && curA.border === curB.border\n && curA.borderColor === curB.borderColor\n && curA.borderWidth === curB.borderWidth\n && curA.borderRadius === curB.borderRadius\n && curA.opacity === curB.opacity\n && curA.fontFamily === curB.fontFamily\n && curA.fontSize === curB.fontSize\n && curA.textAlign === curB.textAlign\n && curA.transform === curB.transform\n && curA.verticalAlign === curB.verticalAlign\n && curA.semantic === curB.semantic\n && curA.debug === curB.debug\n && curA.style === curB.style\n && (curB.svg === undefined || (curA.x === curB.x\n && curA.y === curB.y\n && curA.dx === curB.dx\n && curA.dy === curB.dy\n && curA.cx === curB.cx\n && curA.cy === curB.cy\n && curA.r === curB.r\n && curA.d === curB.d\n && curA.fill === curB.fill\n && curA.stroke === curB.stroke\n && curA.strokeWidth === curB.strokeWidth\n && curA.startOffset === curB.startOffset\n && curA.textAnchor === curB.textAnchor\n && curA.viewBox === curB.viewBox\n && curA.xlinkhref === curB.xlinkhref))) {\n continue;\n }\n updated[id] = \"updated\";\n }\n for (var i = 0, len = bs.length; i < len; i++) {\n var id = bs[i];\n var curA = a[id];\n if (curA === undefined) {\n adds.push(id);\n updated[id] = \"added\";\n continue;\n }\n }\n this.lastDiff = { adds: adds, updates: updated };\n return this.lastDiff;\n };\n Renderer.prototype.prepare = function (root) {\n var elemLen = 1;\n var tree = this.tree;\n var elements = [root];\n var elem;\n for (var elemIx = 0; elemIx < elemLen; elemIx++) {\n elem = elements[elemIx];\n if (elem.parent === undefined)\n elem.parent = \"__root\";\n if (elem.id === undefined)\n elem.id = \"__root__\" + elemIx;\n tree[elem.id] = elem;\n if (elem.postRender !== undefined) {\n this.postRenders.push(elem);\n }\n var children = elem.children;\n if (children !== undefined) {\n for (var childIx = 0, len = children.length; childIx < len; childIx++) {\n var child = children[childIx];\n if (child === undefined)\n continue;\n if (child.id === undefined) {\n child.id = elem.id + \"__\" + childIx;\n }\n if (child.ix === undefined) {\n child.ix = childIx;\n }\n if (child.parent === undefined) {\n child.parent = elem.id;\n }\n elements.push(child);\n elemLen++;\n }\n }\n }\n return tree;\n };\n Renderer.prototype.postDomify = function () {\n var postRenders = this.postRenders;\n var diff = this.lastDiff.updates;\n var elementCache = this.elementCache;\n for (var i = 0, len = postRenders.length; i < len; i++) {\n var elem = postRenders[i];\n var id = elem.id;\n if (diff[id] === \"updated\" || diff[id] === \"added\" || diff[id] === \"replaced\" || elem.dirty || diff[id] === \"moved\") {\n elem.postRender(elementCache[id], elem);\n }\n }\n };\n Renderer.prototype.render = function (elems) {\n this.reset();\n // We sort elements by depth to allow them to be self referential.\n elems.sort(function (a, b) { return (a.parent ? a.parent.split(\"__\").length : 0) - (b.parent ? b.parent.split(\"__\").length : 0); });\n var start = now();\n for (var _i = 0, elems_1 = elems; _i < elems_1.length; _i++) {\n var elem = elems_1[_i];\n var post = this.prepare(elem);\n }\n var prepare = now();\n var d = this.diff();\n var diff = now();\n this.domify();\n var domify = now();\n this.postDomify();\n var postDomify = now();\n var time = now() - start;\n if (time > 5) {\n console.log(\"slow render (> 5ms): \", time, {\n prepare: prepare - start,\n diff: diff - prepare,\n domify: domify - diff,\n postDomify: postDomify - domify\n });\n }\n };\n // @TODO: A more performant implementation would have a way of rendering subtrees and just have a lambda Renderer to compile into\n Renderer._compileRenderer = {};\n return Renderer;\n}());\nexports.Renderer = Renderer;\n//# sourceMappingURL=microReact.js.map\n\n/***/ }),\n/* 82 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n//--------------------------------------------------------------\n// Errors\n//--------------------------------------------------------------\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar chevrotain_1 = __webpack_require__(22);\nvar parser = __webpack_require__(19);\nvar SPAN_TYPE = \"document_comment\";\n//--------------------------------------------------------------\n// EveError\n//--------------------------------------------------------------\nvar EveError = (function () {\n function EveError(blockId, start, stop, message, context) {\n this.type = \"error\";\n this.blockId = blockId;\n this.id = blockId + \"|error|\" + EveError.ID++;\n this.start = start;\n this.stop = stop;\n this.message = message;\n this.context = context;\n }\n EveError.prototype.injectSpan = function (spans, extraInfo) {\n spans.push(this.start, this.stop, SPAN_TYPE, this.id);\n extraInfo[this.id] = this;\n };\n EveError.ID = 0;\n return EveError;\n}());\nexports.EveError = EveError;\n//--------------------------------------------------------------\n// Parse error utils\n//--------------------------------------------------------------\nfunction regexGroup(str, regex, group) {\n if (group === void 0) { group = 1; }\n var matches = [];\n var match;\n while (match = regex.exec(str)) {\n matches.push(match[group]);\n }\n return matches;\n}\nfunction className(thing) {\n var funcNameRegex = /function (.{1,})\\(/;\n var results = (funcNameRegex).exec((thing).constructor.toString());\n return (results && results.length > 1) ? results[1] : \"\";\n}\n;\nfunction lastTokenWithType(tokens, type) {\n var ix = tokens.length - 1;\n while (ix >= 0) {\n var cur = tokens[ix];\n if (cur instanceof type) {\n return cur;\n }\n ix--;\n }\n}\n//--------------------------------------------------------------\n// Parse errors\n//--------------------------------------------------------------\nfunction parserErrors(errors, parseInfo) {\n var blockId = parseInfo.blockId, blockStart = parseInfo.blockStart, spans = parseInfo.spans, extraInfo = parseInfo.extraInfo;\n var normalized = [];\n var errorIx = 1;\n for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {\n var error = errors_1[_i];\n var token = error.token, context = error.context, message = error.message, resyncedTokens = error.resyncedTokens, name_1 = error.name;\n var eveError = void 0;\n if (name_1 === \"MismatchedTokenException\") {\n eveError = mismatchedToken(error, parseInfo);\n }\n else if (name_1 === \"NotAllInputParsedException\") {\n eveError = notAllInputParsed(error, parseInfo);\n }\n else {\n // console.log(\"UNHANDLED ERROR TYPE\", name);\n var start = token.startOffset;\n var stop_1 = token.startOffset + token.image.length;\n eveError = new EveError(blockId, start, stop_1, message, context);\n }\n eveError.injectSpan(spans, extraInfo);\n normalized.push(eveError);\n }\n return normalized;\n}\nexports.parserErrors = parserErrors;\n//--------------------------------------------------------------\n// MismatchedToken parse error\n//--------------------------------------------------------------\nvar MismatchRegex = /-->\\s*(.*?)\\s*<--/gi;\nfunction mismatchedToken(error, parseInfo) {\n var Pairs = {\n \"CloseString\": parser.OpenString,\n \"CloseBracket\": parser.OpenBracket,\n \"CloseParen\": parser.OpenParen,\n };\n var blockId = parseInfo.blockId, blockStart = parseInfo.blockStart, spans = parseInfo.spans, extraInfo = parseInfo.extraInfo, tokens = parseInfo.tokens;\n var token = error.token, context = error.context, message = error.message, resyncedTokens = error.resyncedTokens, name = error.name;\n var blockEnd = tokens[tokens.length - 1].endOffset + 1;\n var _a = regexGroup(message, MismatchRegex), expectedType = _a[0], foundType = _a[1];\n var start, stop;\n if (token instanceof chevrotain_1.EOF) {\n var pair = Pairs[expectedType];\n if (pair) {\n token = lastTokenWithType(tokens, pair);\n message = exports.messages.unclosedPair(expectedType);\n }\n else {\n token = tokens[tokens.length - 1];\n }\n stop = blockEnd;\n }\n // We didn't find a matching pair, check if we're some other mistmatched bit of syntax.\n if (stop === undefined) {\n if (expectedType === \"Tag\") {\n if (token.label === \"identifier\") {\n message = exports.messages.actionRawIdentifier(token.image);\n }\n else {\n message = exports.messages.actionNonTag(token.image);\n }\n }\n }\n if (start === undefined)\n start = token.startOffset;\n if (stop === undefined)\n stop = token.startOffset + token.image.length;\n return new EveError(blockId, start, stop, message, context);\n}\n//--------------------------------------------------------------\n// NotAllInputParsed parse error\n//--------------------------------------------------------------\nvar NotAllInputRegex = /found:\\s*([^\\s]+)/gi;\nvar CloseChars = { \")\": true, \"]\": true };\nfunction notAllInputParsed(error, parseInfo) {\n var blockId = parseInfo.blockId, blockStart = parseInfo.blockStart, spans = parseInfo.spans, extraInfo = parseInfo.extraInfo, tokens = parseInfo.tokens;\n var token = error.token, context = error.context, message = error.message, resyncedTokens = error.resyncedTokens, name = error.name;\n var blockEnd = tokens[tokens.length - 1].endOffset + 1;\n var foundChar = regexGroup(message, NotAllInputRegex)[0];\n var start, stop;\n if (CloseChars[foundChar]) {\n message = exports.messages.extraCloseChar(foundChar);\n }\n else {\n console.log(\"WEIRD STUFF AT THE END\", context);\n }\n if (start === undefined)\n start = token.startOffset;\n if (stop === undefined)\n stop = token.startOffset + token.image.length;\n return new EveError(blockId, start, stop, message, context);\n}\n//--------------------------------------------------------------\n// Build errors\n//--------------------------------------------------------------\nfunction unprovidedVariableGroup(block, variables) {\n var id = block.id, blockStart = block.start;\n var found;\n for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) {\n var variable = variables_1[_i];\n if (!variable.generated) {\n found = variable;\n break;\n }\n }\n if (!found) {\n found = variables[0];\n }\n var _a = parser.nodeToBoundaries(found, blockStart), start = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.unprovidedVariable(found.name));\n}\nexports.unprovidedVariableGroup = unprovidedVariableGroup;\nfunction blankScan(block, scan) {\n var id = block.id, blockStart = block.start;\n var _a = parser.nodeToBoundaries(scan, blockStart), start = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.blankScan());\n}\nexports.blankScan = blankScan;\nfunction invalidLookupAction(block, action) {\n var id = block.id, blockStart = block.start;\n var _a = parser.nodeToBoundaries(action, blockStart), start = _a[0], stop = _a[1];\n var missing = [];\n if (action.entity === undefined)\n missing.push(\"record\");\n if (action.attribute === undefined)\n missing.push(\"attribute\");\n if (action.value === undefined)\n missing.push(\"value\");\n return new EveError(id, start, stop, exports.messages.invalidLookupAction(missing));\n}\nexports.invalidLookupAction = invalidLookupAction;\nfunction unimplementedExpression(block, expression) {\n var id = block.id, blockStart = block.start;\n var _a = parser.nodeToBoundaries(expression, blockStart), start = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.unimplementedExpression(expression.op));\n}\nexports.unimplementedExpression = unimplementedExpression;\nfunction incompatabileConstantEquality(block, left, right) {\n var id = block.id, blockStart = block.start;\n var start = parser.nodeToBoundaries(left, blockStart)[0];\n var _a = parser.nodeToBoundaries(right, blockStart), _ = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.neverEqual(left.value, right.value));\n}\nexports.incompatabileConstantEquality = incompatabileConstantEquality;\nfunction incompatabileVariableToConstantEquality(block, variable, variableValue, constant) {\n var id = block.id, blockStart = block.start;\n var start = parser.nodeToBoundaries(variable, blockStart)[0];\n var _a = parser.nodeToBoundaries(constant, blockStart), _ = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.variableNeverEqual(variable, variableValue, constant.value));\n}\nexports.incompatabileVariableToConstantEquality = incompatabileVariableToConstantEquality;\nfunction incompatabileTransitiveEquality(block, variable, value) {\n var id = block.id, blockStart = block.start;\n var _a = parser.nodeToBoundaries(variable, blockStart), start = _a[0], stop = _a[1];\n return new EveError(id, start, stop, exports.messages.variableNeverEqual(variable, variable.constant, value));\n}\nexports.incompatabileTransitiveEquality = incompatabileTransitiveEquality;\nfunction unrecognisedFunctionAttribute(block, expression, attribute) {\n var id = block.id, blockStart = block.start;\n return new EveError(id, attribute.startOffset, attribute.endOffset, exports.messages.unrecognisedFunctionAttribute(attribute.attribute, expression.op));\n}\nexports.unrecognisedFunctionAttribute = unrecognisedFunctionAttribute;\n//--------------------------------------------------------------\n// Messages\n//--------------------------------------------------------------\nvar PairToName = {\n \"CloseString\": \"quote\",\n \"CloseBracket\": \"bracket\",\n \"CloseParen\": \"paren\",\n \"]\": \"bracket\",\n \")\": \"paren\",\n \"\\\"\": \"quote\",\n};\nexports.messages = {\n unclosedPair: function (type) { return \"Looks like a close \" + PairToName[type] + \" is missing\"; },\n extraCloseChar: function (char) { return \"This close \" + PairToName[char] + \" is missing an open \" + PairToName[char]; },\n unprovidedVariable: function (varName) { return \"Nothing is providing a value for \" + varName; },\n unrecognisedFunctionAttribute: function (attributeName, functionName) { return attributeName + \" is not a recognised attribute for \" + functionName + \".\"; },\n unimplementedExpression: function (op) { return \"There's no definition for the function \" + op; },\n blankScan: function () { return 'Lookup requires at least one attribute: record, attribute, value, or node'; },\n invalidLookupAction: function (missing) { return \"Updating a lookup requires that record, attribute, and value all be provided. Looks like \" + missing.join(\"and\") + \" \" + (missing.length > 1 ? \"are\" : \"is\") + \" missing.\"; },\n neverEqual: function (left, right) { return left + \" can never equal \" + right; },\n variableNeverEqual: function (variable, value, right) { return variable.name + \" is equivalent to \" + value + \", which can't be equal to \" + right; },\n actionNonTag: function (found) { return \"Looks like this should be a tag, try changing the \" + found + \" to #\" + found; },\n actionRawIdentifier: function (found) { return \"I can only add/remove tags directly on a record. If you meant to add \" + found + \" as an attribute to the record, try 'my-record.\" + found + \" += \" + found + \"'; if you meant to add the #\" + found + \" tag, add #.\"; }\n};\n//# sourceMappingURL=errors.js.map\n\n/***/ }),\n/* 83 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global, process) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// import {Program} from \"./dsl2\";\nvar globalsToTrack = [\"transaction\"];\nvar propertiesToTrack = [\"block\", \"PresolveCheck\", \"GenericJoin\"];\nvar PerformanceTracker = (function () {\n function PerformanceTracker() {\n this.reset();\n this.now = exports.now;\n this.elapsed = exports.elapsed;\n }\n PerformanceTracker.prototype._makePropertyHolder = function (props) {\n if (props === void 0) { props = propertiesToTrack; }\n var neue = {};\n for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {\n var property = props_1[_i];\n neue[property] = 0;\n }\n return neue;\n };\n PerformanceTracker.prototype.reset = function () {\n this.activeBlock = \"\";\n this.activeProperties = {};\n this.times = this._makePropertyHolder(globalsToTrack);\n this.counts = this._makePropertyHolder(globalsToTrack);\n this.blocks = {};\n };\n PerformanceTracker.prototype.block = function (name) {\n var blocks = this.blocks;\n var found = blocks[name];\n if (!found) {\n found = blocks[name] = { counts: this._makePropertyHolder(), times: this._makePropertyHolder() };\n }\n this.activeBlock = name;\n this.activeProperties[\"block\"] = this.now();\n found.counts[\"block\"]++;\n };\n PerformanceTracker.prototype.blockEnd = function (name) {\n var _a = this, blocks = _a.blocks, activeBlock = _a.activeBlock;\n blocks[activeBlock].times[\"block\"] += this.elapsed(this.activeProperties[\"block\"]);\n this.activeBlock = \"\";\n };\n PerformanceTracker.prototype.blockTime = function (property) {\n var _a = this, blocks = _a.blocks, activeBlock = _a.activeBlock;\n var found = blocks[activeBlock];\n this.activeProperties[property] = this.now();\n found.counts[property]++;\n };\n PerformanceTracker.prototype.blockTimeEnd = function (property) {\n var _a = this, blocks = _a.blocks, activeBlock = _a.activeBlock;\n var found = blocks[activeBlock];\n found.times[property] += this.elapsed(this.activeProperties[property]);\n };\n PerformanceTracker.prototype.time = function (property) {\n var counts = this.counts;\n this.activeProperties[property] = this.now();\n counts[property]++;\n };\n PerformanceTracker.prototype.timeEnd = function (property) {\n var times = this.times;\n times[property] += this.elapsed(this.activeProperties[property]);\n };\n PerformanceTracker.prototype.serialize = function () {\n return JSON.stringify({\n times: this.times,\n counts: this.counts,\n blocks: this.blocks\n });\n };\n return PerformanceTracker;\n}());\nexports.PerformanceTracker = PerformanceTracker;\nvar NoopPerformanceTracker = (function (_super) {\n __extends(NoopPerformanceTracker, _super);\n function NoopPerformanceTracker() {\n var _this = _super.call(this) || this;\n _this.now = function () { return 0; };\n _this.elapsed = function (start) { return 0; };\n return _this;\n }\n NoopPerformanceTracker.prototype.reset = function () { };\n NoopPerformanceTracker.prototype.time = function (property) { };\n NoopPerformanceTracker.prototype.timeEnd = function (property) { };\n NoopPerformanceTracker.prototype.block = function (name) { this.activeBlock = name; };\n NoopPerformanceTracker.prototype.blockEnd = function (name) { this.activeBlock = \"\"; };\n NoopPerformanceTracker.prototype.blockTime = function (property) { };\n NoopPerformanceTracker.prototype.blockTimeEnd = function (property) { };\n return NoopPerformanceTracker;\n}(PerformanceTracker));\nexports.NoopPerformanceTracker = NoopPerformanceTracker;\nif (global.process) {\n exports.now = function (start) {\n return process.hrtime();\n };\n exports.elapsed = function (start) {\n var end = process.hrtime(start);\n return ((end[0] * 1000) + (end[1] / 1000000));\n };\n}\nelse {\n exports.now = function (start) {\n return performance.now();\n };\n exports.elapsed = function (start) {\n var end = performance.now();\n return end - start;\n };\n}\n//# sourceMappingURL=performance.js.map\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(33)))\n\n/***/ }),\n/* 84 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar runtime_1 = __webpack_require__(4);\nvar microReact_1 = __webpack_require__(81);\nvar performance_1 = __webpack_require__(83);\nfunction isID(v) {\n return typeof v === \"string\" && (v.indexOf(\"|\") > -1 || (v[8] === \"-\" && v.length === 36));\n}\n//------------------------------------------------------------------------\n// UI helpers\n//------------------------------------------------------------------------\nfunction handleArgs(args) {\n if (typeof args[0] === \"object\" && args[0].constructor !== Array)\n return args;\n args.unshift({});\n return args;\n}\nfunction $row() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = handleArgs(args), elem = _a[0], children = _a[1];\n elem.t = \"row\";\n elem.children = children;\n return elem;\n}\nfunction $col() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = handleArgs(args), elem = _a[0], children = _a[1];\n elem.t = \"column\";\n elem.children = children;\n return elem;\n}\nfunction $text() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = handleArgs(args), elem = _a[0], text = _a[1];\n elem.t = \"text\";\n elem.text = text;\n return elem;\n}\nfunction $button() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = handleArgs(args), elem = _a[0], click = _a[1], content = _a[2];\n elem.t = \"button\";\n if (typeof content === \"string\") {\n elem.text = content;\n }\n else {\n elem.children = [content];\n }\n elem.click = click;\n return elem;\n}\nfunction $spacer() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var elem = handleArgs(args)[0];\n elem.t = \"spacer\";\n return elem;\n}\n//------------------------------------------------------------------------\n// Tracer\n//------------------------------------------------------------------------\nvar TraceNode;\n(function (TraceNode) {\n TraceNode[TraceNode[\"Join\"] = 0] = \"Join\";\n TraceNode[TraceNode[\"Choose\"] = 1] = \"Choose\";\n TraceNode[TraceNode[\"Union\"] = 2] = \"Union\";\n TraceNode[TraceNode[\"LinearFlow\"] = 3] = \"LinearFlow\";\n TraceNode[TraceNode[\"BinaryJoin\"] = 4] = \"BinaryJoin\";\n TraceNode[TraceNode[\"AntiJoin\"] = 5] = \"AntiJoin\";\n TraceNode[TraceNode[\"AntiJoinPresolvedRight\"] = 6] = \"AntiJoinPresolvedRight\";\n TraceNode[TraceNode[\"Aggregate\"] = 7] = \"Aggregate\";\n TraceNode[TraceNode[\"AggregateOuterLookup\"] = 8] = \"AggregateOuterLookup\";\n TraceNode[TraceNode[\"Output\"] = 9] = \"Output\";\n TraceNode[TraceNode[\"Watch\"] = 10] = \"Watch\";\n})(TraceNode = exports.TraceNode || (exports.TraceNode = {}));\nvar TraceFrameType;\n(function (TraceFrameType) {\n TraceFrameType[TraceFrameType[\"Program\"] = 0] = \"Program\";\n TraceFrameType[TraceFrameType[\"Transaction\"] = 1] = \"Transaction\";\n TraceFrameType[TraceFrameType[\"Input\"] = 2] = \"Input\";\n TraceFrameType[TraceFrameType[\"Block\"] = 3] = \"Block\";\n TraceFrameType[TraceFrameType[\"Node\"] = 4] = \"Node\";\n TraceFrameType[TraceFrameType[\"MaybeOutput\"] = 5] = \"MaybeOutput\";\n TraceFrameType[TraceFrameType[\"MaybeExternalInput\"] = 6] = \"MaybeExternalInput\";\n})(TraceFrameType = exports.TraceFrameType || (exports.TraceFrameType = {}));\nvar typeToParentField = (_a = {},\n _a[TraceFrameType.Transaction] = \"transactions\",\n _a[TraceFrameType.Input] = \"inputs\",\n _a[TraceFrameType.Block] = \"blocks\",\n _a[TraceFrameType.Node] = \"nodes\",\n _a[TraceFrameType.MaybeOutput] = \"outputs\",\n _a[TraceFrameType.MaybeExternalInput] = \"externalInputs\",\n _a);\n;\nvar Tracer = (function () {\n function Tracer(context, shouldDraw) {\n if (shouldDraw === void 0) { shouldDraw = true; }\n var _this = this;\n this.context = context;\n this.stack = [{ type: TraceFrameType.Program, transactions: [] }];\n this.inputsToOutputs = {};\n this.outputsToInputs = {};\n this.eToChange = {};\n this.activeBlock = \"\";\n this.tracker = new performance_1.PerformanceTracker();\n //------------------------------------------------------------------------\n // UI\n //------------------------------------------------------------------------\n this.activeSearch = \"\";\n this.$interface = function () {\n var program = _this.stack[0];\n return $row({ c: \"trace\" }, [\n _this.$searcher(program),\n _this.$visualization(program)\n ]);\n };\n this.makeSearch = function (query) {\n var _a = query.split(\",\").map(function (v) { return v.trim(); }), e = _a[0], a = _a[1], v = _a[2];\n var conditions = [];\n if (e && e !== \"?\") {\n conditions.push(\"input.e == \" + +e);\n }\n if (a && a !== \"?\") {\n conditions.push(\"input.a === \" + runtime_1.GlobalInterner.intern(a));\n }\n if (v && v !== \"?\") {\n if (_this.eToChange[+v]) {\n conditions.push(\"input.v == \" + +v);\n }\n else {\n conditions.push(\"input.v == \" + runtime_1.GlobalInterner.intern(isNaN(+v) ? v : +v));\n }\n }\n if (!conditions.length) {\n conditions.push(\"true\");\n }\n return new Function(\"input\", \"return \" + conditions.join(\" && \"));\n };\n this.inSearch = function (input) {\n return true;\n };\n this.$searcher = function (program) {\n var inputs = [];\n outer: for (var _i = 0, _a = program.transactions; _i < _a.length; _i++) {\n var transaction = _a[_i];\n if (!transaction)\n continue;\n for (var _b = 0, _c = transaction.inputs; _b < _c.length; _b++) {\n var input = _c[_b];\n if (_this.inSearch(input.input)) {\n inputs.push(_this.$changeLink(input.input));\n if (inputs.length === 500) {\n break outer;\n }\n }\n }\n }\n return $col({ c: \"searcher\" }, [\n { t: \"input\", type: \"text\", placeholder: \"search\", keydown: function (e) {\n if (e.keyCode === 13) {\n _this.activeSearch = e.target.value.trim();\n _this.inSearch = _this.makeSearch(_this.activeSearch);\n _this.draw();\n }\n } },\n $col(inputs)\n ]);\n };\n this.$visualization = function (program) {\n var _a = _this, $changeLink = _a.$changeLink, activeInput = _a.activeInput, getInputFrame = _a.getInputFrame, $block = _a.$block;\n if (activeInput) {\n var frame = getInputFrame(program, activeInput);\n var key = _this.changeKey(activeInput);\n var from = _this.outputsToInputs[key];\n var to = _this.inputsToOutputs[key];\n var fromInfo = void 0;\n if (from) {\n fromInfo = $col([\n $text(\"generated by: \"),\n $changeLink(from),\n ]);\n }\n else {\n fromInfo = $col([\n $text(\"generated by: \"),\n $text(\"unknown\"),\n ]);\n }\n var toInfo = void 0;\n if (to) {\n toInfo = $col([\n $text(\"causes output:\"),\n $col(to.map($changeLink)),\n ]);\n }\n var counts = _this.context.distinctIndex.getCounts(activeInput);\n console.log(frame);\n return $col({ c: \"vis\" }, [\n $changeLink(activeInput),\n fromInfo,\n $col(frame.blocks.map($block)),\n toInfo,\n $text(\"counts: [\" + counts.join(\", \") + \"]\")\n ]);\n }\n return $text(\"select an input\");\n // return $col({c: \"program\"}, program.transactions.map(this.$transaction));\n };\n this.$block = function (block) {\n return $col({ c: \"block\" }, [\n $text({ c: \"name\" }, block.name),\n $col(block.nodes.map(_this.$node)),\n ]);\n };\n this.$node = function (node) {\n var _a = _this, $prefix = _a.$prefix, $node = _a.$node, $changeLink = _a.$changeLink;\n var subs = node.nodes.map($node);\n var out;\n if (node.prefixes.length) {\n out = $row([\n $text(\"out: \"),\n $col(node.prefixes.map($prefix)),\n ]);\n }\n if (node.outputs.length) {\n var outs = [];\n for (var _i = 0, _b = node.outputs; _i < _b.length; _i++) {\n var output = _b[_i];\n outs.push($col([\n $row([\n $text(\"maybe out: \"),\n $changeLink(output.change),\n ]),\n $text(\"pre: \" + output.distinct.pre),\n $text(\"post: \" + output.distinct.post),\n $row([\n $text(\"distinct out: \"),\n $col(output.outputs.map($changeLink)),\n ]),\n ]));\n }\n out = $col(outs);\n }\n return $col({ c: \"node\" }, [\n $text(TraceNode[node.nodeType]),\n $row([\n $text(\"in: \"),\n $prefix(node.inputPrefix),\n ]),\n $row(subs),\n out,\n ]);\n };\n this.$prefix = function (prefix) {\n var items = [];\n var hasValue = false;\n for (var ix = 0; ix < prefix.length - 2; ix++) {\n var value = prefix[ix];\n if (value === undefined) {\n value = \"?\";\n }\n else if (!isID(runtime_1.GlobalInterner.reverse(value))) {\n hasValue = true;\n value = runtime_1.GlobalInterner.reverse(value);\n }\n else {\n hasValue = true;\n }\n items.push(value);\n }\n if (!hasValue) {\n return $text(\"(empty)\");\n }\n var round = prefix[prefix.length - 2];\n var count = prefix[prefix.length - 1];\n return $text(\"(\" + items.join(\", \") + \") [\" + round + \", \" + count + \"]\");\n };\n this.setLink = function (e, elem) {\n _this.activeInput = elem.input;\n _this.draw();\n };\n this.$changeLink = function (change) {\n var e = change.e, a = change.a, v = change.v;\n a = runtime_1.GlobalInterner.reverse(a);\n v = runtime_1.GlobalInterner.reverse(v);\n if (typeof v === \"string\" && (v.indexOf(\"|\") > -1 || (v[8] === \"-\" && v.length === 36))) {\n v = change.v;\n }\n return $button({ c: \"change-link\", input: change }, _this.setLink, $row([\n $text(e + \", \" + a + \", \" + v),\n $spacer(),\n $text(\" [\" + change.transaction + \", \" + change.round + \", \" + change.count + \"]\"),\n ]));\n };\n if (typeof window !== \"undefined\" && shouldDraw) {\n var renderer = this.renderer = new microReact_1.Renderer();\n document.body.appendChild(renderer.content);\n }\n }\n Tracer.prototype.changeKey = function (change) {\n var e = change.e, a = change.a, v = change.v, n = change.n, round = change.round, transaction = change.transaction, count = change.count;\n return e + \"|\" + a + \"|\" + v + \"|\" + n + \"|\" + round + \"|\" + transaction + \"|\" + count;\n };\n Tracer.prototype.current = function () {\n return this.stack[this.stack.length - 1];\n };\n Tracer.prototype.transaction = function (id) {\n this.stack.push({ type: TraceFrameType.Transaction, id: id, externalInputs: [], inputs: [] });\n this.tracker.time(\"transaction\");\n };\n Tracer.prototype.frame = function (commits) {\n // @TODO\n };\n Tracer.prototype.indexChange = function (change) {\n var found = this.eToChange[change.e];\n if (!found)\n found = this.eToChange[change.e] = [];\n found.push(change);\n };\n Tracer.prototype.input = function (input) {\n this._currentInput = input;\n this.indexChange(input);\n this.stack.push({ type: TraceFrameType.Input, input: input, blocks: [] });\n };\n Tracer.prototype.block = function (name) {\n this.activeBlock = name;\n this.stack.push({ type: TraceFrameType.Block, name: name, nodes: [] });\n this.tracker.block(name);\n };\n Tracer.prototype.node = function (node, inputPrefix) {\n this.stack.push({ type: TraceFrameType.Node, nodeType: node.traceType, node: node, inputPrefix: inputPrefix.slice(), nodes: [], prefixes: [], outputs: [], commits: [] });\n };\n Tracer.prototype.capturePrefix = function (prefix) {\n var parent = this.current();\n parent.prefixes.push(prefix.slice());\n };\n Tracer.prototype._mapOutput = function (output) {\n var _currentInput = this._currentInput;\n if (_currentInput) {\n var outKey = this.changeKey(output);\n var inKey = this.changeKey(_currentInput);\n this.outputsToInputs[outKey] = _currentInput;\n var inList = this.inputsToOutputs[inKey];\n if (!inList)\n inList = this.inputsToOutputs[inKey] = [];\n inList.push(output);\n }\n };\n Tracer.prototype.maybeOutput = function (change) {\n // this._mapOutput(change);\n var cur = this.current();\n var type = TraceFrameType.MaybeOutput;\n if (cur.type === TraceFrameType.Transaction) {\n type = TraceFrameType.MaybeExternalInput;\n }\n var counts = (this.context.distinctIndex.getCounts(change) || []).slice();\n this.stack.push({ type: type, distinct: { pre: counts, post: undefined }, change: change, outputs: [] });\n };\n Tracer.prototype.postDistinct = function () {\n var cur = this.current();\n var counts = this.context.distinctIndex.getCounts(cur.change).slice();\n cur.distinct.post = counts;\n };\n Tracer.prototype.output = function (output) {\n var safe = output.clone();\n this._mapOutput(safe);\n var parent = this.current();\n parent.outputs.push(safe);\n };\n Tracer.prototype.commit = function (commit) {\n var safe = commit.clone();\n this._mapOutput(safe);\n var parent = this.current();\n parent.commits.push(safe);\n };\n Tracer.prototype.distinctCheck = function () {\n var error = false;\n var index = this.context.distinctIndex.index;\n for (var key in index) {\n var counts = index[key];\n var sum = 0;\n for (var _i = 0, counts_1 = counts; _i < counts_1.length; _i++) {\n var c = counts_1[_i];\n if (!c)\n continue;\n sum += c;\n if (sum < 0) {\n console.error(\"Negative postDistinct: \", key, counts.slice());\n error = true;\n // throw new Error(\"Negative postDistinct at the end of a transaction\")\n }\n }\n }\n return error;\n };\n Tracer.prototype.pop = function (type) {\n var stack = this.stack;\n var cur = stack.pop();\n if (cur.type !== type) {\n if (cur.type !== TraceFrameType.MaybeExternalInput || type !== TraceFrameType.MaybeOutput) {\n throw new Error(\"Popping the wrong type! expected: \" + TraceFrameType[type] + \", actual: \" + TraceFrameType[cur.type]);\n }\n }\n var parent = this.current();\n if (!parent) {\n throw new Error(\"Removed everything from the stack\");\n }\n if (cur.type === TraceFrameType.Transaction) {\n parent = this.stack[0];\n parent.transactions[cur.id] = cur;\n }\n else {\n var field = typeToParentField[cur.type];\n if (!parent[field])\n throw new Error(\"Trying to write trace field '\" + field + \"', but \" + TraceFrameType[parent.type] + \" doesn't have it\");\n parent[field].push(cur);\n }\n if (cur.type === TraceFrameType.Block)\n this.tracker.blockEnd(cur.name);\n if (cur.type === TraceFrameType.Input)\n this._currentInput = undefined;\n if (cur.type === TraceFrameType.Transaction) {\n this.tracker.timeEnd(\"transaction\");\n var error = this.distinctCheck();\n this.draw();\n }\n };\n Tracer.prototype.draw = function () {\n var renderer = this.renderer;\n if (!renderer)\n return;\n renderer.render([this.$interface()]);\n };\n Tracer.prototype.getInputFrame = function (program, input) {\n var trans = program.transactions[input.transaction];\n for (var _i = 0, _a = trans.inputs; _i < _a.length; _i++) {\n var frame = _a[_i];\n if (frame.input === input)\n return frame;\n }\n };\n return Tracer;\n}());\nexports.Tracer = Tracer;\nvar NoopTracer = (function (_super) {\n __extends(NoopTracer, _super);\n function NoopTracer(context) {\n var _this = _super.call(this, context, false) || this;\n _this.context = context;\n _this.activeBlock = \"\";\n return _this;\n }\n NoopTracer.prototype.transaction = function (id) { };\n NoopTracer.prototype.frame = function (commits) { };\n NoopTracer.prototype.input = function (input) { };\n NoopTracer.prototype.block = function (name) { this.activeBlock = name; };\n NoopTracer.prototype.node = function (node, inputPrefix) { };\n NoopTracer.prototype.capturePrefix = function (prefix) { };\n NoopTracer.prototype.maybeOutput = function (change) { };\n NoopTracer.prototype.postDistinct = function () { };\n NoopTracer.prototype.output = function (output) { };\n NoopTracer.prototype.commit = function (commit) { };\n NoopTracer.prototype.distinctCheck = function () { return false; };\n NoopTracer.prototype.pop = function (type) { };\n return NoopTracer;\n}(Tracer));\nexports.NoopTracer = NoopTracer;\nvar _a;\n//# sourceMappingURL=trace.js.map\n\n/***/ }),\n/* 85 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar ConsoleWatcher = (function (_super) {\n __extends(ConsoleWatcher, _super);\n function ConsoleWatcher() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ConsoleWatcher.prototype.setup = function () {\n if (console) {\n this.program\n .watch(\"Print to console log.\", function (_a) {\n var find = _a.find, record = _a.record;\n var log = find(\"console/log\");\n return [log.add(\"text\", log.text)];\n })\n .asDiffs(function (_a) {\n var adds = _a.adds;\n for (var _i = 0, adds_1 = adds; _i < adds_1.length; _i++) {\n var _b = adds_1[_i], log = _b[0], _ = _b[1], text = _b[2];\n console.log(text);\n }\n })\n .watch(\"Print to console error.\", function (_a) {\n var find = _a.find, record = _a.record;\n var log = find(\"console/error\");\n return [log.add(\"text\", log.text)];\n })\n .asDiffs(function (_a) {\n var adds = _a.adds;\n for (var _i = 0, adds_2 = adds; _i < adds_2.length; _i++) {\n var _b = adds_2[_i], log = _b[0], _ = _b[1], text = _b[2];\n console.error(text);\n }\n })\n .watch(\"Print to console warn.\", function (_a) {\n var find = _a.find, record = _a.record;\n var log = find(\"console/warn\");\n return [log.add(\"text\", log.text)];\n })\n .asDiffs(function (_a) {\n var adds = _a.adds;\n for (var _i = 0, adds_3 = adds; _i < adds_3.length; _i++) {\n var _b = adds_3[_i], log = _b[0], _ = _b[1], text = _b[2];\n console.warn(text);\n }\n });\n }\n };\n return ConsoleWatcher;\n}(watcher_1.Watcher));\nexports.ConsoleWatcher = ConsoleWatcher;\nwatcher_1.Watcher.register(\"console\", ConsoleWatcher);\n//# sourceMappingURL=console.js.map\n\n/***/ }),\n/* 86 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar fs = __webpack_require__(74);\nvar watcher_1 = __webpack_require__(1);\nvar FileWatcher = (function (_super) {\n __extends(FileWatcher, _super);\n function FileWatcher() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FileWatcher.prototype.setup = function () {\n var me = this.program;\n me.load(\"\\nAttach errors to the associated file\\n~~~\\nsearch\\nerror = [#file/error file code message]\\n\\nbind\\nfile.error += error\\n~~~ \\n \");\n if (fs.readFile) {\n me.watch(\"Read a file.\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose;\n var file = find(\"file/read\");\n var encoding = choose(function () { return file.encoding; }, function () { return \"utf-8\"; });\n return [\n record({ file: file, path: file.path, encoding: encoding })\n ];\n })\n .asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n Object.keys(adds).forEach(function (id) {\n var _a = adds[id], file = _a.file, path = _a.path, encoding = _a.encoding;\n fs.readFile(path, { encoding: encoding }, function (err, contents) {\n if (!err) {\n me.inputEAVs([[file, \"contents\", contents]]);\n }\n else {\n var id_1 = file + \"|error\";\n var changes = [];\n changes.push([id_1, \"tag\", \"file/error\"], [id_1, \"file\", file], [id_1, \"code\", \"\" + err.code], [id_1, \"message\", \"\" + err.message]);\n me.inputEAVs(changes);\n }\n });\n });\n });\n }\n if (fs.writeFile) {\n me.watch(\"Write a file.\", function (_a) {\n var find = _a.find, record = _a.record, choose = _a.choose;\n var file = find(\"file/write\");\n var encoding = choose(function () { return file.encoding; }, function () { return \"utf-8\"; });\n return [\n record({ file: file, path: file.path, encoding: encoding, contents: file.contents })\n ];\n })\n .asObjects(function (_a) {\n var adds = _a.adds, removes = _a.removes;\n Object.keys(adds).forEach(function (id) {\n var _a = adds[id], file = _a.file, path = _a.path, contents = _a.contents, encoding = _a.encoding;\n fs.writeFile(path, contents, { encoding: encoding }, function (err) {\n if (!err) {\n me.inputEAVs([[file, \"tag\", \"file/complete\"]]);\n }\n else {\n var id_2 = file + \"|error\";\n var changes = [];\n changes.push([id_2, \"tag\", \"file/error\"], [id_2, \"file\", file], [id_2, \"code\", \"\" + err.code], [id_2, \"message\", \"\" + err.message]);\n me.inputEAVs(changes);\n }\n });\n });\n });\n }\n };\n return FileWatcher;\n}(watcher_1.Watcher));\nexports.FileWatcher = FileWatcher;\nwatcher_1.Watcher.register(\"file\", FileWatcher);\n//# sourceMappingURL=file.js.map\n\n/***/ }),\n/* 87 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar canvas_1 = __webpack_require__(39);\nexports.CanvasWatcher = canvas_1.CanvasWatcher;\nvar compiler_1 = __webpack_require__(40);\nexports.CompilerWatcher = compiler_1.CompilerWatcher;\nvar html_1 = __webpack_require__(42);\nexports.HTMLWatcher = html_1.HTMLWatcher;\nvar notify_1 = __webpack_require__(88);\nexports.NotifyWatcher = notify_1.NotifyWatcher;\nvar file_1 = __webpack_require__(86);\nexports.FileWatcher = file_1.FileWatcher;\nvar console_1 = __webpack_require__(85);\nexports.ConsoleWatcher = console_1.ConsoleWatcher;\nvar shape_1 = __webpack_require__(89);\nexports.ShapeWatcher = shape_1.ShapeWatcher;\nvar svg_1 = __webpack_require__(43);\nexports.SVGWatcher = svg_1.SVGWatcher;\nvar system_1 = __webpack_require__(44);\nexports.SystemWatcher = system_1.SystemWatcher;\nvar tag_browser_1 = __webpack_require__(90);\nexports.TagBrowserWatcher = tag_browser_1.TagBrowserWatcher;\nvar ui_1 = __webpack_require__(21);\nexports.UIWatcher = ui_1.UIWatcher;\n//# sourceMappingURL=index.js.map\n\n/***/ }),\n/* 88 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar Notice = (function () {\n function Notice(program, id, type) {\n this.program = program;\n this.id = id;\n this.type = type;\n this.element = document.createElement(\"notice\");\n var html = program.attach(\"html\");\n html.addExternalRoot(id, this.element);\n }\n Notice.prototype.clear = function () {\n var parent = this.element.parentElement;\n if (parent)\n parent.removeChild(this.element);\n // @FIXME: html.removeExternalRoot.\n };\n return Notice;\n}());\nexports.Notice = Notice;\n// @FIXME: do tihs with two program isolation instead of manual rendering?\nvar NotifyWatcher = (function (_super) {\n __extends(NotifyWatcher, _super);\n function NotifyWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.notices = {};\n return _this;\n }\n NotifyWatcher.prototype.setup = function () {\n var _this = this;\n this.html = this.program.attach(\"html\");\n this.wrapper = document.createElement(\"div\");\n this.wrapper.className = \"notify-wrapper\";\n document.body.appendChild(this.wrapper);\n this.scroller = document.createElement(\"div\");\n this.scroller.className = \"notify-scroller\";\n this.wrapper.appendChild(this.scroller);\n this.root = document.createElement(\"column\");\n this.root.className = \"notify-root ui-column\";\n this.scroller.appendChild(this.root);\n this.html.addExternalRoot(\"notify/root\", this.root);\n this.program\n .bind(\"Notices that aren't dismissed are children of the notify root.\", function (_a) {\n var find = _a.find, not = _a.not;\n var root = find(\"notify/root\");\n var wrapper = find(\"notify/notice-wrapper\");\n not(function () { return wrapper.notice.tag == \"notify/dismissed\"; });\n return [root.add(\"children\", wrapper)];\n })\n .bind(\"Decorate notices.\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var notice = find(\"notify/notice\");\n var type = choose(function () { return notice.type; }, function () { return \"info\"; });\n return [\n record(\"notify/notice-wrapper\", \"ui/row\", { notice: notice, type: type }).add(\"children\", [\n notice.add(\"tag\", \"ui/row\"),\n record(\"ui/spacer\", { sort: 5, notice: notice })\n ])\n ];\n })\n .bind(\"Notices which are dismissable get a button to do so.\", function (_a) {\n var find = _a.find, record = _a.record;\n var notice = find(\"notify/notice\", \"notify/dismissible\");\n var wrapper = find(\"notify/notice-wrapper\", { notice: notice });\n return [wrapper.add(\"children\", [\n record(\"notify/dismiss\", \"ui/button\", { class: \"flat\", notice: notice, sort: 15, icon: \"close-round\" })\n ])];\n })\n .commit(\"Dismissed notices are marked.\", function (_a) {\n var find = _a.find;\n var notice = find(\"notify/notice\");\n find(\"html/event/click\", { element: find(\"notify/dismiss\", { notice: notice }) });\n return [notice.remove().add(\"tag\", \"notify/dismissed\")];\n })\n .bind(\"If a notice has a timestamp, display it.\", function (_a) {\n var find = _a.find, date = _a.lib.date, record = _a.record;\n var notice = find(\"notify/notice\");\n var wrapper = find(\"notify/notice-wrapper\", { notice: notice });\n return [\n wrapper.add(\"children\", [\n record(\"ui/text\", { sort: 10, notice: notice, text: date.format(notice.timestamp, \"HH:MM:ss\") })\n ])\n ];\n })\n .commit(\"Retract timestamps for bound notices that have ceased to be.\", function (_a) {\n var find = _a.find;\n var notice = find(\"notify/retract-timestamp\").notice;\n return [notice.remove(\"timestamp\")];\n })\n .watch(\"The notify watcher attaches a timestamp to notices without one.\", function (_a) {\n var find = _a.find, not = _a.not;\n var notice = find(\"notify/notice\");\n not(function () { return notice.timestamp; });\n return [notice.add(\"tag\", \"notify/notice\")];\n })\n .asDiffs(function (_a) {\n var adds = _a.adds;\n var timestamp = Date.now();\n var eavs = [];\n for (var _i = 0, adds_1 = adds; _i < adds_1.length; _i++) {\n var notice = adds_1[_i][0];\n eavs.push([notice, \"timestamp\", timestamp, 1]);\n }\n if (eavs.length)\n _this.program.inputEAVs(eavs);\n })\n .watch(\"The notify watcher also cleans up those timestamps when the notice goes away.\", function (_a) {\n var find = _a.find;\n var notice = find(\"notify/notice\");\n return [notice.add(\"timestamp\", notice.timestamp)];\n })\n .asDiffs(function (_a) {\n var removes = _a.removes;\n if (!removes.length)\n return;\n var eavs = [];\n eavs.push([\"||notify/retract-timestamp\", \"tag\", \"notify/retract-timestamp\", 1]);\n for (var _i = 0, removes_1 = removes; _i < removes_1.length; _i++) {\n var _b = removes_1[_i], notice = _b[0], _ = _b[1], timestamp = _b[2];\n eavs.push([notice, \"timestamp\", timestamp, -1]);\n //eavs.push([\"||notify/retract-timestamp\", \"notice\", notice, 1]);\n }\n if (eavs.length)\n _this.program.inputEAVs(eavs);\n });\n };\n return NotifyWatcher;\n}(watcher_1.Watcher));\nexports.NotifyWatcher = NotifyWatcher;\nwatcher_1.Watcher.register(\"notify\", NotifyWatcher);\n//# sourceMappingURL=notify.js.map\n\n/***/ }),\n/* 89 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar ShapeWatcher = (function (_super) {\n __extends(ShapeWatcher, _super);\n function ShapeWatcher() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ShapeWatcher.prototype.setup = function () {\n this.program.attach(\"html\");\n this.program.attach(\"canvas\");\n this.hexagon();\n this.hexGrid();\n this.squarePath();\n this.hexagonPath();\n };\n //--------------------------------------------------------------------\n // #shape/hexagon\n //--------------------------------------------------------------------\n ShapeWatcher.prototype.hexagonHTML = function () {\n this.program\n .bind(\"Draw a hexagon\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record, math = _a.lib.math;\n var hex = find(\"shape/hexagon\");\n var side = hex.side;\n var tri_height = math.round(side * 0.5); // sin(30deg)\n var tri_width = math.round(side * 0.86603); // cos(30deg)\n var width = 2 * tri_width;\n var background = choose(function () { hex.tag == \"shape/outline\"; return hex.border; }, function () { return hex.background; })[0];\n var sideBorder = tri_width + \"px\";\n var activeBorder = tri_height + \"px\";\n return [\n hex.add({ tag: \"html/element\", tagname: \"div\", class: \"shape-hexagon\", style: record({ width: width + \"px\" }), children: [\n record(\"shape/hexagon/cap\", \"html/element\", { sort: 1, tagname: \"div\", class: [\"shape-hexagon-cap\", \"first\"], style: record({\n width: 0, height: 0,\n \"border\": \"0 solid transparent\",\n \"border-left-width\": sideBorder, \"border-right-width\": sideBorder,\n \"border-bottom-width\": activeBorder, \"border-bottom-color\": background\n }) }),\n record(\"shape/hexagon/body\", \"ui/column\", { hex: hex, sort: 2, style: record({ height: side + \"px\", width: \"\" + width, background: background }), class: \"shape-hexagon-body\" }),\n record(\"shape/hexagon/cap\", \"html/element\", { sort: 3, tagname: \"div\", class: [\"shape-hexagon-cap\", \"last\"], style: record({\n width: 0, height: 0,\n \"border\": \"0 solid transparent\",\n \"border-left-width\": sideBorder, \"border-right-width\": sideBorder,\n \"border-top-width\": activeBorder, \"border-top-color\": background\n }) }),\n ] })\n ];\n })\n .bind(\"Hexagons with border and thickness are outlined.\", function (_a) {\n var find = _a.find;\n var hex = find(\"shape/hexagon\");\n hex.border;\n hex.thickness;\n return [\n hex.add(\"tag\", \"shape/outline\")\n ];\n })\n .bind(\"An outlined hexagon contains another hexagon inset by thickness.\", function (_a) {\n var find = _a.find, record = _a.record;\n var hex = find(\"shape/hexagon\", \"shape/outline\");\n var thickness = hex.thickness;\n var side = hex.side - thickness;\n var side_thickness = thickness * 0.86603; // cos(30deg)\n return [\n hex.add(\"children\", [\n record(\"shape/hexagon\", \"shape/hexagon/inner\", { outer: hex, sort: 4, side: side, background: hex.background, class: \"shape-hexagon-inner\", style: record({\n position: \"absolute\", top: 0, left: 0, \"margin-top\": thickness + \"px\", \"margin-left\": \"\" + side_thickness\n }) })\n ])\n ];\n })\n .bind(\"Populate hexagon with content\", function (_a) {\n var find = _a.find, not = _a.not;\n var hex_body = find(\"shape/hexagon/body\");\n not(function () { return hex_body.hex.tag == \"shape/outline\"; });\n var content = hex_body.hex.content;\n return [\n hex_body.add(\"children\", [\n content\n ])\n ];\n })\n .bind(\"Populate an outlined hexagon's inner with content\", function (_a) {\n var find = _a.find;\n var hex_inner = find(\"shape/hexagon/inner\");\n return [\n hex_inner.add(\"content\", hex_inner.outer.content)\n ];\n });\n };\n //--------------------------------------------------------------------\n // #shape/hex-grid\n //--------------------------------------------------------------------\n ShapeWatcher.prototype.hexGrid = function () {\n // [#hex-grid cells side gap]\n this.program.bind(\"Decorate all the hex-grid cells as hexagons.\", function (_a) {\n var find = _a.find, math = _a.lib.math, record = _a.record;\n var hex_grid = find(\"shape/hex-grid\");\n var side = hex_grid.side, gap = hex_grid.gap;\n var cell = hex_grid.cell;\n var x_ix = cell.x, y_ix = cell.y;\n var top_gap = gap * 0.86603; // sin(60deg)\n var tri_height = side * 0.5;\n var tri_width = side * 0.86603;\n var width = math.round(2 * tri_width + gap);\n var x_offset = math.round(math.mod(math.absolute(y_ix), 2) * width / 2);\n var height = math.round(side + tri_height + top_gap);\n var x = math.round(width * x_ix + x_offset);\n var y = math.round(height * y_ix);\n return [\n hex_grid.add({ tag: \"html/element\", tagname: \"div\", class: \"shape-hex-grid\" }),\n hex_grid.add(\"children\", [\n cell.add({\n style: record({ position: \"absolute\", left: x + \"px\", top: y + \"px\" })\n })\n ])\n ];\n });\n };\n ShapeWatcher.prototype.hexagon = function () {\n this.program\n .bind(\"Decorate a shape/hexagon as a canvas.\", function (_a) {\n var find = _a.find, choose = _a.choose, math = _a.lib.math, record = _a.record;\n var hex = find(\"shape/hexagon\");\n var side = hex.side;\n var tri_height = side * 0.5;\n var tri_width = side * 0.86603;\n var pad = choose(function () { return hex.lineWidth; }, function () { return 0; })[0];\n var dpad = 2 * pad;\n var width = math.ceiling(2 * tri_width + dpad);\n var height = math.ceiling(2 * side + dpad);\n return [\n hex.add({ tag: \"html/element\", tagname: \"div\", style: record({ width: width + \"px\", height: height + \"px\" }) }).add(\"children\", [\n record(\"canvas/root\", { sort: 1, hex: hex, width: width + \"px\", height: height + \"px\" }).add(\"children\", [\n record(\"shape/hexagon-path\", { sort: 1, hex: hex, x: pad, y: pad, side: side })\n ]),\n record(\"shape/hexagon/content\", \"html/element\", { sort: 2, hex: hex, tagname: \"div\", style: record({ top: tri_height + \"px\", bottom: tri_height + \"px\", left: pad / 2 + \"px\", right: pad + \"px\" }) })\n ])\n ];\n })\n .bind(\"Copy hexagon content into it's appropriate container.\", function (_a) {\n var find = _a.find, record = _a.record;\n var hex = find(\"shape/hexagon\");\n var container = find(\"shape/hexagon/content\", { hex: hex });\n return [container.add(\"children\", hex.content)];\n })\n .bind(\"Copy style properties onto hexagon path.\", function (_a) {\n var find = _a.find, lookup = _a.lookup;\n var hex = find(\"shape/hexagon\");\n var path = find(\"shape/hexagon-path\", { hex: hex });\n var _b = lookup(hex), attribute = _b.attribute, value = _b.value;\n attribute != \"tag\";\n attribute != \"class\";\n attribute != \"tagname\";\n attribute != \"style\";\n attribute != \"children\";\n attribute != \"x\";\n attribute != \"y\";\n return [path.add(attribute, value)];\n });\n };\n ShapeWatcher.prototype.squarePath = function () {\n this.program.bind(\"Decorate a shape/square-path as a canvas/path\", function (_a) {\n var find = _a.find, record = _a.record;\n var square = find(\"shape/square-path\");\n var x = square.x, y = square.y, side = square.side;\n return [\n square.add({ tag: \"canvas/path\" }).add(\"children\", [\n record({ sort: 1, type: \"rect\", x: x, y: y, width: side, height: side }),\n ])\n ];\n });\n };\n ShapeWatcher.prototype.hexagonPath = function () {\n this.program.bind(\"Decorate shape/hexagon-path as a canvas/path\", function (_a) {\n var find = _a.find, record = _a.record;\n var hex = find(\"shape/hexagon-path\");\n var x = hex.x, y = hex.y, side = hex.side;\n var tri_height = side * 0.5;\n var tri_width = side * 0.86603;\n var width = 2 * tri_width;\n var xl = x + width;\n var xm = x + tri_width;\n var y14 = y + tri_height;\n var y34 = y + 3 * tri_height;\n var yb = y + 2 * side;\n return [\n hex.add({ tag: \"canvas/path\" }).add(\"children\", [\n record({ sort: 1, type: \"moveTo\", x: xm, y: y }),\n record({ sort: 2, type: \"lineTo\", x: xl, y: y14 }),\n record({ sort: 3, type: \"lineTo\", x: xl, y: y34 }),\n record({ sort: 4, type: \"lineTo\", x: xm, y: yb }),\n record({ sort: 5, type: \"lineTo\", x: x, y: y34 }),\n record({ sort: 6, type: \"lineTo\", x: x, y: y14 }),\n record({ sort: 7, type: \"closePath\" }),\n ])\n ];\n });\n };\n return ShapeWatcher;\n}(watcher_1.Watcher));\nexports.ShapeWatcher = ShapeWatcher;\nwatcher_1.Watcher.register(\"shape\", ShapeWatcher);\n//# sourceMappingURL=shape.js.map\n\n/***/ }),\n/* 90 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar watcher_1 = __webpack_require__(1);\nvar ui_1 = __webpack_require__(21);\nfunction t(tag) {\n return \"tag-browser/\" + tag;\n}\nfunction collapse() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var all = [];\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var sublist = args_1[_a];\n for (var _b = 0, sublist_1 = sublist; _b < sublist_1.length; _b++) {\n var item = sublist_1[_b];\n all.push(item);\n }\n }\n return all;\n}\nvar TagBrowserWatcher = (function (_super) {\n __extends(TagBrowserWatcher, _super);\n function TagBrowserWatcher() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.browser = _this.createTagBrowser();\n return _this;\n }\n TagBrowserWatcher.prototype.setup = function () {\n var _this = this;\n this.program\n .watch(\"Export all tags\", function (_a) {\n var find = _a.find, record = _a.record;\n var rec = find();\n return [\n record(\"child-tag\", { \"child-tag\": rec.tag })\n ];\n })\n .asDiffs(function (diffs) {\n var eavs = [];\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n eavs.push([e, a, v, -1]);\n }\n for (var _c = 0, _d = diffs.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], v = _e[2];\n eavs.push([e, a, v, 1]);\n }\n if (eavs.length) {\n _this.browser.inputEAVs(eavs);\n }\n })\n .watch(\"Export all records\", function (_a) {\n var find = _a.find, lookup = _a.lookup, choose = _a.choose, record = _a.record;\n var rec = find();\n var _b = lookup(rec), attribute = _b.attribute, value = _b.value;\n // let [attrName] = choose(\n // () => { attribute == \"tag\"; return \"child-tag\"; },\n // () => attribute\n // );\n return [\n rec.add(\"tag\", \"child-record\").add(attribute, value)\n ];\n })\n .asDiffs(function (diffs) {\n var eavs = [];\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n // @NOTE: this breaks tag-browser inspecting tag-browser\n if (a === \"tag\" && v !== \"child-record\")\n a = \"child-tag\";\n eavs.push([e, a, v, -1]);\n }\n for (var _c = 0, _d = diffs.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], v = _e[2];\n // @NOTE: this breaks tag-browser inspecting tag-browser\n if (a === \"tag\" && v !== \"child-record\")\n a = \"child-tag\";\n eavs.push([e, a, v, 1]);\n }\n if (eavs.length) {\n _this.browser.inputEAVs(eavs);\n }\n });\n };\n TagBrowserWatcher.prototype.createTagBrowser = function () {\n var _this = this;\n var prog = new watcher_1.Program(\"Tag Browser\");\n prog.attach(\"ui\");\n var _a = ui_1.UIWatcher.helpers, $style = _a.$style, $row = _a.$row, $column = _a.$column, $text = _a.$text, $elem = _a.$elem;\n //--------------------------------------------------------------------\n // Custom UI Components\n //--------------------------------------------------------------------\n // Tag Button\n prog\n .bind(\"Tag button component\", function (_a) {\n var find = _a.find, record = _a.record;\n var tagButton = find(\"tag-browser/tag\");\n var tag = tagButton.target;\n return [\n tagButton.add({ tag: \"ui/button\", class: \"inset\", text: tag, sort: tag })\n ];\n })\n .commit(\"When a tag button is clicked, update the view target.\", function (_a) {\n var find = _a.find, record = _a.record;\n var click = find(\"html/event/click\");\n var element = click.element;\n element.tag == \"tag-browser/tag\";\n var view = find(\"tag-browser/view\");\n return [\n view.remove(\"target\").add(\"target\", element.target)\n ];\n });\n // @FIXME: Work around for a bug that occurs when leaving a record open and then letting it be retracted and reasserted\n // .commit(\"When a tag button is clicked, clear any open child records\", ({find, record}) => {\n // let click = find(\"html/event/click\");\n // let {element} = click;\n // element.tag == \"tag-browser/tag\";\n // //let view = find(\"tag-browser/view\");\n // //view.target != element.target;\n // let openChildren = find(\"tag-browser/record\");\n // openChildren.open;\n // return [\n // openChildren.remove(\"open\")\n // ];\n // });\n // Record\n prog\n .bind(\"Record component (closed)\", function (_a) {\n var find = _a.find, record = _a.record;\n var childRecord = find(\"tag-browser/record\");\n return [\n childRecord.add({\n tag: \"ui/column\",\n style: record({ border: \"1px solid gray\", margin: 10, padding: 10 }),\n rec: childRecord.target,\n children: [\n record(\"ui/row\", \"tag-browser/record-header\", { sort: 0, rec: childRecord.target }).add(\"children\", [\n record(\"html/element\", { tagname: \"div\", class: \"hexagon\" }),\n record(\"ui/text\", { rec: childRecord.target, text: childRecord.target.displayName })\n ])\n ]\n })\n ];\n })\n .bind(\"Record component (open)\", function (_a) {\n var find = _a.find, lookup = _a.lookup, record = _a.record;\n var childRecord = find(\"tag-browser/record\", { open: \"true\" });\n var _b = lookup(childRecord.target), attribute = _b.attribute, value = _b.value;\n attribute != \"tag\";\n return [\n childRecord.add({\n children: [\n record(\"tag-browser/record-attribute\", { rec: childRecord.target, attr: attribute }).add(\"val\", value)\n ]\n })\n ];\n })\n .commit(\"Clicking a record toggles it open/closed\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var recordHeader = find(\"tag-browser/record-header\");\n var record = find(\"tag-browser/record\", { children: recordHeader });\n find(\"html/event/click\", { element: recordHeader });\n var open = choose(function () { record.open == \"true\"; return \"false\"; }, function () { return \"true\"; })[0];\n return [\n record.remove(\"open\").add(\"open\", open)\n ];\n });\n // Record Attribute\n prog\n .bind(\"Record attribute component\", function (_a) {\n var find = _a.find, choose = _a.choose, record = _a.record;\n var recordAttribute = find(\"tag-browser/record-attribute\");\n var target = find(\"tag-browser/view\").target;\n var attrName = choose(function () { recordAttribute.attr == \"child-tag\"; return \"tag\"; }, function () { return recordAttribute.attr; })[0];\n var rec = recordAttribute.rec, val = recordAttribute.val;\n return [\n recordAttribute.add({ tag: \"ui/row\",\n children: [\n record(\"ui/text\", { sort: 0, text: attrName + \":\", rec: rec, style: record({ \"margin-right\": 10 }) }),\n record(\"ui/column\", { sort: 1, rec: rec, attrName: attrName }) // @FIXME: These attrs from the parent shouldn't need to be on the children.\n .add(\"children\", record(\"tag-browser/record-value\", { rec: rec, attr: attrName, val: val, \"active-input\": \"foo\" }))\n ]\n })\n ];\n });\n // Record Value\n prog\n .bind(\"Record value component (as tag)\", function (_a) {\n var find = _a.find, record = _a.record;\n var recordValue = find(\"tag-browser/record-value\");\n var val = recordValue.val;\n var childTag = find(\"child-tag\", { \"child-tag\": val });\n return [\n recordValue.add({ tag: \"tag-browser/tag\", target: val })\n ];\n })\n .bind(\"Record value component (as record)\", function (_a) {\n var find = _a.find, record = _a.record;\n var recordValue = find(\"tag-browser/record-value\");\n var childRecord = find(\"child-record\");\n childRecord == recordValue.val;\n return [\n recordValue.add({ tag: \"tag-browser/record\", target: childRecord })\n ];\n })\n .bind(\"Record value component (as raw value)\", function (_a) {\n var find = _a.find, not = _a.not, record = _a.record;\n var recordValue = find(\"tag-browser/record-value\");\n // @FIXME: Not is *still* busted\n not(function () { return recordValue.tag == \"tag-browser/tag\"; });\n not(function () { return recordValue.tag == \"tag-browser/record\"; });\n var val = recordValue.val;\n return [\n recordValue.add({ tag: \"ui/text\", sort: val, text: val })\n ];\n });\n // Tag Cloud\n prog.bind(\"List all tags in the tag cloud.\", function (_a) {\n var find = _a.find, not = _a.not, record = _a.record;\n var cloud = find(\"tag-browser/cloud\");\n var rec = find(\"child-tag\");\n var tag = rec[\"child-tag\"];\n return [\n cloud.add(\"children\", record(\"tag-browser/tag\", { target: tag }))\n ];\n });\n // Tag View\n prog\n .bind(\"Show the targeted tag\", function (_a) {\n var find = _a.find, record = _a.record;\n var view = find(\"tag-browser/view\");\n var target = view.target;\n return [\n view.add(\"children\", record(\"ui/text\", { text: \"Current tag: \" + target, sort: 0 }))\n ];\n })\n .bind(\"Show records with the targeted tag\", function (_a) {\n var find = _a.find, not = _a.not, record = _a.record;\n var view = find(\"tag-browser/view\");\n var targetedRecord = find(\"child-record\", { \"child-tag\": view.target });\n return [\n view.add(\"children\", record(\"ui/row\", {\n sort: 1,\n style: record({ \"flex-wrap\": \"wrap\", \"align-items\": \"flex-start\" }),\n }).add(\"children\", record(\"tag-browser/record\", { target: targetedRecord, \"active-tag\": view.target })))\n ];\n })\n .watch(\"When the view target changes, mark it as the active tag in the child program\", function (_a) {\n var find = _a.find, record = _a.record;\n var view = find(\"tag-browser/view\");\n return [\n record(\"tag-browser/active-tag\", { \"active-tag\": view.target })\n ];\n })\n .asDiffs(function (diffs) {\n var eavs = [];\n for (var _i = 0, _a = diffs.removes; _i < _a.length; _i++) {\n var _b = _a[_i], e = _b[0], a = _b[1], v = _b[2];\n eavs.push([e, a, v, -1]);\n }\n for (var _c = 0, _d = diffs.adds; _c < _d.length; _c++) {\n var _e = _d[_c], e = _e[0], a = _e[1], v = _e[2];\n eavs.push([e, a, v, 1]);\n }\n if (eavs.length) {\n _this.program.inputEAVs(eavs);\n }\n });\n // Display Name aliasing\n prog\n .bind(\"Alias display names\", function (_a) {\n var find = _a.find, choose = _a.choose;\n var record = find(\"child-record\");\n var name = choose(\n //() => record.displayName,\n function () { return record.name; }, function () { return \"???\"; })[0];\n return [\n record.add(\"displayName\", name)\n ];\n });\n // Create root UI\n var changes = collapse($column({ tag: t(\"root\") }, [\n $row({ tag: t(\"cloud\"), style: $style({ \"flex-wrap\": \"wrap\" }) }, []),\n $column({ tag: t(\"view\") }, [])\n ]), $elem(\"html/element\", {\n tagname: \"style\",\n text: \"\\n .hexagon {\\n width: 22px;\\n height: 22px;\\n margin-right: 5px;\\n vertical-align: middle;\\n border-radius: 100px;\\n border: 2px solid #AAA;\\n }\\n \"\n }));\n prog.inputEAVs(changes);\n return prog;\n };\n return TagBrowserWatcher;\n}(watcher_1.Watcher));\nexports.TagBrowserWatcher = TagBrowserWatcher;\nwatcher_1.Watcher.register(\"tag browser\", TagBrowserWatcher);\n//# sourceMappingURL=tag-browser.js.map\n\n/***/ }),\n/* 91 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"$:/core/modules/widgets/widget.js\");\n\n/***/ }),\n/* 92 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(45);\n\n\n/***/ })\n/******/ ])));\n}",
"type": "application/javascript",
"title": "$:/plugins/btheado/eve/eve-widget.js",
"module-type": "widget"
},
"$:/plugins/tiddlywiki/codemirror/addon/mode/eve-mode.js": {
"text": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CodeMirror = require(\"../../lib/codemirror\");\n//require(\"codemirror/addon/mode/simple\");\n// Optional but recommended if authoring Eve documents rather than individual blocks.\n// import \"codemirror/addon/mode/overlay\";\n// import \"codemirror/addon/mode/multiplex\";\n// import \"codemirror/mode/gfm/gfm\";\n// import \"codemirror/mode/markdown/markdown\";\n// import \"codemirror/mode/javascript/javascript\";\n// Just some type silliness to tell TS to preserve the static keys but type their values as Patterns.\nfunction asPatterns(patterns) {\n return patterns;\n}\nvar _identifierPattern = /[^\\s|\\[\\](){}\"',.:=#]+/;\nvar patterns = asPatterns({\n start_search: {\n regex: /search/,\n token: \"keyword.section.search\",\n indent: true,\n push: \"search\",\n },\n start_action: {\n regex: /(bind|commit)/,\n token: \"keyword.section.action\",\n indent: true,\n dedent: true,\n push: \"action\"\n },\n start_record: {\n regex: /\\[/,\n token: \"syntax\",\n indent: true,\n push: \"record\",\n },\n stop_record: {\n regex: /\\]/,\n token: \"syntax\",\n dedent: true,\n pop: true\n },\n start_function: {\n regex: /([a-zA-Z][a-zA-Z0-9\\-_\\?!\\/]*)(\\[)/,\n token: [\"identifier.function\", \"syntax\"],\n indent: true,\n push: \"record\",\n },\n start_not: {\n regex: /(not)(\\()/,\n token: [\"keyword.not\", \"syntax\"],\n indent: true,\n push: \"not\",\n },\n stop_not: {\n regex: /\\)/,\n token: \"syntax.end-not\",\n dedent: true,\n pop: true,\n },\n start_string: { regex: /(?:(?!\\\\))\"/, token: \"literal.string\", push: \"string\" },\n stop_string: { regex: /(?:(?!\\\\))\"/, token: \"literal.string\", pop: true },\n string_inner: { regex: /(?:[^\"\\\\{]|\\\\.)+/, token: \"literal.string\" },\n start_interpolation: { regex: /(?:(?!\\\\)){{/, token: \"syntax\", push: \"interpolation\" },\n stop_interpolation: { regex: /(?:(?!\\\\))}}/, token: \"syntax\", pop: true },\n if: { regex: /if|else if/, token: \"keyword.if\", indent: true },\n then: { regex: /then/, token: \"keyword.if\", dedent: true },\n else: { regex: /else/, token: \"keyword.if\" },\n number: { regex: /[-+]?(?:\\.\\d+|\\d+\\.?\\d*)/, token: \"literal.number\" },\n comment: { regex: /\\/\\/.*/, token: \"comment\" },\n identifier: { regex: _identifierPattern, token: \"identifier\" },\n tag: { regex: new RegExp(\"#\" + _identifierPattern.source), token: \"tag\" },\n infix: { regex: /-|\\+|\\/|\\*/, token: \"operator.infix\" },\n filter: { regex: /<|<=|>|>=|!=/, token: \"operator.filter\" },\n update: { regex: /\\+=|-=|:=|<-/, token: \"operator.update\" },\n misc_syntax: { regex: /[:.,]/, token: \"syntax.misc\" }\n});\nfunction compose() {\n var states = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n states[_i] = arguments[_i];\n }\n var result = [];\n for (var _a = 0, states_1 = states; _a < states_1.length; _a++) {\n var state = states_1[_a];\n result.push.apply(result, state);\n }\n return result;\n}\nvar expr = [\n patterns.infix,\n patterns.start_string,\n patterns.start_function,\n patterns.identifier,\n patterns.number\n];\nvar union_or_choose = [\n patterns.if,\n patterns.then,\n patterns.else\n];\nvar mode = CodeMirror.defineSimpleMode(\"eve\", {\n meta: {\n //dontIndentStates: [\"comment\"],\n lineComment: \"//\"\n },\n start: [\n patterns.comment,\n patterns.start_search,\n patterns.start_action\n ],\n record: compose([\n patterns.comment,\n patterns.stop_record,\n patterns.start_record,\n patterns.tag,\n patterns.filter,\n patterns.misc_syntax\n ], expr),\n search: compose([\n patterns.comment,\n patterns.tag,\n patterns.start_action,\n patterns.start_record,\n patterns.start_not,\n ], union_or_choose, [\n patterns.filter,\n patterns.misc_syntax\n ], expr),\n not: compose([\n patterns.comment,\n patterns.stop_not,\n patterns.start_record,\n patterns.filter,\n patterns.misc_syntax\n ], expr),\n action: compose([\n patterns.comment,\n patterns.start_record,\n // @FIXME: begin hack for whitespace syntax\n patterns.start_search,\n patterns.start_action,\n patterns.filter,\n // @FIXME: end hack for whitespace syntax\n patterns.update,\n patterns.tag,\n patterns.misc_syntax\n ], expr),\n string: [\n patterns.start_interpolation,\n patterns.string_inner,\n patterns.stop_string,\n { regex: /./, token: \"string\" }\n ],\n interpolation: compose([\n patterns.comment,\n patterns.stop_interpolation,\n patterns.start_record,\n patterns.misc_syntax\n ], expr)\n});\nCodeMirror.defineMIME(\"text/eve\", \"eve\");\n//# sourceMappingURL=eve-mode.js.map\n",
"module-type": "library",
"title": "$:/plugins/tiddlywiki/codemirror/addon/mode/eve-mode.js",
"type": "application/javascript"
},
"$:/plugins/tiddlywiki/codemirror/addon/mode/overlay.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// Utility function that allows modes to be combined. The mode given\n// as the base argument takes care of most of the normal mode\n// functionality, but a second (typically simple) mode is used, which\n// can override the style of text. Both modes get to parse all of the\n// text, but when both assign a non-null style to a piece of code, the\n// overlay wins, unless the combine argument was true and not overridden,\n// or state.overlay.combineTokens was true, in which case the styles are\n// combined.\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.overlayMode = function(base, overlay, combine) {\n return {\n startState: function() {\n return {\n base: CodeMirror.startState(base),\n overlay: CodeMirror.startState(overlay),\n basePos: 0, baseCur: null,\n overlayPos: 0, overlayCur: null,\n streamSeen: null\n };\n },\n copyState: function(state) {\n return {\n base: CodeMirror.copyState(base, state.base),\n overlay: CodeMirror.copyState(overlay, state.overlay),\n basePos: state.basePos, baseCur: null,\n overlayPos: state.overlayPos, overlayCur: null\n };\n },\n\n token: function(stream, state) {\n if (stream != state.streamSeen ||\n Math.min(state.basePos, state.overlayPos) < stream.start) {\n state.streamSeen = stream;\n state.basePos = state.overlayPos = stream.start;\n }\n\n if (stream.start == state.basePos) {\n state.baseCur = base.token(stream, state.base);\n state.basePos = stream.pos;\n }\n if (stream.start == state.overlayPos) {\n stream.pos = stream.start;\n state.overlayCur = overlay.token(stream, state.overlay);\n state.overlayPos = stream.pos;\n }\n stream.pos = Math.min(state.basePos, state.overlayPos);\n\n // state.overlay.combineTokens always takes precedence over combine,\n // unless set to null\n if (state.overlayCur == null) return state.baseCur;\n else if (state.baseCur != null &&\n state.overlay.combineTokens ||\n combine && state.overlay.combineTokens == null)\n return state.baseCur + \" \" + state.overlayCur;\n else return state.overlayCur;\n },\n\n indent: base.indent && function(state, textAfter) {\n return base.indent(state.base, textAfter);\n },\n electricChars: base.electricChars,\n\n innerMode: function(state) { return {state: state.base, mode: base}; },\n\n blankLine: function(state) {\n var baseToken, overlayToken;\n if (base.blankLine) baseToken = base.blankLine(state.base);\n if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);\n\n return overlayToken == null ?\n baseToken :\n (combine && baseToken != null ? baseToken + \" \" + overlayToken : overlayToken);\n }\n };\n};\n\n});\n",
"module-type": "library",
"title": "$:/plugins/tiddlywiki/codemirror/addon/mode/overlay.js",
"type": "application/javascript"
},
"$:/plugins/tiddlywiki/codemirror/addon/mode/simple.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineSimpleMode = function(name, states) {\n CodeMirror.defineMode(name, function(config) {\n return CodeMirror.simpleMode(config, states);\n });\n };\n\n CodeMirror.simpleMode = function(config, states) {\n ensureState(states, \"start\");\n var states_ = {}, meta = states.meta || {}, hasIndentation = false;\n for (var state in states) if (state != meta && states.hasOwnProperty(state)) {\n var list = states_[state] = [], orig = states[state];\n for (var i = 0; i < orig.length; i++) {\n var data = orig[i];\n list.push(new Rule(data, states));\n if (data.indent || data.dedent) hasIndentation = true;\n }\n }\n var mode = {\n startState: function() {\n return {state: \"start\", pending: null,\n local: null, localState: null,\n indent: hasIndentation ? [] : null};\n },\n copyState: function(state) {\n var s = {state: state.state, pending: state.pending,\n local: state.local, localState: null,\n indent: state.indent && state.indent.slice(0)};\n if (state.localState)\n s.localState = CodeMirror.copyState(state.local.mode, state.localState);\n if (state.stack)\n s.stack = state.stack.slice(0);\n for (var pers = state.persistentStates; pers; pers = pers.next)\n s.persistentStates = {mode: pers.mode,\n spec: pers.spec,\n state: pers.state == state.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state),\n next: s.persistentStates};\n return s;\n },\n token: tokenFunction(states_, config),\n innerMode: function(state) { return state.local && {mode: state.local.mode, state: state.localState}; },\n indent: indentFunction(states_, meta)\n };\n if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop))\n mode[prop] = meta[prop];\n return mode;\n };\n\n function ensureState(states, name) {\n if (!states.hasOwnProperty(name))\n throw new Error(\"Undefined state \" + name + \" in simple mode\");\n }\n\n function toRegex(val, caret) {\n if (!val) return /(?:)/;\n var flags = \"\";\n if (val instanceof RegExp) {\n if (val.ignoreCase) flags = \"i\";\n val = val.source;\n } else {\n val = String(val);\n }\n return new RegExp((caret === false ? \"\" : \"^\") + \"(?:\" + val + \")\", flags);\n }\n\n function asToken(val) {\n if (!val) return null;\n if (val.apply) return val\n if (typeof val == \"string\") return val.replace(/\\./g, \" \");\n var result = [];\n for (var i = 0; i < val.length; i++)\n result.push(val[i] && val[i].replace(/\\./g, \" \"));\n return result;\n }\n\n function Rule(data, states) {\n if (data.next || data.push) ensureState(states, data.next || data.push);\n this.regex = toRegex(data.regex);\n this.token = asToken(data.token);\n this.data = data;\n }\n\n function tokenFunction(states, config) {\n return function(stream, state) {\n if (state.pending) {\n var pend = state.pending.shift();\n if (state.pending.length == 0) state.pending = null;\n stream.pos += pend.text.length;\n return pend.token;\n }\n\n if (state.local) {\n if (state.local.end && stream.match(state.local.end)) {\n var tok = state.local.endToken || null;\n state.local = state.localState = null;\n return tok;\n } else {\n var tok = state.local.mode.token(stream, state.localState), m;\n if (state.local.endScan && (m = state.local.endScan.exec(stream.current())))\n stream.pos = stream.start + m.index;\n return tok;\n }\n }\n\n var curState = states[state.state];\n for (var i = 0; i < curState.length; i++) {\n var rule = curState[i];\n var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);\n if (matches) {\n if (rule.data.next) {\n state.state = rule.data.next;\n } else if (rule.data.push) {\n (state.stack || (state.stack = [])).push(state.state);\n state.state = rule.data.push;\n } else if (rule.data.pop && state.stack && state.stack.length) {\n state.state = state.stack.pop();\n }\n\n if (rule.data.mode)\n enterLocalMode(config, state, rule.data.mode, rule.token);\n if (rule.data.indent)\n state.indent.push(stream.indentation() + config.indentUnit);\n if (rule.data.dedent)\n state.indent.pop();\n var token = rule.token\n if (token && token.apply) token = token(matches)\n if (matches.length > 2) {\n state.pending = [];\n for (var j = 2; j < matches.length; j++)\n if (matches[j])\n state.pending.push({text: matches[j], token: rule.token[j - 1]});\n stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));\n return token[0];\n } else if (token && token.join) {\n return token[0];\n } else {\n return token;\n }\n }\n }\n stream.next();\n return null;\n };\n }\n\n function cmp(a, b) {\n if (a === b) return true;\n if (!a || typeof a != \"object\" || !b || typeof b != \"object\") return false;\n var props = 0;\n for (var prop in a) if (a.hasOwnProperty(prop)) {\n if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false;\n props++;\n }\n for (var prop in b) if (b.hasOwnProperty(prop)) props--;\n return props == 0;\n }\n\n function enterLocalMode(config, state, spec, token) {\n var pers;\n if (spec.persistent) for (var p = state.persistentStates; p && !pers; p = p.next)\n if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p;\n var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec);\n var lState = pers ? pers.state : CodeMirror.startState(mode);\n if (spec.persistent && !pers)\n state.persistentStates = {mode: mode, spec: spec.spec, state: lState, next: state.persistentStates};\n\n state.localState = lState;\n state.local = {mode: mode,\n end: spec.end && toRegex(spec.end),\n endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false),\n endToken: token && token.join ? token[token.length - 1] : token};\n }\n\n function indexOf(val, arr) {\n for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true;\n }\n\n function indentFunction(states, meta) {\n return function(state, textAfter, line) {\n if (state.local && state.local.mode.indent)\n return state.local.mode.indent(state.localState, textAfter, line);\n if (state.indent == null || state.local || meta.dontIndentStates && indexOf(state.state, meta.dontIndentStates) > -1)\n return CodeMirror.Pass;\n\n var pos = state.indent.length - 1, rules = states[state.state];\n scan: for (;;) {\n for (var i = 0; i < rules.length; i++) {\n var rule = rules[i];\n if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {\n var m = rule.regex.exec(textAfter);\n if (m && m[0]) {\n pos--;\n if (rule.next || rule.push) rules = states[rule.next || rule.push];\n textAfter = textAfter.slice(m[0].length);\n continue scan;\n }\n }\n }\n break;\n }\n return pos < 0 ? 0 : state.indent[pos];\n };\n }\n});",
"module-type": "library",
"title": "$:/plugins/tiddlywiki/codemirror/addon/mode/simple.js",
"type": "application/javascript"
},
"$:/plugins/tiddlywiki/codemirror/eve-mode.css": {
"text": "/*.CodeMirror span:not([class]) { color: #747474; }\n.CodeMirror span[class] { color: black; }*/\n\n.CodeMirror.cm-s-default span.cm-syntax { color: #747474; }\n.CodeMirror.cm-s-default span.cm-comment { color: #747474; font-style: italic; }\n.CodeMirror.cm-s-default span.cm-literal,\n.CodeMirror.cm-s-default span.cm-string,\n.CodeMirror.cm-s-default span.cm-number,\n.CodeMirror.cm-s-default span.cm-atom { color: #00a588; }\n.CodeMirror.cm-s-default span.cm-operator { font-weight: bold; }\n.CodeMirror.cm-s-default span.cm-keyword { font-weight: bold; color: rgb(74, 64, 136); }\n.CodeMirror.cm-s-default span.cm-section { color: black; }\n.CodeMirror.cm-s-default span.cm-tag,\n.CodeMirror.cm-s-default span.cm-def { color: #0076ce; }\n.CodeMirror.cm-s-default span.cm-function { color: #0076ce; }",
"tags": "$:/tags/Stylesheet",
"title": "$:/plugins/tiddlywiki/codemirror/eve-mode.css",
"type": "text/css"
},
"$:/plugins/tiddlywiki/codemirror/mode/gfm/gfm.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../markdown/markdown\"), require(\"../../addon/mode/overlay\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../markdown/markdown\", \"../../addon/mode/overlay\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\\.beep|\\.lwz|\\.xpc|\\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\\.beeps?|xmpp|xri|ymsgr|z39\\.50[rs]?):(?:\\/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\\/)(?:[^\\s()<>]|\\([^\\s()<>]*\\))+(?:\\([^\\s()<>]*\\)|[^\\s`*!()\\[\\]{};:'\".,<>?«»“”‘’]))/i\n\nCodeMirror.defineMode(\"gfm\", function(config, modeConfig) {\n var codeDepth = 0;\n function blankLine(state) {\n state.code = false;\n return null;\n }\n var gfmOverlay = {\n startState: function() {\n return {\n code: false,\n codeBlock: false,\n ateSpace: false\n };\n },\n copyState: function(s) {\n return {\n code: s.code,\n codeBlock: s.codeBlock,\n ateSpace: s.ateSpace\n };\n },\n token: function(stream, state) {\n state.combineTokens = null;\n\n // Hack to prevent formatting override inside code blocks (block and inline)\n if (state.codeBlock) {\n if (stream.match(/^```+/)) {\n state.codeBlock = false;\n return null;\n }\n stream.skipToEnd();\n return null;\n }\n if (stream.sol()) {\n state.code = false;\n }\n if (stream.sol() && stream.match(/^```+/)) {\n stream.skipToEnd();\n state.codeBlock = true;\n return null;\n }\n // If this block is changed, it may need to be updated in Markdown mode\n if (stream.peek() === '`') {\n stream.next();\n var before = stream.pos;\n stream.eatWhile('`');\n var difference = 1 + stream.pos - before;\n if (!state.code) {\n codeDepth = difference;\n state.code = true;\n } else {\n if (difference === codeDepth) { // Must be exact\n state.code = false;\n }\n }\n return null;\n } else if (state.code) {\n stream.next();\n return null;\n }\n // Check if space. If so, links can be formatted later on\n if (stream.eatSpace()) {\n state.ateSpace = true;\n return null;\n }\n if (stream.sol() || state.ateSpace) {\n state.ateSpace = false;\n if (modeConfig.gitHubSpice !== false) {\n if(stream.match(/^(?:[a-zA-Z0-9\\-_]+\\/)?(?:[a-zA-Z0-9\\-_]+@)?(?:[a-f0-9]{7,40}\\b)/)) {\n // User/Project@SHA\n // User@SHA\n // SHA\n state.combineTokens = true;\n return \"link\";\n } else if (stream.match(/^(?:[a-zA-Z0-9\\-_]+\\/)?(?:[a-zA-Z0-9\\-_]+)?#[0-9]+\\b/)) {\n // User/Project#Num\n // User#Num\n // #Num\n state.combineTokens = true;\n return \"link\";\n }\n }\n }\n if (stream.match(urlRE) &&\n stream.string.slice(stream.start - 2, stream.start) != \"](\" &&\n (stream.start == 0 || /\\W/.test(stream.string.charAt(stream.start - 1)))) {\n // URLs\n // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls\n // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine\n // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL\n state.combineTokens = true;\n return \"link\";\n }\n stream.next();\n return null;\n },\n blankLine: blankLine\n };\n\n var markdownConfig = {\n taskLists: true,\n fencedCodeBlocks: '```',\n strikethrough: true\n };\n for (var attr in modeConfig) {\n markdownConfig[attr] = modeConfig[attr];\n }\n markdownConfig.name = \"markdown\";\n return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);\n\n}, \"markdown\");\n\n CodeMirror.defineMIME(\"text/x-gfm\", \"gfm\");\n});\n",
"module-type": "library",
"title": "$:/plugins/tiddlywiki/codemirror/mode/gfm/gfm.js",
"type": "application/javascript"
},
"$:/plugins/tiddlywiki/codemirror/addon/runmode/runmode.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.runMode = function(string, modespec, callback, options) {\n var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);\n var ie = /MSIE \\d/.test(navigator.userAgent);\n var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);\n\n if (callback.appendChild) {\n var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;\n var node = callback, col = 0;\n node.innerHTML = \"\";\n callback = function(text, style) {\n if (text == \"\\n\") {\n // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.\n // Emitting a carriage return makes everything ok.\n node.appendChild(document.createTextNode(ie_lt9 ? '\\r' : text));\n col = 0;\n return;\n }\n var content = \"\";\n // replace tabs\n for (var pos = 0;;) {\n var idx = text.indexOf(\"\\t\", pos);\n if (idx == -1) {\n content += text.slice(pos);\n col += text.length - pos;\n break;\n } else {\n col += idx - pos;\n content += text.slice(pos, idx);\n var size = tabSize - col % tabSize;\n col += size;\n for (var i = 0; i < size; ++i) content += \" \";\n pos = idx + 1;\n }\n }\n\n if (style) {\n var sp = node.appendChild(document.createElement(\"span\"));\n sp.className = \"cm-\" + style.replace(/ +/g, \" cm-\");\n sp.appendChild(document.createTextNode(content));\n } else {\n node.appendChild(document.createTextNode(content));\n }\n };\n }\n\n var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);\n for (var i = 0, e = lines.length; i < e; ++i) {\n if (i) callback(\"\\n\");\n var stream = new CodeMirror.StringStream(lines[i]);\n if (!stream.string && mode.blankLine) mode.blankLine(state);\n while (!stream.eol()) {\n var style = mode.token(stream, state);\n callback(stream.current(), style, i, stream.start, state);\n stream.start = stream.pos;\n }\n }\n};\n\n});\n",
"module-type": "library",
"title": "$:/plugins/tiddlywiki/codemirror/addon/runmode/runmode.js",
"type": "application/javascript"
},
"$:/plugins/btheado/tweve/readme": {
"title": "$:/plugins/btheado/tweve/readme",
"caption": "readme",
"text": "<!--\n This is the readme of your plugin.\n This tiddler will be listed as a tab inside your plugin's information card on\n tiddlywiki's control panel.\n Put relevant information about your plugin here.\n This one is different from your repositori's readme.\n This is a comment, you can remove it.\n-->\n! tweve\n\nEve plugin for Tiddlywiki\n"
}
}
}
{
"tiddlers": {
"$:/config/EditorTypeMappings/application/javascript": {
"title": "$:/config/EditorTypeMappings/application/javascript",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/application/json": {
"title": "$:/config/EditorTypeMappings/application/json",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/application/x-tiddler-dictionary": {
"title": "$:/config/EditorTypeMappings/application/x-tiddler-dictionary",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/css": {
"title": "$:/config/EditorTypeMappings/text/css",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/html": {
"title": "$:/config/EditorTypeMappings/text/html",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/plain": {
"title": "$:/config/EditorTypeMappings/text/plain",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/vnd.tiddlywiki": {
"title": "$:/config/EditorTypeMappings/text/vnd.tiddlywiki",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/x-markdown": {
"title": "$:/config/EditorTypeMappings/text/x-markdown",
"text": "codemirror"
},
"$:/config/EditorTypeMappings/text/x-tiddlywiki": {
"title": "$:/config/EditorTypeMappings/text/x-tiddlywiki",
"text": "codemirror"
},
"$:/config/CodeMirror": {
"title": "$:/config/CodeMirror",
"type": "application/json",
"text": "{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/mode/multiplex.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/css/css.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/markdown/markdown.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/meta.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/tiddlywiki/tiddlywiki.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\",\n \"$:/plugins/tiddlywiki/codemirror/keymap/vim.js\",\n \"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js\"\n ],\n \"configuration\": {\n \"matchBrackets\": true,\n \"showCursorWhenSelecting\": true\n }\n}"
},
"$:/plugins/tiddlywiki/codemirror/edit-codemirror.js": {
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/codemirror/edit-codemirror.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-codemirror widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar editTextWidgetFactory = require(\"$:/core/modules/editor/factory.js\").editTextWidgetFactory,\n\tCodeMirrorEngine = require(\"$:/plugins/tiddlywiki/codemirror/engine.js\").CodeMirrorEngine;\n\nexports[\"edit-codemirror\"] = editTextWidgetFactory(CodeMirrorEngine,CodeMirrorEngine);\n\n})();\n",
"title": "$:/plugins/tiddlywiki/codemirror/edit-codemirror.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/plugins/tiddlywiki/codemirror/engine.js": {
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/codemirror/engine.js\ntype: application/javascript\nmodule-type: library\n\nText editor engine based on a CodeMirror instance\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar CODEMIRROR_OPTIONS = \"$:/config/CodeMirror\",\n\tHEIGHT_VALUE_TITLE = \"$:/config/TextEditor/EditorHeight/Height\"\n\n// Install CodeMirror\nif($tw.browser && !window.CodeMirror) {\n\twindow.CodeMirror = require(\"$:/plugins/tiddlywiki/codemirror/lib/codemirror.js\");\n\t// Install required CodeMirror plugins\n\tvar configOptions = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{}),\n\t\treq = configOptions.require;\n\tif(req) {\n\t\tif($tw.utils.isArray(req)) {\n\t\t\tfor(var index=0; index<req.length; index++) {\n\t\t\t\trequire(req[index]);\n\t\t\t}\n\t\t} else {\n\t\t\trequire(req);\n\t\t}\n\t}\n}\n\nfunction CodeMirrorEngine(options) {\n\t// Save our options\n\tvar self = this;\n\toptions = options || {};\n\tthis.widget = options.widget;\n\tthis.value = options.value;\n\tthis.parentNode = options.parentNode;\n\tthis.nextSibling = options.nextSibling;\n\t// Create the wrapper DIV\n\tthis.domNode = this.widget.document.createElement(\"div\");\n\tif(this.widget.editClass) {\n\t\tthis.domNode.className = this.widget.editClass;\n\t}\n\tthis.domNode.style.display = \"inline-block\";\n\tthis.parentNode.insertBefore(this.domNode,this.nextSibling);\n\tthis.widget.domNodes.push(this.domNode);\n\t// Get the configuration options for the CodeMirror object\n\tvar config = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{}).configuration || {};\n\tif(!(\"lineWrapping\" in config)) {\n\t\tconfig.lineWrapping = true;\n\t}\n\tif(!(\"lineNumbers\" in config)) {\n\t\tconfig.lineNumbers = true;\n\t}\n\tconfig.mode = options.type;\n\tconfig.value = options.value;\n\t// Create the CodeMirror instance\n\tthis.cm = window.CodeMirror(function(cmDomNode) {\n\t\t// Note that this is a synchronous callback that is called before the constructor returns\n\t\tself.domNode.appendChild(cmDomNode);\n\t},config);\n\t// Set up a change event handler\n\tthis.cm.on(\"change\",function() {\n\t\tself.widget.saveChanges(self.getText());\n\t});\n\tthis.cm.on(\"drop\",function(cm,event) {\n\t\tevent.stopPropagation(); // Otherwise TW's dropzone widget sees the drop event\n\t\treturn false;\n\t});\n\tthis.cm.on(\"keydown\",function(cm,event) {\n\t\treturn self.widget.handleKeydownEvent.call(self.widget,event);\n\t});\n}\n\n/*\nSet the text of the engine if it doesn't currently have focus\n*/\nCodeMirrorEngine.prototype.setText = function(text,type) {\n\tthis.cm.setOption(\"mode\",type);\n\tif(!this.cm.hasFocus()) {\n\t\tthis.cm.setValue(text);\n\t}\n};\n\n/*\nGet the text of the engine\n*/\nCodeMirrorEngine.prototype.getText = function() {\n\treturn this.cm.getValue();\n};\n\n/*\nFix the height of textarea to fit content\n*/\nCodeMirrorEngine.prototype.fixHeight = function() {\n\tif(this.widget.editAutoHeight) {\n\t\t// Resize to fit\n\t\tthis.cm.setSize(null,null);\n\t} else {\n\t\tvar fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,\"400px\"),10);\n\t\tfixedHeight = Math.max(fixedHeight,20);\n\t\tthis.cm.setSize(null,fixedHeight);\n\t}\n};\n\n/*\nFocus the engine node\n*/\nCodeMirrorEngine.prototype.focus = function() {\n\tthis.cm.focus();\n}\n\n/*\nCreate a blank structure representing a text operation\n*/\nCodeMirrorEngine.prototype.createTextOperation = function() {\n\tvar selections = this.cm.listSelections();\n\tif(selections.length > 0) {\n\t\tvar anchorPos = this.cm.indexFromPos(selections[0].anchor),\n\t\t\theadPos = this.cm.indexFromPos(selections[0].head);\n\t}\n\tvar operation = {\n\t\ttext: this.cm.getValue(),\n\t\tselStart: Math.min(anchorPos,headPos),\n\t\tselEnd: Math.max(anchorPos,headPos),\n\t\tcutStart: null,\n\t\tcutEnd: null,\n\t\treplacement: null,\n\t\tnewSelStart: null,\n\t\tnewSelEnd: null\n\t};\n\toperation.selection = operation.text.substring(operation.selStart,operation.selEnd);\n\treturn operation;\n};\n\n/*\nExecute a text operation\n*/\nCodeMirrorEngine.prototype.executeTextOperation = function(operation) {\n\t// Perform the required changes to the text area and the underlying tiddler\n\tvar newText = operation.text;\n\tif(operation.replacement !== null) {\n\t\tthis.cm.replaceRange(operation.replacement,this.cm.posFromIndex(operation.cutStart),this.cm.posFromIndex(operation.cutEnd));\n\t\tthis.cm.setSelection(this.cm.posFromIndex(operation.newSelStart),this.cm.posFromIndex(operation.newSelEnd));\n\t\tnewText = operation.text.substring(0,operation.cutStart) + operation.replacement + operation.text.substring(operation.cutEnd);\n\t}\n\tthis.cm.focus();\n\treturn newText;\n};\n\nexports.CodeMirrorEngine = CodeMirrorEngine;\n\n})();\n",
"title": "$:/plugins/tiddlywiki/codemirror/engine.js",
"type": "application/javascript",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/lib/codemirror.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// This is CodeMirror (http://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n module.exports = mod();\n else if (typeof define == \"function\" && define.amd) // AMD\n return define([], mod);\n else // Plain browser env\n (this || window).CodeMirror = mod();\n})(function() {\n \"use strict\";\n\n // BROWSER SNIFFING\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);\n var webkit = /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) presto_version = Number(presto_version[1]);\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n // EDITOR CONSTRUCTOR\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }\n\n // DISPLAY CONSTRUCTOR\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = elt(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = elt(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [elt(\"div\", [d.lineSpace], \"CodeMirror-lines\")], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;\n\n if (place) {\n if (place.appendChild) place.appendChild(d.wrapper);\n else place(d.wrapper);\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n input.init(d);\n }\n\n // STATE UPDATES\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function(line) {\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n });\n cm.doc.frontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) regChange(cm);\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function(){updateScrollbars(cm);}, 100);\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function(line) {\n var estHeight = est(line);\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n });\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n function guttersChanged(cm) {\n updateGutters(cm);\n regChange(cm);\n setTimeout(function(){alignHorizontally(cm);}, 20);\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }\n\n function updateGutterSpace(cm) {\n var width = cm.display.gutters.offsetWidth;\n cm.display.sizer.style.marginLeft = width + \"px\";\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // Make sure the gutters options contains the element\n // \"CodeMirror-linenumbers\" when the lineNumbers option is true.\n function setGuttersForLineNumbers(options) {\n var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n if (found == -1 && options.lineNumbers) {\n options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n } else if (found > -1 && !options.lineNumbers) {\n options.gutters = options.gutters.slice(0);\n options.gutters.splice(found, 1);\n }\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }\n\n function NativeScrollbars(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function() {\n if (vert.clientHeight) scroll(vert.scrollTop, \"vertical\");\n });\n on(horiz, \"scroll\", function() {\n if (horiz.clientWidth) scroll(horiz.scrollLeft, \"horizontal\");\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\";\n }\n\n NativeScrollbars.prototype = copyObj({\n update: function(measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) this.zeroWidthHack();\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};\n },\n setScrollLeft: function(pos) {\n if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;\n if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);\n },\n setScrollTop: function(pos) {\n if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;\n if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);\n },\n zeroWidthHack: function() {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n },\n enableZeroWidthBar: function(bar, delay) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // left corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);\n if (elt != bar) bar.style.pointerEvents = \"none\";\n else delay.set(1000, maybeDisable);\n }\n delay.set(1000, maybeDisable);\n },\n clear: function() {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n }\n }, NativeScrollbars.prototype);\n\n function NullScrollbars() {}\n\n NullScrollbars.prototype = copyObj({\n update: function() { return {bottom: 0, right: 0}; },\n setScrollLeft: function() {},\n setScrollTop: function() {},\n clear: function() {}\n }, NullScrollbars.prototype);\n\n CodeMirror.scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n\n cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function() {\n if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0);\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function(pos, axis) {\n if (axis == \"horizontal\") setScrollLeft(cm, pos);\n else setScrollTop(cm, pos);\n }, cm);\n if (cm.display.scrollbars.addClass)\n addClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n\n function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n updateHeightsInViewport(cm);\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }\n\n // LINE NUMBERS\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber));\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }\n\n // DISPLAY DRAWING\n\n function DisplayUpdate(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n }\n\n DisplayUpdate.prototype.signal = function(emitter, type) {\n if (hasHandler(emitter, type))\n this.events.push(arguments);\n };\n DisplayUpdate.prototype.finish = function() {\n for (var i = 0; i < this.events.length; i++)\n signal.apply(null, this.events[i]);\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n break;\n }\n if (!updateDisplayIfNeeded(cm, update)) break;\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height;\n if (cur.hidden) continue;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) height = textHeight(display);\n if (diff > .001 || diff < -.001) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) for (var j = 0; j < cur.rest.length; j++)\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }\n\n function updateLineBackground(lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) cls += \" CodeMirror-linebackground\";\n if (lineView.background) {\n if (cls) lineView.background.className = cls;\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(lineView) {\n updateLineBackground(lineView);\n if (lineView.line.wrapClass)\n ensureLineWrapped(lineView).className = lineView.line.wrapClass;\n else if (lineView.node != lineView.text)\n lineView.node.className = \"\";\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +\n \"px; width: \" + dims.gutterTotalWidth + \"px\");\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", \"left: \" +\n (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\");\n cm.display.input.setUneditable(gutterWrap);\n wrap.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n gutterWrap.className += \" \" + lineView.line.gutterClass;\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n \"left: \" + dims.gutterLeft[\"CodeMirror-linenumbers\"] + \"px; width: \"\n + cm.display.lineNumInnerWidth + \"px\"));\n if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {\n var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\", \"left: \" +\n dims.gutterLeft[id] + \"px; width: \" + dims.gutterWidth[id] + \"px\"));\n }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) lineView.alignable = null;\n for (var node = lineView.node.firstChild, next; node; node = next) {\n var next = node.nextSibling;\n if (node.className == \"CodeMirror-linewidget\")\n lineView.node.removeChild(node);\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) return;\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\");\n if (!widget.handleMouseEvents) node.setAttribute(\"cm-ignore-events\", \"true\");\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n wrap.insertBefore(node, lineView.gutter || lineView.text);\n else\n wrap.appendChild(node);\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + \"px\";\n }\n }\n\n // POSITION OBJECT\n\n // A Pos instance represents a position within the text.\n var Pos = CodeMirror.Pos = function(line, ch) {\n if (!(this instanceof Pos)) return new Pos(line, ch);\n this.line = line; this.ch = ch;\n };\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };\n\n function copyPos(x) {return Pos(x.line, x.ch);}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }\n\n // INPUT HANDLING\n\n function ensureFocus(cm) {\n if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }\n }\n\n // This will be set to an array of strings when copying, so that,\n // when pasting, we know what kind of selections the copied text\n // was made out of.\n var lastCopied = null;\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) sel = doc.sel;\n\n var paste = cm.state.pasteIncoming || origin == \"paste\";\n var textLines = doc.splitLines(inserted), multiPaste = null;\n // When pasing N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.length; i++)\n multiPaste.push(doc.splitLines(lastCopied[i]));\n }\n } else if (textLines.length == sel.ranges.length) {\n multiPaste = map(textLines, function(l) { return [l]; });\n }\n }\n\n // Normal behavior is to insert the new text into every selection\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n from = Pos(from.line, from.ch - deleted);\n else if (cm.state.overwrite && !paste) // Handle overwrite\n to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));\n }\n var updateInput = cm.curOp.updateInput;\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n triggerElectric(cm, inserted);\n\n ensureCursorVisible(cm);\n cm.curOp.updateInput = updateInput;\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = false;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"text/plain\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, \"paste\"); });\n return true;\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) return;\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break;\n }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n indented = indentLine(cm, range.head.line, \"smart\");\n }\n if (indented) signalLater(cm, \"electricInput\", cm, range.head.line);\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges};\n }\n\n function disableBrowserMagic(field) {\n field.setAttribute(\"autocorrect\", \"off\");\n field.setAttribute(\"autocapitalize\", \"off\");\n field.setAttribute(\"spellcheck\", \"false\");\n }\n\n // TEXTAREA INPUT STYLE\n\n function TextareaInput(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Tracks when input.reset has punted to just putting a short\n // string into the textarea instead of the full selection.\n this.inaccurateSelection = false;\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) te.style.width = \"1000px\";\n else te.setAttribute(\"wrap\", \"off\");\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) te.style.border = \"1px solid black\";\n disableBrowserMagic(te);\n return div;\n }\n\n TextareaInput.prototype = copyObj({\n init: function(display) {\n var input = this, cm = this.cm;\n\n // Wraps and hides input textarea\n var div = this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n var te = this.textarea = div.firstChild;\n display.wrapper.insertBefore(div, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) te.style.width = \"0px\";\n\n on(te, \"input\", function() {\n if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null;\n input.poll();\n });\n\n on(te, \"paste\", function(e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return\n\n cm.state.pasteIncoming = true;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) return\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (input.inaccurateSelection) {\n input.prevInput = \"\";\n input.inaccurateSelection = false;\n te.value = lastCopied.join(\"\\n\");\n selectInput(te);\n }\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n lastCopied = ranges.text;\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function(e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;\n cm.state.pasteIncoming = true;\n input.focus();\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(display, e)) e_preventDefault(e);\n });\n\n on(te, \"compositionstart\", function() {\n var start = cm.getCursor(\"from\");\n if (input.composing) input.composing.range.clear()\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function() {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n },\n\n prepareSelection: function() {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result;\n },\n\n showSelection: function(drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n },\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n reset: function(typing) {\n if (this.contextMenuPending) return;\n var minimal, selected, cm = this.cm, doc = cm.doc;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var range = doc.sel.primary();\n minimal = hasCopyEvent &&\n (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);\n var content = minimal ? \"-\" : selected || cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) selectInput(this.textarea);\n if (ie && ie_version >= 9) this.hasSelection = content;\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) this.hasSelection = null;\n }\n this.inaccurateSelection = minimal;\n },\n\n getField: function() { return this.textarea; },\n\n supportsTouch: function() { return false; },\n\n focus: function() {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n },\n\n blur: function() { this.textarea.blur(); },\n\n resetPosition: function() {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n },\n\n receivedFocus: function() { this.slowPoll(); },\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n slowPoll: function() {\n var input = this;\n if (input.pollingFast) return;\n input.polling.set(this.cm.options.pollInterval, function() {\n input.poll();\n if (input.cm.state.focused) input.slowPoll();\n });\n },\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n fastPoll: function() {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n },\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n poll: function() {\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n return false;\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) return false;\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false;\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) prevInput = \"\\u200b\";\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\"); }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;\n\n var self = this;\n runInOp(cm, function() {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, self.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) input.value = self.prevInput = \"\";\n else self.prevInput = text;\n\n if (self.composing) {\n self.composing.range.clear();\n self.composing.range = cm.markText(self.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true;\n },\n\n ensurePolled: function() {\n if (this.pollingFast && this.poll()) this.pollingFast = false;\n },\n\n onKeyPress: function() {\n if (ie && ie_version >= 9) this.hasSelection = null;\n this.fastPoll();\n },\n\n onContextMenu: function(e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n input.wrapper.style.cssText = \"position: absolute\"\n var wrapperBox = input.wrapper.getBoundingClientRect()\n te.style.cssText = \"position: absolute; width: 30px; height: 30px; top: \" + (e.clientY - wrapperBox.top - 5) +\n \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) window.scrollTo(null, oldScrollY);\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) te.value = input.prevInput = \" \";\n input.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\")\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else display.input.reset();\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n },\n\n readOnlyChanged: function(val) {\n if (!val) this.reset();\n },\n\n setUneditable: nothing,\n\n needsContentAttribute: false\n }, TextareaInput.prototype);\n\n // CONTENTEDITABLE INPUT STYLE\n\n function ContentEditableInput(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.gracePeriod = false;\n }\n\n ContentEditableInput.prototype = copyObj({\n init: function(display) {\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div);\n\n on(div, \"paste\", function(e) {\n if (!signalDOMEvent(cm, e)) handlePaste(e, cm);\n })\n\n on(div, \"compositionstart\", function(e) {\n var data = e.data;\n input.composing = {sel: cm.doc.sel, data: data, startData: data};\n if (!data) return;\n var prim = cm.doc.sel.primary();\n var line = cm.getLine(prim.head.line);\n var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length));\n if (found > -1 && found <= prim.head.ch)\n input.composing.sel = simpleSelection(Pos(prim.head.line, found),\n Pos(prim.head.line, found + data.length));\n });\n on(div, \"compositionupdate\", function(e) {\n input.composing.data = e.data;\n });\n on(div, \"compositionend\", function(e) {\n var ours = input.composing;\n if (!ours) return;\n if (e.data != ours.startData && !/\\u200b/.test(e.data))\n ours.data = e.data;\n // Need a small delay to prevent other code (input event,\n // selection polling) from doing damage when fired right after\n // compositionend.\n setTimeout(function() {\n if (!ours.handled)\n input.applyComposition(ours);\n if (input.composing == ours)\n input.composing = null;\n }, 50);\n });\n\n on(div, \"touchstart\", function() {\n input.forceCompositionEnd();\n });\n\n on(div, \"input\", function() {\n if (input.composing) return;\n if (cm.isReadOnly() || !input.pollContent())\n runInOp(input.cm, function() {regChange(cm);});\n });\n\n function onCopyCut(e) {\n if (signalDOMEvent(cm, e)) return\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (e.type == \"cut\") cm.replaceSelection(\"\", null, \"cut\");\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n lastCopied = ranges.text;\n if (e.type == \"cut\") {\n cm.operation(function() {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n if (e.clipboardData && !ios) {\n e.preventDefault();\n e.clipboardData.clearData();\n e.clipboardData.setData(\"text/plain\", lastCopied.join(\"\\n\"));\n } else {\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function() {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n }, 50);\n }\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n },\n\n prepareSelection: function() {\n var result = prepareSelection(this.cm, false);\n result.focus = this.cm.state.focused;\n return result;\n },\n\n showSelection: function(info) {\n if (!info || !this.cm.display.view.length) return;\n if (info.focus) this.showPrimarySelection();\n this.showMultipleSelections(info);\n },\n\n showPrimarySelection: function() {\n var sel = window.getSelection(), prim = this.cm.doc.sel.primary();\n var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&\n cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)\n return;\n\n var start = posToDOM(this.cm, prim.from());\n var end = posToDOM(this.cm, prim.to());\n if (!start && !end) return;\n\n var view = this.cm.display.view;\n var old = sel.rangeCount && sel.getRangeAt(0);\n if (!start) {\n start = {node: view[0].measure.map[2], offset: 0};\n } else if (!end) { // FIXME dangerously hacky\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n try { var rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && this.cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) sel.addRange(rng);\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) sel.addRange(old);\n else if (gecko) this.startGracePeriod();\n }\n this.rememberSelection();\n },\n\n startGracePeriod: function() {\n var input = this;\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function() {\n input.gracePeriod = false;\n if (input.selectionChanged())\n input.cm.operation(function() { input.cm.curOp.selectionChanged = true; });\n }, 20);\n },\n\n showMultipleSelections: function(info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n },\n\n rememberSelection: function() {\n var sel = window.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n },\n\n selectionInEditor: function() {\n var sel = window.getSelection();\n if (!sel.rangeCount) return false;\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node);\n },\n\n focus: function() {\n if (this.cm.options.readOnly != \"nocursor\") this.div.focus();\n },\n blur: function() { this.div.blur(); },\n getField: function() { return this.div; },\n\n supportsTouch: function() { return true; },\n\n receivedFocus: function() {\n var input = this;\n if (this.selectionInEditor())\n this.pollSelection();\n else\n runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; });\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n },\n\n selectionChanged: function() {\n var sel = window.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;\n },\n\n pollSelection: function() {\n if (!this.composing && !this.gracePeriod && this.selectionChanged()) {\n var sel = window.getSelection(), cm = this.cm;\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) runInOp(cm, function() {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) cm.curOp.selectionChanged = true;\n });\n }\n },\n\n pollContent: function() {\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false;\n\n var fromIndex;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n var fromLine = lineNo(display.view[0].line);\n var fromNode = display.view[0].node;\n } else {\n var fromLine = lineNo(display.view[fromIndex].line);\n var fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n if (toIndex == display.view.length - 1) {\n var toLine = display.viewTo - 1;\n var toNode = display.lineDiv.lastChild;\n } else {\n var toLine = lineNo(display.view[toIndex + 1].line) - 1;\n var toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else break;\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n ++cutFront;\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n ++cutEnd;\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd);\n newText[0] = newText[0].slice(cutFront);\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true;\n }\n },\n\n ensurePolled: function() {\n this.forceCompositionEnd();\n },\n reset: function() {\n this.forceCompositionEnd();\n },\n forceCompositionEnd: function() {\n if (!this.composing || this.composing.handled) return;\n this.applyComposition(this.composing);\n this.composing.handled = true;\n this.div.blur();\n this.div.focus();\n },\n applyComposition: function(composing) {\n if (this.cm.isReadOnly())\n operation(this.cm, regChange)(this.cm)\n else if (composing.data && composing.data != composing.startData)\n operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);\n },\n\n setUneditable: function(node) {\n node.contentEditable = \"false\"\n },\n\n onKeyPress: function(e) {\n e.preventDefault();\n if (!this.cm.isReadOnly())\n operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);\n },\n\n readOnlyChanged: function(val) {\n this.div.contentEditable = String(val != \"nocursor\")\n },\n\n onContextMenu: nothing,\n resetPosition: nothing,\n\n needsContentAttribute: true\n }, ContentEditableInput.prototype);\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) return null;\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result;\n }\n\n function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) return null;\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break;\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n return locateNodeInLineView(lineView, node, offset);\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true);\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad);\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) offset = textNode.nodeValue.length;\n }\n while (topNode.parentNode != wrapper) topNode = topNode.parentNode;\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];\n return Pos(line, ch);\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) return badPos(found, bad);\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n return badPos(Pos(found.line, found.ch - dist), bad);\n else\n dist += after.textContent.length;\n }\n for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n return badPos(Pos(found.line, found.ch + dist), bad);\n else\n dist += after.textContent.length;\n }\n }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator();\n function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText != null) {\n if (cmText == \"\") cmText = node.textContent.replace(/\\u200b/g, \"\");\n text += cmText;\n return;\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find()))\n text += getBetween(cm.doc, range.from, range.to).join(lineSep);\n return;\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") return;\n for (var i = 0; i < node.childNodes.length; i++)\n walk(node.childNodes[i]);\n if (/^(pre|div|p)$/i.test(node.nodeName))\n closing = true;\n } else if (node.nodeType == 3) {\n var val = node.nodeValue;\n if (!val) return;\n if (closing) {\n text += lineSep;\n closing = false;\n }\n text += val;\n }\n }\n for (;;) {\n walk(from);\n if (from == to) break;\n from = from.nextSibling;\n }\n return text;\n }\n\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // SELECTION / CURSOR\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n function Selection(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n }\n\n Selection.prototype = {\n primary: function() { return this.ranges[this.primIndex]; },\n equals: function(other) {\n if (other == this) return true;\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;\n }\n return true;\n },\n deepCopy: function() {\n for (var out = [], i = 0; i < this.ranges.length; i++)\n out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));\n return new Selection(out, this.primIndex);\n },\n somethingSelected: function() {\n for (var i = 0; i < this.ranges.length; i++)\n if (!this.ranges[i].empty()) return true;\n return false;\n },\n contains: function(pos, end) {\n if (!end) end = pos;\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n return i;\n }\n return -1;\n }\n };\n\n function Range(anchor, head) {\n this.anchor = anchor; this.head = head;\n }\n\n Range.prototype = {\n from: function() { return minPos(this.anchor, this.head); },\n to: function() { return maxPos(this.anchor, this.head); },\n empty: function() {\n return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;\n }\n };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0);\n }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) return Pos(doc.first, 0);\n var last = doc.first + doc.size - 1;\n if (pos.line > last) return Pos(last, getLine(doc, last).text.length);\n return clipToLen(pos, getLine(doc, pos.line).text.length);\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) return Pos(pos.line, linelen);\n else if (ch < 0) return Pos(pos.line, 0);\n else return pos;\n }\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}\n function clipPosArray(doc, array) {\n for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);\n return out;\n }\n\n // SELECTION UPDATES\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n sel = filterSelectionChange(doc, sel, options);\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm)\n ensureCursorVisible(doc.cm);\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) return;\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) break;\n else {--i; continue;}\n }\n }\n if (!m.atomic) continue;\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff;\n if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)\n near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n return skipAtomicInner(doc, near, pos, dir, mayClear);\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)\n far = movePos(doc, far, dir, far.line == pos.line ? line : null);\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;\n }\n }\n return pos;\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0);\n }\n return found;\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));\n else return null;\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);\n else return null;\n } else {\n return new Pos(pos.line, pos.ch + dir);\n }\n }\n\n // SELECTION DRAWING\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (primary === false && i == doc.sel.primIndex) continue;\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;\n var collapsed = range.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n drawSelectionCursor(cm, range.head, curFragment);\n if (!collapsed)\n drawSelectionRange(cm, range, selFragment);\n }\n return result;\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) return;\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n display.blinker = setInterval(function() {\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate);\n else if (cm.options.cursorBlinkRate < 0)\n display.cursorDiv.style.visibility = \"hidden\";\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)\n cm.state.highlight.set(time, bind(highlightWorker, cm));\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.frontier < doc.first) doc.frontier = doc.first;\n if (doc.frontier >= cm.display.viewTo) return;\n var end = +new Date + cm.options.workTime;\n var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));\n var changedLines = [];\n\n doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {\n if (doc.frontier >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;\n var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) line.styleClasses = newCls;\n else if (oldCls) line.styleClasses = null;\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];\n if (ischange) changedLines.push(doc.frontier);\n line.stateAfter = tooLong ? state : copyState(doc.mode, state);\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n processLine(cm, line.text, state);\n line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;\n }\n ++doc.frontier;\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true;\n }\n });\n if (changedLines.length) runInOp(cm, function() {\n for (var i = 0; i < changedLines.length; i++)\n regLineChange(cm, changedLines[i], \"text\");\n });\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) return doc.first;\n var line = getLine(doc, search - 1);\n if (line.stateAfter && (!precise || search <= doc.frontier)) return search;\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n\n function getStateBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) return true;\n var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;\n if (!state) state = startState(doc.mode);\n else state = copyState(doc.mode, state);\n doc.iter(pos, n, function(line) {\n processLine(cm, line.text, state);\n var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;\n line.stateAfter = save ? copyState(doc.mode, state) : null;\n ++pos;\n });\n if (precise) doc.frontier = pos;\n return state;\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop;}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}\n function paddingH(display) {\n if (display.cachedPaddingH) return display.cachedPaddingH;\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data;\n return data;\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n var mStart = map[i], mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) collapse = \"right\";\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n collapse = bias;\n if (bias == \"left\" && start == 0)\n while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n }\n if (bias == \"right\" && start == mEnd - mStart)\n while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n }\n break;\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {\n rect = node.parentNode.getBoundingClientRect();\n } else if (ie && cm.options.lineWrapping) {\n var rects = range(node, start, end).getClientRects();\n if (rects.length)\n rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n else\n rect = nullRect;\n } else {\n rect = range(node, start, end).getBoundingClientRect() || nullRect;\n }\n if (rect.left || rect.right || start == 0) break;\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) collapse = bias = \"right\";\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n else\n rect = node.getBoundingClientRect();\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};\n else\n rect = nullRect;\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n for (var i = 0; i < heights.length - 1; i++)\n if (mid < heights[i]) break;\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) result.bogus = true;\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result;\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n return rect;\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY};\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n lineView.measure.caches[i] = {};\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n clearLineMeasurementCacheFor(cm.display.view[i]);\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }\n function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"/null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"/null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) lineObj = getLine(cm.doc, pos.line);\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n var innerOff = y - heightAtLine(lineObj);\n var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\n function getX(ch) {\n var sp = cursorCoords(cm, Pos(lineNo, ch), \"line\", lineObj, preparedMeasure);\n wrongLine = true;\n if (innerOff > sp.bottom) return sp.left - adjust;\n else if (innerOff < sp.top) return sp.left + adjust;\n else wrongLine = false;\n return sp.left;\n }\n\n var bidi = getOrder(lineObj), dist = lineObj.text.length;\n var from = lineLeft(lineObj), to = lineRight(lineObj);\n var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;\n\n if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);\n // Do a binary search between these bounds.\n for (;;) {\n if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {\n var ch = x < fromX || x - fromX <= toX - x ? from : to;\n var xDiff = x - (ch == from ? fromX : toX);\n while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;\n var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,\n xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);\n return pos;\n }\n var step = Math.ceil(dist / 2), middle = from + step;\n if (bidi) {\n middle = from;\n for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);\n }\n var middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}\n else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}\n }\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }\n\n // OPERATIONS\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var operationGroup = null;\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n callbacks[i].call(null);\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);\n }\n } while (i < callbacks.length);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp, group = op.ownsGroup;\n if (!group) return;\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n for (var i = 0; i < group.ops.length; i++)\n group.ops[i].cm.curOp = null;\n endOperations(group);\n }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) findMaxLine(cm);\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) updateHeightsInViewport(cm);\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n op.preparedSelection = display.input.prepareSelection();\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);\n cm.display.maxLineChanged = false;\n }\n\n if (op.preparedSelection)\n cm.display.input.showSelection(op.preparedSelection);\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n updateScrollbars(cm, op.barMeasure);\n if (op.updatedDisplay)\n setDocumentHeight(cm, op.barMeasure);\n\n if (op.selectionChanged) restartBlink(cm);\n\n if (cm.state.focused && op.updateInput)\n cm.display.input.reset(op.typing);\n if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))\n ensureFocus(op.cm);\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) postUpdateDisplay(cm, op.update);\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n display.wheelStartX = display.wheelStartY = null;\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {\n doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));\n display.scrollbars.setScrollTop(doc.scrollTop);\n display.scroller.scrollTop = doc.scrollTop;\n }\n if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {\n doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));\n display.scrollbars.setScrollLeft(doc.scrollLeft);\n display.scroller.scrollLeft = doc.scrollLeft;\n alignHorizontally(cm);\n }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) for (var i = 0; i < hidden.length; ++i)\n if (!hidden[i].lines.length) signal(hidden[i], \"hide\");\n if (unhidden) for (var i = 0; i < unhidden.length; ++i)\n if (unhidden[i].lines.length) signal(unhidden[i], \"unhide\");\n\n if (display.wrapper.offsetHeight)\n doc.scrollTop = cm.display.scroller.scrollTop;\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n signal(cm, \"changes\", cm, op.changeObjs);\n if (op.update)\n op.update.finish();\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) return f.apply(this, arguments);\n startOperation(cm);\n try { return f.apply(this, arguments); }\n finally { endOperation(cm); }\n };\n }\n\n // VIEW TRACKING\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) return null;\n n -= cm.display.viewFrom;\n if (n < 0) return null;\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) return i;\n }\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n return {index: index, lineN: newN};\n for (var i = 0, n = cm.display.viewFrom; i < index; i++)\n n += view[i].size;\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) return null;\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) return null;\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN};\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }\n\n // EVENT HANDLERS\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n };\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) return false;\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1;\n }\n function farAway(touch, other) {\n if (other.left == null) return true;\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20;\n }\n on(d.scroller, \"touchstart\", function(e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function() {\n if (d.activeTouch) d.activeTouch.moved = true;\n });\n on(d.scroller, \"touchend\", function(e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n range = new Range(pos, pos);\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n range = cm.findWordAt(pos);\n else // Triple tap\n range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},\n over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function(e){onDragStart(cm, e);},\n drop: operation(cm, onDrop),\n leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", bind(onFocus, cm));\n on(inp, \"blur\", bind(onBlur, cm));\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != CodeMirror.Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n return;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n // MOUSE EVENTS\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n // #3261: make sure, that we're not starting a second selection\n if (cm.state.selectingText)\n cm.state.selectingText(e);\n else if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(function() {display.input.focus();}, 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n else delayBlurEvent(cm);\n break;\n }\n }\n\n var lastClick, lastDoubleClick;\n function leftButtonDown(cm, e, start) {\n if (ie) setTimeout(bind(ensureFocus, cm), 0);\n else cm.curOp.focus = activeElt();\n\n var now = +new Date, type;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {\n type = \"triple\";\n } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {\n type = \"double\";\n lastDoubleClick = {time: now, pos: start};\n } else {\n type = \"single\";\n lastClick = {time: now, pos: start};\n }\n\n var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n type == \"single\" && (contained = sel.contains(start)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&\n (cmp(contained.to(), start) > 0 || start.xRel < 0))\n leftButtonStartDrag(cm, e, start, modifier);\n else\n leftButtonSelect(cm, e, start, type, modifier);\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display, startTime = +new Date;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier && +new Date - 200 < startTime)\n extendSelection(cm.doc, start);\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n else\n display.input.focus();\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true);\n }\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n return;\n e_preventDefault(e);\n if (ie) lastDrop = +new Date;\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) return;\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var loadFile = function(file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1)\n return;\n\n var reader = new FileReader;\n reader.onload = operation(cm, function() {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) content = \"\";\n text[i] = content;\n if (++read == n) {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));\n }\n });\n reader.readAsText(file);\n };\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function() {cm.display.input.focus();}, 20);\n return;\n }\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))\n var selected = cm.listSelections();\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) for (var i = 0; i < selected.length; ++i)\n replaceRange(cm.doc, \"\", selected[i].anchor, selected[i].head, \"drag\");\n cm.replaceSelection(text, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) img.parentNode.removeChild(img);\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) return;\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // SCROLL EVENTS\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function setScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) return;\n cm.doc.scrollTop = val;\n if (!gecko) updateDisplaySimple(cm, {top: val});\n if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (gecko) updateDisplaySimple(cm);\n startWorker(cm, 100);\n }\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller) {\n if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;\n val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) wheelPixelsPerUnit = -.53;\n else if (gecko) wheelPixelsPerUnit = 15;\n else if (chrome) wheelPixelsPerUnit = -.7;\n else if (safari) wheelPixelsPerUnit = -1/3;\n\n var wheelEventDelta = function(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;\n else if (dy == null) dy = e.wheelDelta;\n return {x: dx, y: dy};\n };\n CodeMirror.wheelEventPixels = function(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta;\n };\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) return;\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer;\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));\n setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n e_preventDefault(e);\n display.wheelStartX = null; // Abort measurement, if in progress\n return;\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) top = Math.max(0, top + pixels - 50);\n else bot = Math.min(cm.doc.height, bot + pixels + 50);\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function() {\n if (display.wheelStartX == null) return;\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) return;\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // KEY EVENTS\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) cm.state.suppressEdits = true;\n if (dropShift) cm.display.shift = false;\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done;\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) return result;\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm);\n }\n\n var stopSeq = new Delayed;\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) return \"handled\";\n stopSeq.set(50, function() {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n });\n name = seq + \" \" + name;\n }\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n cm.state.keySeq = name;\n if (result == \"handled\")\n signalLater(cm, \"keyHandled\", cm, name, e);\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n if (seq && !result && /\\'$/.test(name)) {\n e_preventDefault(e);\n return true;\n }\n return !!result;\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) return false;\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n || dispatchKey(cm, name, e, function(b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n return doHandleBinding(cm, b);\n });\n } else {\n return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e,\n function(b) { return doHandleBinding(cm, b, true); });\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) return;\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n cm.replaceSelection(\"\", null, \"cut\");\n }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n showCrossHair(cm);\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) this.doc.sel.shift = false;\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return;\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return;\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n if (handleCharBinding(cm, e, ch)) return;\n cm.display.input.onKeyPress(e);\n }\n\n // FOCUS/BLUR EVENTS\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function() {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n }\n }, 100);\n }\n\n function onFocus(cm) {\n if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;\n\n if (cm.options.readOnly == \"nocursor\") return;\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm) {\n if (cm.state.delayingBlurEvent) return;\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n cm.display.input.onContextMenu(e);\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) return false;\n return gutterEvent(cm, e, \"gutterContextMenu\", false);\n }\n\n // UPDATING\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n var changeEnd = CodeMirror.changeEnd = function(change) {\n if (!change.text) return change.to;\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n };\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(out, doc.sel.primIndex);\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n return Pos(nw.line, pos.ch - old.ch + nw.ch);\n else\n return Pos(nw.line + (pos.line - old.line), pos.ch);\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) return;\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n if (doc.cm && doc.cm.state.suppressEdits) return;\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n for (var i = 0; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n break;\n }\n if (i == source.length) return;\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return;\n }\n selAfter = event;\n }\n else break;\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n for (var i = event.changes.length - 1; i >= 0; --i) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return;\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) return;\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function(range) {\n return new Range(Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch));\n }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n regLineChange(doc.cm, l, \"gutter\");\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n if (!to) to = from;\n if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }\n if (typeof code == \"string\") code = doc.splitLines(code);\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, coords) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) return;\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (coords.top + box.top < 0) doScroll = true;\n else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, \"position: absolute; top: \" +\n (coords.top - display.viewOffset - paddingTop(cm.display)) + \"px; height: \" +\n (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + \"px; left: \" +\n coords.left + \"px; width: 2px;\");\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }\n\n // API UTILITIES\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"char\", \"column\" (like char, but doesn't\n // cross line boundaries), \"word\" (across next word), or \"group\" (to\n // the start of next group of word or non-word-non-whitespace\n // chars). The visually param controls whether, in right-to-left\n // text, direction 1 means to move towards the next index in the\n // string, or towards the character to the right of the current\n // position. The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return false\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return false\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n if (!cmp(pos, result)) result.hitSide = true;\n return result;\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }\n\n // EDITOR METHODS\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") return;\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n operation(this, optionHandlers[option])(this, value, old);\n },\n\n getOption: function(option) {return this.options[option];},\n getDoc: function() {return this.doc;},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true;\n }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) throw new Error(\"Overlays may not be stateful.\");\n this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return;\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) dir = this.options.smartIndent ? \"smart\" : \"prev\";\n else dir = dir ? \"add\" : \"subtract\";\n }\n if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n indentLine(this, j, how);\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) ensureCursorVisible(this);\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise);\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true);\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) type = styles[2];\n else for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;\n else if (styles[mid * 2 + 1] < ch) before = mid + 1;\n else { type = styles[mid * 2 + 2]; break; }\n }\n var cut = type ? type.indexOf(\"cm-overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) return mode;\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0];\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) return found;\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) found.push(help[mode[type]]);\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) found.push(val);\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i = 0; i < help._global.length; i++) {\n var cur = help._global[i];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n found.push(cur.val);\n }\n return found;\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getStateBefore(this, line + 1, precise);\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) pos = range.head;\n else if (typeof start == \"object\") pos = clipPos(this.doc, start);\n else pos = start ? range.from() : range.to();\n return cursorCoords(this, pos, mode || \"page\");\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\");\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top);\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset);\n },\n heightAtLine: function(line, mode) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) line = this.doc.first;\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\").top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0);\n },\n\n defaultTextHeight: function() { return textHeight(this.display); },\n defaultCharWidth: function() { return charWidth(this.display); },\n\n setGutterMarker: methodOp(function(line, gutterID, value) {\n return changeLine(this.doc, line, \"gutter\", function(line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) line.gutterMarkers = null;\n return true;\n });\n }),\n\n clearGutter: methodOp(function(gutterID) {\n var cm = this, doc = cm.doc, i = doc.first;\n doc.iter(function(line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n line.gutterMarkers[gutterID] = null;\n regLineChange(cm, i, \"gutter\");\n if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;\n }\n ++i;\n });\n }),\n\n lineInfo: function(line) {\n if (typeof line == \"number\") {\n if (!isLine(this.doc, line)) return null;\n var n = line;\n line = getLine(this.doc, line);\n if (!line) return null;\n } else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets};\n },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n top = pos.top - node.offsetHeight;\n else if (pos.bottom + node.offsetHeight <= vspace)\n top = pos.bottom;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n node.style.left = left + \"px\";\n }\n if (scroll)\n scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n return commands[cmd].call(null, this);\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) break;\n }\n return cur;\n },\n\n moveH: methodOp(function(dir, unit) {\n var cm = this;\n cm.extendSelectionsBy(function(range) {\n if (cm.display.shift || cm.doc.extend || range.empty())\n return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);\n else\n return dir < 0 ? range.from() : range.to();\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n doc.replaceSelection(\"\", null, \"+delete\");\n else\n deleteNearSelection(this, function(range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};\n });\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) x = coords.left;\n else coords.left = x;\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) break;\n }\n return cur;\n },\n\n moveV: methodOp(function(dir, unit) {\n var cm = this, doc = this.doc, goals = [];\n var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function(range) {\n if (collapse)\n return dir < 0 ? range.from() : range.to();\n var headPos = cursorCoords(cm, range.head, \"div\");\n if (range.goalColumn != null) headPos.left = range.goalColumn;\n goals.push(headPos.left);\n var pos = findPosV(cm, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n addToScrollPos(cm, null, charCoords(cm, pos, \"div\").top - headPos.top);\n return pos;\n }, sel_move);\n if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)\n doc.sel.ranges[i].goalColumn = goals[i];\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function(ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function(ch) {return /\\s/.test(ch);}\n : function(ch) {return !/\\s/.test(ch) && !isWordChar(ch);};\n while (start > 0 && check(line.charAt(start - 1))) --start;\n while (end < line.length && check(line.charAt(end))) ++end;\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end));\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) return;\n if (this.state.overwrite = !this.state.overwrite)\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n else\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(); },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) resolveScrollToPos(this);\n if (x != null) this.curOp.scrollLeft = x;\n if (y != null) this.curOp.scrollTop = y;\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)};\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) margin = this.options.cursorScrollMargin;\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) range.to = range.from;\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n resolveScrollToPos(this);\n this.curOp.scrollToPos = range;\n } else {\n var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),\n Math.min(range.from.top, range.to.top) - range.margin,\n Math.max(range.from.right, range.to.right),\n Math.max(range.from.bottom, range.to.bottom) + range.margin);\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var cm = this;\n function interpret(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n }\n if (width != null) cm.display.wrapper.style.width = interpret(width);\n if (height != null) cm.display.wrapper.style.height = interpret(height);\n if (cm.options.lineWrapping) clearLineMeasurementCache(this);\n var lineNo = cm.display.viewFrom;\n cm.doc.iter(lineNo, cm.display.viewTo, function(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++)\n if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, \"widget\"); break; }\n ++lineNo;\n });\n cm.curOp.forceUpdate = true;\n signal(cm, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f);},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n estimateLineHeights(this);\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n this.scrollTo(doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old;\n }),\n\n getInputField: function(){return this.display.input.getField();},\n getWrapperElement: function(){return this.display.wrapper;},\n getScrollerElement: function(){return this.display.scroller;},\n getGutterElement: function(){return this.display.gutters;}\n };\n eventMixin(CodeMirror);\n\n // OPTION DEFAULTS\n\n // The default configuration options.\n var defaults = CodeMirror.defaults = {};\n // Functions to run when options are changed.\n var optionHandlers = CodeMirror.optionHandlers = {};\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) optionHandlers[name] =\n notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;\n }\n\n // Passed to option handlers when there is no old value.\n var Init = CodeMirror.Init = {toString: function(){return \"CodeMirror.Init\";}};\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function(cm, val) {\n cm.setValue(val);\n }, true);\n option(\"mode\", null, function(cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function(cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n option(\"lineSeparator\", null, function(cm, val) {\n cm.doc.lineSep = val;\n if (!val) return;\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function(line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) break;\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))\n });\n option(\"specialChars\", /[\\t\\u0000-\\u0019\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]/g, function(cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != CodeMirror.Init) cm.refresh();\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function() {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\"); // FIXME\n }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function(cm) {\n themeChanged(cm);\n guttersChanged(cm);\n }, true);\n option(\"keyMap\", \"default\", function(cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != CodeMirror.Init && getKeyMap(old);\n if (prev && prev.detach) prev.detach(cm, next);\n if (next.attach) next.attach(cm, prev || null);\n });\n option(\"extraKeys\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"fixedGutter\", true, function(cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function(cm) {updateScrollbars(cm);}, true);\n option(\"scrollbarStyle\", \"native\", function(cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"firstLineNumber\", 1, guttersChanged, true);\n option(\"lineNumberFormatter\", function(integer) {return integer;}, guttersChanged, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n\n option(\"readOnly\", false, function(cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n cm.display.disabled = true;\n } else {\n cm.display.disabled = false;\n }\n cm.display.input.readOnlyChanged(val)\n });\n option(\"disableInput\", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function(cm, val){cm.doc.history.undoDepth = val;});\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function(cm){cm.refresh();}, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function(cm, val) {\n if (!val) cm.display.input.resetPosition();\n });\n\n option(\"tabindex\", null, function(cm, val) {\n cm.display.input.getField().tabIndex = val || \"\";\n });\n option(\"autofocus\", null);\n\n // MODE DEFINITION AND QUERYING\n\n // Known modes, by name and by MIME\n var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name, mode) {\n if (!CodeMirror.defaults.mode && name != \"null\") CodeMirror.defaults.mode = name;\n if (arguments.length > 2)\n mode.dependencies = Array.prototype.slice.call(arguments, 2);\n modes[name] = mode;\n };\n\n CodeMirror.defineMIME = function(mime, spec) {\n mimeModes[mime] = spec;\n };\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n CodeMirror.resolveMode = function(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") found = {name: found};\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return CodeMirror.resolveMode(\"application/xml\");\n }\n if (typeof spec == \"string\") return {name: spec};\n else return spec || {name: \"null\"};\n };\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n CodeMirror.getMode = function(options, spec) {\n var spec = CodeMirror.resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) return CodeMirror.getMode(options, \"text/plain\");\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) continue;\n if (modeObj.hasOwnProperty(prop)) modeObj[\"_\" + prop] = modeObj[prop];\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) modeObj.helperType = spec.helperType;\n if (spec.modeProps) for (var prop in spec.modeProps)\n modeObj[prop] = spec.modeProps[prop];\n\n return modeObj;\n };\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function() {\n return {token: function(stream) {stream.skipToEnd();}};\n });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = CodeMirror.modeExtensions = {};\n CodeMirror.extendMode = function(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n };\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function(name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function(name, func) {\n Doc.prototype[name] = func;\n };\n CodeMirror.defineOption = option;\n\n var initHooks = [];\n CodeMirror.defineInitHook = function(f) {initHooks.push(f);};\n\n var helpers = CodeMirror.helpers = {};\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []};\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n\n // MODE STATE HANDLING\n\n // Utility functions for working with state. Exported because nested\n // modes need to do this for their inner modes.\n\n var copyState = CodeMirror.copyState = function(mode, state) {\n if (state === true) return state;\n if (mode.copyState) return mode.copyState(state);\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) val = val.concat([]);\n nstate[n] = val;\n }\n return nstate;\n };\n\n var startState = CodeMirror.startState = function(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true;\n };\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n CodeMirror.innerMode = function(mode, state) {\n while (mode.innerMode) {\n var info = mode.innerMode(state);\n if (!info || info.mode == mode) break;\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state};\n };\n\n // STANDARD COMMANDS\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = CodeMirror.commands = {\n selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);},\n singleSelection: function(cm) {\n cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll);\n },\n killLine: function(cm) {\n deleteNearSelection(cm, function(range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n return {from: range.head, to: Pos(range.head.line + 1, 0)};\n else\n return {from: range.head, to: Pos(range.head.line, len)};\n } else {\n return {from: range.from(), to: range.to()};\n }\n });\n },\n deleteLine: function(cm) {\n deleteNearSelection(cm, function(range) {\n return {from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))};\n });\n },\n delLineLeft: function(cm) {\n deleteNearSelection(cm, function(range) {\n return {from: Pos(range.from().line, 0), to: range.from()};\n });\n },\n delWrappedLineLeft: function(cm) {\n deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()};\n });\n },\n delWrappedLineRight: function(cm) {\n deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos };\n });\n },\n undo: function(cm) {cm.undo();},\n redo: function(cm) {cm.redo();},\n undoSelection: function(cm) {cm.undoSelection();},\n redoSelection: function(cm) {cm.redoSelection();},\n goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},\n goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},\n goLineStart: function(cm) {\n cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1});\n },\n goLineStartSmart: function(cm) {\n cm.extendSelectionsBy(function(range) {\n return lineStartSmart(cm, range.head);\n }, {origin: \"+move\", bias: 1});\n },\n goLineEnd: function(cm) {\n cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1});\n },\n goLineRight: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n }, sel_move);\n },\n goLineLeft: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\");\n }, sel_move);\n },\n goLineLeftSmart: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) return lineStartSmart(cm, range.head);\n return pos;\n }, sel_move);\n },\n goLineUp: function(cm) {cm.moveV(-1, \"line\");},\n goLineDown: function(cm) {cm.moveV(1, \"line\");},\n goPageUp: function(cm) {cm.moveV(-1, \"page\");},\n goPageDown: function(cm) {cm.moveV(1, \"page\");},\n goCharLeft: function(cm) {cm.moveH(-1, \"char\");},\n goCharRight: function(cm) {cm.moveH(1, \"char\");},\n goColumnLeft: function(cm) {cm.moveH(-1, \"column\");},\n goColumnRight: function(cm) {cm.moveH(1, \"column\");},\n goWordLeft: function(cm) {cm.moveH(-1, \"word\");},\n goGroupRight: function(cm) {cm.moveH(1, \"group\");},\n goGroupLeft: function(cm) {cm.moveH(-1, \"group\");},\n goWordRight: function(cm) {cm.moveH(1, \"word\");},\n delCharBefore: function(cm) {cm.deleteH(-1, \"char\");},\n delCharAfter: function(cm) {cm.deleteH(1, \"char\");},\n delWordBefore: function(cm) {cm.deleteH(-1, \"word\");},\n delWordAfter: function(cm) {cm.deleteH(1, \"word\");},\n delGroupBefore: function(cm) {cm.deleteH(-1, \"group\");},\n delGroupAfter: function(cm) {cm.deleteH(1, \"group\");},\n indentAuto: function(cm) {cm.indentSelection(\"smart\");},\n indentMore: function(cm) {cm.indentSelection(\"add\");},\n indentLess: function(cm) {cm.indentSelection(\"subtract\");},\n insertTab: function(cm) {cm.replaceSelection(\"\\t\");},\n insertSoftTab: function(cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(new Array(tabSize - col % tabSize + 1).join(\" \"));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function(cm) {\n if (cm.somethingSelected()) cm.indentSelection(\"add\");\n else cm.execCommand(\"insertTab\");\n },\n transposeChars: function(cm) {\n runInOp(cm, function() {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1);\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev)\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), \"+transpose\");\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n });\n },\n newlineAndIndent: function(cm) {\n runInOp(cm, function() {\n var len = cm.listSelections().length;\n for (var i = 0; i < len; i++) {\n var range = cm.listSelections()[i];\n cm.replaceRange(cm.doc.lineSeparator(), range.anchor, range.head, \"+input\");\n cm.indentLine(range.from().line + 1, null, true);\n }\n ensureCursorVisible(cm);\n });\n },\n toggleOverwrite: function(cm) {cm.toggleOverwrite();}\n };\n\n\n // STANDARD KEYMAPS\n\n var keyMap = CodeMirror.keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n fallthrough: \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n fallthrough: [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/), name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) cmd = true;\n else if (/^a(lt)?$/i.test(mod)) alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;\n else if (/^s(hift)$/i.test(mod)) shift = true;\n else throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt) name = \"Alt-\" + name;\n if (ctrl) name = \"Ctrl-\" + name;\n if (cmd) name = \"Cmd-\" + name;\n if (shift) name = \"Shift-\" + name;\n return name;\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n CodeMirror.normalizeKeyMap = function(keymap) {\n var copy = {};\n for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue;\n if (value == \"...\") { delete keymap[keyname]; continue; }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val, name;\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) copy[name] = val;\n else if (prev != val) throw new Error(\"Inconsistent bindings for \" + name);\n }\n delete keymap[keyname];\n }\n for (var prop in copy) keymap[prop] = copy[prop];\n return keymap;\n };\n\n var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) return \"nothing\";\n if (found === \"...\") return \"multi\";\n if (found != null && handle(found)) return \"handled\";\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n return lookupKey(key, map.fallthrough, handle, context);\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) return result;\n }\n }\n };\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n var isModifierKey = CodeMirror.isModifierKey = function(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\";\n };\n\n // Look up the name of a key as indicated by an event object.\n var keyName = CodeMirror.keyName = function(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) return false;\n var base = keyNames[event.keyCode], name = base;\n if (name == null || event.altGraphKey) return false;\n if (event.altKey && base != \"Alt\") name = \"Alt-\" + name;\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") name = \"Ctrl-\" + name;\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") name = \"Cmd-\" + name;\n if (!noShift && event.shiftKey && base != \"Shift\") name = \"Shift-\" + name;\n return name;\n };\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val;\n }\n\n // FROMTEXTAREA\n\n CodeMirror.fromTextArea = function(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n options.tabindex = textarea.tabIndex;\n if (!options.placeholder && textarea.placeholder)\n options.placeholder = textarea.placeholder;\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form, realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function() {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function(cm) {\n cm.save = save;\n cm.getTextArea = function() { return textarea; };\n cm.toTextArea = function() {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (typeof textarea.form.submit == \"function\")\n textarea.form.submit = realSubmit;\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function(node) {\n textarea.parentNode.insertBefore(node, textarea.nextSibling);\n }, options);\n return cm;\n };\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = CodeMirror.StringStream = function(string, tabSize) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n };\n\n StringStream.prototype = {\n eol: function() {return this.pos >= this.string.length;},\n sol: function() {return this.pos == this.lineStart;},\n peek: function() {return this.string.charAt(this.pos) || undefined;},\n next: function() {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n },\n eat: function(match) {\n var ch = this.string.charAt(this.pos);\n if (typeof match == \"string\") var ok = ch == match;\n else var ok = ch && (match.test ? match.test(ch) : match(ch));\n if (ok) {++this.pos; return ch;}\n },\n eatWhile: function(match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start;\n },\n eatSpace: function() {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;\n return this.pos > start;\n },\n skipToEnd: function() {this.pos = this.string.length;},\n skipTo: function(ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true;}\n },\n backUp: function(n) {this.pos -= n;},\n column: function() {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n },\n indentation: function() {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n },\n match: function(pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) this.pos += pattern.length;\n return true;\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) return null;\n if (match && consume !== false) this.pos += match[0].length;\n return match;\n }\n },\n current: function(){return this.string.slice(this.start, this.pos);},\n hideFirstChars: function(n, inner) {\n this.lineStart += n;\n try { return inner(); }\n finally { this.lineStart -= n; }\n }\n };\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n var nextMarkerId = 0;\n\n var TextMarker = CodeMirror.TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n eventMixin(TextMarker);\n\n // Clear the marker.\n TextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) return;\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) startOperation(cm);\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) signalLater(this, \"clear\", found.from, found.to);\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) regLineChange(cm, lineNo(line), \"text\");\n else if (cm) {\n if (span.to != null) max = lineNo(line);\n if (span.from != null) min = lineNo(line);\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n updateLineHeight(line, textHeight(cm.display));\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {\n var visual = visualLine(this.lines[i]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n }\n\n if (min != null && cm && this.collapsed) regChange(cm, min, max + 1);\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) reCheckSelection(cm.doc);\n }\n if (cm) signalLater(cm, \"markerCleared\", cm, this);\n if (withOp) endOperation(cm);\n if (this.parent) this.parent.clear();\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function(side, lineObj) {\n if (side == null && this.type == \"bookmark\") side = 1;\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) return from;\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) return to;\n }\n }\n return from && {from: from, to: to};\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function() {\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) return;\n runInOp(cm, function() {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n updateLineHeight(line, line.height + dHeight);\n }\n });\n };\n\n TextMarker.prototype.attachLine = function(line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);\n }\n this.lines.push(line);\n };\n TextMarker.prototype.detachLine = function(line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) return markTextShared(doc, from, to, options, type);\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) copyObj(options, marker, false);\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n return marker;\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = elt(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\");\n if (options.insertLeft) marker.widgetNode.insertLeft = true;\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n throw new Error(\"Inserting collapsed marker partially overlapping an existing one\");\n sawCollapsedSpans = true;\n }\n\n if (marker.addToHistory)\n addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN);\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function(line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n updateMaxLine = true;\n if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {\n if (lineIsHidden(doc, line)) updateLineHeight(line, 0);\n });\n\n if (marker.clearOnEnter) on(marker, \"beforeCursorEnter\", function() { marker.clear(); });\n\n if (marker.readOnly) {\n sawReadOnlySpans = true;\n if (doc.history.done.length || doc.history.undone.length)\n doc.clearHistory();\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) cm.curOp.updateMaxLine = true;\n if (marker.collapsed)\n regChange(cm, from.line, to.line + 1);\n else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)\n for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, \"text\");\n if (marker.atomic) reCheckSelection(cm.doc);\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker;\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n markers[i].parent = this;\n };\n eventMixin(SharedTextMarker);\n\n SharedTextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) return;\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n this.markers[i].clear();\n signalLater(this, \"clear\");\n };\n SharedTextMarker.prototype.find = function(side, lineObj) {\n return this.primary.find(side, lineObj);\n };\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function(doc) {\n if (widget) options.widgetNode = widget.cloneNode(true);\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n if (doc.linked[i].isParent) return;\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary);\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())),\n function(m) { return m.parent; });\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], linked = [marker.primary.doc];;\n linkedDocs(marker.primary.doc, function(d) { linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n }\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n if (old) for (var i = 0, nw; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n }\n return nw;\n }\n function markedSpansAfter(old, endCh, isInsert) {\n if (old) for (var i = 0, nw; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n }\n return nw;\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) return null;\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) return null;\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) span.to = startCh;\n else if (sameLine) span.to = found.to == null ? null : found.to + offset;\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i = 0; i < last.length; ++i) {\n var span = last[i];\n if (span.to != null) span.to += offset;\n if (span.from == null) {\n var found = getMarkedSpanFor(first, span.marker);\n if (!found) {\n span.from = offset;\n if (sameLine) (first || (first = [])).push(span);\n }\n } else {\n span.from += offset;\n if (sameLine) (first || (first = [])).push(span);\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) first = clearEmptySpans(first);\n if (last && last != first) last = clearEmptySpans(last);\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n for (var i = 0; i < first.length; ++i)\n if (first[i].to == null)\n (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null));\n for (var i = 0; i < gap; ++i)\n newMarkers.push(gapMarkers);\n newMarkers.push(last);\n }\n return newMarkers;\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n spans.splice(i--, 1);\n }\n if (!spans.length) return null;\n return spans;\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) return stretched;\n if (!stretched) return old;\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n if (oldCur[k].marker == span.marker) continue spans;\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old;\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function(line) {\n if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n (markers || (markers = [])).push(mark);\n }\n });\n if (!markers) return null;\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue;\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n newParts.push({from: p.from, to: m.from});\n if (dto > 0 || !mk.inclusiveRight && !dto)\n newParts.push({from: m.to, to: p.to});\n parts.splice.apply(parts, newParts);\n j += newParts.length - 1;\n }\n }\n return parts;\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.attachLine(line);\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) return lenDiff;\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) return -fromCmp;\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) return toCmp;\n return b.id - a.id;\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n found = sp.marker;\n }\n return found;\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) continue;\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;\n if (fromCmp <= 0 && (cmp(found.to, from) > 0 || (sp.marker.inclusiveRight && marker.inclusiveLeft)) ||\n fromCmp >= 0 && (cmp(found.from, to) < 0 || (sp.marker.inclusiveLeft && marker.inclusiveRight)))\n return true;\n }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n return lines;\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) return lineN;\n return lineNo(vis);\n }\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) continue;\n if (sp.from == null) return true;\n if (sp.marker.widgetNode) continue;\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n return true;\n }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n return true;\n for (var sp, i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) return true;\n }\n }\n\n // LINE WIDGETS\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = CodeMirror.LineWidget = function(doc, node, options) {\n if (options) for (var opt in options) if (options.hasOwnProperty(opt))\n this[opt] = options[opt];\n this.doc = doc;\n this.node = node;\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n addToScrollPos(cm, null, diff);\n }\n\n LineWidget.prototype.clear = function() {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) return;\n for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);\n if (!ws.length) line.widgets = null;\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) runInOp(cm, function() {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n };\n LineWidget.prototype.changed = function() {\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) return;\n updateLineHeight(line, line.height + diff);\n if (cm) runInOp(cm, function() {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n });\n };\n\n function widgetHeight(widget) {\n if (widget.height != null) return widget.height;\n var cm = widget.doc.cm;\n if (!cm) return 0;\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\";\n if (widget.noHScroll)\n parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\";\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight;\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) cm.display.alignWidgets = true;\n changeLine(doc, handle, \"widget\", function(line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) widgets.push(widget);\n else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) addToScrollPos(cm, null, widget.height);\n cm.curOp.forceUpdate = true;\n }\n return true;\n });\n return widget;\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n eventMixin(Line);\n Line.prototype.lineNo = function() { return lineNo(this); };\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n function extractLineClasses(type, output) {\n if (type) for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) break;\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n output[prop] = lineClass[2];\n else if (!(new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\")).test(output[prop]))\n output[prop] += \" \" + lineClass[2];\n }\n return type;\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) return mode.blankLine(state);\n if (!mode.innerMode) return;\n var inner = CodeMirror.innerMode(mode, state);\n if (inner.mode.blankLine) return inner.mode.blankLine(inner.state);\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode;\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) return style;\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\");\n }\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n function getObj(copy) {\n return {start: stream.start, end: stream.pos,\n string: stream.current(),\n type: style || null,\n state: copy ? copyState(doc.mode, state) : state};\n }\n\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize), tokens;\n if (asArray) tokens = [];\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, state);\n if (asArray) tokens.push(getObj(true));\n }\n return asArray ? tokens : getObj();\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") extractLineClasses(callBlankLine(mode, state), lineClasses);\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) processLine(cm, text, state, stream.pos);\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) style = \"m-\" + (style ? mName + \" \" + style : mName);\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 50000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444 characters\n var pos = Math.min(stream.pos, curStart + 50000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var state = getStateBefore(cm, lineNo(line));\n var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);\n line.stateAfter = state;\n line.styles = result.styles;\n if (result.classes) line.styleClasses = result.classes;\n else if (line.styleClasses) line.styleClasses = null;\n if (updateFrontier === cm.doc.frontier) cm.doc.frontier++;\n }\n return line.styles;\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, state, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") callBlankLine(mode, state);\n while (!stream.eol()) {\n readToken(mode, stream, state);\n stream.start = stream.pos;\n }\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) return null;\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"));\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token;\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }\n\n function splitSpaces(old) {\n var out = \" \";\n for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? \" \" : \"\\u00a0\";\n out += \" \";\n return out;\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function(builder, text, style, startStyle, endStyle, title, css) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n for (var i = 0; i < order.length; i++) {\n var part = order[i];\n if (part.to > start && part.from <= start) break;\n }\n if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css);\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n };\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) builder.map.push(builder.pos, builder.pos + size, widget);\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n widget = builder.content.appendChild(document.createElement(\"span\"));\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n if (collapsed.to == pos) collapsed = false;\n }\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length; },\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) lines[i].parent = this;\n },\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n if (op(this.lines[at])) return true;\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size; },\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) break;\n at = 0;\n } else at -= sz;\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines);\n },\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n while (child.lines.length > 50) {\n var spilled = child.lines.splice(child.lines.length - 25, 25);\n var newleaf = new LeafChunk(spilled);\n child.height -= newleaf.height;\n this.children.splice(i + 1, 0, newleaf);\n newleaf.parent = this;\n }\n this.maybeSpill();\n }\n break;\n }\n at -= sz;\n }\n },\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) return;\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10);\n me.parent.maybeSpill();\n },\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) return true;\n if ((n -= used) == 0) break;\n at = 0;\n } else at -= sz;\n }\n }\n };\n\n var nextDocId = 0;\n var Doc = CodeMirror.Doc = function(text, mode, firstLine, lineSep) {\n if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep);\n if (firstLine == null) firstLine = 0;\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.frontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.extend = false;\n\n if (typeof text == \"string\") text = this.splitLines(text);\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) this.iterN(from - this.first, to - from, op);\n else this.iterN(this.first, this.first + this.size, from);\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) height += lines[i].height;\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) return lines;\n return lines.join(lineSep || this.lineSeparator());\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n setSelection(this, simpleSelection(top));\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) return lines;\n return lines.join(lineSep || this.lineSeparator());\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},\n\n getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},\n getLineNumber: function(line) {return lineNo(line);},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") line = getLine(this, line);\n return visualLine(line);\n },\n\n lineCount: function() {return this.size;},\n firstLine: function() {return this.first;},\n lastLine: function() {return this.first + this.size - 1;},\n\n clipPos: function(pos) {return clipPos(this, pos);},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") pos = range.head;\n else if (start == \"anchor\") pos = range.anchor;\n else if (start == \"end\" || start == \"to\" || start === false) pos = range.to();\n else pos = range.from();\n return pos;\n },\n listSelections: function() { return this.sel.ranges; },\n somethingSelected: function() {return this.sel.somethingSelected();},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) return;\n for (var i = 0, out = []; i < ranges.length; i++)\n out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head));\n if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex);\n setSelection(this, normalizeSelection(out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) return lines;\n else return lines.join(lineSep || this.lineSeparator());\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator());\n parts[i] = sel;\n }\n return parts;\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n dup[i] = code;\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i = changes.length - 1; i >= 0; i--)\n makeChange(this, changes[i]);\n if (newSel) setSelectionReplaceHistory(this, newSel);\n else if (this.cm) ensureCursorVisible(this.cm);\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend;},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done;\n for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone;\n return {undo: done, redo: undone};\n },\n clearHistory: function() {this.history = new History(this.history.maxGeneration);},\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;\n return this.history.generation;\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration);\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)};\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) line[prop] = cls;\n else if (classTest(cls).test(line[prop])) return false;\n else line[prop] += \" \" + cls;\n return true;\n });\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) return false;\n else if (cls == null) line[prop] = null;\n else {\n var found = cur.match(classTest(cls));\n if (!found) return false;\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true;\n });\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options);\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\");\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\");\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n markers.push(span.marker.parent || span.marker);\n }\n return markers;\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function(line) {\n var spans = line.markedSpans;\n if (spans) for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch > span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from > to.ch) &&\n (!filter || filter(span.marker)))\n found.push(span.marker.parent || span.marker);\n }\n ++lineNo;\n });\n return found;\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function(line) {\n var sps = line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i)\n if (sps[i].from != null) markers.push(sps[i].marker);\n });\n return markers;\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first;\n this.iter(function(line) {\n var sz = line.text.length + 1;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch));\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) return 0;\n this.iter(this.first, coords.line, function (line) {\n index += line.text.length + 1;\n });\n return index;\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc;\n },\n\n linkedDoc: function(options) {\n if (!options) options = {};\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) from = options.from;\n if (options.to != null && options.to < to) to = options.to;\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep);\n if (options.sharedHist) copy.history = this.history;\n (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy;\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) other = other.doc;\n if (this.linked) for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) continue;\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break;\n }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode;},\n getEditor: function() {return this.cm;},\n\n splitLines: function(str) {\n if (this.lineSep) return str.split(this.lineSep);\n return splitLinesAuto(str);\n },\n lineSeparator: function() { return this.lineSep || \"\\n\"; }\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments);};\n })(Doc.prototype[prop]);\n\n eventMixin(Doc);\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n // LINE UTILITIES\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function(line) {\n var text = line.text;\n if (n == end.line) text = text.slice(0, end.ch);\n if (n == start.line) text = text.slice(start.ch);\n out.push(text);\n ++n;\n });\n return out;\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) return null;\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) break;\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first;\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i = 0; i < chunk.children.length; ++i) {\n var child = chunk.children[i], ch = child.height;\n if (h < ch) { chunk = child; continue outer; }\n h -= ch;\n n += child.chunkSize();\n }\n return n;\n } while (!chunk.lines);\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) break;\n h -= lh;\n }\n return n + i;\n }\n\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line) {\n var order = line.order;\n if (order == null) order = line.order = bidiOrdering(line.text);\n return order;\n }\n\n // HISTORY\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, ore are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n dest.push(sel);\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // EVENT UTILITIES\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n var e_preventDefault = CodeMirror.e_preventDefault = function(e) {\n if (e.preventDefault) e.preventDefault();\n else e.returnValue = false;\n };\n var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {\n if (e.stopPropagation) e.stopPropagation();\n else e.cancelBubble = true;\n };\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;\n }\n var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};\n\n function e_target(e) {return e.target || e.srcElement;}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) b = 1;\n else if (e.button & 2) b = 3;\n else if (e.button & 4) b = 2;\n }\n if (mac && e.ctrlKey && b == 1) b = 3;\n return b;\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var on = CodeMirror.on = function(emitter, type, f) {\n if (emitter.addEventListener)\n emitter.addEventListener(type, f, false);\n else if (emitter.attachEvent)\n emitter.attachEvent(\"on\" + type, f);\n else {\n var map = emitter._handlers || (emitter._handlers = {});\n var arr = map[type] || (map[type] = []);\n arr.push(f);\n }\n };\n\n var noHandlers = []\n function getHandlers(emitter, type, copy) {\n var arr = emitter._handlers && emitter._handlers[type]\n if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers\n else return arr || noHandlers\n }\n\n var off = CodeMirror.off = function(emitter, type, f) {\n if (emitter.removeEventListener)\n emitter.removeEventListener(type, f, false);\n else if (emitter.detachEvent)\n emitter.detachEvent(\"on\" + type, f);\n else {\n var handlers = getHandlers(emitter, type, false)\n for (var i = 0; i < handlers.length; ++i)\n if (handlers[i] == f) { handlers.splice(i, 1); break; }\n }\n };\n\n var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type, true)\n if (!handlers.length) return;\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args);\n };\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type, false)\n if (!arr.length) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) delayed[i]();\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore;\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) return;\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)\n set.push(arr[i]);\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // MISC UTILITIES\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 30;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = CodeMirror.Pass = {toString: function(){return \"CodeMirror.Pass\";}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n function Delayed() {this.id = null;}\n Delayed.prototype.set = function(ms, f) {\n clearTimeout(this.id);\n this.id = setTimeout(f, ms);\n };\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) end = string.length;\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n return n + (end - i);\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n };\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) nextTab = string.length;\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n return pos + Math.min(skipped, goal - col);\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) return pos;\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n spaceStrs.push(lst(spaceStrs) + \" \");\n return spaceStrs[n];\n }\n\n function lst(arr) { return arr[arr.length-1]; }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };\n else if (ie) // Suppress mysterious IE10 errors\n selectInput = function(node) { try { node.select(); } catch(_e) {} };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n if (array[i] == elt) return i;\n return -1;\n }\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);\n return out;\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) copyObj(props, inst);\n return inst;\n };\n\n function copyObj(obj, target, overwrite) {\n if (!target) target = {};\n for (var prop in obj)\n if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n target[prop] = obj[prop];\n return target;\n }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args);};\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n var isWordCharBasic = CodeMirror.isWordChar = function(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));\n };\n function isWordChar(ch, helper) {\n if (!helper) return isWordCharBasic(ch);\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) return true;\n return helper.test(ch);\n }\n\n function isEmpty(obj) {\n for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;\n return true;\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n 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]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }\n\n // DOM UTILITIES\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) e.className = className;\n if (style) e.style.cssText = style;\n if (typeof content == \"string\") e.appendChild(document.createTextNode(content));\n else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);\n return e;\n }\n\n var range;\n if (document.createRange) range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r;\n };\n else range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r; }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r;\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n e.removeChild(e.firstChild);\n return e;\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e);\n }\n\n var contains = CodeMirror.contains = function(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n child = child.parentNode;\n if (parent.contains)\n return parent.contains(child);\n do {\n if (child.nodeType == 11) child = child.host;\n if (child == parent) return true;\n } while (child = child.parentNode);\n };\n\n function activeElt() {\n var activeElement = document.activeElement;\n while (activeElement && activeElement.root && activeElement.root.activeElement)\n activeElement = activeElement.root.activeElement;\n return activeElement;\n }\n // Older versions of IE throws unspecified error when touching\n // document.activeElement in some cases (during loading, in iframe)\n if (ie && ie_version < 11) activeElt = function() {\n try { return document.activeElement; }\n catch(e) { return document.body; }\n };\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\"); }\n var rmClass = CodeMirror.rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n var addClass = CodeMirror.addClass = function(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) node.className += (current ? \" \" : \"\") + cls;\n };\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n if (as[i] && !classTest(as[i]).test(b)) b += \" \" + as[i];\n return b;\n }\n\n // WINDOW-WIDE EVENTS\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.body.getElementsByClassName) return;\n var byClass = document.body.getElementsByClassName(\"CodeMirror\");\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) f(cm);\n }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) return;\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function() {\n if (resizeTimer == null) resizeTimer = setTimeout(function() {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100);\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function() {\n forEachCodeMirror(onBlur);\n });\n }\n\n // FEATURE DETECTION\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) return false;\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div;\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node;\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) return badBidiRects;\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n return badBidiRects = (r1.right - r0.right < 3);\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = CodeMirror.splitLines = \"\\n\\nb\".split(/\\n/).length != 3 ? function(string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) nl = string.length;\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result;\n } : function(string){return string.split(/\\r\\n?|\\n/);};\n\n var hasSelection = window.getSelection ? function(te) {\n try { return te.selectionStart != te.selectionEnd; }\n catch(e) { return false; }\n } : function(te) {\n try {var range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) return false;\n return range.compareEndPoints(\"StartToEnd\", range) != 0;\n };\n\n var hasCopyEvent = (function() {\n var e = elt(\"div\");\n if (\"oncopy\" in e) return true;\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\";\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) return badZoomedRects;\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;\n }\n\n // KEY NAMES\n\n var keyNames = CodeMirror.keyNames = {\n 3: \"Enter\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 127: \"Delete\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n (function() {\n // Number keys\n for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);\n // Alphabetic keys\n for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);\n // Function keys\n for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = \"F\" + i;\n })();\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) return f(from, to, \"ltr\");\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\");\n found = true;\n }\n }\n if (!found) f(from, to, \"ltr\");\n }\n\n function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }\n function bidiRight(part) { return part.level % 2 ? part.from : part.to; }\n\n function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }\n function lineRight(line) {\n var order = getOrder(line);\n if (!order) return line.text.length;\n return bidiRight(lst(order));\n }\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) lineN = lineNo(visual);\n var order = getOrder(visual);\n var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);\n return Pos(lineN, ch);\n }\n function lineEnd(cm, lineN) {\n var merged, line = getLine(cm.doc, lineN);\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n lineN = null;\n }\n var order = getOrder(line);\n var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);\n return Pos(lineN == null ? lineNo(line) : lineN, ch);\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(0, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS);\n }\n return start;\n }\n\n function compareBidiLevel(order, a, b) {\n var linedir = order[0].level;\n if (a == linedir) return true;\n if (b == linedir) return false;\n return a < b;\n }\n var bidiOther;\n function getBidiPartAt(order, pos) {\n bidiOther = null;\n for (var i = 0, found; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < pos && cur.to > pos) return i;\n if ((cur.from == pos || cur.to == pos)) {\n if (found == null) {\n found = i;\n } else if (compareBidiLevel(order, cur.level, order[found].level)) {\n if (cur.from != cur.to) bidiOther = found;\n return i;\n } else {\n if (cur.from != cur.to) bidiOther = i;\n return found;\n }\n }\n }\n return found;\n }\n\n function moveInLine(line, pos, dir, byUnit) {\n if (!byUnit) return pos + dir;\n do pos += dir;\n while (pos > 0 && isExtendingChar(line.text.charAt(pos)));\n return pos;\n }\n\n // This is needed in order to move 'visually' through bi-directional\n // text -- i.e., pressing left should make the cursor go left, even\n // when in RTL text. The tricky part is the 'jumps', where RTL and\n // LTR text touch each other. This often requires the cursor offset\n // to move more than one unit, in order to visually move one unit.\n function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }\n\n function moveLogically(line, start, dir, byUnit) {\n var target = start + dir;\n if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;\n return target < 0 || target > line.text.length ? null : target;\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6ff\n var arabicTypes = \"rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm\";\n function charType(code) {\n if (code <= 0xf7) return lowTypes.charAt(code);\n else if (0x590 <= code && code <= 0x5f4) return \"R\";\n else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);\n else if (0x6ee <= code && code <= 0x8ac) return \"r\";\n else if (0x2000 <= code && code <= 0x200b) return \"w\";\n else if (code == 0x200c) return \"b\";\n else return \"L\";\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n // Browsers seem to always treat the boundaries of block elements as being L.\n var outerType = \"L\";\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str) {\n if (!bidiRE.test(str)) return false;\n var len = str.length, types = [];\n for (var i = 0, type; i < len; ++i)\n types.push(type = charType(str.charCodeAt(i)));\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i = 0, prev = outerType; i < len; ++i) {\n var type = types[i];\n if (type == \"m\") types[i] = prev;\n else prev = type;\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i = 0, cur = outerType; i < len; ++i) {\n var type = types[i];\n if (type == \"1\" && cur == \"r\") types[i] = \"n\";\n else if (isStrong.test(type)) { cur = type; if (type == \"r\") types[i] = \"R\"; }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i = 1, prev = types[0]; i < len - 1; ++i) {\n var type = types[i];\n if (type == \"+\" && prev == \"1\" && types[i+1] == \"1\") types[i] = \"1\";\n else if (type == \",\" && prev == types[i+1] &&\n (prev == \"1\" || prev == \"n\")) types[i] = prev;\n prev = type;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i = 0; i < len; ++i) {\n var type = types[i];\n if (type == \",\") types[i] = \"N\";\n else if (type == \"%\") {\n for (var end = i + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i && types[i-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i; j < end; ++j) types[j] = replace;\n i = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i = 0, cur = outerType; i < len; ++i) {\n var type = types[i];\n if (cur == \"L\" && type == \"1\") types[i] = \"L\";\n else if (isStrong.test(type)) cur = type;\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i = 0; i < len; ++i) {\n if (isNeutral.test(types[i])) {\n for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}\n var before = (i ? types[i-1] : outerType) == \"L\";\n var after = (end < len ? types[end] : outerType) == \"L\";\n var replace = before || after ? \"L\" : \"R\";\n for (var j = i; j < end; ++j) types[j] = replace;\n i = end - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i = 0; i < len;) {\n if (countsAsLeft.test(types[i])) {\n var start = i;\n for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}\n order.push(new BidiSpan(0, start, i));\n } else {\n var pos = i, at = order.length;\n for (++i; i < len && types[i] != \"L\"; ++i) {}\n for (var j = pos; j < i;) {\n if (countsAsNum.test(types[j])) {\n if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));\n var nstart = j;\n for (++j; j < i && countsAsNum.test(types[j]); ++j) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j));\n pos = j;\n } else ++j;\n }\n if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));\n }\n }\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n if (order[0].level == 2)\n order.unshift(new BidiSpan(1, order[0].to, order[0].to));\n if (order[0].level != lst(order).level)\n order.push(new BidiSpan(order[0].level, len, len));\n\n return order;\n };\n })();\n\n // THE END\n\n CodeMirror.version = \"5.13.2\";\n\n return CodeMirror;\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/lib/codemirror.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/lib/codemirror.css": {
"text": "/* BASICS */\n\n.CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-family: monospace;\n height: 300px;\n color: black;\n}\n\n/* PADDING */\n\n.CodeMirror-lines {\n padding: 4px 0; /* Vertical padding around content */\n}\n.CodeMirror pre {\n padding: 0 4px; /* Horizontal padding of content */\n}\n\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n background-color: white; /* The little square between H and V scrollbars */\n}\n\n/* GUTTER */\n\n.CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n}\n.CodeMirror-linenumbers {}\n.CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n}\n\n.CodeMirror-guttermarker { color: black; }\n.CodeMirror-guttermarker-subtle { color: #999; }\n\n/* CURSOR */\n\n.CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n}\n/* Shown when moving in bi-directional text */\n.CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n}\n.cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0;\n background: #7e7;\n}\n.cm-fat-cursor div.CodeMirror-cursors {\n z-index: 1;\n}\n\n.cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n}\n@-moz-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@-webkit-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n\n/* Can style cursor different in overwrite (non-insert) mode */\n.CodeMirror-overwrite .CodeMirror-cursor {}\n\n.cm-tab { display: inline-block; text-decoration: inherit; }\n\n.CodeMirror-ruler {\n border-left: 1px solid #ccc;\n position: absolute;\n}\n\n/* DEFAULT THEME */\n\n.cm-s-default .cm-header {color: blue;}\n.cm-s-default .cm-quote {color: #090;}\n.cm-negative {color: #d44;}\n.cm-positive {color: #292;}\n.cm-header, .cm-strong {font-weight: bold;}\n.cm-em {font-style: italic;}\n.cm-link {text-decoration: underline;}\n.cm-strikethrough {text-decoration: line-through;}\n\n.cm-s-default .cm-keyword {color: #708;}\n.cm-s-default .cm-atom {color: #219;}\n.cm-s-default .cm-number {color: #164;}\n.cm-s-default .cm-def {color: #00f;}\n.cm-s-default .cm-variable,\n.cm-s-default .cm-punctuation,\n.cm-s-default .cm-property,\n.cm-s-default .cm-operator {}\n.cm-s-default .cm-variable-2 {color: #05a;}\n.cm-s-default .cm-variable-3 {color: #085;}\n.cm-s-default .cm-comment {color: #a50;}\n.cm-s-default .cm-string {color: #a11;}\n.cm-s-default .cm-string-2 {color: #f50;}\n.cm-s-default .cm-meta {color: #555;}\n.cm-s-default .cm-qualifier {color: #555;}\n.cm-s-default .cm-builtin {color: #30a;}\n.cm-s-default .cm-bracket {color: #997;}\n.cm-s-default .cm-tag {color: #170;}\n.cm-s-default .cm-attribute {color: #00c;}\n.cm-s-default .cm-hr {color: #999;}\n.cm-s-default .cm-link {color: #00c;}\n\n.cm-s-default .cm-error {color: #f00;}\n.cm-invalidchar {color: #f00;}\n\n.CodeMirror-composing { border-bottom: 2px solid; }\n\n/* Default styles for common addons */\n\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n.CodeMirror-activeline-background {background: #e8f2ff;}\n\n/* STOP */\n\n/* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n.CodeMirror {\n position: relative;\n overflow: hidden;\n background: white;\n}\n\n.CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 30px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -30px; margin-right: -30px;\n padding-bottom: 30px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n}\n.CodeMirror-sizer {\n position: relative;\n border-right: 30px solid transparent;\n}\n\n/* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 6;\n display: none;\n}\n.CodeMirror-vscrollbar {\n right: 0; top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n}\n.CodeMirror-hscrollbar {\n bottom: 0; left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n}\n.CodeMirror-scrollbar-filler {\n right: 0; bottom: 0;\n}\n.CodeMirror-gutter-filler {\n left: 0; bottom: 0;\n}\n\n.CodeMirror-gutters {\n position: absolute; left: 0; top: 0;\n min-height: 100%;\n z-index: 3;\n}\n.CodeMirror-gutter {\n white-space: normal;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n margin-bottom: -30px;\n /* Hack to make IE7 behave */\n *zoom:1;\n *display:inline;\n}\n.CodeMirror-gutter-wrapper {\n position: absolute;\n z-index: 4;\n background: none !important;\n border: none !important;\n}\n.CodeMirror-gutter-background {\n position: absolute;\n top: 0; bottom: 0;\n z-index: 4;\n}\n.CodeMirror-gutter-elt {\n position: absolute;\n cursor: default;\n z-index: 4;\n}\n.CodeMirror-gutter-wrapper {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n}\n.CodeMirror pre {\n /* Reset some styles that the rest of the page might have set */\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: inherit;\n color: inherit;\n z-index: 2;\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n.CodeMirror-wrap pre {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: normal;\n}\n\n.CodeMirror-linebackground {\n position: absolute;\n left: 0; right: 0; top: 0; bottom: 0;\n z-index: 0;\n}\n\n.CodeMirror-linewidget {\n position: relative;\n z-index: 2;\n overflow: auto;\n}\n\n.CodeMirror-widget {}\n\n.CodeMirror-code {\n outline: none;\n}\n\n/* Force content-box sizing for the elements where we expect it */\n.CodeMirror-scroll,\n.CodeMirror-sizer,\n.CodeMirror-gutter,\n.CodeMirror-gutters,\n.CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\n.CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n}\n\n.CodeMirror-cursor { position: absolute; }\n.CodeMirror-measure pre { position: static; }\n\ndiv.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n z-index: 3;\n}\ndiv.CodeMirror-dragcursors {\n visibility: visible;\n}\n\n.CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n}\n\n.CodeMirror-selected { background: #d9d9d9; }\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n.CodeMirror-crosshair { cursor: crosshair; }\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n\n.cm-searching {\n background: #ffa;\n background: rgba(255, 255, 0, .4);\n}\n\n/* IE7 hack to prevent it from returning funny offsetTops on the spans */\n.CodeMirror span { *vertical-align: text-bottom; }\n\n/* Used to force a border model for a node */\n.cm-force-border { padding-right: .1px; }\n\n@media print {\n /* Hide the cursor when printing */\n .CodeMirror div.CodeMirror-cursors {\n visibility: hidden;\n }\n}\n\n/* See issue #2901 */\n.cm-tab-wrap-hack:after { content: ''; }\n\n/* Help users use markselection to safely style text background */\nspan.CodeMirror-selectedtext { background: none; }\n",
"type": "text/css",
"title": "$:/plugins/tiddlywiki/codemirror/lib/codemirror.css",
"tags": "[[$:/tags/Stylesheet]]"
},
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.css": {
"text": ".CodeMirror-dialog {\n position: absolute;\n left: 0; right: 0;\n background: inherit;\n z-index: 15;\n padding: .1em .8em;\n overflow: hidden;\n color: inherit;\n}\n\n.CodeMirror-dialog-top {\n border-bottom: 1px solid #eee;\n top: 0;\n}\n\n.CodeMirror-dialog-bottom {\n border-top: 1px solid #eee;\n bottom: 0;\n}\n\n.CodeMirror-dialog input {\n border: none;\n outline: none;\n background: transparent;\n width: 20em;\n color: inherit;\n font-family: monospace;\n}\n\n.CodeMirror-dialog button {\n font-size: 70%;\n}\n",
"type": "text/css",
"title": "$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.css",
"tags": "[[$:/tags/Stylesheet]]"
},
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// Open simple dialogs on top of an editor. Relies on dialog.css.\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n function dialogDiv(cm, template, bottom) {\n var wrap = cm.getWrapperElement();\n var dialog;\n dialog = wrap.appendChild(document.createElement(\"div\"));\n if (bottom)\n dialog.className = \"CodeMirror-dialog CodeMirror-dialog-bottom\";\n else\n dialog.className = \"CodeMirror-dialog CodeMirror-dialog-top\";\n\n if (typeof template == \"string\") {\n dialog.innerHTML = template;\n } else { // Assuming it's a detached DOM element.\n dialog.appendChild(template);\n }\n return dialog;\n }\n\n function closeNotification(cm, newVal) {\n if (cm.state.currentNotificationClose)\n cm.state.currentNotificationClose();\n cm.state.currentNotificationClose = newVal;\n }\n\n CodeMirror.defineExtension(\"openDialog\", function(template, callback, options) {\n if (!options) options = {};\n\n closeNotification(this, null);\n\n var dialog = dialogDiv(this, template, options.bottom);\n var closed = false, me = this;\n function close(newVal) {\n if (typeof newVal == 'string') {\n inp.value = newVal;\n } else {\n if (closed) return;\n closed = true;\n dialog.parentNode.removeChild(dialog);\n me.focus();\n\n if (options.onClose) options.onClose(dialog);\n }\n }\n\n var inp = dialog.getElementsByTagName(\"input\")[0], button;\n if (inp) {\n inp.focus();\n\n if (options.value) {\n inp.value = options.value;\n if (options.selectValueOnOpen !== false) {\n inp.select();\n }\n }\n\n if (options.onInput)\n CodeMirror.on(inp, \"input\", function(e) { options.onInput(e, inp.value, close);});\n if (options.onKeyUp)\n CodeMirror.on(inp, \"keyup\", function(e) {options.onKeyUp(e, inp.value, close);});\n\n CodeMirror.on(inp, \"keydown\", function(e) {\n if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }\n if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {\n inp.blur();\n CodeMirror.e_stop(e);\n close();\n }\n if (e.keyCode == 13) callback(inp.value, e);\n });\n\n if (options.closeOnBlur !== false) CodeMirror.on(inp, \"blur\", close);\n } else if (button = dialog.getElementsByTagName(\"button\")[0]) {\n CodeMirror.on(button, \"click\", function() {\n close();\n me.focus();\n });\n\n if (options.closeOnBlur !== false) CodeMirror.on(button, \"blur\", close);\n\n button.focus();\n }\n return close;\n });\n\n CodeMirror.defineExtension(\"openConfirm\", function(template, callbacks, options) {\n closeNotification(this, null);\n var dialog = dialogDiv(this, template, options && options.bottom);\n var buttons = dialog.getElementsByTagName(\"button\");\n var closed = false, me = this, blurring = 1;\n function close() {\n if (closed) return;\n closed = true;\n dialog.parentNode.removeChild(dialog);\n me.focus();\n }\n buttons[0].focus();\n for (var i = 0; i < buttons.length; ++i) {\n var b = buttons[i];\n (function(callback) {\n CodeMirror.on(b, \"click\", function(e) {\n CodeMirror.e_preventDefault(e);\n close();\n if (callback) callback(me);\n });\n })(callbacks[i]);\n CodeMirror.on(b, \"blur\", function() {\n --blurring;\n setTimeout(function() { if (blurring <= 0) close(); }, 200);\n });\n CodeMirror.on(b, \"focus\", function() { ++blurring; });\n }\n });\n\n /*\n * openNotification\n * Opens a notification, that can be closed with an optional timer\n * (default 5000ms timer) and always closes on click.\n *\n * If a notification is opened while another is opened, it will close the\n * currently opened one and open the new one immediately.\n */\n CodeMirror.defineExtension(\"openNotification\", function(template, options) {\n closeNotification(this, close);\n var dialog = dialogDiv(this, template, options && options.bottom);\n var closed = false, doneTimer;\n var duration = options && typeof options.duration !== \"undefined\" ? options.duration : 5000;\n\n function close() {\n if (closed) return;\n closed = true;\n clearTimeout(doneTimer);\n dialog.parentNode.removeChild(dialog);\n }\n\n CodeMirror.on(dialog, 'click', function(e) {\n CodeMirror.e_preventDefault(e);\n close();\n });\n\n if (duration)\n doneTimer = setTimeout(close, duration);\n\n return close;\n });\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n var ie_lt8 = /MSIE \\d/.test(navigator.userAgent) &&\n (document.documentMode == null || document.documentMode < 8);\n\n var Pos = CodeMirror.Pos;\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n\n function findMatchingBracket(cm, where, strict, config) {\n var line = cm.getLineHandle(where.line), pos = where.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return null;\n var dir = match.charAt(1) == \">\" ? 1 : -1;\n if (strict && (dir > 0) != (pos == where.ch)) return null;\n var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));\n\n var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);\n if (found == null) return null;\n return {from: Pos(where.line, pos), to: found && found.pos,\n match: found && found.ch == match.charAt(0), forward: dir > 0};\n }\n\n // bracketRegex is used to specify which type of bracket to scan\n // should be a regexp, e.g. /[[\\]]/\n //\n // Note: If \"where\" is on an open bracket, then this bracket is ignored.\n //\n // Returns false when no bracket was found, null when it reached\n // maxScanLines and gave up\n function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\\]]/;\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if ((match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }\n\n function matchBrackets(cm, autoclear, config) {\n // Disable brace matching in long lines, since it'll cause hugely slow updates\n var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;\n var marks = [], ranges = cm.listSelections();\n for (var i = 0; i < ranges.length; i++) {\n var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config);\n if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {\n var style = match.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));\n if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)\n marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));\n }\n }\n\n if (marks.length) {\n // Kludge to work around the IE bug from issue #1193, where text\n // input stops going to the textare whever this fires.\n if (ie_lt8 && cm.state.focused) cm.focus();\n\n var clear = function() {\n cm.operation(function() {\n for (var i = 0; i < marks.length; i++) marks[i].clear();\n });\n };\n if (autoclear) setTimeout(clear, 800);\n else return clear;\n }\n }\n\n var currentlyHighlighted = null;\n function doMatchBrackets(cm) {\n cm.operation(function() {\n if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}\n currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);\n });\n }\n\n CodeMirror.defineOption(\"matchBrackets\", false, function(cm, val, old) {\n if (old && old != CodeMirror.Init)\n cm.off(\"cursorActivity\", doMatchBrackets);\n if (val) {\n cm.state.matchBrackets = typeof val == \"object\" ? val : {};\n cm.on(\"cursorActivity\", doMatchBrackets);\n }\n });\n\n CodeMirror.defineExtension(\"matchBrackets\", function() {matchBrackets(this, true);});\n CodeMirror.defineExtension(\"findMatchingBracket\", function(pos, strict, config){\n return findMatchingBracket(this, pos, strict, config);\n });\n CodeMirror.defineExtension(\"scanForBracket\", function(pos, dir, style, config){\n return scanForBracket(this, pos, dir, style, config);\n });\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/addon/mode/multiplex.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.multiplexingMode = function(outer /*, others */) {\n // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects\n var others = Array.prototype.slice.call(arguments, 1);\n\n function indexOf(string, pattern, from, returnEnd) {\n if (typeof pattern == \"string\") {\n var found = string.indexOf(pattern, from);\n return returnEnd && found > -1 ? found + pattern.length : found;\n }\n var m = pattern.exec(from ? string.slice(from) : string);\n return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;\n }\n\n return {\n startState: function() {\n return {\n outer: CodeMirror.startState(outer),\n innerActive: null,\n inner: null\n };\n },\n\n copyState: function(state) {\n return {\n outer: CodeMirror.copyState(outer, state.outer),\n innerActive: state.innerActive,\n inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)\n };\n },\n\n token: function(stream, state) {\n if (!state.innerActive) {\n var cutOff = Infinity, oldContent = stream.string;\n for (var i = 0; i < others.length; ++i) {\n var other = others[i];\n var found = indexOf(oldContent, other.open, stream.pos);\n if (found == stream.pos) {\n if (!other.parseDelimiters) stream.match(other.open);\n state.innerActive = other;\n state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, \"\") : 0);\n return other.delimStyle && (other.delimStyle + \" \" + other.delimStyle + \"-open\");\n } else if (found != -1 && found < cutOff) {\n cutOff = found;\n }\n }\n if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);\n var outerToken = outer.token(stream, state.outer);\n if (cutOff != Infinity) stream.string = oldContent;\n return outerToken;\n } else {\n var curInner = state.innerActive, oldContent = stream.string;\n if (!curInner.close && stream.sol()) {\n state.innerActive = state.inner = null;\n return this.token(stream, state);\n }\n var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;\n if (found == stream.pos && !curInner.parseDelimiters) {\n stream.match(curInner.close);\n state.innerActive = state.inner = null;\n return curInner.delimStyle && (curInner.delimStyle + \" \" + curInner.delimStyle + \"-close\");\n }\n if (found > -1) stream.string = oldContent.slice(0, found);\n var innerToken = curInner.mode.token(stream, state.inner);\n if (found > -1) stream.string = oldContent;\n\n if (found == stream.pos && curInner.parseDelimiters)\n state.innerActive = state.inner = null;\n\n if (curInner.innerStyle) {\n if (innerToken) innerToken = innerToken + \" \" + curInner.innerStyle;\n else innerToken = curInner.innerStyle;\n }\n\n return innerToken;\n }\n },\n\n indent: function(state, textAfter) {\n var mode = state.innerActive ? state.innerActive.mode : outer;\n if (!mode.indent) return CodeMirror.Pass;\n return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);\n },\n\n blankLine: function(state) {\n var mode = state.innerActive ? state.innerActive.mode : outer;\n if (mode.blankLine) {\n mode.blankLine(state.innerActive ? state.inner : state.outer);\n }\n if (!state.innerActive) {\n for (var i = 0; i < others.length; ++i) {\n var other = others[i];\n if (other.open === \"\\n\") {\n state.innerActive = other;\n state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, \"\") : 0);\n }\n }\n } else if (state.innerActive.close === \"\\n\") {\n state.innerActive = state.inner = null;\n }\n },\n\n electricChars: outer.electricChars,\n\n innerMode: function(state) {\n return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};\n }\n };\n};\n\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/addon/mode/multiplex.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n var Pos = CodeMirror.Pos;\n\n function SearchCursor(doc, query, pos, caseFold) {\n this.atOccurrence = false; this.doc = doc;\n if (caseFold == null && typeof query == \"string\") caseFold = false;\n\n pos = pos ? doc.clipPos(pos) : Pos(0, 0);\n this.pos = {from: pos, to: pos};\n\n // The matches method is filled in based on the type of query.\n // It takes a position and a direction, and returns an object\n // describing the next occurrence of the query, or null if no\n // more matches were found.\n if (typeof query != \"string\") { // Regexp match\n if (!query.global) query = new RegExp(query.source, query.ignoreCase ? \"ig\" : \"g\");\n this.matches = function(reverse, pos) {\n if (reverse) {\n query.lastIndex = 0;\n var line = doc.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start;\n for (;;) {\n query.lastIndex = cutOff;\n var newMatch = query.exec(line);\n if (!newMatch) break;\n match = newMatch;\n start = match.index;\n cutOff = match.index + (match[0].length || 1);\n if (cutOff == line.length) break;\n }\n var matchLen = (match && match[0].length) || 0;\n if (!matchLen) {\n if (start == 0 && line.length == 0) {match = undefined;}\n else if (start != doc.getLine(pos.line).length) {\n matchLen++;\n }\n }\n } else {\n query.lastIndex = pos.ch;\n var line = doc.getLine(pos.line), match = query.exec(line);\n var matchLen = (match && match[0].length) || 0;\n var start = match && match.index;\n if (start + matchLen != line.length && !matchLen) matchLen = 1;\n }\n if (match && matchLen)\n return {from: Pos(pos.line, start),\n to: Pos(pos.line, start + matchLen),\n match: match};\n };\n } else { // String query\n var origQuery = query;\n if (caseFold) query = query.toLowerCase();\n var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};\n var target = query.split(\"\\n\");\n // Different methods for single-line and multi-line queries\n if (target.length == 1) {\n if (!query.length) {\n // Empty string would match anything and never progress, so\n // we define it to match nothing instead.\n this.matches = function() {};\n } else {\n this.matches = function(reverse, pos) {\n if (reverse) {\n var orig = doc.getLine(pos.line).slice(0, pos.ch), line = fold(orig);\n var match = line.lastIndexOf(query);\n if (match > -1) {\n match = adjustPos(orig, line, match);\n return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)};\n }\n } else {\n var orig = doc.getLine(pos.line).slice(pos.ch), line = fold(orig);\n var match = line.indexOf(query);\n if (match > -1) {\n match = adjustPos(orig, line, match) + pos.ch;\n return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)};\n }\n }\n };\n }\n } else {\n var origTarget = origQuery.split(\"\\n\");\n this.matches = function(reverse, pos) {\n var last = target.length - 1;\n if (reverse) {\n if (pos.line - (target.length - 1) < doc.firstLine()) return;\n if (fold(doc.getLine(pos.line).slice(0, origTarget[last].length)) != target[target.length - 1]) return;\n var to = Pos(pos.line, origTarget[last].length);\n for (var ln = pos.line - 1, i = last - 1; i >= 1; --i, --ln)\n if (target[i] != fold(doc.getLine(ln))) return;\n var line = doc.getLine(ln), cut = line.length - origTarget[0].length;\n if (fold(line.slice(cut)) != target[0]) return;\n return {from: Pos(ln, cut), to: to};\n } else {\n if (pos.line + (target.length - 1) > doc.lastLine()) return;\n var line = doc.getLine(pos.line), cut = line.length - origTarget[0].length;\n if (fold(line.slice(cut)) != target[0]) return;\n var from = Pos(pos.line, cut);\n for (var ln = pos.line + 1, i = 1; i < last; ++i, ++ln)\n if (target[i] != fold(doc.getLine(ln))) return;\n if (fold(doc.getLine(ln).slice(0, origTarget[last].length)) != target[last]) return;\n return {from: from, to: Pos(ln, origTarget[last].length)};\n }\n };\n }\n }\n }\n\n SearchCursor.prototype = {\n findNext: function() {return this.find(false);},\n findPrevious: function() {return this.find(true);},\n\n find: function(reverse) {\n var self = this, pos = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);\n function savePosAndFail(line) {\n var pos = Pos(line, 0);\n self.pos = {from: pos, to: pos};\n self.atOccurrence = false;\n return false;\n }\n\n for (;;) {\n if (this.pos = this.matches(reverse, pos)) {\n this.atOccurrence = true;\n return this.pos.match || true;\n }\n if (reverse) {\n if (!pos.line) return savePosAndFail(0);\n pos = Pos(pos.line-1, this.doc.getLine(pos.line-1).length);\n }\n else {\n var maxLine = this.doc.lineCount();\n if (pos.line == maxLine - 1) return savePosAndFail(maxLine);\n pos = Pos(pos.line + 1, 0);\n }\n }\n },\n\n from: function() {if (this.atOccurrence) return this.pos.from;},\n to: function() {if (this.atOccurrence) return this.pos.to;},\n\n replace: function(newText, origin) {\n if (!this.atOccurrence) return;\n var lines = CodeMirror.splitLines(newText);\n this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin);\n this.pos.to = Pos(this.pos.from.line + lines.length - 1,\n lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0));\n }\n };\n\n // Maps a position in a case-folded line back to a position in the original line\n // (compensating for codepoints increasing in number during folding)\n function adjustPos(orig, folded, pos) {\n if (orig.length == folded.length) return pos;\n for (var pos1 = Math.min(pos, orig.length);;) {\n var len1 = orig.slice(0, pos1).toLowerCase().length;\n if (len1 < pos) ++pos1;\n else if (len1 > pos) --pos1;\n else return pos1;\n }\n }\n\n CodeMirror.defineExtension(\"getSearchCursor\", function(query, pos, caseFold) {\n return new SearchCursor(this.doc, query, pos, caseFold);\n });\n CodeMirror.defineDocExtension(\"getSearchCursor\", function(query, pos, caseFold) {\n return new SearchCursor(this, query, pos, caseFold);\n });\n\n CodeMirror.defineExtension(\"selectMatches\", function(query, caseFold) {\n var ranges = [];\n var cur = this.getSearchCursor(query, this.getCursor(\"from\"), caseFold);\n while (cur.findNext()) {\n if (CodeMirror.cmpPos(cur.to(), this.getCursor(\"to\")) > 0) break;\n ranges.push({anchor: cur.from(), head: cur.to()});\n }\n if (ranges.length)\n this.setSelections(ranges, 0);\n });\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/css/css.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"css\", function(config, parserConfig) {\n var inline = parserConfig.inline\n if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode(\"text/css\");\n\n var indentUnit = config.indentUnit,\n tokenHooks = parserConfig.tokenHooks,\n documentTypes = parserConfig.documentTypes || {},\n mediaTypes = parserConfig.mediaTypes || {},\n mediaFeatures = parserConfig.mediaFeatures || {},\n mediaValueKeywords = parserConfig.mediaValueKeywords || {},\n propertyKeywords = parserConfig.propertyKeywords || {},\n nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},\n fontProperties = parserConfig.fontProperties || {},\n counterDescriptors = parserConfig.counterDescriptors || {},\n colorKeywords = parserConfig.colorKeywords || {},\n valueKeywords = parserConfig.valueKeywords || {},\n allowNested = parserConfig.allowNested,\n supportsAtComponent = parserConfig.supportsAtComponent === true;\n\n var type, override;\n function ret(style, tp) { type = tp; return style; }\n\n // Tokenizers\n\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (tokenHooks[ch]) {\n var result = tokenHooks[ch](stream, state);\n if (result !== false) return result;\n }\n if (ch == \"@\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"def\", stream.current());\n } else if (ch == \"=\" || (ch == \"~\" || ch == \"|\") && stream.eat(\"=\")) {\n return ret(null, \"compare\");\n } else if (ch == \"\\\"\" || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \"#\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"atom\", \"hash\");\n } else if (ch == \"!\") {\n stream.match(/^\\s*\\w*/);\n return ret(\"keyword\", \"important\");\n } else if (/\\d/.test(ch) || ch == \".\" && stream.eat(/\\d/)) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (ch === \"-\") {\n if (/[\\d.]/.test(stream.peek())) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (stream.match(/^-[\\w\\\\\\-]+/)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return ret(\"variable-2\", \"variable-definition\");\n return ret(\"variable-2\", \"variable\");\n } else if (stream.match(/^\\w+-/)) {\n return ret(\"meta\", \"meta\");\n }\n } else if (/[,+>*\\/]/.test(ch)) {\n return ret(null, \"select-op\");\n } else if (ch == \".\" && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {\n return ret(\"qualifier\", \"qualifier\");\n } else if (/[:;{}\\[\\]\\(\\)]/.test(ch)) {\n return ret(null, ch);\n } else if ((ch == \"u\" && stream.match(/rl(-prefix)?\\(/)) ||\n (ch == \"d\" && stream.match(\"omain(\")) ||\n (ch == \"r\" && stream.match(\"egexp(\"))) {\n stream.backUp(1);\n state.tokenize = tokenParenthesized;\n return ret(\"property\", \"word\");\n } else if (/[\\w\\\\\\-]/.test(ch)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"property\", \"word\");\n } else {\n return ret(null, null);\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, ch;\n while ((ch = stream.next()) != null) {\n if (ch == quote && !escaped) {\n if (quote == \")\") stream.backUp(1);\n break;\n }\n escaped = !escaped && ch == \"\\\\\";\n }\n if (ch == quote || !escaped && quote != \")\") state.tokenize = null;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenParenthesized(stream, state) {\n stream.next(); // Must be '('\n if (!stream.match(/\\s*[\\\"\\')]/, false))\n state.tokenize = tokenString(\")\");\n else\n state.tokenize = null;\n return ret(null, \"(\");\n }\n\n // Context management\n\n function Context(type, indent, prev) {\n this.type = type;\n this.indent = indent;\n this.prev = prev;\n }\n\n function pushContext(state, stream, type, indent) {\n state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);\n return type;\n }\n\n function popContext(state) {\n if (state.context.prev)\n state.context = state.context.prev;\n return state.context.type;\n }\n\n function pass(type, stream, state) {\n return states[state.context.type](type, stream, state);\n }\n function popAndPass(type, stream, state, n) {\n for (var i = n || 1; i > 0; i--)\n state.context = state.context.prev;\n return pass(type, stream, state);\n }\n\n // Parser\n\n function wordAsValue(stream) {\n var word = stream.current().toLowerCase();\n if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"variable\";\n }\n\n var states = {};\n\n states.top = function(type, stream, state) {\n if (type == \"{\") {\n return pushContext(state, stream, \"block\");\n } else if (type == \"}\" && state.context.prev) {\n return popContext(state);\n } else if (supportsAtComponent && /@component/.test(type)) {\n return pushContext(state, stream, \"atComponentBlock\");\n } else if (/^@(-moz-)?document$/.test(type)) {\n return pushContext(state, stream, \"documentTypes\");\n } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {\n return pushContext(state, stream, \"atBlock\");\n } else if (/^@(font-face|counter-style)/.test(type)) {\n state.stateArg = type;\n return \"restricted_atBlock_before\";\n } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {\n return \"keyframes\";\n } else if (type && type.charAt(0) == \"@\") {\n return pushContext(state, stream, \"at\");\n } else if (type == \"hash\") {\n override = \"builtin\";\n } else if (type == \"word\") {\n override = \"tag\";\n } else if (type == \"variable-definition\") {\n return \"maybeprop\";\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n } else if (type == \":\") {\n return \"pseudo\";\n } else if (allowNested && type == \"(\") {\n return pushContext(state, stream, \"parens\");\n }\n return state.context.type;\n };\n\n states.block = function(type, stream, state) {\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (propertyKeywords.hasOwnProperty(word)) {\n override = \"property\";\n return \"maybeprop\";\n } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {\n override = \"string-2\";\n return \"maybeprop\";\n } else if (allowNested) {\n override = stream.match(/^\\s*:(?:\\s|$)/, false) ? \"property\" : \"tag\";\n return \"block\";\n } else {\n override += \" error\";\n return \"maybeprop\";\n }\n } else if (type == \"meta\") {\n return \"block\";\n } else if (!allowNested && (type == \"hash\" || type == \"qualifier\")) {\n override = \"error\";\n return \"block\";\n } else {\n return states.top(type, stream, state);\n }\n };\n\n states.maybeprop = function(type, stream, state) {\n if (type == \":\") return pushContext(state, stream, \"prop\");\n return pass(type, stream, state);\n };\n\n states.prop = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" && allowNested) return pushContext(state, stream, \"propBlock\");\n if (type == \"}\" || type == \"{\") return popAndPass(type, stream, state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n\n if (type == \"hash\" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {\n override += \" error\";\n } else if (type == \"word\") {\n wordAsValue(stream);\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n }\n return \"prop\";\n };\n\n states.propBlock = function(type, _stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"word\") { override = \"property\"; return \"maybeprop\"; }\n return state.context.type;\n };\n\n states.parens = function(type, stream, state) {\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \")\") return popContext(state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n if (type == \"word\") wordAsValue(stream);\n return \"parens\";\n };\n\n states.pseudo = function(type, stream, state) {\n if (type == \"word\") {\n override = \"variable-3\";\n return state.context.type;\n }\n return pass(type, stream, state);\n };\n\n states.documentTypes = function(type, stream, state) {\n if (type == \"word\" && documentTypes.hasOwnProperty(stream.current())) {\n override = \"tag\";\n return state.context.type;\n } else {\n return states.atBlock(type, stream, state);\n }\n };\n\n states.atBlock = function(type, stream, state) {\n if (type == \"(\") return pushContext(state, stream, \"atBlock_parens\");\n if (type == \"}\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"{\") return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\");\n\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (word == \"only\" || word == \"not\" || word == \"and\" || word == \"or\")\n override = \"keyword\";\n else if (mediaTypes.hasOwnProperty(word))\n override = \"attribute\";\n else if (mediaFeatures.hasOwnProperty(word))\n override = \"property\";\n else if (mediaValueKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else if (propertyKeywords.hasOwnProperty(word))\n override = \"property\";\n else if (nonStandardPropertyKeywords.hasOwnProperty(word))\n override = \"string-2\";\n else if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"error\";\n }\n return state.context.type;\n };\n\n states.atComponentBlock = function(type, stream, state) {\n if (type == \"}\")\n return popAndPass(type, stream, state);\n if (type == \"{\")\n return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\", false);\n if (type == \"word\")\n override = \"error\";\n return state.context.type;\n };\n\n states.atBlock_parens = function(type, stream, state) {\n if (type == \")\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state, 2);\n return states.atBlock(type, stream, state);\n };\n\n states.restricted_atBlock_before = function(type, stream, state) {\n if (type == \"{\")\n return pushContext(state, stream, \"restricted_atBlock\");\n if (type == \"word\" && state.stateArg == \"@counter-style\") {\n override = \"variable\";\n return \"restricted_atBlock_before\";\n }\n return pass(type, stream, state);\n };\n\n states.restricted_atBlock = function(type, stream, state) {\n if (type == \"}\") {\n state.stateArg = null;\n return popContext(state);\n }\n if (type == \"word\") {\n if ((state.stateArg == \"@font-face\" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||\n (state.stateArg == \"@counter-style\" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))\n override = \"error\";\n else\n override = \"property\";\n return \"maybeprop\";\n }\n return \"restricted_atBlock\";\n };\n\n states.keyframes = function(type, stream, state) {\n if (type == \"word\") { override = \"variable\"; return \"keyframes\"; }\n if (type == \"{\") return pushContext(state, stream, \"top\");\n return pass(type, stream, state);\n };\n\n states.at = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"tag\";\n else if (type == \"hash\") override = \"builtin\";\n return \"at\";\n };\n\n states.interpolation = function(type, stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"{\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"variable\";\n else if (type != \"variable\" && type != \"(\" && type != \")\") override = \"error\";\n return \"interpolation\";\n };\n\n return {\n startState: function(base) {\n return {tokenize: null,\n state: inline ? \"block\" : \"top\",\n stateArg: null,\n context: new Context(inline ? \"block\" : \"top\", base || 0, null)};\n },\n\n token: function(stream, state) {\n if (!state.tokenize && stream.eatSpace()) return null;\n var style = (state.tokenize || tokenBase)(stream, state);\n if (style && typeof style == \"object\") {\n type = style[1];\n style = style[0];\n }\n override = style;\n state.state = states[state.state](type, stream, state);\n return override;\n },\n\n indent: function(state, textAfter) {\n var cx = state.context, ch = textAfter && textAfter.charAt(0);\n var indent = cx.indent;\n if (cx.type == \"prop\" && (ch == \"}\" || ch == \")\")) cx = cx.prev;\n if (cx.prev) {\n if (ch == \"}\" && (cx.type == \"block\" || cx.type == \"top\" ||\n cx.type == \"interpolation\" || cx.type == \"restricted_atBlock\")) {\n // Resume indentation from parent context.\n cx = cx.prev;\n indent = cx.indent;\n } else if (ch == \")\" && (cx.type == \"parens\" || cx.type == \"atBlock_parens\") ||\n ch == \"{\" && (cx.type == \"at\" || cx.type == \"atBlock\")) {\n // Dedent relative to current context.\n indent = Math.max(0, cx.indent - indentUnit);\n cx = cx.prev;\n }\n }\n return indent;\n },\n\n electricChars: \"}\",\n blockCommentStart: \"/*\",\n blockCommentEnd: \"*/\",\n fold: \"brace\"\n };\n});\n\n function keySet(array) {\n var keys = {};\n for (var i = 0; i < array.length; ++i) {\n keys[array[i]] = true;\n }\n return keys;\n }\n\n var documentTypes_ = [\n \"domain\", \"regexp\", \"url\", \"url-prefix\"\n ], documentTypes = keySet(documentTypes_);\n\n var mediaTypes_ = [\n \"all\", \"aural\", \"braille\", \"handheld\", \"print\", \"projection\", \"screen\",\n \"tty\", \"tv\", \"embossed\"\n ], mediaTypes = keySet(mediaTypes_);\n\n var mediaFeatures_ = [\n \"width\", \"min-width\", \"max-width\", \"height\", \"min-height\", \"max-height\",\n \"device-width\", \"min-device-width\", \"max-device-width\", \"device-height\",\n \"min-device-height\", \"max-device-height\", \"aspect-ratio\",\n \"min-aspect-ratio\", \"max-aspect-ratio\", \"device-aspect-ratio\",\n \"min-device-aspect-ratio\", \"max-device-aspect-ratio\", \"color\", \"min-color\",\n \"max-color\", \"color-index\", \"min-color-index\", \"max-color-index\",\n \"monochrome\", \"min-monochrome\", \"max-monochrome\", \"resolution\",\n \"min-resolution\", \"max-resolution\", \"scan\", \"grid\", \"orientation\",\n \"device-pixel-ratio\", \"min-device-pixel-ratio\", \"max-device-pixel-ratio\",\n \"pointer\", \"any-pointer\", \"hover\", \"any-hover\"\n ], mediaFeatures = keySet(mediaFeatures_);\n\n var mediaValueKeywords_ = [\n \"landscape\", \"portrait\", \"none\", \"coarse\", \"fine\", \"on-demand\", \"hover\",\n \"interlace\", \"progressive\"\n ], mediaValueKeywords = keySet(mediaValueKeywords_);\n\n var propertyKeywords_ = [\n \"align-content\", \"align-items\", \"align-self\", \"alignment-adjust\",\n \"alignment-baseline\", \"anchor-point\", \"animation\", \"animation-delay\",\n \"animation-direction\", \"animation-duration\", \"animation-fill-mode\",\n \"animation-iteration-count\", \"animation-name\", \"animation-play-state\",\n \"animation-timing-function\", \"appearance\", \"azimuth\", \"backface-visibility\",\n \"background\", \"background-attachment\", \"background-blend-mode\", \"background-clip\",\n \"background-color\", \"background-image\", \"background-origin\", \"background-position\",\n \"background-repeat\", \"background-size\", \"baseline-shift\", \"binding\",\n \"bleed\", \"bookmark-label\", \"bookmark-level\", \"bookmark-state\",\n \"bookmark-target\", \"border\", \"border-bottom\", \"border-bottom-color\",\n \"border-bottom-left-radius\", \"border-bottom-right-radius\",\n \"border-bottom-style\", \"border-bottom-width\", \"border-collapse\",\n \"border-color\", \"border-image\", \"border-image-outset\",\n \"border-image-repeat\", \"border-image-slice\", \"border-image-source\",\n \"border-image-width\", \"border-left\", \"border-left-color\",\n \"border-left-style\", \"border-left-width\", \"border-radius\", \"border-right\",\n \"border-right-color\", \"border-right-style\", \"border-right-width\",\n \"border-spacing\", \"border-style\", \"border-top\", \"border-top-color\",\n \"border-top-left-radius\", \"border-top-right-radius\", \"border-top-style\",\n \"border-top-width\", \"border-width\", \"bottom\", \"box-decoration-break\",\n \"box-shadow\", \"box-sizing\", \"break-after\", \"break-before\", \"break-inside\",\n \"caption-side\", \"clear\", \"clip\", \"color\", \"color-profile\", \"column-count\",\n \"column-fill\", \"column-gap\", \"column-rule\", \"column-rule-color\",\n \"column-rule-style\", \"column-rule-width\", \"column-span\", \"column-width\",\n \"columns\", \"content\", \"counter-increment\", \"counter-reset\", \"crop\", \"cue\",\n \"cue-after\", \"cue-before\", \"cursor\", \"direction\", \"display\",\n \"dominant-baseline\", \"drop-initial-after-adjust\",\n \"drop-initial-after-align\", \"drop-initial-before-adjust\",\n \"drop-initial-before-align\", \"drop-initial-size\", \"drop-initial-value\",\n \"elevation\", \"empty-cells\", \"fit\", \"fit-position\", \"flex\", \"flex-basis\",\n \"flex-direction\", \"flex-flow\", \"flex-grow\", \"flex-shrink\", \"flex-wrap\",\n \"float\", \"float-offset\", \"flow-from\", \"flow-into\", \"font\", \"font-feature-settings\",\n \"font-family\", \"font-kerning\", \"font-language-override\", \"font-size\", \"font-size-adjust\",\n \"font-stretch\", \"font-style\", \"font-synthesis\", \"font-variant\",\n \"font-variant-alternates\", \"font-variant-caps\", \"font-variant-east-asian\",\n \"font-variant-ligatures\", \"font-variant-numeric\", \"font-variant-position\",\n \"font-weight\", \"grid\", \"grid-area\", \"grid-auto-columns\", \"grid-auto-flow\",\n \"grid-auto-position\", \"grid-auto-rows\", \"grid-column\", \"grid-column-end\",\n \"grid-column-start\", \"grid-row\", \"grid-row-end\", \"grid-row-start\",\n \"grid-template\", \"grid-template-areas\", \"grid-template-columns\",\n \"grid-template-rows\", \"hanging-punctuation\", \"height\", \"hyphens\",\n \"icon\", \"image-orientation\", \"image-rendering\", \"image-resolution\",\n \"inline-box-align\", \"justify-content\", \"left\", \"letter-spacing\",\n \"line-break\", \"line-height\", \"line-stacking\", \"line-stacking-ruby\",\n \"line-stacking-shift\", \"line-stacking-strategy\", \"list-style\",\n \"list-style-image\", \"list-style-position\", \"list-style-type\", \"margin\",\n \"margin-bottom\", \"margin-left\", \"margin-right\", \"margin-top\",\n \"marker-offset\", \"marks\", \"marquee-direction\", \"marquee-loop\",\n \"marquee-play-count\", \"marquee-speed\", \"marquee-style\", \"max-height\",\n \"max-width\", \"min-height\", \"min-width\", \"move-to\", \"nav-down\", \"nav-index\",\n \"nav-left\", \"nav-right\", \"nav-up\", \"object-fit\", \"object-position\",\n \"opacity\", \"order\", \"orphans\", \"outline\",\n \"outline-color\", \"outline-offset\", \"outline-style\", \"outline-width\",\n \"overflow\", \"overflow-style\", \"overflow-wrap\", \"overflow-x\", \"overflow-y\",\n \"padding\", \"padding-bottom\", \"padding-left\", \"padding-right\", \"padding-top\",\n \"page\", \"page-break-after\", \"page-break-before\", \"page-break-inside\",\n \"page-policy\", \"pause\", \"pause-after\", \"pause-before\", \"perspective\",\n \"perspective-origin\", \"pitch\", \"pitch-range\", \"play-during\", \"position\",\n \"presentation-level\", \"punctuation-trim\", \"quotes\", \"region-break-after\",\n \"region-break-before\", \"region-break-inside\", \"region-fragment\",\n \"rendering-intent\", \"resize\", \"rest\", \"rest-after\", \"rest-before\", \"richness\",\n \"right\", \"rotation\", \"rotation-point\", \"ruby-align\", \"ruby-overhang\",\n \"ruby-position\", \"ruby-span\", \"shape-image-threshold\", \"shape-inside\", \"shape-margin\",\n \"shape-outside\", \"size\", \"speak\", \"speak-as\", \"speak-header\",\n \"speak-numeral\", \"speak-punctuation\", \"speech-rate\", \"stress\", \"string-set\",\n \"tab-size\", \"table-layout\", \"target\", \"target-name\", \"target-new\",\n \"target-position\", \"text-align\", \"text-align-last\", \"text-decoration\",\n \"text-decoration-color\", \"text-decoration-line\", \"text-decoration-skip\",\n \"text-decoration-style\", \"text-emphasis\", \"text-emphasis-color\",\n \"text-emphasis-position\", \"text-emphasis-style\", \"text-height\",\n \"text-indent\", \"text-justify\", \"text-outline\", \"text-overflow\", \"text-shadow\",\n \"text-size-adjust\", \"text-space-collapse\", \"text-transform\", \"text-underline-position\",\n \"text-wrap\", \"top\", \"transform\", \"transform-origin\", \"transform-style\",\n \"transition\", \"transition-delay\", \"transition-duration\",\n \"transition-property\", \"transition-timing-function\", \"unicode-bidi\",\n \"vertical-align\", \"visibility\", \"voice-balance\", \"voice-duration\",\n \"voice-family\", \"voice-pitch\", \"voice-range\", \"voice-rate\", \"voice-stress\",\n \"voice-volume\", \"volume\", \"white-space\", \"widows\", \"width\", \"word-break\",\n \"word-spacing\", \"word-wrap\", \"z-index\",\n // SVG-specific\n \"clip-path\", \"clip-rule\", \"mask\", \"enable-background\", \"filter\", \"flood-color\",\n \"flood-opacity\", \"lighting-color\", \"stop-color\", \"stop-opacity\", \"pointer-events\",\n \"color-interpolation\", \"color-interpolation-filters\",\n \"color-rendering\", \"fill\", \"fill-opacity\", \"fill-rule\", \"image-rendering\",\n \"marker\", \"marker-end\", \"marker-mid\", \"marker-start\", \"shape-rendering\", \"stroke\",\n \"stroke-dasharray\", \"stroke-dashoffset\", \"stroke-linecap\", \"stroke-linejoin\",\n \"stroke-miterlimit\", \"stroke-opacity\", \"stroke-width\", \"text-rendering\",\n \"baseline-shift\", \"dominant-baseline\", \"glyph-orientation-horizontal\",\n \"glyph-orientation-vertical\", \"text-anchor\", \"writing-mode\"\n ], propertyKeywords = keySet(propertyKeywords_);\n\n var nonStandardPropertyKeywords_ = [\n \"scrollbar-arrow-color\", \"scrollbar-base-color\", \"scrollbar-dark-shadow-color\",\n \"scrollbar-face-color\", \"scrollbar-highlight-color\", \"scrollbar-shadow-color\",\n \"scrollbar-3d-light-color\", \"scrollbar-track-color\", \"shape-inside\",\n \"searchfield-cancel-button\", \"searchfield-decoration\", \"searchfield-results-button\",\n \"searchfield-results-decoration\", \"zoom\"\n ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);\n\n var fontProperties_ = [\n \"font-family\", \"src\", \"unicode-range\", \"font-variant\", \"font-feature-settings\",\n \"font-stretch\", \"font-weight\", \"font-style\"\n ], fontProperties = keySet(fontProperties_);\n\n var counterDescriptors_ = [\n \"additive-symbols\", \"fallback\", \"negative\", \"pad\", \"prefix\", \"range\",\n \"speak-as\", \"suffix\", \"symbols\", \"system\"\n ], counterDescriptors = keySet(counterDescriptors_);\n\n var colorKeywords_ = [\n \"aliceblue\", \"antiquewhite\", \"aqua\", \"aquamarine\", \"azure\", \"beige\",\n \"bisque\", \"black\", \"blanchedalmond\", \"blue\", \"blueviolet\", \"brown\",\n \"burlywood\", \"cadetblue\", \"chartreuse\", \"chocolate\", \"coral\", \"cornflowerblue\",\n \"cornsilk\", \"crimson\", \"cyan\", \"darkblue\", \"darkcyan\", \"darkgoldenrod\",\n \"darkgray\", \"darkgreen\", \"darkkhaki\", \"darkmagenta\", \"darkolivegreen\",\n \"darkorange\", \"darkorchid\", \"darkred\", \"darksalmon\", \"darkseagreen\",\n \"darkslateblue\", \"darkslategray\", \"darkturquoise\", \"darkviolet\",\n \"deeppink\", \"deepskyblue\", \"dimgray\", \"dodgerblue\", \"firebrick\",\n \"floralwhite\", \"forestgreen\", \"fuchsia\", \"gainsboro\", \"ghostwhite\",\n \"gold\", \"goldenrod\", \"gray\", \"grey\", \"green\", \"greenyellow\", \"honeydew\",\n \"hotpink\", \"indianred\", \"indigo\", \"ivory\", \"khaki\", \"lavender\",\n \"lavenderblush\", \"lawngreen\", \"lemonchiffon\", \"lightblue\", \"lightcoral\",\n \"lightcyan\", \"lightgoldenrodyellow\", \"lightgray\", \"lightgreen\", \"lightpink\",\n \"lightsalmon\", \"lightseagreen\", \"lightskyblue\", \"lightslategray\",\n \"lightsteelblue\", \"lightyellow\", \"lime\", \"limegreen\", \"linen\", \"magenta\",\n \"maroon\", \"mediumaquamarine\", \"mediumblue\", \"mediumorchid\", \"mediumpurple\",\n \"mediumseagreen\", \"mediumslateblue\", \"mediumspringgreen\", \"mediumturquoise\",\n \"mediumvioletred\", \"midnightblue\", \"mintcream\", \"mistyrose\", \"moccasin\",\n \"navajowhite\", \"navy\", \"oldlace\", \"olive\", \"olivedrab\", \"orange\", \"orangered\",\n \"orchid\", \"palegoldenrod\", \"palegreen\", \"paleturquoise\", \"palevioletred\",\n \"papayawhip\", \"peachpuff\", \"peru\", \"pink\", \"plum\", \"powderblue\",\n \"purple\", \"rebeccapurple\", \"red\", \"rosybrown\", \"royalblue\", \"saddlebrown\",\n \"salmon\", \"sandybrown\", \"seagreen\", \"seashell\", \"sienna\", \"silver\", \"skyblue\",\n \"slateblue\", \"slategray\", \"snow\", \"springgreen\", \"steelblue\", \"tan\",\n \"teal\", \"thistle\", \"tomato\", \"turquoise\", \"violet\", \"wheat\", \"white\",\n \"whitesmoke\", \"yellow\", \"yellowgreen\"\n ], colorKeywords = keySet(colorKeywords_);\n\n var valueKeywords_ = [\n \"above\", \"absolute\", \"activeborder\", \"additive\", \"activecaption\", \"afar\",\n \"after-white-space\", \"ahead\", \"alias\", \"all\", \"all-scroll\", \"alphabetic\", \"alternate\",\n \"always\", \"amharic\", \"amharic-abegede\", \"antialiased\", \"appworkspace\",\n \"arabic-indic\", \"armenian\", \"asterisks\", \"attr\", \"auto\", \"avoid\", \"avoid-column\", \"avoid-page\",\n \"avoid-region\", \"background\", \"backwards\", \"baseline\", \"below\", \"bidi-override\", \"binary\",\n \"bengali\", \"blink\", \"block\", \"block-axis\", \"bold\", \"bolder\", \"border\", \"border-box\",\n \"both\", \"bottom\", \"break\", \"break-all\", \"break-word\", \"bullets\", \"button\", \"button-bevel\",\n \"buttonface\", \"buttonhighlight\", \"buttonshadow\", \"buttontext\", \"calc\", \"cambodian\",\n \"capitalize\", \"caps-lock-indicator\", \"caption\", \"captiontext\", \"caret\",\n \"cell\", \"center\", \"checkbox\", \"circle\", \"cjk-decimal\", \"cjk-earthly-branch\",\n \"cjk-heavenly-stem\", \"cjk-ideographic\", \"clear\", \"clip\", \"close-quote\",\n \"col-resize\", \"collapse\", \"color\", \"color-burn\", \"color-dodge\", \"column\", \"column-reverse\",\n \"compact\", \"condensed\", \"contain\", \"content\",\n \"content-box\", \"context-menu\", \"continuous\", \"copy\", \"counter\", \"counters\", \"cover\", \"crop\",\n \"cross\", \"crosshair\", \"currentcolor\", \"cursive\", \"cyclic\", \"darken\", \"dashed\", \"decimal\",\n \"decimal-leading-zero\", \"default\", \"default-button\", \"destination-atop\",\n \"destination-in\", \"destination-out\", \"destination-over\", \"devanagari\", \"difference\",\n \"disc\", \"discard\", \"disclosure-closed\", \"disclosure-open\", \"document\",\n \"dot-dash\", \"dot-dot-dash\",\n \"dotted\", \"double\", \"down\", \"e-resize\", \"ease\", \"ease-in\", \"ease-in-out\", \"ease-out\",\n \"element\", \"ellipse\", \"ellipsis\", \"embed\", \"end\", \"ethiopic\", \"ethiopic-abegede\",\n \"ethiopic-abegede-am-et\", \"ethiopic-abegede-gez\", \"ethiopic-abegede-ti-er\",\n \"ethiopic-abegede-ti-et\", \"ethiopic-halehame-aa-er\",\n \"ethiopic-halehame-aa-et\", \"ethiopic-halehame-am-et\",\n \"ethiopic-halehame-gez\", \"ethiopic-halehame-om-et\",\n \"ethiopic-halehame-sid-et\", \"ethiopic-halehame-so-et\",\n \"ethiopic-halehame-ti-er\", \"ethiopic-halehame-ti-et\", \"ethiopic-halehame-tig\",\n \"ethiopic-numeric\", \"ew-resize\", \"exclusion\", \"expanded\", \"extends\", \"extra-condensed\",\n \"extra-expanded\", \"fantasy\", \"fast\", \"fill\", \"fixed\", \"flat\", \"flex\", \"flex-end\", \"flex-start\", \"footnotes\",\n \"forwards\", \"from\", \"geometricPrecision\", \"georgian\", \"graytext\", \"groove\",\n \"gujarati\", \"gurmukhi\", \"hand\", \"hangul\", \"hangul-consonant\", \"hard-light\", \"hebrew\",\n \"help\", \"hidden\", \"hide\", \"higher\", \"highlight\", \"highlighttext\",\n \"hiragana\", \"hiragana-iroha\", \"horizontal\", \"hsl\", \"hsla\", \"hue\", \"icon\", \"ignore\",\n \"inactiveborder\", \"inactivecaption\", \"inactivecaptiontext\", \"infinite\",\n \"infobackground\", \"infotext\", \"inherit\", \"initial\", \"inline\", \"inline-axis\",\n \"inline-block\", \"inline-flex\", \"inline-table\", \"inset\", \"inside\", \"intrinsic\", \"invert\",\n \"italic\", \"japanese-formal\", \"japanese-informal\", \"justify\", \"kannada\",\n \"katakana\", \"katakana-iroha\", \"keep-all\", \"khmer\",\n \"korean-hangul-formal\", \"korean-hanja-formal\", \"korean-hanja-informal\",\n \"landscape\", \"lao\", \"large\", \"larger\", \"left\", \"level\", \"lighter\", \"lighten\",\n \"line-through\", \"linear\", \"linear-gradient\", \"lines\", \"list-item\", \"listbox\", \"listitem\",\n \"local\", \"logical\", \"loud\", \"lower\", \"lower-alpha\", \"lower-armenian\",\n \"lower-greek\", \"lower-hexadecimal\", \"lower-latin\", \"lower-norwegian\",\n \"lower-roman\", \"lowercase\", \"ltr\", \"luminosity\", \"malayalam\", \"match\", \"matrix\", \"matrix3d\",\n \"media-controls-background\", \"media-current-time-display\",\n \"media-fullscreen-button\", \"media-mute-button\", \"media-play-button\",\n \"media-return-to-realtime-button\", \"media-rewind-button\",\n \"media-seek-back-button\", \"media-seek-forward-button\", \"media-slider\",\n \"media-sliderthumb\", \"media-time-remaining-display\", \"media-volume-slider\",\n \"media-volume-slider-container\", \"media-volume-sliderthumb\", \"medium\",\n \"menu\", \"menulist\", \"menulist-button\", \"menulist-text\",\n \"menulist-textfield\", \"menutext\", \"message-box\", \"middle\", \"min-intrinsic\",\n \"mix\", \"mongolian\", \"monospace\", \"move\", \"multiple\", \"multiply\", \"myanmar\", \"n-resize\",\n \"narrower\", \"ne-resize\", \"nesw-resize\", \"no-close-quote\", \"no-drop\",\n \"no-open-quote\", \"no-repeat\", \"none\", \"normal\", \"not-allowed\", \"nowrap\",\n \"ns-resize\", \"numbers\", \"numeric\", \"nw-resize\", \"nwse-resize\", \"oblique\", \"octal\", \"open-quote\",\n \"optimizeLegibility\", \"optimizeSpeed\", \"oriya\", \"oromo\", \"outset\",\n \"outside\", \"outside-shape\", \"overlay\", \"overline\", \"padding\", \"padding-box\",\n \"painted\", \"page\", \"paused\", \"persian\", \"perspective\", \"plus-darker\", \"plus-lighter\",\n \"pointer\", \"polygon\", \"portrait\", \"pre\", \"pre-line\", \"pre-wrap\", \"preserve-3d\",\n \"progress\", \"push-button\", \"radial-gradient\", \"radio\", \"read-only\",\n \"read-write\", \"read-write-plaintext-only\", \"rectangle\", \"region\",\n \"relative\", \"repeat\", \"repeating-linear-gradient\",\n \"repeating-radial-gradient\", \"repeat-x\", \"repeat-y\", \"reset\", \"reverse\",\n \"rgb\", \"rgba\", \"ridge\", \"right\", \"rotate\", \"rotate3d\", \"rotateX\", \"rotateY\",\n \"rotateZ\", \"round\", \"row\", \"row-resize\", \"row-reverse\", \"rtl\", \"run-in\", \"running\",\n \"s-resize\", \"sans-serif\", \"saturation\", \"scale\", \"scale3d\", \"scaleX\", \"scaleY\", \"scaleZ\", \"screen\",\n \"scroll\", \"scrollbar\", \"se-resize\", \"searchfield\",\n \"searchfield-cancel-button\", \"searchfield-decoration\",\n \"searchfield-results-button\", \"searchfield-results-decoration\",\n \"semi-condensed\", \"semi-expanded\", \"separate\", \"serif\", \"show\", \"sidama\",\n \"simp-chinese-formal\", \"simp-chinese-informal\", \"single\",\n \"skew\", \"skewX\", \"skewY\", \"skip-white-space\", \"slide\", \"slider-horizontal\",\n \"slider-vertical\", \"sliderthumb-horizontal\", \"sliderthumb-vertical\", \"slow\",\n \"small\", \"small-caps\", \"small-caption\", \"smaller\", \"soft-light\", \"solid\", \"somali\",\n \"source-atop\", \"source-in\", \"source-out\", \"source-over\", \"space\", \"space-around\", \"space-between\", \"spell-out\", \"square\",\n \"square-button\", \"start\", \"static\", \"status-bar\", \"stretch\", \"stroke\", \"sub\",\n \"subpixel-antialiased\", \"super\", \"sw-resize\", \"symbolic\", \"symbols\", \"table\",\n \"table-caption\", \"table-cell\", \"table-column\", \"table-column-group\",\n \"table-footer-group\", \"table-header-group\", \"table-row\", \"table-row-group\",\n \"tamil\",\n \"telugu\", \"text\", \"text-bottom\", \"text-top\", \"textarea\", \"textfield\", \"thai\",\n \"thick\", \"thin\", \"threeddarkshadow\", \"threedface\", \"threedhighlight\",\n \"threedlightshadow\", \"threedshadow\", \"tibetan\", \"tigre\", \"tigrinya-er\",\n \"tigrinya-er-abegede\", \"tigrinya-et\", \"tigrinya-et-abegede\", \"to\", \"top\",\n \"trad-chinese-formal\", \"trad-chinese-informal\",\n \"translate\", \"translate3d\", \"translateX\", \"translateY\", \"translateZ\",\n \"transparent\", \"ultra-condensed\", \"ultra-expanded\", \"underline\", \"up\",\n \"upper-alpha\", \"upper-armenian\", \"upper-greek\", \"upper-hexadecimal\",\n \"upper-latin\", \"upper-norwegian\", \"upper-roman\", \"uppercase\", \"urdu\", \"url\",\n \"var\", \"vertical\", \"vertical-text\", \"visible\", \"visibleFill\", \"visiblePainted\",\n \"visibleStroke\", \"visual\", \"w-resize\", \"wait\", \"wave\", \"wider\",\n \"window\", \"windowframe\", \"windowtext\", \"words\", \"wrap\", \"wrap-reverse\", \"x-large\", \"x-small\", \"xor\",\n \"xx-large\", \"xx-small\"\n ], valueKeywords = keySet(valueKeywords_);\n\n var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)\n .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)\n .concat(valueKeywords_);\n CodeMirror.registerHelper(\"hintWords\", \"css\", allWords);\n\n function tokenCComment(stream, state) {\n var maybeEnd = false, ch;\n while ((ch = stream.next()) != null) {\n if (maybeEnd && ch == \"/\") {\n state.tokenize = null;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return [\"comment\", \"comment\"];\n }\n\n CodeMirror.defineMIME(\"text/css\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\"\n });\n\n CodeMirror.defineMIME(\"text/x-scss\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \":\": function(stream) {\n if (stream.match(/\\s*\\{/))\n return [null, \"{\"];\n return false;\n },\n \"$\": function(stream) {\n stream.match(/^[\\w-]+/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"#\": function(stream) {\n if (!stream.eat(\"{\")) return false;\n return [null, \"interpolation\"];\n }\n },\n name: \"css\",\n helperType: \"scss\"\n });\n\n CodeMirror.defineMIME(\"text/x-less\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \"@\": function(stream) {\n if (stream.eat(\"{\")) return [null, \"interpolation\"];\n if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\\b/, false)) return false;\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"&\": function() {\n return [\"atom\", \"atom\"];\n }\n },\n name: \"css\",\n helperType: \"less\"\n });\n\n CodeMirror.defineMIME(\"text/x-gss\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n supportsAtComponent: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\",\n helperType: \"gss\"\n });\n\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/css/css.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../htmlmixed/htmlmixed\"),\n require(\"../../addon/mode/multiplex\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../htmlmixed/htmlmixed\",\n \"../../addon/mode/multiplex\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineMode(\"htmlembedded\", function(config, parserConfig) {\n return CodeMirror.multiplexingMode(CodeMirror.getMode(config, \"htmlmixed\"), {\n open: parserConfig.open || parserConfig.scriptStartRegex || \"<%\",\n close: parserConfig.close || parserConfig.scriptEndRegex || \"%>\",\n mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)\n });\n }, \"htmlmixed\");\n\n CodeMirror.defineMIME(\"application/x-ejs\", {name: \"htmlembedded\", scriptingModeSpec:\"javascript\"});\n CodeMirror.defineMIME(\"application/x-aspx\", {name: \"htmlembedded\", scriptingModeSpec:\"text/x-csharp\"});\n CodeMirror.defineMIME(\"application/x-jsp\", {name: \"htmlembedded\", scriptingModeSpec:\"text/x-java\"});\n CodeMirror.defineMIME(\"application/x-erb\", {name: \"htmlembedded\", scriptingModeSpec:\"ruby\"});\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../xml/xml\"), require(\"../javascript/javascript\"), require(\"../css/css\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../xml/xml\", \"../javascript/javascript\", \"../css/css\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var defaultTags = {\n script: [\n [\"lang\", /(javascript|babel)/i, \"javascript\"],\n [\"type\", /^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^$/i, \"javascript\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"javascript\"]\n ],\n style: [\n [\"lang\", /^css$/i, \"css\"],\n [\"type\", /^(text\\/)?(x-)?(stylesheet|css)$/i, \"css\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"css\"]\n ]\n };\n\n function maybeBackup(stream, pat, style) {\n var cur = stream.current(), close = cur.search(pat);\n if (close > -1) {\n stream.backUp(cur.length - close);\n } else if (cur.match(/<\\/?$/)) {\n stream.backUp(cur.length);\n if (!stream.match(pat, false)) stream.match(cur);\n }\n return style;\n }\n\n var attrRegexpCache = {};\n function getAttrRegexp(attr) {\n var regexp = attrRegexpCache[attr];\n if (regexp) return regexp;\n return attrRegexpCache[attr] = new RegExp(\"\\\\s+\" + attr + \"\\\\s*=\\\\s*('|\\\")?([^'\\\"]+)('|\\\")?\\\\s*\");\n }\n\n function getAttrValue(text, attr) {\n var match = text.match(getAttrRegexp(attr))\n return match ? match[2] : \"\"\n }\n\n function getTagRegexp(tagName, anchored) {\n return new RegExp((anchored ? \"^\" : \"\") + \"<\\/\\s*\" + tagName + \"\\s*>\", \"i\");\n }\n\n function addTags(from, to) {\n for (var tag in from) {\n var dest = to[tag] || (to[tag] = []);\n var source = from[tag];\n for (var i = source.length - 1; i >= 0; i--)\n dest.unshift(source[i])\n }\n }\n\n function findMatchingMode(tagInfo, tagText) {\n for (var i = 0; i < tagInfo.length; i++) {\n var spec = tagInfo[i];\n if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];\n }\n }\n\n CodeMirror.defineMode(\"htmlmixed\", function (config, parserConfig) {\n var htmlMode = CodeMirror.getMode(config, {\n name: \"xml\",\n htmlMode: true,\n multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,\n multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag\n });\n\n var tags = {};\n var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;\n addTags(defaultTags, tags);\n if (configTags) addTags(configTags, tags);\n if (configScript) for (var i = configScript.length - 1; i >= 0; i--)\n tags.script.unshift([\"type\", configScript[i].matches, configScript[i].mode])\n\n function html(stream, state) {\n var style = htmlMode.token(stream, state.htmlState), tag = /\\btag\\b/.test(style), tagName\n if (tag && !/[<>\\s\\/]/.test(stream.current()) &&\n (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&\n tags.hasOwnProperty(tagName)) {\n state.inTag = tagName + \" \"\n } else if (state.inTag && tag && />$/.test(stream.current())) {\n var inTag = /^([\\S]+) (.*)/.exec(state.inTag)\n state.inTag = null\n var modeSpec = stream.current() == \">\" && findMatchingMode(tags[inTag[1]], inTag[2])\n var mode = CodeMirror.getMode(config, modeSpec)\n var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);\n state.token = function (stream, state) {\n if (stream.match(endTagA, false)) {\n state.token = html;\n state.localState = state.localMode = null;\n return null;\n }\n return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));\n };\n state.localMode = mode;\n state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, \"\"));\n } else if (state.inTag) {\n state.inTag += stream.current()\n if (stream.eol()) state.inTag += \" \"\n }\n return style;\n };\n\n return {\n startState: function () {\n var state = htmlMode.startState();\n return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};\n },\n\n copyState: function (state) {\n var local;\n if (state.localState) {\n local = CodeMirror.copyState(state.localMode, state.localState);\n }\n return {token: state.token, inTag: state.inTag,\n localMode: state.localMode, localState: local,\n htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};\n },\n\n token: function (stream, state) {\n return state.token(stream, state);\n },\n\n indent: function (state, textAfter) {\n if (!state.localMode || /^\\s*<\\//.test(textAfter))\n return htmlMode.indent(state.htmlState, textAfter);\n else if (state.localMode.indent)\n return state.localMode.indent(state.localState, textAfter);\n else\n return CodeMirror.Pass;\n },\n\n innerMode: function (state) {\n return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};\n }\n };\n }, \"xml\", \"javascript\", \"css\");\n\n CodeMirror.defineMIME(\"text/html\", \"htmlmixed\");\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// TODO actually recognize syntax of TypeScript constructs\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nfunction expressionAllowed(stream, state, backUp) {\n return /^(?:operator|sof|keyword c|case|new|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n}\n\nCodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;\n\n // Tokenizer\n\n var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};\n\n var jsKeywords = {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": C, \"break\": C, \"continue\": C, \"new\": kw(\"new\"), \"delete\": C, \"throw\": C, \"debugger\": C,\n \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C\n };\n\n // Extend the 'normal' keywords with the TypeScript language extensions\n if (isTS) {\n var type = {type: \"variable\", style: \"variable-3\"};\n var tsKeywords = {\n // object-like things\n \"interface\": kw(\"class\"),\n \"implements\": C,\n \"namespace\": C,\n \"module\": kw(\"module\"),\n \"enum\": kw(\"module\"),\n\n // scope modifiers\n \"public\": kw(\"modifier\"),\n \"private\": kw(\"modifier\"),\n \"protected\": kw(\"modifier\"),\n \"abstract\": kw(\"modifier\"),\n\n // operators\n \"as\": operator,\n\n // types\n \"string\": type, \"number\": type, \"boolean\": type, \"any\": type\n };\n\n for (var attr in tsKeywords) {\n jsKeywords[attr] = tsKeywords[attr];\n }\n }\n\n return jsKeywords;\n }();\n\n var isOperatorChar = /[+\\-*&%=<>!?|~^]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;\n\n function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }\n\n // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.eat(/x/i)) {\n stream.eatWhile(/[\\da-f]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/o/i)) {\n stream.eatWhile(/[0-7]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/b/i)) {\n stream.eatWhile(/[01]/i);\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyu])(?![gimyu]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eatWhile(isOperatorChar);\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\") {\n stream.skipToEnd();\n return ret(\"error\", \"error\");\n } else if (isOperatorChar.test(ch)) {\n stream.eatWhile(isOperatorChar);\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];\n return (known && state.lastType != \".\") ? ret(known.type, known.style, word) :\n ret(\"variable\", \"variable\", word);\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }\n\n function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }\n\n var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;\n\n var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) break;\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/]/.test(ch)) {\n return;\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }\n\n // Parser\n\n var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};\n\n function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }\n\n function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }\n\n function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;\n\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;\n\n while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }\n\n // Combinator utils\n\n var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function register(varname) {\n function inList(list) {\n for (var v = list; v; v = v.next)\n if (v.name == varname) return true;\n return false;\n }\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (inList(state.localVars)) return;\n state.localVars = {name: varname, next: state.localVars};\n } else {\n if (inList(state.globalVars)) return;\n if (parserConfig.globalVars)\n state.globalVars = {name: varname, next: state.globalVars};\n }\n }\n\n // Combinators\n\n var defaultVars = {name: \"this\", next: {name: \"arguments\"}};\n function pushcontext() {\n cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};\n cx.state.localVars = defaultVars;\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars;\n cx.state.context = cx.state.context.prev;\n }\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;\n\n function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\") return pass();\n else return cont(exp);\n };\n return exp;\n }\n\n function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value.length), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), expression, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"{\") return cont(pushlex(\"}\"), block, poplex);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), expression, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"variable\") return cont(pushlex(\"stat\"), maybelabel);\n if (type == \"switch\") return cont(pushlex(\"form\"), expression, pushlex(\"}\", \"switch\"), expect(\"{\"),\n block, poplex, poplex);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, expect(\"(\"), funarg, expect(\")\"),\n statement, poplex, popcontext);\n if (type == \"class\") return cont(pushlex(\"form\"), className, poplex);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"module\") return cont(pushlex(\"form\"), pattern, pushlex(\"}\"), expect(\"{\"), block, poplex, poplex)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function expression(type) {\n return expressionInner(type, false);\n }\n function expressionNoComma(type) {\n return expressionInner(type, true);\n }\n function expressionInner(type, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(pattern, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }\n\n var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"keyword c\") return cont(noComma ? maybeexpressionNoComma : maybeexpression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, comprehension, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }\n function maybeexpressionNoComma(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expressionNoComma);\n }\n\n function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(expression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value)) return cont(me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (type == \"modifier\") {\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expression);\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end) {\n function proceed(type) {\n if (type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(what, proceed);\n }\n if (type == end) return cont();\n return cont(expect(end));\n }\n return function(type) {\n if (type == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type) {\n if (isTS && type == \":\") return cont(typedef);\n }\n function maybedefault(_, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function typedef(type) {\n if (type == \"variable\") {cx.marked = \"variable-3\"; return cont();}\n }\n function vardef() {\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (type == \"modifier\") return cont(pattern)\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(pattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type) {\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, expect(\")\"), poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, expect(\";\"), forspec2);\n if (type == \";\") return cont(forspec2);\n if (type == \"variable\") return cont(formaybeinof);\n return pass(expression, expect(\";\"), forspec2);\n }\n function formaybeinof(_type, value) {\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return cont(maybeoperatorComma, forspec2);\n }\n function forspec2(type, value) {\n if (type == \";\") return cont(forspec3);\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return pass(expression, expect(\";\"), forspec3);\n }\n function forspec3(type) {\n if (type != \")\") cont(expression);\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, statement, popcontext);\n }\n function funarg(type) {\n if (type == \"spread\") return cont(funarg);\n return pass(pattern, maybetype, maybedefault);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"extends\") return cont(expression, classNameAfter);\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n if (value == \"static\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(classGetterSetter, functiondef, classBody);\n return cont(functiondef, classBody);\n }\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \";\") return cont(classBody);\n if (type == \"}\") return cont();\n }\n function classGetterSetter(type) {\n if (type != \"variable\") return pass();\n cx.marked = \"property\";\n return cont();\n }\n function afterExport(_type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n return pass(statement);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n return pass(importSpec, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(expressionNoComma, maybeArrayComprehension);\n }\n function maybeArrayComprehension(type) {\n if (type == \"for\") return pass(comprehension, expect(\"]\"));\n if (type == \",\") return cont(commasep(maybeexpressionNoComma, \"]\"));\n return pass(commasep(expressionNoComma, \"]\"));\n }\n function comprehension(type) {\n if (type == \"for\") return cont(forspec, comprehension);\n if (type == \"if\") return cont(expression, comprehension);\n }\n\n function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }\n\n // Interface\n\n return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && {vars: parserConfig.localVars},\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },\n\n token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },\n\n indent: function(state, textAfter) {\n if (state.tokenize == tokenComment) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n if (lexical.type == \"stat\" && firstChar == \"}\") lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;\n\n if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },\n\n electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,\n\n expressionAllowed: expressionAllowed,\n skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});\n\nCodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);\n\nCodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });\n\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/markdown/markdown.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../xml/xml\"), require(\"../meta\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../xml/xml\", \"../meta\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"markdown\", function(cmCfg, modeCfg) {\n\n var htmlMode = CodeMirror.getMode(cmCfg, \"text/html\");\n var htmlModeMissing = htmlMode.name == \"null\"\n\n function getMode(name) {\n if (CodeMirror.findModeByName) {\n var found = CodeMirror.findModeByName(name);\n if (found) name = found.mime || found.mimes[0];\n }\n var mode = CodeMirror.getMode(cmCfg, name);\n return mode.name == \"null\" ? null : mode;\n }\n\n // Should characters that affect highlighting be highlighted separate?\n // Does not include characters that will be output (such as `1.` and `-` for lists)\n if (modeCfg.highlightFormatting === undefined)\n modeCfg.highlightFormatting = false;\n\n // Maximum number of nested blockquotes. Set to 0 for infinite nesting.\n // Excess `>` will emit `error` token.\n if (modeCfg.maxBlockquoteDepth === undefined)\n modeCfg.maxBlockquoteDepth = 0;\n\n // Should underscores in words open/close em/strong?\n if (modeCfg.underscoresBreakWords === undefined)\n modeCfg.underscoresBreakWords = true;\n\n // Use `fencedCodeBlocks` to configure fenced code blocks. false to\n // disable, string to specify a precise regexp that the fence should\n // match, and true to allow three or more backticks or tildes (as\n // per CommonMark).\n\n // Turn on task lists? (\"- [ ] \" and \"- [x] \")\n if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;\n\n // Turn on strikethrough syntax\n if (modeCfg.strikethrough === undefined)\n modeCfg.strikethrough = false;\n\n // Allow token types to be overridden by user-provided token types.\n if (modeCfg.tokenTypeOverrides === undefined)\n modeCfg.tokenTypeOverrides = {};\n\n var tokenTypes = {\n header: \"header\",\n code: \"comment\",\n quote: \"quote\",\n list1: \"variable-2\",\n list2: \"variable-3\",\n list3: \"keyword\",\n hr: \"hr\",\n image: \"tag\",\n formatting: \"formatting\",\n linkInline: \"link\",\n linkEmail: \"link\",\n linkText: \"link\",\n linkHref: \"string\",\n em: \"em\",\n strong: \"strong\",\n strikethrough: \"strikethrough\"\n };\n\n for (var tokenType in tokenTypes) {\n if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {\n tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];\n }\n }\n\n var hrRE = /^([*\\-_])(?:\\s*\\1){2,}\\s*$/\n , ulRE = /^[*\\-+]\\s+/\n , olRE = /^[0-9]+([.)])\\s+/\n , taskListRE = /^\\[(x| )\\](?=\\s)/ // Must follow ulRE or olRE\n , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/\n , setextHeaderRE = /^ *(?:\\={1,}|-{1,})\\s*$/\n , textRE = /^[^#!\\[\\]*_\\\\<>` \"'(~]+/\n , fencedCodeRE = new RegExp(\"^(\" + (modeCfg.fencedCodeBlocks === true ? \"~~~+|```+\" : modeCfg.fencedCodeBlocks) +\n \")[ \\\\t]*([\\\\w+#]*)\");\n\n function switchInline(stream, state, f) {\n state.f = state.inline = f;\n return f(stream, state);\n }\n\n function switchBlock(stream, state, f) {\n state.f = state.block = f;\n return f(stream, state);\n }\n\n function lineIsEmpty(line) {\n return !line || !/\\S/.test(line.string)\n }\n\n // Blocks\n\n function blankLine(state) {\n // Reset linkTitle state\n state.linkTitle = false;\n // Reset EM state\n state.em = false;\n // Reset STRONG state\n state.strong = false;\n // Reset strikethrough state\n state.strikethrough = false;\n // Reset state.quote\n state.quote = 0;\n // Reset state.indentedCode\n state.indentedCode = false;\n if (htmlModeMissing && state.f == htmlBlock) {\n state.f = inlineNormal;\n state.block = blockNormal;\n }\n // Reset state.trailingSpace\n state.trailingSpace = 0;\n state.trailingSpaceNewLine = false;\n // Mark this line as blank\n state.prevLine = state.thisLine\n state.thisLine = null\n return null;\n }\n\n function blockNormal(stream, state) {\n\n var sol = stream.sol();\n\n var prevLineIsList = state.list !== false,\n prevLineIsIndentedCode = state.indentedCode;\n\n state.indentedCode = false;\n\n if (prevLineIsList) {\n if (state.indentationDiff >= 0) { // Continued list\n if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block\n state.indentation -= state.indentationDiff;\n }\n state.list = null;\n } else if (state.indentation > 0) {\n state.list = null;\n } else { // No longer a list\n state.list = false;\n }\n }\n\n var match = null;\n if (state.indentationDiff >= 4) {\n stream.skipToEnd();\n if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {\n state.indentation -= 4;\n state.indentedCode = true;\n return tokenTypes.code;\n } else {\n return null;\n }\n } else if (stream.eatSpace()) {\n return null;\n } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {\n state.header = match[1].length;\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n state.f = state.inline;\n return getType(state);\n } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&\n !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {\n state.header = match[0].charAt(0) == '=' ? 1 : 2;\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n state.f = state.inline;\n return getType(state);\n } else if (stream.eat('>')) {\n state.quote = sol ? 1 : state.quote + 1;\n if (modeCfg.highlightFormatting) state.formatting = \"quote\";\n stream.eatSpace();\n return getType(state);\n } else if (stream.peek() === '[') {\n return switchInline(stream, state, footnoteLink);\n } else if (stream.match(hrRE, true)) {\n state.hr = true;\n return tokenTypes.hr;\n } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {\n var listType = null;\n if (stream.match(ulRE, true)) {\n listType = 'ul';\n } else {\n stream.match(olRE, true);\n listType = 'ol';\n }\n state.indentation = stream.column() + stream.current().length;\n state.list = true;\n\n // While this list item's marker's indentation\n // is less than the deepest list item's content's indentation,\n // pop the deepest list item indentation off the stack.\n while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) {\n state.listStack.pop();\n }\n\n // Add this list item's content's indentation to the stack\n state.listStack.push(state.indentation);\n\n if (modeCfg.taskLists && stream.match(taskListRE, false)) {\n state.taskList = true;\n }\n state.f = state.inline;\n if (modeCfg.highlightFormatting) state.formatting = [\"list\", \"list-\" + listType];\n return getType(state);\n } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {\n state.fencedChars = match[1]\n // try switching mode\n state.localMode = getMode(match[2]);\n if (state.localMode) state.localState = state.localMode.startState();\n state.f = state.block = local;\n if (modeCfg.highlightFormatting) state.formatting = \"code-block\";\n state.code = -1\n return getType(state);\n }\n\n return switchInline(stream, state, state.inline);\n }\n\n function htmlBlock(stream, state) {\n var style = htmlMode.token(stream, state.htmlState);\n if (!htmlModeMissing) {\n var inner = CodeMirror.innerMode(htmlMode, state.htmlState)\n if ((inner.mode.name == \"xml\" && inner.state.tagStart === null &&\n (!inner.state.context && inner.state.tokenize.isInText)) ||\n (state.md_inside && stream.current().indexOf(\">\") > -1)) {\n state.f = inlineNormal;\n state.block = blockNormal;\n state.htmlState = null;\n }\n }\n return style;\n }\n\n function local(stream, state) {\n if (state.fencedChars && stream.match(state.fencedChars, false)) {\n state.localMode = state.localState = null;\n state.f = state.block = leavingLocal;\n return null;\n } else if (state.localMode) {\n return state.localMode.token(stream, state.localState);\n } else {\n stream.skipToEnd();\n return tokenTypes.code;\n }\n }\n\n function leavingLocal(stream, state) {\n stream.match(state.fencedChars);\n state.block = blockNormal;\n state.f = inlineNormal;\n state.fencedChars = null;\n if (modeCfg.highlightFormatting) state.formatting = \"code-block\";\n state.code = 1\n var returnType = getType(state);\n state.code = 0\n return returnType;\n }\n\n // Inline\n function getType(state) {\n var styles = [];\n\n if (state.formatting) {\n styles.push(tokenTypes.formatting);\n\n if (typeof state.formatting === \"string\") state.formatting = [state.formatting];\n\n for (var i = 0; i < state.formatting.length; i++) {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i]);\n\n if (state.formatting[i] === \"header\") {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i] + \"-\" + state.header);\n }\n\n // Add `formatting-quote` and `formatting-quote-#` for blockquotes\n // Add `error` instead if the maximum blockquote nesting depth is passed\n if (state.formatting[i] === \"quote\") {\n if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i] + \"-\" + state.quote);\n } else {\n styles.push(\"error\");\n }\n }\n }\n }\n\n if (state.taskOpen) {\n styles.push(\"meta\");\n return styles.length ? styles.join(' ') : null;\n }\n if (state.taskClosed) {\n styles.push(\"property\");\n return styles.length ? styles.join(' ') : null;\n }\n\n if (state.linkHref) {\n styles.push(tokenTypes.linkHref, \"url\");\n } else { // Only apply inline styles to non-url text\n if (state.strong) { styles.push(tokenTypes.strong); }\n if (state.em) { styles.push(tokenTypes.em); }\n if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }\n if (state.linkText) { styles.push(tokenTypes.linkText); }\n if (state.code) { styles.push(tokenTypes.code); }\n }\n\n if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + \"-\" + state.header); }\n\n if (state.quote) {\n styles.push(tokenTypes.quote);\n\n // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth\n if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {\n styles.push(tokenTypes.quote + \"-\" + state.quote);\n } else {\n styles.push(tokenTypes.quote + \"-\" + modeCfg.maxBlockquoteDepth);\n }\n }\n\n if (state.list !== false) {\n var listMod = (state.listStack.length - 1) % 3;\n if (!listMod) {\n styles.push(tokenTypes.list1);\n } else if (listMod === 1) {\n styles.push(tokenTypes.list2);\n } else {\n styles.push(tokenTypes.list3);\n }\n }\n\n if (state.trailingSpaceNewLine) {\n styles.push(\"trailing-space-new-line\");\n } else if (state.trailingSpace) {\n styles.push(\"trailing-space-\" + (state.trailingSpace % 2 ? \"a\" : \"b\"));\n }\n\n return styles.length ? styles.join(' ') : null;\n }\n\n function handleText(stream, state) {\n if (stream.match(textRE, true)) {\n return getType(state);\n }\n return undefined;\n }\n\n function inlineNormal(stream, state) {\n var style = state.text(stream, state);\n if (typeof style !== 'undefined')\n return style;\n\n if (state.list) { // List marker (*, +, -, 1., etc)\n state.list = null;\n return getType(state);\n }\n\n if (state.taskList) {\n var taskOpen = stream.match(taskListRE, true)[1] !== \"x\";\n if (taskOpen) state.taskOpen = true;\n else state.taskClosed = true;\n if (modeCfg.highlightFormatting) state.formatting = \"task\";\n state.taskList = false;\n return getType(state);\n }\n\n state.taskOpen = false;\n state.taskClosed = false;\n\n if (state.header && stream.match(/^#+$/, true)) {\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n return getType(state);\n }\n\n // Get sol() value now, before character is consumed\n var sol = stream.sol();\n\n var ch = stream.next();\n\n // Matches link titles present on next line\n if (state.linkTitle) {\n state.linkTitle = false;\n var matchCh = ch;\n if (ch === '(') {\n matchCh = ')';\n }\n matchCh = (matchCh+'').replace(/([.?*+^$[\\]\\\\(){}|-])/g, \"\\\\$1\");\n var regex = '^\\\\s*(?:[^' + matchCh + '\\\\\\\\]+|\\\\\\\\\\\\\\\\|\\\\\\\\.)' + matchCh;\n if (stream.match(new RegExp(regex), true)) {\n return tokenTypes.linkHref;\n }\n }\n\n // If this block is changed, it may need to be updated in GFM mode\n if (ch === '`') {\n var previousFormatting = state.formatting;\n if (modeCfg.highlightFormatting) state.formatting = \"code\";\n stream.eatWhile('`');\n var count = stream.current().length\n if (state.code == 0) {\n state.code = count\n return getType(state)\n } else if (count == state.code) { // Must be exact\n var t = getType(state)\n state.code = 0\n return t\n } else {\n state.formatting = previousFormatting\n return getType(state)\n }\n } else if (state.code) {\n return getType(state);\n }\n\n if (ch === '\\\\') {\n stream.next();\n if (modeCfg.highlightFormatting) {\n var type = getType(state);\n var formattingEscape = tokenTypes.formatting + \"-escape\";\n return type ? type + \" \" + formattingEscape : formattingEscape;\n }\n }\n\n if (ch === '!' && stream.match(/\\[[^\\]]*\\] ?(?:\\(|\\[)/, false)) {\n stream.match(/\\[[^\\]]*\\]/);\n state.inline = state.f = linkHref;\n return tokenTypes.image;\n }\n\n if (ch === '[' && stream.match(/.*\\](\\(.*\\)| ?\\[.*\\])/, false)) {\n state.linkText = true;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n return getType(state);\n }\n\n if (ch === ']' && state.linkText && stream.match(/\\(.*\\)| ?\\[.*\\]/, false)) {\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n state.linkText = false;\n state.inline = state.f = linkHref;\n return type;\n }\n\n if (ch === '<' && stream.match(/^(https?|ftps?):\\/\\/(?:[^\\\\>]|\\\\.)+>/, false)) {\n state.f = state.inline = linkInline;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkInline;\n }\n\n if (ch === '<' && stream.match(/^[^> \\\\]+@(?:[^\\\\>]|\\\\.)+>/, false)) {\n state.f = state.inline = linkInline;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkEmail;\n }\n\n if (ch === '<' && stream.match(/^(!--|\\w)/, false)) {\n var end = stream.string.indexOf(\">\", stream.pos);\n if (end != -1) {\n var atts = stream.string.substring(stream.start, end);\n if (/markdown\\s*=\\s*('|\"){0,1}1('|\"){0,1}/.test(atts)) state.md_inside = true;\n }\n stream.backUp(1);\n state.htmlState = CodeMirror.startState(htmlMode);\n return switchBlock(stream, state, htmlBlock);\n }\n\n if (ch === '<' && stream.match(/^\\/\\w*?>/)) {\n state.md_inside = false;\n return \"tag\";\n }\n\n var ignoreUnderscore = false;\n if (!modeCfg.underscoresBreakWords) {\n if (ch === '_' && stream.peek() !== '_' && stream.match(/(\\w)/, false)) {\n var prevPos = stream.pos - 2;\n if (prevPos >= 0) {\n var prevCh = stream.string.charAt(prevPos);\n if (prevCh !== '_' && prevCh.match(/(\\w)/, false)) {\n ignoreUnderscore = true;\n }\n }\n }\n }\n if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {\n if (sol && stream.peek() === ' ') {\n // Do nothing, surrounded by newline and space\n } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG\n if (modeCfg.highlightFormatting) state.formatting = \"strong\";\n var t = getType(state);\n state.strong = false;\n return t;\n } else if (!state.strong && stream.eat(ch)) { // Add STRONG\n state.strong = ch;\n if (modeCfg.highlightFormatting) state.formatting = \"strong\";\n return getType(state);\n } else if (state.em === ch) { // Remove EM\n if (modeCfg.highlightFormatting) state.formatting = \"em\";\n var t = getType(state);\n state.em = false;\n return t;\n } else if (!state.em) { // Add EM\n state.em = ch;\n if (modeCfg.highlightFormatting) state.formatting = \"em\";\n return getType(state);\n }\n } else if (ch === ' ') {\n if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces\n if (stream.peek() === ' ') { // Surrounded by spaces, ignore\n return getType(state);\n } else { // Not surrounded by spaces, back up pointer\n stream.backUp(1);\n }\n }\n }\n\n if (modeCfg.strikethrough) {\n if (ch === '~' && stream.eatWhile(ch)) {\n if (state.strikethrough) {// Remove strikethrough\n if (modeCfg.highlightFormatting) state.formatting = \"strikethrough\";\n var t = getType(state);\n state.strikethrough = false;\n return t;\n } else if (stream.match(/^[^\\s]/, false)) {// Add strikethrough\n state.strikethrough = true;\n if (modeCfg.highlightFormatting) state.formatting = \"strikethrough\";\n return getType(state);\n }\n } else if (ch === ' ') {\n if (stream.match(/^~~/, true)) { // Probably surrounded by space\n if (stream.peek() === ' ') { // Surrounded by spaces, ignore\n return getType(state);\n } else { // Not surrounded by spaces, back up pointer\n stream.backUp(2);\n }\n }\n }\n }\n\n if (ch === ' ') {\n if (stream.match(/ +$/, false)) {\n state.trailingSpace++;\n } else if (state.trailingSpace) {\n state.trailingSpaceNewLine = true;\n }\n }\n\n return getType(state);\n }\n\n function linkInline(stream, state) {\n var ch = stream.next();\n\n if (ch === \">\") {\n state.f = state.inline = inlineNormal;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkInline;\n }\n\n stream.match(/^[^>]+/, true);\n\n return tokenTypes.linkInline;\n }\n\n function linkHref(stream, state) {\n // Check if space, and return NULL if so (to avoid marking the space)\n if(stream.eatSpace()){\n return null;\n }\n var ch = stream.next();\n if (ch === '(' || ch === '[') {\n state.f = state.inline = getLinkHrefInside(ch === \"(\" ? \")\" : \"]\");\n if (modeCfg.highlightFormatting) state.formatting = \"link-string\";\n state.linkHref = true;\n return getType(state);\n }\n return 'error';\n }\n\n function getLinkHrefInside(endChar) {\n return function(stream, state) {\n var ch = stream.next();\n\n if (ch === endChar) {\n state.f = state.inline = inlineNormal;\n if (modeCfg.highlightFormatting) state.formatting = \"link-string\";\n var returnState = getType(state);\n state.linkHref = false;\n return returnState;\n }\n\n if (stream.match(inlineRE(endChar), true)) {\n stream.backUp(1);\n }\n\n state.linkHref = true;\n return getType(state);\n };\n }\n\n function footnoteLink(stream, state) {\n if (stream.match(/^([^\\]\\\\]|\\\\.)*\\]:/, false)) {\n state.f = footnoteLinkInside;\n stream.next(); // Consume [\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n state.linkText = true;\n return getType(state);\n }\n return switchInline(stream, state, inlineNormal);\n }\n\n function footnoteLinkInside(stream, state) {\n if (stream.match(/^\\]:/, true)) {\n state.f = state.inline = footnoteUrl;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var returnType = getType(state);\n state.linkText = false;\n return returnType;\n }\n\n stream.match(/^([^\\]\\\\]|\\\\.)+/, true);\n\n return tokenTypes.linkText;\n }\n\n function footnoteUrl(stream, state) {\n // Check if space, and return NULL if so (to avoid marking the space)\n if(stream.eatSpace()){\n return null;\n }\n // Match URL\n stream.match(/^[^\\s]+/, true);\n // Check for link title\n if (stream.peek() === undefined) { // End of line, set flag to check next line\n state.linkTitle = true;\n } else { // More content on line, check if link title\n stream.match(/^(?:\\s+(?:\"(?:[^\"\\\\]|\\\\\\\\|\\\\.)+\"|'(?:[^'\\\\]|\\\\\\\\|\\\\.)+'|\\((?:[^)\\\\]|\\\\\\\\|\\\\.)+\\)))?/, true);\n }\n state.f = state.inline = inlineNormal;\n return tokenTypes.linkHref + \" url\";\n }\n\n var savedInlineRE = [];\n function inlineRE(endChar) {\n if (!savedInlineRE[endChar]) {\n // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)\n endChar = (endChar+'').replace(/([.?*+^$[\\]\\\\(){}|-])/g, \"\\\\$1\");\n // Match any non-endChar, escaped character, as well as the closing\n // endChar.\n savedInlineRE[endChar] = new RegExp('^(?:[^\\\\\\\\]|\\\\\\\\.)*?(' + endChar + ')');\n }\n return savedInlineRE[endChar];\n }\n\n var mode = {\n startState: function() {\n return {\n f: blockNormal,\n\n prevLine: null,\n thisLine: null,\n\n block: blockNormal,\n htmlState: null,\n indentation: 0,\n\n inline: inlineNormal,\n text: handleText,\n\n formatting: false,\n linkText: false,\n linkHref: false,\n linkTitle: false,\n code: 0,\n em: false,\n strong: false,\n header: 0,\n hr: false,\n taskList: false,\n list: false,\n listStack: [],\n quote: 0,\n trailingSpace: 0,\n trailingSpaceNewLine: false,\n strikethrough: false,\n fencedChars: null\n };\n },\n\n copyState: function(s) {\n return {\n f: s.f,\n\n prevLine: s.prevLine,\n thisLine: s.thisLine,\n\n block: s.block,\n htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),\n indentation: s.indentation,\n\n localMode: s.localMode,\n localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,\n\n inline: s.inline,\n text: s.text,\n formatting: false,\n linkTitle: s.linkTitle,\n code: s.code,\n em: s.em,\n strong: s.strong,\n strikethrough: s.strikethrough,\n header: s.header,\n hr: s.hr,\n taskList: s.taskList,\n list: s.list,\n listStack: s.listStack.slice(0),\n quote: s.quote,\n indentedCode: s.indentedCode,\n trailingSpace: s.trailingSpace,\n trailingSpaceNewLine: s.trailingSpaceNewLine,\n md_inside: s.md_inside,\n fencedChars: s.fencedChars\n };\n },\n\n token: function(stream, state) {\n\n // Reset state.formatting\n state.formatting = false;\n\n if (stream != state.thisLine) {\n var forceBlankLine = state.header || state.hr;\n\n // Reset state.header and state.hr\n state.header = 0;\n state.hr = false;\n\n if (stream.match(/^\\s*$/, true) || forceBlankLine) {\n blankLine(state);\n if (!forceBlankLine) return null\n state.prevLine = null\n }\n\n state.prevLine = state.thisLine\n state.thisLine = stream\n\n // Reset state.taskList\n state.taskList = false;\n\n // Reset state.trailingSpace\n state.trailingSpace = 0;\n state.trailingSpaceNewLine = false;\n\n state.f = state.block;\n var indentation = stream.match(/^\\s*/, true)[0].replace(/\\t/g, ' ').length;\n state.indentationDiff = Math.min(indentation - state.indentation, 4);\n state.indentation = state.indentation + state.indentationDiff;\n if (indentation > 0) return null;\n }\n return state.f(stream, state);\n },\n\n innerMode: function(state) {\n if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};\n if (state.localState) return {state: state.localState, mode: state.localMode};\n return {state: state, mode: mode};\n },\n\n blankLine: blankLine,\n\n getType: getType,\n\n fold: \"markdown\"\n };\n return mode;\n}, \"xml\");\n\nCodeMirror.defineMIME(\"text/x-markdown\", \"markdown\");\n\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/markdown/markdown.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/meta.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.modeInfo = [\n {name: \"APL\", mime: \"text/apl\", mode: \"apl\", ext: [\"dyalog\", \"apl\"]},\n {name: \"PGP\", mimes: [\"application/pgp\", \"application/pgp-keys\", \"application/pgp-signature\"], mode: \"asciiarmor\", ext: [\"pgp\"]},\n {name: \"ASN.1\", mime: \"text/x-ttcn-asn\", mode: \"asn.1\", ext: [\"asn\", \"asn1\"]},\n {name: \"Asterisk\", mime: \"text/x-asterisk\", mode: \"asterisk\", file: /^extensions\\.conf$/i},\n {name: \"Brainfuck\", mime: \"text/x-brainfuck\", mode: \"brainfuck\", ext: [\"b\", \"bf\"]},\n {name: \"C\", mime: \"text/x-csrc\", mode: \"clike\", ext: [\"c\", \"h\"]},\n {name: \"C++\", mime: \"text/x-c++src\", mode: \"clike\", ext: [\"cpp\", \"c++\", \"cc\", \"cxx\", \"hpp\", \"h++\", \"hh\", \"hxx\"], alias: [\"cpp\"]},\n {name: \"Cobol\", mime: \"text/x-cobol\", mode: \"cobol\", ext: [\"cob\", \"cpy\"]},\n {name: \"C#\", mime: \"text/x-csharp\", mode: \"clike\", ext: [\"cs\"], alias: [\"csharp\"]},\n {name: \"Clojure\", mime: \"text/x-clojure\", mode: \"clojure\", ext: [\"clj\", \"cljc\", \"cljx\"]},\n {name: \"ClojureScript\", mime: \"text/x-clojurescript\", mode: \"clojure\", ext: [\"cljs\"]},\n {name: \"Closure Stylesheets (GSS)\", mime: \"text/x-gss\", mode: \"css\", ext: [\"gss\"]},\n {name: \"CMake\", mime: \"text/x-cmake\", mode: \"cmake\", ext: [\"cmake\", \"cmake.in\"], file: /^CMakeLists.txt$/},\n {name: \"CoffeeScript\", mime: \"text/x-coffeescript\", mode: \"coffeescript\", ext: [\"coffee\"], alias: [\"coffee\", \"coffee-script\"]},\n {name: \"Common Lisp\", mime: \"text/x-common-lisp\", mode: \"commonlisp\", ext: [\"cl\", \"lisp\", \"el\"], alias: [\"lisp\"]},\n {name: \"Cypher\", mime: \"application/x-cypher-query\", mode: \"cypher\", ext: [\"cyp\", \"cypher\"]},\n {name: \"Cython\", mime: \"text/x-cython\", mode: \"python\", ext: [\"pyx\", \"pxd\", \"pxi\"]},\n {name: \"Crystal\", mime: \"text/x-crystal\", mode: \"crystal\", ext: [\"cr\"]},\n {name: \"CSS\", mime: \"text/css\", mode: \"css\", ext: [\"css\"]},\n {name: \"CQL\", mime: \"text/x-cassandra\", mode: \"sql\", ext: [\"cql\"]},\n {name: \"D\", mime: \"text/x-d\", mode: \"d\", ext: [\"d\"]},\n {name: \"Dart\", mimes: [\"application/dart\", \"text/x-dart\"], mode: \"dart\", ext: [\"dart\"]},\n {name: \"diff\", mime: \"text/x-diff\", mode: \"diff\", ext: [\"diff\", \"patch\"]},\n {name: \"Django\", mime: \"text/x-django\", mode: \"django\"},\n {name: \"Dockerfile\", mime: \"text/x-dockerfile\", mode: \"dockerfile\", file: /^Dockerfile$/},\n {name: \"DTD\", mime: \"application/xml-dtd\", mode: \"dtd\", ext: [\"dtd\"]},\n {name: \"Dylan\", mime: \"text/x-dylan\", mode: \"dylan\", ext: [\"dylan\", \"dyl\", \"intr\"]},\n {name: \"EBNF\", mime: \"text/x-ebnf\", mode: \"ebnf\"},\n {name: \"ECL\", mime: \"text/x-ecl\", mode: \"ecl\", ext: [\"ecl\"]},\n {name: \"edn\", mime: \"application/edn\", mode: \"clojure\", ext: [\"edn\"]},\n {name: \"Eiffel\", mime: \"text/x-eiffel\", mode: \"eiffel\", ext: [\"e\"]},\n {name: \"Elm\", mime: \"text/x-elm\", mode: \"elm\", ext: [\"elm\"]},\n {name: \"Embedded Javascript\", mime: \"application/x-ejs\", mode: \"htmlembedded\", ext: [\"ejs\"]},\n {name: \"Embedded Ruby\", mime: \"application/x-erb\", mode: \"htmlembedded\", ext: [\"erb\"]},\n {name: \"Erlang\", mime: \"text/x-erlang\", mode: \"erlang\", ext: [\"erl\"]},\n {name: \"Factor\", mime: \"text/x-factor\", mode: \"factor\", ext: [\"factor\"]},\n {name: \"FCL\", mime: \"text/x-fcl\", mode: \"fcl\"},\n {name: \"Forth\", mime: \"text/x-forth\", mode: \"forth\", ext: [\"forth\", \"fth\", \"4th\"]},\n {name: \"Fortran\", mime: \"text/x-fortran\", mode: \"fortran\", ext: [\"f\", \"for\", \"f77\", \"f90\"]},\n {name: \"F#\", mime: \"text/x-fsharp\", mode: \"mllike\", ext: [\"fs\"], alias: [\"fsharp\"]},\n {name: \"Gas\", mime: \"text/x-gas\", mode: \"gas\", ext: [\"s\"]},\n {name: \"Gherkin\", mime: \"text/x-feature\", mode: \"gherkin\", ext: [\"feature\"]},\n {name: \"GitHub Flavored Markdown\", mime: \"text/x-gfm\", mode: \"gfm\", file: /^(readme|contributing|history).md$/i},\n {name: \"Go\", mime: \"text/x-go\", mode: \"go\", ext: [\"go\"]},\n {name: \"Groovy\", mime: \"text/x-groovy\", mode: \"groovy\", ext: [\"groovy\", \"gradle\"]},\n {name: \"HAML\", mime: \"text/x-haml\", mode: \"haml\", ext: [\"haml\"]},\n {name: \"Haskell\", mime: \"text/x-haskell\", mode: \"haskell\", ext: [\"hs\"]},\n {name: \"Haskell (Literate)\", mime: \"text/x-literate-haskell\", mode: \"haskell-literate\", ext: [\"lhs\"]},\n {name: \"Haxe\", mime: \"text/x-haxe\", mode: \"haxe\", ext: [\"hx\"]},\n {name: \"HXML\", mime: \"text/x-hxml\", mode: \"haxe\", ext: [\"hxml\"]},\n {name: \"ASP.NET\", mime: \"application/x-aspx\", mode: \"htmlembedded\", ext: [\"aspx\"], alias: [\"asp\", \"aspx\"]},\n {name: \"HTML\", mime: \"text/html\", mode: \"htmlmixed\", ext: [\"html\", \"htm\"], alias: [\"xhtml\"]},\n {name: \"HTTP\", mime: \"message/http\", mode: \"http\"},\n {name: \"IDL\", mime: \"text/x-idl\", mode: \"idl\", ext: [\"pro\"]},\n {name: \"Jade\", mime: \"text/x-jade\", mode: \"jade\", ext: [\"jade\"]},\n {name: \"Java\", mime: \"text/x-java\", mode: \"clike\", ext: [\"java\"]},\n {name: \"Java Server Pages\", mime: \"application/x-jsp\", mode: \"htmlembedded\", ext: [\"jsp\"], alias: [\"jsp\"]},\n {name: \"JavaScript\", mimes: [\"text/javascript\", \"text/ecmascript\", \"application/javascript\", \"application/x-javascript\", \"application/ecmascript\"],\n mode: \"javascript\", ext: [\"js\"], alias: [\"ecmascript\", \"js\", \"node\"]},\n {name: \"JSON\", mimes: [\"application/json\", \"application/x-json\"], mode: \"javascript\", ext: [\"json\", \"map\"], alias: [\"json5\"]},\n {name: \"JSON-LD\", mime: \"application/ld+json\", mode: \"javascript\", ext: [\"jsonld\"], alias: [\"jsonld\"]},\n {name: \"JSX\", mime: \"text/jsx\", mode: \"jsx\", ext: [\"jsx\"]},\n {name: \"Jinja2\", mime: \"null\", mode: \"jinja2\"},\n {name: \"Julia\", mime: \"text/x-julia\", mode: \"julia\", ext: [\"jl\"]},\n {name: \"Kotlin\", mime: \"text/x-kotlin\", mode: \"clike\", ext: [\"kt\"]},\n {name: \"LESS\", mime: \"text/x-less\", mode: \"css\", ext: [\"less\"]},\n {name: \"LiveScript\", mime: \"text/x-livescript\", mode: \"livescript\", ext: [\"ls\"], alias: [\"ls\"]},\n {name: \"Lua\", mime: \"text/x-lua\", mode: \"lua\", ext: [\"lua\"]},\n {name: \"Markdown\", mime: \"text/x-markdown\", mode: \"markdown\", ext: [\"markdown\", \"md\", \"mkd\"]},\n {name: \"mIRC\", mime: \"text/mirc\", mode: \"mirc\"},\n {name: \"MariaDB SQL\", mime: \"text/x-mariadb\", mode: \"sql\"},\n {name: \"Mathematica\", mime: \"text/x-mathematica\", mode: \"mathematica\", ext: [\"m\", \"nb\"]},\n {name: \"Modelica\", mime: \"text/x-modelica\", mode: \"modelica\", ext: [\"mo\"]},\n {name: \"MUMPS\", mime: \"text/x-mumps\", mode: \"mumps\", ext: [\"mps\"]},\n {name: \"MS SQL\", mime: \"text/x-mssql\", mode: \"sql\"},\n {name: \"MySQL\", mime: \"text/x-mysql\", mode: \"sql\"},\n {name: \"Nginx\", mime: \"text/x-nginx-conf\", mode: \"nginx\", file: /nginx.*\\.conf$/i},\n {name: \"NSIS\", mime: \"text/x-nsis\", mode: \"nsis\", ext: [\"nsh\", \"nsi\"]},\n {name: \"NTriples\", mime: \"text/n-triples\", mode: \"ntriples\", ext: [\"nt\"]},\n {name: \"Objective C\", mime: \"text/x-objectivec\", mode: \"clike\", ext: [\"m\", \"mm\"]},\n {name: \"OCaml\", mime: \"text/x-ocaml\", mode: \"mllike\", ext: [\"ml\", \"mli\", \"mll\", \"mly\"]},\n {name: \"Octave\", mime: \"text/x-octave\", mode: \"octave\", ext: [\"m\"]},\n {name: \"Oz\", mime: \"text/x-oz\", mode: \"oz\", ext: [\"oz\"]},\n {name: \"Pascal\", mime: \"text/x-pascal\", mode: \"pascal\", ext: [\"p\", \"pas\"]},\n {name: \"PEG.js\", mime: \"null\", mode: \"pegjs\", ext: [\"jsonld\"]},\n {name: \"Perl\", mime: \"text/x-perl\", mode: \"perl\", ext: [\"pl\", \"pm\"]},\n {name: \"PHP\", mime: \"application/x-httpd-php\", mode: \"php\", ext: [\"php\", \"php3\", \"php4\", \"php5\", \"phtml\"]},\n {name: \"Pig\", mime: \"text/x-pig\", mode: \"pig\", ext: [\"pig\"]},\n {name: \"Plain Text\", mime: \"text/plain\", mode: \"null\", ext: [\"txt\", \"text\", \"conf\", \"def\", \"list\", \"log\"]},\n {name: \"PLSQL\", mime: \"text/x-plsql\", mode: \"sql\", ext: [\"pls\"]},\n {name: \"Properties files\", mime: \"text/x-properties\", mode: \"properties\", ext: [\"properties\", \"ini\", \"in\"], alias: [\"ini\", \"properties\"]},\n {name: \"ProtoBuf\", mime: \"text/x-protobuf\", mode: \"protobuf\", ext: [\"proto\"]},\n {name: \"Python\", mime: \"text/x-python\", mode: \"python\", ext: [\"py\", \"pyw\"]},\n {name: \"Puppet\", mime: \"text/x-puppet\", mode: \"puppet\", ext: [\"pp\"]},\n {name: \"Q\", mime: \"text/x-q\", mode: \"q\", ext: [\"q\"]},\n {name: \"R\", mime: \"text/x-rsrc\", mode: \"r\", ext: [\"r\"], alias: [\"rscript\"]},\n {name: \"reStructuredText\", mime: \"text/x-rst\", mode: \"rst\", ext: [\"rst\"], alias: [\"rst\"]},\n {name: \"RPM Changes\", mime: \"text/x-rpm-changes\", mode: \"rpm\"},\n {name: \"RPM Spec\", mime: \"text/x-rpm-spec\", mode: \"rpm\", ext: [\"spec\"]},\n {name: \"Ruby\", mime: \"text/x-ruby\", mode: \"ruby\", ext: [\"rb\"], alias: [\"jruby\", \"macruby\", \"rake\", \"rb\", \"rbx\"]},\n {name: \"Rust\", mime: \"text/x-rustsrc\", mode: \"rust\", ext: [\"rs\"]},\n {name: \"Sass\", mime: \"text/x-sass\", mode: \"sass\", ext: [\"sass\"]},\n {name: \"Scala\", mime: \"text/x-scala\", mode: \"clike\", ext: [\"scala\"]},\n {name: \"Scheme\", mime: \"text/x-scheme\", mode: \"scheme\", ext: [\"scm\", \"ss\"]},\n {name: \"SCSS\", mime: \"text/x-scss\", mode: \"css\", ext: [\"scss\"]},\n {name: \"Shell\", mime: \"text/x-sh\", mode: \"shell\", ext: [\"sh\", \"ksh\", \"bash\"], alias: [\"bash\", \"sh\", \"zsh\"], file: /^PKGBUILD$/},\n {name: \"Sieve\", mime: \"application/sieve\", mode: \"sieve\", ext: [\"siv\", \"sieve\"]},\n {name: \"Slim\", mimes: [\"text/x-slim\", \"application/x-slim\"], mode: \"slim\", ext: [\"slim\"]},\n {name: \"Smalltalk\", mime: \"text/x-stsrc\", mode: \"smalltalk\", ext: [\"st\"]},\n {name: \"Smarty\", mime: \"text/x-smarty\", mode: \"smarty\", ext: [\"tpl\"]},\n {name: \"Solr\", mime: \"text/x-solr\", mode: \"solr\"},\n {name: \"Soy\", mime: \"text/x-soy\", mode: \"soy\", ext: [\"soy\"], alias: [\"closure template\"]},\n {name: \"SPARQL\", mime: \"application/sparql-query\", mode: \"sparql\", ext: [\"rq\", \"sparql\"], alias: [\"sparul\"]},\n {name: \"Spreadsheet\", mime: \"text/x-spreadsheet\", mode: \"spreadsheet\", alias: [\"excel\", \"formula\"]},\n {name: \"SQL\", mime: \"text/x-sql\", mode: \"sql\", ext: [\"sql\"]},\n {name: \"Squirrel\", mime: \"text/x-squirrel\", mode: \"clike\", ext: [\"nut\"]},\n {name: \"Swift\", mime: \"text/x-swift\", mode: \"swift\", ext: [\"swift\"]},\n {name: \"sTeX\", mime: \"text/x-stex\", mode: \"stex\"},\n {name: \"LaTeX\", mime: \"text/x-latex\", mode: \"stex\", ext: [\"text\", \"ltx\"], alias: [\"tex\"]},\n {name: \"SystemVerilog\", mime: \"text/x-systemverilog\", mode: \"verilog\", ext: [\"v\"]},\n {name: \"Tcl\", mime: \"text/x-tcl\", mode: \"tcl\", ext: [\"tcl\"]},\n {name: \"Textile\", mime: \"text/x-textile\", mode: \"textile\", ext: [\"textile\"]},\n {name: \"TiddlyWiki \", mime: \"text/x-tiddlywiki\", mode: \"tiddlywiki\"},\n {name: \"Tiki wiki\", mime: \"text/tiki\", mode: \"tiki\"},\n {name: \"TOML\", mime: \"text/x-toml\", mode: \"toml\", ext: [\"toml\"]},\n {name: \"Tornado\", mime: \"text/x-tornado\", mode: \"tornado\"},\n {name: \"troff\", mime: \"text/troff\", mode: \"troff\", ext: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]},\n {name: \"TTCN\", mime: \"text/x-ttcn\", mode: \"ttcn\", ext: [\"ttcn\", \"ttcn3\", \"ttcnpp\"]},\n {name: \"TTCN_CFG\", mime: \"text/x-ttcn-cfg\", mode: \"ttcn-cfg\", ext: [\"cfg\"]},\n {name: \"Turtle\", mime: \"text/turtle\", mode: \"turtle\", ext: [\"ttl\"]},\n {name: \"TypeScript\", mime: \"application/typescript\", mode: \"javascript\", ext: [\"ts\"], alias: [\"ts\"]},\n {name: \"Twig\", mime: \"text/x-twig\", mode: \"twig\"},\n {name: \"VB.NET\", mime: \"text/x-vb\", mode: \"vb\", ext: [\"vb\"]},\n {name: \"VBScript\", mime: \"text/vbscript\", mode: \"vbscript\", ext: [\"vbs\"]},\n {name: \"Velocity\", mime: \"text/velocity\", mode: \"velocity\", ext: [\"vtl\"]},\n {name: \"Verilog\", mime: \"text/x-verilog\", mode: \"verilog\", ext: [\"v\"]},\n {name: \"VHDL\", mime: \"text/x-vhdl\", mode: \"vhdl\", ext: [\"vhd\", \"vhdl\"]},\n {name: \"XML\", mimes: [\"application/xml\", \"text/xml\"], mode: \"xml\", ext: [\"xml\", \"xsl\", \"xsd\"], alias: [\"rss\", \"wsdl\", \"xsd\"]},\n {name: \"XQuery\", mime: \"application/xquery\", mode: \"xquery\", ext: [\"xy\", \"xquery\"]},\n {name: \"YAML\", mime: \"text/x-yaml\", mode: \"yaml\", ext: [\"yaml\", \"yml\"], alias: [\"yml\"]},\n {name: \"Z80\", mime: \"text/x-z80\", mode: \"z80\", ext: [\"z80\"]},\n {name: \"mscgen\", mime: \"text/x-mscgen\", mode: \"mscgen\", ext: [\"mscgen\", \"mscin\", \"msc\"]},\n {name: \"xu\", mime: \"text/x-xu\", mode: \"mscgen\", ext: [\"xu\"]},\n {name: \"msgenny\", mime: \"text/x-msgenny\", mode: \"mscgen\", ext: [\"msgenny\"]}\n ];\n // Ensure all modes have a mime property for backwards compatibility\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.mimes) info.mime = info.mimes[0];\n }\n\n CodeMirror.findModeByMIME = function(mime) {\n mime = mime.toLowerCase();\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.mime == mime) return info;\n if (info.mimes) for (var j = 0; j < info.mimes.length; j++)\n if (info.mimes[j] == mime) return info;\n }\n };\n\n CodeMirror.findModeByExtension = function(ext) {\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.ext) for (var j = 0; j < info.ext.length; j++)\n if (info.ext[j] == ext) return info;\n }\n };\n\n CodeMirror.findModeByFileName = function(filename) {\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.file && info.file.test(filename)) return info;\n }\n var dot = filename.lastIndexOf(\".\");\n var ext = dot > -1 && filename.substring(dot + 1, filename.length);\n if (ext) return CodeMirror.findModeByExtension(ext);\n };\n\n CodeMirror.findModeByName = function(name) {\n name = name.toLowerCase();\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.name.toLowerCase() == name) return info;\n if (info.alias) for (var j = 0; j < info.alias.length; j++)\n if (info.alias[j].toLowerCase() == name) return info;\n }\n };\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/meta.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/tiddlywiki/tiddlywiki.css": {
"text": "span.cm-underlined {\n text-decoration: underline;\n}\nspan.cm-strikethrough {\n text-decoration: line-through;\n}\nspan.cm-brace {\n color: #170;\n font-weight: bold;\n}\nspan.cm-table {\n color: blue;\n font-weight: bold;\n}\n",
"type": "text/css",
"title": "$:/plugins/tiddlywiki/codemirror/mode/tiddlywiki/tiddlywiki.css",
"tags": "[[$:/tags/Stylesheet]]"
},
"$:/plugins/tiddlywiki/codemirror/mode/tiddlywiki/tiddlywiki.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n/***\n |''Name''|tiddlywiki.js|\n |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror|\n |''Author''|PMario|\n |''Version''|0.1.7|\n |''Status''|''stable''|\n |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]|\n |''Documentation''|http://codemirror.tiddlyspace.com/|\n |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|\n |''CoreVersion''|2.5.0|\n |''Requires''|codemirror.js|\n |''Keywords''|syntax highlighting color code mirror codemirror|\n ! Info\n CoreVersion parameter is needed for TiddlyWiki only!\n***/\n//{{{\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"tiddlywiki\", function () {\n // Tokenizer\n var textwords = {};\n\n var keywords = function () {\n function kw(type) {\n return { type: type, style: \"macro\"};\n }\n return {\n \"allTags\": kw('allTags'), \"closeAll\": kw('closeAll'), \"list\": kw('list'),\n \"newJournal\": kw('newJournal'), \"newTiddler\": kw('newTiddler'),\n \"permaview\": kw('permaview'), \"saveChanges\": kw('saveChanges'),\n \"search\": kw('search'), \"slider\": kw('slider'), \"tabs\": kw('tabs'),\n \"tag\": kw('tag'), \"tagging\": kw('tagging'), \"tags\": kw('tags'),\n \"tiddler\": kw('tiddler'), \"timeline\": kw('timeline'),\n \"today\": kw('today'), \"version\": kw('version'), \"option\": kw('option'),\n\n \"with\": kw('with'),\n \"filter\": kw('filter')\n };\n }();\n\n var isSpaceName = /[\\w_\\-]/i,\n reHR = /^\\-\\-\\-\\-+$/, // <hr>\n reWikiCommentStart = /^\\/\\*\\*\\*$/, // /***\n reWikiCommentStop = /^\\*\\*\\*\\/$/, // ***/\n reBlockQuote = /^<<<$/,\n\n reJsCodeStart = /^\\/\\/\\{\\{\\{$/, // //{{{ js block start\n reJsCodeStop = /^\\/\\/\\}\\}\\}$/, // //}}} js stop\n reXmlCodeStart = /^<!--\\{\\{\\{-->$/, // xml block start\n reXmlCodeStop = /^<!--\\}\\}\\}-->$/, // xml stop\n\n reCodeBlockStart = /^\\{\\{\\{$/, // {{{ TW text div block start\n reCodeBlockStop = /^\\}\\}\\}$/, // }}} TW text stop\n\n reUntilCodeStop = /.*?\\}\\}\\}/;\n\n function chain(stream, state, f) {\n state.tokenize = f;\n return f(stream, state);\n }\n\n function jsTokenBase(stream, state) {\n var sol = stream.sol(), ch;\n\n state.block = false; // indicates the start of a code block.\n\n ch = stream.peek(); // don't eat, to make matching simpler\n\n // check start of blocks\n if (sol && /[<\\/\\*{}\\-]/.test(ch)) {\n if (stream.match(reCodeBlockStart)) {\n state.block = true;\n return chain(stream, state, twTokenCode);\n }\n if (stream.match(reBlockQuote)) {\n return 'quote';\n }\n if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {\n return 'comment';\n }\n if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {\n return 'comment';\n }\n if (stream.match(reHR)) {\n return 'hr';\n }\n } // sol\n ch = stream.next();\n\n if (sol && /[\\/\\*!#;:>|]/.test(ch)) {\n if (ch == \"!\") { // tw header\n stream.skipToEnd();\n return \"header\";\n }\n if (ch == \"*\") { // tw list\n stream.eatWhile('*');\n return \"comment\";\n }\n if (ch == \"#\") { // tw numbered list\n stream.eatWhile('#');\n return \"comment\";\n }\n if (ch == \";\") { // definition list, term\n stream.eatWhile(';');\n return \"comment\";\n }\n if (ch == \":\") { // definition list, description\n stream.eatWhile(':');\n return \"comment\";\n }\n if (ch == \">\") { // single line quote\n stream.eatWhile(\">\");\n return \"quote\";\n }\n if (ch == '|') {\n return 'header';\n }\n }\n\n if (ch == '{' && stream.match(/\\{\\{/)) {\n return chain(stream, state, twTokenCode);\n }\n\n // rudimentary html:// file:// link matching. TW knows much more ...\n if (/[hf]/i.test(ch)) {\n if (/[ti]/i.test(stream.peek()) && stream.match(/\\b(ttps?|tp|ile):\\/\\/[\\-A-Z0-9+&@#\\/%?=~_|$!:,.;]*[A-Z0-9+&@#\\/%=~_|$]/i)) {\n return \"link\";\n }\n }\n // just a little string indicator, don't want to have the whole string covered\n if (ch == '\"') {\n return 'string';\n }\n if (ch == '~') { // _no_ CamelCase indicator should be bold\n return 'brace';\n }\n if (/[\\[\\]]/.test(ch)) { // check for [[..]]\n if (stream.peek() == ch) {\n stream.next();\n return 'brace';\n }\n }\n if (ch == \"@\") { // check for space link. TODO fix @@...@@ highlighting\n stream.eatWhile(isSpaceName);\n return \"link\";\n }\n if (/\\d/.test(ch)) { // numbers\n stream.eatWhile(/\\d/);\n return \"number\";\n }\n if (ch == \"/\") { // tw invisible comment\n if (stream.eat(\"%\")) {\n return chain(stream, state, twTokenComment);\n }\n else if (stream.eat(\"/\")) { //\n return chain(stream, state, twTokenEm);\n }\n }\n if (ch == \"_\") { // tw underline\n if (stream.eat(\"_\")) {\n return chain(stream, state, twTokenUnderline);\n }\n }\n // strikethrough and mdash handling\n if (ch == \"-\") {\n if (stream.eat(\"-\")) {\n // if strikethrough looks ugly, change CSS.\n if (stream.peek() != ' ')\n return chain(stream, state, twTokenStrike);\n // mdash\n if (stream.peek() == ' ')\n return 'brace';\n }\n }\n if (ch == \"'\") { // tw bold\n if (stream.eat(\"'\")) {\n return chain(stream, state, twTokenStrong);\n }\n }\n if (ch == \"<\") { // tw macro\n if (stream.eat(\"<\")) {\n return chain(stream, state, twTokenMacro);\n }\n }\n else {\n return null;\n }\n\n // core macro handling\n stream.eatWhile(/[\\w\\$_]/);\n var word = stream.current(),\n known = textwords.propertyIsEnumerable(word) && textwords[word];\n\n return known ? known.style : null;\n } // jsTokenBase()\n\n // tw invisible comment\n function twTokenComment(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"%\");\n }\n return \"comment\";\n }\n\n // tw strong / bold\n function twTokenStrong(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return \"strong\";\n }\n\n // tw code\n function twTokenCode(stream, state) {\n var sb = state.block;\n\n if (sb && stream.current()) {\n return \"comment\";\n }\n\n if (!sb && stream.match(reUntilCodeStop)) {\n state.tokenize = jsTokenBase;\n return \"comment\";\n }\n\n if (sb && stream.sol() && stream.match(reCodeBlockStop)) {\n state.tokenize = jsTokenBase;\n return \"comment\";\n }\n\n stream.next();\n return \"comment\";\n }\n\n // tw em / italic\n function twTokenEm(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"/\");\n }\n return \"em\";\n }\n\n // tw underlined text\n function twTokenUnderline(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"_\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"_\");\n }\n return \"underlined\";\n }\n\n // tw strike through text looks ugly\n // change CSS if needed\n function twTokenStrike(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \"-\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"-\");\n }\n return \"strikethrough\";\n }\n\n // macro\n function twTokenMacro(stream, state) {\n var ch, word, known;\n\n if (stream.current() == '<<') {\n return 'macro';\n }\n\n ch = stream.next();\n if (!ch) {\n state.tokenize = jsTokenBase;\n return null;\n }\n if (ch == \">\") {\n if (stream.peek() == '>') {\n stream.next();\n state.tokenize = jsTokenBase;\n return \"macro\";\n }\n }\n\n stream.eatWhile(/[\\w\\$_]/);\n word = stream.current();\n known = keywords.propertyIsEnumerable(word) && keywords[word];\n\n if (known) {\n return known.style, word;\n }\n else {\n return null, word;\n }\n }\n\n // Interface\n return {\n startState: function () {\n return {\n tokenize: jsTokenBase,\n indented: 0,\n level: 0\n };\n },\n\n token: function (stream, state) {\n if (stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n return style;\n },\n\n electricChars: \"\"\n };\n});\n\nCodeMirror.defineMIME(\"text/x-tiddlywiki\", \"tiddlywiki\");\n});\n\n//}}}\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/tiddlywiki/tiddlywiki.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar htmlConfig = {\n autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,\n 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,\n 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,\n 'track': true, 'wbr': true, 'menuitem': true},\n implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,\n 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,\n 'th': true, 'tr': true},\n contextGrabbers: {\n 'dd': {'dd': true, 'dt': true},\n 'dt': {'dd': true, 'dt': true},\n 'li': {'li': true},\n 'option': {'option': true, 'optgroup': true},\n 'optgroup': {'optgroup': true},\n 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,\n 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,\n 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,\n 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,\n 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},\n 'rp': {'rp': true, 'rt': true},\n 'rt': {'rp': true, 'rt': true},\n 'tbody': {'tbody': true, 'tfoot': true},\n 'td': {'td': true, 'th': true},\n 'tfoot': {'tbody': true},\n 'th': {'td': true, 'th': true},\n 'thead': {'tbody': true, 'tfoot': true},\n 'tr': {'tr': true}\n },\n doNotIndent: {\"pre\": true},\n allowUnquoted: true,\n allowMissing: true,\n caseFold: true\n}\n\nvar xmlConfig = {\n autoSelfClosers: {},\n implicitlyClosed: {},\n contextGrabbers: {},\n doNotIndent: {},\n allowUnquoted: false,\n allowMissing: false,\n caseFold: false\n}\n\nCodeMirror.defineMode(\"xml\", function(editorConf, config_) {\n var indentUnit = editorConf.indentUnit\n var config = {}\n var defaults = config_.htmlMode ? htmlConfig : xmlConfig\n for (var prop in defaults) config[prop] = defaults[prop]\n for (var prop in config_) config[prop] = config_[prop]\n\n // Return variables for tokenizers\n var type, setStyle;\n\n function inText(stream, state) {\n function chain(parser) {\n state.tokenize = parser;\n return parser(stream, state);\n }\n\n var ch = stream.next();\n if (ch == \"<\") {\n if (stream.eat(\"!\")) {\n if (stream.eat(\"[\")) {\n if (stream.match(\"CDATA[\")) return chain(inBlock(\"atom\", \"]]>\"));\n else return null;\n } else if (stream.match(\"--\")) {\n return chain(inBlock(\"comment\", \"-->\"));\n } else if (stream.match(\"DOCTYPE\", true, true)) {\n stream.eatWhile(/[\\w\\._\\-]/);\n return chain(doctype(1));\n } else {\n return null;\n }\n } else if (stream.eat(\"?\")) {\n stream.eatWhile(/[\\w\\._\\-]/);\n state.tokenize = inBlock(\"meta\", \"?>\");\n return \"meta\";\n } else {\n type = stream.eat(\"/\") ? \"closeTag\" : \"openTag\";\n state.tokenize = inTag;\n return \"tag bracket\";\n }\n } else if (ch == \"&\") {\n var ok;\n if (stream.eat(\"#\")) {\n if (stream.eat(\"x\")) {\n ok = stream.eatWhile(/[a-fA-F\\d]/) && stream.eat(\";\");\n } else {\n ok = stream.eatWhile(/[\\d]/) && stream.eat(\";\");\n }\n } else {\n ok = stream.eatWhile(/[\\w\\.\\-:]/) && stream.eat(\";\");\n }\n return ok ? \"atom\" : \"error\";\n } else {\n stream.eatWhile(/[^&<]/);\n return null;\n }\n }\n inText.isInText = true;\n\n function inTag(stream, state) {\n var ch = stream.next();\n if (ch == \">\" || (ch == \"/\" && stream.eat(\">\"))) {\n state.tokenize = inText;\n type = ch == \">\" ? \"endTag\" : \"selfcloseTag\";\n return \"tag bracket\";\n } else if (ch == \"=\") {\n type = \"equals\";\n return null;\n } else if (ch == \"<\") {\n state.tokenize = inText;\n state.state = baseState;\n state.tagName = state.tagStart = null;\n var next = state.tokenize(stream, state);\n return next ? next + \" tag error\" : \"tag error\";\n } else if (/[\\'\\\"]/.test(ch)) {\n state.tokenize = inAttribute(ch);\n state.stringStartCol = stream.column();\n return state.tokenize(stream, state);\n } else {\n stream.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/);\n return \"word\";\n }\n }\n\n function inAttribute(quote) {\n var closure = function(stream, state) {\n while (!stream.eol()) {\n if (stream.next() == quote) {\n state.tokenize = inTag;\n break;\n }\n }\n return \"string\";\n };\n closure.isInAttribute = true;\n return closure;\n }\n\n function inBlock(style, terminator) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n state.tokenize = inText;\n break;\n }\n stream.next();\n }\n return style;\n };\n }\n function doctype(depth) {\n return function(stream, state) {\n var ch;\n while ((ch = stream.next()) != null) {\n if (ch == \"<\") {\n state.tokenize = doctype(depth + 1);\n return state.tokenize(stream, state);\n } else if (ch == \">\") {\n if (depth == 1) {\n state.tokenize = inText;\n break;\n } else {\n state.tokenize = doctype(depth - 1);\n return state.tokenize(stream, state);\n }\n }\n }\n return \"meta\";\n };\n }\n\n function Context(state, tagName, startOfLine) {\n this.prev = state.context;\n this.tagName = tagName;\n this.indent = state.indented;\n this.startOfLine = startOfLine;\n if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))\n this.noIndent = true;\n }\n function popContext(state) {\n if (state.context) state.context = state.context.prev;\n }\n function maybePopContext(state, nextTagName) {\n var parentTagName;\n while (true) {\n if (!state.context) {\n return;\n }\n parentTagName = state.context.tagName;\n if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||\n !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {\n return;\n }\n popContext(state);\n }\n }\n\n function baseState(type, stream, state) {\n if (type == \"openTag\") {\n state.tagStart = stream.column();\n return tagNameState;\n } else if (type == \"closeTag\") {\n return closeTagNameState;\n } else {\n return baseState;\n }\n }\n function tagNameState(type, stream, state) {\n if (type == \"word\") {\n state.tagName = stream.current();\n setStyle = \"tag\";\n return attrState;\n } else {\n setStyle = \"error\";\n return tagNameState;\n }\n }\n function closeTagNameState(type, stream, state) {\n if (type == \"word\") {\n var tagName = stream.current();\n if (state.context && state.context.tagName != tagName &&\n config.implicitlyClosed.hasOwnProperty(state.context.tagName))\n popContext(state);\n if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {\n setStyle = \"tag\";\n return closeState;\n } else {\n setStyle = \"tag error\";\n return closeStateErr;\n }\n } else {\n setStyle = \"error\";\n return closeStateErr;\n }\n }\n\n function closeState(type, _stream, state) {\n if (type != \"endTag\") {\n setStyle = \"error\";\n return closeState;\n }\n popContext(state);\n return baseState;\n }\n function closeStateErr(type, stream, state) {\n setStyle = \"error\";\n return closeState(type, stream, state);\n }\n\n function attrState(type, _stream, state) {\n if (type == \"word\") {\n setStyle = \"attribute\";\n return attrEqState;\n } else if (type == \"endTag\" || type == \"selfcloseTag\") {\n var tagName = state.tagName, tagStart = state.tagStart;\n state.tagName = state.tagStart = null;\n if (type == \"selfcloseTag\" ||\n config.autoSelfClosers.hasOwnProperty(tagName)) {\n maybePopContext(state, tagName);\n } else {\n maybePopContext(state, tagName);\n state.context = new Context(state, tagName, tagStart == state.indented);\n }\n return baseState;\n }\n setStyle = \"error\";\n return attrState;\n }\n function attrEqState(type, stream, state) {\n if (type == \"equals\") return attrValueState;\n if (!config.allowMissing) setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrValueState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n if (type == \"word\" && config.allowUnquoted) {setStyle = \"string\"; return attrState;}\n setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrContinuedState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n return attrState(type, stream, state);\n }\n\n return {\n startState: function(baseIndent) {\n var state = {tokenize: inText,\n state: baseState,\n indented: baseIndent || 0,\n tagName: null, tagStart: null,\n context: null}\n if (baseIndent != null) state.baseIndent = baseIndent\n return state\n },\n\n token: function(stream, state) {\n if (!state.tagName && stream.sol())\n state.indented = stream.indentation();\n\n if (stream.eatSpace()) return null;\n type = null;\n var style = state.tokenize(stream, state);\n if ((style || type) && style != \"comment\") {\n setStyle = null;\n state.state = state.state(type || style, stream, state);\n if (setStyle)\n style = setStyle == \"error\" ? style + \" error\" : setStyle;\n }\n return style;\n },\n\n indent: function(state, textAfter, fullLine) {\n var context = state.context;\n // Indent multi-line strings (e.g. css).\n if (state.tokenize.isInAttribute) {\n if (state.tagStart == state.indented)\n return state.stringStartCol + 1;\n else\n return state.indented + indentUnit;\n }\n if (context && context.noIndent) return CodeMirror.Pass;\n if (state.tokenize != inTag && state.tokenize != inText)\n return fullLine ? fullLine.match(/^(\\s*)/)[0].length : 0;\n // Indent the starts of attribute names.\n if (state.tagName) {\n if (config.multilineTagIndentPastTag !== false)\n return state.tagStart + state.tagName.length + 2;\n else\n return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);\n }\n if (config.alignCDATA && /<!\\[CDATA\\[/.test(textAfter)) return 0;\n var tagAfter = textAfter && /^<(\\/)?([\\w_:\\.-]*)/.exec(textAfter);\n if (tagAfter && tagAfter[1]) { // Closing tag spotted\n while (context) {\n if (context.tagName == tagAfter[2]) {\n context = context.prev;\n break;\n } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {\n context = context.prev;\n } else {\n break;\n }\n }\n } else if (tagAfter) { // Opening tag spotted\n while (context) {\n var grabbers = config.contextGrabbers[context.tagName];\n if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))\n context = context.prev;\n else\n break;\n }\n }\n while (context && context.prev && !context.startOfLine)\n context = context.prev;\n if (context) return context.indent + indentUnit;\n else return state.baseIndent || 0;\n },\n\n electricInput: /<\\/[\\s\\w:]+>$/,\n blockCommentStart: \"<!--\",\n blockCommentEnd: \"-->\",\n\n configuration: config.htmlMode ? \"html\" : \"xml\",\n helperType: config.htmlMode ? \"html\" : \"xml\",\n\n skipAttribute: function(state) {\n if (state.state == attrValueState)\n state.state = attrState\n }\n };\n});\n\nCodeMirror.defineMIME(\"text/xml\", \"xml\");\nCodeMirror.defineMIME(\"application/xml\", \"xml\");\nif (!CodeMirror.mimeModes.hasOwnProperty(\"text/html\"))\n CodeMirror.defineMIME(\"text/html\", {name: \"xml\", htmlMode: true});\n\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n/**\n * Supported keybindings:\n * Too many to list. Refer to defaultKeyMap below.\n *\n * Supported Ex commands:\n * Refer to defaultExCommandMap below.\n *\n * Registers: unnamed, -, a-z, A-Z, 0-9\n * (Does not respect the special case for number registers when delete\n * operator is made with these commands: %, (, ), , /, ?, n, N, {, } )\n * TODO: Implement the remaining registers.\n *\n * Marks: a-z, A-Z, and 0-9\n * TODO: Implement the remaining special marks. They have more complex\n * behavior.\n *\n * Events:\n * 'vim-mode-change' - raised on the editor anytime the current mode changes,\n * Event object: {mode: \"visual\", subMode: \"linewise\"}\n *\n * Code structure:\n * 1. Default keymap\n * 2. Variable declarations and short basic helpers\n * 3. Instance (External API) implementation\n * 4. Internal state tracking objects (input state, counter) implementation\n * and instanstiation\n * 5. Key handler (the main command dispatcher) implementation\n * 6. Motion, operator, and action implementations\n * 7. Helper functions for the key handler, motions, operators, and actions\n * 8. Set up Vim to work as a keymap for CodeMirror.\n * 9. Ex command implementations.\n */\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"), require(\"../addon/search/searchcursor\"), require(\"../addon/dialog/dialog\"), require(\"../addon/edit/matchbrackets.js\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\", \"../addon/search/searchcursor\", \"../addon/dialog/dialog\", \"../addon/edit/matchbrackets\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n 'use strict';\n\n var defaultKeymap = [\n // Key to key mapping. This goes first to make it possible to override\n // existing mappings.\n { keys: '<Left>', type: 'keyToKey', toKeys: 'h' },\n { keys: '<Right>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<Up>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<Down>', type: 'keyToKey', toKeys: 'j' },\n { keys: '<Space>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'},\n { keys: '<C-Space>', type: 'keyToKey', toKeys: 'W' },\n { keys: '<C-BS>', type: 'keyToKey', toKeys: 'B', context: 'normal' },\n { keys: '<S-Space>', type: 'keyToKey', toKeys: 'w' },\n { keys: '<S-BS>', type: 'keyToKey', toKeys: 'b', context: 'normal' },\n { keys: '<C-n>', type: 'keyToKey', toKeys: 'j' },\n { keys: '<C-p>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },\n { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},\n { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },\n { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },\n { keys: '<Home>', type: 'keyToKey', toKeys: '0' },\n { keys: '<End>', type: 'keyToKey', toKeys: '$' },\n { keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },\n { keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },\n { keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },\n // Motions\n { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }},\n { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }},\n { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }},\n { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }},\n { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }},\n { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }},\n { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }},\n { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }},\n { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }},\n { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }},\n { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }},\n { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }},\n { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }},\n { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }},\n { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }},\n { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }},\n { keys: '<C-f>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }},\n { keys: '<C-b>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }},\n { keys: '<C-d>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }},\n { keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }},\n { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }},\n { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }},\n { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },\n { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }},\n { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }},\n { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }},\n { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }},\n { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }},\n { keys: 'f<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }},\n { keys: 'F<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }},\n { keys: 't<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }},\n { keys: 'T<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }},\n { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }},\n { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }},\n { keys: '\\'<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}},\n { keys: '`<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}},\n { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } },\n { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } },\n { keys: ']\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } },\n { keys: '[\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } },\n // the next two aren't motions but must come before more general motion declarations\n { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}},\n { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}},\n { keys: ']<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}},\n { keys: '[<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}},\n { keys: '|', type: 'motion', motion: 'moveToColumn'},\n { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'},\n { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'},\n // Operators\n { keys: 'd', type: 'operator', operator: 'delete' },\n { keys: 'y', type: 'operator', operator: 'yank' },\n { keys: 'c', type: 'operator', operator: 'change' },\n { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }},\n { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }},\n { keys: 'g~', type: 'operator', operator: 'changeCase' },\n { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true },\n { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true },\n { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }},\n { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }},\n // Operator-Motion dual commands\n { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }},\n { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},\n { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},\n { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},\n { keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },\n // Actions\n { keys: '<C-i>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},\n { keys: '<C-o>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},\n { keys: '<C-e>', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }},\n { keys: '<C-y>', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }},\n { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },\n { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },\n { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },\n { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },\n { keys: 'v', type: 'action', action: 'toggleVisualMode' },\n { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},\n { keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},\n { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},\n { keys: 'gv', type: 'action', action: 'reselectLastSelection' },\n { keys: 'J', type: 'action', action: 'joinLines', isEdit: true },\n { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},\n { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }},\n { keys: 'r<character>', type: 'action', action: 'replace', isEdit: true },\n { keys: '@<character>', type: 'action', action: 'replayMacro' },\n { keys: 'q<character>', type: 'action', action: 'enterMacroRecordMode' },\n // Handle Replace-mode as a special case of insert mode.\n { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }},\n { keys: 'u', type: 'action', action: 'undo', context: 'normal' },\n { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true },\n { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true },\n { keys: '<C-r>', type: 'action', action: 'redo' },\n { keys: 'm<character>', type: 'action', action: 'setMark' },\n { keys: '\"<character>', type: 'action', action: 'setRegister' },\n { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }},\n { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},\n { keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }},\n { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '.', type: 'action', action: 'repeatLastEdit' },\n { keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}},\n { keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}},\n // Text object motions\n { keys: 'a<character>', type: 'motion', motion: 'textObjectManipulation' },\n { keys: 'i<character>', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }},\n // Search\n { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }},\n { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }},\n { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},\n { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},\n { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }},\n { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }},\n // Ex command\n { keys: ':', type: 'ex' }\n ];\n\n /**\n * Ex commands\n * Care must be taken when adding to the default Ex command map. For any\n * pair of commands that have a shared prefix, at least one of their\n * shortNames must not match the prefix of the other command.\n */\n var defaultExCommandMap = [\n { name: 'colorscheme', shortName: 'colo' },\n { name: 'map' },\n { name: 'imap', shortName: 'im' },\n { name: 'nmap', shortName: 'nm' },\n { name: 'vmap', shortName: 'vm' },\n { name: 'unmap' },\n { name: 'write', shortName: 'w' },\n { name: 'undo', shortName: 'u' },\n { name: 'redo', shortName: 'red' },\n { name: 'set', shortName: 'se' },\n { name: 'set', shortName: 'se' },\n { name: 'setlocal', shortName: 'setl' },\n { name: 'setglobal', shortName: 'setg' },\n { name: 'sort', shortName: 'sor' },\n { name: 'substitute', shortName: 's', possiblyAsync: true },\n { name: 'nohlsearch', shortName: 'noh' },\n { name: 'delmarks', shortName: 'delm' },\n { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },\n { name: 'global', shortName: 'g' }\n ];\n\n var Pos = CodeMirror.Pos;\n\n var Vim = function() {\n function enterVimMode(cm) {\n cm.setOption('disableInput', true);\n cm.setOption('showCursorWhenSelecting', false);\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n cm.on('cursorActivity', onCursorActivity);\n maybeInitVimState(cm);\n CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));\n }\n\n function leaveVimMode(cm) {\n cm.setOption('disableInput', false);\n cm.off('cursorActivity', onCursorActivity);\n CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));\n cm.state.vim = null;\n }\n\n function detachVimMap(cm, next) {\n if (this == CodeMirror.keyMap.vim)\n CodeMirror.rmClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n\n if (!next || next.attach != attachVimMap)\n leaveVimMode(cm, false);\n }\n function attachVimMap(cm, prev) {\n if (this == CodeMirror.keyMap.vim)\n CodeMirror.addClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n\n if (!prev || prev.attach != attachVimMap)\n enterVimMode(cm);\n }\n\n // Deprecated, simply setting the keymap works again.\n CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {\n if (val && cm.getOption(\"keyMap\") != \"vim\")\n cm.setOption(\"keyMap\", \"vim\");\n else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption(\"keyMap\")))\n cm.setOption(\"keyMap\", \"default\");\n });\n\n function cmKey(key, cm) {\n if (!cm) { return undefined; }\n var vimKey = cmKeyToVimKey(key);\n if (!vimKey) {\n return false;\n }\n var cmd = CodeMirror.Vim.findKey(cm, vimKey);\n if (typeof cmd == 'function') {\n CodeMirror.signal(cm, 'vim-keypress', vimKey);\n }\n return cmd;\n }\n\n var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'};\n var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'};\n function cmKeyToVimKey(key) {\n if (key.charAt(0) == '\\'') {\n // Keypress character binding of format \"'a'\"\n return key.charAt(1);\n }\n var pieces = key.split(/-(?!$)/);\n var lastPiece = pieces[pieces.length - 1];\n if (pieces.length == 1 && pieces[0].length == 1) {\n // No-modifier bindings use literal character bindings above. Skip.\n return false;\n } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {\n // Ignore Shift+char bindings as they should be handled by literal character.\n return false;\n }\n var hasCharacter = false;\n for (var i = 0; i < pieces.length; i++) {\n var piece = pieces[i];\n if (piece in modifiers) { pieces[i] = modifiers[piece]; }\n else { hasCharacter = true; }\n if (piece in specialKeys) { pieces[i] = specialKeys[piece]; }\n }\n if (!hasCharacter) {\n // Vim does not support modifier only keys.\n return false;\n }\n // TODO: Current bindings expect the character to be lower case, but\n // it looks like vim key notation uses upper case.\n if (isUpperCase(lastPiece)) {\n pieces[pieces.length - 1] = lastPiece.toLowerCase();\n }\n return '<' + pieces.join('-') + '>';\n }\n\n function getOnPasteFn(cm) {\n var vim = cm.state.vim;\n if (!vim.onPasteFn) {\n vim.onPasteFn = function() {\n if (!vim.insertMode) {\n cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));\n actions.enterInsertMode(cm, {}, vim);\n }\n };\n }\n return vim.onPasteFn;\n }\n\n var numberRegex = /[\\d]/;\n var wordCharTest = [CodeMirror.isWordChar, function(ch) {\n return ch && !CodeMirror.isWordChar(ch) && !/\\s/.test(ch);\n }], bigWordCharTest = [function(ch) {\n return /\\S/.test(ch);\n }];\n function makeKeyRange(start, size) {\n var keys = [];\n for (var i = start; i < start + size; i++) {\n keys.push(String.fromCharCode(i));\n }\n return keys;\n }\n var upperCaseAlphabet = makeKeyRange(65, 26);\n var lowerCaseAlphabet = makeKeyRange(97, 26);\n var numbers = makeKeyRange(48, 10);\n var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']);\n var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '\"', '.', ':', '/']);\n\n function isLine(cm, line) {\n return line >= cm.firstLine() && line <= cm.lastLine();\n }\n function isLowerCase(k) {\n return (/^[a-z]$/).test(k);\n }\n function isMatchableSymbol(k) {\n return '()[]{}'.indexOf(k) != -1;\n }\n function isNumber(k) {\n return numberRegex.test(k);\n }\n function isUpperCase(k) {\n return (/^[A-Z]$/).test(k);\n }\n function isWhiteSpaceString(k) {\n return (/^\\s*$/).test(k);\n }\n function inArray(val, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] == val) {\n return true;\n }\n }\n return false;\n }\n\n var options = {};\n function defineOption(name, defaultValue, type, aliases, callback) {\n if (defaultValue === undefined && !callback) {\n throw Error('defaultValue is required unless callback is provided');\n }\n if (!type) { type = 'string'; }\n options[name] = {\n type: type,\n defaultValue: defaultValue,\n callback: callback\n };\n if (aliases) {\n for (var i = 0; i < aliases.length; i++) {\n options[aliases[i]] = options[name];\n }\n }\n if (defaultValue) {\n setOption(name, defaultValue);\n }\n }\n\n function setOption(name, value, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n throw Error('Unknown option: ' + name);\n }\n if (option.type == 'boolean') {\n if (value && value !== true) {\n throw Error('Invalid argument: ' + name + '=' + value);\n } else if (value !== false) {\n // Boolean options are set to true if value is not defined.\n value = true;\n }\n }\n if (option.callback) {\n if (scope !== 'local') {\n option.callback(value, undefined);\n }\n if (scope !== 'global' && cm) {\n option.callback(value, cm);\n }\n } else {\n if (scope !== 'local') {\n option.value = option.type == 'boolean' ? !!value : value;\n }\n if (scope !== 'global' && cm) {\n cm.state.vim.options[name] = {value: value};\n }\n }\n }\n\n function getOption(name, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n throw Error('Unknown option: ' + name);\n }\n if (option.callback) {\n var local = cm && option.callback(undefined, cm);\n if (scope !== 'global' && local !== undefined) {\n return local;\n }\n if (scope !== 'local') {\n return option.callback();\n }\n return;\n } else {\n var local = (scope !== 'global') && (cm && cm.state.vim.options[name]);\n return (local || (scope !== 'local') && option || {}).value;\n }\n }\n\n defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) {\n // Option is local. Do nothing for global.\n if (cm === undefined) {\n return;\n }\n // The 'filetype' option proxies to the CodeMirror 'mode' option.\n if (name === undefined) {\n var mode = cm.getOption('mode');\n return mode == 'null' ? '' : mode;\n } else {\n var mode = name == '' ? 'null' : name;\n cm.setOption('mode', mode);\n }\n });\n\n var createCircularJumpList = function() {\n var size = 100;\n var pointer = -1;\n var head = 0;\n var tail = 0;\n var buffer = new Array(size);\n function add(cm, oldCur, newCur) {\n var current = pointer % size;\n var curMark = buffer[current];\n function useNextSlot(cursor) {\n var next = ++pointer % size;\n var trashMark = buffer[next];\n if (trashMark) {\n trashMark.clear();\n }\n buffer[next] = cm.setBookmark(cursor);\n }\n if (curMark) {\n var markPos = curMark.find();\n // avoid recording redundant cursor position\n if (markPos && !cursorEqual(markPos, oldCur)) {\n useNextSlot(oldCur);\n }\n } else {\n useNextSlot(oldCur);\n }\n useNextSlot(newCur);\n head = pointer;\n tail = pointer - size + 1;\n if (tail < 0) {\n tail = 0;\n }\n }\n function move(cm, offset) {\n pointer += offset;\n if (pointer > head) {\n pointer = head;\n } else if (pointer < tail) {\n pointer = tail;\n }\n var mark = buffer[(size + pointer) % size];\n // skip marks that are temporarily removed from text buffer\n if (mark && !mark.find()) {\n var inc = offset > 0 ? 1 : -1;\n var newCur;\n var oldCur = cm.getCursor();\n do {\n pointer += inc;\n mark = buffer[(size + pointer) % size];\n // skip marks that are the same as current position\n if (mark &&\n (newCur = mark.find()) &&\n !cursorEqual(oldCur, newCur)) {\n break;\n }\n } while (pointer < head && pointer > tail);\n }\n return mark;\n }\n return {\n cachedCursor: undefined, //used for # and * jumps\n add: add,\n move: move\n };\n };\n\n // Returns an object to track the changes associated insert mode. It\n // clones the object that is passed in, or creates an empty object one if\n // none is provided.\n var createInsertModeChanges = function(c) {\n if (c) {\n // Copy construction\n return {\n changes: c.changes,\n expectCursorActivityForChange: c.expectCursorActivityForChange\n };\n }\n return {\n // Change list\n changes: [],\n // Set to true on change, false on cursorActivity.\n expectCursorActivityForChange: false\n };\n };\n\n function MacroModeState() {\n this.latestRegister = undefined;\n this.isPlaying = false;\n this.isRecording = false;\n this.replaySearchQueries = [];\n this.onRecordingDone = undefined;\n this.lastInsertModeChanges = createInsertModeChanges();\n }\n MacroModeState.prototype = {\n exitMacroRecordMode: function() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.onRecordingDone) {\n macroModeState.onRecordingDone(); // close dialog\n }\n macroModeState.onRecordingDone = undefined;\n macroModeState.isRecording = false;\n },\n enterMacroRecordMode: function(cm, registerName) {\n var register =\n vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.clear();\n this.latestRegister = registerName;\n if (cm.openDialog) {\n this.onRecordingDone = cm.openDialog(\n '(recording)['+registerName+']', null, {bottom:true});\n }\n this.isRecording = true;\n }\n }\n };\n\n function maybeInitVimState(cm) {\n if (!cm.state.vim) {\n // Store instance state in the CodeMirror object.\n cm.state.vim = {\n inputState: new InputState(),\n // Vim's input state that triggered the last edit, used to repeat\n // motions and operators with '.'.\n lastEditInputState: undefined,\n // Vim's action command before the last edit, used to repeat actions\n // with '.' and insert mode repeat.\n lastEditActionCommand: undefined,\n // When using jk for navigation, if you move from a longer line to a\n // shorter line, the cursor may clip to the end of the shorter line.\n // If j is pressed again and cursor goes to the next line, the\n // cursor should go back to its horizontal position on the longer\n // line if it can. This is to keep track of the horizontal position.\n lastHPos: -1,\n // Doing the same with screen-position for gj/gk\n lastHSPos: -1,\n // The last motion command run. Cleared if a non-motion command gets\n // executed in between.\n lastMotion: null,\n marks: {},\n // Mark for rendering fake cursor for visual mode.\n fakeCursor: null,\n insertMode: false,\n // Repeat count for changes made in insert mode, triggered by key\n // sequences like 3,i. Only exists when insertMode is true.\n insertModeRepeat: undefined,\n visualMode: false,\n // If we are in visual line mode. No effect if visualMode is false.\n visualLine: false,\n visualBlock: false,\n lastSelection: null,\n lastPastedText: null,\n sel: {},\n // Buffer-local/window-local values of vim options.\n options: {}\n };\n }\n return cm.state.vim;\n }\n var vimGlobalState;\n function resetVimGlobalState() {\n vimGlobalState = {\n // The current search query.\n searchQuery: null,\n // Whether we are searching backwards.\n searchIsReversed: false,\n // Replace part of the last substituted pattern\n lastSubstituteReplacePart: undefined,\n jumpList: createCircularJumpList(),\n macroModeState: new MacroModeState,\n // Recording latest f, t, F or T motion command.\n lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''},\n registerController: new RegisterController({}),\n // search history buffer\n searchHistoryController: new HistoryController({}),\n // ex Command history buffer\n exCommandHistoryController : new HistoryController({})\n };\n for (var optionName in options) {\n var option = options[optionName];\n option.value = option.defaultValue;\n }\n }\n\n var lastInsertModeKeyTimer;\n var vimApi= {\n buildKeyMap: function() {\n // TODO: Convert keymap into dictionary format for fast lookup.\n },\n // Testing hook, though it might be useful to expose the register\n // controller anyways.\n getRegisterController: function() {\n return vimGlobalState.registerController;\n },\n // Testing hook.\n resetVimGlobalState_: resetVimGlobalState,\n\n // Testing hook.\n getVimGlobalState_: function() {\n return vimGlobalState;\n },\n\n // Testing hook.\n maybeInitVimState_: maybeInitVimState,\n\n suppressErrorLogging: false,\n\n InsertModeKey: InsertModeKey,\n map: function(lhs, rhs, ctx) {\n // Add user defined key bindings.\n exCommandDispatcher.map(lhs, rhs, ctx);\n },\n unmap: function(lhs, ctx) {\n exCommandDispatcher.unmap(lhs, ctx);\n },\n // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace\n // them, or somehow make them work with the existing CodeMirror setOption/getOption API.\n setOption: setOption,\n getOption: getOption,\n defineOption: defineOption,\n defineEx: function(name, prefix, func){\n if (!prefix) {\n prefix = name;\n } else if (name.indexOf(prefix) !== 0) {\n throw new Error('(Vim.defineEx) \"'+prefix+'\" is not a prefix of \"'+name+'\", command not registered');\n }\n exCommands[name]=func;\n exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'};\n },\n handleKey: function (cm, key, origin) {\n var command = this.findKey(cm, key, origin);\n if (typeof command === 'function') {\n return command();\n }\n },\n /**\n * This is the outermost function called by CodeMirror, after keys have\n * been mapped to their Vim equivalents.\n *\n * Finds a command based on the key (and cached keys if there is a\n * multi-key sequence). Returns `undefined` if no key is matched, a noop\n * function if a partial match is found (multi-key), and a function to\n * execute the bound command if a a key is matched. The function always\n * returns true.\n */\n findKey: function(cm, key, origin) {\n var vim = maybeInitVimState(cm);\n function handleMacroRecording() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n if (key == 'q') {\n macroModeState.exitMacroRecordMode();\n clearInputState(cm);\n return true;\n }\n if (origin != 'mapping') {\n logKey(macroModeState, key);\n }\n }\n }\n function handleEsc() {\n if (key == '<Esc>') {\n // Clear input state and get back to normal mode.\n clearInputState(cm);\n if (vim.visualMode) {\n exitVisualMode(cm);\n } else if (vim.insertMode) {\n exitInsertMode(cm);\n }\n return true;\n }\n }\n function doKeyToKey(keys) {\n // TODO: prevent infinite recursion.\n var match;\n while (keys) {\n // Pull off one command key, which is either a single character\n // or a special sequence wrapped in '<' and '>', e.g. '<Space>'.\n match = (/<\\w+-.+?>|<\\w+>|./).exec(keys);\n key = match[0];\n keys = keys.substring(match.index + key.length);\n CodeMirror.Vim.handleKey(cm, key, 'mapping');\n }\n }\n\n function handleKeyInsertMode() {\n if (handleEsc()) { return true; }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n var keysAreChars = key.length == 1;\n var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n // Need to check all key substrings in insert mode.\n while (keys.length > 1 && match.type != 'full') {\n var keys = vim.inputState.keyBuffer = keys.slice(1);\n var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n if (thisMatch.type != 'none') { match = thisMatch; }\n }\n if (match.type == 'none') { clearInputState(cm); return false; }\n else if (match.type == 'partial') {\n if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }\n lastInsertModeKeyTimer = window.setTimeout(\n function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } },\n getOption('insertModeEscKeysTimeout'));\n return !keysAreChars;\n }\n\n if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }\n if (keysAreChars) {\n var here = cm.getCursor();\n cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');\n }\n clearInputState(cm);\n return match.command;\n }\n\n function handleKeyNonInsertMode() {\n if (handleMacroRecording() || handleEsc()) { return true; };\n\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n if (/^[1-9]\\d*$/.test(keys)) { return true; }\n\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (!keysMatcher) { clearInputState(cm); return false; }\n var context = vim.visualMode ? 'visual' :\n 'normal';\n var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context);\n if (match.type == 'none') { clearInputState(cm); return false; }\n else if (match.type == 'partial') { return true; }\n\n vim.inputState.keyBuffer = '';\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (keysMatcher[1] && keysMatcher[1] != '0') {\n vim.inputState.pushRepeatDigit(keysMatcher[1]);\n }\n return match.command;\n }\n\n var command;\n if (vim.insertMode) { command = handleKeyInsertMode(); }\n else { command = handleKeyNonInsertMode(); }\n if (command === false) {\n return undefined;\n } else if (command === true) {\n // TODO: Look into using CodeMirror's multi-key handling.\n // Return no-op since we are caching the key. Counts as handled, but\n // don't want act on it just yet.\n return function() {};\n } else {\n return function() {\n return cm.operation(function() {\n cm.curOp.isVimOp = true;\n try {\n if (command.type == 'keyToKey') {\n doKeyToKey(command.toKeys);\n } else {\n commandDispatcher.processCommand(cm, vim, command);\n }\n } catch (e) {\n // clear VIM state in case it's in a bad state.\n cm.state.vim = undefined;\n maybeInitVimState(cm);\n if (!CodeMirror.Vim.suppressErrorLogging) {\n console['log'](e);\n }\n throw e;\n }\n return true;\n });\n };\n }\n },\n handleEx: function(cm, input) {\n exCommandDispatcher.processCommand(cm, input);\n },\n\n defineMotion: defineMotion,\n defineAction: defineAction,\n defineOperator: defineOperator,\n mapCommand: mapCommand,\n _mapCommand: _mapCommand,\n\n defineRegister: defineRegister,\n\n exitVisualMode: exitVisualMode,\n exitInsertMode: exitInsertMode\n };\n\n // Represents the current input state.\n function InputState() {\n this.prefixRepeat = [];\n this.motionRepeat = [];\n\n this.operator = null;\n this.operatorArgs = null;\n this.motion = null;\n this.motionArgs = null;\n this.keyBuffer = []; // For matching multi-key commands.\n this.registerName = null; // Defaults to the unnamed register.\n }\n InputState.prototype.pushRepeatDigit = function(n) {\n if (!this.operator) {\n this.prefixRepeat = this.prefixRepeat.concat(n);\n } else {\n this.motionRepeat = this.motionRepeat.concat(n);\n }\n };\n InputState.prototype.getRepeat = function() {\n var repeat = 0;\n if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) {\n repeat = 1;\n if (this.prefixRepeat.length > 0) {\n repeat *= parseInt(this.prefixRepeat.join(''), 10);\n }\n if (this.motionRepeat.length > 0) {\n repeat *= parseInt(this.motionRepeat.join(''), 10);\n }\n }\n return repeat;\n };\n\n function clearInputState(cm, reason) {\n cm.state.vim.inputState = new InputState();\n CodeMirror.signal(cm, 'vim-command-done', reason);\n }\n\n /*\n * Register stores information about copy and paste registers. Besides\n * text, a register must store whether it is linewise (i.e., when it is\n * pasted, should it insert itself into a new line, or should the text be\n * inserted at the cursor position.)\n */\n function Register(text, linewise, blockwise) {\n this.clear();\n this.keyBuffer = [text || ''];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n }\n Register.prototype = {\n setText: function(text, linewise, blockwise) {\n this.keyBuffer = [text || ''];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n },\n pushText: function(text, linewise) {\n // if this register has ever been set to linewise, use linewise.\n if (linewise) {\n if (!this.linewise) {\n this.keyBuffer.push('\\n');\n }\n this.linewise = true;\n }\n this.keyBuffer.push(text);\n },\n pushInsertModeChanges: function(changes) {\n this.insertModeChanges.push(createInsertModeChanges(changes));\n },\n pushSearchQuery: function(query) {\n this.searchQueries.push(query);\n },\n clear: function() {\n this.keyBuffer = [];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = false;\n },\n toString: function() {\n return this.keyBuffer.join('');\n }\n };\n\n /**\n * Defines an external register.\n *\n * The name should be a single character that will be used to reference the register.\n * The register should support setText, pushText, clear, and toString(). See Register\n * for a reference implementation.\n */\n function defineRegister(name, register) {\n var registers = vimGlobalState.registerController.registers[name];\n if (!name || name.length != 1) {\n throw Error('Register name must be 1 character');\n }\n if (registers[name]) {\n throw Error('Register already defined ' + name);\n }\n registers[name] = register;\n validRegisters.push(name);\n }\n\n /*\n * vim registers allow you to keep many independent copy and paste buffers.\n * See http://usevim.com/2012/04/13/registers/ for an introduction.\n *\n * RegisterController keeps the state of all the registers. An initial\n * state may be passed in. The unnamed register '\"' will always be\n * overridden.\n */\n function RegisterController(registers) {\n this.registers = registers;\n this.unnamedRegister = registers['\"'] = new Register();\n registers['.'] = new Register();\n registers[':'] = new Register();\n registers['/'] = new Register();\n }\n RegisterController.prototype = {\n pushText: function(registerName, operator, text, linewise, blockwise) {\n if (linewise && text.charAt(0) == '\\n') {\n text = text.slice(1) + '\\n';\n }\n if (linewise && text.charAt(text.length - 1) !== '\\n'){\n text += '\\n';\n }\n // Lowercase and uppercase registers refer to the same register.\n // Uppercase just means append.\n var register = this.isValidRegister(registerName) ?\n this.getRegister(registerName) : null;\n // if no register/an invalid register was specified, things go to the\n // default registers\n if (!register) {\n switch (operator) {\n case 'yank':\n // The 0 register contains the text from the most recent yank.\n this.registers['0'] = new Register(text, linewise, blockwise);\n break;\n case 'delete':\n case 'change':\n if (text.indexOf('\\n') == -1) {\n // Delete less than 1 line. Update the small delete register.\n this.registers['-'] = new Register(text, linewise);\n } else {\n // Shift down the contents of the numbered registers and put the\n // deleted text into register 1.\n this.shiftNumericRegisters_();\n this.registers['1'] = new Register(text, linewise);\n }\n break;\n }\n // Make sure the unnamed register is set to what just happened\n this.unnamedRegister.setText(text, linewise, blockwise);\n return;\n }\n\n // If we've gotten to this point, we've actually specified a register\n var append = isUpperCase(registerName);\n if (append) {\n register.pushText(text, linewise);\n } else {\n register.setText(text, linewise, blockwise);\n }\n // The unnamed register always has the same value as the last used\n // register.\n this.unnamedRegister.setText(register.toString(), linewise);\n },\n // Gets the register named @name. If one of @name doesn't already exist,\n // create it. If @name is invalid, return the unnamedRegister.\n getRegister: function(name) {\n if (!this.isValidRegister(name)) {\n return this.unnamedRegister;\n }\n name = name.toLowerCase();\n if (!this.registers[name]) {\n this.registers[name] = new Register();\n }\n return this.registers[name];\n },\n isValidRegister: function(name) {\n return name && inArray(name, validRegisters);\n },\n shiftNumericRegisters_: function() {\n for (var i = 9; i >= 2; i--) {\n this.registers[i] = this.getRegister('' + (i - 1));\n }\n }\n };\n function HistoryController() {\n this.historyBuffer = [];\n this.iterator;\n this.initialPrefix = null;\n }\n HistoryController.prototype = {\n // the input argument here acts a user entered prefix for a small time\n // until we start autocompletion in which case it is the autocompleted.\n nextMatch: function (input, up) {\n var historyBuffer = this.historyBuffer;\n var dir = up ? -1 : 1;\n if (this.initialPrefix === null) this.initialPrefix = input;\n for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) {\n var element = historyBuffer[i];\n for (var j = 0; j <= element.length; j++) {\n if (this.initialPrefix == element.substring(0, j)) {\n this.iterator = i;\n return element;\n }\n }\n }\n // should return the user input in case we reach the end of buffer.\n if (i >= historyBuffer.length) {\n this.iterator = historyBuffer.length;\n return this.initialPrefix;\n }\n // return the last autocompleted query or exCommand as it is.\n if (i < 0 ) return input;\n },\n pushInput: function(input) {\n var index = this.historyBuffer.indexOf(input);\n if (index > -1) this.historyBuffer.splice(index, 1);\n if (input.length) this.historyBuffer.push(input);\n },\n reset: function() {\n this.initialPrefix = null;\n this.iterator = this.historyBuffer.length;\n }\n };\n var commandDispatcher = {\n matchCommand: function(keys, keyMap, inputState, context) {\n var matches = commandMatches(keys, keyMap, context, inputState);\n if (!matches.full && !matches.partial) {\n return {type: 'none'};\n } else if (!matches.full && matches.partial) {\n return {type: 'partial'};\n }\n\n var bestMatch;\n for (var i = 0; i < matches.full.length; i++) {\n var match = matches.full[i];\n if (!bestMatch) {\n bestMatch = match;\n }\n }\n if (bestMatch.keys.slice(-11) == '<character>') {\n inputState.selectedCharacter = lastChar(keys);\n }\n return {type: 'full', command: bestMatch};\n },\n processCommand: function(cm, vim, command) {\n vim.inputState.repeatOverride = command.repeatOverride;\n switch (command.type) {\n case 'motion':\n this.processMotion(cm, vim, command);\n break;\n case 'operator':\n this.processOperator(cm, vim, command);\n break;\n case 'operatorMotion':\n this.processOperatorMotion(cm, vim, command);\n break;\n case 'action':\n this.processAction(cm, vim, command);\n break;\n case 'search':\n this.processSearch(cm, vim, command);\n break;\n case 'ex':\n case 'keyToEx':\n this.processEx(cm, vim, command);\n break;\n default:\n break;\n }\n },\n processMotion: function(cm, vim, command) {\n vim.inputState.motion = command.motion;\n vim.inputState.motionArgs = copyArgs(command.motionArgs);\n this.evalInput(cm, vim);\n },\n processOperator: function(cm, vim, command) {\n var inputState = vim.inputState;\n if (inputState.operator) {\n if (inputState.operator == command.operator) {\n // Typing an operator twice like 'dd' makes the operator operate\n // linewise\n inputState.motion = 'expandToLine';\n inputState.motionArgs = { linewise: true };\n this.evalInput(cm, vim);\n return;\n } else {\n // 2 different operators in a row doesn't make sense.\n clearInputState(cm);\n }\n }\n inputState.operator = command.operator;\n inputState.operatorArgs = copyArgs(command.operatorArgs);\n if (vim.visualMode) {\n // Operating on a selection in visual mode. We don't need a motion.\n this.evalInput(cm, vim);\n }\n },\n processOperatorMotion: function(cm, vim, command) {\n var visualMode = vim.visualMode;\n var operatorMotionArgs = copyArgs(command.operatorMotionArgs);\n if (operatorMotionArgs) {\n // Operator motions may have special behavior in visual mode.\n if (visualMode && operatorMotionArgs.visualLine) {\n vim.visualLine = true;\n }\n }\n this.processOperator(cm, vim, command);\n if (!visualMode) {\n this.processMotion(cm, vim, command);\n }\n },\n processAction: function(cm, vim, command) {\n var inputState = vim.inputState;\n var repeat = inputState.getRepeat();\n var repeatIsExplicit = !!repeat;\n var actionArgs = copyArgs(command.actionArgs) || {};\n if (inputState.selectedCharacter) {\n actionArgs.selectedCharacter = inputState.selectedCharacter;\n }\n // Actions may or may not have motions and operators. Do these first.\n if (command.operator) {\n this.processOperator(cm, vim, command);\n }\n if (command.motion) {\n this.processMotion(cm, vim, command);\n }\n if (command.motion || command.operator) {\n this.evalInput(cm, vim);\n }\n actionArgs.repeat = repeat || 1;\n actionArgs.repeatIsExplicit = repeatIsExplicit;\n actionArgs.registerName = inputState.registerName;\n clearInputState(cm);\n vim.lastMotion = null;\n if (command.isEdit) {\n this.recordLastEdit(vim, inputState, command);\n }\n actions[command.action](cm, actionArgs, vim);\n },\n processSearch: function(cm, vim, command) {\n if (!cm.getSearchCursor) {\n // Search depends on SearchCursor.\n return;\n }\n var forward = command.searchArgs.forward;\n var wholeWordOnly = command.searchArgs.wholeWordOnly;\n getSearchState(cm).setReversed(!forward);\n var promptPrefix = (forward) ? '/' : '?';\n var originalQuery = getSearchState(cm).getQuery();\n var originalScrollPos = cm.getScrollInfo();\n function handleQuery(query, ignoreCase, smartCase) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n try {\n updateSearchQuery(cm, query, ignoreCase, smartCase);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + query);\n clearInputState(cm);\n return;\n }\n commandDispatcher.processMotion(cm, vim, {\n type: 'motion',\n motion: 'findNext',\n motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }\n });\n }\n function onPromptClose(query) {\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n handleQuery(query, true /** ignoreCase */, true /** smartCase */);\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n logSearchQuery(macroModeState, query);\n }\n }\n function onPromptKeyUp(e, query, close) {\n var keyName = CodeMirror.keyName(e), up;\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';\n close(query);\n } else {\n if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.searchHistoryController.reset();\n }\n var parsedQuery;\n try {\n parsedQuery = updateSearchQuery(cm, query,\n true /** ignoreCase */, true /** smartCase */);\n } catch (e) {\n // Swallow bad regexes for incremental search.\n }\n if (parsedQuery) {\n cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);\n } else {\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n }\n }\n function onPromptKeyDown(e, query, close) {\n var keyName = CodeMirror.keyName(e);\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && query == '')) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n updateSearchQuery(cm, originalQuery);\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n } else if (keyName == 'Ctrl-U') {\n // Ctrl-U clears input.\n CodeMirror.e_stop(e);\n close('');\n }\n }\n switch (command.searchArgs.querySrc) {\n case 'prompt':\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n var query = macroModeState.replaySearchQueries.shift();\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n } else {\n showPrompt(cm, {\n onClose: onPromptClose,\n prefix: promptPrefix,\n desc: searchPromptDesc,\n onKeyUp: onPromptKeyUp,\n onKeyDown: onPromptKeyDown\n });\n }\n break;\n case 'wordUnderCursor':\n var word = expandWordUnderCursor(cm, false /** inclusive */,\n true /** forward */, false /** bigWord */,\n true /** noSymbol */);\n var isKeyword = true;\n if (!word) {\n word = expandWordUnderCursor(cm, false /** inclusive */,\n true /** forward */, false /** bigWord */,\n false /** noSymbol */);\n isKeyword = false;\n }\n if (!word) {\n return;\n }\n var query = cm.getLine(word.start.line).substring(word.start.ch,\n word.end.ch);\n if (isKeyword && wholeWordOnly) {\n query = '\\\\b' + query + '\\\\b';\n } else {\n query = escapeRegex(query);\n }\n\n // cachedCursor is used to save the old position of the cursor\n // when * or # causes vim to seek for the nearest word and shift\n // the cursor before entering the motion.\n vimGlobalState.jumpList.cachedCursor = cm.getCursor();\n cm.setCursor(word.start);\n\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n break;\n }\n },\n processEx: function(cm, vim, command) {\n function onPromptClose(input) {\n // Give the prompt some time to close so that if processCommand shows\n // an error, the elements don't overlap.\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n exCommandDispatcher.processCommand(cm, input);\n }\n function onPromptKeyDown(e, input, close) {\n var keyName = CodeMirror.keyName(e), up;\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && input == '')) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';\n close(input);\n } else if (keyName == 'Ctrl-U') {\n // Ctrl-U clears input.\n CodeMirror.e_stop(e);\n close('');\n } else {\n if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.exCommandHistoryController.reset();\n }\n }\n if (command.type == 'keyToEx') {\n // Handle user defined Ex to Ex mappings\n exCommandDispatcher.processCommand(cm, command.exArgs.input);\n } else {\n if (vim.visualMode) {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\\'<,\\'>',\n onKeyDown: onPromptKeyDown});\n } else {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':',\n onKeyDown: onPromptKeyDown});\n }\n }\n },\n evalInput: function(cm, vim) {\n // If the motion comand is set, execute both the operator and motion.\n // Otherwise return.\n var inputState = vim.inputState;\n var motion = inputState.motion;\n var motionArgs = inputState.motionArgs || {};\n var operator = inputState.operator;\n var operatorArgs = inputState.operatorArgs || {};\n var registerName = inputState.registerName;\n var sel = vim.sel;\n // TODO: Make sure cm and vim selections are identical outside visual mode.\n var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head'));\n var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor'));\n var oldHead = copyCursor(origHead);\n var oldAnchor = copyCursor(origAnchor);\n var newHead, newAnchor;\n var repeat;\n if (operator) {\n this.recordLastEdit(vim, inputState);\n }\n if (inputState.repeatOverride !== undefined) {\n // If repeatOverride is specified, that takes precedence over the\n // input state's repeat. Used by Ex mode and can be user defined.\n repeat = inputState.repeatOverride;\n } else {\n repeat = inputState.getRepeat();\n }\n if (repeat > 0 && motionArgs.explicitRepeat) {\n motionArgs.repeatIsExplicit = true;\n } else if (motionArgs.noRepeat ||\n (!motionArgs.explicitRepeat && repeat === 0)) {\n repeat = 1;\n motionArgs.repeatIsExplicit = false;\n }\n if (inputState.selectedCharacter) {\n // If there is a character input, stick it in all of the arg arrays.\n motionArgs.selectedCharacter = operatorArgs.selectedCharacter =\n inputState.selectedCharacter;\n }\n motionArgs.repeat = repeat;\n clearInputState(cm);\n if (motion) {\n var motionResult = motions[motion](cm, origHead, motionArgs, vim);\n vim.lastMotion = motions[motion];\n if (!motionResult) {\n return;\n }\n if (motionArgs.toJumplist) {\n var jumpList = vimGlobalState.jumpList;\n // if the current motion is # or *, use cachedCursor\n var cachedCursor = jumpList.cachedCursor;\n if (cachedCursor) {\n recordJumpPosition(cm, cachedCursor, motionResult);\n delete jumpList.cachedCursor;\n } else {\n recordJumpPosition(cm, origHead, motionResult);\n }\n }\n if (motionResult instanceof Array) {\n newAnchor = motionResult[0];\n newHead = motionResult[1];\n } else {\n newHead = motionResult;\n }\n // TODO: Handle null returns from motion commands better.\n if (!newHead) {\n newHead = copyCursor(origHead);\n }\n if (vim.visualMode) {\n if (!(vim.visualBlock && newHead.ch === Infinity)) {\n newHead = clipCursorToContent(cm, newHead, vim.visualBlock);\n }\n if (newAnchor) {\n newAnchor = clipCursorToContent(cm, newAnchor, true);\n }\n newAnchor = newAnchor || oldAnchor;\n sel.anchor = newAnchor;\n sel.head = newHead;\n updateCmSelection(cm);\n updateMark(cm, vim, '<',\n cursorIsBefore(newAnchor, newHead) ? newAnchor\n : newHead);\n updateMark(cm, vim, '>',\n cursorIsBefore(newAnchor, newHead) ? newHead\n : newAnchor);\n } else if (!operator) {\n newHead = clipCursorToContent(cm, newHead);\n cm.setCursor(newHead.line, newHead.ch);\n }\n }\n if (operator) {\n if (operatorArgs.lastSel) {\n // Replaying a visual mode operation\n newAnchor = oldAnchor;\n var lastSel = operatorArgs.lastSel;\n var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line);\n var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);\n if (lastSel.visualLine) {\n // Linewise Visual mode: The same number of lines.\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n } else if (lastSel.visualBlock) {\n // Blockwise Visual mode: The same number of lines and columns.\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);\n } else if (lastSel.head.line == lastSel.anchor.line) {\n // Normal Visual mode within one line: The same number of characters.\n newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset);\n } else {\n // Normal Visual mode with several lines: The same number of lines, in the\n // last line the same number of characters as in the last line the last time.\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n vim.visualMode = true;\n vim.visualLine = lastSel.visualLine;\n vim.visualBlock = lastSel.visualBlock;\n sel = vim.sel = {\n anchor: newAnchor,\n head: newHead\n };\n updateCmSelection(cm);\n } else if (vim.visualMode) {\n operatorArgs.lastSel = {\n anchor: copyCursor(sel.anchor),\n head: copyCursor(sel.head),\n visualBlock: vim.visualBlock,\n visualLine: vim.visualLine\n };\n }\n var curStart, curEnd, linewise, mode;\n var cmSel;\n if (vim.visualMode) {\n // Init visual op\n curStart = cursorMin(sel.head, sel.anchor);\n curEnd = cursorMax(sel.head, sel.anchor);\n linewise = vim.visualLine || operatorArgs.linewise;\n mode = vim.visualBlock ? 'block' :\n linewise ? 'line' :\n 'char';\n cmSel = makeCmSelection(cm, {\n anchor: curStart,\n head: curEnd\n }, mode);\n if (linewise) {\n var ranges = cmSel.ranges;\n if (mode == 'block') {\n // Linewise operators in visual block mode extend to end of line\n for (var i = 0; i < ranges.length; i++) {\n ranges[i].head.ch = lineLength(cm, ranges[i].head.line);\n }\n } else if (mode == 'line') {\n ranges[0].head = Pos(ranges[0].head.line + 1, 0);\n }\n }\n } else {\n // Init motion op\n curStart = copyCursor(newAnchor || oldAnchor);\n curEnd = copyCursor(newHead || oldHead);\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curStart;\n curStart = curEnd;\n curEnd = tmp;\n }\n linewise = motionArgs.linewise || operatorArgs.linewise;\n if (linewise) {\n // Expand selection to entire line.\n expandSelectionToLine(cm, curStart, curEnd);\n } else if (motionArgs.forward) {\n // Clip to trailing newlines only if the motion goes forward.\n clipToLine(cm, curStart, curEnd);\n }\n mode = 'char';\n var exclusive = !motionArgs.inclusive || linewise;\n cmSel = makeCmSelection(cm, {\n anchor: curStart,\n head: curEnd\n }, mode, exclusive);\n }\n cm.setSelections(cmSel.ranges, cmSel.primary);\n vim.lastMotion = null;\n operatorArgs.repeat = repeat; // For indent in visual mode.\n operatorArgs.registerName = registerName;\n // Keep track of linewise as it affects how paste and change behave.\n operatorArgs.linewise = linewise;\n var operatorMoveTo = operators[operator](\n cm, operatorArgs, cmSel.ranges, oldAnchor, newHead);\n if (vim.visualMode) {\n exitVisualMode(cm, operatorMoveTo != null);\n }\n if (operatorMoveTo) {\n cm.setCursor(operatorMoveTo);\n }\n }\n },\n recordLastEdit: function(vim, inputState, actionCommand) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) { return; }\n vim.lastEditInputState = inputState;\n vim.lastEditActionCommand = actionCommand;\n macroModeState.lastInsertModeChanges.changes = [];\n macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;\n }\n };\n\n /**\n * typedef {Object{line:number,ch:number}} Cursor An object containing the\n * position of the cursor.\n */\n // All of the functions below return Cursor objects.\n var motions = {\n moveToTopLine: function(cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).top + motionArgs.repeat -1;\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToMiddleLine: function(cm) {\n var range = getUserVisibleLines(cm);\n var line = Math.floor((range.top + range.bottom) * 0.5);\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToBottomLine: function(cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1;\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n expandToLine: function(_cm, head, motionArgs) {\n // Expands forward to end of line, and then to next line if repeat is\n // >1. Does not handle backward motion!\n var cur = head;\n return Pos(cur.line + motionArgs.repeat - 1, Infinity);\n },\n findNext: function(cm, _head, motionArgs) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n // If search is initiated with ? instead of /, negate direction.\n prev = (state.isReversed()) ? !prev : prev;\n highlightSearchMatches(cm, query);\n return findNext(cm, prev/** prev */, query, motionArgs.repeat);\n },\n goToMark: function(cm, _head, motionArgs, vim) {\n var mark = vim.marks[motionArgs.selectedCharacter];\n if (mark) {\n var pos = mark.find();\n return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;\n }\n return null;\n },\n moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) {\n if (vim.visualBlock && motionArgs.sameLine) {\n var sel = vim.sel;\n return [\n clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)),\n clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch))\n ];\n } else {\n return ([vim.sel.head, vim.sel.anchor]);\n }\n },\n jumpToMark: function(cm, head, motionArgs, vim) {\n var best = head;\n for (var i = 0; i < motionArgs.repeat; i++) {\n var cursor = best;\n for (var key in vim.marks) {\n if (!isLowerCase(key)) {\n continue;\n }\n var mark = vim.marks[key].find();\n var isWrongDirection = (motionArgs.forward) ?\n cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark);\n\n if (isWrongDirection) {\n continue;\n }\n if (motionArgs.linewise && (mark.line == cursor.line)) {\n continue;\n }\n\n var equal = cursorEqual(cursor, best);\n var between = (motionArgs.forward) ?\n cursorIsBetween(cursor, mark, best) :\n cursorIsBetween(best, mark, cursor);\n\n if (equal || between) {\n best = mark;\n }\n }\n }\n\n if (motionArgs.linewise) {\n // Vim places the cursor on the first non-whitespace character of\n // the line if there is one, else it places the cursor at the end\n // of the line, regardless of whether a mark was found.\n best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));\n }\n return best;\n },\n moveByCharacters: function(_cm, head, motionArgs) {\n var cur = head;\n var repeat = motionArgs.repeat;\n var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;\n return Pos(cur.line, ch);\n },\n moveByLines: function(cm, head, motionArgs, vim) {\n var cur = head;\n var endCh = cur.ch;\n // Depending what our last motion was, we may want to do different\n // things. If our last motion was moving vertically, we want to\n // preserve the HPos from our last horizontal move. If our last motion\n // was going to the end of a line, moving vertically we should go to\n // the end of the line, etc.\n switch (vim.lastMotion) {\n case this.moveByLines:\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveToColumn:\n case this.moveToEol:\n endCh = vim.lastHPos;\n break;\n default:\n vim.lastHPos = endCh;\n }\n var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0);\n var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;\n var first = cm.firstLine();\n var last = cm.lastLine();\n // Vim go to line begin or line end when cursor at first/last line and\n // move to previous/next line is triggered.\n if (line < first && cur.line == first){\n return this.moveToStartOfLine(cm, head, motionArgs, vim);\n }else if (line > last && cur.line == last){\n return this.moveToEol(cm, head, motionArgs, vim);\n }\n if (motionArgs.toFirstChar){\n endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));\n vim.lastHPos = endCh;\n }\n vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left;\n return Pos(line, endCh);\n },\n moveByDisplayLines: function(cm, head, motionArgs, vim) {\n var cur = head;\n switch (vim.lastMotion) {\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveByLines:\n case this.moveToColumn:\n case this.moveToEol:\n break;\n default:\n vim.lastHSPos = cm.charCoords(cur,'div').left;\n }\n var repeat = motionArgs.repeat;\n var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos);\n if (res.hitSide) {\n if (motionArgs.forward) {\n var lastCharCoords = cm.charCoords(res, 'div');\n var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };\n var res = cm.coordsChar(goalCoords, 'div');\n } else {\n var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div');\n resCoords.left = vim.lastHSPos;\n res = cm.coordsChar(resCoords, 'div');\n }\n }\n vim.lastHPos = res.ch;\n return res;\n },\n moveByPage: function(cm, head, motionArgs) {\n // CodeMirror only exposes functions that move the cursor page down, so\n // doing this bad hack to move the cursor and move it back. evalInput\n // will move the cursor to where it should be in the end.\n var curStart = head;\n var repeat = motionArgs.repeat;\n return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page');\n },\n moveByParagraph: function(cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findParagraph(cm, head, motionArgs.repeat, dir);\n },\n moveByScroll: function(cm, head, motionArgs, vim) {\n var scrollbox = cm.getScrollInfo();\n var curEnd = null;\n var repeat = motionArgs.repeat;\n if (!repeat) {\n repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight());\n }\n var orig = cm.charCoords(head, 'local');\n motionArgs.repeat = repeat;\n var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);\n if (!curEnd) {\n return null;\n }\n var dest = cm.charCoords(curEnd, 'local');\n cm.scrollTo(null, scrollbox.top + dest.top - orig.top);\n return curEnd;\n },\n moveByWords: function(cm, head, motionArgs) {\n return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward,\n !!motionArgs.wordEnd, !!motionArgs.bigWord);\n },\n moveTillCharacter: function(cm, _head, motionArgs) {\n var repeat = motionArgs.repeat;\n var curEnd = moveToCharacter(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter);\n var increment = motionArgs.forward ? -1 : 1;\n recordLastCharacterSearch(increment, motionArgs);\n if (!curEnd) return null;\n curEnd.ch += increment;\n return curEnd;\n },\n moveToCharacter: function(cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n recordLastCharacterSearch(0, motionArgs);\n return moveToCharacter(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter) || head;\n },\n moveToSymbol: function(cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n return findSymbol(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter) || head;\n },\n moveToColumn: function(cm, head, motionArgs, vim) {\n var repeat = motionArgs.repeat;\n // repeat is equivalent to which column we want to move to!\n vim.lastHPos = repeat - 1;\n vim.lastHSPos = cm.charCoords(head,'div').left;\n return moveToColumn(cm, repeat);\n },\n moveToEol: function(cm, head, motionArgs, vim) {\n var cur = head;\n vim.lastHPos = Infinity;\n var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);\n var end=cm.clipPos(retval);\n end.ch--;\n vim.lastHSPos = cm.charCoords(end,'div').left;\n return retval;\n },\n moveToFirstNonWhiteSpaceCharacter: function(cm, head) {\n // Go to the start of the line where the text begins, or the end for\n // whitespace-only lines\n var cursor = head;\n return Pos(cursor.line,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));\n },\n moveToMatchedSymbol: function(cm, head) {\n var cursor = head;\n var line = cursor.line;\n var ch = cursor.ch;\n var lineText = cm.getLine(line);\n var symbol;\n do {\n symbol = lineText.charAt(ch++);\n if (symbol && isMatchableSymbol(symbol)) {\n var style = cm.getTokenTypeAt(Pos(line, ch));\n if (style !== \"string\" && style !== \"comment\") {\n break;\n }\n }\n } while (symbol);\n if (symbol) {\n var matched = cm.findMatchingBracket(Pos(line, ch));\n return matched.to;\n } else {\n return cursor;\n }\n },\n moveToStartOfLine: function(_cm, head) {\n return Pos(head.line, 0);\n },\n moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) {\n var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();\n if (motionArgs.repeatIsExplicit) {\n lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');\n }\n return Pos(lineNum,\n findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));\n },\n textObjectManipulation: function(cm, head, motionArgs, vim) {\n // TODO: lots of possible exceptions that can be thrown here. Try da(\n // outside of a () block.\n\n // TODO: adding <> >< to this map doesn't work, presumably because\n // they're operators\n var mirroredPairs = {'(': ')', ')': '(',\n '{': '}', '}': '{',\n '[': ']', ']': '['};\n var selfPaired = {'\\'': true, '\"': true};\n\n var character = motionArgs.selectedCharacter;\n // 'b' refers to '()' block.\n // 'B' refers to '{}' block.\n if (character == 'b') {\n character = '(';\n } else if (character == 'B') {\n character = '{';\n }\n\n // Inclusive is the difference between a and i\n // TODO: Instead of using the additional text object map to perform text\n // object operations, merge the map into the defaultKeyMap and use\n // motionArgs to define behavior. Define separate entries for 'aw',\n // 'iw', 'a[', 'i[', etc.\n var inclusive = !motionArgs.textObjectInner;\n\n var tmp;\n if (mirroredPairs[character]) {\n tmp = selectCompanionObject(cm, head, character, inclusive);\n } else if (selfPaired[character]) {\n tmp = findBeginningAndEnd(cm, head, character, inclusive);\n } else if (character === 'W') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,\n true /** bigWord */);\n } else if (character === 'w') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,\n false /** bigWord */);\n } else if (character === 'p') {\n tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);\n motionArgs.linewise = true;\n if (vim.visualMode) {\n if (!vim.visualLine) { vim.visualLine = true; }\n } else {\n var operatorArgs = vim.inputState.operatorArgs;\n if (operatorArgs) { operatorArgs.linewise = true; }\n tmp.end.line--;\n }\n } else {\n // No text object defined for this, don't move.\n return null;\n }\n\n if (!cm.state.vim.visualMode) {\n return [tmp.start, tmp.end];\n } else {\n return expandSelection(cm, tmp.start, tmp.end);\n }\n },\n\n repeatLastCharacterSearch: function(cm, head, motionArgs) {\n var lastSearch = vimGlobalState.lastChararacterSearch;\n var repeat = motionArgs.repeat;\n var forward = motionArgs.forward === lastSearch.forward;\n var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);\n cm.moveH(-increment, 'char');\n motionArgs.inclusive = forward ? true : false;\n var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter);\n if (!curEnd) {\n cm.moveH(increment, 'char');\n return head;\n }\n curEnd.ch += increment;\n return curEnd;\n }\n };\n\n function defineMotion(name, fn) {\n motions[name] = fn;\n }\n\n function fillArray(val, times) {\n var arr = [];\n for (var i = 0; i < times; i++) {\n arr.push(val);\n }\n return arr;\n }\n /**\n * An operator acts on a text selection. It receives the list of selections\n * as input. The corresponding CodeMirror selection is guaranteed to\n * match the input selection.\n */\n var operators = {\n change: function(cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock;\n if (!vim.visualMode) {\n var anchor = ranges[0].anchor,\n head = ranges[0].head;\n text = cm.getRange(anchor, head);\n var lastState = vim.lastEditInputState || {};\n if (lastState.motion == \"moveByWords\" && !isWhiteSpaceString(text)) {\n // Exclude trailing whitespace if the range is not all whitespace.\n var match = (/\\s+$/).exec(text);\n if (match && lastState.motionArgs && lastState.motionArgs.forward) {\n head = offsetCursor(head, 0, - match[0].length);\n text = text.slice(0, - match[0].length);\n }\n }\n var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);\n var wasLastLine = cm.firstLine() == cm.lastLine();\n if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {\n cm.replaceRange('', prevLineEnd, head);\n } else {\n cm.replaceRange('', anchor, head);\n }\n if (args.linewise) {\n // Push the next line back down, if there is a next line.\n if (!wasLastLine) {\n cm.setCursor(prevLineEnd);\n CodeMirror.commands.newlineAndIndent(cm);\n }\n // make sure cursor ends up at the end of the line.\n anchor.ch = Number.MAX_VALUE;\n }\n finalHead = anchor;\n } else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(\n args.registerName, 'change', text,\n args.linewise, ranges.length > 1);\n actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim);\n },\n // delete is a javascript keyword.\n 'delete': function(cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n if (!vim.visualBlock) {\n var anchor = ranges[0].anchor,\n head = ranges[0].head;\n if (args.linewise &&\n head.line != cm.firstLine() &&\n anchor.line == cm.lastLine() &&\n anchor.line == head.line - 1) {\n // Special case for dd on last line (and first line).\n if (anchor.line == cm.firstLine()) {\n anchor.ch = 0;\n } else {\n anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));\n }\n }\n text = cm.getRange(anchor, head);\n cm.replaceRange('', anchor, head);\n finalHead = anchor;\n if (args.linewise) {\n finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor);\n }\n } else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = ranges[0].anchor;\n }\n vimGlobalState.registerController.pushText(\n args.registerName, 'delete', text,\n args.linewise, vim.visualBlock);\n return clipCursorToContent(cm, finalHead);\n },\n indent: function(cm, args, ranges) {\n var vim = cm.state.vim;\n var startLine = ranges[0].anchor.line;\n var endLine = vim.visualBlock ?\n ranges[ranges.length - 1].anchor.line :\n ranges[0].head.line;\n // In visual mode, n> shifts the selection right n times, instead of\n // shifting n lines right once.\n var repeat = (vim.visualMode) ? args.repeat : 1;\n if (args.linewise) {\n // The only way to delete a newline is to delete until the start of\n // the next line, so in linewise mode evalInput will include the next\n // line. We don't want this in indent, so we go back a line.\n endLine--;\n }\n for (var i = startLine; i <= endLine; i++) {\n for (var j = 0; j < repeat; j++) {\n cm.indentLine(i, args.indentRight);\n }\n }\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n changeCase: function(cm, args, ranges, oldAnchor, newHead) {\n var selections = cm.getSelections();\n var swapped = [];\n var toLower = args.toLower;\n for (var j = 0; j < selections.length; j++) {\n var toSwap = selections[j];\n var text = '';\n if (toLower === true) {\n text = toSwap.toLowerCase();\n } else if (toLower === false) {\n text = toSwap.toUpperCase();\n } else {\n for (var i = 0; i < toSwap.length; i++) {\n var character = toSwap.charAt(i);\n text += isUpperCase(character) ? character.toLowerCase() :\n character.toUpperCase();\n }\n }\n swapped.push(text);\n }\n cm.replaceSelections(swapped);\n if (args.shouldMoveCursor){\n return newHead;\n } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) {\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor);\n } else if (args.linewise){\n return oldAnchor;\n } else {\n return cursorMin(ranges[0].anchor, ranges[0].head);\n }\n },\n yank: function(cm, args, ranges, oldAnchor) {\n var vim = cm.state.vim;\n var text = cm.getSelection();\n var endPos = vim.visualMode\n ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor)\n : oldAnchor;\n vimGlobalState.registerController.pushText(\n args.registerName, 'yank',\n text, args.linewise, vim.visualBlock);\n return endPos;\n }\n };\n\n function defineOperator(name, fn) {\n operators[name] = fn;\n }\n\n var actions = {\n jumpListWalk: function(cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat;\n var forward = actionArgs.forward;\n var jumpList = vimGlobalState.jumpList;\n\n var mark = jumpList.move(cm, forward ? repeat : -repeat);\n var markPos = mark ? mark.find() : undefined;\n markPos = markPos ? markPos : cm.getCursor();\n cm.setCursor(markPos);\n },\n scroll: function(cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat || 1;\n var lineHeight = cm.defaultTextHeight();\n var top = cm.getScrollInfo().top;\n var delta = lineHeight * repeat;\n var newPos = actionArgs.forward ? top + delta : top - delta;\n var cursor = copyCursor(cm.getCursor());\n var cursorCoords = cm.charCoords(cursor, 'local');\n if (actionArgs.forward) {\n if (newPos > cursorCoords.top) {\n cursor.line += (newPos - cursorCoords.top) / lineHeight;\n cursor.line = Math.ceil(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.top);\n } else {\n // Cursor stays within bounds. Just reposition the scroll window.\n cm.scrollTo(null, newPos);\n }\n } else {\n var newBottom = newPos + cm.getScrollInfo().clientHeight;\n if (newBottom < cursorCoords.bottom) {\n cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight;\n cursor.line = Math.floor(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(\n null, cursorCoords.bottom - cm.getScrollInfo().clientHeight);\n } else {\n // Cursor stays within bounds. Just reposition the scroll window.\n cm.scrollTo(null, newPos);\n }\n }\n },\n scrollToCursor: function(cm, actionArgs) {\n var lineNum = cm.getCursor().line;\n var charCoords = cm.charCoords(Pos(lineNum, 0), 'local');\n var height = cm.getScrollInfo().clientHeight;\n var y = charCoords.top;\n var lineHeight = charCoords.bottom - y;\n switch (actionArgs.position) {\n case 'center': y = y - (height / 2) + lineHeight;\n break;\n case 'bottom': y = y - height + lineHeight;\n break;\n }\n cm.scrollTo(null, y);\n },\n replayMacro: function(cm, actionArgs, vim) {\n var registerName = actionArgs.selectedCharacter;\n var repeat = actionArgs.repeat;\n var macroModeState = vimGlobalState.macroModeState;\n if (registerName == '@') {\n registerName = macroModeState.latestRegister;\n }\n while(repeat--){\n executeMacroRegister(cm, vim, macroModeState, registerName);\n }\n },\n enterMacroRecordMode: function(cm, actionArgs) {\n var macroModeState = vimGlobalState.macroModeState;\n var registerName = actionArgs.selectedCharacter;\n macroModeState.enterMacroRecordMode(cm, registerName);\n },\n enterInsertMode: function(cm, actionArgs, vim) {\n if (cm.getOption('readOnly')) { return; }\n vim.insertMode = true;\n vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1;\n var insertAt = (actionArgs) ? actionArgs.insertAt : null;\n var sel = vim.sel;\n var head = actionArgs.head || cm.getCursor('head');\n var height = cm.listSelections().length;\n if (insertAt == 'eol') {\n head = Pos(head.line, lineLength(cm, head.line));\n } else if (insertAt == 'charAfter') {\n head = offsetCursor(head, 0, 1);\n } else if (insertAt == 'firstNonBlank') {\n head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head);\n } else if (insertAt == 'startOfSelectedArea') {\n if (!vim.visualBlock) {\n if (sel.head.line < sel.anchor.line) {\n head = sel.head;\n } else {\n head = Pos(sel.anchor.line, 0);\n }\n } else {\n head = Pos(\n Math.min(sel.head.line, sel.anchor.line),\n Math.min(sel.head.ch, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n } else if (insertAt == 'endOfSelectedArea') {\n if (!vim.visualBlock) {\n if (sel.head.line >= sel.anchor.line) {\n head = offsetCursor(sel.head, 0, 1);\n } else {\n head = Pos(sel.anchor.line, 0);\n }\n } else {\n head = Pos(\n Math.min(sel.head.line, sel.anchor.line),\n Math.max(sel.head.ch + 1, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n } else if (insertAt == 'inplace') {\n if (vim.visualMode){\n return;\n }\n }\n cm.setOption('keyMap', 'vim-insert');\n cm.setOption('disableInput', false);\n if (actionArgs && actionArgs.replace) {\n // Handle Replace-mode as a special case of insert mode.\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"replace\"});\n } else {\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"insert\"});\n }\n if (!vimGlobalState.macroModeState.isPlaying) {\n // Only record if not replaying.\n cm.on('change', onChange);\n CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n selectForInsert(cm, head, height);\n },\n toggleVisualMode: function(cm, actionArgs, vim) {\n var repeat = actionArgs.repeat;\n var anchor = cm.getCursor();\n var head;\n // TODO: The repeat should actually select number of characters/lines\n // equal to the repeat times the size of the previous visual\n // operation.\n if (!vim.visualMode) {\n // Entering visual mode\n vim.visualMode = true;\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n head = clipCursorToContent(\n cm, Pos(anchor.line, anchor.ch + repeat - 1),\n true /** includeLineBreak */);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\"});\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n } else if (vim.visualLine ^ actionArgs.linewise ||\n vim.visualBlock ^ actionArgs.blockwise) {\n // Toggling between modes\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\"});\n updateCmSelection(cm);\n } else {\n exitVisualMode(cm);\n }\n },\n reselectLastSelection: function(cm, _actionArgs, vim) {\n var lastSelection = vim.lastSelection;\n if (vim.visualMode) {\n updateLastSelection(cm, vim);\n }\n if (lastSelection) {\n var anchor = lastSelection.anchorMark.find();\n var head = lastSelection.headMark.find();\n if (!anchor || !head) {\n // If the marks have been destroyed due to edits, do nothing.\n return;\n }\n vim.sel = {\n anchor: anchor,\n head: head\n };\n vim.visualMode = true;\n vim.visualLine = lastSelection.visualLine;\n vim.visualBlock = lastSelection.visualBlock;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n CodeMirror.signal(cm, 'vim-mode-change', {\n mode: 'visual',\n subMode: vim.visualLine ? 'linewise' :\n vim.visualBlock ? 'blockwise' : ''});\n }\n },\n joinLines: function(cm, actionArgs, vim) {\n var curStart, curEnd;\n if (vim.visualMode) {\n curStart = cm.getCursor('anchor');\n curEnd = cm.getCursor('head');\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curEnd;\n curEnd = curStart;\n curStart = tmp;\n }\n curEnd.ch = lineLength(cm, curEnd.line) - 1;\n } else {\n // Repeat is the number of lines to join. Minimum 2 lines.\n var repeat = Math.max(actionArgs.repeat, 2);\n curStart = cm.getCursor();\n curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1,\n Infinity));\n }\n var finalCh = 0;\n for (var i = curStart.line; i < curEnd.line; i++) {\n finalCh = lineLength(cm, curStart.line);\n var tmp = Pos(curStart.line + 1,\n lineLength(cm, curStart.line + 1));\n var text = cm.getRange(curStart, tmp);\n text = text.replace(/\\n\\s*/g, ' ');\n cm.replaceRange(text, curStart, tmp);\n }\n var curFinalPos = Pos(curStart.line, finalCh);\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curFinalPos);\n },\n newLineAndEnterInsertMode: function(cm, actionArgs, vim) {\n vim.insertMode = true;\n var insertAt = copyCursor(cm.getCursor());\n if (insertAt.line === cm.firstLine() && !actionArgs.after) {\n // Special case for inserting newline before start of document.\n cm.replaceRange('\\n', Pos(cm.firstLine(), 0));\n cm.setCursor(cm.firstLine(), 0);\n } else {\n insertAt.line = (actionArgs.after) ? insertAt.line :\n insertAt.line - 1;\n insertAt.ch = lineLength(cm, insertAt.line);\n cm.setCursor(insertAt);\n var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n newlineFn(cm);\n }\n this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim);\n },\n paste: function(cm, actionArgs, vim) {\n var cur = copyCursor(cm.getCursor());\n var register = vimGlobalState.registerController.getRegister(\n actionArgs.registerName);\n var text = register.toString();\n if (!text) {\n return;\n }\n if (actionArgs.matchIndent) {\n var tabSize = cm.getOption(\"tabSize\");\n // length that considers tabs and tabSize\n var whitespaceLength = function(str) {\n var tabs = (str.split(\"\\t\").length - 1);\n var spaces = (str.split(\" \").length - 1);\n return tabs * tabSize + spaces * 1;\n };\n var currentLine = cm.getLine(cm.getCursor().line);\n var indent = whitespaceLength(currentLine.match(/^\\s*/)[0]);\n // chomp last newline b/c don't want it to match /^\\s*/gm\n var chompedText = text.replace(/\\n$/, '');\n var wasChomped = text !== chompedText;\n var firstIndent = whitespaceLength(text.match(/^\\s*/)[0]);\n var text = chompedText.replace(/^\\s*/gm, function(wspace) {\n var newIndent = indent + (whitespaceLength(wspace) - firstIndent);\n if (newIndent < 0) {\n return \"\";\n }\n else if (cm.getOption(\"indentWithTabs\")) {\n var quotient = Math.floor(newIndent / tabSize);\n return Array(quotient + 1).join('\\t');\n }\n else {\n return Array(newIndent + 1).join(' ');\n }\n });\n text += wasChomped ? \"\\n\" : \"\";\n }\n if (actionArgs.repeat > 1) {\n var text = Array(actionArgs.repeat + 1).join(text);\n }\n var linewise = register.linewise;\n var blockwise = register.blockwise;\n if (linewise) {\n if(vim.visualMode) {\n text = vim.visualLine ? text.slice(0, -1) : '\\n' + text.slice(0, text.length - 1) + '\\n';\n } else if (actionArgs.after) {\n // Move the newline at the end to the start instead, and paste just\n // before the newline character of the line we are on right now.\n text = '\\n' + text.slice(0, text.length - 1);\n cur.ch = lineLength(cm, cur.line);\n } else {\n cur.ch = 0;\n }\n } else {\n if (blockwise) {\n text = text.split('\\n');\n for (var i = 0; i < text.length; i++) {\n text[i] = (text[i] == '') ? ' ' : text[i];\n }\n }\n cur.ch += actionArgs.after ? 1 : 0;\n }\n var curPosFinal;\n var idx;\n if (vim.visualMode) {\n // save the pasted text for reselection if the need arises\n vim.lastPastedText = text;\n var lastSelectionCurEnd;\n var selectedArea = getSelectedAreaRange(cm, vim);\n var selectionStart = selectedArea[0];\n var selectionEnd = selectedArea[1];\n var selectedText = cm.getSelection();\n var selections = cm.listSelections();\n var emptyStrings = new Array(selections.length).join('1').split('1');\n // save the curEnd marker before it get cleared due to cm.replaceRange.\n if (vim.lastSelection) {\n lastSelectionCurEnd = vim.lastSelection.headMark.find();\n }\n // push the previously selected text to unnamed register\n vimGlobalState.registerController.unnamedRegister.setText(selectedText);\n if (blockwise) {\n // first delete the selected text\n cm.replaceSelections(emptyStrings);\n // Set new selections as per the block length of the yanked text\n selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch);\n cm.setCursor(selectionStart);\n selectBlock(cm, selectionEnd);\n cm.replaceSelections(text);\n curPosFinal = selectionStart;\n } else if (vim.visualBlock) {\n cm.replaceSelections(emptyStrings);\n cm.setCursor(selectionStart);\n cm.replaceRange(text, selectionStart, selectionStart);\n curPosFinal = selectionStart;\n } else {\n cm.replaceRange(text, selectionStart, selectionEnd);\n curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1);\n }\n // restore the the curEnd marker\n if(lastSelectionCurEnd) {\n vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd);\n }\n if (linewise) {\n curPosFinal.ch=0;\n }\n } else {\n if (blockwise) {\n cm.setCursor(cur);\n for (var i = 0; i < text.length; i++) {\n var line = cur.line+i;\n if (line > cm.lastLine()) {\n cm.replaceRange('\\n', Pos(line, 0));\n }\n var lastCh = lineLength(cm, line);\n if (lastCh < cur.ch) {\n extendLineToColumn(cm, line, cur.ch);\n }\n }\n cm.setCursor(cur);\n selectBlock(cm, Pos(cur.line + text.length-1, cur.ch));\n cm.replaceSelections(text);\n curPosFinal = cur;\n } else {\n cm.replaceRange(text, cur);\n // Now fine tune the cursor to where we want it.\n if (linewise && actionArgs.after) {\n curPosFinal = Pos(\n cur.line + 1,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));\n } else if (linewise && !actionArgs.after) {\n curPosFinal = Pos(\n cur.line,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));\n } else if (!linewise && actionArgs.after) {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length - 1);\n } else {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length);\n }\n }\n }\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curPosFinal);\n },\n undo: function(cm, actionArgs) {\n cm.operation(function() {\n repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)();\n cm.setCursor(cm.getCursor('anchor'));\n });\n },\n redo: function(cm, actionArgs) {\n repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)();\n },\n setRegister: function(_cm, actionArgs, vim) {\n vim.inputState.registerName = actionArgs.selectedCharacter;\n },\n setMark: function(cm, actionArgs, vim) {\n var markName = actionArgs.selectedCharacter;\n updateMark(cm, vim, markName, cm.getCursor());\n },\n replace: function(cm, actionArgs, vim) {\n var replaceWith = actionArgs.selectedCharacter;\n var curStart = cm.getCursor();\n var replaceTo;\n var curEnd;\n var selections = cm.listSelections();\n if (vim.visualMode) {\n curStart = cm.getCursor('start');\n curEnd = cm.getCursor('end');\n } else {\n var line = cm.getLine(curStart.line);\n replaceTo = curStart.ch + actionArgs.repeat;\n if (replaceTo > line.length) {\n replaceTo=line.length;\n }\n curEnd = Pos(curStart.line, replaceTo);\n }\n if (replaceWith=='\\n') {\n if (!vim.visualMode) cm.replaceRange('', curStart, curEnd);\n // special case, where vim help says to replace by just one line-break\n (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm);\n } else {\n var replaceWithStr = cm.getRange(curStart, curEnd);\n //replace all characters in range by selected, but keep linebreaks\n replaceWithStr = replaceWithStr.replace(/[^\\n]/g, replaceWith);\n if (vim.visualBlock) {\n // Tabs are split in visua block before replacing\n var spaces = new Array(cm.getOption(\"tabSize\")+1).join(' ');\n replaceWithStr = cm.getSelection();\n replaceWithStr = replaceWithStr.replace(/\\t/g, spaces).replace(/[^\\n]/g, replaceWith).split('\\n');\n cm.replaceSelections(replaceWithStr);\n } else {\n cm.replaceRange(replaceWithStr, curStart, curEnd);\n }\n if (vim.visualMode) {\n curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ?\n selections[0].anchor : selections[0].head;\n cm.setCursor(curStart);\n exitVisualMode(cm, false);\n } else {\n cm.setCursor(offsetCursor(curEnd, 0, -1));\n }\n }\n },\n incrementNumberToken: function(cm, actionArgs) {\n var cur = cm.getCursor();\n var lineStr = cm.getLine(cur.line);\n var re = /-?\\d+/g;\n var match;\n var start;\n var end;\n var numberStr;\n var token;\n while ((match = re.exec(lineStr)) !== null) {\n token = match[0];\n start = match.index;\n end = start + token.length;\n if (cur.ch < end)break;\n }\n if (!actionArgs.backtrack && (end <= cur.ch))return;\n if (token) {\n var increment = actionArgs.increase ? 1 : -1;\n var number = parseInt(token) + (increment * actionArgs.repeat);\n var from = Pos(cur.line, start);\n var to = Pos(cur.line, end);\n numberStr = number.toString();\n cm.replaceRange(numberStr, from, to);\n } else {\n return;\n }\n cm.setCursor(Pos(cur.line, start + numberStr.length - 1));\n },\n repeatLastEdit: function(cm, actionArgs, vim) {\n var lastEditInputState = vim.lastEditInputState;\n if (!lastEditInputState) { return; }\n var repeat = actionArgs.repeat;\n if (repeat && actionArgs.repeatIsExplicit) {\n vim.lastEditInputState.repeatOverride = repeat;\n } else {\n repeat = vim.lastEditInputState.repeatOverride || repeat;\n }\n repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);\n },\n exitInsertMode: exitInsertMode\n };\n\n function defineAction(name, fn) {\n actions[name] = fn;\n }\n\n /*\n * Below are miscellaneous utility functions used by vim.js\n */\n\n /**\n * Clips cursor to ensure that line is within the buffer's range\n * If includeLineBreak is true, then allow cur.ch == lineLength.\n */\n function clipCursorToContent(cm, cur, includeLineBreak) {\n var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );\n var maxCh = lineLength(cm, line) - 1;\n maxCh = (includeLineBreak) ? maxCh + 1 : maxCh;\n var ch = Math.min(Math.max(0, cur.ch), maxCh);\n return Pos(line, ch);\n }\n function copyArgs(args) {\n var ret = {};\n for (var prop in args) {\n if (args.hasOwnProperty(prop)) {\n ret[prop] = args[prop];\n }\n }\n return ret;\n }\n function offsetCursor(cur, offsetLine, offsetCh) {\n if (typeof offsetLine === 'object') {\n offsetCh = offsetLine.ch;\n offsetLine = offsetLine.line;\n }\n return Pos(cur.line + offsetLine, cur.ch + offsetCh);\n }\n function getOffset(anchor, head) {\n return {\n line: head.line - anchor.line,\n ch: head.line - anchor.line\n };\n }\n function commandMatches(keys, keyMap, context, inputState) {\n // Partial matches are not applied. They inform the key handler\n // that the current key sequence is a subsequence of a valid key\n // sequence, so that the key buffer is not cleared.\n var match, partial = [], full = [];\n for (var i = 0; i < keyMap.length; i++) {\n var command = keyMap[i];\n if (context == 'insert' && command.context != 'insert' ||\n command.context && command.context != context ||\n inputState.operator && command.type == 'action' ||\n !(match = commandMatch(keys, command.keys))) { continue; }\n if (match == 'partial') { partial.push(command); }\n if (match == 'full') { full.push(command); }\n }\n return {\n partial: partial.length && partial,\n full: full.length && full\n };\n }\n function commandMatch(pressed, mapped) {\n if (mapped.slice(-11) == '<character>') {\n // Last character matches anything.\n var prefixLen = mapped.length - 11;\n var pressedPrefix = pressed.slice(0, prefixLen);\n var mappedPrefix = mapped.slice(0, prefixLen);\n return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' :\n mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false;\n } else {\n return pressed == mapped ? 'full' :\n mapped.indexOf(pressed) == 0 ? 'partial' : false;\n }\n }\n function lastChar(keys) {\n var match = /^.*(<[\\w\\-]+>)$/.exec(keys);\n var selectedCharacter = match ? match[1] : keys.slice(-1);\n if (selectedCharacter.length > 1){\n switch(selectedCharacter){\n case '<CR>':\n selectedCharacter='\\n';\n break;\n case '<Space>':\n selectedCharacter=' ';\n break;\n default:\n break;\n }\n }\n return selectedCharacter;\n }\n function repeatFn(cm, fn, repeat) {\n return function() {\n for (var i = 0; i < repeat; i++) {\n fn(cm);\n }\n };\n }\n function copyCursor(cur) {\n return Pos(cur.line, cur.ch);\n }\n function cursorEqual(cur1, cur2) {\n return cur1.ch == cur2.ch && cur1.line == cur2.line;\n }\n function cursorIsBefore(cur1, cur2) {\n if (cur1.line < cur2.line) {\n return true;\n }\n if (cur1.line == cur2.line && cur1.ch < cur2.ch) {\n return true;\n }\n return false;\n }\n function cursorMin(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur1 : cur2;\n }\n function cursorMax(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur2 : cur1;\n }\n function cursorIsBetween(cur1, cur2, cur3) {\n // returns true if cur2 is between cur1 and cur3.\n var cur1before2 = cursorIsBefore(cur1, cur2);\n var cur2before3 = cursorIsBefore(cur2, cur3);\n return cur1before2 && cur2before3;\n }\n function lineLength(cm, lineNum) {\n return cm.getLine(lineNum).length;\n }\n function trim(s) {\n if (s.trim) {\n return s.trim();\n }\n return s.replace(/^\\s+|\\s+$/g, '');\n }\n function escapeRegex(s) {\n return s.replace(/([.?*+$\\[\\]\\/\\\\(){}|\\-])/g, '\\\\$1');\n }\n function extendLineToColumn(cm, lineNum, column) {\n var endCh = lineLength(cm, lineNum);\n var spaces = new Array(column-endCh+1).join(' ');\n cm.setCursor(Pos(lineNum, endCh));\n cm.replaceRange(spaces, cm.getCursor());\n }\n // This functions selects a rectangular block\n // of text with selectionEnd as any of its corner\n // Height of block:\n // Difference in selectionEnd.line and first/last selection.line\n // Width of the block:\n // Distance between selectionEnd.ch and any(first considered here) selection.ch\n function selectBlock(cm, selectionEnd) {\n var selections = [], ranges = cm.listSelections();\n var head = copyCursor(cm.clipPos(selectionEnd));\n var isClipped = !cursorEqual(selectionEnd, head);\n var curHead = cm.getCursor('head');\n var primIndex = getIndex(ranges, curHead);\n var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor);\n var max = ranges.length - 1;\n var index = max - primIndex > primIndex ? max : 0;\n var base = ranges[index].anchor;\n\n var firstLine = Math.min(base.line, head.line);\n var lastLine = Math.max(base.line, head.line);\n var baseCh = base.ch, headCh = head.ch;\n\n var dir = ranges[index].head.ch - baseCh;\n var newDir = headCh - baseCh;\n if (dir > 0 && newDir <= 0) {\n baseCh++;\n if (!isClipped) { headCh--; }\n } else if (dir < 0 && newDir >= 0) {\n baseCh--;\n if (!wasClipped) { headCh++; }\n } else if (dir < 0 && newDir == -1) {\n baseCh--;\n headCh++;\n }\n for (var line = firstLine; line <= lastLine; line++) {\n var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)};\n selections.push(range);\n }\n primIndex = head.line == lastLine ? selections.length - 1 : 0;\n cm.setSelections(selections);\n selectionEnd.ch = headCh;\n base.ch = baseCh;\n return base;\n }\n function selectForInsert(cm, head, height) {\n var sel = [];\n for (var i = 0; i < height; i++) {\n var lineHead = offsetCursor(head, i, 0);\n sel.push({anchor: lineHead, head: lineHead});\n }\n cm.setSelections(sel, 0);\n }\n // getIndex returns the index of the cursor in the selections.\n function getIndex(ranges, cursor, end) {\n for (var i = 0; i < ranges.length; i++) {\n var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);\n var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);\n if (atAnchor || atHead) {\n return i;\n }\n }\n return -1;\n }\n function getSelectedAreaRange(cm, vim) {\n var lastSelection = vim.lastSelection;\n var getCurrentSelectedAreaRange = function() {\n var selections = cm.listSelections();\n var start = selections[0];\n var end = selections[selections.length-1];\n var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;\n var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor;\n return [selectionStart, selectionEnd];\n };\n var getLastSelectedAreaRange = function() {\n var selectionStart = cm.getCursor();\n var selectionEnd = cm.getCursor();\n var block = lastSelection.visualBlock;\n if (block) {\n var width = block.width;\n var height = block.height;\n selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width);\n var selections = [];\n // selectBlock creates a 'proper' rectangular block.\n // We do not want that in all cases, so we manually set selections.\n for (var i = selectionStart.line; i < selectionEnd.line; i++) {\n var anchor = Pos(i, selectionStart.ch);\n var head = Pos(i, selectionEnd.ch);\n var range = {anchor: anchor, head: head};\n selections.push(range);\n }\n cm.setSelections(selections);\n } else {\n var start = lastSelection.anchorMark.find();\n var end = lastSelection.headMark.find();\n var line = end.line - start.line;\n var ch = end.ch - start.ch;\n selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch};\n if (lastSelection.visualLine) {\n selectionStart = Pos(selectionStart.line, 0);\n selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));\n }\n cm.setSelection(selectionStart, selectionEnd);\n }\n return [selectionStart, selectionEnd];\n };\n if (!vim.visualMode) {\n // In case of replaying the action.\n return getLastSelectedAreaRange();\n } else {\n return getCurrentSelectedAreaRange();\n }\n }\n // Updates the previous selection with the current selection's values. This\n // should only be called in visual mode.\n function updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n // To accommodate the effect of lastPastedText in the last selection\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock};\n }\n function expandSelection(cm, start, end) {\n var sel = cm.state.vim.sel;\n var head = sel.head;\n var anchor = sel.anchor;\n var tmp;\n if (cursorIsBefore(end, start)) {\n tmp = end;\n end = start;\n start = tmp;\n }\n if (cursorIsBefore(head, anchor)) {\n head = cursorMin(start, head);\n anchor = cursorMax(anchor, end);\n } else {\n anchor = cursorMin(start, anchor);\n head = cursorMax(head, end);\n head = offsetCursor(head, 0, -1);\n if (head.ch == -1 && head.line != cm.firstLine()) {\n head = Pos(head.line - 1, lineLength(cm, head.line - 1));\n }\n }\n return [anchor, head];\n }\n /**\n * Updates the CodeMirror selection to match the provided vim selection.\n * If no arguments are given, it uses the current vim selection state.\n */\n function updateCmSelection(cm, sel, mode) {\n var vim = cm.state.vim;\n sel = sel || vim.sel;\n var mode = mode ||\n vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';\n var cmSel = makeCmSelection(cm, sel, mode);\n cm.setSelections(cmSel.ranges, cmSel.primary);\n updateFakeCursor(cm);\n }\n function makeCmSelection(cm, sel, mode, exclusive) {\n var head = copyCursor(sel.head);\n var anchor = copyCursor(sel.anchor);\n if (mode == 'char') {\n var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n head = offsetCursor(sel.head, 0, headOffset);\n anchor = offsetCursor(sel.anchor, 0, anchorOffset);\n return {\n ranges: [{anchor: anchor, head: head}],\n primary: 0\n };\n } else if (mode == 'line') {\n if (!cursorIsBefore(sel.head, sel.anchor)) {\n anchor.ch = 0;\n\n var lastLine = cm.lastLine();\n if (head.line > lastLine) {\n head.line = lastLine;\n }\n head.ch = lineLength(cm, head.line);\n } else {\n head.ch = 0;\n anchor.ch = lineLength(cm, anchor.line);\n }\n return {\n ranges: [{anchor: anchor, head: head}],\n primary: 0\n };\n } else if (mode == 'block') {\n var top = Math.min(anchor.line, head.line),\n left = Math.min(anchor.ch, head.ch),\n bottom = Math.max(anchor.line, head.line),\n right = Math.max(anchor.ch, head.ch) + 1;\n var height = bottom - top + 1;\n var primary = head.line == top ? 0 : height - 1;\n var ranges = [];\n for (var i = 0; i < height; i++) {\n ranges.push({\n anchor: Pos(top + i, left),\n head: Pos(top + i, right)\n });\n }\n return {\n ranges: ranges,\n primary: primary\n };\n }\n }\n function getHead(cm) {\n var cur = cm.getCursor('head');\n if (cm.getSelection().length == 1) {\n // Small corner case when only 1 character is selected. The \"real\"\n // head is the left of head and anchor.\n cur = cursorMin(cur, cm.getCursor('anchor'));\n }\n return cur;\n }\n\n /**\n * If moveHead is set to false, the CodeMirror selection will not be\n * touched. The caller assumes the responsibility of putting the cursor\n * in the right place.\n */\n function exitVisualMode(cm, moveHead) {\n var vim = cm.state.vim;\n if (moveHead !== false) {\n cm.setCursor(clipCursorToContent(cm, vim.sel.head));\n }\n updateLastSelection(cm, vim);\n vim.visualMode = false;\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n if (vim.fakeCursor) {\n vim.fakeCursor.clear();\n }\n }\n\n // Remove any trailing newlines from the selection. For\n // example, with the caret at the start of the last word on the line,\n // 'dw' should word, but not the newline, while 'w' should advance the\n // caret to the first character of the next line.\n function clipToLine(cm, curStart, curEnd) {\n var selection = cm.getRange(curStart, curEnd);\n // Only clip if the selection ends with trailing newline + whitespace\n if (/\\n\\s*$/.test(selection)) {\n var lines = selection.split('\\n');\n // We know this is all whitepsace.\n lines.pop();\n\n // Cases:\n // 1. Last word is an empty line - do not clip the trailing '\\n'\n // 2. Last word is not an empty line - clip the trailing '\\n'\n var line;\n // Find the line containing the last word, and clip all whitespace up\n // to it.\n for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) {\n curEnd.line--;\n curEnd.ch = 0;\n }\n // If the last word is not an empty line, clip an additional newline\n if (line) {\n curEnd.line--;\n curEnd.ch = lineLength(cm, curEnd.line);\n } else {\n curEnd.ch = 0;\n }\n }\n }\n\n // Expand the selection to line ends.\n function expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }\n\n function findFirstNonWhiteSpaceCharacter(text) {\n if (!text) {\n return 0;\n }\n var firstNonWS = text.search(/\\S/);\n return firstNonWS == -1 ? text.length : firstNonWS;\n }\n\n function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {\n var cur = getHead(cm);\n var line = cm.getLine(cur.line);\n var idx = cur.ch;\n\n // Seek to first word or non-whitespace character, depending on if\n // noSymbol is true.\n var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0];\n while (!test(line.charAt(idx))) {\n idx++;\n if (idx >= line.length) { return null; }\n }\n\n if (bigWord) {\n test = bigWordCharTest[0];\n } else {\n test = wordCharTest[0];\n if (!test(line.charAt(idx))) {\n test = wordCharTest[1];\n }\n }\n\n var end = idx, start = idx;\n while (test(line.charAt(end)) && end < line.length) { end++; }\n while (test(line.charAt(start)) && start >= 0) { start--; }\n start++;\n\n if (inclusive) {\n // If present, include all whitespace after word.\n // Otherwise, include all whitespace before word, except indentation.\n var wordEnd = end;\n while (/\\s/.test(line.charAt(end)) && end < line.length) { end++; }\n if (wordEnd == end) {\n var wordStart = start;\n while (/\\s/.test(line.charAt(start - 1)) && start > 0) { start--; }\n if (!start) { start = wordStart; }\n }\n }\n return { start: Pos(cur.line, start), end: Pos(cur.line, end) };\n }\n\n function recordJumpPosition(cm, oldCur, newCur) {\n if (!cursorEqual(oldCur, newCur)) {\n vimGlobalState.jumpList.add(cm, oldCur, newCur);\n }\n }\n\n function recordLastCharacterSearch(increment, args) {\n vimGlobalState.lastChararacterSearch.increment = increment;\n vimGlobalState.lastChararacterSearch.forward = args.forward;\n vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter;\n }\n\n var symbolToMode = {\n '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket',\n '[': 'section', ']': 'section',\n '*': 'comment', '/': 'comment',\n 'm': 'method', 'M': 'method',\n '#': 'preprocess'\n };\n var findSymbolModes = {\n bracket: {\n isComplete: function(state) {\n if (state.nextCh === state.symb) {\n state.depth++;\n if (state.depth >= 1)return true;\n } else if (state.nextCh === state.reverseSymb) {\n state.depth--;\n }\n return false;\n }\n },\n section: {\n init: function(state) {\n state.curMoveThrough = true;\n state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}';\n },\n isComplete: function(state) {\n return state.index === 0 && state.nextCh === state.symb;\n }\n },\n comment: {\n isComplete: function(state) {\n var found = state.lastCh === '*' && state.nextCh === '/';\n state.lastCh = state.nextCh;\n return found;\n }\n },\n // TODO: The original Vim implementation only operates on level 1 and 2.\n // The current implementation doesn't check for code block level and\n // therefore it operates on any levels.\n method: {\n init: function(state) {\n state.symb = (state.symb === 'm' ? '{' : '}');\n state.reverseSymb = state.symb === '{' ? '}' : '{';\n },\n isComplete: function(state) {\n if (state.nextCh === state.symb)return true;\n return false;\n }\n },\n preprocess: {\n init: function(state) {\n state.index = 0;\n },\n isComplete: function(state) {\n if (state.nextCh === '#') {\n var token = state.lineText.match(/#(\\w+)/)[1];\n if (token === 'endif') {\n if (state.forward && state.depth === 0) {\n return true;\n }\n state.depth++;\n } else if (token === 'if') {\n if (!state.forward && state.depth === 0) {\n return true;\n }\n state.depth--;\n }\n if (token === 'else' && state.depth === 0)return true;\n }\n return false;\n }\n }\n };\n function findSymbol(cm, repeat, forward, symb) {\n var cur = copyCursor(cm.getCursor());\n var increment = forward ? 1 : -1;\n var endLine = forward ? cm.lineCount() : -1;\n var curCh = cur.ch;\n var line = cur.line;\n var lineText = cm.getLine(line);\n var state = {\n lineText: lineText,\n nextCh: lineText.charAt(curCh),\n lastCh: null,\n index: curCh,\n symb: symb,\n reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb],\n forward: forward,\n depth: 0,\n curMoveThrough: false\n };\n var mode = symbolToMode[symb];\n if (!mode)return cur;\n var init = findSymbolModes[mode].init;\n var isComplete = findSymbolModes[mode].isComplete;\n if (init) { init(state); }\n while (line !== endLine && repeat) {\n state.index += increment;\n state.nextCh = state.lineText.charAt(state.index);\n if (!state.nextCh) {\n line += increment;\n state.lineText = cm.getLine(line) || '';\n if (increment > 0) {\n state.index = 0;\n } else {\n var lineLen = state.lineText.length;\n state.index = (lineLen > 0) ? (lineLen-1) : 0;\n }\n state.nextCh = state.lineText.charAt(state.index);\n }\n if (isComplete(state)) {\n cur.line = line;\n cur.ch = state.index;\n repeat--;\n }\n }\n if (state.nextCh || state.curMoveThrough) {\n return Pos(line, state.index);\n }\n return cur;\n }\n\n /**\n * Returns the boundaries of the next word. If the cursor in the middle of\n * the word, then returns the boundaries of the current word, starting at\n * the cursor. If the cursor is at the start/end of a word, and we are going\n * forward/backward, respectively, find the boundaries of the next word.\n *\n * @param {CodeMirror} cm CodeMirror object.\n * @param {Cursor} cur The cursor position.\n * @param {boolean} forward True to search forward. False to search\n * backward.\n * @param {boolean} bigWord True if punctuation count as part of the word.\n * False if only [a-zA-Z0-9] characters count as part of the word.\n * @param {boolean} emptyLineIsWord True if empty lines should be treated\n * as words.\n * @return {Object{from:number, to:number, line: number}} The boundaries of\n * the word, or null if there are no more words.\n */\n function findWord(cm, cur, forward, bigWord, emptyLineIsWord) {\n var lineNum = cur.line;\n var pos = cur.ch;\n var line = cm.getLine(lineNum);\n var dir = forward ? 1 : -1;\n var charTests = bigWord ? bigWordCharTest: wordCharTest;\n\n if (emptyLineIsWord && line == '') {\n lineNum += dir;\n line = cm.getLine(lineNum);\n if (!isLine(cm, lineNum)) {\n return null;\n }\n pos = (forward) ? 0 : line.length;\n }\n\n while (true) {\n if (emptyLineIsWord && line == '') {\n return { from: 0, to: 0, line: lineNum };\n }\n var stop = (dir > 0) ? line.length : -1;\n var wordStart = stop, wordEnd = stop;\n // Find bounds of next word.\n while (pos != stop) {\n var foundWord = false;\n for (var i = 0; i < charTests.length && !foundWord; ++i) {\n if (charTests[i](line.charAt(pos))) {\n wordStart = pos;\n // Advance to end of word.\n while (pos != stop && charTests[i](line.charAt(pos))) {\n pos += dir;\n }\n wordEnd = pos;\n foundWord = wordStart != wordEnd;\n if (wordStart == cur.ch && lineNum == cur.line &&\n wordEnd == wordStart + dir) {\n // We started at the end of a word. Find the next one.\n continue;\n } else {\n return {\n from: Math.min(wordStart, wordEnd + 1),\n to: Math.max(wordStart, wordEnd),\n line: lineNum };\n }\n }\n }\n if (!foundWord) {\n pos += dir;\n }\n }\n // Advance to next/prev line.\n lineNum += dir;\n if (!isLine(cm, lineNum)) {\n return null;\n }\n line = cm.getLine(lineNum);\n pos = (dir > 0) ? 0 : line.length;\n }\n // Should never get here.\n throw new Error('The impossible happened.');\n }\n\n /**\n * @param {CodeMirror} cm CodeMirror object.\n * @param {Pos} cur The position to start from.\n * @param {int} repeat Number of words to move past.\n * @param {boolean} forward True to search forward. False to search\n * backward.\n * @param {boolean} wordEnd True to move to end of word. False to move to\n * beginning of word.\n * @param {boolean} bigWord True if punctuation count as part of the word.\n * False if only alphabet characters count as part of the word.\n * @return {Cursor} The position the cursor should move to.\n */\n function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {\n var curStart = copyCursor(cur);\n var words = [];\n if (forward && !wordEnd || !forward && wordEnd) {\n repeat++;\n }\n // For 'e', empty lines are not considered words, go figure.\n var emptyLineIsWord = !(forward && wordEnd);\n for (var i = 0; i < repeat; i++) {\n var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord);\n if (!word) {\n var eodCh = lineLength(cm, cm.lastLine());\n words.push(forward\n ? {line: cm.lastLine(), from: eodCh, to: eodCh}\n : {line: 0, from: 0, to: 0});\n break;\n }\n words.push(word);\n cur = Pos(word.line, forward ? (word.to - 1) : word.from);\n }\n var shortCircuit = words.length != repeat;\n var firstWord = words[0];\n var lastWord = words.pop();\n if (forward && !wordEnd) {\n // w\n if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) {\n // We did not start in the middle of a word. Discard the extra word at the end.\n lastWord = words.pop();\n }\n return Pos(lastWord.line, lastWord.from);\n } else if (forward && wordEnd) {\n return Pos(lastWord.line, lastWord.to - 1);\n } else if (!forward && wordEnd) {\n // ge\n if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {\n // We did not start in the middle of a word. Discard the extra word at the end.\n lastWord = words.pop();\n }\n return Pos(lastWord.line, lastWord.to);\n } else {\n // b\n return Pos(lastWord.line, lastWord.from);\n }\n }\n\n function moveToCharacter(cm, repeat, forward, character) {\n var cur = cm.getCursor();\n var start = cur.ch;\n var idx;\n for (var i = 0; i < repeat; i ++) {\n var line = cm.getLine(cur.line);\n idx = charIdxInLine(start, line, character, forward, true);\n if (idx == -1) {\n return null;\n }\n start = idx;\n }\n return Pos(cm.getCursor().line, idx);\n }\n\n function moveToColumn(cm, repeat) {\n // repeat is always >= 1, so repeat - 1 always corresponds\n // to the column we want to go to.\n var line = cm.getCursor().line;\n return clipCursorToContent(cm, Pos(line, repeat - 1));\n }\n\n function updateMark(cm, vim, markName, pos) {\n if (!inArray(markName, validMarks)) {\n return;\n }\n if (vim.marks[markName]) {\n vim.marks[markName].clear();\n }\n vim.marks[markName] = cm.setBookmark(pos);\n }\n\n function charIdxInLine(start, line, character, forward, includeChar) {\n // Search for char in line.\n // motion_options: {forward, includeChar}\n // If includeChar = true, include it too.\n // If forward = true, search forward, else search backwards.\n // If char is not found on this line, do nothing\n var idx;\n if (forward) {\n idx = line.indexOf(character, start + 1);\n if (idx != -1 && !includeChar) {\n idx -= 1;\n }\n } else {\n idx = line.lastIndexOf(character, start - 1);\n if (idx != -1 && !includeChar) {\n idx += 1;\n }\n }\n return idx;\n }\n\n function findParagraph(cm, head, repeat, dir, inclusive) {\n var line = head.line;\n var min = cm.firstLine();\n var max = cm.lastLine();\n var start, end, i = line;\n function isEmpty(i) { return !cm.getLine(i); }\n function isBoundary(i, dir, any) {\n if (any) { return isEmpty(i) != isEmpty(i + dir); }\n return !isEmpty(i) && isEmpty(i + dir);\n }\n if (dir) {\n while (min <= i && i <= max && repeat > 0) {\n if (isBoundary(i, dir)) { repeat--; }\n i += dir;\n }\n return new Pos(i, 0);\n }\n\n var vim = cm.state.vim;\n if (vim.visualLine && isBoundary(line, 1, true)) {\n var anchor = vim.sel.anchor;\n if (isBoundary(anchor.line, -1, true)) {\n if (!inclusive || anchor.line != line) {\n line += 1;\n }\n }\n }\n var startState = isEmpty(line);\n for (i = line; i <= max && repeat; i++) {\n if (isBoundary(i, 1, true)) {\n if (!inclusive || isEmpty(i) != startState) {\n repeat--;\n }\n }\n }\n end = new Pos(i, 0);\n // select boundary before paragraph for the last one\n if (i > max && !startState) { startState = true; }\n else { inclusive = false; }\n for (i = line; i > min; i--) {\n if (!inclusive || isEmpty(i) == startState || i == line) {\n if (isBoundary(i, -1, true)) { break; }\n }\n }\n start = new Pos(i, 0);\n return { start: start, end: end };\n }\n\n // TODO: perhaps this finagling of start and end positions belonds\n // in codmirror/replaceRange?\n function selectCompanionObject(cm, head, symb, inclusive) {\n var cur = head, start, end;\n\n var bracketRegexp = ({\n '(': /[()]/, ')': /[()]/,\n '[': /[[\\]]/, ']': /[[\\]]/,\n '{': /[{}]/, '}': /[{}]/})[symb];\n var openSym = ({\n '(': '(', ')': '(',\n '[': '[', ']': '[',\n '{': '{', '}': '{'})[symb];\n var curChar = cm.getLine(cur.line).charAt(cur.ch);\n // Due to the behavior of scanForBracket, we need to add an offset if the\n // cursor is on a matching open bracket.\n var offset = curChar === openSym ? 1 : 0;\n\n start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp});\n end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp});\n\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n\n start = start.pos;\n end = end.pos;\n\n if ((start.line == end.line && start.ch > end.ch)\n || (start.line > end.line)) {\n var tmp = start;\n start = end;\n end = tmp;\n }\n\n if (inclusive) {\n end.ch += 1;\n } else {\n start.ch += 1;\n }\n\n return { start: start, end: end };\n }\n\n // Takes in a symbol and a cursor and tries to simulate text objects that\n // have identical opening and closing symbols\n // TODO support across multiple lines\n function findBeginningAndEnd(cm, head, symb, inclusive) {\n var cur = copyCursor(head);\n var line = cm.getLine(cur.line);\n var chars = line.split('');\n var start, end, i, len;\n var firstIndex = chars.indexOf(symb);\n\n // the decision tree is to always look backwards for the beginning first,\n // but if the cursor is in front of the first instance of the symb,\n // then move the cursor forward\n if (cur.ch < firstIndex) {\n cur.ch = firstIndex;\n // Why is this line even here???\n // cm.setCursor(cur.line, firstIndex+1);\n }\n // otherwise if the cursor is currently on the closing symbol\n else if (firstIndex < cur.ch && chars[cur.ch] == symb) {\n end = cur.ch; // assign end to the current cursor\n --cur.ch; // make sure to look backwards\n }\n\n // if we're currently on the symbol, we've got a start\n if (chars[cur.ch] == symb && !end) {\n start = cur.ch + 1; // assign start to ahead of the cursor\n } else {\n // go backwards to find the start\n for (i = cur.ch; i > -1 && !start; i--) {\n if (chars[i] == symb) {\n start = i + 1;\n }\n }\n }\n\n // look forwards for the end symbol\n if (start && !end) {\n for (i = start, len = chars.length; i < len && !end; i++) {\n if (chars[i] == symb) {\n end = i;\n }\n }\n }\n\n // nothing found\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n\n // include the symbols\n if (inclusive) {\n --start; ++end;\n }\n\n return {\n start: Pos(cur.line, start),\n end: Pos(cur.line, end)\n };\n }\n\n // Search functions\n defineOption('pcre', true, 'boolean');\n function SearchState() {}\n SearchState.prototype = {\n getQuery: function() {\n return vimGlobalState.query;\n },\n setQuery: function(query) {\n vimGlobalState.query = query;\n },\n getOverlay: function() {\n return this.searchOverlay;\n },\n setOverlay: function(overlay) {\n this.searchOverlay = overlay;\n },\n isReversed: function() {\n return vimGlobalState.isReversed;\n },\n setReversed: function(reversed) {\n vimGlobalState.isReversed = reversed;\n },\n getScrollbarAnnotate: function() {\n return this.annotate;\n },\n setScrollbarAnnotate: function(annotate) {\n this.annotate = annotate;\n }\n };\n function getSearchState(cm) {\n var vim = cm.state.vim;\n return vim.searchState_ || (vim.searchState_ = new SearchState());\n }\n function dialog(cm, template, shortText, onClose, options) {\n if (cm.openDialog) {\n cm.openDialog(template, onClose, { bottom: true, value: options.value,\n onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp,\n selectValueOnOpen: false});\n }\n else {\n onClose(prompt(shortText, ''));\n }\n }\n function splitBySlash(argString) {\n var slashes = findUnescapedSlashes(argString) || [];\n if (!slashes.length) return [];\n var tokens = [];\n // in case of strings like foo/bar\n if (slashes[0] !== 0) return;\n for (var i = 0; i < slashes.length; i++) {\n if (typeof slashes[i] == 'number')\n tokens.push(argString.substring(slashes[i] + 1, slashes[i+1]));\n }\n return tokens;\n }\n\n function findUnescapedSlashes(str) {\n var escapeNextChar = false;\n var slashes = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i);\n if (!escapeNextChar && c == '/') {\n slashes.push(i);\n }\n escapeNextChar = !escapeNextChar && (c == '\\\\');\n }\n return slashes;\n }\n\n // Translates a search string from ex (vim) syntax into javascript form.\n function translateRegex(str) {\n // When these match, add a '\\' if unescaped or remove one if escaped.\n var specials = '|(){';\n // Remove, but never add, a '\\' for these.\n var unescape = '}';\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i+1) || '';\n var specialComesNext = (n && specials.indexOf(n) != -1);\n if (escapeNextChar) {\n if (c !== '\\\\' || !specialComesNext) {\n out.push(c);\n }\n escapeNextChar = false;\n } else {\n if (c === '\\\\') {\n escapeNextChar = true;\n // Treat the unescape list as special for removing, but not adding '\\'.\n if (n && unescape.indexOf(n) != -1) {\n specialComesNext = true;\n }\n // Not passing this test means removing a '\\'.\n if (!specialComesNext || n === '\\\\') {\n out.push(c);\n }\n } else {\n out.push(c);\n if (specialComesNext && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n }\n\n // Translates the replace part of a search and replace from ex (vim) syntax into\n // javascript form. Similar to translateRegex, but additionally fixes back references\n // (translates '\\[0..9]' to '$[0..9]') and follows different rules for escaping '$'.\n var charUnescapes = {'\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t'};\n function translateRegexReplace(str) {\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i+1) || '';\n if (charUnescapes[c + n]) {\n out.push(charUnescapes[c+n]);\n i++;\n } else if (escapeNextChar) {\n // At any point in the loop, escapeNextChar is true if the previous\n // character was a '\\' and was not escaped.\n out.push(c);\n escapeNextChar = false;\n } else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if ((isNumber(n) || n === '$')) {\n out.push('$');\n } else if (n !== '/' && n !== '\\\\') {\n out.push('\\\\');\n }\n } else {\n if (c === '$') {\n out.push('$');\n }\n out.push(c);\n if (n === '/') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n }\n\n // Unescape \\ and / in the replace part, for PCRE mode.\n var unescapes = {'\\\\/': '/', '\\\\\\\\': '\\\\', '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t'};\n function unescapeRegexReplace(str) {\n var stream = new CodeMirror.StringStream(str);\n var output = [];\n while (!stream.eol()) {\n // Search for \\.\n while (stream.peek() && stream.peek() != '\\\\') {\n output.push(stream.next());\n }\n var matched = false;\n for (var matcher in unescapes) {\n if (stream.match(matcher, true)) {\n matched = true;\n output.push(unescapes[matcher]);\n break;\n }\n }\n if (!matched) {\n // Don't change anything\n output.push(stream.next());\n }\n }\n return output.join('');\n }\n\n /**\n * Extract the regular expression from the query and return a Regexp object.\n * Returns null if the query is blank.\n * If ignoreCase is passed in, the Regexp object will have the 'i' flag set.\n * If smartCase is passed in, and the query contains upper case letters,\n * then ignoreCase is overridden, and the 'i' flag will not be set.\n * If the query contains the /i in the flag part of the regular expression,\n * then both ignoreCase and smartCase are ignored, and 'i' will be passed\n * through to the Regex object.\n */\n function parseQuery(query, ignoreCase, smartCase) {\n // First update the last search register\n var lastSearchRegister = vimGlobalState.registerController.getRegister('/');\n lastSearchRegister.setText(query);\n // Check if the query is already a regex.\n if (query instanceof RegExp) { return query; }\n // First try to extract regex + flags from the input. If no flags found,\n // extract just the regex. IE does not accept flags directly defined in\n // the regex string in the form /regex/flags\n var slashes = findUnescapedSlashes(query);\n var regexPart;\n var forceIgnoreCase;\n if (!slashes.length) {\n // Query looks like 'regexp'\n regexPart = query;\n } else {\n // Query looks like 'regexp/...'\n regexPart = query.substring(0, slashes[0]);\n var flagsPart = query.substring(slashes[0]);\n forceIgnoreCase = (flagsPart.indexOf('i') != -1);\n }\n if (!regexPart) {\n return null;\n }\n if (!getOption('pcre')) {\n regexPart = translateRegex(regexPart);\n }\n if (smartCase) {\n ignoreCase = (/^[^A-Z]*$/).test(regexPart);\n }\n var regexp = new RegExp(regexPart,\n (ignoreCase || forceIgnoreCase) ? 'i' : undefined);\n return regexp;\n }\n function showConfirm(cm, text) {\n if (cm.openNotification) {\n cm.openNotification('<span style=\"color: red\">' + text + '</span>',\n {bottom: true, duration: 5000});\n } else {\n alert(text);\n }\n }\n function makePrompt(prefix, desc) {\n var raw = '';\n if (prefix) {\n raw += '<span style=\"font-family: monospace\">' + prefix + '</span>';\n }\n raw += '<input type=\"text\"/> ' +\n '<span style=\"color: #888\">';\n if (desc) {\n raw += '<span style=\"color: #888\">';\n raw += desc;\n raw += '</span>';\n }\n return raw;\n }\n var searchPromptDesc = '(Javascript regexp)';\n function showPrompt(cm, options) {\n var shortText = (options.prefix || '') + ' ' + (options.desc || '');\n var prompt = makePrompt(options.prefix, options.desc);\n dialog(cm, prompt, shortText, options.onClose, options);\n }\n function regexEqual(r1, r2) {\n if (r1 instanceof RegExp && r2 instanceof RegExp) {\n var props = ['global', 'multiline', 'ignoreCase', 'source'];\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n if (r1[prop] !== r2[prop]) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n // Returns true if the query is valid.\n function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {\n if (!rawQuery) {\n return;\n }\n var state = getSearchState(cm);\n var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);\n if (!query) {\n return;\n }\n highlightSearchMatches(cm, query);\n if (regexEqual(query, state.getQuery())) {\n return query;\n }\n state.setQuery(query);\n return query;\n }\n function searchOverlay(query) {\n if (query.source.charAt(0) == '^') {\n var matchSol = true;\n }\n return {\n token: function(stream) {\n if (matchSol && !stream.sol()) {\n stream.skipToEnd();\n return;\n }\n var match = stream.match(query, false);\n if (match) {\n if (match[0].length == 0) {\n // Matched empty string, skip to next.\n stream.next();\n return 'searching';\n }\n if (!stream.sol()) {\n // Backtrack 1 to match \\b\n stream.backUp(1);\n if (!query.exec(stream.next() + match[0])) {\n stream.next();\n return null;\n }\n }\n stream.match(query);\n return 'searching';\n }\n while (!stream.eol()) {\n stream.next();\n if (stream.match(query, false)) break;\n }\n },\n query: query\n };\n }\n function highlightSearchMatches(cm, query) {\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (!overlay || query != overlay.query) {\n if (overlay) {\n cm.removeOverlay(overlay);\n }\n overlay = searchOverlay(query);\n cm.addOverlay(overlay);\n if (cm.showMatchesOnScrollbar) {\n if (searchState.getScrollbarAnnotate()) {\n searchState.getScrollbarAnnotate().clear();\n }\n searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));\n }\n searchState.setOverlay(overlay);\n }\n }\n function findNext(cm, prev, query, repeat) {\n if (repeat === undefined) { repeat = 1; }\n return cm.operation(function() {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n for (var i = 0; i < repeat; i++) {\n var found = cursor.find(prev);\n if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); }\n if (!found) {\n // SearchCursor may have returned null because it hit EOF, wrap\n // around and try again.\n cursor = cm.getSearchCursor(query,\n (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return cursor.from();\n });\n }\n function clearSearchHighlight(cm) {\n var state = getSearchState(cm);\n cm.removeOverlay(getSearchState(cm).getOverlay());\n state.setOverlay(null);\n if (state.getScrollbarAnnotate()) {\n state.getScrollbarAnnotate().clear();\n state.setScrollbarAnnotate(null);\n }\n }\n /**\n * Check if pos is in the specified range, INCLUSIVE.\n * Range can be specified with 1 or 2 arguments.\n * If the first range argument is an array, treat it as an array of line\n * numbers. Match pos against any of the lines.\n * If the first range argument is a number,\n * if there is only 1 range argument, check if pos has the same line\n * number\n * if there are 2 range arguments, then check if pos is in between the two\n * range arguments.\n */\n function isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n // Assume it is a cursor position. Get the line number.\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n } else {\n if (end) {\n return (pos >= start && pos <= end);\n } else {\n return pos == start;\n }\n }\n }\n function getUserVisibleLines(cm) {\n var scrollInfo = cm.getScrollInfo();\n var occludeToleranceTop = 6;\n var occludeToleranceBottom = 10;\n var from = cm.coordsChar({left:0, top: occludeToleranceTop + scrollInfo.top}, 'local');\n var bottomY = scrollInfo.clientHeight - occludeToleranceBottom + scrollInfo.top;\n var to = cm.coordsChar({left:0, top: bottomY}, 'local');\n return {top: from.line, bottom: to.line};\n }\n\n var ExCommandDispatcher = function() {\n this.buildCommandMap_();\n };\n ExCommandDispatcher.prototype = {\n processCommand: function(cm, input, opt_params) {\n var that = this;\n cm.operation(function () {\n cm.curOp.isVimOp = true;\n that._processCommand(cm, input, opt_params);\n });\n },\n _processCommand: function(cm, input, opt_params) {\n var vim = cm.state.vim;\n var commandHistoryRegister = vimGlobalState.registerController.getRegister(':');\n var previousCommand = commandHistoryRegister.toString();\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n var inputStream = new CodeMirror.StringStream(input);\n // update \": with the latest command whether valid or invalid\n commandHistoryRegister.setText(input);\n var params = opt_params || {};\n params.input = input;\n try {\n this.parseInput_(cm, inputStream, params);\n } catch(e) {\n showConfirm(cm, e);\n throw e;\n }\n var command;\n var commandName;\n if (!params.commandName) {\n // If only a line range is defined, move to the line.\n if (params.line !== undefined) {\n commandName = 'move';\n }\n } else {\n command = this.matchCommand_(params.commandName);\n if (command) {\n commandName = command.name;\n if (command.excludeFromCommandHistory) {\n commandHistoryRegister.setText(previousCommand);\n }\n this.parseCommandArgs_(inputStream, params, command);\n if (command.type == 'exToKey') {\n // Handle Ex to Key mapping.\n for (var i = 0; i < command.toKeys.length; i++) {\n CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping');\n }\n return;\n } else if (command.type == 'exToEx') {\n // Handle Ex to Ex mapping.\n this.processCommand(cm, command.toInput);\n return;\n }\n }\n }\n if (!commandName) {\n showConfirm(cm, 'Not an editor command \":' + input + '\"');\n return;\n }\n try {\n exCommands[commandName](cm, params);\n // Possibly asynchronous commands (e.g. substitute, which might have a\n // user confirmation), are responsible for calling the callback when\n // done. All others have it taken care of for them here.\n if ((!command || !command.possiblyAsync) && params.callback) {\n params.callback();\n }\n } catch(e) {\n showConfirm(cm, e);\n throw e;\n }\n },\n parseInput_: function(cm, inputStream, result) {\n inputStream.eatWhile(':');\n // Parse range.\n if (inputStream.eat('%')) {\n result.line = cm.firstLine();\n result.lineEnd = cm.lastLine();\n } else {\n result.line = this.parseLineSpec_(cm, inputStream);\n if (result.line !== undefined && inputStream.eat(',')) {\n result.lineEnd = this.parseLineSpec_(cm, inputStream);\n }\n }\n\n // Parse command name.\n var commandMatch = inputStream.match(/^(\\w+)/);\n if (commandMatch) {\n result.commandName = commandMatch[1];\n } else {\n result.commandName = inputStream.match(/.*/)[0];\n }\n\n return result;\n },\n parseLineSpec_: function(cm, inputStream) {\n var numberMatch = inputStream.match(/^(\\d+)/);\n if (numberMatch) {\n return parseInt(numberMatch[1], 10) - 1;\n }\n switch (inputStream.next()) {\n case '.':\n return cm.getCursor().line;\n case '$':\n return cm.lastLine();\n case '\\'':\n var mark = cm.state.vim.marks[inputStream.next()];\n if (mark && mark.find()) {\n return mark.find().line;\n }\n throw new Error('Mark not set');\n default:\n inputStream.backUp(1);\n return undefined;\n }\n },\n parseCommandArgs_: function(inputStream, params, command) {\n if (inputStream.eol()) {\n return;\n }\n params.argString = inputStream.match(/.*/)[0];\n // Parse command-line arguments\n var delim = command.argDelimiter || /\\s+/;\n var args = trim(params.argString).split(delim);\n if (args.length && args[0]) {\n params.args = args;\n }\n },\n matchCommand_: function(commandName) {\n // Return the command in the command map that matches the shortest\n // prefix of the passed in command name. The match is guaranteed to be\n // unambiguous if the defaultExCommandMap's shortNames are set up\n // correctly. (see @code{defaultExCommandMap}).\n for (var i = commandName.length; i > 0; i--) {\n var prefix = commandName.substring(0, i);\n if (this.commandMap_[prefix]) {\n var command = this.commandMap_[prefix];\n if (command.name.indexOf(commandName) === 0) {\n return command;\n }\n }\n }\n return null;\n },\n buildCommandMap_: function() {\n this.commandMap_ = {};\n for (var i = 0; i < defaultExCommandMap.length; i++) {\n var command = defaultExCommandMap[i];\n var key = command.shortName || command.name;\n this.commandMap_[key] = command;\n }\n },\n map: function(lhs, rhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) { throw Error('Mode not supported for ex mappings'); }\n var commandName = lhs.substring(1);\n if (rhs != ':' && rhs.charAt(0) == ':') {\n // Ex to Ex mapping\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToEx',\n toInput: rhs.substring(1),\n user: true\n };\n } else {\n // Ex to key mapping\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToKey',\n toKeys: rhs,\n user: true\n };\n }\n } else {\n if (rhs != ':' && rhs.charAt(0) == ':') {\n // Key to Ex mapping.\n var mapping = {\n keys: lhs,\n type: 'keyToEx',\n exArgs: { input: rhs.substring(1) },\n user: true};\n if (ctx) { mapping.context = ctx; }\n defaultKeymap.unshift(mapping);\n } else {\n // Key to key mapping\n var mapping = {\n keys: lhs,\n type: 'keyToKey',\n toKeys: rhs,\n user: true\n };\n if (ctx) { mapping.context = ctx; }\n defaultKeymap.unshift(mapping);\n }\n }\n },\n unmap: function(lhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n // Ex to Ex or Ex to key mapping\n if (ctx) { throw Error('Mode not supported for ex mappings'); }\n var commandName = lhs.substring(1);\n if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {\n delete this.commandMap_[commandName];\n return;\n }\n } else {\n // Key to Ex or key to key mapping\n var keys = lhs;\n for (var i = 0; i < defaultKeymap.length; i++) {\n if (keys == defaultKeymap[i].keys\n && defaultKeymap[i].context === ctx\n && defaultKeymap[i].user) {\n defaultKeymap.splice(i, 1);\n return;\n }\n }\n }\n throw Error('No such mapping.');\n }\n };\n\n var exCommands = {\n colorscheme: function(cm, params) {\n if (!params.args || params.args.length < 1) {\n showConfirm(cm, cm.getOption('theme'));\n return;\n }\n cm.setOption('theme', params.args[0]);\n },\n map: function(cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 2) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx);\n },\n imap: function(cm, params) { this.map(cm, params, 'insert'); },\n nmap: function(cm, params) { this.map(cm, params, 'normal'); },\n vmap: function(cm, params) { this.map(cm, params, 'visual'); },\n unmap: function(cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'No such mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.unmap(mapArgs[0], ctx);\n },\n move: function(cm, params) {\n commandDispatcher.processCommand(cm, cm.state.vim, {\n type: 'motion',\n motion: 'moveToLineOrEdgeOfDocument',\n motionArgs: { forward: false, explicitRepeat: true,\n linewise: true },\n repeatOverride: params.line+1});\n },\n set: function(cm, params) {\n var setArgs = params.args;\n // Options passed through to the setOption/getOption calls. May be passed in by the\n // local/global versions of the set command\n var setCfg = params.setCfg || {};\n if (!setArgs || setArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n var expr = setArgs[0].split('=');\n var optionName = expr[0];\n var value = expr[1];\n var forceGet = false;\n\n if (optionName.charAt(optionName.length - 1) == '?') {\n // If post-fixed with ?, then the set is actually a get.\n if (value) { throw Error('Trailing characters: ' + params.argString); }\n optionName = optionName.substring(0, optionName.length - 1);\n forceGet = true;\n }\n if (value === undefined && optionName.substring(0, 2) == 'no') {\n // To set boolean options to false, the option name is prefixed with\n // 'no'.\n optionName = optionName.substring(2);\n value = false;\n }\n\n var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean';\n if (optionIsBoolean && value == undefined) {\n // Calling set with a boolean option sets it to true.\n value = true;\n }\n // If no value is provided, then we assume this is a get.\n if (!optionIsBoolean && value === undefined || forceGet) {\n var oldValue = getOption(optionName, cm, setCfg);\n if (oldValue === true || oldValue === false) {\n showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);\n } else {\n showConfirm(cm, ' ' + optionName + '=' + oldValue);\n }\n } else {\n setOption(optionName, value, cm, setCfg);\n }\n },\n setlocal: function (cm, params) {\n // setCfg is passed through to setOption\n params.setCfg = {scope: 'local'};\n this.set(cm, params);\n },\n setglobal: function (cm, params) {\n // setCfg is passed through to setOption\n params.setCfg = {scope: 'global'};\n this.set(cm, params);\n },\n registers: function(cm, params) {\n var regArgs = params.args;\n var registers = vimGlobalState.registerController.registers;\n var regInfo = '----------Registers----------<br><br>';\n if (!regArgs) {\n for (var registerName in registers) {\n var text = registers[registerName].toString();\n if (text.length) {\n regInfo += '\"' + registerName + ' ' + text + '<br>';\n }\n }\n } else {\n var registerName;\n regArgs = regArgs.join('');\n for (var i = 0; i < regArgs.length; i++) {\n registerName = regArgs.charAt(i);\n if (!vimGlobalState.registerController.isValidRegister(registerName)) {\n continue;\n }\n var register = registers[registerName] || new Register();\n regInfo += '\"' + registerName + ' ' + register.toString() + '<br>';\n }\n }\n showConfirm(cm, regInfo);\n },\n sort: function(cm, params) {\n var reverse, ignoreCase, unique, number;\n function parseArgs() {\n if (params.argString) {\n var args = new CodeMirror.StringStream(params.argString);\n if (args.eat('!')) { reverse = true; }\n if (args.eol()) { return; }\n if (!args.eatSpace()) { return 'Invalid arguments'; }\n var opts = args.match(/[a-z]+/);\n if (opts) {\n opts = opts[0];\n ignoreCase = opts.indexOf('i') != -1;\n unique = opts.indexOf('u') != -1;\n var decimal = opts.indexOf('d') != -1 && 1;\n var hex = opts.indexOf('x') != -1 && 1;\n var octal = opts.indexOf('o') != -1 && 1;\n if (decimal + hex + octal > 1) { return 'Invalid arguments'; }\n number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';\n }\n if (args.match(/\\/.*\\//)) { return 'patterns not supported'; }\n }\n }\n var err = parseArgs();\n if (err) {\n showConfirm(cm, err + ': ' + params.argString);\n return;\n }\n var lineStart = params.line || cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n if (lineStart == lineEnd) { return; }\n var curStart = Pos(lineStart, 0);\n var curEnd = Pos(lineEnd, lineLength(cm, lineEnd));\n var text = cm.getRange(curStart, curEnd).split('\\n');\n var numberRegex = (number == 'decimal') ? /(-?)([\\d]+)/ :\n (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :\n (number == 'octal') ? /([0-7]+)/ : null;\n var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;\n var numPart = [], textPart = [];\n if (number) {\n for (var i = 0; i < text.length; i++) {\n if (numberRegex.exec(text[i])) {\n numPart.push(text[i]);\n } else {\n textPart.push(text[i]);\n }\n }\n } else {\n textPart = text;\n }\n function compareFn(a, b) {\n if (reverse) { var tmp; tmp = a; a = b; b = tmp; }\n if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); }\n var anum = number && numberRegex.exec(a);\n var bnum = number && numberRegex.exec(b);\n if (!anum) { return a < b ? -1 : 1; }\n anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);\n bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);\n return anum - bnum;\n }\n numPart.sort(compareFn);\n textPart.sort(compareFn);\n text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);\n if (unique) { // Remove duplicate lines\n var textOld = text;\n var lastLine;\n text = [];\n for (var i = 0; i < textOld.length; i++) {\n if (textOld[i] != lastLine) {\n text.push(textOld[i]);\n }\n lastLine = textOld[i];\n }\n }\n cm.replaceRange(text.join('\\n'), curStart, curEnd);\n },\n global: function(cm, params) {\n // a global command is of the form\n // :[range]g/pattern/[cmd]\n // argString holds the string /pattern/[cmd]\n var argString = params.argString;\n if (!argString) {\n showConfirm(cm, 'Regular Expression missing from global');\n return;\n }\n // range is specified here\n var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n // get the tokens from argString\n var tokens = splitBySlash(argString);\n var regexPart = argString, cmd;\n if (tokens.length) {\n regexPart = tokens[0];\n cmd = tokens.slice(1, tokens.length).join('/');\n }\n if (regexPart) {\n // If regex part is empty, then use the previous query. Otherwise\n // use the regex part as the new query.\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */,\n true /** smartCase */);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n // now that we have the regexPart, search for regex matches in the\n // specified range of lines\n var query = getSearchState(cm).getQuery();\n var matchedLines = [], content = '';\n for (var i = lineStart; i <= lineEnd; i++) {\n var matched = query.test(cm.getLine(i));\n if (matched) {\n matchedLines.push(i+1);\n content+= cm.getLine(i) + '<br>';\n }\n }\n // if there is no [cmd], just display the list of matched lines\n if (!cmd) {\n showConfirm(cm, content);\n return;\n }\n var index = 0;\n var nextCommand = function() {\n if (index < matchedLines.length) {\n var command = matchedLines[index] + cmd;\n exCommandDispatcher.processCommand(cm, command, {\n callback: nextCommand\n });\n }\n index++;\n };\n nextCommand();\n },\n substitute: function(cm, params) {\n if (!cm.getSearchCursor) {\n throw new Error('Search feature not available. Requires searchcursor.js or ' +\n 'any other getSearchCursor implementation.');\n }\n var argString = params.argString;\n var tokens = argString ? splitBySlash(argString) : [];\n var regexPart, replacePart = '', trailing, flagsPart, count;\n var confirm = false; // Whether to confirm each replace.\n var global = false; // True to replace all instances on a line, false to replace only 1.\n if (tokens.length) {\n regexPart = tokens[0];\n replacePart = tokens[1];\n if (replacePart !== undefined) {\n if (getOption('pcre')) {\n replacePart = unescapeRegexReplace(replacePart);\n } else {\n replacePart = translateRegexReplace(replacePart);\n }\n vimGlobalState.lastSubstituteReplacePart = replacePart;\n }\n trailing = tokens[2] ? tokens[2].split(' ') : [];\n } else {\n // either the argString is empty or its of the form ' hello/world'\n // actually splitBySlash returns a list of tokens\n // only if the string starts with a '/'\n if (argString && argString.length) {\n showConfirm(cm, 'Substitutions should be of the form ' +\n ':s/pattern/replace/');\n return;\n }\n }\n // After the 3rd slash, we can have flags followed by a space followed\n // by count.\n if (trailing) {\n flagsPart = trailing[0];\n count = parseInt(trailing[1]);\n if (flagsPart) {\n if (flagsPart.indexOf('c') != -1) {\n confirm = true;\n flagsPart.replace('c', '');\n }\n if (flagsPart.indexOf('g') != -1) {\n global = true;\n flagsPart.replace('g', '');\n }\n regexPart = regexPart + '/' + flagsPart;\n }\n }\n if (regexPart) {\n // If regex part is empty, then use the previous query. Otherwise use\n // the regex part as the new query.\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */,\n true /** smartCase */);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;\n if (replacePart === undefined) {\n showConfirm(cm, 'No previous substitute regular expression');\n return;\n }\n var state = getSearchState(cm);\n var query = state.getQuery();\n var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;\n var lineEnd = params.lineEnd || lineStart;\n if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {\n lineEnd = Infinity;\n }\n if (count) {\n lineStart = lineEnd;\n lineEnd = lineStart + count - 1;\n }\n var startPos = clipCursorToContent(cm, Pos(lineStart, 0));\n var cursor = cm.getSearchCursor(query, startPos);\n doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);\n },\n redo: CodeMirror.commands.redo,\n undo: CodeMirror.commands.undo,\n write: function(cm) {\n if (CodeMirror.commands.save) {\n // If a save command is defined, call it.\n CodeMirror.commands.save(cm);\n } else {\n // Saves to text area if no save command is defined.\n cm.save();\n }\n },\n nohlsearch: function(cm) {\n clearSearchHighlight(cm);\n },\n delmarks: function(cm, params) {\n if (!params.argString || !trim(params.argString)) {\n showConfirm(cm, 'Argument required');\n return;\n }\n\n var state = cm.state.vim;\n var stream = new CodeMirror.StringStream(trim(params.argString));\n while (!stream.eol()) {\n stream.eatSpace();\n\n // Record the streams position at the beginning of the loop for use\n // in error messages.\n var count = stream.pos;\n\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n\n var sym = stream.next();\n // Check if this symbol is part of a range\n if (stream.match('-', true)) {\n // This symbol is part of a range.\n\n // The range must terminate at an alphabetic character.\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n\n var startMark = sym;\n var finishMark = stream.next();\n // The range must terminate at an alphabetic character which\n // shares the same case as the start of the range.\n if (isLowerCase(startMark) && isLowerCase(finishMark) ||\n isUpperCase(startMark) && isUpperCase(finishMark)) {\n var start = startMark.charCodeAt(0);\n var finish = finishMark.charCodeAt(0);\n if (start >= finish) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n\n // Because marks are always ASCII values, and we have\n // determined that they are the same case, we can use\n // their char codes to iterate through the defined range.\n for (var j = 0; j <= finish - start; j++) {\n var mark = String.fromCharCode(start + j);\n delete state.marks[mark];\n }\n } else {\n showConfirm(cm, 'Invalid argument: ' + startMark + '-');\n return;\n }\n } else {\n // This symbol is a valid mark, and is not part of a range.\n delete state.marks[sym];\n }\n }\n }\n };\n\n var exCommandDispatcher = new ExCommandDispatcher();\n\n /**\n * @param {CodeMirror} cm CodeMirror instance we are in.\n * @param {boolean} confirm Whether to confirm each replace.\n * @param {Cursor} lineStart Line to start replacing from.\n * @param {Cursor} lineEnd Line to stop replacing at.\n * @param {RegExp} query Query for performing matches with.\n * @param {string} replaceWith Text to replace matches with. May contain $1,\n * $2, etc for replacing captured groups using Javascript replace.\n * @param {function()} callback A callback for when the replace is done.\n */\n function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query,\n replaceWith, callback) {\n // Set up all the functions.\n cm.state.vim.exMode = true;\n var done = false;\n var lastPos = searchCursor.from();\n function replaceAll() {\n cm.operation(function() {\n while (!done) {\n replace();\n next();\n }\n stop();\n });\n }\n function replace() {\n var text = cm.getRange(searchCursor.from(), searchCursor.to());\n var newText = text.replace(query, replaceWith);\n searchCursor.replace(newText);\n }\n function next() {\n // The below only loops to skip over multiple occurrences on the same\n // line when 'global' is not true.\n while(searchCursor.findNext() &&\n isInRange(searchCursor.from(), lineStart, lineEnd)) {\n if (!global && lastPos && searchCursor.from().line == lastPos.line) {\n continue;\n }\n cm.scrollIntoView(searchCursor.from(), 30);\n cm.setSelection(searchCursor.from(), searchCursor.to());\n lastPos = searchCursor.from();\n done = false;\n return;\n }\n done = true;\n }\n function stop(close) {\n if (close) { close(); }\n cm.focus();\n if (lastPos) {\n cm.setCursor(lastPos);\n var vim = cm.state.vim;\n vim.exMode = false;\n vim.lastHPos = vim.lastHSPos = lastPos.ch;\n }\n if (callback) { callback(); }\n }\n function onPromptKeyDown(e, _value, close) {\n // Swallow all keys.\n CodeMirror.e_stop(e);\n var keyName = CodeMirror.keyName(e);\n switch (keyName) {\n case 'Y':\n replace(); next(); break;\n case 'N':\n next(); break;\n case 'A':\n // replaceAll contains a call to close of its own. We don't want it\n // to fire too early or multiple times.\n var savedCallback = callback;\n callback = undefined;\n cm.operation(replaceAll);\n callback = savedCallback;\n break;\n case 'L':\n replace();\n // fall through and exit.\n case 'Q':\n case 'Esc':\n case 'Ctrl-C':\n case 'Ctrl-[':\n stop(close);\n break;\n }\n if (done) { stop(close); }\n return true;\n }\n\n // Actually do replace.\n next();\n if (done) {\n showConfirm(cm, 'No matches for ' + query.source);\n return;\n }\n if (!confirm) {\n replaceAll();\n if (callback) { callback(); };\n return;\n }\n showPrompt(cm, {\n prefix: 'replace with <strong>' + replaceWith + '</strong> (y/n/a/q/l)',\n onKeyDown: onPromptKeyDown\n });\n }\n\n CodeMirror.keyMap.vim = {\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n function exitInsertMode(cm) {\n var vim = cm.state.vim;\n var macroModeState = vimGlobalState.macroModeState;\n var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');\n var isPlaying = macroModeState.isPlaying;\n var lastChange = macroModeState.lastInsertModeChanges;\n // In case of visual block, the insertModeChanges are not saved as a\n // single word, so we convert them to a single word\n // so as to update the \". register as expected in real vim.\n var text = [];\n if (!isPlaying) {\n var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1;\n var changes = lastChange.changes;\n var text = [];\n var i = 0;\n // In case of multiple selections in blockwise visual,\n // the inserted text, for example: 'f<Backspace>oo', is stored as\n // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines).\n // We push the contents of the changes array as per the following:\n // 1. In case of InsertModeKey, just increment by 1.\n // 2. In case of a character, jump by selLength (2 in the example).\n while (i < changes.length) {\n // This loop will convert 'ff<bs>oooo' to 'f<bs>oo'.\n text.push(changes[i]);\n if (changes[i] instanceof InsertModeKey) {\n i++;\n } else {\n i+= selLength;\n }\n }\n lastChange.changes = text;\n cm.off('change', onChange);\n CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (!isPlaying && vim.insertModeRepeat > 1) {\n // Perform insert mode repeat for commands like 3,a and 3,o.\n repeatLastEdit(cm, vim, vim.insertModeRepeat - 1,\n true /** repeatForInsert */);\n vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;\n }\n delete vim.insertModeRepeat;\n vim.insertMode = false;\n cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1);\n cm.setOption('keyMap', 'vim');\n cm.setOption('disableInput', true);\n cm.toggleOverwrite(false); // exit replace mode if we were in it.\n // update the \". register before exiting insert mode\n insertModeChangeRegister.setText(lastChange.changes.join(''));\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n if (macroModeState.isRecording) {\n logInsertModeChange(macroModeState);\n }\n }\n\n function _mapCommand(command) {\n defaultKeymap.unshift(command);\n }\n\n function mapCommand(keys, type, name, args, extra) {\n var command = {keys: keys, type: type};\n command[type] = name;\n command[type + \"Args\"] = args;\n for (var key in extra)\n command[key] = extra[key];\n _mapCommand(command);\n }\n\n // The timeout in milliseconds for the two-character ESC keymap should be\n // adjusted according to your typing speed to prevent false positives.\n defineOption('insertModeEscKeysTimeout', 200, 'number');\n\n CodeMirror.keyMap['vim-insert'] = {\n // TODO: override navigation keys so that Esc will cancel automatic\n // indentation from o, O, i_<CR>\n 'Ctrl-N': 'autocomplete',\n 'Ctrl-P': 'autocomplete',\n 'Enter': function(cm) {\n var fn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n fn(cm);\n },\n fallthrough: ['default'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n CodeMirror.keyMap['vim-replace'] = {\n 'Backspace': 'goCharLeft',\n fallthrough: ['vim-insert'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n function executeMacroRegister(cm, vim, macroModeState, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (registerName == ':') {\n // Read-only register containing last Ex command.\n if (register.keyBuffer[0]) {\n exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);\n }\n macroModeState.isPlaying = false;\n return;\n }\n var keyBuffer = register.keyBuffer;\n var imc = 0;\n macroModeState.isPlaying = true;\n macroModeState.replaySearchQueries = register.searchQueries.slice(0);\n for (var i = 0; i < keyBuffer.length; i++) {\n var text = keyBuffer[i];\n var match, key;\n while (text) {\n // Pull off one command key, which is either a single character\n // or a special sequence wrapped in '<' and '>', e.g. '<Space>'.\n match = (/<\\w+-.+?>|<\\w+>|./).exec(text);\n key = match[0];\n text = text.substring(match.index + key.length);\n CodeMirror.Vim.handleKey(cm, key, 'macro');\n if (vim.insertMode) {\n var changes = register.insertModeChanges[imc++].changes;\n vimGlobalState.macroModeState.lastInsertModeChanges.changes =\n changes;\n repeatInsertModeChanges(cm, changes, 1);\n exitInsertMode(cm);\n }\n }\n };\n macroModeState.isPlaying = false;\n }\n\n function logKey(macroModeState, key) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.pushText(key);\n }\n }\n\n function logInsertModeChange(macroModeState) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushInsertModeChanges) {\n register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);\n }\n }\n\n function logSearchQuery(macroModeState, query) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushSearchQuery) {\n register.pushSearchQuery(query);\n }\n }\n\n /**\n * Listens for changes made in insert mode.\n * Should only be active in insert mode.\n */\n function onChange(_cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while(changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var text = changeObj.text.join('\\n');\n lastChange.changes.push(text);\n }\n // Change objects may be chained with next.\n changeObj = changeObj.next;\n }\n }\n }\n\n /**\n * Listens for any kind of cursor activity on CodeMirror.\n */\n function onCursorActivity(cm) {\n var vim = cm.state.vim;\n if (vim.insertMode) {\n // Tracking cursor activity in insert mode (for macro support).\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) { return; }\n var lastChange = macroModeState.lastInsertModeChanges;\n if (lastChange.expectCursorActivityForChange) {\n lastChange.expectCursorActivityForChange = false;\n } else {\n // Cursor moved outside the context of an edit. Reset the change.\n lastChange.changes = [];\n }\n } else if (!cm.curOp.isVimOp) {\n handleExternalSelection(cm, vim);\n }\n if (vim.visualMode) {\n updateFakeCursor(cm);\n }\n }\n function updateFakeCursor(cm) {\n var vim = cm.state.vim;\n var from = clipCursorToContent(cm, copyCursor(vim.sel.head));\n var to = offsetCursor(from, 0, 1);\n if (vim.fakeCursor) {\n vim.fakeCursor.clear();\n }\n vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'});\n }\n function handleExternalSelection(cm, vim) {\n var anchor = cm.getCursor('anchor');\n var head = cm.getCursor('head');\n // Enter or exit visual mode to match mouse selection.\n if (vim.visualMode && !cm.somethingSelected()) {\n exitVisualMode(cm, false);\n } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {\n vim.visualMode = true;\n vim.visualLine = false;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\"});\n }\n if (vim.visualMode) {\n // Bind CodeMirror selection model to vim selection model.\n // Mouse selections are considered visual characterwise.\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n updateMark(cm, vim, '<', cursorMin(head, anchor));\n updateMark(cm, vim, '>', cursorMax(head, anchor));\n } else if (!vim.insertMode) {\n // Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse.\n vim.lastHPos = cm.getCursor().ch;\n }\n }\n\n /** Wrapper for special keys pressed in insert mode */\n function InsertModeKey(keyName) {\n this.keyName = keyName;\n }\n\n /**\n * Handles raw key down events from the text area.\n * - Should only be active in insert mode.\n * - For recording deletes in insert mode.\n */\n function onKeyEventTargetKeyDown(e) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n var keyName = CodeMirror.keyName(e);\n if (!keyName) { return; }\n function onKeyFound() {\n lastChange.changes.push(new InsertModeKey(keyName));\n return true;\n }\n if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {\n CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);\n }\n }\n\n /**\n * Repeats the last edit, which includes exactly 1 command and at most 1\n * insert. Operator and motion commands are read from lastEditInputState,\n * while action commands are read from lastEditActionCommand.\n *\n * If repeatForInsert is true, then the function was called by\n * exitInsertMode to repeat the insert mode changes the user just made. The\n * corresponding enterInsertMode call was made with a count.\n */\n function repeatLastEdit(cm, vim, repeat, repeatForInsert) {\n var macroModeState = vimGlobalState.macroModeState;\n macroModeState.isPlaying = true;\n var isAction = !!vim.lastEditActionCommand;\n var cachedInputState = vim.inputState;\n function repeatCommand() {\n if (isAction) {\n commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);\n } else {\n commandDispatcher.evalInput(cm, vim);\n }\n }\n function repeatInsert(repeat) {\n if (macroModeState.lastInsertModeChanges.changes.length > 0) {\n // For some reason, repeat cw in desktop VIM does not repeat\n // insert mode changes. Will conform to that behavior.\n repeat = !vim.lastEditActionCommand ? 1 : repeat;\n var changeObject = macroModeState.lastInsertModeChanges;\n repeatInsertModeChanges(cm, changeObject.changes, repeat);\n }\n }\n vim.inputState = vim.lastEditInputState;\n if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {\n // o and O repeat have to be interlaced with insert repeats so that the\n // insertions appear on separate lines instead of the last line.\n for (var i = 0; i < repeat; i++) {\n repeatCommand();\n repeatInsert(1);\n }\n } else {\n if (!repeatForInsert) {\n // Hack to get the cursor to end up at the right place. If I is\n // repeated in insert mode repeat, cursor will be 1 insert\n // change set left of where it should be.\n repeatCommand();\n }\n repeatInsert(repeat);\n }\n vim.inputState = cachedInputState;\n if (vim.insertMode && !repeatForInsert) {\n // Don't exit insert mode twice. If repeatForInsert is set, then we\n // were called by an exitInsertMode call lower on the stack.\n exitInsertMode(cm);\n }\n macroModeState.isPlaying = false;\n };\n\n function repeatInsertModeChanges(cm, changes, repeat) {\n function keyHandler(binding) {\n if (typeof binding == 'string') {\n CodeMirror.commands[binding](cm);\n } else {\n binding(cm);\n }\n return true;\n }\n var head = cm.getCursor('head');\n var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;\n if (inVisualBlock) {\n // Set up block selection again for repeating the changes.\n var vim = cm.state.vim;\n var lastSel = vim.lastSelection;\n var offset = getOffset(lastSel.anchor, lastSel.head);\n selectForInsert(cm, head, offset.line + 1);\n repeat = cm.listSelections().length;\n cm.setCursor(head);\n }\n for (var i = 0; i < repeat; i++) {\n if (inVisualBlock) {\n cm.setCursor(offsetCursor(head, i, 0));\n }\n for (var j = 0; j < changes.length; j++) {\n var change = changes[j];\n if (change instanceof InsertModeKey) {\n CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);\n } else {\n var cur = cm.getCursor();\n cm.replaceRange(change, cur, cur);\n }\n }\n }\n if (inVisualBlock) {\n cm.setCursor(offsetCursor(head, 0, 1));\n }\n }\n\n resetVimGlobalState();\n return vimApi;\n };\n // Initialize Vim and make it available as an API.\n CodeMirror.Vim = Vim();\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/keymap/vim.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/keymap/sublime.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// A rough approximation of Sublime Text's keybindings\n// Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"), require(\"../addon/search/searchcursor\"), require(\"../addon/edit/matchbrackets\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\", \"../addon/search/searchcursor\", \"../addon/edit/matchbrackets\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var map = CodeMirror.keyMap.sublime = {fallthrough: \"default\"};\n var cmds = CodeMirror.commands;\n var Pos = CodeMirror.Pos;\n var mac = CodeMirror.keyMap[\"default\"] == CodeMirror.keyMap.macDefault;\n var ctrl = mac ? \"Cmd-\" : \"Ctrl-\";\n\n // This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.\n function findPosSubword(doc, start, dir) {\n if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));\n var line = doc.getLine(start.line);\n if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));\n var state = \"start\", type;\n for (var pos = start.ch, e = dir < 0 ? 0 : line.length, i = 0; pos != e; pos += dir, i++) {\n var next = line.charAt(dir < 0 ? pos - 1 : pos);\n var cat = next != \"_\" && CodeMirror.isWordChar(next) ? \"w\" : \"o\";\n if (cat == \"w\" && next.toUpperCase() == next) cat = \"W\";\n if (state == \"start\") {\n if (cat != \"o\") { state = \"in\"; type = cat; }\n } else if (state == \"in\") {\n if (type != cat) {\n if (type == \"w\" && cat == \"W\" && dir < 0) pos--;\n if (type == \"W\" && cat == \"w\" && dir > 0) { type = \"w\"; continue; }\n break;\n }\n }\n }\n return Pos(start.line, pos);\n }\n\n function moveSubword(cm, dir) {\n cm.extendSelectionsBy(function(range) {\n if (cm.display.shift || cm.doc.extend || range.empty())\n return findPosSubword(cm.doc, range.head, dir);\n else\n return dir < 0 ? range.from() : range.to();\n });\n }\n\n cmds[map[\"Alt-Left\"] = \"goSubwordLeft\"] = function(cm) { moveSubword(cm, -1); };\n cmds[map[\"Alt-Right\"] = \"goSubwordRight\"] = function(cm) { moveSubword(cm, 1); };\n\n var scrollLineCombo = mac ? \"Ctrl-Alt-\" : \"Ctrl-\";\n\n cmds[map[scrollLineCombo + \"Up\"] = \"scrollLineUp\"] = function(cm) {\n var info = cm.getScrollInfo();\n if (!cm.somethingSelected()) {\n var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, \"local\");\n if (cm.getCursor().line >= visibleBottomLine)\n cm.execCommand(\"goLineUp\");\n }\n cm.scrollTo(null, info.top - cm.defaultTextHeight());\n };\n cmds[map[scrollLineCombo + \"Down\"] = \"scrollLineDown\"] = function(cm) {\n var info = cm.getScrollInfo();\n if (!cm.somethingSelected()) {\n var visibleTopLine = cm.lineAtHeight(info.top, \"local\")+1;\n if (cm.getCursor().line <= visibleTopLine)\n cm.execCommand(\"goLineDown\");\n }\n cm.scrollTo(null, info.top + cm.defaultTextHeight());\n };\n\n cmds[map[\"Shift-\" + ctrl + \"L\"] = \"splitSelectionByLine\"] = function(cm) {\n var ranges = cm.listSelections(), lineRanges = [];\n for (var i = 0; i < ranges.length; i++) {\n var from = ranges[i].from(), to = ranges[i].to();\n for (var line = from.line; line <= to.line; ++line)\n if (!(to.line > from.line && line == to.line && to.ch == 0))\n lineRanges.push({anchor: line == from.line ? from : Pos(line, 0),\n head: line == to.line ? to : Pos(line)});\n }\n cm.setSelections(lineRanges, 0);\n };\n\n map[\"Shift-Tab\"] = \"indentLess\";\n\n cmds[map[\"Esc\"] = \"singleSelectionTop\"] = function(cm) {\n var range = cm.listSelections()[0];\n cm.setSelection(range.anchor, range.head, {scroll: false});\n };\n\n cmds[map[ctrl + \"L\"] = \"selectLine\"] = function(cm) {\n var ranges = cm.listSelections(), extended = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n extended.push({anchor: Pos(range.from().line, 0),\n head: Pos(range.to().line + 1, 0)});\n }\n cm.setSelections(extended);\n };\n\n map[\"Shift-Ctrl-K\"] = \"deleteLine\";\n\n function insertLine(cm, above) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n cm.operation(function() {\n var len = cm.listSelections().length, newSelection = [], last = -1;\n for (var i = 0; i < len; i++) {\n var head = cm.listSelections()[i].head;\n if (head.line <= last) continue;\n var at = Pos(head.line + (above ? 0 : 1), 0);\n cm.replaceRange(\"\\n\", at, null, \"+insertLine\");\n cm.indentLine(at.line, null, true);\n newSelection.push({head: at, anchor: at});\n last = head.line + 1;\n }\n cm.setSelections(newSelection);\n });\n }\n\n cmds[map[ctrl + \"Enter\"] = \"insertLineAfter\"] = function(cm) { return insertLine(cm, false); };\n\n cmds[map[\"Shift-\" + ctrl + \"Enter\"] = \"insertLineBefore\"] = function(cm) { return insertLine(cm, true); };\n\n function wordAt(cm, pos) {\n var start = pos.ch, end = start, line = cm.getLine(pos.line);\n while (start && CodeMirror.isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && CodeMirror.isWordChar(line.charAt(end))) ++end;\n return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};\n }\n\n cmds[map[ctrl + \"D\"] = \"selectNextOccurrence\"] = function(cm) {\n var from = cm.getCursor(\"from\"), to = cm.getCursor(\"to\");\n var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;\n if (CodeMirror.cmpPos(from, to) == 0) {\n var word = wordAt(cm, from);\n if (!word.word) return;\n cm.setSelection(word.from, word.to);\n fullWord = true;\n } else {\n var text = cm.getRange(from, to);\n var query = fullWord ? new RegExp(\"\\\\b\" + text + \"\\\\b\") : text;\n var cur = cm.getSearchCursor(query, to);\n if (cur.findNext()) {\n cm.addSelection(cur.from(), cur.to());\n } else {\n cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));\n if (cur.findNext())\n cm.addSelection(cur.from(), cur.to());\n }\n }\n if (fullWord)\n cm.state.sublimeFindFullWord = cm.doc.sel;\n };\n\n var mirror = \"(){}[]\";\n function selectBetweenBrackets(cm) {\n var pos = cm.getCursor(), opening = cm.scanForBracket(pos, -1);\n if (!opening) return;\n for (;;) {\n var closing = cm.scanForBracket(pos, 1);\n if (!closing) return;\n if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {\n cm.setSelection(Pos(opening.pos.line, opening.pos.ch + 1), closing.pos, false);\n return true;\n }\n pos = Pos(closing.pos.line, closing.pos.ch + 1);\n }\n }\n\n cmds[map[\"Shift-\" + ctrl + \"Space\"] = \"selectScope\"] = function(cm) {\n selectBetweenBrackets(cm) || cm.execCommand(\"selectAll\");\n };\n cmds[map[\"Shift-\" + ctrl + \"M\"] = \"selectBetweenBrackets\"] = function(cm) {\n if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;\n };\n\n cmds[map[ctrl + \"M\"] = \"goToBracket\"] = function(cm) {\n cm.extendSelectionsBy(function(range) {\n var next = cm.scanForBracket(range.head, 1);\n if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;\n var prev = cm.scanForBracket(range.head, -1);\n return prev && Pos(prev.pos.line, prev.pos.ch + 1) || range.head;\n });\n };\n\n var swapLineCombo = mac ? \"Cmd-Ctrl-\" : \"Shift-Ctrl-\";\n\n cmds[map[swapLineCombo + \"Up\"] = \"swapLineUp\"] = function(cm) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i], from = range.from().line - 1, to = range.to().line;\n newSels.push({anchor: Pos(range.anchor.line - 1, range.anchor.ch),\n head: Pos(range.head.line - 1, range.head.ch)});\n if (range.to().ch == 0 && !range.empty()) --to;\n if (from > at) linesToMove.push(from, to);\n else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;\n at = to;\n }\n cm.operation(function() {\n for (var i = 0; i < linesToMove.length; i += 2) {\n var from = linesToMove[i], to = linesToMove[i + 1];\n var line = cm.getLine(from);\n cm.replaceRange(\"\", Pos(from, 0), Pos(from + 1, 0), \"+swapLine\");\n if (to > cm.lastLine())\n cm.replaceRange(\"\\n\" + line, Pos(cm.lastLine()), null, \"+swapLine\");\n else\n cm.replaceRange(line + \"\\n\", Pos(to, 0), null, \"+swapLine\");\n }\n cm.setSelections(newSels);\n cm.scrollIntoView();\n });\n };\n\n cmds[map[swapLineCombo + \"Down\"] = \"swapLineDown\"] = function(cm) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;\n for (var i = ranges.length - 1; i >= 0; i--) {\n var range = ranges[i], from = range.to().line + 1, to = range.from().line;\n if (range.to().ch == 0 && !range.empty()) from--;\n if (from < at) linesToMove.push(from, to);\n else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;\n at = to;\n }\n cm.operation(function() {\n for (var i = linesToMove.length - 2; i >= 0; i -= 2) {\n var from = linesToMove[i], to = linesToMove[i + 1];\n var line = cm.getLine(from);\n if (from == cm.lastLine())\n cm.replaceRange(\"\", Pos(from - 1), Pos(from), \"+swapLine\");\n else\n cm.replaceRange(\"\", Pos(from, 0), Pos(from + 1, 0), \"+swapLine\");\n cm.replaceRange(line + \"\\n\", Pos(to, 0), null, \"+swapLine\");\n }\n cm.scrollIntoView();\n });\n };\n\n cmds[map[ctrl + \"/\"] = \"toggleCommentIndented\"] = function(cm) {\n cm.toggleComment({ indent: true });\n }\n\n cmds[map[ctrl + \"J\"] = \"joinLines\"] = function(cm) {\n var ranges = cm.listSelections(), joined = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i], from = range.from();\n var start = from.line, end = range.to().line;\n while (i < ranges.length - 1 && ranges[i + 1].from().line == end)\n end = ranges[++i].to().line;\n joined.push({start: start, end: end, anchor: !range.empty() && from});\n }\n cm.operation(function() {\n var offset = 0, ranges = [];\n for (var i = 0; i < joined.length; i++) {\n var obj = joined[i];\n var anchor = obj.anchor && Pos(obj.anchor.line - offset, obj.anchor.ch), head;\n for (var line = obj.start; line <= obj.end; line++) {\n var actual = line - offset;\n if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1);\n if (actual < cm.lastLine()) {\n cm.replaceRange(\" \", Pos(actual), Pos(actual + 1, /^\\s*/.exec(cm.getLine(actual + 1))[0].length));\n ++offset;\n }\n }\n ranges.push({anchor: anchor || head, head: head});\n }\n cm.setSelections(ranges, 0);\n });\n };\n\n cmds[map[\"Shift-\" + ctrl + \"D\"] = \"duplicateLine\"] = function(cm) {\n cm.operation(function() {\n var rangeCount = cm.listSelections().length;\n for (var i = 0; i < rangeCount; i++) {\n var range = cm.listSelections()[i];\n if (range.empty())\n cm.replaceRange(cm.getLine(range.head.line) + \"\\n\", Pos(range.head.line, 0));\n else\n cm.replaceRange(cm.getRange(range.from(), range.to()), range.from());\n }\n cm.scrollIntoView();\n });\n };\n\n map[ctrl + \"T\"] = \"transposeChars\";\n\n function sortLines(cm, caseSensitive) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), toSort = [], selected;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.empty()) continue;\n var from = range.from().line, to = range.to().line;\n while (i < ranges.length - 1 && ranges[i + 1].from().line == to)\n to = range[++i].to().line;\n toSort.push(from, to);\n }\n if (toSort.length) selected = true;\n else toSort.push(cm.firstLine(), cm.lastLine());\n\n cm.operation(function() {\n var ranges = [];\n for (var i = 0; i < toSort.length; i += 2) {\n var from = toSort[i], to = toSort[i + 1];\n var start = Pos(from, 0), end = Pos(to);\n var lines = cm.getRange(start, end, false);\n if (caseSensitive)\n lines.sort();\n else\n lines.sort(function(a, b) {\n var au = a.toUpperCase(), bu = b.toUpperCase();\n if (au != bu) { a = au; b = bu; }\n return a < b ? -1 : a == b ? 0 : 1;\n });\n cm.replaceRange(lines, start, end);\n if (selected) ranges.push({anchor: start, head: end});\n }\n if (selected) cm.setSelections(ranges, 0);\n });\n }\n\n cmds[map[\"F9\"] = \"sortLines\"] = function(cm) { sortLines(cm, true); };\n cmds[map[ctrl + \"F9\"] = \"sortLinesInsensitive\"] = function(cm) { sortLines(cm, false); };\n\n cmds[map[\"F2\"] = \"nextBookmark\"] = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) while (marks.length) {\n var current = marks.shift();\n var found = current.find();\n if (found) {\n marks.push(current);\n return cm.setSelection(found.from, found.to);\n }\n }\n };\n\n cmds[map[\"Shift-F2\"] = \"prevBookmark\"] = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) while (marks.length) {\n marks.unshift(marks.pop());\n var found = marks[marks.length - 1].find();\n if (!found)\n marks.pop();\n else\n return cm.setSelection(found.from, found.to);\n }\n };\n\n cmds[map[ctrl + \"F2\"] = \"toggleBookmark\"] = function(cm) {\n var ranges = cm.listSelections();\n var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);\n for (var i = 0; i < ranges.length; i++) {\n var from = ranges[i].from(), to = ranges[i].to();\n var found = cm.findMarks(from, to);\n for (var j = 0; j < found.length; j++) {\n if (found[j].sublimeBookmark) {\n found[j].clear();\n for (var k = 0; k < marks.length; k++)\n if (marks[k] == found[j])\n marks.splice(k--, 1);\n break;\n }\n }\n if (j == found.length)\n marks.push(cm.markText(from, to, {sublimeBookmark: true, clearWhenEmpty: false}));\n }\n };\n\n cmds[map[\"Shift-\" + ctrl + \"F2\"] = \"clearBookmarks\"] = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();\n marks.length = 0;\n };\n\n cmds[map[\"Alt-F2\"] = \"selectBookmarks\"] = function(cm) {\n var marks = cm.state.sublimeBookmarks, ranges = [];\n if (marks) for (var i = 0; i < marks.length; i++) {\n var found = marks[i].find();\n if (!found)\n marks.splice(i--, 0);\n else\n ranges.push({anchor: found.from, head: found.to});\n }\n if (ranges.length)\n cm.setSelections(ranges, 0);\n };\n\n map[\"Alt-Q\"] = \"wrapLines\";\n\n var cK = ctrl + \"K \";\n\n function modifyWordOrSelection(cm, mod) {\n cm.operation(function() {\n var ranges = cm.listSelections(), indices = [], replacements = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.empty()) { indices.push(i); replacements.push(\"\"); }\n else replacements.push(mod(cm.getRange(range.from(), range.to())));\n }\n cm.replaceSelections(replacements, \"around\", \"case\");\n for (var i = indices.length - 1, at; i >= 0; i--) {\n var range = ranges[indices[i]];\n if (at && CodeMirror.cmpPos(range.head, at) > 0) continue;\n var word = wordAt(cm, range.head);\n at = word.from;\n cm.replaceRange(mod(word.word), word.from, word.to);\n }\n });\n }\n\n map[cK + ctrl + \"Backspace\"] = \"delLineLeft\";\n\n cmds[map[\"Backspace\"] = \"smartBackspace\"] = function(cm) {\n if (cm.somethingSelected()) return CodeMirror.Pass;\n\n var cursor = cm.getCursor();\n var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);\n var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption(\"tabSize\"));\n var indentUnit = cm.getOption(\"indentUnit\");\n\n if (toStartOfLine && !/\\S/.test(toStartOfLine) && column % indentUnit == 0) {\n var prevIndent = new Pos(cursor.line,\n CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit));\n\n // If no smart delete is happening (due to tab sizing) just do a regular delete\n if (prevIndent.ch == cursor.ch) return CodeMirror.Pass;\n\n return cm.replaceRange(\"\", prevIndent, cursor, \"+delete\");\n } else {\n return CodeMirror.Pass;\n }\n };\n\n cmds[map[cK + ctrl + \"K\"] = \"delLineRight\"] = function(cm) {\n cm.operation(function() {\n var ranges = cm.listSelections();\n for (var i = ranges.length - 1; i >= 0; i--)\n cm.replaceRange(\"\", ranges[i].anchor, Pos(ranges[i].to().line), \"+delete\");\n cm.scrollIntoView();\n });\n };\n\n cmds[map[cK + ctrl + \"U\"] = \"upcaseAtCursor\"] = function(cm) {\n modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });\n };\n cmds[map[cK + ctrl + \"L\"] = \"downcaseAtCursor\"] = function(cm) {\n modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });\n };\n\n cmds[map[cK + ctrl + \"Space\"] = \"setSublimeMark\"] = function(cm) {\n if (cm.state.sublimeMark) cm.state.sublimeMark.clear();\n cm.state.sublimeMark = cm.setBookmark(cm.getCursor());\n };\n cmds[map[cK + ctrl + \"A\"] = \"selectToSublimeMark\"] = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) cm.setSelection(cm.getCursor(), found);\n };\n cmds[map[cK + ctrl + \"W\"] = \"deleteToSublimeMark\"] = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) {\n var from = cm.getCursor(), to = found;\n if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; }\n cm.state.sublimeKilled = cm.getRange(from, to);\n cm.replaceRange(\"\", from, to);\n }\n };\n cmds[map[cK + ctrl + \"X\"] = \"swapWithSublimeMark\"] = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) {\n cm.state.sublimeMark.clear();\n cm.state.sublimeMark = cm.setBookmark(cm.getCursor());\n cm.setCursor(found);\n }\n };\n cmds[map[cK + ctrl + \"Y\"] = \"sublimeYank\"] = function(cm) {\n if (cm.state.sublimeKilled != null)\n cm.replaceSelection(cm.state.sublimeKilled, null, \"paste\");\n };\n\n map[cK + ctrl + \"G\"] = \"clearBookmarks\";\n cmds[map[cK + ctrl + \"C\"] = \"showInCenter\"] = function(cm) {\n var pos = cm.cursorCoords(null, \"local\");\n cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);\n };\n\n cmds[map[\"Shift-Alt-Up\"] = \"selectLinesUpward\"] = function(cm) {\n cm.operation(function() {\n var ranges = cm.listSelections();\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.head.line > cm.firstLine())\n cm.addSelection(Pos(range.head.line - 1, range.head.ch));\n }\n });\n };\n cmds[map[\"Shift-Alt-Down\"] = \"selectLinesDownward\"] = function(cm) {\n cm.operation(function() {\n var ranges = cm.listSelections();\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.head.line < cm.lastLine())\n cm.addSelection(Pos(range.head.line + 1, range.head.ch));\n }\n });\n };\n\n function getTarget(cm) {\n var from = cm.getCursor(\"from\"), to = cm.getCursor(\"to\");\n if (CodeMirror.cmpPos(from, to) == 0) {\n var word = wordAt(cm, from);\n if (!word.word) return;\n from = word.from;\n to = word.to;\n }\n return {from: from, to: to, query: cm.getRange(from, to), word: word};\n }\n\n function findAndGoTo(cm, forward) {\n var target = getTarget(cm);\n if (!target) return;\n var query = target.query;\n var cur = cm.getSearchCursor(query, forward ? target.to : target.from);\n\n if (forward ? cur.findNext() : cur.findPrevious()) {\n cm.setSelection(cur.from(), cur.to());\n } else {\n cur = cm.getSearchCursor(query, forward ? Pos(cm.firstLine(), 0)\n : cm.clipPos(Pos(cm.lastLine())));\n if (forward ? cur.findNext() : cur.findPrevious())\n cm.setSelection(cur.from(), cur.to());\n else if (target.word)\n cm.setSelection(target.from, target.to);\n }\n };\n cmds[map[ctrl + \"F3\"] = \"findUnder\"] = function(cm) { findAndGoTo(cm, true); };\n cmds[map[\"Shift-\" + ctrl + \"F3\"] = \"findUnderPrevious\"] = function(cm) { findAndGoTo(cm,false); };\n cmds[map[\"Alt-F3\"] = \"findAllUnder\"] = function(cm) {\n var target = getTarget(cm);\n if (!target) return;\n var cur = cm.getSearchCursor(target.query);\n var matches = [];\n var primaryIndex = -1;\n while (cur.findNext()) {\n matches.push({anchor: cur.from(), head: cur.to()});\n if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch)\n primaryIndex++;\n }\n cm.setSelections(matches, primaryIndex);\n };\n\n map[\"Shift-\" + ctrl + \"[\"] = \"fold\";\n map[\"Shift-\" + ctrl + \"]\"] = \"unfold\";\n map[cK + ctrl + \"0\"] = map[cK + ctrl + \"j\"] = \"unfoldAll\";\n\n map[ctrl + \"I\"] = \"findIncremental\";\n map[\"Shift-\" + ctrl + \"I\"] = \"findIncrementalReverse\";\n map[ctrl + \"H\"] = \"replace\";\n map[\"F3\"] = \"findNext\";\n map[\"Shift-F3\"] = \"findPrev\";\n\n CodeMirror.normalizeKeyMap(map);\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/keymap/sublime.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js": {
"text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var Pos = CodeMirror.Pos;\n function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }\n\n // Kill 'ring'\n\n var killRing = [];\n function addToRing(str) {\n killRing.push(str);\n if (killRing.length > 50) killRing.shift();\n }\n function growRingTop(str) {\n if (!killRing.length) return addToRing(str);\n killRing[killRing.length - 1] += str;\n }\n function getFromRing(n) { return killRing[killRing.length - (n ? Math.min(n, 1) : 1)] || \"\"; }\n function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }\n\n var lastKill = null;\n\n function kill(cm, from, to, mayGrow, text) {\n if (text == null) text = cm.getRange(from, to);\n\n if (mayGrow && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))\n growRingTop(text);\n else\n addToRing(text);\n cm.replaceRange(\"\", from, to, \"+delete\");\n\n if (mayGrow) lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};\n else lastKill = null;\n }\n\n // Boundaries of various units\n\n function byChar(cm, pos, dir) {\n return cm.findPosH(pos, dir, \"char\", true);\n }\n\n function byWord(cm, pos, dir) {\n return cm.findPosH(pos, dir, \"word\", true);\n }\n\n function byLine(cm, pos, dir) {\n return cm.findPosV(pos, dir, \"line\", cm.doc.sel.goalColumn);\n }\n\n function byPage(cm, pos, dir) {\n return cm.findPosV(pos, dir, \"page\", cm.doc.sel.goalColumn);\n }\n\n function byParagraph(cm, pos, dir) {\n var no = pos.line, line = cm.getLine(no);\n var sawText = /\\S/.test(dir < 0 ? line.slice(0, pos.ch) : line.slice(pos.ch));\n var fst = cm.firstLine(), lst = cm.lastLine();\n for (;;) {\n no += dir;\n if (no < fst || no > lst)\n return cm.clipPos(Pos(no - dir, dir < 0 ? 0 : null));\n line = cm.getLine(no);\n var hasText = /\\S/.test(line);\n if (hasText) sawText = true;\n else if (sawText) return Pos(no, 0);\n }\n }\n\n function bySentence(cm, pos, dir) {\n var line = pos.line, ch = pos.ch;\n var text = cm.getLine(pos.line), sawWord = false;\n for (;;) {\n var next = text.charAt(ch + (dir < 0 ? -1 : 0));\n if (!next) { // End/beginning of line reached\n if (line == (dir < 0 ? cm.firstLine() : cm.lastLine())) return Pos(line, ch);\n text = cm.getLine(line + dir);\n if (!/\\S/.test(text)) return Pos(line, ch);\n line += dir;\n ch = dir < 0 ? text.length : 0;\n continue;\n }\n if (sawWord && /[!?.]/.test(next)) return Pos(line, ch + (dir > 0 ? 1 : 0));\n if (!sawWord) sawWord = /\\w/.test(next);\n ch += dir;\n }\n }\n\n function byExpr(cm, pos, dir) {\n var wrap;\n if (cm.findMatchingBracket && (wrap = cm.findMatchingBracket(pos, true))\n && wrap.match && (wrap.forward ? 1 : -1) == dir)\n return dir > 0 ? Pos(wrap.to.line, wrap.to.ch + 1) : wrap.to;\n\n for (var first = true;; first = false) {\n var token = cm.getTokenAt(pos);\n var after = Pos(pos.line, dir < 0 ? token.start : token.end);\n if (first && dir > 0 && token.end == pos.ch || !/\\w/.test(token.string)) {\n var newPos = cm.findPosH(after, dir, \"char\");\n if (posEq(after, newPos)) return pos;\n else pos = newPos;\n } else {\n return after;\n }\n }\n }\n\n // Prefixes (only crudely supported)\n\n function getPrefix(cm, precise) {\n var digits = cm.state.emacsPrefix;\n if (!digits) return precise ? null : 1;\n clearPrefix(cm);\n return digits == \"-\" ? -1 : Number(digits);\n }\n\n function repeated(cmd) {\n var f = typeof cmd == \"string\" ? function(cm) { cm.execCommand(cmd); } : cmd;\n return function(cm) {\n var prefix = getPrefix(cm);\n f(cm);\n for (var i = 1; i < prefix; ++i) f(cm);\n };\n }\n\n function findEnd(cm, pos, by, dir) {\n var prefix = getPrefix(cm);\n if (prefix < 0) { dir = -dir; prefix = -prefix; }\n for (var i = 0; i < prefix; ++i) {\n var newPos = by(cm, pos, dir);\n if (posEq(newPos, pos)) break;\n pos = newPos;\n }\n return pos;\n }\n\n function move(by, dir) {\n var f = function(cm) {\n cm.extendSelection(findEnd(cm, cm.getCursor(), by, dir));\n };\n f.motion = true;\n return f;\n }\n\n function killTo(cm, by, dir) {\n var selections = cm.listSelections(), cursor;\n var i = selections.length;\n while (i--) {\n cursor = selections[i].head;\n kill(cm, cursor, findEnd(cm, cursor, by, dir), true);\n }\n }\n\n function killRegion(cm) {\n if (cm.somethingSelected()) {\n var selections = cm.listSelections(), selection;\n var i = selections.length;\n while (i--) {\n selection = selections[i];\n kill(cm, selection.anchor, selection.head);\n }\n return true;\n }\n }\n\n function addPrefix(cm, digit) {\n if (cm.state.emacsPrefix) {\n if (digit != \"-\") cm.state.emacsPrefix += digit;\n return;\n }\n // Not active yet\n cm.state.emacsPrefix = digit;\n cm.on(\"keyHandled\", maybeClearPrefix);\n cm.on(\"inputRead\", maybeDuplicateInput);\n }\n\n var prefixPreservingKeys = {\"Alt-G\": true, \"Ctrl-X\": true, \"Ctrl-Q\": true, \"Ctrl-U\": true};\n\n function maybeClearPrefix(cm, arg) {\n if (!cm.state.emacsPrefixMap && !prefixPreservingKeys.hasOwnProperty(arg))\n clearPrefix(cm);\n }\n\n function clearPrefix(cm) {\n cm.state.emacsPrefix = null;\n cm.off(\"keyHandled\", maybeClearPrefix);\n cm.off(\"inputRead\", maybeDuplicateInput);\n }\n\n function maybeDuplicateInput(cm, event) {\n var dup = getPrefix(cm);\n if (dup > 1 && event.origin == \"+input\") {\n var one = event.text.join(\"\\n\"), txt = \"\";\n for (var i = 1; i < dup; ++i) txt += one;\n cm.replaceSelection(txt);\n }\n }\n\n function addPrefixMap(cm) {\n cm.state.emacsPrefixMap = true;\n cm.addKeyMap(prefixMap);\n cm.on(\"keyHandled\", maybeRemovePrefixMap);\n cm.on(\"inputRead\", maybeRemovePrefixMap);\n }\n\n function maybeRemovePrefixMap(cm, arg) {\n if (typeof arg == \"string\" && (/^\\d$/.test(arg) || arg == \"Ctrl-U\")) return;\n cm.removeKeyMap(prefixMap);\n cm.state.emacsPrefixMap = false;\n cm.off(\"keyHandled\", maybeRemovePrefixMap);\n cm.off(\"inputRead\", maybeRemovePrefixMap);\n }\n\n // Utilities\n\n function setMark(cm) {\n cm.setCursor(cm.getCursor());\n cm.setExtending(!cm.getExtending());\n cm.on(\"change\", function() { cm.setExtending(false); });\n }\n\n function clearMark(cm) {\n cm.setExtending(false);\n cm.setCursor(cm.getCursor());\n }\n\n function getInput(cm, msg, f) {\n if (cm.openDialog)\n cm.openDialog(msg + \": <input type=\\\"text\\\" style=\\\"width: 10em\\\"/>\", f, {bottom: true});\n else\n f(prompt(msg, \"\"));\n }\n\n function operateOnWord(cm, op) {\n var start = cm.getCursor(), end = cm.findPosH(start, 1, \"word\");\n cm.replaceRange(op(cm.getRange(start, end)), start, end);\n cm.setCursor(end);\n }\n\n function toEnclosingExpr(cm) {\n var pos = cm.getCursor(), line = pos.line, ch = pos.ch;\n var stack = [];\n while (line >= cm.firstLine()) {\n var text = cm.getLine(line);\n for (var i = ch == null ? text.length : ch; i > 0;) {\n var ch = text.charAt(--i);\n if (ch == \")\")\n stack.push(\"(\");\n else if (ch == \"]\")\n stack.push(\"[\");\n else if (ch == \"}\")\n stack.push(\"{\");\n else if (/[\\(\\{\\[]/.test(ch) && (!stack.length || stack.pop() != ch))\n return cm.extendSelection(Pos(line, i));\n }\n --line; ch = null;\n }\n }\n\n function quit(cm) {\n cm.execCommand(\"clearSearch\");\n clearMark(cm);\n }\n\n // Actual keymap\n\n var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({\n \"Ctrl-W\": function(cm) {kill(cm, cm.getCursor(\"start\"), cm.getCursor(\"end\"));},\n \"Ctrl-K\": repeated(function(cm) {\n var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));\n var text = cm.getRange(start, end);\n if (!/\\S/.test(text)) {\n text += \"\\n\";\n end = Pos(start.line + 1, 0);\n }\n kill(cm, start, end, true, text);\n }),\n \"Alt-W\": function(cm) {\n addToRing(cm.getSelection());\n clearMark(cm);\n },\n \"Ctrl-Y\": function(cm) {\n var start = cm.getCursor();\n cm.replaceRange(getFromRing(getPrefix(cm)), start, start, \"paste\");\n cm.setSelection(start, cm.getCursor());\n },\n \"Alt-Y\": function(cm) {cm.replaceSelection(popFromRing(), \"around\", \"paste\");},\n\n \"Ctrl-Space\": setMark, \"Ctrl-Shift-2\": setMark,\n\n \"Ctrl-F\": move(byChar, 1), \"Ctrl-B\": move(byChar, -1),\n \"Right\": move(byChar, 1), \"Left\": move(byChar, -1),\n \"Ctrl-D\": function(cm) { killTo(cm, byChar, 1); },\n \"Delete\": function(cm) { killRegion(cm) || killTo(cm, byChar, 1); },\n \"Ctrl-H\": function(cm) { killTo(cm, byChar, -1); },\n \"Backspace\": function(cm) { killRegion(cm) || killTo(cm, byChar, -1); },\n\n \"Alt-F\": move(byWord, 1), \"Alt-B\": move(byWord, -1),\n \"Alt-D\": function(cm) { killTo(cm, byWord, 1); },\n \"Alt-Backspace\": function(cm) { killTo(cm, byWord, -1); },\n\n \"Ctrl-N\": move(byLine, 1), \"Ctrl-P\": move(byLine, -1),\n \"Down\": move(byLine, 1), \"Up\": move(byLine, -1),\n \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStart\",\n\n \"Alt-V\": move(byPage, -1), \"Ctrl-V\": move(byPage, 1),\n \"PageUp\": move(byPage, -1), \"PageDown\": move(byPage, 1),\n\n \"Ctrl-Up\": move(byParagraph, -1), \"Ctrl-Down\": move(byParagraph, 1),\n\n \"Alt-A\": move(bySentence, -1), \"Alt-E\": move(bySentence, 1),\n \"Alt-K\": function(cm) { killTo(cm, bySentence, 1); },\n\n \"Ctrl-Alt-K\": function(cm) { killTo(cm, byExpr, 1); },\n \"Ctrl-Alt-Backspace\": function(cm) { killTo(cm, byExpr, -1); },\n \"Ctrl-Alt-F\": move(byExpr, 1), \"Ctrl-Alt-B\": move(byExpr, -1),\n\n \"Shift-Ctrl-Alt-2\": function(cm) {\n var cursor = cm.getCursor();\n cm.setSelection(findEnd(cm, cursor, byExpr, 1), cursor);\n },\n \"Ctrl-Alt-T\": function(cm) {\n var leftStart = byExpr(cm, cm.getCursor(), -1), leftEnd = byExpr(cm, leftStart, 1);\n var rightEnd = byExpr(cm, leftEnd, 1), rightStart = byExpr(cm, rightEnd, -1);\n cm.replaceRange(cm.getRange(rightStart, rightEnd) + cm.getRange(leftEnd, rightStart) +\n cm.getRange(leftStart, leftEnd), leftStart, rightEnd);\n },\n \"Ctrl-Alt-U\": repeated(toEnclosingExpr),\n\n \"Alt-Space\": function(cm) {\n var pos = cm.getCursor(), from = pos.ch, to = pos.ch, text = cm.getLine(pos.line);\n while (from && /\\s/.test(text.charAt(from - 1))) --from;\n while (to < text.length && /\\s/.test(text.charAt(to))) ++to;\n cm.replaceRange(\" \", Pos(pos.line, from), Pos(pos.line, to));\n },\n \"Ctrl-O\": repeated(function(cm) { cm.replaceSelection(\"\\n\", \"start\"); }),\n \"Ctrl-T\": repeated(function(cm) {\n cm.execCommand(\"transposeChars\");\n }),\n\n \"Alt-C\": repeated(function(cm) {\n operateOnWord(cm, function(w) {\n var letter = w.search(/\\w/);\n if (letter == -1) return w;\n return w.slice(0, letter) + w.charAt(letter).toUpperCase() + w.slice(letter + 1).toLowerCase();\n });\n }),\n \"Alt-U\": repeated(function(cm) {\n operateOnWord(cm, function(w) { return w.toUpperCase(); });\n }),\n \"Alt-L\": repeated(function(cm) {\n operateOnWord(cm, function(w) { return w.toLowerCase(); });\n }),\n\n \"Alt-;\": \"toggleComment\",\n\n \"Ctrl-/\": repeated(\"undo\"), \"Shift-Ctrl--\": repeated(\"undo\"),\n \"Ctrl-Z\": repeated(\"undo\"), \"Cmd-Z\": repeated(\"undo\"),\n \"Shift-Alt-,\": \"goDocStart\", \"Shift-Alt-.\": \"goDocEnd\",\n \"Ctrl-S\": \"findNext\", \"Ctrl-R\": \"findPrev\", \"Ctrl-G\": quit, \"Shift-Alt-5\": \"replace\",\n \"Alt-/\": \"autocomplete\",\n \"Ctrl-J\": \"newlineAndIndent\", \"Enter\": false, \"Tab\": \"indentAuto\",\n\n \"Alt-G G\": function(cm) {\n var prefix = getPrefix(cm, true);\n if (prefix != null && prefix > 0) return cm.setCursor(prefix - 1);\n\n getInput(cm, \"Goto line\", function(str) {\n var num;\n if (str && !isNaN(num = Number(str)) && num == (num|0) && num > 0)\n cm.setCursor(num - 1);\n });\n },\n\n \"Ctrl-X Tab\": function(cm) {\n cm.indentSelection(getPrefix(cm, true) || cm.getOption(\"indentUnit\"));\n },\n \"Ctrl-X Ctrl-X\": function(cm) {\n cm.setSelection(cm.getCursor(\"head\"), cm.getCursor(\"anchor\"));\n },\n \"Ctrl-X Ctrl-S\": \"save\",\n \"Ctrl-X Ctrl-W\": \"save\",\n \"Ctrl-X S\": \"saveAll\",\n \"Ctrl-X F\": \"open\",\n \"Ctrl-X U\": repeated(\"undo\"),\n \"Ctrl-X K\": \"close\",\n \"Ctrl-X Delete\": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), true); },\n \"Ctrl-X H\": \"selectAll\",\n\n \"Ctrl-Q Tab\": repeated(\"insertTab\"),\n \"Ctrl-U\": addPrefixMap\n });\n\n var prefixMap = {\"Ctrl-G\": clearPrefix};\n function regPrefix(d) {\n prefixMap[d] = function(cm) { addPrefix(cm, d); };\n keyMap[\"Ctrl-\" + d] = function(cm) { addPrefix(cm, d); };\n prefixPreservingKeys[\"Ctrl-\" + d] = true;\n }\n for (var i = 0; i < 10; ++i) regPrefix(String(i));\n regPrefix(\"-\");\n});\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/codemirror/keymap/emacs.js",
"module-type": "library"
},
"$:/plugins/tiddlywiki/codemirror/readme": {
"title": "$:/plugins/tiddlywiki/codemirror/readme",
"text": "This plugin provides an enhanced text editor component based on [[CodeMirror|http://codemirror.net]]. It provides several advantages over the default browser text editor:\n\n* Code colouring for many languages (see [[the official documentation here|http://codemirror.net/mode/index.html]])\n* Auto closing brackets and tags\n* Folding brackets, comments, and tags\n* Auto-completion\n\n[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/codemirror]]\n\nBased on ~CodeMirror version 5.13.2\n"
},
"$:/plugins/tiddlywiki/codemirror/styles": {
"title": "$:/plugins/tiddlywiki/codemirror/styles",
"tags": "[[$:/tags/Stylesheet]]",
"text": "/* Make the editor resize to fit its content */\n\n.CodeMirror {\n\theight: auto;\n\tborder: 1px solid #ddd;\n\tline-height: 1.5;\n\tfont-family: \"Monaco\", monospace;\n}\n\n.CodeMirror-scroll {\n\toverflow-x: auto;\n\toverflow-y: hidden;\t\n}\n"
},
"$:/plugins/tiddlywiki/codemirror/usage": {
"title": "$:/plugins/tiddlywiki/codemirror/usage",
"text": "! Setting ~CodeMirror Content Types\n\nYou can determine which tiddler content types are edited by the ~CodeMirror widget by creating or modifying special tiddlers whose prefix is comprised of the string `$:/config/EditorTypeMappings/` concatenated with the content type. The text of that tiddler gives the editor type to be used (eg, ''text'', ''bitmap'', ''codemirror'').\n\nThe current editor type mappings are shown in [[$:/ControlPanel]] under the \"Advanced\" tab.\n\n! ~CodeMirror Configuration\n\nYou can configure the ~CodeMirror plugin by creating a tiddler called [[$:/config/CodeMirror]] containing a JSON configuration object. The configuration tiddler must have its type field set to `application/json` to take effect.\n\nSee http://codemirror.net/ for details of available configuration options.\n\nFor example:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js\",\n \"$:/plugins/tiddlywiki/codemirror/keymap/vim.js\",\n \"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js\"\n ],\n \"configuration\": {\n \"keyMap\": \"vim\",\n \"matchBrackets\":true,\n \"showCursorWhenSelecting\": true\n }\n}\n```\n\n!! Basic working configuration\n\n# Create a tiddler called `$:/config/CodeMirror`\n\n# The type of the tiddler has to be set to `application/json`\n\n# The text of the tiddler is the following: \n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js\"\n ],\n \"configuration\": {\n \"matchBrackets\":true,\n \"showCursorWhenSelecting\": true\n }\n}\n\n```\n\n# You should see line numbers when editing a tiddler\n# When editing a tiddler, no matter what the type of the tiddler is set to, you should see matching brackets being highlighted whenever the cursor is next to one of them\n# If you edit a tiddler with the type `application/javascript` or `application/json` you should see the code being syntax highlighted\n\n!! Add HTML syntax highlighting\n\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/xml/xml.js]]\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js\"\n ],\n \"configuration\": {\n \"showCursorWhenSelecting\": true,\n \"matchBrackets\":true\n }\n}\n```\n# Edit a tiddler with the type `text/html` and write some html code. You should see your code being coloured\n\n!! Add a non-existing language mode\n\nHere's an example of adding a new language mode - in this case, the language C.\n\n\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/mode/clike/clike.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/clike/clike.js]]\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/clike/clike.js\"\n ],\n \"configuration\": {\n \"showCursorWhenSelecting\": true\n }\n}\n```\n\n# Add the correct ~EditorTypeMappings tiddler\n## Find the matching MIME type. If you go on the [[CodeMirror documentation for language modes|http://codemirror.net/mode/index.html]] you can see the [[documentation for the c-like mode|http://codemirror.net/mode/clike/index.html]]. In this documentation, at the end you will be told the MIME types defined. Here it's ''text/x-csrc''\n## Add the tiddler: `$:/config/EditorTypeMappings/text/x-csrc` and fill the text field with : ''codemirror''\n\nIf you edit a tiddler with the type `text/x-csrc` and write some code in C, you should see your text being coloured.\n\n!! Add matching tags\n\n# Add XML and HTML colouring\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/edit/matchtags.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[http://codemirror.net/addon/edit/matchtags.js]]\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchtags.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\"\n ],\n \"configuration\": {\n \"showCursorWhenSelecting\": true,\n \"matchTags\": {\"bothTags\": true},\n \"extraKeys\": {\"Ctrl-J\": \"toMatchingTag\"}\n }\n}\n```\n\nEdit a tiddler that has the type :`text/htm` and write this code:\n\n```\n<html>\n <div id=\"click here and press CTRL+J\">\n <ul>\n <li>\n </li>\n </ul>\n </div>\n</html>\n```\n\nIf you click on a tag and press CTRL+J, your cursor will select the matching tag. Supposedly, it should highlight the pair when clicking a tag. However, that part doesn't work.\n\n!! Adding closing tags\n\n# Add the xml mode (see \"Add XML and HTML colouring\")\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/edit/closetags.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[http://codemirror.net/addon/edit/closetag.js]]\n\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/closetags.js\"\n ],\n \"configuration\": {\n \"showCursorWhenSelecting\": true,\n \"autoCloseTags\":true\n }\n}\n```\n\nIf you edit a tiddler with the type`text/html` and write:\n\n```\n<html>\n```\n\nThen the closing tag ''</html>'' should automatically appear.\n\n!! Add closing brackets\n\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/edit/closebrackets.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[http://codemirror.net/addon/edit/closebrackets.js]]\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/edit/closebrackets.js\"\n ],\n\n \"configuration\": {\n\n \"showCursorWhenSelecting\": true,\n \"matchBrackets\":true,\n \"autoCloseBrackets\":true\n }\n}\n```\n\n# If you try to edit any tiddler and write `if(` you should see the bracket closing itself automatically (you will get \"if()\"). It works with (), [], and {}\n# If you try and edit a tiddler with the type `application/javascript`, it will auto-close `()`,`[]`,`{}`,`''` and `\"\"`\n\n!! Adding folding tags\n\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/fold/foldcode.js`\n## Add a field `module-type` and set it to ''library''\n## Set the field `type` to ''application/javascript''\n## Set the text field of the tiddler with the javascript code from this link : [[http://codemirror.net/addon/fold/foldcode.js]]\n# Repeat the above process for the following tiddlers, but replace the code with the one from the given link:\n## Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/fold/xml-fold.js`, the code can be found here [[https://raw.githubusercontent.com/codemirror/CodeMirror/master/addon/fold/xml-fold.js]]\n## Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/fold/foldgutter.js`, the code can be found here [[http://codemirror.net/addon/fold/foldgutter.js]]\n# Create a tiddler `$:/plugins/tiddlywiki/codemirror/addon/fold/foldgutter.css`\n## Add the tag `$:/tags/Stylesheet`\n## Set the text field of the tiddler with the css code from this link : [[http://codemirror.net/addon/fold/foldgutter.css]]\n# Set the text field of the tiddler `$:/config/CodeMirror` to:\n\n```\n{\n \"require\": [\n \"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\",\n \"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/fold/foldcode.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/fold/xml-fold.js\",\n \"$:/plugins/tiddlywiki/codemirror/addon/fold/foldgutter.js\"\n ],\n \"configuration\": {\n \"showCursorWhenSelecting\": true,\n \"matchTags\": {\"bothTags\": true},\n \"foldGutter\": true,\n \"gutters\": [\"CodeMirror-linenumbers\", \"CodeMirror-foldgutter\"]\n }\n}\n```\n\nNow if you type the below code in a tiddler with the type `text/html`:\n\n```\n<html>\n <div>\n <ul>\n\n </ul>\n </div>\n</html>\n```\n\nYou should see little arrows just next to the line numbers. Clicking on it will have the effect to fold the code (or unfold it).\n"
}
}
}
{
"tiddlers": {
"$:/plugins/tiddlywiki/filesystem/filesystemadaptor.js": {
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/filesystem/filesystemadaptor.js\ntype: application/javascript\nmodule-type: syncadaptor\n\nA sync adaptor module for synchronising with the local filesystem via node.js APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Get a reference to the file system\nvar fs = $tw.node ? require(\"fs\") : null,\n\tpath = $tw.node ? require(\"path\") : null;\n\nfunction FileSystemAdaptor(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\tthis.logger = new $tw.utils.Logger(\"FileSystem\");\n\t// Create the <wiki>/tiddlers folder if it doesn't exist\n\t$tw.utils.createDirectory($tw.boot.wikiTiddlersPath);\n}\n\nFileSystemAdaptor.prototype.name = \"filesystem\";\n\nFileSystemAdaptor.prototype.isReady = function() {\n\t// The file system adaptor is always ready\n\treturn true;\n};\n\nFileSystemAdaptor.prototype.getTiddlerInfo = function(tiddler) {\n\treturn {};\n};\n\n/*\nReturn a fileInfo object for a tiddler, creating it if necessary:\n filepath: the absolute path to the file containing the tiddler\n type: the type of the tiddler file (NOT the type of the tiddler -- see below)\n hasMetaFile: true if the file also has a companion .meta file\n\nThe boot process populates $tw.boot.files for each of the tiddler files that it loads. The type is found by looking up the extension in $tw.config.fileExtensionInfo (eg \"application/x-tiddler\" for \".tid\" files).\n\nIt is the responsibility of the filesystem adaptor to update $tw.boot.files for new files that are created.\n*/\nFileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {\n\t// See if we've already got information about this file\n\tvar self = this,\n\t\ttitle = tiddler.fields.title,\n\t\tfileInfo = $tw.boot.files[title];\n\tif(fileInfo) {\n\t\t// If so, just invoke the callback\n\t\tcallback(null,fileInfo);\n\t} else {\n\t\t// Otherwise, we'll need to generate it\n\t\tfileInfo = {};\n\t\tvar tiddlerType = tiddler.fields.type || \"text/vnd.tiddlywiki\";\n\t\t// Get the content type info\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddlerType] || {};\n\t\t// Get the file type by looking up the extension\n\t\tvar extension = contentTypeInfo.extension || \".tid\";\n\t\tfileInfo.type = ($tw.config.fileExtensionInfo[extension] || {type: \"application/x-tiddler\"}).type;\n\t\t// Use a .meta file unless we're saving a .tid file.\n\t\t// (We would need more complex logic if we supported other template rendered tiddlers besides .tid)\n\t\tfileInfo.hasMetaFile = (fileInfo.type !== \"application/x-tiddler\") && (fileInfo.type !== \"application/json\");\n\t\tif(!fileInfo.hasMetaFile) {\n\t\t\textension = \".tid\";\n\t\t}\n\t\t// Generate the base filepath and ensure the directories exist\n\t\tvar baseFilepath = path.resolve($tw.boot.wikiTiddlersPath,this.generateTiddlerBaseFilepath(title));\n\t\t$tw.utils.createFileDirectories(baseFilepath);\n\t\t// Start by getting a list of the existing files in the directory\n\t\tfs.readdir(path.dirname(baseFilepath),function(err,files) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Start with the base filename plus the extension\n\t\t\tvar filepath = baseFilepath;\n\t\t\tif(filepath.substr(-extension.length).toLocaleLowerCase() !== extension.toLocaleLowerCase()) {\n\t\t\t\tfilepath = filepath + extension;\n\t\t\t}\n\t\t\tvar filename = path.basename(filepath),\n\t\t\t\tcount = 1;\n\t\t\t// Add a discriminator if we're clashing with an existing filename while\n\t\t\t// handling case-insensitive filesystems (NTFS, FAT/FAT32, etc.)\n\t\t\twhile(files.some(function(value) {return value.toLocaleLowerCase() === filename.toLocaleLowerCase();})) {\n\t\t\t\tfilepath = baseFilepath + \" \" + (count++) + extension;\n\t\t\t\tfilename = path.basename(filepath);\n\t\t\t}\n\t\t\t// Set the final fileInfo\n\t\t\tfileInfo.filepath = filepath;\nconsole.log(\"\\x1b[1;35m\" + \"For \" + title + \", type is \" + fileInfo.type + \" hasMetaFile is \" + fileInfo.hasMetaFile + \" filepath is \" + fileInfo.filepath + \"\\x1b[0m\");\n\t\t\t$tw.boot.files[title] = fileInfo;\n\t\t\t// Pass it to the callback\n\t\t\tcallback(null,fileInfo);\n\t\t});\n\t}\n};\n\n/*\nGiven a list of filters, apply every one in turn to source, and return the first result of the first filter with non-empty result.\n*/\nFileSystemAdaptor.prototype.findFirstFilter = function(filters,source) {\n\tfor(var i=0; i<filters.length; i++) {\n\t\tvar result = this.wiki.filterTiddlers(filters[i],null,source);\n\t\tif(result.length > 0) {\n\t\t\treturn result[0];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGiven a tiddler title and an array of existing filenames, generate a new legal filename for the title, case insensitively avoiding the array of existing filenames\n*/\nFileSystemAdaptor.prototype.generateTiddlerBaseFilepath = function(title) {\n\tvar baseFilename;\n\t// Check whether the user has configured a tiddler -> pathname mapping\n\tvar pathNameFilters = this.wiki.getTiddlerText(\"$:/config/FileSystemPaths\");\n\tif(pathNameFilters) {\n\t\tvar source = this.wiki.makeTiddlerIterator([title]);\n\t\tbaseFilename = this.findFirstFilter(pathNameFilters.split(\"\\n\"),source);\n\t\tif(baseFilename) {\n\t\t\t// Interpret \"/\" and \"\\\" as path separator\n\t\t\tbaseFilename = baseFilename.replace(/\\/|\\\\/g,path.sep);\n\t\t}\n\t}\n\tif(!baseFilename) {\n\t\t// No mappings provided, or failed to match this tiddler so we use title as filename\n\t\tbaseFilename = title.replace(/\\/|\\\\/g,\"_\");\n\t}\n\t// Remove any of the characters that are illegal in Windows filenames\n\tvar baseFilename = $tw.utils.transliterate(baseFilename.replace(/<|>|\\:|\\\"|\\||\\?|\\*|\\^/g,\"_\"));\n\t// Truncate the filename if it is too long\n\tif(baseFilename.length > 200) {\n\t\tbaseFilename = baseFilename.substr(0,200);\n\t}\n\treturn baseFilename;\n};\n\n/*\nSave a tiddler and invoke the callback with (err,adaptorInfo,revision)\n*/\nFileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {\n\tvar self = this;\n\tthis.getTiddlerFileInfo(tiddler,function(err,fileInfo) {\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\tvar filepath = fileInfo.filepath,\n\t\t\terror = $tw.utils.createDirectory(path.dirname(filepath));\n\t\tif(error) {\n\t\t\treturn callback(error);\n\t\t}\n\t\tif(fileInfo.hasMetaFile) {\n\t\t\t// Save the tiddler as a separate body and meta file\n\t\t\tvar typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/plain\"] || {encoding: \"utf8\"};\n\t\t\tfs.writeFile(filepath,tiddler.fields.text,{encoding: typeInfo.encoding},function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\tcontent = self.wiki.renderTiddler(\"text/plain\",\"$:/core/templates/tiddler-metadata\",{variables: {currentTiddler: tiddler.fields.title}});\n\t\t\t\tfs.writeFile(fileInfo.filepath + \".meta\",content,{encoding: \"utf8\"},function (err) {\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\treturn callback(err);\n\t\t\t\t\t}\n\t\t\t\t\tself.logger.log(\"Saved file\",filepath);\n\t\t\t\t\treturn callback(null);\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\t// Save the tiddler as a self contained templated file\n\t\t\tvar content = self.wiki.renderTiddler(\"text/plain\",\"$:/core/templates/tid-tiddler\",{variables: {currentTiddler: tiddler.fields.title}});\n\t\t\tfs.writeFile(filepath,content,{encoding: \"utf8\"},function (err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\tself.logger.log(\"Saved file\",filepath);\n\t\t\t\treturn callback(null);\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nLoad a tiddler and invoke the callback with (err,tiddlerFields)\n\nWe don't need to implement loading for the file system adaptor, because all the tiddler files will have been loaded during the boot process.\n*/\nFileSystemAdaptor.prototype.loadTiddler = function(title,callback) {\n\tcallback(null,null);\n};\n\n/*\nDelete a tiddler and invoke the callback with (err)\n*/\nFileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {\n\tvar self = this,\n\t\tfileInfo = $tw.boot.files[title];\n\t// Only delete the tiddler if we have writable information for the file\n\tif(fileInfo) {\n\t\t// Delete the file\n\t\tfs.unlink(fileInfo.filepath,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.logger.log(\"Deleted file\",fileInfo.filepath);\n\t\t\t// Delete the metafile if present\n\t\t\tif(fileInfo.hasMetaFile) {\n\t\t\t\tfs.unlink(fileInfo.filepath + \".meta\",function(err) {\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\treturn callback(err);\n\t\t\t\t\t}\n\t\t\t\t\treturn $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),callback);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),callback);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tcallback(null);\n\t}\n};\n\nif(fs) {\n\texports.adaptorClass = FileSystemAdaptor;\n}\n\n})();\n",
"title": "$:/plugins/tiddlywiki/filesystem/filesystemadaptor.js",
"type": "application/javascript",
"module-type": "syncadaptor"
},
"$:/plugins/tiddlywiki/filesystem/readme": {
"title": "$:/plugins/tiddlywiki/filesystem/readme",
"text": "The filesystem plugin is used under Node.js to synchronise tiddler changes back to the file system. It is inert when used in the browser.\n\n[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/filesystem]]\n"
}
}
}
Eve Embedded in ~TiddlyWiki
{
"tiddlers": {
"$:/info/browser": {
"title": "$:/info/browser",
"text": "yes"
},
"$:/info/node": {
"title": "$:/info/node",
"text": "no"
},
"$:/info/url/full": {
"title": "$:/info/url/full",
"text": "https://btheado.github.io/tweve/"
},
"$:/info/url/host": {
"title": "$:/info/url/host",
"text": "btheado.github.io"
},
"$:/info/url/hostname": {
"title": "$:/info/url/hostname",
"text": "btheado.github.io"
},
"$:/info/url/protocol": {
"title": "$:/info/url/protocol",
"text": "https:"
},
"$:/info/url/port": {
"title": "$:/info/url/port",
"text": ""
},
"$:/info/url/pathname": {
"title": "$:/info/url/pathname",
"text": "/tweve/"
},
"$:/info/url/search": {
"title": "$:/info/url/search",
"text": ""
},
"$:/info/url/origin": {
"title": "$:/info/url/origin",
"text": "https://btheado.github.io"
}
}
}
{
"tiddlers": {
"$:/themes/tiddlywiki/vanilla/themetweaks": {
"title": "$:/themes/tiddlywiki/vanilla/themetweaks",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ThemeTweaks/ThemeTweaks}}",
"text": "\\define lingo-base() $:/language/ThemeTweaks/\n\n\\define replacement-text()\n[img[$(imageTitle)$]]\n\\end\n\n\\define backgroundimage-dropdown()\n<div class=\"tc-drop-down-wrapper\">\n<$button popup=<<qualify \"$:/state/popup/themetweaks/backgroundimage\">> class=\"tc-btn-invisible tc-btn-dropdown\">{{$:/core/images/down-arrow}}</$button>\n<$reveal state=<<qualify \"$:/state/popup/themetweaks/backgroundimage\">> type=\"popup\" position=\"belowleft\" text=\"\" default=\"\">\n<div class=\"tc-drop-down\">\n<$macrocall $name=\"image-picker\" actions=\"\"\"\n\n<$action-setfield\n\t$tiddler=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\"\n\t$value=<<imageTitle>>\n/>\n\n\"\"\"/>\n</div>\n</$reveal>\n</div>\n\\end\n\n\\define backgroundimageattachment-dropdown()\n<$select tiddler=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment\" default=\"scroll\">\n<option value=\"scroll\"><<lingo Settings/BackgroundImageAttachment/Scroll>></option>\n<option value=\"fixed\"><<lingo Settings/BackgroundImageAttachment/Fixed>></option>\n</$select>\n\\end\n\n\\define backgroundimagesize-dropdown()\n<$select tiddler=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize\" default=\"scroll\">\n<option value=\"auto\"><<lingo Settings/BackgroundImageSize/Auto>></option>\n<option value=\"cover\"><<lingo Settings/BackgroundImageSize/Cover>></option>\n<option value=\"contain\"><<lingo Settings/BackgroundImageSize/Contain>></option>\n</$select>\n\\end\n\n<<lingo ThemeTweaks/Hint>>\n\n! <<lingo Options>>\n\n|<$link to=\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\"><<lingo Options/SidebarLayout>></$link> |<$select tiddler=\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\"><option value=\"fixed-fluid\"><<lingo Options/SidebarLayout/Fixed-Fluid>></option><option value=\"fluid-fixed\"><<lingo Options/SidebarLayout/Fluid-Fixed>></option></$select> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/options/stickytitles\"><<lingo Options/StickyTitles>></$link><br>//<<lingo Options/StickyTitles/Hint>>// |<$select tiddler=\"$:/themes/tiddlywiki/vanilla/options/stickytitles\"><option value=\"no\">{{$:/language/No}}</option><option value=\"yes\">{{$:/language/Yes}}</option></$select> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/options/codewrapping\"><<lingo Options/CodeWrapping>></$link> |<$select tiddler=\"$:/themes/tiddlywiki/vanilla/options/codewrapping\"><option value=\"pre\">{{$:/language/No}}</option><option value=\"pre-wrap\">{{$:/language/Yes}}</option></$select> |\n\n! <<lingo Settings>>\n\n|<$link to=\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\"><<lingo Settings/FontFamily>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\" default=\"\" tag=\"input\"/> | |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/settings/codefontfamily\"><<lingo Settings/CodeFontFamily>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/settings/codefontfamily\" default=\"\" tag=\"input\"/> | |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\"><<lingo Settings/BackgroundImage>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\" default=\"\" tag=\"input\"/> |<<backgroundimage-dropdown>> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment\"><<lingo Settings/BackgroundImageAttachment>></$link> |<<backgroundimageattachment-dropdown>> | |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize\"><<lingo Settings/BackgroundImageSize>></$link> |<<backgroundimagesize-dropdown>> | |\n\n! <<lingo Metrics>>\n\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/fontsize\"><<lingo Metrics/FontSize>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/fontsize\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/lineheight\"><<lingo Metrics/LineHeight>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/lineheight\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize\"><<lingo Metrics/BodyFontSize>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/bodylineheight\"><<lingo Metrics/BodyLineHeight>></$link> |<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/bodylineheight\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/storyleft\"><<lingo Metrics/StoryLeft>></$link><br>//<<lingo Metrics/StoryLeft/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/storyleft\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/storytop\"><<lingo Metrics/StoryTop>></$link><br>//<<lingo Metrics/StoryTop/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/storytop\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/storyright\"><<lingo Metrics/StoryRight>></$link><br>//<<lingo Metrics/StoryRight/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/storyright\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/storywidth\"><<lingo Metrics/StoryWidth>></$link><br>//<<lingo Metrics/StoryWidth/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/storywidth\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth\"><<lingo Metrics/TiddlerWidth>></$link><br>//<<lingo Metrics/TiddlerWidth/Hint>>//<br> |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint\"><<lingo Metrics/SidebarBreakpoint>></$link><br>//<<lingo Metrics/SidebarBreakpoint/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth\"><<lingo Metrics/SidebarWidth>></$link><br>//<<lingo Metrics/SidebarWidth/Hint>>// |^<$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth\" default=\"\" tag=\"input\"/> |\n"
},
"$:/themes/tiddlywiki/vanilla/base": {
"title": "$:/themes/tiddlywiki/vanilla/base",
"tags": "[[$:/tags/Stylesheet]]",
"text": "\\define custom-background-datauri()\n<$set name=\"background\" value={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}}>\n<$list filter=\"[<background>is[image]]\">\n`background: url(`\n<$list filter=\"[<background>!has[_canonical_uri]]\">\n<$macrocall $name=\"datauri\" title={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}}/>\n</$list>\n<$list filter=\"[<background>has[_canonical_uri]]\">\n<$view tiddler={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}} field=\"_canonical_uri\"/>\n</$list>\n`) center center;`\n`background-attachment: `{{$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment}}`;\n-webkit-background-size:` {{$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize}}`;\n-moz-background-size:` {{$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize}}`;\n-o-background-size:` {{$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize}}`;\nbackground-size:` {{$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize}}`;`\n</$list>\n</$set>\n\\end\n\n\\define if-fluid-fixed(text,hiddenSidebarText)\n<$reveal state=\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\" type=\"match\" text=\"fluid-fixed\">\n$text$\n<$reveal state=\"$:/state/sidebar\" type=\"nomatch\" text=\"yes\" default=\"yes\">\n$hiddenSidebarText$\n</$reveal>\n</$reveal>\n\\end\n\n\\define if-editor-height-fixed(then,else)\n<$reveal state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"fixed\">\n$then$\n</$reveal>\n<$reveal state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"auto\">\n$else$\n</$reveal>\n\\end\n\n\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock\n\n/*\n** Start with the normalize CSS reset, and then belay some of its effects\n*/\n\n{{$:/themes/tiddlywiki/vanilla/reset}}\n\n*, input[type=\"search\"] {\n\tbox-sizing: border-box;\n\t-moz-box-sizing: border-box;\n\t-webkit-box-sizing: border-box;\n}\n\nhtml button {\n\tline-height: 1.2;\n\tcolor: <<colour button-foreground>>;\n\tbackground: <<colour button-background>>;\n\tborder-color: <<colour button-border>>;\n}\n\n/*\n** Basic element styles\n*/\n\nhtml {\n\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings/fontfamily}};\n\ttext-rendering: optimizeLegibility; /* Enables kerning and ligatures etc. */\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n\nhtml:-webkit-full-screen {\n\tbackground-color: <<colour page-background>>;\n}\n\nbody.tc-body {\n\tfont-size: {{$:/themes/tiddlywiki/vanilla/metrics/fontsize}};\n\tline-height: {{$:/themes/tiddlywiki/vanilla/metrics/lineheight}};\n\tword-wrap: break-word;\n\t<<custom-background-datauri>>\n\tcolor: <<colour foreground>>;\n\tbackground-color: <<colour page-background>>;\n\tfill: <<colour foreground>>;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tline-height: 1.2;\n\tfont-weight: 300;\n}\n\npre {\n\tdisplay: block;\n\tpadding: 14px;\n\tmargin-top: 1em;\n\tmargin-bottom: 1em;\n\tword-break: normal;\n\tword-wrap: break-word;\n\twhite-space: {{$:/themes/tiddlywiki/vanilla/options/codewrapping}};\n\tbackground-color: <<colour pre-background>>;\n\tborder: 1px solid <<colour pre-border>>;\n\tpadding: 0 3px 2px;\n\tborder-radius: 3px;\n\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\ncode {\n\tcolor: <<colour code-foreground>>;\n\tbackground-color: <<colour code-background>>;\n\tborder: 1px solid <<colour code-border>>;\n\twhite-space: {{$:/themes/tiddlywiki/vanilla/options/codewrapping}};\n\tpadding: 0 3px 2px;\n\tborder-radius: 3px;\n\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\nblockquote {\n\tborder-left: 5px solid <<colour blockquote-bar>>;\n\tmargin-left: 25px;\n\tpadding-left: 10px;\n\tquotes: \"\\201C\"\"\\201D\"\"\\2018\"\"\\2019\";\n}\n\nblockquote.tc-big-quote {\n\tfont-family: Georgia, serif;\n\tposition: relative;\n\tbackground: <<colour pre-background>>;\n\tborder-left: none;\n\tmargin-left: 50px;\n\tmargin-right: 50px;\n\tpadding: 10px;\n border-radius: 8px;\n}\n\nblockquote.tc-big-quote cite:before {\n\tcontent: \"\\2014 \\2009\";\n}\n\nblockquote.tc-big-quote:before {\n\tfont-family: Georgia, serif;\n\tcolor: <<colour blockquote-bar>>;\n\tcontent: open-quote;\n\tfont-size: 8em;\n\tline-height: 0.1em;\n\tmargin-right: 0.25em;\n\tvertical-align: -0.4em;\n\tposition: absolute;\n left: -50px;\n top: 42px;\n}\n\nblockquote.tc-big-quote:after {\n\tfont-family: Georgia, serif;\n\tcolor: <<colour blockquote-bar>>;\n\tcontent: close-quote;\n\tfont-size: 8em;\n\tline-height: 0.1em;\n\tmargin-right: 0.25em;\n\tvertical-align: -0.4em;\n\tposition: absolute;\n right: -80px;\n bottom: -20px;\n}\n\ndl dt {\n\tfont-weight: bold;\n\tmargin-top: 6px;\n}\n\ntextarea,\ninput[type=text],\ninput[type=search],\ninput[type=\"\"],\ninput:not([type]) {\n\tcolor: <<colour foreground>>;\n\tbackground: <<colour background>>;\n}\n\n.tc-muted {\n\tcolor: <<colour muted-foreground>>;\n}\n\nsvg.tc-image-button {\n\tpadding: 0px 1px 1px 0px;\n}\n\n.tc-icon-wrapper > svg {\n\twidth: 1em;\n\theight: 1em;\n}\n\nkbd {\n\tdisplay: inline-block;\n\tpadding: 3px 5px;\n\tfont-size: 0.8em;\n\tline-height: 1.2;\n\tcolor: <<colour foreground>>;\n\tvertical-align: middle;\n\tbackground-color: <<colour background>>;\n\tborder: solid 1px <<colour muted-foreground>>;\n\tborder-bottom-color: <<colour muted-foreground>>;\n\tborder-radius: 3px;\n\tbox-shadow: inset 0 -1px 0 <<colour muted-foreground>>;\n}\n\n/*\nMarkdown likes putting code elements inside pre elements\n*/\npre > code {\n\tpadding: 0;\n\tborder: none;\n\tbackground-color: inherit;\n\tcolor: inherit;\n}\n\ntable {\n\tborder: 1px solid <<colour table-border>>;\n\twidth: auto;\n\tmax-width: 100%;\n\tcaption-side: bottom;\n\tmargin-top: 1em;\n\tmargin-bottom: 1em;\n}\n\ntable th, table td {\n\tpadding: 0 7px 0 7px;\n\tborder-top: 1px solid <<colour table-border>>;\n\tborder-left: 1px solid <<colour table-border>>;\n}\n\ntable thead tr td, table th {\n\tbackground-color: <<colour table-header-background>>;\n\tfont-weight: bold;\n}\n\ntable tfoot tr td {\n\tbackground-color: <<colour table-footer-background>>;\n}\n\n.tc-csv-table {\n\twhite-space: nowrap;\n}\n\n.tc-tiddler-frame img,\n.tc-tiddler-frame svg,\n.tc-tiddler-frame canvas,\n.tc-tiddler-frame embed,\n.tc-tiddler-frame iframe {\n\tmax-width: 100%;\n}\n\n.tc-tiddler-body > embed,\n.tc-tiddler-body > iframe {\n\twidth: 100%;\n\theight: 600px;\n}\n\n/*\n** Links\n*/\n\nbutton.tc-tiddlylink,\na.tc-tiddlylink {\n\ttext-decoration: none;\n\tfont-weight: normal;\n\tcolor: <<colour tiddler-link-foreground>>;\n\t-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */\n}\n\n.tc-sidebar-lists a.tc-tiddlylink {\n\tcolor: <<colour sidebar-tiddler-link-foreground>>;\n}\n\n.tc-sidebar-lists a.tc-tiddlylink:hover {\n\tcolor: <<colour sidebar-tiddler-link-foreground-hover>>;\n}\n\nbutton.tc-tiddlylink:hover,\na.tc-tiddlylink:hover {\n\ttext-decoration: underline;\n}\n\na.tc-tiddlylink-resolves {\n}\n\na.tc-tiddlylink-shadow {\n\tfont-weight: bold;\n}\n\na.tc-tiddlylink-shadow.tc-tiddlylink-resolves {\n\tfont-weight: normal;\n}\n\na.tc-tiddlylink-missing {\n\tfont-style: italic;\n}\n\na.tc-tiddlylink-external {\n\ttext-decoration: underline;\n\tcolor: <<colour external-link-foreground>>;\n\tbackground-color: <<colour external-link-background>>;\n}\n\na.tc-tiddlylink-external:visited {\n\tcolor: <<colour external-link-foreground-visited>>;\n\tbackground-color: <<colour external-link-background-visited>>;\n}\n\na.tc-tiddlylink-external:hover {\n\tcolor: <<colour external-link-foreground-hover>>;\n\tbackground-color: <<colour external-link-background-hover>>;\n}\n\n/*\n** Drag and drop styles\n*/\n\n.tc-tiddler-dragger {\n\tposition: relative;\n\tz-index: -10000;\n}\n\n.tc-tiddler-dragger-inner {\n\tposition: absolute;\n\ttop: -1000px;\n\tleft: -1000px;\n\tdisplay: inline-block;\n\tpadding: 8px 20px;\n\tfont-size: 16.9px;\n\tfont-weight: bold;\n\tline-height: 20px;\n\tcolor: <<colour dragger-foreground>>;\n\ttext-shadow: 0 1px 0 rgba(0, 0, 0, 1);\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: <<colour dragger-background>>;\n\tborder-radius: 20px;\n}\n\n.tc-tiddler-dragger-cover {\n\tposition: absolute;\n\tbackground-color: <<colour page-background>>;\n}\n\n.tc-dropzone {\n\tposition: relative;\n}\n\n.tc-dropzone.tc-dragover:before {\n\tz-index: 10000;\n\tdisplay: block;\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground: <<colour dropzone-background>>;\n\ttext-align: center;\n\tcontent: \"<<lingo DropMessage>>\";\n}\n\n.tc-droppable > .tc-droppable-placeholder {\n\tdisplay: none;\n}\n\n.tc-droppable.tc-dragover > .tc-droppable-placeholder {\n\tdisplay: block;\n\tborder: 2px dashed <<colour dropzone-background>>;\n}\n\n.tc-draggable {\n\tcursor: move;\n}\n\n/*\n** Plugin reload warning\n*/\n\n.tc-plugin-reload-warning {\n\tz-index: 1000;\n\tdisplay: block;\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground: <<colour alert-background>>;\n\ttext-align: center;\n}\n\n/*\n** Buttons\n*/\n\nbutton svg, button img, label svg, label img {\n\tvertical-align: middle;\n}\n\n.tc-btn-invisible {\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: none;\n\tborder: none;\n cursor: pointer;\n}\n\n.tc-btn-boxed {\n\tfont-size: 0.6em;\n\tpadding: 0.2em;\n\tmargin: 1px;\n\tbackground: none;\n\tborder: 1px solid <<colour tiddler-controls-foreground>>;\n\tborder-radius: 0.25em;\n}\n\nhtml body.tc-body .tc-btn-boxed svg {\n\tfont-size: 1.6666em;\n}\n\n.tc-btn-boxed:hover {\n\tbackground: <<colour muted-foreground>>;\n\tcolor: <<colour background>>;\n}\n\nhtml body.tc-body .tc-btn-boxed:hover svg {\n\tfill: <<colour background>>;\n}\n\n.tc-btn-rounded {\n\tfont-size: 0.5em;\n\tline-height: 2;\n\tpadding: 0em 0.3em 0.2em 0.4em;\n\tmargin: 1px;\n\tborder: 1px solid <<colour muted-foreground>>;\n\tbackground: <<colour muted-foreground>>;\n\tcolor: <<colour background>>;\n\tborder-radius: 2em;\n}\n\nhtml body.tc-body .tc-btn-rounded svg {\n\tfont-size: 1.6666em;\n\tfill: <<colour background>>;\n}\n\n.tc-btn-rounded:hover {\n\tborder: 1px solid <<colour muted-foreground>>;\n\tbackground: <<colour background>>;\n\tcolor: <<colour muted-foreground>>;\n}\n\nhtml body.tc-body .tc-btn-rounded:hover svg {\n\tfill: <<colour muted-foreground>>;\n}\n\n.tc-btn-icon svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: <<colour muted-foreground>>;\n}\n\n.tc-btn-text {\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.tc-btn-big-green {\n\tdisplay: inline-block;\n\tpadding: 8px;\n\tmargin: 4px 8px 4px 8px;\n\tbackground: <<colour download-background>>;\n\tcolor: <<colour download-foreground>>;\n\tfill: <<colour download-foreground>>;\n\tborder: none;\n\tfont-size: 1.2em;\n\tline-height: 1.4em;\n\ttext-decoration: none;\n}\n\n.tc-btn-big-green svg,\n.tc-btn-big-green img {\n\theight: 2em;\n\twidth: 2em;\n\tvertical-align: middle;\n\tfill: <<colour download-foreground>>;\n}\n\n.tc-sidebar-lists input {\n\tcolor: <<colour foreground>>;\n}\n\n.tc-sidebar-lists button {\n\tcolor: <<colour sidebar-button-foreground>>;\n\tfill: <<colour sidebar-button-foreground>>;\n}\n\n.tc-sidebar-lists button.tc-btn-mini {\n\tcolor: <<colour sidebar-muted-foreground>>;\n}\n\n.tc-sidebar-lists button.tc-btn-mini:hover {\n\tcolor: <<colour sidebar-muted-foreground-hover>>;\n}\n\nbutton svg.tc-image-button, button .tc-image-button img {\n\theight: 1em;\n\twidth: 1em;\n}\n\n.tc-unfold-banner {\n\tposition: absolute;\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: none;\n\tborder: none;\n\twidth: 100%;\n\twidth: calc(100% + 2px);\n\tmargin-left: -43px;\n\ttext-align: center;\n\tborder-top: 2px solid <<colour tiddler-info-background>>;\n\tmargin-top: 4px;\n}\n\n.tc-unfold-banner:hover {\n\tbackground: <<colour tiddler-info-background>>;\n\tborder-top: 2px solid <<colour tiddler-info-border>>;\n}\n\n.tc-unfold-banner svg, .tc-fold-banner svg {\n\theight: 0.75em;\n\tfill: <<colour tiddler-controls-foreground>>;\n}\n\n.tc-unfold-banner:hover svg, .tc-fold-banner:hover svg {\n\tfill: <<colour tiddler-controls-foreground-hover>>;\n}\n\n.tc-fold-banner {\n\tposition: absolute;\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: none;\n\tborder: none;\n\twidth: 23px;\n\ttext-align: center;\n\tmargin-left: -35px;\n\ttop: 6px;\n\tbottom: 6px;\n}\n\n.tc-fold-banner:hover {\n\tbackground: <<colour tiddler-info-background>>;\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-unfold-banner {\n\t\tposition: static;\n\t\twidth: calc(100% + 59px);\n\t}\n\n\t.tc-fold-banner {\n\t\twidth: 16px;\n\t\tmargin-left: -16px;\n\t\tfont-size: 0.75em;\n\t}\n\n}\n\n/*\n** Tags and missing tiddlers\n*/\n\n.tc-tag-list-item {\n\tposition: relative;\n\tdisplay: inline-block;\n\tmargin-right: 7px;\n}\n\n.tc-tags-wrapper {\n\tmargin: 4px 0 14px 0;\n}\n\n.tc-missing-tiddler-label {\n\tfont-style: italic;\n\tfont-weight: normal;\n\tdisplay: inline-block;\n\tfont-size: 11.844px;\n\tline-height: 14px;\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n}\n\nbutton.tc-tag-label, span.tc-tag-label {\n\tdisplay: inline-block;\n\tpadding: 0.16em 0.7em;\n\tfont-size: 0.9em;\n\tfont-weight: 400;\n\tline-height: 1.2em;\n\tcolor: <<colour tag-foreground>>;\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: <<colour tag-background>>;\n\tborder-radius: 1em;\n}\n\n.tc-untagged-separator {\n\twidth: 10em;\n\tleft: 0;\n\tmargin-left: 0;\n\tborder: 0;\n\theight: 1px;\n\tbackground: <<colour tab-divider>>;\n}\n\nbutton.tc-untagged-label {\n\tbackground-color: <<colour untagged-background>>;\n}\n\n.tc-tag-label svg, .tc-tag-label img {\n\theight: 1em;\n\twidth: 1em;\n\tfill: <<colour tag-foreground>>;\n\tvertical-align: text-bottom;\n}\n\n.tc-tag-manager-table .tc-tag-label {\n\twhite-space: normal;\n}\n\n.tc-tag-manager-tag {\n\twidth: 100%;\n}\n\n/*\n** Page layout\n*/\n\n.tc-topbar {\n\tposition: fixed;\n\tz-index: 1200;\n}\n\n.tc-topbar-left {\n\tleft: 29px;\n\ttop: 5px;\n}\n\n.tc-topbar-right {\n\ttop: 5px;\n\tright: 29px;\n}\n\n.tc-topbar button {\n\tpadding: 8px;\n}\n\n.tc-topbar svg {\n\tfill: <<colour muted-foreground>>;\n}\n\n.tc-topbar button:hover svg {\n\tfill: <<colour foreground>>;\n}\n\n.tc-sidebar-header {\n\tcolor: <<colour sidebar-foreground>>;\n\tfill: <<colour sidebar-foreground>>;\n}\n\n.tc-sidebar-header .tc-title a.tc-tiddlylink-resolves {\n\tfont-weight: 300;\n}\n\n.tc-sidebar-header .tc-sidebar-lists p {\n\tmargin-top: 3px;\n\tmargin-bottom: 3px;\n}\n\n.tc-sidebar-header .tc-missing-tiddler-label {\n\tcolor: <<colour sidebar-foreground>>;\n}\n\n.tc-advanced-search input {\n\twidth: 60%;\n}\n\n.tc-search a svg {\n\twidth: 1.2em;\n\theight: 1.2em;\n\tvertical-align: middle;\n}\n\n.tc-page-controls {\n\tmargin-top: 14px;\n\tfont-size: 1.5em;\n}\n\n.tc-page-controls button {\n\tmargin-right: 0.5em;\n}\n\n.tc-page-controls a.tc-tiddlylink:hover {\n\ttext-decoration: none;\n}\n\n.tc-page-controls img {\n\twidth: 1em;\n}\n\n.tc-page-controls svg {\n\tfill: <<colour sidebar-controls-foreground>>;\n}\n\n.tc-page-controls button:hover svg, .tc-page-controls a:hover svg {\n\tfill: <<colour sidebar-controls-foreground-hover>>;\n}\n\n.tc-menu-list-item {\n\twhite-space: nowrap;\n}\n\n.tc-menu-list-count {\n\tfont-weight: bold;\n}\n\n.tc-menu-list-subitem {\n\tpadding-left: 7px;\n}\n\n.tc-story-river {\n\tposition: relative;\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-sidebar-header {\n\t\tpadding: 14px;\n\t\tmin-height: 32px;\n\t\tmargin-top: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}};\n\t}\n\n\t.tc-story-river {\n\t\tposition: relative;\n\t\tpadding: 0;\n\t}\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-message-box {\n\t\tmargin: 21px -21px 21px -21px;\n\t}\n\n\t.tc-sidebar-scrollable {\n\t\tposition: fixed;\n\t\ttop: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}};\n\t\tleft: {{$:/themes/tiddlywiki/vanilla/metrics/storyright}};\n\t\tbottom: 0;\n\t\tright: 0;\n\t\toverflow-y: auto;\n\t\toverflow-x: auto;\n\t\t-webkit-overflow-scrolling: touch;\n\t\tmargin: 0 0 0 -42px;\n\t\tpadding: 71px 0 28px 42px;\n\t}\n\n\thtml[dir=\"rtl\"] .tc-sidebar-scrollable {\n\t\tleft: auto;\n\t\tright: {{$:/themes/tiddlywiki/vanilla/metrics/storyright}};\n\t}\n\n\t.tc-story-river {\n\t\tposition: relative;\n\t\tleft: {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}};\n\t\ttop: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}};\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics/storywidth}};\n\t\tpadding: 42px 42px 42px 42px;\n\t}\n\n<<if-no-sidebar \"\n\n\t.tc-story-river {\n\t\twidth: calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}});\n\t}\n\n\">>\n\n}\n\n@media print {\n\n\tbody.tc-body {\n\t\tbackground-color: transparent;\n\t}\n\n\t.tc-sidebar-header, .tc-topbar {\n\t\tdisplay: none;\n\t}\n\n\t.tc-story-river {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t}\n\n\t.tc-story-river .tc-tiddler-frame {\n\t\tmargin: 0;\n\t\tborder: none;\n\t\tpadding: 0;\n\t}\n}\n\n/*\n** Tiddler styles\n*/\n\n.tc-tiddler-frame {\n\tposition: relative;\n\tmargin-bottom: 28px;\n\tbackground-color: <<colour tiddler-background>>;\n\tborder: 1px solid <<colour tiddler-border>>;\n}\n\n{{$:/themes/tiddlywiki/vanilla/sticky}}\n\n.tc-tiddler-info {\n\tpadding: 14px 42px 14px 42px;\n\tbackground-color: <<colour tiddler-info-background>>;\n\tborder-top: 1px solid <<colour tiddler-info-border>>;\n\tborder-bottom: 1px solid <<colour tiddler-info-border>>;\n}\n\n.tc-tiddler-info p {\n\tmargin-top: 3px;\n\tmargin-bottom: 3px;\n}\n\n.tc-tiddler-info .tc-tab-buttons button.tc-tab-selected {\n\tbackground-color: <<colour tiddler-info-tab-background>>;\n\tborder-bottom: 1px solid <<colour tiddler-info-tab-background>>;\n}\n\n.tc-view-field-table {\n\twidth: 100%;\n}\n\n.tc-view-field-name {\n\twidth: 1%; /* Makes this column be as narrow as possible */\n\ttext-align: right;\n\tfont-style: italic;\n\tfont-weight: 200;\n}\n\n.tc-view-field-value {\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\t.tc-tiddler-frame {\n\t\tpadding: 14px 14px 14px 14px;\n\t}\n\n\t.tc-tiddler-info {\n\t\tmargin: 0 -14px 0 -14px;\n\t}\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\t.tc-tiddler-frame {\n\t\tpadding: 28px 42px 42px 42px;\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth}};\n\t\tborder-radius: 2px;\n\t}\n\n<<if-no-sidebar \"\n\n\t.tc-tiddler-frame {\n\t\twidth: 100%;\n\t}\n\n\">>\n\n\t.tc-tiddler-info {\n\t\tmargin: 0 -42px 0 -42px;\n\t}\n}\n\n.tc-site-title,\n.tc-titlebar {\n\tfont-weight: 300;\n\tfont-size: 2.35em;\n\tline-height: 1.2em;\n\tcolor: <<colour tiddler-title-foreground>>;\n\tmargin: 0;\n}\n\n.tc-site-title {\n\tcolor: <<colour site-title-foreground>>;\n}\n\n.tc-tiddler-title-icon {\n\tvertical-align: middle;\n}\n\n.tc-system-title-prefix {\n\tcolor: <<colour muted-foreground>>;\n}\n\n.tc-titlebar h2 {\n\tfont-size: 1em;\n\tdisplay: inline;\n}\n\n.tc-titlebar img {\n\theight: 1em;\n}\n\n.tc-subtitle {\n\tfont-size: 0.9em;\n\tcolor: <<colour tiddler-subtitle-foreground>>;\n\tfont-weight: 300;\n}\n\n.tc-tiddler-missing .tc-title {\n font-style: italic;\n font-weight: normal;\n}\n\n.tc-tiddler-frame .tc-tiddler-controls {\n\tfloat: right;\n}\n\n.tc-tiddler-controls .tc-drop-down {\n\tfont-size: 0.6em;\n}\n\n.tc-tiddler-controls .tc-drop-down .tc-drop-down {\n\tfont-size: 1em;\n}\n\n.tc-tiddler-controls > span > button {\n\tvertical-align: baseline;\n\tmargin-left:5px;\n}\n\n.tc-tiddler-controls button svg, .tc-tiddler-controls button img,\n.tc-search button svg, .tc-search a svg {\n\tfill: <<colour tiddler-controls-foreground>>;\n}\n\n.tc-tiddler-controls button svg, .tc-tiddler-controls button img {\n\theight: 0.75em;\n}\n\n.tc-search button svg, .tc-search a svg {\n height: 1.2em;\n width: 1.2em;\n margin: 0 0.25em;\n}\n\n.tc-tiddler-controls button.tc-selected svg,\n.tc-page-controls button.tc-selected svg {\n\tfill: <<colour tiddler-controls-foreground-selected>>;\n}\n\n.tc-tiddler-controls button.tc-btn-invisible:hover svg,\n.tc-search button:hover svg, .tc-search a:hover svg {\n\tfill: <<colour tiddler-controls-foreground-hover>>;\n}\n\n@media print {\n\t.tc-tiddler-controls {\n\t\tdisplay: none;\n\t}\n}\n\n.tc-tiddler-help { /* Help prompts within tiddler template */\n\tcolor: <<colour muted-foreground>>;\n\tmargin-top: 14px;\n}\n\n.tc-tiddler-help a.tc-tiddlylink {\n\tcolor: <<colour very-muted-foreground>>;\n}\n\n.tc-tiddler-frame .tc-edit-texteditor {\n\twidth: 100%;\n\tmargin: 4px 0 4px 0;\n}\n\n.tc-tiddler-frame input.tc-edit-texteditor,\n.tc-tiddler-frame textarea.tc-edit-texteditor,\n.tc-tiddler-frame iframe.tc-edit-texteditor {\n\tpadding: 3px 3px 3px 3px;\n\tborder: 1px solid <<colour tiddler-editor-border>>;\n\tbackground-color: <<colour tiddler-editor-background>>;\n\tline-height: 1.3em;\n\t-webkit-appearance: none;\n}\n\n.tc-tiddler-frame .tc-binary-warning {\n\twidth: 100%;\n\theight: 5em;\n\ttext-align: center;\n\tpadding: 3em 3em 6em 3em;\n\tbackground: <<colour alert-background>>;\n\tborder: 1px solid <<colour alert-border>>;\n}\n\ncanvas.tc-edit-bitmapeditor {\n\tborder: 6px solid <<colour tiddler-editor-border-image>>;\n\tcursor: crosshair;\n\t-moz-user-select: none;\n\t-webkit-user-select: none;\n\t-ms-user-select: none;\n\tmargin-top: 6px;\n\tmargin-bottom: 6px;\n}\n\n.tc-edit-bitmapeditor-width {\n\tdisplay: block;\n}\n\n.tc-edit-bitmapeditor-height {\n\tdisplay: block;\n}\n\n.tc-tiddler-body {\n\tclear: both;\n}\n\n.tc-tiddler-frame .tc-tiddler-body {\n\tfont-size: {{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}};\n\tline-height: {{$:/themes/tiddlywiki/vanilla/metrics/bodylineheight}};\n}\n\n.tc-titlebar, .tc-tiddler-edit-title {\n\toverflow: hidden; /* https://github.com/Jermolene/TiddlyWiki5/issues/282 */\n}\n\nhtml body.tc-body.tc-single-tiddler-window {\n\tmargin: 1em;\n\tbackground: <<colour tiddler-background>>;\n}\n\n.tc-single-tiddler-window img,\n.tc-single-tiddler-window svg,\n.tc-single-tiddler-window canvas,\n.tc-single-tiddler-window embed,\n.tc-single-tiddler-window iframe {\n\tmax-width: 100%;\n}\n\n/*\n** Editor\n*/\n\n.tc-editor-toolbar {\n\tmargin-top: 8px;\n}\n\n.tc-editor-toolbar button {\n\tvertical-align: middle;\n\tbackground-color: <<colour tiddler-controls-foreground>>;\n\tfill: <<colour tiddler-controls-foreground-selected>>;\n\tborder-radius: 4px;\n\tpadding: 3px;\n\tmargin: 2px 0 2px 4px;\n}\n\n.tc-editor-toolbar button.tc-text-editor-toolbar-item-adjunct {\n\tmargin-left: 1px;\n\twidth: 1em;\n\tborder-radius: 8px;\n}\n\n.tc-editor-toolbar button.tc-text-editor-toolbar-item-start-group {\n\tmargin-left: 11px;\n}\n\n.tc-editor-toolbar button.tc-selected {\n\tbackground-color: <<colour primary>>;\n}\n\n.tc-editor-toolbar button svg {\n\twidth: 1.6em;\n\theight: 1.2em;\n}\n\n.tc-editor-toolbar button:hover {\n\tbackground-color: <<colour tiddler-controls-foreground-selected>>;\n\tfill: <<colour background>>;\n}\n\n.tc-editor-toolbar .tc-text-editor-toolbar-more {\n\twhite-space: normal;\n}\n\n.tc-editor-toolbar .tc-text-editor-toolbar-more button {\n\tdisplay: inline-block;\n\tpadding: 3px;\n\twidth: auto;\n}\n\n.tc-editor-toolbar .tc-search-results {\n\tpadding: 0;\n}\n\n/*\n** Adjustments for fluid-fixed mode\n*/\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n<<if-fluid-fixed text:\"\"\"\n\n\t.tc-story-river {\n\t\tpadding-right: 0;\n\t\tposition: relative;\n\t\twidth: auto;\n\t\tleft: 0;\n\t\tmargin-left: {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}};\n\t\tmargin-right: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}};\n\t}\n\n\t.tc-tiddler-frame {\n\t\twidth: 100%;\n\t}\n\n\t.tc-sidebar-scrollable {\n\t\tleft: auto;\n\t\tbottom: 0;\n\t\tright: 0;\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}};\n\t}\n\n\tbody.tc-body .tc-storyview-zoomin-tiddler {\n\t\twidth: 100%;\n\t\twidth: calc(100% - 42px);\n\t}\n\n\"\"\" hiddenSidebarText:\"\"\"\n\n\t.tc-story-river {\n\t\tpadding-right: 3em;\n\t\tmargin-right: 0;\n\t}\n\n\tbody.tc-body .tc-storyview-zoomin-tiddler {\n\t\twidth: 100%;\n\t\twidth: calc(100% - 84px);\n\t}\n\n\"\"\">>\n\n}\n\n/*\n** Toolbar buttons\n*/\n\n.tc-page-controls svg.tc-image-new-button {\n fill: <<colour toolbar-new-button>>;\n}\n\n.tc-page-controls svg.tc-image-options-button {\n fill: <<colour toolbar-options-button>>;\n}\n\n.tc-page-controls svg.tc-image-save-button {\n fill: <<colour toolbar-save-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-info-button {\n fill: <<colour toolbar-info-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-edit-button {\n fill: <<colour toolbar-edit-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-close-button {\n fill: <<colour toolbar-close-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-delete-button {\n fill: <<colour toolbar-delete-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-cancel-button {\n fill: <<colour toolbar-cancel-button>>;\n}\n\n.tc-tiddler-controls button svg.tc-image-done-button {\n fill: <<colour toolbar-done-button>>;\n}\n\n/*\n** Tiddler edit mode\n*/\n\n.tc-tiddler-edit-frame em.tc-edit {\n\tcolor: <<colour muted-foreground>>;\n\tfont-style: normal;\n}\n\n.tc-edit-type-dropdown a.tc-tiddlylink-missing {\n\tfont-style: normal;\n}\n\n.tc-edit-tags {\n\tborder: 1px solid <<colour tiddler-editor-border>>;\n\tpadding: 4px 8px 4px 8px;\n}\n\n.tc-edit-add-tag {\n\tdisplay: inline-block;\n}\n\n.tc-edit-add-tag .tc-add-tag-name input {\n\twidth: 50%;\n}\n\n.tc-edit-add-tag .tc-keyboard {\n\tdisplay:inline;\n}\n\n.tc-edit-tags .tc-tag-label {\n\tdisplay: inline-block;\n}\n\n.tc-edit-tags-list {\n\tmargin: 14px 0 14px 0;\n}\n\n.tc-remove-tag-button {\n\tpadding-left: 4px;\n}\n\n.tc-tiddler-preview {\n\toverflow: auto;\n}\n\n.tc-tiddler-preview-preview {\n\tfloat: right;\n\twidth: 49%;\n\tborder: 1px solid <<colour tiddler-editor-border>>;\n\tmargin: 4px 0 3px 3px;\n\tpadding: 3px 3px 3px 3px;\n}\n\n<<if-editor-height-fixed then:\"\"\"\n\n.tc-tiddler-preview-preview {\n\toverflow-y: scroll;\n\theight: {{$:/config/TextEditor/EditorHeight/Height}};\n}\n\n\"\"\">>\n\n.tc-tiddler-frame .tc-tiddler-preview .tc-edit-texteditor {\n\twidth: 49%;\n}\n\n.tc-tiddler-frame .tc-tiddler-preview canvas.tc-edit-bitmapeditor {\n\tmax-width: 49%;\n}\n\n.tc-edit-fields {\n\twidth: 100%;\n}\n\n\n.tc-edit-fields table, .tc-edit-fields tr, .tc-edit-fields td {\n\tborder: none;\n\tpadding: 4px;\n}\n\n.tc-edit-fields > tbody > .tc-edit-field:nth-child(odd) {\n\tbackground-color: <<colour tiddler-editor-fields-odd>>;\n}\n\n.tc-edit-fields > tbody > .tc-edit-field:nth-child(even) {\n\tbackground-color: <<colour tiddler-editor-fields-even>>;\n}\n\n.tc-edit-field-name {\n\ttext-align: right;\n}\n\n.tc-edit-field-value input {\n\twidth: 100%;\n}\n\n.tc-edit-field-remove {\n}\n\n.tc-edit-field-remove svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: <<colour muted-foreground>>;\n\tvertical-align: middle;\n}\n\n.tc-edit-field-add-name {\n\tdisplay: inline-block;\n\twidth: 15%;\n}\n\n.tc-edit-field-add-value {\n\tdisplay: inline-block;\n\twidth: 40%;\n}\n\n.tc-edit-field-add-button {\n\tdisplay: inline-block;\n\twidth: 10%;\n}\n\n/*\n** Storyview Classes\n*/\n\n.tc-storyview-zoomin-tiddler {\n\tposition: absolute;\n\tdisplay: block;\n\twidth: 100%;\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-storyview-zoomin-tiddler {\n\t\twidth: calc(100% - 84px);\n\t}\n\n}\n\n/*\n** Dropdowns\n*/\n\n.tc-btn-dropdown {\n\ttext-align: left;\n}\n\n.tc-btn-dropdown svg, .tc-btn-dropdown img {\n\theight: 1em;\n\twidth: 1em;\n\tfill: <<colour muted-foreground>>;\n}\n\n.tc-drop-down-wrapper {\n\tposition: relative;\n}\n\n.tc-drop-down {\n\tmin-width: 380px;\n\tborder: 1px solid <<colour dropdown-border>>;\n\tbackground-color: <<colour dropdown-background>>;\n\tpadding: 7px 0 7px 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n\ttext-shadow: none;\n\tline-height: 1.4;\n}\n\n.tc-drop-down .tc-drop-down {\n\tmargin-left: 14px;\n}\n\n.tc-drop-down button svg, .tc-drop-down a svg {\n\tfill: <<colour foreground>>;\n}\n\n.tc-drop-down button.tc-btn-invisible:hover svg {\n\tfill: <<colour foreground>>;\n}\n\n.tc-drop-down p {\n\tpadding: 0 14px 0 14px;\n}\n\n.tc-drop-down svg {\n\twidth: 1em;\n\theight: 1em;\n}\n\n.tc-drop-down img {\n\twidth: 1em;\n}\n\n.tc-drop-down-language-chooser img {\n\twidth: 2em;\n\tvertical-align: baseline;\n}\n\n.tc-drop-down a, .tc-drop-down button {\n\tdisplay: block;\n\tpadding: 0 14px 0 14px;\n\twidth: 100%;\n\ttext-align: left;\n\tcolor: <<colour foreground>>;\n\tline-height: 1.4;\n}\n\n.tc-drop-down .tc-tab-set .tc-tab-buttons button {\n\tdisplay: inline-block;\n width: auto;\n margin-bottom: 0px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.tc-drop-down .tc-prompt {\n\tpadding: 0 14px;\n}\n\n.tc-drop-down .tc-chooser {\n\tborder: none;\n}\n\n.tc-drop-down .tc-chooser .tc-swatches-horiz {\n\tfont-size: 0.4em;\n\tpadding-left: 1.2em;\n}\n\n.tc-drop-down .tc-file-input-wrapper {\n\twidth: 100%;\n}\n\n.tc-drop-down .tc-file-input-wrapper button {\n\tcolor: <<colour foreground>>;\n}\n\n.tc-drop-down a:hover, .tc-drop-down button:hover, .tc-drop-down .tc-file-input-wrapper:hover button {\n\tcolor: <<colour tiddler-link-background>>;\n\tbackground-color: <<colour tiddler-link-foreground>>;\n\ttext-decoration: none;\n}\n\n.tc-drop-down .tc-tab-buttons button {\n\tbackground-color: <<colour dropdown-tab-background>>;\n}\n\n.tc-drop-down .tc-tab-buttons button.tc-tab-selected {\n\tbackground-color: <<colour dropdown-tab-background-selected>>;\n\tborder-bottom: 1px solid <<colour dropdown-tab-background-selected>>;\n}\n\n.tc-drop-down-bullet {\n\tdisplay: inline-block;\n\twidth: 0.5em;\n}\n\n.tc-drop-down .tc-tab-contents a {\n\tpadding: 0 0.5em 0 0.5em;\n}\n\n.tc-block-dropdown-wrapper {\n\tposition: relative;\n}\n\n.tc-block-dropdown {\n\tposition: absolute;\n\tmin-width: 220px;\n\tborder: 1px solid <<colour dropdown-border>>;\n\tbackground-color: <<colour dropdown-background>>;\n\tpadding: 7px 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n\tz-index: 1000;\n\ttext-shadow: none;\n}\n\n.tc-block-dropdown.tc-search-drop-down {\n\tmargin-left: -12px;\n}\n\n.tc-block-dropdown a {\n\tdisplay: block;\n\tpadding: 4px 14px 4px 14px;\n}\n\n.tc-block-dropdown.tc-search-drop-down a {\n\tdisplay: block;\n\tpadding: 0px 10px 0px 10px;\n}\n\n.tc-drop-down .tc-dropdown-item-plain,\n.tc-block-dropdown .tc-dropdown-item-plain {\n\tpadding: 4px 14px 4px 7px;\n}\n\n.tc-drop-down .tc-dropdown-item,\n.tc-block-dropdown .tc-dropdown-item {\n\tpadding: 4px 14px 4px 7px;\n\tcolor: <<colour muted-foreground>>;\n}\n\n.tc-block-dropdown a:hover {\n\tcolor: <<colour tiddler-link-background>>;\n\tbackground-color: <<colour tiddler-link-foreground>>;\n\ttext-decoration: none;\n}\n\n.tc-search-results {\n\tpadding: 0 7px 0 7px;\n}\n\n.tc-image-chooser, .tc-colour-chooser {\n\twhite-space: normal;\n}\n\n.tc-image-chooser a,\n.tc-colour-chooser a {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\ttext-align: center;\n\tposition: relative;\n}\n\n.tc-image-chooser a {\n\tborder: 1px solid <<colour muted-foreground>>;\n\tpadding: 2px;\n\tmargin: 2px;\n\twidth: 4em;\n\theight: 4em;\n}\n\n.tc-colour-chooser a {\n\tpadding: 3px;\n\twidth: 2em;\n\theight: 2em;\n\tvertical-align: middle;\n}\n\n.tc-image-chooser a:hover,\n.tc-colour-chooser a:hover {\n\tbackground: <<colour primary>>;\n\tpadding: 0px;\n\tborder: 3px solid <<colour primary>>;\n}\n\n.tc-image-chooser a svg,\n.tc-image-chooser a img {\n\tdisplay: inline-block;\n\twidth: auto;\n\theight: auto;\n\tmax-width: 3.5em;\n\tmax-height: 3.5em;\n\tposition: absolute;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tmargin: auto;\n}\n\n/*\n** Modals\n*/\n\n.tc-modal-wrapper {\n\tposition: fixed;\n\toverflow: auto;\n\toverflow-y: scroll;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\tz-index: 900;\n}\n\n.tc-modal-backdrop {\n\tposition: fixed;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\tz-index: 1000;\n\tbackground-color: <<colour modal-backdrop>>;\n}\n\n.tc-modal {\n\tz-index: 1100;\n\tbackground-color: <<colour modal-background>>;\n\tborder: 1px solid <<colour modal-border>>;\n}\n\n@media (max-width: 55em) {\n\t.tc-modal {\n\t\tposition: fixed;\n\t\ttop: 1em;\n\t\tleft: 1em;\n\t\tright: 1em;\n\t}\n\n\t.tc-modal-body {\n\t\toverflow-y: auto;\n\t\tmax-height: 400px;\n\t\tmax-height: 60vh;\n\t}\n}\n\n@media (min-width: 55em) {\n\t.tc-modal {\n\t\tposition: fixed;\n\t\ttop: 2em;\n\t\tleft: 25%;\n\t\twidth: 50%;\n\t}\n\n\t.tc-modal-body {\n\t\toverflow-y: auto;\n\t\tmax-height: 400px;\n\t\tmax-height: 60vh;\n\t}\n}\n\n.tc-modal-header {\n\tpadding: 9px 15px;\n\tborder-bottom: 1px solid <<colour modal-header-border>>;\n}\n\n.tc-modal-header h3 {\n\tmargin: 0;\n\tline-height: 30px;\n}\n\n.tc-modal-header img, .tc-modal-header svg {\n\twidth: 1em;\n\theight: 1em;\n}\n\n.tc-modal-body {\n\tpadding: 15px;\n}\n\n.tc-modal-footer {\n\tpadding: 14px 15px 15px;\n\tmargin-bottom: 0;\n\ttext-align: right;\n\tbackground-color: <<colour modal-footer-background>>;\n\tborder-top: 1px solid <<colour modal-footer-border>>;\n}\n\n/*\n** Notifications\n*/\n\n.tc-notification {\n\tposition: fixed;\n\ttop: 14px;\n\tright: 42px;\n\tz-index: 1300;\n\tmax-width: 280px;\n\tpadding: 0 14px 0 14px;\n\tbackground-color: <<colour notification-background>>;\n\tborder: 1px solid <<colour notification-border>>;\n}\n\n/*\n** Tabs\n*/\n\n.tc-tab-set.tc-vertical {\n\tdisplay: -webkit-flex;\n\tdisplay: flex;\n}\n\n.tc-tab-buttons {\n\tfont-size: 0.85em;\n\tpadding-top: 1em;\n\tmargin-bottom: -2px;\n}\n\n.tc-tab-buttons.tc-vertical {\n\tz-index: 100;\n\tdisplay: block;\n\tpadding-top: 14px;\n\tvertical-align: top;\n\ttext-align: right;\n\tmargin-bottom: inherit;\n\tmargin-right: -1px;\n\tmax-width: 33%;\n\t-webkit-flex: 0 0 auto;\n\tflex: 0 0 auto;\n}\n\n.tc-tab-buttons button.tc-tab-selected {\n\tcolor: <<colour tab-foreground-selected>>;\n\tbackground-color: <<colour tab-background-selected>>;\n\tborder-left: 1px solid <<colour tab-border-selected>>;\n\tborder-top: 1px solid <<colour tab-border-selected>>;\n\tborder-right: 1px solid <<colour tab-border-selected>>;\n}\n\n.tc-tab-buttons button {\n\tcolor: <<colour tab-foreground>>;\n\tpadding: 3px 5px 3px 5px;\n\tmargin-right: 0.3em;\n\tfont-weight: 300;\n\tborder: none;\n\tbackground: inherit;\n\tbackground-color: <<colour tab-background>>;\n\tborder-left: 1px solid <<colour tab-border>>;\n\tborder-top: 1px solid <<colour tab-border>>;\n\tborder-right: 1px solid <<colour tab-border>>;\n\tborder-top-left-radius: 2px;\n\tborder-top-right-radius: 2px;\n}\n\n.tc-tab-buttons.tc-vertical button {\n\tdisplay: block;\n\twidth: 100%;\n\tmargin-top: 3px;\n\tmargin-right: 0;\n\ttext-align: right;\n\tbackground-color: <<colour tab-background>>;\n\tborder-left: 1px solid <<colour tab-border>>;\n\tborder-bottom: 1px solid <<colour tab-border>>;\n\tborder-right: none;\n\tborder-top-left-radius: 2px;\n\tborder-bottom-left-radius: 2px;\n}\n\n.tc-tab-buttons.tc-vertical button.tc-tab-selected {\n\tbackground-color: <<colour tab-background-selected>>;\n\tborder-right: 1px solid <<colour tab-background-selected>>;\n}\n\n.tc-tab-divider {\n\tborder-top: 1px solid <<colour tab-divider>>;\n}\n\n.tc-tab-divider.tc-vertical {\n\tdisplay: none;\n}\n\n.tc-tab-content {\n\tmargin-top: 14px;\n}\n\n.tc-tab-content.tc-vertical {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tpadding-top: 0;\n\tpadding-left: 14px;\n\tborder-left: 1px solid <<colour tab-border>>;\n\t-webkit-flex: 1 0 70%;\n\tflex: 1 0 70%;\n}\n\n.tc-sidebar-lists .tc-tab-buttons {\n\tmargin-bottom: -1px;\n}\n\n.tc-sidebar-lists .tc-tab-buttons button.tc-tab-selected {\n\tbackground-color: <<colour sidebar-tab-background-selected>>;\n\tcolor: <<colour sidebar-tab-foreground-selected>>;\n\tborder-left: 1px solid <<colour sidebar-tab-border-selected>>;\n\tborder-top: 1px solid <<colour sidebar-tab-border-selected>>;\n\tborder-right: 1px solid <<colour sidebar-tab-border-selected>>;\n}\n\n.tc-sidebar-lists .tc-tab-buttons button {\n\tbackground-color: <<colour sidebar-tab-background>>;\n\tcolor: <<colour sidebar-tab-foreground>>;\n\tborder-left: 1px solid <<colour sidebar-tab-border>>;\n\tborder-top: 1px solid <<colour sidebar-tab-border>>;\n\tborder-right: 1px solid <<colour sidebar-tab-border>>;\n}\n\n.tc-sidebar-lists .tc-tab-divider {\n\tborder-top: 1px solid <<colour sidebar-tab-divider>>;\n}\n\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button {\n\tdisplay: block;\n\twidth: 100%;\n\tbackground-color: <<colour sidebar-tab-background>>;\n\tborder-top: none;\n\tborder-left: none;\n\tborder-bottom: none;\n\tborder-right: 1px solid #ccc;\n\tmargin-bottom: inherit;\n}\n\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button.tc-tab-selected {\n\tbackground-color: <<colour sidebar-tab-background-selected>>;\n\tborder: none;\n}\n\n/*\n** Manager\n*/\n\n.tc-manager-wrapper {\n\t\n}\n\n.tc-manager-controls {\n\t\n}\n\n.tc-manager-control {\n\tmargin: 0.5em 0;\n}\n\n.tc-manager-list {\n\twidth: 100%;\n\tborder-top: 1px solid <<colour muted-foreground>>;\n\tborder-left: 1px solid <<colour muted-foreground>>;\n\tborder-right: 1px solid <<colour muted-foreground>>;\n}\n\n.tc-manager-list-item {\n\n}\n\n.tc-manager-list-item-heading {\n display: block;\n width: 100%;\n text-align: left;\t\n\tborder-bottom: 1px solid <<colour muted-foreground>>;\n\tpadding: 3px;\n}\n\n.tc-manager-list-item-heading-selected {\n\tfont-weight: bold;\n\tcolor: <<colour background>>;\n\tfill: <<colour background>>;\n\tbackground-color: <<colour foreground>>;\n}\n\n.tc-manager-list-item-heading:hover {\n\tbackground: <<colour primary>>;\n\tcolor: <<colour background>>;\n}\n\n.tc-manager-list-item-content {\n\tdisplay: flex;\n}\n\n.tc-manager-list-item-content-sidebar {\n flex: 1 0;\n background: <<colour tiddler-editor-background>>;\n border-right: 0.5em solid <<colour muted-foreground>>;\n border-bottom: 0.5em solid <<colour muted-foreground>>;\n white-space: nowrap;\n}\n\n.tc-manager-list-item-content-item-heading {\n\tdisplay: block;\n\twidth: 100%;\n\ttext-align: left;\n background: <<colour muted-foreground>>;\n\ttext-transform: uppercase;\n\tfont-size: 0.6em;\n\tfont-weight: bold;\n padding: 0.5em 0 0.5em 0;\n}\n\n.tc-manager-list-item-content-item-body {\n\tpadding: 0 0.5em 0 0.5em;\n}\n\n.tc-manager-list-item-content-item-body > pre {\n\tmargin: 0.5em 0 0.5em 0;\n\tborder: none;\n\tbackground: inherit;\n}\n\n.tc-manager-list-item-content-tiddler {\n flex: 3 1;\n border-left: 0.5em solid <<colour muted-foreground>>;\n border-right: 0.5em solid <<colour muted-foreground>>;\n border-bottom: 0.5em solid <<colour muted-foreground>>;\n}\n\n.tc-manager-list-item-content-item-body > table {\n\tborder: none;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.tc-manager-list-item-content-item-body > table td {\n\tborder: none;\n}\n\n.tc-manager-icon-editor > button {\n\twidth: 100%;\n}\n\n.tc-manager-icon-editor > button > svg,\n.tc-manager-icon-editor > button > button {\n\twidth: 100%;\n\theight: auto;\n}\n\n/*\n** Alerts\n*/\n\n.tc-alerts {\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\tmax-width: 500px;\n\tz-index: 20000;\n}\n\n.tc-alert {\n\tposition: relative;\n\tmargin: 28px;\n\tpadding: 14px 14px 14px 14px;\n\tborder: 2px solid <<colour alert-border>>;\n\tbackground-color: <<colour alert-background>>;\n}\n\n.tc-alert-toolbar {\n\tposition: absolute;\n\ttop: 14px;\n\tright: 14px;\n}\n\n.tc-alert-toolbar svg {\n\tfill: <<colour alert-muted-foreground>>;\n}\n\n.tc-alert-subtitle {\n\tcolor: <<colour alert-muted-foreground>>;\n\tfont-weight: bold;\n}\n\n.tc-alert-highlight {\n\tcolor: <<colour alert-highlight>>;\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-static-alert {\n\t\tposition: relative;\n\t}\n\n\t.tc-static-alert-inner {\n\t\tposition: absolute;\n\t\tz-index: 100;\n\t}\n\n}\n\n.tc-static-alert-inner {\n\tpadding: 0 2px 2px 42px;\n\tcolor: <<colour static-alert-foreground>>;\n}\n\n/*\n** Control panel\n*/\n\n.tc-control-panel td {\n\tpadding: 4px;\n}\n\n.tc-control-panel table, .tc-control-panel table input, .tc-control-panel table textarea {\n\twidth: 100%;\n}\n\n.tc-plugin-info {\n\tdisplay: block;\n\tborder: 1px solid <<colour muted-foreground>>;\n\tbackground-colour: <<colour background>>;\n\tmargin: 0.5em 0 0.5em 0;\n\tpadding: 4px;\n}\n\n.tc-plugin-info-disabled {\n\tbackground: -webkit-repeating-linear-gradient(45deg, #ff0, #ff0 10px, #eee 10px, #eee 20px);\n\tbackground: repeating-linear-gradient(45deg, #ff0, #ff0 10px, #eee 10px, #eee 20px);\n}\n\n.tc-plugin-info-disabled:hover {\n\tbackground: -webkit-repeating-linear-gradient(45deg, #aa0, #aa0 10px, #888 10px, #888 20px);\n\tbackground: repeating-linear-gradient(45deg, #aa0, #aa0 10px, #888 10px, #888 20px);\n}\n\na.tc-tiddlylink.tc-plugin-info:hover {\n\ttext-decoration: none;\n\tbackground-color: <<colour primary>>;\n\tcolor: <<colour background>>;\n\tfill: <<colour foreground>>;\n}\n\na.tc-tiddlylink.tc-plugin-info:hover .tc-plugin-info > .tc-plugin-info-chunk > svg {\n\tfill: <<colour foreground>>;\n}\n\n.tc-plugin-info-chunk {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\n\n.tc-plugin-info-chunk h1 {\n\tfont-size: 1em;\n\tmargin: 2px 0 2px 0;\n}\n\n.tc-plugin-info-chunk h2 {\n\tfont-size: 0.8em;\n\tmargin: 2px 0 2px 0;\n}\n\n.tc-plugin-info-chunk div {\n\tfont-size: 0.7em;\n\tmargin: 2px 0 2px 0;\n}\n\n.tc-plugin-info:hover > .tc-plugin-info-chunk > img, .tc-plugin-info:hover > .tc-plugin-info-chunk > svg {\n\twidth: 2em;\n\theight: 2em;\n\tfill: <<colour foreground>>;\n}\n\n.tc-plugin-info > .tc-plugin-info-chunk > img, .tc-plugin-info > .tc-plugin-info-chunk > svg {\n\twidth: 2em;\n\theight: 2em;\n\tfill: <<colour muted-foreground>>;\n}\n\n.tc-plugin-info.tc-small-icon > .tc-plugin-info-chunk > img, .tc-plugin-info.tc-small-icon > .tc-plugin-info-chunk > svg {\n\twidth: 1em;\n\theight: 1em;\n}\n\n.tc-plugin-info-dropdown {\n\tborder: 1px solid <<colour muted-foreground>>;\n\tmargin-top: -8px;\n}\n\n.tc-plugin-info-dropdown-message {\n\tbackground: <<colour message-background>>;\n\tpadding: 0.5em 1em 0.5em 1em;\n\tfont-weight: bold;\n\tfont-size: 0.8em;\n}\n\n.tc-plugin-info-dropdown-body {\n\tpadding: 1em 1em 1em 1em;\n}\n\n/*\n** Message boxes\n*/\n\n.tc-message-box {\n\tborder: 1px solid <<colour message-border>>;\n\tbackground: <<colour message-background>>;\n\tpadding: 0px 21px 0px 21px;\n\tfont-size: 12px;\n\tline-height: 18px;\n\tcolor: <<colour message-foreground>>;\n}\n\n.tc-message-box svg {\n\twidth: 1em;\n\theight: 1em;\n vertical-align: text-bottom;\n}\n\n/*\n** Pictures\n*/\n\n.tc-bordered-image {\n\tborder: 1px solid <<colour muted-foreground>>;\n\tpadding: 5px;\n\tmargin: 5px;\n}\n\n/*\n** Floats\n*/\n\n.tc-float-right {\n\tfloat: right;\n}\n\n/*\n** Chooser\n*/\n\n.tc-chooser {\n\tborder: 1px solid <<colour table-border>>;\n}\n\n.tc-chooser-item {\n\tborder: 8px;\n\tpadding: 2px 4px;\n}\n\n.tc-chooser-item a.tc-tiddlylink {\n\tdisplay: block;\n\ttext-decoration: none;\n\tcolor: <<colour tiddler-link-foreground>>;\n\tbackground-color: <<colour tiddler-link-background>>;\n}\n\n.tc-chooser-item a.tc-tiddlylink:hover {\n\ttext-decoration: none;\n\tcolor: <<colour tiddler-link-background>>;\n\tbackground-color: <<colour tiddler-link-foreground>>;\n}\n\n/*\n** Palette swatches\n*/\n\n.tc-swatches-horiz {\n}\n\n.tc-swatches-horiz .tc-swatch {\n\tdisplay: inline-block;\n}\n\n.tc-swatch {\n\twidth: 2em;\n\theight: 2em;\n\tmargin: 0.4em;\n\tborder: 1px solid #888;\n}\n\n/*\n** Table of contents\n*/\n\n.tc-sidebar-lists .tc-table-of-contents {\n\twhite-space: nowrap;\n}\n\n.tc-table-of-contents button {\n\tcolor: <<colour sidebar-foreground>>;\n}\n\n.tc-table-of-contents svg {\n\twidth: 0.7em;\n\theight: 0.7em;\n\tvertical-align: middle;\n\tfill: <<colour sidebar-foreground>>;\n}\n\n.tc-table-of-contents ol {\n\tlist-style-type: none;\n\tpadding-left: 0;\n}\n\n.tc-table-of-contents ol ol {\n\tpadding-left: 1em;\n}\n\n.tc-table-of-contents li {\n\tfont-size: 1.0em;\n\tfont-weight: bold;\n}\n\n.tc-table-of-contents li a {\n\tfont-weight: bold;\n}\n\n.tc-table-of-contents li li {\n\tfont-size: 0.95em;\n\tfont-weight: normal;\n\tline-height: 1.4;\n}\n\n.tc-table-of-contents li li a {\n\tfont-weight: normal;\n}\n\n.tc-table-of-contents li li li {\n\tfont-size: 0.95em;\n\tfont-weight: 200;\n\tline-height: 1.5;\n}\n\n.tc-table-of-contents li li li a {\n\tfont-weight: bold;\n}\n\n.tc-table-of-contents li li li li {\n\tfont-size: 0.95em;\n\tfont-weight: 200;\n}\n\n.tc-tabbed-table-of-contents {\n\tdisplay: -webkit-flex;\n\tdisplay: flex;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents {\n\tz-index: 100;\n\tdisplay: inline-block;\n\tpadding-left: 1em;\n\tmax-width: 50%;\n\t-webkit-flex: 0 0 auto;\n\tflex: 0 0 auto;\n\tbackground: <<colour tab-background>>;\n\tborder-left: 1px solid <<colour tab-border>>;\n\tborder-top: 1px solid <<colour tab-border>>;\n\tborder-bottom: 1px solid <<colour tab-border>>;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a,\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a {\n\tdisplay: block;\n\tpadding: 0.12em 1em 0.12em 0.25em;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a {\n\tborder-top: 1px solid <<colour tab-background>>;\n\tborder-left: 1px solid <<colour tab-background>>;\n\tborder-bottom: 1px solid <<colour tab-background>>;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a:hover {\n\ttext-decoration: none;\n\tborder-top: 1px solid <<colour tab-border>>;\n\tborder-left: 1px solid <<colour tab-border>>;\n\tborder-bottom: 1px solid <<colour tab-border>>;\n\tbackground: <<colour tab-border>>;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a {\n\tborder-top: 1px solid <<colour tab-border>>;\n\tborder-left: 1px solid <<colour tab-border>>;\n\tborder-bottom: 1px solid <<colour tab-border>>;\n\tbackground: <<colour background>>;\n\tmargin-right: -1px;\n}\n\n.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a:hover {\n\ttext-decoration: none;\n}\n\n.tc-tabbed-table-of-contents .tc-tabbed-table-of-contents-content {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tpadding-left: 1.5em;\n\tpadding-right: 1.5em;\n\tborder: 1px solid <<colour tab-border>>;\n\t-webkit-flex: 1 0 50%;\n\tflex: 1 0 50%;\n}\n\n/*\n** Dirty indicator\n*/\n\nbody.tc-dirty span.tc-dirty-indicator, body.tc-dirty span.tc-dirty-indicator svg {\n\tfill: <<colour dirty-indicator>>;\n\tcolor: <<colour dirty-indicator>>;\n}\n\n/*\n** File inputs\n*/\n\n.tc-file-input-wrapper {\n\tposition: relative;\n\toverflow: hidden;\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\n\n.tc-file-input-wrapper input[type=file] {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbottom: 0;\n\tfont-size: 999px;\n\tmax-width: 100%;\n\tmax-height: 100%;\n\tfilter: alpha(opacity=0);\n\topacity: 0;\n\toutline: none;\n\tbackground: white;\n\tcursor: pointer;\n\tdisplay: inline-block;\n}\n\n/*\n** Thumbnail macros\n*/\n\n.tc-thumbnail-wrapper {\n\tposition: relative;\n\tdisplay: inline-block;\n\tmargin: 6px;\n\tvertical-align: top;\n}\n\n.tc-thumbnail-right-wrapper {\n\tfloat:right;\n\tmargin: 0.5em 0 0.5em 0.5em;\n}\n\n.tc-thumbnail-image {\n\ttext-align: center;\n\toverflow: hidden;\n\tborder-radius: 3px;\n}\n\n.tc-thumbnail-image svg,\n.tc-thumbnail-image img {\n\tfilter: alpha(opacity=1);\n\topacity: 1;\n\tmin-width: 100%;\n\tmin-height: 100%;\n\tmax-width: 100%;\n}\n\n.tc-thumbnail-wrapper:hover .tc-thumbnail-image svg,\n.tc-thumbnail-wrapper:hover .tc-thumbnail-image img {\n\tfilter: alpha(opacity=0.8);\n\topacity: 0.8;\n}\n\n.tc-thumbnail-background {\n\tposition: absolute;\n\tborder-radius: 3px;\n}\n\n.tc-thumbnail-icon svg,\n.tc-thumbnail-icon img {\n\twidth: 3em;\n\theight: 3em;\n\t<<filter \"drop-shadow(2px 2px 4px rgba(0,0,0,0.3))\">>\n}\n\n.tc-thumbnail-wrapper:hover .tc-thumbnail-icon svg,\n.tc-thumbnail-wrapper:hover .tc-thumbnail-icon img {\n\tfill: #fff;\n\t<<filter \"drop-shadow(3px 3px 4px rgba(0,0,0,0.6))\">>\n}\n\n.tc-thumbnail-icon {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbottom: 0;\n\tdisplay: -webkit-flex;\n\t-webkit-align-items: center;\n\t-webkit-justify-content: center;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.tc-thumbnail-caption {\n\tposition: absolute;\n\tbackground-color: #777;\n\tcolor: #fff;\n\ttext-align: center;\n\tbottom: 0;\n\twidth: 100%;\n\tfilter: alpha(opacity=0.9);\n\topacity: 0.9;\n\tline-height: 1.4;\n\tborder-bottom-left-radius: 3px;\n\tborder-bottom-right-radius: 3px;\n}\n\n.tc-thumbnail-wrapper:hover .tc-thumbnail-caption {\n\tfilter: alpha(opacity=1);\n\topacity: 1;\n}\n\n/*\n** Errors\n*/\n\n.tc-error {\n\tbackground: #f00;\n\tcolor: #fff;\n}"
},
"$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize",
"text": "15px"
},
"$:/themes/tiddlywiki/vanilla/metrics/bodylineheight": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/bodylineheight",
"text": "22px"
},
"$:/themes/tiddlywiki/vanilla/metrics/fontsize": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/fontsize",
"text": "14px"
},
"$:/themes/tiddlywiki/vanilla/metrics/lineheight": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/lineheight",
"text": "20px"
},
"$:/themes/tiddlywiki/vanilla/metrics/storyleft": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/storyleft",
"text": "0px"
},
"$:/themes/tiddlywiki/vanilla/metrics/storytop": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/storytop",
"text": "0px"
},
"$:/themes/tiddlywiki/vanilla/metrics/storyright": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/storyright",
"text": "770px"
},
"$:/themes/tiddlywiki/vanilla/metrics/storywidth": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/storywidth",
"text": "770px"
},
"$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth",
"text": "686px"
},
"$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint",
"text": "960px"
},
"$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth": {
"title": "$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth",
"text": "350px"
},
"$:/themes/tiddlywiki/vanilla/options/stickytitles": {
"title": "$:/themes/tiddlywiki/vanilla/options/stickytitles",
"text": "no"
},
"$:/themes/tiddlywiki/vanilla/options/sidebarlayout": {
"title": "$:/themes/tiddlywiki/vanilla/options/sidebarlayout",
"text": "fixed-fluid"
},
"$:/themes/tiddlywiki/vanilla/options/codewrapping": {
"title": "$:/themes/tiddlywiki/vanilla/options/codewrapping",
"text": "pre-wrap"
},
"$:/themes/tiddlywiki/vanilla/reset": {
"title": "$:/themes/tiddlywiki/vanilla/reset",
"type": "text/plain",
"text": "/*! normalize.css v3.0.0 | MIT License | git.io/normalize */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\n\nhtml {\n font-family: sans-serif; /* 1 */\n -ms-text-size-adjust: 100%; /* 2 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n margin: 0;\n}\n\n/* HTML5 display definitions\n ========================================================================== */\n\n/**\n * Correct `block` display not defined in IE 8/9.\n */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection,\nsummary {\n display: block;\n}\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\n\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block; /* 1 */\n vertical-align: baseline; /* 2 */\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\n * Address `[hidden]` styling not present in IE 8/9.\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n display: none;\n}\n\n/* Links\n ========================================================================== */\n\n/**\n * Remove the gray background color from active links in IE 10.\n */\n\na {\n background: transparent;\n}\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\n\na:active,\na:hover {\n outline: 0;\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Address styling not present in IE 8/9, Safari 5, and Chrome.\n */\n\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\n\ndfn {\n font-style: italic;\n}\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari 5, and Chrome.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove border when inside `a` element in IE 8/9.\n */\n\nimg {\n border: 0;\n}\n\n/**\n * Correct overflow displayed oddly in IE 9.\n */\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari 5.\n */\n\nfigure {\n margin: 1em 40px;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n}\n\n/**\n * Contain overflow in all browsers.\n */\n\npre {\n overflow: auto;\n}\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n\n/**\n * 1. Correct color not being inherited.\n * Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit; /* 1 */\n font: inherit; /* 2 */\n margin: 0; /* 3 */\n}\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10.\n */\n\nbutton {\n overflow: visible;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8+, and Opera\n * Correct `select` style inheritance in Firefox.\n */\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button; /* 2 */\n cursor: pointer; /* 3 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\ninput {\n line-height: normal;\n}\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n * (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box; /* 2 */\n box-sizing: content-box;\n}\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n border: 0; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Remove default vertical scrollbar in IE 8/9.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\n\noptgroup {\n font-weight: bold;\n}\n\n/* Tables\n ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\ntd,\nth {\n padding: 0;\n}\n"
},
"$:/themes/tiddlywiki/vanilla/settings/fontfamily": {
"title": "$:/themes/tiddlywiki/vanilla/settings/fontfamily",
"text": "\"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", \"DejaVu Sans\", sans-serif"
},
"$:/themes/tiddlywiki/vanilla/settings/codefontfamily": {
"title": "$:/themes/tiddlywiki/vanilla/settings/codefontfamily",
"text": "Monaco, Consolas, \"Lucida Console\", \"DejaVu Sans Mono\", monospace"
},
"$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment": {
"title": "$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment",
"text": "fixed"
},
"$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize": {
"title": "$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize",
"text": "auto"
},
"$:/themes/tiddlywiki/vanilla/sticky": {
"title": "$:/themes/tiddlywiki/vanilla/sticky",
"text": "<$reveal state=\"$:/themes/tiddlywiki/vanilla/options/stickytitles\" type=\"match\" text=\"yes\">\n``\n.tc-tiddler-title {\n\tposition: -webkit-sticky;\n\tposition: -moz-sticky;\n\tposition: -o-sticky;\n\tposition: -ms-sticky;\n\tposition: sticky;\n\ttop: 0px;\n\tbackground: ``<<colour tiddler-background>>``;\n\tz-index: 500;\n}\n``\n</$reveal>\n"
}
}
}
See the source code at [[canvas-demo.eve]]
```
<$eve markdown={{canvas-demo.eve}}/>
```
renders as
<$eve markdown={{canvas-demo.eve}}/>
This is the start of a translation of [[canvas-demo.ts|https://github.com/witheve/eve-starter/blob/6b0cf201c400efe05f949b36c771dd4950cde5b3/programs/canvas-demo.ts]] from the Javascript DSL into Eve syntax
! Description
The Canvas watcher allows you to declaratively draw to HTML5 canvas elements.
! Terms
* `canvas/root` is an html canvas element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas.
* `canvas/path` is a Path2D https://developer.mozilla.org/en-US/docs/Web/API/Path2D.
* Children of `canvas/path`s are operations to execute on their parent.
! Notes
Canvas has an inherently sequential API. This sequence is reflected in Eve using the `sort` attribute.
Paths with higher sorts will draw on top of paths with lower sorts. Ditto for operations.
Style properties https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Applying_styles_and_colors can be set
as attributes of the path.
Pay special attention to the `example` attribute. It's used to make the containers and canvases of each example unique.
Without it, both blocks would write into the same canvas in the same container, leading to a single canvas with all the paths
of the individual examples in it!
In the current version of the canvas watcher, all attributes for an operation are ''required''. We'll fix this in the future.
For optimal performance, it's recommended that you try to separate things which change frequently
and things that don't into separate paths, as the Canvas API requires rerendering an entire path when it changes.
! The code
An example container is a div with a title
```eve
search
container = [#container]
bind
container <- [#ui/div class: container children: [#ui/div sort: 0 text: container.example]]
```
Draw a simple square.
```eve
search
example = "Square"
bind
[#container example, children:
[#canvas/root sort: 1, width: 160, height: 140, example, children:
[#canvas/path sort: 1, fillStyle: "rgb(0, 158, 224)", children:
[sort: 1, type: "rect", x: 30, y: 20, width: 100, height: 100]]]]
```
Draw a compound path
```eve
search
example = "Compound path"
bind
[#container example, children:
[#canvas/root sort: 1, width: 160, height: 140, example, children:
[#canvas/path sort: 1, strokeStyle: "rgb(91,89,164)", lineWidth: 2, lineCap: "square", lineJoin: "bevel", children:
[sort: 1, type: "rect", x: 50, y: 30, width: 50, height: 75]
[sort: 2, type: "moveTo", x: 100, y: 55]
[sort: 3, type: "ellipse", x: 100, y: 75, radiusX: 25, radiusY: 50, rotation: 0, startAngle: 0, endAngle: 3.14 * 3 / 4, anticlockwise: "false"]]]]
```
Draw a canvas with multiple paths.
```eve
search
example = "Multiple paths"
bind
[#container example children:
[#canvas/root sort: 1, width: 160, height: 140, example children:
[#canvas/path sort: 1, fillStyle: "rgb(0, 184, 241)" children:
[sort: 1, type: "rect", x: 40, y: 25, width: 50, height: 100]]
[#canvas/path sort: 1, strokeStyle: "rgb(0, 121, 177)", lineWidth: 10, lineCap: "round", lineJoin: "miter" children:
[sort: 1, type: "moveTo", x: 100, y: 25]
[sort: 2, type: "lineTo", x: 125, y: 50]
[sort: 3, type: "lineTo", x: 100, y: 75]
[sort: 4, type: "lineTo", x: 125, y: 100]
[sort: 5, type: "lineTo", x: 100, y: 125]]]]
```
Reusable equilateral triangle path block.
```eve
search
triangle = [#triangle x y side]
adjacent = side * math/cos[degrees: 30]
bind
triangle <- [#canvas/path children:
[sort: 1, type: "moveTo", x, y]
[sort: 2, type: "lineTo", x: x + side / 2, y: y + adjacent]
[sort: 3, type: "lineTo", x: x - side / 2, y: y + adjacent]
[sort: 4, type: "closePath"]] // Draws a line back to the first vertex.
```
Draw a canvas with a reusable path component.
```eve
search
example = "Reusable path component"
bind
[#container example children:
[#canvas/root sort: 1, width: 160, height: 140, example children:
[#triangle sort: 1, x: 80, y: 10, side: 100, fillStyle: "rgb(74, 64, 136)"]
[#triangle sort: 2, x: 80, y: 32, side: 60, fillStyle: "rgb(91, 89, 164)"]
[#triangle sort: 3, x: 80, y: 54, side: 20, fillStyle: "rgb(107, 103, 173)"]
[#triangle sort: 4, x: 80, y: 10, side: 50, strokeStyle: "rgb(0, 184, 241)", lineWidth: 2]
[#triangle sort: 4, x: 55, y: 53.5, side: 50, strokeStyle: "rgb(0, 184, 241)", lineWidth: 2]
[#triangle sort: 4, x: 105, y: 53.5, side: 50, strokeStyle: "rgb(0, 184, 241)", lineWidth: 2]]]
```
Add some CSS to spruce the place up. The flex-direction part doesn't seem to be working. Not sure why
```eve
bind
[#html/element tagname: "style" text: "
.tc-widget { flex-direction: row; justify-content: flex-start; align-content: flex-start; flex-wrap: wrap; }
.container { flex: 0 0 auto; margin: 20px; padding: 20px; padding-top: 0; width: 200px; height: 202px; background: white; border-radius: 3px; box-shadow: 0 3px 4px rgba(0, 0, 0, 0.1); }
.container > div { margin: 10px 0; text-align: center; }
"]
```
This code is copied from the eve-starter project at [clock.eve](https://github.com/witheve/eve-starter/blob/master/programs/clock.eve)
Create a timer that will tick once per second.
```eve
commit
[#time #system/timer resolution: 1000]
```
Draw an appropriately positioned line into `#clock-hand`s.
```eve
search
hand = [#clock-hand degrees length]
x2 = 50 + (length * math/sin[degrees])
y2 = 50 - (length * math/cos[degrees])
bind
hand <- [#svg/line, x1: 50, y1: 50, x2, y2]
```
Draw a clock using SVG. We find the angle for each hand using time and let the `#clock-hand` block take care of the rest.
```eve
search
[#time hour minute second]
bind
[#svg/root viewBox: "0 0 100 100", width: "300px", children:
[#svg/circle sort: 1, cx: 50, cy: 50, r: 45, fill: "#0B79CE"]
[#clock-hand #hour-hand sort: 2, degrees: 30 * hour, length: 30, stroke: "#023963"]
[#clock-hand #minute-hand sort: 3, degrees: 6 * minute, length: 40, stroke: "#023963"]
[#clock-hand #second-hand sort: 4, degrees: 6 * second, length: 40, stroke: "#ce0b46"]]
```
Create a tiddler with `type=text/x-gfm` and in view mode, the github flavored markdown contents will be rendered. In edit mode the codemirror plugin will be used to provide syntax highlighting for the markdown and for the Eve code stored inside code blocks.
With this standard Eve programs can be pasted in and they will be rednered nicely without having to change to the TiddlyWiki markup syntax.
# Example markdown
Eve code block:
```eve
search
a = 1
bind
[#ui/div text: "hi"]
```
Javascript code block
```javascript
var foo = function (bar) {
return bar++;
};
console.log(foo(5));
var a = "abc123", b = "<br/>"
```
**nols**
_italics_
straight
*italics*
[I'm an inline-style link](https://www.google.com)
inline `code` has `back-ticks around` it.
```
No language indicated, so no syntax highlighting.
But let's throw in a <b>tag</b>.
```
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
Tables are supported:
| Option | Description |
| ------ | ----------- |
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Images also:
![Minion](https://octodex.github.com/images/minion.png)
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
# Counter
Based on the eve program at [http://play.witheve.com/#/examples/counter.eve](http://play.witheve.com/#/examples/counter.eve). Modified to support embedding.
This program demonstrates:
* responding to events
* drawing elements on the screen
* reusing elements programatically
* extending an element
### Increment a Counter
Each button uses the referenced counter to increment itself. We need to think about two tags to accomplish this goal:
* `#html/event/click` is a record created by the HTML watcher any time a user clicks somewhere within an Eve app.
* `#ui/button` is a record we'll create a little later on to represent our button. The UI Watcher will helpfully draw it as a graphical button for us.
```eve
search
[#html/event/click element: [#ui/button diff counter]]
commit
counter.count := counter.count + diff
```
### Build a Counter
For every `#counter`, we create a `#ui/row` that contains the elements that draw the counter. These rows are added automatically to the root of the DOM, but you could add them to a particular element instead adding them as children to the parent's record.
There is an *issue* with Eve which causes html events to be sent to all Eve program instances. See [https://github.com/witheve/Eve/issues/844](https://github.com/witheve/Eve/issues/844) for further discussion. Using the `#program` is one of the workarounds proposed there. It is only needed for tweve since multiple instances of the same program are being instantiated here. For a standalone eve program, it would not be necessary.
```eve
search
program = [#program]
counter = [#counter count]
bind
[#ui/row counter sort: counter.sort style: [flex: "0 0 auto" width: "100px"] children:
[#ui/button program text: "-" diff: -1 counter]
[#ui/text text: count counter style: [padding: "0 6px" flex: 1 text-align: "right"]]
[#ui/button program text: "+" diff: 1 counter]]
```
Add some counters programatically. To make `n` unique and independent counters, we need to add something to the committed counter that makes it unique. Since `sort` = `{1, 2, 3, 4}`, when we add it to the counter record we get 4 different counters. As an added bonus, we can use it to choose what order to display our counters in. We also add one `#fancy` counter, which is a standard counter with new styling.
```eve
search
sort = math/range[start: 1 stop: 2]
not([#counter sort: s count: c])
commit
[#counter #persist sort count: 0]
[#counter #persist #fancy sort: 5 count: 0]
```
### Extend the Counter
This block says: "For every rows with a counter that is tagged fancy, add a style with a black background and pink text". Let's break it down. We search for all `#ui/row`s with a counter attribute. The counter is constrained to be only counters with a `#fancy` tag. Then we bind a new style to each.
```eve
search
container = [#ui/row counter]
counter.tag = "fancy"
bind
container.style += [background: "black" color: "#FFD0E0"]
```
Here are some code blocks, most containing errors:
<pre><code>
<$view tiddler="Miscellaneous Eve errors" format=text/>
</code></pre>
It renders as:
<$eve markdown={{Miscellaneous Eve errors}}/>
---
<!-- These used to be parser exceptions but were fixed by https://github.com/witheve/Eve/pull/848 -->
<pre><code>
<$view tiddler="Parser exception 1" format=text/>
</code></pre>
renders as:
<$eve markdown={{Parser exception 1}}/>
---
<pre><code>
<$view tiddler="Parser exception 2" format=text/>
</code></pre>
renders as:
<$eve markdown={{Parser exception 2}}/>
!Introduction
This plugin implements a [[Tiddlywiki|http://tiddlywiki.com]] widget which allows an [[Eve|https://github.com/witheve/Eve]] program to be embedded.
<<<
* New to Eve? Check out http://witheve.com/ and http://play.witheve.com/
* New to Tiddlywiki? There's much to learn. http://tiddlywiki.com is the best place to start
<<<
Example using the eve widget to "render" an Eve program which can be used as a two person game of Tic-Tac-Toe
```
<$eve markdown={{tic-tac-toe.eve}}/>
```
This renders as
<<<
<$eve markdown={{tic-tac-toe.eve}}/>
<<<
Click the squares above to play. Open the [[tic-tac-toe.eve]] tiddler to view the source code.
! Using the widget to execute Eve code
Widgets in Tiddlywiki are a way to provide extended functionality beyond the wiki syntax and html markup. There are many core widgets included with Tiddlywiki by default and javascript code can be written to add new widgets.
Eve code has its own syntax. It also has a Javascript DSL which can be used to glue it together with other javascript projects. Here it is glued to Tiddlywiki by exposing a Tiddlywiki widget with the name ``eve``. This ``eve`` widget allows the Eve syntax to be executed/rendered inside of Tiddlywiki.
Eve code is passed into the widget using the ``markdown`` attribute. Tiddlywiki widget [[attributes|http://tiddlywiki.com/static/Widgets%2520in%2520WikiText.html]] can be specified several ways. Two ways are described here.
!! Double curly brace attribute syntax
One way is to add the code to a separate tiddler and pass the contents of that tiddler to the ``eve`` markdown attribute using the doubly curly brace syntax. This was done with the Tic-Tac-Toe example above and [[hello.eve]] is a simpler example of the same:
```
<$eve markdown={{hello.eve}}/>
```
and will render as
<<<
<$eve markdown={{hello.eve}}/>
<<<
The contents of [[hello.eve]] looks like this:
{{hello.eve}}
!! Triple double quote attribute syntax
This example shows how the [[Tiddlywiki triple double quote syntax|http://tiddlywiki.com/static/Widgets%2520in%2520WikiText.html]] can be used to embed the eve source code directly within the widget call:
<pre><code>
<$view tiddler="hello.eve triple double quotes" format=text/>
</code></pre>
This renders as:
<<<
<$eve markdown={{hello.eve triple double quotes}}/>
<<<
This approach is recommended only for the smallest of Eve programs.
!! Use the filter attribute to pull Eve code from multiple tiddlers
[[flappy bird]] - shows how the `filter` attribute of the eve widget can be used to join multiple tiddlers together into a single Eve program. Editing a long program within a single tiddler can be unwieldy, so breaking them down into smaller chunks can be helpful.
! Authoring Eve programs in Tiddlywiki
A program specified with the Eve syntax is a valid markdown document with the actual Eve code embedded inside the triple backtick sections. The triple backtick delimiters are sometimes called ''code fences'' and they are used to delineate blocks of code.
!! Using Tiddlywiki syntax
The Tiddlywiki [[wiki syntax|http://tiddlywiki.com/static/WikiText.html]], though different from markdown, uses the same code fence syntax to mark code blocks. This means the Tiddlywiki syntax can work just fine to specify Eve programs.
To create a new Eve program using the Tiddlywiki syntax, click the {{$:/core/ui/Buttons/new-tiddler}} icon and begin composing your code.
!! Using markdown syntax
Tiddlywiki has a [[markdown plugin|http://tiddlywiki.com/plugins/tiddlywiki/markdown/]] for rendering tiddlers as markdown if the type is set as `text/x-markdown`. However it uses a markdown library which does not support the all-important code fence syntax. Therefore, I've written my own [[plugin|$:/plugins/btheado/markdown]] which wraps a markdown library that does support the code fence syntax.
To create a new Eve program using the Markdown syntax, click the {{$:/plugins/btheado/markdown/new-markdown-button}} icon and begin composing your code. As an alternative, you can use the {{$:/core/ui/Buttons/new-tiddler}} icon and set the type to `text/x-gfm` (gfm for github-flavored markdown).
A few advantages to using the markdown syntax:
#If the [[codemirror plugin|http://tiddlywiki.com/plugins/tiddlywiki/codemirror/]] is loaded and configured correctly, the editor will have colored syntax highlighting for both the markdown and the Eve code.
#If you find a random Eve program on the web it will likely be in markdown format. If you paste such a program into a markdown tiddler, then it will render much nicer than if you paste it into a Tiddlywiki tiddler. If all you want to do is execute the code, then this will not matter. But if you also want to read the code, it will.
Note that the widget syntax will not work in a markdown tiddler. In order to actually invoke a program using the `eve` widget, a normal tiddler is needed.
! Features and examples
* ''Persistence'' - Eve records tagged with the `#persist` will automatically be stored in tiddler fields as they change. Upon widget refresh, the fields will be loaded back into the eve program. See [[Storing eve state in tiddlers]] for details and a demo
* ''SVG'' - [[svg clock]]
* ''Canvas'' - [[canvas demo]]
* [[flappy bird]]
* [[Eve syntax error examples]]
* [[Codemirror and eve syntax highlighting]]
! Eve widget reference
The content of the `<$eve>` widget is ignored.
|!Attribute |!Description |
|markdown|The value of this attribute is used as eve source code|
|filter |The text field of all the tiddlers matching this ~TiddlyWiki filter are concatenated and used as eve source code.|
If both attributes are supplied, then source code from both are used.
This example shows how the `filter` attribute can be used to construct an eve program from multiple tiddlers. ~TiddlyWiki has a [[filter|http://tiddlywiki.com/static/Filters.html]] syntax which allows tiddlers to be queried in many ways.
I chose to store the flappy bird souce code in tiddlers all tagged with the tag `flappy.eve`, The filter `tag[flappy.eve]` will return those tiddlers, so this eve widget call:
```
<$eve filter="[!has[draft.of]tag[flappy.eve]]" />
```
renders as
<$eve filter="[!has[draft.of]tag[flappy.eve]]" />
The `!has[draft.of]` portion of the filter avoids matching the tiddler while it is being edited.
These are the tiddlers which match the `flappy.eve` tag:
{{{[!has[draft.of]tag[flappy.eve]sort[created]]}}}
In addition to using `flappy.eve` as a tag, I've also created it as a tiddler [[flappy.eve]]. The content I placed in that tiddler cause the content of all the `flappy.eve` tagged tiddlers to be displayed. The raw content of that tiddler looks like this:
<pre>
<$view tiddler=flappy.eve/>
</pre>
In this way the [[flappy.eve]] tiddler can be visited in order to view the entire program. There are countless ways to organize tiddlers and display tiddlers. Using tags is just one way.
Using tags is a particularly powerful way when combined with the {{$:/core/ui/Buttons/new-here}} button. Clicking that button at the top of a tiddler causes a new tiddler to be created. This new tiddler is automatically tagged with the tiddler from which the button was clicked. This means you can create a new tiddler `myprogram.eve`, copy the above content and then click the {{$:/core/ui/Buttons/new-here}} button to start adding blocks of code in separate tiddlers.
Having this separate `myprogram.eve` tiddler is a convenience only. In order to run the code from the separate tiddlers all you need is the `<$eve filter="[!has[draft.of]tag[flappy.eve]]" />` widget call.
<!-- Loop through all tiddlers with tag matching the name of this tiddler (flappy.eve) and transclude them here for viewing -->
<$list filter="[!has[draft.of]tag{!!title}sort[created]]">
----
<$link to={{!!title}}>{{!!title}}</$link>
{{||$:/core/ui/Buttons/edit}}
{{!!text}}
</$list>
# Drawing
## Player
Next we draw the `#player` at its (x,y) coordinates. Since the player is stationary in x, setting his x position here dynamically is just a formality, but it allows us to configure his position on the screen when we initialize. We create the sprite first, then set the x and y positions to let us reuse the same element regardless of where the player is.
Draw the player
```eve
search
svg = [#game-window]
player = [#player x y]
bind
sprite = [#svg/image player | width: 10 height: 10 href: "http://i.imgur.com/sp68LtM.gif" sort: 8]
sprite.x := x - 5
sprite.y := y - 5
svg.children += sprite
```
## Obstacles
Drawing obstacles is much the same process as drawing the player, but we encapsulate the sprites into a nested SVG to group and move them as a unit.
Draw the obstacles
```eve
search
svg = [#game-window]
obstacle = [#obstacle x height gap]
bottom-height = height + gap
imgs = "https://cdn.rawgit.com/bhauman/flappy-bird-demo/master/resources/public/imgs"
bind
sprite-group = [#svg/element tagname: "svg" #obs-spr obstacle | sort: 2 overflow: "visible" children:
[#svg/image obstacle y: 0 width: 10 height, preserveAspectRatio: "none" href: "{{imgs}}/pillar-bkg.png" sort: 1]
[#svg/image obstacle x: -1 y: height - 5 width: 12 height: 5 href: "{{imgs}}/lower-pillar-head.png" sort: 2]
[#svg/image obstacle y: bottom-height width: 10 height: 90 - bottom-height, preserveAspectRatio: "none" href: "{{imgs}}/pillar-bkg.png" sort: 1]
[#svg/image obstacle x: -1 y: bottom-height width: 12 height: 5 href: "{{imgs}}/lower-pillar-head.png" sort: 2]]
sprite-group.x := x
svg.children += sprite-group
```
# Game Logic
Now we need some logic to actually play the game. We slide obstacles along proportional to the distance travelled, and wrap them around to the beginning once they're entirely off screen. Additionally, we only show obstacles once their distance travelled is positive. This allows us to offset a pipe in the future, without the modulo operator wrapping it around to start off halfway through the screen.
## Obstacles
Every 2 distance a wild obstacle appears
```eve
search
[#world distance]
obstacle = [#obstacle offset]
obstacle-distance = distance + offset
obstacle-distance >= 0
bind
obstacle.x := 100 - (50 * math/mod[value: obstacle-distance, by: 2])
```
When the obstacle is offscreen (`x > 90`), we randomly adjust the height of its gap to ensure the game doesn't play the same way twice. Eve's current random implementation yields a single result per seed per evaluation, so you can ask for `random[seed: "foo"]` in multiple queries and get the same result in that evaluation. In practice, this means that for every unique sample of randomness you care about in a program at a fixed time, you should use a unique seed. In this case, since we want one sample per obstacle, we just use the obstacle UUIDs as our seeds. The magic numbers in the equation just keep the gap from being at the very top of the screen or underground.
Readjust the height of the gap every time the obstacle resets
```eve
search
[#time tick]
[#world screen: "game" tick != tick]
obstacle = [#obstacle x > 98]
height = random/number[seed: tick] * 30 + 5
commit
obstacle.height := height
```
## Flapping the player
When a player clicks during gameplay, we give the bird some lift by setting its velocity.
```eve
search
[#html/event/click]
[#world screen: "game"]
player = [#player #self]
commit
player.velocity := 1.17
```
## Scroll the world
Next, we scroll the world in time with frame updates. Eve is currently locked to 60fps updates here, but this will probably be configurable in the future. Importantly, we only want to update the world state once per frame, so to ensure that we note the offset of the frame we last computed in `world.frame` and ensure we’re not recomputing for the same offset.
```eve
search
[#time tick]
world = [#world screen: "game" tick != tick gravity]
player = [#player y velocity]
not([#html/event/click])
commit
world.tick := tick
world.distance := world.distance + 1 / 60
player.y := y - velocity
player.velocity := velocity + gravity
```
## Collision
Checking collision with the ground is very simple. Since we know the y height of the ground, we just check if the player's bottom (determined by center + radius) is below that point.
The game is lost if the player hits the ground.
```eve
search
world = [#world screen: "game"]
[#player y > 85] // ground height + player radius
commit
world.screen := "game over"
```
Collision with the pipes is only slightly harder. Since they come in pairs, we first determine if the player is horizontally in a slice that may contain pipes and if so, whether we're above or below the gap. If neither, we're in the clear, otherwise we've collided.
The game is lost if the player hits an `#obstacle`
```eve
search
world = [#world screen: "game"]
[#player x y]
[#obstacle x: obstacle-x height gap]
∂x = math/absolute[value: obstacle-x + 5 - x] - 10 // distance between the edges of player and obstacle (offset of 1/2 obstacle width because origin is on the left)
∂x < 0
collision = if y - 5 <= height then true
else if y + 5 >= gap + height then true
commit
world.screen := "game over"
```
# Game menus
These following blocks handle drawing the game's other screens (such as the main menu and the game over scene).
The main menu displays a message instructing the player how to start the game.
```eve
search
[#world screen: "menu"]
svg = [#game-window]
bind
svg.children += [#svg/text x: 50 y: 45 text-anchor: "middle" font-size: 6 text: "Click the screen to begin!" sort: 10]
```
The "game over" screen displays the final score of the last game, the high score of all games, and a message inviting the player to play the game again.
```eve
search
[#world screen: "game over" score best]
svg = [#game-window]
bind
svg.children += [#svg/text x: 50 y: 30 text-anchor: "middle" font-size: 6 text: "Game Over :(" sort: 10]
svg.children += [#svg/text x: 50 y: 55 text-anchor: "middle" font-size: 6 text: "Score {{score}}" sort: 10]
svg.children += [#svg/text x: 50 y: 65 text-anchor: "middle" font-size: 6 text: "Best {{best}}" sort: 10]
svg.children += [#svg/text x: 50 y: 85 text-anchor: "middle" font-size: 4 text: "Click to play again!" sort: 10]
```
## Score calculation
We haven't calculated the score yet, so let's do that. We calculate the score as the `floor` of the distance, meaning we just round the distance down to the nearest integer. If the distance between pipes is changed, this value can be scaled to search.
```eve
search
world = [#world distance]
bind
world.score := math/floor[value: distance]
```
## Start a new game
When the game is on the "menu" or "game over" screens, a click anywhere in the application will (re)start the game. Additionally, if the current score is better than the current best, we'll swap them out now. Along with starting the game, we make sure to reset the distance and player positions in the came of a restart.
```eve
search
world = [#world]
[#html/event/click]
ok = if world.screen = "menu" then "true"
else if world.screen = "game over" then "true"
new = if world.score > world.best then world.score
else world.best
player = [#player]
commit
world.screen := "game"
world.distance := 0
world.best := new
player.y := 50
player.velocity := 0
```
The code here came from the eve-starter project at [[flappy.eve|https://github.com/witheve/eve-starter/blob/master/programs/flappy.eve]].
When a player starts the game, we commit a `#world`, a `#player`, and some `#obstacles`. These will keep all of the essential state of the game. All of this information could have been stored on the world, but for clarity we break the important bits of state into objects that they effect.
* The `#world` tracks the distance the player has travelled, the current game screen, and the high score.
* The `#player` stores his current y position and (vertical) velocity.
* The `obstacles` have their (horizontal) offset and gap widths. We put distance on the world and only keep two obstacles; rather than moving the player through the world, we keep the player stationary and move the world past the player. When an obstacle goes off screen, we will wrap it around, update the placement of its gap, and continue on.
# Setup
Add a flappy eve and a world for it to flap in:
```eve
commit
[#player #self name: "eve" x: 25 y: 50 velocity: 0]
[#world screen: "menu" tick: 0 distance: 0 best: 0 gravity: -0.061]
[#obstacle gap: 35 offset: 0]
[#obstacle gap: 35 offset: -1]
[#time #system/timer resolution: 16.66666666667]
```
Next we draw the backdrop of the world. The player and obstacle will be drawn later based on their current state. Throughout the app we use resources from [@bhauman's flappy bird demo in clojure](https://github.com/bhauman/flappy-bird-demo). Since none of these things change over time, we commit them once when the player starts the game.
## Draw the game world!
```eve
search
world = [#world]
commit
world <- [#ui/div style: [user-select: "none" -webkit-user-select: "none" -moz-user-select: "none"] children:
[#svg/root #game-window viewBox: "10 0 80 100", width: 480 children:
[#svg/rect x: 0 y: 0 width: 100 height: 53 fill: "rgb(112, 197, 206)" sort: 0]
[#svg/image x: 0 y: 52 width: 100 height: 43 preserveAspectRatio: "xMinYMin slice" href: "https://cdn.rawgit.com/bhauman/flappy-bird-demo/master/resources/public/imgs/background.png" sort: 1]
[#svg/rect x: 0 y: 95 width: 100 height: 5 fill: "rgb(222, 216, 149)" sort: 0]]]
```
```eve
commit
[#ui/div text: "hello from Eve"]
```
<$eve markdown="""
```
commit
[#ui/div text: "hello using triple double quotes"]
```
"""/>
```eve
commit
// This isn't an error...the block just doesn't match
[#ui/div text: "Undefined variable here:" undefined_variable]
```
```eve
commit
a=5
[#ui/div text: "invalid assignment in a commit"]
```
```eve
search
a = math/sin[degrees: "not a number"]
bind
[#ui/div text: "sin of a string: {{a}}"]
```
```eve
search
a = 1
bind
a <- 2
```
```eve
search
*
bind
[#ui/div text: a]
```
```eve
bind
[#ui/div text: "missing quote]
```
The state of an eve program can be stored to tiddler fields. This is important because tiddlers frequently get refreshed (i.e. closing and opening a tiddler among many other possibilities). Upon refresh, the `eve` widget is recreated from scratch.
For the [[hello.eve]] example this does not matter because that program has no changeable state.
However, this [[counter.eve]] example is an interactive program in which counters can be incremented and decremented by clicking on the `+` and `-` buttons.
```
<$eve markdown={{counter.eve}}/>
```
which renders as
<$eve markdown={{counter.eve}}/>
If you click the buttons to change the counter values and then close and reopen this tiddler, the counters will be reset back to zero.
There are two requirements for persisting the state. First, the eve records you want stored must be marked with the `#persist` tag. Also, the name of a tiddler to which the data is to be stored must be passed into the widget using the optional attribute `save-tiddler`.
The first requirement is already met in the [[counter.eve]] code. In this widget instantiation, the 2nd requirement is met:
```
<$eve save-tiddler="test-eve-save" markdown={{counter.eve}}/>
```
which renders as
<$eve save-tiddler="test-eve-save" markdown={{counter.eve}}/>
if you change these counters and refresh the widget, the changes will not be lost.
You can inspect the persisted data at [[test-eve-save]]
---
The original counter.eve example generated the initial counters like this:
```eve
search
sort = math/range[start: 1 stop: 2]
commit
[#counter sort count: 0]
[#counter #fancy sort: 5 count: 0]
```
In order to add support for storing the `#counter` records, I changed it to this:
```eve
search
sort = math/range[start: 1 stop: 2]
not([#counter sort: s count: c])
commit
[#counter #persist sort count: 0]
[#counter #persist #fancy sort: 5 count: 0]
```
The `#persist` tag is added to the `#counter` records and also the `not([#counter sort: s count: c])` line is added in order to generate the initial counters only if none are already found.
---
''Note'': I haven't tested this functionality much yet, so it is likely far from perfect.
```
<$eve markdown={{clock.eve}}/>
```
renders as
<$eve markdown={{clock.eve}}/>
The contents of the [[clock.eve]] tiddler:
---
{{clock.eve}}
This tiddler is used to store the eve state for the [[counter.eve]] code. Here are the eve related fields being stored in this tiddler:
<$list variable=field filter="[all[current]fields[]] -text -created -creator -modified -tags -title -modifier -type -revision -bag">
* ''<<field>>'' - <$transclude field=<<field>> mode=inline/>
</$list>
Click the edit button on this tiddler to see more.
# Tic-Tac-Toe
Code copied from [eve starter](https://github.com/witheve/eve-starter/blob/fe1a27930c9afa85ffc8c6221060e16ff2899670/programs/tic-tac-toe.eve)
## Game logic
Tic-Tac-Toe is a classic game played by two players, "X" and "O", who take turns marking their letter on a 3x3 grid. The first player to mark 3 adjacent cells in a line wins. The game can potentially result in a draw, where all grid cells are marked, but neither player has 3 adjacent cells. To build this game in Eve, we need several parts:
- A game board with cells
- A way to mark a cell as "X" or "O"
- A way to recognize that a player has won the game.
### Game settings
To begin, we initialize the board. We commit a `#board` record to hold our global state and create a set of `#cell`s, which will keep track of the moves players have made. Common connect-N games (a generalized tic-tac-toe for any `NxN` grid) are scored along 4 axes (horizontal, vertical, the diagonal, and the anti-diagonal). We group cells together along each axis up front to make scoring easier later.
The game board is square, with a given size. It contains size ^ 2 cells,
each with a row and column index.
```eve
search
// board constants
size = 3
starting-player = "X"
// generate the cells
i = math/range[start: 1, stop: size]
j = math/range[start: 1, stop: size]
commit
board = [#board size player: starting-player]
[#cell board row: i column: j]
```
A subtlety here is the last line, [#cell board row: i column: j]. Thanks to our relational semantics, this line actually generates all 9 cells. Since the sets of values computed in i and j have no relation to each other, when we use them together we get the cartesian product of their values. This means that if `i = {1, 2, 3}` and `j = {1, 2, 3}`, then `i x j = {(1, 1), (1, 2), ... (3, 2), (3, 3)}`. These are exactly the indices we need for our grid!
Now we tag some special cell groupings: diagonal and anti-diagonal cells. The diagonal cells are `(1, 1)`, `(2, 2)`, and `(3, 3)`. From this we can see that diagonal cells have a row index equal to its column index
```eve
search
cells = [#cell row column]
row = column
bind
cells += #diagonal
```
Similarly, the anti-diagonal cells are `(1, 3)`, `(2, 2)`, and `(3, 1)`.
Anti-diagonal cells satisfy the equation `row + col = N + 1`,
where `N` is the size of the board.
```eve
search
cells = [#cell row column]
[#board size: N]
row + column = N + 1
bind
cells += #anti-diagonal
```
### Winning condition
A game is won when a player marks N cells in a row, column, or diagonal.
The game can end in a tie, where no player has N in a row.
```eve
search
board = [#board size: N, not(winner)]
(winner, winning-cell) =
if cell = [#cell row player] N = gather/count[for: cell per: (row, player)] then (player, cell)
else if cell = [#cell column player] N = gather/count[for: cell per: (column, player)] then (player, cell)
else if cell = [#diagonal player] N = gather/count[for: cell per: player] then (player, cell)
else if cell = [#anti-diagonal player] N = gather/count[for: cell per: player] then (player, cell)
//else if N * N = gather/count[for: [#cell player]] then ("Nobody", "nothing") // Cat's game!
else if not([#cell not(player)]) then ("Nobody", "nothing")
commit
board.winner := winner
winning-cell += #winner
```
We use the count aggregate in the above block. Count returns the number of discrete values (the cardinality) of the variables in given. The optional per attribute allows you to specify groupings, which yield one result for each set of values in the group.
For example, in count[given: cell, per: player] we group by player, which returns two values: the count of cells marked by player X and those marked by O. This can be read "count the cells per player". In the scoring block, we group by column and player. This will return the count of cells marked by a player in a particular column. Like wise with the row case. By equating this with N, we ensure the winning player is only returned when she has marked N cells in the given direction.
This is how Eve works without looping. Rather than writing a nested for loop and iterating over the cells, we can use Eve's semantics to our advantage.
We first search every row, then every column. Finally we check the diagonal and anti-diagonal. To do this, we leverage the `#diagonal` and `#anti-diagonal` tags we created earlier; instead of searching for `#cell`, we can search for these new tags to select only a subset of cells.
## React to Events
Next, we handle user input. Any time a cell is directly clicked, we:
- Ensure the cell hasn't already been played
- Check for a winner
- Switch to the next player
Then update the cell to reflect its new owner, and switch board's player to the next player.
### Marking a cell
Click on a cell to make your move
```eve
search
[#html/event/click target: [#ui/div cell]]
// Ensures the cell hasn't been played
not(cell.player)
// Ensures the game has not been won
board = [#board player: current, not(winner)]
// Switches to the next player
next_player = if current = "X" then "O"
else "X"
commit
board.player := next_player
cell.player := current
```
### Reset the game
Since games of tic-tac-toe are often very short and extremely competitive, it's imperative that it be quick and easy to begin a new match. When the game is over (the board has a winner attribute), a click anywhere on the drawing area will reset the game for another round of play.
A reset consists of:
- Clearing the board of a winner
- Clearing all of the cells
- Removing the #winner tag from the winning cell set
```eve
search
[#html/event/click element: [#ui/div board]]
board = [#board winner]
cell = [#cell player]
commit
board.winner := none
cell.player := none
cell -= #winner
```
## Drawing the Game
We've implemented the game logic, but now we need to actually draw the board so players have something to see and interact with. Our general strategy will be that the game board is a #div with one child `#div` for each cell. Each cell will be drawn with an "X", "O", or empty string as text. We also add a `#status` div, which we'll write game state into later. Our cells have the CSS inlined, but you could just as easily link to an external file.
### Draw the board
```eve
search
board = [#board]
cell = [#cell board row column]
contents = if cell.player then cell.player
else ""
bind
[#ui/div board #container | style: [font-family: "sans-serif" padding: "10px"] children:
[#ui/div #status board class: "status" | style: [text-align: "center" width: "150px" height: "50px"]]
[#ui/div board class: "board" | style: [color: "black"] children:
[#ui/div board class: "row" sort: row, | children:
[#ui/div #cell-div cell class: "cell" sort: column text: contents |
style: [cell display: "inline-block" width: "50px" height: "50px" border: "1px solid black" background: "white" font-size: "2em" line-height: "50px" text-align: "center" vertical-align: "top"]]]]]
```
Winning cells are drawn in a different color
```eve
search
winning-cell = [#cell #winner]
cell-elements = [#ui/div cell: winning-cell style]
bind
style.color := "blue"
```
### Draw status message
Finally, we fill the previously mentioned #status div with our current game state. If no winner has been declared, we remind the competitors of whose turn it is, and once a winner is found we announce her newly-acquired bragging rights.
Display the current player if the game isn't won
```eve
search
status = [#status board]
not(board.winner)
bind
status.text += "It's {{board.player}}'s turn!"
```
When the game is won, display the winner
```eve
search
status = [#status board]
winner = board.winner
bind
status.text += "{{winner}} wins! Click anywhere to restart!"
```