2023-04-27 17:35:20 +02:00
<!doctype html>
<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->
<!-- saved from url=(0021)https://tiddlywiki.com -->
< html lang = "en-GB" >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=utf-8" / >
<!-- ~~ Raw markup for the top of the head section ~~ -->
< meta http-equiv = "X-UA-Compatible" content = "IE=Edge" / >
< meta name = "application-name" content = "TiddlyWiki" / >
< meta name = "generator" content = "TiddlyWiki" / >
< meta name = "tiddlywiki-version" content = "5.2.7" / >
< 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 = "mobile-web-app-capable" content = "yes" / >
< meta name = "format-detection" content = "telephone=no" / >
< meta name = "copyright" content = "TiddlyWiki created by Jeremy Ruston , ( jeremy [ at ] jermolene [ dot ] com )
Copyright (c) 2004-2007, Jeremy Ruston
Copyright (c) 2007-2023, UnaMesa Association
All rights reserved.
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 copyright holder 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 HOLDER 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" >
2023-04-28 14:21:22 +02:00
< title > XR Fragments — protocol for surfing 3D assets (unhosted)
Home
2023-04-28 17:16:13 +02:00
How it works
< / title >
2023-04-27 17:35:20 +02:00
<!-- ~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~ -->
<!-- ~~ Raw markup ~~ -->
<!-- aframe v1.4.0 -->
< script >
/*! For license information please see aframe.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports& & "object"==typeof module?module.exports=t():"function"==typeof define& & define.amd?define([],t):"object"==typeof exports?exports.AFRAME=t():e.AFRAME=t()}(self,(()=>(()=>{var e={651:()=>{!function(){"use strict";var e=function(e,t){var n=function(e){for(var t=0,n=e.length;t< n ; t + + ) i ( e [ t ] ) } , i = function(e){var t = e.target,n=e.attributeName,i=e.oldValue;t.attributeChangedCallback(n,i,t.getAttribute(n))};return function ( r , s ) { var o = r.constructor.observedAttributes;return o & & e ( s ) . then ( ( function ( ) { new t ( n ) . observe ( r , { attributes: ! 0 , attributeOldValue: ! 0 , attributeFilter:o } ) ; for ( var e = 0,s=o.length;e<s;e++)r.hasAttribute(o[e])&&i({target:r,attributeName:o[e],oldValue:null})})),r}};function t ( e , t ) { ( null = =t||t > e.length)&&(t=e.length); for(var n=0,i=new Array(t);n< t ; n + + ) i [ n ] = e [ n ] ; return i } function n ( e , n ) { var i = "undefined" ! = typeof Symbol & & e [ Symbol . iterator ] | | e [ " @ @ iterator " ] ; if ( ! i ) { if ( Array . isArray ( e ) | | ( i = function(e,n){if(e){if("string"==typeof e ) return t ( e , n ) ; var i = Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?t(e,n):void 0 } } ( e ) ) | | n & & e & & " number " = = typeof e . length ) { i & & ( e = i);var r = 0,s=function(){};return{s,n:function(){return r > =e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}var i=!0,r=!1,s="querySelectorAll",o="querySelectorAll",a=self,l=a.document,c=a.Element,h=a.MutationObserver,u=a.Set,d=a.WeakMap,p=function(e){return o in e},A=[].filter,f=function(e){var t=new d,a=function(n,i){var r;if(i)for(var s,o=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(n),a=0,l=m.length;a< l ; a + + ) o . call ( n , s = m[a])&&(t.has(n)||t.set(n,new u ) , ( r = t.get(n)).has(s)||(r.add(s),e.handle(n,i,s)));else t . has ( n ) & & ( r = t.get(n),t.delete(n),r.forEach((function(t){e.handle(n,i,t)})))},f=function(e){for(var t = !(arguments.length > 1& & void 0!==arguments[1])||arguments[1],n=0,i=e.length;n< i ; n + + ) a ( e [ n ] , t ) } , m = e.query,g=e.root||l,v=function(e){var t = arguments.length > 1& & void 0!==arguments[1]?arguments[1]:document,o=arguments.length>2& & void 0!==arguments[2]?arguments[2]:MutationObserver,a=arguments.length>3& & void 0!==arguments[3]?arguments[3]:["*"],l=function t(r,o,a,l,c,h){var u,d=n(r);try{for(d.s();!(u=d.n()).done;){var p=u.value;(h||s in p)& & (c?a.has(p)||(a.add(p),l.delete(p),e(p,c)):l.has(p)||(l.add(p),a.delete(p),e(p,c)),h||t(p[s](o),o,a,l,c,i))}}catch(e){d.e(e)}finally{d.f()}},c=new o((function(e){if(a.length){var t,s=a.join(","),o=new Set,c=new Set,h=n(e);try{for(h.s();!(t=h.n()).done;){var u=t.value,d=u.addedNodes,p=u.removedNodes;l(p,s,o,c,r,r),l(d,s,o,c,i,r)}}catch(e){h.e(e)}finally{h.f()}}})),h=c.observe;return(c.observe=function(e){return h.call(c,e,{subtree:i,childList:i})})(t),c}(a,g,h,m),y=c.prototype.attachShadow;return y& & (c.prototype.attachShadow=function(e){var t=y.call(this,e);return v.observe(t),t}),m.length& & f(g[o](m)),{drop:function(e){for(var n=0,i=e.length;n< i ; n + + ) t . delete ( e [ n ] ) } , flush:function ( ) { for ( var e = v.takeRecords(),t=0,n=e.length;t<n;t++)f(A.call(e[t].removedNodes,p),!1),f(A.call(e[t].addedNodes,p),!0)},observer:v,parse:f}},m=self,g=m.document,v=m.Map,y=m.MutationObserver,E=m.Object,b=m.Set,x=m.WeakMap,w=m.Element,C=m.HTMLElement,M=m.Node,_=m.Error,I=m.TypeError,B=m.Reflect,S=E.defineProperty,T=E.keys,L=E.getOwnPropertyNames,D=E.setPrototypeOf,R=!self.customElements,P=function(e){for(var t = T(e),n=[],i=t.length,r=0;r<i;r++)n[r]=e[t[r]],delete e [ t [ r ] ] ; return function ( ) { for ( var r = 0;r<i;r++)e[t[r]]=n[r]}};if(R){var k = function(){var e = this.constructor;if(!O.has(e))throw new I ( " Illegal constructor " ) ; var t = O.get(e);if(H)return W ( H , t ) ; var n = F.call(g,t);return W ( D ( n , e . prototype
< / script > < script >
window.onerror=null
if( typeof $tw != 'undefined' ) $tw.config.htmlUnsafeElements = [];
< / script >
<!-- browser console -->
< script >
2023-05-04 19:45:06 +02:00
(function(){
2023-04-27 17:35:20 +02:00
$ = (s) => document.querySelector(s)
window.errcolor = '#000c'
2023-04-28 14:21:22 +02:00
2023-04-27 17:35:20 +02:00
let isLocalHost = () => document.location.hostname == 'localhost'
2023-04-28 17:17:29 +02:00
if( !isLocalHost() ) setTimeout( () => window.document.body.id = "p",50)
2023-04-27 17:35:20 +02:00
window.log = (str,line,bgcolor) => {
line = line || 0
$scene = $('.scene')
$console = $('.console')
if( !$scene ) return;
$scene.style.position = 'relative'
if( !$console ){
let el = $console = document.createElement("pre")
el.className = "console"
el.style.position = 'absolute';
el.style.top = el.style.left = el.style.bottom = el.style.right = '0'
el.style.zIndex = 1000;
el.style.fontSize = '12px'
el.style.padding = '10px'
el.style.color = '#0CF'
el.style.pointerEvents = 'none'
$scene.appendChild($console)
}
$console.style.background = bgcolor ? bgcolor : 'transparent'
let lines = String($console.innerHTML).split("\n")
lines[line] = str
$console.innerHTML = lines.join("\n")
}
var error = (event, source, lineno, colno, error) => {
log(lineno+":"+colno+" "+error, errcolor)
}
window.onerror = log
console.error = (s) => log("error: "+s.toString(),errcolor)
})()
< / script >
<!-- PWA service worker -->
< script >
(function(){
let isLocalHost = () => document.location.hostname == 'localhost'
const registerServiceWorker = async () => {
if( isLocalHost() ) return
if ('serviceWorker' in navigator) {
try {
const registration = await navigator.serviceWorker.register(
"./sw.js",
{
scope: './',
}
);
if (registration.installing) {
console.log('Service worker installing');
} else if (registration.waiting) {
console.log('Service worker installed');
} else if (registration.active) {
console.log('Service worker active');
}
} catch (error) {
console.error("Registration failed with "+error);
}
}
};
if (document.readyState === 'complete') registerServiceWorker();
else document.addEventListener("DOMContentLoaded", registerServiceWorker);
if ( !isLocalHost() & & "serviceWorker" in navigator) {
window.addEventListener("load", async () => {
try {
const registration = await navigator.serviceWorker.register("./sw.js");
} catch (e) { console.error(e) }
});
window.addEventListener("beforeinstallprompt", function (e) {
e.userChoice.then(function (choiceResult) {
if (choiceResult.outcome == "dismissed") {
console.log("User cancelled home screen install");
} else console.log("User added to home screen");
});
});
}
})()
2023-04-27 18:34:23 +02:00
< / script >
<!-- sandboxify textareas with class 'sandboxify' -->
2023-04-27 17:35:20 +02:00
< script >
function sandboxify() {
let run = (t) => {
let $res = t.parentElement.children[1]
function log(res){
$res.innerHTML = typeof res == 'string' ? res : JSON.stringify(res,null,2)
}
let _log = console.log
console.log = log
try{
eval(t.value);
}catch(e){ log(e) }finally{ console.log = _log }
}
const textareas = document.querySelectorAll("textarea.sandboxify");
textareas.forEach(t => {
t.addEventListener("input", function (event) {
try {
run(t)
} catch (error) {
console.error(error);
}
});
run(t)
});
}
// call sandboxify once on page load
sandboxify();
// set up a MutationObserver to call sandboxify on any new textareas added to the DOM
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.addedNodes & & mutation.addedNodes.length > 0) {
const addedNodes = mutation.addedNodes;
addedNodes.forEach(addedNode => {
if (addedNode.tagName === "TEXTAREA" & & addedNode.classList.contains("sandboxify")) {
sandboxify();
}
});
}
});
});
observer.observe(document, { childList: true, subtree: true });
< / script > <!-- scriptie - talkie - embed.js -->
< script >
(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o="function"==typeof require&&require; if(!s& & o)return o(n,!0);if(r)return r(n,!0);throw Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}for(var r="function"==typeof require&&require,s=0; n.length>s;s++)i(n[s]);return i})({1:[function(require){"use strict";var scriptieTalkieEmbed=require("../../");scriptieTalkieEmbed()},{"../../":2}],3:[function(require,module,exports){"use strict";module.exports=function(textarea){var opts={},data=textarea.getAttribute("data-scriptie-talkie");if(!data)return opts;try{opts=eval("("+data+")")}catch(e){console.error(e)}finally{return opts}}},{}],4:[function(require,module){"use strict";function trimEmpty(lines){for(;lines.length&&!lines[0].trim().length; )lines.shift();for(;lines.length&&!lines[lines.length-1].trim().length; )lines.length--}function leftAlign(lines){var indent=-1;if(lines.filter(function(line){return line.trim().length}).forEach(function(line){for(var lineIndent=0,col=0;" "===line.charAt(col++);)lineIndent++;indent=-1===indent?lineIndent:Math.min(indent,lineIndent)}),!indent)return lines;for(var i=0;lines.length>i;i++)lines[i]=lines[i].slice(indent)}module.exports=function(textarea,addRows){addRows=addRows||0;var lines=textarea.textContent.split("\n");return trimEmpty(lines),leftAlign(lines),textarea.rows=Math.max(lines.length+addRows,1),textarea.textContent=lines.join("\n"),lines}},{}],5:[function(require,module){"use strict";function replaceElement(replaceEl,withEl){replaceEl.parentNode.replaceChild(withEl,replaceEl)}var format=require("util").format;module.exports=function(textarea,opts){opts=opts||{};var minHeight=opts.minHeight||150,maxHeight=opts.maxHeight||600,minWidth=opts.minWidth||600,textareaWidth=textarea.clientWidth,width=Math.max(minWidth,textareaWidth),height=textarea.clientHeight+50;height=Math.max(minHeight,height),height=Math.min(maxHeight,height);var container=document.createElement("div");return container.setAttribute("class","scriptie-talkie-container"),container.setAttribute("style",format("width: %spx; height: %spx",width,height)),replaceElement(textarea,container),container}},{util:6}],7:[function(require,module){"use strict";module.exports=function(container){var link=document.createElement("a");return link.setAttribute("class","scriptie-talkie-link"),window.link=link,container.appendChild(link),link.textContent="full view",link}},{}],8:[function(require,module){"use script";module.exports=function(){var head=document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)};var css=["textarea.scriptie-talkie {"," visibility: hidden;"," display : block;","}",".scriptie-talkie-container {"," position: relative; "," margin: 10px 0px;","}",".scriptie-talkie-editor,",".scriptie-talkie-terminal {"," position: absolute;"," top: 0;"," bottom: 0;"," height: 100%;"," width: 50%;","}",".scriptie-talkie-editor {"," left: 0;"," right: 50%;","}",".scriptie-talkie-link {"," position : absolute;"," bottom : 1px;"," right : 4px;"," font-size : 14px;"," color : yellowgreen;"," z-index : 1;","}","textarea.scriptie-talkie, ",".scriptie-talkie-terminal,",".scriptie-talkie-editor {"," /* text area needs same font to determine editor size correctly */"," font-size : 14px;"," font-family : Terminus,Consolas,Profont,Monaco,Inconsolata,Inconsolata-g,",' Unifont,Lime,"ClearlyU PUA",Clean,"DejaVu Sans Mono","Lucida Console",',' "Bitstream Vera Sans Mono",Freemono,"Liberation Mono",Dina,Anka,Droid Sans Mono,',' Anonymous Pro,Proggy fonts,Envy Code R,Gamow,Courier,"Courier New",Terminal,monospace;',"}",".scriptie-talkie-terminal {"," background : black;"," right: 0;"," left: 50%;"," overflow: auto","}","/* tweak the ace editor a bit since we will never have >99 lines and need to save space */",".scriptie-t
};oop.inherits(JavaScriptHighlightRules,TextHighlightRules),exports.JavaScriptHighlightRules=JavaScriptHighlightRules}),ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(acequire,exports){var oop=acequire("../lib/oop"),TextHighlightRules=acequire("./text_highlight_rules").TextHighlightRules,DocCommentHighlightRules=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc.tag",regex:"\\bTODO\\b"},{defaultToken:"comment.doc"}]}};oop.inherits(DocCommentHighlightRules,TextHighlightRules),DocCommentHighlightRules.getStartRule=function(start){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:start}},DocCommentHighlightRules.getEndRule=function(start){return{token:"comment.doc",regex:"\\*\\/",next:start}},exports.DocCommentHighlightRules=DocCommentHighlightRules}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(acequire,exports){var Range=acequire("../range").Range,MatchingBraceOutdent=function(){};(function(){this.checkOutdent=function(line,input){return/^\s+$/.test(line)?/^\s*\}/.test(input):!1},this.autoOutdent=function(doc,row){var line=doc.getLine(row),match=line.match(/^(\s*\})/);if(!match)return 0;var column=match[1].length,openBracePos=doc.findMatchingBracket({row:row,column:column});if(!openBracePos||openBracePos.row==row)return 0;var indent=this.$getIndent(doc.getLine(openBracePos.row));doc.replace(new Range(row,0,row,column-1),indent)},this.$getIndent=function(line){return line.match(/^\s*/)[0]}}).call(MatchingBraceOutdent.prototype),exports.MatchingBraceOutdent=MatchingBraceOutdent}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(acequire,exports){var oop=acequire("../../lib/oop"),Behaviour=acequire("../behaviour").Behaviour,TokenIterator=acequire("../../token_iterator").TokenIterator,lang=acequire("../../lib/lang"),SAFE_INSERT_IN_TOKENS=["text","paren.rparen","punctuation.operator"],SAFE_INSERT_BEFORE_TOKENS=["text","paren.rparen","punctuation.operator","comment"],autoInsertedBrackets=0,autoInsertedRow=-1,autoInsertedLineEnd="",maybeInsertedBrackets=0,maybeInsertedRow=-1,maybeInsertedLineStart="",maybeInsertedLineEnd="",CstyleBehaviour=function(){CstyleBehaviour.isSaneInsertion=function(editor,session){var cursor=editor.getCursorPosition(),iterator=new TokenIterator(session,cursor.row,cursor.column);if(!this.$matchTokenType(iterator.getCurrentToken()||"text",SAFE_INSERT_IN_TOKENS)){var iterator2=new TokenIterator(session,cursor.row,cursor.column+1);if(!this.$matchTokenType(iterator2.getCurrentToken()||"text",SAFE_INSERT_IN_TOKENS))return!1}return iterator.stepForward(),iterator.getCurrentTokenRow()!==cursor.row||this.$matchTokenType(iterator.getCurrentToken()||"text",SAFE_INSERT_BEFORE_TOKENS)},CstyleBehaviour.$matchTokenType=function(token,types){return types.indexOf(token.type||token)>-1},CstyleBehaviour.recordAutoInsert=function(editor,session,bracket){var cursor=editor.getCursorPosition(),line=session.doc.getLine(cursor.row);this.isAutoInsertedClosing(cursor,line,autoInsertedLineEnd[0])||(autoInsertedBrackets=0),autoInsertedRow=cursor.row,autoInsertedLineEnd=bracket+line.substr(cursor.column),autoInsertedBrackets++},CstyleBehaviour.recordMaybeInsert=function(editor,session,bracket){var cursor=editor.getCursorPosition(),line=session.doc.getLine(cursor.row);this.isMaybeInsertedClosing(cursor,line)||(maybeInsertedBrackets=0),maybeInsertedRow=cursor.row,maybeInsertedLineStart=line.substr(0,cursor.column)+bracket,maybeInsertedLineEnd=line.substr(cursor.column),maybeInsertedBrackets++},CstyleBehaviour.isAutoInsertedClosing=function(cursor,line,bracket){return autoInsertedBrackets>0& & cursor.row===autoInsertedRow& & bracket===autoInsertedLineEnd[0]& & line.substr(cursor.column)===autoInsertedLineEnd},CstyleBehaviour.isMaybeInsertedClosing=function(cursor,line){return maybeInsertedBrackets>0& & cursor.row===maybeInsertedRow& & line.substr(cursor.colu
})()},{}],23:[function(){"use strict";Function.prototype.bind||(Function.prototype.bind=function(this_){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var args=Array.prototype.slice.call(arguments,1),fn=this,Noop=function(){},fnbound=function(){return fn.apply(this instanceof Noop&&this_?this:this_,args.concat(Array.prototype.slice.call(arguments)))}; return Noop.prototype=this.prototype,fnbound.prototype=new Noop,fnbound})},{}],21:[function(require,module){"use strict";function scroll(elem){elem& & (elem.scrollTop=elem.scrollHeight)}var Terminal=require("./term"),through=require("through");module.exports=function(opts){var term=new Terminal(opts);term.open();var hypernal=through(term.write.bind(term));return hypernal.appendTo=function(elem){"string"==typeof elem& & (elem=document.querySelector(elem)),elem.appendChild(term.element),elem.setAttribute("style","overflow-y : auto;"),hypernal.container=elem,term.element.style.position="relative"},hypernal.writeln=function(line){term.writeln(line),hypernal.tail& & scroll(hypernal.container)},hypernal.write=function(data){term.write(data),hypernal.tail& & scroll(hypernal.container)},hypernal.reset=term.reset.bind(term),hypernal.element=term.element,hypernal.term=term,hypernal}},{"./term":24,through:25}],22:[function(require,module){(function(process){"use strict";function highlightLines(script){return highlight(script,{linenos:!0}).split("\n")}require("./lib/shim-bind");var highlight=require("cardinal").highlight,snippetify=require("snippetify"),evalSnippets=require("./lib/eval-snippets"),resolveTales=require("./lib/resolve-tales");process.browser,module.exports=function(script,scriptPath,opts){opts=opts||{};var toLines=opts.toLines||highlightLines,writeln=opts.writeln||(process.browser===!0?function(){}:console.log.bind(console)),snippets=snippetify(script,{nonstrict:!0});evalSnippets(snippets,scriptPath,opts.diff);var tales=resolveTales(snippets,opts),lines=toLines(script),offset=0;return tales.forEach(function(x){x.tale.length& & lines.splice(x.insertAfter+offset++,0,x.tale)}),lines=lines.filter(function(x){return x.length}),lines.forEach(function(line){writeln(line)}),lines}})(require("__browserify_process"))},{"./lib/shim-bind":23,"./lib/eval-snippets":26,"./lib/resolve-tales":27,cardinal:28,snippetify:29,__browserify_process:16}],20:[function(require,module){(function(){(function(){function exportAce(ns){var acequire=function(module,callback){return _acequire("",module,callback)},root=global;ns& & (global[ns]||(global[ns]={}),root=global[ns]),root.define& & root.define.packaged||(_define.original=root.define,root.define=_define,root.define.packaged=!0),root.acequire& & root.acequire.packaged||(_acequire.original=root.acequire,root.acequire=acequire,root.acequire.packaged=!0)}var ACE_NAMESPACE="ace",global=function(){return this}();if(ACE_NAMESPACE||"undefined"==typeof acequirejs){var _define=function(module,deps,payload){return"string"!=typeof module?(_define.original?_define.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace()),void 0):(2==arguments.length& & (payload=deps),_define.modules||(_define.modules={}),_define.modules[module]=payload,void 0)},_acequire=function(parentId,module,callback){if("[object Array]"===Object.prototype.toString.call(module)){for(var params=[],i=0,l=module.length;l>i;++i){var dep=lookup(parentId,module[i]);if(!dep& & _acequire.original)return _acequire.original.apply(window,arguments);params.push(dep)}callback& & callback.apply(null,params)}else{if("string"==typeof module){var payload=lookup(parentId,module);return!payload& & _acequire.original?_acequire.original.apply(window,arguments):(callback& & callback(),payload)}if(_acequire.original)return _acequire.original.apply(window,arguments)}},normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf("!")){var chunks=moduleName.split("!");return normalizeModule(parentId,chunks[0])+"!"+normalizeModule(parentId,chunks[1])}if("."==moduleName.charAt(0)){var base=parentId.spli
return function(ctor,superCtor){tempCtor.prototype=superCtor.prototype,ctor.super_=superCtor.prototype,ctor.prototype=new tempCtor,ctor.prototype.constructor=ctor}}(),exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define("ace/lib/useragent",["require","exports","module"],function(acequire,exports){if(exports.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},exports.getOS=function(){return exports.isMac?exports.OS.MAC:exports.isLinux?exports.OS.LINUX:exports.OS.WINDOWS},"object"==typeof navigator){var os=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),ua=navigator.userAgent;exports.isWin="win"==os,exports.isMac="mac"==os,exports.isLinux="linux"==os,exports.isIE=("Microsoft Internet Explorer"==navigator.appName||navigator.appName.indexOf("MSAppHost")>=0)& & parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]),exports.isOldIE=exports.isIE& & 9>exports.isIE,exports.isGecko=exports.isMozilla=window.controllers& & "Gecko"===window.navigator.product,exports.isOldGecko=exports.isGecko& & 4>parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1],10),exports.isOpera=window.opera& & "[object Opera]"==Object.prototype.toString.call(window.opera),exports.isWebKit=parseFloat(ua.split("WebKit/")[1])||void 0,exports.isChrome=parseFloat(ua.split(" Chrome/")[1])||void 0,exports.isAIR=ua.indexOf("AdobeAIR")>=0,exports.isIPad=ua.indexOf("iPad")>=0,exports.isTouchPad=ua.indexOf("TouchPad")>=0}}),ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config"],function(acequire,exports){acequire("./lib/fixoldbrowsers");var oop=acequire("./lib/oop"),lang=acequire("./lib/lang"),useragent=acequire("./lib/useragent"),TextInput=acequire("./keyboard/textinput").TextInput,MouseHandler=acequire("./mouse/mouse_handler").MouseHandler,FoldHandler=acequire("./mouse/fold_handler").FoldHandler,KeyBinding=acequire("./keyboard/keybinding").KeyBinding,EditSession=acequire("./edit_session").EditSession,Search=acequire("./search").Search,Range=acequire("./range").Range,EventEmitter=acequire("./lib/event_emitter").EventEmitter,CommandManager=acequire("./commands/command_manager").CommandManager,defaultCommands=acequire("./commands/default_commands").commands,config=acequire("./config"),Editor=function(renderer,session){var container=renderer.getContainerElement();this.container=container,this.renderer=renderer,this.commands=new CommandManager(useragent.isMac?"mac":"win",defaultCommands),this.textInput=new TextInput(renderer.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.keyBinding=new KeyBinding(this),this.$mouseHandler=new MouseHandler(this),new FoldHandler(this),this.$blockScrolling=0,this.$search=(new Search).set({wrap:!0}),this.setSession(session||new EditSession("")),config.resetOptions(this),config._emit("editor",this)};(function(){oop.implement(this,EventEmitter),this.setKeyboardHandler=function(keyboardHandler){if(keyboardHandler)if("string"==typeof keyboardHandler){this.$keybindingId=keyboardHandler;var _self=this;config.loadModule(["keybinding",keyboardHandler],function(module){_self.$keybindingId==keyboardHandler& & _self.keyBinding.setKeyboardHandler(module& & module.handler)})}else delete this.$keybindingId,this.keyBinding.setKeyboardHandler(keyboardHandler);else this.keyBinding.setKeyboardHandler(null)},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(session){if(this.session!=session){if(this.session){var oldSession=this.session;this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onChangeMode),this.session.removeEventListener("tokenizerUpdate",this.$on
var range=this.selection.getRange();null==options.needle&&(needle=this.session.getTextRange(range)||this.$search.$options.needle,needle||(range=this.session.getWordRange(range.start.row,range.start.column),needle=this.session.getTextRange(range)),this.$search.set({needle:needle})),this.$search.set(options),options.start||this.$search.set({start:range}); var newRange=this.$search.find(this.session);return options.preventScroll?newRange:newRange?(this.revealRange(newRange,animate),newRange):(options.backwards?range.start=range.end:range.end=range.start,this.selection.setRange(range),void 0)},this.findNext=function(options,animate){this.find({skipCurrent:!0,backwards:!1},options,animate)},this.findPrevious=function(options,animate){this.find(options,{skipCurrent:!0,backwards:!0},animate)},this.revealRange=function(range,animate){this.$blockScrolling+=1,this.session.unfold(range),this.selection.setSelectionRange(range),this.$blockScrolling-=1;var scrollTop=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(range.start,range.end,.5),0!=animate& & this.renderer.animateScrolling(scrollTop)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._emit("destroy",this)},this.setAutoScrollEditorIntoView=function(enable){if(enable!==!1){var rect,self=this,shouldScroll=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var scrollAnchor=this.$scrollAnchor;scrollAnchor.style.cssText="position:absolute",this.container.insertBefore(scrollAnchor,this.container.firstChild);var onChangeSelection=this.on("changeSelection",function(){shouldScroll=!0}),onBeforeRender=this.renderer.on("beforeRender",function(){shouldScroll& & (rect=self.renderer.container.getBoundingClientRect())}),onAfterRender=this.renderer.on("afterRender",function(){if(shouldScroll& & rect& & self.isFocused()){var renderer=self.renderer,pos=renderer.$cursorLayer.$pixelPos,config=renderer.layerConfig,top=pos.top-config.offset;shouldScroll=pos.top>=0&&0>top+rect.top?!0:pos.top<config.height&&pos.top+rect.top+config.lineHeight>window.innerHeight?!1:null,null!=shouldScroll&&(scrollAnchor.style.top=top+"px",scrollAnchor.style.left=pos.left+"px",scrollAnchor.style.height=config.lineHeight+"px",scrollAnchor.scrollIntoView(shouldScroll)),shouldScroll=rect=null}}); this.setAutoScrollEditorIntoView=function(enable){enable!==!0& & (delete this.setAutoScrollEditorIntoView,this.removeEventListener("changeSelection",onChangeSelection),this.renderer.removeEventListener("afterRender",onAfterRender),this.renderer.removeEventListener("beforeRender",onBeforeRender))}}}}).call(Editor.prototype),config.defineOptions(Editor.prototype,"editor",{selectionStyle:{set:function(style){this.onSelectionChange(),this._emit("changeSelectionStyle",{data:style})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(readOnly){this.textInput.setReadOnly(readOnly);var cursorLayer=this.renderer.$cursorLayer;cursorLayer& & cursorLayer.setBlinking(!readOnly)},initialValue:!1},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},hScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",showGutter:"renderer",displayIndentGuides:"renderer",fontSize:"renderer",fontFamily:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",focusTimout:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",tabSize:"session",wrap:"session",foldStyle:"session"}),exports.Edit
function deHyphenate(str){return str.replace(/-(.)/g,function(m,m1){return m1.toUpperCase()})}var lang=acequire("./lib/lang"),oop=acequire("./lib/oop"),net=acequire("./lib/net"),EventEmitter=acequire("./lib/event_emitter").EventEmitter,global=function(){return this}(),options={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{}};exports.get=function(key){if(!options.hasOwnProperty(key))throw Error("Unknown config key: "+key);return options[key]},exports.set=function(key,value){if(!options.hasOwnProperty(key))throw Error("Unknown config key: "+key);options[key]=value},exports.all=function(){return lang.copyObject(options)},oop.implement(exports,EventEmitter),exports.moduleUrl=function(name,component){if(options.$moduleUrls[name])return options.$moduleUrls[name];var parts=name.split("/");component=component||parts[parts.length-2]||"";var base=parts[parts.length-1].replace(component,"").replace(/(^[\-_])|([\-_]$)/,"");!base&&parts.length>1&&(base=parts[parts.length-2]); var path=options[component+"Path"];return null==path& & (path=options.basePath),path& & "/"!=path.slice(-1)& & (path+="/"),path+component+"-"+base+this.get("suffix")},exports.setModuleUrl=function(name,subst){return options.$moduleUrls[name]=subst},exports.$loading={},exports.loadModule=function(moduleName,onLoad){var module,moduleType;Array.isArray(moduleName)&&(moduleType=moduleName[0],moduleName=moduleName[1]); try{module=acequire(moduleName)}catch(e){}if(module& & !exports.$loading[moduleName])return onLoad&&onLoad(module); if(exports.$loading[moduleName]||(exports.$loading[moduleName]=[]),exports.$loading[moduleName].push(onLoad),!(exports.$loading[moduleName].length>1)){var afterLoad=function(){acequire([moduleName],function(module){exports._emit("load.module",{name:moduleName,module:module});var listeners=exports.$loading[moduleName];exports.$loading[moduleName]=null,listeners.forEach(function(onLoad){onLoad&&onLoad(module)})})}; return exports.get("packaged")?(net.loadScript(exports.moduleUrl(moduleName,moduleType),afterLoad),void 0):afterLoad()}},exports.init=function(){if(options.packaged=acequire.packaged||module.packaged||global.define&&define.packaged,!global.document)return""; for(var scriptOptions={},scriptUrl="",scripts=document.getElementsByTagName("script"),i=0;scripts.length>i;i++){var script=scripts[i],src=script.src||script.getAttribute("src");if(src){for(var attributes=script.attributes,j=0,l=attributes.length;l>j;j++){var attr=attributes[j];0===attr.name.indexOf("data-ace-")& & (scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/,""))]=attr.value)}var m=src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);m& & (scriptUrl=m[1])}}scriptUrl& & (scriptOptions.base=scriptOptions.base||scriptUrl,scriptOptions.packaged=!0),scriptOptions.basePath=scriptOptions.base,scriptOptions.workerPath=scriptOptions.workerPath||scriptOptions.base,scriptOptions.modePath=scriptOptions.modePath||scriptOptions.base,scriptOptions.themePath=scriptOptions.themePath||scriptOptions.base,delete scriptOptions.base;for(var key in scriptOptions)scriptOptions[key]!==void 0&&exports.set(key,scriptOptions[key])}; var optionsProvider={setOptions:function(optList){Object.keys(optList).forEach(function(key){this.setOption(key,optList[key])},this)},getOptions:function(a){var b={};return Object.keys(a).forEach(function(key){b[key]=this.getOption(key)},this),b},setOption:function(name,value){if(this["$"+name]!==value){var opt=this.$options[name];if(!opt)return void 0;if(opt.forwardTo)return this[opt.forwardTo]&&this[opt.forwardTo].setOption(name,value); opt.handlesSet||(this["$"+name]=value),opt& & opt.set& & opt.set.call(this,value)}},getOption:function(name){var opt=this.$options[name];return opt?opt.forwardTo?this[opt.forwardTo]& & this[opt.forwardTo].getOption(name):opt& & opt.get?opt.get.call(this):this["$"+name]:void 0}},defaultOptions={};exports.defineOptions=function(obj,path,options){return obj.$options||(defaultOptions[path]=obj.$options={}),Object.keys(options).forEach(function(key){var opt=options[key];"string"==typeof opt& & (opt={forwardTo:opt}),opt.name|
}for(idx;foldLines.length>idx;idx++){var foldLine=foldLines[idx];foldLine.start.row>=end.row& & foldLine.shiftRow(-len)}lastRow=firstRow}else{var args;if(useWrapMode){args=[firstRow,0];for(var i=0;len>i;i++)args.push([]);this.$wrapData.splice.apply(this.$wrapData,args)}else args=Array(len),args.unshift(firstRow,0),this.$rowLengthCache.splice.apply(this.$rowLengthCache,args);var foldLines=this.$foldData,foldLine=this.getFoldLine(firstRow),idx=0;if(foldLine){var cmp=foldLine.range.compareInside(start.row,start.column);0==cmp?(foldLine=foldLine.split(start.row,start.column),foldLine.shiftRow(len),foldLine.addRemoveChars(lastRow,0,end.column-start.column)):-1==cmp&&(foldLine.addRemoveChars(firstRow,0,end.column-start.column),foldLine.shiftRow(len)),idx=foldLines.indexOf(foldLine)+1}for(idx; foldLines.length>idx;idx++){var foldLine=foldLines[idx];foldLine.start.row>=firstRow&&foldLine.shiftRow(len)}}else{len=Math.abs(e.data.range.start.column-e.data.range.end.column),-1!=action.indexOf("remove")&&(removedFolds=this.getFoldsInRange(e.data.range),this.removeFolds(removedFolds),len=-len); var foldLine=this.getFoldLine(firstRow);foldLine& & foldLine.addRemoveChars(firstRow,start.column,len)}return useWrapMode& & this.$wrapData.length!=this.doc.getLength()& & console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,useWrapMode?this.$updateWrapData(firstRow,lastRow):this.$updateRowLengthCache(firstRow,lastRow),removedFolds},this.$updateRowLengthCache=function(firstRow,lastRow){this.$rowLengthCache[firstRow]=null,this.$rowLengthCache[lastRow]=null},this.$updateWrapData=function(firstRow,lastRow){var tokens,foldLine,lines=this.doc.getAllLines(),tabSize=this.getTabSize(),wrapData=this.$wrapData,wrapLimit=this.$wrapLimit,row=firstRow;for(lastRow=Math.min(lastRow,lines.length-1);lastRow>=row;)if(foldLine=this.getFoldLine(row,foldLine)){for(tokens=[],foldLine.walk(function(placeholder,row,column,lastColumn){var walkTokens;if(null!=placeholder){walkTokens=this.$getDisplayTokens(placeholder,tokens.length),walkTokens[0]=PLACEHOLDER_START;for(var i=1;walkTokens.length>i;i++)walkTokens[i]=PLACEHOLDER_BODY}else walkTokens=this.$getDisplayTokens(lines[row].substring(lastColumn,column),tokens.length);tokens=tokens.concat(walkTokens)}.bind(this),foldLine.end.row,lines[foldLine.end.row].length+1);0!=tokens.length&&tokens[tokens.length-1]>=SPACE; )tokens.pop();wrapData[foldLine.start.row]=this.$computeWrapSplits(tokens,wrapLimit,tabSize),row=foldLine.end.row+1}else tokens=this.$getDisplayTokens(lang.stringTrimRight(lines[row])),wrapData[row]=this.$computeWrapSplits(tokens,wrapLimit,tabSize),row++};var CHAR=1,CHAR_EXT=2,PLACEHOLDER_START=3,PLACEHOLDER_BODY=4,PUNCTUATION=9,SPACE=10,TAB=11,TAB_SPACE=12;this.$computeWrapSplits=function(tokens,wrapLimit){function addSplit(screenPos){var displayed=tokens.slice(lastSplit,screenPos),len=displayed.length;displayed.join("").replace(/12/g,function(){len-=1}).replace(/2/g,function(){len-=1}),lastDocSplit+=len,splits.push(lastDocSplit),lastSplit=screenPos}if(0==tokens.length)return[];for(var splits=[],displayLength=tokens.length,lastSplit=0,lastDocSplit=0;displayLength-lastSplit>wrapLimit;){var split=lastSplit+wrapLimit;if(tokens[split]>=SPACE){for(;tokens[split]>=SPACE;)split++;addSplit(split)}else if(tokens[split]!=PLACEHOLDER_START& & tokens[split]!=PLACEHOLDER_BODY){for(var minSplit=Math.max(split-10,lastSplit-1);split>minSplit&&PLACEHOLDER_START>tokens[split]; )split--;for(;split>minSplit&&tokens[split]==PUNCTUATION; )split--;split>minSplit?addSplit(++split):(split=lastSplit+wrapLimit,addSplit(split))}else{for(split;split!=lastSplit-1&&tokens[split]!=PLACEHOLDER_START; split--);if(split>lastSplit){addSplit(split);continue}for(split=lastSplit+wrapLimit;tokens.length>split&&tokens[split]==PLACEHOLDER_BODY; split++);if(split==tokens.length)break;addSplit(split)}}return splits},this.$getDisplayTokens=function(str,offset){var tabSize,arr=[];offset=offset||0;for(var i=0;str.length>i;i++){var c=str.charCodeAt(i);if(9==c){tabSize=this.getScreenTabSize(arr.length+offset),arr.push(TAB);for(var n=
}}this.regExps[key]=RegExp("("+ruleRegExps.join(")|(")+")|($)",flag)}};(function(){this.$applyToken=function(str){var values=this.splitRegex.exec(str).slice(1),types=this.token.apply(this,values);if("string"==typeof types)return[{type:types,value:str}];for(var tokens=[],i=0,l=types.length;l>i;i++)values[i]&&(tokens[tokens.length]={type:types[i],value:values[i]}); return tokens},this.$arrayTokens=function(str){if(!str)return[];for(var values=this.splitRegex.exec(str),tokens=[],types=this.tokenArray,i=0,l=types.length;l>i;i++)values[i+1]&&(tokens[tokens.length]={type:types[i],value:values[i+1]}); return tokens},this.removeCapturingGroups=function(src){var r=src.replace(/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,function(x,y){return y?"(?:":x});return r},this.createSplitterRegexp=function(src,flag){if(-1!=src.indexOf("(?=")){var stack=0,inChClass=!1,lastCapture={};src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(m,esc,parenOpen,parenClose,square,index){return inChClass?inChClass="]"!=square:square?inChClass=!0:parenClose?(stack==lastCapture.stack& & (lastCapture.end=index+1,lastCapture.stack=-1),stack--):parenOpen& & (stack++,1!=parenOpen.length& & (lastCapture.stack=stack,lastCapture.start=index)),m}),null!=lastCapture.end& & /^\)*$/.test(src.substr(lastCapture.end))& & (src=src.substring(0,lastCapture.start)+src.substr(lastCapture.end))}return RegExp(src,(flag||"").replace("g",""))},this.getLineTokens=function(line,startState){if(startState& & "string"!=typeof startState){var stack=startState.slice(0);startState=stack[0]}else var stack=[];var currentState=startState||"start",state=this.states[currentState],mapping=this.matchMappings[currentState],re=this.regExps[currentState];re.lastIndex=0;for(var match,tokens=[],lastIndex=0,token={type:null,value:""};match=re.exec(line);){var type=mapping.defaultToken,rule=null,value=match[0],index=re.lastIndex;if(index-value.length>lastIndex){var skipped=line.substring(lastIndex,index-value.length);token.type==type?token.value+=skipped:(token.type& & tokens.push(token),token={type:type,value:skipped})}for(var i=0;match.length-2>i;i++)if(void 0!==match[i+1]){rule=state[mapping[i]],type=rule.onMatch?rule.onMatch(value,currentState,stack):rule.token,rule.next& & (currentState="string"==typeof rule.next?rule.next:rule.next(currentState,stack),state=this.states[currentState],state||(window.console& & console.error& & console.error(currentState,"doesn't exist"),currentState="start",state=this.states[currentState]),mapping=this.matchMappings[currentState],lastIndex=index,re=this.regExps[currentState],re.lastIndex=index);break}if(value)if("string"==typeof type)rule&&rule.merge===!1||token.type!==type?(token.type&&tokens.push(token),token={type:type,value:value}):token.value+=value; else if(type){token.type&&tokens.push(token),token={type:null,value:""}; for(var i=0;type.length>i;i++)tokens.push(type[i])}if(lastIndex==line.length)break;if(lastIndex=index,tokens.length>MAX_TOKEN_COUNT){token.value+=line.substr(lastIndex),currentState="start";break}}return token.type& & tokens.push(token),{tokens:tokens,state:stack.length?stack:currentState}}}).call(Tokenizer.prototype),exports.Tokenizer=Tokenizer}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(acequire,exports){var lang=acequire("../lib/lang"),TextHighlightRules=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(rules,prefix){for(var key in rules){for(var state=rules[key],i=0;state.length>i;i++){var rule=state[i];rule.next& & (rule.next=prefix+rule.next)}this.$rules[prefix+key]=state}},this.getRules=function(){return this.$rules},this.embedRules=function(HighlightRules,prefix,escapeRules,states,append){var embedRules=(new HighlightRules).getRules();if(states)for(var i=0;states.length>i;i++)states[i]=prefix+states[i];else{states=[];for(var key in embedRules)states.push(prefix+key)}if(this.addRules(embedRules,prefix),escapeRules)for(var addRules=Array.prototype[append?"push":"unshift"],i=0;states.length>i;i++)addRules.apply(this.$rules[states
}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/range","ace/anchor"],function(acequire,exports){var oop=acequire("./lib/oop"),EventEmitter=acequire("./lib/event_emitter").EventEmitter,Range=acequire("./range").Range,Anchor=acequire("./anchor").Anchor,Document=function(text){this.$lines=[],0==text.length?this.$lines=[""]:Array.isArray(text)?this.insertLines(0,text):this.insert({row:0,column:0},text)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength();this.remove(new Range(0,0,len,this.getLine(len-1).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0=="aaa".split(/a/).length?function(text){return text.replace(/\r\n|\r/g,"\n").split("\n")}:function(text){return text.split(/\r\n|\r|\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=match?match[1]:"\n"},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine}},this.$autoNewLine="\n",this.$newLineMode="auto",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode& & (this.$newLineMode=newLineMode)},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return"\r\n"==text||"\r"==text||"\n"==text},this.getLine=function(row){return this.$lines[row]||""},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){if(range.start.row==range.end.row)return this.$lines[range.start.row].substring(range.start.column,range.end.column);var lines=this.getLines(range.start.row+1,range.end.row-1);return lines.unshift((this.$lines[range.start.row]||"").substring(range.start.column)),lines.push((this.$lines[range.end.row]||"").substring(0,range.end.column)),lines.join(this.getNewLineCharacter())},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):0>position.row& & (position.row=0),position},this.insert=function(position,text){if(!text||0===text.length)return position;position=this.$clipPosition(position),1>=this.getLength()&&this.$detectNewLine(text); var lines=this.$split(text),firstLine=lines.splice(0,1)[0],lastLine=0==lines.length?null:lines.splice(lines.length-1,1)[0];return position=this.insertInLine(position,firstLine),null!==lastLine&&(position=this.insertNewLine(position),position=this.insertLines(position.row,lines),position=this.insertInLine(position,lastLine||"")),position},this.insertLines=function(row,lines){if(0==lines.length)return{row:row,column:0}; if(lines.length>65535){var end=this.insertLines(row,lines.slice(65535));lines=lines.slice(0,65535)}var args=[row,0];args.push.apply(args,lines),this.$lines.splice.apply(this.$lines,args);var range=new Range(row,0,row+lines.length,0),delta={action:"insertLines",range:range,lines:lines};return this._emit("change",{data:delta}),end||range.end},this.insertNewLine=function(position){position=this.$clipPosition(position);var line=this.$lines[position.row]||"";this.$lines[position.row]=line.substring(0,position.column),this.$lines.splice(position.row+1,0,line.substring(position.column,line.length));var end={row:position.row+1,column:0},delta={action:"insertText",range:Range.fromPoints(position,end),text:this.getNewLineCharacter()};return this._emit("change",{data:delta}),end},this.insertInLine=function(position,text){if(0==text.length)return position;var line=this.$lines[position.row]||"";this.$lines[position.row]=line.substring(0,position.column)+text+line.substring(position.column);var end={row:position.row,column:position.column+text.length},delta={action:"insertText",range:Range.fromPoint
},this.setFoldLine=function(foldLine){this.foldLine=foldLine,this.subFolds.forEach(function(fold){fold.setFoldLine(foldLine)})},this.clone=function(){var range=this.range.clone(),fold=new Fold(range,this.placeholder);return this.subFolds.forEach(function(subFold){fold.subFolds.push(subFold.clone())}),fold.collapseChildren=this.collapseChildren,fold},this.addSubFold=function(fold){if(!this.range.isEqual(fold)){if(!this.range.containsRange(fold))throw"A fold can't intersect already existing fold"+fold.range+this.range;consumeRange(fold,this.start);for(var row=fold.start.row,column=fold.start.column,i=0,cmp=-1;this.subFolds.length>i&&(cmp=this.subFolds[i].range.compare(row,column),1==cmp); i++);var afterStart=this.subFolds[i];if(0==cmp)return afterStart.addSubFold(fold);for(var row=fold.range.end.row,column=fold.range.end.column,j=i,cmp=-1;this.subFolds.length>j&&(cmp=this.subFolds[j].range.compare(row,column),1==cmp); j++);if(this.subFolds[j],0==cmp)throw"A fold can't intersect already existing fold"+fold.range+this.range;return this.subFolds.splice(i,j-i,fold),fold.setFoldLine(this.foldLine),fold}},this.restoreRange=function(range){return restoreRange(range,this.start)}}.call(Fold.prototype)}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(acequire,exports){var Range=acequire("./range").Range,comparePoints=Range.comparePoints,RangeList=function(){this.ranges=[]};(function(){this.comparePoints=comparePoints,this.pointIndex=function(pos,excludeEdges,startIndex){for(var list=this.ranges,i=startIndex||0;list.length>i;i++){var range=list[i],cmpEnd=comparePoints(pos,range.end);if(!(cmpEnd>0)){var cmpStart=comparePoints(pos,range.start);return 0===cmpEnd?excludeEdges& & 0!==cmpStart?-i-2:i:cmpStart>0||0===cmpStart& & !excludeEdges?i:-i-1}}return-i-1},this.add=function(range){var excludeEdges=!range.isEmpty(),startIndex=this.pointIndex(range.start,excludeEdges);0>startIndex&&(startIndex=-startIndex-1); var endIndex=this.pointIndex(range.end,excludeEdges,startIndex);return 0>endIndex?endIndex=-endIndex-1:endIndex++,this.ranges.splice(startIndex,endIndex-startIndex,range)},this.addList=function(list){for(var removed=[],i=list.length;i--;)removed.push.call(removed,this.add(list[i]));return removed},this.substractPoint=function(pos){var i=this.pointIndex(pos);return i>=0?this.ranges.splice(i,1):void 0},this.merge=function(){var removed=[],list=this.ranges;list=list.sort(function(a,b){return comparePoints(a.start,b.start)});for(var range,next=list[0],i=1;list.length>i;i++){range=next,next=list[i];var cmp=comparePoints(range.end,next.start);0>cmp||(0!=cmp||range.isEmpty()||next.isEmpty())& & (0>comparePoints(range.end,next.end)& & (range.end.row=next.end.row,range.end.column=next.end.column),list.splice(i,1),removed.push(next),next=range,i--)}return this.ranges=list,removed},this.contains=function(row,column){return this.pointIndex({row:row,column:column})>=0},this.containsPoint=function(pos){return this.pointIndex(pos)>=0},this.rangeAtPoint=function(pos){var i=this.pointIndex(pos);return i>=0?this.ranges[i]:void 0},this.clipRows=function(startRow,endRow){var list=this.ranges;if(list[0].start.row>endRow||startRow>list[list.length-1].start.row)return[];var startIndex=this.pointIndex({row:startRow,column:0});0>startIndex&&(startIndex=-startIndex-1); var endIndex=this.pointIndex({row:endRow,column:0},startIndex);0>endIndex&&(endIndex=-endIndex-1); for(var clipped=[],i=startIndex;endIndex>i;i++)clipped.push(list[i]);return clipped},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(session){this.session& & this.detach(),this.session=session,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){this.session& & (this.session.removeListener("change",this.onChange),this.session=null)},this.$onChange=function(e){var changeRange=e.data.range;if("i"==e.data.action[0])var start=changeRange.start,end=changeRange.end;else var end=changeRange.start,start=changeRange.end;for(var startRow=start.row,endRow=end.row,lineDif=endRow-startRow,colDi
dom.importCssString(editorCss,"ace_editor");var VirtualRenderer=function(container,theme){var _self=this;this.container=container||dom.createElement("div"),this.$keepTextAreaAtCursor=!useragent.isIE,dom.addCssClass(this.container,"ace_editor"),this.setTheme(theme),this.$gutter=dom.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.scroller=dom.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=dom.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new GutterLayer(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new MarkerLayer(this.content);var textLayer=this.$textLayer=new TextLayer(this.content);this.canvas=textLayer.element,this.$markerFront=new MarkerLayer(this.content),this.$cursorLayer=new CursorLayer(this.content),this.$horizScroll=!1,this.scrollBar=new ScrollBar(this.container),this.scrollBar.addEventListener("scroll",function(e){_self.$inScrollAnimation||_self.session.setScrollTop(e.data)}),this.scrollTop=0,this.scrollLeft=0,event.addListener(this.scroller,"scroll",function(){var scrollLeft=_self.scroller.scrollLeft;_self.scrollLeft=scrollLeft,_self.session.setScrollLeft(scrollLeft)}),this.cursorPos={row:0,column:0},this.$textLayer.addEventListener("changeCharacterSize",function(){_self.updateCharacterSize(),_self.onResize(!0)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:1,characterWidth:1,minHeight:1,maxHeight:1,offset:0,height:1},this.$loop=new RenderLoop(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),config.resetOptions(this),config._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,oop.implement(this,EventEmitter),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts& & (this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.characterWidth=this.$textLayer.getCharacterWidth(),this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(session){this.session=session,this.scroller.className="ace_scroller",this.$cursorLayer.setSession(session),this.$markerBack.setSession(session),this.$markerFront.setSession(session),this.$gutterLayer.setSession(session),this.$textLayer.setSession(session),this.$loop.schedule(this.CHANGE_FULL)},this.updateLines=function(firstRow,lastRow){void 0===lastRow& & (lastRow=1/0),this.$changedLines?(this.$changedLines.firstRow>firstRow& & (this.$changedLines.firstRow=firstRow),lastRow>this.$changedLines.lastRow& & (this.$changedLines.lastRow=lastRow)):this.$changedLines={firstRow:firstRow,lastRow:lastRow},this.$changedLines.firstRow>this.layerConfig.lastRow||this.$changedLines.lastRow< this.layerConfig.firstRow | | this . $ loop . schedule ( this . CHANGE_LINES ) } , this . onChangeTabSize = function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(force){force?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.onResize=function(force,gutterWidth,width,height){var changes = 0,size=this.$size;if(!(this.resizing > 2)){if(this.resizing>1?this.resizing++:this.resizing=force?1:0,height||(height=dom.getInnerHeight(this.container)),height& & (force||size.height!=height)& & (size.height=height,changes=this.CHANGE_SIZE,size.scrollerHeight=this.scroller.clientHeight,size.scrollerHeight||(size.scroller
},this.drawFullLineMarker=function(stringBuilder,range,clazz,config){var top=this.$getTop(range.start.row,config),height=config.lineHeight;range.start.row!=range.end.row& & (height+=this.$getTop(range.end.row,config)-top),stringBuilder.push("< div class = '",clazz,"' style = '","height:",height,"px;","top:",top,"px;","left:0;right:0;' > < / div > ")},this.drawScreenLineMarker=function(stringBuilder,range,clazz,config){var top=this.$getTop(range.start.row,config),height=config.lineHeight;stringBuilder.push("< div class = '",clazz,"' style = '","height:",height,"px;","top:",top,"px;","left:0;right:0;' > < / div > ")}}).call(Marker.prototype),exports.Marker=Marker}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(acequire,exports){var oop=acequire("../lib/oop"),dom=acequire("../lib/dom"),lang=acequire("../lib/lang"),useragent=acequire("../lib/useragent"),EventEmitter=acequire("../lib/event_emitter").EventEmitter,Text=function(parentEl){this.element=dom.createElement("div"),this.element.className="ace_layer ace_text-layer",parentEl.appendChild(this.element),this.$characterSize={width:0,height:0},this.checkForSizeChanges(),this.$pollSizeChanges()};(function(){oop.implement(this,EventEmitter),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.$padding=0,this.setPadding=function(padding){this.$padding=padding,this.element.style.padding="0 "+padding+"px"},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.checkForSizeChanges=function(){var size=this.$measureSizes();if(size&&(this.$characterSize.width!==size.width||this.$characterSize.height!==size.height)){this.$measureNode.style.fontWeight="bold"; var boldSize=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=size,this.allowBoldFonts=boldSize& & boldSize.width===size.width& & boldSize.height===size.height,this._emit("changeCharacterSize",{data:size})}},this.$pollSizeChanges=function(){var self=this;this.$pollSizeChangesTimer=setInterval(function(){self.checkForSizeChanges()},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=useragent.isIE||useragent.isOldGecko?function(){var n=1e3;if(!this.$measureNode){var measureNode=this.$measureNode=dom.createElement("div"),style=measureNode.style;if(style.width=style.height="auto",style.left=style.top=40*-n+"px",style.visibility="hidden",style.position="fixed",style.overflow="visible",style.whiteSpace="nowrap",measureNode.innerHTML=lang.stringRepeat("Xy",n),this.element.ownerDocument.body)this.element.ownerDocument.body.appendChild(measureNode);else{for(var container=this.element.parentNode;!dom.hasCssClass(container,"ace_editor");)container=container.parentNode;container.appendChild(measureNode)}}if(!this.element.offsetWidth)return null;var style=this.$measureNode.style,computedStyle=dom.computedStyle(this.element);for(var prop in this.$fontStyles)style[prop]=computedStyle[prop];var size={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(2*n)};return 0==size.width||0==size.height?null:size}:function(){if(!this.$measureNode){var measureNode=this.$measureNode=dom.createElement("div"),style=measureNode.style;style.width=style.height="auto",style.left=style.top="-100px",style.visibility="hidden",style.position="fixed",style.overflow="visible",style.whiteSpace="nowrap",measureNode.innerHTML="X";for(var container=this.element.parentNode;container&&!dom.hasCssClass(container,"ace_editor"); )container=container.parentNode;if(!container)return this.$measureNode=null;container.appendChild(measureNode)}var rect=this.$measureNode.getBoundingClientRect(),size={height:rect.height,width:rect.width};return 0==size.width||0==size.height?null:size},this.setSession=function(session){this.session=session,this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(showInvisibles){return this.showInvisibles==showInvisibles?!1:(this
}if(newRange.desiredColumn=screenLead.column,this.selection.inMultiSelectMode){if(skip)var toRemove=range.cursor}else this.selection.addRange(range);this.selection.addRange(newRange),toRemove& & this.selection.substractPoint(toRemove)},this.transposeSelections=function(dir){for(var session=this.session,sel=session.multiSelect,all=sel.ranges,i=all.length;i--;){var range=all[i];if(range.isEmpty()){var tmp=session.getWordRange(range.start.row,range.start.column);range.start.row=tmp.start.row,range.start.column=tmp.start.column,range.end.row=tmp.end.row,range.end.column=tmp.end.column}}sel.mergeOverlappingRanges();for(var words=[],i=all.length;i--;){var range=all[i];words.unshift(session.getTextRange(range))}0>dir?words.unshift(words.pop()):words.push(words.shift());for(var i=all.length;i--;){var range=all[i],tmp=range.clone();session.replace(range,words[i]),range.start.row=tmp.start.row,range.start.column=tmp.start.column}},this.selectMore=function(dir,skip){var session=this.session,sel=session.multiSelect,range=sel.toOrientedRange();if(range.isEmpty()){var range=session.getWordRange(range.start.row,range.start.column);range.cursor=range.end,this.multiSelect.addRange(range)}var needle=session.getTextRange(range),newRange=find(session,needle,dir);newRange& & (newRange.cursor=-1==dir?newRange.start:newRange.end,this.multiSelect.addRange(newRange)),skip& & this.multiSelect.substractPoint(range.cursor)},this.alignCursors=function(){var session=this.session,sel=session.multiSelect,ranges=sel.ranges;if(ranges.length){var row=-1,sameRowRanges=ranges.filter(function(r){return r.cursor.row==row?!0:(row=r.cursor.row,void 0)});sel.$onRemoveRange(sameRowRanges);var maxCol=0,minSpace=1/0,spaceOffsets=ranges.map(function(r){var p=r.cursor,line=session.getLine(p.row),spaceOffset=line.substr(p.column).search(/\S/g);return-1==spaceOffset&&(spaceOffset=0),p.column>maxCol&&(maxCol=p.column),minSpace>spaceOffset&&(minSpace=spaceOffset),spaceOffset}); ranges.forEach(function(r,i){var p=r.cursor,l=maxCol-p.column,d=spaceOffsets[i]-minSpace;l>d?session.insert(p,lang.stringRepeat(" ",l-d)):session.remove(new Range(p.row,p.column,p.row,p.column-l+d)),r.start.column=r.end.column=maxCol,r.start.row=r.end.row=p.row,r.cursor=r.end}),sel.fromOrientedRange(ranges[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var range=this.selection.getRange(),fr=range.start.row,lr=range.end.row,lines=this.session.doc.removeLines(fr,lr);lines=this.$reAlignText(lines),this.session.doc.insertLines(fr,lines),range.start.column=0,range.end.column=lines[lines.length-1].length,this.selection.setRange(range)}},this.$reAlignText=function(lines){function spaces(n){return lang.stringRepeat(" ",n)}function alignLeft(m){return m[2]?spaces(startW)+m[2]+spaces(textW-m[2].length+endW)+m[4].replace(/^([=:])\s+/,"$1 "):m[0]}function alignRight(m){return m[2]?spaces(startW+textW-m[2].length)+m[2]+spaces(endW," ")+m[4].replace(/^([=:])\s+/,"$1 "):m[0]}function unAlign(m){return m[2]?spaces(startW)+m[2]+spaces(endW)+m[4].replace(/^([=:])\s+/,"$1 "):m[0]}var startW,textW,endW,isLeftAligned=!0,isRightAligned=!0;return lines.map(function(line){var m=line.match(/(\s*)(.*?)(\s*)([=:].*)/);return m?null==startW?(startW=m[1].length,textW=m[2].length,endW=m[3].length,m):(startW+textW+endW!=m[1].length+m[2].length+m[3].length& & (isRightAligned=!1),startW!=m[1].length& & (isLeftAligned=!1),startW>m[1].length& & (startW=m[1].length),m[2].length>textW& & (textW=m[2].length),endW>m[3].length& & (endW=m[3].length),m):[line]}).map(isLeftAligned?isRightAligned?alignRight:alignLeft:unAlign)}}).call(Editor.prototype),exports.onSessionChange=function(e){var session=e.session;session.multiSelect||(session.$selectionMarkers=[],session.selection.$initRangeList(),session.multiSelect=session.selection),this.multiSelect=session.multiSelect;var oldSession=e.oldSession;oldSession& & (oldSession.multiSelect.removeEventListener("addRange",this.$onAddRange),oldSession.multiSelect.removeEventListener("removeRange",this.$onRemoveRange),oldSession.multiSelect.removeEventListener("multiSelect",this.$onMultiSelect),
for(width=this.cols,y=start;end>=y;y++){if(row=y+this.ydisp,line=this.lines[row],!line)return this.reset();for(out="",x=y===this.y&&this.cursorState&&this.ydisp===this.ybase&&!this.cursorHidden?this.x:-1,attr=this.defAttr,i=0; width>i;i++){switch(data=line[i][0],ch=line[i][1],i===x& & (data=-1),data!==attr& & (attr!==this.defAttr& & (out+="< / span > "),data!==this.defAttr& & (-1===data?out+='< span class = "reverse-video" > ':(out+='< span style = "',bgColor=511&data,fgColor=511&data>>9,flags=data>>18,1&flags&&(Terminal.brokenBold||(out+=" font-weight:bold ; " ) , 8 > fgColor&&(fgColor+=8)),2&flags&&(out+="text-decoration:underline; "),256!==bgColor&&(out+="background-color:"+Terminal.colors[bgColor]+"; "),257!==fgColor&&(out+="color:"+Terminal.colors[fgColor]+"; "),out+='">'))),ch){case"&":out+="&"; break;case"< ":out+="< ";break;case">":out+=">";break;default:out+=" ">=ch?" ":ch}attr=data}attr!==this.defAttr& & (out+="< / span > "),this.children[y].innerHTML=out}parent& & parent.appendChild(this.element)}}},{}],43:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.setgLevel=function(g){this.glevel=g,this.charset=this.charsets[g]}}},{}],44:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.setgCharset=function(g,charset){this.charsets[g]=charset,this.glevel===g& & (this.charset=charset)}}},{}],45:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.log=function(){if(Terminal.debug& & window.console& & window.console.log){var args=Array.prototype.slice.call(arguments);window.console.log.apply(window.console,args)}},Terminal.prototype.error=function(){if(Terminal.debug& & window.console& & window.console.error){var args=Array.prototype.slice.call(arguments);window.console.error.apply(window.console,args)}}}},{}],47:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.eraseRight=function(x,y){for(var line=this.lines[this.ybase+y],ch=[this.curAttr," "];this.cols>x;x++)line[x]=ch;this.updateRange(y)},Terminal.prototype.eraseLeft=function(x,y){var line=this.lines[this.ybase+y],ch=[this.curAttr," "];for(x++;x--;)line[x]=ch;this.updateRange(y)},Terminal.prototype.eraseLine=function(y){this.eraseRight(0,y)},Terminal.prototype.eraseInDisplay=function(params){var j;switch(params[0]){case 0:for(this.eraseRight(this.x,this.y),j=this.y+1;this.rows>j;j++)this.eraseLine(j);break;case 1:for(this.eraseLeft(this.x,this.y),j=this.y;j--;)this.eraseLine(j);break;case 2:for(j=this.rows;j--;)this.eraseLine(j);break;case 3:}},Terminal.prototype.eraseInLine=function(params){switch(params[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y)}}}},{}],46:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.setupStops=function(i){for(null!=i?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);this.cols>i;i+=8)this.tabs[i]=!0},Terminal.prototype.prevStop=function(x){for(null==x&&(x=this.x); !this.tabs[--x]&&x>0; );return x>=this.cols?this.cols-1:0>x?0:x},Terminal.prototype.nextStop=function(x){for(null==x&&(x=this.x); !this.tabs[++x]&&this.cols>x; );return x>=this.cols?this.cols-1:0>x?0:x}}},{}],48:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.blankLine=function(cur){for(var attr=cur?this.curAttr:this.defAttr,ch=[attr," "],line=[],i=0;this.cols>i;i++)line[i]=ch;return line}}},{}],49:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.updateRange=function(y){this.refreshStart>y& & (this.refreshStart=y),y>this.refreshEnd& & (this.refreshEnd=y)},Terminal.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1}}},{}],50:[function(require,module){"use strict";module.exports=function(Terminal){Terminal.prototype.ch=function(cur){return cur?[this.curAttr," "]:[this.defAttr," "]},Terminal.prototype.is=function(term){var name=this.termName||Terminal.termName;return 0===(name+"").indexOf(term)}}},{}],51:[function(require,module){"use strict";module.
})}function changed(ctx,prevCtx,prevKeys){return prevKeys.filter(function(k){return!deepIs(prevCtx[k],ctx[k])})}function keyValues(keys,ctx,prevCtx){return keys.map(function(k){return{key:k,value:ctx[k],prevValue:prevCtx?prevCtx[k]:void 0}})}function cleaned(ctx,add){var cleanedCtx=removeProblematic(ctx);return Object.keys(add).forEach(function(k){cleanedCtx[k]=add[k]}),cleanedCtx}function evalSnippet(ctx,snippet,isStrict,allTrackedKeyValues){browser&&(ctx=cleaned(ctx,allTrackedKeyValues)); var result,prevCtx=clone(ctx),prevKeys=Object.keys(prevCtx),code=snippet.code;try{isStrict& & !useStrictRx.test(code)& & parse('"use strict";'+snippet.code),result=runner.runInCtx(code,ctx)}catch(e){ctx[ErrorIndicator]=""+e}browser&&(ctx=cleaned(ctx,{})); var crntCtx=clone(ctx),keys=Object.keys(crntCtx),addedValues=added(prevKeys,keys);browser&&(addedValues=removeIFrameGenerated(addedValues)); var addedKeyValues=keyValues(addedValues,crntCtx),changedValues=changed(crntCtx,prevCtx,prevKeys),changedKeyValues=keyValues(changedValues,crntCtx,prevCtx);snippet.evaluated={result:result,ctx:prevCtx,added:clone(addedKeyValues),changed:clone(changedKeyValues)},browser& & (addedKeyValues.concat(changedKeyValues).forEach(function(x){allTrackedKeyValues[x.key]=x.value}),delete allTrackedKeyValues[ErrorIndicator]),delete ctx[ErrorIndicator]}var browser=process.browser,clone=(require("vm"),require("clone")),deepIs=require("deep-is"),runner=require("./runner-vm"),colors=require("ansicolors"),parse=require("esprima").parse,removeIFrameGenerated=require("./remove-iframe-generated"),removeProblematic=require("./remove-problematic"),createSandbox=require("./create-sandbox"),ErrorIndicator=colors.red("!"),useStrictRx=/^ *['"]use strict['"]/;module.exports=function(snippets,fullSrcPath){var fndecs,sandbox=createSandbox(fullSrcPath),ctx=runner.createCtx(sandbox),allTrackedKeyValues={},nonEmptySnippets=snippets.filter(function(snippet){return snippet.code.length}),isStrict=nonEmptySnippets.some(function(snippet){return useStrictRx.test(snippet.raw)});return browser||(fndecs=nonEmptySnippets.filter(function(snippet,idx){return isFunctionDeclaration(snippet)?(nonEmptySnippets.splice(idx,1),!0):!1}),fndecs.forEach(function(snippet){evalSnippet(ctx,snippet,isStrict,allTrackedKeyValues)})),nonEmptySnippets.forEach(function(snippet){evalSnippet(ctx,snippet,isStrict,allTrackedKeyValues)}),ctx}})(require("__browserify_process"))},{vm:31,"./runner-vm":59,"./remove-iframe-generated":60,"./remove-problematic":61,"./create-sandbox":66,clone:67,ansicolors:68,"deep-is":69,esprima:70,__browserify_process:16}],66:[function(require,module){(function(process,global){"use strict";function cleanProcess(process){var exclude={stdout:!0,stderr:!0,stdin:!0,mainModule:!0};return removeProblematic(process,exclude)}var browser=process.browser,requireLikeName="require-like",requireLike=browser?function(){}:require(requireLikeName),path=require("path"),removeProblematic=require("./remove-problematic");module.exports=function(fullSrcPath){var exports={},sandbox={console:global.console,module:{exports:exports,parent:null},exports:exports,process:cleanProcess(process)},serverside={require:requireLike(fullSrcPath),__filename:fullSrcPath,__dirname:path.dirname(fullSrcPath),Buffer:require("buffer").Buffer,ArrayBuffer:global.ArrayBuffer,Int8Array:global.Int8Array,Uint8Array:global.Uint8Array,Uint8ClampedArray:global.Uint8ClampedArray,Int16Array:global.Int16Array,Uint16Array:global.Uint16Array,Int32Array:global.Int32Array,Uint32Array:global.Uint32Array,Float32Array:global.Float32Array,Float64Array:global.Float64Array,DataView:global.DataView};return browser||Object.keys(serverside).forEach(function(k){sandbox[k]=serverside[k]}),sandbox}})(require("__browserify_process"),window)},{path:65,buffer:71,"./remove-problematic":61,__browserify_process:16}],27:[function(require,module){"use strict";function formatAdd(key,value,diffopts){return format("%s %s: %s",colors.brightGreen("+"),key,diffValues({},value,diffopts))}function formatChange(key,prevValue,value,diffopts){return format("%s %s: %s",colors.brigh
}function parseMultiplicativeExpression(){for(var expr=parseUnaryExpression();match("*")||match("/")||match("%");)expr={type:Syntax.BinaryExpression,operator:lex().value,left:expr,right:parseUnaryExpression()};return expr}function parseAdditiveExpression(){for(var expr=parseMultiplicativeExpression();match("+")||match("-");)expr={type:Syntax.BinaryExpression,operator:lex().value,left:expr,right:parseMultiplicativeExpression()};return expr}function parseShiftExpression(){for(var expr=parseAdditiveExpression();match("< < ")||match(">>")||match(">>>");)expr={type:Syntax.BinaryExpression,operator:lex().value,left:expr,right:parseAdditiveExpression()};return expr}function parseRelationalExpression(){var expr,previousAllowIn;for(previousAllowIn=state.allowIn,state.allowIn=!0,expr=parseShiftExpression();match("< ")||match(">")||match("< =")||match(">=")||previousAllowIn&&matchKeyword("in")||matchKeyword("instanceof"); )expr={type:Syntax.BinaryExpression,operator:lex().value,left:expr,right:parseShiftExpression()};return state.allowIn=previousAllowIn,expr}function parseEqualityExpression(){for(var expr=parseRelationalExpression();match("==")||match("!=")||match("===")||match("!==");)expr={type:Syntax.BinaryExpression,operator:lex().value,left:expr,right:parseRelationalExpression()};return expr}function parseBitwiseANDExpression(){for(var expr=parseEqualityExpression();match("&"); )lex(),expr={type:Syntax.BinaryExpression,operator:"&",left:expr,right:parseEqualityExpression()}; return expr}function parseBitwiseXORExpression(){for(var expr=parseBitwiseANDExpression();match("^");)lex(),expr={type:Syntax.BinaryExpression,operator:"^",left:expr,right:parseBitwiseANDExpression()};return expr}function parseBitwiseORExpression(){for(var expr=parseBitwiseXORExpression();match("|");)lex(),expr={type:Syntax.BinaryExpression,operator:"|",left:expr,right:parseBitwiseXORExpression()};return expr}function parseLogicalANDExpression(){for(var expr=parseBitwiseORExpression();match("&&"); )lex(),expr={type:Syntax.LogicalExpression,operator:"&&",left:expr,right:parseBitwiseORExpression()}; return expr}function parseLogicalORExpression(){for(var expr=parseLogicalANDExpression();match("||");)lex(),expr={type:Syntax.LogicalExpression,operator:"||",left:expr,right:parseLogicalANDExpression()};return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent;return expr=parseLogicalORExpression(),match("?")& & (lex(),previousAllowIn=state.allowIn,state.allowIn=!0,consequent=parseAssignmentExpression(),state.allowIn=previousAllowIn,expect(":"),expr={type:Syntax.ConditionalExpression,test:expr,consequent:consequent,alternate:parseAssignmentExpression()}),expr}function parseAssignmentExpression(){var token,expr;return token=lookahead(),expr=parseConditionalExpression(),matchAssign()& & (isLeftHandSide(expr)||throwError({},Messages.InvalidLHSInAssignment),strict& & expr.type===Syntax.Identifier& & isRestrictedWord(expr.name)& & throwErrorTolerant(token,Messages.StrictLHSAssignment),expr={type:Syntax.AssignmentExpression,operator:lex().value,left:expr,right:parseAssignmentExpression()}),expr}function parseExpression(){var expr=parseAssignmentExpression();if(match(","))for(expr={type:Syntax.SequenceExpression,expressions:[expr]};length>index&&match(","); )lex(),expr.expressions.push(parseAssignmentExpression());return expr}function parseStatementList(){for(var statement,list=[];length>index& & !match("}")& & (statement=parseSourceElement(),void 0!==statement);)list.push(statement);return list}function parseBlock(){var block;return expect("{"),block=parseStatementList(),expect("}"),{type:Syntax.BlockStatement,body:block}}function parseVariableIdentifier(){var token=lex();return token.type!==Token.Identifier& & throwUnexpected(token),{type:Syntax.Identifier,name:token.value}}function parseVariableDeclaration(kind){var id=parseVariableIdentifier(),init=null;return strict& & isRestrictedWord(id.name)& & throwErrorTolerant({},Messages.StrictVarName),"const"===kind?(expect("="),init=parseAssignmentExpression()):match("=")& & (lex(),init=parseAssignmentExpression()),{type:Synt
toString=String,"string"==typeof code||code instanceof String||(code=toString(code)),source=code,index=0,lineNumber=source.length>0?1:0,lineStart=0,length=source.length,buffer=null,state={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1},extra={},options!==void 0& & (extra.range="boolean"==typeof options.range& & options.range,extra.loc="boolean"==typeof options.loc& & options.loc,extra.raw="boolean"==typeof options.raw& & options.raw,"boolean"==typeof options.tokens& & options.tokens& & (extra.tokens=[]),"boolean"==typeof options.comment& & options.comment& & (extra.comments=[]),"boolean"==typeof options.tolerant& & options.tolerant& & (extra.errors=[])),length>0& & source[0]===void 0& & (code instanceof String& & (source=code.valueOf()),source[0]===void 0&&(source=stringToArray(code))),patch(); try{program=parseProgram(),extra.comments!==void 0& & (filterCommentLocation(),program.comments=extra.comments),extra.tokens!==void 0& & (filterTokenLocation(),program.tokens=extra.tokens),extra.errors!==void 0& & (program.errors=extra.errors),(extra.range||extra.loc)& & (program.body=filterGroup(program.body))}catch(e){throw e}finally{unpatch(),extra={}}return program}var Token,TokenName,Syntax,PropertyKind,Messages,Regex,source,strict,index,lineNumber,lineStart,length,buffer,state,extra;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},TokenName={},TokenName[Token.BooleanLiteral]="Boolean",TokenName[Token.EOF]="< end > ",TokenName[Token.Identifier]="Identifier",TokenName[Token.Keyword]="Keyword",TokenName[Token.NullLiteral]="Null",TokenName[Token.NumericLiteral]="Numeric",TokenName[Token.Punctuator]="Punctuator",TokenName[Token.StringLiteral]="String",Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},PropertyKind={Data:1,Get:2,Set:4},Messages={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mo
case"utf8":case"utf-8":ret=this.parent.utf8Write(string,this.offset+offset,length);break;case"ascii":ret=this.parent.asciiWrite(string,this.offset+offset,length);break;case"binary":ret=this.parent.binaryWrite(string,this.offset+offset,length);break;case"base64":ret=this.parent.base64Write(string,this.offset+offset,length);break;case"ucs2":case"ucs-2":ret=this.parent.ucs2Write(string,this.offset+offset,length);break;default:throw Error("Unknown encoding")}return Buffer._charsWritten=SlowBuffer._charsWritten,ret},Buffer.prototype.toString=function(encoding,start,end){switch(encoding=((encoding||"utf8")+"").toLowerCase(),start===void 0||0>start?start=0:start>this.length& & (start=this.length),end===void 0||end>this.length?end=this.length:0>end& & (end=0),start+=this.offset,end+=this.offset,encoding){case"hex":return this.parent.hexSlice(start,end);case"utf8":case"utf-8":return this.parent.utf8Slice(start,end);case"ascii":return this.parent.asciiSlice(start,end);case"binary":return this.parent.binarySlice(start,end);case"base64":return this.parent.base64Slice(start,end);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(start,end);default:throw Error("Unknown encoding")}},Buffer.byteLength=SlowBuffer.byteLength,Buffer.prototype.fill=function(value,start,end){if(value||(value=0),start||(start=0),end||(end=this.length),"string"==typeof value& & (value=value.charCodeAt(0)),"number"!=typeof value||isNaN(value))throw Error("value is not a number");if(start>end)throw Error("end < start " ) ; if ( end = ==start)return 0 ; if ( 0 = =this.length)return 0 ; if ( 0 > start||start>=this.length)throw Error("start out of bounds");if(0>end||end>this.length)throw Error("end out of bounds");return this.parent.fill(value,start+this.offset,end+this.offset)},Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(start||(start=0),end||(end=this.length),target_start||(target_start=0),start>end)throw Error("sourceEnd < sourceStart " ) ; if ( end = ==start)return 0 ; if ( 0 = =target.length||0==source.length)return 0 ; if ( 0 > target_start||target_start>=target.length)throw Error("targetStart out of bounds");if(0>start||start>=source.length)throw Error("sourceStart out of bounds");if(0>end||end>source.length)throw Error("sourceEnd out of bounds");return end>this.length& & (end=this.length),end-start>target.length-target_start& & (end=target.length-target_start+start),this.parent.copy(target.parent,target_start+target.offset,start+this.offset,end+this.offset)},Buffer.prototype.slice=function(start,end){if(void 0===end& & (end=this.length),end>this.length)throw Error("oob");if(start>end)throw Error("oob");return new Buffer(this.parent,end-start,+start+this.offset)},Buffer.prototype.utf8Slice=function(start,end){return this.toString("utf8",start,end)},Buffer.prototype.binarySlice=function(start,end){return this.toString("binary",start,end)},Buffer.prototype.asciiSlice=function(start,end){return this.toString("ascii",start,end)},Buffer.prototype.utf8Write=function(string,offset){return this.write(string,offset,"utf8")},Buffer.prototype.binaryWrite=function(string,offset){return this.write(string,offset,"binary")},Buffer.prototype.asciiWrite=function(string,offset){return this.write(string,offset,"ascii")},Buffer.prototype.readUInt8=function(offset,noAssert){var buffer=this;return noAssert||(assert.ok(void 0!==offset& & null!==offset,"missing offset"),assert.ok(buffer.length>offset,"Trying to read beyond buffer length")),offset>=buffer.length?void 0:buffer.parent[buffer.offset+offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return readUInt16(this,offset,!1,noAssert)},Buffer.prototype.readUInt16BE=function(offset,noAssert){return readUInt16(this,offset,!0,noAssert)},Buffer.prototype.readUInt32LE=function(offset,noAssert){return readUInt32(this,offset,!1,noAssert)},Buffer.prototype.readUInt32BE=function(offset,noAssert){return readUInt32(this,offset,!0,noAssert)},Buffer.prototype.readInt8=function(offset,noAssert){var neg,buffer=this;return noAssert||(assert.ok(void 0!==offset& & null!==offset,"missing offset"),assert.ok(buffer.length>offset,"Trying to read beyond
switch(encoding){case"hex":return this.hexSlice(start,end);case"utf8":case"utf-8":return this.utf8Slice(start,end);case"ascii":return this.asciiSlice(start,end);case"binary":return this.binarySlice(start,end);case"base64":return this.base64Slice(start,end);case"ucs2":case"ucs-2":return this.ucs2Slice(start,end);default:throw Error("Unknown encoding")}},SlowBuffer.prototype.hexWrite=function(string,offset,length){offset=+offset||0;var remaining=this.length-offset;length?(length=+length,length>remaining&&(length=remaining)):length=remaining; var strLen=string.length;if(strLen%2)throw Error("Invalid hex string");length>strLen/2&&(length=strLen/2); for(var i=0;length>i;i++){var byte=parseInt(string.substr(2*i,2),16);if(isNaN(byte))throw Error("Invalid hex string");this[offset+i]=byte}return SlowBuffer._charsWritten=2*i,i},SlowBuffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset))isFinite(length)||(encoding=length,length=void 0);else{var swap=encoding;encoding=offset,offset=length,length=swap}offset=+offset||0;var remaining=this.length-offset;switch(length?(length=+length,length>remaining& & (length=remaining)):length=remaining,encoding=((encoding||"utf8")+"").toLowerCase()){case"hex":return this.hexWrite(string,offset,length);case"utf8":case"utf-8":return this.utf8Write(string,offset,length);case"ascii":return this.asciiWrite(string,offset,length);case"binary":return this.binaryWrite(string,offset,length);case"base64":return this.base64Write(string,offset,length);case"ucs2":case"ucs-2":return this.ucs2Write(string,offset,length);default:throw Error("Unknown encoding")}},SlowBuffer.prototype.slice=function(start,end){if(void 0===end& & (end=this.length),end>this.length)throw Error("oob");if(start>end)throw Error("oob");return new Buffer(this,end-start,+start)},SlowBuffer.prototype.copy=function(target,targetstart,sourcestart,sourceend){for(var temp=[],i=sourcestart;sourceend>i;i++)assert.ok(this[i]!==void 0,"copying undefined buffer bytes!"),temp.push(this[i]);for(var i=targetstart;targetstart+temp.length>i;i++)target[i]=temp[i-targetstart]},exports.SlowBuffer=SlowBuffer,exports.Buffer=Buffer,Buffer.poolSize=8192;var pool;Buffer.isBuffer=function(b){return b instanceof Buffer||b instanceof SlowBuffer},Buffer.concat=function(list,totalLength){if(!Array.isArray(list))throw Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===list.length)return new Buffer(0);if(1===list.length)return list[0];if("number"!=typeof totalLength){totalLength=0;for(var i=0;list.length>i;i++){var buf=list[i];totalLength+=buf.length}}for(var buffer=new Buffer(totalLength),pos=0,i=0;list.length>i;i++){var buf=list[i];buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.prototype.inspect=function(){for(var out=[],len=this.length,i=0;len>i;i++)if(out[i]=toHex(this.parent[i+this.offset]),i==exports.INSPECT_MAX_BYTES){out[i+1]="...";break}return"< Buffer " + out . join ( " " ) + " > "},Buffer.prototype.get=function(i){if(0>i||i>=this.length)throw Error("oob");return this.parent[this.offset+i]},Buffer.prototype.set=function(i,v){if(0>i||i>=this.length)throw Error("oob");return this.parent[this.offset+i]=v},Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset))isFinite(length)||(encoding=length,length=void 0);else{var swap=encoding;encoding=offset,offset=length,length=swap}offset=+offset||0;var remaining=this.length-offset;length?(length=+length,length>remaining&&(length=remaining)):length=remaining,encoding=((encoding||"utf8")+"").toLowerCase(); var ret;switch(encoding){case"hex":ret=this.parent.hexWrite(string,this.offset+offset,length);break;case"utf8":case"utf-8":ret=this.parent.utf8Write(string,this.offset+offset,length);break;case"ascii":ret=this.parent.asciiWrite(string,this.offset+offset,length);break;case"binary":ret=this.parent.binaryWrite(string,this.offset+offset,length);break;case"base64":ret=this.parent.base64Write(string,this.offset+offset,length);break;case"ucs2":case"ucs-2":ret=this.parent.ucs2Write(string,this.offset+offset,length);break;default:throw Error("Un
if(0>end||end>this.length)throw Error("end out of bounds");return this.parent.fill(value,start+this.offset,end+this.offset)},Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(start||(start=0),end||(end=this.length),target_start||(target_start=0),start>end)throw Error("sourceEnd < sourceStart " ) ; if ( end = ==start)return 0 ; if ( 0 = =target.length||0==source.length)return 0 ; if ( 0 > target_start||target_start>=target.length)throw Error("targetStart out of bounds");if(0>start||start>=source.length)throw Error("sourceStart out of bounds");if(0>end||end>source.length)throw Error("sourceEnd out of bounds");return end>this.length& & (end=this.length),end-start>target.length-target_start& & (end=target.length-target_start+start),this.parent.copy(target.parent,target_start+target.offset,start+this.offset,end+this.offset)},Buffer.prototype.slice=function(start,end){if(void 0===end& & (end=this.length),end>this.length)throw Error("oob");if(start>end)throw Error("oob");return new Buffer(this.parent,end-start,+start+this.offset)},Buffer.prototype.utf8Slice=function(start,end){return this.toString("utf8",start,end)},Buffer.prototype.binarySlice=function(start,end){return this.toString("binary",start,end)},Buffer.prototype.asciiSlice=function(start,end){return this.toString("ascii",start,end)},Buffer.prototype.utf8Write=function(string,offset){return this.write(string,offset,"utf8")},Buffer.prototype.binaryWrite=function(string,offset){return this.write(string,offset,"binary")},Buffer.prototype.asciiWrite=function(string,offset){return this.write(string,offset,"ascii")},Buffer.prototype.readUInt8=function(offset,noAssert){var buffer=this;return noAssert||(assert.ok(void 0!==offset& & null!==offset,"missing offset"),assert.ok(buffer.length>offset,"Trying to read beyond buffer length")),offset>=buffer.length?void 0:buffer.parent[buffer.offset+offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return readUInt16(this,offset,!1,noAssert)},Buffer.prototype.readUInt16BE=function(offset,noAssert){return readUInt16(this,offset,!0,noAssert)},Buffer.prototype.readUInt32LE=function(offset,noAssert){return readUInt32(this,offset,!1,noAssert)},Buffer.prototype.readUInt32BE=function(offset,noAssert){return readUInt32(this,offset,!0,noAssert)},Buffer.prototype.readInt8=function(offset,noAssert){var neg,buffer=this;return noAssert||(assert.ok(void 0!==offset& & null!==offset,"missing offset"),assert.ok(buffer.length>offset,"Trying to read beyond buffer length")),offset>=buffer.length?void 0:(neg=128& buffer.parent[buffer.offset+offset],neg?-1*(255-buffer.parent[buffer.offset+offset]+1):buffer.parent[buffer.offset+offset])},Buffer.prototype.readInt16LE=function(offset,noAssert){return readInt16(this,offset,!1,noAssert)},Buffer.prototype.readInt16BE=function(offset,noAssert){return readInt16(this,offset,!0,noAssert)},Buffer.prototype.readInt32LE=function(offset,noAssert){return readInt32(this,offset,!1,noAssert)},Buffer.prototype.readInt32BE=function(offset,noAssert){return readInt32(this,offset,!0,noAssert)},Buffer.prototype.readFloatLE=function(offset,noAssert){return readFloat(this,offset,!1,noAssert)},Buffer.prototype.readFloatBE=function(offset,noAssert){return readFloat(this,offset,!0,noAssert)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return readDouble(this,offset,!1,noAssert)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return readDouble(this,offset,!0,noAssert)},Buffer.prototype.writeUInt8=function(value,offset,noAssert){var buffer=this;noAssert||(assert.ok(void 0!==value& & null!==value,"missing value"),assert.ok(void 0!==offset& & null!==offset,"missing offset"),assert.ok(buffer.length>offset,"trying to write beyond buffer length"),verifuint(value,255)),buffer.length>offset& & (buffer.parent[buffer.offset+offset]=value)},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){writeUInt16(this,value,offset,!1,noAssert)},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){writeUInt16(this,value,offset,!0,noAssert)},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){writeUIn
normalize(config),all=mergeTokensAndComments(tokens,comments);for(var tokenIdx=0;all.length>tokenIdx;tokenIdx++){var surround,start,end,token=all[tokenIdx],surroundForType=config[token.type];surroundForType& & (surround=surroundForType& & surroundForType.hasOwnProperty(token.value)& & surroundForType[token.value]& & isFunction(surroundForType[token.value])?surroundForType[token.value]:surroundForType._default,start=token.range[0],end=token.range[1],addSplit(lastSplitEnd,start),info={tokenIndex:tokenIdx,tokens:all,ast:ast,code:code},tokenIdx+=addSplit(start,end,surround,info))}return code.length>lastSplitEnd& & addSplit(lastSplitEnd,code.length),transformedCode=opts.nojoin?void 0:splits.join(""),{ast:ast,tokens:tokens,comments:comments,splits:splits,code:transformedCode}}return exportFn?exportFn(redeyed):redeyed}var esprima,exportFn,toString=Object.prototype.toString;"object"==typeof module& & "object"==typeof module.exports& & "function"==typeof require?(esprima=require("esprima"),exportFn=function(redeyed){module.exports=redeyed},bootstrap(esprima,exportFn)):"function"==typeof define& & define.amd?define(["esprima"],function(esprima){return bootstrap(esprima)}):"object"==typeof window& & (window.redeyed=bootstrap(window.esprima))})()})()},{esprima:70}],86:[function(require,module){(function(Buffer){var encode=module.exports=function(xs){function bytes(s){return"string"==typeof s?s.split("").map(ord):Array.isArray(s)?s.reduce(function(acc,c){return acc.concat(bytes(c))},[]):void 0}return new Buffer([27].concat(bytes(xs)))},ord=encode.ord=function ord(c){return c.charCodeAt(0)}})(require("__browserify_buffer").Buffer)},{__browserify_buffer:77}]},{},[1]);
< / script >
<!-- shader - doodle.js -->
< script >
'use strict';(function(z,A){"object"===typeof exports& & "undefined"!==typeof module?A(exports):"function"===typeof define& & define.amd?define(["exports"],A):(z=z||self,A(z.ShaderDoodle={}))})(this,function(z){function A(a){function b(a){console.log(a);e.add(a.targetElement)}function d(b){e.has(b.targetElement)?e.delete(b.targetElement):(b=a.createBufferSource(),b.buffer=a.createBuffer(1,1,a.sampleRate),b.connect(a.destination),b.start(0),"function"===typeof a.resume& & a.resume().then(c),f())}function c(){v.forEach(a=>
{a()})}function f(){p.forEach(a=>{a.removeEventListener("touchstart",d);a.removeEventListener("touchmove",b);a.removeEventListener("touchend",d);a.removeEventListener("mouseup",d)});p.clear();e.clear()}let e=new Set,p=new Set,v=[];return{onStart:function(b){"running"===a.state?(console.log("already"),b()):v.push(b)},register:function(a){a.addEventListener("touchstart",d);a.addEventListener("touchmove",b);a.addEventListener("touchend",d);a.addEventListener("mouseup",d);p.add(a)},dispose:f}}function ca(){function a(a){d[0].value[0]=
a.alpha;d[0].value[1]=a.beta;d[0].value[2]=a.gamma}let b=!1,d=JSON.parse(JSON.stringify(L));return{get ustate(){return d},setup:function(){b||(b=!0,"object"===typeof DeviceOrientationEvent& & "function"===typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(b=>{"granted"===b& & window.addEventListener("deviceorientation",a)}).catch(console.error):window.addEventListener("deviceorientation",a))},dispose:function(){window.removeEventListener("deviceorientation",
a)}}}function da(a){let b={},d=a.getExtension.bind(a);return{get:function(a){if(void 0!==b[a])return b[a];let c=d(a)||d("MOZ_".concat(a))||d("WEBKIT_".concat(a));null===c& & console.warn("< shader-doodle / > ".concat(a," extension not supported."));return b[a]=c}}}function C(){function a(a,b){if(a>n||b>h)a=Math.max(a,n),b=Math.max(b,h),a!==n& & (n=a,c.width=Math.floor(1*n)),b!==h& & (h=b,c.height=Math.floor(1*h))}function b(a){let b=l?(a-l)/1E3:0;l=a;k[0].value+=b;k[1].value=b;k[3].value++;a=new Date;k[2].value[0]=
a.getFullYear();k[2].value[1]=a.getMonth()+1;k[2].value[2]=a.getDate();k[2].value[3]=3600*a.getHours()+60*a.getMinutes()+a.getSeconds()+.001*a.getMilliseconds()}function d(f){if(m.size){b(f);var u=[...k,...e.ustate];m.forEach(b=>b.render(c,a,n,h,1,u));q=requestAnimationFrame(d)}else q=void 0}let c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),f=c.getContext("webgl")||c.getContext("experimental-webgl"),e=ca(),p=new (window.AudioContext||window.webkitAudioContext),v=new A(p);p.onStart=
v.onStart;f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.enable(f.BLEND);let n=0,h=0,q,l,m=new Set,k=JSON.parse(JSON.stringify(M)),w=da(f);w.get("OES_texture_float");w.get("OES_texture_float_linear");w.get("OES_texture_half_float");w.get("OES_texture_half_float_linear");f.clearColor(0,0,0,0);return Object.freeze({get gl(){return f},get wa(){return p},addSurface:function(a){v.register(a.dom);a.addClick(e.setup);m.add(a);q||(q=requestAnimationFrame(d))},removeSurface:function(a){m.delete(a)},addUniform:function(a,
b,c){for(let d=0;d< k.length ; d + + ) if ( k [ d ] . name = ==a){k[d].value=b;k[d].type=c;return}k.push({name:a,value:b,type:c,toyname:a})},setUniform:function(a,b){for(let c = 0;c<k.length;c++)if(k[c].name===a){k[c].value=b;break}},dispose:function(){m.forEach(a= > a.dispose());m.clear();m=void 0;cancelAnimationFrame(q);e.dispose();v.dispose()}})}function ea(a,b){let d={},c=a.getProgramParameter(b,a.ACTIVE_ATTRIBUTES);for(let f=0;f< c ; f + + ) { let { name:c } = a . getActiveAttrib ( b , f ) ; d [ c ] = a . getAttribLocation ( b , c ) } return d } function N ( a ) { function b ( b ) { a . texParameteri ( a . TEXTURE_2D ,
a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,b?a.NEAREST:a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,b?a.NEAREST:a.LINEAR)}let d,c,f=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,f);let e=a.createTexture();if(!e)throw Error("createTexture returned null");a.bindTexture(a.TEXTURE_2D,e);b(!0);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0);return{get handle(){return f},
get texture(){return e},updateTexture:b,bind:function(){a.bindFramebuffer(a.FRAMEBUFFER,f);a.viewport(0,0,d,c)},updateResolution:function(b,f){if(b!==d||f!==c)d=b,c=f,a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,b,f,0,a.RGBA,a.FLOAT,null)},dispose:function(){a.deleteFramebuffer(f);a.deleteTexture(e)}}}function O(a,b,d){b=a.createShader(b);a.shaderSource(b,d);a.compileShader(b);if(!a.getShaderParameter(b,a.COMPILE_STATUS)){let c=a.getShaderInfoLog(b);a.deleteShader(b);console.warn(c,
"\nin shader:\n",d)}return b}function H(a,b){if(a.length!==b.length)return!1;for(let d=0,c=a.length;d< c ; d + + ) if ( a [ d ] ! = = b [ d ] ) return ! 1 ; return ! 0 } function I ( a , b ) { for ( let d = 0,c=b.length;d<c;d++)a[d]=b[d]}function fa ( a , b , d , c ) { a [ 0 ] ! = = c & & ( d . uniform1f ( b , c ) , a [ 0 ] = c ) } function ha ( a , b , d , c ) { H ( a , c ) | | ( d . uniform2fv ( b , c ) , I ( a , c ) ) } function ia ( a , b , d , c ) { H ( a , c ) | | ( d . uniform3fv ( b , c ) , I ( a , c ) ) } function ja ( a , b , d , c ) { H ( a , c ) | | ( d . uniform4fv ( b , c ) , I ( a , c ) ) } function ka ( a , b , d , c ) { a [ 0 ] ! = = c & & ( d . uniform1i ( b , c ) , a [ 0 ] = c ) } function la ( a ) { switch ( a ) { case 5126:return fa ;
case 35664:return ha;case 35665:return ia;case 35666:return ja;case 35678:case 36198:return ka}}function ma(a,b,d){let c=[],f=la(b.type);return{get location(){return d},get name(){return b.name},setValue:function(...b){f(c,d,a,...b)}}}function na(a,b){let d={},c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(let e=0;e< c ; e + + ) { var f = a.getActiveUniform(b,e);let c = a.getUniformLocation(b,f.name);f=ma(a,f,c);d[f.name]=f}return d } function oa ( a , b ) { if ( b ) { let b = a.match(P);a=a.replace("mainImage","main");a=
a.replace(P,"()");a=(b?"#define ".concat(b[1]," gl_FragColor\n#define ").concat(b[2]," gl_FragCoord.xy\n"):"")+a}a=pa(qa,b)+a;return"precision highp float;\n"+a}function ra(a,b,d,c,f=!1){function e(a){let b=r[F(a,f,"name")];b& & b.setValue(F(a,f,"value"))}function p(b){b.forEach(e);t.forEach(a=>a.update(e));k&&r.u_prevbuffer&&(b=r.u_prevbuffer)&&(b.setValue(w),a.activeTexture(a["TEXTURE".concat(w)]),a.bindTexture(a.TEXTURE_2D,k.texture),k.updateTexture()); g.forEach(b=>{r[b.name].setValue(b.u);a.activeTexture(a["TEXTURE".concat(b.u)]);
a.bindTexture(a.TEXTURE_2D,b.fbo.texture);b.fbo.updateTexture()})}let v=sa++,n=a.createProgram(),h=a.createBuffer();b=O(a,a.VERTEX_SHADER,b);d=O(a,a.FRAGMENT_SHADER,oa(d,f));a.attachShader(n,b);a.attachShader(n,d);a.linkProgram(n);let q,l,m,k,w,u=ea(a,n),r=na(a,n),g=new Set,t=new Set,x=0;if(!a.getProgramParameter(n,a.LINK_STATUS)){let b=a.getProgramInfoLog(n);console.warn(b)}a.detachShader(n,b);a.detachShader(n,d);a.deleteShader(b);a.deleteShader(d);b=u.position;a.bindBuffer(a.ARRAY_BUFFER,h);a.bufferData(a.ARRAY_BUFFER,
c,a.STATIC_DRAW);a.enableVertexAttribArray(b);a.vertexAttribPointer(b,2,a.FLOAT,!1,0,0);return{get id(){return v},get nodes(){return g},get fbo(){return m},get name(){return q},get u(){return l},render:function(b,c,d){g.size&&g.forEach(a=>a.render(b,c,d)); if(m){if(k){let a=m;m=k;k=a;k.bind();k.updateResolution(b,c)}m.updateResolution(b,c);m.bind()}else a.bindFramebuffer(a.FRAMEBUFFER,null),a.viewport(0,0,b,c);a.clear(a.COLOR_BUFFER_BIT);a.useProgram(n);p(d);a.drawArrays(a.TRIANGLES,0,6)},addNode:function(a,
b,c){a.toFbo(b,x++,c);g.add(a)},removeNode:function(a){g.delete(a)},addTexture:function(a){t.add(a)},removeTexture:function(a){t.delete(a)},getTexUnit:function(){return x++},update:p,toFbo:function(b,c,d){q=b;l=c;m=N(a);d&&(k=N(a),w=x++)},dispose:function(){t.forEach(a=>a.dispose()); t.clear();a.deleteProgram(n)}}}function Q(a){if(!a)return[0,0];let b=(a.tagName||"").toLowerCase();return"video"===b?[a.videoWidth,a.videoHeight]:"img"===b?[a.naturalWidth,a.naturalHeight]:[a.width,a.height]}function R(a,
b,d={}){function c(){a.getParameter(a.ACTIVE_TEXTURE)!==b& & a.activeTexture(a["TEXTURE".concat(b)])}function f(){h.forEach(b=>{a.texParameteri(p,b[0],b[1])})}function e(b){if("object"===typeof b){Object.assign(n,b);c();a.bindTexture(p,v);var {level:d,internalFormat:e,offsetX:h,offsetY:r,width:g,height:t,border:m,format:B,type:D,flipY:z,buffer:y,pixels:A}=n;f();a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,z);if(A){let [c,d]=Q(A);if(0===c||0===d){console.warn("Texture size is invalid ".concat(c," x ").concat(d,
". Update is skipped;"));return}{({pixels:b}=n);var J=a.getTexParameter(p,a.TEXTURE_WRAP_S);let c=a.getTexParameter(p,a.TEXTURE_WRAP_T),d=a.getTexParameter(p,a.TEXTURE_MIN_FILTER),f=G(b.width)&&G(b.height); (J=J!==a.CLAMP_TO_EDGE||c!==a.CLAMP_TO_EDGE||d!==a.LINEAR& & d!==a.NEAREST)& & !f& & (l||(l=document.createElement("canvas"),l.width=2**Math.floor(Math.log(b.width)/Math.LN2),l.height=2**Math.floor(Math.log(b.height)/Math.LN2),console.warn("Texture is not power of two ".concat(b.width," x ").concat(b.height,
". Resized to ").concat(l.width," x ").concat(l.height,";"))),l.getContext("2d").drawImage(b,0,0,l.width,l.height));q=J& & l||b}}"number"===typeof h& & "number"===typeof r?q?a.texSubImage2D(p,d,h,r,B,D,q):a.texSubImage2D(p,d,h,r,g,t,B,D,y):q?a.texImage2D(p,d,e,B,D,q):a.texImage2D(p,d,e,g,t,m,B,D,y);q& & G(q.width)& & G(q.height)& & (b=a.getTexParameter(p,a.TEXTURE_MIN_FILTER),b!==a.LINEAR& & b!==a.NEAREST& & a.generateMipmap(p))}}let p=a.TEXTURE_2D,v=a.createTexture(),n={},h=[],q,l;e(Object.assign({level:0,internalFormat:a.RGBA,
offsetX:null,offsetY:null,width:1,height:1,border:0,format:a.RGBA,type:a.UNSIGNED_BYTE,flipY:!0,buffer:ta,pixels:null},"object"===typeof d?d:{}));return{setParameters:function(b){c();h.length=0;b.forEach(b=>{h.push(b);a.texParameteri(p,b[0],b[1])})},shallow:function(){c();a.bindTexture(p,v);f()},update:e,dispose:function(){a.deleteTexture(v)}}}function ua(a){return new Promise((b,d)=>{let c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onreadystatechange=()=>{c.readyState===
XMLHttpRequest.DONE&&(200===c.status||206===c.status?b(c.response):(console.log(c),d(c.status)))}; c.send()})}function va(a,b){return new Promise((d,c)=>{b.decodeAudioData(a,d,c)})}function wa(a,b,d,c,f,e,p,v){async function n(){g=l.createBufferSource();g.buffer=await va(await ua(c),l);g.loop=e;g.start();t=!0}function h(){let a=document.querySelector(c);a& & a instanceof HTMLAudioElement& & (r=a,g=l.createMediaElementSource(a))}function q(a,b){a.connect(m);m.connect(b)}f=a.gl;let l=a.wa,m=l.createAnalyser();
m.fftSize=1024;let k=new Uint8Array(m.frequencyBinCount),w=new Uint8Array(m.frequencyBinCount),u=R(f,b,{internalFormat:f.LUMINANCE,width:w.length,height:2,format:f.LUMINANCE,buffer:null});u.setParameters([[f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE],[f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE],[f.TEXTURE_MIN_FILTER,f.NEAREST]]);let r,g,t=!1,x=[{name:d,value:b}];"#"===c[0]?h():c&&n(); g&&q(g,l.destination); return{dispose:function(){u.dispose()},update:function(a){x.forEach(a);if(t||r& & 2< r.readyState & & ! r . paused & & ! r . ended & &
r.currentTime)m.getByteFrequencyData(k),m.getByteTimeDomainData(w),u.update({offsetX:0,offsetY:0,height:1,buffer:k}),u.update({offsetX:0,offsetY:1,height:1,buffer:w})}}}function S(a,b){var d=Object.keys(a);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(a);b& & (c=c.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable}));d.push.apply(d,c)}return d}function T(a){let b=document.createElement("div");b.style.width=b.style.height="1px";b.style.overflow="hidden";b.style.position=
"absolute";b.style.opacity="0";b.style.pointerEvents="none";b.style.zIndex="-1000";b.appendChild(a);document.body.appendChild(b)}function xa(a,b,d,c,f,e,p,v,n,h){function q(){t=0;g=new Image;g.crossOrigin="anonymous";g.onload=l;g.onerror=()=>{console.warn("failed loading src: ".concat(c))};g.src=c}function l(){k();r.setParameters([[u.TEXTURE_WRAP_S,e],[u.TEXTURE_WRAP_T,p],[u.TEXTURE_MIN_FILTER,v],[u.TEXTURE_MAG_FILTER,n]]);r.update({pixels:g})}function m(){t=2;let a=navigator.getUserMedia||navigator.webkitGetUserMedia||
navigator.mozGetUserMedia,b=a=>{g=document.createElement("video");g.width=320;g.height=240;g.autoplay=!0;g.srcObject=a;T(g)},c=()=>{navigator.mediaDevices.getUserMedia({video:!0}).then(b).catch(a=>console.log(a.name+": "+a.message))},d=()=>{a({video:!0},b,a=>a)};navigator.mediaDevices& & navigator.mediaDevices.getUserMedia?c():a& & d()}function k(){if(g){let [a,b]=Q(g);x[1].value[0]=a;x[1].value[1]=b}}function w(){return(2===t||1===t)& & g instanceof HTMLVideoElement}let u=a.gl,r=R(u,b),g,t,x=[{name:d,
value:b},{name:d+"_resolution",value:[0,0]}],B=!1;if(f)m();else if(ya.test(c))t=1,g=document.createElement("video"),g.autoplay=!0,g.muted=!0,g.loop=!0,g.playsInline=!0,g.crossOrigin="anonymous",g.src=c,T(g),g.play();else if(za.test(c))q();else{try{g=document.querySelector(c)}catch(D){console.warn("src: ".concat(c,": invalid selector"))}g?g instanceof HTMLImageElement?(t=0,g.complete?l():g.addEventListener("load",l)):g instanceof HTMLVideoElement?t=1:g instanceof HTMLCanvasElement?(t=3,l()):g instanceof
K?(g=g.surface.dom,t=3,l()):console.warn("src: ".concat(c,": element is not a valid texture source")):console.warn("src: ".concat(c,": no element could be selected"))}return{dispose:function(){r.dispose()},update:function(a){x.forEach(a);h||w()& & g.readyState===g.HAVE_ENOUGH_DATA?(w()& & (B||(B=!0,k(),r.setParameters([[u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE],[u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE],[u.TEXTURE_MIN_FILTER,u.LINEAR]]))),r.update({pixels:g})):r.shallow()}}}function Aa(a){function b(a){n.forEach(a=>
"function"===typeof a&&a()); k=!0;a=U(a);let {top:b,left:c,height:d}=q;h[2].value[0]=h[2].value[2]=a[0]-Math.floor(c);h[2].value[1]=h[2].value[3]=Math.floor(d)-(a[1]-Math.floor(b))}function d(a){if(!m){a=U(a);let {top:b,left:c,height:d}=q;h[1].value[0]=a[0]-Math.floor(c);h[1].value[1]=Math.floor(d)-(a[1]-Math.floor(b));k&&(h[2].value[0]=h[1].value[0],h[2].value[1]=h[1].value[1]); m=!0}}function c(a){k=!1;1===Math.sign(h[2].value[2])&&(h[2].value[2]*=-1); 1===Math.sign(h[2].value[3])& & (h[2].value[3]*=
-1)}function f(){let b=e.getBoundingClientRect();l=0< =b.top+b.height&&0<=b.left+b.width&&b.bottom-b.height<=(window.innerHeight||document.documentElement.clientHeight)&&b.right-b.width<=(window.innerWidth||document.documentElement.clientWidth); let c=0< a.height ? a . height:b . height , d = 0<a.width?a.width:b.width;d!==h[0].value[0]&&(e.width=h[0].value[0]=d);c!==h[0].value[1]&&(e.height=h[0].value[1]=c);q=b}let e = a.canvas instanceof HTMLCanvasElement ? a . canvas:document . createElementNS ( " http: / / www . w3 . org / 1999 / xhtml " ,
"canvas"),p=e.getContext("2d"),v=a.program,n=new Set,h=JSON.parse(JSON.stringify(V)),q={},l,m,k;e.addEventListener("mousedown",b);e.addEventListener("mousemove",d);e.addEventListener("mouseup",c);e.addEventListener("mouseout",c);e.addEventListener("touchstart",b);e.addEventListener("touchmove",d);e.addEventListener("touchend",c);f();return Object.freeze({get dom(){return e},render:function(a,b,c,d,e,k){f();m=!1;if(l& & v){var g=h[0].value[0]||0;c=h[0].value[1]||0;b(g,c);v.render(g,c,[...k,...h]);b=
g*e;e*=c;p.clearRect(0,0,b,e);p.drawImage(a,0,d-e,b,e,0,0,b,e)}},addClick:function(a){n.add(a)},dispose:function(){n.clear();e.removeEventListener("mousedown",b);e.removeEventListener("mousemove",d);e.removeEventListener("mouseup",c);e.removeEventListener("mouseout",c);e.removeEventListener("touchstart",b);e.removeEventListener("touchmove",d);e.removeEventListener("touchend",c)}})}var W={render(a,b){return"".concat(this.css(a,b),"\n ").concat(this.html())},map(a){return{canvas:a.querySelector("canvas")}},
html(a){return"< canvas > < / canvas > "},css(a,b){return"< style > \ n : host { \ n position : relative ; \ n display : inline-block ; \ n width : ".concat(a||250," px ; \ n height : ").concat(b||250," px ; \ n } \ n : host > canvas { \ n position : absolute ; \ n top : 0 ; \ n left : 0 ; \ n height : 100 % ; \ n width : 100 % ; \ n border-radius : inherit ; \ n } \ n < / style > ")}};let M=[{name:"u_time",toyname:"iTime",type:"float",value:0},{name:"u_delta",toyname:"iTimeDelta",
type:"float",value:0},{name:"u_date",toyname:"iDate",type:"vec4",value:[0,0,0,0]},{name:"u_frame",toyname:"iFrame",type:"int",value:0}],V=[{name:"u_resolution",toyname:"iResolution",type:"vec2",value:[0,0]},{name:"u_mouse",toyname:"iCurrentMouse",type:"vec2",value:[0,0]},{name:"u_mousedrag",toyname:"iMouse",type:"vec4",value:[0,0,0,0]}],L=[{name:"u_orientation",toyname:"iOrientation",type:"vec3",value:[0,0,0]}],qa=[...M,...L,...V],P=/\(\s*out\s+vec4\s+(\S+)\s*,\s*in\s+vec2\s+(\S+)\s*\)/,y;C.singleton=
function(){y||(y=C());return y};C.resetSingleton=function(){y&&y.dispose(); y=C()};class E extends HTMLElement{get renderer(){return C.singleton()}get name(){return this.getAttribute("name")}set name(a){this.setAttribute("name",a)}}var F=(a,b,d)=>{if(!b)return a[d];b="toy".concat(d);return a.hasOwnProperty(b)?a[b]:a[d]},pa=(a,b)=>Object.values(a).reduce((a,c)=>a+"uniform ".concat(F(c,b,"type")," ").concat(F(c,b,"name"),";\n"),"");let sa=0;var Ba=a=>new Promise((b,d)=>{let c=new XMLHttpRequest;c.open("GET",
a);c.onreadystatechange=()=>{c.readyState===XMLHttpRequest.DONE&&(200===c.status?b(c.responseText):d(c.status))}; c.send()}),X=async a=>a.src?Ba(a.src):a.text;let Y=new Float32Array([-1,1,1,1,1,-1,-1,1,1,-1,-1,-1]),Ca=0;class Z extends E{disconnectedCallback(){this.program.dispose();this.program=void 0}get shadertoy(){return this.hasAttribute("shadertoy")}set shadertoy(a){a?this.setAttribute("shadertoy",""):this.removeAttribute("shadertoy")}get prevbuffer(){return this.hasAttribute("prevbuffer")}set prevbuffer(a){a?
this.setAttribute("prevbuffer",""):this.removeAttribute("prevbuffer")}get vertices(){let a=this.getAttribute("vertices");if(!a)return Y;a=JSON.parse(a);return Array.isArray(a)?new Float32Array(a):Y}set vertices(a){a& & Array.isArray(a)& & this.setAttribute("vertices",JSON.stringify(a))}async init(a){a&&!this.name&&(this.name="".concat("u_node").concat(Ca++)); let b=[],d,c;for(let a=0;a< this.children.length ; a + + ) { let e = this.children[a];if(e instanceof E ) b . push ( e ) ; else switch ( e . getAttribute ( " type " ) ) { case " x-shader / x-fragment " :c =
await X(e);break;case "x-shader/x-vertex":d=await X(e)}}this.program=ra(this.renderer.gl,d||"attribute vec2 position;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}",c,this.vertices,this.shadertoy);b.forEach(a=>{a.init(this.program)});a&&a.addNode(this.program,this.name,this.prevbuffer)}}customElements.get("sd-node")||customElements.define("sd-node",Z); let ta=new Uint8Array([0,0,0,255]),G=a=>!(a&a-1)&&!!a,Da=0; class Ea extends E{disconnectedCallback(){this.program.removeTexture(this.texture);
this.texture.dispose()}get src(){return this.getAttribute("src")}set src(a){this.setAttribute("src",a)}get autoplay(){return this.hasAttribute("autoplay")}set autoplay(a){a?this.setAttribute("autoplay",""):this.removeAttribute("autoplay")}get loop(){return this.hasAttribute("loop")}set loop(a){a?this.setAttribute("loop",""):this.removeAttribute("loop")}get crossOrigin(){return this.getAttribute("crossorigin")}set crossOrigin(a){this.setAttribute("crossorigin",a)}get mic(){return this.hasAttribute("mic")}set mic(a){a?
this.setAttribute("mic",""):this.removeAttribute("mic")}init(a){this.name||(this.name="".concat("u_audio").concat(Da++));this.src&&(this.program=a,this.texture=wa(this.renderer,a.getTexUnit(),this.name,this.src,this.mic,this.loop,this.autoplay,this.crossOrigin),a.addTexture(this.texture))}}customElements.get("sd-audio")||customElements.define("sd-audio",Ea); let za=/\w+\.(jpg|jpeg|png|gif|bmp)(?=\?|$)/i,ya=/\w+\.(mp4|3gp|webm|ogv)(?=\?|$)/i,aa={NEAREST:9728,LINEAR:9729},Fa=function(a){for(var b=1;b<
arguments.length;b++){var d=null!=arguments[b]?arguments[b]:{};b%2?S(d,!0).forEach(function(b){var c=d[b];b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(d)):S(d).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(d,b))})}return a}({},aa,{NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987}),
ba={REPEAT:10497,MIRRORED_REPEAT:33648,CLAMP_TO_EDGE:33071},Ga=0;class Ha extends E{static get observedAttributes(){return"mag-filter min-filter name src wrap-s wrap-t".split(" ")}disconnectedCallback(){this.program.removeTexture(this.texture);this.texture.dispose()}get forceUpdate(){return this.hasAttribute("force-update")}set forceUpdate(a){a?this.setAttribute("force-update",""):this.removeAttribute("force-update")}get magFilter(){return aa[this.getAttribute("mag-filter")]||9729}get minFilter(){return Fa[this.getAttribute("min-filter")]||
9987}get src(){return this.getAttribute("src")}set src(a){this.setAttribute("src",a)}get webcam(){return this.hasAttribute("webcam")}set webcam(a){a?this.setAttribute("webcam",""):this.removeAttribute("webcam")}get wrapS(){return ba[this.getAttribute("wrap-s")]||10497}get wrapT(){return ba[this.getAttribute("wrap-t")]||10497}init(a){this.name||(this.name="".concat("u_texture").concat(Ga++));if(this.src||this.webcam)this.program=a,this.texture=xa(this.renderer,a.getTexUnit(),this.name,this.src,this.webcam,
this.wrapS,this.wrapT,this.minFilter,this.magFilter,this.forceUpdate),a.addTexture(this.texture)}}customElements.get("sd-texture")||customElements.define("sd-texture",Ha);class Ia extends E{disconnectedCallback(){}get x(){return parseFloat(this.getAttribute("x"))}set x(a){null!=a?this.setAttribute("x",a):this.removeAttribute("x")}get y(){return parseFloat(this.getAttribute("y"))}set y(a){null!=a?this.setAttribute("y",a):this.removeAttribute("y")}get z(){return parseFloat(this.getAttribute("z"))}set z(a){null!=
a?this.setAttribute("z",a):this.removeAttribute("z")}get w(){return parseFloat(this.getAttribute("w"))}set w(a){null!=a?this.setAttribute("w",a):this.removeAttribute("w")}getValue(){switch(this.type){case "vec2":return[this.x,this.y];case "vec3":return[this.x,this.y,this.z];case "vec4":return[this.x,this.y,this.z,this.w];default:return this.x}}get type(){return this.getAttribute("type")}set type(a){null!=a?this.setAttribute("type",a):this.removeAttribute("type")}static get observedAttributes(){return["x",
"y","z","w"]}attributeChangedCallback(a,b,d){switch(a){case "x":case "y":case "z":case "w":null!=d& & this.renderer.setUniform(this.name,this.getValue())}}init(a){this.name?(this.program=a,this.renderer.addUniform(this.name,this.getValue(),this.type)):console.warn("sd-uniform created without a name.")}}customElements.get("sd-uniform")||customElements.define("sd-uniform",Ia);let Ja=new Set(["touchstart","touchmove","touchend"]);var U=a=>{a=Ja.has(a.type)& & "object"===typeof a.touches[0]?a.touches[0]:
a;return[a.clientX||0,a.clientY||0]};class K extends Z{static get observedAttributes(){return["height","width"]}constructor(){super();this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.shadow.innerHTML=W.render(this.width,this.height);this.canvas=W.map(this.shadow).canvas;setTimeout(()=>{try{this.init()}catch(a){console.error(a& & a.message||"Error in shader-doodle.")}})}disconnectedCallback(){super.disconnectedCallback();this.renderer.removeSurface(this.surface);this.surface.dispose();
this.surface=void 0}attributeChangedCallback(a){let b=this.shadow.styleSheets;if(("height"===a||"width"===a)& & 0< b.length ) { let d = this[a];b[0].cssRules[0].style[a]=Number.isInteger(d)?"".concat(d,"px"):"250px"}}get height ( ) { let a = parseInt(this.getAttribute("height"));return Number . isInteger ( a ) ? a:void 0 } set height ( a ) { let b = parseInt(a);Number.isInteger(b)&&this.setAttribute("height",a)}get width ( ) { let a = parseInt(this.getAttribute("width"));return Number . isInteger ( a ) ? a:void 0 } set width ( a ) { a = parseInt(a);
Number.isInteger(a)& & this.setAttribute("width",a)}async init(){await super.init();this.surface=Aa(this);this.renderer.addSurface(this.surface)}}customElements.get("shader-doodle")||customElements.define("shader-doodle",K);z.ShaderDoodleElement=K;Object.defineProperty(z,"__esModule",{value:!0})})
2023-04-27 18:34:23 +02:00
< / script >
< script >
2023-05-04 13:28:22 +02:00
2023-04-27 18:34:23 +02:00
var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this;
(function ($global) { "use strict";
$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {};
var EReg = function(r,opt) {
this.r = new RegExp(r,opt.split("u").join(""));
};
EReg.__name__ = true;
EReg.prototype = {
match: function(s) {
if(this.r.global) {
this.r.lastIndex = 0;
}
this.r.m = this.r.exec(s);
this.r.s = s;
return this.r.m != null;
}
,split: function(s) {
var d = "#__delim__#";
return s.replace(this.r,d).split(d);
}
};
var HxOverrides = function() { };
HxOverrides.__name__ = true;
HxOverrides.cca = function(s,index) {
var x = s.charCodeAt(index);
if(x != x) {
return undefined;
}
return x;
};
HxOverrides.substr = function(s,pos,len) {
if(len == null) {
len = s.length;
} else if(len < 0 ) {
if(pos == 0) {
len = s.length + len;
} else {
return "";
}
}
return s.substr(pos,len);
};
HxOverrides.now = function() {
return Date.now();
};
Math.__name__ = true;
var Reflect = function() { };
Reflect.__name__ = true;
Reflect.field = function(o,field) {
try {
return o[field];
} catch( _g ) {
return null;
}
};
Reflect.fields = function(o) {
var a = [];
if(o != null) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
for( var f in o ) {
if(f != "__id__" & & f != "hx__closures__" & & hasOwnProperty.call(o,f)) {
a.push(f);
}
}
}
return a;
};
Reflect.deleteField = function(o,field) {
if(!Object.prototype.hasOwnProperty.call(o,field)) {
return false;
}
delete(o[field]);
return true;
};
var Std = function() { };
Std.__name__ = true;
Std.string = function(s) {
return js_Boot.__string_rec(s,"");
};
Std.parseInt = function(x) {
if(x != null) {
var _g = 0;
var _g1 = x.length;
while(_g < _g1 ) {
var i = _g++;
var c = x.charCodeAt(i);
if(c < = 8 || c >= 14 & & c != 32 & & c != 45) {
var nc = x.charCodeAt(i + 1);
var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10);
if(isNaN(v)) {
return null;
} else {
return v;
}
}
}
}
return null;
};
var StringTools = function() { };
StringTools.__name__ = true;
StringTools.isSpace = function(s,pos) {
var c = HxOverrides.cca(s,pos);
if(!(c > 8 & & c < 14 ) ) {
return c == 32;
} else {
return true;
}
};
StringTools.ltrim = function(s) {
var l = s.length;
var r = 0;
while(r < l & & StringTools . isSpace ( s , r ) ) + + r ;
if(r > 0) {
return HxOverrides.substr(s,r,l - r);
} else {
return s;
}
};
StringTools.rtrim = function(s) {
var l = s.length;
var r = 0;
while(r < l & & StringTools . isSpace ( s , l - r - 1 ) ) + + r ;
if(r > 0) {
return HxOverrides.substr(s,0,l - r);
} else {
return s;
}
};
StringTools.trim = function(s) {
return StringTools.ltrim(StringTools.rtrim(s));
};
StringTools.replace = function(s,sub,by) {
return s.split(sub).join(by);
};
var haxe_iterators_ArrayIterator = function(array) {
this.current = 0;
this.array = array;
};
haxe_iterators_ArrayIterator.__name__ = true;
haxe_iterators_ArrayIterator.prototype = {
hasNext: function() {
return this.current < this.array.length ;
}
,next: function() {
return this.array[this.current++];
}
};
var js_Boot = function() { };
js_Boot.__name__ = true;
js_Boot.__string_rec = function(o,s) {
if(o == null) {
return "null";
}
if(s.length >= 5) {
return "< ... > ";
}
var t = typeof(o);
if(t == "function" & & (o.__name__ || o.__ename__)) {
t = "object";
}
switch(t) {
case "function":
return "< function > ";
case "object":
if(((o) instanceof Array)) {
var str = "[";
s += "\t";
var _g = 0;
var _g1 = o.length;
while(_g < _g1 ) {
var i = _g++;
str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s);
}
str += "]";
return str;
}
var tostr;
try {
tostr = o.toString;
} catch( _g ) {
return "???";
}
if(tostr != null & & tostr != Object.toString & & typeof(tostr) == "function") {
var s2 = o.toString();
if(s2 != "[object Object]") {
return s2;
}
}
var str = "{\n";
s += "\t";
var hasp = o.hasOwnProperty != null;
var k = null;
for( k in o ) {
if(hasp & & !o.hasOwnProperty(k)) {
continue;
}
if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
continue;
}
if(str.length != 2) {
str += ", \n";
}
str += s + k + " : " + js_Boot.__string_rec(o[k],s);
}
s = s.substring(1);
str += "\n" + s + "}";
return str;
case "string":
return o;
default:
return String(o);
}
};
var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
xrfragment_Parser.__name__ = true;
xrfragment_Parser.parse = function(key,value,resultMap) {
var Frag_h = Object.create(null);
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
2023-05-04 13:28:22 +02:00
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBED_OVERRIDE;
2023-04-27 18:34:23 +02:00
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
2023-05-04 13:28:22 +02:00
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
2023-04-27 18:34:23 +02:00
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
2023-04-28 13:19:45 +02:00
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
2023-04-27 18:34:23 +02:00
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
2023-05-04 13:28:22 +02:00
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE | xrfragment_XRF.PROMPT;
2023-04-27 18:34:23 +02:00
if(value.length == 0 & & !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
return true;
}
if(key.split(".").length > 1 & & value.split(".").length > 1) {
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND);
return true;
}
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
var v = new xrfragment_XRF(key,Frag_h[key]);
if(!v.validate(value)) {
2023-04-28 13:19:45 +02:00
console.log("src/xrfragment/Parser.hx:74:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
2023-04-27 18:34:23 +02:00
return false;
}
resultMap[key] = v;
} else {
2023-04-28 13:19:45 +02:00
console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
2023-04-27 18:34:23 +02:00
return false;
}
return true;
};
var xrfragment_Query = $hx_exports["xrfragment"]["Query"] = function(str) {
this.isNumber = new EReg("^[0-9\\.]+$","");
this.isClass = new EReg("^[-]?class$","");
this.isExclude = new EReg("^-","");
this.isProp = new EReg("^.*:[>< =!]?","");
this.q = { };
this.str = "";
if(str != null) {
this.parse(str);
}
};
xrfragment_Query.__name__ = true;
xrfragment_Query.prototype = {
toObject: function() {
return this.q;
}
,expandAliases: function(token) {
var classAlias = new EReg("^(-)?\\.","");
if(classAlias.match(token)) {
return StringTools.replace(token,".","class:");
} else {
return token;
}
}
,get: function() {
return this.q;
}
,parse: function(str,recurse) {
if(recurse == null) {
recurse = false;
}
var _gthis = this;
var token = str.split(" ");
var q = { };
var process = function(str,prefix) {
if(prefix == null) {
prefix = "";
}
str = StringTools.trim(str);
var k = str.split(":")[0];
var v = str.split(":")[1];
var filter = { };
if(q[prefix + k]) {
filter = q[prefix + k];
}
filter["rules"] = filter["rules"] != null ? filter["rules"] : [];
if(_gthis.isProp.match(str)) {
var oper = "";
if(str.indexOf("*") != -1) {
oper = "*";
}
if(str.indexOf(">") != -1) {
oper = ">";
}
if(str.indexOf("< ") != -1) {
oper = "< ";
}
if(str.indexOf(">=") != -1) {
oper = ">=";
}
if(str.indexOf("< =") != -1) {
oper = "< =";
}
if(_gthis.isExclude.match(k)) {
oper = "!=";
k = HxOverrides.substr(k,1,null);
} else {
v = HxOverrides.substr(v,oper.length,null);
}
if(oper.length == 0) {
oper = "=";
}
if(_gthis.isClass.match(k)) {
filter[prefix + k] = oper != "!=";
q[v] = filter;
} else {
var rule = { };
if(_gthis.isNumber.match(v)) {
rule[oper] = parseFloat(v);
} else {
rule[oper] = v;
}
filter["rules"].push(rule);
q[k] = filter;
}
return;
} else {
filter["id"] = _gthis.isExclude.match(str) ? false : true;
var key = _gthis.isExclude.match(str) ? HxOverrides.substr(str,1,null) : str;
q[key] = filter;
}
};
var _g = 0;
var _g1 = token.length;
while(_g < _g1 ) {
var i = _g++;
process(this.expandAliases(token[i]));
}
return this.q = q;
}
,test: function(obj) {
var qualify = false;
var _g = 0;
var _g1 = Reflect.fields(obj);
while(_g < _g1.length ) {
var k = _g1[_g];
++_g;
var v = Std.string(Reflect.field(obj,k));
if(this.testProperty(k,v)) {
qualify = true;
}
}
var _g = 0;
var _g1 = Reflect.fields(obj);
while(_g < _g1.length ) {
var k = _g1[_g];
++_g;
var v = Std.string(Reflect.field(obj,k));
if(this.testProperty(k,v,true)) {
qualify = false;
}
}
return qualify;
}
,testProperty: function(property,value,exclude) {
var conds = 0;
var fails = 0;
var qualify = 0;
var testprop = function(expr) {
conds += 1;
fails += expr ? 0 : 1;
return expr;
};
if(this.q[value] != null) {
var v = this.q[value];
if(v[property] != null) {
return v[property];
}
}
var _g = 0;
var _g1 = Reflect.fields(this.q);
while(_g < _g1.length ) {
var k = _g1[_g];
++_g;
var filter = Reflect.field(this.q,k);
if(filter.rules == null) {
continue;
}
var rules = filter.rules;
var _g2 = 0;
while(_g2 < rules.length ) {
var rule = rules[_g2];
++_g2;
if(exclude) {
if(Reflect.field(rule,"!=") != null & & testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(rule,"!="))) & & exclude) {
++qualify;
}
} else {
if(Reflect.field(rule,"*") != null & & testprop(parseFloat(value) != null)) {
++qualify;
}
if(Reflect.field(rule,">") != null & & testprop(parseFloat(value) > parseFloat(Reflect.field(rule,">")))) {
++qualify;
}
if(Reflect.field(rule,"< ") != null & & testprop(parseFloat(value) < parseFloat ( Reflect . field ( rule , " < " ) ) ) ) {
++qualify;
}
if(Reflect.field(rule,">=") != null & & testprop(parseFloat(value) >= parseFloat(Reflect.field(rule,">=")))) {
++qualify;
}
if(Reflect.field(rule,"< =") != null & & testprop(parseFloat(value) < = parseFloat(Reflect.field(rule,"< =")))) {
++qualify;
}
if(Reflect.field(rule,"=") != null & & (testprop(value == Reflect.field(rule,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(rule,"="))))) {
++qualify;
}
}
}
}
return qualify > 0;
}
};
var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { };
xrfragment_URI.__name__ = true;
2023-05-04 13:28:22 +02:00
xrfragment_URI.parse = function(url,filter) {
var store = { };
if(url.indexOf("#") == -1) {
return store;
}
var fragment = url.split("#");
2023-04-27 18:34:23 +02:00
var splitArray = fragment[1].split("&");
var _g = 0;
var _g1 = splitArray.length;
while(_g < _g1 ) {
var i = _g++;
var splitByEqual = splitArray[i].split("=");
var regexPlus = new EReg("\\+","g");
var key = splitByEqual[0];
var value = "";
if(splitByEqual.length > 1) {
var s = regexPlus.split(splitByEqual[1]).join(" ");
value = decodeURIComponent(s.split("+").join(" "));
}
2023-05-04 13:28:22 +02:00
var ok = xrfragment_Parser.parse(key,value,store);
2023-04-27 18:34:23 +02:00
}
2023-05-04 13:28:22 +02:00
if(filter != null & & filter != 0) {
2023-04-27 18:34:23 +02:00
var _g = 0;
2023-05-04 13:28:22 +02:00
var _g1 = Reflect.fields(store);
2023-04-27 18:34:23 +02:00
while(_g < _g1.length ) {
var key = _g1[_g];
++_g;
2023-05-04 13:28:22 +02:00
var xrf = store[key];
if(!xrf.is(filter)) {
Reflect.deleteField(store,key);
2023-04-27 18:34:23 +02:00
}
}
}
2023-05-04 13:28:22 +02:00
return store;
2023-04-27 18:34:23 +02:00
};
2023-04-28 13:19:45 +02:00
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) {
2023-04-27 18:34:23 +02:00
this.fragment = _fragment;
this.flags = _flags;
};
xrfragment_XRF.__name__ = true;
2023-04-28 13:19:45 +02:00
xrfragment_XRF.set = function(flag,flags) {
return flags | flag;
};
xrfragment_XRF.unset = function(flag,flags) {
return flags & ~flag;
};
2023-04-27 18:34:23 +02:00
xrfragment_XRF.prototype = {
is: function(flag) {
return (this.flags & flag) != 0;
}
,validate: function(value) {
this.guessType(this,value);
if(value.split("|").length > 1) {
this.args = [];
var args = value.split("|");
var _g = 0;
var _g1 = args.length;
while(_g < _g1 ) {
var i = _g++;
var x = new xrfragment_XRF(this.fragment,this.flags);
this.guessType(x,args[i]);
this.args.push(x);
}
}
if(this.fragment == "q") {
this.query = new xrfragment_Query(value).get();
}
var ok = true;
if(!((this.args) instanceof Array)) {
if(this.is(xrfragment_XRF.T_VECTOR3) & & !(typeof(this.x) == "number" & & typeof(this.y) == "number" & & typeof(this.z) == "number")) {
ok = false;
}
if(this.is(xrfragment_XRF.T_VECTOR2) & & !(typeof(this.x) == "number" & & typeof(this.y) == "number")) {
ok = false;
}
var tmp;
if(this.is(xrfragment_XRF.T_INT)) {
var v = this.int;
tmp = !(typeof(v) == "number" & & ((v | 0) === v));
} else {
tmp = false;
}
if(tmp) {
ok = false;
}
}
return ok;
}
,guessType: function(v,str) {
v.string = str;
if(str.split(",").length > 1) {
var xyz = str.split(",");
if(xyz.length > 0) {
v.x = parseFloat(xyz[0]);
}
if(xyz.length > 1) {
v.y = parseFloat(xyz[1]);
}
if(xyz.length > 2) {
v.z = parseFloat(xyz[2]);
}
}
if(xrfragment_XRF.isColor.match(str)) {
v.color = str;
}
if(xrfragment_XRF.isFloat.match(str)) {
v.float = parseFloat(str);
}
if(xrfragment_XRF.isInt.match(str)) {
v.int = Std.parseInt(str);
}
}
};
if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) {
HxOverrides.now = performance.now.bind(performance);
}
String.__name__ = true;
Array.__name__ = true;
js_Boot.__toStr = ({ }).toString;
xrfragment_Parser.error = "";
xrfragment_XRF.ASSET = 1;
xrfragment_XRF.PROP_BIND = 2;
xrfragment_XRF.QUERY_OPERATOR = 4;
xrfragment_XRF.PROMPT = 8;
xrfragment_XRF.ROUNDROBIN = 16;
xrfragment_XRF.BROWSER_OVERRIDE = 32;
2023-05-04 13:28:22 +02:00
xrfragment_XRF.EMBED_OVERRIDE = 64;
xrfragment_XRF.PV_OVERRIDE = 128;
xrfragment_XRF.PV_EXECUTE = 256;
xrfragment_XRF.T_COLOR = 8192;
xrfragment_XRF.T_INT = 16384;
xrfragment_XRF.T_FLOAT = 32768;
xrfragment_XRF.T_VECTOR2 = 65536;
xrfragment_XRF.T_VECTOR3 = 131072;
xrfragment_XRF.T_URL = 262144;
xrfragment_XRF.T_PREDEFINED_VIEW = 524288;
xrfragment_XRF.T_STRING = 1048576;
xrfragment_XRF.T_STRING_OBJ = 2097152;
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304;
2023-04-27 18:34:23 +02:00
xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","");
xrfragment_XRF.isInt = new EReg("^[0-9]+$","");
xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$","");
2023-04-28 13:19:45 +02:00
xrfragment_XRF.isVector = new EReg("([,]+|\\w)","");
xrfragment_XRF.isUrl = new EReg("(://)?\\..*","");
xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*","");
xrfragment_XRF.isString = new EReg(".*","");
2023-04-27 18:34:23 +02:00
})({});
var xrfragment = $hx_exports["xrfragment"];
2023-04-27 17:35:20 +02:00
< / script >
< / head >
< body class = "tc-body" >
<!-- ~~ Raw markup for the top of the body section ~~ -->
<!-- ~~ 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
*/
.tc-error-form {
font-family: sans-serif;
color: #fff;
z-index: 20000;
position: fixed;
background-color: rgb(255, 75, 75);
border: 8px solid rgb(255, 0, 0);
border-radius: 8px;
width: 50%;
margin-left: 25%;
margin-top: 4em;
padding: 0 2em 1em 2em;
}
.tc-error-form h1 {
text-align: center;
}
.tc-error-prompt {
text-align: center;
color: #000;
}
.tc-error-message {
overflow: auto;
max-height: 40em;
padding-right: 1em;
margin: 1em 0;
white-space: pre-line;
}
.tc-password-wrapper {
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;
border-radius: 8px;
}
.tc-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);
}
.tc-password-wrapper form {
text-align: left;
}
.tc-password-wrapper h1 {
font-size: 16px;
line-height: 20px;
padding-bottom: 16px;
}
.tc-password-wrapper input {
width: 100%;
}
< / style >
< / div >
<!-- ~~ Static content for Google and browsers without JavaScript ~~ -->
< noscript >
< div id = "splashArea" >
< p > This < a class = "tc-tiddlylink-external" href = "https://tiddlywiki.com" rel = "noopener noreferrer" target = "_blank" > TiddlyWiki< / a > contains the following tiddlers:< / p > < p > < ul >
2023-05-04 13:28:22 +02:00
< li > ↪ Parser.parse(k,v,store)< / li >
2023-04-27 20:06:46 +02:00
2023-05-04 13:28:22 +02:00
< li > ↪ URI.parse(url,filter)< / li >
2023-04-27 20:06:46 +02:00
2023-04-27 17:35:20 +02:00
< li > $:/.tb/macros/script< / li >
2023-05-04 19:45:06 +02:00
< li > $:/.tb/modules/startup/hide-sidebar.js< / li >
2023-04-27 17:35:20 +02:00
< li > $:/config/AutoSave< / li >
2023-05-04 13:28:22 +02:00
< li > $:/config/BitmapEditor/Colour< / li >
2023-04-27 17:35:20 +02:00
< li > $:/config/BrowserStorage/Enabled< / li >
< li > $:/config/BrowserStorage/SaveFilter< / li >
< li > $:/config/codemirror/lineNumbers< / li >
< li > $:/config/codemirror/lineWrapping< / li >
< li > $:/config/codemirror/styleActiveLine< / li >
< li > $:/config/codemirror/theme< / li >
2023-05-04 13:28:22 +02:00
< li > $:/config/ColourPicker/Recent< / li >
2023-05-04 19:45:06 +02:00
< li > $:/config/HideSidebarOnStartup< / li >
2023-04-27 17:35:20 +02:00
< li > $:/config/HtmlParser/DisableSandbox< / li >
< li > $:/config/HtmlParser/SandboxTokens< / li >
< li > $:/config/Manager/Filter< / li >
< li > $:/config/Manager/System< / li >
< li > $:/config/Navigation/UpdateAddressBar< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/control-panel< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-tiddler< / li >
< li > $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/save-wiki< / li >
2023-04-27 20:06:46 +02:00
< li > $:/config/PageControlButtons/Visibility/$:/plugins/tiddlywiki/markdown/new-markdown-button< / li >
2023-04-27 17:35:20 +02:00
< li > $:/config/PageControlButtons/Visibility/$:/themes/nico/notebook/ui/Buttons/SwitchPalette< / li >
< li > $:/config/Plugins/Disabled/$:/plugins/tiddlywiki/browser-storage< / li >
< li > $:/config/Plugins/Disabled/$:/plugins/tiddlywiki/codemirror< / li >
< li > $:/config/RelinkOnRename< / li >
< li > $:/config/TextEditor/EditorHeight/Mode< / li >
< li > $:/config/TextEditor/EnableToolbar< / li >
< li > $:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone< / li >
< li > $:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler< / li >
< li > $:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window< / li >
< li > $:/config/WikiParserRules/Inline/wikilink< / li >
< li > $:/core< / li >
< li > $:/DefaultTiddlers< / li >
2023-05-04 13:28:22 +02:00
< li > $:/Import< / li >
2023-04-27 17:35:20 +02:00
< li > $:/isEncrypted< / li >
< li > $:/javascript/enable.js< / li >
< li > $:/language/DefaultNewTiddlerTitle< / li >
< li > $:/palette< / li >
< li > $:/plugins/ihm/tidgraph< / li >
< li > $:/plugins/nico/notebook-mobile< / li >
< li > $:/plugins/TheDiveO/TwTube< / li >
< li > $:/plugins/tiddlywiki/browser-storage< / li >
< li > $:/plugins/tiddlywiki/codemirror< / li >
2023-04-27 20:28:00 +02:00
< li > $:/plugins/tiddlywiki/codemirror-mode-css< / li >
< li > $:/plugins/tiddlywiki/codemirror-mode-htmlmixed< / li >
< li > $:/plugins/tiddlywiki/codemirror-mode-javascript< / li >
< li > $:/plugins/tiddlywiki/codemirror-mode-xml< / li >
2023-04-27 20:06:46 +02:00
< li > $:/plugins/tiddlywiki/markdown< / li >
2023-04-27 17:35:20 +02:00
< li > $:/SiteSubtitle< / li >
< li > $:/SiteTitle< / li >
< li > $:/state/folded/AFRAME template< / li >
< li > $:/state/folded/GLSL shader template< / li >
< li > $:/state/import/select-all< / li >
< li > $:/state/notebook-sidebar< / li >
< li > $:/state/notebook-sidebar-section< / li >
< li > $:/state/plugin-info--1887569658-$:/plugins/ihm/tidgraph--50210113< / li >
< li > $:/state/plugin-info--391242618-$:/plugins/tiddlywiki/browser-storage< / li >
< li > $:/state/plugin-info--391242618-$:/plugins/tiddlywiki/browser-storage--605768392< / li >
< li > $:/state/plugin-info-1024395336-$:/plugins/tiddlywiki/codemirror--1574138004< / li >
< li > $:/state/plugin-info-833095967-Draft of '$:/core'---1604322978< / li >
< li > $:/state/showeditpreview< / li >
2023-05-04 19:45:06 +02:00
< li > $:/state/sidebar< / li >
2023-04-27 17:35:20 +02:00
< li > $:/state/tab--1963855381< / li >
< li > $:/state/tab--2112689675< / li >
< li > $:/state/tab--697582678< / li >
< li > $:/state/tab--86143343< / li >
< li > $:/state/tab--959111941< / li >
< li > $:/state/tab-1749438307< / li >
< li > $:/state/tab-2065006209< / li >
< li > $:/state/tab/moresidebar-1850697562< / li >
< li > $:/state/tabs/controlpanel/toolbars-1345989671< / li >
< li > $:/status/RequireReloadDueToPluginChange< / li >
< li > $:/StoryList< / li >
< li > $:/theme< / li >
< li > $:/themes/nico/notebook< / li >
< li > $:/themes/nico/notebook/metrics/sidebar-width< / li >
< li > $:/themes/nico/notebook/metrics/story-width< / li >
< li > $:/themes/nico/notebook/options/stickytitles< / li >
< li > $:/themes/tiddlywiki/snowwhite< / li >
< li > $:/themes/tiddlywiki/vanilla< / li >
< li > $:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint< / li >
< li > $:/view< / li >
< li > $:/webxr-notebook/aframe.min.js< / li >
< li > $:/webxr-notebook/boot.css< / li >
< li > $:/webxr-notebook/boot.html< / li >
< li > $:/webxr-notebook/sandboxify.js< / li >
< li > $:/webxr-notebook/scriptie-talkie-embed.js< / li >
< li > $:/webxr-notebook/shader-doodle.js< / li >
2023-04-28 14:21:22 +02:00
< li > $:/xrfragment/topmenu< / li >
2023-04-27 18:34:23 +02:00
< li > $:/xrfragment/xrfragment.js< / li >
2023-04-27 17:35:20 +02:00
< li > AFRAME template< / li >
2023-04-28 17:16:13 +02:00
< li > Draft 2 of '$:/webxr-notebook/boot.css'< / li >
2023-05-04 13:28:22 +02:00
< li > Draft of '↪ URI.parse(url,flags)'< / li >
2023-04-28 14:21:22 +02:00
< li > Draft of '$:/webxr-notebook/boot.css'< / li >
2023-04-27 17:35:20 +02:00
< li > Examples< / li >
< li > Fragment Explorer< / li >
< li > GLSL template< / li >
2023-04-28 17:16:13 +02:00
< li > How it works< / li >
2023-04-27 20:06:46 +02:00
< li > List of fragments< / li >
2023-04-27 17:35:20 +02:00
2023-04-28 13:19:45 +02:00
< li > predefined_view< / li >
2023-04-27 17:35:20 +02:00
< li > Reference< / li >
< li > THREE template< / li >
< li > THREE template #online< / li >
2023-04-28 13:19:45 +02:00
< li > vector< / li >
2023-04-27 17:35:20 +02:00
< li > WebXR< / li >
< li > XR Fragments< / li >
2023-05-04 13:28:22 +02:00
< li > xrfragment.jpg< / li >
2023-04-27 17:35:20 +02:00
< / ul >
< / p >
< style >
.tc-remove-when-wiki-loaded {display: none;}
< / style >
< / div >
< / noscript >
<!-- ~~ Ordinary tiddlers ~~ -->
< script class = "tiddlywiki-tiddler-store" type = "application/json" > [
2023-05-04 13:28:22 +02:00
{"created":"20230427174739986","text":"Parse a fragment (key/value) and add it to an object store (if valid).\n\n| args | type | example | comment |\n|-|-|-|-|\n| key | string | `pos` | |\n| value | string | `1.2,3,4` | datatype must comply with [spec](#List%20of%20fragments) |\n| store | object | {} | will not be touched if validation failed, |\n\n> returns true if validated, otherwise false \n\nhere are some interactive examples:\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = {}\nok = xrfragment.Parser.parse('pos','1.2,2,3',frags)\nconsole.log( frags.pos )\n\n\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n\n\u003Cbr>\n\nUnknown or fragments with wrong type will be rejected:\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = {}\nok = xrfragment.Parser.parse('pos','true',frags)\nconsole.log( frags.pos )\n\n\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>","tags":"Reference","title":"↪ Parser.parse(k,v,store)","modified":"20230504091555411","type":"text/markdown"},
{"created":"20230427150948872","text":"Validates and turns a XR fragment string into objectform using [Parser.parse(k,v,store)](#↪%20Parser.parse(k,v,store)).\n\n| args | type | example | comment |\n|-|-|-|-|\n| url | string | `#pos=1.2,3,4`\u003Cbr>`#pos=1.2,3,4& t=1,2`| |\n| filter | integer\u003Cbr>(bitmask) | `0` = no filter\u003Cbr>`XRF.BROWSER_OVERRIDE`\u003Cbr>`XRF.EMBED_OVERRIDE`\u003Cbr>`XRF.PV_OVERRIDE` | filter out fragments which are not flagged with this flag.\u003Cbr>\u003Cbr>For example, parsing with `XRF.BROWSER_OVERRIDE` will ignore any fragments which are not flagged as such (like `scale` in case of top-level URI navigation).\u003Cbr>On the other hand, `XRF.EMBED_OVERRIDE` makes sense when parsing an embedded URI (`src: other.gltf#scale=2,2,2` e.g.)\u003Cbr> |\n\n> returns an object with validated fragment(values) as key(objects)\n\nhere are some interactive examples:\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = xrfragment.URI.parse('#pos=1.0,2.0,3.0')\nconsole.log( frags.pos )\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n\n\u003Cbr>\n\nYou can combine them with the `& ` character:\u003Cbr>\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = xrfragment.URI.parse('#t=1,100& pos=1,2,3.1')\nconsole.log( frags.t )\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n\nUnallowed fragments can be filtered out:\u003Cbr>\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">XRF = xrfragment.XRF\nfrags = xrfragment.URI.parse('#scale=1,2,3', XRF.BROWSER_OVERRIDE )\nconsole.log( frags )\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n\n> The above is perfect for top-level browser navigation (modifying `scale` is not allowed here)\n\nAnother example for parsing embedded assets\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">XRF = xrfragment.XRF\nmymodel = {userData:{src: \"other.gltf#scale=2,2,2\"}} // mock THREE.js\nfrags = xrfragment.URI.parse( mymodel.userData.src, XRF.EMBED_OVERRIDE )\nconsole.log( frags.scale.x )\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n\n> The above is perfect for embedded content (`scale` fragment is allowed here)","tags":"Reference","title":"↪ URI.parse(url,filter)","modified":"20230504103105280","type":"text/markdown","list-after":"List of fragments"},
2023-04-27 17:35:20 +02:00
{"text":"(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nenables js via \u003C\u003Cscript>> and disables with \u003C\u003Cscript 0>>\n*/\n\nexports.name = \"script\";\n\nexports.params = [\n\t{name: \"run\"},\n];\n\n/*\nRun the macro\n*/\nexports.run = function(run) {\n var off = run ? run.toLowerCase() : false;\n\tif(off & & [\"0\",\"no\",\"off\",\"false\"].indexOf(off) > -1) {\n\t\t$tw.config.htmlUnsafeElements = [\"script\"];\n\t} else {\n\t\t$tw.config.htmlUnsafeElements = [];\n\t}\nreturn \"\";\n};\n})();","type":"application/javascript","title":"$:/.tb/macros/script","tags":"","module-type":"macro","modifier":"Tobias Beer","modified":"20150129192206415","creator":"Tobias Beer","created":"20150129001857442"},
2023-05-04 19:45:06 +02:00
{"text":"/*\\\ntitle: $:/.tb/modules/startup/hide-sidebar.js\ntype: application/javascript\nmodule-type: startup\ncreated: 20151010151732122\ncreator: Tobias Beer\nmodified: 20151010151750739\n\nHides the sidebar on startup when the config tiddler [[$:/config/hide-sidebar-on-startup]] contains \"yes\"\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"hide-sidebar-on-startup\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\tvar conf = $tw.wiki.getTiddler(\"$:/config/HideSidebarOnStartup\"),\n\t\tvalue = (conf ? conf.getFieldString(\"text\") : \"\").toLowerCase(),\n\t\tstate = value == \"yes\" ? \"no\" : \"yes\";\n\t$tw.wiki.setText(\"$:/state/sidebar\", \"text\", undefined, state);\n};\n\n})();","bag":"default","revision":"0","type":"application/javascript","title":"$:/.tb/modules/startup/hide-sidebar.js","module-type":"startup","modified":"20151010151750739","creator":"Tobias Beer","created":"20151010151732122"},
2023-04-27 17:35:20 +02:00
{"created":"20230427092629816","title":"$:/config/AutoSave","text":"no","modified":"20230427104339917"},
2023-05-04 13:28:22 +02:00
{"created":"20230504104444744","title":"$:/config/BitmapEditor/Colour","text":"PaleGreen","modified":"20230504104444744"},
2023-04-27 17:35:20 +02:00
{"title":"$:/config/BrowserStorage/Enabled","text":"yes"},
{"created":"20230427093305938","title":"$:/config/BrowserStorage/SaveFilter","text":"[all[]] -[is[shadow]!is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]]","modified":"20230427093305938"},
{"created":"20230424093106917","text":"true","title":"$:/config/codemirror/lineNumbers","type":"bool","modified":"20230424093106917"},
{"created":"20230424093115922","text":"false","title":"$:/config/codemirror/lineWrapping","type":"bool","modified":"20230425143830415"},
{"created":"20230424093124914","text":"true","title":"$:/config/codemirror/styleActiveLine","type":"bool","modified":"20230424093124914"},
{"created":"20230424093136251","title":"$:/config/codemirror/theme","type":"string","text":"tiddlywiki","modified":"20230424093243338"},
2023-05-04 13:28:22 +02:00
{"created":"20230504104444743","title":"$:/config/ColourPicker/Recent","list":"PaleGreen","modified":"20230504104444743"},
2023-05-04 19:45:06 +02:00
{"created":"20151007165524815","text":"yes","bag":"default","revision":"0","type":"text/vnd.tiddlywiki","title":"$:/config/HideSidebarOnStartup","tags":"","modified":"20230504174422977","creator":"Tobias Beer"},
2023-04-27 17:35:20 +02:00
{"created":"20230424093821723","text":"yes","tags":"","title":"$:/config/HtmlParser/DisableSandbox","modified":"20230424142930452"},
{"created":"20230424140117603","text":"allowvr allowfullscreen allow-scripts","tags":"","title":"$:/config/HtmlParser/SandboxTokens","modified":"20230424142737213"},
2023-05-04 19:45:06 +02:00
{"created":"20230423174843715","title":"$:/config/Manager/Filter","text":"css","modified":"20230504112637300"},
2023-04-27 17:35:20 +02:00
{"created":"20230423164137536","text":"","title":"$:/config/Manager/System","modified":"20230424140109138"},
2023-04-27 20:06:46 +02:00
{"created":"20230425162854560","title":"$:/config/Navigation/UpdateAddressBar","text":"permalink","modified":"20230427180247389"},
2023-04-27 17:35:20 +02:00
{"created":"20230424152601270","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/control-panel","modified":"20230424152601270"},
{"created":"20230424091250751","text":"show","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen","modified":"20230424091250751"},
{"created":"20230423175657308","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager","modified":"20230424152608585"},
{"created":"20230423175850357","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions","modified":"20230423175928862"},
{"created":"20230424152539963","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-tiddler","modified":"20230424152539963"},
{"created":"20230427093524759","text":"show","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/save-wiki","modified":"20230427095709120"},
2023-04-27 20:06:46 +02:00
{"created":"20230427180301628","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/plugins/tiddlywiki/markdown/new-markdown-button","modified":"20230427180301628"},
2023-04-27 17:35:20 +02:00
{"created":"20230423175456754","text":"hide","title":"$:/config/PageControlButtons/Visibility/$:/themes/nico/notebook/ui/Buttons/SwitchPalette","modified":"20230423175456754"},
2023-04-27 19:19:54 +02:00
{"created":"20230427093917511","title":"$:/config/Plugins/Disabled/$:/plugins/tiddlywiki/browser-storage","text":"yes","modified":"20230427171938167"},
2023-04-27 17:35:20 +02:00
{"created":"20230424143038883","title":"$:/config/Plugins/Disabled/$:/plugins/tiddlywiki/codemirror","text":"no","modified":"20230425143703257"},
{"created":"20230423163708078","text":"yes","title":"$:/config/RelinkOnRename","modified":"20230423163708078"},
{"created":"20230424124352350","title":"$:/config/TextEditor/EditorHeight/Mode","text":"fixed","modified":"20230424124352350"},
{"created":"20230423181426748","text":"yes","title":"$:/config/TextEditor/EnableToolbar","modified":"20230423181429179"},
{"created":"20230423175528147","text":"hide","title":"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone","modified":"20230427093444766"},
{"created":"20230425165150260","text":"hide","title":"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler","modified":"20230427093445320"},
{"created":"20230423175546354","text":"hide","title":"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window","modified":"20230427093450679"},
{"created":"20230426161158672","text":"disable","title":"$:/config/WikiParserRules/Inline/wikilink","modified":"20230426161158672"},
{"created":"20230424124659851","text":"{\"tiddlers\":{\"$:/Acknowledgements\":{\"title\":\"$:/Acknowledgements\",\"text\":\"TiddlyWiki incorporates code from these fine OpenSource projects:\\n\\n* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]\\n* [[The Jasmine JavaScript Test Framework|http://pivotal.github.io/jasmine/]]\\n* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]\\n\\nAnd media from these projects:\\n\\n* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]]\\n\"},\"$:/core/copyright.txt\":{\"title\":\"$:/core/copyright.txt\",\"type\":\"text/plain\",\"text\":\"TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\\n\\nCopyright (c) 2004-2007, Jeremy Ruston\\nCopyright (c) 2007-2023, UnaMesa Association\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"},\"$:/core/icon\":{\"title\":\"$:/core/icon\",\"tags\":\"$:/tags/Image\",\"text\":\"\u003Csvg width=\\\"22pt\\\" height=\\\"22pt\\\" viewBox=\\\"0 0 128 128\\\">\u003Cpath d=\\\"M64 0l54.56 32v64L64 128 9.44 96V32L64 0zm21.127 95.408c-3.578-.103-5.15-.094-6.974-3.152l-1.42.042c-1.653-.075-.964-.04-2.067-.097-1.844-.07-1.548-1.86-1.873-2.8-.52-3.202.687-6.43.65-9.632-.014-1.14-1.593-5.17-2.157-6.61-1.768.34-3.546.406-5.34.497-4.134-.01-8.24-.527-12.317-1.183-.8 3.35-3.16 8.036-1.21 11.44 2.37 3.52 4.03 4.495 6.61 4.707 2.572.212 3.16 3.18 2.53 4.242-.55.73-1.52.864-2.346 1.04l-1.65.08c-1.296-.046-2.455-.404-3.61-.955-1.93-1.097-3.925-3.383-5.406-5.024.345.658.55 1.938.24 2.53-.878 1.27-4.665 1.26-6.4.47-1.97-.89-6.73-7.162-7.468-11.86 1.96-3.78 4.812-7.07 6.255-11.186-3.146-2.05-4.83-5.384-4.61-9.16l.08-.44c-3.097.59-1.49.37-4.82.628-10.608-.032-19.935-7.37-14.68-18.774.34-.673.664-1.287 1.243-.994.466.237.4 1.18.166 2.227-3.005 13.627 11.67 13.732 20.69 11.21.89-.25 2.67-1.936 3.905-2.495 2.016-.91 4.205-1.282 6.376-1.55 5.4-.63 11.893 2.276 15.19 2.37 3.3.096 7.99-.805 10.87-.615 2.09.098 4.143.483 6.16 1.03 1.306-6.49 1.4-11.27 4.492-12.38 1.814.293 3.213 2.818 4.25 4.167 2.112-.086 4.12.46 6.115 1.066 3.61-.522 6.642-2.593 9.833-4.203-3.234 2.69-3.673 7.075-3.303 11.127.138 2.103-.444 4.386-1.164 6.54-1.348 3.507-3.95 7.204-6.97 7.014-1.14-.036-1.805-.695-2.653-1.4-.164 1.427-.81 2.7-1.434 3.96-1.44 2.797-5.203 4.03-8.687 7.016-3.484 2.985 1.114 13.65 2.23 15.594 1.114 1.94 4.226 2.652 3.02 4.406-.37.58-.936.785-1.54 1.01l-.82.11zm-40.097-8.85l.553.14c.694-.27 2.09.15 2.83.353-1.363-1.31-3.417-3.24-4.897-4.46-.485-1.47-.278-2.96-.174-4.46l.02-.123c-.582 1.205-1.322 2.376-1.72 3.645-.465 1.71 2.07 3.5
{"created":"20230424092518912","title":"$:/DefaultTiddlers","text":"[[XR Fragments]]","modified":"20230427123802118"},
2023-05-04 19:45:06 +02:00
{"title":"$:/Import","text":"The following tiddlers were imported:\n\n# [[$:/config/HideSidebarOnStartup]]","status":"complete"},
2023-04-27 17:35:20 +02:00
{"title":"$:/isEncrypted","text":"no"},
{"created":"20230424084159329","text":"\u003C\u003Cscript>>","tags":"$:/tags/PageTemplate","title":"$:/javascript/enable.js","modified":"20230424090240827","type":"text/vnd.tiddlywiki"},
{"created":"20230424092618636","title":"$:/language/DefaultNewTiddlerTitle","text":"New Experiment or Note","modified":"20230424092627873"},
{"created":"20230423174350792","title":"$:/palette","text":"$:/themes/nico/notebook/palettes/palette-beige","modified":"20230427115921847"},
{"text":"{\n \"tiddlers\": {\n \"$:/plugins/ihm/tidgraph/changelog\": {\n \"created\": \"20151024161547099\",\n \"creator\": \"ihm4u\",\n \"modified\": \"20151031061347109\",\n \"modifier\": \"ihm4u\",\n \"tags\": \"\",\n \"title\": \"$:/plugins/ihm/tidgraph/changelog\",\n \"text\": \"For the complete changelog see\\n\\nhttps://ihm4u.github.io/tw5plugs/#Tidgraph%20-%20Changelog\\n\"\n },\n \"$:/plugins/ihm/tidgraph/documentation\": {\n \"title\": \"$:/plugins/ihm/tidgraph/documentation\",\n \"text\": \"!!Example\\nThe following example shows a tiddler which tags 7 children:\\n\\n``\u003C$tidgraph start=\\\"Virtues\\\" />``\\n\\nlooks like this:\\n\\n{{$:/plugins/ihm/tidgraph/tidgraph.png}}\\n\\n!!Usage\\nSimple usage:\\n\\n``\u003C$tidgraph start=\\\"MyRootTiddler\\\" />``\\n\\nThe map will start with MyRootTiddler on the left, and show all its children recursively. The default maximum depth is 10 levels, it can be changed with the `maxdepth` attribute.\\n\\nAll options:\\n\\n|!Attribute |!Description|!Default |\\n|`start` |Initial tiddler that starts the map | none |\\n|`startat` |First level to display. 0 is the root tiddler named in the `start` attribute. 1 is the next level, etc. | 0 |\\n|`maxdepth` |Maximum depth to display.| 10 |\\n|`mode` |//tagging// or //linking// or custom. This is how to identify the children of a node. With //tagging// Tiddlers that tag other tiddlers become their parent. With //linking// tiddlers that link to other tiddlers become their parent. A custom mode can be specified by a `$:/config/tidgraph/modes/MyMode` tiddler where `MyMode` is the name of the mode. The subfilter can be also specified directly; e.g. `mode=\\\"fields[]\\\"`. See [[Custom Mode Demo|https://ihm4u.github.io/tw5plugs/#Custom%20Mode%20Demo]] for an example | //tagging// |\\n|`nodetitle` |Field to use as title for the node. | //title// (or //caption// if present) |\\n|`tooltip` |List of fields to use for node tooltip. The first field with a non empty value is used. | //summary// |\\n|`filter` |Only tiddlers matching filter will be used | none |\\n|`nocollapse` |Disable ability to collapse nodes. The graph allows node collapsing by default. | false |\\n|`nodetemplate` |One or mode node templates to make node look like you want. See the [[Node Templates Demo|https://ihm4u.github.io/tw5plugs/#Node%20Templates%20Demo]] for examples of how to use them. | none |\\n|`layout` |`E` for East (Vertical) or `S` for south (Horizontal) layout. | E |\\n\\n!CSS classes\\nYou can also change colors, and other styles with the following CSS classes.\\n\\n|!Class |!Description |\\n|tgr-node |Style for each node. If you want to change the color of the links inside the node use the `.tgr-node a` selector. |\\n|tgr-edge |Style for the SVG path that connects the nodes. The old name was tgr-link. |\\n|tgr-arrow |Style for the SVG polyline that draws the arrow at the end of the link |\\n\"\n },\n \"$:/plugins/ihm/tidgraph/readme\": {\n \"created\": \"20151024054526558\",\n \"modified\": \"20151024065317719\",\n \"tags\": \"\",\n \"title\": \"$:/plugins/ihm/tidgraph/readme\",\n \"text\": \"!!How\\nSimply put this in your tiddler:\\n\\n``\u003C$tidgraph start=\\\"MyRootTiddler\\\" />``\\n\\nThere are other options covered in the [[documentation|$:/plugins/ihm/tidgraph/documentation]].\\n\\n!!Features\\n* No third-party libraries\\n* Light weight\\n* Rendering of map/graph with HTML5 and SVG (no heavy png or jpg images)\\n* Automatic map/graph creation, no need for dragging/connecting/etc\\n* Figures out tree-graph by means of tags or links, or custom modes \\n* Collapse/expand nodes\\n* User defined Node Templates!!\\n\\n!!Limitations\\n* Layout is horizontal from left to right, if needed a vertical layout will be added later\\n\"\n },\n \"$:/plugins/ihm/tidgraph/stylesheet\": {\n \"tags\": \"$:/tags/Stylesheet\",\n
{"text":"{\n \"tiddlers\": {\n \"$:/plugins/nico/notebook-mobile/js/notebookSidebarNav.js\": {\n \"title\": \"$:/plugins/nico/notebook-mobile/js/notebookSidebarNav.js\",\n \"text\": \"/*\\\\\\ntitle: $:/themes/nico/notebook-mobile/js/notebookSidebarNav.js\\ntype: application/javascript\\nmodule-type: global\\n\\nCloses the notebook sidebar on mobile when navigating\\n\\n\\\\*/\\n(function(){\\n\\n /*jslint node: true, browser: true */\\n /*global $tw: false */\\n \\\"use strict\\\";\\n\\n const isOnMobile = () => {\\n\\t\\tlet bottombar = document.querySelector('.nc-bottombar');\\n\\t\\treturn bottombar & & bottombar.getClientRects().length > 0;\\n };\\n\\n const closeSidebar = () => {\\n\\t\\t$tw.wiki.setText(\\\"$:/state/notebook-sidebar\\\", \\\"text\\\", undefined, \\\"no\\\");\\n };\\n\\n const closeSidebarOnMobile = () => {\\n\\t\\tif (isOnMobile()) {\\n console.log(\\\"closing sidebar\\\");\\n\\t\\t\\tcloseSidebar();\\n\\t\\t};\\n };\\n\\n const setup = () => {\\n\\t\\t$tw.hooks.addHook(\\\"th-navigating\\\",function(event) {\\n\\t\\t\\tcloseSidebarOnMobile();\\n\\t\\t\\treturn event;\\n\\t\\t});\\n };\\n\\n setup();\\n\\n exports.closeNotebookSidebar = closeSidebar;\\n})();\\n\",\n \"type\": \"application/javascript\",\n \"module-type\": \"global\",\n \"created\": \"20200430151329085\",\n \"modified\": \"20201210200127495\",\n \"tags\": \"\"\n }\n }\n}","bag":"default","revision":"0","version":"1.0.0","type":"application/json","title":"$:/plugins/nico/notebook-mobile","source":"https://github.com/NicolasPetton/Notebook","plugin-type":"plugin","name":"Mobile support for the Notebook theme","list":"","description":"JavaScript hooks for mobile devices support of the Notebook theme","dependents":"","core-version":">=5.1.22","author":"NicolasPetton"},
{"text":"{\"tiddlers\":{\"$:/plugins/TheDiveO/TwTube/libraries/video.js\":{\"text\":\"/* automatically included from npm package `video.js` */\\r\\n/**\\n * @license\\n * Video.js 6.7.3 \u003Chttp://videojs.com/>\\n * Copyright Brightcove, Inc. \u003Chttps://www.brightcove.com/>\\n * Available under Apache License Version 2.0\\n * \u003Chttps://github.com/videojs/video.js/blob/master/LICENSE>\\n *\\n * Includes vtt.js \u003Chttps://github.com/mozilla/vtt.js>\\n * Available under Apache License Version 2.0\\n * \u003Chttps://github.com/mozilla/vtt.js/blob/master/LICENSE>\\n */\\n\\n(function (global, factory) {\\n\\ttypeof exports === 'object' & & typeof module !== 'undefined' ? module.exports = factory() :\\n\\ttypeof define === 'function' & & define.amd ? define(factory) :\\n\\t(global.videojs = factory());\\n}(this, (function () {\\n\\nvar version = \\\"6.7.3\\\";\\n\\nvar commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\\n\\n\\n\\n\\n\\nfunction createCommonjsModule(fn, module) {\\n\\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\\n}\\n\\nvar win;\\n\\nif (typeof window !== \\\"undefined\\\") {\\n win = window;\\n} else if (typeof commonjsGlobal !== \\\"undefined\\\") {\\n win = commonjsGlobal;\\n} else if (typeof self !== \\\"undefined\\\"){\\n win = self;\\n} else {\\n win = {};\\n}\\n\\nvar window_1 = win;\\n\\nvar empty = {};\\n\\n\\nvar empty$1 = (Object.freeze || Object)({\\n\\t'default': empty\\n});\\n\\nvar minDoc = ( empty$1 & & empty ) || empty$1;\\n\\nvar topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal :\\n typeof window !== 'undefined' ? window : {};\\n\\n\\nvar doccy;\\n\\nif (typeof document !== 'undefined') {\\n doccy = document;\\n} else {\\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\\n\\n if (!doccy) {\\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\\n }\\n}\\n\\nvar document_1 = doccy;\\n\\n/**\\n * @file browser.js\\n * @module browser\\n */\\nvar USER_AGENT = window_1.navigator & & window_1.navigator.userAgent || '';\\nvar webkitVersionMap = /AppleWebKit\\\\/([\\\\d.]+)/i.exec(USER_AGENT);\\nvar appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;\\n\\n/*\\n * Device is an iPhone\\n *\\n * @type {Boolean}\\n * @constant\\n * @private\\n */\\nvar IS_IPAD = /iPad/i.test(USER_AGENT);\\n\\n// The Facebook app's UIWebView identifies as both an iPhone and iPad, so\\n// to identify iPhones, we need to exclude iPads.\\n// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\\nvar IS_IPHONE = /iPhone/i.test(USER_AGENT) & & !IS_IPAD;\\nvar IS_IPOD = /iPod/i.test(USER_AGENT);\\nvar IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\\n\\nvar IOS_VERSION = function () {\\n var match = USER_AGENT.match(/OS (\\\\d+)_/i);\\n\\n if (match & & match[1]) {\\n return match[1];\\n }\\n return null;\\n}();\\n\\nvar IS_ANDROID = /Android/i.test(USER_AGENT);\\nvar ANDROID_VERSION = function () {\\n // This matches Android Major.Minor.Patch versions\\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\\n var match = USER_AGENT.match(/Android (\\\\d+)(?:\\\\.(\\\\d+))?(?:\\\\.(\\\\d+))*/i);\\n\\n if (!match) {\\n return null;\\n }\\n\\n var major = match[1] & & parseFloat(match[1]);\\n var minor = match[2] & & parseFloat(match[2]);\\n\\n if (major & & minor) {\\n return parseFloat(match[1] + '.' + match[2]);\\n } else if (major) {\\n return major;\\n }\\n return null;\\n}();\\n\\n// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser\\nvar IS_OLD_ANDROID = IS_ANDROID & & /webkit/i.test(USER_AGENT) & & ANDROID_VERSION \u003C 2.3;\\nvar IS_NATIVE_ANDROID = IS_ANDROID & & ANDROID_VERSION \u003C 5 & & appleWebkitVersion \u003C 537;\\n\\nvar IS_FIREFOX = /Firefox/i.test(USER_AGENT);\\nvar IS_EDGE = /Edge/i.test(USER_AGENT);\\nvar IS_CHROME = !IS_EDGE & & /Chrome/i.test(USER_AGENT);\
{"title":"$:/plugins/tiddlywiki/browser-storage","name":"Browser Storage","description":"Local storage in the browser","list":"readme settings","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/config/BrowserStorage/SaveFilter\":{\"title\":\"$:/config/BrowserStorage/SaveFilter\",\"text\":\"[prefix[$:/state/]] -[prefix[$:/state/popup/]]\"},\"$:/plugins/tiddlywiki/browser-storage/icon\":{\"title\":\"$:/plugins/tiddlywiki/browser-storage/icon\",\"tags\":\"$:/tags/Image\",\"text\":\"\u003Csvg class=\\\"tc-image-down-arrow tc-image-button\\\" viewBox=\\\"0 0 128 128\\\" width=\\\"22pt\\\" height=\\\"22pt\\\">\\n \u003Cg stroke=\\\"none\\\" stroke-width=\\\"1\\\" fill-rule=\\\"evenodd\\\">\\n \u003Cellipse id=\\\"Oval\\\" cx=\\\"64\\\" cy=\\\"16\\\" rx=\\\"40\\\" ry=\\\"16\\\">\u003C/ellipse>\\n \u003Cpath d=\\\"M24,96 C24,104.836556 41.90861,112 64,112 C86.09139,112 104,104.836556 104,96 L104,112 C104,120.836556 86.09139,128 64,128 C41.90861,128 24,120.836556 24,112 L24,96 Z\\\" id=\\\"Combined-Shape\\\">\u003C/path>\\n \u003Cpath d=\\\"M24,72 C24,80.836556 41.90861,88 64,88 C86.09139,88 104,80.836556 104,72 L104,88 C104,96.836556 86.09139,104 64,104 C41.90861,104 24,96.836556 24,88 L24,72 Z\\\" id=\\\"Combined-Shape-Copy-16\\\">\u003C/path>\\n \u003Cpath d=\\\"M24,48 C24,56.836556 41.90861,64 64,64 C86.09139,64 104,56.836556 104,48 L104,64 C104,72.836556 86.09139,80 64,80 C41.90861,80 24,72.836556 24,64 L24,48 Z\\\" id=\\\"Combined-Shape-Copy-17\\\">\u003C/path>\\n \u003Cpath d=\\\"M24,24 C24,32.836556 41.90861,40 64,40 C86.09139,40 104,32.836556 104,24 L104,40 C104,48.836556 86.09139,56 64,56 C41.90861,56 24,48.836556 24,40 L24,24 Z\\\" id=\\\"Combined-Shape-Copy-18\\\">\u003C/path>\\n \u003C/g>\\n\u003C/svg>\"},\"$:/plugins/tiddlywiki/browser-storage/rawmarkup.js\":{\"title\":\"$:/plugins/tiddlywiki/browser-storage/rawmarkup.js\",\"text\":\"/*\\\\\\ntitle: $:/plugins/tiddlywiki/browser-storage/rawmarkup.js\\ntype: application/javascript\\nmodule-type: library\\n\\nStartup code injected as raw markup\\n\\n\\\\*/\\n\\n(function() {\\n\\n// Need to initialise these because we run before bootprefix.js and boot.js\\n$tw = window.$tw || Object.create(null);\\n$tw.hooks = $tw.hooks || { names: {}};\\n$tw.boot = $tw.boot || {};\\n$tw.boot.preloadDirty = $tw.boot.preloadDirty || [];\\n// Hook the point in the startup process when the tiddlers have been loaded but plugins not unpacked\\nvar hookName = \\\"th-boot-tiddlers-loaded\\\";\\nif(Object.prototype.hasOwnProperty.call($tw.hooks.names,hookName)) {\\n\\t$tw.hooks.names[hookName].push(hookBootTiddlersLoaded);\\n} else {\\n\\t$tw.hooks.names[hookName] = [hookBootTiddlersLoaded];\\n}\\n\\n// Load tiddlers from browser storage\\nfunction hookBootTiddlersLoaded() {\\n\\tvar url = window.location.pathname,\\n\\t\\tkeysToDelete = [],\\n\\t\\tlog = [];\\n\\t// Check that browser storage is available\\n\\ttry {\\n\\t\\twindow.localStorage;\\n\\t} catch(e) {\\n\\t\\treturn;\\n\\t}\\n\\t// Step through each browsder storage item\\n\\tfor(var index=0; index\u003Cwindow.localStorage.length; index++) {\\n\\t\\tvar key = window.localStorage.key(index),\\n\\t\\t\\tparts = key.split(\\\"#\\\");\\n\\t\\t// If it's ours\\n\\t\\tif(parts[0] === \\\"tw5\\\" & & parts[1] === url) {\\n\\t\\t\\t// Read it as JSON\\n\\t\\t\\tvar jsonString = window.localStorage.getItem(key),\\n\\t\\t\\t\\tjsonData;\\n\\t\\t\\tif(jsonString) {\\n\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\tjsonData = JSON.parse(jsonString);\\n\\t\\t\\t\\t} catch(e) {}\\n\\t\\t\\t\\tif(jsonData) {\\n\\t\\t\\t\\t\\t// Convert it to a tiddler\\n\\t\\t\\t\\t\\tvar incomingTiddler = new $tw.Tiddler(jsonData);\\n\\t\\t\\t\\t\\tif(incomingTiddler) {\\n\\t\\t\\t\\t\\t\\t// Get any existing tiddler\\n\\t\\t\\t\\t\\t\\tvar title = incomingTiddler.fields.title,\\n\\t\\t\\t\\t\\t\\t\\texistingTiddler = $tw.wiki.getTiddler(title);\\n\\t\\t\\t\\t\\t\\tif(existingTiddler & & existingTiddler.isEqual(incomingTiddler)) {\\n\\t\\t\\t\\t\\t\\t\\t// If the incoming ti
{"title":"$:/plugins/tiddlywiki/codemirror","name":"CodeMirror","description":"CodeMirror editor","list":"readme usage keyboard license","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/config/EditorTypeMappings/application/javascript\":{\"title\":\"$:/config/EditorTypeMappings/application/javascript\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/application/json\":{\"title\":\"$:/config/EditorTypeMappings/application/json\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/application/x-tiddler-dictionary\":{\"title\":\"$:/config/EditorTypeMappings/application/x-tiddler-dictionary\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/css\":{\"title\":\"$:/config/EditorTypeMappings/text/css\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/html\":{\"title\":\"$:/config/EditorTypeMappings/text/html\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/plain\":{\"title\":\"$:/config/EditorTypeMappings/text/plain\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/vnd.tiddlywiki\":{\"title\":\"$:/config/EditorTypeMappings/text/vnd.tiddlywiki\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/x-markdown\":{\"title\":\"$:/config/EditorTypeMappings/text/x-markdown\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/markdown\":{\"title\":\"$:/config/EditorTypeMappings/text/markdown\",\"text\":\"codemirror\"},\"$:/config/EditorTypeMappings/text/x-tiddlywiki\":{\"title\":\"$:/config/EditorTypeMappings/text/x-tiddlywiki\",\"text\":\"codemirror\"},\"$:/config/codemirror/cursorBlinkRate\":{\"title\":\"$:/config/codemirror/cursorBlinkRate\",\"type\":\"integer\",\"text\":\"530\"},\"$:/config/codemirror/extraKeysTW\":{\"title\":\"$:/config/codemirror/extraKeysTW\",\"extend\":\"extraKeys\",\"type\":\"json\",\"text\":\"{\\n\\t\\\"Ctrl-Esc\\\": \\\"singleSelection\\\",\\n\\t\\\"Esc\\\": \\\"\\\",\\n\\t\\\"Ctrl-S\\\": \\\"\\\",\\n\\t\\\"Ctrl-U\\\": \\\"\\\",\\n\\t\\\"Ctrl-T\\\": \\\"\\\",\\n\\t\\\"Alt-T\\\": \\\"transposeChars\\\",\\n\\t\\\"Alt-U\\\": \\\"undoSelection\\\",\\n\\t\\\"Shift-Alt-U\\\": \\\"redoSelection\\\",\\n\\t\\\"Cmd-U\\\": \\\"\\\",\\n\\t\\\"Tab\\\": \\\"indentAuto()\\\",\\n\\t\\\"Enter\\\": \\\"newLineAndIndent()\\\"\\n}\\n\"},\"$:/config/codemirror/indentUnit\":{\"title\":\"$:/config/codemirror/indentUnit\",\"type\":\"integer\",\"text\":\"2\"},\"$:/config/codemirror/indentWithTabs\":{\"title\":\"$:/config/codemirror/indentWithTabs\",\"type\":\"bool\",\"text\":\"true\"},\"$:/config/codemirror/inputStyle\":{\"title\":\"$:/config/codemirror/inputStyle\",\"type\":\"string\",\"text\":\"textarea\"},\"$:/config/codemirror/keyMap\":{\"title\":\"$:/config/codemirror/keyMap\",\"type\":\"string\",\"text\":\"default\"},\"$:/config/codemirror/lineNumbers\":{\"title\":\"$:/config/codemirror/lineNumbers\",\"type\":\"bool\",\"text\":\"false\"},\"$:/config/codemirror/lineWrapping\":{\"title\":\"$:/config/codemirror/lineWrapping\",\"type\":\"bool\",\"text\":\"true\"},\"$:/config/codemirror/showCursorWhenSelecting\":{\"title\":\"$:/config/codemirror/showCursorWhenSelecting\",\"type\":\"bool\",\"text\":\"true\"},\"$:/config/codemirror/smartIndent\":{\"title\":\"$:/config/codemirror/smartIndent\",\"type\":\"bool\",\"text\":\"true\"},\"$:/config/codemirror/styleActiveLine\":{\"title\":\"$:/config/codemirror/styleActiveLine\",\"type\":\"bool\",\"text\":\"false\"},\"$:/config/codemirror/tabSize\":{\"title\":\"$:/config/codemirror/tabSize\",\"type\":\"integer\",\"text\":\"2\"},\"$:/config/codemirror/theme\":{\"title\":\"$:/config/codemirror/theme\",\"type\":\"string\",\"text\":\"tiddlywiki\"},\"$:/language/codemirror/homeUrl\":{\"title\":\"$:/language/codemirror/homeUrl\",\"text\":\"http://codemirror.net\"},\"$:/language/codemirror/addOnUrl\":{\"title\":\"$:/language/codemirror/addOnUrl\",\"text\":\"http://codemirror.net/doc/manual.html#addons\"},\"$:/language/codemirror/configUrl\":{\"title\":\"$:/language/codemirror/configUrl\",\"text\":\"http://codemirror.net/doc/manual.html#config\"},\"$:/language
2023-04-27 20:28:00 +02:00
{"title":"$:/plugins/tiddlywiki/codemirror-mode-css","name":"CodeMirror Mode CSS","description":"CSS highlighting mode for CodeMirror","parent-plugin":"$:/plugins/tiddlywiki/codemirror","list":"readme","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/codemirror/mode/css/css.js\":{\"text\":\"// CodeMirror, copyright (c) by Marijn Haverbeke and others\\n// Distributed under an MIT license: https://codemirror.net/LICENSE\\n!function(e){\\\"object\\\"==typeof exports& & \\\"object\\\"==typeof module?e(require(\\\"../../lib/codemirror\\\")):\\\"function\\\"==typeof define& & define.amd?define([\\\"../../lib/codemirror\\\"],e):e(CodeMirror)}(function(T){\\\"use strict\\\";function e(e){for(var t={},r=0;r\u003Ce.length;++r)t[e[r].toLowerCase()]=!0;return t}T.defineMode(\\\"css\\\",function(e,t){var r=t.inline;t.propertyKeywords||(t=T.resolveMode(\\\"text/css\\\"));var a,i,n=e.indentUnit,l=t.tokenHooks,o=t.documentTypes||{},s=t.mediaTypes||{},d=t.mediaFeatures||{},c=t.mediaValueKeywords||{},p=t.propertyKeywords||{},u=t.nonStandardPropertyKeywords||{},m=t.fontProperties||{},b=t.counterDescriptors||{},g=t.colorKeywords||{},h=t.valueKeywords||{},f=t.allowNested,k=t.lineComment,y=!0===t.supportsAtComponent,w=!1!==e.highlightNonStandardPropertyKeywords;function v(e,t){return a=t,e}function x(i){return function(e,t){for(var r,o=!1;null!=(r=e.next());){if(r==i&&!o){\\\")\\\"==i&&e.backUp(1); break}o=!o& & \\\"\\\\\\\\\\\"==r}return r!=i& & (o||\\\")\\\"==i)||(t.tokenize=null),a=\\\"string\\\"}}function z(e,t){return e.next(),e.match(/\\\\s*[\\\\\\\"\\\\')]/,!1)?t.tokenize=null:t.tokenize=x(\\\")\\\"),a=\\\"(\\\",null}function j(e,t,r){this.type=e,this.indent=t,this.prev=r}function P(e,t,r,o){return e.context=new j(r,t.indentation()+(!1===o?0:n),e.context),r}function K(e){return e.context.prev& & (e.context=e.context.prev),e.context.type}function q(e,t,r){return _[r.context.type](e,t,r)}function C(e,t,r,o){for(var i=o||1;0\u003Ci;i--)r.context=r.context.prev;return q(e,t,r)}function B(e){var t=e.current().toLowerCase();i=h.hasOwnProperty(t)?\\\"atom\\\":g.hasOwnProperty(t)?\\\"keyword\\\":\\\"variable\\\"}var _={top:function(e,t,r){if(\\\"{\\\"==e)return P(r,t,\\\"block\\\");if(\\\"}\\\"==e& & r.context.prev)return K(r);if(y& & /@component/i.test(e))return P(r,t,\\\"atComponentBlock\\\");if(/^@(-moz-)?document$/i.test(e))return P(r,t,\\\"documentTypes\\\");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return P(r,t,\\\"atBlock\\\");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,\\\"restricted_atBlock_before\\\";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return\\\"keyframes\\\";if(e& & \\\"@\\\"==e.charAt(0))return P(r,t,\\\"at\\\");if(\\\"hash\\\"==e)i=\\\"builtin\\\";else if(\\\"word\\\"==e)i=\\\"tag\\\";else{if(\\\"variable-definition\\\"==e)return\\\"maybeprop\\\";if(\\\"interpolation\\\"==e)return P(r,t,\\\"interpolation\\\");if(\\\":\\\"==e)return\\\"pseudo\\\";if(f& & \\\"(\\\"==e)return P(r,t,\\\"parens\\\")}return r.context.type},block:function(e,t,r){if(\\\"word\\\"!=e)return\\\"meta\\\"==e?\\\"block\\\":f||\\\"hash\\\"!=e&&\\\"qualifier\\\"!=e?_.top(e,t,r):(i=\\\"error\\\",\\\"block\\\"); var o=t.current().toLowerCase();return p.hasOwnProperty(o)?(i=\\\"property\\\",\\\"maybeprop\\\"):u.hasOwnProperty(o)?(i=w?\\\"string-2\\\":\\\"property\\\",\\\"maybeprop\\\"):f?(i=t.match(/^\\\\s*:(?:\\\\s|$)/,!1)?\\\"property\\\":\\\"tag\\\",\\\"block\\\"):(i+=\\\" error\\\",\\\"maybeprop\\\")},maybeprop:function(e,t,r){return\\\":\\\"==e?P(r,t,\\\"prop\\\"):q(e,t,r)},prop:function(e,t,r){if(\\\";\\\"==e)return K(r);if(\\\"{\\\"==e& & f)return P(r,t,\\\"propBlock\\\");if(\\\"}\\\"==e||\\\"{\\\"==e)return C(e,t,r);if(\\\"(\\\"==e)return P(r,t,\\\"parens\\\");if(\\\"hash\\\"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if(\\\"word\\\"==e)B(t);else if(\\\"interpolation\\\"==e)return P(r,t,\\\"interpolation\\\")}else i+=\\\" error\\\";return\\\"prop\\\"},propBlock:function(e,t,r){return\\\"}\\\"==e?K(r):\\\"word\\\"==e?(i=
{"title":"$:/plugins/tiddlywiki/codemirror-mode-htmlmixed","name":"CodeMirror Mode HTML Mixed","description":"HTML mixed highlighting mode for CodeMirror","parent-plugin":"$:/plugins/tiddlywiki/codemirror","dependents":"$:/plugins/tiddlywiki/codemirror-mode-xml $:/plugins/tiddlywiki/codemirror-mode-javascript $:/plugins/tiddlywiki/codemirror-mode-css","list":"readme","version":"5.2.7","plugin-type":"plugin","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed.js\":{\"text\":\"// CodeMirror, copyright (c) by Marijn Haverbeke and others\\n// Distributed under an MIT license: https://codemirror.net/LICENSE\\n!function(t){\\\"object\\\"==typeof exports& & \\\"object\\\"==typeof module?t(require(\\\"../../lib/codemirror\\\"),require(\\\"../xml/xml\\\"),require(\\\"../javascript/javascript\\\"),require(\\\"../css/css\\\")):\\\"function\\\"==typeof define& & define.amd?define([\\\"../../lib/codemirror\\\",\\\"../xml/xml\\\",\\\"../javascript/javascript\\\",\\\"../css/css\\\"],t):t(CodeMirror)}(function(p){\\\"use strict\\\";var l={script:[[\\\"lang\\\",/(javascript|babel)/i,\\\"javascript\\\"],[\\\"type\\\",/^(?:text|application)\\\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,\\\"javascript\\\"],[\\\"type\\\",/./,\\\"text/plain\\\"],[null,null,\\\"javascript\\\"]],style:[[\\\"lang\\\",/^css$/i,\\\"css\\\"],[\\\"type\\\",/^(text\\\\/)?(x-)?(stylesheet|css)$/i,\\\"css\\\"],[\\\"type\\\",/./,\\\"text/plain\\\"],[null,null,\\\"css\\\"]]};var o={};function f(t,e){var a,n=t.match(o[a=e]||(o[a]=new RegExp(\\\"\\\\\\\\s+\\\"+a+\\\"\\\\\\\\s*=\\\\\\\\s*('|\\\\\\\")?([^'\\\\\\\"]+)('|\\\\\\\")?\\\\\\\\s*\\\")));return n?/^\\\\s*(.*?)\\\\s*$/.exec(n[2])[1]:\\\"\\\"}function h(t,e){return new RegExp((e?\\\"^\\\":\\\"\\\")+\\\"\u003C/s*\\\"+t+\\\"s*>\\\",\\\"i\\\")}function r(t,e){for(var a in t)for(var n=e[a]||(e[a]=[]),l=t[a],o=l.length-1;0\u003C=o;o--)n.unshift(l[o])}p.defineMode(\\\"htmlmixed\\\",function(u,t){var m=p.getMode(u,{name:\\\"xml\\\",htmlMode:!0,multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag,allowMissingTagName:t.allowMissingTagName}),d={},e=t&&t.tags,a=t&&t.scriptTypes; if(r(l,d),e& & r(e,d),a)for(var n=a.length-1;0\u003C=n;n--)d.script.unshift([\\\"type\\\",a[n].matches,a[n].mode]);function g(t,e){var a,n,l,o,i,c,r=m.token(t,e.htmlState),s=/\\\\btag\\\\b/.test(r);return s& & !/[\u003C>\\\\s\\\\/]/.test(t.current())& & (a=e.htmlState.tagName& & e.htmlState.tagName.toLowerCase())& & d.hasOwnProperty(a)?e.inTag=a+\\\" \\\":e.inTag& & s& & />$/.test(t.current())?(n=/^([\\\\S]+) (.*)/.exec(e.inTag),e.inTag=null,l=\\\">\\\"==t.current()& & function(t,e){for(var a=0;a\u003Ct.length;a++){var n=t[a];if(!n[0]||n[1].test(f(e,n[0])))return n[2]}}(d[n[1]],n[2]),o=p.getMode(u,l),i=h(n[1],!0),c=h(n[1],!1),e.token=function(t,e){return t.match(i,!1)?(e.token=g,e.localState=e.localMode=null):(a=t,n=c,l=e.localMode.token(t,e.localState),o=a.current(),-1\u003C(r=o.search(n))?a.backUp(o.length-r):o.match(/\u003C\\\\/?$/)&&(a.backUp(o.length),a.match(n,!1)||a.match(o)),l); var a,n,l,o,r},e.localMode=o,e.localState=p.startState(o,m.indent(e.htmlState,\\\"\\\",\\\"\\\"))):e.inTag& & (e.inTag+=t.current(),t.eol()& & (e.inTag+=\\\" \\\")),r}return{startState:function(){return{token:g,inTag:null,localMode:null,localState:null,htmlState:p.startState(m)}},copyState:function(t){var e;return t.localState& & (e=p.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:e,htmlState:p.copyState(m,t.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(t,e,a){return!t.localMode||/^\\\\s*\u003C\\\\//.test(e)?m.indent(t.htmlState,e,a):t.localMode.indent?t.localMode.indent(t.localState,e,a):p.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||m}}}},\\\"xml\\\",\\\"javascript\\\",\\\"css\\\"),p.defineMIME(\\\"text/html\\\",\\\"htmlmixed\\\")});\\n\",\"type\":\"application/javascript\",\"title\":\"$:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed.js\",\"module-type\":\"codemirro
{"title":"$:/plugins/tiddlywiki/codemirror-mode-javascript","name":"CodeMirror Mode JavaScript","description":"JavaScript highlighting mode for CodeMirror","parent-plugin":"$:/plugins/tiddlywiki/codemirror","list":"readme","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js\":{\"text\":\"// CodeMirror, copyright (c) by Marijn Haverbeke and others\\n// Distributed under an MIT license: https://codemirror.net/LICENSE\\n!function(e){\\\"object\\\"==typeof exports& & \\\"object\\\"==typeof module?e(require(\\\"../../lib/codemirror\\\")):\\\"function\\\"==typeof define& & define.amd?define([\\\"../../lib/codemirror\\\"],e):e(CodeMirror)}(function(tt){\\\"use strict\\\";tt.defineMode(\\\"javascript\\\",function(e,l){var t,r,n,a,i,o,d=e.indentUnit,p=l.statementIndent,c=l.jsonld,s=l.json||c,u=l.typescript,f=l.wordCharacters||/[\\\\w$\\\\xa1-\\\\uffff]/,m=(t=v(\\\"keyword a\\\"),r=v(\\\"keyword b\\\"),n=v(\\\"keyword c\\\"),a=v(\\\"keyword d\\\"),i=v(\\\"operator\\\"),{if:v(\\\"if\\\"),while:t,with:t,else:r,do:r,try:r,finally:r,return:a,break:a,continue:a,new:v(\\\"new\\\"),delete:n,void:n,throw:n,debugger:v(\\\"debugger\\\"),var:v(\\\"var\\\"),const:v(\\\"var\\\"),let:v(\\\"var\\\"),function:v(\\\"function\\\"),catch:v(\\\"catch\\\"),for:v(\\\"for\\\"),switch:v(\\\"switch\\\"),case:v(\\\"case\\\"),default:v(\\\"default\\\"),in:i,typeof:i,instanceof:i,true:o={type:\\\"atom\\\",style:\\\"atom\\\"},false:o,null:o,undefined:o,NaN:o,Infinity:o,this:v(\\\"this\\\"),class:v(\\\"class\\\"),super:v(\\\"atom\\\"),yield:n,export:v(\\\"export\\\"),import:v(\\\"import\\\"),extends:n,await:n});function v(e){return{type:e,style:\\\"keyword\\\"}}var k,y,w=/[+\\\\-*&%=\u003C>!?|~^@]/,b=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\\\"/; function x(e,t,r){return k=e,y=r,t}function h(e,t){var a,r=e.next();if('\\\"'==r||\\\"'\\\"==r)return t.tokenize=(a=r,function(e,t){var r,n=!1;if(c& & \\\"@\\\"==e.peek()& & e.match(b))return t.tokenize=h,x(\\\"jsonld-keyword\\\",\\\"meta\\\");for(;null!=(r=e.next())&&(r!=a||n); )n=!n&&\\\"\\\\\\\\\\\"==r; return n||(t.tokenize=h),x(\\\"string\\\",\\\"string\\\")}),t.tokenize(e,t);if(\\\".\\\"==r& & e.match(/^\\\\d[\\\\d_]*(?:[eE][+\\\\-]?[\\\\d_]+)?/))return x(\\\"number\\\",\\\"number\\\");if(\\\".\\\"==r& & e.match(\\\"..\\\"))return x(\\\"spread\\\",\\\"meta\\\");if(/[\\\\[\\\\]{}\\\\(\\\\),;\\\\:\\\\.]/.test(r))return x(r);if(\\\"=\\\"==r& & e.eat(\\\">\\\"))return x(\\\"=>\\\",\\\"operator\\\");if(\\\"0\\\"==r& & e.match(/^(?:x[\\\\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return x(\\\"number\\\",\\\"number\\\");if(/\\\\d/.test(r))return e.match(/^[\\\\d_]*(?:n|(?:\\\\.[\\\\d_]*)?(?:[eE][+\\\\-]?[\\\\d_]+)?)?/),x(\\\"number\\\",\\\"number\\\");if(\\\"/\\\"==r)return e.eat(\\\"*\\\")?(t.tokenize=g)(e,t):e.eat(\\\"/\\\")?(e.skipToEnd(),x(\\\"comment\\\",\\\"comment\\\")):et(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if(\\\"/\\\"==t&&!n)return; \\\"[\\\"==t?n=!0:n&&\\\"]\\\"==t&&(n=!1)}r=!r&&\\\"\\\\\\\\\\\"==t}}(e),e.match(/^\\\\b(([gimyus])(?![gimyus]*\\\\2))+\\\\b/),x(\\\"regexp\\\",\\\"string-2\\\")):(e.eat(\\\"=\\\"),x(\\\"operator\\\",\\\"operator\\\",e.current())); if(\\\"`\\\"==r)return(t.tokenize=j)(e,t);if(\\\"#\\\"==r& & \\\"!\\\"==e.peek())return e.skipToEnd(),x(\\\"meta\\\",\\\"meta\\\");if(\\\"#\\\"==r& & e.eatWhile(f))return x(\\\"variable\\\",\\\"property\\\");if(\\\"\u003C\\\"==r& & e.match(\\\"!--\\\")||\\\"-\\\"==r& & e.match(\\\"->\\\")& & !/\\\\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),x(\\\"comment\\\",\\\"comment\\\");if(w.test(r))return\\\">\\\"==r&&t.lexical&&\\\">\\\"==t.lexical.type||(e.eat(\\\"=\\\")?\\\"!\\\"!=r&&\\\"=\\\"!=r||e.eat(\\\"=\\\"):/[\u003C>*+\\\\-|&?]/.test(r)&&(e.eat(r),\\\">\\\"==r&&e.eat(r))),\\\"?\\\"==r&&e.eat(\\\".\\\")?x(\\\".\\\"):x(\\\"operator\\\",\\\"operator\\\",e.current()); if(f.test(r)){e.eatWhile(f);var n=e.current();if(\\\".\\\"!=t.lastType){if(m.propertyIsEnumerable(n)){var i=m[n];return x(i.type
{"title":"$:/plugins/tiddlywiki/codemirror-mode-xml","name":"CodeMirror Mode XML","description":"XML highlighting mode for CodeMirror","parent-plugin":"$:/plugins/tiddlywiki/codemirror","list":"readme","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js\":{\"text\":\"// CodeMirror, copyright (c) by Marijn Haverbeke and others\\n// Distributed under an MIT license: https://codemirror.net/LICENSE\\n!function(t){\\\"object\\\"==typeof exports& & \\\"object\\\"==typeof module?t(require(\\\"../../lib/codemirror\\\")):\\\"function\\\"==typeof define& & define.amd?define([\\\"../../lib/codemirror\\\"],t):t(CodeMirror)}(function(N){\\\"use strict\\\";var y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},z={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};N.defineMode(\\\"xml\\\",function(t,e){var i,a,l=t.indentUnit,u={},n=e.htmlMode?y:z;for(var r in n)u[r]=n[r];for(var r in e)u[r]=e[r];function c(e,n){function t(t){return(n.tokenize=t)(e,n)}var r=e.next();if(\\\"\u003C\\\"==r)return e.eat(\\\"!\\\")?e.eat(\\\"[\\\")?e.match(\\\"CDATA[\\\")?t(s(\\\"atom\\\",\\\"]]>\\\")):null:e.match(\\\"--\\\")?t(s(\\\"comment\\\",\\\"--\\\\x3e\\\")):e.match(\\\"DOCTYPE\\\",!0,!0)?(e.eatWhile(/[\\\\w\\\\._\\\\-]/),t(function r(o){return function(t,e){for(var n;null!=(n=t.next());){if(\\\"\u003C\\\"==n)return e.tokenize=r(o+1),e.tokenize(t,e);if(\\\">\\\"==n){if(1!=o)return e.tokenize=r(o-1),e.tokenize(t,e);e.tokenize=c;break}}return\\\"meta\\\"}}(1))):null:e.eat(\\\"?\\\")?(e.eatWhile(/[\\\\w\\\\._\\\\-]/),n.tokenize=s(\\\"meta\\\",\\\"?>\\\"),\\\"meta\\\"):(i=e.eat(\\\"/\\\")?\\\"closeTag\\\":\\\"openTag\\\",n.tokenize=d,\\\"tag bracket\\\");if(\\\"& \\\"!=r)return e.eatWhile(/[^&\u003C]/),null; var o=e.eat(\\\"#\\\")?e.eat(\\\"x\\\")?e.eatWhile(/[a-fA-F\\\\d]/)&&e.eat(\\\"; \\\"):e.eatWhile(/[\\\\d]/)&&e.eat(\\\"; \\\"):e.eatWhile(/[\\\\w\\\\.\\\\-:]/)&&e.eat(\\\"; \\\");return o?\\\"atom\\\":\\\"error\\\"}function d(t,e){var n=t.next();if(\\\">\\\"==n||\\\"/\\\"==n& & t.eat(\\\">\\\"))return e.tokenize=c,i=\\\">\\\"==n?\\\"endTag\\\":\\\"selfcloseTag\\\",\\\"tag bracket\\\";if(\\\"=\\\"==n)return i=\\\"equals\\\",null;if(\\\"\u003C\\\"!=n)return/[\\\\'\\\\\\\"]/.test(n)?(e.tokenize=(r=n,a.isInAttribute=!0,a),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\\\\s\\\\u00a0=\u003C>\\\\\\\"\\\\']*[^\\\\s\\\\u00a0=\u003C>\\\\\\\"\\\\'\\\\/]/),\\\"word\\\");e.tokenize=c,e.state=g,e.tagName=e.tagStart=null;var r,o=e.tokenize(t,e);return o?o+\\\" tag error\\\":\\\"tag error\\\";function a(t,e){for(;!t.eol();)if(t.next()==r){e.tokenize=d;break}return\\\"string\\\"}}function s(n,r){return function(t,e){for(;!t.eol();){if(t.match(r)){e.tokenize=c;break}t.next()}return n}}function f(t,e,n){this.prev=t.context,this.tagName=e||\\\"\\\",this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context& & t.context.noIndent)& & (this.noIndent=!0)}function o(t){t.context& & (t.context=t.context.prev)}function m(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return;o(t)}}function g(t,e,n){return
2023-04-27 20:06:46 +02:00
{"title":"$:/plugins/tiddlywiki/markdown","name":"Markdown","description":"Markdown parser based on markdown-it","list":"readme config syntax license","version":"5.2.7","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/markdown/EditorToolbar/bold\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/bold\",\"list-after\":\"$:/core/ui/EditorToolbar/bold\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/bold\",\"caption\":\"{{$:/language/Buttons/Bold/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Bold/Hint}}\",\"condition\":\"[\u003CtargetTiddler>type[text/x-markdown]] [\u003CtargetTiddler>type[text/markdown]]\",\"shortcuts\":\"((bold))\",\"text\":\"\u003C$action-sendmessage\\n\\t$message=\\\"tm-edit-text-operation\\\"\\n\\t$param=\\\"wrap-selection\\\"\\n\\tprefix=\\\"**\\\"\\n\\tsuffix=\\\"**\\\"\\n/>\\n\"},\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-1\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-1\",\"list-after\":\"$:/core/ui/EditorToolbar/heading-1\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/heading-1\",\"caption\":\"{{$:/language/Buttons/Heading1/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Heading1/Hint}}\",\"condition\":\"[\u003CtargetTiddler>type[text/x-markdown]] [\u003CtargetTiddler>type[text/markdown]]\",\"shortcuts\":\"((heading-1))\",\"text\":\"\u003C$action-sendmessage\\n\\t$message=\\\"tm-edit-text-operation\\\"\\n\\t$param=\\\"prefix-lines\\\"\\n\\tcharacter=\\\"#\\\"\\n\\tcount=\\\"1\\\"\\n/>\\n\"},\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-2\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-2\",\"list-after\":\"$:/core/ui/EditorToolbar/heading-2\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/heading-2\",\"caption\":\"{{$:/language/Buttons/Heading2/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Heading2/Hint}}\",\"condition\":\"[\u003CtargetTiddler>type[text/x-markdown]] [\u003CtargetTiddler>type[text/markdown]]\",\"shortcuts\":\"((heading-2))\",\"text\":\"\u003C$action-sendmessage\\n\\t$message=\\\"tm-edit-text-operation\\\"\\n\\t$param=\\\"prefix-lines\\\"\\n\\tcharacter=\\\"#\\\"\\n\\tcount=\\\"2\\\"\\n/>\\n\"},\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-3\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-3\",\"list-after\":\"$:/core/ui/EditorToolbar/heading-3\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/heading-3\",\"caption\":\"{{$:/language/Buttons/Heading3/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Heading3/Hint}}\",\"condition\":\"[\u003CtargetTiddler>type[text/x-markdown]] [\u003CtargetTiddler>type[text/markdown]]\",\"shortcuts\":\"((heading-3))\",\"text\":\"\u003C$action-sendmessage\\n\\t$message=\\\"tm-edit-text-operation\\\"\\n\\t$param=\\\"prefix-lines\\\"\\n\\tcharacter=\\\"#\\\"\\n\\tcount=\\\"3\\\"\\n/>\\n\"},\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-4\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-4\",\"list-after\":\"$:/core/ui/EditorToolbar/heading-4\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/heading-4\",\"caption\":\"{{$:/language/Buttons/Heading4/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Heading4/Hint}}\",\"condition\":\"[\u003CtargetTiddler>type[text/x-markdown]] [\u003CtargetTiddler>type[text/markdown]]\",\"shortcuts\":\"((heading-4))\",\"text\":\"\u003C$action-sendmessage\\n\\t$message=\\\"tm-edit-text-operation\\\"\\n\\t$param=\\\"prefix-lines\\\"\\n\\tcharacter=\\\"#\\\"\\n\\tcount=\\\"4\\\"\\n/>\\n\"},\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-5\":{\"title\":\"$:/plugins/tiddlywiki/markdown/EditorToolbar/heading-5\",\"list-after\":\"$:/core/ui/EditorToolbar/heading-5\",\"tags\":\"$:/tags/EditorToolbar\",\"icon\":\"$:/core/images/heading-5\",\"caption\":\"{{$:/language/Buttons/Heading5/Caption}} (Markdown)\",\"description\":\"{{$:/language/Buttons/Heading5/Hint}}\",\"condition\":\"[\u003CtargetTiddler>
2023-04-28 14:21:22 +02:00
{"created":"20230423163535033","title":"$:/SiteSubtitle","text":"protocol for surfing 3D assets (unhosted){{$:/xrfragment/topmenu}}","modified":"20230428121341246"},
{"created":"20230423163524355","title":"$:/SiteTitle","text":"XR Fragments","modified":"20230428121135697"},
2023-04-27 17:35:20 +02:00
{"created":"20230425164931250","title":"$:/state/folded/AFRAME template","text":"show","modified":"20230425164935940"},
{"created":"20230425164931250","title":"$:/state/folded/GLSL shader template","text":"show","modified":"20230425164939576"},
{"created":"20230424142403302","text":"checked","title":"$:/state/import/select-all","modified":"20230424142404392"},
2023-05-04 19:45:06 +02:00
{"created":"20230423163640468","title":"$:/state/notebook-sidebar","text":"no","modified":"20230504174439906"},
{"created":"20230423163641722","title":"$:/state/notebook-sidebar-section","text":"Reference","modified":"20230504150240576"},
2023-04-27 17:35:20 +02:00
{"created":"20230427102758222","title":"$:/state/plugin-info--1887569658-$:/plugins/ihm/tidgraph--50210113","text":"documentation","modified":"20230427102759911"},
{"created":"20230427092525294","title":"$:/state/plugin-info--391242618-$:/plugins/tiddlywiki/browser-storage","text":"yes","modified":"20230427092525375"},
{"created":"20230427093219686","title":"$:/state/plugin-info--391242618-$:/plugins/tiddlywiki/browser-storage--605768392","text":"settings","modified":"20230427094141558"},
{"created":"20230424092949812","title":"$:/state/plugin-info-1024395336-$:/plugins/tiddlywiki/codemirror--1574138004","text":"contents","modified":"20230425143706081"},
{"created":"20230424093627704","title":"$:/state/plugin-info-833095967-Draft of '$:/core'---1604322978","text":"readme","modified":"20230424093629208"},
2023-05-04 13:28:22 +02:00
{"created":"20230423163649566","title":"$:/state/showeditpreview","text":"no","modified":"20230504103804532"},
2023-05-04 19:54:44 +02:00
{"created":"20230504174435745","title":"$:/state/sidebar","text":"no","modified":"20230504174456146"},
2023-04-27 20:06:46 +02:00
{"created":"20230423163453188","title":"$:/state/tab--1963855381","text":"$:/core/ui/ControlPanel/Toolbars","modified":"20230427180255458"},
2023-04-27 17:35:20 +02:00
{"created":"20230427092954391","title":"$:/state/tab--2112689675","text":"$:/core/ui/ControlPanel/Basics","modified":"20230427093021814"},
{"created":"20230424093058379","title":"$:/state/tab--697582678","text":"$:/core/ui/ControlPanel/Settings/TiddlyWiki","modified":"20230427093030201"},
{"created":"20230424093019562","title":"$:/state/tab--86143343","text":"$:/core/ui/ControlPanel/Plugins/Installed/Plugins","modified":"20230424143034115"},
{"created":"20230427093005798","title":"$:/state/tab--959111941","text":"$:/core/ui/ControlPanel/Cascades","modified":"20230427093019630"},
2023-04-28 14:21:22 +02:00
{"created":"20230423163443902","title":"$:/state/tab-1749438307","text":"$:/core/ui/ControlPanel/Info","modified":"20230428121132415"},
2023-04-27 17:35:20 +02:00
{"created":"20230427092533296","title":"$:/state/tab-2065006209","text":"$:/core/ui/ControlPanel/Saving/General","modified":"20230427092920920"},
{"created":"20230427151522031","title":"$:/state/tab/moresidebar-1850697562","text":"$:/core/ui/MoreSideBar/All","modified":"20230427151523774"},
2023-04-27 20:06:46 +02:00
{"created":"20230423164446212","title":"$:/state/tabs/controlpanel/toolbars-1345989671","text":"$:/core/ui/ControlPanel/Toolbars/PageControls","modified":"20230427180259900"},
2023-04-27 17:35:20 +02:00
{"title":"$:/status/RequireReloadDueToPluginChange","text":"no"},
2023-05-04 19:45:06 +02:00
{"title":"$:/StoryList","text":"","list":"[[XR Fragments]]"},
2023-04-27 17:35:20 +02:00
{"created":"20230423163445948","title":"$:/theme","text":"$:/themes/nico/notebook","modified":"20230423163445948"},
{"text":"{\n \"tiddlers\": {\n \"$:/themes/nico/notebook/LICENSE\": {\n \"title\": \"$:/themes/nico/notebook/LICENSE\",\n \"created\": \"20200419141443144\",\n \"modified\": \"20210118213330307\",\n \"tags\": \"\",\n \"type\": \"text/vnd.tiddlywiki\",\n \"text\": \"\\nMIT License Copyright (c) 2020 [[Nicolas Petton|https://nicolas.petton.fr]] nicolas@petton.fr\\n\\nPermission is hereby granted, free of charge, to any person obtaining a copy\\nof this software and associated documentation files (the \\\"Software\\\"), to deal\\nin the Software without restriction, including without limitation the rights\\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\\ncopies of the Software, and to permit persons to whom the Software is furnished\\nto do so, subject to the following conditions:\\n\\nThe above copyright notice and this permission notice (including the next\\nparagraph) shall be included in all copies or substantial portions of the\\nSoftware.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\\nOR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\\nOR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\n\"\n },\n \"$:/themes/nico/notebook/themetweaks\": {\n \"title\": \"$:/themes/nico/notebook/themetweaks\",\n \"created\": \"20201217172915960\",\n \"modified\": \"20210123211851680\",\n \"tags\": \"$:/tags/ControlPanel/Appearance\",\n \"caption\": \"{{$:/language/ThemeTweaks/ThemeTweaks}}\",\n \"text\": \"\\\\define lingo-base() $:/language/ThemeTweaks/\\n\\nYou can tweak certain aspects of the ''Notebook'' theme.\\n\\n! \u003C\u003Clingo Options>>\\n\\n|\u003C$link to=\\\"$:/themes/nico/notebook/options/stickytitles\\\">\u003C\u003Clingo Options/StickyTitles>>\u003C/$link>\u003Cbr>//\u003C\u003Clingo Options/StickyTitles/Hint>>// |\u003C$select tiddler=\\\"$:/themes/nico/notebook/options/stickytitles\\\">\u003Coption value=\\\"no\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"yes\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003C\u003Clingo Options/CodeWrapping>>\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003Coption value=\\\"pre\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"pre-wrap\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/nico/notebook/options/reveal-tiddler-controls-on-hover\\\">Reveal tiddler controls on mouseover\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/nico/notebook/options/reveal-tiddler-controls-on-hover\\\">\u003Coption value=\\\"no\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"yes\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n\\n! \u003C\u003Clingo Settings>>\\n\\n|\u003C$link to=\\\"$:/themes/nico/notebook/settings/fontfamily\\\">\u003C\u003Clingo Settings/FontFamily>>\u003C/$link> |\u003C$edit-text tiddler=\\\"$:/themes/nico/notebook/settings/fontfamily\\\" default=\\\"\\\" tag=\\\"input\\\"/> | |\\n|\u003C$link to=\\\"$:/themes/nico/notebook/settings/codefontfamily\\\">\u003C\u003Clingo Settings/CodeFontFamily>>\u003C/$link> |\u003C$edit-text tiddler=\\\"$:/themes/nico/notebook/settings/codefontfamily\\\" default=\\\"\\\" tag=\\\"input\\\"/> | |\\n|\u003C$link to=\\\"$:/themes/nico/notebook/settings/editorfontfamily\\\">\u003C\u003Clingo Settings/EditorFontFamily>>\u003C/$link> |\u003C$edit-text tiddler=\\\"$:/themes/nico/notebook/settings/editorfontfamily\\\" default=\\\"\\\" tag=\\\"input\\\"/> | |\\n\\n! \u003C\u003Clingo Metrics>>\\n\\n|\u003C$link to=\\\"$:/themes/tiddl
{"created":"20200429144554294","title":"$:/themes/nico/notebook/metrics/sidebar-width","modified":"20230423163514560","tags":"","type":"text/vnd.tiddlywiki","text":"300px"},
{"created":"20210123210054185","title":"$:/themes/nico/notebook/metrics/story-width","modified":"20230423163516762","tags":"","type":"text/vnd.tiddlywiki","text":"100%"},
{"created":"20230423163459763","title":"$:/themes/nico/notebook/options/stickytitles","text":"yes","modified":"20230423163459763"},
{"title":"$:/themes/tiddlywiki/snowwhite","name":"Snow White","author":"JeremyRuston","core-version":">=5.0.0","plugin-type":"theme","description":"Emphasises individual tiddlers","dependents":"$:/themes/tiddlywiki/vanilla","plugin-priority":"0","version":"5.2.7","type":"application/json","text":"{\"tiddlers\":{\"$:/themes/tiddlywiki/snowwhite/base\":{\"title\":\"$:/themes/tiddlywiki/snowwhite/base\",\"tags\":\"[[$:/tags/Stylesheet]]\",\"text\":\"\\\\define sidebarbreakpoint-minus-one()\\n\u003C$text text={{{ [{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}removesuffix[px]subtract[1]addsuffix[px]] ~[{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}] }}}/>\\n\\\\end\\n\\n\\\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\\n\\n.tc-sidebar-header {\\n\\ttext-shadow: 0 1px 0 \u003C\u003Ccolour sidebar-foreground-shadow>>;\\n}\\n\\n.tc-tiddler-info {\\n\\t\u003C\u003Cbox-shadow \\\"inset 1px 2px 3px rgba(0,0,0,0.1)\\\">>\\n}\\n\\n@media screen {\\n\\t.tc-tiddler-frame {\\n\\t\\t\u003C\u003Cbox-shadow \\\"1px 1px 5px rgba(0, 0, 0, 0.3)\\\">>\\n\\t}\\n}\\n\\n@media (max-width: \u003C\u003Csidebarbreakpoint-minus-one>>) {\\n\\t.tc-tiddler-frame {\\n\\t\\t\u003C\u003Cbox-shadow none>>\\n\\t}\\n}\\n\\n.tc-page-controls button svg, .tc-tiddler-controls button svg, .tc-topbar button svg {\\n\\t\u003C\u003Ctransition \\\"fill 150ms ease-in-out\\\">>\\n}\\n\\n.tc-tiddler-controls button.tc-selected,\\n.tc-page-controls button.tc-selected {\\n\\t\u003C\u003Cfilter \\\"drop-shadow(0px -1px 2px rgba(0,0,0,0.25))\\\">>\\n}\\n\\n.tc-tiddler-frame input.tc-edit-texteditor,\\n.tc-tiddler-frame select.tc-edit-texteditor {\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 8px rgba(0, 0, 0, 0.15)\\\">>\\n}\\n\\n.tc-edit-tags {\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 8px rgba(0, 0, 0, 0.15)\\\">>\\n}\\n\\n.tc-tiddler-frame .tc-edit-tags input.tc-edit-texteditor {\\n\\t\u003C\u003Cbox-shadow \\\"none\\\">>\\n\\tborder: none;\\n\\toutline: none;\\n}\\n\\ntextarea.tc-edit-texteditor {\\n\\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings/editorfontfamily}};\\n}\\n\\ncanvas.tc-edit-bitmapeditor {\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 5px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-drop-down {\\n\\tborder-radius: 4px;\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 10px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-block-dropdown {\\n\\tborder-radius: 4px;\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 10px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-modal {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-shadow \\\"0 3px 7px rgba(0,0,0,0.3)\\\">>\\n}\\n\\n.tc-modal-footer {\\n\\tborder-radius: 0 0 6px 6px;\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 0 #fff\\\">>;\\n}\\n\\n\\n.tc-alert {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-shadow \\\"0 3px 7px rgba(0,0,0,0.6)\\\">>\\n}\\n\\n.tc-notification {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-shadow \\\"0 3px 7px rgba(0,0,0,0.3)\\\">>\\n\\ttext-shadow: 0 1px 0 rgba(255,255,255, 0.8);\\n}\\n\\n.tc-sidebar-lists .tc-tab-set .tc-tab-divider {\\n\\tborder-top: none;\\n\\theight: 1px;\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.0) 100%\\\">>\\n}\\n\\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button {\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.01) 0%, rgba(0,0,0,0.1) 100%\\\">>\\n}\\n\\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button.tc-tab-selected {\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.05) 0%, rgba(255,255,255,0.05) 100%\\\">>\\n}\\n\\n.tc-message-box img {\\n\\t\u003C\u003Cbox-shadow \\\"1px 1px 3px rgba(0,0,0,0.5)\\\">>\\n}\\n\\n.tc-plugin-info {\\n\\t\u003C\u003Cbox-shadow \\\"1px 1px 3px rgba(0,0,0,0.5)\\\">>\\n}\\n\"}}}"},
{"title":"$:/themes/tiddlywiki/vanilla","name":"Vanilla","author":"JeremyRuston","core-version":">=5.0.0","plugin-type":"theme","description":"Basic theme","plugin-priority":"0","version":"5.2.7","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/themes/tiddlywiki/vanilla/themetweaks\":{\"title\":\"$:/themes/tiddlywiki/vanilla/themetweaks\",\"tags\":\"$:/tags/ControlPanel/Appearance\",\"caption\":\"{{$:/language/ThemeTweaks/ThemeTweaks}}\",\"text\":\"\\\\define lingo-base() $:/language/ThemeTweaks/\\n\\n\\\\define replacement-text()\\n[img[$(imageTitle)$]]\\n\\\\end\\n\\n\\\\define backgroundimage-dropdown()\\n\u003Cdiv class=\\\"tc-drop-down-wrapper\\\">\\n\u003C$set name=\\\"state\\\" value=\u003C\u003Cqualify \\\"$:/state/popup/themetweaks/backgroundimage\\\">>>\\n\u003C$button popup=\u003C\u003Cstate>> class=\\\"tc-btn-invisible tc-btn-dropdown\\\">{{$:/core/images/down-arrow}}\u003C/$button>\\n\u003C$reveal state=\u003C\u003Cstate>> type=\\\"popup\\\" position=\\\"belowleft\\\" text=\\\"\\\" default=\\\"\\\" class=\\\"tc-popup-keep\\\">\\n\u003Cdiv class=\\\"tc-drop-down\\\" style=\\\"text-align:center;\\\">\\n\u003C$macrocall $name=\\\"image-picker\\\" actions=\\\"\\\"\\\"\\n\\n\u003C$action-setfield\\n\\t$tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\\\"\\n\\t$value=\u003C\u003CimageTitle>>\\n/>\\n\\n\u003C$action-deletetiddler $tiddler=\u003C\u003Cstate>>/>\\n\\n\\\"\\\"\\\"/>\\n\u003C/div>\\n\u003C/$reveal>\\n\u003C/$set>\\n\u003C/div>\\n\\\\end\\n\\n\\\\define backgroundimageattachment-dropdown()\\n\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment\\\" default=\\\"scroll\\\">\\n\u003Coption value=\\\"scroll\\\">\u003C\u003Clingo Settings/BackgroundImageAttachment/Scroll>>\u003C/option>\\n\u003Coption value=\\\"fixed\\\">\u003C\u003Clingo Settings/BackgroundImageAttachment/Fixed>>\u003C/option>\\n\u003C/$select>\\n\\\\end\\n\\n\\\\define backgroundimagesize-dropdown()\\n\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize\\\" default=\\\"scroll\\\">\\n\u003Coption value=\\\"auto\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Auto>>\u003C/option>\\n\u003Coption value=\\\"cover\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Cover>>\u003C/option>\\n\u003Coption value=\\\"contain\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Contain>>\u003C/option>\\n\u003C/$select>\\n\\\\end\\n\\n\u003C\u003Clingo ThemeTweaks/Hint>>\\n\\n! \u003C\u003Clingo Options>>\\n\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\\\">\u003C\u003Clingo Options/SidebarLayout>>\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\\\">\u003Coption value=\\\"fixed-fluid\\\">\u003C\u003Clingo Options/SidebarLayout/Fixed-Fluid>>\u003C/option>\u003Coption value=\\\"fluid-fixed\\\">\u003C\u003Clingo Options/SidebarLayout/Fluid-Fixed>>\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/stickytitles\\\">\u003C\u003Clingo Options/StickyTitles>>\u003C/$link>\u003Cbr>//\u003C\u003Clingo Options/StickyTitles/Hint>>// |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/stickytitles\\\">\u003Coption value=\\\"no\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"yes\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003C\u003Clingo Options/CodeWrapping>>\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003Coption value=\\\"pre\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"pre-wrap\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n\\n! \u003C\u003Clingo Settings>>\\n\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\\\">\u003C\u003Clingo Settings/FontFamily>>\u003C/$link> |\u003C$edit-text tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\\\" default=\\\"\\\" tag=\\\"input\\\"/> | |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/settings/co
{"created":"20230423163505037","title":"$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint","text":"600px","modified":"20230423164234376"},
{"created":"20230423164459179","title":"$:/view","text":"zoomin","modified":"20230427151401818"},
{"created":"20230426064525527","text":"\n\u003C!-- aframe v1.4.0 -->\n\u003Cscript>\n/*! For license information please see aframe.min.js.LICENSE.txt */\n!function(e,t){\"object\"==typeof exports& & \"object\"==typeof module?module.exports=t():\"function\"==typeof define& & define.amd?define([],t):\"object\"==typeof exports?exports.AFRAME=t():e.AFRAME=t()}(self,(()=>(()=>{var e={651:()=>{!function(){\"use strict\";var e=function(e,t){var n=function(e){for(var t=0,n=e.length;t\u003Cn;t++)i(e[t])},i=function(e){var t=e.target,n=e.attributeName,i=e.oldValue;t.attributeChangedCallback(n,i,t.getAttribute(n))};return function(r,s){var o=r.constructor.observedAttributes;return o& & e(s).then((function(){new t(n).observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:o});for(var e=0,s=o.length;e\u003Cs;e++)r.hasAttribute(o[e])&&i({target:r,attributeName:o[e],oldValue:null})})),r}}; function t(e,t){(null==t||t>e.length)&&(t=e.length); for(var n=0,i=new Array(t);n\u003Ct;n++)i[n]=e[n];return i}function n(e,n){var i=\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"]; if(!i){if(Array.isArray(e)||(i=function(e,n){if(e){if(\"string\"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);return\"Object\"===i& & e.constructor& & (i=e.constructor.name),\"Map\"===i||\"Set\"===i?Array.from(e):\"Arguments\"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?t(e,n):void 0}}(e))||n& & e& & \"number\"==typeof e.length){i&&(e=i); var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var o,a=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}var i=!0,r=!1,s=\"querySelectorAll\",o=\"querySelectorAll\",a=self,l=a.document,c=a.Element,h=a.MutationObserver,u=a.Set,d=a.WeakMap,p=function(e){return o in e},A=[].filter,f=function(e){var t=new d,a=function(n,i){var r;if(i)for(var s,o=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(n),a=0,l=m.length;a\u003Cl;a++)o.call(n,s=m[a])& & (t.has(n)||t.set(n,new u),(r=t.get(n)).has(s)||(r.add(s),e.handle(n,i,s)));else t.has(n)& & (r=t.get(n),t.delete(n),r.forEach((function(t){e.handle(n,i,t)})))},f=function(e){for(var t=!(arguments.length>1& & void 0!==arguments[1])||arguments[1],n=0,i=e.length;n\u003Ci;n++)a(e[n],t)},m=e.query,g=e.root||l,v=function(e){var t=arguments.length>1& & void 0!==arguments[1]?arguments[1]:document,o=arguments.length>2& & void 0!==arguments[2]?arguments[2]:MutationObserver,a=arguments.length>3& & void 0!==arguments[3]?arguments[3]:[\"*\"],l=function t(r,o,a,l,c,h){var u,d=n(r);try{for(d.s();!(u=d.n()).done;){var p=u.value;(h||s in p)& & (c?a.has(p)||(a.add(p),l.delete(p),e(p,c)):l.has(p)||(l.add(p),a.delete(p),e(p,c)),h||t(p[s](o),o,a,l,c,i))}}catch(e){d.e(e)}finally{d.f()}},c=new o((function(e){if(a.length){var t,s=a.join(\",\"),o=new Set,c=new Set,h=n(e);try{for(h.s();!(t=h.n()).done;){var u=t.value,d=u.addedNodes,p=u.removedNodes;l(p,s,o,c,r,r),l(d,s,o,c,i,r)}}catch(e){h.e(e)}finally{h.f()}}})),h=c.observe;return(c.observe=function(e){return h.call(c,e,{subtree:i,childList:i})})(t),c}(a,g,h,m),y=c.prototype.attachShadow;return y& & (c.prototype.attachShadow=function(e){var t=y.call(this,e);return v.observe(t),t}),m.length& & f(g[o](m)),{drop:function(e){for(var n=0,i=e.length;n\u003Ci;n++)t.delete(e[n])},flush:function(){for(var e=v.takeRecords(),t=0,n=e.length;t\u003Cn;t++)f(A.call(e[t].removedNodes,p),!1),f(A.call(e[t].addedNodes,p),!0)},observer:v,parse:f}},m=self,g=m.document,v=m.Map,y=m.MutationObserver,E=m.Object,b=m.Set,x=m.WeakMap,w=m.Element,C=m.HTMLElement,M=m.Node,_=m.Error,I=m.TypeError,B=m.Reflect,S=E.defineProperty,T=E.keys,L=E.getOwnPropertyNames,D=E.setPrototypeOf,R=!self.customElements,P=function(e){for(var t=T(e),n=[],i=t.length,r=0;r\u003Ci;r++)n[r]=e[t[r]],delete
2023-05-04 13:28:22 +02:00
{"created":"20230423163601005","text":"code{\n\tfont-size:12px;\n}\n\n.nc-sidebar h1.tc-site-title {\n margin: 0;\n text-indent: 113px;\n font-size: 15px !important;\n vertical-align: bottom;\n display: block;\n margin-top: 11px;\n}\n\nh1.tc-site-title::before {\n display: block;\n position: absolute;\n content: \"\";\n width: 99px;\n height: 100px;\n background: url(./example/assets/logo.png) no-repeat;\n background-size: contain;\n transform: translate(0px,-11px);\n}\n\n.nc-sidebar .section.open .label {\n background: linear-gradient(45deg,#7f4bca, #08F, #7f4bca)\n}\n\nbody.tc-body,\n.nc-bar.nc-topbar{\n background: #FFF;\n}\n\n.tc-site-title {\n color: #0a81FF;\n}\n\n.tc-story-river{\n width:100% !important;\n} \n\na,\na:visited,\na:focus-visible{\n color:#0a81FF\n}\na:hover{\n opacity:0.8;\n}\n\n\n.nc-sidebar{\n box-shadow: 0px 0px 0px 15px 0px 0px #0006;\n}\n\n.tc-tiddler-preview-preview iframe{\n width:100%;\n height:50vh;\n max-height:380px;\n}\n\n.tc-tiddler-preview-preview {\n border:none;\n overflow-y:auto;\n}\n\n@media only screen and (max-width: 500px) {\n .tc-tiddler-body > embed, \n .tc-tiddler-body > iframe {\n max-height:300px;\n }\n}\n\n\n.tc-tiddler-body, iframe{\n border-radius:7px;\n}\n\n.tc-tiddler-frame{\n\tborder:none;\n\tbox-shadow:none !important;\n}\n\n.nc-bar input[type=\"search\"]{\n background:#EEE;\n}\n.nc-bar {\n height:47px;\n}\n\n.CodeMirror {\n font-size:13px;\n}\n\nshader-doodle,\n.scene{\n width:100%;\n height:50vh; \n max-height:365px;\n}\n\n.scene canvas {\n border-radius:6px;\n}\n\n.scene pre {\n margin-top:0;\n}\n\npre.result::before {\n display: block;\n position: absolute;\n width: 51px;\n height: 20px;\n background: #FFF;\n content: \"output\";\n transform: translate(-13px,-25px);\n color: #FFFF;\n background: #555;\n text-indent: 5px;\n border-radius: 4px 4px 0px 0px;\n font-weight: bold;\n font-size: 11px;\n}\n\npre.result {\n background: #555;\n color: #ccc;\n margin: 0;\n border: 0;\n padding: 5px;\n border-radius: 0px 0px 6px 6px;\n vertical-align: top;\n padding-left: 13px;\n\t\tborder-top: 1px solid #ff02b5\n}\ntextarea.sandboxify {\n padding: 13px 13px 26px 13px;\n font-family: \"Fira Mono\",\"Liberation Mono\",Menlo,Courier,monospace;\n color: #ddddff;\n background: #333;\n border-radius: 6px 6px 0px 0px;\n vertical-align: top;\n min-height: 50px;\n white-space: nowrap;\n}\ntextarea.sandboxify, pre.result {\n width: 100%;\n max-width: 485px;\n min-width: 350px;\n display: inline-block;\n font-size: 13px;\n display: inline-block;\n box-sizing: border-box;\n\t\theight:14vh;\n\t\toverflow-y:auto\n}\n\n.border{\n border: 1px solid #ccc;\n box-shadow: 0px 0px 10px #0004;\n}\n\n/* hide admin buttons */\nbody#p .nc-sidebar .tc-reveal:nth-child(6),\nbody#p .nc-sidebar .tc-reveal:nth-child(8),\nbody#p .nc-sidebar .tc-reveal:nth-child(10),\nbody#p .nc-sidebar .tc-reveal:nth-child(12),\nbody#p .nc-sidebar .tc-reveal:nth-child(14){\n\tdisplay:none\n}\n\n.st, .dn, .se, .rr { color:#FFF; display:inline-block; padding:0px 3px; border-radius:5px; font-size:12px;margin:0px 5px 0px 0px} \n.st { background:#FA0;}\n.dn { background:#F0A;}\n.se { background:#0FA;}\n.rr { background:#0AF;}\n.st > .dn,\n.st > .rr { margin-left:5px;display:inline;}\n","tags":"$:/tags/Stylesheet","title":"$:/webxr-notebook/boot.css","modified":"20230504112705284","type":"text/css"},
2023-05-04 19:45:06 +02:00
{"created":"20230425145424360","text":"\u003Cscript>\nwindow.onerror=null\nif( typeof $tw != 'undefined' ) $tw.config.htmlUnsafeElements = [];\n\u003C/script>\n\n\u003C!-- browser console -->\n\u003Cscript>\n(function(){\n\t$ = (s) => document.querySelector(s)\n\twindow.errcolor = '#000c'\n \n let isLocalHost = () => document.location.hostname == 'localhost'\n if( !isLocalHost() ) setTimeout( () => window.document.body.id = \"p\",50) \n\n\twindow.log = (str,line,bgcolor) => {\n\t\tline = line || 0\n\t\t$scene = $('.scene')\n\t\t$console = $('.console')\n\t\tif( !$scene ) return;\n\t\t$scene.style.position = 'relative'\n\t\tif( !$console ){\n\t\t\tlet el = $console = document.createElement(\"pre\")\n\t\t\tel.className = \"console\"\n\t\t\tel.style.position = 'absolute';\n\t\t\tel.style.top = el.style.left = el.style.bottom = el.style.right = '0'\n\t\t\tel.style.zIndex = 1000;\n\t\t\tel.style.fontSize = '12px'\n\t\t\tel.style.padding = '10px'\n\t\t\tel.style.color = '#0CF'\n\t\t\tel.style.pointerEvents = 'none'\n\t\t\t$scene.appendChild($console)\n\t\t}\n\t\t$console.style.background = bgcolor ? bgcolor : 'transparent'\n\t\tlet lines = String($console.innerHTML).split(\"\\n\")\n\t\t\tlines[line] = str\n\t\t$console.innerHTML = lines.join(\"\\n\")\n\t}\n\n\tvar error = (event, source, lineno, colno, error) => {\n\t\tlog(lineno+\":\"+colno+\" \"+error, errcolor)\n\t}\n\twindow.onerror = log\n\tconsole.error = (s) => log(\"error: \"+s.toString(),errcolor)\n\n})()\n\u003C/script>\n\n\u003C!-- PWA service worker -->\n\u003Cscript>\n(function(){\n let isLocalHost = () => document.location.hostname == 'localhost'\n\n\t\t\tconst registerServiceWorker = async () => {\n if( isLocalHost() ) return\n\t\t\t\tif ('serviceWorker' in navigator) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst registration = await navigator.serviceWorker.register(\n\t\t\t\t\t\t\t\"./sw.js\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tscope: './',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (registration.installing) {\n\t\t\t\t\t\t\tconsole.log('Service worker installing');\n\t\t\t\t\t\t} else if (registration.waiting) {\n\t\t\t\t\t\t\tconsole.log('Service worker installed');\n\t\t\t\t\t\t} else if (registration.active) {\n\t\t\t\t\t\t\tconsole.log('Service worker active');\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(\"Registration failed with \"+error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n if (document.readyState === 'complete') registerServiceWorker();\n else document.addEventListener(\"DOMContentLoaded\", registerServiceWorker);\n\n if ( !isLocalHost() & & \"serviceWorker\" in navigator) { \n window.addEventListener(\"load\", async () => {\n try {\n const registration = await navigator.serviceWorker.register(\"./sw.js\");\n } catch (e) { console.error(e) }\n });\n window.addEventListener(\"beforeinstallprompt\", function (e) {\n e.userChoice.then(function (choiceResult) {\n if (choiceResult.outcome == \"dismissed\") {\n console.log(\"User cancelled home screen install\");\n } else console.log(\"User added to home screen\");\n });\n });\n }\n\t\t\t\n})()\n\u003C/script>\n","tags":"$:/tags/RawMarkup","title":"$:/webxr-notebook/boot.html","modified":"20230428151719616"},
2023-04-27 17:35:20 +02:00
{"created":"20230427081708927","text":"\u003C!-- sandboxify textareas with class 'sandboxify' -->\n\u003Cscript>\n\nfunction sandboxify() { \n let run = (t) => {\n let $res = t.parentElement.children[1]\n function log(res){\n $res.innerHTML = typeof res == 'string' ? res : JSON.stringify(res,null,2)\n }\n let _log = console.log\n console.log = log\n try{\n eval(t.value); \n }catch(e){ log(e) }finally{ console.log = _log }\n } \n const textareas = document.querySelectorAll(\"textarea.sandboxify\");\n textareas.forEach(t => {\n t.addEventListener(\"input\", function (event) {\n try {\n run(t)\n } catch (error) {\n console.error(error);\n }\n });\n run(t)\n }); \n}\n\n// call sandboxify once on page load\nsandboxify();\n\n// set up a MutationObserver to call sandboxify on any new textareas added to the DOM\nconst observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.addedNodes & & mutation.addedNodes.length > 0) {\n const addedNodes = mutation.addedNodes;\n addedNodes.forEach(addedNode => {\n if (addedNode.tagName === \"TEXTAREA\" & & addedNode.classList.contains(\"sandboxify\")) {\n sandboxify();\n }\n });\n }\n });\n});\n\nobserver.observe(document, { childList: true, subtree: true });\n\u003C/script>","tags":"$:/tags/RawMarkup","title":"$:/webxr-notebook/sandboxify.js","modified":"20230427090041916"},
{"created":"20230427072514129","text":"\u003C!-- scriptie-talkie-embed.js -->\n\u003Cscript>\n\n(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=\"function\"==typeof require&&require; if(!s& & o)return o(n,!0);if(r)return r(n,!0);throw Error(\"Cannot find module '\"+n+\"'\")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}for(var r=\"function\"==typeof require&&require,s=0; n.length>s;s++)i(n[s]);return i})({1:[function(require){\"use strict\";var scriptieTalkieEmbed=require(\"../../\");scriptieTalkieEmbed()},{\"../../\":2}],3:[function(require,module,exports){\"use strict\";module.exports=function(textarea){var opts={},data=textarea.getAttribute(\"data-scriptie-talkie\");if(!data)return opts;try{opts=eval(\"(\"+data+\")\")}catch(e){console.error(e)}finally{return opts}}},{}],4:[function(require,module){\"use strict\";function trimEmpty(lines){for(;lines.length&&!lines[0].trim().length; )lines.shift();for(;lines.length&&!lines[lines.length-1].trim().length; )lines.length--}function leftAlign(lines){var indent=-1;if(lines.filter(function(line){return line.trim().length}).forEach(function(line){for(var lineIndent=0,col=0;\" \"===line.charAt(col++);)lineIndent++;indent=-1===indent?lineIndent:Math.min(indent,lineIndent)}),!indent)return lines;for(var i=0;lines.length>i;i++)lines[i]=lines[i].slice(indent)}module.exports=function(textarea,addRows){addRows=addRows||0;var lines=textarea.textContent.split(\"\\n\");return trimEmpty(lines),leftAlign(lines),textarea.rows=Math.max(lines.length+addRows,1),textarea.textContent=lines.join(\"\\n\"),lines}},{}],5:[function(require,module){\"use strict\";function replaceElement(replaceEl,withEl){replaceEl.parentNode.replaceChild(withEl,replaceEl)}var format=require(\"util\").format;module.exports=function(textarea,opts){opts=opts||{};var minHeight=opts.minHeight||150,maxHeight=opts.maxHeight||600,minWidth=opts.minWidth||600,textareaWidth=textarea.clientWidth,width=Math.max(minWidth,textareaWidth),height=textarea.clientHeight+50;height=Math.max(minHeight,height),height=Math.min(maxHeight,height);var container=document.createElement(\"div\");return container.setAttribute(\"class\",\"scriptie-talkie-container\"),container.setAttribute(\"style\",format(\"width: %spx; height: %spx\",width,height)),replaceElement(textarea,container),container}},{util:6}],7:[function(require,module){\"use strict\";module.exports=function(container){var link=document.createElement(\"a\");return link.setAttribute(\"class\",\"scriptie-talkie-link\"),window.link=link,container.appendChild(link),link.textContent=\"full view\",link}},{}],8:[function(require,module){\"use script\";module.exports=function(){var head=document.getElementsByTagName(\"head\")[0],style=document.createElement(\"style\");style.type=\"text/css\",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)};var css=[\"textarea.scriptie-talkie {\",\" visibility: hidden;\",\" display : block;\",\"}\",\".scriptie-talkie-container {\",\" position: relative; \",\" margin: 10px 0px;\",\"}\",\".scriptie-talkie-editor,\",\".scriptie-talkie-terminal {\",\" position: absolute;\",\" top: 0;\",\" bottom: 0;\",\" height: 100%;\",\" width: 50%;\",\"}\",\".scriptie-talkie-editor {\",\" left: 0;\",\" right: 50%;\",\"}\",\".scriptie-talkie-link {\",\" position : absolute;\",\" bottom : 1px;\",\" right : 4px;\",\" font-size : 14px;\",\" color : yellowgreen;\",\" z-index : 1;\",\"}\",\"textarea.scriptie-talkie, \",\".scriptie-talkie-terminal,\",\".scriptie-talkie-editor {\",\" /* text area needs same font to determine editor size correctly */\",\" font-size : 14px;\",\" font-family : Terminus,Consolas,Profont,Monaco,Inconsolata,Inconsolata-g,\",' Unifont,Lime,\"ClearlyU PUA\",Clean,\"DejaVu Sans Mono\",\"Lucida Console\",',' \"Bitstream Vera Sans Mono\",Freemono,\"Liberation Mono\",Dina,Anka,Droid Sans Mono,',' Anonymous Pro,Proggy fonts,Envy Code R,Gamow,Courier,\"Courier New\",
{"created":"20230426064319911","text":"\n\u003C!-- shader-doodle.js -->\n\u003Cscript>\n'use strict';(function(z,A){\"object\"===typeof exports& & \"undefined\"!==typeof module?A(exports):\"function\"===typeof define& & define.amd?define([\"exports\"],A):(z=z||self,A(z.ShaderDoodle={}))})(this,function(z){function A(a){function b(a){console.log(a);e.add(a.targetElement)}function d(b){e.has(b.targetElement)?e.delete(b.targetElement):(b=a.createBufferSource(),b.buffer=a.createBuffer(1,1,a.sampleRate),b.connect(a.destination),b.start(0),\"function\"===typeof a.resume& & a.resume().then(c),f())}function c(){v.forEach(a=>\n{a()})}function f(){p.forEach(a=>{a.removeEventListener(\"touchstart\",d);a.removeEventListener(\"touchmove\",b);a.removeEventListener(\"touchend\",d);a.removeEventListener(\"mouseup\",d)});p.clear();e.clear()}let e=new Set,p=new Set,v=[];return{onStart:function(b){\"running\"===a.state?(console.log(\"already\"),b()):v.push(b)},register:function(a){a.addEventListener(\"touchstart\",d);a.addEventListener(\"touchmove\",b);a.addEventListener(\"touchend\",d);a.addEventListener(\"mouseup\",d);p.add(a)},dispose:f}}function ca(){function a(a){d[0].value[0]=\na.alpha;d[0].value[1]=a.beta;d[0].value[2]=a.gamma}let b=!1,d=JSON.parse(JSON.stringify(L));return{get ustate(){return d},setup:function(){b||(b=!0,\"object\"===typeof DeviceOrientationEvent& & \"function\"===typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(b=>{\"granted\"===b& & window.addEventListener(\"deviceorientation\",a)}).catch(console.error):window.addEventListener(\"deviceorientation\",a))},dispose:function(){window.removeEventListener(\"deviceorientation\",\na)}}}function da(a){let b={},d=a.getExtension.bind(a);return{get:function(a){if(void 0!==b[a])return b[a];let c=d(a)||d(\"MOZ_\".concat(a))||d(\"WEBKIT_\".concat(a));null===c& & console.warn(\"\u003Cshader-doodle /> \".concat(a,\" extension not supported.\"));return b[a]=c}}}function C(){function a(a,b){if(a>n||b>h)a=Math.max(a,n),b=Math.max(b,h),a!==n& & (n=a,c.width=Math.floor(1*n)),b!==h& & (h=b,c.height=Math.floor(1*h))}function b(a){let b=l?(a-l)/1E3:0;l=a;k[0].value+=b;k[1].value=b;k[3].value++;a=new Date;k[2].value[0]=\na.getFullYear();k[2].value[1]=a.getMonth()+1;k[2].value[2]=a.getDate();k[2].value[3]=3600*a.getHours()+60*a.getMinutes()+a.getSeconds()+.001*a.getMilliseconds()}function d(f){if(m.size){b(f);var u=[...k,...e.ustate];m.forEach(b=>b.render(c,a,n,h,1,u));q=requestAnimationFrame(d)}else q=void 0}let c=document.createElementNS(\"http://www.w3.org/1999/xhtml\",\"canvas\"),f=c.getContext(\"webgl\")||c.getContext(\"experimental-webgl\"),e=ca(),p=new (window.AudioContext||window.webkitAudioContext),v=new A(p);p.onStart=\nv.onStart;f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.enable(f.BLEND);let n=0,h=0,q,l,m=new Set,k=JSON.parse(JSON.stringify(M)),w=da(f);w.get(\"OES_texture_float\");w.get(\"OES_texture_float_linear\");w.get(\"OES_texture_half_float\");w.get(\"OES_texture_half_float_linear\");f.clearColor(0,0,0,0);return Object.freeze({get gl(){return f},get wa(){return p},addSurface:function(a){v.register(a.dom);a.addClick(e.setup);m.add(a);q||(q=requestAnimationFrame(d))},removeSurface:function(a){m.delete(a)},addUniform:function(a,\nb,c){for(let d=0;d\u003Ck.length;d++)if(k[d].name===a){k[d].value=b;k[d].type=c;return}k.push({name:a,value:b,type:c,toyname:a})},setUniform:function(a,b){for(let c=0;c\u003Ck.length;c++)if(k[c].name===a){k[c].value=b;break}},dispose:function(){m.forEach(a=>a.dispose());m.clear();m=void 0;cancelAnimationFrame(q);e.dispose();v.dispose()}})}function ea(a,b){let d={},c=a.getProgramParameter(b,a.ACTIVE_ATTRIBUTES);for(let f=0;f\u003Cc;f++){let {name:c}=a.getActiveAttrib(b,f);d[c]=a.getAttribLocation(b,c)}return d}function N(a){function b(b){a.texParameteri(a.TEXTURE_2D,\na.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,b?a.NEAREST:a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,b?a.NEAREST:a.LINEAR)}let d,c,f=a
2023-04-28 17:16:13 +02:00
{"created":"20230428121310382","text":"\u003Cbr>\n\u003Cbr>\n\u003Cdiv class=\"section\">\n \u003Ca href=\"#XR Fragments\" class=\"tc-btn-invisible label\" style=\"font-weight:bold;padding:0; text-decoration:none\">Home\u003C/a>\n\u003C/div>\n\u003Cbr>\n\u003Cdiv class=\"section\">\n \u003Ca href=\"#How it works\" class=\"tc-btn-invisible label\" style=\"font-weight:bold;padding:0; text-decoration:none\">How it works\u003C/a>\n\u003C/div>\n\u003Cbr>","tags":"","title":"$:/xrfragment/topmenu","modified":"20230428150153103"},
2023-05-04 13:28:22 +02:00
{"created":"20230427155228509","text":"\n\u003Cscript>\n\nvar $hx_exports = typeof exports != \"undefined\" ? exports : typeof window != \"undefined\" ? window : typeof self != \"undefined\" ? self : this;\n(function ($global) { \"use strict\";\n$hx_exports[\"xrfragment\"] = $hx_exports[\"xrfragment\"] || {};\nvar EReg = function(r,opt) {\n\tthis.r = new RegExp(r,opt.split(\"u\").join(\"\"));\n};\nEReg.__name__ = true;\nEReg.prototype = {\n\tmatch: function(s) {\n\t\tif(this.r.global) {\n\t\t\tthis.r.lastIndex = 0;\n\t\t}\n\t\tthis.r.m = this.r.exec(s);\n\t\tthis.r.s = s;\n\t\treturn this.r.m != null;\n\t}\n\t,split: function(s) {\n\t\tvar d = \"#__delim__#\";\n\t\treturn s.replace(this.r,d).split(d);\n\t}\n};\nvar HxOverrides = function() { };\nHxOverrides.__name__ = true;\nHxOverrides.cca = function(s,index) {\n\tvar x = s.charCodeAt(index);\n\tif(x != x) {\n\t\treturn undefined;\n\t}\n\treturn x;\n};\nHxOverrides.substr = function(s,pos,len) {\n\tif(len == null) {\n\t\tlen = s.length;\n\t} else if(len \u003C 0) {\n\t\tif(pos == 0) {\n\t\t\tlen = s.length + len;\n\t\t} else {\n\t\t\treturn \"\";\n\t\t}\n\t}\n\treturn s.substr(pos,len);\n};\nHxOverrides.now = function() {\n\treturn Date.now();\n};\nMath.__name__ = true;\nvar Reflect = function() { };\nReflect.__name__ = true;\nReflect.field = function(o,field) {\n\ttry {\n\t\treturn o[field];\n\t} catch( _g ) {\n\t\treturn null;\n\t}\n};\nReflect.fields = function(o) {\n\tvar a = [];\n\tif(o != null) {\n\t\tvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\t\tfor( var f in o ) {\n\t\tif(f != \"__id__\" & & f != \"hx__closures__\" & & hasOwnProperty.call(o,f)) {\n\t\t\ta.push(f);\n\t\t}\n\t\t}\n\t}\n\treturn a;\n};\nReflect.deleteField = function(o,field) {\n\tif(!Object.prototype.hasOwnProperty.call(o,field)) {\n\t\treturn false;\n\t}\n\tdelete(o[field]);\n\treturn true;\n};\nvar Std = function() { };\nStd.__name__ = true;\nStd.string = function(s) {\n\treturn js_Boot.__string_rec(s,\"\");\n};\nStd.parseInt = function(x) {\n\tif(x != null) {\n\t\tvar _g = 0;\n\t\tvar _g1 = x.length;\n\t\twhile(_g \u003C _g1) {\n\t\t\tvar i = _g++;\n\t\t\tvar c = x.charCodeAt(i);\n\t\t\tif(c \u003C= 8 || c >= 14 & & c != 32 & & c != 45) {\n\t\t\t\tvar nc = x.charCodeAt(i + 1);\n\t\t\t\tvar v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10);\n\t\t\t\tif(isNaN(v)) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n};\nvar StringTools = function() { };\nStringTools.__name__ = true;\nStringTools.isSpace = function(s,pos) {\n\tvar c = HxOverrides.cca(s,pos);\n\tif(!(c > 8 & & c \u003C 14)) {\n\t\treturn c == 32;\n\t} else {\n\t\treturn true;\n\t}\n};\nStringTools.ltrim = function(s) {\n\tvar l = s.length;\n\tvar r = 0;\n\twhile(r \u003C l & & StringTools.isSpace(s,r)) ++r;\n\tif(r > 0) {\n\t\treturn HxOverrides.substr(s,r,l - r);\n\t} else {\n\t\treturn s;\n\t}\n};\nStringTools.rtrim = function(s) {\n\tvar l = s.length;\n\tvar r = 0;\n\twhile(r \u003C l & & StringTools.isSpace(s,l - r - 1)) ++r;\n\tif(r > 0) {\n\t\treturn HxOverrides.substr(s,0,l - r);\n\t} else {\n\t\treturn s;\n\t}\n};\nStringTools.trim = function(s) {\n\treturn StringTools.ltrim(StringTools.rtrim(s));\n};\nStringTools.replace = function(s,sub,by) {\n\treturn s.split(sub).join(by);\n};\nvar haxe_iterators_ArrayIterator = function(array) {\n\tthis.current = 0;\n\tthis.array = array;\n};\nhaxe_iterators_ArrayIterator.__name__ = true;\nhaxe_iterators_ArrayIterator.prototype = {\n\thasNext: function() {\n\t\treturn this.current \u003C this.array.length;\n\t}\n\t,next: function() {\n\t\treturn this.array[this.current++];\n\t}\n};\nvar js_Boot = function() { };\njs_Boot.__name__ = true;\njs_Boot.__string_rec = function(o,s) {\n\tif(o == null) {\n\t\treturn \"null\";\n\t}\n\tif(s.length >= 5) {\n\t\treturn \"\u003C...>\";\n\t}\n\tvar t = typeof(o);\n\tif(t == \"function\" & & (o.__name__ || o.__ename__)) {\n\t\tt = \"object\";\n\t}\n\tswitch(t) {\n\tcase \"function\":\n\t\treturn \"\u003Cfunction>\";\n\tcase \"object\":\n\t\tif(((o) instanceof Array)) {\n\t\t\tvar str = \"
2023-04-27 17:35:20 +02:00
{"created":"20230424093140723","text":"\u003C\u003Cscript>> \u003C!-- enables script-tag -->\n\n\u003Cdiv class=\"scene\">\n\t\u003Ca-scene embedded>\n\t\t\u003Ca-box position=\"-1 0.5 -3\" rotation=\"0 45 0\" color=\"#4CC3D9\">\u003C/a-box>\n\t\t\u003Ca-sphere position=\"0 1.25 -5\" radius=\"1.25\" color=\"#EF2D5E\">\u003C/a-sphere>\n\t\t\u003Ca-cylinder position=\"1 0.75 -3\" radius=\"0.5\" height=\"1.5\" color=\"#FFC65D\">\u003C/a-cylinder>\n\t\t\u003Ca-plane position=\"0 0 -4\" rotation=\"-90 0 0\" width=\"4\" height=\"4\" color=\"#7BC8A4\">\u003C/a-plane>\n\t\t\u003Ca-sky color=\"#444\">\u003C/a-sky>\n\t\u003C/a-scene>\n\u003C/div>\n\n\u003Cscript>\n(function(){\n\t\n\tlog(\"hello world\")\n let $scene = $('a-scene')\n\t\n $scene.addEventListener('loaded', () => {\n\t\t$scene.renderer.render = ( (render) => ( scene, cam ) => {\n \t\trender(scene,cam)\t\n\t\t\tif( !$scene.renderer ) return log(\"no renderer\")\n\t\t\tlet info = $scene.renderer.info.render\n\t\t\tlog(\"frame : \" + info.frame,2)\n\t\t\tlog(\"triangle: \" + info.triangles,4)\n\t\t\tlog(\"calls : \" + info.calls,3)\t\t\n\t\t})($scene.renderer.render.bind($scene.renderer) )\n })\t\n\t\n})()\n\u003C/script>","tags":"AFRAME VR THREE WebXR","title":"AFRAME template","modified":"20230427103455960","type":"text/vnd.tiddlywiki"},
2023-04-28 17:16:13 +02:00
{"modified":"20230428145910492","title":"Draft 2 of '$:/webxr-notebook/boot.css'"},
2023-05-04 13:28:22 +02:00
{"modified":"20230504093652627","title":"Draft of '↪ URI.parse(url,flags)'"},
2023-04-28 14:21:22 +02:00
{"modified":"20230428112728789","title":"Draft of '$:/webxr-notebook/boot.css'"},
2023-04-27 17:35:20 +02:00
{"created":"20230427151153103","text":"\u003C\u003Ctoc-selective-expandable 'Examples' sort[title]>>","tags":"$:/tags/SideBar","title":"Examples","modified":"20230427152839062","list-after":"Reference"},
2023-04-27 18:34:23 +02:00
{"created":"20230427124155325","text":"\u003Ciframe src=\"./example/explorer.html#t=1,100\" frameborder=\"0\" style=\"width:100%; height:90vh\"/>","tags":"Examples","title":"Fragment Explorer","modified":"20230427155205004"},
2023-04-27 17:35:20 +02:00
{"created":"20230425160210102","text":"\u003Cshader-doodle>\n \u003Csd-node name=\"motionblur\" prevbuffer>\n \u003Csd-node name=\"rotate\">\n \u003Csd-node name=\"basic_gl\">\n \u003Cscript type=\"x-shader/x-fragment\">\n void main() {\n vec2 st = gl_FragCoord.xy / u_resolution.xy;\n vec3 color = vec3(st.x, st.y, abs(sin(u_time)));\n\n gl_FragColor = vec4(color, 1.);\n }\n \u003C/script>\n \u003C/sd-node>\n \u003Cscript type=\"x-shader/x-fragment\">\n uniform sampler2D basic_gl;\n\n const float PI = 3.1415926;\n\n void main() {\n vec2 st = gl_FragCoord.xy / u_resolution.xy;\n\n float angle = 2. * PI * (.5 + .5 * cos(u_time));\n float scale = .7 + .4 * cos(u_time);\n\n mat2 rotation = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 p = (st - vec2(.5)) * rotation / scale + vec2(.5);\n\n gl_FragColor = p.x \u003C 0. || p.x > 1. || p.y \u003C 0. || p.y > 1.\n ? vec4(0., 0., 0., 1.)\n : texture2D(basic_gl, p);\n }\n \u003C/script>\n \u003C/sd-node>\n \u003Cscript type=\"x-shader/x-fragment\">\n uniform sampler2D rotate, u_prevbuffer;\n\n void main () {\n vec2 st = gl_FragCoord.xy / u_resolution.xy;\n gl_FragColor = vec4(mix(\n texture2D(rotate, st),\n texture2D(u_prevbuffer, st),\n .8\n ).rgb, 1.);\n }\n \u003C/script>\n \u003C/sd-node>\n \u003Cscript type=\"x-shader/x-fragment\">\n uniform sampler2D motionblur;\n\n void main() {\n vec2 st = gl_FragCoord.xy / u_resolution.xy;\n gl_FragColor = texture2D(motionblur, st);\n }\n \u003C/script>\n\u003C/shader-doodle>","tags":"GLSL","title":"GLSL template","modified":"20230425170513931","type":"text/vnd.tiddlywiki"},
2023-05-04 19:45:06 +02:00
{"created":"20230428150217784","text":"[img[xrfragment.jpg]]\n\n(URL) XR Fragments map directly to ''custom properties'' 🔒 inside 3D assets.\u003Cbr>\nTo enable interactive ''NOCODE experiences'', dynamic ''values'' are possible too, for example:\u003CBR>\n\n* 🔒 `href` ''values'' can modify other [[🔓 values|List of fragments]] (`#pos=1,2,3` e.g.)\n* 🔒 `src` ''values'' can modify [[🔗 embedded values|List of fragments]] (`other.gltf#scale=1,2,3` e.g.)\n\nBut also roundrobin-values 🎲 and 💥[[Predefined views|predefined_view]] can create fun interactions.\n\u003Cbr>\n\nCheck the [[List of fragments]] for a complete overview.","title":"How it works","modified":"20230504104542034","type":"text/vnd.tiddlywiki"},
2023-05-04 13:28:22 +02:00
{"created":"20230427172131986","text":"| fragment | type | access | scope |\n|----------|------|--------------|-------|\n| **prio** |int|🔒|asset loading linking|\n| **#** |[predefined view](#predefined_view ) |🔒|asset loading linking|\n| **class** |string|🔒|asset loading linking|\n| **src** |[url](#url ) |🔒|asset loading linking|\n| **pos** |[vector3](#vector ) |🔓 🎲 💥 🔗|href navigation / portals / teleporting|\n| **href** |[predefined view](#predefined_view ) |🔒|href navigation / portals / teleporting|\n| **q** |string|🔓 💥 🔗|query selector / object manipulation|\n| **scale** |[vector3](#vector ) |🔓 🎲 💥 🔗|query selector / object manipulation|\n| **rot** |[vector3](#vector ) |🔓 🎲 💥 🔗|query selector / object manipulation|\n| **translate** |[vector3](#vector ) |🔓 🎲 💥 🔗|query selector / object manipulation|\n| **visible** |int|🔓 🎲 💥 🔗|query selector / object manipulation|\n| **env** |string|🔓 💥 🔗|query selector / object manipulation|\n| **t** |[vector2](#vector ) |🔓 🎲 💥 👩 🔗|animation|\n| **gravity** |[vector3](#vector ) |🔓 💥 🔗|animation|\n| **physics** |[vector3](#vector ) |🔓 💥 🔗|animation|\n| **fov** |int|🔓 💥 👩 🔗|device / viewport settings|\n| **clip** |[vector2](#vector ) |🔓 💥 👩 🔗|device / viewport settings|\n| **fog** |string|🔓 💥 👩 🔗|device / viewport settings|\n| **namespace** |string|🔒|author / metadata|\n| **SPDX** |string|🔒|author / metadata|\n| **unit** |string|🔒|author / metadata|\n| **description** |string|🔒|author / metadata|\n| **session** |[url](#url ) |🔓 💥 👩 🔗 ✋?|multiparty|\n\n🔒 = value(s) can only defined in 3D asset (immutable)\u003Cbr>\n🔓 = value(s) can be overwritten in certain context\u003Cbr>\n🎲 = multiple values will be roundrobin'ed (`#pos=0,0,0|1,0,0` e.g.)\u003Cbr>\n💥 = value(s) can be overwritten by [predefined_view](#predefined_view)\u003Cbr>\n👩 = value(s) can be overwritten when user clicks `href` (value) or top-level URL change(see [How it works](#How%20it%20works))\u003Cbr>\n🔗 = value(s) can be overwritten when 3D asset is embedded/linked as `src` value\u003Cbr>\n✋? = value(s) can be overwritten by offering confirmation/undo to user\u003Cbr>\u003Cbr>\n\nfor more info see [How it works](#How%20it%20works)\n","tags":"Reference","title":"List of fragments","modified":"20230504095201462","type":"text/markdown"},
2023-04-28 13:19:45 +02:00
{"created":"20230427205533684","text":"Just like with SVG fragments, predefined views are settings embedded in the asset, which can be triggered:\n\n* by default (the `#` custom property in the asset)\n* on-demand (by clicking a `href`-property with value `#my_view` e.g.)\n\nhere's an interactive examples:\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = xrfragment.URI.parse('#my_view& t=1,2')\nconsole.log( frags )\n\n\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n","tags":"","title":"predefined_view","modified":"20230428110050202","type":"text/markdown"},
2023-04-27 17:35:20 +02:00
{"created":"20230427150512404","text":"\u003C\u003Ctoc-selective-expandable 'Reference' sort[title]>>","tags":"$:/tags/SideBar","title":"Reference","modified":"20230427151056587","list-before":"$:/core/ui/SideBar/Open"},
{"created":"20230426160615931","text":"\u003Cdiv class=\"scene\">\u003C/div>\n\n\u003C\u003Cscript>>\n\u003Cscript>\n $scene = document.querySelector(\".scene\")\n\tscene = new THREE.Scene();\n camera = new THREE.PerspectiveCamera( 75, $scene.offsetWidth / $scene.offsetHeight, 0.1, 1000 );\n\n\trenderer = new THREE.WebGLRenderer();\n renderer.setSize( $scene.offsetWidth, $scene.offsetHeight );\n $scene.appendChild( renderer.domElement );\n\t\n\tvar geometry = new THREE.BoxGeometry( 1, 1, 1 );\n\tvar material = new THREE.MeshBasicMaterial( { color: 0x0a84ff } );\n\tvar cube = new THREE.Mesh( geometry, material );\n\tscene.add( cube );\n\tscene.background = new THREE.Color( 0x18181c );\n\n\tcamera.position.z = 2;\n\n\tfunction animate() {\n\t\trequestAnimationFrame( animate );\n\n\t\tcube.rotation.x += 0.004;\n\t\tcube.rotation.y += 0.004;\n\n\t\trenderer.render( scene, camera );\n\t}\n\n\tanimate();\t\n\tlog(\"hello world\")\n\u003C/script>","title":"THREE template","modified":"20230427103421550","tags":"THREE WebXR"},
{"created":"20230425154949623","text":"\u003Cscript async src=\"https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js\">\u003C/script>\n\n\u003Cscript type=\"importmap\">\n{\n\t\"imports\": {\n\t\t\"three\": \"https://unpkg.com/three@0.151.3/build/three.module.js\",\n\t\t\t\"three/addons/\": \"https://unpkg.com/three@0.151.3/examples/jsm/\"\n\t}\n}\n\u003C/script>\n\n\u003Cscript type=\"module\">\nimport * as THREE from 'three';\n\nimport { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js';\nimport { VRButton } from 'three/addons/webxr/VRButton.js';\nimport { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';\n\nlet camera, scene, raycaster, renderer;\nlet controller1, controller2;\nlet controllerGrip1, controllerGrip2;\n\nlet room, marker, floor, baseReferenceSpace;\n\nlet INTERSECTION;\nconst tempMatrix = new THREE.Matrix4();\n\ninit();\nanimate();\n\nfunction init() {\n\n\tscene = new THREE.Scene();\n\tscene.background = new THREE.Color( 0x505050 );\n\n\tcamera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 );\n\tcamera.position.set( 0, 1, 3 );\n\n\troom = new THREE.LineSegments(\n\t\t\tnew BoxLineGeometry( 6, 6, 6, 10, 10, 10 ).translate( 0, 3, 0 ),\n\t\t\tnew THREE.LineBasicMaterial( { color: 0x808080 } )\n\t\t\t);\n\tscene.add( room );\n\n\tscene.add( new THREE.HemisphereLight( 0x606060, 0x404040 ) );\n\n\tconst light = new THREE.DirectionalLight( 0xffffff );\n\tlight.position.set( 1, 1, 1 ).normalize();\n\tscene.add( light );\n\n\tmarker = new THREE.Mesh(\n\t\t\tnew THREE.CircleGeometry( 0.25, 32 ).rotateX( - Math.PI / 2 ),\n\t\t\tnew THREE.MeshBasicMaterial( { color: 0x808080 } )\n\t\t\t);\n\tscene.add( marker );\n\n\tfloor = new THREE.Mesh(\n\t\t\tnew THREE.PlaneGeometry( 4.8, 4.8, 2, 2 ).rotateX( - Math.PI / 2 ),\n\t\t\tnew THREE.MeshBasicMaterial( { color: 0x808080, transparent: true, opacity: 0.25 } )\n\t\t\t);\n\tscene.add( floor );\n\n\traycaster = new THREE.Raycaster();\n\n\trenderer = new THREE.WebGLRenderer( { antialias: true } );\n\trenderer.setPixelRatio( window.devicePixelRatio );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\trenderer.outputEncoding = THREE.sRGBEncoding;\n\n\trenderer.xr.addEventListener( 'sessionstart', () => baseReferenceSpace = renderer.xr.getReferenceSpace() );\n\trenderer.xr.enabled = true;\n\n\tdocument.body.appendChild( renderer.domElement );\n\tdocument.body.appendChild( VRButton.createButton( renderer ) );\n\n\t// controllers\n\n\tfunction onSelectStart() {\n\n\t\tthis.userData.isSelecting = true;\n\n\t}\n\n\tfunction onSelectEnd() {\n\n\t\tthis.userData.isSelecting = false;\n\n\t\tif ( INTERSECTION ) {\n\n\t\t\tconst offsetPosition = { x: - INTERSECTION.x, y: - INTERSECTION.y, z: - INTERSECTION.z, w: 1 };\n\t\t\tconst offsetRotation = new THREE.Quaternion();\n\t\t\tconst transform = new XRRigidTransform( offsetPosition, offsetRotation );\n\t\t\tconst teleportSpaceOffset = baseReferenceSpace.getOffsetReferenceSpace( transform );\n\n\t\t\trenderer.xr.setReferenceSpace( teleportSpaceOffset );\n\n\t\t}\n\n\t}\n\n\tcontroller1 = renderer.xr.getController( 0 );\n\tcontroller1.addEventListener( 'selectstart', onSelectStart );\n\tcontroller1.addEventListener( 'selectend', onSelectEnd );\n\tcontroller1.addEventListener( 'connected', function ( event ) {\n\n\t\t\tthis.add( buildController( event.data ) );\n\n\t\t\t} );\n\tcontroller1.addEventListener( 'disconnected', function () {\n\n\t\t\tthis.remove( this.children[ 0 ] );\n\n\t\t\t} );\n\tscene.add( controller1 );\n\n\tcontroller2 = renderer.xr.getController( 1 );\n\tcontroller2.addEventListener( 'selectstart', onSelectStart );\n\tcontroller2.addEventListener( 'selectend', onSelectEnd );\n\tcontroller2.addEventListener( 'connected', function ( event ) {\n\n\t\t\tthis.add( buildController( event.data ) );\n\n\t\t\t} );\n\tcontroller2.addEventListener( 'disconnected', function () {\n\n\t\t\tthis.remove( this.children[ 0 ] );\n\n\t\t\t} );\n\tscene.add( controller2 );\n\n\t// The XRControllerModelFactory will automatically
2023-04-28 13:19:45 +02:00
{"created":"20230427204906096","text":"comma-separated coordinates e.g. which after parsing can be accessed using `.x`, `.y`, `.z` etc.\n\n| type | example |\n|-|-|\n| vector2 | `1.2,3` or `0.4,0.6` | \n| vector3 | `1.2,3,4` or `0.4,0.6,5` | \n\nhere are some interactive examples:\n\n\u003Cdiv>\n \u003Ctextarea spellcheck=\"false\" autofocus class=\"sandboxify\">frags = {}\nok = xrfragment.Parser.parse('pos','1.2,2,3',frags)\nconsole.log( frags.pos.z )\n\n\u003C/textarea>\n\t\u003Cpre class=\"result\">\u003C/pre>\n\u003C/div>\n","tags":"","title":"vector","modified":"20230427205327718","type":"text/markdown"},
2023-04-27 17:35:20 +02:00
{"created":"20230427103350051","text":"","tags":"","title":"WebXR","modified":"20230427103400217"},
2023-05-04 19:54:44 +02:00
{"created":"20230424092557827","text":"A protocol to discover, link, navigate & query 3D assets.\u003Cbr>\nStart surfing 3D assets today 💙\n\u003Cbr>\u003Cbr>\n[img[xrfragment.jpg]]\n\n\n\u003Cbr>\nCheck [[How it works|How it works]] or see it in [[THREE.js|https://threejs.org]] action here:\u003Cbr>\u003Cbr>\n\u003Ciframe class=\"border\" src=\"./example/threejs/sandbox\" frameborder=\"0\" style=\"width:100%; height:400px\"/>","tags":"","title":"XR Fragments","modified":"20230504174804009"},
2023-05-04 13:28:22 +02:00
{"title":"xrfragment.jpg","text":"/9j/4AAQSkZJRgABAQEBLAEsAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/4gKwSUNDX1BST0ZJTEUAAQEAAAKgbGNtcwQwAABtbnRyUkdCIFhZWiAH5wAFAAQACgArACFhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1kZXNjAAABIAAAAEBjcHJ0AAABYAAAADZ3dHB0AAABmAAAABRjaGFkAAABrAAAACxyWFlaAAAB2AAAABRiWFlaAAAB7AAAABRnWFlaAAACAAAAABRyVFJDAAACFAAAACBnVFJDAAACFAAAACBiVFJDAAACFAAAACBjaHJtAAACNAAAACRkbW5kAAACWAAAACRkbWRkAAACfAAAACRtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACQAAAAcAEcASQBNAFAAIABiAHUAaQBsAHQALQBpAG4AIABzAFIARwBCbWx1YwAAAAAAAAABAAAADGVuVVMAAAAaAAAAHABQAHUAYgBsAGkAYwAgAEQAbwBtAGEAaQBuAABYWVogAAAAAAAA9tYAAQAAAADTLXNmMzIAAAAAAAEMQgAABd7///MlAAAHkwAA/ZD///uh///9ogAAA9wAAMBuWFlaIAAAAAAAAG+gAAA49QAAA5BYWVogAAAAAAAAJJ8AAA+EAAC2xFhZWiAAAAAAAABilwAAt4cAABjZcGFyYQAAAAAAAwAAAAJmZgAA8qcAAA1ZAAAT0AAACltjaHJtAAAAAAADAAAAAKPXAABUfAAATM0AAJmaAAAmZwAAD1xtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAEcASQBNAFBtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEL/2wBDAAMCAgMCAgMDAgMDAwMDBAcFBAQEBAkGBwUHCgkLCwoJCgoMDREODAwQDAoKDhQPEBESExMTCw4UFhQSFhESExL/2wBDAQMDAwQEBAgFBQgSDAoMEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhL/wgARCAGkA1wDAREAAhEBAxEB/8QAHAABAAEFAQEAAAAAAAAAAAAAAAECAwQFBgcI/8QAGwEBAQADAQEBAAAAAAAAAAAAAAECAwQFBgf/2gAMAwEAAhADEAAAAfqkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA81yx5PKAAAUlQKSoAAAAAAAAAHpWGXWSgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeE7MPOMoAAAAB1JsDCLBaN6aQk0ZYAAAAAPdteXo+OQAAAAAAAAAGEl5b4KCsAFougsF8sl4AAAAAAAAAAAAAAAAAAA8J2YecZQAAAADpDOKy2YhsS0Ypy4AAAAAPdteXo+OQAAAAAAAAEFo4642TrZb68jZ1UXlF41ScXlNpHOVSWj1TGwSa+rRz9nc45c5ZzVm2jupkAAAAAAAAAAAAAB8954+X5QAAAAAAAAAAAAAAD6Fwy9PxoAAAAAAAAFo4a47xcc4TLG0bWXWWZsuWQYp2MuvTArVJmL57lj3GOUFRklR2kvNWYpu5ewlAAAAAAAAAAAAAA+RjxYgxQZhhlwtgGQQWgUgrJBbALhkAAFJig+vD3EEAAAAAAAAAAAA5+zZxmrobMI6uUADmLOnlAA0yDcqAAAAAAAAAAAAAAB8uHmhtzy0tnqhgGxLJ5sWT0otlZWYp56bg6gyjTnGgyjpi8bIuFo5A05vz6zPWwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfIR4cAAAAAAAACoFIMk2ptCspKDSGqLp9entoIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPk08UNuXTRkFIBJaOgOfAAAAALpAAAAPrY9rBAAAAAAAAAAAAAABBFgLFVSSIKAAAAAAAAAAAAAAAAAPlA8ZPejijkzQlsArLpvzmDBAAAABnAAAAH1ue0AgAAAAAAAAAAAAhIq2tNgElSyVzEsiCgAAAAAAAAAAAAAAAAfJ54udQaAwwUAFRkmtAAAAABkEAAAA+tj2kEAAAAAAAAAAAFuy1ZTSyVqJKpZlAqRJKyIKAAAAAAAAAAAAAAAAPkw84MUySTFKzPMEvFJqzBAAAAAAAAAB9aHtYIAAAAAAAAAALdljKW8pJUklUyqJEQEElUStUTKUAAAAAAAAAAAAAAAAfJh5SXy0ZJhmSVFogyDUGKAAAAAAAAAD60PawQAAAAAAAAAWrLGS3ljKKRICoArJSQVLMVS1S1SgAAAAAAAAAAAAAAAD5aM0sHh5JSYxWCggAAAAAAAAAAH2MeqggAAAAAAAAprGyxt5SmyqSZYqkCggVlRXFRVKEVLVLMoAAEpCgAAAAAAAAAAAD5gOvMc8ALptio15lmKccAAAAAAAAAAD7XPRAQAAAAAAACizCzU3GpKlqihKagJFkglaipaiuKpZgVxMsylAAEpBTlEVSlJFTBQAAAAAAAB8nnmBBr9eefp3aro0WcsQAK2GReelljTpAAAAAAAAH1ke1ggAAAAAAAx8pi7MIuWn2dtTO3llaS3VJmTXutHBDGQSSFqBUSTFSzLXLXimZAASkWU1BIAIJlqgoAAAAAAA+TDz40Zn8vT3flep5l7fi5ezDbA5ctlxr2eXm0stVj6gAAAAAAAA+tD2sEAAAAAAAxNmONlhWlV3+Ier9xp9/oYmzO3copWy18H0B4fwc4c0wBUSAKkRWtSzLVLVLXimIWUlIoQQKhBTUW1RcwpQAAAAAAPlDPHxfKQDoOPr5/s5M8zy0acgG0y8vV4+oAAAAAAAAB9YYZe040QAAAAACDC2Y2c8a4uxTlu+f/e+503R6EZZRYzxnObTR5/0B818RVhpSAlQJAJKlmJWomUVRVALJMCABVKKptgF7CzKAAAAAAPmr2eHyzt57OU7LxPU3fk+lyf0Pic/3couas1Wd2sZGNycbg56s/X5lK6/b6oAAAAAAH0t43d61wdIgAAAAAgw88bGeNRVjaksbt3zz9P91g9HXGUjPCctdWzDa8fN7/8AIfF3deAgkVAJBUlUtUSskkwJEsqYyqFQCYppZC01FxmZXsLMoAAAAAHzV7PD5/0atfsw3nNu6f5n6Dj/AKr5zN+c9aZbG/XZ3a9D7/mC9jdvpz1G7DLw8jDz9C1luAAAAAAA+lvG7vWuDpEAAAAAGJnMbPBFRMQWd+352+y+zwerez1zcLkxvzDe8Oj3j4r5e7jrLQUkVAJJSsmJWVqJkqiSZSkAKSioKlmKcsRFW7IKpb+GUygAAAAD5W6NXjW3Abfn373m6eY7OPC2YLAABKbDLgtzPCnaAAAAAAAPqnn2+zasxAAAAALOWOHsxpYlkggtbd3zh919Rh9e24mVhjscMcnDHZ8Wj274nwK5hFWykWSSklQJgsrJMVRXFQOJ4PqOX5vcystHpnp/EeT+V9/3PofKarV3aPR63pvp/EeWeT952/f8t0fT41NlGWMFcyva8pAAAAAPkw8/NEZHPv73yvV8z9rxeizxulRBQak1JKbbLybbZrMfTAAAAAAAH1oe1ggAAAAoswtuFDGAAUlvbt+bfv8A6HH6t2Tjrztcz9MuRl82n2/4bw7slNUFKSXCYkEAkllUSXMbVHA8H1l669nt4sA2t073f5fH6PY6bb52tbcXHo6Lf5fH8vtb3Pl87877Hsez5vpu356ioLmOV/ClAAAAHyaeKAG259+p6NG2KCkxy8YhbBm3ixJ10sgAAAAAAB9ZntYIAAABCYOzG3ljCFEIIKNuz5n/AET2LHXnfmFTHM14ZenHN5dPvfwHHXjKKpJJW5JKwhSCpS1lUVSyeceZ9p6T6XxeHZdL8ayzYzK1Z
2023-04-27 17:35:20 +02:00
]< / script > < div id = "storeArea" style = "display:none;" > < / 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" > " u s e s t r i c t " ; v a r s j c l = { c i p h e r : { } , h a s h : { } , k e y e x c h a n g e : { } , m o d e : { } , m i s c : { } , c o d e c : { } , e x c e p t i o n : { c o r r u p t : f u n c t i o n ( a ) { t h i s . t o S t r i n g = f u n c t i o n ( ) { r e t u r n " C O R R U P T : " + t h i s . m e s s a g e } ; t h i s . m e s s a g e = a } , i n v a l i d : f u n c t i o n ( a ) { t h i s . t o S t r i n g = f u n c t i o n ( ) { r e t u r n " I N V A L I D : " + t h i s . m e s s a g e } ; t h i s . m e s s a g e = a } , b u g : f u n c t i o n ( a ) { t h i s . t o S t r i n g = f u n c t i o n ( ) { r e t u r n " B U G : " + t h i s . m e s s a g e } ; t h i s . m e s s a g e = a } , n o t R e a d y : f u n c t i o n ( a ) { t h i s . t o S t r i n g = f u n c t i o n ( ) { r e t u r n " N O T R E A D Y : " + t h i s . m e s s a g e } ; t h i s . m e s s a g e = a } } } ;
sjcl.cipher.aes=function(a){this.s[0][0][0]||this.O();var b,c,d,e,f=this.s[0][4],g=this.s[1];b=a.length;var h=1;if(4!==b& & 6!==b& & 8!==b)throw new sjcl.exception.invalid("invalid aes key size");this.b=[d=a.slice(0),e=[]];for(a=b;a< 4 * b + 28 ; a + + ) { c = d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c > >>24]< < 24 ^ f [ c > >16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7)); d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b& 3?a:a-4],e[b]=4>=a||4>b?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 t(this,a,0)},decrypt:function(a){return t(this,a,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var a=this.s[0],b=this.s[1],c=a[4],d=b[4],e,f,g,h=[],k=[],l,n,m,p;for(e=0;0x100>e;e++)k[(h[e]=e< < 1 ^ 283 * ( e > >7))^e]=e;for(f=g=0;!c[f];f^=l||1,g=k[g]||1)for(m=g^g< < 1 ^ g < < 2 ^ g < < 3 ^ g < < 4 , m = m > >8^m&255^99,c[f]=m,d[m]=f,n=h[e=h[l=h[f]]],p=0x1010101*n^0x10001*e^0x101*l^0x1010100*f,n=0x101*h[m]^0x1010100*m,e=0; 4>e;e++)a[e][f]=n=n< < 24 ^ n > >>8,b[e][m]=p=p< < 24 ^ p > >>8;for(e=
0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};
function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,k,l,n=d.length/4-2,m,p=4,r=[0,0,0,0];h=a.s[c];a=h[0];var q=h[1],v=h[2],w=h[3],x=h[4];for(m=0;m< n ; m + + ) h = a[e > >>24]^q[f>>16&255]^v[g>>8&255]^w[b&255]^d[p],k=a[f>>>24]^q[g>>16&255]^v[b>>8&255]^w[e&255]^d[p+1],l=a[g>>>24]^q[b>>16&255]^v[e>>8&255]^w[f&255]^d[p+2],b=a[b>>>24]^q[e>>16&255]^v[f>>8&255]^w[g&255]^d[p+3],p+=4,e=h,f=k,g=l; for(m=
0;4>m;m++)r[c?3&-m:m]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h; return r}
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1); return void 0===c?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 ( 0 = ==a.length||0===b.length)return a . concat ( b ) ; var c = a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32 = ==d?a.concat(b):sjcl.bitArray.$(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b = a.length;return 0 = ==
b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length< b ) return a ; a = a.slice(0,Math.ceil(b/32));var c = a.length;b=b&31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648 > >b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b< < 32-a ) + 0x10000000000 * a } , getPartial:function ( a ) { return Math . round ( a / 0x10000000000 ) | | 32 } , equal:function ( a , b ) { if ( sjcl . bitArray . bitLength ( a ) ! = = sjcl . bitArray . bitLength ( b ) ) return ! 1 ; var c = 0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0 = ==
c},$:function(a,b,c,d){var e;e=0;for(void 0===d&&(d=[]); 32< =b;b-=32)d.push(c),c=0;if(0===b)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,32<b+a?c:d.pop(),1));return d } , i:function ( a , b ) { return [ a [ 0 ] ^ b [ 0 ] , a [ 1 ] ^ b [ 1 ] , a [ 2 ] ^ b [ 2 ] , a [ 3 ] ^ b [ 3 ] ] } , byteswapM:function ( a ) { var b , c ; for ( b = 0;b<a.length;++b)c=a[b],a[b]=c > >>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24; return a}};
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d< c / 8 ; d + + ) 0 = ==(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e > >>8>>>8>>>8),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),3===(c&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=a+"00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl . bitArray . clamp ( c , 4 * d ) } } ;
sjcl.codec.base32={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",X:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f="",g=0,h=sjcl.codec.base32.B,k=0,l=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.X); for(c=0;f.length*d< l ; ) f + = h . charAt ( ( k ^ a [ c ] > >>g)>>>e),g< d ? ( k = a[c]<<d-g,g+=e,c++):(k<<=d,g-=d);for(;f.length&7&&!b;)f+="=";return f } , toBits:function ( a , b ) { a = a.replace(/\s|=/g,"").toUpperCase();var c = sjcl.codec.base32.BITS,
d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f=[],g,h=0,k=sjcl.codec.base32.B,l=0,n,m="base32";b&&(k=sjcl.codec.base32.X,m="base32hex"); for(g=0;g< a.length ; g + + ) { n = k.indexOf(a.charAt(g));if(0 > n){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n< < c-h ) : ( h + = d , l ^ = n < < c-h ) } h & 56 & & f . push ( sjcl . bitArray . partial ( h & 56 , l , 1 ) ) ; return f } } ;
sjcl.codec.base32hex={fromBits:function(a,b){return sjcl.codec.base32.fromBits(a,b,1)},toBits:function(a){return sjcl.codec.base32.toBits(a,1)}};
sjcl.codec.base64={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.B,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+"-_"); for(c=0;6*d.length< h ; ) d + = f . charAt ( ( g ^ a [ c ] > >>e)>>>26),6>e?(g=a[c]< < 6-e , e + = 26 , c + + ) : ( g < < = 6 , e- = 6);for(;d.length&3&&!b;)d+="=";return d } , toBits:function ( a , b ) { a = a.replace(/\s|=/g,"");var c = [],d,e=0,f=sjcl.codec.base64.B,g=0,h;b&&(f=f.substr(0,62)+"-_");for(d=0;d<a.length;d++){h=f.indexOf(a.charAt(d));
if(0>h)throw new sjcl.exception.invalid("this isn't base64!");26< e ? ( e- = 26,c.push(g^h > >>e),g=h< < 32-e ) : ( e + = 6 , g ^ = h < < 32-e ) } e & 56 & & c . push ( sjcl . bitArray . partial ( e & 56 , g , 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.b[0]||this.O();a?(this.F=a.F.slice(0),this.A=a.A.slice(0),this.l=a.l):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.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a)); var b,c=this.A=sjcl.bitArray.concat(this.A,a);b=this.l;a=this.l=b+sjcl.bitArray.bitLength(a);if(0x1fffffffffffff< a ) throw new sjcl . exception . invalid ( " Cannot hash more than 2 ^ 53 - 1 bits " ) ; if ( " undefined " ! = = typeof Uint32Array ) { var d = new Uint32Array ( c ) , e = 0;for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,d.subarray(16*e,
16*(e+1))),e+=1;c.splice(0,16*e)}else for(b=512+b-(512+b&0x1ff); b< =a;b+=512)u(this,c.splice(0,16));return this},finalize:function(){var a,b=this.A,c=this.F,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.l/0x100000000));for(b.push(this.l|0);b.length;)u(this,b.splice(0,16));this.reset();return c},Y:[],b:[],O:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}for(var b=0,c=2,d,e;64>b;c++){e=!0;for(d=2;d*d< =c;d++)if(0===c%d){e=
!1;break}e&&(8>b&&(this.Y[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}};
function u(a,b){var c,d,e,f=a.F,g=a.b,h=f[0],k=f[1],l=f[2],n=f[3],m=f[4],p=f[5],r=f[6],q=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[c&15]+b[c+9&15]|0),d=d+q+(m>>>6^m>>>11^m>>>25^m<<26^m<<21^m<<7)+(r^m&(p^r))+g[c],q=r,r=p,p=m,m=n+d|0,n=l,l=k,k=h,h=d+(k&l^n&(k^l))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0; f[0]=f[0]+h|0;f[1]=f[1]+k|0;f[2]=f[2]+l|0;f[3]=f[3]+n|0;f[4]=f[4]+m|0;f[5]=f[5]+p|0;f[6]=f[6]+r|0;f[7]=
f[7]+q|0}
sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(a){sjcl.mode.ccm.G.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.G.indexOf(a);-1< a & & sjcl . mode . ccm . G . splice ( a , 1 ) } , fa:function ( a ) { var b = sjcl.mode.ccm.G.slice(),c;for(c=0;c<b.length;c+=1)b[c](a)},encrypt:function(a,b,c,d,e){var f , g = b.slice(0),h=sjcl.bitArray,k=h.bitLength(c)/8,l=h.bitLength(g)/8;e=e||64;d=d||[];if(7 > k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;4>f&&l>>>8*f; f++);f< 15-k & & ( f = 15-k);c=h.clamp(c,
8*(15-f));b=sjcl.mode.ccm.V(a,b,c,d,e,f);g=sjcl.mode.ccm.C(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),k=f.clamp(b,h-e),l=f.bitSlice(b,h-e),h=(h-e)/8;if(7>g)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;4>b&&h>>>8*b; b++);b< 15-g & & ( b = 15-g);c=f.clamp(c,8*(15-b));k=sjcl.mode.ccm.C(a,k,c,l,e,b);a=sjcl.mode.ccm.V(a,k.data,c,d,e,b);if(!f.equal(k.tag,a))throw new sjcl . exception . corrupt ( " ccm: tag doesn ' t match " ) ;
return k.data},na:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,k=h.i;d=[h.partial(8,(b.length?64:0)|d-2< < 2 | f-1 ) ] ; d = h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length)for(c=h.bitLength(b)/8,65279 > =c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0; b< g.length ; b + = 4 ) d = a.encrypt(k(d,g.slice(b,b+4).concat([0,0,0])));return d } , V:function ( a , b , c , d , e , f ) { var g = sjcl.bitArray,h=g.i;e/=8;if(e%2||4 > e||16< e ) throw new sjcl . exception . invalid ( " ccm: invalid tag length " ) ;
if(0xffffffff< d.length | | 0xffffffff < b . length ) throw new sjcl . exception . bug ( " ccm: can ' t deal with 4GiB or more data " ) ; c = sjcl.mode.ccm.na(a,d,c,e,g.bitLength(b)/8,f);for(d=0;d<b.length;d+=4)c=a.encrypt(h(c,b.slice(d,d+4).concat([0,0,0])));return g . clamp ( c , 8 * e ) } , C:function ( a , b , c , d , e , f ) { var g , h = sjcl.bitArray;g=h.i;var k = b.length,l=h.bitLength(b),n=k/50,m=n;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(!k)return{tag:d,data:[]};for(g=0;g<k;g+=4)g > n& & (sjcl.mode.ccm.fa(g/
k),n+=m),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,l)}}};
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.S,k=sjcl.bitArray,l=k.i,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4< b.length ; g + = 4 ) m = b.slice(g,g+4),n=l(n,m),p=p.concat(l(c,a.encrypt(l(c,m)))),c=h(c);m=b.slice(g);b=k.bitLength(m);g=a.encrypt(l(c,[0,0,0,b]));m=k.clamp(l(m.concat([0,0,0]),g),b);n=l(n,l(m.concat([0,0,0]),g));n=a.encrypt(l(n,l(c,h(c))));
d.length&&(n=l(n,f?d:sjcl.mode.ocb2.pmac(a,d))); return p.concat(k.concat(m,k.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.S,h=sjcl.bitArray,k=h.i,l=[0,0,0,0],n=g(a.encrypt(c)),m,p,r=sjcl.bitArray.bitLength(b)-e,q=[];d=d||[];for(c=0;c+4< r / 32 ; c + = 4 ) m = k(n,a.decrypt(k(n,b.slice(c,c+4)))),l=k(l,m),q=q.concat(m),n=g(n);p=r-32*c;m=a.encrypt(k(n,[0,0,0,p]));m=k(m,h.clamp(b.slice(c),p).concat([0,
0,0]));l=k(l,m);l=a.encrypt(k(l,k(n,g(n))));d.length&&(l=k(l,f?d:sjcl.mode.ocb2.pmac(a,d))); if(!h.equal(h.clamp(l,e),h.bitSlice(b,r)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return q.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.S,e=sjcl.bitArray,f=e.i,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))));c=b.slice(c);128 > e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0])); g=f(g,c);
return a.encrypt(f(d(f(h,d(h))),g))},S:function(a){return[a[0]< < 1 ^ a [ 1 ] > >>31,a[1]< < 1 ^ a [ 2 ] > >>31,a[2]< < 1 ^ a [ 3 ] > >>31,a[3]< < 1 ^ 135 * ( a [ 0 ] > >>31)]}};
sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e< =h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0,
0,0];f=b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f)); g=0!==(f[3]&1); for(d=3;0< d ; d-- ) f [ d ] = f [ d ] > >>1|(f[d-1]&1)<<31; f[0]>>>=1;g& & (f[0]^=-0x1f000000)}return e},j:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d< e ; d + = 4 ) b [ 0 ] ^ = 0xffffffff & c [ d ] , b [ 1 ] ^ = 0xffffffff & c [ d + 1 ] , b [ 2 ] ^ = 0xffffffff & c [ d + 2 ] , b [ 3 ] ^ = 0xffffffff & c [ d + 3 ] , b = sjcl.mode.gcm.ka(b,a);return b } , C:function ( a , b , c , d , e , f ) { var g , h , k , l , n , m , p , r , q = sjcl.bitArray;m=c.length;p=q.bitLength(c);r=q.bitLength(d);h=q.bitLength(e);
g=b.encrypt([0,0,0,0]);96===h?(e=e.slice(0),e=q.concat(e,[1])):(e=sjcl.mode.gcm.j(g,[0,0,0,0],e),e=sjcl.mode.gcm.j(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff])); h=sjcl.mode.gcm.j(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.j(g,h,c));for(l=0;l< m ; l + = 4 ) n [ 3 ] + + , k = b.encrypt(n),c[l]^=k[0],c[l+1]^=k[1],c[l+2]^=k[2],c[l+3]^=k[3];c=q.clamp(c,p);a&&(d=sjcl.mode.gcm.j(g,h,c));a=[Math.floor(r/0x100000000),r&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.j(g,d,a);k=b.encrypt(e);
d[0]^=k[0];d[1]^=k[1];d[2]^=k[2];d[3]^=k[3];return{tag:q.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.W=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.w=[new b,new b];a.length>e&&(a=b.hash(a)); for(d=0;d< e ; d + + ) c [ 0 ] [ d ] = a [ d ] ^ 909522486 , c [ 1 ] [ d ] = a [ d ] ^ 1549556828 ; this . w [ 0 ] . update ( c [ 0 ] ) ; this . w [ 1 ] . update ( c [ 1 ] ) ; this . R = new b ( this . w [ 0 ] ) } ;
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){if(this.aa)throw new sjcl.exception.invalid("encrypt on already updated hmac called!");this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.R=new this.W(this.w[0]);this.aa=!1};sjcl.misc.hmac.prototype.update=function(a){this.aa=!0;this.R.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.R.finalize(),a=(new this.W(this.w[1])).update(a).finalize();this.reset();return a};
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E4;if(0>d||0>c)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a)); "string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b)); e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,k,l=[],n=sjcl.bitArray;for(k=1;32*l.length< (d||1);k++){e=f=a.encrypt(n.concat(b,[k]));for(g=1;g< c ; g + + ) for ( f = a.encrypt(f),h=0;h<f.length;h++)e[h]^=f[h];l=l.concat(e)}d&&(l=n.clamp(l,d));return l } ;
sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.m=[0];this.P=0;this.H={};this.N=0;this.U={};this.Z=this.f=this.o=this.ha=0;this.b=[0,0,0,0,0,0,0,0];this.h=[0,0,0,0];this.L=void 0;this.M=a;this.D=!1;this.K={progress:{},seeded:{}};this.u=this.ga=0;this.I=1;this.J=2;this.ca=0x10000;this.T=[0,48,64,96,128,192,0x100,384,512,768,1024];this.da=3E4;this.ba=80};
sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;if(d===this.u)throw new sjcl.exception.notReady("generator isn't seeded");if(d&this.J){d=!(d&this.I); e=[];var f=0,g;this.Z=e[0]=(new Date).valueOf()+this.da;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g< this.c.length & & ( e = e.concat(this.c[g].finalize()),f+=this.m[g],this.m[g]=0,d||!(this.P&1<<g));g++);this.P > =1< < this.c.length & & ( this . c . push ( new sjcl . hash . sha256 ) , this . m . push ( 0 ) ) ; this . f- = f;f > this.o& & (this.o=
f);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.L=new sjcl.cipher.aes(this.b);for(d=0;4>d&&(this.h[d]=this.h[d]+1|0,!this.h[d]); d++);}for(d=0;d< a ; d + = 4 ) 0 = ==(d+1)%this.ca&&y(this),e=z(this),c.push(e[0],e[1],e[2],e[3]);y(this);return c . slice ( 0 , a ) } , setDefaultParanoia:function ( a , b ) { if ( 0 = ==a&&"Setting paranoia = 0 will ruin your security ; use it only for testing " ! = = b ) throw new sjcl . exception . invalid ( " Setting paranoia = 0 will ruin your security ; use it only for testing " ) ; this . M = a},addEntropy:function(a,
b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.H[c],h=this.isReady(),k=0;d=this.U[c];void 0===d&&(d=this.U[c]=this.ha++); void 0===g&&(g=this.H[c]=0); this.H[c]=(this.H[c]+1)%this.c.length;switch(typeof a){case "number":void 0===b&&(b=1); this.c[g].update([d,this.N++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if("[object Uint32Array]"===c){e=[];for(c=0;c< a.length ; c + + ) e . push ( a [ c ] ) ; a = e}else for ( " [ object Array ] " ! = = c & & ( k = 1),c=0;c<a.length&&!k;c++)"number"!==typeof a [ c ] & &
(k=1);if(!k){if(void 0===b)for(c=b=0;c< a.length ; c + + ) for ( e = a[c];0<e;)b++,e=e > >>1;this.c[g].update([d,this.N++,2,b,f,a.length].concat(a))}break;case "string":void 0===b&&(b=a.length); this.c[g].update([d,this.N++,3,b,f,a.length]);this.c[g].update(a);break;default:k=1}if(k)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[g]+=b;this.f+=b;h===this.u& & (this.isReady()!==this.u& & A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},
isReady:function(a){a=this.T[void 0!==a?a:this.M];return this.o& & this.o>=a?this.m[0]>this.ba& & (new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=a?this.J|this.u:this.u},getProgress:function(a){a=this.T[a?a:this.M];return this.o>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load",
this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event");
this.D=!0}},stopCollectors:function(){this.D& & (window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent& & (document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",
this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(a,b){this.K[a][this.ga++]=b},removeEventListener:function(a,b){var c,d,e=this.K[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d); for(c=0;c< f.length ; c + + ) d = f[c],delete e [ d ] } , la:function ( ) { C ( this , 1 ) } , oa:function ( a ) { var b , c ; try { b = a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&this.addEntropy([b,c],2,"mouse");C(this,0)},qa:function(a){a=
a.touches[0]||a.changedTouches[0];this.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch");C(this,0)},ma:function(){C(this,2)},ea:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;"number"===typeof b&&this.addEntropy(b,1,"accelerometer")}a&&this.addEntropy(a,2,"accelerometer"); C(this,0)}};
function A(a,b){var c,d=sjcl.random.K[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]); for(c=0;c< e.length ; c + + ) e [ c ] ( b ) } function C ( a , b ) { " undefined " ! = = typeof window & & window . performance & & " function " = = = typeof window . performance . now ? a . addEntropy ( window . performance . now ( ) , b , " loadtime " ) :a . addEntropy ( ( new Date ) . valueOf ( ) , b , " loadtime " ) } function y ( a ) { a . b = z(a).concat(z(a));a.L=new sjcl . cipher . aes ( a . b ) } function z ( a ) { for ( var b = 0;4 > b&&(a.h[b]=a.h[b]+1|0,!a.h[b]); b++);return a.L.encrypt(a.h)}
function B(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);
a:try{var D,E,F,G;if(G="undefined"!==typeof module& & module.exports){var H;try{H=require("crypto")}catch(a){H=null}G=E=H}if(G& & E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window& & "undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F); else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F);
else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!==typeof window& & window.console& & (console.log("There was an error collecting entropy from the browser:"),console.log(a))}
sjcl.json={defaults:{v:1,iter:1E4,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.g({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.g(f,c);c=f.adata;"string"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt)); "string"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv)); if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||"string"===typeof a& & 100>=f.iter||64!==f.ts& & 96!==f.ts& & 128!==f.ts||128!==f.ks& & 192!==f.ks& & 0x100!==f.ks||2>f.iv.length||
4< f.iv.length ) throw new sjcl . exception . invalid ( " json encrypt: invalid parameters " ) ; " string " = = = typeof a ? ( g = sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl . ecc . elGamal . publicKey & & ( g = a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));"string"===typeof b & & ( b = sjcl.codec.utf8String.toBits(b));"string"===typeof c & & ( f . adata = c=sjcl.codec.utf8String.toBits(c));g=new sjcl . cipher [ f . cipher ] ( a ) ; e . g ( d , f ) ; d . key = a;f.ct="ccm"===f.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&
b instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.encrypt(g,b,f.iv,c,f.ts):sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},encrypt:function(a,b,c,d){var e=sjcl.json,f=e.ja.apply(e,arguments);return e.encode(f)},ia:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.g(e.g(e.g({},e.defaults),b),c,!0);var f,g;f=b.adata;"string"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt)); "string"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv)); if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||"string"===
typeof a& & 100>=b.iter||64!==b.ts& & 96!==b.ts& & 128!==b.ts||128!==b.ks& & 192!==b.ks& & 0x100!==b.ks||!b.iv||2>b.iv.length||4< b.iv.length ) throw new sjcl . exception . invalid ( " json decrypt: invalid parameters " ) ; " string " = = = typeof a ? ( g = sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl . ecc . elGamal . secretKey & & ( a = a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));"string"===typeof f & & ( f = sjcl.codec.utf8String.toBits(f));g=new sjcl . cipher [ b . cipher ] ( a ) ; f = "ccm" = = =
b.mode& & sjcl.arrayBuffer& & sjcl.arrayBuffer.ccm& & b.ct instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.decrypt(g,b.ct,b.iv,b.tag,f,b.ts):sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.g(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,c,d){var e=sjcl.json;return e.ia(a,e.decode(b),c,d)},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],0)+'"';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(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i)))throw new sjcl . exception . invalid ( " json decode: this isn ' t json ! " ) ;
null!=d[3]?b[d[2]]=parseInt(d[3],10):null!=d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):null!=d[5]& & (b[d[2]]="true"===d[5])}return b},g:function(a,b,c){void 0===a&&(a={}); if(void 0===b)return a;for(var d in b)if(b.hasOwnProperty(d)){if(c& & void 0!==a[d]& & a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},sa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]); return c},ra:function(a,
b){var c={},d;for(d=0;d< b.length ; d + + ) void 0 ! = = a [ b [ d ] ] & & ( c [ b [ d ] ] = a [ b [ d ] ] ) ; return c } } ; sjcl . encrypt = sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.pa={};sjcl.misc.cachedPbkdf2=function(a,b){var c = sjcl.misc.pa,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=void 0 = ==b.salt?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)}};
"undefined"!==typeof module&&module.exports&&(module.exports=sjcl); "function"===typeof define& & define([],function(){return sjcl});
< / 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 || Object.create(null);
$tw.boot = $tw.boot || Object.create(null);
// Detect platforms
if(!("browser" in $tw)) {
$tw.browser = typeof(window) !== "undefined" ? {} : null;
}
if(!("node" in $tw)) {
$tw.node = typeof(process) === "object" ? {} : null;
}
if(!("nodeWebKit" in $tw)) {
$tw.nodeWebKit = $tw.node & & global.window & & global.window.nwDispatcher ? {} : null;
}
// Set default boot tasks
$tw.boot.tasks = {
trapErrors: !!($tw.browser & & !$tw.node),
readBrowserTiddlers: !!($tw.browser & & !$tw.node)
};
/*
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);
};
/*
Convenience function for pushing an array of tiddlers onto the preloading array
*/
$tw.preloadTiddlerArray = function(fieldsArray) {
$tw.preloadTiddlers.push.apply($tw.preloadTiddlers,fieldsArray);
};
return $tw;
});
if(typeof(exports) === "undefined") {
// Set up $tw global for the browser
window.$tw = _bootprefix(window.$tw);
} else {
// Export functionality as a module
exports.bootprefix = _bootprefix;
}
//# sourceURL=$:/boot/bootprefix.js
< / script >
< / div >
<!-- ~~ Boot kernel ~~ -->
< div id = "bootKernel" style = "display:none;" >
< script data-tiddler-created = "20230425145216673" data-tiddler-modified = "20230425145412612" 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.
\*/
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 || Object.create(null);
/////////////////////////// Standard node.js libraries
var fs, path, vm;
if($tw.node) {
fs = require("fs");
path = require("path");
vm = require("vm");
}
/////////////////////////// Utility functions
$tw.boot.log = function(str) {
$tw.boot.logMessages = $tw.boot.logMessages || [];
$tw.boot.logMessages.push(str);
}
/*
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]";
};
/*
Check if an array is equal by value and by reference.
*/
$tw.utils.isArrayEqual = function(array1,array2) {
if(array1 === array2) {
return true;
}
array1 = array1 || [];
array2 = array2 || [];
if(array1.length !== array2.length) {
return false;
}
return array1.every(function(value,index) {
return value === array2[index];
});
};
/*
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
*/
$tw.utils.insertSortedArray = function(array,value) {
var low = 0, high = array.length - 1, mid, cmp;
while(low < = high) {
mid = (low + high) >> 1;
cmp = value.localeCompare(array[mid]);
if(cmp > 0) {
low = mid + 1;
} else if(cmp < 0 ) {
high = mid - 1;
} else {
return array;
}
}
array.splice(low,0,value);
return array;
};
/*
Push entries onto an array, removing them first if they already exist in the array
array: array to modify (assumed to be free of duplicates)
value: a single value to push or an array of values to push
*/
$tw.utils.pushTop = function(array,value) {
var t,p;
if($tw.utils.isArray(value)) {
// Remove any array entries that are duplicated in the new values
if(value.length !== 0) {
if(array.length !== 0) {
if(value.length < array.length ) {
for(t=0; t< value.length ; t + + ) {
p = array.indexOf(value[t]);
if(p !== -1) {
array.splice(p,1);
}
}
} else {
for(t=array.length-1; t>=0; t--) {
p = value.indexOf(array[t]);
if(p !== -1) {
array.splice(t,1);
}
}
}
}
// Push the values on top of the main array
array.push.apply(array,value);
}
} else {
p = array.indexOf(value);
if(p !== -1) {
array.splice(p,1);
}
array.push(value);
}
return 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 next,f,length;
if(object) {
if(Object.prototype.toString.call(object) == "[object Array]") {
for (f=0, length=object.length; f< length ; f + + ) {
next = callback(object[f],f,object);
if(next === false) {
break;
}
}
} else {
var keys = Object.keys(object);
for (f=0, length=keys.length; f< length ; f + + ) {
var key = keys[f];
next = callback(object[key],key,object);
if(next === false) {
break;
}
}
}
}
};
/*
Helper for making DOM elements
tag: tag name
options: see below
Options include:
namespace: defaults to http://www.w3.org/1999/xhtml
attributes: hashmap of attribute values
style: hashmap of styles
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.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
if(options["class"]) {
element.className = options["class"];
}
if(options.text) {
element.appendChild(doc.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);
});
$tw.utils.each(options.style,function(value,name) {
element.style[name] = value;
});
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 = ( $tw.language == undefined ? "Internal JavaScript Error" : $tw.language.getString("InternalJavaScriptError/Title") ),
promptMsg = ( $tw.language == undefined ? "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser" : $tw.language.getString("InternalJavaScriptError/Hint") );
// Log the error to the console
console.error($tw.node ? "\x1b[1;31m" + err + "\x1b[0m" : err);
if($tw.browser & & !$tw.node) {
// Display an error message to the user
var dm = $tw.utils.domMaker,
heading = dm("h1",{text: errHeading}),
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
message = dm("div",{text: err, "class":"tc-error-message"}),
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-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 if(!$tw.browser) {
// Exit if we're under node.js
process.exit(1);
}
};
/*
Use our custom error handler if we're in the browser
*/
/*
if($tw.boot.tasks.trapErrors) {
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] === undefined) {
object[p] = source[p];
}
if(typeof object[p] === "object" & & typeof source[p] === "object") {
$tw.utils.deepDefaults(object[p],source[p]);
}
}
}
});
return object;
};
/*
Convert a URIComponent encoded string to a string safely
*/
$tw.utils.decodeURIComponentSafe = function(s) {
var v = s;
try {
v = decodeURIComponent(s);
} catch(e) {}
return v;
};
/*
Convert a URI encoded string to a string safely
*/
$tw.utils.decodeURISafe = function(s) {
var v = s;
try {
v = decodeURI(s);
} catch(e) {}
return v;
};
/*
Convert "& " to & , " " to nbsp, "< " to < , "> " to > and "" " to "
*/
$tw.utils.htmlDecode = function(s) {
return s.toString().replace(/< /mg,"< ").replace(/ /mg,"\xA0").replace(/> /mg,">").replace(/" /mg,"\"").replace(/& /mg,"&");
};
/*
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
*/
$tw.utils.getLocationHash = function() {
var href = window.location.href;
var idx = href.indexOf('#');
if(idx === -1) {
return "#";
} else if(href.substr(idx + 1,1) === "#" || href.substr(idx + 1,3) === "%23") {
// Special case: ignore location hash if it itself starts with a #
return "#";
} else {
return href.substring(idx);
}
};
/*
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") {
var negative = 1;
if(value.charAt(0) === "-") {
negative = -1;
value = value.substr(1);
}
var year = parseInt(value.substr(0,4),10) * negative,
d = new Date(Date.UTC(year,
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)));
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
return d;
} 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) {
if($tw.utils.isArray(value)) {
var result = new Array(value.length);
for(var t=0, l=value.length; t< l ; t + + ) {
var entry = value[t] || "";
if(entry.match(/[^\S\xA0]/mg)) {
result[t] = "[[" + entry + "]]";
} else {
result[t] = entry;
}
}
return result.join(" ");
} else {
return value || "";
}
};
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"
$tw.utils.parseStringArray = function(value, allowDuplicate) {
if(typeof value === "string") {
var memberRegExp = /(?:^|[^\S\xA0])(?:\[\[(.*?)\]\])(?=[^\S\xA0]|$)|([\S\xA0]+)/mg,
results = [], names = {},
match;
do {
match = memberRegExp.exec(value);
if(match) {
var item = match[1] || match[2];
if(item !== undefined & & (!$tw.utils.hop(names,item) || allowDuplicate)) {
results.push(item);
names[item] = true;
}
}
} 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 || Object.create(null);
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();
if(field) {
fields[field] = value;
}
}
}
});
return fields;
};
// Safely parse a string as JSON
$tw.utils.parseJSONSafe = function(text,defaultJSON) {
try {
return JSON.parse(text);
} catch(e) {
if(typeof defaultJSON === "function") {
return defaultJSON(e);
} else {
return defaultJSON || {};
}
}
};
/*
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 -- see https://semver.org
*/
$tw.utils.parseVersion = function(version) {
var match = /^v?((\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 +1 if the version string A is greater than the version string B, 0 if they are the same, and +1 if B is greater than A.
Missing or malformed version strings are parsed as 0.0.0
*/
$tw.utils.compareVersions = function(versionStringA,versionStringB) {
var defaultVersion = {
major: 0,
minor: 0,
patch: 0
},
versionA = $tw.utils.parseVersion(versionStringA) || defaultVersion,
versionB = $tw.utils.parseVersion(versionStringB) || defaultVersion,
diff = [
versionA.major - versionB.major,
versionA.minor - versionB.minor,
versionA.patch - versionB.patch
];
if((diff[0] > 0) || (diff[0] === 0 & & diff[1] > 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] > 0)) {
return +1;
} else if((diff[0] < 0 ) | | ( diff [ 0 ] = = = 0 & & diff [ 1 ] < 0 ) | | ( diff [ 0 ] = = = 0 & diff [ 1 ] = = = 0 & diff [ 2 ] < 0 ) ) {
return -1;
} else {
return 0;
}
};
/*
Returns true if the version string A is greater than the version string B. Returns true if the versions are the same
*/
$tw.utils.checkVersions = function(versionStringA,versionStringB) {
return $tw.utils.compareVersions(versionStringA,versionStringB) !== -1;
};
/*
Register file type information
options: {flags: flags,deserializerType: deserializerType}
flags:"image" for image types
deserializerType: defaults to type if not specified
*/
$tw.utils.registerFileType = function(type,encoding,extension,options) {
options = options || {};
if($tw.utils.isArray(extension)) {
$tw.utils.each(extension,function(extension) {
$tw.config.fileExtensionInfo[extension] = {type: type};
});
extension = extension[0];
} else {
$tw.config.fileExtensionInfo[extension] = {type: type};
}
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};
};
/*
Given an extension, always access the $tw.config.fileExtensionInfo
using a lowercase extension only.
*/
$tw.utils.getFileExtensionInfo = function(ext) {
return ext ? $tw.config.fileExtensionInfo[ext.toLowerCase()] : null;
}
/*
Given an extension, get the correct encoding for that file.
defaults to utf8
*/
$tw.utils.getTypeEncoding = function(ext) {
var extensionInfo = $tw.utils.getFileExtensionInfo(ext),
type = extensionInfo ? extensionInfo.type : null,
typeInfo = type ? $tw.config.contentTypeInfo[type] : null;
return typeInfo ? typeInfo.encoding : "utf8";
};
/*
Run code globally with specified context variables in scope
*/
$tw.utils.evalGlobal = function(code,context,filename) {
var contextCopy = $tw.utils.extend(Object.create(null),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 + "\n;})();\nreturn exports;\n})\n";
// Compile the code into a function
var fn;
if($tw.browser) {
fn = window["eval"](code + "\n\n//# sourceURL=" + filename);
} 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(Object.create(null),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":"tc-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
canCancel: set true to enable a cancel button (callback called with null)
repeatPassword: set true to prompt for the password twice
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 self = this,
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: $tw.language.getString("Encryption/Username")}
}));
}
children.push(dm("input",{
attributes: {
type: "password",
name: "password",
placeholder: ( $tw.language == undefined ? "Password" : $tw.language.getString("Encryption/Password") )
}
}));
if(options.repeatPassword) {
children.push(dm("input",{
attributes: {
type: "password",
name: "password2",
placeholder: $tw.language.getString("Encryption/RepeatPassword")
}
}));
}
if(options.canCancel) {
children.push(dm("button",{
text: $tw.language.getString("Encryption/Cancel"),
attributes: {
type: "button"
},
eventListeners: [{
name: "click",
handlerFunction: function(event) {
self.removePrompt(promptInfo);
options.callback(null);
}
}]
}));
}
children.push(dm("button",{
attributes: {type: "submit"},
text: submitText
}));
var form = dm("form",{
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;
}
});
// Check that the passwords match
if(options.repeatPassword & & data.password !== data.password2) {
alert($tw.language.getString("Encryption/PasswordNoMatch"));
} else {
// Call the callback
if(options.callback(data)) {
// Remove the prompt if the callback returned true
self.removePrompt(promptInfo);
} else {
// Clear the password if the callback returned false
$tw.utils.each(form.elements,function(element) {
if(element.name === "password" || element.name === "password2") {
element.value = "";
}
});
}
}
event.preventDefault();
return false;
},true);
// Add the prompt to the list
var promptInfo = {
serviceName: options.serviceName,
callback: options.callback,
form: form,
owner: this
};
this.passwordPrompts.push(promptInfo);
// Make sure the wrapper is displayed
this.setWrapperDisplay();
return promptInfo;
};
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
var i = this.passwordPrompts.indexOf(promptInfo);
if(i !== -1) {
this.passwordPrompts.splice(i,1);
promptInfo.form.parentNode.removeChild(promptInfo.form);
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.node ? (global.sjcl || require("./sjcl.js")) : window.sjcl,
currentPassword = null,
callSjcl = function(method,inputText,password) {
password = password || currentPassword;
var outputText;
try {
if(password) {
outputText = sjcl[method](password,inputText);
}
} catch(ex) {
console.log("Crypto error:" + ex);
outputText = null;
}
return outputText;
};
this.setPassword = function(newPassword) {
currentPassword = newPassword;
this.updateCryptoStateTiddler();
};
this.updateCryptoStateTiddler = function() {
if($tw.wiki) {
var state = currentPassword ? "yes" : "no",
tiddler = $tw.wiki.getTiddler("$:/isEncrypted");
if(!tiddler || tiddler.fields.text !== state) {
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: state}));
}
}
};
this.hasPassword = function() {
return !!currentPassword;
}
this.encrypt = function(text,password) {
return callSjcl("encrypt",text,password);
};
this.decrypt = function(text,password) {
return callSjcl("decrypt",text,password);
};
};
/////////////////////////// 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;
if(moduleName.charAt(0) === ".") {
name = $tw.utils.resolvePath(moduleName,moduleRoot)
}
if(!$tw.modules.titles[name]) {
if($tw.modules.titles[name + ".js"]) {
name = name + ".js";
} else if($tw.modules.titles[name + "/index.js"]) {
name = name + "/index.js";
} else if($tw.modules.titles[moduleName]) {
name = moduleName;
} else if($tw.modules.titles[moduleName + ".js"]) {
name = moduleName + ".js";
} else if($tw.modules.titles[moduleName + "/index.js"]) {
name = moduleName + "/index.js";
}
}
var moduleInfo = $tw.modules.titles[name],
tiddler = $tw.wiki.getTiddler(name),
_exports = {},
sandbox = {
module: {exports: _exports},
//moduleInfo: moduleInfo,
exports: _exports,
console: console,
setInterval: setInterval,
clearInterval: clearInterval,
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Buffer: $tw.browser ? undefined : 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);
if(sandbox.module.exports) {
moduleInfo.exports = sandbox.module.exports; //more codemirror workaround
}
} else { // Object
moduleInfo.exports = moduleInfo.definition;
}
} catch(e) {
if (e instanceof SyntaxError) {
var line = e.lineNumber || e.line; // Firefox || Safari
if (typeof(line) != "undefined" & & line !== null) {
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
} else if(!$tw.browser) {
// this is the only way to get node.js to display the line at which the syntax error appeared,
// and $tw.utils.error would exit anyway
// cf. https://bugs.chromium.org/p/v8/issues/detail?id=2589
throw e;
} else {
// Opera: line number is included in e.message
// Chrome/IE: there's currently no way to get the line number
$tw.utils.error("Syntax error in boot module " + name + ": " + e.message + "\n" + e.stack);
}
} else {
// line number should be included in e.stack for runtime errors
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
}
}
}
// 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) {
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 = Object.create(null);
$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 = Object.create(null);
}
$tw.modules.forEachModuleOfType(moduleType,function(title,module) {
$tw.utils.each(module,function(element,title,object) {
targetObject[title] = module[title];
});
});
return targetObject;
};
/*
Return a class created from a modules. The module should export the properties to be added to those of the optional base class
*/
$tw.modules.createClassFromModule = function(moduleExports,baseClass) {
var newClass = function() {};
if(baseClass) {
newClass.prototype = new baseClass();
newClass.prototype.constructor = baseClass;
}
$tw.utils.extend(newClass.prototype,moduleExports);
return newClass;
};
/*
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 = Object.create(null);
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
if(!subType || moduleExports.types[subType]) {
classes[moduleExports.name] = $tw.modules.createClassFromModule(moduleExports,baseClass);
}
});
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 = Object.create(null);
this.cache = Object.create(null);
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 || src[t] === null) {
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],
value;
if(fieldModule & & fieldModule.parse) {
value = fieldModule.parse.call(this,src[t]);
} else {
value = src[t];
}
// Freeze the field to keep it immutable
if(value != null & & typeof value === "object") {
Object.freeze(value);
}
this.fields[t] = value;
}
}
}
// Freeze the tiddler against modification
Object.freeze(this.fields);
Object.freeze(this);
};
$tw.Tiddler.prototype.hasField = function(field) {
return $tw.utils.hop(this.fields,field);
};
/*
Compare two tiddlers for equality
tiddler: the tiddler to compare
excludeFields: array of field names to exclude from the comparison
*/
$tw.Tiddler.prototype.isEqual = function(tiddler,excludeFields) {
if(!(tiddler instanceof $tw.Tiddler)) {
return false;
}
excludeFields = excludeFields || [];
var self = this,
differences = []; // Fields that have differences
// Add to the differences array
function addDifference(fieldName) {
// Check for this field being excluded
if(excludeFields.indexOf(fieldName) === -1) {
// Save the field as a difference
$tw.utils.pushTop(differences,fieldName);
}
}
// Returns true if the two values of this field are equal
function isFieldValueEqual(fieldName) {
var valueA = self.fields[fieldName],
valueB = tiddler.fields[fieldName];
// Check for identical string values
if(typeof(valueA) === "string" & & typeof(valueB) === "string" & & valueA === valueB) {
return true;
}
// Check for identical array values
if($tw.utils.isArray(valueA) & & $tw.utils.isArray(valueB) & & $tw.utils.isArrayEqual(valueA,valueB)) {
return true;
}
// Check for identical date values
if($tw.utils.isDate(valueA) & & $tw.utils.isDate(valueB) & & valueA.getTime() === valueB.getTime()) {
return true;
}
// Otherwise the fields must be different
return false;
}
// Compare our fields
for(var fieldName in this.fields) {
if(!isFieldValueEqual(fieldName)) {
addDifference(fieldName);
}
}
// There's a difference for every field in the other tiddler that we don't have
for(fieldName in tiddler.fields) {
if(!(fieldName in this.fields)) {
addDifference(fieldName);
}
}
// Return whether there were any differences
return differences.length === 0;
};
/*
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
/*
Wiki constructor. State is stored in private members that only a small number of privileged accessor methods have direct access. Methods added via the prototype have to use these accessors and cannot access the state data directly.
options include:
enableIndexers - Array of indexer names to enable, or null to use all available indexers
*/
$tw.Wiki = function(options) {
options = options || {};
var self = this,
tiddlers = Object.create(null), // Hashmap of tiddlers
tiddlerTitles = null, // Array of tiddler titles
getTiddlerTitles = function() {
if(!tiddlerTitles) {
tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
}
return tiddlerTitles;
},
pluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority
pluginInfo = Object.create(null), // Hashmap of parsed plugin content
shadowTiddlers = Object.create(null), // Hashmap by title of {source:, tiddler:}
shadowTiddlerTitles = null,
getShadowTiddlerTitles = function() {
if(!shadowTiddlerTitles) {
shadowTiddlerTitles = Object.keys(shadowTiddlers);
}
return shadowTiddlerTitles;
},
enableIndexers = options.enableIndexers || null,
indexers = [],
indexersByName = Object.create(null);
this.addIndexer = function(indexer,name) {
// Bail if this indexer is not enabled
if(enableIndexers & & enableIndexers.indexOf(name) === -1) {
return;
}
indexers.push(indexer);
indexersByName[name] = indexer;
indexer.init();
};
this.getIndexer = function(name) {
return indexersByName[name] || null;
};
// Add a tiddler to the store
this.addTiddler = function(tiddler) {
if(!(tiddler instanceof $tw.Tiddler)) {
tiddler = new $tw.Tiddler(tiddler);
}
// Save the tiddler
if(tiddler) {
var title = tiddler.fields.title;
if(title) {
// Uncomment the following line for detailed logs of all tiddler writes
// console.log("Adding",title,tiddler)
// Record the old tiddler state
var updateDescriptor = {
old: {
tiddler: this.getTiddler(title),
shadow: this.isShadowTiddler(title),
exists: this.tiddlerExists(title)
}
}
// Save the new tiddler
tiddlers[title] = tiddler;
// Check we've got the title
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
// Record the new tiddler state
updateDescriptor["new"] = {
tiddler: tiddler,
shadow: this.isShadowTiddler(title),
exists: this.tiddlerExists(title)
}
// Update indexes
this.clearCache(title);
this.clearGlobalCache();
$tw.utils.each(indexers,function(indexer) {
indexer.update(updateDescriptor);
});
// Queue a change event
this.enqueueTiddlerEvent(title);
}
}
};
// Delete a tiddler
this.deleteTiddler = function(title) {
// Uncomment the following line for detailed logs of all tiddler deletions
// console.log("Deleting",title)
if($tw.utils.hop(tiddlers,title)) {
// Record the old tiddler state
var updateDescriptor = {
old: {
tiddler: this.getTiddler(title),
shadow: this.isShadowTiddler(title),
exists: this.tiddlerExists(title)
}
}
// Delete the tiddler
delete tiddlers[title];
// Delete it from the list of titles
if(tiddlerTitles) {
var index = tiddlerTitles.indexOf(title);
if(index !== -1) {
tiddlerTitles.splice(index,1);
}
}
// Record the new tiddler state
updateDescriptor["new"] = {
tiddler: this.getTiddler(title),
shadow: this.isShadowTiddler(title),
exists: this.tiddlerExists(title)
}
// Update indexes
this.clearCache(title);
this.clearGlobalCache();
$tw.utils.each(indexers,function(indexer) {
indexer.update(updateDescriptor);
});
// Queue a change event
this.enqueueTiddlerEvent(title,true);
}
};
// Get a tiddler from the store
this.getTiddler = function(title) {
if(title) {
var t = tiddlers[title];
if(t !== undefined) {
return t;
} else {
var s = shadowTiddlers[title];
if(s !== undefined) {
return s.tiddler;
}
}
}
return undefined;
};
// Get an array of all tiddler titles
this.allTitles = function() {
return getTiddlerTitles().slice(0);
};
// Iterate through all tiddler titles
this.each = function(callback) {
var titles = getTiddlerTitles(),
index,titlesLength,title;
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
callback(tiddlers[title],title);
}
};
// Get an array of all shadow tiddler titles
this.allShadowTitles = function() {
return getShadowTiddlerTitles().slice(0);
};
// Iterate through all shadow tiddler titles
this.eachShadow = function(callback) {
var titles = getShadowTiddlerTitles(),
index,titlesLength,title;
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
if(tiddlers[title]) {
callback(tiddlers[title],title);
} else {
var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title);
}
}
};
// Iterate through all tiddlers and then the shadows
this.eachTiddlerPlusShadows = function(callback) {
var index,titlesLength,title,
titles = getTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
callback(tiddlers[title],title);
}
titles = getShadowTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
if(!tiddlers[title]) {
var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title);
}
}
};
// Iterate through all the shadows and then the tiddlers
this.eachShadowPlusTiddlers = function(callback) {
var index,titlesLength,title,
titles = getShadowTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
if(tiddlers[title]) {
callback(tiddlers[title],title);
} else {
var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title);
}
}
titles = getTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength ; index + + ) {
title = titles[index];
if(!shadowTiddlers[title]) {
callback(tiddlers[title],title);
}
}
};
// Test for the existence of a tiddler (excludes shadow tiddlers)
this.tiddlerExists = function(title) {
return !!$tw.utils.hop(tiddlers,title);
};
// Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler
this.isShadowTiddler = function(title) {
return $tw.utils.hop(shadowTiddlers,title);
};
this.getShadowSource = function(title) {
if($tw.utils.hop(shadowTiddlers,title)) {
return shadowTiddlers[title].source;
}
return null;
};
// Get an array of all the currently recognised plugin types
this.getPluginTypes = function() {
var types = [];
$tw.utils.each(pluginTiddlers,function(pluginTiddler) {
var pluginType = pluginTiddler.fields["plugin-type"];
if(pluginType & & types.indexOf(pluginType) === -1) {
types.push(pluginType);
}
});
return types;
};
// Read plugin info for all plugins, or just an array of titles. Returns the number of plugins updated or deleted
this.readPluginInfo = function(titles) {
var results = {
modifiedPlugins: [],
deletedPlugins: []
};
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
var tiddler = tiddlers[title];
if(tiddler) {
if(tiddler.fields.type === "application/json" & & tiddler.hasField("plugin-type") & & tiddler.fields.text) {
pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
results.modifiedPlugins.push(tiddler.fields.title);
}
} else {
if(pluginInfo[title]) {
delete pluginInfo[title];
results.deletedPlugins.push(title);
}
}
});
return results;
};
// Get plugin info for a plugin
this.getPluginInfo = function(title) {
return pluginInfo[title];
};
// Register the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected
this.registerPluginTiddlers = function(pluginType,titles) {
var self = this,
registeredTitles = [],
checkTiddler = function(tiddler,title) {
if(tiddler & & tiddler.fields.type === "application/json" & & tiddler.fields["plugin-type"] & & (!pluginType || tiddler.fields["plugin-type"] === pluginType)) {
var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + title);
if(title === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") {
self.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered
pluginTiddlers.push(tiddler);
registeredTitles.push(tiddler.fields.title);
}
}
};
if(titles) {
$tw.utils.each(titles,function(title) {
checkTiddler(self.getTiddler(title),title);
});
} else {
this.each(function(tiddler,title) {
checkTiddler(tiddler,title);
});
}
return registeredTitles;
};
// Unregister the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting unregistering to an array of tiddler titles. Returns an array of the titles affected
this.unregisterPluginTiddlers = function(pluginType,titles) {
var self = this,
unregisteredTitles = [];
// Remove any previous registered plugins of this type
for(var t=pluginTiddlers.length-1; t>=0; t--) {
var tiddler = pluginTiddlers[t];
if(tiddler.fields["plugin-type"] & & (!pluginType || tiddler.fields["plugin-type"] === pluginType) & & (!titles || titles.indexOf(tiddler.fields.title) !== -1)) {
unregisteredTitles.push(tiddler.fields.title);
pluginTiddlers.splice(t,1);
}
}
return unregisteredTitles;
};
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
this.unpackPluginTiddlers = function() {
var self = this;
// Sort the plugin titles by the `plugin-priority` field
pluginTiddlers.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
shadowTiddlers = Object.create(null);
$tw.utils.each(pluginTiddlers,function(tiddler) {
// Extract the constituent tiddlers
if($tw.utils.hop(pluginInfo,tiddler.fields.title)) {
$tw.utils.each(pluginInfo[tiddler.fields.title].tiddlers,function(constituentTiddler,constituentTitle) {
// Save the tiddler object
if(constituentTitle) {
shadowTiddlers[constituentTitle] = {
source: tiddler.fields.title,
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
}
});
}
});
shadowTiddlerTitles = null;
this.clearCache(null);
this.clearGlobalCache();
$tw.utils.each(indexers,function(indexer) {
indexer.rebuild();
});
};
if(this.addIndexersToWiki) {
this.addIndexersToWiki();
}
};
// Dummy methods that will be filled in after boot
$tw.Wiki.prototype.clearCache =
$tw.Wiki.prototype.clearGlobalCache =
$tw.Wiki.prototype.enqueueTiddlerEvent = function() {};
// Add an array of tiddlers
$tw.Wiki.prototype.addTiddlers = function(tiddlers) {
for(var t=0; t< tiddlers.length ; t + + ) {
this.addTiddler(tiddlers[t]);
}
};
/*
Define all modules stored in ordinary tiddlers
*/
$tw.Wiki.prototype.defineTiddlerModules = function() {
this.each(function(tiddler,title) {
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"],$tw.utils.parseJSONSafe(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;
this.eachShadow(function(tiddler,title) {
// Don't define the module if it is overidden by an ordinary tiddler
if(!self.tiddlerExists(title) & & tiddler.hasField("module-type")) {
// Define the module
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
}
});
};
/*
Enable safe mode by deleting any tiddlers that override a shadow tiddler
*/
$tw.Wiki.prototype.processSafeMode = function() {
var self = this,
overrides = [];
// Find the overriding tiddlers
this.each(function(tiddler,title) {
if(self.isShadowTiddler(title)) {
console.log(title);
overrides.push(title);
}
});
// Assemble a report tiddler
var titleReportTiddler = "TiddlyWiki Safe Mode",
report = [];
report.push("TiddlyWiki has been started in [[safe mode|https://tiddlywiki.com/static/SafeMode.html]]. All plugins are temporarily disabled. Most customisations have been disabled by renaming the following tiddlers:")
// Delete the overrides
overrides.forEach(function(title) {
var tiddler = self.getTiddler(title),
newTitle = "SAFE: " + title;
self.deleteTiddler(title);
self.addTiddler(new $tw.Tiddler(tiddler, {title: newTitle}));
report.push("* [[" + title + "|" + newTitle + "]]");
});
report.push()
this.addTiddler(new $tw.Tiddler({title: titleReportTiddler, text: report.join("\n\n")}));
// Set $:/DefaultTiddlers to point to our report
this.addTiddler(new $tw.Tiddler({title: "$:/DefaultTiddlers", text: "[[" + titleReportTiddler + "]]"}));
};
/*
Extracts tiddlers from a typed block of text, specifying default field values
*/
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
srcFields = srcFields || Object.create(null);
options = options || {};
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
fields = Object.create(null);
if(!deserializer) {
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
}
if(!deserializer & & $tw.utils.getFileExtensionInfo(type)) {
// If we didn't find the serializer, try converting it from an extension to a content type
type = $tw.utils.getFileExtensionInfo(type).type;
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
}
if(!deserializer & & $tw.config.contentTypeInfo[type]) {
// see if this type has a different deserializer registered with it
type = $tw.config.contentTypeInfo[type].deserializerType;
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
*/
var deserializeHeaderComment = 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/js","tiddlerdeserializer",{
"application/javascript": deserializeHeaderComment
});
$tw.modules.define("$:/boot/tiddlerdeserializer/css","tiddlerdeserializer",{
"text/css": deserializeHeaderComment
});
$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");
}
return [fields];
}
});
$tw.modules.define("$:/boot/tiddlerdeserializer/tids","tiddlerdeserializer",{
"application/x-tiddlers": function(text,fields) {
var titles = [],
tiddlers = [],
match = /\r?\n\r?\n/mg.exec(text);
if(match) {
fields = $tw.utils.parseFields(text.substr(0,match.index),fields);
var lines = text.substr(match.index + match[0].length).split(/\r?\n/mg);
for(var t=0; t< lines.length ; t + + ) {
var line = lines[t];
if(line.charAt(0) !== "#") {
var colonPos= line.indexOf(":");
if(colonPos !== -1) {
var tiddler = $tw.utils.extend(Object.create(null),fields);
tiddler.title = (tiddler.title || "") + line.substr(0,colonPos).trim();
if(titles.indexOf(tiddler.title) !== -1) {
console.log("Warning: .multids file contains multiple definitions for " + tiddler.title);
}
titles.push(tiddler.title);
tiddler.text = line.substr(colonPos + 2).trim();
tiddlers.push(tiddler);
}
}
}
}
return tiddlers;
}
});
$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 isTiddlerValid = function(data) {
// Not valid if it's not an object with a title property
if(typeof(data) !== "object" || !$tw.utils.hop(data,"title")) {
return false;
}
for(var f in data) {
if($tw.utils.hop(data,f)) {
// Check field name doesn't contain control characters
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
return false;
}
}
}
return true;
},
isTiddlerArrayValid = function(data) {
for(var t=0; t< data.length ; t + + ) {
if(!isTiddlerValid(data[t])) {
return false;
}
}
return true;
},
data = $tw.utils.parseJSONSafe(text);
if($tw.utils.isArray(data) & & isTiddlerArrayValid(data)) {
return data;
} else if(isTiddlerValid(data)) {
return [data];
} else {
// Plain JSON file
fields.text = text;
fields.type = "application/json";
return [fields];
}
}
});
/////////////////////////// Browser definitions
if($tw.browser & & !$tw.node) {
/*
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 = "Enter a password to decrypt this TiddlyWiki";
// Prompt for the password
if($tw.utils.hop($tw.boot,"encryptionPrompts")) {
prompt = $tw.boot.encryptionPrompts.decrypt;
}
$tw.passwordPrompt.createPrompt({
serviceName: prompt,
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 = $tw.utils.parseJSONSafe(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) {
var type = (node.getAttribute & & node.getAttribute("type")) || null;
if(type) {
// A new-style container with an explicit deserialization type
result = $tw.wiki.deserializeTiddlers(type,node.textContent);
} else {
// An old-style container of classic DIV-based tiddlers
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.loadTiddlersBrowser = function() {
// In the browser, we load tiddlers from certain elements
var containerSelectors = [
// IDs for old-style v5.1.x tiddler stores
"#libraryModules",
"#modules",
"#bootKernelPrefix",
"#bootKernel",
"#styleArea",
"#storeArea",
"#systemArea",
// Classes for new-style v5.2.x JSON tiddler stores
"script.tiddlywiki-tiddler-store"
];
for(var t=0; t< containerSelectors.length ; t + + ) {
var nodes = document.querySelectorAll(containerSelectors[t]);
for(var n=0; n< nodes.length ; n + + ) {
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",nodes[n]));
}
}
};
} else {
/////////////////////////// Server definitions
/*
Get any encrypted tiddlers
*/
$tw.boot.decryptEncryptedTiddlers = function(callback) {
// Storing encrypted tiddlers on the server isn't supported yet
callback();
};
} // End of if($tw.browser & & !$tw.node)
/////////////////////////// Node definitions
if($tw.node) {
/*
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.utils.getFileExtensionInfo(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),
metadata = $tw.loadMetadataForFile(filepath);
if(metadata) {
if(type === "application/json") {
tiddlers = [{text: data, type: "application/json"}];
}
tiddlers = [$tw.utils.extend({},tiddlers[0],metadata)];
}
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
};
/*
Load the metadata fields in the .meta file corresponding to a particular file
*/
$tw.loadMetadataForFile = function(filepath) {
var metafilename = filepath + ".meta";
if(fs.existsSync(metafilename)) {
return $tw.utils.parseFields(fs.readFileSync(metafilename,"utf8") || "");
} else {
return null;
}
};
/*
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$|^\.github$|^\.vscode$|^\.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) {
Array.prototype.push.apply(tiddlers,$tw.loadTiddlersFromSpecification(filepath,excludeRegExp));
} else {
// If not, read all the files in the directory
$tw.utils.each(files,function(file) {
if(!excludeRegExp.test(file) & & file !== "plugin.info") {
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp));
}
});
}
} else if(stat.isFile()) {
tiddlers.push($tw.loadTiddlersFromFile(filepath,{title: filepath}));
}
}
return tiddlers;
};
/*
Load all the tiddlers defined by a `tiddlywiki.files` specification file
filepath: pathname of the directory containing the specification file
*/
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
var tiddlers = [];
// Read the specification
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
// Helper to process a file
var processFile = function(filename,isTiddlerFile,fields,isEditableFile) {
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
type = (extInfo || {}).type || fields.type || "text/plain",
typeInfo = $tw.config.contentTypeInfo[type] || {},
pathname = path.resolve(filepath,filename),
text = fs.readFileSync(pathname,typeInfo.encoding || "utf8"),
metadata = $tw.loadMetadataForFile(pathname) || {},
fileTiddlers;
if(isTiddlerFile) {
fileTiddlers = $tw.wiki.deserializeTiddlers(path.extname(pathname),text,metadata) || [];
} else {
fileTiddlers = [$tw.utils.extend({text: text},metadata)];
}
var combinedFields = $tw.utils.extend({},fields,metadata);
$tw.utils.each(fileTiddlers,function(tiddler) {
$tw.utils.each(combinedFields,function(fieldInfo,name) {
if(typeof fieldInfo === "string" || $tw.utils.isArray(fieldInfo)) {
tiddler[name] = fieldInfo;
} else {
var value = tiddler[name];
switch(fieldInfo.source) {
case "filename":
value = path.basename(filename);
break;
case "filename-uri-decoded":
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
break;
case "basename":
value = path.basename(filename,path.extname(filename));
break;
case "basename-uri-decoded":
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
break;
case "extname":
value = path.extname(filename);
break;
case "created":
value = new Date(fs.statSync(pathname).birthtime);
break;
case "modified":
value = new Date(fs.statSync(pathname).mtime);
break;
}
if(fieldInfo.prefix) {
value = fieldInfo.prefix + value;
}
if(fieldInfo.suffix) {
value = value + fieldInfo.suffix;
}
tiddler[name] = value;
}
});
});
if(isEditableFile) {
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata & & !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});
} else {
tiddlers.push({tiddlers: fileTiddlers});
}
};
// Helper to recursively search subdirectories
var getAllFiles = function(dirPath, recurse, arrayOfFiles) {
recurse = recurse || false;
arrayOfFiles = arrayOfFiles || [];
var files = fs.readdirSync(dirPath);
files.forEach(function(file) {
if (recurse & & fs.statSync(dirPath + path.sep + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
arrayOfFiles.push(path.join(dirPath, path.sep, file));
}
});
return arrayOfFiles;
}
// Process the listed tiddlers
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
if(tidInfo.prefix & & tidInfo.suffix) {
tidInfo.fields.text = {prefix: tidInfo.prefix,suffix: tidInfo.suffix};
} else if(tidInfo.prefix) {
tidInfo.fields.text = {prefix: tidInfo.prefix};
} else if(tidInfo.suffix) {
tidInfo.fields.text = {suffix: tidInfo.suffix};
}
processFile(tidInfo.file,tidInfo.isTiddlerFile,tidInfo.fields);
});
// Process any listed directories
$tw.utils.each(filesInfo.directories,function(dirSpec) {
// Read literal directories directly
if(typeof dirSpec === "string") {
var pathname = path.resolve(filepath,dirSpec);
if(fs.existsSync(pathname) & & fs.statSync(pathname).isDirectory()) {
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(pathname,excludeRegExp));
}
} else {
// Process directory specifier
var dirPath = path.resolve(filepath,dirSpec.path);
if(fs.existsSync(dirPath) & & fs.statSync(dirPath).isDirectory()) {
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
metaRegExp = /^.*\.meta$/;
for(var t=0; t< files.length ; t + + ) {
var thisPath = path.relative(filepath, files[t]),
filename = path.basename(thisPath);
if(filename !== "tiddlywiki.files" & & !metaRegExp.test(filename) & & fileRegExp.test(filename)) {
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
}
}
} else {
console.log("Warning: a directory in a tiddlywiki.files file does not exist.");
console.log("dirPath: " + dirPath);
console.log("tiddlywiki.files location: " + 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 infoPath = filepath + path.sep + "plugin.info";
if(fs.existsSync(filepath) & & fs.statSync(filepath).isDirectory()) {
// Read the plugin information
if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {
console.log("Warning: missing plugin.info file in " + filepath);
return null;
}
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"));
// Read the plugin files
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
// Save the plugin tiddlers into the plugin info
pluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);
for(var f=0; f< pluginFiles.length ; f + + ) {
var tiddlers = pluginFiles[f].tiddlers;
for(var t=0; t< tiddlers.length ; t + + ) {
var tiddler= tiddlers[t];
if(tiddler.title) {
pluginInfo.tiddlers[tiddler.title] = tiddler;
}
}
}
// 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;
}
// Use "plugin" as the plugin-type if we don't have one
if(!("plugin-type" in pluginInfo)) {
pluginInfo["plugin-type"] = "plugin";
}
pluginInfo.dependents = pluginInfo.dependents || [];
pluginInfo.type = "application/json";
// Set plugin text
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
delete pluginInfo.tiddlers;
// Deserialise array fields (currently required for the dependents field)
for(var field in pluginInfo) {
if($tw.utils.isArray(pluginInfo[field])) {
pluginInfo[field] = $tw.utils.stringifyList(pluginInfo[field]);
}
}
return pluginInfo;
} else {
return null;
}
};
/*
name: Name of the plugin to find
paths: array of file paths to search for it
Returns the path of the plugin folder
*/
$tw.findLibraryItem = function(name,paths) {
var pathIndex = 0;
do {
var pluginPath = path.resolve(paths[pathIndex],"./" + name)
if(fs.existsSync(pluginPath) & & fs.statSync(pluginPath).isDirectory()) {
return pluginPath;
}
} while(++pathIndex < paths.length ) ;
return null;
};
/*
name: Name of the plugin to load
paths: array of file paths to search for it
*/
$tw.loadPlugin = function(name,paths) {
var pluginPath = $tw.findLibraryItem(name,paths);
if(pluginPath) {
var pluginFields = $tw.loadPluginFolder(pluginPath);
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
return;
}
}
console.log("Warning: Cannot find plugin '" + name + "'");
};
/*
libraryPath: Path of library folder for these plugins (relative to core path)
envVar: Environment variable name for these plugins
Returns an array of search paths
*/
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
env = process.env[envVar];
if(env) {
env.split(path.delimiter).map(function(item) {
if(item) {
pluginPaths.push(item);
}
});
}
return pluginPaths;
};
/*
plugins: Array of names of plugins (eg, "tiddlywiki/filesystemadaptor")
libraryPath: Path of library folder for these plugins (relative to core path)
envVar: Environment variable name for these plugins
*/
$tw.loadPlugins = function(plugins,libraryPath,envVar) {
if(plugins) {
var pluginPaths = $tw.getLibraryItemSearchPaths(libraryPath,envVar);
for(var t=0; t< plugins.length ; t + + ) {
$tw.loadPlugin(plugins[t],pluginPaths);
}
}
};
/*
path: path of wiki directory
options:
parentPaths: array of parent paths that we mustn't recurse into
readOnly: true if the tiddler file paths should not be retained
*/
$tw.loadWikiTiddlers = function(wikiPath,options) {
options = options || {};
var parentPaths = options.parentPaths || [],
wikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo),
wikiInfo,
pluginFields;
// Bail if we don't have a wiki info file
if(fs.existsSync(wikiInfoPath)) {
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"));
} else {
return null;
}
// Save the path to the tiddlers folder for the filesystemadaptor
var config = wikiInfo.config || {};
if($tw.boot.wikiPath == wikiPath) {
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
}
// Load any parent wikis
if(wikiInfo.includeWikis) {
parentPaths = parentPaths.slice(0);
parentPaths.push(wikiPath);
$tw.utils.each(wikiInfo.includeWikis,function(info) {
if(typeof info === "string") {
info = {path: info};
}
var resolvedIncludedWikiPath = path.resolve(wikiPath,info.path);
if(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) {
var subWikiInfo = $tw.loadWikiTiddlers(resolvedIncludedWikiPath,{
parentPaths: parentPaths,
readOnly: info["read-only"]
});
// Merge the build targets
wikiInfo.build = $tw.utils.extend([],subWikiInfo.build,wikiInfo.build);
} else {
$tw.utils.error("Cannot recursively include wiki " + resolvedIncludedWikiPath);
}
});
}
// Load any plugins, themes and languages listed in the wiki info file
$tw.loadPlugins(wikiInfo.plugins,$tw.config.pluginsPath,$tw.config.pluginsEnvVar);
$tw.loadPlugins(wikiInfo.themes,$tw.config.themesPath,$tw.config.themesEnvVar);
$tw.loadPlugins(wikiInfo.languages,$tw.config.languagesPath,$tw.config.languagesEnvVar);
// Load the wiki files, registering them as writable
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
if(!options.readOnly & & tiddlerFile.filepath) {
$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) {
$tw.boot.files[tiddler.title] = {
filepath: tiddlerFile.filepath,
type: tiddlerFile.type,
hasMetaFile: tiddlerFile.hasMetaFile,
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0
};
});
}
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
});
if ($tw.boot.wikiPath == wikiPath) {
// Save the original tiddler file locations if requested
var output = {}, relativePath, fileInfo;
for(var title in $tw.boot.files) {
fileInfo = $tw.boot.files[title];
if(fileInfo.isEditableFile) {
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
fileInfo.originalpath = relativePath;
output[title] =
path.sep === "/" ?
relativePath :
relativePath.split(path.sep).join("/");
}
}
if(Object.keys(output).length > 0){
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
}
}
// 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(var 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(var t=0; t< themeFolders.length ; t + + ) {
pluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,"./" + themeFolders[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
// Load any languages within the wiki folder
var wikiLanguagesPath = path.resolve(wikiPath,$tw.config.wikiLanguagesSubDir);
if(fs.existsSync(wikiLanguagesPath)) {
var languageFolders = fs.readdirSync(wikiLanguagesPath);
for(var t=0; t< languageFolders.length ; t + + ) {
pluginFields = $tw.loadPluginFolder(path.resolve(wikiLanguagesPath,"./" + languageFolders[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
return wikiInfo;
};
$tw.loadTiddlersNode = 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 any extra plugins
$tw.utils.each($tw.boot.extraPlugins,function(name) {
if(name.charAt(0) === "+") { // Relative path to plugin
var pluginFields = $tw.loadPluginFolder(name.substring(1));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
} else {
var parts = name.split("/"),
type = parts[0];
if(parts.length === 3 & & ["plugins","themes","languages"].indexOf(type) !== -1) {
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
}
}
});
// Load the tiddlers from the wiki directory
if($tw.boot.wikiPath) {
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);
}
};
// End of if($tw.node)
}
/////////////////////////// Main startup function called once tiddlers have been decrypted
/*
Startup TiddlyWiki
*/
$tw.boot.initStartup = function(options) {
// Get the URL hash and check for safe mode
$tw.locationHash = "#";
if($tw.browser & & !$tw.node) {
if(location.hash === "#:safe") {
$tw.safeMode = true;
} else {
$tw.locationHash = $tw.utils.getLocationHash();
}
}
// Initialise some more $tw properties
$tw.utils.deepDefaults($tw,{
modules: { // Information about each module
titles: Object.create(null), // hashmap by module title of {fn:, exports:, moduleType:}
types: {} // hashmap by module type of hashmap of exports
},
config: { // Configuration overridables
pluginsPath: "../plugins/",
themesPath: "../themes/",
languagesPath: "../languages/",
editionsPath: "../editions/",
wikiInfo: "./tiddlywiki.info",
wikiPluginsSubDir: "./plugins",
wikiThemesSubDir: "./themes",
wikiLanguagesSubDir: "./languages",
wikiTiddlersSubDir: "./tiddlers",
wikiOutputSubDir: "./output",
jsModuleHeaderRegExpString: "^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)",
fileExtensionInfo: Object.create(null), // Map file extension to {type:}
contentTypeInfo: Object.create(null), // Map type to {encoding:,extension:}
pluginsEnvVar: "TIDDLYWIKI_PLUGIN_PATH",
themesEnvVar: "TIDDLYWIKI_THEME_PATH",
languagesEnvVar: "TIDDLYWIKI_LANGUAGE_PATH",
editionsEnvVar: "TIDDLYWIKI_EDITION_PATH"
},
log: {}, // Log flags
unloadTasks: []
});
if(!$tw.boot.tasks.readBrowserTiddlers) {
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
$tw.boot.files = Object.create(null);
// System paths and filenames
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
// If there's no arguments then default to `--help`
if($tw.boot.argv.length === 0) {
$tw.boot.argv = ["--help"];
}
// Parse any extra plugin references
$tw.boot.extraPlugins = $tw.boot.extraPlugins || [];
while($tw.boot.argv[0] & & $tw.boot.argv[0].indexOf("+") === 0) {
$tw.boot.extraPlugins.push($tw.boot.argv[0].substring(1));
$tw.boot.argv.splice(0,1);
}
// 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.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 = $tw.packageInfo || require("../package.json");
// Check node version number
if(!$tw.utils.checkVersions(process.version.substr(1),$tw.packageInfo.engines.node.substr(2))) {
$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-tiddlers","utf8",".multids");
$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",".htm"]);
$tw.utils.registerFileType("application/hta","utf16le",".hta",{deserializerType:"text/html"});
$tw.utils.registerFileType("application/javascript","utf8",".js");
$tw.utils.registerFileType("application/json","utf8",".json");
$tw.utils.registerFileType("application/pdf","base64",".pdf",{flags:["image"]});
$tw.utils.registerFileType("application/zip","base64",".zip");
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
$tw.utils.registerFileType("image/jpg","base64",[".jpg",".jpeg"],{flags:["image"]});
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
$tw.utils.registerFileType("application/font-woff","base64",".woff");
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
$tw.utils.registerFileType("video/webm","base64",".webm");
$tw.utils.registerFileType("video/mp4","base64",".mp4");
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
$tw.utils.registerFileType("audio/mpeg","base64");
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
$tw.utils.registerFileType("application/octet-stream","base64",".octet-stream");
// Create the wiki store for the app
$tw.wiki = new $tw.Wiki($tw.safeMode & & {enableIndexers: []});
// Install built in tiddler fields modules
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
// Install the tiddler deserializer modules
$tw.Wiki.tiddlerDeserializerModules = Object.create(null);
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
// Call unload handlers in the browser
if($tw.browser) {
window.onbeforeunload = function(event) {
event = event || {};
var result;
$tw.utils.each($tw.unloadTasks,function(task) {
var r = task(event);
if(r) {
result = r;
}
});
return result;
}
}
};
$tw.boot.loadStartup = function(options){
// Load tiddlers
if($tw.boot.tasks.readBrowserTiddlers) {
$tw.loadTiddlersBrowser();
} else {
$tw.loadTiddlersNode();
}
// Load any preloaded tiddlers
if($tw.preloadTiddlers) {
$tw.wiki.addTiddlers($tw.preloadTiddlers);
}
// Give hooks a chance to modify the store
$tw.hooks.invokeHook("th-boot-tiddlers-loaded");
}
$tw.boot.execStartup = function(options){
// Unpack plugin tiddlers
$tw.wiki.readPluginInfo();
$tw.wiki.registerPluginTiddlers("plugin",$tw.safeMode ? ["$:/core"] : undefined);
$tw.wiki.unpackPluginTiddlers();
// Process "safe mode"
if($tw.safeMode) {
$tw.wiki.processSafeMode();
}
// 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
if($tw.crypto) {
$tw.crypto.updateCryptoStateTiddler();
}
// Gather up any startup modules
$tw.boot.remainingStartupModules = []; // Array of startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {
if(module.startup) {
$tw.boot.remainingStartupModules.push(module);
}
});
// Keep track of the startup tasks that have been executed
$tw.boot.executedStartupModules = Object.create(null);
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
// Repeatedly execute the next eligible task
$tw.boot.executeNextStartupTask(options.callback);
}
/*
Startup TiddlyWiki
*/
$tw.boot.startup = function(options) {
options = options || {};
// Get the URL hash and check for safe mode
$tw.boot.initStartup(options);
$tw.boot.loadStartup(options);
$tw.boot.execStartup(options);
};
/*
Add another unload task
*/
$tw.addUnloadTask = function(task) {
if($tw.unloadTasks.indexOf(task) === -1) {
$tw.unloadTasks.push(task);
}
}
/*
Execute the remaining eligible startup tasks
*/
$tw.boot.executeNextStartupTask = function(callback) {
// Find the next eligible task
var taskIndex = 0, task,
asyncTaskCallback = function() {
if(task.name) {
$tw.boot.executedStartupModules[task.name] = true;
}
return $tw.boot.executeNextStartupTask(callback);
};
while(taskIndex < $tw.boot.remainingStartupModules.length) {
task = $tw.boot.remainingStartupModules[taskIndex];
if($tw.boot.isStartupTaskEligible(task)) {
// Remove this task from the list
$tw.boot.remainingStartupModules.splice(taskIndex,1);
// Assemble log message
var s = ["Startup task:",task.name];
if(task.platforms) {
s.push("platforms:",task.platforms.join(","));
}
if(task.after) {
s.push("after:",task.after.join(","));
}
if(task.before) {
s.push("before:",task.before.join(","));
}
$tw.boot.log(s.join(" "));
// Execute task
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
task.startup();
if(task.name) {
$tw.boot.executedStartupModules[task.name] = true;
}
return $tw.boot.executeNextStartupTask(callback);
} else {
task.startup(asyncTaskCallback);
return true;
}
}
taskIndex++;
}
if(typeof callback === 'function') {
callback();
}
return false;
};
/*
Returns true if we are running on one of the platforms specified in taskModule's
`platforms` array; or if `platforms` property is not defined.
*/
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
var platforms = taskModule.platforms;
if(platforms) {
for(var t=0; t< platforms.length ; t + + ) {
switch (platforms[t]) {
case "browser":
if ($tw.browser) {
return true;
}
break;
case "node":
if ($tw.node) {
return true;
}
break;
default:
$tw.utils.error("Module " + taskModule.name + ": '" + platforms[t] + "' in export.platforms invalid");
}
}
return false;
}
return true;
};
$tw.boot.isStartupTaskEligible = function(taskModule) {
var t;
// Check that the platform is correct
if(!$tw.boot.doesTaskMatchPlatform(taskModule)) {
return false;
}
var name = taskModule.name,
remaining = $tw.boot.remainingStartupModules;
if(name) {
// Fail if this module is disabled
if($tw.boot.disabledStartupModules.indexOf(name) !== -1) {
return false;
}
// Check that no other outstanding tasks must be executed before this one
for(t=0; t< remaining.length ; t + + ) {
var task = remaining[t];
if(task.before & & task.before.indexOf(name) !== -1) {
if($tw.boot.doesTaskMatchPlatform(task) & & (!task.name || $tw.boot.disabledStartupModules.indexOf(task.name) === -1)) {
return false;
}
}
}
}
// Check that all of the tasks that we must be performed after has been done
var after = taskModule.after;
if(after) {
for(t=0; t< after.length ; t + + ) {
if(!$tw.boot.executedStartupModules[after[t]]) {
return false;
}
}
}
return true;
};
/*
Global Hooks mechanism which allows plugins to modify default functionality
*/
$tw.hooks = $tw.hooks || { names: {}};
/*
Add hooks to the hashmap
*/
$tw.hooks.addHook = function(hookName,definition) {
if($tw.utils.hop($tw.hooks.names,hookName)) {
$tw.hooks.names[hookName].push(definition);
}
else {
$tw.hooks.names[hookName] = [definition];
}
};
/*
Invoke the hook by key
*/
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
var args = Array.prototype.slice.call(arguments,1);
if($tw.utils.hop($tw.hooks.names,hookName)) {
for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
}
}
return args[0];
};
/////////////////////////// Main boot function to decrypt tiddlers and then startup
$tw.boot.boot = function(callback) {
// Initialise crypto object
$tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter
if($tw.browser & & !$tw.node) {
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
}
// Preload any encrypted tiddlers
$tw.boot.decryptEncryptedTiddlers(function() {
// Startup
$tw.boot.startup({callback: callback});
});
};
/////////////////////////// Autoboot in the browser
if($tw.browser & & !$tw.boot.suppressBoot) {
$tw.boot.boot();
}
return $tw;
});
if(typeof(exports) !== "undefined") {
exports.TiddlyWiki = _boot;
} else {
_boot(window.$tw);
}
//# sourceURL=$:/boot/boot.js
< / script >
< / div >
<!-- ~~ Raw markup for the bottom of the body section ~~ -->
< / body >
< / html >