Skip to content

Instantly share code, notes, and snippets.

@Jermolene
Last active April 25, 2023 04:00
Show Gist options
  • Save Jermolene/8383863 to your computer and use it in GitHub Desktop.
Save Jermolene/8383863 to your computer and use it in GitHub Desktop.
Unofficial build of TiddlyWiki 5.0.7-prerelease for testing
<!doctype html>
<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->
<!-- saved from url=(0021)http://tiddlywiki.com -->
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Force IE standards mode for Intranet and HTA - should be the first meta -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="application-name" content="TiddlyWiki" />
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="5.0.7-prerelease" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="format-detection" content="telephone=no" />
<meta name="copyright" content="TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
Copyright © Jeremy Ruston 2004-2007
Copyright © UnaMesa Association 2007-2014
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
Neither the name of the UnaMesa Association nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
" />
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<title>TiddlyWiki — a non-linear personal web notebook</title>
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~--><!--~~ Raw markup ~~-->
</head>
<body class="tw-body">
<!--~~ Static styles ~~-->
<div id="styleArea">
<style data-tiddler-title="$:/boot/boot.css" data-tiddler-type="text/css" type="text/css">/*
Basic styles used before we boot up the parsing engine
*/
/*
Error message and password prompt
*/
.tw-password-wrapper, .tw-error-form {
font-family: sans-serif;
z-index: 20000;
position: fixed;
text-align: center;
width: 200px;
top: 4em;
left: 50%;
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
padding: 16px 16px 16px 16px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
.tw-error-form {
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
background-color: rgb(255, 75, 75);
border: 8px solid rgb(255, 0, 0);
}
.tw-error-form div {
padding-bottom: 1em;
}
.tw-error-prompt {
color: #000;
text-shadow: none;
}
.tw-password-wrapper {
color: #000;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
background-color: rgb(197, 235, 183);
border: 8px solid rgb(164, 197, 152);
}
.tw-password-wrapper form {
text-align: left;
}
.tw-password-wrapper h1 {
font-size: 16px;
line-height: 20px;
padding-bottom: 16px;
}
</style>
</div>
<!--~~ Static content for Google and browsers without JavaScript ~~-->
<noscript>
<div id="splashArea">
<div class=' tw-reveal' hidden='true'></div>
</div>
</noscript>
<!--~~ Ordinary tiddlers ~~-->
<div id="storeArea" style="display:none;">
<div dependents="" description="TiddlyWiki5 core plugin" plugin-priority="0" plugin-type="plugin" title="$:/core" type="application/json" version="5.0.7-prerelease">
<pre>{
&quot;tiddlers&quot;: {
&quot;$:/core/copyright.txt&quot;: {
&quot;title&quot;: &quot;$:/core/copyright.txt&quot;,
&quot;type&quot;: &quot;text/plain&quot;,
&quot;text&quot;: &quot;TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\n\nCopyright © Jeremy Ruston 2004-2007\nCopyright © UnaMesa Association 2007-2014\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of the UnaMesa Association nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n&quot;
},
&quot;$:/docs/fields/bag&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/bag&quot;,
&quot;text&quot;: &quot;The name of the bag from which a tiddler came&quot;
},
&quot;$:/docs/fields/color&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/color&quot;,
&quot;text&quot;: &quot;The CSS color value associated with a tiddler&quot;
},
&quot;$:/docs/fields/created&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/created&quot;,
&quot;text&quot;: &quot;The date a tiddler was created&quot;
},
&quot;$:/docs/fields/creator&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/creator&quot;,
&quot;text&quot;: &quot;The name of the person who created a tiddler&quot;
},
&quot;$:/docs/fields/description&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/description&quot;,
&quot;text&quot;: &quot;The descriptive text for a wizard&quot;
},
&quot;$:/docs/fields/draft.of&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/draft.of&quot;,
&quot;text&quot;: &quot;For draft tiddlers, contains the title of the tiddler of which this is a draft&quot;
},
&quot;$:/docs/fields/draft.title&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/draft.title&quot;,
&quot;text&quot;: &quot;For draft tiddlers, contains the proposed new title of the tiddler&quot;
},
&quot;$:/docs/fields/footer&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/footer&quot;,
&quot;text&quot;: &quot;The footer text for a wizard&quot;
},
&quot;$:/docs/fields/icon&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/icon&quot;,
&quot;text&quot;: &quot;The title of the tiddler containing the icon associated with a tiddler&quot;
},
&quot;$:/docs/fields/library&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/library&quot;,
&quot;text&quot;: &quot;If set to \&quot;yes\&quot; indicates that a tiddler should be saved as a JavaScript library&quot;
},
&quot;$:/docs/fields/list&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/list&quot;,
&quot;text&quot;: &quot;An ordered list of tiddler titles associated with a tiddler&quot;
},
&quot;$:/docs/fields/modified&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/modified&quot;,
&quot;text&quot;: &quot;The date and time at which a tiddler was last modified&quot;
},
&quot;$:/docs/fields/modifier&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/modifier&quot;,
&quot;text&quot;: &quot;The tiddler title associated with the person who last modified a tiddler&quot;
},
&quot;$:/docs/fields/name&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/name&quot;,
&quot;text&quot;: &quot;The human readable name associated with a plugin tiddler&quot;
},
&quot;$:/docs/fields/plugin-priority&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/plugin-priority&quot;,
&quot;text&quot;: &quot;A numerical value indicating the priority of a plugin tiddler&quot;
},
&quot;$:/docs/fields/plugin-type&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/plugin-type&quot;,
&quot;text&quot;: &quot;The type of plugin in a plugin tiddler&quot;
},
&quot;$:/docs/fields/revision&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/revision&quot;,
&quot;text&quot;: &quot;The revision of the tiddler held at the server&quot;
},
&quot;$:/docs/fields/source&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/source&quot;,
&quot;text&quot;: &quot;The source URL associated with a tiddler&quot;
},
&quot;$:/docs/fields/subtitle&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/subtitle&quot;,
&quot;text&quot;: &quot;The subtitle text for a wizard&quot;
},
&quot;$:/docs/fields/tags&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/tags&quot;,
&quot;text&quot;: &quot;A list of tags associated with a tiddler&quot;
},
&quot;$:/docs/fields/text&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/text&quot;,
&quot;text&quot;: &quot;The body text of a tiddler&quot;
},
&quot;$:/docs/fields/title&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/title&quot;,
&quot;text&quot;: &quot;The unique name of a tiddler&quot;
},
&quot;$:/docs/fields/type&quot;: {
&quot;title&quot;: &quot;$:/docs/fields/type&quot;,
&quot;text&quot;: &quot;The content type of a tiddler&quot;
},
&quot;$:/docs/moduletypes/animation&quot;: {
&quot;title&quot;: &quot;$:/docs/moduletypes/animation&quot;,
&quot;text&quot;: &quot;Animation modules contain animations that may be used with the RevealWidget.&quot;
},
&quot;$:/docs/types/application/json&quot;: {
&quot;title&quot;: &quot;$:/docs/types/application/json&quot;,
&quot;description&quot;: &quot;JSON data&quot;,
&quot;name&quot;: &quot;application/json&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/application/x-tiddler-dictionary&quot;: {
&quot;title&quot;: &quot;$:/docs/types/application/x-tiddler-dictionary&quot;,
&quot;description&quot;: &quot;Data dictionary&quot;,
&quot;name&quot;: &quot;application/x-tiddler-dictionary&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/image/gif&quot;: {
&quot;title&quot;: &quot;$:/docs/types/image/gif&quot;,
&quot;description&quot;: &quot;GIF image&quot;,
&quot;name&quot;: &quot;image/gif&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/image/jpeg&quot;: {
&quot;title&quot;: &quot;$:/docs/types/image/jpeg&quot;,
&quot;description&quot;: &quot;JPEG image&quot;,
&quot;name&quot;: &quot;image/jpeg&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/image/png&quot;: {
&quot;title&quot;: &quot;$:/docs/types/image/png&quot;,
&quot;description&quot;: &quot;PNG image&quot;,
&quot;name&quot;: &quot;image/png&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/image/svg+xml&quot;: {
&quot;title&quot;: &quot;$:/docs/types/image/svg+xml&quot;,
&quot;description&quot;: &quot;Structured Vector Graphics image&quot;,
&quot;name&quot;: &quot;image/svg+xml&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/image/x-icon&quot;: {
&quot;title&quot;: &quot;$:/docs/types/image/x-icon&quot;,
&quot;description&quot;: &quot;ICO format icon file&quot;,
&quot;name&quot;: &quot;image/x-icon&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/text/plain&quot;: {
&quot;title&quot;: &quot;$:/docs/types/text/plain&quot;,
&quot;description&quot;: &quot;Plain text&quot;,
&quot;name&quot;: &quot;text/plain&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/text/vnd.tiddlywiki&quot;: {
&quot;title&quot;: &quot;$:/docs/types/text/vnd.tiddlywiki&quot;,
&quot;description&quot;: &quot;TiddlyWiki version 5 wikitext&quot;,
&quot;name&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/docs/types/text/x-tiddlywiki&quot;: {
&quot;title&quot;: &quot;$:/docs/types/text/x-tiddlywiki&quot;,
&quot;description&quot;: &quot;TiddlyWiki Classic wikitext&quot;,
&quot;name&quot;: &quot;text/x-tiddlywiki&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/core/images/cancel-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/cancel-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-cancel-button tw-image-button\&quot; viewBox=\&quot;366 150 58 58\&quot; width=\&quot;22pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 414.76236 158.98764 C 403.77887 148.0041 385.97113 148.0041 374.98764 158.98764 C 364.0041 169.97113 364.0041 187.77887 374.98764 198.76236 C 385.97113 209.7459 403.77887 209.7459 414.76236 198.76236 C 425.7459 187.77887 425.7459 169.97113 414.76236 158.98764 M 385.3967 165.32954 L 385.3967 165.32954 L 394.77674 174.7096 L 404.3533 165.13303 C 405.53068 163.95566 407.4396 163.95566 408.61697 165.13303 C 409.79434 166.31041 409.79434 168.21932 408.61697 169.39669 L 399.0404 178.97325 L 408.42046 188.35331 C 409.59783 189.53068 409.59783 191.43959 408.42046 192.61697 L 408.42046 192.61697 C 407.24308 193.79434 405.33417 193.79434 404.1568 192.61697 L 394.77675 183.23692 L 385.5932 192.42046 C 384.41583 193.59783 382.50692 193.59783 381.32954 192.42046 L 381.32954 192.42046 C 380.15217 191.24308 380.15217 189.33417 381.32954 188.1568 C 381.32954 188.1568 381.32954 188.1568 381.32954 188.1568 L 381.32954 188.1568 L 381.32954 188.1568 L 390.51309 178.97326 L 381.13303 169.5932 C 379.95566 168.41583 379.95566 166.50692 381.13303 165.32954 L 381.13303 165.32954 C 382.3104 164.15217 384.21932 164.15217 385.3967 165.32954 C 385.3967 165.32954 385.3967 165.32954 385.3967 165.32954 Z\&quot;/&gt;&lt;/svg&gt;&quot;
},
&quot;$:/core/images/close-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/close-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-close-button tw-image-button\&quot; viewBox=\&quot;222 150 56 56\&quot; width=\&quot;22pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 249.56668 185.88827 L 267.06757 203.38916 C 269.26427 205.58586 272.82582 205.58586 275.02252 203.38916 L 275.02252 203.38916 C 277.21922 201.19246 277.21922 197.63091 275.02252 195.43421 L 257.52163 177.93332 L 275.38916 160.06579 C 277.58586 157.86909 277.58586 154.30754 275.38916 152.11084 C 273.19246 149.91414 269.63091 149.91414 267.43421 152.11084 L 249.56668 169.97837 L 232.06579 152.47748 L 232.06579 152.47748 C 232.06579 152.47748 232.06579 152.47748 232.06579 152.47748 C 229.86909 150.28078 226.30754 150.28078 224.11084 152.47748 L 224.11084 152.47748 C 221.91414 154.674175 221.91414 158.23573 224.11084 160.43243 L 241.61173 177.93332 L 224.47748 195.06757 L 224.47748 195.06757 L 224.47748 195.06757 C 224.47748 195.06757 224.47748 195.06757 224.47748 195.06757 C 222.28078 197.26427 222.28078 200.82583 224.47748 203.02252 L 224.47748 203.02252 C 226.67418 205.21922 230.23573 205.21922 232.43243 203.02252 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/delete-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/delete-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-delete-button tw-image-button\&quot; viewBox=\&quot;303 155 39 50\&quot; width=\&quot;17pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 333 164.25 L 333 157.25 C 333 156.14543 332.10457 155.25 331 155.25 L 314.75 155.25 C 314.75 155.25 314.75 155.25 314.75 155.25 C 313.64543 155.25 312.75 156.14543 312.75 157.25 L 312.75 164.25 L 303.75 164.25 L 303.75 168.75 L 306 168.75 L 306 201.75 L 306 201.75 L 306 201.75 C 306 203.40685 307.34315 204.75 309 204.75 L 336.75 204.75 C 338.40685 204.75 339.75 203.40685 339.75 201.75 L 339.75 168.75 L 342 168.75 L 342 164.25 Z M 317.25 160.75 L 317.25 160.75 C 317.25 160.19772 317.69772 159.75 318.25 159.75 C 318.25 159.75 318.25 159.75 318.25 159.75 L 327.5 159.75 C 328.05228 159.75 328.5 160.19772 328.5 160.75 L 328.5 164.25 L 317.25 164.25 L 317.25 160.75 Z M 310.5 168.75 L 312.75 168.75 L 312.75 200.25 L 310.5 200.25 Z M 317.25 168.75 L 319.5 168.75 L 319.5 200.25 L 317.25 200.25 Z M 324 168.75 L 326.25 168.75 L 326.25 200.25 L 324 200.25 Z M 330.75 168.75 L 333 168.75 L 333 200.25 L 330.75 200.25 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/done-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/done-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-done-button tw-image-button\&quot; viewBox=\&quot;434 150 68 55\&quot; width=\&quot;22pt\&quot; height=\&quot;18pt\&quot;&gt;&lt;path d=\&quot;M 438.49266 178.00797 L 439.00744 177.49319 C 441.35054 175.15008 445.14946 175.15004 447.49262 177.49309 L 452.50734 182.50757 C 454.8505 184.85063 458.6494 184.85058 460.99252 182.50748 L 488.50747 154.99255 C 490.85058 152.64944 494.6495 152.6494 496.99266 154.99246 L 497.50722 155.506995 C 499.8504 157.85009 499.8505 161.64908 497.5074 163.99228 C 497.50738 163.99229 497.50736 163.99231 497.50734 163.99233 L 460.9926 200.5077 C 458.64947 202.85087 454.85048 202.8509 452.50732 200.50778 C 452.5073 200.50777 452.5073 200.50777 452.5073 200.50776 L 438.49268 186.49327 C 436.14952 184.15013 436.1495 180.35114 438.49264 178.00799 C 438.49265 178.00798 438.49265 178.00797 438.49266 178.00797 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/down-arrow&quot;: {
&quot;title&quot;: &quot;$:/core/images/down-arrow&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-down-arrow tw-image-button\&quot; viewBox=\&quot;441 306 59 45\&quot; width=\&quot;24pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 441 306 L 470.25 351 L 499.5 306 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/edit-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/edit-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-edit-button tw-image-button\&quot; viewBox=\&quot;244 193 20 22\&quot; width=\&quot;20pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 257.33334 196.80951 L 245.90476 207.2857 L 244 212.0476 L 248.7619 210.14284 L 260.19048 199.66665 Z M 259.2381 194.90475 L 258.28566 195.85716 L 261.14284 198.71428 L 262.09522 197.76187 Z M 261.14286 193 L 260.19042 193.95241 L 263.04762 196.80953 L 264 195.85714 Z M 244 213.72882 C 244 213.72882 247.4281 215.43353 250.8572 213.7288 C 254.28599 212.02405 261.14284 214.86531 261.14284 214.86531 L 261.14284 213.72884 C 261.14284 213.72884 254.28577 210.88755 250.8572 212.5923 C 247.42858 214.29712 244 212.59228 244 212.59228 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/info-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/info-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-info-button tw-image-button\&quot; viewBox=\&quot;294 150 58 58\&quot; width=\&quot;22pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 342.76236 158.98764 C 331.77887 148.0041 313.97113 148.0041 302.98764 158.98764 C 292.0041 169.97113 292.0041 187.77887 302.98764 198.76236 C 313.97113 209.7459 331.77887 209.7459 342.76236 198.76236 C 353.7459 187.77887 353.7459 169.97113 342.76236 158.98764 M 326.5425 157.5 L 326.5425 157.5 C 327.72545 157.5 328.72201 157.91022 329.5337 158.73088 C 330.34465 159.55157 330.75 160.54402 330.75 161.7075 C 330.75 162.87172 330.33979 163.86316 329.51911 164.68385 C 328.69842 165.5045 327.70674 165.91501 326.5425 165.91501 C 325.39801 165.91501 324.4153 165.5045 323.5946 164.68385 C 322.77393 163.86316 322.36372 162.87172 322.36372 161.7075 C 322.36372 160.54402 322.76906 159.55157 323.58 158.73088 C 324.39171 157.91022 325.3793 157.5 326.5425 157.5 Z M 327.80211 190.47259 C 324.91945 195.49132 321.85778 198 318.61462 198 C 317.37452 198 316.38691 197.65158 315.65186 196.9555 C 314.9176 196.25866 314.54943 195.37617 314.54943 194.30782 C 314.54943 193.60202 314.71223 192.70572 315.03629 191.61813 L 319.0151 177.93651 C 319.39685 176.61922 319.58735 175.62754 319.58735 174.95991 C 319.58735 174.53996 319.40582 174.16692 319.04356 173.84286 C 318.68052 173.51905 318.18469 173.35701 317.55527 173.35701 C 317.26861 173.35701 316.92506 173.36677 316.5246 173.38548 L 316.89661 172.2407 L 326.59967 170.66627 L 328.31744 170.66627 L 322.44986 191.01638 C 322.12503 192.18064 321.963 192.94337 321.963 193.30666 C 321.963 193.51588 322.04862 193.71121 322.2204 193.89273 C 322.39218 194.07425 322.5737 194.16554 322.7642 194.16477 C 323.08903 194.16554 323.4131 194.02221 323.73792 193.73559 C 324.59605 193.02976 325.6267 191.75142 326.82838 189.90008 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/new-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/new-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-new-button tw-image-button\&quot; viewBox=\&quot;83 81 50 50\&quot; width=\&quot;22pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 101.25 112.5 L 101.25 127.5 C 101.25 127.5 101.25 127.5 101.25 127.5 L 101.25 127.5 C 101.25 129.156855 102.593146 130.5 104.25 130.5 L 111.75 130.5 C 113.406854 130.5 114.75 129.156854 114.75 127.5 L 114.75 112.5 L 129.75 112.5 C 131.406854 112.5 132.75 111.156854 132.75 109.5 L 132.75 102 C 132.75 100.343146 131.406854 99 129.75 99 L 114.75 99 L 114.75 84 C 114.75 82.343146 113.406854 81 111.75 81 L 104.25 81 C 104.25 81 104.25 81 104.25 81 C 102.593146 81 101.25 82.343146 101.25 84 L 101.25 99 L 86.25 99 C 86.25 99 86.25 99 86.25 99 C 84.593146 99 83.25 100.343146 83.25 102 L 83.25 109.5 C 83.25 109.5 83.25 109.5 83.25 109.5 L 83.25 109.5 C 83.25 111.156855 84.593146 112.5 86.25 112.5 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/options-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/options-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-options-button tw-image-button\&quot; viewBox=\&quot;434 218 68 68\&quot; width=\&quot;22pt\&quot; height=\&quot;22pt\&quot;&gt;&lt;path d=\&quot;M 478.39696 232.53705 L 478.39696 232.53705 C 477.11453 231.85132 475.77877 231.30146 474.4106 230.88735 L 474.4106 218.24993 L 461.58944 218.24993 L 461.58944 230.88735 C 460.22126 231.30146 458.8855 231.85132 457.60308 232.53705 L 448.66825 223.60214 L 439.6022 232.66814 L 448.53716 241.60304 C 447.8515 242.88541 447.30158 244.22116 446.88747 245.58935 L 434.25 245.58935 L 434.25 258.41052 L 446.88747 258.41052 C 447.30158 259.7787 447.8515 261.11446 448.53716 262.39689 L 439.6022 271.33173 L 448.66825 280.39779 L 457.60308 271.46281 C 458.8855 272.14862 460.22126 272.69847 461.58944 273.11251 L 461.58944 285.74986 L 474.4106 285.74986 L 474.4106 273.11251 C 475.77877 272.69847 477.11453 272.14862 478.39696 271.46281 L 487.3318 280.39779 L 496.3977 271.33173 L 487.46287 262.39689 C 488.14854 261.11446 488.6984 259.7787 489.11257 258.41052 L 501.7499 258.41052 L 501.7499 245.58935 L 489.11257 245.58935 C 488.6984 244.22116 488.14854 242.88541 487.46287 241.60304 L 496.3977 232.66814 L 487.3318 223.60214 Z M 475.3328 244.66714 C 479.38253 248.71698 479.38253 255.2829 475.3328 259.33273 C 471.28297 263.3826 464.71706 263.3826 460.66723 259.33273 C 456.61737 255.2829 456.61737 248.71698 460.66723 244.66714 C 464.71706 240.61734 471.28297 240.61734 475.3328 244.66714\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/core/images/save-button&quot;: {
&quot;title&quot;: &quot;$:/core/images/save-button&quot;,
&quot;text&quot;: &quot;&lt;svg class=\&quot;tw-image-save-button tw-image-button\&quot; viewBox=\&quot;4 512 64 60\&quot; width=\&quot;22pt\&quot; height=\&quot;21pt\&quot;&gt;&lt;path d=\&quot;M 13.5 537.75 L 11.5 537.75 C 11.5 537.75 11.5 537.75 11.5 537.75 C 7.6340064 537.75 4.4999994 540.884 4.5 544.75 L 4.5 564.5 L 4.5 564.5 C 4.5 564.5 4.5 564.5 4.5 564.5 L 4.5 564.5 C 4.5000006 568.366 7.634007 571.5 11.5 571.5 L 60.5 571.5 C 64.365993 571.5 67.5 568.366 67.5 564.5 L 67.5 544.75 C 67.5 540.884 64.365993 537.75 60.5 537.75 L 58.5 537.75 L 49.5 546.75 L 50 546.75 C 52.20914 546.75 54 548.54086 54 550.75 L 54 556.25 C 54 558.45914 52.20914 560.25 50 560.25 L 36 560.25 L 22 560.25 C 19.790861 560.25 18 558.45914 18 556.25 L 18 556.25 C 18 556.25 18 556.25 18 556.25 L 18 550.75 C 18 548.54086 19.790861 546.75 22 546.75 C 22 546.75 22 546.75 22 546.75 L 22.5 546.75 Z\&quot;/&gt;&lt;path d=\&quot;M 16.37132 533.87132 L 33.87868 551.37868 C 35.050253 552.55025 36.949747 552.55025 38.12132 551.37868 L 55.62868 533.87132 C 56.800252 532.69975 56.800252 530.80025 55.62868 529.62868 C 55.06607 529.06607 54.30301 528.75 53.50736 528.75 L 48 528.75 C 46.343146 528.75 45 527.40685 45 525.75 L 45 516 C 45 514.34315 43.656854 513 42 513 L 30 513 C 28.343146 513 27 514.34315 27 516 L 27 525.75 C 27 527.40685 25.656854 528.75 24 528.75 L 18.492641 528.75 C 16.835786 528.75 15.492641 530.09315 15.492641 531.75 C 15.492641 532.54565 15.808711 533.3087 16.37132 533.87132 Z\&quot;/&gt;&lt;/svg&gt;\n&quot;
},
&quot;$:/messages/Download&quot;: {
&quot;title&quot;: &quot;$:/messages/Download&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;subtitle&quot;: &quot;Download changes&quot;,
&quot;footer&quot;: &quot;&lt;$button message=\&quot;tw-close-tiddler\&quot; class=\&quot;btn btn-primary\&quot;&gt;Close&lt;/$button&gt;&quot;,
&quot;help&quot;: &quot;http://five.tiddlywiki.com/static/DownloadingChanges.html&quot;,
&quot;text&quot;: &quot;Your browser only supports manual saving.\n\nTo save your modified wiki, right click on the download link below and select \&quot;Download file\&quot; or \&quot;Save file\&quot;, 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&quot;
},
&quot;$:/messages/EnterEditMode&quot;: {
&quot;title&quot;: &quot;$:/messages/EnterEditMode&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;subtitle&quot;: &quot;Editing this wiki&quot;,
&quot;footer&quot;: &quot;&lt;&lt;button close class:\&quot;btn btn-primary\&quot;&gt;&lt;Close&gt;&gt;&quot;,
&quot;help&quot;: &quot;http://five.tiddlywiki.com/static/EditMode&quot;,
&quot;text&quot;: &quot;You can edit this wiki and save your changes. You are strongly advised to verify that saving is working properly before trusting ~TiddlyWiki with your data.\n\nThe following methods of saving changes are available:\n\n* Using Firefox's built-in file system access\n* Uploading to a simple server script\n* Using HTML5's data URI and download attribute\n\n\n[x] Don't show this message again&quot;
},
&quot;$:/messages/SaveInstructions&quot;: {
&quot;title&quot;: &quot;$:/messages/SaveInstructions&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;subtitle&quot;: &quot;Save your work&quot;,
&quot;footer&quot;: &quot;&lt;$button message=\&quot;tw-close-tiddler\&quot; class=\&quot;btn btn-primary\&quot;&gt;Close&lt;/$button&gt;&quot;,
&quot;help&quot;: &quot;http://five.tiddlywiki.com/static/SavingChanges&quot;,
&quot;text&quot;: &quot;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&quot;
},
&quot;$:/messages/Saved&quot;: {
&quot;title&quot;: &quot;$:/messages/Saved&quot;,
&quot;text&quot;: &quot;Saved wiki\n&quot;
},
&quot;$:/messages/StartingSave&quot;: {
&quot;title&quot;: &quot;$:/messages/StartingSave&quot;,
&quot;text&quot;: &quot;Starting to save wiki\n&quot;
},
&quot;$:/core/modules/commander.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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\tthis.commandTokens = commandTokens;\n\tthis.nextToken = 0;\n\tthis.callback = callback;\n\tthis.wiki = wiki;\n\tthis.streams = streams;\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 &gt;= 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) !== \&quot;--\&quot;) {\n\t\t\tthis.callback(\&quot;Missing command\&quot;);\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 &lt; this.commandTokens.length &amp;&amp; \n\t\t\t\tthis.commandTokens[this.nextToken].substr(0,2) !== \&quot;--\&quot;) {\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(\&quot;Unknown command: \&quot; + commandName);\n\t\t\t} else {\n\t\t\t\tif(this.verbose) {\n\t\t\t\t\tthis.streams.output.write(\&quot;Executing command: \&quot; + commandName + \&quot; \&quot; + params.join(\&quot; \&quot;) + \&quot;\\n\&quot;);\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 || \&quot;command\&quot;;\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/commander.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;global&quot;
},
&quot;$:/core/modules/commands/load.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;load\&quot;,\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(\&quot;fs\&quot;),\n\t\tpath = require(\&quot;path\&quot;);\n\tif(this.params.length &lt; 1) {\n\t\treturn \&quot;Missing filename\&quot;;\n\t}\n\tfs.readFile(this.params[0],\&quot;utf8\&quot;,function(err,data) {\n\t\tif(err) {\n\t\t\tself.callback(err);\n\t\t} else {\n\t\t\tvar fields = {title: self.params[0]},\n\t\t\t\ttype = path.extname(self.params[0]);\n\t\t\tvar tiddlers = self.commander.wiki.deserializeTiddlers(type,data,fields);\n\t\t\tif(!tiddlers) {\n\t\t\t\tself.callback(\&quot;No tiddlers found in file \\\&quot;\&quot; + self.params[0] + \&quot;\\\&quot;\&quot;);\n\t\t\t} else {\n\t\t\t\tfor(var t=0; t&lt;tiddlers.length; t++) {\n\t\t\t\t\tself.commander.wiki.addTiddler(new $tw.Tiddler(tiddlers[t]));\n\t\t\t\t}\n\t\t\t\tself.callback(null);\t\n\t\t\t}\n\t\t}\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/load.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/password.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;password\&quot;,\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 &lt; 1) {\n\t\treturn \&quot;Missing password\&quot;;\n\t}\n\t$tw.crypto.setPassword(this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/password.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/print.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/commands/print.js\ntype: application/javascript\nmodule-type: command\n\nPrint command for inspecting TiddlyWiki internals\n\n\\*/\n(function(){\n\n/*jshint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;print\&quot;,\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.output = commander.streams.output;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length &lt; 1) {\n\t\treturn \&quot;Too few parameters for print command\&quot;;\n\t}\n\tvar subcommand = this.subcommands[this.params[0]];\n\tif(subcommand) {\n\t\treturn subcommand.call(this);\n\t} else {\n\t\treturn \&quot;Unknown subcommand (\&quot; + this.params[0] + \&quot;) for print command\&quot;;\n\t}\n};\n\nCommand.prototype.subcommands = {};\n\nCommand.prototype.subcommands.tiddler = function() {\n\tif(this.params.length &lt; 2) {\n\t\treturn \&quot;Too few parameters for print tiddler command\&quot;;\n\t}\n\tvar tiddler = this.commander.wiki.getTiddler(this.params[1]);\n\tif(!tiddler) {\n\t\treturn \&quot;No such tiddler as '\&quot; + this.params[1] + \&quot;'\&quot;;\n\t}\n\tthis.output.write(\&quot;Tiddler '\&quot; + this.params[1] + \&quot;' contains these fields:\\n\&quot;);\n\tfor(var t in tiddler.fields) {\n\t\tthis.output.write(\&quot; \&quot; + t + \&quot;: \&quot; + tiddler.getFieldString(t) + \&quot;\\n\&quot;);\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.tiddlers = function() {\n\tvar tiddlers = this.commander.wiki.getTiddlers();\n\tthis.output.write(\&quot;Wiki contains these tiddlers:\\n\&quot;);\n\tfor(var t=0; t&lt;tiddlers.length; t++) {\n\t\tthis.output.write(tiddlers[t] + \&quot;\\n\&quot;);\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.system = function() {\n\tvar tiddlers = this.commander.wiki.getSystemTitles();\n\tthis.output.write(\&quot;Wiki contains these system tiddlers:\\n\&quot;);\n\tfor(var t=0; t&lt;tiddlers.length; t++) {\n\t\tthis.output.write(tiddlers[t] + \&quot;\\n\&quot;);\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.config = function() {\n\tvar self = this;\n\tvar quotePropertyName = function(p) {\n\t\t\tvar unquotedPattern = /^[A-Za-z0-9_]*$/mg;\n\t\t\tif(unquotedPattern.test(p)) {\n\t\t\t\treturn p;\n\t\t\t} else {\n\t\t\t\treturn \&quot;[\\\&quot;\&quot; + $tw.utils.stringify(p) + \&quot;\\\&quot;]\&quot;;\n\t\t\t}\n\t\t},\n\t\tprintConfig = function(object,prefix) {\n\t\t\tfor(var n in object) {\n\t\t\t\tvar v = object[n];\n\t\t\t\tif(typeof v === \&quot;object\&quot;) {\n\t\t\t\t\tprintConfig(v,prefix + \&quot;.\&quot; + quotePropertyName(n));\n\t\t\t\t} else if(typeof v === \&quot;string\&quot;) {\n\t\t\t\t\tself.output.write(prefix + \&quot;.\&quot; + quotePropertyName(n) + \&quot;: \\\&quot;\&quot; + $tw.utils.stringify(v) + \&quot;\\\&quot;\\n\&quot;);\n\t\t\t\t} else {\n\t\t\t\t\tself.output.write(prefix + \&quot;.\&quot; + quotePropertyName(n) + \&quot;: \&quot; + v.toString() + \&quot;\\n\&quot;);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tprintObject = function(heading,object) {\n\t\t\tself.output.write(heading +\&quot;\\n\&quot;);\n\t\t\tfor(var n in object) {\n\t\t\t\tself.output.write(\&quot; \&quot; + n + \&quot;\\n\&quot;);\n\t\t\t}\n\t\t};\n\tthis.output.write(\&quot;Configuration:\\n\&quot;);\n\tprintConfig($tw.config,\&quot; $tw.config\&quot;);\n\tprintObject(\&quot;Tiddler field modules:\&quot;,$tw.Tiddler.fieldModules);\n\tprintObject(\&quot;Loaded modules:\&quot;,$tw.modules.titles);\n\tprintObject(\&quot;Command modules:\&quot;,$tw.commands);\n\tprintObject(\&quot;Parser modules:\&quot;,$tw.wiki.parsers);\n\tprintObject(\&quot;Macro modules:\&quot;,$tw.wiki.macros);\n\tprintObject(\&quot;Deserializer modules:\&quot;,$tw.Wiki.tiddlerDeserializerModules);\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/print.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/rendertiddler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;rendertiddler\&quot;,\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 &lt; 2) {\n\t\treturn \&quot;Missing filename\&quot;;\n\t}\n\tvar self = this,\n\t\tfs = require(\&quot;fs\&quot;),\n\t\tpath = require(\&quot;path\&quot;),\n\t\ttitle = this.params[0],\n\t\tfilename = this.params[1],\n\t\ttype = this.params[2] || \&quot;text/html\&quot;;\n\tfs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),\&quot;utf8\&quot;,function(err) {\n\t\tself.callback(err);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/rendertiddler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/rendertiddlers.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\n\nexports.info = {\n\tname: \&quot;rendertiddlers\&quot;,\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 &lt; 2) {\n\t\treturn \&quot;Missing filename\&quot;;\n\t}\n\tvar self = this,\n\t\tfs = require(\&quot;fs\&quot;),\n\t\tpath = require(\&quot;path\&quot;),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\ttemplate = this.params[1],\n\t\tpathname = this.params[2],\n\t\ttype = this.params[3] || \&quot;text/html\&quot;,\n\t\textension = this.params[4] || \&quot;.html\&quot;,\n\t\ttiddlers = wiki.filterTiddlers(filter);\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\tvar container = $tw.document.createElement(\&quot;div\&quot;);\n\t\twidgetNode.render(container,null);\n\t\tvar text = type === \&quot;text/html\&quot; ? container.innerHTML : container.textContent;\n\t\tfs.writeFileSync(path.resolve(pathname,encodeURIComponent(title) + extension),text,\&quot;utf8\&quot;);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/rendertiddlers.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/savetiddler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;savetiddler\&quot;,\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 &lt; 2) {\n\t\treturn \&quot;Missing filename\&quot;;\n\t}\n\tvar self = this,\n\t\tfs = require(\&quot;fs\&quot;),\n\t\tpath = require(\&quot;path\&quot;),\n\t\ttitle = this.params[0],\n\t\tfilename = this.params[1],\n\t\ttiddler = this.commander.wiki.getTiddler(title),\n\t\ttype = tiddler.fields.type || \&quot;text/vnd.tiddlywiki\&quot;,\n\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \&quot;utf8\&quot;};\n\tfs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {\n\t\tself.callback(err);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/savetiddler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/server.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nif(!$tw.browser) {\n\tvar util = require(\&quot;util\&quot;),\n\t\tfs = require(\&quot;fs\&quot;),\n\t\turl = require(\&quot;url\&quot;),\n\t\tpath = require(\&quot;path\&quot;),\n\t\thttp = require(\&quot;http\&quot;);\t\n}\n\nexports.info = {\n\tname: \&quot;server\&quot;,\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\tfor(var t=0; t&lt;this.routes.length; t++) {\n\t\tvar potentialRoute = this.routes[t],\n\t\t\tpathRegExp = potentialRoute.path,\n\t\t\tmatch = potentialRoute.path.exec(state.urlInfo.pathname);\n\t\tif(match &amp;&amp; request.method === potentialRoute.method) {\n\t\t\tstate.params = [];\n\t\t\tfor(var p=1; p&lt;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[\&quot;authorization\&quot;] || \&quot;\&quot;,\n\t\ttoken = header.split(/\\s+/).pop() || \&quot;\&quot;,\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 &amp;&amp; incomingPassword === password) {\n\t\treturn \&quot;ALLOWED\&quot;;\n\t} else {\n\t\treturn \&quot;DENIED\&quot;;\n\t}\n}\n\nSimpleServer.prototype.listen = function(port,host) {\n\tvar self = this;\n\thttp.createServer(function(request,response) {\n\t\t// Compose the state object\n\t\tvar state = {};\n\t\tstate.wiki = self.wiki;\n\t\tstate.server = self;\n\t\tstate.urlInfo = url.parse(request.url);\n\t\t// Find the route that matches this path\n\t\tvar route = self.findMatchingRoute(request,state);\n\t\t// Check for the username and password if we've got one\n\t\tvar username = self.get(\&quot;username\&quot;),\n\t\t\tpassword = self.get(\&quot;password\&quot;);\n\t\tif(username &amp;&amp; password) {\n\t\t\t// Check they match\n\t\t\tif(self.checkCredentials(request,username,password) !== \&quot;ALLOWED\&quot;) {\n\t\t\t\tresponse.writeHead(401,\&quot;Authentication required\&quot;,{\n\t\t\t\t\t\&quot;WWW-Authenticate\&quot;: 'Basic realm=\&quot;Please provide your username and password to login to TiddlyWiki5\&quot;'\n\t\t\t\t});\n\t\t\t\tresponse.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Return a 404 if we didn't find a route\n\t\tif(!route) {\n\t\t\tresponse.writeHead(404);\n\t\t\tresponse.end();\n\t\t\treturn;\n\t\t}\n\t\t// Dispatch the appropriate method\n\t\tswitch(request.method) {\n\t\t\tcase \&quot;GET\&quot;: // Intentional fall-through\n\t\t\tcase \&quot;DELETE\&quot;:\n\t\t\t\troute.handler(request,response,state);\n\t\t\t\tbreak;\n\t\t\tcase \&quot;PUT\&quot;:\n\t\t\t\tvar data = \&quot;\&quot;;\n\t\t\t\trequest.on(\&quot;data\&quot;,function(chunk) {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\trequest.on(\&quot;end\&quot;,function() {\n\t\t\t\t\tstate.data = data;\n\t\t\t\t\troute.handler(request,response,state);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\t}).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: \&quot;PUT\&quot;,\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[\&quot;revision\&quot;]) {\n\t\t\t\tdelete fields[\&quot;revision\&quot;];\n\t\t\t}\n\t\t\tstate.wiki.addTiddler(new $tw.Tiddler(state.wiki.getCreationFields(),fields,{title: title}));\n\t\t\tvar changeCount = state.wiki.getChangeCount(title).toString();\n\t\t\tresponse.writeHead(204, \&quot;OK\&quot;,{\n\t\t\t\tEtag: \&quot;\\\&quot;default/\&quot; + title + \&quot;/\&quot; + changeCount + \&quot;:\\\&quot;\&quot;\n\t\t\t});\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;DELETE\&quot;,\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, \&quot;OK\&quot;);\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;GET\&quot;,\n\t\tpath: /^\\/$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\&quot;Content-Type\&quot;: state.server.get(\&quot;serveType\&quot;)});\n\t\t\tvar text = state.wiki.renderTiddler(state.server.get(\&quot;renderType\&quot;),state.server.get(\&quot;rootTiddler\&quot;));\n\t\t\tresponse.end(text,\&quot;utf8\&quot;);\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;GET\&quot;,\n\t\tpath: /^\\/status$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\&quot;Content-Type\&quot;: \&quot;application/json\&quot;});\n\t\t\tvar text = JSON.stringify({\n\t\t\t\tusername: state.server.get(\&quot;username\&quot;),\n\t\t\t\tspace: {\n\t\t\t\t\trecipe: \&quot;default\&quot;\n\t\t\t\t},\n\t\t\t\ttiddlywiki_version: $tw.version\n\t\t\t});\n\t\t\tresponse.end(text,\&quot;utf8\&quot;);\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;GET\&quot;,\n\t\tpath: /^\\/favicon.ico$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\&quot;Content-Type\&quot;: \&quot;image/x-icon\&quot;});\n\t\t\tvar buffer = state.wiki.getTiddlerText(\&quot;$:/favicon.ico\&quot;,\&quot;\&quot;);\n\t\t\tresponse.end(buffer,\&quot;base64\&quot;);\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;GET\&quot;,\n\t\tpath: /^\\/recipes\\/default\\/tiddlers.json$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\&quot;Content-Type\&quot;: \&quot;application/json\&quot;});\n\t\t\tvar tiddlers = [];\n\t\t\tstate.wiki.forEachTiddler({sortField: \&quot;title\&quot;},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 !== \&quot;text\&quot;) {\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[\&quot;revision\&quot;] = state.wiki.getChangeCount(title);\n\t\t\t\ttiddlerFields.type = tiddlerFields.type || \&quot;text/vnd.tiddlywiki\&quot;;\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,\&quot;utf8\&quot;);\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \&quot;GET\&quot;,\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\&quot;bag\&quot;, \&quot;created\&quot;, \&quot;creator\&quot;, \&quot;modified\&quot;, \&quot;modifier\&quot;, \&quot;permissions\&quot;, \&quot;recipe\&quot;, \&quot;revision\&quot;, \&quot;tags\&quot;, \&quot;text\&quot;, \&quot;title\&quot;, \&quot;type\&quot;, \&quot;uri\&quot;\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[\&quot;revision\&quot;] = state.wiki.getChangeCount(title);\n\t\t\t\ttiddlerFields.type = tiddlerFields.type || \&quot;text/vnd.tiddlywiki\&quot;;\n\t\t\t\tresponse.writeHead(200, {\&quot;Content-Type\&quot;: \&quot;application/json\&quot;});\n\t\t\t\tresponse.end(JSON.stringify(tiddlerFields),\&quot;utf8\&quot;);\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\tvar port = this.params[0] || \&quot;8080\&quot;,\n\t\trootTiddler = this.params[1] || \&quot;$:/core/save/all\&quot;,\n\t\trenderType = this.params[2] || \&quot;text/plain\&quot;,\n\t\tserveType = this.params[3] || \&quot;text/html\&quot;,\n\t\tusername = this.params[4],\n\t\tpassword = this.params[5],\n\t\thost = this.params[6] || \&quot;127.0.0.1\&quot;;\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});\n\tthis.server.listen(port,host);\n\tconsole.log(\&quot;Serving on \&quot; + host + \&quot;:\&quot; + port);\n\tconsole.log(\&quot;(press ctrl-C to exit)\&quot;);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/server.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/verbose.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;verbose\&quot;,\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\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/verbose.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/commands/version.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.info = {\n\tname: \&quot;version\&quot;,\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 + \&quot;\\n\&quot;);\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/commands/version.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;command&quot;
},
&quot;$:/core/modules/config.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.preferences = {};\n\nexports.preferences.notificationDuration = 3 * 1000;\nexports.preferences.jsonSpaces = 4;\n\nexports.dateFormats = {\n\tmonths: [\&quot;January\&quot;, \&quot;February\&quot;, \&quot;March\&quot;, \&quot;April\&quot;, \&quot;May\&quot;, \&quot;June\&quot;, \&quot;July\&quot;, \&quot;August\&quot;, \&quot;September\&quot;, \&quot;October\&quot;, \&quot;November\&quot;,\&quot;December\&quot;],\n\tdays: [\&quot;Sunday\&quot;, \&quot;Monday\&quot;, \&quot;Tuesday\&quot;, \&quot;Wednesday\&quot;, \&quot;Thursday\&quot;, \&quot;Friday\&quot;, \&quot;Saturday\&quot;],\n\tshortMonths: [\&quot;Jan\&quot;, \&quot;Feb\&quot;, \&quot;Mar\&quot;, \&quot;Apr\&quot;, \&quot;May\&quot;, \&quot;Jun\&quot;, \&quot;Jul\&quot;, \&quot;Aug\&quot;, \&quot;Sep\&quot;, \&quot;Oct\&quot;, \&quot;Nov\&quot;, \&quot;Dec\&quot;],\n\tshortDays: [\&quot;Sun\&quot;, \&quot;Mon\&quot;, \&quot;Tue\&quot;, \&quot;Wed\&quot;, \&quot;Thu\&quot;, \&quot;Fri\&quot;, \&quot;Sat\&quot;],\n// suffixes for dates, eg \&quot;1st\&quot;,\&quot;2nd\&quot;,\&quot;3rd\&quot;...\&quot;30th\&quot;,\&quot;31st\&quot;\n\tdaySuffixes: [\&quot;st\&quot;,\&quot;nd\&quot;,\&quot;rd\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\n\t\t\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\n\t\t\&quot;st\&quot;,\&quot;nd\&quot;,\&quot;rd\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\&quot;th\&quot;,\n\t\t\&quot;st\&quot;],\n\tam: \&quot;am\&quot;,\n\tpm: \&quot;pm\&quot;\n};\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 = \&quot;area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr\&quot;.split(\&quot;,\&quot;);\n\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/config.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;config&quot;
},
&quot;$:/core/modules/deserializers.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nUtility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:\n\n&lt;div title=\&quot;Title\&quot; creator=\&quot;JoeBloggs\&quot; modifier=\&quot;JoeBloggs\&quot; created=\&quot;201102111106\&quot; modified=\&quot;201102111310\&quot; tags=\&quot;myTag [[my long tag]]\&quot;&gt;\n&lt;pre&gt;The text of the tiddler (without the expected HTML encoding).\n&lt;/pre&gt;\n&lt;/div&gt;\n\nNote that the field attributes are HTML encoded, but that the body of the &lt;PRE&gt; 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 &gt; 1) {\n\t\tfor(var f=1; f&lt;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*&lt;div\\s+([^&gt;]*)&gt;(\\s*&lt;pre&gt;)?/gi,\n\t\tendRegExp,\n\t\tmatch = startRegExp.exec(text);\n\tif(match) {\n\t\t// Old-style DIVs don't have the &lt;pre&gt; tag\n\t\tif(match[2]) {\n\t\t\tendRegExp = /&lt;\\/pre&gt;\\s*&lt;\\/div&gt;\\s*$/gi;\n\t\t} else {\n\t\t\tendRegExp = /&lt;\\/div&gt;\\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*\&quot;([^\&quot;]*)\&quot;/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];\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[\&quot;application/x-tiddler-html-div\&quot;] = function(text,fields) {\n\treturn [parseTiddlerDiv(text,fields)];\n};\n\nexports[\&quot;application/json\&quot;] = function(text,fields) {\n\tvar tiddlers = JSON.parse(text),\n\t\tresult = [],\n\t\tgetKnownFields = function(tid) {\n\t\t\tvar fields = {};\n\t\t\t\&quot;title text created creator modified modifier type tags\&quot;.split(\&quot; \&quot;).forEach(function(value) {\n\t\t\t\tif(tid[value] !== null) {\n\t\t\t\t\tfields[value] = tid[value];\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn fields;\n\t\t};\n\tfor(var t=0; t&lt;tiddlers.length; t++) {\n\t\tresult.push(getKnownFields(tiddlers[t]));\n\t}\n\treturn result;\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[\&quot;text/html\&quot;] = function(text,fields) {\n\t// Check if we've got a store area\n\tvar storeAreaMarkerRegExp = /&lt;div id=[\&quot;']?storeArea['\&quot;]?( style=[\&quot;']?display:none;[\&quot;']?)?&gt;/gi,\n\t\tmatch = storeAreaMarkerRegExp.exec(text);\n\tif(match) {\n\t\t// If so, it's either a classic TiddlyWiki file or a 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 = /&lt;div id=[\&quot;']?systemArea['\&quot;]?( style=[\&quot;']?display:none;[\&quot;']?)?&gt;/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// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler\n\t\treturn deserializeHtmlFile(text,fields);\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 = \&quot;text/html\&quot;;\n\treturn [result];\n}\n\nfunction deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {\n\tvar results = [],\n\t\tendOfDivRegExp = /(&lt;\\/div&gt;\\s*)/gi,\n\t\tstartPos = storeAreaEnd,\n\t\tdefaultType = isTiddlyWiki5 ? undefined : \&quot;text/x-tiddlywiki\&quot;;\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 === \&quot;string\&quot;) {\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/deserializers.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;tiddlerdeserializer&quot;
},
&quot;$:/core/modules/filters/backlinks.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.backlinks = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/backlinks.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/each.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.each = function(source,operator,options) {\n\t// Convert the source to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Collect up the first tiddler with each unique value of the specified field\n\tvar results = [],values = {};\n\t$tw.utils.each(source,function(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar value = tiddler.getFieldString(operator.operand);\n\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\tvalues[value] = true;\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/each.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/eachday.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.eachday = function(source,operator,options) {\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\t// Convert the source to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Collect up the first tiddler with each unique day value of the specified field\n\tvar results = [],values = [];\n\t$tw.utils.each(source,function(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler &amp;&amp; tiddler.fields[operator.operand]) {\n\t\t\tvar value = toDate(tiddler.fields[operator.operand]);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/eachday.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/field.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.field = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.getFieldString(operator.operator) === operator.operand;\n\t\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/field.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/fields.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.fields = function(source,operator,options) {\n\tvar self = this,\n\t\tresults = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t// Return the fields on the specified tiddler\n\t\tvar tiddler = options.wiki.getTiddler(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\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/fields.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/has.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.has = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = $tw.utils.hop(tiddler.fields,operator.operand);\n\t\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/has.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/is/current.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tif(title !== options.currTiddlerTitle) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\t$tw.utils.each(source,function(title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t} else {\n\t\t\tif(source.indexOf(options.currTiddlerTitle) !== -1) {\n\t\t\t\tresults.push(options.currTiddlerTitle);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t} else {\n\t\t\tresults.push(options.currTiddlerTitle);\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/current.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is/missing.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\tvar results = [],\n\t\tmissingTitles;\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\tmissingTitles = options.wiki.getMissingTitles();\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tvar match = missingTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tif(prefix !== \&quot;!\&quot;) {\n\t\t\tmissingTitles = options.wiki.getMissingTitles();\n\t\t\t$tw.utils.each(missingTitles,function(title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/missing.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is/orphan.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.orphan = function(source,prefix,options) {\n\tvar results = [],\n\t\torphanTitles = options.wiki.getOrphanTitles();\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tvar match = orphanTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tvar match = orphanTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/orphan.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is/shadow.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.shadow = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.isShadowTiddler(title);\n\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\tif(prefix !== \&quot;!\&quot;) {\n\t\t\t$tw.utils.each(options.wiki.shadowTiddlers,function(tiddler,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/shadow.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is/system.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.system = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.isSystemTiddler(title);\n\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/system.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is/tiddler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.tiddler = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.tiddlerExists(title);\n\t\tif(prefix === \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is/tiddler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;isfilteroperator&quot;
},
&quot;$:/core/modules/filters/is.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar isFilterOperators;\n\nfunction getIsFilterOperators() {\n\tif(!isFilterOperators) {\n\t\tisFilterOperators = {};\n\t\t$tw.modules.applyMethods(\&quot;isfilteroperator\&quot;,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\tvar isFilterOperator = isFilterOperators[operator.operand];\n\tif(isFilterOperator) {\n\t\treturn isFilterOperator(source,operator.prefix,options);\n\t} else {\n\t\treturn [\&quot;Filter Error: Unknown operand for the 'is' filter operator\&quot;];\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/is.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/limit.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.limit = function(source,operator,options) {\n\tvar results = [];\n\t// Convert to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Slice the array if necessary\n\tvar limit = Math.min(source.length,parseInt(operator.operand,10));\n\tif(operator.prefix === \&quot;!\&quot;) {\n\t\tresults = source.slice(source.length - limit);\n\t} else {\n\t\tresults = source.slice(0,limit);\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/limit.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/links.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.links = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerLinks(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/links.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/list.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.list = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tfunction checkTiddler(title) {\n\t\tvar match = list.indexOf(title) !== -1;\n\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\tif(operator.prefix !== \&quot;!\&quot;) {\n\t\t\tresults = list;\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/list.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/listed.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.listed = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.findListingsOfTiddler(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/listed.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/modules.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.modules = function(source,operator,options) {\n\tvar results = [],\n\t\tpushModules = function(type) {\n\t\t\t$tw.utils.each($tw.modules.types[type],function(moduleInfo,moduleName) {\n\t\t\t\tresults.push(moduleName);\n\t\t\t});\n\t\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tpushModules(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tpushModules(title);\n\t\t});\n\t}\n\tresults.sort();\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/modules.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/moduletypes.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/moduletypes.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/next.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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\n\tfunction checkTiddler(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 &gt; 0 &amp;&amp; match &lt; list.length) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/next.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/prefix.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.prefix = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar match = title.substr(0,operator.operand.length).toLowerCase() === operator.operand.toLowerCase();\n\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/prefix.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/previous.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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\n\tfunction checkTiddler(title) {\n\t\tvar match = list.indexOf(title);\n\t\t// decrement match and then test if result is in range\n\t\tmatch--;\n\t\tif( match &gt;= 0 ) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/previous.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/sameday.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.sameday = function(source,operator,options) {\n\tvar results = [],\n\t\tisSameDay = function(dateField,dateString) {\n\t\t\tvar date1 = (new Date(dateField)).setHours(0,0,0,0),\n\t\t\t\tdate2 = (new Date($tw.utils.parseDate(dateString))).setHours(0,0,0,0);\n\t\t\treturn date1 === date2;\n\t\t};\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = isSameDay(tiddler.fields.modified,operator.operand);\n\t\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/sameday.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/search.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.search = function(source,operator,options) {\n\tvar invert = operator.prefix === \&quot;!\&quot;;\n\treturn options.wiki.search(operator.operand,{\n\t\ttitles: source,\n\t\tinvert: invert\n\t});\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/search.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/sort.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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,operator.prefix === \&quot;!\&quot;,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,operator.prefix === \&quot;!\&quot;,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,operator.prefix === \&quot;!\&quot;,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,operator.prefix === \&quot;!\&quot;,true,true);\n\treturn results;\n};\n\nvar prepare_results = function (source) {\n\tvar results;\n\tif($tw.utils.isArray(source)) {\n\t\tresults = source;\n\t} else {\n\t\tresults = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t}\n\treturn results;\n}\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/sort.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/tag.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.hasTag(operator.operand);\n\t\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\t// Sort the results if we are matching a tag\n\tif(operator.prefix !== \&quot;!\&quot;) {\n\t\tresults = options.wiki.sortByList(results,operator.operand);\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/tag.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/tagging.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.tagging = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlersWithTag(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/tagging.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/tags.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler &amp;&amp; tiddler.fields.tags) {\n\t\t\t$tw.utils.pushTop(results,tiddler.fields.tags);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/tags.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/title.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.title = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.fields[operator.operator] === operator.operand;\n\t\t\tif(operator.prefix === \&quot;!\&quot;) {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t// If we're filtering a hashmap we change the behaviour to pass through missing tiddlers\n\t\tif(operator.prefix !== \&quot;!\&quot;) {\n\t\t\tresults.push(operator.operand);\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tif(title !== operator.operand) {\n\t\t\t\t\tcheckTiddler(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/title.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters/untagged.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nExport our filter function\n*/\nexports.untagged = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title),\n\t\t\tmatch = tiddler &amp;&amp; $tw.utils.isArray(tiddler.fields.tags) &amp;&amp; tiddler.fields.tags.length &gt; 0;\n\t\tif(operator.prefix !== \&quot;!\&quot;) {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\t$tw.utils.pushTop(results,title);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters/untagged.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;filteroperator&quot;
},
&quot;$:/core/modules/filters.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/filters.js\ntype: application/javascript\nmodule-type: wikimethod\n\nAdds tiddler filtering to the $tw.Wiki object.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\n/*\nParses an operation within a filter string\n\tresults: 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 operator, operand, bracketPos, curlyBracketPos;\n\t// Skip the starting square bracket\n\tif(filterString.charAt(p++) !== \&quot;[\&quot;) {\n\t\tthrow \&quot;Missing [ in filter expression\&quot;;\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) === \&quot;!\&quot;) {\n\t\t\toperator.prefix = filterString.charAt(p++);\n\t\t}\n\t\t// Get the operator name\n\t\tbracketPos = filterString.indexOf(\&quot;[\&quot;,p);\n\t\tcurlyBracketPos = filterString.indexOf(\&quot;{\&quot;,p);\n\t\tif((bracketPos === -1) &amp;&amp; (curlyBracketPos === -1)) {\n\t\t\tthrow \&quot;Missing [ in filter expression\&quot;;\n\t\t}\n\t\tif(bracketPos === -1 || (curlyBracketPos !== -1 &amp;&amp; curlyBracketPos &lt; bracketPos)) {\n\t\t\t// Curly brackets\n\t\t\toperator.indirect = true;\n\t\t\toperator.operator = filterString.substring(p,curlyBracketPos);\n\t\t\tp = curlyBracketPos + 1;\n\t\t} else {\n\t\t\t// Square brackets\n\t\t\toperator.operator = filterString.substring(p,bracketPos);\n\t\t\tp = bracketPos + 1;\n\t\t}\n\t\tif(operator.operator === \&quot;\&quot;) {\n\t\t\toperator.operator = \&quot;title\&quot;;\n\t\t}\n\t\t// Get the operand\n\t\tbracketPos = filterString.indexOf(operator.indirect ? \&quot;}\&quot; : \&quot;]\&quot;,p);\n\t\tif(bracketPos === -1) {\n\t\t\tthrow \&quot;Missing closing bracket in filter expression\&quot;;\n\t\t}\n\t\toperator.operand = filterString.substring(p,bracketPos);\n\t\tp = bracketPos + 1;\n\t\t// Push this operator\n\t\toperators.push(operator);\n\t} while(filterString.charAt(p) !== \&quot;]\&quot;);\n\t// Skip the ending square bracket\n\tif(filterString.charAt(p++) !== \&quot;]\&quot;) {\n\t\tthrow \&quot;Missing ] in filter expression\&quot;;\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 || \&quot;\&quot;;\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 = /((?:\\+|\\-)?)(?:(\\[)|(\&quot;(?:[^\&quot;])*\&quot;)|('(?:[^'])*')|([^\\s\\[\\]]+))/mg;\n\twhile(p &lt; filterString.length) {\n\t\t// Skip any whitespace\n\t\twhitespaceRegExp.lastIndex = p;\n\t\tmatch = whitespaceRegExp.exec(filterString);\n\t\tif(match &amp;&amp; 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 &lt; 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 \&quot;Syntax error in filter expression\&quot;;\n\t\t\t}\n\t\t\tvar operation = {\n\t\t\t\tprefix: \&quot;\&quot;,\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: \&quot;title\&quot;, 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(\&quot;filteroperator\&quot;,this.filterOperators);\n\t}\n\treturn this.filterOperators;\n};\n\nexports.filterTiddlers = function(filterString,currTiddlerTitle,tiddlerList) {\n\tvar fn = this.compileFilter(filterString);\n\treturn fn.call(this,tiddlerList || this.tiddlers,currTiddlerTitle);\n};\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,currTiddlerTitle) {\n\t\t\treturn [\&quot;Filter error: \&quot; + 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,currTiddlerTitle) {\n\t\t\tvar accumulator = source,\n\t\t\t\tresults = [];\n\t\t\t$tw.utils.each(operation.operators,function(operator) {\n\t\t\t\tvar operatorFunction = filterOperators[operator.operator] || filterOperators.field || function(source,operator,operations) {\n\t\t\t\t\t\treturn [\&quot;Filter Error: unknown operator '\&quot; + operator.operator + \&quot;'\&quot;];\n\t\t\t\t\t},\n\t\t\t\t\toperand = operator.operand;\n\t\t\t\tif(operator.indirect) {\n\t\t\t\t\toperand = self.getTextReference(operator.operand,\&quot;\&quot;,currTiddlerTitle);\n\t\t\t\t}\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},{\n\t\t\t\t\t\t\twiki: self,\n\t\t\t\t\t\t\tcurrTiddlerTitle: currTiddlerTitle\n\t\t\t\t\t\t});\n\t\t\t\taccumulator = results;\n\t\t\t});\n\t\t\treturn results;\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 || \&quot;\&quot;) {\n\t\t\t\tcase \&quot;\&quot;: // No prefix means that the operation is unioned into the result\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,currTiddlerTitle));\n\t\t\t\t\t};\n\t\t\t\tcase \&quot;-\&quot;: // The results of this operation are removed from the main result\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\n\t\t\t\t\t\t$tw.utils.removeArrayEntries(results,operationSubFunction(source,currTiddlerTitle));\n\t\t\t\t\t};\n\t\t\t\tcase \&quot;+\&quot;: // This operation is applied to the main results so far\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\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 = results.slice(0);\n\t\t\t\t\t\tresults.splice(0,results.length);\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,currTiddlerTitle));\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 array/hashmap of tiddler titles\n\treturn function(source,currTiddlerTitle) {\n\t\tvar results = [];\n\t\t$tw.utils.each(operationFunctions,function(operationFunction) {\n\t\t\toperationFunction(results,source,currTiddlerTitle);\n\t\t});\n\t\treturn results;\n\t};\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/filters.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikimethod&quot;
},
&quot;$:/core/modules/macros/changecount.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nInformation about this macro\n*/\n\nexports.name = \&quot;changecount\&quot;;\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn this.wiki.getChangeCount(this.getVariable(\&quot;currentTiddler\&quot;)) + \&quot;\&quot;;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/macros/changecount.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;macro&quot;
},
&quot;$:/core/modules/macros/makedatauri.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/macros/makedatauri.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to convert the content of a tiddler to a data URI\n\n&lt;&lt;makedatauri text:\&quot;Text to be converted\&quot; type:\&quot;text/vnd.tiddlywiki\&quot;&gt;&gt;\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\n/*\nInformation about this macro\n*/\n\nexports.name = \&quot;makedatauri\&quot;;\n\nexports.params = [\n\t{name: \&quot;text\&quot;},\n\t{name: \&quot;type\&quot;}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(text,type) {\n\ttype = type || \&quot;text/vnd.tiddlywiki\&quot;;\n\tvar typeInfo = $tw.config.contentTypeInfo[type] || $tw.config.contentTypeInfo[\&quot;text/plain\&quot;],\n\t\tisBase64 = typeInfo.encoding === \&quot;base64\&quot;,\n\t\tparts = [];\n\tparts.push(\&quot;data:\&quot;);\n\tparts.push(type);\n\tparts.push(isBase64 ? \&quot;;base64\&quot; : \&quot;\&quot;);\n\tparts.push(\&quot;,\&quot;);\n\tparts.push(isBase64 ? text : encodeURIComponent(text));\n\treturn parts.join(\&quot;\&quot;);\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/macros/makedatauri.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;macro&quot;
},
&quot;$:/core/modules/macros/qualify.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nInformation about this macro\n*/\n\nexports.name = \&quot;qualify\&quot;;\n\nexports.params = [\n\t{name: \&quot;title\&quot;}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\treturn title + \&quot;-\&quot; + this.getStateQualifier();\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/macros/qualify.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;macro&quot;
},
&quot;$:/core/modules/macros/version.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nInformation about this macro\n*/\n\nexports.name = \&quot;version\&quot;;\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn $tw.version;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/macros/version.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;macro&quot;
},
&quot;$:/core/modules/parsers/htmlparser.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar HtmlParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \&quot;raw\&quot;,\n\t\thtml: text\n\t}];\n};\n\nexports[\&quot;text/html\&quot;] = HtmlParser;\n\n})();\n\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/htmlparser.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;parser&quot;
},
&quot;$:/core/modules/parsers/imageparser.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar ImageParser = function(type,text,options) {\n\tvar element = \&quot;img\&quot;,\n\t\tsrc;\n\tif(type === \&quot;application/pdf\&quot; || type === \&quot;.pdf\&quot;) {\n\t\tsrc = \&quot;data:application/pdf;base64,\&quot; + text;\n\t\telement = \&quot;embed\&quot;;\n\t} else if(type === \&quot;image/svg+xml\&quot; || type === \&quot;.svg\&quot;) {\n\t\tsrc = \&quot;data:image/svg+xml,\&quot; + encodeURIComponent(text);\n\t} else {\n\t\tsrc = \&quot;data:\&quot; + type + \&quot;;base64,\&quot; + text;\n\t}\n\tthis.tree = [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: element,\n\t\tattributes: {\n\t\t\t\&quot;src\&quot;: {type: \&quot;string\&quot;, value: src}\n\t\t}\n\t}];\n};\n\nexports[\&quot;image/svg+xml\&quot;] = ImageParser;\nexports[\&quot;image/jpg\&quot;] = ImageParser;\nexports[\&quot;image/jpeg\&quot;] = ImageParser;\nexports[\&quot;image/png\&quot;] = ImageParser;\nexports[\&quot;image/gif\&quot;] = ImageParser;\nexports[\&quot;application/pdf\&quot;] = ImageParser;\nexports[\&quot;image/x-icon\&quot;] = ImageParser;\n\n})();\n\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/imageparser.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;parser&quot;
},
&quot;$:/core/modules/parsers/textparser.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar TextParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;pre\&quot;,\n\t\tchildren: [{\n\t\t\ttype: \&quot;text\&quot;,\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\nexports[\&quot;text/plain\&quot;] = TextParser;\nexports[\&quot;text/x-tiddlywiki\&quot;] = TextParser;\nexports[\&quot;application/javascript\&quot;] = TextParser;\nexports[\&quot;application/json\&quot;] = TextParser;\nexports[\&quot;text/css\&quot;] = TextParser;\nexports[\&quot;application/x-tiddler-dictionary\&quot;] = TextParser;\n\n})();\n\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/textparser.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;parser&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/codeblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;codeblock\&quot;;\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\tvar reEnd = /(\\r?\\n```$)/mg;\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// Return the pre element\n\treturn [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;pre\&quot;,\n\t\tchildren: [{\n\t\t\ttype: \&quot;text\&quot;,\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/codeblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/codeinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;codeinline\&quot;;\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], \&quot;mg\&quot;);\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: \&quot;element\&quot;,\n\t\ttag: \&quot;code\&quot;,\n\t\tchildren: [{\n\t\t\ttype: \&quot;text\&quot;,\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/codeinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/commentblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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&lt;!-- This is a comment --&gt;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;commentblock\&quot;;\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match - HTML comment regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html\n\tthis.matchRegExp = /\\&lt;![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\&gt;\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/commentblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/commentinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\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&lt;!-- This is a comment --&gt;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;commentinline\&quot;;\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match - HTML comment regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html\n\tthis.matchRegExp = /\\&lt;![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\&gt;/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/commentinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/dash.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;dash\&quot;;\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 ? \&quot;&amp;ndash;\&quot; : \&quot;&amp;mdash;\&quot;;\n\treturn [{\n\t\ttype: \&quot;entity\&quot;,\n\t\tentity: dash\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/dash.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/emphasis.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis. For example:\n\n```\n\tThis is ''bold'' text\n\n\tThis is //italic// text\n\n\tThis is __underlined__ text\n\n\tThis is ^^superscript^^ text\n\n\tThis is ,,subscript,, text\n\n\tThis is ~~strikethrough~~ text\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;emphasis\&quot;;\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// Figure out which element and closing regexp to use\n\tvar tag,reEnd;\n\tswitch(this.match[0]) {\n\t\tcase \&quot;''\&quot;: // Bold\n\t\t\ttag = \&quot;strong\&quot;;\n\t\t\treEnd = /''/mg;\n\t\t\tbreak;\n\t\tcase \&quot;//\&quot;: // Italics\n\t\t\ttag = \&quot;em\&quot;;\n\t\t\treEnd = /\\/\\//mg;\n\t\t\tbreak;\n\t\tcase \&quot;__\&quot;: // Underline\n\t\t\ttag = \&quot;u\&quot;;\n\t\t\treEnd = /__/mg;\n\t\t\tbreak;\n\t\tcase \&quot;^^\&quot;: // Superscript\n\t\t\ttag = \&quot;sup\&quot;;\n\t\t\treEnd = /\\^\\^/mg;\n\t\t\tbreak;\n\t\tcase \&quot;,,\&quot;: // Subscript\n\t\t\ttag = \&quot;sub\&quot;;\n\t\t\treEnd = /,,/mg;\n\t\t\tbreak;\n\t\tcase \&quot;~~\&quot;: // Strikethrough\n\t\t\ttag = \&quot;strike\&quot;;\n\t\t\treEnd = /~~/mg;\n\t\t\tbreak;\n\t}\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t// Return the classed span\n\treturn [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: tag,\n\t\tchildren: tree\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/emphasis.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/entity.js&quot;: {
&quot;text&quot;: &quot;/*\\\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: &amp;copy;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;entity\&quot;;\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(&amp;#?[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: \&quot;entity\&quot;, entity: this.match[0]}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/entity.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/extlink.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;extlink\&quot;;\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'\&quot;&lt;&gt;]+(?:\\/|\\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) === \&quot;~\&quot;) {\n\t\treturn [{type: \&quot;text\&quot;, text: this.match[0].substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;a\&quot;,\n\t\t\tattributes: {\n\t\t\t\thref: {type: \&quot;string\&quot;, value: this.match[0]},\n\t\t\t\t\&quot;class\&quot;: {type: \&quot;string\&quot;, value: \&quot;tw-tiddlylink-external\&quot;},\n\t\t\t\ttarget: {type: \&quot;string\&quot;, value: \&quot;_blank\&quot;}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \&quot;text\&quot;, text: this.match[0]\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/extlink.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;filteredtranscludeblock\&quot;;\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: \&quot;element\&quot;,\n\t\ttag: \&quot;$list\&quot;,\n\t\tattributes: {\n\t\t\tfilter: {type: \&quot;string\&quot;, value: filter}\n\t\t},\n\t\tisBlock: true\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \&quot;string\&quot;, value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \&quot;string\&quot;, value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \&quot;string\&quot;, value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\&quot;itemClass\&quot;] = {type: \&quot;string\&quot;, value: classes.split(\&quot;.\&quot;).join(\&quot; \&quot;)};\n\t}\n\treturn [node];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;filteredtranscludeinline\&quot;;\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: \&quot;element\&quot;,\n\t\ttag: \&quot;$list\&quot;,\n\t\tattributes: {\n\t\t\tfilter: {type: \&quot;string\&quot;, value: filter}\n\t\t}\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \&quot;string\&quot;, value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \&quot;string\&quot;, value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \&quot;string\&quot;, value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\&quot;itemClass\&quot;] = {type: \&quot;string\&quot;, value: classes.split(\&quot;.\&quot;).join(\&quot; \&quot;)};\n\t}\n\treturn [node];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;\&quot;\&quot;\nThis is some text\nThat is set like\nIt is a Poem\nWhen it is\nClearly\nNot\n\&quot;\&quot;\&quot;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;hardlinebreaks\&quot;;\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\&quot;\&quot;\&quot;(?:\\r?\\n)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\&quot;\&quot;\&quot;)|(\\r?\\n)/mg,\n\t\ttree = [];\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\tvar match = 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: \&quot;element\&quot;, tag: \&quot;br\&quot;});\n\t\t\t}\n\t\t}\n\t} while(match &amp;&amp; !match[1]);\n\t// Return the nodes\n\treturn tree;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/heading.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;heading\&quot;;\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: \&quot;element\&quot;,\n\t\ttag: \&quot;h\&quot; + this.match[1].length, \n\t\tattributes: {\n\t\t\t\&quot;class\&quot;: {type: \&quot;string\&quot;, value: classes.join(\&quot; \&quot;)}\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/heading.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/horizrule.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;horizrule\&quot;;\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: \&quot;element\&quot;, tag: \&quot;hr\&quot;}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/horizrule.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/html.js&quot;: {
&quot;text&quot;: &quot;/*\\\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&lt;aside&gt;\nThis is an HTML5 aside element\n&lt;/aside&gt;\n\n&lt;$slider target=\&quot;MyTiddler\&quot;&gt;\nThis is a widget invocation\n&lt;/$slider&gt;\n\n}}}\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;html\&quot;;\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 a following linebreak\n\tvar hasLineBreak = !tag.isSelfClosing &amp;&amp; !!this.parseTokenRegExp(this.parser.source,this.parser.pos,/(\\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 &amp;&amp; $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {\n\t\t\tvar reEndString = \&quot;&lt;/\&quot; + $tw.utils.escapeRegExp(tag.tag) + \&quot;&gt;\&quot;,\n\t\t\t\treEnd = new RegExp(\&quot;(\&quot; + reEndString + \&quot;)\&quot;,\&quot;mg\&quot;);\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 &amp;&amp; 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 a whitespace token. Returns null if not found, otherwise returns {type: \&quot;whitespace\&quot;, start:, end:,}\n*/\nexports.parseWhiteSpace = function(source,pos) {\n\tvar node = {\n\t\ttype: \&quot;whitespace\&quot;,\n\t\tstart: pos\n\t};\n\tvar re = /(\\s)+/g;\n\tre.lastIndex = pos;\n\tvar match = re.exec(source);\n\tif(match &amp;&amp; match.index === pos) {\n\t\tnode.end = pos + match[0].length;\n\t\treturn node;\n\t}\n\treturn null;\n};\n\n/*\nConvenience wrapper for parseWhiteSpace\n*/\nexports.skipWhiteSpace = function(source,pos) {\n\tvar whitespace = this.parseWhiteSpace(source,pos);\n\tif(whitespace) {\n\t\treturn whitespace.end;\n\t}\n\treturn pos;\n};\n\n/*\nLook for a given string token. Returns null if not found, otherwise returns {type: \&quot;token\&quot;, 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: \&quot;token\&quot;,\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: \&quot;regexp\&quot;, match:, start:, end:,}\n*/\nexports.parseTokenRegExp = function(source,pos,reToken) {\n\tvar node = {\n\t\ttype: \&quot;regexp\&quot;,\n\t\tstart: pos\n\t};\n\treToken.lastIndex = pos;\n\tnode.match = reToken.exec(source);\n\tif(node.match &amp;&amp; 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: \&quot;string\&quot;, value:, start:, end:,}\n*/\nexports.parseStringLiteral = function(source,pos) {\n\tvar node = {\n\t\ttype: \&quot;string\&quot;,\n\t\tstart: pos\n\t};\n\tvar reString = /(?:\&quot;([^\&quot;]*)\&quot;)|(?:'([^']*)')/g;\n\treString.lastIndex = pos;\n\tvar match = reString.exec(source);\n\tif(match &amp;&amp; match.index === pos) {\n\t\tnode.value = match[1] === undefined ? match[2] : match[1];\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: \&quot;macro-parameter\&quot;, name:, value:, start:, end:}\n*/\nexports.parseMacroParameter = function(source,pos) {\n\tvar node = {\n\t\ttype: \&quot;macro-parameter\&quot;,\n\t\tstart: pos\n\t};\n\t// Define our regexp\n\tvar reMacroParameter = /(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\&quot;([^\&quot;]*)\&quot;|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\\s&gt;\&quot;'=]+)))/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for the parameter\n\tvar token = this.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\t\&quot;\&quot;\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: \&quot;macrocall\&quot;, name:, parameters:, start:, end:}\n*/\nexports.parseMacroInvocation = function(source,pos) {\n\tvar node = {\n\t\ttype: \&quot;macrocall\&quot;,\n\t\tstart: pos,\n\t\tparams: []\n\t};\n\t// Define our regexps\n\tvar reMacroName = /([^\\s&gt;\&quot;'=]+)/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a double less than sign\n\tvar token = this.parseTokenString(source,pos,\&quot;&lt;&lt;\&quot;);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the macro name\n\tvar name = this.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 = this.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 = this.parseMacroParameter(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a double greater than sign\n\ttoken = this.parseTokenString(source,pos,\&quot;&gt;&gt;\&quot;);\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: \&quot;attribute\&quot;, name:, valueType: \&quot;string|indirect|macro\&quot;, 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&gt;\&quot;'=]+)/g,\n\t\treUnquotedAttribute = /([^\\/\\s&lt;&gt;\&quot;'=]+)/g,\n\t\treIndirectValue = /\\{\\{([^\\}]+)\\}\\}/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Get the attribute name\n\tvar name = this.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 = this.skipWhiteSpace(source,pos);\n\t// Look for an equals sign\n\tvar token = this.parseTokenString(source,pos,\&quot;=\&quot;);\n\tif(token) {\n\t\tpos = token.end;\n\t\t// Skip whitespace\n\t\tpos = this.skipWhiteSpace(source,pos);\n\t\t// Look for a string literal\n\t\tvar stringLiteral = this.parseStringLiteral(source,pos);\n\t\tif(stringLiteral) {\n\t\t\tpos = stringLiteral.end;\n\t\t\tnode.type = \&quot;string\&quot;;\n\t\t\tnode.value = stringLiteral.value;\n\t\t} else {\n\t\t\t// Look for an indirect value\n\t\t\tvar indirectValue = this.parseTokenRegExp(source,pos,reIndirectValue);\n\t\t\tif(indirectValue) {\n\t\t\t\tpos = indirectValue.end;\n\t\t\t\tnode.type = \&quot;indirect\&quot;;\n\t\t\t\tnode.textReference = indirectValue.match[1];\n\t\t\t} else {\n\t\t\t\t// Look for a unquoted value\n\t\t\t\tvar unquotedValue = this.parseTokenRegExp(source,pos,reUnquotedAttribute);\n\t\t\t\tif(unquotedValue) {\n\t\t\t\t\tpos = unquotedValue.end;\n\t\t\t\t\tnode.type = \&quot;string\&quot;;\n\t\t\t\t\tnode.value = unquotedValue.match[1];\n\t\t\t\t} else {\n\t\t\t\t\t// Look for a macro invocation value\n\t\t\t\t\tvar macroInvocation = this.parseMacroInvocation(source,pos);\n\t\t\t\t\tif(macroInvocation) {\n\t\t\t\t\t\tpos = macroInvocation.end;\n\t\t\t\t\t\tnode.type = \&quot;macro\&quot;;\n\t\t\t\t\t\tnode.value = macroInvocation;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.type = \&quot;string\&quot;;\n\t\t\t\t\t\tnode.value = \&quot;true\&quot;;\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 = \&quot;string\&quot;;\n\t\tnode.value = \&quot;true\&quot;;\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for an HTML tag. Returns null if not found, otherwise returns {type: \&quot;tag\&quot;, 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: \&quot;element\&quot;,\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 = this.skipWhiteSpace(source,pos);\n\t// Look for a less than sign\n\ttoken = this.parseTokenString(source,pos,\&quot;&lt;\&quot;);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the tag name\n\ttoken = this.parseTokenRegExp(source,pos,reTagName);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tnode.tag = token.match[1];\n\tpos = token.end;\n\t// Process attributes\n\tvar attribute = this.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 = this.parseAttribute(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a closing slash\n\ttoken = this.parseTokenString(source,pos,\&quot;/\&quot;);\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 = this.parseTokenString(source,pos,\&quot;&gt;\&quot;);\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 = this.parseTokenRegExp(source,pos,/(\\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 = /&lt;([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 &amp;&amp; this.isLegalTag(tag.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// If it starts with a $ then we'll let anything go\n\tif(tag.charAt(0) === \&quot;$\&quot;) {\n\t\treturn true;\n\t// If it starts with a dash then it's not legal\n\t} else if(tag.charAt(0) === \&quot;-\&quot;) {\n\t\treturn false;\n\t} else {\n\t\t// Otherwise it's OK\n\t\treturn true;\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/html.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/list.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;list\&quot;;\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /([\\*#;:&gt;]+)/mg;\n};\n\nvar listTypes = {\n\t\&quot;*\&quot;: {listTag: \&quot;ul\&quot;, itemTag: \&quot;li\&quot;},\n\t\&quot;#\&quot;: {listTag: \&quot;ol\&quot;, itemTag: \&quot;li\&quot;},\n\t\&quot;;\&quot;: {listTag: \&quot;dl\&quot;, itemTag: \&quot;dt\&quot;},\n\t\&quot;:\&quot;: {listTag: \&quot;dl\&quot;, itemTag: \&quot;dd\&quot;},\n\t\&quot;&gt;\&quot;: {listTag: \&quot;blockquote\&quot;, itemTag: \&quot;p\&quot;}\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 = /([\\*#;:&gt;]+)/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 &gt; 0 &amp;&amp; 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&lt;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 &gt; t &amp;&amp; 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 &lt;= t) {\n\t\t\t\tvar listElement = {type: \&quot;element\&quot;, tag: listInfo.listTag, children: [\n\t\t\t\t\t{type: \&quot;element\&quot;, 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: \&quot;element\&quot;, tag: listInfo.itemTag, children: []});\n\t\t\t}\n\t\t}\n\t\tif(listStack.length &gt; 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 &gt; 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(\&quot; \&quot;));\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/list.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/macrocallblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for block macro calls\n\n```\n&lt;&lt;name value value2&gt;&gt;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;macrocallblock\&quot;;\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /&lt;&lt;([^&gt;\\s]+)(?:\\s*)((?:[^&gt;]|(?:&gt;(?!&gt;)))*?)&gt;&gt;(?:\\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*(?:\&quot;([^\&quot;]*)\&quot;|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\&quot;'\\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]\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: \&quot;macrocall\&quot;,\n\t\tname: macroName,\n\t\tparams: params,\n\t\tisBlock: true\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/macrocallblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/macrocallinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for macro calls\n\n```\n&lt;&lt;name value value2&gt;&gt;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;macrocallinline\&quot;;\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /&lt;&lt;([^\\s&gt;]+)\\s*([\\s\\S]*?)&gt;&gt;/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*(?:\&quot;([^\&quot;]*)\&quot;|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\&quot;'\\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]\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: \&quot;macrocall\&quot;,\n\t\tname: macroName,\n\t\tparams: params\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/macrocallinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/macrodef.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;macrodef\&quot;;\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*([^)]*)\\)(\\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 !== \&quot;\&quot;) {\n\t\tvar reParam = /\\s*([A-Za-z0-9\\-_]+)(?:\\s*:\\s*(?:\&quot;([^\&quot;]*)\&quot;|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\&quot;'\\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];\n\t\t\tif(defaultValue) {\n\t\t\t\tparamInfo[\&quot;default\&quot;] = 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\\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}\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 = \&quot;\&quot;;\n\t}\n\t// Save the macro definition\n\treturn [{\n\t\ttype: \&quot;macrodef\&quot;,\n\t\tname: this.match[1],\n\t\tparams: params,\n\t\ttext: text\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/macrodef.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/prettylink.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;prettylink\&quot;;\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\[\\[(.*?)(?:\\|(.*?))?\\]\\]/mg;\n};\n\nvar isLinkExternal = function(to) {\n\tvar externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s'\&quot;]+(?:\\/|\\b)/i;\n\treturn externalRegExp.test(to);\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(isLinkExternal(link)) {\n\t\treturn [{\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;a\&quot;,\n\t\t\tattributes: {\n\t\t\t\thref: {type: \&quot;string\&quot;, value: link},\n\t\t\t\t\&quot;class\&quot;: {type: \&quot;string\&quot;, value: \&quot;tw-tiddlylink-external\&quot;},\n\t\t\t\ttarget: {type: \&quot;string\&quot;, value: \&quot;_blank\&quot;}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \&quot;text\&quot;, text: text\n\t\t\t}]\n\t\t}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;$link\&quot;,\n\t\t\tattributes: {\n\t\t\t\tto: {type: \&quot;string\&quot;, value: link}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \&quot;text\&quot;, text: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/prettylink.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/quoteblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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&lt;&lt;&lt;.optionalClass(es) optional cited from\n\ta quote\n\t&lt;&lt;&lt;\n\t\n\t&lt;&lt;&lt;.optionalClass(es)\n\ta quote\n\t&lt;&lt;&lt; optional cited from\n```\n\nQuotes can be quoted by putting more &lt;s\n\n```\n\t&lt;&lt;&lt;\n\tQuote Level 1\n\t\n\t&lt;&lt;&lt;&lt;\n\tQuoteLevel 2\n\t&lt;&lt;&lt;&lt;\n\t\n\t&lt;&lt;&lt;\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nexports.name = \&quot;quoteblock\&quot;;\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(&lt;&lt;&lt;+)/mg;\n};\n\nexports.parse = function() {\n\tvar classes = [\&quot;tw-quote\&quot;];\n\t// Get all the details of the match\n\tvar reEndString = \&quot;^\&quot; + this.match[1] + \&quot;(?!&lt;)\&quot;;\n\t// Move past the &lt;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\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 &gt; 0) {\n\t\ttree.unshift({\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;cite\&quot;,\n\t\t\tchildren: cite\n\t\t});\n\t}\n\n\t// Parse any optional cite\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar cite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// If we got a cite, push it\n\tif(cite.length &gt; 0) {\n\t\ttree.push({\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;cite\&quot;,\n\t\t\tchildren: cite\n\t\t});\n\t}\n\n\t// Return the blockquote element\n\treturn [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;blockquote\&quot;,\n\t\tattributes: {\n\t\t\tclass: { type: \&quot;string\&quot;, value: classes.join(\&quot; \&quot;) },\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/quoteblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/rules.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;rules\&quot;;\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 &amp;&amp; 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 &gt; 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&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/rules.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/styleblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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 `&lt;ul&gt;` 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\&quot;use strict\&quot;;\n\nexports.name = \&quot;styleblock\&quot;;\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 = \&quot;^@@(?:\\\\r?\\\\n)?\&quot;;\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(\&quot;.\&quot;).join(\&quot; \&quot;));\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 &amp;&amp; this.match.index === this.parser.pos);\n\t// Parse the body\n\tvar tree = this.parser.parseBlocks(reEndString);\n\tfor(var t=0; t&lt;tree.length; t++) {\n\t\tif(classes.length &gt; 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(tree[t],classes.join(\&quot; \&quot;));\n\t\t}\n\t\tif(styles.length &gt; 0) {\n\t\t\t$tw.utils.addAttributeToParseTreeNode(tree[t],\&quot;style\&quot;,styles.join(\&quot;\&quot;));\n\t\t}\n\t}\n\treturn tree;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/styleblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/styleinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;styleinline\&quot;;\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(\&quot;.\&quot;).join(\&quot; \&quot;) : 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: \&quot;element\&quot;,\n\t\ttag: \&quot;span\&quot;,\n\t\tattributes: {\n\t\t\t\&quot;class\&quot;: {type: \&quot;string\&quot;, value: \&quot;tw-inline-style\&quot;}\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,\&quot;style\&quot;,stylesString);\n\t}\n\treturn [node];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/styleinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/table.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;table\&quot;;\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// Match a single cell\n\tcellRegExp.lastIndex = this.parser.pos;\n\tvar cellMatch = cellRegExp.exec(this.parser.source);\n\twhile(cellMatch &amp;&amp; cellMatch.index === this.parser.pos) {\n\t\tif(cellMatch[1] === \&quot;~\&quot;) {\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,\&quot;rowspan\&quot;,last.rowSpanCount);\n\t\t\t\tvar vAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,\&quot;valign\&quot;,\&quot;center\&quot;);\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\&quot;valign\&quot;,vAlign);\n\t\t\t\tif(colSpanCount &gt; 1) {\n\t\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\&quot;colspan\&quot;,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] === \&quot;&gt;\&quot;) {\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] === \&quot;&lt;\&quot; &amp;&amp; prevCell) {\n\t\t\tcolSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,\&quot;colspan\&quot;,1);\n\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\&quot;colspan\&quot;,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 &amp;&amp; colSpanCount &gt; 1) {\n\t\t\t\tif(prevCell.attributes &amp;&amp; prevCell.attributes &amp;&amp; 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,\&quot;colspan\&quot;,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\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\tvar vAlign = null;\n\t\t\tif(chr === \&quot;^\&quot;) {\n\t\t\t\tvAlign = \&quot;top\&quot;;\n\t\t\t} else if(chr === \&quot;,\&quot;) {\n\t\t\t\tvAlign = \&quot;bottom\&quot;;\n\t\t\t}\n\t\t\tif(vAlign) {\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\twhile(chr === \&quot; \&quot;) {\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 === \&quot;!\&quot;) {\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tcell = {type: \&quot;element\&quot;, tag: \&quot;th\&quot;, children: []};\n\t\t\t} else {\n\t\t\t\tcell = {type: \&quot;element\&quot;, tag: \&quot;td\&quot;, 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 &gt; 1) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\&quot;colspan\&quot;,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,\&quot;valign\&quot;,vAlign);\n\t\t\t}\n\t\t\tif(this.parser.source.substr(this.parser.pos - 2,1) === \&quot; \&quot;) { // spaceRight\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\&quot;align\&quot;,spaceLeft ? \&quot;center\&quot; : \&quot;left\&quot;);\n\t\t\t} else if(spaceLeft) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\&quot;align\&quot;,\&quot;right\&quot;);\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 = {\&quot;c\&quot;:\&quot;caption\&quot;, \&quot;h\&quot;:\&quot;thead\&quot;, \&quot;\&quot;:\&quot;tbody\&quot;, \&quot;f\&quot;:\&quot;tfoot\&quot;},\n\t\ttable = {type: \&quot;element\&quot;, tag: \&quot;table\&quot;, 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 &amp;&amp; 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 === \&quot;k\&quot;) {\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: \&quot;element\&quot;, 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 === \&quot;c\&quot;) {\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 ? \&quot;top\&quot; : \&quot;bottom\&quot;;\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: \&quot;element\&quot;, tag: \&quot;tr\&quot;, children: []};\n\t\t\t\t$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? \&quot;oddRow\&quot; : \&quot;evenRow\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/table.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/transcludeblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;transcludeblock\&quot;;\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// Get the match details\n\tvar textRef = $tw.utils.trim(this.match[1]),\n\t\ttr = $tw.utils.parseTextReference(textRef),\n\t\ttargetTitle = tr.title,\n\t\ttargetField = tr.field,\n\t\ttargetIndex = tr.index,\n\t\ttemplate = $tw.utils.trim(this.match[2]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;$transclude\&quot;,\n\t\t\tattributes: {},\n\t\t\tisBlock: true\n\t\t};\n\tvar tiddlerNode = {\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;$tiddler\&quot;,\n\t\tattributes: {\n\t\t\ttiddler: {type: \&quot;string\&quot;, value: targetTitle}\n\t\t},\n\t\tisBlock: true,\n\t\tchildren: [transcludeNode]\n\t};\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \&quot;string\&quot;, value: template};\n\t} else {\n\t\ttranscludeNode.attributes.tiddler = {type: \&quot;string\&quot;, value: targetTitle};\n\t\tif(targetField) {\n\t\t\ttranscludeNode.attributes.field = {type: \&quot;string\&quot;, value: targetField};\n\t\t}\n\t\tif(targetIndex) {\n\t\t\ttranscludeNode.attributes.index = {type: \&quot;string\&quot;, value: targetIndex};\n\t\t}\n\t}\n\treturn [tiddlerNode];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/transcludeblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/transcludeinline.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;transcludeinline\&quot;;\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 textRef = $tw.utils.trim(this.match[1]),\n\t\ttr = $tw.utils.parseTextReference(textRef),\n\t\ttargetTitle = tr.title,\n\t\ttargetField = tr.field,\n\t\ttargetIndex = tr.index,\n\t\ttemplate = $tw.utils.trim(this.match[2]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;$transclude\&quot;,\n\t\t\tattributes: {}\n\t\t};\n\tvar tiddlerNode = {\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;$tiddler\&quot;,\n\t\tattributes: {\n\t\t\ttiddler: {type: \&quot;string\&quot;, value: targetTitle}\n\t\t},\n\t\tchildren: [transcludeNode]\n\t};\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \&quot;string\&quot;, value: template};\n\t} else {\n\t\ttranscludeNode.attributes.tiddler = {type: \&quot;string\&quot;, value: targetTitle};\n\t\tif(targetField) {\n\t\t\ttranscludeNode.attributes.field = {type: \&quot;string\&quot;, value: targetField};\n\t\t}\n\t\tif(targetIndex) {\n\t\t\ttranscludeNode.attributes.index = {type: \&quot;string\&quot;, value: targetIndex};\n\t\t}\n\t}\n\treturn [tiddlerNode];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/transcludeinline.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/typedblock.js&quot;: {
&quot;text&quot;: &quot;/*\\\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&lt;svg xmlns=\&quot;http://www.w3.org/2000/svg\&quot; width=\&quot;150\&quot; height=\&quot;100\&quot;&gt;\n &lt;circle cx=\&quot;100\&quot; cy=\&quot;50\&quot; r=\&quot;40\&quot; stroke=\&quot;black\&quot; stroke-width=\&quot;2\&quot; fill=\&quot;red\&quot; /&gt;\n&lt;/svg&gt;\n$$$\n\n$$$text/vnd.tiddlywiki&gt;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\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\n\nexports.name = \&quot;typedblock\&quot;;\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\$\\$\\$([^ &gt;\\r\\n]*)(?: *&gt; *([^ \\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: \&quot;text/plain\&quot;});\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 &lt;PRE&gt; tag\n\t\tvar widgetNode = this.parser.wiki.makeWidget(parser),\n\t\t\tcontainer = $tw.document.createElement(\&quot;div\&quot;);\n\t\twidgetNode.render(container,null);\n\t\tvar text = renderType === \&quot;text/html\&quot; ? container.innerHTML : container.textContent;\n\t\treturn [{\n\t\t\ttype: \&quot;element\&quot;,\n\t\t\ttag: \&quot;pre\&quot;,\n\t\t\tchildren: [{\n\t\t\t\ttype: \&quot;text\&quot;,\n\t\t\t\ttext: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/typedblock.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/wikilink.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.name = \&quot;wikilink\&quot;;\nexports.types = {inline: true};\n\nvar textPrimitives = {\n\tupperLetter: \&quot;[A-Z\\u00c0-\\u00de\\u0150\\u0170]\&quot;,\n\tlowerLetter: \&quot;[a-z0-9_\\\\-\\u00df-\\u00ff\\u0151\\u0171]\&quot;,\n\tanyLetter: \&quot;[A-Za-z0-9_\\\\-\\u00c0-\\u00de\\u00df-\\u00ff\\u0150\\u0170\\u0151\\u0171]\&quot;,\n\tanyLetterStrict: \&quot;[A-Za-z0-9\\u00c0-\\u00de\\u00df-\\u00ff\\u0150\\u0170\\u0151\\u0171]\&quot;\n};\n\ntextPrimitives.unWikiLink = \&quot;~\&quot;;\ntextPrimitives.wikiLink = textPrimitives.upperLetter + \&quot;+\&quot; +\n\ttextPrimitives.lowerLetter + \&quot;+\&quot; +\n\ttextPrimitives.upperLetter +\n\ttextPrimitives.anyLetter + \&quot;*\&quot;;\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp(textPrimitives.unWikiLink + \&quot;?\&quot; + textPrimitives.wikiLink,\&quot;mg\&quot;);\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) === textPrimitives.unWikiLink) {\n\t\treturn [{type: \&quot;text\&quot;, text: linkText.substr(1)}];\n\t}\n\t// If the link has been preceded with a letter then don't treat it as a link\n\tif(this.match.index &gt; 0) {\n\t\tvar preRegExp = new RegExp(textPrimitives.anyLetterStrict,\&quot;mg\&quot;);\n\t\tpreRegExp.lastIndex = this.match.index-1;\n\t\tvar preMatch = preRegExp.exec(this.parser.source);\n\t\tif(preMatch &amp;&amp; preMatch.index === this.match.index-1) {\n\t\t\treturn [{type: \&quot;text\&quot;, text: linkText}];\n\t\t}\n\t}\n\treturn [{\n\t\ttype: \&quot;element\&quot;,\n\t\ttag: \&quot;$link\&quot;,\n\t\tattributes: {\n\t\t\tto: {type: \&quot;string\&quot;, value: linkText}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \&quot;text\&quot;,\n\t\t\ttext: linkText\n\t\t}]\n\t}];\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/wikilink.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikirule&quot;
},
&quot;$:/core/modules/parsers/wikiparser/wikiparser.js&quot;: {
&quot;text&quot;: &quot;/*\\\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: \&quot;element\&quot;, tag: &lt;string&gt;, attributes: {}, children: []} - an HTML element\n\t{type: \&quot;text\&quot;, text: &lt;string&gt;} - a text node\n\t{type: \&quot;entity\&quot;, value: &lt;string&gt;} - an entity\n\t{type: \&quot;raw\&quot;, html: &lt;string&gt;} - raw HTML\n\nAttributes are stored as hashmaps of the following objects:\n\n\t{type: \&quot;string\&quot;, value: &lt;string&gt;} - literal string\n\t{type: \&quot;indirect\&quot;, textReference: &lt;textReference&gt;} - indirect through a text reference\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nvar WikiParser = function(type,text,options) {\n\tthis.wiki = options.wiki;\n\t// Initialise the classes if we don't have them already\n\tif(!this.pragmaRuleClasses) {\n\t\tWikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules(\&quot;wikirule\&quot;,\&quot;pragma\&quot;,$tw.WikiRuleBase);\n\t}\n\tif(!this.blockRuleClasses) {\n\t\tWikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules(\&quot;wikirule\&quot;,\&quot;block\&quot;,$tw.WikiRuleBase);\n\t}\n\tif(!this.inlineRuleClasses) {\n\t\tWikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules(\&quot;wikirule\&quot;,\&quot;inline\&quot;,$tw.WikiRuleBase);\n\t}\n\t// Save the parse text\n\tthis.type = type || \&quot;text/vnd.tiddlywiki\&quot;;\n\tthis.source = text || \&quot;\&quot;;\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,\&quot;pragma\&quot;,0);\n\t// Instantiate the parser block and inline rules\n\tthis.blockRules = this.instantiateRules(this.blockRuleClasses,\&quot;block\&quot;,0);\n\tthis.inlineRules = this.instantiateRules(this.inlineRuleClasses,\&quot;inline\&quot;,0);\n\t// Parse any pragmas\n\tthis.tree = this.parsePragmas();\n\t// Parse the text into inline runs or blocks\n\tif(options.parseAsInline) {\n\t\tthis.tree.push.apply(this.tree,this.parseInlineRun());\n\t} else {\n\t\tthis.tree.push.apply(this.tree,this.parseBlocks());\n\t}\n\t// Return the parse tree\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 &amp;&amp; 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 = undefined,\n\t\tmatchingRulePos = this.sourceLength;\n\t// Step through each rule\n\tfor(var t=0; t&lt;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 &amp;&amp; ruleInfo.matchIndex &lt; 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 &amp;&amp; ruleInfo.matchIndex &lt;= 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 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 &gt;= 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\ttree.push.apply(tree,nextMatch.rule.parse());\n\t}\n\treturn tree;\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(\&quot;(\&quot; + terminatorRegExpString + \&quot;|\\\\r?\\\\n\\\\r?\\\\n)\&quot;,\&quot;mg\&quot;) : /(\\r?\\n\\r?\\n)/mg;\n\tthis.skipWhitespace();\n\tif(this.pos &gt;= 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 &amp;&amp; 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: \&quot;element\&quot;, tag: \&quot;p\&quot;, 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 &lt; 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(\&quot;(\&quot; + terminatorRegExpString + \&quot;)\&quot;,\&quot;mg\&quot;),\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 &lt; this.sourceLength &amp;&amp; !(match &amp;&amp; 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 &amp;&amp; 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 &lt; this.sourceLength &amp;&amp; nextMatch) {\n\t\t// Process the text preceding the run rule\n\t\tif(nextMatch.matchIndex &gt; this.pos) {\n\t\t\ttree.push({type: \&quot;text\&quot;, 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 &lt; this.sourceLength) {\n\t\ttree.push({type: \&quot;text\&quot;, 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 &lt; this.sourceLength &amp;&amp; (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 &gt;= terminatorMatch.index) {\n\t\t\t\tif(terminatorMatch.index &gt; this.pos) {\n\t\t\t\t\ttree.push({type: \&quot;text\&quot;, 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 &gt; this.pos) {\n\t\t\t\ttree.push({type: \&quot;text\&quot;, 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 &lt; this.sourceLength) {\n\t\ttree.push({type: \&quot;text\&quot;, 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 &amp;&amp; match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t\tclassNames.push(match[1]);\n\t\tvar match = 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 === \&quot;only\&quot;) {\n\t\tkeepFilter = function(name) {\n\t\t\treturn names.indexOf(name) !== -1;\n\t\t};\n\t} else if(type === \&quot;except\&quot;) {\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&gt;=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[\&quot;text/vnd.tiddlywiki\&quot;] = WikiParser;\n\n})();\n\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/wikiparser.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;parser&quot;
},
&quot;$:/core/modules/parsers/wikiparser/rules/wikirulebase.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/parsers/wikiparser/rules/wikirulebase.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;global&quot;
},
&quot;$:/core/modules/savers/andtidwiki.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar AndTidWiki = function(wiki) {\n};\n\nAndTidWiki.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.toString());\n\t// Strip the file://\n\tif(pathname.indexOf(\&quot;file://\&quot;) === 0) {\n\t\tpathname = pathname.substr(7);\n\t}\n\t// Strip any query or location part\n\tvar p = pathname.indexOf(\&quot;?\&quot;);\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\&quot;#\&quot;);\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: \&quot;andtidwiki\&quot;,\n\tpriority: 1600\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.twi &amp;&amp; !!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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/andtidwiki.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/download.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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) {\n\t// Get the current filename\n\tvar filename = \&quot;tiddlywiki.html\&quot;,\n\t\tp = document.location.pathname.lastIndexOf(\&quot;/\&quot;);\n\tif(p !== -1) {\n\t\tfilename = document.location.pathname.substr(p+1);\n\t}\n\t// Set up the link\n\tvar link = document.createElement(\&quot;a\&quot;);\n\tlink.setAttribute(\&quot;target\&quot;,\&quot;_blank\&quot;);\n\tif(Blob !== undefined) {\n\t\tvar blob = new Blob([text], {type: \&quot;text/html\&quot;});\n\t\tlink.setAttribute(\&quot;href\&quot;, URL.createObjectURL(blob));\n\t} else {\n\t\tlink.setAttribute(\&quot;href\&quot;,\&quot;data:text/html,\&quot; + encodeURIComponent(text));\n\t}\n\tlink.setAttribute(\&quot;download\&quot;,filename);\n\tdocument.body.appendChild(link);\n\tlink.click();\n\tdocument.body.removeChild(link);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nDownloadSaver.prototype.info = {\n\tname: \&quot;download\&quot;,\n\tpriority: 100\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn document.createElement(\&quot;a\&quot;).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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/download.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/fsosaver.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\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 !== \&quot;\&quot; &amp;&amp; /^\\/\\\\[^\\\\]+\\\\[^\\\\]+/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 = \&quot;\\\\\\\\\&quot; + document.location.hostname + pathname;\n\t} else return false;\n\t\n\t// Save the file (as UTF-16)\n\tvar fso = new ActiveXObject(\&quot;Scripting.FileSystemObject\&quot;);\n\tvar file = fso.OpenTextFile(pathname,2,-1,-1);\n\t\n\tfile.Write(text);\n\tfile.Close();\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nFSOSaver.prototype.info = {\n\tname: \&quot;FSOSaver\&quot;,\n\tpriority: 120\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 === \&quot;file:\&quot;) &amp;&amp; !!(new ActiveXObject(\&quot;Scripting.FileSystemObject\&quot;));\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/fsosaver.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/manualdownload.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n// Title of the tiddler containing the download message\nvar downloadInstructionsTitle = \&quot;$:/messages/Download\&quot;\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: \&quot;data:text/html,\&quot; + encodeURIComponent(text)\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nManualDownloadSaver.prototype.info = {\n\tname: \&quot;manualdownload\&quot;,\n\tpriority: 0\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/manualdownload.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/msdownload.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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 = \&quot;tiddlywiki.html\&quot;,\n\t\tp = document.location.pathname.lastIndexOf(\&quot;/\&quot;);\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: \&quot;text/html\&quot;});\n\twindow.navigator.msSaveBlob(blob,filename);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nMsDownloadSaver.prototype.info = {\n\tname: \&quot;msdownload\&quot;,\n\tpriority: 110\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/msdownload.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/nodewebkit.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/savers/nodewebkit.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes in the node-webkit environment\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\&quot;use strict\&quot;;\n\nvar NodeWebKitSaver = function(wiki) {\n};\n\nNodeWebKitSaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = document.location.pathname;\n\t// Test for a Windows path of the form /x:/blah/blah\n\tif(/^\\/[A-Z]\\:\\//i.test(pathname)) {\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t\t// Convert slashes to backslashes\n\t\tpathname = pathname.replace(/\\//g,\&quot;\\\\\&quot;);\n\t}\n\t// Try to save\n\tvar fs = require(\&quot;fs\&quot;);\n\tfs.writeFile(pathname,text,callback);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nNodeWebKitSaver.prototype.info = {\n\tname: \&quot;nodewebkit\&quot;,\n\tpriority: 1700\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\t// Check if we're running under node-webkit\n\treturn (typeof process == \&quot;object\&quot;)\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new NodeWebKitSaver(wiki);\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/nodewebkit.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/tiddlyfox.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar TiddlyFoxSaver = function(wiki) {\n};\n\nTiddlyFoxSaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\tvar messageBox = document.getElementById(\&quot;tiddlyfox-message-box\&quot;);\n\tif(messageBox) {\n\t\t// Get the pathname of this document\n\t\tvar pathname = document.location.pathname;\n\t\t// Test for a Windows path of the form /x:/blah/blah\n\t\tif(/^\\/[A-Z]\\:\\//i.test(pathname)) {\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,\&quot;\\\\\&quot;);\n\t\t}\n\t\t// Create the message element and put it in the message box\n\t\tvar message = document.createElement(\&quot;div\&quot;);\n\t\tmessage.setAttribute(\&quot;data-tiddlyfox-path\&quot;,decodeURIComponent(pathname));\n\t\tmessage.setAttribute(\&quot;data-tiddlyfox-content\&quot;,text);\n\t\tmessageBox.appendChild(message);\n\t\t// Add an event handler for when the file has been saved\n\t\tmessage.addEventListener(\&quot;tiddlyfox-have-saved-file\&quot;,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(\&quot;Events\&quot;);\n\t\tevent.initEvent(\&quot;tiddlyfox-save-file\&quot;,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: \&quot;tiddlyfox\&quot;,\n\tpriority: 1500\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 === \&quot;file:\&quot;);\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyFoxSaver(wiki);\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/tiddlyfox.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/tiddlyie.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\t// check existence of TiddlyIE BHO extension (note: only works after document is complete)\n\tif(typeof(window.TiddlyIE) != \&quot;undefined\&quot;) {\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,\&quot;\\\\\&quot;);\n\t\t} else if(document.hostname !== \&quot;\&quot; &amp;&amp; /^\\/[^\\/]+\\/[^\\/]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\&quot;\\\\\&quot;);\n\t\t\t// reconstruct UNC path\n\t\t\tpathname = \&quot;\\\\\\\\\&quot; + document.location.hostname + pathname;\n\t\t} else return false;\n\t\t\n\t\t// Prompt the user to save the file\n\t\twindow.TiddlyIE.save(pathname, text);\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: \&quot;tiddlyiesaver\&quot;,\n\tpriority: 1500\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 === \&quot;file:\&quot;);\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyIESaver(wiki);\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/tiddlyie.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/twedit.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar TWEditSaver = function(wiki) {\n};\n\nTWEditSaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\t// Bail if we're not running under TWEdit\n\tif(typeof DeviceInfo !== \&quot;object\&quot;) {\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(\&quot;?\&quot;);\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\&quot;#\&quot;);\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\t// Remove the leading \&quot;/Documents\&quot; from path\n\tvar prefix = \&quot;/Documents\&quot;;\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// Error\n \tcallback(\&quot;Error saving to TWEdit: \&quot; + event.target.error.code);\n };\n\t// Get the file system\n window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) {\n \t// Now we've got the filesystem, get the fileEntry\n fileSystem.root.getFile(pathname, {create: true}, function(fileEntry) {\n \t// Now we've got the fileEntry, create the writer\n \tfileEntry.createWriter(function(writer) {\n\t\t writer.onerror = errorHandler;\n\t\t writer.onwrite = function() {\n\t\t \tcallback(null);\n\t\t };\n\t\t writer.position = 0;\n\t\t writer.write(text);\n \t},errorHandler);\n }, errorHandler);\n }, errorHandler);\n return true;\n};\n\n/*\nInformation about this saver\n*/\nTWEditSaver.prototype.info = {\n\tname: \&quot;twedit\&quot;,\n\tpriority: 1600\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: \&quot;TiddlyWiki\&quot;};\n}\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/twedit.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/savers/upload.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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// Bail out unless this is a save (rather than a download)\n\tif(method !== \&quot;save\&quot;) {\n\t\treturn false;\n\t}\n\t// Get the various parameters we need\n\tvar backupDir = this.wiki.getTextReference(\&quot;$:/UploadBackupDir\&quot;) || \&quot;.\&quot;,\n\t\tusername = this.wiki.getTextReference(\&quot;$:/UploadName\&quot;),\n\t\tpassword = $tw.utils.getPassword(\&quot;upload\&quot;),\n\t\tuploadDir = this.wiki.getTextReference(\&quot;$:/UploadDir\&quot;) || \&quot;.\&quot;,\n\t\tuploadFilename = this.wiki.getTextReference(\&quot;$:/UploadFilename\&quot;) || \&quot;index.html\&quot;,\n\t\turl = this.wiki.getTextReference(\&quot;$:/UploadURL\&quot;);\n\t// Bail out if we don't have the bits we need\n\tif(!username || username.toString().trim() === \&quot;\&quot; || !password || password.toString().trim() === \&quot;\&quot;) {\n\t\treturn false;\n\t}\n\t// Construct the url if not provided\n\tif(!url) {\n\t\turl = \&quot;http://\&quot; + username + \&quot;.tiddlyspot.com/store.cgi\&quot;;\n\t}\n\t// Assemble the header\n\tvar boundary = \&quot;---------------------------\&quot; + \&quot;AaB03x\&quot;;\t\n\tvar uploadFormName = \&quot;UploadPlugin\&quot;;\n\tvar head = [];\n\thead.push(\&quot;--\&quot; + boundary + \&quot;\\r\\nContent-disposition: form-data; name=\\\&quot;UploadPlugin\\\&quot;\\r\\n\&quot;);\n\thead.push(\&quot;backupDir=\&quot; + backupDir + \&quot;;user=\&quot; + username + \&quot;;password=\&quot; + password + \&quot;;uploaddir=\&quot; + uploadDir + \&quot;;;\&quot;); \n\thead.push(\&quot;\\r\\n\&quot; + \&quot;--\&quot; + boundary);\n\thead.push(\&quot;Content-disposition: form-data; name=\\\&quot;userfile\\\&quot;; filename=\\\&quot;\&quot; + uploadFilename + \&quot;\\\&quot;\&quot;);\n\thead.push(\&quot;Content-Type: text/html;charset=UTF-8\&quot;);\n\thead.push(\&quot;Content-Length: \&quot; + text.length + \&quot;\\r\\n\&quot;);\n\thead.push(\&quot;\&quot;);\n\t// Assemble the tail and the data itself\n\tvar tail = \&quot;\\r\\n--\&quot; + boundary + \&quot;--\\r\\n\&quot;,\n\t\tdata = head.join(\&quot;\\r\\n\&quot;) + text + tail;\n\t// Do the HTTP post\n\tvar http = new XMLHttpRequest();\n\thttp.open(\&quot;POST\&quot;,url,true,username,password);\n\thttp.setRequestHeader(\&quot;Content-Type\&quot;,\&quot;multipart/form-data; ;charset=UTF-8; boundary=\&quot; + boundary);\n\thttp.onreadystatechange = function() {\n\t\tif(http.readyState == 4 &amp;&amp; http.status == 200) {\n\t\t\tif(http.responseText.substr(0,4) === \&quot;0 - \&quot;) {\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\thttp.send(data);\n\t$tw.notifier.display(\&quot;$:/messages/StartingSave\&quot;);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nUploadSaver.prototype.info = {\n\tname: \&quot;upload\&quot;,\n\tpriority: 500\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/savers/upload.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;saver&quot;
},
&quot;$:/core/modules/startup.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/startup.js\ntype: application/javascript\nmodule-type: startup\n\nThis is the main application logic for both the client and server\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\n\nexports.startup = function() {\n\tvar modules,n,m,f,commander;\n\t// Load modules\n\t$tw.modules.applyMethods(\&quot;global\&quot;,$tw);\n\t$tw.modules.applyMethods(\&quot;config\&quot;,$tw.config);\n\t$tw.modules.applyMethods(\&quot;utils\&quot;,$tw.utils);\n\tif($tw.browser) {\n\t\t$tw.utils.getBrowserInfo($tw.browser);\n\t}\n\t$tw.version = $tw.utils.extractVersionInfo();\n\t$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap(\&quot;tiddlerfield\&quot;);\n\t$tw.modules.applyMethods(\&quot;tiddlermethod\&quot;,$tw.Tiddler.prototype);\n\t$tw.modules.applyMethods(\&quot;wikimethod\&quot;,$tw.Wiki.prototype);\n\t$tw.modules.applyMethods(\&quot;tiddlerdeserializer\&quot;,$tw.Wiki.tiddlerDeserializerModules);\n\t$tw.macros = $tw.modules.getModulesByTypeAsHashmap(\&quot;macro\&quot;);\n\t// Set up the parsers\n\t$tw.wiki.initParsers();\n\t// Set up the syncer object\n\t$tw.syncer = new $tw.Syncer({wiki: $tw.wiki});\n\t// Set up the command modules\n\t$tw.Commander.initCommands();\n\t// Kick off the theme manager\n\t$tw.themeManager = new $tw.ThemeManager($tw.wiki);\n\t// Get the default tiddlers\n\tvar defaultTiddlersTitle = \&quot;$:/DefaultTiddlers\&quot;,\n\t\tdefaultTiddlersTiddler = $tw.wiki.getTiddler(defaultTiddlersTitle),\n\t\tdefaultTiddlers = [];\n\tif(defaultTiddlersTiddler) {\n\t\tdefaultTiddlers = $tw.wiki.filterTiddlers(defaultTiddlersTiddler.fields.text);\n\t}\n\t// Initialise the story and history\n\tvar storyTitle = \&quot;$:/StoryList\&quot;,\n\t\tstory = [];\n\tfor(var t=0; t&lt;defaultTiddlers.length; t++) {\n\t\tstory[t] = defaultTiddlers[t];\n\t}\n\t$tw.wiki.addTiddler({title: storyTitle, text: \&quot;\&quot;, list: story},$tw.wiki.getModificationFields());\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\trootElement: document.body\n\t\t});\n\t\t// Install the animator\n\t\t$tw.anim = new $tw.utils.Animator();\n\t\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\t\t$tw.rootWidget = new widget.widget({\n\t\t\ttype: \&quot;widget\&quot;,\n\t\t\tchildren: []\n\t\t},{\n\t\t\twiki: $tw.wiki,\n\t\t\tdocument: document\n\t\t});\n\t\t// Install the modal message mechanism\n\t\t$tw.modal = new $tw.utils.Modal($tw.wiki);\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-modal\&quot;,function(event) {\n\t\t\t$tw.modal.display(event.param);\n\t\t});\n\t\t// Install the notification mechanism\n\t\t$tw.notifier = new $tw.utils.Notifier($tw.wiki);\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-notify\&quot;,function(event) {\n\t\t\t$tw.notifier.display(event.param);\n\t\t});\n\t\t// Install the scroller\n\t\t$tw.pageScroller = new $tw.utils.PageScroller();\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-scroll\&quot;,function(event) {\n\t\t\t$tw.pageScroller.handleEvent(event);\n\t\t});\n\t\t// Install the save action handler\n\t\t$tw.wiki.initSavers();\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-save-wiki\&quot;,function(event) {\n\t\t\t$tw.wiki.saveWiki({\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \&quot;text/plain\&quot;\n\t\t\t});\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-download-file\&quot;,function(event) {\n\t\t\t$tw.wiki.saveWiki({\n\t\t\t\tmethod: \&quot;download\&quot;,\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \&quot;text/plain\&quot;\n\t\t\t});\n\t\t});\n\t\t// Install the crypto event handlers\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-set-password\&quot;,function(event) {\n\t\t\t$tw.passwordPrompt.createPrompt({\n\t\t\t\tserviceName: \&quot;Set a new password for this TiddlyWiki\&quot;,\n\t\t\t\tnoUserName: true,\n\t\t\t\tsubmitText: \&quot;Set password\&quot;,\n\t\t\t\tcallback: function(data) {\n\t\t\t\t\t$tw.crypto.setPassword(data.password);\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\t$tw.rootWidget.addEventListener(\&quot;tw-clear-password\&quot;,function(event) {\n\t\t\t$tw.crypto.setPassword(null);\n\t\t});\n\t\t// Set up the favicon\n\t\tvar faviconTitle = \&quot;$:/favicon.ico\&quot;,\n\t\t\tfaviconLink = document.getElementById(\&quot;faviconLink\&quot;),\n\t\t\tsetFavicon = function() {\n\t\t\t\tvar tiddler = $tw.wiki.getTiddler(faviconTitle);\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tfaviconLink.setAttribute(\&quot;href\&quot;,\&quot;data:\&quot; + tiddler.fields.type + \&quot;;base64,\&quot; + tiddler.fields.text);\n\t\t\t\t}\n\t\t\t};\n\t\tsetFavicon();\n\t\t$tw.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\t\tif($tw.utils.hop(changes,faviconTitle)) {\n\t\t\t\tsetFavicon();\n\t\t\t}\n\t\t});\n\t\t// Set up the styles\n\t\tvar styleTemplateTitle = \&quot;$:/core/ui/PageStylesheet\&quot;,\n\t\t\tstyleParser = $tw.wiki.parseTiddler(styleTemplateTitle);\n\t\t$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.document});\n\t\t$tw.styleContainer = $tw.document.createElement(\&quot;style\&quot;);\n\t\t$tw.styleWidgetNode.render($tw.styleContainer,null);\n\t\t$tw.styleElement = document.createElement(\&quot;style\&quot;);\n\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\tdocument.head.insertBefore($tw.styleElement,document.head.firstChild);\n\t\t$tw.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\t\tif($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {\n\t\t\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\t\t}\n\t\t});\n\t\t// Display the PageMacros, which includes the PageTemplate\n\t\tvar templateTitle = \&quot;$:/core/ui/PageMacros\&quot;,\n\t\t\tparser = $tw.wiki.parseTiddler(templateTitle);\n\t\t$tw.pageWidgetNode = $tw.wiki.makeWidget(parser,{document: document, parentWidget: $tw.rootWidget});\n\t\t$tw.pageContainer = document.createElement(\&quot;div\&quot;);\n\t\t$tw.utils.addClass($tw.pageContainer,\&quot;tw-page-container\&quot;);\n\t\tdocument.body.insertBefore($tw.pageContainer,document.body.firstChild);\n\t\t$tw.pageWidgetNode.render($tw.pageContainer,null);\n\t\t$tw.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\t\t$tw.pageWidgetNode.refresh(changes,$tw.pageContainer,null);\n\t\t});\n\t\t// Fix up the link between the root widget and the page container\n\t\t$tw.rootWidget.domNodes = [$tw.pageContainer];\n\t\t$tw.rootWidget.children = [$tw.pageWidgetNode];\n\t\t// If we're being viewed on a data: URI then give instructions for how to save\n\t\tif(document.location.protocol === \&quot;data:\&quot;) {\n\t\t\t$tw.utils.dispatchCustomEvent(document,\&quot;tw-modal\&quot;,{\n\t\t\t\tparam: \&quot;$:/messages/SaveInstructions\&quot;\n\t\t\t});\n\t\t}\n\t\t// Call browser startup modules\n\t\t$tw.modules.forEachModuleOfType(\&quot;browser-startup\&quot;,function(title,module) {\n\t\t\tif(module.startup) {\n\t\t\t\tmodule.startup();\n\t\t\t}\n\t\t});\n\t} else {\n\t\t// On the server, start a commander with the command line arguments\n\t\tcommander = new $tw.Commander(\n\t\t\t$tw.boot.argv,\n\t\t\tfunction(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\tconsole.log(\&quot;Error: \&quot; + err);\n\t\t\t\t}\n\t\t\t},\n\t\t\t$tw.wiki,\n\t\t\t{output: process.stdout, error: process.stderr}\n\t\t);\n\t\tcommander.execute();\n\t}\n\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/startup.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;startup&quot;
},
&quot;$:/core/modules/storyviews/classic.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \&quot;tw-scroll\&quot;, target: targetElement});\n};\n\nClassicStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\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: \&quot;none\&quot;},\n\t\t\t{marginBottom: \&quot;\&quot;}\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: \&quot;none\&quot;},\n\t\t{marginBottom: (-currHeight) + \&quot;px\&quot;},\n\t\t{opacity: \&quot;0.0\&quot;}\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: \&quot;opacity \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;margin-bottom \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{marginBottom: currMarginBottom + \&quot;px\&quot;},\n\t\t{opacity: \&quot;1.0\&quot;}\n\t]);\n};\n\nClassicStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\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(function() {\n\t\twidget.removeChildDomNodes();\n\t},duration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \&quot;none\&quot;},\n\t\t{transform: \&quot;translateX(0px)\&quot;},\n\t\t{marginBottom: currMarginBottom + \&quot;px\&quot;},\n\t\t{opacity: \&quot;1.0\&quot;}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;opacity \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;margin-bottom \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{transform: \&quot;translateX(-\&quot; + currWidth + \&quot;px)\&quot;},\n\t\t{marginBottom: (-currHeight) + \&quot;px\&quot;},\n\t\t{opacity: \&quot;0.0\&quot;}\n\t]);\n};\n\nexports.classic = ClassicStoryView;\n\n})();&quot;,
&quot;title&quot;: &quot;$:/core/modules/storyviews/classic.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;storyview&quot;
},
&quot;$:/core/modules/storyviews/pop.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \&quot;tw-scroll\&quot;, target: targetElement});\n};\n\nPopStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Reset once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \&quot;none\&quot;},\n\t\t\t{transform: \&quot;none\&quot;}\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: \&quot;none\&quot;},\n\t\t{transform: \&quot;scale(2)\&quot;},\n\t\t{opacity: \&quot;0.0\&quot;}\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(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;opacity \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{transform: \&quot;scale(1)\&quot;},\n\t\t{opacity: \&quot;1.0\&quot;}\n\t]);\n};\n\nPopStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Remove the element at the end of the transition\n\tsetTimeout(function() {\n\t\tif(targetElement.parentNode) {\n\t\t\twidget.removeChildDomNodes();\n\t\t}\n\t},duration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \&quot;none\&quot;},\n\t\t{transform: \&quot;scale(1)\&quot;},\n\t\t{opacity: \&quot;1.0\&quot;}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;opacity \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{transform: \&quot;scale(0.1)\&quot;},\n\t\t{opacity: \&quot;0.0\&quot;}\n\t]);\n};\n\nexports.pop = PopStoryView;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/storyviews/pop.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;storyview&quot;
},
&quot;$:/core/modules/storyviews/zoomin.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar ZoominListView = function(listWidget) {\n\tvar self = this;\n\tthis.listWidget = listWidget;\n\t// Make all the tiddlers position absolute, and hide all but the first one\n\t$tw.utils.each(this.listWidget.children,function(itemWidget,index) {\n\t\tvar domNode = itemWidget.findFirstDomNode();\n\t\tif(index) {\n\t\t\tdomNode.style.display = \&quot;none\&quot;;\n\t\t} else {\n\t\t\tself.currentTiddlerDomNode = domNode;\n\t\t}\n\t\tdomNode.style.position = \&quot;absolute\&quot;;\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// Make the new tiddler be position absolute and visible so that we can measure it\n\t$tw.utils.setStyle(targetElement,[\n\t\t{position: \&quot;absolute\&quot;},\n\t\t{display: \&quot;block\&quot;},\n\t\t{transformOrigin: \&quot;0 0\&quot;},\n\t\t{transform: \&quot;translateX(0px) translateY(0px) scale(1)\&quot;},\n\t\t{transition: \&quot;none\&quot;},\n\t\t{opacity: \&quot;0.0\&quot;}\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: \&quot;translateX(\&quot; + x + \&quot;px) translateY(\&quot; + y + \&quot;px) scale(\&quot; + scale + \&quot;)\&quot;}\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(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in, opacity \&quot; + duration + \&quot;ms ease-in\&quot;},\n\t\t{opacity: \&quot;1.0\&quot;},\n\t\t{transform: \&quot;translateX(0px) translateY(0px) scale(1)\&quot;},\n\t\t{zIndex: \&quot;500\&quot;},\n\t]);\n\t// Transform the previous tiddler out of the way and then hide it\n\tif(prevCurrentTiddler &amp;&amp; prevCurrentTiddler !== targetElement) {\n\t\tvar scale = 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(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in, opacity \&quot; + duration + \&quot;ms ease-in\&quot;},\n\t\t\t{opacity: \&quot;0.0\&quot;},\n\t\t\t{transformOrigin: \&quot;0 0\&quot;},\n\t\t\t{transform: \&quot;translateX(\&quot; + x + \&quot;px) translateY(\&quot; + y + \&quot;px) scale(\&quot; + scale + \&quot;)\&quot;},\n\t\t\t{zIndex: \&quot;0\&quot;}\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 = \&quot;none\&quot;;\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 \&quot;title\&quot;\n*/\nfunction findTitleDomNode(widget,targetClass) {\n\ttargetClass = targetClass || \&quot;title\&quot;;\n\tvar domNode = widget.findFirstDomNode();\n\tif(domNode &amp;&amp; domNode.querySelector) {\n\t\treturn domNode.querySelector(\&quot;.\&quot; + targetClass);\n\t}\n\treturn null;\n}\n\nZoominListView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode();\n\t// Make the newly inserted node position absolute and hidden\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \&quot;none\&quot;},\n\t\t{position: \&quot;absolute\&quot;}\n\t]);\n};\n\nZoominListView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Set up the tiddler that is being closed\n\t$tw.utils.setStyle(targetElement,[\n\t\t{position: \&quot;absolute\&quot;},\n\t\t{display: \&quot;block\&quot;},\n\t\t{transformOrigin: \&quot;50% 50%\&quot;},\n\t\t{transform: \&quot;translateX(0px) translateY(0px) scale(1)\&quot;},\n\t\t{transition: \&quot;none\&quot;},\n\t\t{zIndex: \&quot;0\&quot;}\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 &amp;&amp; toWidget.findFirstDomNode();\n\t// Set up the tiddler we're moving back in\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{position: \&quot;absolute\&quot;},\n\t\t\t{display: \&quot;block\&quot;},\n\t\t\t{transformOrigin: \&quot;50% 50%\&quot;},\n\t\t\t{transform: \&quot;translateX(0px) translateY(0px) scale(10)\&quot;},\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in, opacity \&quot; + duration + \&quot;ms ease-in\&quot;},\n\t\t\t{opacity: \&quot;0\&quot;},\n\t\t\t{zIndex: \&quot;500\&quot;}\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: \&quot;50% 50%\&quot;},\n\t\t{transform: \&quot;translateX(0px) translateY(0px) scale(0.1)\&quot;},\n\t\t{transition: $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in, opacity \&quot; + duration + \&quot;ms ease-in\&quot;},\n\t\t{opacity: \&quot;0\&quot;},\n\t\t{zIndex: \&quot;0\&quot;}\n\t]);\n\tsetTimeout(function() {\n\t\t// Delete the DOM node when the transition is over\n\t\twidget.removeChildDomNodes();\n\t},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: \&quot;translateX(0px) translateY(0px) scale(1)\&quot;},\n\t\t\t{opacity: \&quot;1\&quot;}\n\t\t]);\n\t}\n\treturn true; // Indicate that we'll delete the DOM node\n};\n\nexports.zoomin = ZoominListView;\n\n})();&quot;,
&quot;title&quot;: &quot;$:/core/modules/storyviews/zoomin.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;storyview&quot;
},
&quot;$:/core/modules/syncer.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/syncer.js\ntype: application/javascript\nmodule-type: global\n\nThe syncer transfers content to and from data sources using syncadaptor modules.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\n/*\nInstantiate the syncer with the following options:\nwiki: wiki to be synced\n*/\nfunction Syncer(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\t// Find a working syncadaptor\n\tthis.syncadaptor = undefined;\n\t$tw.modules.forEachModuleOfType(\&quot;syncadaptor\&quot;,function(title,module) {\n\t\tif(!self.syncadaptor &amp;&amp; module.adaptorClass) {\n\t\t\tself.syncadaptor = new module.adaptorClass(self);\n\t\t}\n\t});\n\t// Only do anything if we've got a syncadaptor\n\tif(this.syncadaptor) {\n\t\tthis.init();\n\t}\n}\n\n/*\nError handling\n*/\nSyncer.prototype.showError = function(error) {\n\talert(\&quot;Syncer error: \&quot; + error);\n\t$tw.utils.log(\&quot;Syncer error: \&quot; + error);\n};\n\n/*\nMessage logging\n*/\nSyncer.prototype.log = function(/* arguments */) {\n\tvar args = Array.prototype.slice.call(arguments,0);\n\targs[0] = \&quot;Syncer: \&quot; + args[0];\n\t// Temporarily disable logging to help the wood vs. trees situation; we need better filtering of log messages\n\t//$tw.utils.log.apply(null,args);\n};\n\n/*\nConstants\n*/\nSyncer.prototype.titleIsLoggedIn = \&quot;$:/status/IsLoggedIn\&quot;;\nSyncer.prototype.titleUserName = \&quot;$:/status/UserName\&quot;;\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/*\nInitialise the syncer\n*/\nSyncer.prototype.init = function() {\n\tvar self = this;\n\t// Hashmap by title of {revision:,changeCount:,adaptorInfo:}\n\tthis.tiddlerInfo = {};\n\t// Record information for known tiddlers\n\tthis.wiki.forEachTiddler({includeSystem: true},function(title,tiddler) {\n\t\tself.tiddlerInfo[title] = {\n\t\t\trevision: tiddler.fields[\&quot;revision\&quot;],\n\t\t\tadaptorInfo: self.syncadaptor.getTiddlerInfo(tiddler),\n\t\t\tchangeCount: self.wiki.getChangeCount(title)\n\t\t}\n\t});\n\t// Tasks are {type: \&quot;load\&quot;/\&quot;save\&quot;/\&quot;delete\&quot;, title:, queueTime:, lastModificationTime:}\n\tthis.taskQueue = {}; // Hashmap of tasks 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(\&quot;change\&quot;,function(changes) {\n\t\tself.syncToServer(changes);\n\t});\n\t// Listen out for lazyLoad events\n\tthis.wiki.addEventListener(\&quot;lazyLoad\&quot;,function(title) {\n\t\tself.handleLazyLoadEvent(title);\n\t});\n\t// Listen out for login/logout/refresh events in the browser\n\tif($tw.browser) {\n\t\tdocument.addEventListener(\&quot;tw-login\&quot;,function(event) {\n\t\t\tself.handleLoginEvent(event);\n\t\t},false);\n\t\tdocument.addEventListener(\&quot;tw-logout\&quot;,function(event) {\n\t\t\tself.handleLogoutEvent(event);\n\t\t},false);\n\t\tdocument.addEventListener(\&quot;tw-server-refresh\&quot;,function(event) {\n\t\t\tself.handleRefreshEvent(event);\n\t\t},false);\n\t}\n\t// Get the login status\n\tthis.getStatus(function (err,isLoggedIn) {\n\t\tif(isLoggedIn) {\n\t\t\t// Do a sync from the server\n\t\t\tself.syncFromServer();\n\t\t}\n\t});\n};\n\n/*\nSave an incoming tiddler in the store, and updates the associated tiddlerInfo\n*/\nSyncer.prototype.storeTiddler = function(tiddlerFields) {\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};\n};\n\nSyncer.prototype.getStatus = function(callback) {\n\tvar self = this;\n\t// Check if the adaptor supports getStatus()\n\tif(this.syncadaptor.getStatus) {\n\t\t// Mark us as not logged in\n\t\tthis.wiki.addTiddler({title: this.titleIsLoggedIn,text: \&quot;no\&quot;});\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.showError(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 ? \&quot;yes\&quot; : \&quot;no\&quot;});\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,\&quot;UNAUTHENTICATED\&quot;);\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.getSkinnyTiddlers) {\n\t\tthis.log(\&quot;Retrieving skinny tiddler list\&quot;);\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 another 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.log(\&quot;Error retrieving skinny tiddler list:\&quot;,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&lt;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 + \&quot;\&quot;,\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 &amp;&amp; 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: \&quot;load\&quot;,\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);\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 = new Date();\n\t$tw.utils.each(changes,function(change,title,object) {\n\t\t// Ignore the change if it is a shadow tiddler\n\t\tif((change.deleted &amp;&amp; $tw.utils.hop(self.tiddlerInfo,title)) || (!change.deleted &amp;&amp; self.wiki.tiddlerExists(title))) {\n\t\t\t// Queue a task to sync this tiddler\n\t\t\tself.enqueueSyncTask({\n\t\t\t\ttype: change.deleted ? \&quot;delete\&quot; : \&quot;save\&quot;,\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// Queue up a sync task to load this tiddler\n\tthis.enqueueSyncTask({\n\t\ttype: \&quot;load\&quot;,\n\t\ttitle: title\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: \&quot;Login to TiddlySpace\&quot;,\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.log(\&quot;Attempting to login as\&quot;,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.log(\&quot;Attempting to logout\&quot;);\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.showError(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 = new Date();\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\tif(!$tw.utils.hop(this.tiddlerInfo,task.title)) {\n\t\tthis.tiddlerInfo[task.title] = {\n\t\t\trevision: null,\n\t\t\tadaptorInfo: {},\n\t\t\tchangeCount: -1\n\t\t}\n\t}\n\t// Bail if this is a save and the tiddler is already at the changeCount that the server has\n\tif(task.type === \&quot;save\&quot; &amp;&amp; this.wiki.getChangeCount(task.title) &lt;= 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\tthis.log(\&quot;Re-queueing up sync task with type:\&quot;,task.type,\&quot;title:\&quot;,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 === \&quot;save\&quot; || task.type === \&quot;delete\&quot;) {\n\t\t\texistingTask.type = task.type;\n\t\t}\n\t} else {\n\t\tthis.log(\&quot;Queuing up sync task with type:\&quot;,task.type,\&quot;title:\&quot;,task.title);\n\t\t// If it is not in the queue, insert it\n\t\tthis.taskQueue[task.title] = task;\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 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.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\t// Dispatch the task\n\t\t\tthis.dispatchTask(task,function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\tconsole.log(\&quot;Sync error while processing '\&quot; + task.title + \&quot;':\\n\&quot; + 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\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() &gt; 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 = new Date();\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 === \&quot;save\&quot; &amp;&amp; (now - task.lastModificationTime) &lt; self.throttleInterval &amp;&amp;\n\t\t\t(now - task.queueTime) &lt; self.fallbackInterval) {\n\t\t\treturn;\t\n\t\t}\n\t\t// Exclude the task if it is newer than the current best candidate\n\t\tif(candidateTask &amp;&amp; candidateTask.queueTime &lt; 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 === \&quot;save\&quot;) {\n\t\tvar changeCount = this.wiki.getChangeCount(task.title),\n\t\t\ttiddler = this.wiki.getTiddler(task.title);\n\t\tthis.log(\&quot;Dispatching 'save' task:\&quot;,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}\n\t} else if(task.type === \&quot;load\&quot;) {\n\t\t// Load the tiddler\n\t\tthis.log(\&quot;Dispatching 'load' task:\&quot;,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);\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 === \&quot;delete\&quot;) {\n\t\t// Delete the tiddler\n\t\tthis.log(\&quot;Dispatching 'delete' task:\&quot;,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\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t}\n};\n\nexports.Syncer = Syncer;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/syncer.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;global&quot;
},
&quot;$:/core/modules/themes.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/themes.js\ntype: application/javascript\nmodule-type: global\n\nManages themes and styling.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nvar THEME_PLUGIN_TITLE = \&quot;$:/theme\&quot;, // This tiddler contains the title of the current theme plugin\n\tDEFAULT_THEME_PLUGINS = [\n\t\t\&quot;$:/themes/tiddlywiki/snowwhite\&quot;,\n\t\t\&quot;$:/themes/tiddlywiki/vanilla\&quot;\n\t];\n\nfunction ThemeManager(wiki) {\n\tthis.wiki = wiki;\n\t// There's no theme to start with\n\tthis.currentThemeTitle = undefined;\n\t// Switch to the current theme\n\tthis.switchTheme();\n\t// Listen for changes to the theme\n\tvar self = this;\n\tthis.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\tif($tw.utils.hop(changes,THEME_PLUGIN_TITLE)) {\n\t\t\tself.switchTheme();\n\t\t}\n\t});\n}\n\nThemeManager.prototype.switchTheme = function() {\n\t// Get the name of the current theme\n\tvar themePluginTitle = this.wiki.getTiddlerText(THEME_PLUGIN_TITLE);\n\t// If it doesn't exist, then fallback to one of the default themes\n\tvar index = 0;\n\twhile(!this.wiki.getTiddler(themePluginTitle) &amp;&amp; index &lt; DEFAULT_THEME_PLUGINS.length) {\n\t\tthemePluginTitle = DEFAULT_THEME_PLUGINS[index++];\n\t}\n\t// Accumulate the titles of the plugins that we need to load\n\tvar themePlugins = [],\n\t\tself = this,\n\t\taccumulatePlugin = function(title) {\n\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\tif(tiddler &amp;&amp; tiddler.isPlugin() &amp;&amp; themePlugins.indexOf(title) === -1) {\n\t\t\t\tthemePlugins.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 || \&quot;\&quot;);\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(themePluginTitle);\n\t// Unregister any existing theme tiddlers\n\tvar unregisteredThemeTiddlers = $tw.wiki.unregisterPluginTiddlers(\&quot;theme\&quot;);\n\t// Accumulate the titles of shadow tiddlers that have changed as a result of this switch\n\tvar changedTiddlers = {};\n\t$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {\n\t\tif(unregisteredThemeTiddlers.indexOf(shadowInfo.source) !== -1) {\n\t\t\tchangedTiddlers[title] = true; // isDeleted?\n\t\t}\n\t});\n\t// Register any new theme tiddlers\n\tvar registeredThemeTiddlers = $tw.wiki.registerPluginTiddlers(\&quot;theme\&quot;,themePlugins);\n\t// Unpack the current theme tiddlers\n\t$tw.wiki.unpackPluginTiddlers();\n\t// Accumulate the affected shadow tiddlers\n\t$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {\n\t\tif(registeredThemeTiddlers.indexOf(shadowInfo.source) !== -1) {\n\t\t\tchangedTiddlers[title] = false; // isDeleted?\n\t\t}\n\t});\n\t// Issue change events for the modified tiddlers\n\t$tw.utils.each(changedTiddlers,function(status,title) {\n\t\tself.wiki.enqueueTiddlerEvent(title,status);\n\t});\n};\n\nexports.ThemeManager = ThemeManager;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/themes.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;global&quot;
},
&quot;$:/core/modules/tiddler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.hasTag = function(tag) {\n\treturn this.fields.tags &amp;&amp; this.fields.tags.indexOf(tag) !== -1;\n};\n\nexports.isPlugin = function() {\n\treturn this.fields.type === \&quot;application/json\&quot; &amp;&amp; this.hasField(\&quot;plugin-type\&quot;);\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 \&quot;\&quot;;\n\t}\n\t// Parse the field with the associated module (if any)\n\tvar fieldModule = $tw.Tiddler.fieldModules[field];\n\tif(fieldModule &amp;&amp; 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 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 + \&quot;: \&quot; + this.getFieldString(field));\n\t\t\t}\n\t\t}\n\t}\n\treturn fields.join(\&quot;\\n\&quot;);\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/tiddler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;tiddlermethod&quot;
},
&quot;$:/core/modules/utils/dom/animations/slide.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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: \&quot;none\&quot;},\n\t\t\t{marginBottom: \&quot;\&quot;},\n\t\t\t{marginTop: \&quot;\&quot;},\n\t\t\t{paddingBottom: \&quot;\&quot;},\n\t\t\t{paddingTop: \&quot;\&quot;},\n\t\t\t{height: \&quot;auto\&quot;},\n\t\t\t{opacity: \&quot;\&quot;}\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: \&quot;none\&quot;},\n\t\t{marginTop: \&quot;0px\&quot;},\n\t\t{marginBottom: \&quot;0px\&quot;},\n\t\t{paddingTop: \&quot;0px\&quot;},\n\t\t{paddingBottom: \&quot;0px\&quot;},\n\t\t{height: \&quot;0px\&quot;},\n\t\t{opacity: \&quot;0\&quot;}\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: \&quot;margin-top \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;margin-bottom \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;padding-top \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;padding-bottom \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;height \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;opacity \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{marginBottom: currMarginBottom + \&quot;px\&quot;},\n\t\t{marginTop: currMarginTop + \&quot;px\&quot;},\n\t\t{paddingBottom: currPaddingBottom + \&quot;px\&quot;},\n\t\t{paddingTop: currPaddingTop + \&quot;px\&quot;},\n\t\t{height: currHeight + \&quot;px\&quot;},\n\t\t{opacity: \&quot;1\&quot;}\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: \&quot;none\&quot;},\n\t\t\t{marginBottom: \&quot;\&quot;},\n\t\t\t{marginTop: \&quot;\&quot;},\n\t\t\t{paddingBottom: \&quot;\&quot;},\n\t\t\t{paddingTop: \&quot;\&quot;},\n\t\t\t{height: \&quot;auto\&quot;},\n\t\t\t{opacity: \&quot;\&quot;}\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 + \&quot;px\&quot;},\n\t\t{opacity: \&quot;1\&quot;}\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: \&quot;margin-top \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;margin-bottom \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;padding-top \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;padding-bottom \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;height \&quot; + duration + \&quot;ms ease-in-out, \&quot; +\n\t\t\t\t\t\&quot;opacity \&quot; + duration + \&quot;ms ease-in-out\&quot;},\n\t\t{marginTop: \&quot;0px\&quot;},\n\t\t{marginBottom: \&quot;0px\&quot;},\n\t\t{paddingTop: \&quot;0px\&quot;},\n\t\t{paddingBottom: \&quot;0px\&quot;},\n\t\t{height: \&quot;0px\&quot;},\n\t\t{opacity: \&quot;0\&quot;}\n\t]);\n}\n\nexports.slide = {\n\topen: slideOpen,\n\tclose: slideClosed\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/animations/slide.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;animation&quot;
},
&quot;$:/core/modules/utils/dom/animator.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nfunction Animator() {\n\t// Get the registered animation modules\n\tthis.animations = {};\n\t$tw.modules.applyMethods(\&quot;animation\&quot;,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&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/animator.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/browser.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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&lt;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\&quot;background-color\&quot; --&gt; \&quot;backgroundColor\&quot;\n\t\&quot;transition\&quot; --&gt; \&quot;webkitTransition\&quot;\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(document.body.style[propertyName] === undefined) {\n\t\tvar prefixes = [\&quot;O\&quot;,\&quot;MS\&quot;,\&quot;Moz\&quot;,\&quot;webkit\&quot;];\n\t\tfor(var t=0; t&lt;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\&quot;backgroundColor\&quot; --&gt; \&quot;background-color\&quot;\n\t\&quot;webkitTransform\&quot; --&gt; \&quot;-webkit-transform\&quot;\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(\&quot;webkit\&quot;) === 0) {\n\t\tstyleName = \&quot;-\&quot; + styleName;\n\t} else if(styleName.indexOf(\&quot;-m-s\&quot;) === 0) {\n\t\tstyleName = \&quot;-ms\&quot; + 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\&quot;transform\&quot; --&gt; \&quot;webkitTransform\&quot; --&gt; \&quot;-webkit-transform\&quot;\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\&quot;animationEnd\&quot; --&gt; \&quot;webkitAnimationEnd\&quot;\n*/\n\nvar eventNameCache = {}; // We'll cache the conversions\n\nvar eventNameMappings = {\n\t\&quot;transitionEnd\&quot;: {\n\t\tcorrespondingCssProperty: \&quot;transition\&quot;,\n\t\tmappings: {\n\t\t\ttransition: \&quot;transitionend\&quot;,\n\t\t\tOTransition: \&quot;oTransitionEnd\&quot;,\n\t\t\tMSTransition: \&quot;msTransitionEnd\&quot;,\n\t\t\tMozTransition: \&quot;transitionend\&quot;,\n\t\t\twebkitTransition: \&quot;webkitTransitionEnd\&quot;\n\t\t}\n\t},\n\t\&quot;animationEnd\&quot;: {\n\t\tcorrespondingCssProperty: \&quot;animation\&quot;,\n\t\tmappings: {\n\t\t\tanimation: \&quot;animationend\&quot;,\n\t\t\tOAnimation: \&quot;oAnimationEnd\&quot;,\n\t\t\tMSAnimation: \&quot;msAnimationEnd\&quot;,\n\t\t\tMozAnimation: \&quot;animationend\&quot;,\n\t\t\twebkitAnimation: \&quot;webkitAnimationEnd\&quot;\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// Setup constants for the current browser\nexports.getBrowserInfo = function(info) {\n\tinfo.isIE = (/msie|trident/i.test(navigator.userAgent));\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/browser.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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 &amp;&amp; a.contains(b) :\n\t\t!!(a.compareDocumentPosition(b) &amp; 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 &amp;&amp; el.className &amp;&amp; el.className.split(\&quot; \&quot;).indexOf(className) !== -1;\n};\n\nexports.addClass = function(el,className) {\n\tvar c = el.className.split(\&quot; \&quot;);\n\tif(c.indexOf(className) === -1) {\n\t\tc.push(className);\n\t}\n\tel.className = c.join(\&quot; \&quot;);\n};\n\nexports.removeClass = function(el,className) {\n\tvar c = el.className.split(\&quot; \&quot;),\n\t\tp = c.indexOf(className);\n\tif(p !== -1) {\n\t\tc.splice(p,1);\n\t\tel.className = c.join(\&quot; \&quot;);\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\nexports.applyStyleSheet = function(id,css) {\n\tvar el = document.getElementById(id);\n\tif(document.createStyleSheet) { // Older versions of IE\n\t\tif(el) {\n\t\t\tel.parentNode.removeChild(el);\n\t\t}\n\t\tdocument.getElementsByTagName(\&quot;head\&quot;)[0].insertAdjacentHTML(\&quot;beforeEnd\&quot;,\n\t\t\t'&amp;nbsp;&lt;style id=\&quot;' + id + '\&quot; type=\&quot;text/css\&quot;&gt;' + css + '&lt;/style&gt;'); // fails without &amp;nbsp;\n\t} else { // Modern browsers\n\t\tif(el) {\n\t\t\tel.replaceChild(document.createTextNode(css), el.firstChild);\n\t\t} else {\n\t\t\tel = document.createElement(\&quot;style\&quot;);\n\t\t\tel.type = \&quot;text/css\&quot;;\n\t\t\tel.id = id;\n\t\t\tel.appendChild(document.createTextNode(css));\n\t\t\tdocument.getElementsByTagName(\&quot;head\&quot;)[0].appendChild(el);\n\t\t}\n\t}\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(\&quot;scrollX\&quot; 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/*\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\tif(window.localStorage) {\n\t\tlocalStorage.setItem(\&quot;tw5-password-\&quot; + name,password);\n\t}\n};\n\n/*\nRetrieve a named password from the browser\n*/\nexports.getPassword = function(name) {\n\treturn window.localStorage ? localStorage.getItem(\&quot;tw5-password-\&quot; + name) : \&quot;\&quot;;\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,\&quot;pulse\&quot;);\n\t},false);\n\t// Apply the pulse class\n\t$tw.utils.removeClass(element,\&quot;pulse\&quot;);\n\t$tw.utils.forceLayout(element);\n\t$tw.utils.addClass(element,\&quot;pulse\&quot;);\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/*\nConstruct and dispatch a custom event\n*/\nexports.dispatchCustomEvent = function(target,name,members) {\n\tvar event = document.createEvent(\&quot;Event\&quot;);\n\tevent.initEvent(name,true,true);\n\t$tw.utils.each(members,function(member,name) {\n\t\tevent[name] = member;\n\t});\n\ttarget.dispatchEvent(event); \n};\n\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/http.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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*/\nexports.httpRequest = function(options) {\n\tvar type = options.type || \&quot;GET\&quot;,\n\t\theaders = options.headers || {accept: \&quot;application/json\&quot;},\n\t\trequest = new XMLHttpRequest(),\n\t\tdata = \&quot;\&quot;,\n\t\tf,results;\n\t// Massage the data hashmap into a string\n\tif(options.data) {\n\t\tif(typeof options.data === \&quot;string\&quot;) { // 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 + \&quot;=\&quot; + encodeURIComponent(dataItem));\n\t\t\t});\n\t\t\tdata = results.join(\&quot;&amp;\&quot;);\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 === 204) {\n\t\t\t\t// Success!\n\t\t\t\toptions.callback(null,this.responseText,this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t// Something went wrong\n\t\toptions.callback(new Error(\&quot;XMLHttpRequest error: \&quot; + 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 &amp;&amp; !$tw.utils.hop(headers,\&quot;Content-type\&quot;)) {\n\t\trequest.setRequestHeader(\&quot;Content-type\&quot;,\&quot;application/x-www-form-urlencoded; charset=UTF-8\&quot;);\n\t}\n\trequest.send(data);\n\treturn request;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/http.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/modal.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\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\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 wrapper divs\n\tvar wrapper = document.createElement(\&quot;div\&quot;),\n\t\tmodalBackdrop = document.createElement(\&quot;div\&quot;),\n\t\tmodalWrapper = document.createElement(\&quot;div\&quot;),\n\t\tmodalHeader = document.createElement(\&quot;div\&quot;),\n\t\theaderTitle = document.createElement(\&quot;h3\&quot;),\n\t\tmodalBody = document.createElement(\&quot;div\&quot;),\n\t\tmodalLink = document.createElement(\&quot;a\&quot;),\n\t\tmodalFooter = document.createElement(\&quot;div\&quot;),\n\t\tmodalFooterHelp = document.createElement(\&quot;span\&quot;),\n\t\tmodalFooterButtons = document.createElement(\&quot;span\&quot;);\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,\&quot;modal-wrapper\&quot;);\n\t$tw.utils.addClass(modalBackdrop,\&quot;modal-backdrop\&quot;);\n\t$tw.utils.addClass(modalWrapper,\&quot;modal\&quot;);\n\t$tw.utils.addClass(modalHeader,\&quot;modal-header\&quot;);\n\t$tw.utils.addClass(modalBody,\&quot;modal-body\&quot;);\n\t$tw.utils.addClass(modalLink,\&quot;btn btn-large btn-block btn-success\&quot;);\n\t$tw.utils.addClass(modalFooter,\&quot;modal-footer\&quot;);\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 titleText;\n\tif(tiddler &amp;&amp; tiddler.fields &amp;&amp; tiddler.fields.subtitle) {\n\t\ttitleText = tiddler.fields.subtitle;\n\t} else {\n\t\ttitleText = title;\n\t}\n\tvar headerParser = this.wiki.parseText(\&quot;text/vnd.tiddlywiki\&quot;,titleText,{parseAsInline: true}),\n\t\theaderWidgetNode = this.wiki.makeWidget(headerParser,{parentWidget: $tw.rootWidget, document: document});\n\theaderWidgetNode.render(headerTitle,null);\n\tthis.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\theaderWidgetNode.refresh(changes,modalHeader,null);\n\t});\n\t// Render the body of the message\n\tvar bodyParser = this.wiki.parseTiddler(title),\n\t\tbodyWidgetNode = this.wiki.makeWidget(bodyParser,{parentWidget: $tw.rootWidget, document: document});\n\tbodyWidgetNode.render(modalBody,null);\n\tthis.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\tbodyWidgetNode.refresh(changes,modalBody,null);\n\t});\n\t// Setup the link if present\n\tif(options.downloadLink) {\n\t\tmodalLink.href = options.downloadLink\n\t\tmodalLink.appendChild(document.createTextNode(\&quot;Right-click to save changes\&quot;));\n\t\tmodalBody.appendChild(modalLink);\n\t}\n\t// Render the footer of the message\n\tif(tiddler &amp;&amp; tiddler.fields &amp;&amp; tiddler.fields.help) {\n\t\tvar link = document.createElement(\&quot;a\&quot;);\n\t\tlink.setAttribute(\&quot;href\&quot;,tiddler.fields.help);\n\t\tlink.setAttribute(\&quot;target\&quot;,\&quot;_blank\&quot;);\n\t\tlink.appendChild(document.createTextNode(\&quot;Help\&quot;));\n\t\tmodalFooterHelp.appendChild(link);\n\t\tmodalFooterHelp.style.float = \&quot;left\&quot;;\n\t}\n\tvar footerText;\n\tif(tiddler &amp;&amp; tiddler.fields &amp;&amp; tiddler.fields.footer) {\n\t\tfooterText = tiddler.fields.footer;\n\t} else {\n\t\tfooterText = '&lt;$button message=\&quot;tw-close-tiddler\&quot; class=\&quot;btn btn-primary\&quot;&gt;Close&lt;/$button&gt;';\n\t}\n\tvar footerParser = this.wiki.parseText(\&quot;text/vnd.tiddlywiki\&quot;,footerText,{parseAsInline: true}),\n\t\tfooterWidgetNode = this.wiki.makeWidget(footerParser,{parentWidget: $tw.rootWidget, document: document});\n\tfooterWidgetNode.render(modalFooterButtons,null);\n\tthis.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\tfooterWidgetNode.refresh(changes,modalFooterButtons,null);\n\t});\n\t// Add the close event handler\n\tvar closeHandler = function(event) {\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: \&quot;0\&quot;}\n\t\t]);\n\t\t$tw.utils.setStyle(modalWrapper,[\n\t\t\t{transform: \&quot;translateY(\&quot; + window.innerHeight + \&quot;px)\&quot;}\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 tw-close-tiddler message\n\t\treturn false;\n\t};\n\theaderWidgetNode.addEventListener(\&quot;tw-close-tiddler\&quot;,closeHandler,false);\n\tbodyWidgetNode.addEventListener(\&quot;tw-close-tiddler\&quot;,closeHandler,false);\n\tfooterWidgetNode.addEventListener(\&quot;tw-close-tiddler\&quot;,closeHandler,false);\n\t// Set the initial styles for the message\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \&quot;0\&quot;}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transformOrigin: \&quot;0% 0%\&quot;},\n\t\t{transform: \&quot;translateY(\&quot; + (-window.innerHeight) + \&quot;px)\&quot;}\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: \&quot;opacity \&quot; + duration + \&quot;ms ease-out\&quot;}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in-out\&quot;}\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: \&quot;0.7\&quot;}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transform: \&quot;translateY(0px)\&quot;}\n\t]);\n};\n\nModal.prototype.adjustPageClass = function() {\n\tif($tw.pageContainer) {\n\t\t$tw.utils.toggleClass($tw.pageContainer,\&quot;tw-modal-displayed\&quot;,this.modalCount &gt; 0);\n\t}\n};\n\nexports.Modal = Modal;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/modal.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/notifier.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\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 notification = document.createElement(\&quot;div\&quot;),\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tduration = $tw.utils.getAnimationDuration();\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,\&quot;tw-notification\&quot;);\n\t// Render the body of the notification\n\tvar parser = this.wiki.parseTiddler(title),\n\t\twidgetNode = this.wiki.makeWidget(parser,{parentWidget: $tw.rootWidget, document: document});\n\twidgetNode.render(notification,null);\n\tthis.wiki.addEventListener(\&quot;change\&quot;,function(changes) {\n\t\twidgetNode.refresh(changes,notification,null);\n\t});\n\t// Set the initial styles for the notification\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \&quot;0\&quot;},\n\t\t{transformOrigin: \&quot;0% 0%\&quot;},\n\t\t{transform: \&quot;translateY(\&quot; + (-window.innerHeight) + \&quot;px)\&quot;},\n\t\t{transition: \&quot;opacity \&quot; + duration + \&quot;ms ease-out, \&quot; + $tw.utils.roundTripPropertyName(\&quot;transform\&quot;) + \&quot; \&quot; + duration + \&quot;ms ease-in-out\&quot;}\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: \&quot;1.0\&quot;},\n\t\t{transform: \&quot;translateY(0px)\&quot;}\n\t]);\n\t// Set a timer to remove the notification\n\twindow.setTimeout(function() {\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: \&quot;0.0\&quot;},\n\t\t\t{transform: \&quot;translateX(\&quot; + (notification.offsetWidth) + \&quot;px)\&quot;}\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/notifier.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/popup.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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.body;\n};\n\nPopup.prototype.show = function(options) {\n\tthis.cancel();\n\tthis.title = options.title;\n\tthis.wiki = options.wiki;\n\tthis.anchorDomNode = options.domNode;\n\t$tw.utils.addClass(this.anchorDomNode,\&quot;tw-popup\&quot;);\n\tthis.rootElement.addEventListener(\&quot;click\&quot;,this,false);\n};\n\nPopup.prototype.handleEvent = function(event) {\n\t// Dismiss the popup if we get a click on an element that doesn't have .tw-popup class\n\tif(event.type === \&quot;click\&quot;) {\n\t\tvar node = event.target;\n\t\twhile(node &amp;&amp; !$tw.utils.hasClass(node,\&quot;tw-popup\&quot;)) {\n\t\t\tnode = node.parentNode;\n\t\t}\n\t\tif(!node) {\n\t\t\tthis.cancel();\n\t\t}\n\t}\n};\n\nPopup.prototype.cancel = function() {\n\tif(this.anchorDomNode) {\n\t\t$tw.utils.removeClass(this.anchorDomNode,\&quot;tw-popup\&quot;);\n\t\tthis.anchorDomNode = null;\t\t\n\t}\n\tthis.rootElement.removeEventListener(\&quot;click\&quot;,this,false);\n\tif(this.title) {\n\t\tthis.wiki.deleteTiddler(this.title);\n\t\tthis.title = null;\n\t}\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\n*/\nPopup.prototype.triggerPopup = function(options) {\n\t// Get the current popup state tiddler\n\tvar value = options.wiki.getTextReference(options.title,\&quot;\&quot;);\n\t// Check if the popup is open by checking whether it matches \&quot;(&lt;x&gt;,&lt;y&gt;)\&quot;\n\tvar state = !this.readPopupState(options.title,value);\n\tif(\&quot;force\&quot; in options) {\n\t\tstate = options.force;\n\t}\n\tif(state) {\n\t\t// Set the position if we're opening it\n\t\tthis.cancel();\n\t\toptions.wiki.setTextReference(options.title,\n\t\t\t\&quot;(\&quot; + options.domNode.offsetLeft + \&quot;,\&quot; + options.domNode.offsetTop + \&quot;,\&quot; + \n\t\t\t\toptions.domNode.offsetWidth + \&quot;,\&quot; + options.domNode.offsetHeight + \&quot;)\&quot;);\n\t\tthis.show(options);\n\t} else {\n\t\tthis.cancel();\n\t}\n};\n\n/*\nReturns true if the specified title and text identifies an active popup\n*/\nPopup.prototype.readPopupState = function(title,text) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tresult = false;\n\tif(this.title === title) {\n\t\tresult = popupLocationRegExp.test(text);\n\t}\n\treturn result;\n};\n\nexports.Popup = Popup;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/popup.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/dom/scroller.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n/*\nEvent handler for when the `tw-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 === \&quot;tw-scroll\&quot;) {\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// Get the offset bounds of the element\n\tvar bounds = {\n\t\t\tleft: element.offsetLeft,\n\t\t\ttop: element.offsetTop,\n\t\t\twidth: element.offsetWidth,\n\t\t\theight: element.offsetHeight\n\t\t};\n\t// Walk up the tree adjusting the offset bounds by each offsetParent\n\twhile(element.offsetParent) {\n\t\telement = element.offsetParent;\n\t\tbounds.left += element.offsetLeft;\n\t\tbounds.top += element.offsetTop;\n\t}\n\t// Now get ready to scroll the body\n\tthis.cancelScroll();\n\tthis.startTime = new Date();\n\tvar scrollPosition = $tw.utils.getScrollPosition(),\n\t\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\t\tgetEndPos = function(targetPos,targetSize,currentPos,currentSize) {\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 &lt;= 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 &lt; currentSize &amp;&amp; currentPos &lt; (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 &lt; 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,window.innerWidth),\n\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);\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 &lt;= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((new Date()) - self.startTime) / duration;\t\n\t\t\t}\n\t\t\tif(t &gt;= 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 &lt; 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&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/dom/scroller.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/fakedom.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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\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.namespaceURI = namespace || \&quot;http://www.w3.org/1999/xhtml\&quot;;\n};\n\nTW_Element.prototype.setAttribute = function(name,value) {\n\tif(this.isRaw) {\n\t\tthrow \&quot;Cannot setAttribute on a raw TW_Element\&quot;;\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 \&quot;Cannot removeAttribute on a raw TW_Element\&quot;;\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, \&quot;firstChild\&quot;, {\n get: function() {\n \treturn this.children[0];\n }\n});\n\nTW_Element.prototype.addEventListener = function(type,listener,useCapture) {\n\t// Do nothing\n};\n\nObject.defineProperty(TW_Element.prototype, \&quot;className\&quot;, {\n\tget: function() {\n\t\treturn this.attributes[\&quot;class\&quot;] || \&quot;\&quot;;\n\t},\n set: function(value) {\n \tthis.attributes[\&quot;class\&quot;] = value;\n }\n});\n\nObject.defineProperty(TW_Element.prototype, \&quot;outerHTML\&quot;, {\n get: function() {\n\t\tvar output = [],attr,a,v;\n\t\toutput.push(\&quot;&lt;\&quot;,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&lt;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(\&quot; \&quot;,attr[a],\&quot;='\&quot;,$tw.utils.htmlEncode(v),\&quot;'\&quot;);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.push(\&quot;&gt;\&quot;);\n\t\tif($tw.config.htmlVoidElements.indexOf(this.tag) === -1) {\n\t\t\toutput.push(this.innerHTML);\n\t\t\toutput.push(\&quot;&lt;/\&quot;,this.tag,\&quot;&gt;\&quot;);\n\t\t}\n\t\treturn output.join(\&quot;\&quot;);\n }\n});\n\nObject.defineProperty(TW_Element.prototype, \&quot;innerHTML\&quot;, {\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(\&quot;\&quot;);\n\t\t}\n\t},\n set: function(value) {\n \tthis.isRaw = true;\n \tthis.rawHTML = value;\n }\n});\n\nObject.defineProperty(TW_Element.prototype, \&quot;textContent\&quot;, {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\tthrow \&quot;Cannot get textContent on a raw TW_Element\&quot;;\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(\&quot;\&quot;);\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};\n\nexports.document = document;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/fakedom.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;global&quot;
},
&quot;$:/core/modules/utils/parsetree.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nexports.addAttributeToParseTreeNode = function(node,name,value) {\n\tif(node.type === \&quot;element\&quot;) {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[name] = {type: \&quot;string\&quot;, value: value};\n\t}\n};\n\nexports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {\n\tif(node.type === \&quot;element\&quot; &amp;&amp; node.attributes &amp;&amp; node.attributes[name] &amp;&amp; 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\tif(node.type === \&quot;element\&quot;) {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[\&quot;class\&quot;] = node.attributes[\&quot;class\&quot;] || {type: \&quot;string\&quot;, value: \&quot;\&quot;};\n\t\tif(node.attributes[\&quot;class\&quot;].type === \&quot;string\&quot;) {\n\t\t\tif(node.attributes[\&quot;class\&quot;].value !== \&quot;\&quot;) {\n\t\t\t\tclasses = node.attributes[\&quot;class\&quot;].value.split(\&quot; \&quot;);\n\t\t\t}\n\t\t\tif(classString !== \&quot;\&quot;) {\n\t\t\t\t$tw.utils.pushTop(classes,classString.split(\&quot; \&quot;));\n\t\t\t}\n\t\t\tnode.attributes[\&quot;class\&quot;].value = classes.join(\&quot; \&quot;);\n\t\t}\n\t}\n};\n\nexports.addStyleToParseTreeNode = function(node,name,value) {\n\tif(node.type === \&quot;element\&quot;) {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[\&quot;style\&quot;] = node.attributes[\&quot;style\&quot;] || {type: \&quot;string\&quot;, value: \&quot;\&quot;};\n\t\tif(node.attributes[\&quot;style\&quot;].type === \&quot;string\&quot;) {\n\t\t\tnode.attributes[\&quot;style\&quot;].value += name + \&quot;:\&quot; + value + \&quot;;\&quot;;\n\t\t}\n\t}\n};\n\nexports.findParseTreeNode = function(nodeArray,search) {\n\tfor(var t=0; t&lt;nodeArray.length; t++) {\n\t\tif(nodeArray[t].type === search.type &amp;&amp; nodeArray[t].tag === search.tag) {\n\t\t\treturn nodeArray[t];\n\t\t}\n\t}\n\treturn undefined;\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/parsetree.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/utils/utils.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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 === \&quot;string\&quot;) {\n\t\treturn str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\t} else {\n\t\treturn str;\n\t}\n};\n\n/*\nReturn the number of keys in an object\n*/\nexports.count = function(object) {\n\tvar s = 0;\n\t$tw.utils.each(object,function() {s++;});\n\treturn s;\n};\n\n/*\nPush entries onto an array, removing them first if they already exist in the array\n\tarray: array to modify\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\tfor(t=0; t&lt;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\t// Push the values on top of the main array\n\t\tarray.push.apply(array,value);\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};\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&lt;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 === \&quot;object\&quot;) {\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.slowInSlowOut = function(t) {\n\treturn (1 - ((Math.cos(t * Math.PI) + 1) / 2));\n};\n\nexports.formatDateString = function (date,template) {\n\tvar t = template.replace(/0hh12/g,$tw.utils.pad($tw.utils.getHours12(date)));\n\tt = t.replace(/hh12/g,$tw.utils.getHours12(date));\n\tt = t.replace(/0hh/g,$tw.utils.pad(date.getHours()));\n\tt = t.replace(/hh/g,date.getHours());\n\tt = t.replace(/mmm/g,$tw.config.dateFormats.shortMonths[date.getMonth()]);\n\tt = t.replace(/0mm/g,$tw.utils.pad(date.getMinutes()));\n\tt = t.replace(/mm/g,date.getMinutes());\n\tt = t.replace(/0ss/g,$tw.utils.pad(date.getSeconds()));\n\tt = t.replace(/ss/g,date.getSeconds());\n\tt = t.replace(/[ap]m/g,$tw.utils.getAmPm(date).toLowerCase());\n\tt = t.replace(/[AP]M/g,$tw.utils.getAmPm(date).toUpperCase());\n\tt = t.replace(/wYYYY/g,$tw.utils.getYearForWeekNo(date));\n\tt = t.replace(/wYY/g,$tw.utils.pad($tw.utils.getYearForWeekNo(date)-2000));\n\tt = t.replace(/YYYY/g,date.getFullYear());\n\tt = t.replace(/YY/g,$tw.utils.pad(date.getFullYear()-2000));\n\tt = t.replace(/MMM/g,$tw.config.dateFormats.months[date.getMonth()]);\n\tt = t.replace(/0MM/g,$tw.utils.pad(date.getMonth()+1));\n\tt = t.replace(/MM/g,date.getMonth()+1);\n\tt = t.replace(/0WW/g,$tw.utils.pad($tw.utils.getWeek(date)));\n\tt = t.replace(/WW/g,$tw.utils.getWeek(date));\n\tt = t.replace(/DDD/g,$tw.config.dateFormats.days[date.getDay()]);\n\tt = t.replace(/ddd/g,$tw.config.dateFormats.shortDays[date.getDay()]);\n\tt = t.replace(/0DD/g,$tw.utils.pad(date.getDate()));\n\tt = t.replace(/DDth/g,date.getDate()+$tw.utils.getDaySuffix(date));\n\tt = t.replace(/DD/g,date.getDate());\n\tvar tz = date.getTimezoneOffset();\n\tvar atz = Math.abs(tz);\n\tt = t.replace(/TZD/g,(tz &lt; 0 ? '+' : '-') + $tw.utils.pad(Math.floor(atz / 60)) + ':' + $tw.utils.pad(atz % 60));\n\tt = t.replace(/\\\\/g,\&quot;\&quot;);\n\treturn t;\n};\n\nexports.getAmPm = function(date) {\n\treturn date.getHours() &gt;= 12 ? $tw.config.dateFormats.pm : $tw.config.dateFormats.am;\n};\n\nexports.getDaySuffix = function(date) {\n\treturn $tw.config.dateFormats.daySuffixes[date.getDate()-1];\n};\n\nexports.getWeek = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) d=7;// JavaScript Sun=0, ISO Sun=7\n\tdt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week to calculate weekNo\n\tvar n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1)+3600000)/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) d=7;// JavaScript Sun=0, ISO Sun=7\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 &gt; 12 ? h-12 : ( h &gt; 0 ? h : 12 );\n};\n\n/*\nConvert a date delta in milliseconds into a string representation of \&quot;23 seconds ago\&quot;, \&quot;27 minutes ago\&quot; 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 units = [\n\t\t{name: \&quot;years\&quot;, duration: 365 * 24 * 60 * 60 * 1000},\n\t\t{name: \&quot;months\&quot;, duration: (365/12) * 24 * 60 * 60 * 1000},\n\t\t{name: \&quot;days\&quot;, duration: 24 * 60 * 60 * 1000},\n\t\t{name: \&quot;hours\&quot;, duration: 60 * 60 * 1000},\n\t\t{name: \&quot;minutes\&quot;, duration: 60 * 1000},\n\t\t{name: \&quot;seconds\&quot;, duration: 1000}\n\t];\n\tfor(var t=0; t&lt;units.length; t++) {\n\t\tvar result = Math.floor(delta / units[t].duration);\n\t\tif(result &gt;= 2) {\n\t\t\treturn {\n\t\t\t\tdelta: delta,\n\t\t\t\tdescription: result + \&quot; \&quot; + units[t].name + \&quot; ago\&quot;,\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: \&quot;1 second ago\&quot;,\n\t\tupdatePeriod: 1000\n\t};\n};\n\n// Convert &amp; to \&quot;&amp;amp;\&quot;, &lt; to \&quot;&amp;lt;\&quot;, &gt; to \&quot;&amp;gt;\&quot; and \&quot; to \&quot;&amp;quot;\&quot;\nexports.htmlEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&amp;/mg,\&quot;&amp;amp;\&quot;).replace(/&lt;/mg,\&quot;&amp;lt;\&quot;).replace(/&gt;/mg,\&quot;&amp;gt;\&quot;).replace(/\\\&quot;/mg,\&quot;&amp;quot;\&quot;);\n\t} else {\n\t\treturn \&quot;\&quot;;\n\t}\n};\n\n// Converts all HTML entities to their character equivalents\nexports.entityDecode = function(s) {\n\tvar e = s.substr(1,s.length-2); // Strip the &amp; and the ;\n\tif(e.charAt(0) === \&quot;#\&quot;) {\n\t\tif(e.charAt(1) === \&quot;x\&quot; || e.charAt(1) === \&quot;X\&quot;) {\n\t\t\treturn String.fromCharCode(parseInt(e.substr(2),16));\t\n\t\t} else {\n\t\t\treturn String.fromCharCode(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 String.fromCharCode(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,\&quot;\\n\&quot;).replace(/\\\\b/mg,\&quot; \&quot;).replace(/\\\\s/mg,\&quot;\\\\\&quot;).replace(/\\r/mg,\&quot;\&quot;);\n};\n\n/*\n * Returns an escape sequence for given character. Uses \\x for characters &lt;=\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 \&quot;action\&quot; nodes.\n */\n// Copied from peg.js, thanks to David Majda\nexports.escape = function(ch) {\n\tvar charCode = ch.charCodeAt(0);\n\tif(charCode &lt;= 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 escape all non-ASCII characters.\n\t*/\n\treturn s\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\&quot;/g, '\\\\\&quot;') // double quote character\n\t\t.replace(/'/g, \&quot;\\\\'\&quot;) // 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, '\\\\$&amp;');\n};\n\nexports.nextTick = function(fn) {\n/*global window: false */\n\tif(typeof window !== \&quot;undefined\&quot;) {\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 (\&quot;backgroundColor\&quot; --&gt; \&quot;background-color\&quot;)\n*/\nexports.hyphenateCss = function(propName) {\n\treturn propName.replace(/([A-Z])/g, function(match0,match1) {\n\t\treturn \&quot;-\&quot; + 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 = /^\\s*([^!#]+)?(?:(?:!!([^\\s]+))|(?:##([^\\s]+)))?\\s*/mg,\n\t\tmatch = reTextRef.exec(textRef);\n\tif(match &amp;&amp; reTextRef.lastIndex === textRef.length) {\n\t\t// Return the parts\n\t\treturn {\n\t\t\ttitle: match[1],\n\t\t\tfield: match[2],\n\t\t\tindex: match[3]\n\t\t};\n\t} else {\n\t\t// If we couldn't parse it (eg it started with a)\n\t\treturn {\n\t\t\ttitle: textRef\n\t\t};\n\t}\n};\n\n/*\nExtract the version number from the meta tag or from the boot file\n*/\n\nif($tw.browser) {\n\n// Browser version\nexports.extractVersionInfo = function() {\n\tvar metatags = document.getElementsByTagName(\&quot;meta\&quot;);\n\tfor(var t=0; t&lt;metatags.length; t++) {\n\t\tvar m = metatags[t];\n\t\tif(m.name === \&quot;tiddlywiki-version\&quot;) {\n\t\t\treturn m.content;\n\t\t}\n\t}\n\treturn null;\n};\n\n} else {\n\n// Server version\nexports.extractVersionInfo = function() {\n\treturn $tw.packageInfo.version;\n};\n\n}\n\n/*\nGet the animation duration in ms\n*/\nexports.getAnimationDuration = function() {\n\treturn parseInt($tw.wiki.getTiddlerText(\&quot;$:/config/AnimationDuration\&quot;,\&quot;400\&quot;),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(\&quot;\&quot;).reduce(function(a,b) {\n\t\ta = ((a &lt;&lt; 5) - a) + b.charCodeAt(0);\n\t\treturn a &amp; 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 \&quot;$tw.utils.base64Decode() doesn't work in the browser\&quot;;\n\t} else {\n\t\treturn (new Buffer(string64,\&quot;base64\&quot;)).toString();\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/utils/utils.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;utils&quot;
},
&quot;$:/core/modules/widgets/browse.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;input\&quot;);\n\tdomNode.setAttribute(\&quot;type\&quot;,\&quot;file\&quot;);\n\tdomNode.setAttribute(\&quot;multiple\&quot;,\&quot;multiple\&quot;);\n\t// Add a click event handler\n\tdomNode.addEventListener(\&quot;change\&quot;,function (event) {\n\t\tself.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {\n\t\t\tself.dispatchEvent({type: \&quot;tw-import-tiddlers\&quot;, param: JSON.stringify(tiddlerFieldsArray)});\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};\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/browse.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/button.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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 domNode = this.document.createElement(\&quot;button\&quot;);\n\t// Assign classes\n\tvar classes = this[\&quot;class\&quot;].split(\&quot; \&quot;) || [];\n\tif(this.selectedClass) {\n\t\tif(this.set &amp;&amp; this.setTo &amp;&amp; this.isSelected()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\&quot; \&quot;));\n\t\t}\n\t\tif(this.popup &amp;&amp; this.isPoppedUp()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\&quot; \&quot;));\n\t\t}\n\t}\n\tdomNode.className = classes.join(\&quot; \&quot;);\n\t// Assign classes\n\tif(this.style) {\n\t\tdomNode.setAttribute(\&quot;style\&quot;,this.style);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\&quot;click\&quot;,function (event) {\n\t\tvar handled = false;\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(handled) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\treturn handled;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nButtonWidget.prototype.isSelected = function() {\n\tvar tiddler = this.wiki.getTiddler(this.set);\n\treturn tiddler ? tiddler.fields.text === this.setTo : this.defaultSetValue === this.setTo;\n};\n\nButtonWidget.prototype.isPoppedUp = function() {\n\tvar tiddler = this.wiki.getTiddler(this.popup);\n\tvar result = tiddler &amp;&amp; tiddler.fields.text ? $tw.popup.readPopupState(this.popup,tiddler.fields.text) : false;\n\treturn result;\n};\n\nButtonWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\&quot;currentTiddler\&quot;)});\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\tvar tiddler = this.wiki.getTiddler(this.set);\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));\n};\n\n/*\nCompute the internal state of the widget\n*/\nButtonWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.message = this.getAttribute(\&quot;message\&quot;);\n\tthis.param = this.getAttribute(\&quot;param\&quot;);\n\tthis.set = this.getAttribute(\&quot;set\&quot;);\n\tthis.setTo = this.getAttribute(\&quot;setTo\&quot;);\n\tthis.popup = this.getAttribute(\&quot;popup\&quot;);\n\tthis.hover = this.getAttribute(\&quot;hover\&quot;);\n\tthis[\&quot;class\&quot;] = this.getAttribute(\&quot;class\&quot;,\&quot;\&quot;);\n\tthis.style = this.getAttribute(\&quot;style\&quot;);\n\tthis.selectedClass = this.getAttribute(\&quot;selectedClass\&quot;);\n\tthis.defaultSetValue = this.getAttribute(\&quot;default\&quot;);\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.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes[\&quot;class\&quot;] || changedAttributes.selectedClass || changedAttributes.style || (this.set &amp;&amp; changedTiddlers[this.set]) || (this.popup &amp;&amp; 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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/button.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/checkbox.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;label\&quot;);\n\tthis.inputDomNode = this.document.createElement(\&quot;input\&quot;);\n\tthis.inputDomNode.setAttribute(\&quot;type\&quot;,\&quot;checkbox\&quot;);\n\tif(this.getValue()) {\n\t\tthis.inputDomNode.setAttribute(\&quot;checked\&quot;,\&quot;true\&quot;);\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\&quot;span\&quot;);\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \&quot;change\&quot;, handlerObject: this, handlerMethod: \&quot;handleChangeEvent\&quot;}\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\treturn tiddler ? tiddler.hasTag(this.checkboxTag) : false;\n};\n\nCheckboxWidget.prototype.handleChangeEvent = function(event) {\n\tvar checked = this.inputDomNode.checked,\n\t\ttiddler = this.wiki.getTiddler(this.checkboxTitle);\n\tif(tiddler &amp;&amp; tiddler.hasTag(this.checkboxTag) !== checked) {\n\t\tvar newTags = (tiddler.fields.tags || []).slice(0),\n\t\t\tpos = newTags.indexOf(this.checkboxTag);\n\t\tif(pos !== -1) {\n\t\t\tnewTags.splice(pos,1);\n\t\t}\n\t\tif(checked) {\n\t\t\tnewTags.push(this.checkboxTag);\n\t\t}\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{tags: newTags},this.wiki.getModificationFields()));\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.checkboxTitle = this.getAttribute(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.checkboxTag = this.getAttribute(\&quot;tag\&quot;);\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[\&quot;class\&quot;]) {\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})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/checkbox.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/count.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;filter\&quot;);\n\t// Execute the filter\n\tif(this.filter) {\n\t\tthis.currentCount = this.wiki.filterTiddlers(this.filter,this.getVariable(\&quot;currentTiddler\&quot;)).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\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/count.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/dropzone.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;div\&quot;);\n\tdomNode.className = \&quot;tw-dropzone\&quot;;\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \&quot;dragenter\&quot;, handlerObject: this, handlerMethod: \&quot;handleDragEnterEvent\&quot;},\n\t\t{name: \&quot;dragover\&quot;, handlerObject: this, handlerMethod: \&quot;handleDragOverEvent\&quot;},\n\t\t{name: \&quot;dragleave\&quot;, handlerObject: this, handlerMethod: \&quot;handleDragLeaveEvent\&quot;},\n\t\t{name: \&quot;drop\&quot;, handlerObject: this, handlerMethod: \&quot;handleDropEvent\&quot;},\n\t\t{name: \&quot;paste\&quot;, handlerObject: this, handlerMethod: \&quot;handlePasteEvent\&quot;}\n\t]);\n\tdomNode.addEventListener(\&quot;click\&quot;,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};\n\nDropZoneWidget.prototype.handleDragEnterEvent = function(event) {\n\t// We count enter/leave events\n\tthis.dragEnterCount = (this.dragEnterCount || 0) + 1;\n\t// If we're entering for the first time we need to apply highlighting\n\tif(this.dragEnterCount === 1) {\n\t\t$tw.utils.addClass(this.domNodes[0],\&quot;tw-dragover\&quot;);\n\t}\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// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\tevent.dataTransfer.dropEffect = \&quot;copy\&quot;; // Explicitly show this is a copy\n};\n\nDropZoneWidget.prototype.handleDragLeaveEvent = function(event) {\n\t// Reduce the enter count\n\tthis.dragEnterCount = (this.dragEnterCount || 0) - 1;\n\t// Remove highlighting if we're leaving externally\n\tif(this.dragEnterCount &lt;= 0) {\n\t\t$tw.utils.removeClass(this.domNodes[0],\&quot;tw-dragover\&quot;);\n\t}\n};\n\nDropZoneWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this,\n\t\tdataTransfer = event.dataTransfer;\n\t// Reset the enter count\n\tthis.dragEnterCount = 0;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.domNodes[0],\&quot;tw-dragover\&quot;);\n\t// Try to import the various data types we understand\n\tthis.importData(dataTransfer);\n\t// Import any files in the drop\n\tthis.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {\n\t\tself.dispatchEvent({type: \&quot;tw-import-tiddlers\&quot;, param: JSON.stringify(tiddlerFieldsArray)});\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.importData = function(dataTransfer) {\n\t// Try each provided data type in turn\n\tfor(var t=0; t&lt;this.importDataTypes.length; t++) {\n\t\tif(!$tw.browser.isIE || this.importDataTypes[t].IECompatible) {\n\t\t\t// Get the data\n\t\t\tvar dataType = this.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 !== \&quot;\&quot; &amp;&amp; data !== null) {\n\t\t\t\tvar tiddlerFields = dataType.convertToFields(data);\n\t\t\t\tif(!tiddlerFields.title) {\n\t\t\t\t\ttiddlerFields.title = this.wiki.generateNewTitle(\&quot;Untitled\&quot;);\n\t\t\t\t}\n\t\t\t\tthis.dispatchEvent({type: \&quot;tw-import-tiddlers\&quot;, param: JSON.stringify([tiddlerFields])});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n};\n\nDropZoneWidget.prototype.importDataTypes = [\n\t{type: \&quot;text/vnd.tiddler\&quot;, IECompatible: false, convertToFields: function(data) {\n\t\treturn JSON.parse(data);\n\t}},\n\t{type: \&quot;URL\&quot;, IECompatible: true, convertToFields: function(data) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURI(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn JSON.parse(match[1]);\n\t\t} else {\n\t\t\treturn { // As URL string\n\t\t\t\ttext: data\n\t\t\t};\n\t\t}\n\t}},\n\t{type: \&quot;text/x-moz-url\&quot;, IECompatible: false, convertToFields: function(data) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURI(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn JSON.parse(match[1]);\n\t\t} else {\n\t\t\treturn { // As URL string\n\t\t\t\ttext: data\n\t\t\t};\n\t\t}\n\t}},\n\t{type: \&quot;text/plain\&quot;, IECompatible: false, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}},\n\t{type: \&quot;Text\&quot;, IECompatible: true, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}},\n\t{type: \&quot;text/uri-list\&quot;, IECompatible: false, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}}\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([\&quot;TEXTAREA\&quot;,\&quot;INPUT\&quot;].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&lt;items.length; t++) {\n\t\t\tvar item = items[t];\n\t\t\tif(item.kind === \&quot;file\&quot;) {\n\t\t\t\t// Import any files\n\t\t\t\tthis.wiki.readFile(item.getAsFile(),function(tiddlerFields) {\n\t\t\t\t\tself.dispatchEvent({type: \&quot;tw-import-tiddlers\&quot;, param: JSON.stringify([tiddlerFields])});\n\t\t\t\t});\n\t\t\t} else if(item.kind === \&quot;string\&quot;) {\n\t\t\t\t// Create tiddlers from string items\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(\&quot;Untitled\&quot;),\n\t\t\t\t\t\ttext: str\n\t\t\t\t\t};\n\t\t\t\t\tself.dispatchEvent({type: \&quot;tw-import-tiddlers\&quot;, 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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/dropzone.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/edit-bitmap.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\n// Default image sizes\nvar DEFAULT_IMAGE_WIDTH = 300,\n\tDEFAULT_IMAGE_HEIGHT = 185;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\n\nvar EditBitmapWidget = function(parseTreeNode,options) {\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 our element\n\tthis.canvasDomNode = $tw.utils.domMaker(\&quot;canvas\&quot;,{\n\t\tdocument: this.document,\n\t\t\&quot;class\&quot;:\&quot;tw-edit-bitmapeditor\&quot;,\n\t\teventListeners: [{\n\t\t\tname: \&quot;touchstart\&quot;, handlerObject: this, handlerMethod: \&quot;handleTouchStartEvent\&quot;\n\t\t},{\n\t\t\tname: \&quot;touchmove\&quot;, handlerObject: this, handlerMethod: \&quot;handleTouchMoveEvent\&quot;\n\t\t},{\n\t\t\tname: \&quot;touchend\&quot;, handlerObject: this, handlerMethod: \&quot;handleTouchEndEvent\&quot;\n\t\t},{\n\t\t\tname: \&quot;mousedown\&quot;, handlerObject: this, handlerMethod: \&quot;handleMouseDownEvent\&quot;\n\t\t},{\n\t\t\tname: \&quot;mousemove\&quot;, handlerObject: this, handlerMethod: \&quot;handleMouseMoveEvent\&quot;\n\t\t},{\n\t\t\tname: \&quot;mouseup\&quot;, handlerObject: this, handlerMethod: \&quot;handleMouseUpEvent\&quot;\n\t\t}]\n\t});\n\tthis.widthDomNode = $tw.utils.domMaker(\&quot;input\&quot;,{\n\t\tdocument: this.document,\n\t\t\&quot;class\&quot;:\&quot;tw-edit-bitmapeditor-width\&quot;,\n\t\teventListeners: [{\n\t\t\tname: \&quot;change\&quot;, handlerObject: this, handlerMethod: \&quot;handleWidthChangeEvent\&quot;\n\t\t}]\n\t});\n\tthis.heightDomNode = $tw.utils.domMaker(\&quot;input\&quot;,{\n\t\tdocument: this.document,\n\t\t\&quot;class\&quot;:\&quot;tw-edit-bitmapeditor-height\&quot;,\n\t\teventListeners: [{\n\t\t\tname: \&quot;change\&quot;, handlerObject: this, handlerMethod: \&quot;handleHeightChangeEvent\&quot;\n\t\t}]\n\t});\n\t// Insert the elements into the DOM\n\tparent.insertBefore(this.canvasDomNode,nextSibling);\n\tparent.insertBefore(this.widthDomNode,nextSibling);\n\tparent.insertBefore(this.heightDomNode,nextSibling);\n\tthis.domNodes.push(this.canvasDomNode,this.widthDomNode,this.heightDomNode);\n\t// Load the image into the canvas\n\tthis.loadCanvas();\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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n};\n\n/*\nNote that the bitmap editor intentionally doesn't try to refresh itself because it would be confusing to have the image changing spontaneously while editting it\n*/\nEditBitmapWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\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(\&quot;canvas\&quot;);\n\t\tself.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage);\n\t\t// Set the width and height input boxes\n\t\tself.updateSize();\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(\&quot;canvas\&quot;);\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.updateSize();\n\t}\n\t// Get the current bitmap into an image object\n\tcurrImage.src = \&quot;data:\&quot; + tiddler.fields.type + \&quot;;base64,\&quot; + 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(\&quot;2d\&quot;);\n\tif(image) {\n\t\tctx.drawImage(image,0,0);\n\t} else {\n\t\tctx.fillStyle = \&quot;#fff\&quot;;\n\t\tctx.fillRect(0,0,canvas.width,canvas.height);\n\t}\n}\n\n/*\n** Update the input boxes with the actual size of the canvas\n*/\nEditBitmapWidget.prototype.updateSize = function() {\n\tthis.widthDomNode.value = this.currCanvas.width;\n\tthis.heightDomNode.value = this.currCanvas.height;\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(\&quot;canvas\&quot;);\n\tthis.initCanvas(newCanvas,newWidth,newHeight);\n\t// Copy the old image\n\tvar ctx = newCanvas.getContext(\&quot;2d\&quot;);\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(\&quot;2d\&quot;);\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\nEditBitmapWidget.prototype.handleWidthChangeEvent = function(event) {\n\t// Get the new width\n\tvar newWidth = parseInt(this.widthDomNode.value,10);\n\t// Update if necessary\n\tif(newWidth &gt; 0 &amp;&amp; newWidth !== this.currCanvas.width) {\n\t\tthis.changeCanvasSize(newWidth,this.currCanvas.height);\n\t}\n\t// Update the input controls\n\tthis.updateSize();\n};\n\nEditBitmapWidget.prototype.handleHeightChangeEvent = function(event) {\n\t// Get the new width\n\tvar newHeight = parseInt(this.heightDomNode.value,10);\n\t// Update if necessary\n\tif(newHeight &gt; 0 &amp;&amp; newHeight !== this.currCanvas.height) {\n\t\tthis.changeCanvasSize(this.currCanvas.width,newHeight);\n\t}\n\t// Update the input controls\n\tthis.updateSize();\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(\&quot;2d\&quot;),\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.strokeStyle = \&quot;#ff0\&quot;;\n\tctx.lineWidth = 3;\n\tctx.lineCap = \&quot;round\&quot;;\n\tctx.lineJoin = \&quot;round\&quot;;\n\tctx.beginPath();\n\tctx.moveTo(this.stroke[0].x,this.stroke[0].y);\n\tfor(t=1; t&lt;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(\&quot;2d\&quot;);\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 \&quot;data:&lt;type&gt;;base64,&lt;text&gt;\&quot;\n\t\tvar dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type,1.0),\n\t\t\tposColon = dataURL.indexOf(\&quot;:\&quot;),\n\t\t\tposSemiColon = dataURL.indexOf(\&quot;;\&quot;),\n\t\t\tposComma = dataURL.indexOf(\&quot;,\&quot;),\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(tiddler,update));\n\t}\n};\n\nexports[\&quot;edit-bitmap\&quot;] = EditBitmapWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/edit-bitmap.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/edit-text.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar MIN_TEXT_AREA_HEIGHT = 100; // Minimum height of textareas in pixels\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\n\nvar EditTextWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditTextWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditTextWidget.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 our element\n\tvar editInfo = this.getEditInfo();\n\tvar domNode = this.document.createElement(this.editTag);\n\tif(this.editType) {\n\t\tdomNode.setAttribute(\&quot;type\&quot;,this.editType);\n\t}\n\tif(editInfo.value === \&quot;\&quot; &amp;&amp; this.editPlaceholder) {\n\t\tdomNode.setAttribute(\&quot;placeholder\&quot;,this.editPlaceholder);\n\t}\n\t// Assign classes\n\tif(this.editClass) {\n\t\tdomNode.className = this.editClass;\n\t}\n\t// Set the text\n\tif(this.editTag === \&quot;textarea\&quot;) {\n\t\tdomNode.appendChild(this.document.createTextNode(editInfo.value));\n\t} else {\n\t\tdomNode.setAttribute(\&quot;value\&quot;,editInfo.value)\n\t}\n\t// Add an input event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \&quot;focus\&quot;, handlerObject: this, handlerMethod: \&quot;handleFocusEvent\&quot;},\n\t\t{name: \&quot;input\&quot;, handlerObject: this, handlerMethod: \&quot;handleInputEvent\&quot;}\n\t]);\n\t// Insert the element into the DOM\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n\tif(this.postRender) {\n\t\tthis.postRender();\n\t}\n\t// Fix height\n\tthis.fixHeight();\n};\n\n/*\nGet the tiddler being edited and current value\n*/\nEditTextWidget.prototype.getEditInfo = function() {\n\t// Get the edit value\n\tvar self = this,\n\t\tvalue,\n\t\tupdate;\n\tif(this.editIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault);\n\t\tupdate = function(value) {\n\t\t\tvar data = self.wiki.getTiddlerData(self.editTitle,{});\n\t\t\tif(data[self.editIndex] !== value) {\n\t\t\t\tdata[self.editIndex] = value;\n\t\t\t\tself.wiki.setTiddlerData(self.editTitle,data);\n\t\t\t}\n\t\t};\n\t} else {\n\t\t// Get the current tiddler and the field name\n\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\tif(tiddler) {\n\t\t\t// If we've got a tiddler, the value to display is the field string value\n\t\t\tvalue = tiddler.getFieldString(this.editField);\n\t\t} else {\n\t\t\t// Otherwise, we need to construct a default value for the editor\n\t\t\tswitch(this.editField) {\n\t\t\t\tcase \&quot;text\&quot;:\n\t\t\t\t\tvalue = \&quot;Type the text for the tiddler '\&quot; + this.editTitle + \&quot;'\&quot;;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \&quot;title\&quot;:\n\t\t\t\t\tvalue = this.editTitle;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = \&quot;\&quot;;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(this.editDefault !== undefined) {\n\t\t\t\tvalue = this.editDefault;\n\t\t\t}\n\t\t}\n\t\tupdate = function(value) {\n\t\t\tvar tiddler = self.wiki.getTiddler(self.editTitle),\n\t\t\t\tupdateFields = {\n\t\t\t\t\ttitle: self.editTitle\n\t\t\t\t};\n\t\t\tupdateFields[self.editField] = value;\n\t\t\tself.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields()));\n\t\t};\n\t}\n\treturn {value: value, update: update};\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditTextWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.editField = this.getAttribute(\&quot;field\&quot;,\&quot;text\&quot;);\n\tthis.editIndex = this.getAttribute(\&quot;index\&quot;);\n\tthis.editDefault = this.getAttribute(\&quot;default\&quot;);\n\tthis.editClass = this.getAttribute(\&quot;class\&quot;);\n\tthis.editPlaceholder = this.getAttribute(\&quot;placeholder\&quot;);\n\tthis.editFocusPopup = this.getAttribute(\&quot;focusPopup\&quot;);\n\t// Get the editor element tag and type\n\tvar tag,type;\n\tif(this.editField === \&quot;text\&quot;) {\n\t\ttag = \&quot;textarea\&quot;;\n\t} else {\n\t\ttag = \&quot;input\&quot;;\n\t\tvar fieldModule = $tw.Tiddler.fieldModules[this.editField];\n\t\tif(fieldModule &amp;&amp; fieldModule.editTag) {\n\t\t\ttag = fieldModule.editTag;\n\t\t}\n\t\tif(fieldModule &amp;&amp; fieldModule.editType) {\n\t\t\ttype = fieldModule.editType;\n\t\t}\n\t\ttype = type || \&quot;text\&quot;;\n\t}\n\t// Get the rest of our parameters\n\tthis.editTag = this.getAttribute(\&quot;tag\&quot;,tag);\n\tthis.editType = this.getAttribute(\&quot;type\&quot;,type);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEditTextWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Completely rerender if any of our attributes have changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedTiddlers[this.editTitle]) {\n\t\tthis.updateEditor(this.getEditInfo().value);\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n/*\nUpdate the editor with new text. This method is separate from updateEditorDomNode()\nso that subclasses can override updateEditor() and still use updateEditorDomNode()\n*/\nEditTextWidget.prototype.updateEditor = function(text) {\n\tthis.updateEditorDomNode(text);\n};\n\n/*\nUpdate the editor dom node with new text\n*/\nEditTextWidget.prototype.updateEditorDomNode = function(text) {\n\t// Replace the edit value if the tiddler we're editing has changed\n\tvar domNode = this.domNodes[0];\n\tif(!domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.document.activeElement !== domNode) {\n\t\t\tdomNode.value = text;\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nFix the height of textareas to fit their content\n*/\nEditTextWidget.prototype.fixHeight = function() {\n\tvar self = this,\n\t\tdomNode = this.domNodes[0];\n\tif(domNode &amp;&amp; !domNode.isTiddlyWikiFakeDom &amp;&amp; this.editTag === \&quot;textarea\&quot;) {\n\t\t$tw.utils.nextTick(function() {\n\t\t\t// Resize the textarea to fit its content, preserving scroll position\n\t\t\tvar scrollPosition = $tw.utils.getScrollPosition(),\n\t\t\t\tscrollTop = scrollPosition.y;\n\t\t\t// Set its height to auto so that it snaps to the correct height\n\t\t\tdomNode.style.height = \&quot;auto\&quot;;\n\t\t\t// Calculate the revised height\n\t\t\tvar newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,MIN_TEXT_AREA_HEIGHT);\n\t\t\t// Only try to change the height if it has changed\n\t\t\tif(newHeight !== domNode.offsetHeight) {\n\t\t\t\tdomNode.style.height = newHeight + \&quot;px\&quot;;\n\t\t\t\t// Make sure that the dimensions of the textarea are recalculated\n\t\t\t\t$tw.utils.forceLayout(domNode);\n\t\t\t\t// Check that the scroll position is still visible before trying to scroll back to it\n\t\t\t\tscrollTop = Math.min(scrollTop,self.document.body.scrollHeight - window.innerHeight);\n\t\t\t\twindow.scrollTo(scrollPosition.x,scrollTop);\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nHandle a dom \&quot;input\&quot; event\n*/\nEditTextWidget.prototype.handleInputEvent = function(event) {\n\tthis.saveChanges(this.domNodes[0].value);\n\tthis.fixHeight();\n\treturn true;\n};\n\nEditTextWidget.prototype.handleFocusEvent = function(event) {\n\tif(this.editFocusPopup) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNodes[0],\n\t\t\ttitle: this.editFocusPopup,\n\t\t\twiki: this.wiki,\n\t\t\tforce: true\n\t\t});\n\t}\n\treturn true;\n};\n\nEditTextWidget.prototype.saveChanges = function(text) {\n\tvar editInfo = this.getEditInfo();\n\tif(text !== editInfo.value) {\n\t\teditInfo.update(text);\n\t}\n};\n\nexports[\&quot;edit-text\&quot;] = EditTextWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/edit-text.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/edit.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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\n// TODO: This information should be configurable/extensible\nvar editorTypeMappings = {\n\t\&quot;text/vnd.tiddlywiki\&quot;: \&quot;text\&quot;,\n\t\&quot;image/svg+xml\&quot;: \&quot;text\&quot;,\n\t\&quot;image/jpg\&quot;: \&quot;bitmap\&quot;,\n\t\&quot;image/jpeg\&quot;: \&quot;bitmap\&quot;,\n\t\&quot;image/gif\&quot;: \&quot;bitmap\&quot;,\n\t\&quot;image/png\&quot;: \&quot;bitmap\&quot;,\n\t\&quot;image/x-icon\&quot;: \&quot;bitmap\&quot;\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.editField = this.getAttribute(\&quot;field\&quot;,\&quot;text\&quot;);\n\tthis.editIndex = this.getAttribute(\&quot;index\&quot;);\n\tthis.editClass = this.getAttribute(\&quot;class\&quot;);\n\tthis.editPlaceholder = this.getAttribute(\&quot;placeholder\&quot;);\n\t// Get the content type of the thing we're editing\n\tvar type;\n\tif(this.editField === \&quot;text\&quot;) {\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 || \&quot;text/vnd.tiddlywiki\&quot;;\n\t// Choose the appropriate edit widget\n\tvar editorType = editorTypeMappings[type] || \&quot;text\&quot;;\n\t// Make the child widgets\n\tthis.makeChildWidgets([{\n\t\ttype: \&quot;edit-\&quot; + editorType,\n\t\tattributes: {\n\t\t\ttiddler: {type: \&quot;string\&quot;, value: this.editTitle},\n\t\t\tfield: {type: \&quot;string\&quot;, value: this.editField},\n\t\t\tindex: {type: \&quot;string\&quot;, value: this.editIndex},\n\t\t\t\&quot;class\&quot;: {type: \&quot;string\&quot;, value: this.editClass},\n\t\t\t\&quot;placeholder\&quot;: {type: \&quot;string\&quot;, value: this.editPlaceholder}\n\t\t}\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*/\nEditWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index) {\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/edit.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/element.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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\tvar domNode = this.document.createElementNS(this.namespace,this.parseTreeNode.tag);\n\tthis.assignAttributes(domNode);\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: \&quot;http://www.w3.org/2000/svg\&quot;,\n\t\t\tmath: \&quot;http://www.w3.org/1998/Math/MathML\&quot;,\n\t\t\tbody: \&quot;http://www.w3.org/1999/xhtml\&quot;\n\t\t};\n\tthis.namespace = tagNamespaces[this.parseTreeNode.tag];\n\tif(this.namespace) {\n\t\tthis.setVariable(\&quot;namespace\&quot;,this.namespace);\n\t} else {\n\t\tthis.namespace = this.getVariable(\&quot;namespace\&quot;,{defaultValue: \&quot;http://www.w3.org/1999/xhtml\&quot;});\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) &gt; 0;\n\tif(hasChangedAttributes) {\n\t\t// Update our attributes\n\t\tthis.assignAttributes(this.domNodes[0]);\n\t}\n\treturn this.refreshChildren(changedTiddlers) || hasChangedAttributes;\n};\n\nexports.element = ElementWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/element.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/encrypt.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;filter\&quot;,\&quot;[!is[system]]\&quot;);\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\tvar changedAttributes = this.computeAttributes(),\n\t\taffectedTiddlers = this.wiki.filterTiddlers(this.filter,null,changedTiddlers);\n\tif(changedAttributes.filter || affectedTiddlers.length &gt; 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\n\t}\n};\n\nexports.encrypt = EncryptWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/encrypt.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/entity.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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 textNode = this.document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity));\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\treturn false;\n};\n\nexports.entity = EntityWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/entity.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/fieldmangler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\n\nvar FieldManglerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \&quot;tw-remove-field\&quot;, handler: \&quot;handleRemoveFieldEvent\&quot;},\n\t\t{type: \&quot;tw-add-field\&quot;, handler: \&quot;handleAddFieldEvent\&quot;},\n\t\t{type: \&quot;tw-remove-tag\&quot;, handler: \&quot;handleRemoveTagEvent\&quot;},\n\t\t{type: \&quot;tw-add-tag\&quot;, handler: \&quot;handleAddTagEvent\&quot;}\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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\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\tif(tiddler &amp;&amp; typeof event.param === \&quot;string\&quot;) {\n\t\tvar name = event.param.toLowerCase();\n\t\tif(name !== \&quot;\&quot; &amp;&amp; !$tw.utils.hop(tiddler.fields,name)) {\n\t\t\tvar addition = this.wiki.getModificationFields();\n\t\t\taddition[name] = \&quot;\&quot;;\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\t\t}\n\t}\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler &amp;&amp; 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\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 &amp;&amp; typeof event.param === \&quot;string\&quot; &amp;&amp; event.param !== \&quot;\&quot;) {\n\t\tvar modification = this.wiki.getModificationFields();\n\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t$tw.utils.pushTop(modification.tags,event.param);\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t}\n\treturn true;\n};\n\nexports.fieldmangler = FieldManglerWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/fieldmangler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/fields.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.template = this.getAttribute(\&quot;template\&quot;);\n\tthis.exclude = this.getAttribute(\&quot;exclude\&quot;);\n\tthis.stripTitlePrefix = this.getAttribute(\&quot;stripTitlePrefix\&quot;,\&quot;no\&quot;) === \&quot;yes\&quot;;\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(\&quot; \&quot;);\n\t} else {\n\t\texclude = [\&quot;text\&quot;]; \n\t}\n\t// Compose the template\n\tvar text = [];\n\tif(this.template &amp;&amp; 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&lt;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 &amp;&amp; fieldName === \&quot;title\&quot;) {\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 = row.replace(\&quot;$name$\&quot;,fieldName);\n\t\t\t\trow = row.replace(\&quot;$value$\&quot;,value);\n\t\t\t\trow = row.replace(\&quot;$encoded_value$\&quot;,$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(\&quot;\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/fields.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/link.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\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 tw-wikilinks configuration macro\n\tvar wikiLinksMacro = this.getVariable(\&quot;tw-wikilinks\&quot;),\n\t\tuseWikiLinks = wikiLinksMacro ? !(wikiLinksMacro.trim() === \&quot;no\&quot;) : true;\n\t// Render the link if required\n\tif(useWikiLinks) {\n\t\tthis.renderLink(parent,nextSibling);\n\t} else {\n\t\t// Just insert the link text\n\t\tvar domNode = this.document.createElement(\&quot;span\&quot;);\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// Create our element\n\tvar domNode = this.document.createElement(\&quot;a\&quot;);\n\t// Assign classes\n\t$tw.utils.addClass(domNode,\&quot;tw-tiddlylink\&quot;);\n\tif(this.isShadow) {\n\t\t$tw.utils.addClass(domNode,\&quot;tw-tiddlylink-shadow\&quot;);\n\t}\n\tif(this.isMissing &amp;&amp; !this.isShadow) {\n\t\t$tw.utils.addClass(domNode,\&quot;tw-tiddlylink-missing\&quot;);\n\t} else {\n\t\tif(!this.isMissing) {\n\t\t\t$tw.utils.addClass(domNode,\&quot;tw-tiddlylink-resolves\&quot;);\n\t\t}\n\t}\n\t// Set an href\n\tvar wikiLinkTemplateMacro = this.getVariable(\&quot;tw-wikilink-template\&quot;),\n\t\twikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : \&quot;#$uri_encoded$\&quot;,\n\t\twikiLinkText = wikiLinkTemplate.replace(\&quot;$uri_encoded$\&quot;,encodeURIComponent(this.to));\n\twikiLinkText = wikiLinkText.replace(\&quot;$uri_doubleencoded$\&quot;,encodeURIComponent(encodeURIComponent(this.to)));\n\tdomNode.setAttribute(\&quot;href\&quot;,wikiLinkText);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \&quot;click\&quot;, handlerObject: this, handlerMethod: \&quot;handleClickEvent\&quot;},\n\t\t{name: \&quot;dragstart\&quot;, handlerObject: this, handlerMethod: \&quot;handleDragStartEvent\&quot;},\n\t\t{name: \&quot;dragend\&quot;, handlerObject: this, handlerMethod: \&quot;handleDragEndEvent\&quot;}\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 it's way as a navigate event\n\tvar bounds = this.domNodes[0].getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \&quot;tw-navigate\&quot;,\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\&quot;storyTiddler\&quot;),\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});\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nLinkWidget.prototype.handleDragStartEvent = function(event) {\n\tif(this.to) {\n\t\t// Set the dragging class on the element being dragged\n\t\t$tw.utils.addClass(event.target,\&quot;tw-tiddlylink-dragging\&quot;);\n\t\t// Create the drag image elements\n\t\tthis.dragImage = this.document.createElement(\&quot;div\&quot;);\n\t\tthis.dragImage.className = \&quot;tw-tiddler-dragger\&quot;;\n\t\tvar inner = this.document.createElement(\&quot;div\&quot;);\n\t\tinner.className = \&quot;tw-tiddler-dragger-inner\&quot;;\n\t\tinner.appendChild(this.document.createTextNode(this.to));\n\t\tthis.dragImage.appendChild(inner);\n\t\tthis.document.body.appendChild(this.dragImage);\n\t\t// Astoundingly, we need to cover the dragger up: http://www.kryogenix.org/code/browser/custom-drag-image.html\n\t\tvar cover = this.document.createElement(\&quot;div\&quot;);\n\t\tcover.className = \&quot;tw-tiddler-dragger-cover\&quot;;\n\t\tcover.style.left = (inner.offsetLeft - 16) + \&quot;px\&quot;;\n\t\tcover.style.top = (inner.offsetTop - 16) + \&quot;px\&quot;;\n\t\tcover.style.width = (inner.offsetWidth + 32) + \&quot;px\&quot;;\n\t\tcover.style.height = (inner.offsetHeight + 32) + \&quot;px\&quot;;\n\t\tthis.dragImage.appendChild(cover);\n\t\t// Set the data transfer properties\n\t\tvar dataTransfer = event.dataTransfer;\n\t\t// First the image\n\t\tdataTransfer.effectAllowed = \&quot;copy\&quot;;\n\t\tif(dataTransfer.setDragImage) {\n\t\t\tdataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);\n\t\t}\n\t\t// Then the data\n\t\tdataTransfer.clearData();\n\t\tvar jsonData = this.wiki.getTiddlerAsJson(this.to),\n\t\t\ttextData = this.wiki.getTiddlerText(this.to,\&quot;\&quot;);\n\t\t// IE doesn't like these content types\n\t\tif(!$tw.browser.isIE) {\n\t\t\tdataTransfer.setData(\&quot;text/vnd.tiddler\&quot;,jsonData);\n\t\t\tdataTransfer.setData(\&quot;text/plain\&quot;,textData);\n\t\t\tdataTransfer.setData(\&quot;text/x-moz-url\&quot;,\&quot;data:text/vnd.tiddler,\&quot; + encodeURI(jsonData));\n\t\t}\n\t\tdataTransfer.setData(\&quot;URL\&quot;,\&quot;data:text/vnd.tiddler,\&quot; + encodeURI(jsonData));\n\t\tdataTransfer.setData(\&quot;Text\&quot;,textData);\n\t\tevent.stopPropagation();\n\t} else {\n\t\tevent.preventDefault();\n\t}\n};\n\nLinkWidget.prototype.handleDragEndEvent = function(event) {\n\t// Remove the dragging class on the element being dragged\n\t$tw.utils.removeClass(event.target,\&quot;tw-tiddlylink-dragging\&quot;);\n\t// Delete the drag image element\n\tif(this.dragImage) {\n\t\tthis.dragImage.parentNode.removeChild(this.dragImage);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkWidget.prototype.execute = function() {\n\t// Get the target tiddler title\n\tthis.to = this.getAttribute(\&quot;to\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\t// Determine the link characteristics\n\tthis.isMissing = !this.wiki.tiddlerExists(this.to);\n\tthis.isShadow = this.wiki.isShadowTiddler(this.to);\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]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.link = LinkWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/link.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/linkcatcher.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\n\nvar LinkCatcherWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \&quot;tw-navigate\&quot;, handler: \&quot;handleNavigateEvent\&quot;}\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(\&quot;to\&quot;);\n\tthis.catchMessage = this.getAttribute(\&quot;message\&quot;);\n\tthis.catchSet = this.getAttribute(\&quot;set\&quot;);\n\tthis.catchSetTo = this.getAttribute(\&quot;setTo\&quot;);\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 tw-navigate event\n*/\nLinkCatcherWidget.prototype.handleNavigateEvent = function(event) {\n\tif(this.catchTo) {\n\t\tthis.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable(\&quot;currentTiddler\&quot;));\n\t}\n\tif(this.catchMessage) {\n\t\tthis.dispatchEvent({\n\t\t\ttype: this.catchMessage,\n\t\t\tparam: 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\treturn false;\n};\n\nexports.linkcatcher = LinkCatcherWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/linkcatcher.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/list.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;storyview\&quot;,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\tthis.storyview = StoryView ? new StoryView(this) : null;\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(\&quot;template\&quot;);\n\tthis.editTemplate = this.getAttribute(\&quot;editTemplate\&quot;);\n\tthis.variableName = this.getAttribute(\&quot;variable\&quot;,\&quot;currentTiddler\&quot;);\n\tthis.storyViewName = this.getAttribute(\&quot;storyview\&quot;);\n\tthis.historyTitle = this.getAttribute(\&quot;history\&quot;);\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 = \&quot;[!is[system]sort[title]]\&quot;;\n\treturn this.wiki.filterTiddlers(this.getAttribute(\&quot;filter\&quot;,defaultFilter),this.getVariable(\&quot;currentTiddler\&quot;));\n};\n\nListWidget.prototype.getEmptyMessage = function() {\n\tvar emptyMessage = this.getAttribute(\&quot;emptyMessage\&quot;,\&quot;\&quot;),\n\t\tparser = this.wiki.parseText(\&quot;text/vnd.tiddlywiki\&quot;,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 &amp;&amp; tiddler.hasField(\&quot;draft.of\&quot;),\n\t\ttemplate = this.template,\n\t\ttemplateTree;\n\tif(isDraft &amp;&amp; this.editTemplate) {\n\t\ttemplate = this.editTemplate;\n\t}\n\t// Compose the transclusion of the template\n\tif(template) {\n\t\ttemplateTree = [{type: \&quot;transclude\&quot;, attributes: {tiddler: {type: \&quot;string\&quot;, value: template}}}];\n\t} else {\n\t\tif(this.parseTreeNode.children &amp;&amp; this.parseTreeNode.children.length &gt; 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: \&quot;element\&quot;, tag: this.parseTreeNode.isBlock ? \&quot;div\&quot; : \&quot;span\&quot;, children: [{type: \&quot;link\&quot;, attributes: {to: {type: \&quot;string\&quot;, value: title}}, children: [\n\t\t\t\t\t{type: \&quot;text\&quot;, text: title}\n\t\t\t]}]}];\n\t\t}\n\t}\n\t// Return the list item\n\treturn {type: \&quot;listitem\&quot;, 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// 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\treturn true;\n\t} else {\n\t\t// Handle any changes to the list\n\t\tvar hasChanged = this.handleListChanges(changedTiddlers);\n\t\t// Handle any changes to the history stack\n\t\tif(this.historyTitle &amp;&amp; changedTiddlers[this.historyTitle]) {\n\t\t\tthis.handleHistoryChanges();\n\t\t}\n\t\treturn hasChanged;\n\t}\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.getTiddlerData(this.historyTitle,[]);\n\t// Ignore any entries of the history that match the previous history\n\tvar entry = 0;\n\twhile(entry &lt; newHistory.length &amp;&amp; entry &lt; this.history.length &amp;&amp; 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 &lt; newHistory.length) {\n\t\tif(this.storyview &amp;&amp; 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&gt;=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&lt;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&gt;=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&gt;=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 &lt; 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 &amp;&amp; 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 &amp;&amp; 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})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/list.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/macrocall.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;$type\&quot;,\&quot;text/vnd.tiddlywiki\&quot;);\n\tthis.renderOutput = this.getAttribute(\&quot;$output\&quot;,\&quot;text/html\&quot;);\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) !== \&quot;$\&quot;) {\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(\&quot;$name\&quot;),{params: params}),\n\t\tparseTreeNodes;\n\t// Are we rendering to HTML?\n\tif(this.renderOutput === \&quot;text/html\&quot;) {\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(\&quot;text/plain\&quot;,this.parseType,text,{parentWidget: this});\n\t\tparseTreeNodes = [{type: \&quot;text\&quot;, 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) &gt; 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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/macrocall.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/navigator.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).widget;\n\nvar NavigatorWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \&quot;tw-navigate\&quot;, handler: \&quot;handleNavigateEvent\&quot;},\n\t\t{type: \&quot;tw-edit-tiddler\&quot;, handler: \&quot;handleEditTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-delete-tiddler\&quot;, handler: \&quot;handleDeleteTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-save-tiddler\&quot;, handler: \&quot;handleSaveTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-cancel-tiddler\&quot;, handler: \&quot;handleCancelTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-close-tiddler\&quot;, handler: \&quot;handleCloseTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-close-all-tiddlers\&quot;, handler: \&quot;handleCloseAllTiddlersEvent\&quot;},\n\t\t{type: \&quot;tw-close-other-tiddlers\&quot;, handler: \&quot;handleCloseOtherTiddlersEvent\&quot;},\n\t\t{type: \&quot;tw-new-tiddler\&quot;, handler: \&quot;handleNewTiddlerEvent\&quot;},\n\t\t{type: \&quot;tw-import-tiddlers\&quot;, handler: \&quot;handleImportTiddlersEvent\&quot;},\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(\&quot;story\&quot;);\n\tthis.historyTitle = this.getAttribute(\&quot;history\&quot;);\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);\t\t\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.findTitleInStory = function(storyList,title,defaultIndex) {\n\tvar p = storyList.indexOf(title);\n\treturn p === -1 ? defaultIndex : p;\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\tif(storyList) {\n\t\t// See if the tiddler is already there\n\t\tvar slot = this.findTitleInStory(storyList,title,-1);\n\t\t// If not we need to add it\n\t\tif(slot === -1) {\n\t\t\t// First we try to find the position of the story element we navigated from\n\t\t\tslot = this.findTitleInStory(storyList,fromTitle,-1) + 1;\n\t\t\t// Add the tiddler\n\t\t\tstoryList.splice(slot,0,title);\n\t\t\t// Save the story\n\t\t\tthis.saveStoryList(storyList);\n\t\t}\n\t}\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\tvar titles = $tw.utils.isArray(title) ? title : [title];\n\t// Add a new record to the top of the history stack\n\tif(this.historyTitle) {\n\t\tvar historyList = this.wiki.getTiddlerData(this.historyTitle,[]);\n\t\t$tw.utils.each(titles,function(title) {\n\t\t\thistoryList.push({title: title, fromPageRect: fromPageRect});\n\t\t});\n\t\tthis.wiki.setTiddlerData(this.historyTitle,historyList);\n\t}\n};\n\n/*\nHandle a tw-navigate event\n*/\nNavigatorWidget.prototype.handleNavigateEvent = function(event) {\n\tthis.addToStory(event.navigateTo,event.navigateFromTitle);\n\tthis.addToHistory(event.navigateTo,event.navigateFromClientRect);\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\t// Replace the specified tiddler with a draft in edit mode\n\tvar title = event.param || event.tiddlerTitle,\n\t\tdraftTiddler = this.makeDraftTiddler(title),\n\t\tdraftTitle = draftTiddler.fields.title,\n\t\tstoryList = this.getStoryList();\n\tthis.removeTitleFromStory(storyList,draftTitle);\n\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\tthis.saveStoryList(storyList);\n\treturn false;\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// Check if the tiddler we're deleting is in draft mode\n\tif(tiddler.hasField(\&quot;draft.title\&quot;)) {\n\t\t// Delete the original tiddler\n\t\tvar originalTitle = tiddler.fields[\&quot;draft.of\&quot;];\n\t\tthis.wiki.deleteTiddler(originalTitle);\n\t\tthis.removeTitleFromStory(storyList,originalTitle);\n\t}\n\t// Delete this 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\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 drafts = [];\n\tthis.wiki.forEachTiddler({includeSystem: true},function(title,tiddler) {\n\t\tif(tiddler.fields[\&quot;draft.title\&quot;] &amp;&amp; tiddler.fields[\&quot;draft.of\&quot;] === targetTitle) {\n\t\t\tdrafts.push(tiddler);\n\t\t}\n\t});\n\tif(drafts.length &gt; 0) {\n\t\treturn drafts[0];\n\t}\n\t// Get the current value of the tiddler we're editing\n\tvar tiddler = this.wiki.getTiddler(targetTitle),\n\t\tdraftTitle = this.generateDraftTitle(targetTitle);\n\t// Save the initial value of the draft tiddler\n\tvar draftTiddler = new $tw.Tiddler(\n\t\t\t{text: \&quot;Type the text for the tiddler '\&quot; + targetTitle + \&quot;'\&quot;},\n\t\t\ttiddler,\n\t\t\t{\n\t\t\t\ttitle: draftTitle,\n\t\t\t\t\&quot;draft.title\&quot;: targetTitle,\n\t\t\t\t\&quot;draft.of\&quot;: 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\tdo {\n\t\tvar draftTitle = \&quot;Draft \&quot; + (c ? (c + 1) + \&quot; \&quot; : \&quot;\&quot;) + \&quot;of '\&quot; + title + \&quot;'\&quot;;\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\tstoryTiddlerModified = false; // We have to special case saving the story tiddler itself\n\t// Replace the original tiddler with the draft\n\tif(tiddler) {\n\t\tvar draftTitle = (tiddler.fields[\&quot;draft.title\&quot;] || \&quot;\&quot;).trim(),\n\t\t\tdraftOf = (tiddler.fields[\&quot;draft.of\&quot;] || \&quot;\&quot;).trim();\n\t\tif(draftTitle) {\n\t\t\tvar isRename = draftOf !== draftTitle,\n\t\t\t\tisConfirmed = true;\n\t\t\tif(isRename &amp;&amp; this.wiki.tiddlerExists(draftTitle)) {\n\t\t\t\tisConfirmed = confirm(\&quot;Do you wish to overwrite the tiddler '\&quot; + draftTitle + \&quot;'?\&quot;);\n\t\t\t}\n\t\t\tif(isConfirmed) {\n\t\t\t\t// Save the draft tiddler as the real tiddler\n\t\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\ttitle: draftTitle,\n\t\t\t\t\t\&quot;draft.title\&quot;: undefined, \n\t\t\t\t\t\&quot;draft.of\&quot;: undefined\n\t\t\t\t},this.wiki.getModificationFields()));\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// Replace the draft in the story with the original\n\t\t\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\t\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\t\t\tif(draftTitle !== this.storyTitle) {\n\t\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t\t}\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.fields[\&quot;draft.of\&quot;],\n\t\tstoryList = this.getStoryList();\n\tif(draftTiddler &amp;&amp; originalTitle) {\n\t\t// Remove the draft tiddler\n\t\tthis.wiki.deleteTiddler(draftTitle);\n\t\tthis.replaceFirstTitleInStory(storyList,draftTitle,originalTitle);\n\t\tthis.addToHistory(originalTitle,event.navigateFromClientRect);\n\t\tthis.saveStoryList(storyList);\n\t}\n\treturn false;\n};\n\n// Create a new draft tiddler\nNavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {\n\t// Get the story details\n\tvar storyList = this.getStoryList();\n\t// Get the template tiddler if there is one\n\tvar templateTiddler = this.wiki.getTiddler(event.param);\n\t// Create the new tiddler\n\tvar title = this.wiki.generateNewTitle((templateTiddler &amp;&amp; templateTiddler.fields.title) || \&quot;New Tiddler\&quot;);\n\tvar tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{\n\t\ttext: \&quot;Newly created tiddler\&quot;,\n\t\ttitle: title\n\t},this.wiki.getModificationFields());\n\tthis.wiki.addTiddler(tiddler);\n\t// Create the draft tiddler\n\tvar draftTitle = this.generateDraftTitle(title),\n\t\tdraftTiddler = new $tw.Tiddler({\n\t\t\ttext: \&quot;\&quot;\n\t\t},templateTiddler,{\n\t\t\ttitle: draftTitle,\n\t\t\t\&quot;draft.title\&quot;: title,\n\t\t\t\&quot;draft.of\&quot;: title\n\t\t},this.wiki.getModificationFields());\n\tthis.wiki.addTiddler(draftTiddler);\n\t// Update the story to insert the new draft at the top\n\tvar slot = storyList.indexOf(event.navigateFromTitle);\n\tstoryList.splice(slot + 1,0,draftTitle);\n\t// Save the updated story\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\nNavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {\n\tvar self = this;\n\t// Get the story and history details\n\tvar storyList = this.getStoryList();\n\tvar history = [];\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// Process each tiddler\n\t$tw.utils.each(tiddlers,function(tiddlerFields) {\n\t\tvar title = tiddlerFields.title;\n\t\t// Add it to the store\n\t\tvar imported = self.wiki.importTiddler(new $tw.Tiddler(\n\t\t\tself.wiki.getCreationFields(),\n\t\t\tself.wiki.getModificationFields(),\n\t\t\ttiddlerFields\n\t\t));\n\t\tif(imported) {\n\t\t\t// Add it to the story\n\t\t\tif(storyList.indexOf(title) === -1) {\n\t\t\t\tstoryList.unshift(title);\n\t\t\t}\n\t\t\t// And to history\n\t\t\thistory.push(title);\n\t\t}\n\t});\n\t// Save the updated story and history\n\tthis.saveStoryList(storyList);\n\tthis.addToHistory(history);\n\treturn false;\n};\n\nexports.navigator = NavigatorWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/navigator.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/password.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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) || \&quot;\&quot; : \&quot;\&quot;;\n\t// Create our element\n\tvar domNode = this.document.createElement(\&quot;input\&quot;);\n\tdomNode.setAttribute(\&quot;type\&quot;,\&quot;password\&quot;);\n\tdomNode.setAttribute(\&quot;value\&quot;,password);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \&quot;change\&quot;, handlerObject: this, handlerMethod: \&quot;handleChangeEvent\&quot;}\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(\&quot;name\&quot;,\&quot;\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/password.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/radio.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/core/modules/widgets/radio.js\ntype: application/javascript\nmodule-type: widget\n\nRadio widget\n\nWill set a field to the selected value:\n\n```\n\t&lt;$radio field=\&quot;myfield\&quot; value=\&quot;check 1\&quot;&gt;one&lt;/$radio&gt;\n\t&lt;$radio field=\&quot;myfield\&quot; value=\&quot;check 2\&quot;&gt;two&lt;/$radio&gt;\n\t&lt;$radio field=\&quot;myfield\&quot; value=\&quot;check 3\&quot;&gt;three&lt;/$radio&gt;\n```\n\n|Parameter |Description |h\n|tiddler |Name of the tiddler in which the field should be set. Defaults to current tiddler |\n|field |The name of the field to be set |\n|value |The value to set |\n|class |Optional class name(s) |\n\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;label\&quot;);\n\tthis.labelDomNode.setAttribute(\&quot;class\&quot;,this.radioClass);\n\tthis.inputDomNode = this.document.createElement(\&quot;input\&quot;);\n\tthis.inputDomNode.setAttribute(\&quot;type\&quot;,\&quot;radio\&quot;);\n\tif(this.getValue() == this.radioValue) {\n\t\tthis.inputDomNode.setAttribute(\&quot;checked\&quot;,\&quot;true\&quot;);\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\&quot;span\&quot;);\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \&quot;change\&quot;, handlerObject: this, handlerMethod: \&quot;handleChangeEvent\&quot;}\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 tiddler = this.wiki.getTiddler(this.radioTitle);\n\treturn tiddler &amp;&amp; tiddler.getFieldString(this.radioField);\n};\n\nRadioWidget.prototype.setValue = function() {\n\tif(this.radioField) {\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(tiddler,addition));\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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.radioField = this.getAttribute(\&quot;field\&quot;);\n\tthis.radioValue = this.getAttribute(\&quot;value\&quot;);\n\tthis.radioClass = this.getAttribute(\&quot;class\&quot;,\&quot;\&quot;);\n\tif(this.radioClass !== \&quot;\&quot;) {\n\t\tthis.radioClass += \&quot; \&quot;;\n\t}\n\tthis.radioClass += \&quot;tw-radio\&quot;;\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.value || changedAttributes[\&quot;class\&quot;]) {\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/radio.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/raw.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;div\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/raw.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/reveal.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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 domNode = this.document.createElement(this.parseTreeNode.isBlock ? \&quot;div\&quot; : \&quot;span\&quot;);\n\tvar classes = this[\&quot;class\&quot;].split(\&quot; \&quot;) || [];\n\tclasses.push(\&quot;tw-reveal\&quot;);\n\tdomNode.className = classes.join(\&quot; \&quot;);\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tif(!domNode.isTiddlyWikiFakeDom &amp;&amp; this.type === \&quot;popup\&quot; &amp;&amp; this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\&quot;tw-popup\&quot;); // Make sure that clicks don't dismiss popups within the revealed content\n\t}\n\tif(!this.isOpen) {\n\t\tdomNode.setAttribute(\&quot;hidden\&quot;,\&quot;true\&quot;)\n\t}\n\tthis.domNodes.push(domNode);\n};\n\nRevealWidget.prototype.positionPopup = function(domNode) {\n\tdomNode.style.position = \&quot;absolute\&quot;;\n\tdomNode.style.zIndex = \&quot;1000\&quot;;\n\tswitch(this.position) {\n\t\tcase \&quot;left\&quot;:\n\t\t\tdomNode.style.left = (this.popup.left - domNode.offsetWidth) + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = this.popup.top + \&quot;px\&quot;;\n\t\t\tbreak;\n\t\tcase \&quot;above\&quot;:\n\t\t\tdomNode.style.left = this.popup.left + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = (this.popup.top - domNode.offsetHeight) + \&quot;px\&quot;;\n\t\t\tbreak;\n\t\tcase \&quot;aboveright\&quot;:\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height - domNode.offsetHeight) + \&quot;px\&quot;;\n\t\t\tbreak;\n\t\tcase \&quot;right\&quot;:\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = this.popup.top + \&quot;px\&quot;;\n\t\t\tbreak;\n\t\tcase \&quot;belowleft\&quot;:\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width - domNode.offsetWidth) + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \&quot;px\&quot;;\n\t\t\tbreak;\n\t\tdefault: // Below\n\t\t\tdomNode.style.left = this.popup.left + \&quot;px\&quot;;\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \&quot;px\&quot;;\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(\&quot;state\&quot;);\n\tthis.type = this.getAttribute(\&quot;type\&quot;);\n\tthis.text = this.getAttribute(\&quot;text\&quot;);\n\tthis.position = this.getAttribute(\&quot;position\&quot;);\n\tthis[\&quot;class\&quot;] = this.getAttribute(\&quot;class\&quot;,\&quot;\&quot;);\n\tthis[\&quot;default\&quot;] = this.getAttribute(\&quot;default\&quot;,\&quot;\&quot;);\n\tthis.animate = this.getAttribute(\&quot;animate\&quot;,\&quot;no\&quot;);\n\tthis.openAnimation = this.animate === \&quot;no\&quot; ? undefined : \&quot;open\&quot;;\n\tthis.closeAnimation = this.animate === \&quot;no\&quot; ? undefined : \&quot;close\&quot;;\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\tif(this.stateTitle) {\n\t\tvar state = this.wiki.getTextReference(this.stateTitle,this[\&quot;default\&quot;],this.getVariable(\&quot;currentTiddler\&quot;));\n\t\tswitch(this.type) {\n\t\t\tcase \&quot;popup\&quot;:\n\t\t\t\tthis.readPopupState(state);\n\t\t\t\tbreak;\n\t\t\tcase \&quot;match\&quot;:\n\t\t\t\tthis.readMatchState(state);\n\t\t\t\tbreak;\n\t\t\tcase \&quot;nomatch\&quot;:\n\t\t\t\tthis.readMatchState(state);\n\t\t\t\tthis.isOpen = !this.isOpen;\n\t\t\t\tbreak;\n\t\t}\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[\&quot;default\&quot;] || changedAttributes.animate) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.stateTitle]) {\n\t\t\tthis.updateState();\n\t\t\trefreshed = true;\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 &amp;&amp; !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 &amp;&amp; this.type === \&quot;popup\&quot; &amp;&amp; this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\&quot;tw-popup\&quot;); // Make sure that clicks don't dismiss popups within the revealed content\n\n\t}\n\tif(this.isOpen) {\n\t\tdomNode.removeAttribute(\&quot;hidden\&quot;);\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(\&quot;hidden\&quot;,\&quot;true\&quot;);\n }});\n\t}\n};\n\nexports.reveal = RevealWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/reveal.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/set.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;name\&quot;,\&quot;currentTiddler\&quot;);\n\tthis.setValue = this.getAttribute(\&quot;value\&quot;);\n\t// Set context variable\n\tthis.setVariable(this.setName,this.setValue,this.parseTreeNode.params);\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*/\nSetWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name || changedAttributes.value) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.setvariable = SetWidget;\nexports.set = SetWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/set.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/text.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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.execute();\n\tvar textNode = this.document.createTextNode(this.parseTreeNode.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\treturn false;\n};\n\nexports.text = TextNodeWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/text.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/tiddler.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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\t// Get our parameters\n\tthis.tiddlerTitle = this.getAttribute(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\t// Set context variables\n\tthis.setVariable(\&quot;currentTiddler\&quot;,this.tiddlerTitle);\n\tthis.setVariable(\&quot;missingTiddlerClass\&quot;,(this.wiki.tiddlerExists(this.tiddlerTitle) || this.wiki.isShadowTiddler(this.tiddlerTitle)) ? \&quot;tw-tiddler-exists\&quot; : \&quot;tw-tiddler-missing\&quot;);\n\tthis.setVariable(\&quot;shadowTiddlerClass\&quot;,this.wiki.isShadowTiddler(this.tiddlerTitle) ? \&quot;tw-tiddler-shadow\&quot; : \&quot;\&quot;);\n\tthis.setVariable(\&quot;systemTiddlerClass\&quot;,this.wiki.isSystemTiddler(this.tiddlerTitle) ? \&quot;tw-tiddler-system\&quot; : \&quot;\&quot;);\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*/\nTiddlerWidget.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\nexports.tiddler = TiddlerWidget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/tiddler.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/transclude.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.transcludeField = this.getAttribute(\&quot;field\&quot;);\n\tthis.transcludeIndex = this.getAttribute(\&quot;index\&quot;);\n\t// Check for recursion\n\tvar recursionMarker = this.makeRecursionMarker();;\n\tif(this.parentWidget &amp;&amp; this.parentWidget.hasVariable(\&quot;transclusion\&quot;,recursionMarker)) {\n\t\tthis.makeChildWidgets([{type: \&quot;text\&quot;, text: \&quot;Tiddler recursion error in transclude widget\&quot;}]);\n\t\treturn;\n\t}\n\t// Set context variables for recursion detection\n\tthis.setVariable(\&quot;transclusion\&quot;,recursionMarker);\n\t// Parse the text reference\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{parseAsInline: !this.parseTreeNode.isBlock}),\n\t\tparseTreeNodes = parser ? parser.tree : [];\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(\&quot;{\&quot;);\n\toutput.push(this.getVariable(\&quot;currentTiddler\&quot;,{defaultValue: \&quot;\&quot;}));\n\toutput.push(\&quot;|\&quot;);\n\toutput.push(this.transcludeTitle || \&quot;\&quot;);\n\toutput.push(\&quot;|\&quot;);\n\toutput.push(this.transcludeField || \&quot;\&quot;);\n\toutput.push(\&quot;|\&quot;);\n\toutput.push(this.transcludeIndex || \&quot;\&quot;);\n\toutput.push(\&quot;}\&quot;);\n\treturn output.join(\&quot;\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/transclude.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/view.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar Widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;).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(\&quot;tiddler\&quot;,this.getVariable(\&quot;currentTiddler\&quot;));\n\tthis.viewField = this.getAttribute(\&quot;field\&quot;,\&quot;text\&quot;);\n\tthis.viewIndex = this.getAttribute(\&quot;index\&quot;);\n\tthis.viewFormat = this.getAttribute(\&quot;format\&quot;,\&quot;text\&quot;);\n\tthis.viewTemplate = this.getAttribute(\&quot;template\&quot;,\&quot;\&quot;);\n\tswitch(this.viewFormat) {\n\t\tcase \&quot;htmlwikified\&quot;:\n\t\t\tthis.text = this.getValueAsHtmlWikified();\n\t\t\tbreak;\n\t\tcase \&quot;htmlencoded\&quot;:\n\t\t\tthis.text = this.getValueAsHtmlEncoded();\n\t\t\tbreak;\n\t\tcase \&quot;urlencoded\&quot;:\n\t\t\tthis.text = this.getValueAsUrlEncoded();\n\t\t\tbreak;\n\t\tcase \&quot;doubleurlencoded\&quot;:\n\t\t\tthis.text = this.getValueAsDoubleUrlEncoded();\n\t\t\tbreak;\n\t\tcase \&quot;date\&quot;:\n\t\t\tthis.text = this.getValueAsDate(this.viewTemplate);\n\t\t\tbreak;\n\t\tcase \&quot;relativedate\&quot;:\n\t\t\tthis.text = this.getValueAsRelativeDate();\n\t\t\tbreak;\n\t\tcase \&quot;stripcomments\&quot;:\n\t\t\tthis.text = this.getValueAsStrippedComments();\n\t\t\tbreak;\n\t\tcase \&quot;jsencoded\&quot;:\n\t\t\tthis.text = this.getValueAsJsEncoded();\n\t\t\tbreak;\n\t\tdefault: // \&quot;text\&quot;\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\nViewWidget.prototype.getValue = function() {\n\t// Get the value to display\n\tvar value,\n\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\tif(tiddler) {\n\t\tif(this.viewField === \&quot;text\&quot;) {\n\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\tvalue = this.wiki.getTiddlerText(this.viewTitle);\n\t\t} else {\n\t\t\tif($tw.utils.hop(tiddler.fields,this.viewField)) {\n\t\t\t\tvalue = tiddler.fields[this.viewField];\t\t\t\t\n\t\t\t} else {\n\t\t\t\tvalue = \&quot;\&quot;;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(this.viewField === \&quot;title\&quot;) {\n\t\t\tvalue = this.viewTitle;\n\t\t} else {\n\t\t\tvalue = undefined;\n\t\t}\n\t}\n\treturn value;\n};\n\nViewWidget.prototype.getValueAsText = function() {\n\t// Get the value to display\n\tvar text,\n\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\tif(tiddler) {\n\t\tif(this.viewField === \&quot;text\&quot;) {\n\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\ttext = this.wiki.getTiddlerText(this.viewTitle);\n\t\t} else {\n\t\t\ttext = tiddler.getFieldString(this.viewField);\n\t\t}\n\t} else { // Use a special value if the tiddler is missing\n\t\tif(this.viewField === \&quot;title\&quot;) {\n\t\t\ttext = this.viewTitle;\n\t\t} else {\n\t\t\ttext = \&quot;\&quot;;\n\t\t}\n\t}\n\treturn text;\n};\n\nViewWidget.prototype.getValueAsHtmlWikified = function() {\n\treturn this.wiki.renderText(\&quot;text/html\&quot;,\&quot;text/vnd.tiddlywiki\&quot;,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 || \&quot;YYYY MM DD 0hh:0mm\&quot;;\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value &amp;&amp; $tw.utils.isDate(value) &amp;&amp; value.toString() !== \&quot;Invalid Date\&quot;) {\n\t\treturn $tw.utils.formatDateString(value,format);\n\t} else {\n\t\treturn \&quot;\&quot;;\n\t}\n};\n\nViewWidget.prototype.getValueAsRelativeDate = function(format) {\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value &amp;&amp; $tw.utils.isDate(value) &amp;&amp; value.toString() !== \&quot;Invalid Date\&quot;) {\n\t\treturn $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;\n\t} else {\n\t\treturn \&quot;\&quot;;\n\t}\n};\n\nViewWidget.prototype.getValueAsStrippedComments = function() {\n\tvar lines = this.getValueAsText().split(\&quot;\\n\&quot;),\n\t\tout = [];\n\tfor(var line=0; line&lt;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(\&quot;\\n\&quot;);\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&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/view.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/widgets/widget.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\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\tvariables: optional hashmap of context variables (see below)\n\tparentWidget: optional reference to a parent renderer node for the context chain\n\tdocument: optional document object to use instead of global document\nContext variables include:\n\tcurrentTiddler: title of the tiddler providing the context\n*/\nvar Widget = function(parseTreeNode,options) {\n\tif(arguments.length &gt; 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(\&quot;widget\&quot;);\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// If the variable doesn't exist then look for a macro module\n\tif(!(name in this.variables)) {\n\t\treturn this.evaluateMacroModule(name,actualParams,options.defaultValue);\n\t}\n\tvar variable = this.variables[name],\n\t\tvalue = variable.value || \&quot;\&quot;;\n\t// Substitute any parameters specified in the definition\n\tvalue = this.substituteVariableParameters(value,variable.params,actualParams);\n\tvalue = this.substituteVariableReferences(value);\n\treturn value;\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&lt;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&lt;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 &lt; actualParams.length &amp;&amp; actualParams[nextAnonParameter].name) {\n\t\t\t\tnextAnonParameter++;\n\t\t\t}\n\t\t\tif(paramValue === undefined &amp;&amp; nextAnonParameter &lt; 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[\&quot;default\&quot;] || \&quot;\&quot;;\n\t\t\t// Replace any instances of this parameter\n\t\t\ttext = text.replace(new RegExp(\&quot;\\\\$\&quot; + $tw.utils.escapeRegExp(paramInfo.name) + \&quot;\\\\$\&quot;,\&quot;mg\&quot;),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: \&quot;\&quot;});\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 &gt; 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&lt;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&lt;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 &lt; actualParams.length &amp;&amp; actualParams[nextAnonParameter].name) {\n\t\t\t\t\tnextAnonParameter++;\n\t\t\t\t}\n\t\t\t\tif(paramValue === undefined &amp;&amp; nextAnonParameter &lt; 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[\&quot;default\&quot;] || \&quot;\&quot;;\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&lt;actualParams.length; ++i) {\n\t\t\targs.push(actualParams[i].value);\n\t\t}\n\t\treturn macro.run.apply(this,args)\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) &amp;&amp; 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\tname = name || \&quot;transclusion\&quot;;\n\tvar output = [],\n\t\tnode = this;\n\twhile(node) {\n\t\tif($tw.utils.hop(node.variables,name)) {\n\t\t\toutput.push(node.getVariable(name));\n\t\t}\n\t\tnode = node.parentWidget;\n\t}\n\treturn \&quot;{\&quot; + $tw.utils.hashString(output.join(\&quot;\&quot;)) + \&quot;}\&quot;;\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 === \&quot;indirect\&quot;) {\n\t\t\tvalue = self.wiki.getTextReference(attribute.textReference,\&quot;\&quot;,self.getVariable(\&quot;currentTiddler\&quot;));\n\t\t} else if(attribute.type === \&quot;macro\&quot;) {\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\n*/\nWidget.prototype.assignAttributes = function(domNode) {\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(v,a) {\n\t\tif(v !== undefined) {\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\tdomNode.setAttributeNS(null,a,v);\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 &amp;&amp; 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[\&quot;text\&quot;];\n\t\tparseTreeNode = {type: \&quot;text\&quot;, text: \&quot;Undefined widget '\&quot; + parseTreeNode.type + \&quot;'\&quot;};\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 &amp;&amp; index &lt; 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 &amp;&amp; index &gt; 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);\t\t\n\t});\n};\n\n/*\nAdd an event listener\n*/\nWidget.prototype.addEventListener = function(type,handler) {\n\tvar self = this;\n\tif(typeof handler === \&quot;string\&quot;) { // 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\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 \&quot;node not found in parents children\&quot;;\n}\n\t// Look for a DOM node in the later siblings\n\twhile(++index &lt; 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 &amp;&amp; parent.parentDomNode === this.parentDomNode) {\n\t\tindex = grandParent.children.indexOf(parent);\n\t\treturn parent.findNextSiblingDomNode(index);\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 &gt; 0) {\n\t\treturn this.domNodes[0];\n\t}\n\t// Otherwise, recursively call our children\n\tfor(var t=0; t&lt;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 &gt; 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\nexports.widget = Widget;\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/widgets/widget.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;widget&quot;
},
&quot;$:/core/modules/wiki.js&quot;: {
&quot;text&quot;: &quot;/*\\\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\&quot;use strict\&quot;;\n\nvar widget = require(\&quot;$:/core/modules/widgets/widget.js\&quot;);\n\nvar USER_NAME_TITLE = \&quot;$:/status/UserName\&quot;;\n\n/*\nGet the value of a text reference. Text references can have any of these forms:\n\t&lt;tiddlertitle&gt;\n\t&lt;tiddlertitle&gt;!!&lt;fieldname&gt;\n\t!!&lt;fieldname&gt; - specifies a field of the current tiddlers\n\t&lt;tiddlertitle&gt;##&lt;index&gt;\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 === \&quot;title\&quot;) { // Special case so we can return the title of a non-existent tiddler\n\t\t\treturn title;\n\t\t} else if(tiddler &amp;&amp; $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,tiddler,fields;\n\t// Check if it is a reference to a tiddler\n\tif(tr.title &amp;&amp; !tr.field) {\n\t\ttiddler = this.getTiddler(tr.title);\n\t\tthis.addTiddler(new $tw.Tiddler(tiddler,{title: tr.title,text: value},this.getModificationFields()));\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) {\n\t\t\tfields = {};\n\t\t\tfields[tr.field] = value;\n\t\t\tthis.addTiddler(new $tw.Tiddler(tiddler,fields,this.getModificationFields()));\n\t\t}\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 &amp;&amp; !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 &amp;&amp; $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\tfields = {};\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&lt;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 created\n*/\nexports.enqueueTiddlerEvent = function(title,isDeleted) {\n\t// Record the touch in the list of changed tiddlers\n\tthis.changedTiddlers = this.changedTiddlers || {};\n\tthis.changedTiddlers[title] = this.changedTiddlers[title] || {};\n\tthis.changedTiddlers[title][isDeleted ? \&quot;deleted\&quot; : \&quot;modified\&quot;] = true;\n\t// Increment the change count\n\tthis.changeCount = this.changeCount || {};\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 = {};\n\t\t\tself.eventsTriggered = false;\n\t\t\tself.dispatchEvent(\&quot;change\&quot;,changes);\n\t\t});\n\t\tthis.eventsTriggered = true;\n\t}\n};\n\nexports.getChangeCount = function(title) {\n\tthis.changeCount = this.changeCount || {};\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\nexports.deleteTiddler = function(title) {\n\tdelete this.tiddlers[title];\n\tthis.clearCache(title);\n\tthis.clearGlobalCache();\n\tthis.enqueueTiddlerEvent(title,true);\n};\n\nexports.tiddlerExists = function(title) {\n\treturn !!this.tiddlers[title];\n};\n\n/*\nGenerate an unused title from the specified base\n*/\nexports.generateNewTitle = function(baseTitle) {\n\tvar c = 0,\n\t title = baseTitle;\n\twhile(this.tiddlerExists(title)) {\n\t\ttitle = baseTitle + \&quot; \&quot; + (++c);\n\t};\n\treturn title;\n};\n\nexports.isSystemTiddler = function(title) {\n\treturn title.indexOf(\&quot;$:/\&quot;) === 0;\n};\n\nexports.isTemporaryTiddler = function(title) {\n\treturn title.indexOf(\&quot;$:/temp/\&quot;) === 0;\n};\n\n/*\nDetermines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler\n*/\nexports.isShadowTiddler = function(title) {\n\treturn $tw.utils.hop(this.shadowTiddlers,title);\n};\n\nexports.addTiddler = function(tiddler) {\n\t// Check if we're passed a fields hashmap instead of a tiddler\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = new $tw.Tiddler(tiddler);\n\t}\n\t// Get the title\n\tvar title = tiddler.fields.title;\n\t// Save the tiddler\n\tif(title) {\n\t\tthis.tiddlers[title] = tiddler;\n\t\tthis.clearCache(title);\n\t\tthis.clearGlobalCache();\n\t\tthis.enqueueTiddlerEvent(title);\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 &amp;&amp; tiddler.hasField(\&quot;plugin-type\&quot;) &amp;&amp; tiddler.hasField(\&quot;version\&quot;) &amp;&amp; existingTiddler &amp;&amp; existingTiddler.hasField(\&quot;plugin-type\&quot;) &amp;&amp; existingTiddler.hasField(\&quot;version\&quot;)) {\n\t\t// Reject the incoming plugin if it is older\n\t\tif($tw.utils.checkVersions(existingTiddler.fields.version,tiddler.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\tvar fields = {\n\t\t\tcreated: new Date()\n\t\t},\n\t\tcreator = this.getTiddlerText(USER_NAME_TITLE);\n\tif(creator) {\n\t\tfields.creator = creator;\n\t}\n\treturn fields;\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is modified\n*/\nexports.getModificationFields = function() {\n\tvar fields = {},\n\t\tmodifier = this.getTiddlerText(USER_NAME_TITLE);\n\tfields.modified = new Date();\n\tif(modifier) {\n\t\tfields.modifier = modifier;\n\t}\n\treturn fields;\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 || {};\n\tvar self = this,\n\t\tsortField = options.sortField || \&quot;title\&quot;,\n\t\ttiddlers = [], t, titles = [];\n\tfor(t in this.tiddlers) {\n\t\tif($tw.utils.hop(this.tiddlers,t)) {\n\t\t\tif(options.includeSystem || !this.isSystemTiddler(t)) {\n\t\t\t\tif(!options.excludeTag || !this.tiddlers[t].hasTag(excludeTag)) {\n\t\t\t\t\ttiddlers.push(this.tiddlers[t]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttiddlers.sort(function(a,b) {\n\t\tvar aa = a.fields[sortField].toLowerCase() || \&quot;\&quot;,\n\t\t\tbb = b.fields[sortField].toLowerCase() || \&quot;\&quot;;\n\t\tif(aa &lt; bb) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(aa &gt; 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&lt;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/*\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\tif(sortField !== \&quot;title\&quot;) {\n\t\t\ta = self.getTiddler(a).fields[sortField] || \&quot;\&quot;;\n\t\t\tb = self.getTiddler(b).fields[sortField] || \&quot;\&quot;;\n\t\t}\n\t\tif(!isNumeric || isNaN(a) || isNaN(b)) {\n\t\t\tif(!isCaseSensitive) {\n\t\t\t\tif(typeof a === \&quot;string\&quot;) {\n\t\t\t\t\ta = a.toLowerCase();\n\t\t\t\t}\n\t\t\t\tif(typeof b === \&quot;string\&quot;) {\n\t\t\t\t\tb = b.toLowerCase();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\ta-= 0;\n\t\t\tb-= 0;\n\t\t}\n\t\tif(a &lt; b) {\n\t\t\treturn isDescending ? +1 : -1;\n\t\t} else {\n\t\t\tif(a &gt; b) {\n\t\t\t\treturn isDescending ? -1 : +1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\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 &gt;= 2 ? arguments[arg++] : {},\n\t\tcallback = arguments[arg++],\n\t\ttitles = this.getTiddlers(options),\n\t\tt, tiddler;\n\tfor(t=0; t&lt;titles.length; t++) {\n\t\ttiddler = this.tiddlers[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,\&quot;links\&quot;,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&lt;parseTree.length; t++) {\n\t\t\t\t\tvar parseTreeNode = parseTree[t];\n\t\t\t\t\tif(parseTreeNode.type === \&quot;link\&quot; &amp;&amp; parseTreeNode.attributes.to &amp;&amp; parseTreeNode.attributes.to.type === \&quot;string\&quot;) {\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) &amp;&amp; !self.isShadowTiddler(link)) &amp;&amp; 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\nexports.getSystemTitles = function() {\n\tvar titles = [];\n\tfor(var title in this.tiddlers) {\n\t\tif(this.isSystemTiddler(title)) {\n\t\t\ttitles.push(title);\n\t\t}\n\t}\n\ttitles.sort();\n\treturn titles;\n};\n\nexports.getShadowTitles = function() {\n\tvar titles = [];\n\tfor(var title in this.shadowTiddlers) {\n\t\ttitles.push(title);\n\t}\n\ttitles.sort();\n\treturn titles;\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(\&quot;taglist-\&quot; + 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(\&quot;tagmap\&quot;,function() {\n\t\tvar tags = {};\n\t\t// Collect up all the tags\n\t\tfor(var title in self.tiddlers) {\n\t\t\tvar tiddler = self.tiddlers[title];\n\t\t\tif(tiddler.fields.tags) {\n\t\t\t\tfor(var index=0; index&lt;tiddler.fields.tags.length; index++) {\n\t\t\t\t\tvar tag = tiddler.fields.tags[index];\n\t\t\t\t\tif(tags[tag]) {\n\t\t\t\t\t\ttags[tag].push(title)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttags[tag] = [title];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\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 their list\n*/\nexports.findListingsOfTiddler = function(targetTitle) {\n\t// Get the list associated with the tag\n\tvar titles = [];\n\tfor(var title in this.tiddlers) {\n\t\tvar tiddler = this.tiddlers[title];\n\t\tif($tw.utils.isArray(tiddler.fields.list) &amp;&amp; tiddler.fields.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 if(list) {\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&lt;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&lt;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\treturn titles;\n\t} else {\n\t\treturn array;\n\t}\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 = {};\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 a tiddlers content 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*/\nexports.getTiddlerData = function(title,defaultData) {\n\tvar tiddler = this.getTiddler(title),\n\t\tdata;\n\tif(tiddler &amp;&amp; tiddler.fields.text) {\n\t\tswitch(tiddler.fields.type) {\n\t\t\tcase \&quot;application/json\&quot;:\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 \&quot;application/x-tiddler-dictionary\&quot;:\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(title,index,defaultText) {\n\tvar data = this.getTiddlerData(title,{}),\n\t\ttext;\n\tif(data &amp;&amp; $tw.utils.hop(data,index)) {\n\t\ttext = data[index];\n\t}\n\tif(typeof text === \&quot;string\&quot; || typeof text === \&quot;number\&quot;) {\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 \&quot;application/json\&quot; and setting the text to the JSON text of the data.\n*/\nexports.setTiddlerData = function(title,data) {\n\tvar tiddler = this.getTiddler(title);\n\tthis.addTiddler(new $tw.Tiddler(tiddler,{title: title, type: \&quot;application/json\&quot;, text: JSON.stringify(data,null,$tw.config.preferences.jsonSpaces)},this.getModificationFields()));\n};\n\n/*\nReturn the content of a tiddler as an array containing each line\n*/\nexports.getTiddlerList = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler &amp;&amp; $tw.utils.isArray(tiddler.fields.list)) {\n\t\treturn tiddler.fields.list.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 || {};\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 = {};\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\n// Temporarily disable caching so that tweakParseTreeNode() works\nreturn initializer();\n\n\tthis.caches = this.caches || {};\n\tvar caches = this.caches[title];\n\tif(caches &amp;&amp; caches[cacheName]) {\n\t\treturn caches[cacheName];\n\t} else {\n\t\tif(!caches) {\n\t\t\tcaches = {};\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\nexports.clearCache = function(title) {\n\tthis.caches = this.caches || {};\n\tif($tw.utils.hop(this.caches,title)) {\n\t\tdelete this.caches[title];\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(\&quot;parser\&quot;,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*/\nexports.old_parseText = function(type,text,options) {\n\toptions = options || {};\n\t// Select a parser\n\tvar Parser = $tw.Wiki.parsers[type];\n\tif(!Parser &amp;&amp; $tw.config.fileExtensionInfo[type]) {\n\t\tParser = $tw.Wiki.parsers[$tw.config.fileExtensionInfo[type].type];\n\t}\n\tif(!Parser) {\n\t\tParser = $tw.Wiki.parsers[options.defaultType || \&quot;text/vnd.tiddlywiki\&quot;];\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});\n};\n\n/*\nParse a tiddler according to its MIME type\n*/\nexports.old_parseTiddler = function(title,options) {\n\toptions = options || {};\n\tvar cacheType = options.parseAsInline ? \&quot;newInlineParseTree\&quot; : \&quot;newBlockParseTree\&quot;,\n\t\ttiddler = this.getTiddler(title),\n\t\tself = this;\n\treturn tiddler ? this.getCacheForTiddler(title,cacheType,function() {\n\t\t\treturn self.old_parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t}) : null;\n};\n\n// We need to tweak parse trees generated by the existing parser because of the change from {type:\&quot;element\&quot;,tag:\&quot;$tiddler\&quot;,...} to {type:\&quot;tiddler\&quot;,...}\nvar tweakParseTreeNode = function(node) {\n\tif(node.type === \&quot;element\&quot; &amp;&amp; node.tag.charAt(0) === \&quot;$\&quot;) {\n\t\tnode.type = node.tag.substr(1);\n\t\tdelete node.tag;\n\t}\n\ttweakParseTreeNodes(node.children);\n};\n\nvar tweakParseTreeNodes = function(nodeList) {\n\t$tw.utils.each(nodeList,tweakParseTreeNode);\n};\n\nvar tweakMacroDefinition = function(nodeList) {\n\tif(nodeList &amp;&amp; nodeList[0] &amp;&amp; nodeList[0].type === \&quot;macrodef\&quot;) {\n\t\tnodeList[0].type = \&quot;set\&quot;;\n\t\tnodeList[0].attributes = {\n\t\t\tname: {type: \&quot;string\&quot;, value: nodeList[0].name},\n\t\t\tvalue: {type: \&quot;string\&quot;, value: nodeList[0].text}\n\t\t};\n\t\tnodeList[0].children = nodeList.slice(1);\n\t\tnodeList.splice(1,nodeList.length-1);\n\t\ttweakMacroDefinition(nodeList[0].children);\n\t}\n};\n\nvar tweakParser = function(parser) {\n\t// Move any macro definitions to contain the body tree\n\ttweakMacroDefinition(parser.tree);\n\t// Tweak widgets\n\ttweakParseTreeNodes(parser.tree);\n};\n\nexports.parseText = function(type,text,options) {\n\tvar parser = this.old_parseText(type,text,options);\n\tif(parser) {\n\t\ttweakParser(parser)\n\t};\n\treturn parser;\n};\n\nexports.parseTiddler = function(title,options) {\n\tvar parser = this.old_parseTiddler(title,options);\n\tif(parser) {\n\t\ttweakParser(parser)\n\t};\n\treturn parser;\n};\n\nexports.parseTextReference = function(title,field,index,options) {\n\tif(field === \&quot;text\&quot; || (!field &amp;&amp; !index)) {\n\t\t// Force the tiddler to be lazily loaded\n\t\tthis.getTiddlerText(title);\n\t\t// Parse it\n\t\treturn this.parseTiddler(title,options);\n\t} else {\n\t\tvar tiddler,text;\n\t\tif(field) {\n\t\t\ttiddler = this.getTiddler(title);\n\t\t\ttext = tiddler ? tiddler.fields[field] : \&quot;\&quot;;\n\t\t\tif(text === undefined) {\n\t\t\t\ttext = \&quot;\&quot;;\n\t\t\t}\n\t\t\treturn this.parseText(\&quot;text/vnd.tiddlywiki\&quot;,text.toString(),options);\n\t\t} else if(index) {\n\t\t\ttext = this.extractTiddlerDataItem(title,index,\&quot;\&quot;);\n\t\t\treturn this.parseText(\&quot;text/vnd.tiddlywiki\&quot;,text,options);\n\t\t}\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: \&quot;widget\&quot;,\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: \&quot;set\&quot;,\n\t\t\tattributes: {\n\t\t\t\tname: {type: \&quot;string\&quot;, value: name},\n\t\t\t\tvalue: {type: \&quot;string\&quot;, 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.document,\n\t\tparentWidget: options.parentWidget\n\t});\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.document.createElement(\&quot;div\&quot;);\n\twidgetNode.render(container,null);\n\treturn outputType === \&quot;text/html\&quot; ? 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),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.document.createElement(\&quot;div\&quot;);\n\twidgetNode.render(container,null);\n\treturn outputType === \&quot;text/html\&quot; ? container.innerHTML : container.textContent;\n};\n\n/*\nSelect the appropriate saver modules and set them up\n*/\nexports.initSavers = function(moduleType) {\n\tmoduleType = moduleType || \&quot;saver\&quot;;\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));\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 &lt; b.info.priority) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(a.info.priority &gt; 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/*\nInvoke the highest priority saver that successfully handles a method\n*/\nexports.callSaver = function(method /*, args */ ) {\n\tfor(var t=this.savers.length-1; t&gt;=0; t--) {\n\t\tvar saver = this.savers[t];\n\t\tif(saver[method].apply(saver,Array.prototype.slice.call(arguments,1))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nSave the wiki contents. Options are:\n\tmethod: \&quot;save\&quot; or \&quot;download\&quot;\n\ttemplate: the tiddler containing the template to save\n\tdownloadType: the content type for the saved file\n*/\nexports.saveWiki = function(options) {\n\toptions = options || {};\n\tvar method = options.method || \&quot;save\&quot;,\n\t\ttemplate = options.template || \&quot;$:/core/save/all\&quot;,\n\t\tdownloadType = options.downloadType || \&quot;text/plain\&quot;;\n\tvar text = this.renderTiddler(downloadType,template);\n\tthis.callSaver(\&quot;save\&quot;,text,method,function(err) {\n\t\tif(err) {\n\t\t\talert(\&quot;Error while saving:\\n\\n\&quot; + err);\n\t\t} else {\n\t\t\t$tw.notifier.display(\&quot;$:/messages/Saved\&quot;);\n\t\t}\n\t});\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\ttitles: Hashmap or array of tiddler titles to limit search\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*/\nexports.search = function(text,options) {\n\toptions = options || {};\n\tvar self = this,t;\n\t// Convert the search string into a regexp for each term\n\tvar terms, searchTermsRegExps,\n\t\tflags = options.caseSensitive ? \&quot;\&quot; : \&quot;i\&quot;;\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(\&quot;(\&quot; + $tw.utils.escapeRegExp(text) + \&quot;)\&quot;,flags)];\n\t\t}\n\t} else {\n\t\tterms = text.split(/ +/);\n\t\tif(terms.length === 1 &amp;&amp; terms[0] === \&quot;\&quot;) {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [];\n\t\t\tfor(t=0; t&lt;terms.length; t++) {\n\t\t\t\tsearchTermsRegExps.push(new RegExp(\&quot;(\&quot; + $tw.utils.escapeRegExp(terms[t]) + \&quot;)\&quot;,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: \&quot;\&quot;, type: \&quot;text/vnd.tiddlywiki\&quot;});\n\t\t}\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo[\&quot;text/vnd.tiddlywiki\&quot;],\n\t\t\tmatch;\n\t\tfor(var t=0; t&lt;searchTermsRegExps.length; t++) {\n\t\t\t// Search title, tags and body\n\t\t\tmatch = false;\n\t\t\tif(contentTypeInfo.encoding === \&quot;utf8\&quot;) {\n\t\t\t\tmatch = match || searchTermsRegExps[t].test(tiddler.fields.text);\n\t\t\t}\n\t\t\tvar tags = tiddler.fields.tags ? tiddler.fields.tags.join(\&quot;\\0\&quot;) : \&quot;\&quot;;\n\t\t\tmatch = match || searchTermsRegExps[t].test(tags) || searchTermsRegExps[t].test(tiddler.fields.title);\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\tif($tw.utils.isArray(options.titles)) {\n\t\tfor(t=0; t&lt;options.titles.length; t++) {\n\t\t\tif(!!searchTiddler(options.titles[t]) === !options.invert) {\n\t\t\t\tresults.push(options.titles[t]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar source = options.titles || this.tiddlers;\n\t\tfor(t in source) {\n\t\t\tif(!!searchTiddler(t) === !options.invert) {\n\t\t\t\tresults.push(t);\n\t\t\t}\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&lt;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(\&quot;lazyLoad\&quot;,title);\n\t\t// Indicate that the text is being loaded\n\t\treturn null;\n\t}\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&lt;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};\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 === \&quot;\&quot; || !type) {\n\t\tvar dotPos = file.name.lastIndexOf(\&quot;.\&quot;);\n\t\tif(dotPos !== -1) {\n\t\t\tvar fileExtensionInfo = $tw.config.fileExtensionInfo[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 === \&quot;base64\&quot; : false;\n\t// Create the FileReader\n\tvar reader = new FileReader();\n\t// Onload\n\treader.onload = function(event) {\n\t\t// Deserialise the file contents\n\t\tvar tiddlerFields = {title: file.name || \&quot;Untitled\&quot;, type: type};\n\t\t// Are we binary?\n\t\tif(isBinary) {\n\t\t\t// The base64 section starts after the first comma in the data URI\n\t\t\tvar commaPos = event.target.result.indexOf(\&quot;,\&quot;);\n\t\t\tif(commaPos !== -1) {\n\t\t\t\ttiddlerFields.text = event.target.result.substr(commaPos+1);\n\t\t\t\tcallback([tiddlerFields]);\n\t\t\t}\n\t\t} else {\n\t\t\tcallback(self.deserializeTiddlers(type,event.target.result,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})();\n&quot;,
&quot;title&quot;: &quot;$:/core/modules/wiki.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;wikimethod&quot;
},
&quot;$:/core/templates/MOTW.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/MOTW.html&quot;,
&quot;text&quot;: &quot;\\rules only filteredtranscludeinline transcludeinline entity\n&lt;!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension --&gt;\n&lt;!-- saved from url=(0021)http://tiddlywiki.com --&gt;&amp;#13;&amp;#10;&quot;
},
&quot;$:/core/templates/alltiddlers.content&quot;: {
&quot;title&quot;: &quot;$:/core/templates/alltiddlers.content&quot;,
&quot;text&quot;: &quot;{{{ [!is[system]sort[title]] ||$:/core/templates/static-tiddler}}}&quot;
},
&quot;$:/core/templates/alltiddlers.template.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/alltiddlers.template.html&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki-html&quot;,
&quot;text&quot;: &quot;\\define tw-wikilink-template() #$uri_encoded$\n\\rules only filteredtranscludeinline transcludeinline\n&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html;charset=utf-8\&quot; /&gt;\n&lt;meta name=\&quot;generator\&quot; content=\&quot;TiddlyWiki\&quot; /&gt;\n&lt;meta name=\&quot;tiddlywiki-version\&quot; content=\&quot;{{$:/core/templates/version}}\&quot; /&gt;\n&lt;meta name=\&quot;format-detection\&quot; content=\&quot;telephone=no\&quot;&gt;\n&lt;link id=\&quot;faviconLink\&quot; rel=\&quot;shortcut icon\&quot; href=\&quot;favicon.ico\&quot;&gt;\n&lt;title&gt;{{$:/core/wiki/title}}&lt;/title&gt;\n&lt;div id=\&quot;styleArea\&quot;&gt;\n{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}\n&lt;/div&gt;\n&lt;style type=\&quot;text/css\&quot;&gt;\n{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}\n&lt;/style&gt;\n&lt;/head&gt;\n&lt;body class=\&quot;tw-body\&quot;&gt;\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n&lt;section class=\&quot;story-river\&quot;&gt;\n{{$:/core/templates/alltiddlers.content||$:/core/templates/html-tiddler}}\n&lt;/section&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;
},
&quot;$:/core/templates/css-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/css-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.\n\n--&gt;`&lt;style`&lt;$fields template=' data-tiddler-$name$=\&quot;$encoded_value$\&quot;'&gt;&lt;/$fields&gt;` type=\&quot;text/css\&quot;&gt;`&lt;$view field=\&quot;text\&quot; format=\&quot;text\&quot; /&gt;`&lt;/style&gt;`&quot;
},
&quot;$:/core/templates/html-div-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/html-div-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.\n\n--&gt;`&lt;div`&lt;$fields template=' $name$=\&quot;$encoded_value$\&quot;'&gt;&lt;/$fields&gt;`&gt;\n&lt;pre&gt;`&lt;$view field=\&quot;text\&quot; format=\&quot;htmlencoded\&quot; /&gt;`&lt;/pre&gt;\n&lt;/div&gt;`\n&quot;
},
&quot;$:/core/templates/html-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/html-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving tiddlers as raw HTML\n\n--&gt;&lt;$view field=\&quot;text\&quot; format=\&quot;htmlwikified\&quot; /&gt;&quot;
},
&quot;$:/core/templates/javascript-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/javascript-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.\n\n--&gt;`&lt;script`&lt;$fields template=' data-tiddler-$name$=\&quot;$encoded_value$\&quot;'&gt;&lt;/$fields&gt;` type=\&quot;text/javascript\&quot;&gt;`&lt;$view field=\&quot;text\&quot; format=\&quot;text\&quot; /&gt;`&lt;/script&gt;`&quot;
},
&quot;$:/core/templates/module-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/module-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\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--&gt;`&lt;script`&lt;$fields template=' data-tiddler-$name$=\&quot;$encoded_value$\&quot;'&gt;&lt;/$fields&gt;` type=\&quot;text/javascript\&quot; data-module=\&quot;yes\&quot;&gt;$tw.modules.define(\&quot;`&lt;$view field=\&quot;title\&quot; format=\&quot;jsencoded\&quot; /&gt;`\&quot;,\&quot;`&lt;$view field=\&quot;module-type\&quot; format=\&quot;jsencoded\&quot; /&gt;`\&quot;,function(module,exports,require) {`&lt;$view field=\&quot;text\&quot; format=\&quot;text\&quot; /&gt;`});\n&lt;/script&gt;`&quot;
},
&quot;$:/core/templates/plain-text-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/plain-text-tiddler&quot;,
&quot;text&quot;: &quot;&lt;$view field=\&quot;text\&quot; format=\&quot;text\&quot; /&gt;&quot;
},
&quot;$:/core/save/all&quot;: {
&quot;title&quot;: &quot;$:/core/save/all&quot;,
&quot;text&quot;: &quot;\\define saveTiddlerFilter()\n[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n&quot;
},
&quot;$:/core/save/empty&quot;: {
&quot;title&quot;: &quot;$:/core/save/empty&quot;,
&quot;text&quot;: &quot;\\define saveTiddlerFilter()\n[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n&quot;
},
&quot;$:/core/templates/split-recipe&quot;: {
&quot;title&quot;: &quot;$:/core/templates/split-recipe&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[!is[system]]\&quot;&gt;\ntiddler: &lt;$view field=\&quot;title\&quot; format=\&quot;urlencoded\&quot;/&gt;.tid\n&lt;/$list&gt;\n&quot;
},
&quot;$:/core/templates/static-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static-tiddler&quot;,
&quot;text&quot;: &quot;&lt;a name=&lt;&lt;currentTiddler&gt;&gt;&gt;\n&lt;$transclude tiddler=\&quot;$:/core/ui/ViewTemplate\&quot;/&gt;\n&lt;/a&gt;&quot;
},
&quot;$:/core/templates/static.area&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static.area&quot;,
&quot;text&quot;: &quot;&lt;$reveal type=\&quot;nomatch\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\n{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}\n&lt;/$reveal&gt;\n&lt;$reveal type=\&quot;match\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\nThis file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.\n&lt;/$reveal&gt;\n&quot;
},
&quot;$:/core/templates/static.content&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static.content&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;text&quot;: &quot;&lt;!-- For Google, and people without JavaScript--&gt;\nThis [[TiddlyWiki|http://tiddlywiki.com]] contains the following tiddlers:\n\n&lt;ul&gt;\n&lt;$list filter=&lt;&lt;saveTiddlerFilter&gt;&gt;&gt;\n&lt;li&gt;&lt;$view field=\&quot;title\&quot; format=\&quot;text\&quot;&gt;&lt;/$view&gt;&lt;/li&gt;\n&lt;/$list&gt;\n&lt;/ul&gt;\n&quot;
},
&quot;$:/core/templates/static.template.css&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static.template.css&quot;,
&quot;text&quot;: &quot;{{{ [is[system]type[text/css]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}\n&quot;
},
&quot;$:/core/templates/static.template.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static.template.html&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki-html&quot;,
&quot;text&quot;: &quot;\\define tw-wikilink-template() static/$uri_doubleencoded$.html\n\\rules only filteredtranscludeinline transcludeinline\n&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html;charset=utf-8\&quot; /&gt;\n&lt;meta name=\&quot;generator\&quot; content=\&quot;TiddlyWiki\&quot; /&gt;\n&lt;meta name=\&quot;tiddlywiki-version\&quot; content=\&quot;{{$:/core/templates/version}}\&quot; /&gt;\n&lt;meta name=\&quot;format-detection\&quot; content=\&quot;telephone=no\&quot;&gt;\n&lt;link id=\&quot;faviconLink\&quot; rel=\&quot;shortcut icon\&quot; href=\&quot;favicon.ico\&quot;&gt;\n&lt;title&gt;{{$:/core/wiki/title}}&lt;/title&gt;\n&lt;div id=\&quot;styleArea\&quot;&gt;\n{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}\n&lt;/div&gt;\n&lt;style type=\&quot;text/css\&quot;&gt;\n{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}\n&lt;/style&gt;\n&lt;/head&gt;\n&lt;body class=\&quot;tw-body\&quot;&gt;\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n{{$:/core/ui/PageMacros||$:/core/templates/html-tiddler}}\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;
},
&quot;$:/core/templates/static.tiddler.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/static.tiddler.html&quot;,
&quot;text&quot;: &quot;\\define tw-wikilink-template() $uri_doubleencoded$.html\n`&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html;charset=utf-8\&quot; /&gt;\n&lt;meta name=\&quot;generator\&quot; content=\&quot;TiddlyWiki\&quot; /&gt;\n&lt;meta name=\&quot;tiddlywiki-version\&quot; content=\&quot;`{{$:/core/templates/version}}`\&quot; /&gt;\n&lt;meta name=\&quot;format-detection\&quot; content=\&quot;telephone=no\&quot;&gt;\n&lt;link id=\&quot;faviconLink\&quot; rel=\&quot;shortcut icon\&quot; href=\&quot;favicon.ico\&quot;&gt;\n&lt;link rel=\&quot;stylesheet\&quot; href=\&quot;static.css\&quot;&gt;\n&lt;title&gt;`{{$:/core/wiki/title}}`&lt;/title&gt;\n&lt;/head&gt;\n&lt;body class=\&quot;tw-body\&quot;&gt;\n`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`\n&lt;section class=\&quot;story-river\&quot;&gt;\n`&lt;$view tiddler=\&quot;$:/core/ui/ViewTemplate\&quot; format=\&quot;htmlwikified\&quot;/&gt;`\n&lt;/section&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n`&quot;
},
&quot;$:/core/templates/store.area.template.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/store.area.template.html&quot;,
&quot;text&quot;: &quot;&lt;$reveal type=\&quot;nomatch\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\n`&lt;div id=\&quot;storeArea\&quot; style=\&quot;display:none;\&quot;&gt;`\n&lt;$list filter=&lt;&lt;saveTiddlerFilter&gt;&gt; template=\&quot;$:/core/templates/html-div-tiddler\&quot;/&gt;\n`&lt;/div&gt;`\n&lt;/$reveal&gt;\n&lt;$reveal type=\&quot;match\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\n`&lt;!--~~ Encrypted tiddlers ~~--&gt;`\n`&lt;pre id=\&quot;encryptedStoreArea\&quot; type=\&quot;text/plain\&quot; style=\&quot;display:none;\&quot;&gt;`\n&lt;$encrypt filter=&lt;&lt;saveTiddlerFilter&gt;&gt;/&gt;\n`&lt;/pre&gt;`\n&lt;/$reveal&gt;&quot;
},
&quot;$:/core/templates/tid-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/tid-tiddler&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving tiddlers in TiddlyWeb *.tid format\n\n--&gt;&lt;$fields exclude='text bag' template='$name$: $value$\n'&gt;&lt;/$fields&gt;`\n`&lt;$view field=\&quot;text\&quot; format=\&quot;text\&quot; /&gt;&quot;
},
&quot;$:/core/templates/tiddler-metadata&quot;: {
&quot;title&quot;: &quot;$:/core/templates/tiddler-metadata&quot;,
&quot;text&quot;: &quot;&lt;!--\n\nThis template is used for saving tiddler metadata *.meta files\n\n--&gt;&lt;$fields exclude='text bag' template='$name$: $value$\n'&gt;&lt;/$fields&gt;&quot;
},
&quot;$:/core/templates/tiddlywiki5.html&quot;: {
&quot;title&quot;: &quot;$:/core/templates/tiddlywiki5.html&quot;,
&quot;text&quot;: &quot;\\rules only filteredtranscludeinline transcludeinline\n&lt;!doctype html&gt;\n{{$:/core/templates/MOTW.html}}&lt;html&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\&quot;X-UA-Compatible\&quot; content=\&quot;IE=edge\&quot; /&gt;\t\t&lt;!-- Force IE standards mode for Intranet and HTA - should be the first meta --&gt;\n&lt;meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html;charset=utf-8\&quot; /&gt;\n&lt;meta name=\&quot;application-name\&quot; content=\&quot;TiddlyWiki\&quot; /&gt;\n&lt;meta name=\&quot;generator\&quot; content=\&quot;TiddlyWiki\&quot; /&gt;\n&lt;meta name=\&quot;tiddlywiki-version\&quot; content=\&quot;{{$:/core/templates/version}}\&quot; /&gt;\n&lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width, initial-scale=1.0\&quot; /&gt;\n&lt;meta name=\&quot;apple-mobile-web-app-capable\&quot; content=\&quot;yes\&quot; /&gt;\n&lt;meta name=\&quot;apple-mobile-web-app-status-bar-style\&quot; content=\&quot;black-translucent\&quot; /&gt;\n&lt;meta name=\&quot;format-detection\&quot; content=\&quot;telephone=no\&quot; /&gt;\n&lt;meta name=\&quot;copyright\&quot; content=\&quot;{{$:/core/copyright.txt}}\&quot; /&gt;\n&lt;link id=\&quot;faviconLink\&quot; rel=\&quot;shortcut icon\&quot; href=\&quot;favicon.ico\&quot;&gt;\n&lt;title&gt;{{$:/core/wiki/title}}&lt;/title&gt;\n&lt;!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~--&gt;\n\n&lt;!--~~ Raw markup ~~--&gt;\n{{{ [tag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}\n&lt;/head&gt;\n&lt;body class=\&quot;tw-body\&quot;&gt;\n&lt;!--~~ Static styles ~~--&gt;\n&lt;div id=\&quot;styleArea\&quot;&gt;\n{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}\n&lt;/div&gt;\n&lt;!--~~ Static content for Google and browsers without JavaScript ~~--&gt;\n&lt;noscript&gt;\n&lt;div id=\&quot;splashArea\&quot;&gt;\n{{$:/core/templates/static.area}}\n&lt;/div&gt;\n&lt;/noscript&gt;\n&lt;!--~~ Ordinary tiddlers ~~--&gt;\n{{$:/core/templates/store.area.template.html}}\n&lt;!--~~ Library modules ~~--&gt;\n&lt;div id=\&quot;libraryModules\&quot; style=\&quot;display:none;\&quot;&gt;\n{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/javascript-tiddler}}}\n&lt;/div&gt;\n&lt;!--~~ Boot kernel prologue ~~--&gt;\n&lt;div id=\&quot;bootKernelPrefix\&quot; style=\&quot;display:none;\&quot;&gt;\n{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}\n&lt;/div&gt;\n&lt;!--~~ Static modules ~~--&gt;\n&lt;div id=\&quot;modules\&quot; style=\&quot;display:none;\&quot;&gt;\n{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}\n&lt;/div&gt;\n&lt;!--~~ Boot kernel ~~--&gt;\n&lt;div id=\&quot;bootKernel\&quot; style=\&quot;display:none;\&quot;&gt;\n{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}\n&lt;/div&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;
},
&quot;$:/core/templates/version&quot;: {
&quot;title&quot;: &quot;$:/core/templates/version&quot;,
&quot;text&quot;: &quot;&lt;&lt;version&gt;&gt;&quot;
},
&quot;$:/core/templates/wikified-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/templates/wikified-tiddler&quot;,
&quot;text&quot;: &quot;&lt;$transclude /&gt;&quot;
},
&quot;$:/core/ui/AdvancedSearch/Shadows&quot;: {
&quot;title&quot;: &quot;$:/core/ui/AdvancedSearch/Shadows&quot;,
&quot;tags&quot;: &quot;$:/tags/AdvancedSearch&quot;,
&quot;caption&quot;: &quot;Shadows&quot;,
&quot;text&quot;: &quot;&lt;$linkcatcher to=\&quot;$:/temp/advancedsearch\&quot;&gt;\n\nSearch for shadow tiddlers:\n\n&lt;div class=\&quot;tw-search\&quot;&gt;&lt;$edit-text tiddler=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;search\&quot; tag=\&quot;input\&quot;/&gt;&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt; &lt;$link to=\&quot;\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/close-button}}&lt;/$link&gt;&lt;/$reveal&gt;&lt;/div&gt;\n\n&lt;/$linkcatcher&gt;\n\n&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt;\n\n&lt;div class=\&quot;tw-search-results\&quot;&gt;\n\n//&lt;small&gt;&lt;$count filter=\&quot;[is[shadow]search{$:/temp/advancedsearch}]\&quot;/&gt; matches&lt;/small&gt;//\n\n&lt;$list filter=\&quot;[is[shadow]search{$:/temp/advancedsearch}sort[title]limit[250]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n\n&lt;/div&gt;\n\n&lt;/$reveal&gt;\n\n&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;match\&quot; text=\&quot;\&quot;&gt;\n\n&lt;/$reveal&gt;\n&quot;
},
&quot;$:/core/ui/AdvancedSearch/System&quot;: {
&quot;title&quot;: &quot;$:/core/ui/AdvancedSearch/System&quot;,
&quot;tags&quot;: &quot;$:/tags/AdvancedSearch&quot;,
&quot;caption&quot;: &quot;System&quot;,
&quot;text&quot;: &quot;&lt;$linkcatcher to=\&quot;$:/temp/advancedsearch\&quot;&gt;\n\nSearch for system tiddlers:\n\n&lt;div class=\&quot;tw-search\&quot;&gt;&lt;$edit-text tiddler=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;search\&quot; tag=\&quot;input\&quot;/&gt;&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt; &lt;$link to=\&quot;\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/close-button}}&lt;/$link&gt;&lt;/$reveal&gt;&lt;/div&gt;\n\n&lt;/$linkcatcher&gt;\n\n&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt;\n\n&lt;div class=\&quot;tw-search-results\&quot;&gt;\n\n//&lt;small&gt;&lt;$count filter=\&quot;[is[system]search{$:/temp/advancedsearch}]\&quot;/&gt; matches&lt;/small&gt;//\n\n&lt;$list filter=\&quot;[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n\n&lt;/div&gt;\n\n&lt;/$reveal&gt;\n\n&lt;$reveal state=\&quot;$:/temp/advancedsearch\&quot; type=\&quot;match\&quot; text=\&quot;\&quot;&gt;\n\n&lt;/$reveal&gt;\n&quot;
},
&quot;$:/AdvancedSearch&quot;: {
&quot;title&quot;: &quot;$:/AdvancedSearch&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-advanced-search\&quot;&gt;&lt;&lt;tabs \&quot;[is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] [!is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] +[tag[$:/tags/AdvancedSearch]]\&quot; \&quot;$:/core/ui/AdvancedSearch/System\&quot;&gt;&gt;&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/ControlPanel/Appearance&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Appearance&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Appearance&quot;,
&quot;text&quot;: &quot;! Theme\n\n{{$:/snippets/themeswitcher}}\n\n! Story View\n\n{{$:/snippets/viewswitcher}}\n&quot;
},
&quot;$:/core/ui/ControlPanel/Basics&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Basics&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Basics&quot;,
&quot;text&quot;: &quot;|TiddlyWiki version |''&lt;&lt;version&gt;&gt;'' |\n|[[Title of this TiddlyWiki|SiteTitle]] |&lt;$edit-text tiddler=\&quot;SiteTitle\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|[[Subtitle|SiteSubtitle]] |&lt;$edit-text tiddler=\&quot;SiteSubtitle\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|[[Username for signing edits|$:/status/UserName]] |&lt;$edit-text tiddler=\&quot;$:/status/UserName\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|[[Animation duration|$:/config/AnimationDuration]] |&lt;$edit-text tiddler=\&quot;$:/config/AnimationDuration\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:&lt;br&gt; &lt;$edit-text tag=\&quot;textarea\&quot; tiddler=\&quot;$:/DefaultTiddlers\&quot;/&gt;&lt;br&gt;//Use &amp;#91;&amp;#91;double square brackets&amp;#93;&amp;#93; for titles with spaces// |\n|Tiddlers |''&lt;$count filter=\&quot;[!is[system]]\&quot;/&gt;'' |\n|System tiddlers |''&lt;$count filter=\&quot;[is[system]]\&quot;/&gt;'' |\n|Shadow tiddlers |''&lt;$count filter=\&quot;[is[shadow]]\&quot;/&gt;'' |\n|Overridden shadow tiddlers |''&lt;$count filter=\&quot;[!is[system]is[shadow]]\&quot;/&gt;'' |\n&quot;
},
&quot;$:/core/ui/ControlPanel/Internals&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Internals&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Internals&quot;,
&quot;text&quot;: &quot;! Tiddler fields\n\nThis is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers).\n\n{{$:/snippets/allfields}}\n\n! Loaded Modules\n\nThese 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.\n\n{{$:/snippets/modules}}\n&quot;
},
&quot;$:/core/ui/ControlPanel/Plugins&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Plugins&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Plugins&quot;,
&quot;text&quot;: &quot;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Version&lt;/th&gt;&lt;/tr&gt;&lt;$list filter=\&quot;[!has[draft.of]has[plugin-type]sort[title]]\&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/$link&gt;&lt;/td&gt;&lt;td&gt;&lt;$view field=\&quot;description\&quot;/&gt;&lt;/td&gt;&lt;td&gt;&lt;$view field=\&quot;version\&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/$list&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&quot;
},
&quot;$:/core/ui/ControlPanel/Saving&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Saving&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Saving&quot;,
&quot;text&quot;: &quot;\\define backupURL()\nhttp://$(userName)$.tiddlyspot.com/backup/\n\\end\n\\define backupLink()\n&lt;$reveal type=\&quot;nomatch\&quot; state=\&quot;$:/UploadName\&quot; text=\&quot;\&quot;&gt;\n&lt;$set name=\&quot;userName\&quot; value={{$:/UploadName}}&gt;\n&lt;a href=&lt;&lt;backupURL&gt;&gt;&gt;&lt;$macrocall $name=\&quot;backupURL\&quot; $type=\&quot;text/plain\&quot; $output=\&quot;text/plain\&quot;/&gt;&lt;/a&gt;\n&lt;/$set&gt;\n&lt;/$reveal&gt;\n\\end\n! TiddlySpot\n\n|[[Wiki name|$:/UploadName]] |&lt;$edit-text tiddler=\&quot;$:/UploadName\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|Password |&lt;$password name=\&quot;upload\&quot;/&gt; |\n|Backups |&lt;&lt;backupLink&gt;&gt; |\n\n!! Advanced settings\n\n|Server URL |&lt;$edit-text tiddler=\&quot;$:/UploadURL\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt; |\n|Upload filename |&lt;$edit-text tiddler=\&quot;$:/UploadFilename\&quot; default=\&quot;index.html\&quot; tag=\&quot;input\&quot;/&gt; |\n|Upload directory |&lt;$edit-text tiddler=\&quot;$:/UploadDir\&quot; default=\&quot;.\&quot; tag=\&quot;input\&quot;/&gt; |\n|Backup directory |&lt;$edit-text tiddler=\&quot;$:/UploadBackupDir\&quot; default=\&quot;.\&quot; tag=\&quot;input\&quot;/&gt; |\n\n\n//The server URL defaults to `http://&lt;wikiname&gt;.tiddlyspot.com/store.cgi` and can be changed to use a custom server address//\n&quot;
},
&quot;$:/core/ui/ControlPanel/Tools&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ControlPanel/Tools&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Tools&quot;,
&quot;text&quot;: &quot;! Import\n\n&lt;$browse/&gt;\n\nBrowse for files on your computer to import their contents (the individual tiddlers within TiddlyWiki HTML files are imported separately). You can also drag and drop files directly to the browser window.\n\n! Export\n\n&lt;$button message=\&quot;tw-download-file\&quot; param=\&quot;$:/core/templates/alltiddlers.template.html\&quot; class=\&quot;btn-big-green\&quot;&gt;Download all tiddlers as static HTML {{$:/core/images/save-button}}&lt;/$button&gt;\n\n! Encryption\n\n{{$:/snippets/encryptionstatus}}\n&quot;
},
&quot;$:/ControlPanel&quot;: {
&quot;title&quot;: &quot;$:/ControlPanel&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-control-panel\&quot;&gt;&lt;&lt;tabs \&quot;[is[shadow]!has[draft.of]tag[$:/tags/ControlPanel]] [!is[shadow]!has[draft.of]tag[$:/tags/ControlPanel]] +[tag[$:/tags/ControlPanel]]\&quot; \&quot;$:/core/ui/ControlPanel/Basics\&quot;&gt;&gt;&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/EditTemplate/body&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/body&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;\\define prompt()\nType the text for this tiddler\n\\end\n&lt;$reveal state=\&quot;$:/ShowEditPreview\&quot; type=\&quot;match\&quot; text=\&quot;yes\&quot;&gt;\n&lt;em class=\&quot;tw-edit\&quot;&gt;&lt;$transclude tiddler=\&quot;$:/core/ui/EditorHint\&quot;/&gt;&lt;/em&gt; &lt;$button type=\&quot;set\&quot; set=\&quot;$:/ShowEditPreview\&quot; setTo=\&quot;no\&quot;&gt;hide preview&lt;/$button&gt;\n&lt;div class=\&quot;tw-tiddler-preview\&quot;&gt;\n&lt;div class=\&quot;tw-tiddler-preview-preview\&quot;&gt;\n&lt;$transclude /&gt;\n&lt;/div&gt;\n&lt;div class=\&quot;tw-tiddler-preview-edit\&quot;&gt;\n&lt;$edit field=\&quot;text\&quot; class=\&quot;tw-edit-texteditor\&quot; placeholder=&lt;&lt;prompt&gt;&gt;/&gt;\n&lt;/div&gt;\n&lt;/div&gt;\n&lt;/$reveal&gt;\n&lt;$reveal state=\&quot;$:/ShowEditPreview\&quot; type=\&quot;nomatch\&quot; text=\&quot;yes\&quot;&gt;\n&lt;em class=\&quot;tw-edit\&quot;&gt;&lt;$transclude tiddler=\&quot;$:/core/ui/EditorHint\&quot;/&gt;&lt;/em&gt; &lt;$button type=\&quot;set\&quot; set=\&quot;$:/ShowEditPreview\&quot; setTo=\&quot;yes\&quot;&gt;show preview&lt;/$button&gt;\n&lt;$edit field=\&quot;text\&quot; class=\&quot;tw-edit-texteditor\&quot; placeholder=&lt;&lt;prompt&gt;&gt;/&gt;\n&lt;/$reveal&gt;\n&quot;
},
&quot;$:/core/ui/EditTemplate/controls&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/controls&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;&lt;span class=\&quot;tw-tiddler-controls titlebar\&quot;&gt; &lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/EditToolbar]] [!is[shadow]!has[draft.of]tag[$:/tags/EditToolbar]] +[tag[$:/tags/EditToolbar]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt; &lt;/span&gt;\n&quot;
},
&quot;$:/core/ui/EditTemplate/fields&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/fields&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;&lt;$fieldmangler&gt;&lt;div class=\&quot;tw-edit-fields\&quot;&gt;\n&lt;table class=\&quot;tw-edit-fields\&quot;&gt;&lt;tbody&gt;&lt;$list filter=\&quot;[is[current]fields[]] -title -tags -text -creator -created -modified -modifier -type -[[draft.title]] -[[draft.of]]\&quot; variable=\&quot;currentField\&quot;&gt;&lt;tr class=\&quot;tw-edit-field\&quot;&gt;&lt;td class=\&quot;tw-edit-field-name\&quot;&gt;&lt;&lt;currentField&gt;&gt;:&lt;/td&gt;&lt;td class=\&quot;tw-edit-field-value\&quot;&gt;&lt;$edit-text tiddler=&lt;&lt;currentTiddler&gt;&gt; field=&lt;&lt;currentField&gt;&gt; placeholder=\&quot;field value\&quot;/&gt;&lt;/td&gt;&lt;td class=\&quot;tw-edit-field-remove\&quot;&gt;&lt;$button message=\&quot;tw-remove-field\&quot; param=&lt;&lt;currentField&gt;&gt; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/delete-button}}&lt;/$button&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/$list&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;/div&gt;\n\n&lt;div class=\&quot;tw-edit-field-add\&quot;&gt;&lt;em class=\&quot;tw-edit\&quot;&gt;Add a new field:&lt;/em&gt; &lt;span class=\&quot;tw-edit-field-add-name\&quot;&gt;&lt;$edit-text tiddler=\&quot;$:/NewFieldName\&quot; tag=\&quot;input\&quot; default=\&quot;\&quot; placeholder=\&quot;field name\&quot; class=\&quot;tw-edit-texteditor\&quot;/&gt;&lt;/span&gt; &lt;span class=\&quot;tw-edit-field-add-button\&quot;&gt;&lt;$button message=\&quot;tw-add-field\&quot; param={{$:/NewFieldName}} set=\&quot;$:/NewFieldName\&quot; setTo=\&quot;\&quot; class=\&quot;\&quot;&gt;add&lt;/$button&gt;&lt;/span&gt;&lt;/div&gt;\n\n&lt;/$fieldmangler&gt;\n&quot;
},
&quot;$:/core/ui/EditTemplate/tags&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/tags&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;\\define tag-styles()\nbackground-color:$(backgroundColor)$;\n\\end\n&lt;div class=\&quot;tw-edit-tags\&quot;&gt;&lt;$fieldmangler&gt;&lt;$list filter=\&quot;[is[current]tags[]sort[title]]\&quot; storyview=\&quot;pop\&quot;&gt;&lt;$set name=\&quot;backgroundColor\&quot; value={{!!color}}&gt;&lt;span style=&lt;&lt;tag-styles&gt;&gt; class=\&quot;tw-tag-label\&quot;&gt;&lt;$view field=\&quot;title\&quot; format=\&quot;text\&quot; /&gt;&lt;$button message=\&quot;tw-remove-tag\&quot; param={{!!title}} class=\&quot;btn-invisible tw-remove-tag-button\&quot;&gt;&amp;times;&lt;/$button&gt;&lt;/span&gt;&lt;/$set&gt;\n&lt;/$list&gt;\n\n&lt;div class=\&quot;tw-edit-add-tag\&quot;&gt;&lt;span class=\&quot;tw-add-tag-name\&quot;&gt;&lt;$edit-text tiddler=\&quot;$:/NewTagName\&quot; tag=\&quot;input\&quot; default=\&quot;\&quot; placeholder=\&quot;tag name\&quot; focusPopup=&lt;&lt;qualify \&quot;$:/state/tagsAutoComplete\&quot;&gt;&gt; class=\&quot;tw-edit-texteditor\&quot;/&gt;&lt;/span&gt; &lt;$button popup=&lt;&lt;qualify \&quot;$:/state/tagsAutoComplete\&quot;&gt;&gt; class=\&quot;btn-invisible btn-dropdown\&quot;&gt;{{$:/core/images/down-arrow}}&lt;/$button&gt; &lt;span class=\&quot;tw-add-tag-button\&quot;&gt;&lt;$button message=\&quot;tw-add-tag\&quot; param={{$:/NewTagName}} set=\&quot;$:/NewTagName\&quot; setTo=\&quot;\&quot; class=\&quot;\&quot;&gt;add&lt;/$button&gt;&lt;/span&gt;&lt;/div&gt;\n\n&lt;div class=\&quot;tw-block-dropdown-wrapper\&quot;&gt;\n&lt;$reveal state=&lt;&lt;qualify \&quot;$:/state/tagsAutoComplete\&quot;&gt;&gt; type=\&quot;nomatch\&quot; text=\&quot;\&quot; default=\&quot;\&quot;&gt;\n&lt;div class=\&quot;tw-block-dropdown\&quot;&gt;\n&lt;$linkcatcher set=\&quot;$:/NewTagName\&quot; setTo=\&quot;\&quot; message=\&quot;tw-add-tag\&quot;&gt;&lt;$list filter=\&quot;[!is[shadow]tags[]search{$:/NewTagName}sort[title]]\&quot;&gt;&lt;$link&gt;&lt;$set name=\&quot;backgroundColor\&quot; value={{!!color}}&gt;&lt;span style=&lt;&lt;tag-styles&gt;&gt; class=\&quot;tw-tag-label\&quot;&gt;&lt;$view field=\&quot;title\&quot; format=\&quot;text\&quot;/&gt;&lt;/span&gt;&lt;/$set&gt;&lt;/$link&gt;\n&lt;/$list&gt;\n&lt;/$linkcatcher&gt;\n&lt;/div&gt;\n\n&lt;/$reveal&gt;\n&lt;/div&gt;\n&lt;/$fieldmangler&gt;\n&lt;/div&gt;&quot;
},
&quot;$:/core/ui/EditTemplate/title&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/title&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;&lt;$view field=\&quot;title\&quot;/&gt;\n\n&lt;$edit-text field=\&quot;draft.title\&quot; class=\&quot;titlebar tw-edit-texteditor\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/EditTemplate/type&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate/type&quot;,
&quot;tags&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;text&quot;: &quot;&lt;p&gt;&lt;em class=\&quot;tw-edit\&quot;&gt;Type:&lt;/em&gt; &lt;$edit-text field=\&quot;type\&quot; tag=\&quot;input\&quot; default=\&quot;\&quot; placeholder=\&quot;type\&quot; focusPopup=&lt;&lt;qualify \&quot;$:/state/typeDropdown\&quot;&gt;&gt; class=\&quot;tw-edit-typeeditor\&quot;/&gt; &lt;$button popup=&lt;&lt;qualify \&quot;$:/state/typeDropdown\&quot;&gt;&gt; class=\&quot;btn-invisible btn-dropdown\&quot;&gt;{{$:/core/images/down-arrow}}&lt;/$button&gt;&lt;/p&gt;\n\n&lt;div class=\&quot;tw-block-dropdown-wrapper\&quot;&gt;\n&lt;$reveal state=&lt;&lt;qualify \&quot;$:/state/typeDropdown\&quot;&gt;&gt; type=\&quot;nomatch\&quot; text=\&quot;\&quot; default=\&quot;\&quot;&gt;\n&lt;div class=\&quot;tw-block-dropdown tw-edit-type-dropdown\&quot;&gt;\n&lt;$linkcatcher to=\&quot;!!type\&quot;&gt;\n&lt;$list filter=\&quot;[is[shadow]prefix[$:/docs/types/]] [!is[shadow]prefix[$:/docs/types/]] +[sort[description]]\&quot;&gt;&lt;$link to={{!!name}}&gt;&lt;$view field=\&quot;description\&quot;/&gt; (&lt;$view field=\&quot;name\&quot;/&gt;)&lt;/$link&gt;\n&lt;/$list&gt;\n&lt;/$linkcatcher&gt;\n&lt;/div&gt;\n&lt;/$reveal&gt;\n&lt;/div&gt;&quot;
},
&quot;$:/core/ui/EditTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditTemplate&quot;,
&quot;text&quot;: &quot;\\define frame-classes()\ntw-tiddler-frame tw-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$\n\\end\n&lt;$set name=\&quot;storyTiddler\&quot; value=&lt;&lt;currentTiddler&gt;&gt;&gt;&lt;div class=&lt;&lt;frame-classes&gt;&gt;&gt;&lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] +[tag[$:/tags/EditTemplate]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt;&lt;/div&gt;&lt;/$set&gt;\n&quot;
},
&quot;$:/core/ui/EditToolbar/cancel&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditToolbar/cancel&quot;,
&quot;tags&quot;: &quot;$:/tags/EditToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-cancel-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/cancel-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/EditToolbar/delete&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditToolbar/delete&quot;,
&quot;tags&quot;: &quot;$:/tags/EditToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-delete-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/delete-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/EditToolbar/save&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditToolbar/save&quot;,
&quot;tags&quot;: &quot;$:/tags/EditToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-save-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/done-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/EditorHint&quot;: {
&quot;title&quot;: &quot;$:/core/ui/EditorHint&quot;,
&quot;text&quot;: &quot;Use WikiText to add formatting, images, and dynamic features&quot;
},
&quot;$:/core/ui/ListItemTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ListItemTemplate&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-menu-list-item\&quot;&gt;&lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/$link&gt;\n&lt;/div&gt;&quot;
},
&quot;$:/core/ui/MissingTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MissingTemplate&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-tiddler-missing\&quot;&gt;&lt;$button popup=&lt;&lt;qualify \&quot;$:/state/missingpopup\&quot;&gt;&gt; class=\&quot;btn-invisible tw-missing-tiddler-label\&quot;&gt;&lt;$view field=\&quot;title\&quot; format=\&quot;text\&quot; /&gt;&lt;/$button&gt;\n&lt;$reveal state=&lt;&lt;qualify \&quot;$:/state/missingpopup\&quot;&gt;&gt; type=\&quot;popup\&quot; position=\&quot;below\&quot; animate=\&quot;yes\&quot;&gt;&lt;div class=\&quot;tw-drop-down\&quot;&gt;\n&lt;$transclude tiddler=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&lt;hr&gt;\n&lt;$list filter=\&quot;[is[current]backlinks[]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&lt;/div&gt;&lt;/$reveal&gt;&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/All&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/All&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;All&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[!is[system]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Drafts&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Drafts&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Drafts&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[has[draft.of]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Missing&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Missing&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Missing&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[missing]sort[title]]\&quot; template=\&quot;$:/core/ui/MissingTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Orphans&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Orphans&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Orphans&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[orphan]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Recent&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Recent&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Recent&quot;,
&quot;text&quot;: &quot;{{$:/snippets/recentchanges}}\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Shadows&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Shadows&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Shadows&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[shadow]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/System&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/System&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;System&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[system]sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Tags&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Tags&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Tags&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[tags[]sort[title]]\&quot;&gt;\n&lt;$transclude tiddler=\&quot;$:/core/ui/TagTemplate\&quot;/&gt; &lt;small class=\&quot;tw-menu-list-count\&quot;&gt;&lt;$count filter=\&quot;[is[current]tagging[]]\&quot;/&gt;&lt;/small&gt;\n&lt;/$list&gt;\n----\n{{$:/core/ui/UntaggedTemplate}} &lt;small class=\&quot;tw-menu-list-count\&quot;&gt;&lt;$count filter=\&quot;[untagged[]!is[system]] -[tags[]]\&quot;/&gt;&lt;/small&gt;\n&quot;
},
&quot;$:/core/ui/MoreSideBar/Types&quot;: {
&quot;title&quot;: &quot;$:/core/ui/MoreSideBar/Types&quot;,
&quot;tags&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;caption&quot;: &quot;Types&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[!is[system]has[type]each[type]sort[type]]\&quot;&gt;\n&lt;div class=\&quot;tw-menu-list-item\&quot;&gt;\n&lt;$view field=\&quot;type\&quot;/&gt;\n&lt;$list filter=\&quot;[type{!!type}!is[system]sort[title]]\&quot;&gt;\n&lt;div class=\&quot;tw-menu-list-subitem\&quot;&gt;\n&lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/$link&gt;\n&lt;/div&gt;\n&lt;/$list&gt;\n&lt;/div&gt;\n&lt;/$list&gt;\n&quot;
},
&quot;$:/core/ui/PageControls/control-panel&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageControls/control-panel&quot;,
&quot;tags&quot;: &quot;$:/tags/PageControls&quot;,
&quot;text&quot;: &quot;&lt;$link to=\&quot;$:/ControlPanel\&quot;&gt;{{$:/core/images/options-button}}&lt;/$link&gt;&quot;
},
&quot;$:/core/ui/PageControls/new-tiddler&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageControls/new-tiddler&quot;,
&quot;tags&quot;: &quot;$:/tags/PageControls&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-new-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/new-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/PageControls/save-wiki&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageControls/save-wiki&quot;,
&quot;tags&quot;: &quot;$:/tags/PageControls&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-save-wiki\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/save-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/PageMacros&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageMacros&quot;,
&quot;text&quot;: &quot;\\define tabs(tabsList,default,state:\&quot;$:/state/tab\&quot;)\n&lt;div class=\&quot;tw-tab-buttons\&quot;&gt;&lt;$list filter=\&quot;$tabsList$\&quot; variable=\&quot;currentTab\&quot;&gt;&lt;$button set=&lt;&lt;qualify \&quot;$state$\&quot;&gt;&gt; setTo=&lt;&lt;currentTab&gt;&gt; default=\&quot;$default$\&quot; selectedClass=\&quot;tw-tab-selected\&quot;&gt;&lt;$view tiddler=&lt;&lt;currentTab&gt;&gt; field=\&quot;caption\&quot;&gt;&lt;$macrocall $name=\&quot;currentTab\&quot; $type=\&quot;text/plain\&quot; $output=\&quot;text/plain\&quot;/&gt;&lt;/$view&gt; &lt;/$button&gt;\n&lt;/$list&gt;\n&lt;/div&gt;\n&lt;div class=\&quot;tw-tab-divider\&quot;&gt;\n&lt;/div&gt;\n&lt;div class=\&quot;tw-tab-content\&quot;&gt;\n&lt;$list filter=\&quot;$tabsList$\&quot; variable=\&quot;currentTab\&quot;&gt;\n&lt;$reveal type=\&quot;match\&quot; state=&lt;&lt;qualify \&quot;$state$\&quot;&gt;&gt; text=&lt;&lt;currentTab&gt;&gt; default=\&quot;$default$\&quot;&gt;\n&lt;$transclude tiddler=&lt;&lt;currentTab&gt;&gt;/&gt;\n&lt;/$reveal&gt;\n&lt;/$list&gt;\n&lt;/div&gt;\n\\end\n\\define wikitext-example(src)\n```\n$src$\n```\n\nRenders as:\n\n$src$\n\nIn HTML:\n\n$$$text/vnd.tiddlywiki&gt;text/html\n$src$\n$$$\n\n\\end\n{{$:/core/ui/PageTemplate}}\n&quot;
},
&quot;$:/core/ui/PageStylesheet&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageStylesheet&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[shadow]tag[$:/tags/stylesheet]] [!is[shadow]tag[$:/tags/stylesheet]]\&quot;&gt;\n&lt;$transclude/&gt;\n&lt;/$list&gt;\n&quot;
},
&quot;$:/core/ui/PageTemplate/sidebar&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageTemplate/sidebar&quot;,
&quot;tags&quot;: &quot;$:/tags/PageTemplate&quot;,
&quot;text&quot;: &quot;&lt;header class=\&quot;sidebar-header\&quot;&gt;\n&lt;div class=\&quot;titlebar\&quot;&gt;{{SiteTitle}}&lt;/div&gt;\n&lt;div class=\&quot;tw-subtitle\&quot;&gt;{{SiteSubtitle}}&lt;/div&gt;\n\n&lt;div class=\&quot;tw-page-controls\&quot;&gt;\n&lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/PageControls]] [!is[shadow]!has[draft.of]tag[$:/tags/PageControls]] +[tag[$:/tags/PageControls]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt;\n&lt;/div&gt;\n\n{{$:/core/ui/SideBarLists}}\n\n&lt;/header&gt;\n&quot;
},
&quot;$:/core/ui/PageTemplate/story&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageTemplate/story&quot;,
&quot;tags&quot;: &quot;$:/tags/PageTemplate&quot;,
&quot;text&quot;: &quot;&lt;section class=\&quot;story-river\&quot;&gt;\n\n&lt;!-- The main story --&gt;\n&lt;$list filter=\&quot;[list[$:/StoryList]]\&quot; history=\&quot;$:/HistoryList\&quot; template=\&quot;$:/core/ui/ViewTemplate\&quot; editTemplate=\&quot;$:/core/ui/EditTemplate\&quot; storyview={{$:/view}} /&gt;\n\n&lt;!-- End of story river --&gt;\n&lt;/section&gt;\n&quot;
},
&quot;$:/core/ui/PageTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/PageTemplate&quot;,
&quot;text&quot;: &quot;&lt;$navigator story=\&quot;$:/StoryList\&quot; history=\&quot;$:/HistoryList\&quot;&gt;\n\n&lt;$dropzone&gt;\n\n&lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/PageTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/PageTemplate]] +[tag[$:/tags/PageTemplate]]\&quot; variable=\&quot;listItem\&quot;&gt;\n\n&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;\n\n&lt;/$list&gt;\n\n&lt;/$dropzone&gt;\n\n&lt;/$navigator&gt;\n\n&quot;
},
&quot;$:/core/ui/SideBar/More&quot;: {
&quot;title&quot;: &quot;$:/core/ui/SideBar/More&quot;,
&quot;tags&quot;: &quot;$:/tags/SideBar&quot;,
&quot;caption&quot;: &quot;More&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-more-sidebar\&quot;&gt;\n&lt;&lt;tabs \&quot;[is[shadow]!has[draft.of]tag[$:/tags/MoreSideBar]] [!is[shadow]!has[draft.of]tag[$:/tags/MoreSideBar]] +[tag[$:/tags/MoreSideBar]]\&quot; \&quot;$:/core/ui/MoreSideBar/Open\&quot; \&quot;$:/state/tab/moresidebar\&quot;&gt;&gt;\n&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/SideBar/Open&quot;: {
&quot;title&quot;: &quot;$:/core/ui/SideBar/Open&quot;,
&quot;tags&quot;: &quot;$:/tags/SideBar&quot;,
&quot;caption&quot;: &quot;Open&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[list[$:/StoryList]]\&quot; history=\&quot;$:/HistoryList\&quot; storyview=\&quot;pop\&quot;&gt;\n&lt;$button message=\&quot;tw-close-tiddler\&quot; class=\&quot;btn-invisible btn-mini\&quot;&gt;&amp;times;&lt;/$button&gt; &lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/$link&gt;\n&lt;/$list&gt;\n&lt;$button message=\&quot;tw-close-all-tiddlers\&quot; class=\&quot;btn-invisible btn-mini\&quot;&gt;close all&lt;/$button&gt;\n&quot;
},
&quot;$:/core/ui/SideBar/Recent&quot;: {
&quot;title&quot;: &quot;$:/core/ui/SideBar/Recent&quot;,
&quot;tags&quot;: &quot;$:/tags/SideBar&quot;,
&quot;caption&quot;: &quot;Recent&quot;,
&quot;text&quot;: &quot;{{$:/snippets/recentchanges}}\n&quot;
},
&quot;$:/core/ui/SideBar/Tools&quot;: {
&quot;title&quot;: &quot;$:/core/ui/SideBar/Tools&quot;,
&quot;tags&quot;: &quot;$:/tags/SideBar&quot;,
&quot;caption&quot;: &quot;Tools&quot;,
&quot;text&quot;: &quot;{{$:/snippets/viewswitcher}}\n\n---\n\n[[AdvancedSearch|$:/AdvancedSearch]]\n\n---\n\n{{$:/snippets/minithemeswitcher}}\n\n---\n\nImport: &lt;$browse/&gt;\n\n---\n\n{{$:/snippets/encryptionstatus}}\n\n---\n\nTiddlyWiki5 version &lt;&lt;version&gt;&gt;\n&quot;
},
&quot;$:/core/ui/SideBarLists&quot;: {
&quot;title&quot;: &quot;$:/core/ui/SideBarLists&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-sidebar-lists\&quot;&gt;\n\n&lt;div class=\&quot;tw-search\&quot;&gt;&lt;$edit-text tiddler=\&quot;$:/temp/search\&quot; type=\&quot;search\&quot; tag=\&quot;input\&quot;/&gt; &lt;$reveal state=\&quot;$:/temp/search\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt;&lt;$linkcatcher to=\&quot;$:/temp/search\&quot;&gt;&lt;$link to=\&quot;\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/close-button}}&lt;/$link&gt;&lt;/$linkcatcher&gt;&lt;/$reveal&gt;&lt;$reveal state=\&quot;$:/temp/search\&quot; type=\&quot;match\&quot; text=\&quot;\&quot;&gt; &amp;nbsp;&lt;$link to=\&quot;$:/AdvancedSearch\&quot; class=\&quot;btn-invisible\&quot;&gt;...&lt;/$link&gt;&lt;/$reveal&gt;&lt;/div&gt;\n\n&lt;$reveal state=\&quot;$:/temp/search\&quot; type=\&quot;nomatch\&quot; text=\&quot;\&quot;&gt;\n\n&lt;div class=\&quot;tw-search-results\&quot;&gt;\n\n//&lt;small&gt;&lt;$count filter=\&quot;[!is[system]search{$:/temp/search}]\&quot;/&gt; matches&lt;/small&gt;//\n\n&lt;$list filter=\&quot;[!is[system]search{$:/temp/search}sort[title]limit[250]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n\n&lt;/div&gt;\n\n&lt;/$reveal&gt;\n\n&lt;$reveal state=\&quot;$:/temp/search\&quot; type=\&quot;match\&quot; text=\&quot;\&quot;&gt;\n\n&lt;&lt;tabs \&quot;[is[shadow]!has[draft.of]tag[$:/tags/SideBar]] [!is[shadow]!has[draft.of]tag[$:/tags/SideBar]] +[tag[$:/tags/SideBar]]\&quot; \&quot;$:/core/ui/SideBar/Open\&quot; \&quot;$:/state/tab/sidebar\&quot;&gt;&gt;\n\n&lt;/$reveal&gt;\n&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/TagTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TagTemplate&quot;,
&quot;text&quot;: &quot;\\define tag-styles()\nbackground-color:$(backgroundColor)$;\n\\end\n&lt;span class=\&quot;tw-tag-list-item\&quot;&gt;&lt;$set name=\&quot;backgroundColor\&quot; value={{!!color}}&gt;&lt;$button popup=&lt;&lt;qualify \&quot;$:/state/tagpopup\&quot;&gt;&gt; class=\&quot;btn-invisible tw-tag-label\&quot; style=&lt;&lt;tag-styles&gt;&gt;&gt;&lt;$transclude tiddler={{!!icon}}/&gt; &lt;$view field=\&quot;title\&quot; format=\&quot;text\&quot; /&gt;&lt;/$button&gt;&lt;/$set&gt;\n&lt;$reveal state=&lt;&lt;qualify \&quot;$:/state/tagpopup\&quot;&gt;&gt; type=\&quot;popup\&quot; position=\&quot;below\&quot; animate=\&quot;yes\&quot;&gt;&lt;div class=\&quot;tw-drop-down\&quot;&gt;&lt;$transclude tiddler=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&lt;hr&gt;\n&lt;$list filter=\&quot;[is[current]tagging[]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&lt;/div&gt;&lt;/$reveal&gt;&lt;/span&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerFieldTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerFieldTemplate&quot;,
&quot;text&quot;: &quot;&lt;tr class=\&quot;tw-view-field\&quot;&gt;&lt;td class=\&quot;tw-view-field-name\&quot;&gt;&lt;&lt;listItem&gt;&gt;&lt;/td&gt;&lt;td class=\&quot;tw-view-field-value\&quot;&gt;&lt;$view field=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/td&gt;&lt;/tr&gt;&quot;
},
&quot;$:/core/ui/TiddlerFields&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerFields&quot;,
&quot;text&quot;: &quot;&lt;table class=\&quot;tw-view-field-table\&quot;&gt;&lt;tbody&gt;&lt;$list filter=\&quot;[is[current]fields[]sort[title]] -text\&quot; template=\&quot;$:/core/ui/TiddlerFieldTemplate\&quot; variable=\&quot;listItem\&quot;/&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo/Fields&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo/Fields&quot;,
&quot;tags&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;caption&quot;: &quot;Fields&quot;,
&quot;text&quot;: &quot;&lt;$transclude tiddler=\&quot;$:/core/ui/TiddlerFields\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo/List&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo/List&quot;,
&quot;tags&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;caption&quot;: &quot;List&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[list{!!title}]\&quot; emptyMessage=\&quot;This tiddler does not have a list\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo/Listed&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo/Listed&quot;,
&quot;tags&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;caption&quot;: &quot;Listed&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[current]listed[]!is[system]]\&quot; emptyMessage=\&quot;This tiddler is not listed by any others\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo/References&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo/References&quot;,
&quot;tags&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;caption&quot;: &quot;References&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[current]backlinks[]sort[title]]\&quot; emptyMessage=\&quot;No tiddlers link to this one\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;&gt;\n&lt;/$list&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo/Tagging&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo/Tagging&quot;,
&quot;tags&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;caption&quot;: &quot;Tagging&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[is[current]tagging[]]\&quot; emptyMessage=\&quot;No tiddlers are tagged with this one\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&quot;
},
&quot;$:/core/ui/TiddlerInfo&quot;: {
&quot;title&quot;: &quot;$:/core/ui/TiddlerInfo&quot;,
&quot;text&quot;: &quot;&lt;&lt;tabs \&quot;[is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo]] [!is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo]] +[tag[$:/tags/TiddlerInfo]]\&quot; \&quot;$:/core/ui/TiddlerInfo/References\&quot;&gt;&gt;\n&quot;
},
&quot;$:/core/ui/UntaggedTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/UntaggedTemplate&quot;,
&quot;text&quot;: &quot;&lt;$button popup=&lt;&lt;qualify \&quot;$:/state/tagpopup\&quot;&gt;&gt; class=\&quot;btn-invisible tw-untagged-label tw-tag-label\&quot;&gt;untagged&lt;/$button&gt;\n&lt;$reveal state=&lt;&lt;qualify \&quot;$:/state/tagpopup\&quot;&gt;&gt; type=\&quot;popup\&quot; position=\&quot;below\&quot;&gt;&lt;div class=\&quot;tw-drop-down\&quot;&gt;\n&lt;$list filter=\&quot;[untagged[]!is[system]] -[tags[]] +[sort[title]]\&quot; template=\&quot;$:/core/ui/ListItemTemplate\&quot;/&gt;\n&lt;/div&gt;&lt;/$reveal&gt;\n&quot;
},
&quot;$:/core/ui/ViewTemplate/body&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewTemplate/body&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewTemplate&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;body\&quot;&gt;\n&lt;$transclude /&gt;\n&lt;/div&gt;&quot;
},
&quot;$:/core/ui/ViewTemplate/subtitle&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewTemplate/subtitle&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewTemplate&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-subtitle\&quot;&gt;&lt;$link to={{!!modifier}}&gt;&lt;$view field=\&quot;modifier\&quot;/&gt;&lt;/$link&gt; &lt;$view field=\&quot;modified\&quot; format=\&quot;relativedate\&quot;/&gt;&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/ViewTemplate/tags&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewTemplate/tags&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewTemplate&quot;,
&quot;text&quot;: &quot;&lt;div class=\&quot;tw-tags-wrapper\&quot;&gt;&lt;$list filter=\&quot;[is[current]tags[]sort[title]]\&quot; template=\&quot;$:/core/ui/TagTemplate\&quot; storyview=\&quot;pop\&quot;/&gt;&lt;/div&gt;\n&quot;
},
&quot;$:/core/ui/ViewTemplate/title&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewTemplate/title&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewTemplate&quot;,
&quot;text&quot;: &quot;\\define title-styles()\nfill:$(foregroundColor)$;\n\\end\n&lt;div class=\&quot;tw-tiddler-title\&quot;&gt;&lt;div class=\&quot;titlebar\&quot;&gt;&lt;span class=\&quot;tw-tiddler-controls\&quot;&gt;&lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/ViewToolbar]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewToolbar]] +[tag[$:/tags/ViewToolbar]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt;\n\n&lt;/span&gt;&lt;$set name=\&quot;foregroundColor\&quot; value={{!!color}}&gt;&lt;span style=&lt;&lt;title-styles&gt;&gt;&gt;&lt;$transclude tiddler={{!!icon}}/&gt;&lt;/span&gt;&lt;/$set&gt; &lt;span class=\&quot;title\&quot;&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/span&gt;&lt;/div&gt;\n\n&lt;$reveal type=\&quot;nomatch\&quot; text=\&quot;\&quot; default=\&quot;\&quot; state=&lt;&lt;tiddlerInfoState&gt;&gt; class=\&quot;tw-tiddler-info tw-popup\&quot; animate=\&quot;yes\&quot;&gt;\n\n&lt;$transclude tiddler=\&quot;$:/core/ui/TiddlerInfo\&quot;/&gt;\n\n&lt;/$reveal&gt;&lt;/div&gt;&quot;
},
&quot;$:/core/ui/ViewTemplate&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewTemplate&quot;,
&quot;text&quot;: &quot;\\define frame-classes()\ntw-tiddler-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$\n\\end\n&lt;$set name=\&quot;storyTiddler\&quot; value=&lt;&lt;currentTiddler&gt;&gt;&gt;&lt;$set name=\&quot;tiddlerInfoState\&quot; value=&lt;&lt;qualify \&quot;$:/state/tiddlerInfo\&quot;&gt;&gt;&gt;&lt;$tiddler tiddler=&lt;&lt;currentTiddler&gt;&gt;&gt;&lt;div class=&lt;&lt;frame-classes&gt;&gt;&gt;&lt;$list filter=\&quot;[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] +[tag[$:/tags/ViewTemplate]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$transclude tiddler=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt;\n&lt;/div&gt;\n&lt;/$tiddler&gt;&lt;/$set&gt;&lt;/$set&gt;\n&quot;
},
&quot;$:/core/ui/ViewToolbar/close&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewToolbar/close&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-close-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/close-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/ViewToolbar/edit&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewToolbar/edit&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-edit-tiddler\&quot; class=\&quot;btn-invisible\&quot;&gt;{{$:/core/images/edit-button}}&lt;/$button&gt;&quot;
},
&quot;$:/core/ui/ViewToolbar/info&quot;: {
&quot;title&quot;: &quot;$:/core/ui/ViewToolbar/info&quot;,
&quot;tags&quot;: &quot;$:/tags/ViewToolbar&quot;,
&quot;text&quot;: &quot;&lt;$button popup=&lt;&lt;tiddlerInfoState&gt;&gt; class=\&quot;btn-invisible\&quot; selectedClass=\&quot;tw-selected\&quot;&gt;{{$:/core/images/info-button}}&lt;/$button&gt;&quot;
},
&quot;$:/DefaultTiddlers&quot;: {
&quot;title&quot;: &quot;$:/DefaultTiddlers&quot;,
&quot;text&quot;: &quot;GettingStarted&quot;
},
&quot;GettingStarted&quot;: {
&quot;title&quot;: &quot;GettingStarted&quot;,
&quot;text&quot;: &quot;Welcome to TiddlyWiki, the non-linear personal web notebook.\n\nTo get started, first verify that you can save changes successfully - see http://tiddlywiki.com/ for detailed instructions.\n\nThen you can:\n\n* Create new tiddlers using the 'plus' button in the sidebar\n* Save changes using the 'download' button in the sidebar\n* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to determine which tiddlers appear when you open this wiki\n* Edit the SiteTitle and SiteSubtitle\n* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]\n&quot;
},
&quot;SiteSubtitle&quot;: {
&quot;title&quot;: &quot;SiteSubtitle&quot;,
&quot;text&quot;: &quot;a non-linear personal web notebook&quot;
},
&quot;SiteTitle&quot;: {
&quot;title&quot;: &quot;SiteTitle&quot;,
&quot;text&quot;: &quot;My ~TiddlyWiki&quot;
},
&quot;$:/temp/advancedsearch&quot;: {
&quot;title&quot;: &quot;$:/temp/advancedsearch&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/snippets/allfields&quot;: {
&quot;title&quot;: &quot;$:/snippets/allfields&quot;,
&quot;text&quot;: &quot;\\define renderfield(title)\n&lt;tr class=\&quot;tw-view-field\&quot;&gt;&lt;td class=\&quot;tw-view-field-name\&quot;&gt;''$title$'':&lt;/td&gt;&lt;td class=\&quot;tw-view-field-value\&quot;&gt;//{{$:/docs/fields/$title$}}//&lt;/td&gt;&lt;/tr&gt;\n\\end\n&lt;table class=\&quot;tw-view-field-table\&quot;&gt;&lt;tbody&gt;&lt;$list filter=\&quot;[fields[]sort[title]]\&quot; variable=\&quot;listItem\&quot;&gt;&lt;$macrocall $name=\&quot;renderfield\&quot; title=&lt;&lt;listItem&gt;&gt;/&gt;&lt;/$list&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n&quot;
},
&quot;$:/config/AnimationDuration&quot;: {
&quot;title&quot;: &quot;$:/config/AnimationDuration&quot;,
&quot;text&quot;: &quot;400&quot;
},
&quot;$:/snippets/download-wiki-button&quot;: {
&quot;title&quot;: &quot;$:/snippets/download-wiki-button&quot;,
&quot;text&quot;: &quot;&lt;$button message=\&quot;tw-download-file\&quot; param=\&quot;$:/core/save/all\&quot; class=\&quot;btn-big-green\&quot;&gt;Download Full {{$:/core/images/save-button}}&lt;/$button&gt;&quot;
},
&quot;$:/snippets/encryptionstatus&quot;: {
&quot;title&quot;: &quot;$:/snippets/encryptionstatus&quot;,
&quot;text&quot;: &quot;&lt;$reveal type=\&quot;match\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\nThis wiki is encrypted.\n&lt;$button message=\&quot;tw-clear-password\&quot; class=\&quot;btn btn-danger\&quot;&gt;Clear password&lt;/$button&gt;\n&lt;$button message=\&quot;tw-set-password\&quot; class=\&quot;btn btn-warning\&quot;&gt;Change password&lt;/$button&gt;\n&lt;/$reveal&gt;\n&lt;$reveal type=\&quot;nomatch\&quot; state=\&quot;$:/isEncrypted\&quot; text=\&quot;yes\&quot;&gt;\nThis wiki is not encrypted.\n&lt;$button message=\&quot;tw-set-password\&quot; class=\&quot;btn btn-warning\&quot;&gt;Set password&lt;/$button&gt;\n&lt;/$reveal&gt;&quot;
},
&quot;$:/snippets/minithemeswitcher&quot;: {
&quot;title&quot;: &quot;$:/snippets/minithemeswitcher&quot;,
&quot;text&quot;: &quot;Current theme: &lt;$link to={{$:/theme}}&gt;&lt;$view tiddler={{$:/theme}} field=\&quot;name\&quot;/&gt;&lt;/$link&gt;\n\n&lt;$linkcatcher to=\&quot;$:/theme\&quot;&gt;\n&lt;$list filter=\&quot;[plugin-type[theme]sort[title]]\&quot;&gt;&lt;div&gt;&lt;$reveal state=\&quot;$:/theme\&quot; type=\&quot;match\&quot; text={{!!title}}&gt;&amp;bull;&lt;/$reveal&gt;&lt;$reveal state=\&quot;$:/theme\&quot; type=\&quot;nomatch\&quot; text={{!!title}}&gt;&amp;nbsp;&lt;/$reveal&gt; &lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;name\&quot; format=\&quot;text\&quot;/&gt;&lt;/$link&gt;&lt;/div&gt;\n&lt;/$list&gt;\n&lt;/$linkcatcher&gt;&quot;
},
&quot;$:/snippets/modules&quot;: {
&quot;title&quot;: &quot;$:/snippets/modules&quot;,
&quot;text&quot;: &quot;\\define describeModuleType(type)\n{{$:/docs/moduletypes/$type$}}\n\\end\n&lt;$list filter=\&quot;[moduletypes[]]\&quot;&gt;\n!! &lt;$macrocall $name=\&quot;currentTiddler\&quot; $type=\&quot;text/plain\&quot; $output=\&quot;text/plain\&quot;/&gt;\n&lt;$macrocall $name=\&quot;describeModuleType\&quot; type=&lt;&lt;currentTiddler&gt;&gt;/&gt;\n&lt;ul&gt;&lt;$list filter=\&quot;[is[current]modules[]]\&quot;&gt;&lt;li&gt;&lt;$link&gt;&lt;&lt;currentTiddler&gt;&gt;&lt;/$link&gt;\n&lt;/li&gt;\n&lt;/$list&gt;\n&lt;/ul&gt;\n&lt;/$list&gt;\n&quot;
},
&quot;$:/state/tab/moresidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar/More||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}&quot;: {
&quot;title&quot;: &quot;$:/state/tab/moresidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar/More||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}&quot;,
&quot;text&quot;: &quot;$:/core/ui/MoreSideBar/Tags&quot;
},
&quot;$:/snippets/recentchanges&quot;: {
&quot;title&quot;: &quot;$:/snippets/recentchanges&quot;,
&quot;text&quot;: &quot;&lt;$list filter=\&quot;[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]\&quot;&gt;\n&lt;div class=\&quot;tw-menu-list-item\&quot;&gt;\n&lt;$view field=\&quot;modified\&quot; format=\&quot;date\&quot; template=\&quot;DDth MMM YYYY\&quot;/&gt;\n&lt;$list filter=\&quot;[sameday{!!modified}!is[system]!sort[modified]]\&quot;&gt;\n&lt;div class=\&quot;tw-menu-list-subitem\&quot;&gt;\n&lt;$link to={{!!title}}&gt;\n&lt;$view field=\&quot;title\&quot;/&gt;\n&lt;/$link&gt;\n&lt;/div&gt;\n&lt;/$list&gt;\n&lt;/div&gt;\n&lt;/$list&gt;\n&quot;
},
&quot;$:/temp/search&quot;: {
&quot;title&quot;: &quot;$:/temp/search&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/state/tab/sidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}&quot;: {
&quot;title&quot;: &quot;$:/state/tab/sidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}&quot;,
&quot;text&quot;: &quot;$:/core/ui/SideBar/Open&quot;
},
&quot;$:/tags/ControlPanel&quot;: {
&quot;title&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;list&quot;: &quot;$:/core/ui/ControlPanel/Basics $:/core/ui/ControlPanel/Appearance $:/core/ui/ControlPanel/Saving $:/core/ui/ControlPanel/Plugins $:/core/ui/ControlPanel/Tools $:/core/ui/ControlPanel/Internals&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/EditTemplate&quot;: {
&quot;title&quot;: &quot;$:/tags/EditTemplate&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/EditToolbar&quot;: {
&quot;title&quot;: &quot;$:/tags/EditToolbar&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/EditToolbar/delete]] [[$:/core/ui/EditToolbar/cancel]] [[$:/core/ui/EditToolbar/save]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/MoreSideBar&quot;: {
&quot;title&quot;: &quot;$:/tags/MoreSideBar&quot;,
&quot;list&quot;: &quot;[[$:/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]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/PageControls&quot;: {
&quot;title&quot;: &quot;$:/tags/PageControls&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/PageControls/new-tiddler]] [[$:/core/ui/PageControls/control-panel]] [[$:/core/ui/PageControls/save-wiki]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/PageTemplate&quot;: {
&quot;title&quot;: &quot;$:/tags/PageTemplate&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/PageTemplate/sidebar]] [[$:/core/ui/PageTemplate/story]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/SideBar&quot;: {
&quot;title&quot;: &quot;$:/tags/SideBar&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/SideBar/Open]] [[$:/core/ui/SideBar/Recent]] [[$:/core/ui/SideBar/Tools]] [[$:/core/ui/SideBar/More]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/TiddlerInfo&quot;: {
&quot;title&quot;: &quot;$:/tags/TiddlerInfo&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/TiddlerInfo/References]] [[$:/core/ui/TiddlerInfo/Tagging]] [[$:/core/ui/TiddlerInfo/List]] [[$:/core/ui/TiddlerInfo/Listed]] [[$:/core/ui/TiddlerInfo/Fields]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/ViewTemplate&quot;: {
&quot;title&quot;: &quot;$:/tags/ViewTemplate&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/body]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/tags/ViewToolbar&quot;: {
&quot;title&quot;: &quot;$:/tags/ViewToolbar&quot;,
&quot;list&quot;: &quot;[[$:/core/ui/ViewToolbar/info]] [[$:/core/ui/ViewToolbar/edit]] [[$:/core/ui/ViewToolbar/close]]&quot;,
&quot;text&quot;: &quot;&quot;
},
&quot;$:/snippets/themeswitcher&quot;: {
&quot;title&quot;: &quot;$:/snippets/themeswitcher&quot;,
&quot;text&quot;: &quot;Current theme: &lt;$link to={{$:/theme}}&gt;&lt;$view tiddler={{$:/theme}} field=\&quot;name\&quot;/&gt;&lt;/$link&gt;\n\n&lt;$linkcatcher to=\&quot;$:/theme\&quot;&gt;\n&lt;$list filter=\&quot;[plugin-type[theme]sort[title]]\&quot;&gt;&lt;div&gt;&lt;$reveal state=\&quot;$:/theme\&quot; type=\&quot;match\&quot; text={{!!title}}&gt;&amp;bull;&lt;/$reveal&gt;&lt;$reveal state=\&quot;$:/theme\&quot; type=\&quot;nomatch\&quot; text={{!!title}}&gt;&amp;nbsp;&lt;/$reveal&gt; &lt;$link to={{!!title}}&gt;''&lt;$view field=\&quot;name\&quot; format=\&quot;text\&quot;/&gt;'' &lt;$view field=\&quot;description\&quot; format=\&quot;text\&quot;/&gt;&lt;/$link&gt;&lt;/div&gt;\n&lt;/$list&gt;\n&lt;/$linkcatcher&gt;&quot;
},
&quot;$:/core/wiki/title&quot;: {
&quot;title&quot;: &quot;$:/core/wiki/title&quot;,
&quot;type&quot;: &quot;text/vnd.tiddlywiki&quot;,
&quot;text&quot;: &quot;{{SiteTitle}} --- {{SiteSubtitle}}&quot;
},
&quot;$:/view&quot;: {
&quot;title&quot;: &quot;$:/view&quot;,
&quot;text&quot;: &quot;classic&quot;
},
&quot;$:/snippets/viewswitcher&quot;: {
&quot;title&quot;: &quot;$:/snippets/viewswitcher&quot;,
&quot;text&quot;: &quot;Current view: {{$:/view}}\n\n&lt;$linkcatcher to=\&quot;$:/view\&quot;&gt;&lt;$list filter=\&quot;classic zoomin pop\&quot;&gt;&lt;div&gt;&lt;$reveal state=\&quot;$:/view\&quot; type=\&quot;match\&quot; text={{!!title}}&gt;&amp;bull;&lt;/$reveal&gt;&lt;$reveal state=\&quot;$:/view\&quot; type=\&quot;nomatch\&quot; text={{!!title}}&gt;&amp;nbsp;&lt;/$reveal&gt; &lt;$link to={{!!title}}&gt;&lt;$view field=\&quot;title\&quot;/&gt;&lt;/$link&gt;\n&lt;/div&gt;\n&lt;/$list&gt;\n&lt;/$linkcatcher&gt;\n&quot;
}
}
}</pre>
</div>
<div title="$:/isEncrypted">
<pre>no</pre>
</div>
<div dependents="" description="Adds support for HTML5 full screen mode" plugin-type="plugin" title="$:/plugins/tiddlywiki/fullscreen" type="application/json" version="5.0.7-prerelease">
<pre>{
&quot;tiddlers&quot;: {
&quot;$:/plugins/tiddlywiki/fullscreen/init.js&quot;: {
&quot;text&quot;: &quot;/*\\\ntitle: $:/plugins/tiddlywiki/fullscreen/init.js\ntype: application/javascript\nmodule-type: browser-startup\n\nMessage handler for full screen mode\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, Element: false */\n\&quot;use strict\&quot;;\n\nvar d = document,\n\tdb = d.body,\n\t_requestFullscreen = db.webkitRequestFullscreen !== undefined ? \&quot;webkitRequestFullscreen\&quot; :\n\t\t\t\t\t\tdb.mozRequestFullScreen !== undefined ? \&quot;mozRequestFullScreen\&quot; :\n\t\t\t\t\t\tdb.msRequestFullscreen !== undefined ? \&quot;msRequestFullscreen\&quot; :\n\t\t\t\t\t\tdb.requestFullscreen !== undefined ? \&quot;requestFullscreen\&quot; : \&quot;\&quot;,\n\t_exitFullscreen = d.webkitExitFullscreen !== undefined ? \&quot;webkitExitFullscreen\&quot; :\n\t\t\t\t\t\t\td.mozCancelFullScreen !== undefined ? \&quot;mozCancelFullScreen\&quot; :\n\t\t\t\t\t\t\td.msExitFullscreen !== undefined ? \&quot;msExitFullscreen\&quot; :\n\t\t\t\t\t\t\td.exitFullscreen !== undefined ? \&quot;exitFullscreen\&quot; : \&quot;\&quot;,\n\t_fullscreenElement = d.webkitFullscreenElement !== undefined ? \&quot;webkitFullscreenElement\&quot; :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \&quot;mozFullScreenElement\&quot; :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \&quot;msFullscreenElement\&quot; :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \&quot;fullscreenElement\&quot; : \&quot;\&quot;;\n\nvar toggleFullscreen = function() {\n\tif(document[_fullscreenElement]) {\n\t\tdocument[_exitFullscreen]();\n\t} else {\n\t\tdocument.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);\n\t}\n};\n\nexports.startup = function() {\n\t// Install the full screen handler\n\tif(_requestFullscreen) {\n\t\t$tw.rootWidget.addEventListener(\&quot;tw-full-screen\&quot;,function(event) {\n\t\t\ttoggleFullscreen();\n\t\t});\n\t}\n};\n\n})();\n&quot;,
&quot;title&quot;: &quot;$:/plugins/tiddlywiki/fullscreen/init.js&quot;,
&quot;type&quot;: &quot;application/javascript&quot;,
&quot;module-type&quot;: &quot;browser-startup&quot;
}
}
}</pre>
</div>
<div dependents="$:/themes/tiddlywiki/vanilla" description="A clean theme that emphasises individual tiddlers" name="Snow White" plugin-type="theme" title="$:/themes/tiddlywiki/snowwhite" type="application/json" version="5.0.7-prerelease">
<pre>{
&quot;tiddlers&quot;: {
&quot;$:/themes/tiddlywiki/snowwhite/base&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/snowwhite/base&quot;,
&quot;tags&quot;: &quot;[[$:/tags/stylesheet]]&quot;,
&quot;text&quot;: &quot;\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\n\\define border-radius(radius)\n```\n -webkit-border-radius: $radius$;\n -moz-border-radius: $radius$;\n border-radius: $radius$;\n```\n\\end\n\\define box-shadow(shadow)\n```\n -webkit-box-shadow: $shadow$;\n -moz-box-shadow: $shadow$;\n box-shadow: $shadow$;\n```\n\\end\n\\define filter(filter)\n```\n -webkit-filter: $filter$;\n -moz-filter: $filter$;\n filter: $filter$;\n```\n\\end\n\\define transition(transition)\n```\n -webkit-transition: $transition$;\n -moz-transition: $transition$;\n transition: $transition$;\n```\n\\end\n\\define transform-origin(origin)\n```\n -webkit-transform-origin: $origin$;\n -moz-transform-origin: $origin$;\n transform-origin: $origin$;\n```\n\\end\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.sidebar-header {\n\ttext-shadow: 0 1px 0 rgba(255,255,255, 0.8);\n}\n\n.tw-page-controls svg {\n\t&lt;&lt;transition \&quot;fill 150ms ease-in-out\&quot;&gt;&gt;\n}\n\n.tw-tiddler-info {\n\t&lt;&lt;box-shadow \&quot;inset 1px 2px 3px rgba(0,0,0,0.1)\&quot;&gt;&gt;\n}\n\n@media screen {\n\t.tw-tiddler-frame {\n\t\t&lt;&lt;box-shadow \&quot;5px 5px 5px rgba(0, 0, 0, 0.1)\&quot;&gt;&gt;\n\t}\n}\n\n@media (max-width: 770px) {\n\t.tw-tiddler-frame {\n\t\t&lt;&lt;box-shadow none&gt;&gt;\n\t}\n}\n\n.tw-tiddler-controls button svg {\n\t&lt;&lt;transition \&quot;fill 150ms ease-in-out\&quot;&gt;&gt;\n}\n\n.tw-tiddler-controls button.tw-selected svg {\n\t&lt;&lt;filter \&quot;drop-shadow(0px -1px 2px rgba(0,0,0,0.25))\&quot;&gt;&gt;\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor {\n\t&lt;&lt;box-shadow \&quot;inset 0 1px 8px rgba(0, 0, 0, 0.15)\&quot;&gt;&gt;\n}\n\n.tw-edit-tags {\n\t&lt;&lt;box-shadow \&quot;inset 0 1px 8px rgba(0, 0, 0, 0.15)\&quot;&gt;&gt;\n}\n\n.tw-tiddler-frame .tw-edit-tags input.tw-edit-texteditor {\n\t&lt;&lt;box-shadow \&quot;none\&quot;&gt;&gt;\n\tborder: none;\n\toutline: none;\n}\n\ncanvas.tw-edit-bitmapeditor {\n\t&lt;&lt;box-shadow \&quot;2px 2px 5px rgba(0, 0, 0, 0.5)\&quot;&gt;&gt;\n}\n\n.tw-drop-down {\n\t&lt;&lt;border-radius 4px&gt;&gt;\n\t&lt;&lt;box-shadow \&quot;2px 2px 10px rgba(0, 0, 0, 0.5)\&quot;&gt;&gt;\n}\n\n.tw-block-dropdown {\n\t&lt;&lt;border-radius 4px&gt;&gt;\n\t&lt;&lt;box-shadow \&quot;2px 2px 10px rgba(0, 0, 0, 0.5)\&quot;&gt;&gt;\n}\n\n.modal {\n\t&lt;&lt;border-radius 6px&gt;&gt;\n\t&lt;&lt;box-shadow \&quot;0 3px 7px rgba(0,0,0,0.3)\&quot;&gt;&gt;\n}\n\n.modal-footer {\n\t&lt;&lt;border-radius \&quot;0 0 6px 6px\&quot;&gt;&gt;\n\t&lt;&lt;box-shadow \&quot;inset 0 1px 0 #fff\&quot;&gt;&gt;;\n}\n\n.tw-notification {\n\t&lt;&lt;border-radius 6px&gt;&gt;\n\t&lt;&lt;box-shadow \&quot;0 3px 7px rgba(0,0,0,0.3)\&quot;&gt;&gt;\n\ttext-shadow: 0 1px 0 rgba(255,255,255, 0.8);\n}\n\n.tw-sidebar-lists .tw-tab-divider {\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(216,216,216) 0%, rgb(236,236,236) 250px\&quot;&gt;&gt;\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(236,236,236) 0%, rgb(224,224,224) 100%\&quot;&gt;&gt;\n}\n\n.tw-more-sidebar .tw-tab-buttons button.tw-tab-selected {\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(236,236,236) 0%, rgb(248,248,248) 100%\&quot;&gt;&gt;\n}\n\n.tw-message-box img {\n\t&lt;&lt;box-shadow \&quot;1px 1px 3px rgba(0,0,0,0.5)\&quot;&gt;&gt;\n}\n&quot;
}
}
}</pre>
</div>
<div dependents="" description="A basic default theme" name="Vanilla" plugin-type="theme" title="$:/themes/tiddlywiki/vanilla" type="application/json" version="5.0.7-prerelease">
<pre>{
&quot;tiddlers&quot;: {
&quot;$:/themes/tiddlywiki/vanilla/themetweaks&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/themetweaks&quot;,
&quot;tags&quot;: &quot;$:/tags/ControlPanel&quot;,
&quot;caption&quot;: &quot;Theme Tweaks&quot;,
&quot;text&quot;: &quot;You can tweak certain aspects of the ''Vanilla'' theme.\n\n//Currently, you need to toggle to a different theme and back (or save and restart TiddlyWiki) before these changes take effect. Also take care to preserve any backticks (&amp;#96;) in the settings//\n\n! Colours\n\n* Primary colour: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colours\&quot; index=\&quot;primary\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot; type=\&quot;color\&quot;/&gt;\n* Background colour: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colours\&quot; index=\&quot;background\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot; type=\&quot;color\&quot;/&gt;\n* Foreground colour: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colours\&quot; index=\&quot;foreground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot; type=\&quot;color\&quot;/&gt;\n* Page background colour: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colours\&quot; index=\&quot;pagebackground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot; type=\&quot;color\&quot;/&gt;\n* Medium contrast color: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colours\&quot; index=\&quot;medium\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot; type=\&quot;color\&quot;/&gt;\n\n! Colour mappings\n\n* Tiddler background colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;tiddlerbackground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Tiddler foreground colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;foreground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Page background colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;pagebackground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Link background colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;linkbackground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Link foreground colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;linkforeground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Dropdown background colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;dropdownbackground\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Dropdown border colour mapping: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/colourmappings\&quot; index=\&quot;dropdownborder\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n\n! Settings\n\n* Font family: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/settings\&quot; index=\&quot;fontfamily\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n\n! Sizes\n\n* Font size: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;fontsize\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Line height: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;lineheight\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Story left position //(the distance between the left of the screen and the left margin of the story river or tiddler area)//: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;storyleft\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Story top position //(the distance between the top of the screen ad the top margin of the story river or tiddler area)//: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;storytop\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Story right //(the distance between the left side of the screen and the left margin of the sidebar area)//: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;storyright\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Story width //(the width of the story river or tiddler area)//: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;storywidth\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n* Tiddler width //(the width of individual tiddlers -- used for zoomin storyview)//: &lt;$edit-text tiddler=\&quot;$:/themes/tiddlywiki/vanilla/metrics\&quot; index=\&quot;tiddlerwidth\&quot; default=\&quot;\&quot; tag=\&quot;input\&quot;/&gt;\n\n&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/base&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/base&quot;,
&quot;tags&quot;: &quot;[[$:/tags/stylesheet]]&quot;,
&quot;text&quot;: &quot;\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\n\\define border-radius(radius)\n```\n -webkit-border-radius: $radius$;\n -moz-border-radius: $radius$;\n border-radius: $radius$;\n```\n\\end\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=\&quot;search\&quot;] {\n\tbox-sizing: border-box;\n\t-moz-box-sizing: border-box;\n\t-webkit-box-sizing: border-box;\n}\n\n/*\n** Basic element styles\n*/\n\nhtml {\n\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings##fontfamily}};\n}\n\nbody.tw-body {\n\tfont-size: {{$:/themes/tiddlywiki/vanilla/metrics##fontsize}};\n\tline-height: {{$:/themes/tiddlywiki/vanilla/metrics##lineheight}};\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##foreground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##pagebackground}};\n\tword-wrap: break-word;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tline-height: 1em;\n\tfont-weight: 300;\n}\n\npre {\n\tdisplay: block;\n\tpadding: 14px;\n\tmargin: 0 0 14px;\n\tword-break: normal;\n\tword-wrap: break-word;\n\twhite-space: pre;\n\twhite-space: pre-wrap;\n\tbackground-color: #f5f5f5;\n\tborder: 1px solid #ccc;\n\tpadding: 0 3px 2px;\n\t&lt;&lt;border-radius 3px&gt;&gt;\n}\n\ncode {\n\tcolor: #d14;\n\tbackground-color: #f7f7f9;\n\tborder: 1px solid #e1e1e8;\n white-space: pre-wrap;\n\tpadding: 0 3px 2px;\n\t&lt;&lt;border-radius 3px&gt;&gt;\n}\n\nblockquote {\n\tborder-left: 5px solid #ddd;\n\tmargin-left: 25px;\n\tpadding-left: 10px;\n}\n\ndl dt {\n\tfont-weight: bold;\n\tmargin-top: 6px;\n}\n\n/*\nMarkdown likes putting code elements inside pre elements\n*/\npre &gt; code {\n\tpadding: 0;\n\tborder: none;\n\tbackground-color: inherit;\n\tcolor: inherit;\n}\n\ntable {\n\tborder: 1px solid #ddd;\n\twidth: auto;\n\tmax-width: 100%;\n\tcaption-side: bottom;\n}\n\ntable th, table td {\n\tpadding: 0 7px 0 7px;\n\tborder-top: 1px solid #ddd;\n\tborder-left: 1px solid #ddd;\n}\n\ntable thead tr td, table th {\n\tbackground-color: #f0f0f0;\n\tfont-weight: bold;\n}\n\ntable tfoot tr td {\n\tbackground-color: #a8a8a8;\n}\n\n.tw-tiddler-frame img, .tw-tiddler-frame svg, .tw-tiddler-frame canvas, .tw-tiddler-frame embed {\n\tmax-width: 100%;\n}\n\n.tw-tiddler-frame embed {\n\twidth: 100%;\n\theight: 600px;\n}\n\n/*\n** Links\n*/\n\na.tw-tiddlylink {\n\ttext-decoration: none;\n\tfont-weight: normal;\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\t-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */\n}\n\n.tw-sidebar-lists a.tw-tiddlylink {\n\tcolor: #999;\n}\n\n.tw-sidebar-lists a.tw-tiddlylink:hover {\n\tcolor: #444;\n}\n\na.tw-tiddlylink:hover {\n\ttext-decoration: underline;\n}\n\na.tw-tiddlylink-resolves {\n}\n\na.tw-tiddlylink-shadow {\n\tfont-weight: bold;\n}\n\na.tw-tiddlylink-shadow.tw-tiddlylink-resolves {\n\tfont-weight: normal;\n}\n\na.tw-tiddlylink-missing {\n\tfont-style: italic;\n}\n\na.tw-tiddlylink-external {\n\ttext-decoration: underline;\n}\n\n/*\n** Drag and drop styles\n*/\n\n.tw-tiddler-dragger {\n\tposition: relative;\n\tz-index: -10000;\n}\n\n.tw-tiddler-dragger-inner {\n\tposition: absolute;\n\tdisplay: inline-block;\n\tpadding: 8px 20px;\n\tfont-size: 16.9px;\n\tfont-weight: bold;\n\tline-height: 20px;\n\tcolor: #fff;\n\ttext-shadow: 0 1px 0 rgba(0, 0, 0, 1);\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: #000;\n\t&lt;&lt;border-radius 20px&gt;&gt;\n}\n\n.tw-tiddler-dragger-cover {\n\tposition: absolute;\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##pagebackground}};\n}\n\n.tw-dropzone {\n\tposition: relative;\n}\n\n.tw-dropzone.tw-dragover:before {\n\tz-index: 10000;\n\tdisplay: block;\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground: rgba(0,200,0,0.7);\n\ttext-align: center;\n\tcontent: \&quot;Drop here\&quot;;\n}\n\n/*\n** Buttons\n*/\n\n.btn-invisible {\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: none;\n\tborder: none;\n}\n\n.btn-big-green {\n\tpadding: 8px;\n\tmargin: 4px 8px 4px 8px;\n\tbackground: #34C734;\n\tcolor: #fff;\n\tfill: #fff;\n\tborder: none;\n\tfont-size: 1.2em;\n\tline-height: 1.4em;\n}\n\n.btn-mini {\n\tcolor: #e0e0e0;\n}\n\n.btn-mini:hover {\n\tcolor: #444;\n}\n\n.tw-image-button {\n\theight: 1em;\n}\n\n/*\n** Tags and missing tiddlers\n*/\n\n.tw-tag-list-item {\n\tdisplay: inline-block;\n\tmargin-right: 7px;\n}\n\n.tw-tags-wrapper {\n\tmargin: 4px 0 14px 0;\n}\n\n.tw-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\n.tw-tag-label {\n\tdisplay: inline-block;\n\tpadding: 2px 9px;\n\tfont-size: 0.9em;\n\tfont-weight: 300;\n\tline-height: 1.2em;\n\tcolor: #fff;\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: #D5AD34;\n\t&lt;&lt;border-radius 8px&gt;&gt;\n}\n\n.tw-untagged-label {\n\tbackground-color: #999;\n}\n\n.tw-tag-label svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #fff;\n}\n\n/*\n** Page layout\n*/\n\n.sidebar-header {\n\tcolor: #acacac;\n}\n\n.sidebar-header .title a.tw-tiddlylink-resolves {\n\tfont-weight: 300;\n}\n\n.sidebar-header .tw-sidebar-lists p {\n\tmargin-top: 3px;\n\tmargin-bottom: 3px;\n}\n\n.tw-search a svg {\n\theight: 0.75em;\n}\n\n.tw-search-results {\n\tpadding-top: 14px;\n}\n\n.tw-page-controls {\n\tmargin-top: 14px;\n}\n\n.tw-page-controls a.tw-tiddlylink:hover {\n\ttext-decoration: none;\n}\n\n.tw-page-controls svg {\n\theight: 1.75em;\n\tmin-width: 1px;\n\tpadding-right: 0.5em;\n\tfill: #fff;\n}\n\n.tw-page-controls button:hover svg, .tw-page-controls a:hover svg {\n\tfill: #000;\n}\n\n.tw-menu-list-item {\n\twhite-space: nowrap;\n}\n\n.tw-menu-list-count {\n\tfont-weight: bold;\n}\n\n.tw-open-tiddler-list {\n\t&lt;&lt;transform-origin \&quot;0% 0%\&quot;&gt;&gt;\n}\n\n.tw-menu-list-subitem {\n\tpadding-left: 7px;\n}\n\n.story-river {\n\tposition: relative;\n}\n\n.tw-story-spacer {\n\tposition: absolute;\n\tmin-height: 100%;\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}}) {\n\t.sidebar-header {\n\t\tpadding: 14px;\n\t}\n\n\t.story-river {\n\t\tposition: relative;\n\t\tpadding: 0;\n\t}\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}}) {\n\t.sidebar-header {\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: 70px 0 28px 42px;\n\t}\n\n\t.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: 56px 42px 42px 42px;\n\t}\n}\n\n@media print {\n\t.sidebar-header {\n\t\tdisplay: none;\n\t}\n\n\t.story-river {\n\t\tmargin-left: 14px;\n\t}\n}\n\n/*\n** Tiddler styles\n*/\n\n.tw-tiddler-frame {\n\tmargin-bottom: 28px;\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##tiddlerbackground}};\n}\n\n.tw-tiddler-info {\n\tpadding: 14px 42px 14px 42px;\n\tbackground-color: #f8f8f8;\n\tborder-top: 1px solid #ddd;\n\tborder-bottom: 1px solid #ddd;\n}\n\n.tw-tiddler-info .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #f8f8f8;\n\tborder-bottom: 1px solid #f8f8f8;\n}\n\n.tw-view-field-table {\n\twidth: 100%;\n}\n\n.tw-view-field-name {\n\twidth: 1%; /* Makes this column be as narrow as possible */\n\ttext-align: right;\n\tfont-style: italic;\n}\n\n.tw-view-field-value {\n}\n\n@media (max-width: 770px) {\n\t.tw-tiddler-frame {\n\t\tpadding: 14px 14px 14px 14px;\n\t}\n\n\t.tw-tiddler-info {\n\t\tmargin: 0 -14px 0 -14px;\n\t}\n}\n\n@media (min-width: 770px) {\n\t.tw-tiddler-frame {\n\t\tpadding: 28px 42px 42px 42px;\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics##tiddlerwidth}};\n\t}\n\n\t.tw-tiddler-info {\n\t\tmargin: 0 -42px 0 -42px;\n\t}\n}\n\n.titlebar {\n\tfont-weight: 300;\n\tfont-size: 2.35em;\n\tline-height: 1.2em;\n\tcolor: #182955;\n}\n\n.titlebar img {\n\theight: 1em;\n}\n\n.tw-subtitle {\n\tfont-size: 0.9em;\n\tcolor: #c0c0c0;\n\tfont-weight: 300;\n}\n\n.tw-tiddler-missing .title {\n font-style: italic;\n font-weight: normal;\n}\n\n.tw-tiddler-frame .tw-tiddler-controls {\n\tfloat: right;\n}\n\n.tw-tiddler-controls button {\n\tmargin: 0 0 0 5px;\n\tvertical-align: baseline;\n}\n\n.tw-tiddler-controls button svg {\n\theight: 0.75em;\n\tfill: #ccc;\n}\n\n.tw-tiddler-controls button.tw-selected svg {\n\tfill: #444;\n}\n\n.tw-tiddler-controls button:hover svg {\n\tfill: #888;\n}\n\n@media print {\n\t.tw-tiddler-controls {\n\t\tdisplay: none;\n\t}\n}\n\n.tw-tiddler-help { /* Help prompts within tiddler template */\n\tcolor: #999;\n\tmargin-top: 14px;\n}\n\n.tw-tiddler-help a.tw-tiddlylink {\n\tcolor: #888888;\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor, .tw-tiddler-frame textarea.tw-edit-texteditor {\n\twidth: 100%;\n\tpadding: 3px 3px 3px 3px;\n\tborder: 1px solid #ccc;\n\tline-height: 1.3em;\n\t-webkit-appearance: none;\n\tmargin: 4px 0 4px 0;\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor {\n\tbackground-color: #f8f8f8;\n}\n\ncanvas.tw-edit-bitmapeditor {\n\tborder: 6px solid #fff;\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.tw-edit-bitmapeditor-width {\n\tdisplay: block;\n}\n\n.tw-edit-bitmapeditor-height {\n\tdisplay: block;\n}\n\n/*\n** Tiddler edit mode\n*/\n\n.tw-tiddler-edit-frame em.tw-edit {\n\tcolor: #999;\n\tfont-style: normal;\n}\n\n.tw-edit-type-dropdown a.tw-tiddlylink-missing {\n\tfont-style: normal;\n}\n\n.tw-edit-tags {\n\tborder: 1px solid #ddd;\n\tpadding: 4px 8px 4px 8px;\n}\n\n.tw-edit-add-tag {\n\tdisplay: inline-block;\n}\n\n.tw-edit-add-tag .tw-add-tag-name input {\n\twidth: 50%;\n}\n\n.tw-edit-tags .tw-tag-label {\n\tdisplay: inline-block;\n}\n\n.tw-edit-tags-list {\n\tmargin: 14px 0 14px 0;\n}\n\n.tw-tag-editor-label {\n\tdisplay: inline-block;\n\tmargin-right: 7px;\n}\n\n.tw-remove-tag-button {\n\tpadding-left: 4px;\n}\n\n.tw-tiddler-preview {\n\toverflow: auto;\n}\n\n.tw-tiddler-preview-preview {\n\tfloat: right;\n\twidth: 48%;\n\tborder: 1px solid #ccc;\n\tmargin: 4px 3px 3px 3px;\n\tpadding: 3px 3px 3px 3px;\n}\n\n.tw-tiddler-preview-edit {\n\twidth: 48%;\n}\n\n.tw-edit-fields {\n\twidth: 100%;\n}\n\n\n.tw-edit-fields table, .tw-edit-fields tr, .tw-edit-fields td {\n\tborder: none;\n\tpadding: 4px;\n}\n\n.tw-edit-fields &gt; tbody &gt; .tw-edit-field:nth-child(odd) {\n\tbackground-color: #f0f4f0;\n}\n\n.tw-edit-fields &gt; tbody &gt; .tw-edit-field:nth-child(even) {\n\tbackground-color: #e0e8e0;\n}\n\n.tw-edit-field-name {\n\ttext-align: right;\n}\n\n.tw-edit-field-value input {\n\twidth: 100%;\n}\n\n.tw-edit-field-remove {\n}\n\n.tw-edit-field-remove svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #888;\n\tvertical-align: middle;\n}\n\n.tw-edit-field-add-name {\n\tdisplay: inline-block;\n\twidth: 15%;\n}\n\n.tw-edit-field-add-button {\n\tdisplay: inline-block;\n\twidth: 10%;\n}\n\n/*\n** Dropdowns\n*/\n\n.btn-dropdown svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #999;\n}\n\n.tw-drop-down {\n\tmin-width: 280px;\n\tborder: 1px solid {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownborder}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownbackground}};\n\tpadding: 7px 0 7px 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n}\n\n.tw-drop-down p {\n\tpadding: 0 14px 0 14px;\n}\n\n.tw-drop-down a {\n\tdisplay: block;\n\tpadding: 0 14px 0 14px;\n}\n\n.tw-drop-down a:hover {\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkbackground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\ttext-decoration: none;\n}\n\n.tw-drop-down .tw-tab-buttons button {\n\tbackground-color: #ececec;\n}\n\n.tw-drop-down .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\tborder-bottom: 1px solid #fff;\n}\n\n.tw-drop-down .tw-tab-contents a {\n\tpadding: 0 0.5em 0 0.5em;\n}\n\n.tw-block-dropdown-wrapper {\n\tposition: relative;\n}\n\n.tw-block-dropdown {\n\tposition: absolute;\n\tmin-width: 280px;\n\tborder: 1px solid {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownborder}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownbackground}};\n\tpadding: 0 0 0 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n\tz-index: 1000;\n}\n\n.tw-block-dropdown a {\n\tdisplay: block;\n\tpadding: 4px 14px 4px 14px;\n}\n\n.tw-block-dropdown a:hover {\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkbackground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\ttext-decoration: none;\n}\n\n/*\n** Modals\n*/\n\n.tw-modal-displayed {\n\t-webkit-filter: blur(4px);\n}\n\n.modal-backdrop {\n\tposition: fixed;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\tz-index: 1000;\n\tbackground-color: #000;\n}\n\n.modal {\n\tz-index: 1100;\n\tbackground-color: #fff;\n\tborder: 1px solid #999;\n\tborder: 1px solid rgba(0,0,0,.3);\n}\n\n@media (max-width: 55em) {\n\t.modal {\n\t\tposition: fixed;\n\t\ttop: 1em;\n\t\tleft: 1em;\n\t\tright: 1em;\n\t}\n\n\t.modal-body {\n\t\toverflow-y: auto;\n\t\tmax-height: 400px;\n\t}\n}\n\n@media (min-width: 55em) {\n\t.modal {\n\t\tposition: fixed;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\twidth: 560px;\n\t\tmargin: -250px 0 0 -280px;\n\t}\n}\n\n.modal-header {\n\tpadding: 9px 15px;\n\tborder-bottom: 1px solid #eee;\n}\n\n.modal-header h3 {\n\tmargin: 0;\n\tline-height: 30px;\n}\n\n.modal-body {\n\tpadding: 15px;\n}\n\n.modal-footer {\n\tpadding: 14px 15px 15px;\n\tmargin-bottom: 0;\n\ttext-align: right;\n\tbackground-color: #f5f5f5;\n\tborder-top: 1px solid #ddd;\n}\n\n/*\n** Notifications\n*/\n\n.tw-notification {\n\tposition: fixed;\n\ttop: 14px;\n\tright: 14px;\n\tz-index: 1000;\n\tmax-width: 280px;\n\tpadding: 0 14px 0 14px;\n\tbackground-color: #ffd;\n\tborder: 1px solid #999;\n\tborder: 1px solid rgba(0,0,0,.3);\n}\n\n/*\n** Tabs\n*/\n\n.tw-tab-set {\n}\n\n.tw-tab-buttons {\n\tfont-size: 0.85em;\n\tline-height: 100%;\n\tpadding-top: 1em;\n\tmargin-bottom: -1px;\n}\n\n.tw-tab-buttons button {\n\tcolor: #666;\n\tmargin-left: 2px;\n\tmargin-right: 2px;\n\tfont-weight: 300;\n\tborder: none;\n\tbackground: inherit;\n}\n\n.tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\tborder-left: 1px solid #d8d8d8;\n\tborder-top: 1px solid #d8d8d8;\n\tborder-right: 1px solid #d8d8d8;\n\tmargin-bottom: -1px;\n}\n\n.tw-tab-buttons button:not(.tw-tab-selected) {\n\tbackground-color: #d8d8d8;\n\tborder-left: 1px solid #ccc;\n\tborder-top: 1px solid #ccc;\n\tborder-right: 1px solid #ccc;\n}\n\n.tw-tab-divider {\n\tborder-top: 1px solid #d8d8d8;\n}\n\n.tw-tab-content {\n\tpadding-top: 14px;\n}\n\n.tw-sidebar-lists .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #ececec;\n\tborder-bottom: 1px solid #ececec;\n}\n\n.tw-sidebar-lists .tw-tab-divider {\n\tborder-top: none;\n\theight: 1px;\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(216,216,216) 0%, rgb(236,236,236) 250px\&quot;&gt;&gt;\n}\n\n.tw-more-sidebar {\n\twhite-space: nowrap;\n}\n\n@media (min-width: 770px) {\n\t.tw-more-sidebar {\n\t\tmargin-left: -14px;\n\t}\n}\n\n.tw-more-sidebar .tw-tab-buttons {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\ttext-align: right;\n\tpadding-top: 0;\n\tpadding-left: 0;\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\tdisplay: block;\n\twidth: 100%;\n\ttext-align: right;\n}\n\n.tw-sidebar-lists .tw-more-sidebar .tw-tab-divider {\n\tdisplay: none;\n}\n\n.tw-more-sidebar .tw-tab-content {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tpadding-top: 0;\n\tpadding-left: 14px;\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\tbackground-color: #ececec;\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(236,236,236) 0%, rgb(224,224,224) 100%\&quot;&gt;&gt;\n\tborder-top: none;\n\tborder-left: none;\n\tborder-bottom: none;\n\tborder-right: 1px solid #ccc;\n}\n\n.tw-more-sidebar .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\t&lt;&lt;background-linear-gradient \&quot;left, rgb(236,236,236) 0%, rgb(248,248,248) 100%\&quot;&gt;&gt;\n\tborder: none;\n}\n\n/*\n** Alerts\n*/\n\n.tw-alert {\n\t&lt;&lt;border-radius 6px&gt;&gt;\n\tmargin: 7px 7px 7px 7px;\n\tpadding: 14px 14px 14px 14px;\n\tborder: 3px solid #DBB727;\n\tbackground-color: rgb(250, 210, 50);\n}\n\n.tw-static-alert {\n\tposition: relative;\n}\n\n.tw-static-alert-inner {\n\tpadding: 0 2px 2px 42px;\n\tcolor: #AAA;\n\tposition: absolute;\n}\n\n/*\n** Grids\n*/\n\n.tw-grid-frame td {\n\twidth: 1em;\n\theight: 1em;\n}\n\n/*\n** Control panel\n*/\n\n.tw-control-panel td {\n\tpadding: 4px;\n}\n\n.tw-control-panel table, .tw-control-panel table input, .tw-control-panel table textarea {\n\twidth: 100%;\n}\n\n/*\n** Message boxes\n*/\n\n.tw-message-box {\n\tborder: 1px solid #CFD6E6;\n\tbackground: #ECF2FF;\n\tpadding: 0px 21px 0px 21px;\n\tmargin: 0 -21px 0 -21px;\n\tfont-size: 12px;\n\tline-height: 18px;\n\tcolor: #547599;\n}\n\n.tw-message-box img {\n\tfloat: right;\n\twidth: 150px;\n\tmargin: 0px 0px 12px 12px;\n}\n&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/colourmappings&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/colourmappings&quot;,
&quot;type&quot;: &quot;application/x-tiddler-dictionary&quot;,
&quot;text&quot;: &quot;tiddlerbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\nforeground: {{$:/themes/tiddlywiki/vanilla/colours##foreground}}\npagebackground: {{$:/themes/tiddlywiki/vanilla/colours##pagebackground}}\nlinkbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\nlinkforeground: {{$:/themes/tiddlywiki/vanilla/colours##primary}}\ndropdownbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\ndropdownborder: {{$:/themes/tiddlywiki/vanilla/colours##medium}}\n&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/colours&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/colours&quot;,
&quot;type&quot;: &quot;application/x-tiddler-dictionary&quot;,
&quot;text&quot;: &quot;primary: #5778D8\nbackground: #ffffff\nforeground: #333333\npagebackground: #ececec\nmedium: #bbbbbb\n&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/metrics&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/metrics&quot;,
&quot;type&quot;: &quot;application/x-tiddler-dictionary&quot;,
&quot;text&quot;: &quot;fontsize: `14px`\nlineheight: `20px`\nstoryleft: `0px`\nstorytop: `0px`\nstoryright: `770px`\nstorywidth: `770px`\ntiddlerwidth: `686px`\n&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/reset&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/reset&quot;,
&quot;type&quot;: &quot;text/plain&quot;,
&quot;text&quot;: &quot;/*! normalize.css v2.1.0 | MIT License | git.io/normalize */\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 * Correct `inline-block` display not defined in IE 8/9.\n */\n\naudio,\ncanvas,\nvideo {\n display: inline-block;\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 styling not present in IE 8/9.\n */\n\n[hidden] {\n display: none;\n}\n\n/* ==========================================================================\n Base\n ========================================================================== */\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 -webkit-text-size-adjust: 100%; /* 2 */\n -ms-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n margin: 0;\n}\n\n/* ==========================================================================\n Links\n ========================================================================== */\n\n/**\n * Address `outline` inconsistency between Chrome and other browsers.\n */\n\na:focus {\n outline: thin dotted;\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/* ==========================================================================\n Typography\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, 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 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 * Address styling not present in IE 8/9.\n */\n\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, serif;\n font-size: 1em;\n}\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\n\npre {\n white-space: pre-wrap;\n}\n\n/**\n * Set consistent quote types.\n */\n\nq {\n quotes: \&quot;\\201C\&quot; \&quot;\\201D\&quot; \&quot;\\2018\&quot; \&quot;\\2019\&quot;;\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/* ==========================================================================\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/* ==========================================================================\n Figures\n ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari 5.\n */\n\nfigure {\n margin: 0;\n}\n\n/* ==========================================================================\n Forms\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 * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n */\n\nbutton,\ninput,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 2 */\n margin: 0; /* 3 */\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\nbutton,\ninput {\n line-height: normal;\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 Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\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=\&quot;button\&quot;], /* 1 */\ninput[type=\&quot;reset\&quot;],\ninput[type=\&quot;submit\&quot;] {\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 * 1. Address box sizing set to `content-box` in IE 8/9.\n * 2. Remove excess padding in IE 8/9.\n */\n\ninput[type=\&quot;checkbox\&quot;],\ninput[type=\&quot;radio\&quot;] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\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=\&quot;search\&quot;] {\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 5 and Chrome\n * on OS X.\n */\n\ninput[type=\&quot;search\&quot;]::-webkit-search-cancel-button,\ninput[type=\&quot;search\&quot;]::-webkit-search-decoration {\n -webkit-appearance: none;\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 * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\n\ntextarea {\n overflow: auto; /* 1 */\n vertical-align: top; /* 2 */\n}\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&quot;
},
&quot;$:/themes/tiddlywiki/vanilla/settings&quot;: {
&quot;title&quot;: &quot;$:/themes/tiddlywiki/vanilla/settings&quot;,
&quot;type&quot;: &quot;application/x-tiddler-dictionary&quot;,
&quot;text&quot;: &quot;fontfamily: `\&quot;Helvetica Neue\&quot;, Helvetica, Arial, \&quot;Lucida Grande\&quot;, sans-serif`\n&quot;
}
}
}</pre>
</div>
</div>
<!--~~ Library modules ~~-->
<div id="libraryModules" style="display:none;">
<script data-tiddler-library="yes" data-tiddler-title="$:/library/sjcl.js" data-tiddler-type="application/javascript" type="text/javascript">"use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
if(typeof module!="undefined"&&module.exports)module.exports=sjcl;
sjcl.cipher.aes=function(a){this.h[0][0][0]||this.z();var b,c,d,e,f=this.h[0][4],g=this.h[1];b=a.length;var h=1;if(b!==4&&b!==6&&b!==8)throw new sjcl.exception.invalid("invalid aes key size");this.a=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(a%b===0||b===8&&a%b===4){c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255];if(a%b===0){c=c<<8^c>>>24^h<<24;h=h<<1^(h>>7)*283}}d[a]=d[a-b]^c}for(b=0;a;b++,a--){c=d[b&3?a:a-4];e[b]=a<=4||b<4?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^
g[3][f[c&255]]}};
sjcl.cipher.aes.prototype={encrypt:function(a){return this.I(a,0)},decrypt:function(a){return this.I(a,1)},h:[[[],[],[],[],[]],[[],[],[],[],[]]],z:function(){var a=this.h[0],b=this.h[1],c=a[4],d=b[4],e,f,g,h=[],i=[],k,j,l,m;for(e=0;e<0x100;e++)i[(h[e]=e<<1^(e>>7)*283)^e]=e;for(f=g=0;!c[f];f^=k||1,g=i[g]||1){l=g^g<<1^g<<2^g<<3^g<<4;l=l>>8^l&255^99;c[f]=l;d[l]=f;j=h[e=h[k=h[f]]];m=j*0x1010101^e*0x10001^k*0x101^f*0x1010100;j=h[l]*0x101^l*0x1010100;for(e=0;e<4;e++){a[e][f]=j=j<<24^j>>>8;b[e][l]=m=m<<24^m>>>8}}for(e=
0;e<5;e++){a[e]=a[e].slice(0);b[e]=b[e].slice(0)}},I:function(a,b){if(a.length!==4)throw new sjcl.exception.invalid("invalid aes block size");var c=this.a[b],d=a[0]^c[0],e=a[b?3:1]^c[1],f=a[2]^c[2];a=a[b?1:3]^c[3];var g,h,i,k=c.length/4-2,j,l=4,m=[0,0,0,0];g=this.h[b];var n=g[0],o=g[1],p=g[2],q=g[3],r=g[4];for(j=0;j<k;j++){g=n[d>>>24]^o[e>>16&255]^p[f>>8&255]^q[a&255]^c[l];h=n[e>>>24]^o[f>>16&255]^p[a>>8&255]^q[d&255]^c[l+1];i=n[f>>>24]^o[a>>16&255]^p[d>>8&255]^q[e&255]^c[l+2];a=n[a>>>24]^o[d>>16&
255]^p[e>>8&255]^q[f&255]^c[l+3];l+=4;d=g;e=h;f=i}for(j=0;j<4;j++){m[b?3&-j:j]=r[d>>>24]<<24^r[e>>16&255]<<16^r[f>>8&255]<<8^r[a&255]^c[l++];g=d;d=e;e=f;f=a;a=g}return m}};
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.P(a.slice(b/32),32-(b&31)).slice(1);return c===undefined?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(a.length===0||b.length===0)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return d===32?a.concat(b):sjcl.bitArray.P(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;
if(b===0)return 0;return(b-1)*32+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(a.length*32<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b&=31;if(c>0&&b)a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1);return a},partial:function(a,b,c){if(a===32)return b;return(c?b|0:b<<32-a)+a*0x10000000000},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return false;var c=0,d;for(d=0;d<a.length;d++)c|=
a[d]^b[d];return c===0},P:function(a,b,c,d){var e;e=0;if(d===undefined)d=[];for(;b>=32;b-=32){d.push(c);c=0}if(b===0)return d.concat(a);for(e=0;e<a.length;e++){d.push(c|a[e]>>>b);c=a[e]<<32-b}e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,b+a>32?c:d.pop(),1));return d},k:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}};
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++){if((d&3)===0)e=a[d/4];b+=String.fromCharCode(e>>>24);e<<=8}return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++){d=d<<8|a.charCodeAt(c);if((c&3)===3){b.push(d);d=0}}c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a+="00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,d*4)}};
sjcl.codec.base64={F:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.F,g=0,h=sjcl.bitArray.bitLength(a);if(c)f=f.substr(0,62)+"-_";for(c=0;d.length*6<h;){d+=f.charAt((g^a[c]>>>e)>>>26);if(e<6){g=a[c]<<6-e;e+=26;c++}else{g<<=6;e-=6}}for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d=0,e=sjcl.codec.base64.F,f=0,g;if(b)e=e.substr(0,62)+"-_";for(b=0;b<a.length;b++){g=e.indexOf(a.charAt(b));
if(g<0)throw new sjcl.exception.invalid("this isn't base64!");if(d>26){d-=26;c.push(f^g>>>d);f=g<<32-d}else{d+=6;f^=g<<32-d}}d&56&&c.push(sjcl.bitArray.partial(d&56,f,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.a[0]||this.z();if(a){this.n=a.n.slice(0);this.i=a.i.slice(0);this.e=a.e}else this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};
sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.n=this.N.slice(0);this.i=[];this.e=0;return this},update:function(a){if(typeof a==="string")a=sjcl.codec.utf8String.toBits(a);var b,c=this.i=sjcl.bitArray.concat(this.i,a);b=this.e;a=this.e=b+sjcl.bitArray.bitLength(a);for(b=512+b&-512;b<=a;b+=512)this.D(c.splice(0,16));return this},finalize:function(){var a,b=this.i,c=this.n;b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.e/
4294967296));for(b.push(this.e|0);b.length;)this.D(b.splice(0,16));this.reset();return c},N:[],a:[],z:function(){function a(e){return(e-Math.floor(e))*0x100000000|0}var b=0,c=2,d;a:for(;b<64;c++){for(d=2;d*d<=c;d++)if(c%d===0)continue a;if(b<8)this.N[b]=a(Math.pow(c,0.5));this.a[b]=a(Math.pow(c,1/3));b++}},D:function(a){var b,c,d=a.slice(0),e=this.n,f=this.a,g=e[0],h=e[1],i=e[2],k=e[3],j=e[4],l=e[5],m=e[6],n=e[7];for(a=0;a<64;a++){if(a<16)b=d[a];else{b=d[a+1&15];c=d[a+14&15];b=d[a&15]=(b>>>7^b>>>18^
b>>>3^b<<25^b<<14)+(c>>>17^c>>>19^c>>>10^c<<15^c<<13)+d[a&15]+d[a+9&15]|0}b=b+n+(j>>>6^j>>>11^j>>>25^j<<26^j<<21^j<<7)+(m^j&(l^m))+f[a];n=m;m=l;l=j;j=k+b|0;k=i;i=h;h=g;g=b+(h&i^k&(h^i))+(h>>>2^h>>>13^h>>>22^h<<30^h<<19^h<<10)|0}e[0]=e[0]+g|0;e[1]=e[1]+h|0;e[2]=e[2]+i|0;e[3]=e[3]+k|0;e[4]=e[4]+j|0;e[5]=e[5]+l|0;e[6]=e[6]+m|0;e[7]=e[7]+n|0}};
sjcl.mode.ccm={name:"ccm",encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,i=h.bitLength(c)/8,k=h.bitLength(g)/8;e=e||64;d=d||[];if(i<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;f<4&&k>>>8*f;f++);if(f<15-i)f=15-i;c=h.clamp(c,8*(15-f));b=sjcl.mode.ccm.H(a,b,c,d,e,f);g=sjcl.mode.ccm.J(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),i=f.clamp(b,h-e),k=f.bitSlice(b,
h-e);h=(h-e)/8;if(g<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;b<4&&h>>>8*b;b++);if(b<15-g)b=15-g;c=f.clamp(c,8*(15-b));i=sjcl.mode.ccm.J(a,i,c,k,e,b);a=sjcl.mode.ccm.H(a,i.data,c,d,e,b);if(!f.equal(i.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match");return i.data},H:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,i=h.k;e/=8;if(e%2||e<4||e>16)throw new sjcl.exception.invalid("ccm: invalid tag length");if(d.length>0xffffffff||b.length>0xffffffff)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data");
f=[h.partial(8,(d.length?64:0)|e-2<<2|f-1)];f=h.concat(f,c);f[3]|=h.bitLength(b)/8;f=a.encrypt(f);if(d.length){c=h.bitLength(d)/8;if(c<=65279)g=[h.partial(16,c)];else if(c<=0xffffffff)g=h.concat([h.partial(16,65534)],[c]);g=h.concat(g,d);for(d=0;d<g.length;d+=4)f=a.encrypt(i(f,g.slice(d,d+4).concat([0,0,0])))}for(d=0;d<b.length;d+=4)f=a.encrypt(i(f,b.slice(d,d+4).concat([0,0,0])));return h.clamp(f,e*8)},J:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.k;var i=b.length,k=h.bitLength(b);c=h.concat([h.partial(8,
f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!i)return{tag:d,data:[]};for(g=0;g<i;g+=4){c[3]++;e=a.encrypt(c);b[g]^=e[0];b[g+1]^=e[1];b[g+2]^=e[2];b[g+3]^=e[3]}return{tag:d,data:h.clamp(b,k)}}};
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.B,i=sjcl.bitArray,k=i.k,j=[0,0,0,0];c=h(a.encrypt(c));var l,m=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4){l=b.slice(g,g+4);j=k(j,l);m=m.concat(k(c,a.encrypt(k(c,l))));c=h(c)}l=b.slice(g);b=i.bitLength(l);g=a.encrypt(k(c,[0,0,0,b]));l=i.clamp(k(l.concat([0,0,0]),g),b);j=k(j,k(l.concat([0,0,0]),g));j=a.encrypt(k(j,k(c,h(c))));
if(d.length)j=k(j,f?d:sjcl.mode.ocb2.pmac(a,d));return m.concat(i.concat(l,i.clamp(j,e)))},decrypt:function(a,b,c,d,e,f){if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.B,h=sjcl.bitArray,i=h.k,k=[0,0,0,0],j=g(a.encrypt(c)),l,m,n=sjcl.bitArray.bitLength(b)-e,o=[];d=d||[];for(c=0;c+4<n/32;c+=4){l=i(j,a.decrypt(i(j,b.slice(c,c+4))));k=i(k,l);o=o.concat(l);j=g(j)}m=n-c*32;l=a.encrypt(i(j,[0,0,0,m]));l=i(l,h.clamp(b.slice(c),
m).concat([0,0,0]));k=i(k,l);k=a.encrypt(i(k,i(j,g(j))));if(d.length)k=i(k,f?d:sjcl.mode.ocb2.pmac(a,d));if(!h.equal(h.clamp(k,e),h.bitSlice(b,n)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return o.concat(h.clamp(l,m))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.B,e=sjcl.bitArray,f=e.k,g=[0,0,0,0],h=a.encrypt([0,0,0,0]);h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4){h=d(h);g=f(g,a.encrypt(f(h,b.slice(c,c+4))))}b=b.slice(c);if(e.bitLength(b)<128){h=f(h,d(h));b=e.concat(b,[2147483648|0,0,
0,0])}g=f(g,b);return a.encrypt(f(d(f(h,d(h))),g))},B:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^(a[0]>>>31)*135]}};sjcl.misc.hmac=function(a,b){this.M=b=b||sjcl.hash.sha256;var c=[[],[]],d=b.prototype.blockSize/32;this.l=[new b,new b];if(a.length>d)a=b.hash(a);for(b=0;b<d;b++){c[0][b]=a[b]^909522486;c[1][b]=a[b]^1549556828}this.l[0].update(c[0]);this.l[1].update(c[1])};
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a,b){a=(new this.M(this.l[0])).update(a,b).finalize();return(new this.M(this.l[1])).update(a).finalize()};
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E3;if(d<0||c<0)throw sjcl.exception.invalid("invalid params to pbkdf2");if(typeof a==="string")a=sjcl.codec.utf8String.toBits(a);e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,i,k=[],j=sjcl.bitArray;for(i=1;32*k.length<(d||1);i++){e=f=a.encrypt(j.concat(b,[i]));for(g=1;g<c;g++){f=a.encrypt(f);for(h=0;h<f.length;h++)e[h]^=f[h]}k=k.concat(e)}if(d)k=j.clamp(k,d);return k};
sjcl.random={randomWords:function(a,b){var c=[];b=this.isReady(b);var d;if(b===0)throw new sjcl.exception.notReady("generator isn't seeded");else b&2&&this.U(!(b&1));for(b=0;b<a;b+=4){(b+1)%0x10000===0&&this.L();d=this.w();c.push(d[0],d[1],d[2],d[3])}this.L();return c.slice(0,a)},setDefaultParanoia:function(a){this.t=a},addEntropy:function(a,b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.q[c],h=this.isReady(),i=0;d=this.G[c];if(d===undefined)d=this.G[c]=this.R++;if(g===undefined)g=this.q[c]=
0;this.q[c]=(this.q[c]+1)%this.b.length;switch(typeof a){case "number":if(b===undefined)b=1;this.b[g].update([d,this.u++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if(c==="[object Uint32Array]"){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else{if(c!=="[object Array]")i=1;for(c=0;c<a.length&&!i;c++)if(typeof a[c]!="number")i=1}if(!i){if(b===undefined)for(c=b=0;c<a.length;c++)for(e=a[c];e>0;){b++;e>>>=1}this.b[g].update([d,this.u++,2,b,f,a.length].concat(a))}break;case "string":if(b===
undefined)b=a.length;this.b[g].update([d,this.u++,3,b,f,a.length]);this.b[g].update(a);break;default:i=1}if(i)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.j[g]+=b;this.f+=b;if(h===0){this.isReady()!==0&&this.K("seeded",Math.max(this.g,this.f));this.K("progress",this.getProgress())}},isReady:function(a){a=this.C[a!==undefined?a:this.t];return this.g&&this.g>=a?this.j[0]>80&&(new Date).valueOf()>this.O?3:1:this.f>=a?2:0},getProgress:function(a){a=
this.C[a?a:this.t];return this.g>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.m){if(window.addEventListener){window.addEventListener("load",this.o,false);window.addEventListener("mousemove",this.p,false)}else if(document.attachEvent){document.attachEvent("onload",this.o);document.attachEvent("onmousemove",this.p)}else throw new sjcl.exception.bug("can't attach event");this.m=true}},stopCollectors:function(){if(this.m){if(window.removeEventListener){window.removeEventListener("load",
this.o,false);window.removeEventListener("mousemove",this.p,false)}else if(window.detachEvent){window.detachEvent("onload",this.o);window.detachEvent("onmousemove",this.p)}this.m=false}},addEventListener:function(a,b){this.r[a][this.Q++]=b},removeEventListener:function(a,b){var c;a=this.r[a];var d=[];for(c in a)a.hasOwnProperty(c)&&a[c]===b&&d.push(c);for(b=0;b<d.length;b++){c=d[b];delete a[c]}},b:[new sjcl.hash.sha256],j:[0],A:0,q:{},u:0,G:{},R:0,g:0,f:0,O:0,a:[0,0,0,0,0,0,0,0],d:[0,0,0,0],s:undefined,
t:6,m:false,r:{progress:{},seeded:{}},Q:0,C:[0,48,64,96,128,192,0x100,384,512,768,1024],w:function(){for(var a=0;a<4;a++){this.d[a]=this.d[a]+1|0;if(this.d[a])break}return this.s.encrypt(this.d)},L:function(){this.a=this.w().concat(this.w());this.s=new sjcl.cipher.aes(this.a)},T:function(a){this.a=sjcl.hash.sha256.hash(this.a.concat(a));this.s=new sjcl.cipher.aes(this.a);for(a=0;a<4;a++){this.d[a]=this.d[a]+1|0;if(this.d[a])break}},U:function(a){var b=[],c=0,d;this.O=b[0]=(new Date).valueOf()+3E4;for(d=
0;d<16;d++)b.push(Math.random()*0x100000000|0);for(d=0;d<this.b.length;d++){b=b.concat(this.b[d].finalize());c+=this.j[d];this.j[d]=0;if(!a&&this.A&1<<d)break}if(this.A>=1<<this.b.length){this.b.push(new sjcl.hash.sha256);this.j.push(0)}this.f-=c;if(c>this.g)this.g=c;this.A++;this.T(b)},p:function(a){sjcl.random.addEntropy([a.x||a.clientX||a.offsetX||0,a.y||a.clientY||a.offsetY||0],2,"mouse")},o:function(){sjcl.random.addEntropy((new Date).valueOf(),2,"loadtime")},K:function(a,b){var c;a=sjcl.random.r[a];
var d=[];for(c in a)a.hasOwnProperty(c)&&d.push(a[c]);for(c=0;c<d.length;c++)d[c](b)}};try{var s=new Uint32Array(32);crypto.getRandomValues(s);sjcl.random.addEntropy(s,1024,"crypto['getRandomValues']")}catch(t){}
sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},encrypt:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.c({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.c(f,c);c=f.adata;if(typeof f.salt==="string")f.salt=sjcl.codec.base64.toBits(f.salt);if(typeof f.iv==="string")f.iv=sjcl.codec.base64.toBits(f.iv);if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||typeof a==="string"&&f.iter<=100||f.ts!==64&&f.ts!==96&&f.ts!==128||f.ks!==128&&f.ks!==192&&f.ks!==0x100||f.iv.length<
2||f.iv.length>4)throw new sjcl.exception.invalid("json encrypt: invalid parameters");if(typeof a==="string"){g=sjcl.misc.cachedPbkdf2(a,f);a=g.key.slice(0,f.ks/32);f.salt=g.salt}if(typeof b==="string")b=sjcl.codec.utf8String.toBits(b);if(typeof c==="string")c=sjcl.codec.utf8String.toBits(c);g=new sjcl.cipher[f.cipher](a);e.c(d,f);d.key=a;f.ct=sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return e.encode(f)},decrypt:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.c(e.c(e.c({},e.defaults),e.decode(b)),
c,true);var f;c=b.adata;if(typeof b.salt==="string")b.salt=sjcl.codec.base64.toBits(b.salt);if(typeof b.iv==="string")b.iv=sjcl.codec.base64.toBits(b.iv);if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||typeof a==="string"&&b.iter<=100||b.ts!==64&&b.ts!==96&&b.ts!==128||b.ks!==128&&b.ks!==192&&b.ks!==0x100||!b.iv||b.iv.length<2||b.iv.length>4)throw new sjcl.exception.invalid("json decrypt: invalid parameters");if(typeof a==="string"){f=sjcl.misc.cachedPbkdf2(a,b);a=f.key.slice(0,b.ks/32);b.salt=f.salt}if(typeof c===
"string")c=sjcl.codec.utf8String.toBits(c);f=new sjcl.cipher[b.cipher](a);c=sjcl.mode[b.mode].decrypt(f,b.ct,b.iv,c,b.ts);e.c(d,b);d.key=a;return sjcl.codec.utf8String.fromBits(c)},encode:function(a){var b,c="{",d="";for(b in a)if(a.hasOwnProperty(b)){if(!b.match(/^[a-z0-9]+$/i))throw new sjcl.exception.invalid("json encode: invalid property name");c+=d+'"'+b+'":';d=",";switch(typeof a[b]){case "number":case "boolean":c+=a[b];break;case "string":c+='"'+escape(a[b])+'"';break;case "object":c+='"'+
sjcl.codec.base64.fromBits(a[b],1)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type");}}return c+"}"},decode:function(a){a=a.replace(/\s/g,"");if(!a.match(/^\{.*\}$/))throw new sjcl.exception.invalid("json decode: this isn't json!");a=a.replace(/^\{|\}$/g,"").split(/,/);var b={},c,d;for(c=0;c<a.length;c++){if(!(d=a[c].match(/^(?:(["']?)([a-z][a-z0-9]*)\1):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");b[d[2]]=
d[3]?parseInt(d[3],10):d[2].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4])}return b},c:function(a,b,c){if(a===undefined)a={};if(b===undefined)return a;var d;for(d in b)if(b.hasOwnProperty(d)){if(c&&a[d]!==undefined&&a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},W:function(a,b){var c={},d;for(d in a)if(a.hasOwnProperty(d)&&a[d]!==b[d])c[d]=a[d];return c},V:function(a,b){var c={},d;for(d=0;d<b.length;d++)if(a[b[d]]!==undefined)c[b[d]]=
a[b[d]];return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.S={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.S,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===undefined?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};</script>
</div>
<!--~~ Boot kernel prologue ~~-->
<div id="bootKernelPrefix" style="display:none;">
<script data-tiddler-title="$:/boot/bootprefix.js" data-tiddler-type="application/javascript" type="text/javascript">/*\
title: $:/boot/bootprefix.js
type: application/javascript
This file sets up the globals that need to be available when JavaScript modules are executed in the browser. The overall sequence is:
# BootPrefix.js
# <module definitions>
# Boot.js
See Boot.js for further details of the boot process.
\*/
var _bootprefix = (function($tw) {
"use strict";
$tw = $tw || {browser: typeof(window) !== "undefined" ? {} : null};
/*
Information about each module is kept in an object with these members:
moduleType: type of module
definition: object, function or string defining the module; see below
exports: exports of the module, filled in after execution
The `definition` can be of several types:
* An object can be used to directly specify the exports of the module
* A function with the arguments `module,require,exports` that returns `exports`
* A string function body with the same arguments
Each moduleInfo object is stored in two hashmaps: $tw.modules.titles and $tw.modules.types. The first is indexed by title and the second is indexed by type and then title
*/
$tw.modules = {
titles: {}, // hashmap by module name of moduleInfo
types: {} // hashmap by module type and then name of moduleInfo
};
/*
Define a JavaScript tiddler module for later execution
moduleName: name of module being defined
moduleType: type of module
definition: module definition; see discussion above
*/
$tw.modules.define = function(moduleName,moduleType,definition) {
// Create the moduleInfo
var moduleInfo = {
moduleType: moduleType,
definition: definition,
exports: undefined
};
// If the definition is already an object we can use it as the exports
if(typeof moduleInfo.definition === "object") {
moduleInfo.exports = definition;
}
// Store the module in the titles hashmap
if(Object.prototype.hasOwnProperty.call($tw.modules.titles,moduleName)) {
console.log("Warning: Redefined module - " + moduleName);
}
$tw.modules.titles[moduleName] = moduleInfo;
// Store the module in the types hashmap
if(!Object.prototype.hasOwnProperty.call($tw.modules.types,moduleType)) {
$tw.modules.types[moduleType] = {};
}
if(Object.prototype.hasOwnProperty.call($tw.modules.types[moduleType],moduleName)) {
console.log("Warning: Redefined module - " + moduleName);
}
$tw.modules.types[moduleType][moduleName] = moduleInfo;
};
/*
External JavaScript can populate this array before calling boot.js in order to preload tiddlers
*/
$tw.preloadTiddlers = $tw.preloadTiddlers || [];
/*
Convenience function for pushing a tiddler onto the preloading array
*/
$tw.preloadTiddler = function(fields) {
$tw.preloadTiddlers.push(fields);
};
return $tw
});
if(typeof(exports) === "undefined") {
// Set up $tw global for the browser
window.$tw = _bootprefix();
} else {
// Export functionality as a module
exports.bootprefix = _bootprefix;
}
</script>
</div>
<!--~~ Static modules ~~-->
<div id="modules" style="display:none;">
</div>
<!--~~ Boot kernel ~~-->
<div id="bootKernel" style="display:none;">
<script data-tiddler-title="$:/boot/boot.js" data-tiddler-type="application/javascript" type="text/javascript">/*\
title: $:/boot/boot.js
type: application/javascript
The main boot kernel for TiddlyWiki. This single file creates a barebones TW environment that is just sufficient to bootstrap the modules containing the main logic of the application.
On the server this file is executed directly to boot TiddlyWiki. In the browser, this file is packed into a single HTML file along with other elements:
# bootprefix.js
# <module definitions>
# boot.js
The module definitions on the browser look like this:
$tw.defineModule("MyModule","moduletype",function(module,exports,require) {
// Module code inserted here
return exports;
});
In practice, each module is wrapped in a separate script block.
\*/
var _boot = (function($tw) {
/*jslint node: true, browser: true */
/*global modules: false, $tw: false */
"use strict";
// Include bootprefix if we're not given module data
if(!$tw) {
$tw = require("./bootprefix.js").bootprefix();
}
$tw.utils = $tw.utils || {};
$tw.boot = $tw.boot || {};
/////////////////////////// Standard node.js libraries
var fs, path, vm;
if(!$tw.browser) {
fs = require("fs");
path = require("path");
vm = require("vm");
}
/////////////////////////// Utility functions
/*
Log a message
*/
$tw.utils.log = function(/* args */) {
if(console !== undefined && console.log !== undefined) {
return Function.apply.call(console.log, console, arguments);
}
};
/*
Check if an object has a property
*/
$tw.utils.hop = function(object,property) {
return object ? Object.prototype.hasOwnProperty.call(object,property) : false;
};
/*
Determine if a value is an array
*/
$tw.utils.isArray = function(value) {
return Object.prototype.toString.call(value) == "[object Array]";
};
/*
Determine if a value is a date
*/
$tw.utils.isDate = function(value) {
return Object.prototype.toString.call(value) === "[object Date]";
};
/*
Iterate through all the own properties of an object or array. Callback is invoked with (element,title,object)
*/
$tw.utils.each = function(object,callback) {
var f;
if(object) {
if($tw.utils.isArray(object)) {
for(f=0; f<object.length; f++) {
callback(object[f],f,object);
}
} else {
for(f in object) {
if($tw.utils.hop(object,f)) {
callback(object[f],f,object);
}
}
}
}
};
/*
Helper for making DOM elements
tag: tag name
options: see below
Options include:
attributes: hashmap of attribute values
text: text to add as a child node
children: array of further child nodes
innerHTML: optional HTML for element
class: class name(s)
document: defaults to current document
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
*/
$tw.utils.domMaker = function(tag,options) {
var doc = options.document || document;
var element = doc.createElement(tag);
if(options["class"]) {
element.className = options["class"];
}
if(options.text) {
element.appendChild(document.createTextNode(options.text));
}
$tw.utils.each(options.children,function(child) {
element.appendChild(child);
});
if(options.innerHTML) {
element.innerHTML = options.innerHTML;
}
$tw.utils.each(options.attributes,function(attribute,name) {
element.setAttribute(name,attribute);
});
if(options.eventListeners) {
$tw.utils.addEventListeners(element,options.eventListeners);
}
return element;
};
/*
Display an error and exit
*/
$tw.utils.error = function(err) {
// Prepare the error message
var errHeading = "Internal JavaScript Error",
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser";
// Log the error to the console
console.error(err);
if($tw.browser) {
// Display an error message to the user
var dm = $tw.utils.domMaker,
heading = dm("h1",{text: errHeading}),
prompt = dm("div",{text: promptMsg, "class": "tw-error-prompt"}),
message = dm("div",{text: err}),
button = dm("button",{text: "close"}),
form = dm("form",{children: [heading,prompt,message,button], "class": "tw-error-form"});
document.body.insertBefore(form,document.body.firstChild);
form.addEventListener("submit",function(event) {
document.body.removeChild(form);
event.preventDefault();
return false;
},true);
return null;
} else {
// Exit if we're under node.js
process.exit(1);
}
};
/*
Use our custom error handler if we're in the browser
*/
if($tw.browser) {
window.onerror = function(errorMsg,url,lineNumber) {
$tw.utils.error(errorMsg);
return false;
};
}
/*
Extend an object with the properties from a list of source objects
*/
$tw.utils.extend = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) {
for (var p in source) {
object[p] = source[p];
}
}
});
return object;
};
/*
Fill in any null or undefined properties of an object with the properties from a list of source objects. Each property that is an object is called recursively
*/
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) {
for (var p in source) {
if(object[p] == null) {
object[p] = source[p];
}
if(typeof object[p] === "object" && typeof source[p] === "object") {
$tw.utils.deepDefaults(object[p],source[p]);
}
}
}
});
return object;
};
/*
Convert "&amp;" to &, "&nbsp;" to nbsp, "&lt;" to <, "&gt;" to > and "&quot;" to "
*/
$tw.utils.htmlDecode = function(s) {
return s.toString().replace(/&lt;/mg,"<").replace(/&nbsp;/mg,"\x40").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&");
};
/*
Pad a string to a given length with "0"s. Length defaults to 2
*/
$tw.utils.pad = function(value,length) {
length = length || 2;
var s = value.toString();
if(s.length < length) {
s = "000000000000000000000000000".substr(0,length - s.length) + s;
}
return s;
};
// Convert a date into UTC YYYYMMDDHHMMSSmmm format
$tw.utils.stringifyDate = function(value) {
return value.getUTCFullYear() +
$tw.utils.pad(value.getUTCMonth() + 1) +
$tw.utils.pad(value.getUTCDate()) +
$tw.utils.pad(value.getUTCHours()) +
$tw.utils.pad(value.getUTCMinutes()) +
$tw.utils.pad(value.getUTCSeconds()) +
$tw.utils.pad(value.getUTCMilliseconds(),3);
};
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
$tw.utils.parseDate = function(value) {
if(typeof value === "string") {
return new Date(Date.UTC(parseInt(value.substr(0,4),10),
parseInt(value.substr(4,2),10)-1,
parseInt(value.substr(6,2),10),
parseInt(value.substr(8,2)||"00",10),
parseInt(value.substr(10,2)||"00",10),
parseInt(value.substr(12,2)||"00",10),
parseInt(value.substr(14,3)||"000",10)));
} else if($tw.utils.isDate(value)) {
return value;
} else {
return null;
}
};
// Stringify an array of tiddler titles into a list string
$tw.utils.stringifyList = function(value) {
var result = [];
for(var t=0; t<value.length; t++) {
if(value[t].indexOf(" ") !== -1) {
result.push("[[" + value[t] + "]]");
} else {
result.push(value[t]);
}
}
return result.join(" ");
};
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"
$tw.utils.parseStringArray = function(value) {
if(typeof value === "string") {
var memberRegExp = /(?:^|\s)(?:\[\[(.*?)\]\])(?=\s|$)|(\S+)/mg,
results = [],
match;
do {
match = memberRegExp.exec(value);
if(match) {
var item = match[1] || match[2];
if(results.indexOf(item) === -1) {
results.push(item);
}
}
} while(match);
return results;
} else if($tw.utils.isArray(value)) {
return value;
} else {
return null;
}
};
// Parse a block of name:value fields. The `fields` object is used as the basis for the return value
$tw.utils.parseFields = function(text,fields) {
fields = fields || {};
text.split(/\r?\n/mg).forEach(function(line) {
if(line.charAt(0) !== "#") {
var p = line.indexOf(":");
if(p !== -1) {
var field = line.substr(0, p).trim(),
value = line.substr(p+1).trim();
fields[field] = value;
}
}
});
return fields;
};
/*
Resolves a source filepath delimited with `/` relative to a specified absolute root filepath.
In relative paths, the special folder name `..` refers to immediate parent directory, and the
name `.` refers to the current directory
*/
$tw.utils.resolvePath = function(sourcepath,rootpath) {
// If the source path starts with ./ or ../ then it is relative to the root
if(sourcepath.substr(0,2) === "./" || sourcepath.substr(0,3) === "../" ) {
var src = sourcepath.split("/"),
root = rootpath.split("/");
// Remove the filename part of the root
root.splice(root.length-1,1);
// Process the source path bit by bit onto the end of the root path
while(src.length > 0) {
var c = src.shift();
if(c === "..") { // Slice off the last root entry for a double dot
if(root.length > 0) {
root.splice(root.length-1,1);
}
} else if(c !== ".") { // Ignore dots
root.push(c); // Copy other elements across
}
}
return root.join("/");
} else {
// If it isn't relative, just return the path
if(rootpath) {
var root = rootpath.split("/");
// Remove the filename part of the root
root.splice(root.length - 1, 1);
return root.join("/") + "/" + sourcepath;
} else {
return sourcepath;
}
}
};
/*
Parse a semantic version string into its constituent parts
*/
$tw.utils.parseVersion = function(version) {
var match = /^((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/.exec(version);
if(match) {
return {
version: match[1],
major: parseInt(match[2],10),
minor: parseInt(match[3],10),
patch: parseInt(match[4],10),
prerelease: match[5],
build: match[6]
};
} else {
return null;
}
};
/*
Returns true if the version string A is greater than the version string B
*/
$tw.utils.checkVersions = function(versionStringA,versionStringB) {
var versionA = $tw.utils.parseVersion(versionStringA),
versionB = $tw.utils.parseVersion(versionStringB),
diff = [
versionA.major - versionB.major,
versionA.minor - versionB.minor,
versionA.patch - versionB.patch
];
return (diff[0] > 0) ||
(diff[0] === 0 && diff[1] > 0) ||
(diff[0] === 0 && diff[1] === 0 && diff[2] > 0);
};
/*
Register file type information
*/
$tw.utils.registerFileType = function(type,encoding,extension) {
$tw.config.fileExtensionInfo[extension] = {type: type};
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension};
};
/*
Run code globally with specified context variables in scope
*/
$tw.utils.evalGlobal = function(code,context,filename) {
var contextCopy = $tw.utils.extend({},context);
// Get the context variables as a pair of arrays of names and values
var contextNames = [], contextValues = [];
$tw.utils.each(contextCopy,function(value,name) {
contextNames.push(name);
contextValues.push(value);
});
// Add the code prologue and epilogue
code = "(function(" + contextNames.join(",") + ") {(function(){\n" + code + ";})();\nreturn exports;\n})\n";
// Compile the code into a function
var fn;
if($tw.browser) {
fn = window["eval"](code);
} else {
fn = vm.runInThisContext(code,filename);
}
// Call the function and return the exports
return fn.apply(null,contextValues);
};
/*
Run code in a sandbox with only the specified context variables in scope
*/
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) {
var sandbox = $tw.utils.extend({},context);
vm.runInNewContext(code,sandbox,filename);
return sandbox.exports;
};
/*
Creates a PasswordPrompt object
*/
$tw.utils.PasswordPrompt = function() {
// Store of pending password prompts
this.passwordPrompts = [];
// Create the wrapper
this.promptWrapper = $tw.utils.domMaker("div",{"class":"tw-password-wrapper"});
document.body.appendChild(this.promptWrapper);
// Hide the empty wrapper
this.setWrapperDisplay();
};
/*
Hides or shows the wrapper depending on whether there are any outstanding prompts
*/
$tw.utils.PasswordPrompt.prototype.setWrapperDisplay = function() {
if(this.passwordPrompts.length) {
this.promptWrapper.style.display = "block";
} else {
this.promptWrapper.style.display = "none";
}
};
/*
Adds a new password prompt. Options are:
submitText: text to use for submit button (defaults to "Login")
serviceName: text of the human readable service name
noUserName: set true to disable username prompt
callback: function to be called on submission with parameter of object {username:,password:}. Callback must return `true` to remove the password prompt
*/
$tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
// Create and add the prompt to the DOM
var submitText = options.submitText || "Login",
dm = $tw.utils.domMaker,
children = [dm("h1",{text: options.serviceName})];
if(!options.noUserName) {
children.push(dm("input",{
attributes: {type: "text", name: "username", placeholder: "Username"},
"class": "input-small"
}));
}
children.push(dm("input",{
attributes: {type: "password", name: "password", placeholder: "Password"},
"class": "input-small"
}));
children.push(dm("button",{
attributes: {type: "submit"},
text: submitText,
"class": "btn"
}));
var form = dm("form",{
"class": "form-inline",
attributes: {autocomplete: "off"},
children: children
});
this.promptWrapper.appendChild(form);
window.setTimeout(function() {
form.elements[0].focus();
},10);
// Add a submit event handler
var self = this;
form.addEventListener("submit",function(event) {
// Collect the form data
var data = {},t;
$tw.utils.each(form.elements,function(element) {
if(element.name && element.value) {
data[element.name] = element.value;
}
});
// Call the callback
if(options.callback(data)) {
// Remove the prompt if the callback returned true
var i = self.passwordPrompts.indexOf(promptInfo);
if(i !== -1) {
self.passwordPrompts.splice(i,1);
promptInfo.form.parentNode.removeChild(promptInfo.form);
self.setWrapperDisplay();
}
} else {
// Clear the password if the callback returned false
$tw.utils.each(form.elements,function(element) {
if(element.name === "password") {
element.value = "";
}
});
}
event.preventDefault();
return false;
},true);
// Add the prompt to the list
var promptInfo = {
serviceName: options.serviceName,
callback: options.callback,
form: form
};
this.passwordPrompts.push(promptInfo);
// Make sure the wrapper is displayed
this.setWrapperDisplay();
};
/*
Crypto helper object for encrypted content. It maintains the password text in a closure, and provides methods to change
the password, and to encrypt/decrypt a block of text
*/
$tw.utils.Crypto = function() {
var sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"),
password = null,
callSjcl = function(method,inputText) {
var outputText;
try {
outputText = sjcl[method](password,inputText);
} catch(ex) {
console.log("Crypto error:" + ex);
outputText = null;
}
return outputText;
};
this.setPassword = function(newPassword) {
password = newPassword;
this.updateCryptoStateTiddler();
};
this.updateCryptoStateTiddler = function() {
if($tw.wiki && $tw.wiki.addTiddler) {
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"}));
}
};
this.hasPassword = function() {
return !!password;
}
this.encrypt = function(text) {
return callSjcl("encrypt",text);
};
this.decrypt = function(text) {
return callSjcl("decrypt",text);
};
};
/////////////////////////// Module mechanism
/*
Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot'
*/
$tw.modules.execute = function(moduleName,moduleRoot) {
var name = moduleName[0] === "." ? $tw.utils.resolvePath(moduleName,moduleRoot) : moduleName,
moduleInfo = $tw.modules.titles[name] || $tw.modules.titles[name + ".js"] || $tw.modules.titles[moduleName] || $tw.modules.titles[moduleName + ".js"] ,
tiddler = $tw.wiki.getTiddler(name) || $tw.wiki.getTiddler(name + ".js") || $tw.wiki.getTiddler(moduleName) || $tw.wiki.getTiddler(moduleName + ".js") ,
_exports = {},
sandbox = {
module: {},
//moduleInfo: moduleInfo,
exports: _exports,
console: console,
setInterval: setInterval,
clearInterval: clearInterval,
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Buffer: $tw.browser ? {} : Buffer,
$tw: $tw,
require: function(title) {
return $tw.modules.execute(title, name);
}
};
Object.defineProperty(sandbox.module, "id", {
value: name,
writable: false,
enumerable: true,
configurable: false
});
if(!$tw.browser) {
$tw.utils.extend(sandbox,{
process: process
});
} else {
/*
CommonJS optional require.main property:
In a browser we offer a fake main module which points back to the boot function
(Theoretically, this may allow TW to eventually load itself as a module in the browser)
*/
Object.defineProperty(sandbox.require, "main", {
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
writable: false,
enumerable: true,
configurable: false
});
}
if(!moduleInfo) {
// We could not find the module on this path
// Try to defer to browserify etc, or node
var deferredModule;
if($tw.browser) {
if(window.require) {
try {
return window.require(moduleName);
} catch(e) {}
}
throw "Cannot find module named '" + moduleName + "' required by module '" + moduleRoot + "', resolved to " + name;
} else {
// If we don't have a module with that name, let node.js try to find it
return require(moduleName);
}
}
// Execute the module if we haven't already done so
if(!moduleInfo.exports) {
try {
// Check the type of the definition
if(typeof moduleInfo.definition === "function") { // Function
moduleInfo.exports = _exports;
moduleInfo.definition(moduleInfo,moduleInfo.exports,sandbox.require);
} else if(typeof moduleInfo.definition === "string") { // String
moduleInfo.exports = _exports;
$tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title);
} else { // Object
moduleInfo.exports = moduleInfo.definition;
}
} catch(e) {
$tw.utils.error("Error executing boot module " + name + ":\n" + e);
}
}
// Return the exports of the module
return moduleInfo.exports;
};
/*
Apply a callback to each module of a particular type
moduleType: type of modules to enumerate
callback: function called as callback(title,moduleExports) for each module
*/
$tw.modules.forEachModuleOfType = function(moduleType,callback) {
var modules = $tw.modules.types[moduleType];
$tw.utils.each(modules,function(element,title,object) {
callback(title,$tw.modules.execute(title));
});
};
/*
Get all the modules of a particular type in a hashmap by their `name` field
*/
$tw.modules.getModulesByTypeAsHashmap = function(moduleType,nameField) {
nameField = nameField || "name";
var results = {};
$tw.modules.forEachModuleOfType(moduleType,function(title,module) {
results[module[nameField]] = module;
});
return results;
};
/*
Apply the exports of the modules of a particular type to a target object
*/
$tw.modules.applyMethods = function(moduleType,targetObject) {
if(!targetObject) {
targetObject = {};
}
$tw.modules.forEachModuleOfType(moduleType,function(title,module) {
$tw.utils.each(module,function(element,title,object) {
targetObject[title] = module[title];
});
});
return targetObject;
};
/*
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class
*/
$tw.modules.createClassesFromModules = function(moduleType,subType,baseClass) {
var classes = {};
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
if(!subType || moduleExports.types[subType]) {
var newClass = function() {};
if(baseClass) {
newClass.prototype = new baseClass();
newClass.prototype.constructor = baseClass;
}
$tw.utils.extend(newClass.prototype,moduleExports);
classes[moduleExports.name] = newClass;
}
});
return classes;
};
/////////////////////////// Barebones tiddler object
/*
Construct a tiddler object from a hashmap of tiddler fields. If multiple hasmaps are provided they are merged,
taking precedence to the right
*/
$tw.Tiddler = function(/* [fields,] fields */) {
this.fields = {};
for(var c=0; c<arguments.length; c++) {
var arg = arguments[c],
src = (arg instanceof $tw.Tiddler) ? arg.fields : arg;
for(var t in src) {
if(src[t] === undefined) {
if(t in this.fields) {
delete this.fields[t]; // If we get a field that's undefined, delete any previous field value
}
} else {
// Parse the field with the associated field module (if any)
var fieldModule = $tw.Tiddler.fieldModules[t];
if(fieldModule && fieldModule.parse) {
this.fields[t] = fieldModule.parse.call(this,src[t]);
} else {
this.fields[t] = src[t];
}
}
}
}
};
$tw.Tiddler.prototype.hasField = function(field) {
return $tw.utils.hop(this.fields,field);
};
/*
Register and install the built in tiddler field modules
*/
$tw.modules.define("$:/boot/tiddlerfields/modified","tiddlerfield",{
name: "modified",
parse: $tw.utils.parseDate,
stringify: $tw.utils.stringifyDate
});
$tw.modules.define("$:/boot/tiddlerfields/created","tiddlerfield",{
name: "created",
parse: $tw.utils.parseDate,
stringify: $tw.utils.stringifyDate
});
$tw.modules.define("$:/boot/tiddlerfields/color","tiddlerfield",{
name: "color",
editTag: "input",
editType: "color"
});
$tw.modules.define("$:/boot/tiddlerfields/tags","tiddlerfield",{
name: "tags",
parse: $tw.utils.parseStringArray,
stringify: $tw.utils.stringifyList
});
$tw.modules.define("$:/boot/tiddlerfields/list","tiddlerfield",{
name: "list",
parse: $tw.utils.parseStringArray,
stringify: $tw.utils.stringifyList
});
/////////////////////////// Barebones wiki store
/*
Construct a wiki store object
*/
$tw.Wiki = function() {
this.tiddlers = {};
this.plugins = []; // Array of registered plugins, ordered by priority
this.shadowTiddlers = {}; // Hashmap by title of {source:, tiddler:}
};
$tw.Wiki.prototype.addTiddler = function(tiddler) {
if(!(tiddler instanceof $tw.Tiddler)) {
tiddler = new $tw.Tiddler(tiddler);
}
if(tiddler.fields.title) {
this.tiddlers[tiddler.fields.title] = tiddler;
}
};
$tw.Wiki.prototype.addTiddlers = function(tiddlers) {
for(var t=0; t<tiddlers.length; t++) {
this.addTiddler(tiddlers[t]);
}
};
/*
Register the plugin tiddlers of a particular type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected
*/
$tw.Wiki.prototype.registerPluginTiddlers = function(pluginType,titles) {
var self = this,
registeredTitles = [];
// Go through the provided titles, or the entire tiddler list, looking for plugins of this type
var checkTiddler = function(tiddler) {
if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] === pluginType) {
self.plugins.push(tiddler);
registeredTitles.push(tiddler.fields.title);
}
};
if(titles) {
$tw.utils.each(titles,function(title) {
checkTiddler(self.getTiddler(title));
});
} else {
$tw.utils.each(this.tiddlers,function(tiddler,title) {
checkTiddler(tiddler);
});
}
return registeredTitles;
};
/*
Unregister the plugin tiddlers of a particular type, returning an array of the titles affected
*/
$tw.Wiki.prototype.unregisterPluginTiddlers = function(pluginType) {
var self = this,
titles = [];
// Remove any previous registered plugins of this type
for(var t=this.plugins.length-1; t>=0; t--) {
var tiddler = this.plugins[t];
if(tiddler.fields["plugin-type"] === pluginType) {
titles.push(tiddler.fields.title);
this.plugins.splice(t,1);
}
}
return titles;
};
/*
Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
*/
$tw.Wiki.prototype.unpackPluginTiddlers = function() {
var self = this;
// Sort the plugin titles by the `plugin-priority` field
this.plugins.sort(function(a,b) {
if("plugin-priority" in a.fields && "plugin-priority" in b.fields) {
return a.fields["plugin-priority"] - b.fields["plugin-priority"];
} else if("plugin-priority" in a.fields) {
return -1;
} else if("plugin-priority" in b.fields) {
return +1;
} else if(a.fields.title < b.fields.title) {
return -1;
} else if(a.fields.title === b.fields.title) {
return 0;
} else {
return +1;
}
});
// Now go through the plugins in ascending order and assign the shadows
this.shadowTiddlers = {};
$tw.utils.each(this.plugins,function(tiddler) {
// Get the plugin information
var pluginInfo = JSON.parse(tiddler.fields.text);
// Extract the constituent tiddlers
$tw.utils.each(pluginInfo.tiddlers,function(constituentTiddler,constituentTitle) {
// Save the tiddler object
if(constituentTitle) {
self.shadowTiddlers[constituentTitle] = {
source: tiddler.fields.title,
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
}
});
});
};
/*
Define all modules stored in ordinary tiddlers
*/
$tw.Wiki.prototype.defineTiddlerModules = function() {
$tw.utils.each(this.tiddlers,function(tiddler,title,object) {
if(tiddler.hasField("module-type")) {
switch (tiddler.fields.type) {
case "application/javascript":
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
}
break;
case "application/json":
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],JSON.parse(tiddler.fields.text));
break;
case "application/x-tiddler-dictionary":
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text));
break;
}
}
});
};
/*
Register all the module tiddlers that have a module type
*/
$tw.Wiki.prototype.defineShadowModules = function() {
var self = this;
$tw.utils.each(this.shadowTiddlers,function(element,title) {
var tiddler = self.getTiddler(title);
if(!$tw.utils.hop(self.tiddlers,title)) { // Don't define the module if it is overidden by an ordinary tiddler
if(tiddler.hasField("module-type")) {
// Define the module
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
}
}
});
};
$tw.Wiki.prototype.getTiddler = function(title) {
var t = this.tiddlers[title];
if(t instanceof $tw.Tiddler) {
return t;
} else if(title !== undefined && $tw.utils.hop(this.shadowTiddlers,title)) {
return this.shadowTiddlers[title].tiddler;
} else {
return undefined;
}
};
/*
Extracts tiddlers from a typed block of text, specifying default field values
*/
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) {
srcFields = srcFields || {};
var deserializer = $tw.Wiki.tiddlerDeserializerModules[type],
fields = {};
if(!deserializer && $tw.config.fileExtensionInfo[type]) {
// If we didn't find the serializer, try converting it from an extension to a content type
type = $tw.config.fileExtensionInfo[type].type;
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
}
if(!deserializer) {
// If we still don't have a deserializer, treat it as plain text
deserializer = $tw.Wiki.tiddlerDeserializerModules["text/plain"];
}
for(var f in srcFields) {
fields[f] = srcFields[f];
}
if(deserializer) {
return deserializer.call(this,text,fields,type);
} else {
// Return a raw tiddler for unknown types
fields.text = text;
return [fields];
}
};
/*
Register the built in tiddler deserializer modules
*/
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
"application/javascript": function(text,fields) {
var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"),
match = headerCommentRegExp.exec(text);
fields.text = text;
if(match) {
fields = $tw.utils.parseFields(match[1].split(/\r?\n\r?\n/mg)[0],fields);
}
return [fields];
}
});
$tw.modules.define("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{
"application/x-tiddler": function(text,fields) {
var split = text.split(/\r?\n\r?\n/mg);
if(split.length >= 1) {
fields = $tw.utils.parseFields(split[0],fields);
}
if(split.length >= 2) {
fields.text = split.slice(1).join("\n\n");
} else {
fields.text = "";
}
return [fields];
}
});
$tw.modules.define("$:/boot/tiddlerdeserializer/txt","tiddlerdeserializer",{
"text/plain": function(text,fields,type) {
fields.text = text;
fields.type = type || "text/plain";
return [fields];
}
});
$tw.modules.define("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{
"text/html": function(text,fields) {
fields.text = text;
fields.type = "text/html";
return [fields];
}
});
$tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
"application/json": function(text,fields) {
var tiddlers = JSON.parse(text);
return tiddlers;
}
});
/////////////////////////// Browser definitions
if($tw.browser) {
/*
Decrypt any tiddlers stored within the element with the ID "encryptedArea". The function is asynchronous to allow the user to be prompted for a password
callback: function to be called the decryption is complete
*/
$tw.boot.decryptEncryptedTiddlers = function(callback) {
var encryptedArea = document.getElementById("encryptedStoreArea");
if(encryptedArea) {
var encryptedText = encryptedArea.innerHTML;
// Prompt for the password
$tw.passwordPrompt.createPrompt({
serviceName: "Enter a password to decrypt this TiddlyWiki",
noUserName: true,
submitText: "Decrypt",
callback: function(data) {
// Attempt to decrypt the tiddlers
$tw.crypto.setPassword(data.password);
var decryptedText = $tw.crypto.decrypt(encryptedText);
if(decryptedText) {
var json = JSON.parse(decryptedText);
for(var title in json) {
$tw.preloadTiddler(json[title]);
}
// Call the callback
callback();
// Exit and remove the password prompt
return true;
} else {
// We didn't decrypt everything, so continue to prompt for password
return false;
}
}
});
} else {
// Just invoke the callback straight away if there weren't any encrypted tiddlers
callback();
}
};
/*
Register a deserializer that can extract tiddlers from the DOM
*/
$tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
"(DOM)": function(node) {
var extractTextTiddlers = function(node) {
var e = node.firstChild;
while(e && e.nodeName.toLowerCase() !== "pre") {
e = e.nextSibling;
}
var title = node.getAttribute ? node.getAttribute("title") : null;
if(e && title) {
var attrs = node.attributes,
tiddler = {
text: $tw.utils.htmlDecode(e.innerHTML)
};
for(var i=attrs.length-1; i >= 0; i--) {
tiddler[attrs[i].name] = attrs[i].value;
}
return [tiddler];
} else {
return null;
}
},
extractModuleTiddlers = function(node) {
if(node.hasAttribute && node.hasAttribute("data-tiddler-title")) {
var text = node.innerHTML,
s = text.indexOf("{"),
e = text.lastIndexOf("}");
if(node.hasAttribute("data-module") && s !== -1 && e !== -1) {
text = text.substring(s+1,e);
}
var fields = {text: text},
attributes = node.attributes;
for(var a=0; a<attributes.length; a++) {
if(attributes[a].nodeName.substr(0,13) === "data-tiddler-") {
fields[attributes[a].nodeName.substr(13)] = attributes[a].value;
}
}
return [fields];
} else {
return null;
}
},
t,result = [];
if(node) {
for(t = 0; t < node.childNodes.length; t++) {
var childNode = node.childNodes[t],
tiddlers = extractTextTiddlers(childNode);
tiddlers = tiddlers || extractModuleTiddlers(childNode);
if(tiddlers) {
result.push.apply(result,tiddlers);
}
}
}
return result;
}
});
$tw.loadTiddlers = function() {
// In the browser, we load tiddlers from certain elements
var containerIds = [
"libraryModules",
"modules",
"bootKernelPrefix",
"bootKernel",
"styleArea",
"storeArea",
"systemArea"
];
for(var t=0; t<containerIds.length; t++) {
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
}
// Load any preloaded tiddlers
if($tw.preloadTiddlers) {
$tw.wiki.addTiddlers($tw.preloadTiddlers);
}
};
// End of if($tw.browser)
}
/////////////////////////// Server definitions
if(!$tw.browser) {
/*
Get any encrypted tiddlers
*/
$tw.boot.decryptEncryptedTiddlers = function(callback) {
// Storing encrypted tiddlers on the server isn't supported yet
callback();
};
/*
Load the tiddlers contained in a particular file (and optionally extract fields from the accompanying .meta file) returned as {filepath:,type:,tiddlers:[],hasMetaFile:}
*/
$tw.loadTiddlersFromFile = function(filepath,fields) {
var ext = path.extname(filepath),
extensionInfo = $tw.config.fileExtensionInfo[ext],
type = extensionInfo ? extensionInfo.type : null,
typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"),
tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields),
metafile = filepath + ".meta",
metadata;
if(ext !== ".json" && tiddlers.length === 1 && fs.existsSync(metafile)) {
metadata = fs.readFileSync(metafile,"utf8");
if(metadata) {
tiddlers = [$tw.utils.parseFields(metadata,tiddlers[0])];
}
}
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
};
/*
A default set of files for TiddlyWiki to ignore during load.
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
metadata files.
*/
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
/*
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
*/
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
var tiddlers = [];
if(fs.existsSync(filepath)) {
var stat = fs.statSync(filepath);
if(stat.isDirectory()) {
var files = fs.readdirSync(filepath);
// Look for a tiddlywiki.files file
if(files.indexOf("tiddlywiki.files") !== -1) {
// If so, process the files it describes
var filesInfo = JSON.parse(fs.readFileSync(filepath + "/tiddlywiki.files","utf8"));
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
var typeInfo = $tw.config.contentTypeInfo[tidInfo.fields.type || "text/plain"],
pathname = path.resolve(filepath,tidInfo.file),
text = fs.readFileSync(pathname,typeInfo ? typeInfo.encoding : "utf8");
if(tidInfo.prefix) {
text = tidInfo.prefix + text;
}
if(tidInfo.suffix) {
text = text + tidInfo.suffix;
}
tidInfo.fields.text = text;
tiddlers.push({tiddlers: [tidInfo.fields]});
});
} else {
// If not, read all the files in the directory
$tw.utils.each(files,function(file) {
if(!excludeRegExp.test(file)) {
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + "/" + file,excludeRegExp));
}
});
}
} else if(stat.isFile()) {
tiddlers.push($tw.loadTiddlersFromFile(filepath));
}
}
return tiddlers;
};
/*
Load the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler
*/
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t;
if(fs.existsSync(filepath)) {
stat = fs.statSync(filepath);
if(stat.isDirectory()) {
// Read the plugin information
pluginInfo = JSON.parse(fs.readFileSync(filepath + "/plugin.info","utf8"));
// Read the plugin files
files = fs.readdirSync(filepath);
for(f=0; f<files.length; f++) {
file = files[f];
if(!excludeRegExp.test(file) && file !== "plugin.info" && file !== "tiddlywiki.files") {
var tiddlerFiles = $tw.loadTiddlersFromPath(filepath + "/" + file,excludeRegExp);
$tw.utils.each(tiddlerFiles,function(tiddlerFile) {
pluginTiddlers.push.apply(pluginTiddlers,tiddlerFile.tiddlers);
});
}
}
// Save the plugin tiddlers into the plugin info
pluginInfo.tiddlers = pluginInfo.tiddlers || {};
for(t=0; t<pluginTiddlers.length; t++) {
if(pluginTiddlers[t].title) {
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
}
}
}
}
// Give the plugin the same version number as the core if it doesn't have one
if(!("version" in pluginInfo)) {
pluginInfo.version = $tw.packageInfo.version;
}
// Save the plugin tiddler
if(pluginInfo) {
var fields = {
title: pluginInfo.title,
type: "application/json",
text: JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4),
"plugin-priority": pluginInfo["plugin-priority"],
"name": pluginInfo["name"],
"version": pluginInfo["version"],
"thumbnail": pluginInfo["thumbnail"],
"description": pluginInfo["description"],
"plugin-type": pluginInfo["plugin-type"] || "plugin",
"dependents": $tw.utils.stringifyList(pluginInfo["dependents"] || [])
}
return fields;
} else {
return null;
}
};
/*
Fallback tiddlywiki.info content
*/
$tw.boot.defaultWikiInfo = {
"plugins": [
"tiddlywiki/tiddlyweb",
"tiddlywiki/filesystem"
],
"themes": [
"tiddlywiki/vanilla",
"tiddlywiki/snowwhite"
]
};
/*
path: path of wiki directory
parentPaths: array of parent paths that we mustn't recurse into
*/
$tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
parentPaths = parentPaths || [];
var wikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo),
wikiInfo,
pluginFields;
// Bail if we don't have a wiki info file
if(fs.existsSync(wikiInfoPath)) {
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
} else {
wikiInfo = $tw.boot.defaultWikiInfo;
}
// Load any parent wikis
if(wikiInfo.includeWikis) {
parentPaths = parentPaths.slice(0);
parentPaths.push(wikiPath);
$tw.utils.each(wikiInfo.includeWikis,function(includedWikiPath) {
var resolvedIncludedWikiPath = path.resolve(wikiPath,includedWikiPath);
if(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) {
$tw.loadWikiTiddlers(resolvedIncludedWikiPath,parentPaths);
} else {
$tw.utils.error("Cannot recursively include wiki " + resolvedIncludedWikiPath);
}
});
}
// Load any plugins listed in the wiki info file
if(wikiInfo.plugins) {
var pluginBasePath = path.resolve($tw.boot.corePath,$tw.config.pluginsPath);
for(var t=0; t<wikiInfo.plugins.length; t++) {
pluginFields = $tw.loadPluginFolder(path.resolve(pluginBasePath,"./" + wikiInfo.plugins[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
// Load any themes listed in the wiki info file
if(wikiInfo.themes) {
var themesBasePath = path.resolve($tw.boot.corePath,$tw.config.themesPath);
for(var t=0; t<wikiInfo.themes.length; t++) {
pluginFields = $tw.loadPluginFolder(path.resolve(themesBasePath,"./" + wikiInfo.themes[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
// Load the wiki files, registering them as writable
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
if(tiddlerFile.filepath) {
$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) {
$tw.boot.files[tiddler.title] = {
filepath: tiddlerFile.filepath,
type: tiddlerFile.type,
hasMetaFile: tiddlerFile.hasMetaFile
};
});
}
});
// Save the path to the tiddlers folder for the filesystemadaptor
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir);
// Load any plugins within the wiki folder
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
if(fs.existsSync(wikiPluginsPath)) {
var pluginFolders = fs.readdirSync(wikiPluginsPath);
for(t=0; t<pluginFolders.length; t++) {
pluginFields = $tw.loadPluginFolder(path.resolve(wikiPluginsPath,"./" + pluginFolders[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
// Load any themes within the wiki folder
var wikiThemesPath = path.resolve(wikiPath,$tw.config.wikiThemesSubDir);
if(fs.existsSync(wikiThemesPath)) {
var themeFolders = fs.readdirSync(wikiThemesPath);
for(t=0; t<themeFolders.length; t++) {
pluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,"./" + themeFolders[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
return wikiInfo;
};
$tw.loadTiddlers = function() {
// Load the boot tiddlers
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
});
// Load the core tiddlers
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath));
// Load the tiddlers from the wiki directory
if($tw.boot.wikiPath) {
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);
}
};
// End of if(!$tw.browser)
}
/////////////////////////// Main startup function called once tiddlers have been decrypted
$tw.boot.startup = function() {
// Initialise some more $tw properties
$tw.utils.deepDefaults($tw,{
modules: { // Information about each module
titles: {}, // hashmap by module title of {fn:, exports:, moduleType:}
types: {} // hashmap by module type of hashmap of exports
},
config: { // Configuration overridables
pluginsPath: "../plugins/",
themesPath: "../themes/",
wikiInfo: "./tiddlywiki.info",
wikiPluginsSubDir: "./plugins",
wikiThemesSubDir: "./themes",
wikiTiddlersSubDir: "./tiddlers",
jsModuleHeaderRegExpString: "^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)",
fileExtensionInfo: {}, // Map file extension to {type:}
contentTypeInfo: {} // Map type to {encoding:,extension:}
}
});
if(!$tw.browser) {
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
$tw.boot.files = {};
// System paths and filenames
$tw.boot.bootPath = path.dirname(module.filename);
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
// If the first command line argument doesn't start with `--` then we
// interpret it as the path to the wiki folder, which will otherwise default
// to the current folder
if($tw.boot.argv[0] === "*") {
$tw.boot.wikiPath = undefined;
$tw.boot.argv = $tw.boot.argv.slice(1);
} else if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) {
$tw.boot.wikiPath = $tw.boot.argv[0];
$tw.boot.argv = $tw.boot.argv.slice(1);
} else {
$tw.boot.wikiPath = process.cwd();
}
// Read package info
$tw.packageInfo = require("../package");
// Check node version number
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) {
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engines.node);
}
}
// Add file extension information
$tw.utils.registerFileType("text/vnd.tiddlywiki","utf8",".tid");
$tw.utils.registerFileType("application/x-tiddler","utf8",".tid");
$tw.utils.registerFileType("application/x-tiddler-html-div","utf8",".tiddler");
$tw.utils.registerFileType("text/vnd.tiddlywiki2-recipe","utf8",".recipe");
$tw.utils.registerFileType("text/plain","utf8",".txt");
$tw.utils.registerFileType("text/css","utf8",".css");
$tw.utils.registerFileType("text/html","utf8",".html");
$tw.utils.registerFileType("application/javascript","utf8",".js");
$tw.utils.registerFileType("application/json","utf8",".json");
$tw.utils.registerFileType("application/pdf","base64",".pdf");
$tw.utils.registerFileType("image/jpeg","base64",".jpg");
$tw.utils.registerFileType("image/png","base64",".png");
$tw.utils.registerFileType("image/gif","base64",".gif");
$tw.utils.registerFileType("image/svg+xml","utf8",".svg");
$tw.utils.registerFileType("image/x-icon","base64",".ico");
$tw.utils.registerFileType("application/font-woff","base64",".woff");
// Create the wiki store for the app
$tw.wiki = new $tw.Wiki();
// Install built in tiddler fields modules
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
// Install the tiddler deserializer modules
$tw.Wiki.tiddlerDeserializerModules = {};
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
// Load tiddlers
$tw.loadTiddlers();
// Unpack plugin tiddlers
$tw.wiki.registerPluginTiddlers("plugin");
$tw.wiki.unpackPluginTiddlers();
// Register typed modules from the tiddlers we've just loaded
$tw.wiki.defineTiddlerModules();
// And any modules within plugins
$tw.wiki.defineShadowModules();
// Make sure the crypto state tiddler is up to date
$tw.crypto.updateCryptoStateTiddler();
// Run any startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {
if(module.startup) {
module.startup();
}
});
};
/////////////////////////// Main boot function to decrypt tiddlers and then startup
$tw.boot.boot = function() {
// Initialise crypto object
$tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter
if($tw.browser) {
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
}
// Preload any encrypted tiddlers
$tw.boot.decryptEncryptedTiddlers(function() {
// Startup
$tw.boot.startup();
});
};
/////////////////////////// Autoboot in the browser
if($tw.browser) {
$tw.boot.boot();
}
return $tw;
});
if(typeof(exports) !== "undefined") {
exports.TiddlyWiki = _boot;
} else {
_boot(window.$tw);
}
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment