!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("tiddlywiki",function(){var i={},n={allTags:!0,closeAll:!0,list:!0,newJournal:!0,newTiddler:!0,permaview:!0,saveChanges:!0,search:!0,slider:!0,tabs:!0,tag:!0,tagging:!0,tags:!0,tiddler:!0,timeline:!0,today:!0,version:!0,option:!0,with:!0,filter:!0},o=/[\w_\-]/i,u=/^\-\-\-\-+$/,a=/^\/\*\*\*$/,f=/^\*\*\*\/$/,c=/^<<<$/,l=/^\/\/\{\{\{$/,m=/^\/\/\}\}\}$/,k=/^<!--\{\{\{-->$/,d=/^<!--\}\}\}-->$/,h=/^\{\{\{$/,s=/^\}\}\}$/,b=/.*?\}\}\}/;function p(e,t,r){return(t.tokenize=r)(e,t)}function $(e,t){var r=e.sol(),n=e.peek();if(t.block=!1,r&&/[<\/\*{}\-]/.test(n)){if(e.match(h))return t.block=!0,p(e,t,x);if(e.match(c))return"quote";if(e.match(a)||e.match(f))return"comment";if(e.match(l)||e.match(m)||e.match(k)||e.match(d))return"comment";if(e.match(u))return"hr"}if(e.next(),r&&/[\/\*!#;:>|]/.test(n)){if("!"==n)return e.skipToEnd(),"header";if("*"==n)return e.eatWhile("*"),"comment";if("#"==n)return e.eatWhile("#"),"comment";if(";"==n)return e.eatWhile(";"),"comment";if(":"==n)return e.eatWhile(":"),"comment";if(">"==n)return e.eatWhile(">"),"quote";if("|"==n)return"header"}if("{"==n&&e.match("{{"))return p(e,t,x);if(/[hf]/i.test(n)&&/[ti]/i.test(e.peek())&&e.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return"link";if('"'==n)return"string";if("~"==n)return"brace";if(/[\[\]]/.test(n)&&e.match(n))return"brace";if("@"==n)return e.eatWhile(o),"link";if(/\d/.test(n))return e.eatWhile(/\d/),"number";if("/"==n){if(e.eat("%"))return p(e,t,v);if(e.eat("/"))return p(e,t,y)}if("_"==n&&e.eat("_"))return p(e,t,z);if("-"==n&&e.eat("-")){if(" "!=e.peek())return p(e,t,g);if(" "==e.peek())return"brace"}return"'"==n&&e.eat("'")?p(e,t,w):"<"==n&&e.eat("<")?p(e,t,W):(e.eatWhile(/[\w\$_]/),i.propertyIsEnumerable(e.current())?"keyword":null)}function v(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=$;break}n="%"==r}return"comment"}function w(e,t){for(var r,n=!1;r=e.next();){if("'"==r&&n){t.tokenize=$;break}n="'"==r}return"strong"}function x(e,t){var r=t.block;return r&&e.current()||(!r&&e.match(b)||r&&e.sol()&&e.match(s)?t.tokenize=$:e.next()),"comment"}function y(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=$;break}n="/"==r}return"em"}function z(e,t){for(var r,n=!1;r=e.next();){if("_"==r&&n){t.tokenize=$;break}n="_"==r}return"underlined"}function g(e,t){for(var r,n=!1;r=e.next();){if("-"==r&&n){t.tokenize=$;break}n="-"==r}return"strikethrough"}function W(e,t){if("<<"==e.current())return"macro";var r=e.next();return r?">"==r&&">"==e.peek()?(e.next(),t.tokenize=$,"macro"):(e.eatWhile(/[\w\$_]/),n.propertyIsEnumerable(e.current())?"keyword":null):(t.tokenize=$,null)}return{startState:function(){return{tokenize:$}},token:function(e,t){return e.eatSpace()?null:t.tokenize(e,t)}}}),e.defineMIME("text/x-tiddlywiki","tiddlywiki")});