From 03fc5ac48b657ca8baab640843e4f6b752c7ec0c Mon Sep 17 00:00:00 2001 From: Jeff Lindsay Date: Wed, 17 May 2023 17:39:43 -0500 Subject: [PATCH] 0.3.0 bundle --- web/static/lib/0.3.0/treehouse.min.js | 4 ++++ web/static/lib/0.3.0/treehouse.min.js.map | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 web/static/lib/0.3.0/treehouse.min.js create mode 100644 web/static/lib/0.3.0/treehouse.min.js.map diff --git a/web/static/lib/0.3.0/treehouse.min.js b/web/static/lib/0.3.0/treehouse.min.js new file mode 100644 index 0000000..122c4ba --- /dev/null +++ b/web/static/lib/0.3.0/treehouse.min.js @@ -0,0 +1,4 @@ +var ae=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var a=(r,e)=>ae(r,"name",{value:e,configurable:!0});var R=(r,e,t,n)=>{for(var o=n>1?void 0:n?Le(e,t):e,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&ae(e,t,o),o};var de=navigator.userAgent.toLowerCase().indexOf("mac")!==-1;function le(r){if(!r)return[];let e={backspace:"\u232B",shift:"\u21E7",meta:"\u2318",tab:"\u21B9",ctrl:"\u2303",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",enter:"\u23CE"};return r.toLowerCase().split("+").map(ce).map(n=>Object.keys(e).includes(n)?e[n]:n)}a(le,"bindingSymbols");function ce(r){return!de&&r==="meta"?"ctrl":r}a(ce,"filterKeyForNonMacMeta");var K=class{constructor(){this.bindings=[]}registerBinding(e){this.bindings.push(e)}getBinding(e){for(let t of this.bindings)if(t.command===e)return t;return null}evaluateEvent(e){e:for(let t of this.bindings){let n=t.key.toLowerCase().split("+");if(n.pop()===e.key.toLowerCase()){for(let i of["shift","ctrl","alt","meta"]){let s=n.includes(i);if(!de){if(i==="meta")continue;i==="ctrl"&&(s=n.includes("meta")||n.includes("ctrl"))}let d=e[`${ce(i)}Key`];if(!d&&s||d&&!s)continue e}return t}}return null}};a(K,"KeyBindings");var Y=class{constructor(){this.commands={}}registerCommand(e){this.commands[e.id]=e}executeCommand(e,...t){return new Promise(n=>{let o=this.commands[e].action(...t);n(o)})}};a(Y,"CommandRegistry");var G=class{constructor(){this.menus={}}registerMenu(e,t){this.menus[e]=t}};a(G,"MenuRegistry");var q=class{constructor(e){this.commands=new Y,this.keybindings=new K,this.menus=new G,this.backend=e,this.workspace=new W(e.files),this.context={node:null},this.panels=[]}get mainPanel(){return this.panels[0]}async initialize(){await this.workspace.load(),this.workspace.rawNodes.forEach(e=>this.backend.index.index(e)),this.workspace.observe(e=>{this.workspace.save(),e.isDestroyed?this.backend.index.remove(e.id):(this.backend.index.index(e.raw),e.components.forEach(t=>this.backend.index.index(t.raw)))}),this.workspace.lastOpenedID?this.openNewPanel(this.workspace.find(this.workspace.lastOpenedID)||this.workspace.mainNode()):this.openNewPanel(this.workspace.mainNode()),this.backend.loadExtensions&&await this.backend.loadExtensions(),m.redraw(),localStorage.getItem("firsttime")||this.showNotice("firsttime")}authenticated(){return this.backend.auth&&this.backend.auth.currentUser()}closeQuickAdd(){this.quickadd=null,m.redraw()}openQuickAdd(){let e=this.workspace.find("@quickadd");e||(e=this.workspace.new("@quickadd")),this.quickadd=e}commitQuickAdd(){let e=this.workspace.find("@quickadd");if(!e)return;let t=this.todayNode();e.children.forEach(n=>n.parent=t)}clearQuickAdd(){let e=this.workspace.find("@quickadd");e&&e.children.forEach(t=>t.destroy())}todayNode(){let e=new Date,t=e.toUTCString().split(e.getFullYear())[0],n=`Week ${String(Se(e)).padStart(2,"0")}`,i=["@workspace","Calendar",`${e.getFullYear()}`,n,t].join("/"),s=this.workspace.find(i);return s||(s=this.workspace.new(i)),s}openToday(){this.open(this.todayNode())}open(e){this.workspace.expanded[e.id]||(this.workspace.expanded[e.id]={}),this.workspace.lastOpenedID=e.id,this.workspace.save();let t=new D(e);this.panels[0]=t,this.context.path=t}openNewPanel(e){this.workspace.expanded[e.id]||(this.workspace.expanded[e.id]={}),this.workspace.lastOpenedID=e.id,this.workspace.save();let t=new D(e);this.panels.push(t),this.context.path=t}closePanel(e){this.panels=this.panels.filter(t=>t.name!==e.name)}defocus(){this.context.node=null}focus(e,t=0){let n=this.getInput(e);n?(this.context.path=e,n.focus(),t!==void 0&&n.setSelectionRange(t,t)):console.warn("unable to find input for",e)}getInput(e){let t=`input-${e.id}-${e.node.id}`;return e.node.raw.Rel==="Fields"&&(t=t+"-value"),document.getElementById(t)}executeCommand(e,t,...n){return t=this.newContext(t),console.log(e,t,...n),this.commands.executeCommand(e,this.newContext(t),...n)}newContext(e){return Object.assign({},this.context,e)}showMenu(e,t){e.stopPropagation(),e.preventDefault();let n=e.target.closest("*[data-menu]"),o=n.getBoundingClientRect(),i=n.dataset.align||"left",s=document.body.scrollLeft+o.x;i==="right"&&(s=document.body.offsetWidth-o.right);let d=document.body.scrollTop+o.y+o.height,l=this.menus.menus[n.dataset.menu],c=l.filter(u=>u.command).map(u=>this.commands.commands[u.command]);l&&(this.menu={x:s,y:d,ctx:this.newContext(t),items:l,commands:c,align:i},this.curtain={visible:!1,onclick:()=>this.hideMenu()},m.redraw())}hideMenu(){this.menu=null,this.curtain=null,m.redraw()}showPalette(e,t,n){this.palette={x:e,y:t,ctx:n},this.curtain={visible:!1,onclick:()=>this.hidePalette()},m.redraw()}hidePalette(){this.palette=null,this.curtain=null,m.redraw()}showNotice(e,t){this.notice={message:e,finished:t},m.redraw()}hideNotice(){this.notice=null,m.redraw()}};a(q,"Workbench");function Se(r){var e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);var n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e-n)/864e5+1)/7)}a(Se,"getWeekOfYear");function he(r){function e(E,x){var b=E<>>32-x;return b}a(e,"rotate_left");function t(E){var x="",b,N,se;for(b=0;b<=6;b+=2)N=E>>>b*4+4&15,se=E>>>b*4&15,x+=N.toString(16)+se.toString(16);return x}a(t,"lsb_hex");function n(E){var x="",b,N;for(b=7;b>=0;b--)N=E>>>b*4&15,x+=N.toString(16);return x}a(n,"cvt_hex");function o(E){E=E.replace(/\r\n/g,` +`);for(var x="",b=0;b127&&N<2048?(x+=String.fromCharCode(N>>6|192),x+=String.fromCharCode(N&63|128)):(x+=String.fromCharCode(N>>12|224),x+=String.fromCharCode(N>>6&63|128),x+=String.fromCharCode(N&63|128))}return x}a(o,"Utf8Encode");var i,s,d,l=new Array(80),c=1732584193,u=4023233417,p=2562383102,g=271733878,w=3285377520,f,v,h,y,C,T;r=o(r);var A=r.length,P=new Array;for(s=0;s>>29),P.push(A<<3&4294967295),i=0;ie.id)].join(":"))}get node(){return this.nodes[this.nodes.length-1]}get previous(){return this.nodes.length<2?null:this.nodes[this.nodes.length-2]}get head(){return this.nodes[0]}};a(D,"Path");var oe={};function B(r){oe[O(r)]=r}a(B,"component");function O(r){return r.prototype===void 0&&(r=r.constructor),`treehouse.${r.name}`}a(O,"componentName");function ie(r){return typeof r=="string"?oe[r]:oe[O(r)]}a(ie,"getComponent");function ue(r,e){let t=new(ie(r));return t.fromJSON instanceof Function?t.fromJSON(e):Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),t}a(ue,"inflateToComponent");function z(r,e){return r.value&&r.value[e]instanceof Function}a(z,"hasHook");function M(r,e,...t){if(z(r,e))return r.value[e].apply(r.value,t)}a(M,"triggerHook");function H(r,e){for(let t of r.components)if(z(t,e))return!0;return!1}a(H,"objectHas");function $(r,e,...t){for(let n of r.components)if(z(n,e))return n.value[e].apply(n.value,t)}a($,"objectCall");var Q=class{constructor(){this.nodes={"@root":{ID:"@root",Name:"@root",Linked:{Children:[],Components:[]},Attrs:{}}},this.observers=[]}changed(e){this.observers.forEach(t=>t(e))}import(e){for(let t of e)t.Value&&ie(t.Name)&&(t.Value=ue(t.Name,t.Value),t.Rel="Components"),this.nodes[t.ID]=t;for(let t of e){if(t.Parent==="@tmp"){delete this.nodes[t.ID];continue}if(!t.ID.startsWith("@")&&t.Parent===void 0){delete this.nodes[t.ID];continue}if(t.Parent&&!this.nodes[t.Parent]){delete this.nodes[t.ID];continue}let n=this.find(t.ID);if(n){if(n.parent&&!n.parent.raw){delete this.nodes[t.ID];continue}M(n,"onAttach",n)}}}export(){let e=[];for(let t of Object.values(this.nodes))e.push(t);return e}make(e,t){let n=null;if(e.includes("/")){let s=e.split("/");n=this.find(s[0]);for(let d=1;de.Parent===void 0).map(e=>new I(this,e.ID))}root(e){e=e||"@root";let t=this.roots().find(n=>n.name===e);return t===void 0?null:t}find(e){let t=this.nodes[e];if(t)return new I(this,t.ID);let n=e.split("/");if(n.length===1&&n[0].startsWith("@"))return null;let o=this.root(n[0]);if(!o&&this.nodes[n[0]]&&(o=new I(this,this.nodes[n[0]].ID)),o?n.shift():o=this.root("@root"),!o)return null;let i=a((s,d)=>(s.refTo&&(s=s.refTo),s.children.find(l=>l.name===d)),"findChild");for(let s of n){let d=i(o,s);if(!d)return null;o=d}return o}walk(e,t){for(let n of this.roots())if(n.walk(e,t))return}observe(e){this.observers.push(e)}};a(Q,"Bus");var De=a(()=>{let r=Date.now().toString(36),e=Math.random().toString(36).substring(2);return r+e},"uniqueId");var I=class{constructor(e,t){this._bus=e,this._id=t}[Symbol.for("Deno.customInspect")](){return`Node[${this.id}:${this.name}]`}get id(){return this._id}get bus(){return this._bus}get raw(){let e=this._bus.nodes[this.id];if(!e)throw`use of non-existent node ${this.id}`;return e}get name(){return this.refTo?this.refTo.name:this.raw.Name}set name(e){this.refTo?this.refTo.name=e:this.raw.Name=e,this.changed()}get value(){return this.refTo?this.refTo.value:this.raw.Value}set value(e){this.refTo?this.refTo.value=e:this.raw.Value=e,this.changed()}get parent(){return!this.raw.Parent||!this._bus.nodes[this.raw.Parent]?null:new I(this._bus,this.raw.Parent)}set parent(e){let t=this.parent;t!==null&&t.raw.Linked.Children.splice(this.siblingIndex,1),e!==null?(this.raw.Parent=e.id,e.raw.Linked.Children.push(this.id),M(e,"onAttach",e)):this.raw.Parent=void 0,this.changed()}get refTo(){let e=this.raw.Attrs.refTo;return!e||!this._bus.nodes[e]?null:new I(this._bus,e)}set refTo(e){if(!e){delete this.raw.Attrs.refTo,this.changed();return}this.raw.Attrs.refTo=e.id,this.changed()}get siblingIndex(){let e=this.parent;if(e===null)return 0;let t=this.raw.Rel||"Children";return e.raw.Linked[t].findIndex(n=>n===this.id)}set siblingIndex(e){let t=this.parent;if(t===null)return;let n=this.raw.Rel||"Children";t.raw.Linked[n].splice(this.siblingIndex,1),t.raw.Linked[n].splice(e,0,this.id),t.changed()}get prevSibling(){let e=this.parent;if(e===null||this.siblingIndex===0)return null;let t=this.raw.Rel||"Children";return e.getLinked(t)[this.siblingIndex-1]}get nextSibling(){let e=this.parent;if(e===null||this.siblingIndex===e.children.length-1)return null;let t=this.raw.Rel||"Children";return e.getLinked(t)[this.siblingIndex+1]}get ancestors(){let e=[],t=this.parent;for(;t!==null;)e.push(t),t=t.parent;return e}get isDestroyed(){return!this._bus.nodes.hasOwnProperty(this.id)}get path(){let e=this,t=[];for(;e;)t.unshift(e.name),e=e.parent;return t.join("/")}get children(){if(this.refTo)return this.refTo.children;let e=[];this.raw.Linked.Children&&(e=this.raw.Linked.Children.map(t=>new I(this._bus,t)));for(let t of this.components)if(z(t,"objectChildren"))return M(t,"objectChildren",this,e);return e}get childCount(){if(this.refTo)return this.refTo.childCount;for(let e of this.components)if(z(e,"objectChildren"))return M(e,"objectChildren",this,null).length;return this.raw.Linked.Children?this.raw.Linked.Children.length:0}addChild(e){if(this.refTo){this.refTo.addChild(e);return}this.raw.Linked.Children.push(e.id),this.changed()}removeChild(e){if(this.refTo){this.refTo.removeChild(e);return}let t=this.raw.Linked.Children.filter(n=>n===e.id);this.raw.Linked.Children=t,this.changed()}get components(){return this.raw.Linked.Components?this.raw.Linked.Components.map(e=>new I(this._bus,e)):[]}get componentCount(){return this.raw.Linked.Components?this.raw.Linked.Components.length:0}addComponent(e){let t=this.bus.make(O(e),e);t.raw.Parent=this.id,t.raw.Rel="Components",this.raw.Linked.Components.push(t.id),M(t,"onAttach",t),this.changed()}removeComponent(e){let t=this.components.filter(n=>n.name===O(e));t.length>0&&t[0].destroy(),this.changed()}hasComponent(e){return this.components.filter(n=>n.name===O(e)).length>0}getComponent(e){let t=this.components.filter(n=>n.name===O(e));return t.length>0?t[0].value:null}getLinked(e){return this.raw.Linked[e]?this.raw.Linked[e].map(t=>new I(this._bus,t)):[]}addLinked(e,t){this.raw.Linked[e]||(this.raw.Linked[e]=[]),t.raw.Rel=e,this.raw.Linked[e].push(t.id),this.changed()}removeLinked(e,t){this.raw.Linked[e]||(this.raw.Linked[e]=[]);let n=this.raw.Linked[e].filter(o=>o===t.id);this.raw.Linked[e]=n,this.changed()}moveLinked(e,t,n){this.raw.Linked[e]||(this.raw.Linked[e]=[]);let o=this.raw.Linked[e].findIndex(s=>s===t.id);if(o===-1)return;let i=this.raw.Linked[e];i.splice(n,0,i.splice(o,1)[0]),this.raw.Linked[e]=i,this.changed()}getAttr(e){return this.raw.Attrs[e]||""}setAttr(e,t){this.raw.Attrs[e]=t,this.changed()}find(e){return this.bus.find([this.path,e].join("/"))}walk(e,t){if(t=t||{followRefs:!1,includeComponents:!1},e(this))return!0;let n=this.children;if(this.refTo&&t.followRefs){if(e(this.refTo))return!0;n=this.refTo.children}for(let o of n)if(o.walk(e,t))return!0;if(t.includeComponents){for(let o of this.components)if(o.walk(e,t))return!0}return!1}destroy(){if(this.isDestroyed)return;if(this.refTo){this._bus.destroy(this);return}let e=[];this.walk(t=>(e.push(t),!1),{followRefs:!1,includeComponents:!0}),e.reverse().forEach(t=>this._bus.destroy(t))}changed(){this._bus.changed(this)}};a(I,"Node");var W=class{constructor(e){this.fs=e,this.bus=new Q,this.expanded={},this.writeDebounce=Ee(async(t,n)=>{try{await this.fs.writeFile(t,n),console.log("Saved workspace.")}catch(o){console.error(o),document.dispatchEvent(new CustomEvent("BackendError"))}})}get rawNodes(){return this.bus.export()}observe(e){this.bus.observe(e)}save(){this.writeDebounce("workspace.json",JSON.stringify({version:1,lastopen:this.lastOpenedID,expanded:this.expanded,nodes:this.rawNodes},null,2))}async load(){let e=JSON.parse(await this.fs.readFile("workspace.json")||"{}");if(Array.isArray(e)&&(e={version:0,nodes:e}),e.nodes&&(this.bus.import(e.nodes),console.log(`Loaded ${e.nodes.length} nodes.`)),e.expanded)for(let t in e.expanded)for(let n in e.expanded[t])this.bus.find(n)&&(this.expanded[t]||(this.expanded[t]={}),this.expanded[t][n]=e.expanded[t][n]);e.lastopen&&(this.lastOpenedID=e.lastopen)}mainNode(){let e=this.bus.find("@workspace");if(!e){console.info("Building missing workspace node.");let t=this.bus.find("@root"),n=this.bus.make("@workspace");n.name="Workspace",n.parent=t;let o=this.bus.make("@calendar");o.name="Calendar",o.parent=n;let i=this.bus.make("Home");i.parent=n,e=n}return e}find(e){return this.bus.find(e)}new(e,t){return this.bus.make(e,t)}getExpanded(e,t){this.expanded[e.id]||(this.expanded[e.id]={});let n=this.expanded[e.id][t.id];return n===void 0&&(n=!1),n}setExpanded(e,t,n){this.expanded[e.id][t.id]=n,this.save()}findAbove(e){if(e.node.id===e.head.id)return null;let t=e.clone();t.pop();let n=e.node.prevSibling;if(!n){let i=e.previous.getLinked("Fields").length;return e.node.raw.Rel!=="Fields"&&i>0?t.append(e.previous.getLinked("Fields")[i-1]):t}let o=a(i=>{if(!this.getExpanded(e.head,i.node))return i;let d=i.node.getLinked("Fields").length;if(i.node.childCount===0&&d>0){let c=i.node.getLinked("Fields")[d-1];return o(i.append(c))}let l=i.node.children[i.node.childCount-1];return o(i.append(l))},"lastSubIfExpanded");return o(t.append(n))}findBelow(e){let t=e.clone();if(this.getExpanded(e.head,e.node)&&e.node.getLinked("Fields").length>0)return t.append(e.node.getLinked("Fields")[0]);if(this.getExpanded(e.head,e.node)&&e.node.childCount>0)return t.append(e.node.children[0]);let n=a(o=>{let i=o.node.nextSibling;if(i)return o.pop(),o.append(i);let s=o.previous;return s?o.node.raw.Rel==="Fields"&&s.childCount>0?(o.pop(),o.append(s.children[0])):(o.pop(),n(o)):null},"nextSiblingOrParentNextSibling");return n(t)}};a(W,"Workspace");function Ee(r,e=3e3){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{r.apply(this,n)},e)}}a(Ee,"debounce");var pe={view({attrs:{workbench:r,x:e,y:t,items:n,align:o,commands:i,ctx:s}}){let d=a((c,u)=>p=>{p.stopPropagation(),!c.disabled&&(c.onclick&&c.onclick(),u&&r.executeCommand(u.id,s),r.hideMenu())},"onclick"),l={left:`${e}px`};return o==="right"&&(l={right:`${e}px`}),m("ul",{class:"menu",style:Object.assign(l,{margin:"0",position:"absolute",top:`${t}px`,display:"inline-block"})},n.filter(c=>!c.when||c.when()).map(c=>{let u="",p,g;return c.command&&(g=i.find(w=>w.id===c.command),p=r.keybindings.getBinding(g.id),u=g.title),c.title&&(u=c.title()),m("li",{onclick:d(c,g),class:c.disabled?"disabled":"",style:{display:"flex"}},m("div",null,u),p&&m("div",{class:"keybindings grow text-right"},le(p.key).join(" ").toUpperCase()))}))}};var me={onupdate({state:r,dom:e}){let t=e.querySelector(".commands").children;r.selected!==void 0&&t.length>0&&t[r.selected].scrollIntoView({block:"nearest"})},oncreate({state:r,dom:e}){e.querySelector("input").focus(),r.selected===void 0&&(r.selected=0)},view({attrs:r,state:e}){let t=r.workbench;e.filter=e.filter===void 0?"":e.filter;let o=Object.values(t.commands.commands).filter(l=>(l.title||l.id).toLowerCase().startsWith(e.filter.toLowerCase())),i=a(l=>{let c=a((u,p)=>(u%p+p)%p,"mod");if(l.key==="ArrowDown"){if(e.selected===void 0){e.selected=0;return}return e.selected=c(e.selected+1,o.length),!1}if(l.key==="ArrowUp")return e.selected===void 0&&(e.selected=0),e.selected=c(e.selected-1,o.length),!1;if(l.key==="Enter")return e.selected!==void 0&&(t.commands.executeCommand(o[e.selected].id,r.ctx),t.hidePalette()),!1},"onkeydown"),s=a(l=>{t.commands.executeCommand(l.id,r.ctx),t.hidePalette()},"onclick"),d=a(l=>{e.filter=l.target.value,e.selected=0},"autocomplete");return m("div",{class:"palette",style:{position:"absolute",left:`${r.x}px`,top:`${r.y}px`}},m("div",null,m("input",{style:{width:"98%",outline:"0",border:"0"},type:"text",onkeydown:i,oninput:d,placeholder:"Enter command..."})),m("div",{class:"commands",style:{overflowY:"scroll",position:"relative"}},o.map((l,c)=>m("div",{class:e.selected===c?"selected":"",onclick:()=>s(l)},l.title||l.id))))}};var F={view({attrs:{workbench:r,path:e,onkeydown:t,disallowEmpty:n,editValue:o},state:i}){let s=e.node,d=o?"value":"name",l=a(()=>d==="name"?H(s,"displayName")?$(s,"displayName",s):s.name:s[d]||"","display"),c=a(()=>{i.initialValue=s[d],r.context.node=s,r.context.path=e},"onfocus"),u=a(()=>s[d],"getter"),p=a((f,v)=>{s.isDestroyed||(n&&f.length===0?s[d]=i.initialValue:s[d]=f),v&&(r.context.node=null)},"setter"),g;s.raw.Rel==="Fields"&&(g=o?"Value":"Field");let w=`input-${e.id}-${s.id}`;return d==="value"&&(w=w+"-value"),m(Te,{id:w,getter:u,setter:p,display:l,onkeydown:t,onfocus:c,placeholder:g})}},Te={oncreate({dom:r,attrs:e}){let t=r.querySelector("textarea"),n=t.offsetHeight,o=r.querySelector("span");this.updateHeight=()=>{o.style.width=`${Math.max(t.offsetWidth,100)}px`,o.innerHTML=t.value.replace(` +`,"
"),t.style.height=o.offsetHeight>0?`${o.offsetHeight}px`:`${n}px`},t.addEventListener("input",()=>this.updateHeight()),t.addEventListener("blur",()=>o.innerHTML=""),setTimeout(()=>this.updateHeight(),50),e.onmount&&e.onmount(t)},onupdate(){this.updateHeight()},view({attrs:{id:r,onkeydown:e,onfocus:t,onblur:n,getter:o,setter:i,display:s,placeholder:d},state:l}){let c=l.editing?l.buffer:s?s():o();return m("div",{class:"node-container"},m("textarea",{id:r,rows:"1",onfocus:a(f=>{t&&t(f),l.editing=!0,l.buffer=o()},"startEdit"),onblur:a(f=>{l.editing&&(l.editing=!1,i(l.buffer,!0),l.buffer=void 0),n&&n(f)},"finishEdit"),oninput:a(f=>{l.buffer=f.target.value,i(l.buffer,!1)},"edit"),placeholder:d,onkeydown:e||a(f=>{f.key==="Enter"&&(f.preventDefault(),f.stopPropagation())},"defaultKeydown"),value:c},c),m("span",{style:{visibility:"hidden",position:"fixed"}}))}};var fe={view({attrs:{node:r,workbench:e,panel:t}}){return m("div",{class:"empty-view"})}};var ge={view({attrs:{workbench:r,path:e}}){return m("div",{class:"new-node flex flex-row items-center"},m("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"gray",viewBox:"0 0 16 16"},m("circle",{cx:"8",cy:"7",r:"7"}),m("path",{style:{transform:"translate(0px, -1px)"},d:"M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"})),m("div",{class:"flex grow"},m("input",{class:"grow",type:"text",oninput:a(o=>{r.executeCommand("insert-child",{node:e.node,path:e},o.target.value)},"startNew"),onkeydown:a(o=>{if(o.key==="Tab"&&(o.stopPropagation(),o.preventDefault(),node.childCount>0)){let i=e.node.children[e.node.childCount-1];r.executeCommand("insert-child",{node:i,path:e})}},"tabNew"),value:""})))}};var we={view({attrs:{workbench:r,path:e}}){let t=e.node;return e.node.refTo&&(t=e.node.refTo),m("div",{class:"list-view"},m("div",{class:"fields"},t.getLinked("Fields").length>0&&t.getLinked("Fields").map(n=>m(J,{key:n.id,workbench:r,path:e.append(n)}))),m("div",{class:"children"},t.childCount>0?t.children.map(n=>m(J,{key:n.id,workbench:r,path:e.append(n)})):m(ge,{workbench:r,path:e})))}};var ve={view({attrs:{workbench:r,path:e},state:t}){let n=e.node;t.fields=t.fields===void 0?new Set:t.fields,n.children.forEach(i=>{i.getLinked("Fields").forEach(s=>t.fields.add(s.name))});let o=a((i,s)=>{let d=i.getLinked("Fields").filter(l=>l.name===s);return d.length===0?"":m(F,{editValue:!0,workbench:r,path:e.append(d[0])})},"getFieldEditor");return m("table",{class:"table-view",style:{gridTemplateColumns:`repeat(${t.fields.size+1}, 1fr)`}},m("thead",null,m("tr",null,m("th",null),[...t.fields].map(i=>m("th",null,i)))),m("tbody",null,n.children.map(i=>m("tr",null,m("td",null,m(J,{key:i.id,workbench:r,path:e.append(i)})),[...t.fields].map(s=>m("td",null,o(i,s)))))))}};var ke={list:we,table:ve};function re(r){return ke[r]||fe}a(re,"getView");window.registerView=(r,e)=>{ke[r]=e,workbench.commands.registerCommand({id:`view-${r}`,title:`View as ${Re(r)}`,action:t=>{t.node&&t.node.setAttr("view",r)}})};function Re(r){return r.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}a(Re,"toTitleCase");var X={view({attrs:{workbench:r,path:e}}){return m(re(e.node.getAttr("view")||"list"),{workbench:r,path:e})}},J={view({attrs:r,state:e,children:t}){let{path:n,workbench:o}=r,i=n.node,s=!1,d=i;i.refTo&&(s=!0,i=d.refTo);let l=o.workspace.getExpanded(n.head,d),c=a(h=>{e.hover=!0,h.stopPropagation()},"hover"),u=a(h=>{e.hover=!1,h.stopPropagation()},"unhover"),p=a(h=>{l?o.executeCommand("collapse",{node:d,path:n}):o.executeCommand("expand",{node:d,path:n}),h.stopPropagation()},"toggle"),g=a(h=>{let y=h.shiftKey||h.metaKey||h.altKey||h.ctrlKey;switch(h.key){case"ArrowUp":h.target.selectionStart!==0&&!y&&h.stopPropagation();break;case"ArrowDown":h.target.selectionStart!==h.target.value.length&&h.target.selectionStart!==0&&!y&&h.stopPropagation();break;case"Backspace":if(h.target.value===""){if(h.preventDefault(),h.stopPropagation(),i.childCount>0)return;o.executeCommand("delete",{node:i,path:n,event:h});return}if(h.target.value!==""&&h.target.selectionStart===0&&h.target.selectionEnd===0){h.preventDefault(),h.stopPropagation();let C=o.workspace.findAbove(n);if(!C)return;let A=C.node.name;C.node.name=A+h.target.value,i.destroy(),m.redraw.sync(),o.focus(C,A.length);return}break;case"Enter":if(h.preventDefault(),h.ctrlKey||h.shiftKey||h.metaKey||h.altKey)return;if(h.target.selectionStart===h.target.value.length){i.childCount>0&&o.workspace.getExpanded(n.head,i)?o.executeCommand("insert-child",{node:i,path:n},"",0):o.executeCommand("insert",{node:i,path:n}),h.stopPropagation();return}if(h.target.selectionStart===0){o.executeCommand("insert-before",{node:i,path:n}),h.stopPropagation();return}if(h.target.selectionStart>0&&h.target.selectionStart{i.name=h.target.value.slice(0,h.target.selectionStart)}),h.stopPropagation();return}break}},"checkCommands"),w=a(h=>{h.preventDefault(),h.stopPropagation(),o.executeCommand("open",{node:i,path:n}),document.selection&&document.selection.empty?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()},"open"),f=a(h=>h.childCount+h.getLinked("Fields").length,"subCount"),v=a(()=>i.id===o.context?.node?.id||e.hover?!0:i.name.length>0,"showHandle");return m("div",{onmouseover:c,onmouseout:u},m("div",{class:"node-row-outer-wrapper flex flex-row items-start"},m("svg",{class:"node-menu shrink-0",xmlns:"http://www.w3.org/2000/svg",onclick:h=>o.showMenu(h,{node:d,path:n}),oncontextmenu:h=>o.showMenu(h,{node:d,path:n}),"data-menu":"node",viewBox:"0 0 16 16"},e.hover&&m("path",{style:{transform:"translateY(-1px)"},"fill-rule":"evenodd",d:"M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"})),m("div",{class:"node-handle shrink-0",onclick:p,ondblclick:w,oncontextmenu:h=>o.showMenu(h,{node:d,path:n}),"data-menu":"node",style:{display:v()?"block":"none"}},H(i,"handleIcon")?$(i,"handleIcon"):m("svg",{class:"node-bullet",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},f(i)>0&&!l?m("circle",{id:"node-collapsed-handle",cx:"8",cy:"7",r:"7"}):null,m("circle",{cx:"8",cy:"7",r:"3",fill:"currentColor"}),",",s?m("circle",{id:"node-reference-handle",cx:"8",cy:"7",r:"7",fill:"none","stroke-width":"1",stroke:"currentColor","stroke-dasharray":"3,3"}):null)),i.raw.Rel==="Fields"?m("div",{class:"flex grow items-start flex-row"},m("div",null,m(F,{workbench:o,path:n,onkeydown:g})),m(F,{editValue:!0,workbench:o,path:n,onkeydown:g})):m("div",{class:"flex grow items-start flex-row"},H(i,"beforeEditor")&&m($(i,"beforeEditor"),{node:i}),m(F,{workbench:o,path:n,onkeydown:g}),H(i,"afterEditor")&&m($(i,"afterEditor"),{node:i}))),H(i,"belowEditor")&&m($(i,"belowEditor"),{node:i}),l===!0&&m("div",{class:"expanded-node flex flex-row"},m("div",{class:"indent flex",onclick:p}),m("div",{class:"view grow"},m(re(i.getAttr("view")||"list"),{workbench:o,path:n}))))}};var L=class{constructor(){this.markdown=""}};a(L,"Page"),L=R([B],L);var ye={view({attrs:r}){let e=r.path,t=r.workbench,n=e.node,o=a(c=>{t.executeCommand("close-panel",{},e)},"close"),i=a(c=>{e.pop()},"goBack"),s=a(c=>{t.panels=[e],t.context.path=e},"maximize"),d=a(c=>{n.getComponent(L).markdown=c.target.value,n.changed()},"editMarkdown");function l(c=""){return 20+(c.match(/\n/g)||[]).length*20}return a(l,"calcHeight"),m("div",{class:"panel flex flex-col grow"},m("div",{class:"bar flex"},e.length>1?m("div",{class:"panel-back",style:{rightPadding:"var(--padding)"}},m("svg",{onclick:i,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},m("path",{"fill-rule":"evenodd",d:"M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"}))):null,m("div",{class:"panel-back-parent grow"},n.parent&&n.parent.id!=="@root"?m("span",{style:{cursor:"pointer"},onclick:()=>t.open(n.parent)},n.parent.name):m("span",null,"\xA0")),t.panels.length>1?m("div",{class:"panel-icons flex items-center"},m("svg",{onclick:s,style:{cursor:"pointer"},xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-maximize-2"},m("polyline",{points:"15 3 21 3 21 9"}),m("polyline",{points:"9 21 3 21 3 15"}),m("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),m("line",{x1:"3",y1:"21",x2:"10",y2:"14"})),m("svg",{onclick:o,style:{cursor:"pointer"},xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-x"},m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null),m("div",{class:"body flex flex-col"},m("div",{class:"title-node",oncontextmenu:c=>t.showMenu(c,{node:n,path:e}),"data-menu":"node"},m(F,{workbench:t,path:e,disallowEmpty:!0})),n.hasComponent(L)?m("textarea",{oninput:d,value:n.getComponent(L).markdown,placeholder:"Enter Markdown text here",style:{marginLeft:"var(--padding)",padding:"var(--padding)",outline:"0",height:`${l(n.getComponent(L).markdown)}px`,border:"0"}},n.getComponent(L).markdown):null,m(X,{workbench:t,path:e.sub()})))}};var xe={view({attrs:{workbench:r}}){let e=new D(r.quickadd,"quickadd");return m("div",{style:{position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}},m("div",{onclick:()=>r.closeQuickAdd(),style:{position:"absolute",background:"black",opacity:"50%",width:"100%",height:"100%"}}),m("div",{class:"notice",style:{position:"relative",marginLeft:"auto",marginRight:"auto",marginTop:"20vh"}},m("h3",null,"Quick Add"),m(X,{workbench:r,path:e}),m("div",{class:"button-bar"},m("button",{class:"primary",onclick:()=>{r.commitQuickAdd(),r.closeQuickAdd()}},"Add to Today"))))}};var be={onupdate({state:r,dom:e}){let t=e.querySelector(".results");t&&r.selected!==void 0&&t.children.length>0&&t.children[r.selected].scrollIntoView({block:"nearest"})},view({attrs:{workbench:r},state:e}){e.query=e.query===void 0?"":e.query,e.results=e.results===void 0?[]:e.results;let t=a(()=>{e.query="",e.results=[],r.curtain=null},"clear"),n=a(s=>{r.open(s),t()},"open"),o=a(s=>{let d=a((l,c)=>(l%c+c)%c,"mod");if(s.key==="ArrowDown"){if(e.selected===void 0){e.selected=0;return}return e.selected=d(e.selected+1,e.results.length),!1}if(s.key==="ArrowUp")return e.selected===void 0&&(e.selected=0),e.selected=d(e.selected-1,e.results.length),!1;if(s.key==="Enter")return e.selected!==void 0&&n(e.results[e.selected]),!1;s.key==="Escape"&&t()},"onkeydown"),i=a(s=>{if(e.query=s.target.value,e.selected=0,e.query){let d=e.query.split(/[ ]+/),l=d.filter(u=>!u.includes(":")).join(" "),c=Object.fromEntries(d.filter(u=>u.includes(":")).map(u=>u.toLowerCase().split(":")));!l&&Object.keys(c).length>0&&(l=Object.keys(c)[0]),e.results=r.backend.index.search(l).map(u=>{let p=r.workspace.find(u);if(p&&!(p.value&&(p=p.parent,!p.raw))){if(Object.keys(c).length>0){let g={};for(let w of p.getLinked("Fields"))g[w.name.toLowerCase()]=w.value.toLowerCase();for(let w in c)if(!g[w]||g[w]!==c[w])return}return p}}).filter(u=>u!==void 0)}else e.results=[];e.query&&e.results.length>0?r.curtain={visible:!1,onclick:()=>t()}:r.curtain=null},"autocomplete");return m("div",{class:e.results.length>0?"search active flex grow":"search flex grow"},m("div",null,m("div",{class:"flex",style:{margin:e.results.length>0?"0":"1px"}},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-search shrink-0"},m("circle",{cx:"11",cy:"11",r:"8"}),m("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),m("input",{type:"text",placeholder:"Search",value:e.query,onkeydown:o,oninput:i,style:{border:"0",outline:"0",background:"transparent",paddingTop:"3px"}})),e.results.length>0?m("div",{class:"results",style:{overflowX:"hidden",overflowY:"auto",maxHeight:"400px"}},e.results.map((s,d)=>m("div",{onclick:()=>n(s),class:e.selected===d?"selected":""},s.name))):null))}};var Be={view({attrs:{workbench:r,finished:e}}){return m("div",null,m("h3",null,"Refresh to view latest updates"),m("p",null,"Your notes were updated in another browser session. Refresh the page to view the latest version."),m("div",{class:"button-bar"},m("button",{class:"primary",onclick:()=>{e()}},"Refresh Now")))}},Pe={view({attrs:{workbench:r}}){return m("div",null,m("h3",null,"Treehouse is under active development"),m("p",null,"This is a preview based on our main branch, which is actively being developed."),m("p",null,"If you find a bug, please report it via [ ",m("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"0.25rem",marginRight:"0.25rem"},width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},m("path",{d:"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"}))," > Submit Issue ]."),m("p",null,"Data is stored using localstorage, which you can reset via [ ",m("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"0.25rem",marginRight:"0.25rem"},width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},m("path",{d:"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"}))," > Reset Demo ]."),m("div",{class:"button-bar"},m("button",{class:"primary",onclick:()=>{localStorage.setItem("firsttime","1"),r.hideNotice()}},"Got it")))}},Fe={view({attrs:{workbench:r,finished:e}}){return m("div",null,m("h3",null,"Login with GitHub"),m("p",null,"The GitHub backend is experimental so use at your own risk!"),m("p",null,"To store your workbench we will create a public repository called ",m("pre",{style:{display:"inline"}},".treehouse.sh")," if it doesn't already exist. You can manually make this repository private via GitHub if you want."),m("p",null,"You can Logout via the",m("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"0.5rem",marginRight:"0.5rem"},width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},m("path",{d:"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"})),"menu in the top right to return to the localstorage backend."),m("div",{class:"button-bar"},m("button",{onclick:()=>{r.hideNotice()}},"Cancel"),m("button",{class:"primary",onclick:()=>{r.hideNotice(),localStorage.setItem("github","1"),e()}},"Log in with GitHub")))}},Ce={view({attrs:{workbench:r,message:e,finished:t}}){return m("div",{style:{position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}},m("div",{style:{position:"absolute",background:"black",opacity:"50%",width:"100%",height:"100%"}}),m("div",{class:"notice",style:{position:"relative",marginLeft:"auto",marginRight:"auto",filter:"drop-shadow(2px 2px 4px #5555)",marginTop:"20vh"}},m({firsttime:Pe,github:Fe,lockstolen:Be}[e],{workbench:r,finished:t})))}};var Ne={view({attrs:{workbench:r},state:e}){e.open=e.open===void 0?!0:e.open;let t=a(n=>{e.open?e.open=!1:e.open=!0},"toggle");return m("main",{class:"workbench m-0 flex flex-row absolute inset-0",style:{overflow:"none"}},m("div",{class:"sidebar flex flex-col",style:{width:e.open?"256px":"52px"}},m("div",{class:"sidebar-topsection",style:{height:"56px"}},m("img",{class:"logo",src:"/icon_transparent.png",style:{width:"20px",height:"20px"}})),m("div",{class:"grow sidebar-maincontent"},e.open&&r.workspace.bus.root().children.map(n=>m(Ie,{node:n,expanded:!0,level:0,workbench:r}))),m("div",{class:"sidebar-bottomsection"},m("svg",{onclick:t,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-sidebar"},m("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),m("line",{x1:"9",y1:"3",x2:"9",y2:"21"})))),m("div",{class:"main flex flex-col grow"},m("div",{class:"topbar flex"},m("div",{class:"topbar-item",onclick:()=>r.openToday(),style:{cursor:"pointer",marginLeft:"var(--padding)",marginRight:"var(--padding)",display:"flex",alignItems:"center"}},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-calendar"},m("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),m("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),m("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),m("line",{x1:"3",y1:"10",x2:"21",y2:"10"})),m("div",null,"Today")),m("div",{class:"topbar-item",onclick:()=>r.openQuickAdd(),style:{cursor:"pointer",marginLeft:"var(--padding)",marginRight:"var(--padding)",display:"flex",alignItems:"center"}},m("svg",{style:{marginRight:"var(--1)"},xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-plus-circle"},m("circle",{cx:"12",cy:"12",r:"10"}),m("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),m("line",{x1:"8",y1:"12",x2:"16",y2:"12"})),m("div",null,"Quick Add")),m(be,{workbench:r}),m("div",{onclick:n=>r.showMenu(n),"data-menu":"settings","data-align":"right",style:{cursor:"pointer",marginLeft:"var(--padding)",marginRight:"var(--padding)"}},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-menu"},m("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),m("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),m("line",{x1:"3",y1:"18",x2:"21",y2:"18"})))),m("div",{class:"panels flex flex-row",style:{position:"relative",overflow:"hidden"}},r.panels.map(n=>m("div",{style:{flex:"1 1 auto",overflowY:"auto"}},m(ye,{workbench:r,path:n}))))),r.curtain&&m("div",{onclick:r.curtain.onclick,style:{zIndex:"10",position:"absolute",background:"black",opacity:r.curtain.visible?"50%":"0%",width:"100%",height:"100%"}}),r.menu&&m(pe,{workbench:r,...r.menu}),r.palette&&m(me,{workbench:r,...r.palette}),r.quickadd&&m(xe,{workbench:r}),r.notice&&m(Ce,{workbench:r,...r.notice}))}},Ie={view({attrs:{node:r,workbench:e,expanded:t,level:n},state:o}){o.expanded=o.expanded===void 0?t:o.expanded;let i=r.childCount>0&&n<3,s=a(l=>{i&&(o.expanded?o.expanded=!1:o.expanded=!0,l.stopPropagation())},"toggle"),d=a(l=>{e.open(r)},"open");return m("div",null,m("div",{style:{display:"flex",paddingBottom:"var(--2)"}},m("svg",{onclick:s,style:{cursor:"pointer",flexShrink:"0",paddingTop:"0px",marginRight:"0.125rem"},class:"feather feather-chevron-right",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",xmlns:"http://www.w3.org/2000/svg"},i?o.expanded?m("polyline",{points:"6 9 12 15 18 9"}):m("polyline",{points:"9 18 15 12 9 6"}):null),m("div",{onclick:d,style:{cursor:"pointer",lineHeight:"1.25",fontSize:"0.875rem",flexGrow:"1",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.name)),o.expanded&&m("div",{style:{marginLeft:"0.5rem"}},r.children.filter(l=>l.name!=="").map(l=>m(Ie,{workbench:e,node:l,level:n+1}))))}};function je(r,e=1e3){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{r.apply(this,n)},e)}}a(je,"debounce");var U=class{constructor(){this.index=window.workbench.backend.index,this.searchDebounce=je(this.search.bind(this))}handleIcon(){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"11",cy:"11",r:"8"}),m("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))}displayName(e){return`Search for "${e.name}"`}onAttach(e){this.component=e,this.object=e.parent,e.bus.observe(t=>{e.isDestroyed||this.searchDebounce()})}search(){if(console.log("searched"),!this.object)return;let e=this.object.name,t=e.split(/[ ]+/),n=t.filter(s=>!s.includes(":")).join(" "),o=Object.fromEntries(t.filter(s=>s.includes(":")).map(s=>s.toLowerCase().split(":")));!n&&Object.keys(o).length>0&&(n=Object.keys(o)[0]);let i=this.index.search(n).map(s=>{let d=window.workbench.workspace.find(s);if(d&&!(d.value&&(d=d.parent,!d.raw))){if(Object.keys(o).length>0){let l={};for(let c of d.getLinked("Fields"))l[c.name.toLowerCase()]=c.value.toLowerCase();for(let c in o)if(!l[c]||l[c]!==o[c])return}return d}}).filter(s=>s!==void 0).filter(s=>s.id!==this.object.id&&s.id!==this.component.id);(i.length!==this.lastResultCount||e!==this.lastQuery)&&(this.results&&this.results.forEach(s=>s.destroy()),this.results=i.map(s=>{let d=this.object.bus.make("");return d.raw.Parent="@tmp",d.refTo=s,d}),this.lastQuery=e,this.lastResultCount=i.length)}objectChildren(e,t){return this.results||this.search(),this.results}toJSON(e){return{}}fromJSON(e){}};a(U,"SearchNode"),U=R([B],U);var S=class{constructor(){this.checked=!1}beforeEditor(){return Oe}};a(S,"Checkbox"),S=R([B],S);var Oe={view({attrs:{node:r}}){return m("input",{type:"checkbox",style:{marginTop:"0.3rem",marginRight:"0.5rem"},onclick:a(t=>{let n=r.getComponent(S);n.checked=!n.checked,r.changed()},"toggleCheckbox"),checked:r.getComponent(S).checked})}};var j=class{constructor(){}handleIcon(){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("polyline",{points:"4 7 4 4 20 4 20 7"}),m("line",{x1:"9",y1:"20",x2:"15",y2:"20"}),m("line",{x1:"12",y1:"4",x2:"12",y2:"20"}))}};a(j,"TextField"),j=R([B],j);var k=class{constructor(){this.log=[],this.showLog=!1}onAttach(e){this.component=e,this.object=e.parent}fromJSON(e){e.startedAt&&(this.startedAt=new Date(e.startedAt)),this.log=(e.log||[]).map(t=>[new Date(t[0]),new Date(t[1])]),this.showLog=e.showLog}toJSON(e){return{startedAt:this.startedAt,log:this.log,showLog:this.showLog}}localTotal(){return this.log.map(this.entryDuration).reduce((e,t)=>e+t,0)}grandTotal(){let e=this.localTotal();return this.object&&this.object.children.forEach(t=>{t.hasComponent(k)&&(e+=t.getComponent(k).grandTotal())}),e}start(){this.startedAt||(this.startedAt=new Date)}stop(){if(!this.startedAt)return;let e=new Date;(e.getTime()-this.startedAt.getTime())/1e3>=60&&this.log.push([this.startedAt,e]),this.startedAt=void 0}formatEntry(e){return e.length!==2?"":`${this.formatDate(e[0])} - ${new Intl.DateTimeFormat("en",{timeStyle:"short"}).format(e[1])}`}entryDuration(e){let t=e[0];return((e[1]||new Date).getTime()-t.getTime())/1e3}formatDate(e){return e?new Intl.DateTimeFormat("en",{dateStyle:"short",timeStyle:"short"}).format(e):""}formatDuration(e){let t=e/60,n=Math.floor(t%60);return t=t/60,`${Math.floor(t%60)}:${n.toLocaleString("en-US",{minimumIntegerDigits:2,useGrouping:!1})}`}afterEditor(){return Me}belowEditor(){return He}static initialize(e){e.commands.registerCommand({id:"stop-clock",title:"Stop clock",action:t=>{if(t.node){if(!t.node.hasComponent(k)){let n=new k;t.node.addComponent(n)}t.node.getComponent(k).stop(),t.node.changed()}}}),e.keybindings.registerBinding({command:"stop-clock",key:"meta+o"}),e.commands.registerCommand({id:"start-clock",title:"Start clock",action:t=>{if(t.node){if(!t.node.hasComponent(k)){let n=new k;t.node.addComponent(n)}t.node.getComponent(k).start(),t.node.changed()}}}),e.keybindings.registerBinding({command:"start-clock",key:"meta+i"}),e.commands.registerCommand({id:"remove-clock",title:"Remove clock",action:t=>{t.node&&t.node.removeComponent(k)}})}};a(k,"Clock"),k=R([B],k);var Me={view({attrs:{node:r}}){let e=r.getComponent(k),t=a(()=>{e.showLog=!e.showLog,r.changed()},"toggleLog");return!e.showLog&&e.startedAt?m("div",{onclick:t,class:"flex flex-row items-center",style:{background:"green",lineHeight:"var(--body-line-height)",paddingLeft:"0.25rem",paddingRight:"0.25rem",borderRadius:"4px",color:"white"}},m("svg",{class:"blink",style:{width:"1rem",height:"1rem",marginRight:"0.25rem"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"10"}),m("polyline",{points:"12 6 12 12 16 14"})),m("div",null,e.formatDuration(e.entryDuration([e.startedAt])))):m("div",{onclick:t,class:"flex flex-row items-center",style:{background:"gray",lineHeight:"var(--body-line-height)",paddingLeft:"0.25rem",paddingRight:"0.25rem",borderRadius:"4px",color:"white"}},m("svg",{style:{width:"1rem",height:"1rem",marginRight:"0.25rem"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"10"}),m("polyline",{points:"12 6 12 12 16 14"})),m("div",null,e.formatDuration(e.grandTotal())))}},He={view({attrs:{node:r}}){let e=r.getComponent(k);if(e.showLog)return m("div",{class:"expanded-node flex flex-row"},m("div",{class:"indent flex"}),m("div",{class:"grow"},e.startedAt&&m("div",{class:"flex flex-row",style:{marginBottom:"2px"}},m("div",{class:"grow"},e.formatDate(e.startedAt)," - ..."),m("div",{class:"flex flex-row items-center",style:{background:"green",lineHeight:"var(--body-line-height)",paddingLeft:"0.25rem",paddingRight:"0.25rem",borderRadius:"4px",color:"white"}},m("svg",{class:"blink",style:{width:"1rem",height:"1rem",marginRight:"0.25rem"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"10"}),m("polyline",{points:"12 6 12 12 16 14"})),m("div",null,e.formatDuration(e.entryDuration([e.startedAt]))))),e.log.toReversed().map(t=>m("div",{class:"flex flex-row",style:{marginBottom:"2px"}},m("div",{class:"grow"},e.formatEntry(t)),m("div",{class:"flex flex-row items-center",style:{background:"#aaa",lineHeight:"var(--body-line-height)",paddingLeft:"0.25rem",paddingRight:"0.25rem",borderRadius:"4px",color:"white"}},m("svg",{style:{width:"1rem",height:"1rem",marginRight:"0.25rem"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"10"}),m("polyline",{points:"12 6 12 12 16 14"})),m("div",null,e.formatDuration(e.entryDuration(t))))))))}};var V=class{constructor(){this.auth=null,this.files=new ee,window.MiniSearch?this.index=new _:this.index=new Z}};a(V,"BrowserBackend");var _=class{constructor(){this.indexer=new MiniSearch({idField:"ID",fields:["ID","Name","Value","Value.markdown"],storeFields:["ID"],extractField:(e,t)=>t.split(".").reduce((n,o)=>n&&n[o],e)})}index(e){this.indexer.has(e.ID)?this.indexer.replace(e):this.indexer.add(e)}remove(e){try{this.indexer.discard(e)}catch{}}search(e){let t=this.indexer.autoSuggest(e);return t.length===0?[]:this.indexer.search(t[0].suggestion,{prefix:!0}).map(n=>n.ID)}};a(_,"SearchIndex_MiniSearch");var Z=class{constructor(){this.nodes={}}index(e){this.nodes[e.ID]=e.Name}remove(e){delete this.nodes[e]}search(e){let t=[];for(let n in this.nodes)this.nodes[n].includes(e)&&t.push(n);return t}};a(Z,"SearchIndex_Dumb");var ee=class{async readFile(e){return localStorage.getItem(`treehouse:${e}`)}async writeFile(e,t){localStorage.setItem(`treehouse:${e}`,t)}};a(ee,"FileStore");import{encode as $e,decode as Ue}from"https://cdn.jsdelivr.net/npm/js-base64@3.7.5/base64.mjs";var te=class{constructor(e,t,n){this.loginURL=e,this.clientFactory=t,this.auth=this,this.shas={},this.opts=Object.assign({domain:"treehouse.sh",checkDomain:!1},n||{});let o=new V;this.index=o.index,this.files=o.files}get repo(){return`${this.user?.userID()}.${this.opts.domain}`}async initialize(){let e=new URL(location.href).searchParams.get("code");if(e)try{let i=location.search.replace(/\bcode=\w+/,"").replace(/\?$/,"");history.pushState({},"",`${location.pathname}${i}`);let d=await(await fetch(this.loginURL,{method:"POST",mode:"cors",headers:{"content-type":"application/json"},body:JSON.stringify({code:e})})).json();if(d.error)throw d.error;localStorage.setItem("treehouse:gh-token",d.token)}catch(i){this.reset(),console.error(i);return}let t=new URL(location.href).searchParams.get("access_token");if(t)try{let i=location.search.replace(/\baccess_token=\w+/,"").replace(/\?$/,"");history.pushState({},"",`${location.pathname}${i}`),localStorage.setItem("treehouse:gh-token",t)}catch(i){this.reset(),console.error(i);return}try{if(await this.authenticate(),!this.user)throw"authentication failed"}catch(i){console.error(i),this.opts.authFallbackURL&&(location.href=this.opts.authFallbackURL);return}if(this.opts.checkDomain&&this.repo!==location.hostname){location.hostname=this.repo;return}try{await this.client.rest.repos.get({owner:this.user.userID(),repo:this.repo})}catch(i){if(i.message!=="Not Found")throw i;console.log("Creating repository...");let s=await this.client.rest.repos.createForAuthenticatedUser({name:this.repo});if(s.status!==201){console.error(s);return}}try{await this.client.rest.repos.getContent({owner:this.user.userID(),repo:this.repo,path:"workspace.json"})}catch(i){if(i.name!=="HttpError")throw i;console.log("Creating workspace.json...");let s=await this.client.rest.repos.createOrUpdateFileContents({owner:this.user.userID(),repo:this.repo,path:"workspace.json",message:"initial commit",content:btoa(JSON.stringify([]))});if(s.status!==201){console.error(s);return}}this.files=this;let n=qe();await this.readFile("treehouse.lock"),await this.writeFile("treehouse.lock",n);let o=setInterval(async()=>{await this.readFile("treehouse.lock")!==n&&(clearInterval(o),document.dispatchEvent(new CustomEvent("BackendError")),console.warn("lock stolen!"))},5e3)}async loadExtensions(){try{if((await this.client.rest.repos.getContent({owner:this.user?.userID(),repo:this.repo,path:"",random:Math.random().toString(36).substring(2)})).data.find(t=>t.type==="dir"&&t.name==="ext")){let t=await this.client.rest.repos.getContent({owner:this.user?.userID(),repo:this.repo,path:"ext",random:Math.random().toString(36).substring(2)});for(let n of t.data)if(n.name.endsWith(".css")){let o=await this.client.rest.repos.getContent({owner:this.user?.userID(),repo:this.repo,path:n.path,random:Math.random().toString(36).substring(2)}),i=document.createElement("link");i.setAttribute("href",`data:text/css;charset=utf-8;base64,${o.data.content}`),i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),document.head.appendChild(i)}else if(n.name.endsWith(".js")){let o=await this.client.rest.repos.getContent({owner:this.user?.userID(),repo:this.repo,path:n.path,random:Math.random().toString(36).substring(2)}),i=document.createElement("script");i.setAttribute("type","module"),i.setAttribute("src",`data:text/javascript;charset=utf-8;base64,${o.data.content}`),document.head.appendChild(i)}}}catch{}}async authenticate(){let e=localStorage.getItem("treehouse:gh-token");if(!e)return;this.client=new this.clientFactory({auth:e});let t=await this.client.rest.users.getAuthenticated();!t||t.error||(this.user=new ne(t.data),m&&m.redraw())}currentUser(){return this.user}login(){location.assign(this.loginURL)}reset(){localStorage.removeItem("treehouse:gh-token"),this.user=null,m&&m.redraw()}logout(){this.reset(),location.reload()}async readFile(e){try{let t=await this.client.rest.repos.getContent({owner:this.user?.userID(),repo:this.repo,path:e,random:Math.random().toString(36).substring(2)});return this.shas[e]=t.data.sha,Ue(t.data.content)}catch(t){return t.name!=="HttpError"&&console.error(t),null}}async writeFile(e,t){let n=await this.client.rest.repos.createOrUpdateFileContents({owner:this.user?.userID(),repo:this.repo,path:e,message:"autosave",content:$e(t),sha:this.shas[e]});this.shas[e]=n.data.content.sha}};a(te,"GitHubBackend");var ne=class{constructor(e){this.user=e}userID(){return this.user.login}displayName(){return this.user.name}avatarURL(){return this.user.avatar_url}};a(ne,"User");function qe(){let r=Date.now().toString(36),e=Math.random().toString(36).substring(2);return r+e}a(qe,"uniqueID");async function to(r,e,t){t.initialize&&await t.initialize();let n=new q(t);window.workbench=n,await n.initialize(),[k,j,L,S].forEach(o=>{o.initialize&&o.initialize(n)}),r.addEventListener("BackendError",()=>{n.showNotice("lockstolen",()=>{location.reload()})}),n.commands.registerCommand({id:"create-search",title:"Create Search Node",action:o=>{if(!o.node)return;let i=new U;o.node.addComponent(i),n.workspace.setExpanded(o.path.head,o.node,!0)}}),n.commands.registerCommand({id:"view-list",title:"View as List",action:o=>{o.node&&o.node.setAttr("view","list")}}),n.commands.registerCommand({id:"view-table",title:"View as Table",action:o=>{o.node&&o.node.setAttr("view","table")}}),n.commands.registerCommand({id:"add-page",title:"Add page",action:o=>{if(!o.node)return;let i=new L;o.node.addComponent(i)}}),n.commands.registerCommand({id:"remove-page",title:"Remove page",action:o=>{o.node&&o.node.removeComponent(L)}}),n.commands.registerCommand({id:"add-checkbox",title:"Add checkbox",action:o=>{if(!o.node)return;let i=new S;o.node.addComponent(i)}}),n.commands.registerCommand({id:"remove-checkbox",title:"Remove checkbox",action:o=>{o.node&&o.node.removeComponent(S)}}),n.commands.registerCommand({id:"create-field",title:"Create Field",action:o=>{if(!o.node||o.node.childCount>0||o.node.componentCount>0)return;let i=o.path.clone();i.pop();let s=n.workspace.new(o.node.name,"");s.raw.Parent=o.node.parent.id;let d=new j;s.addComponent(d),o.node.parent.addLinked("Fields",s),i.push(s),o.node.destroy(),m.redraw.sync(),n.focus(i)}}),n.commands.registerCommand({id:"mark-done",title:"Mark done",action:o=>{if(o.node)if(o.node.hasComponent(S)){let i=o.node.getComponent(S);i.checked?o.node.removeComponent(S):(i.checked=!0,o.node.changed())}else{let i=new S;o.node.addComponent(i)}}}),n.keybindings.registerBinding({command:"mark-done",key:"meta+enter"}),n.commands.registerCommand({id:"expand",title:"Expand",action:o=>{o.node&&(n.workspace.setExpanded(o.path.head,o.node,!0),m.redraw())}}),n.keybindings.registerBinding({command:"expand",key:"meta+arrowdown"}),n.commands.registerCommand({id:"collapse",title:"Collapse",action:o=>{o.node&&(n.workspace.setExpanded(o.path.head,o.node,!1),m.redraw())}}),n.keybindings.registerBinding({command:"collapse",key:"meta+arrowup"}),n.commands.registerCommand({id:"indent",title:"Indent",action:o=>{if(!o.node||o.node.raw.Rel==="Fields")return;let i=o.node,s=o.path.clone(),d=i.prevSibling;d!==null&&(s.pop(),s.push(d),i.parent=d,s.push(i),n.workspace.setExpanded(o.path.head,d,!0),m.redraw.sync(),n.focus(s))}}),n.keybindings.registerBinding({command:"indent",key:"tab"}),n.commands.registerCommand({id:"outdent",title:"Outdent",action:o=>{if(!o.node||o.node.raw.Rel==="Fields")return;let i=o.node,s=o.path.previous,d=o.path.clone();s!==null&&s.id!=="@root"&&(d.pop(),d.pop(),i.parent=s.parent,d.push(i),i.siblingIndex=s.siblingIndex+1,s.childCount===0&&n.workspace.setExpanded(o.path.head,s,!1),m.redraw.sync(),n.focus(d))}}),n.keybindings.registerBinding({command:"outdent",key:"shift+tab"}),n.commands.registerCommand({id:"move-up",title:"Move Up",action:o=>{if(!o.node)return;let i=o.node,s=i.parent;if(s!==null&&s.id!=="@root"){let d=s.childCount;if(i.siblingIndex===0){if(!s.prevSibling)return;let l=o.path.clone();l.pop(),l.pop();let c=s.prevSibling;l.push(c),l.push(i),i.parent=c,i.siblingIndex=c.childCount-1,n.workspace.setExpanded(o.path.head,c,!0),m.redraw.sync(),n.focus(l)}else{if(d===1)return;i.siblingIndex=i.siblingIndex-1,m.redraw.sync()}}}}),n.keybindings.registerBinding({command:"move-up",key:"shift+meta+arrowup"}),n.commands.registerCommand({id:"move-down",title:"Move Down",action:o=>{if(!o.node)return;let i=o.node,s=i.parent;if(s!==null&&s.id!=="@root"){let d=s.childCount;if(i.siblingIndex===d-1){if(!s.nextSibling)return;let l=o.path.clone();l.pop(),l.pop();let c=s.nextSibling;l.push(c),l.push(i),i.parent=c,i.siblingIndex=0,n.workspace.setExpanded(o.path.head,c,!0),m.redraw.sync(),n.focus(l)}else{if(d===1)return;i.siblingIndex=i.siblingIndex+1,m.redraw.sync()}}}}),n.keybindings.registerBinding({command:"move-down",key:"shift+meta+arrowdown"}),n.commands.registerCommand({id:"insert-child",title:"Insert Child",action:(o,i="",s)=>{if(!o.node)return;let d=n.workspace.new(i);d.parent=o.node,s!==void 0&&(d.siblingIndex=s),n.workspace.setExpanded(o.path.head,o.node,!0),m.redraw.sync(),n.focus(o.path.append(d),i.length)}}),n.commands.registerCommand({id:"insert-before",title:"Insert Before",action:o=>{if(!o.node)return;let i=n.workspace.new("");i.parent=o.node.parent,i.siblingIndex=o.node.siblingIndex,m.redraw.sync();let s=o.path.clone();s.pop(),n.focus(s.append(i))}}),n.commands.registerCommand({id:"insert",title:"Insert Node",action:(o,i="")=>{if(!o.node)return;let s=n.workspace.new(i);s.parent=o.node.parent,s.siblingIndex=o.node.siblingIndex+1,m.redraw.sync();let d=o.path.clone();d.pop(),n.focus(d.append(s))}}),n.keybindings.registerBinding({command:"insert",key:"shift+enter"}),n.commands.registerCommand({id:"create-reference",title:"Create Reference",action:o=>{if(!o.node)return;let i=n.workspace.new("");i.parent=o.node.parent,i.siblingIndex=o.node.siblingIndex+1,i.refTo=o.node,m.redraw.sync();let s=o.path.clone();s.pop(),n.focus(s.append(i))}}),n.commands.registerCommand({id:"delete",title:"Delete node",action:o=>{if(!o.node||o.node.id.startsWith("@"))return;let i=n.workspace.findAbove(o.path);if(o.node.destroy(),m.redraw.sync(),i){let s=0;o.event&&o.event.key==="Backspace"&&(s=i.node.name.length),i.node.childCount===0&&n.workspace.setExpanded(o.path.head,i.node,!1),n.focus(i,s)}}}),n.keybindings.registerBinding({command:"delete",key:"shift+meta+backspace"}),n.commands.registerCommand({id:"prev",action:o=>{if(!o.node)return;let i=n.workspace.findAbove(o.path);i&&n.focus(i)}}),n.keybindings.registerBinding({command:"prev",key:"arrowup"}),n.commands.registerCommand({id:"next",action:o=>{if(!o.node)return;let i=n.workspace.findBelow(o.path);i&&n.focus(i)}}),n.keybindings.registerBinding({command:"next",key:"arrowdown"}),n.commands.registerCommand({id:"pick-command",action:o=>{let i=o.node,s=o.path,d=!1;i||(i=o.path.head,s=new D(o.path.head,o.path.name),d=!0);let l=n.getInput(s),c=l.getBoundingClientRect(),u=r.body.scrollLeft+c.x+l.selectionStart*10+20,p=r.body.scrollTop+c.y-8;d&&(u=r.body.scrollLeft+c.x,p=r.body.scrollTop+c.y+c.height),n.showPalette(u,p,n.newContext({node:i}))}}),n.keybindings.registerBinding({command:"pick-command",key:"meta+k"}),n.commands.registerCommand({id:"new-panel",title:"Open in New Panel",action:o=>{o.node&&(n.openNewPanel(o.node),m.redraw())}}),n.commands.registerCommand({id:"close-panel",title:"Close Panel",action:(o,i)=>{n.closePanel(i||o.path),n.context.path=n.mainPanel,m.redraw()}}),n.commands.registerCommand({id:"zoom",title:"Open",action:o=>{n.workspace.lastOpenedID=o.node.id,n.workspace.save(),n.context.path=o.path.append(o.node),n.panels[0]=n.context.path,m.redraw()}}),n.commands.registerCommand({id:"generate-random",title:"Generate Random Children",action:o=>{o.node&&[...Array(100)].forEach(()=>{let i=n.workspace.new(We(8));i.parent=o.node})}}),n.menus.registerMenu("node",[{command:"zoom"},{command:"new-panel"},{command:"indent"},{command:"outdent"},{command:"move-up"},{command:"move-down"},{command:"delete"}]),n.menus.registerMenu("settings",[{title:()=>`${n.backend.auth?.currentUser()?.userID()} @ GitHub`,disabled:!0,when:()=>n.authenticated()},{title:()=>"Login with GitHub",when:()=>!n.authenticated(),onclick:()=>{localStorage.getItem("github")?n.backend.auth.login():n.showNotice("github",()=>{n.backend.auth.login()})}},{title:()=>"Reset Demo",when:()=>!n.authenticated(),onclick:()=>{localStorage.clear(),location.reload()}},{title:()=>"Submit Issue",onclick:()=>window.open("https://github.com/treehousedev/treehouse/issues","_blank")},{title:()=>"Logout",when:()=>n.authenticated(),onclick:()=>n.backend.auth.logout()}]),r.addEventListener("keydown",o=>{let i=n.keybindings.evaluateEvent(o);if(i){n.executeCommand(i.command,n.context),o.stopPropagation(),o.preventDefault();return}o.key==="Escape"&&n.curtain&&n.curtain.onclick&&n.curtain.onclick(o)}),m.mount(e,{view:()=>m(Ne,{workbench:n})})}a(to,"setup");function We(r=10){let e=a((o,i)=>Math.round(Math.random()*(i-o)+o),"random"),t=a(()=>{let o=["got","ability","shop","recall","fruit","easy","dirty","giant","shaking","ground","weather","lesson","almost","square","forward","bend","cold","broken","distant","adjective"];return o[e(0,o.length-1)]},"word");return a(o=>[...Array(o)].map((i,s)=>t()).join(" ").trim(),"words")(e(2,r))}a(We,"generateName");export{V as BrowserBackend,te as GitHubBackend,_ as SearchIndex_MiniSearch,to as setup}; +//# sourceMappingURL=treehouse.min.js.map diff --git a/web/static/lib/0.3.0/treehouse.min.js.map b/web/static/lib/0.3.0/treehouse.min.js.map new file mode 100644 index 0000000..a224824 --- /dev/null +++ b/web/static/lib/0.3.0/treehouse.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../lib/action/keybinds.ts", "../../../lib/action/commands.ts", "../../../lib/action/menus.ts", "../../../lib/workbench/workbench.ts", "../../../lib/workbench/util.js", "../../../lib/workbench/path.ts", "../../../lib/model/components.ts", "../../../lib/model/hooks.ts", "../../../lib/model/module/bus.ts", "../../../lib/model/module/node.ts", "../../../lib/workbench/workspace.ts", "../../../lib/ui/menu.tsx", "../../../lib/ui/palette.tsx", "../../../lib/ui/node/editor.tsx", "../../../lib/view/empty.tsx", "../../../lib/ui/node/new.tsx", "../../../lib/view/list.tsx", "../../../lib/view/table.tsx", "../../../lib/view/views.ts", "../../../lib/ui/outline.tsx", "../../../lib/com/page.tsx", "../../../lib/ui/panel.tsx", "../../../lib/ui/quickadd.tsx", "../../../lib/ui/search.tsx", "../../../lib/ui/notices.tsx", "../../../lib/ui/app.tsx", "../../../lib/com/search.tsx", "../../../lib/com/checkbox.tsx", "../../../lib/com/textfield.tsx", "../../../lib/com/clock.tsx", "../../../lib/backend/browser.ts", "../../../lib/backend/github.ts", "../../../lib/mod.ts"], + "sourcesContent": ["\nconst isMac = (navigator.userAgent.toLowerCase().indexOf(\"mac\") !== -1);\n\nexport function bindingSymbols(key?: string): string[] {\n if (!key) return [];\n const symbols = {\n \"backspace\": \"\u232B\",\n \"shift\": \"\u21E7\",\n \"meta\": \"\u2318\",\n \"tab\": \"\u21B9\",\n \"ctrl\": \"\u2303\",\n \"arrowup\": \"\u2191\",\n \"arrowdown\": \"\u2193\",\n \"arrowleft\": \"\u2190\",\n \"arrowright\": \"\u2192\",\n \"enter\": \"\u23CE\"\n };\n const keys = key.toLowerCase().split(\"+\");\n return keys.map(filterKeyForNonMacMeta).map(k => (Object.keys(symbols).includes(k)) ? symbols[k] : k);\n}\n\n// if key is meta and not on a mac, change it to ctrl,\n// otherwise return the key as is\nfunction filterKeyForNonMacMeta(key: string): string {\n return (!isMac && key === \"meta\") ? \"ctrl\": key;\n}\n\nexport interface Binding {\n command: string;\n key: string;\n //when\n //args\n}\n\nexport class KeyBindings {\n bindings: Binding[];\n\n constructor() {\n this.bindings = [];\n }\n\n registerBinding(binding: Binding) {\n this.bindings.push(binding);\n }\n\n getBinding(commandId: string): Binding|null {\n for (const b of this.bindings) {\n if (b.command === commandId) {\n return b;\n }\n }\n return null;\n }\n\n evaluateEvent(event: KeyboardEvent): Binding|null {\n bindings: for (const b of this.bindings) {\n let modifiers = b.key.toLowerCase().split(\"+\");\n let key = modifiers.pop();\n if (key !== event.key.toLowerCase()) {\n continue;\n }\n for (const checkMod of [\"shift\", \"ctrl\", \"alt\", \"meta\"]) {\n let hasMod = modifiers.includes(checkMod);\n if (!isMac) {\n if (checkMod === \"meta\") continue;\n if (checkMod === \"ctrl\") {\n hasMod = modifiers.includes(\"meta\") || modifiers.includes(\"ctrl\");\n }\n }\n // @ts-ignore\n const modState = event[`${filterKeyForNonMacMeta(checkMod)}Key`];\n if (!modState && hasMod) {\n continue bindings;\n }\n if (modState && !hasMod) {\n continue bindings;\n }\n }\n return b;\n }\n return null;\n }\n}", "\nexport interface Command {\n id: string;\n title?: string;\n category?: string;\n icon?: string;\n action: Function;\n}\n\nexport class CommandRegistry {\n commands: {[index: string]: Command}\n\n constructor() {\n this.commands = {};\n }\n\n registerCommand(cmd: Command) {\n this.commands[cmd.id] = cmd;\n }\n\n executeCommand(id: string, ...rest: any): Promise {\n return new Promise((resolve) => {\n const ret = this.commands[id].action(...rest);\n resolve(ret);\n });\n }\n}", "\nexport interface MenuItem {\n command: string;\n //alt?: string;\n when?: Function;\n title?: Function;\n onclick?: Function;\n disabled?: boolean;\n //group\n //submenu\n}\n\nexport class MenuRegistry {\n menus: {[index: string]: MenuItem[]};\n\n constructor() {\n this.menus = {};\n }\n\n registerMenu(id: string, items: MenuItem[]) {\n this.menus[id] = items;\n }\n}", "import { Backend } from \"../backend/mod.ts\";\nimport { KeyBindings } from \"../action/keybinds.ts\";\nimport { CommandRegistry } from \"../action/commands.ts\";\nimport { MenuRegistry } from \"../action/menus.ts\";\nimport { Node } from \"../model/mod.ts\";\nimport { objectHas, objectCall } from \"../model/hooks.ts\";\n\nimport { Workspace, Context, Path } from \"./mod.ts\";\n\n/**\n * Workbench is the top-level controller for the Treehouse frontend.\n * \n * It manages the user action registries, open panels, open workspace,\n * user context, and provides an API used by UI components to \n * trigger various pop-overs, work with quick add, or anything else\n * not provided by the backend or workspace.\n */\nexport class Workbench {\n commands: CommandRegistry;\n keybindings: KeyBindings;\n menus: MenuRegistry;\n\n backend: Backend;\n workspace: Workspace;\n \n context: Context;\n panels: Path[];\n\n menu: any;\n notice: any;\n palette: any;\n quickadd: any;\n curtain: any;\n\n constructor(backend: Backend) {\n this.commands = new CommandRegistry();\n this.keybindings = new KeyBindings();\n this.menus = new MenuRegistry();\n\n this.backend = backend;\n this.workspace = new Workspace(backend.files);\n\n this.context = {node: null};\n this.panels = [];\n \n }\n\n get mainPanel(): Path {\n return this.panels[0];\n }\n\n async initialize() {\n await this.workspace.load();\n\n this.workspace.rawNodes.forEach(n => this.backend.index.index(n));\n this.workspace.observe((n => {\n this.workspace.save();\n if (n.isDestroyed) {\n this.backend.index.remove(n.id);\n } else {\n this.backend.index.index(n.raw);\n n.components.forEach(com => this.backend.index.index(com.raw));\n }\n }));\n\n \n if (this.workspace.lastOpenedID) {\n this.openNewPanel(this.workspace.find(this.workspace.lastOpenedID) || this.workspace.mainNode());\n } else {\n this.openNewPanel(this.workspace.mainNode());\n }\n\n if (this.backend.loadExtensions) {\n await this.backend.loadExtensions();\n }\n \n m.redraw();\n\n // todo: move this out to the demo\n if (!localStorage.getItem(\"firsttime\")) {\n this.showNotice('firsttime');\n }\n \n }\n\n authenticated(): boolean {\n return this.backend.auth && this.backend.auth.currentUser();\n }\n\n closeQuickAdd() {\n this.quickadd = null;\n m.redraw();\n }\n\n openQuickAdd() {\n let node = this.workspace.find(\"@quickadd\");\n if (!node) {\n node = this.workspace.new(\"@quickadd\");\n }\n this.quickadd = node;\n }\n\n commitQuickAdd() {\n const node = this.workspace.find(\"@quickadd\");\n if (!node) return;\n const today = this.todayNode();\n node.children.forEach(n => n.parent = today);\n }\n\n clearQuickAdd() {\n const node = this.workspace.find(\"@quickadd\");\n if (!node) return;\n node.children.forEach(n => n.destroy());\n }\n\n // TODO: goto workspace\n todayNode(): Node {\n const today = new Date();\n const dayNode = today.toUTCString().split(today.getFullYear())[0];\n const weekNode = `Week ${String(getWeekOfYear(today)).padStart(2, \"0\")}`;\n const yearNode = `${today.getFullYear()}`;\n const todayPath = [\"@workspace\", \"Calendar\", yearNode, weekNode, dayNode].join(\"/\");\n let todayNode = this.workspace.find(todayPath);\n if (!todayNode) {\n todayNode = this.workspace.new(todayPath);\n }\n return todayNode;\n }\n\n openToday() {\n this.open(this.todayNode());\n }\n\n open(n: Node) {\n // TODO: not sure this is still necessary\n if (!this.workspace.expanded[n.id]) {\n this.workspace.expanded[n.id] = {};\n }\n\n this.workspace.lastOpenedID = n.id;\n this.workspace.save();\n const p = new Path(n);\n this.panels[0] = p\n this.context.path = p;\n }\n\n openNewPanel(n: Node) {\n // TODO: not sure this is still necessary\n if (!this.workspace.expanded[n.id]) {\n this.workspace.expanded[n.id] = {};\n }\n\n this.workspace.lastOpenedID = n.id;\n this.workspace.save();\n const p = new Path(n);\n this.panels.push(p);\n this.context.path = p;\n }\n\n closePanel(panel: Path) {\n this.panels = this.panels.filter(p => p.name !== panel.name);\n }\n\n defocus() {\n this.context.node = null;\n }\n\n focus(path: Path, pos?: number = 0) {\n const input = this.getInput(path);\n if (input) {\n this.context.path = path;\n input.focus();\n if (pos !== undefined) {\n input.setSelectionRange(pos,pos);\n }\n } else {\n console.warn(\"unable to find input for\", path);\n }\n }\n\n getInput(path: Path): HTMLElement {\n let id = `input-${path.id}-${path.node.id}`;\n // kludge:\n if (path.node.raw.Rel === \"Fields\") {\n id = id+\"-value\"; \n }\n return document.getElementById(id);\n }\n\n executeCommand(id: string, ctx: any, ...rest: any): Promise {\n ctx = this.newContext(ctx);\n console.log(id, ctx, ...rest);\n return this.commands.executeCommand(id, this.newContext(ctx), ...rest);\n }\n\n newContext(ctx: any): Context {\n return Object.assign({}, this.context, ctx);\n }\n\n showMenu(event: Event, ctx: any) {\n event.stopPropagation();\n event.preventDefault();\n const trigger = event.target.closest(\"*[data-menu]\");\n const rect = trigger.getBoundingClientRect();\n const align = trigger.dataset[\"align\"] || \"left\";\n let x = document.body.scrollLeft+rect.x;\n if (align === \"right\") {\n x = document.body.offsetWidth - rect.right;\n }\n const y = document.body.scrollTop+rect.y+rect.height;\n const items = this.menus.menus[trigger.dataset[\"menu\"]];\n const cmds = items.filter(i => i.command).map(i => this.commands.commands[i.command]);\n if (!items) return;\n this.menu = {x, y, \n ctx: this.newContext(ctx), \n items: items,\n commands: cmds,\n align: align\n };\n this.curtain = {\n visible: false,\n onclick: () => this.hideMenu()\n }\n m.redraw();\n }\n\n hideMenu() {\n this.menu = null;\n this.curtain = null;\n m.redraw();\n }\n\n showPalette(x: number, y: number, ctx: Context) {\n this.palette = {x, y, ctx: ctx};\n this.curtain = {\n visible: false,\n onclick: () => this.hidePalette()\n }\n m.redraw();\n }\n\n hidePalette() {\n this.palette = null;\n this.curtain = null;\n m.redraw();\n }\n\n showNotice(message, finished) {\n this.notice = {message, finished};\n m.redraw();\n }\n\n hideNotice() {\n this.notice = null;\n m.redraw();\n }\n\n\n}\n\n\nfunction getWeekOfYear(date) {\n var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));\n var dayNum = d.getUTCDay() || 7;\n d.setUTCDate(d.getUTCDate() + 4 - dayNum);\n var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));\n return Math.ceil((((d - yearStart) / 86400000) + 1)/7);\n}", "\n/**\n* Secure Hash Algorithm (SHA1)\n* http://www.webtoolkit.info/\n**/\nexport function SHA1(msg) {\n function rotate_left(n,s) {\n var t4 = ( n<>>(32-s));\n return t4;\n };\n function lsb_hex(val) {\n var str='';\n var i;\n var vh;\n var vl;\n for( i=0; i<=6; i+=2 ) {\n vh = (val>>>(i*4+4))&0x0f;\n vl = (val>>>(i*4))&0x0f;\n str += vh.toString(16) + vl.toString(16);\n }\n return str;\n };\n function cvt_hex(val) {\n var str='';\n var i;\n var v;\n for( i=7; i>=0; i-- ) {\n v = (val>>>(i*4))&0x0f;\n str += v.toString(16);\n }\n return str;\n };\n function Utf8Encode(string) {\n string = string.replace(/\\r\\n/g,'\\n');\n var utftext = '';\n for (var n = 0; n < string.length; n++) {\n var c = string.charCodeAt(n);\n if (c < 128) {\n utftext += String.fromCharCode(c);\n }\n else if((c > 127) && (c < 2048)) {\n utftext += String.fromCharCode((c >> 6) | 192);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n else {\n utftext += String.fromCharCode((c >> 12) | 224);\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n }\n return utftext;\n };\n var blockstart;\n var i, j;\n var W = new Array(80);\n var H0 = 0x67452301;\n var H1 = 0xEFCDAB89;\n var H2 = 0x98BADCFE;\n var H3 = 0x10325476;\n var H4 = 0xC3D2E1F0;\n var A, B, C, D, E;\n var temp;\n msg = Utf8Encode(msg);\n var msg_len = msg.length;\n var word_array = new Array();\n for( i=0; i>>29 );\n word_array.push( (msg_len<<3)&0x0ffffffff );\n for ( blockstart=0; blockstart n.id)].join(\":\"));\n }\n\n get node(): Node {\n return this.nodes[this.nodes.length-1];\n }\n\n get previous(): Node|null {\n if (this.nodes.length < 2) return null;\n return this.nodes[this.nodes.length-2];\n }\n\n get head(): Node {\n return this.nodes[0];\n }\n}\n\n", "/**\n * Components are classes that can be used for component values in component nodes.\n * These classes need to be registered so they can be properly \"hydrated\" from \n * marshaled form (usually JSON) back into class instances.\n * \n * @module\n */\n\nconst registry: Record = {};\n\nexport function component(target: any) {\n registry[componentName(target)] = target;\n}\n\nexport function componentName(target: any): string {\n if (target.prototype === undefined) {\n target = target.constructor;\n }\n return `treehouse.${target.name}`;\n}\n\nexport function getComponent(com: any): any {\n if (typeof com === \"string\") {\n return registry[com];\n }\n return registry[componentName(com)];\n}\n\nexport function inflateToComponent(com: any, obj: any): any {\n const o = new (getComponent(com));\n if (o[\"fromJSON\"] instanceof Function) {\n o.fromJSON(obj);\n } else {\n Object.defineProperties(o, Object.getOwnPropertyDescriptors(obj));\n }\n return o;\n}", "/**\n * Hooks are single method interfaces implemented by component values. There are\n * some system hook interfaces defined here as well as utilities for working with\n * system and app hooks.\n * \n * @module\n */\nimport { Node } from \"./mod.ts\";\n\n// triggered on parent set or import (if has parent), or addcomponent\nexport interface AttachListener {\n onAttach(node: Node): void;\n}\n\n// called on accessing children\nexport interface ChildProvider {\n objectChildren(node: Node, children: Node[]): Node[];\n}\n\nexport function hasHook(node: Node, hook: string): boolean {\n return node.value && node.value[hook] instanceof Function;\n}\n\nexport function triggerHook(node: Node, hook: string, ...args: any[]): any {\n if (hasHook(node, hook)) {\n return node.value[hook].apply(node.value, args);\n }\n}\n\nexport function objectHas(obj: Node, hook: string): boolean {\n for (const com of obj.components) {\n if (hasHook(com, hook)) return true;\n }\n return false;\n}\n\nexport function objectCall(obj: Node, hook: string, ...args: any[]): any {\n for (const com of obj.components) {\n if (hasHook(com, hook)) {\n return com.value[hook].apply(com.value, args);\n }\n }\n}", "import { RawNode, Node as INode, Bus as IBus, WalkFunc, ObserverFunc, WalkOptions } from \"../mod.ts\";\nimport { componentName, getComponent, inflateToComponent } from \"../components.ts\";\nimport { triggerHook, hasHook } from \"../hooks.ts\";\nimport { Node } from \"./mod.ts\";\n\nexport class Bus {\n nodes: Record;\n observers: ObserverFunc[];\n\n constructor() {\n this.nodes = {\"@root\": {\n ID: \"@root\",\n Name: \"@root\",\n Linked: {Children: [], Components: []},\n Attrs: {}\n }};\n this.observers = [];\n }\n\n changed(n: INode) {\n this.observers.forEach(cb => cb(n));\n }\n\n /* Bus interface */\n\n import(nodes: RawNode[]) {\n for (const n of nodes) {\n if (n.Value && getComponent(n.Name)) {\n n.Value = inflateToComponent(n.Name, n.Value);\n n.Rel = \"Components\"; // kludge\n }\n this.nodes[n.ID] = n;\n }\n for (const n of nodes) {\n // clear stored tmp nodes\n if (n.Parent === \"@tmp\") {\n delete this.nodes[n.ID];\n continue;\n }\n // clear nodes with no parent that aren't system\n if (!n.ID.startsWith(\"@\") && n.Parent === undefined) {\n delete this.nodes[n.ID];\n continue;\n }\n // clear nodes with non-existant parent\n if (n.Parent && !this.nodes[n.Parent]) {\n delete this.nodes[n.ID];\n continue;\n }\n const node = this.find(n.ID);\n if (node) {\n // check orphan\n if (node.parent && !node.parent.raw) {\n delete this.nodes[n.ID];\n continue;\n }\n // trigger attach\n triggerHook(node, \"onAttach\", node);\n }\n }\n }\n\n export(): RawNode[] {\n const nodes: RawNode[] = [];\n for (const n of Object.values(this.nodes)) {\n nodes.push(n);\n }\n return nodes;\n }\n\n make(name: string, value?: any): INode {\n let parent: INode|null = null;\n if (name.includes(\"/\")) {\n const parts = name.split(\"/\");\n parent = this.find(parts[0]);\n for (let i = 1; i < parts.length-1; i++) {\n if (parent === null) {\n throw \"unable to get root\";\n }\n \n let child = parent.find(parts[i]);\n if (!child) {\n child = this.make(parts.slice(0, i+1).join(\"/\"));\n }\n parent = child;\n }\n name = parts[parts.length-1];\n }\n const id = (name.startsWith(\"@\"))?name:uniqueId();\n this.nodes[id] = {\n ID: id,\n Name: name,\n Value: value,\n Linked: {Children: [], Components: []},\n Attrs: {}\n };\n const node = new Node(this, id);\n if (parent) {\n node.parent = parent;\n }\n return node;\n }\n\n // destroys node but not linked nodes\n destroy(n: INode) {\n const p = n.parent;\n if (p !== null && !p.isDestroyed) {\n let rel = n.raw.Rel || \"Children\";\n if (p.raw.Linked[rel].includes(n.id)) {\n p.raw.Linked[rel].splice(n.siblingIndex, 1);\n }\n }\n delete this.nodes[n.id];\n if (p) {\n this.changed(p);\n }\n }\n\n roots(): INode[] {\n return Object.values(this.nodes).filter(n => n.Parent === undefined).map(n => new Node(this, n.ID));\n }\n\n root(name?: string): INode|null {\n name = name || \"@root\"\n const node = this.roots().find(root => root.name === name);\n if (node === undefined) return null;\n return node;\n }\n\n find(path:string): INode|null {\n const byId = this.nodes[path];\n if (byId) return new Node(this, byId.ID);\n const parts = path.split(\"/\");\n if (parts.length === 1 && parts[0].startsWith(\"@\")) {\n // did not find @id by ID so return null\n return null;\n }\n let cur = this.root(parts[0]);\n if (!cur && this.nodes[parts[0]]) {\n cur = new Node(this, this.nodes[parts[0]].ID);\n }\n if (cur) {\n parts.shift();\n } else {\n cur = this.root(\"@root\"); \n }\n if (!cur) {\n return null;\n }\n const findChild = (n: INode, name: string): INode|undefined => {\n if (n.refTo) {\n n = n.refTo;\n }\n return n.children.find(child => child.name === name);\n }\n for (const name of parts) {\n const child = findChild(cur, name);\n if (!child) return null;\n cur = child;\n }\n return cur;\n }\n\n walk(fn: WalkFunc, opts?: WalkOptions) {\n for (const root of this.roots()) {\n if (root.walk(fn, opts)) return;\n }\n }\n\n observe(fn: ObserverFunc) {\n this.observers.push(fn);\n }\n}\n\nconst uniqueId = () => {\n const dateString = Date.now().toString(36);\n const randomness = Math.random().toString(36).substring(2);\n return dateString + randomness;\n};\n", "import { RawNode, Node as INode, Bus as IBus, WalkFunc, WalkOptions } from \"../mod.ts\";\nimport { componentName } from \"../components.ts\";\nimport { triggerHook, hasHook } from \"../hooks.ts\";\nimport { Bus } from \"./mod.ts\";\n\nexport class Node {\n _id: string;\n _bus: Bus;\n\n constructor(bus: Bus, id: string) {\n this._bus = bus;\n this._id = id;\n }\n\n [Symbol.for(\"Deno.customInspect\")]() {\n return `Node[${this.id}:${this.name}]`;\n }\n\n /* Node interface */\n\n get id(): string {\n return this._id;\n }\n\n get bus(): IBus {\n return this._bus;\n }\n\n get raw(): RawNode {\n const raw = this._bus.nodes[this.id];\n if (!raw) throw `use of non-existent node ${this.id}`;\n return raw;\n }\n\n\n get name(): string {\n if (this.refTo) {\n return this.refTo.name;\n }\n return this.raw.Name;\n }\n\n set name(val: string) {\n if (this.refTo) {\n this.refTo.name = val;\n } else {\n this.raw.Name = val;\n }\n this.changed();\n }\n\n get value(): any {\n if (this.refTo) {\n return this.refTo.value;\n }\n return this.raw.Value;\n }\n\n set value(val: string) {\n if (this.refTo) {\n this.refTo.value = val;\n } else {\n this.raw.Value = val;\n }\n this.changed();\n }\n\n get parent(): INode|null {\n if (!this.raw.Parent) return null;\n if (!this._bus.nodes[this.raw.Parent]) return null;\n return new Node(this._bus, this.raw.Parent);\n }\n\n set parent(n: INode|null) {\n const p = this.parent;\n if (p !== null) {\n p.raw.Linked.Children.splice(this.siblingIndex, 1);\n }\n if (n !== null) {\n this.raw.Parent = n.id;\n n.raw.Linked.Children.push(this.id);\n triggerHook(n, \"onAttach\", n);\n } else {\n this.raw.Parent = undefined;\n }\n this.changed();\n }\n\n get refTo(): INode|null {\n const id = this.raw.Attrs[\"refTo\"];\n if (!id) return null;\n const refTo = this._bus.nodes[id];\n if (!refTo) return null;\n return new Node(this._bus, id);\n }\n\n set refTo(n: INode|null) {\n if (!n) {\n delete this.raw.Attrs[\"refTo\"];\n this.changed();\n return;\n }\n this.raw.Attrs[\"refTo\"] = n.id;\n this.changed();\n }\n\n get siblingIndex(): number {\n const p = this.parent;\n if (p === null) return 0;\n let rel = this.raw.Rel || \"Children\";\n return p.raw.Linked[rel].findIndex(id => id === this.id);\n }\n\n set siblingIndex(i: number) {\n const p = this.parent;\n if (p === null) return;\n let rel = this.raw.Rel || \"Children\";\n p.raw.Linked[rel].splice(this.siblingIndex, 1);\n p.raw.Linked[rel].splice(i, 0, this.id);\n p.changed();\n }\n\n get prevSibling(): INode|null {\n const p = this.parent;\n if (p === null) return null;\n if (this.siblingIndex === 0) return null;\n let rel = this.raw.Rel || \"Children\";\n return p.getLinked(rel)[this.siblingIndex-1];\n }\n\n get nextSibling(): INode|null {\n const p = this.parent;\n if (p === null) return null;\n if (this.siblingIndex === p.children.length-1) return null;\n let rel = this.raw.Rel || \"Children\";\n return p.getLinked(rel)[this.siblingIndex+1];\n }\n\n get ancestors(): INode[] {\n const anc = [];\n let p = this.parent;\n while (p !== null) {\n anc.push(p);\n p = p.parent;\n }\n return anc;\n }\n\n get isDestroyed(): boolean {\n return !this._bus.nodes.hasOwnProperty(this.id);\n }\n\n get path(): string {\n let cur: INode|null = this;\n const path = [];\n while (cur) {\n path.unshift(cur.name);\n cur = cur.parent;\n }\n return path.join(\"/\");\n }\n\n get children(): INode[] {\n if (this.refTo) return this.refTo.children;\n let children: INode[] = [];\n if (this.raw.Linked.Children) {\n children = this.raw.Linked.Children.map(id => new Node(this._bus, id));\n };\n for (const com of this.components) {\n if (hasHook(com, \"objectChildren\")) {\n return triggerHook(com, \"objectChildren\", this, children);\n }\n }\n return children;\n }\n\n get childCount(): number {\n if (this.refTo) return this.refTo.childCount;\n for (const com of this.components) {\n if (hasHook(com, \"objectChildren\")) {\n return triggerHook(com, \"objectChildren\", this, null).length;\n }\n }\n if (!this.raw.Linked.Children) return 0;\n return this.raw.Linked.Children.length;\n }\n\n addChild(node: INode) {\n if (this.refTo) {\n this.refTo.addChild(node);\n return;\n }\n this.raw.Linked.Children.push(node.id);\n this.changed();\n } \n\n removeChild(node: INode) {\n if (this.refTo) {\n this.refTo.removeChild(node);\n return;\n }\n const children = this.raw.Linked.Children.filter(id => id === node.id);\n this.raw.Linked.Children = children;\n this.changed();\n }\n\n\n get components(): INode[] {\n if (!this.raw.Linked.Components) return [];\n return this.raw.Linked.Components.map(id => new Node(this._bus, id));\n }\n\n get componentCount(): number {\n if (!this.raw.Linked.Components) return 0;\n return this.raw.Linked.Components.length;\n }\n\n addComponent(obj: any) {\n const node = this.bus.make(componentName(obj), obj);\n node.raw.Parent = this.id;\n node.raw.Rel = \"Components\" // kludge\n this.raw.Linked.Components.push(node.id);\n triggerHook(node, \"onAttach\", node);\n this.changed();\n } \n\n removeComponent(type: any) {\n const coms = this.components.filter(n => n.name === componentName(type));\n if (coms.length > 0) {\n coms[0].destroy();\n }\n this.changed();\n }\n \n hasComponent(type: any): boolean {\n const coms = this.components.filter(n => n.name === componentName(type));\n if (coms.length > 0) {\n return true;\n }\n return false;\n }\n\n getComponent(type: any): any|null {\n const coms = this.components.filter(n => n.name === componentName(type));\n if (coms.length > 0) {\n return coms[0].value;\n }\n return null;\n }\n // getComponentsInChildren\n // getComponentsInParents\n\n getLinked(rel: string): INode[] {\n if (!this.raw.Linked[rel]) return [];\n return this.raw.Linked[rel].map(id => new Node(this._bus, id));\n }\n\n addLinked(rel: string, node: INode) {\n if (!this.raw.Linked[rel]) {\n this.raw.Linked[rel] = [];\n }\n node.raw.Rel = rel; // kludge\n this.raw.Linked[rel].push(node.id);\n this.changed();\n } \n\n removeLinked(rel: string, node: INode) {\n if (!this.raw.Linked[rel]) {\n this.raw.Linked[rel] = [];\n }\n const linked = this.raw.Linked[rel].filter(id => id === node.id);\n this.raw.Linked[rel] = linked;\n this.changed();\n }\n\n moveLinked(rel: string, node: INode, idx: number) {\n if (!this.raw.Linked[rel]) {\n this.raw.Linked[rel] = [];\n }\n const oldIdx = this.raw.Linked[rel].findIndex(id => id === node.id);\n if (oldIdx === -1) return;\n const linked = this.raw.Linked[rel];\n linked.splice(idx, 0, linked.splice(oldIdx, 1)[0]);\n this.raw.Linked[rel] = linked;\n this.changed();\n }\n\n getAttr(name: string): string {\n return this.raw.Attrs[name] || \"\";\n }\n\n setAttr(name: string, value: string) {\n this.raw.Attrs[name] = value;\n this.changed();\n }\n\n find(path: string): INode|null {\n return this.bus.find([this.path, path].join(\"/\"));\n }\n\n walk(fn: WalkFunc, opts?: WalkOptions): boolean {\n opts = opts || {\n followRefs: false,\n includeComponents: false\n };\n if (fn(this)) {\n return true;\n }\n let children = this.children;\n if (this.refTo && opts.followRefs) {\n if (fn(this.refTo)) {\n return true;\n }\n children = this.refTo.children;\n }\n for (const child of children) {\n if (child.walk(fn, opts)) return true;\n }\n if (opts.includeComponents) {\n for (const com of this.components) {\n if (com.walk(fn, opts)) return true;\n }\n }\n return false;\n }\n\n destroy() {\n if (this.isDestroyed) return;\n if (this.refTo) {\n this._bus.destroy(this);\n return;\n }\n const nodes: INode[] = [];\n this.walk((n: INode): boolean => {\n nodes.push(n);\n return false;\n }, {\n followRefs: false,\n includeComponents: true\n });\n nodes.reverse().forEach(n => this._bus.destroy(n));\n }\n\n changed() {\n this._bus.changed(this);\n }\n \n // duplicate?\n}\n", "import { FileStore } from \"../backend/mod.ts\";\nimport { Bus, Node, RawNode } from \"../model/mod.ts\";\nimport { Path } from \"./mod.ts\";\nimport * as module from \"../model/module/mod.ts\";\n\n\n/**\n * Workspace is a container for nodes and manages marshaling them using\n * the FileStore backend API. It also keeps track of what nodes have been\n * expanded and what node was last opened. It serializes as JSON with a\n * version indicator and will handle migrations of old versions to the \n * latest when loading. Saving is currently debounced here so this applies\n * to all backends. \n */\nexport class Workspace {\n fs: FileStore;\n bus: Bus;\n\n lastOpenedID: string;\n expanded: { [key: string]: { [key: string]: boolean } }; // [rootid][id]\n\n constructor(fs: FileStore) {\n this.fs = fs;\n this.bus = new module.Bus();\n this.expanded = {};\n\n this.writeDebounce = debounce(async (path, contents) => {\n try {\n await this.fs.writeFile(path, contents);\n console.log(\"Saved workspace.\");\n } catch (e: Error) {\n console.error(e);\n document.dispatchEvent(new CustomEvent(\"BackendError\"));\n }\n });\n }\n\n get rawNodes(): RawNode[] {\n return this.bus.export();\n }\n\n observe(fn: (n: Node) => void) {\n this.bus.observe(fn);\n }\n\n save() {\n this.writeDebounce(\"workspace.json\", JSON.stringify({\n version: 1,\n lastopen: this.lastOpenedID,\n expanded: this.expanded,\n nodes: this.rawNodes\n }, null, 2));\n }\n\n async load() {\n let doc = JSON.parse(await this.fs.readFile(\"workspace.json\") || \"{}\");\n if (Array.isArray(doc)) {\n doc = {\n version: 0,\n nodes: doc\n }\n }\n if (doc.nodes) {\n this.bus.import(doc.nodes);\n console.log(`Loaded ${doc.nodes.length} nodes.`);\n }\n if (doc.expanded) {\n // Only import the node keys that still exist\n // in the workspace.\n for (const n in doc.expanded) {\n for (const i in doc.expanded[n]) {\n if (this.bus.find(i)) {\n if (!this.expanded[n]) this.expanded[n] = {};\n this.expanded[n][i] = doc.expanded[n][i];\n }\n }\n }\n }\n if (doc.lastopen) {\n this.lastOpenedID = doc.lastopen;\n }\n\n }\n\n mainNode(): Node {\n let main = this.bus.find(\"@workspace\");\n if (!main) {\n console.info(\"Building missing workspace node.\")\n const root = this.bus.find(\"@root\");\n const ws = this.bus.make(\"@workspace\");\n ws.name = \"Workspace\";\n ws.parent = root;\n const cal = this.bus.make(\"@calendar\");\n cal.name = \"Calendar\";\n cal.parent = ws;\n const home = this.bus.make(\"Home\");\n home.parent = ws;\n main = ws;\n }\n return main;\n }\n\n find(path: string): Node | null {\n return this.bus.find(path)\n }\n\n new(name: string, value?: any): Node {\n return this.bus.make(name, value);\n }\n\n // TODO: take single Path\n getExpanded(head: Node, n: Node): boolean {\n if (!this.expanded[head.id]) {\n this.expanded[head.id] = {};\n }\n let expanded = this.expanded[head.id][n.id];\n if (expanded === undefined) {\n expanded = false;\n }\n return expanded;\n }\n\n // TODO: take single Path\n setExpanded(head: Node, n: Node, b: boolean) {\n this.expanded[head.id][n.id] = b;\n this.save();\n }\n\n findAbove(path: Path): Path | null {\n if (path.node.id === path.head.id) {\n return null;\n }\n const p = path.clone();\n p.pop(); // pop to parent\n let prev = path.node.prevSibling;\n if (!prev) {\n // if not a field and parent has fields, return last field\n const fieldCount = path.previous.getLinked(\"Fields\").length;\n if (path.node.raw.Rel !== \"Fields\" && fieldCount > 0) {\n return p.append(path.previous.getLinked(\"Fields\")[fieldCount - 1]);\n }\n // if no prev sibling, and no fields, return parent\n return p;\n }\n const lastSubIfExpanded = (p: Path): Path => {\n const expanded = this.getExpanded(path.head, p.node);\n if (!expanded) {\n // if not expanded, return input path\n return p;\n }\n const fieldCount = p.node.getLinked(\"Fields\").length;\n if (p.node.childCount === 0 && fieldCount > 0) {\n const lastField = p.node.getLinked(\"Fields\")[fieldCount - 1];\n // if expanded, no children, has fields, return last field or its last sub if expanded\n return lastSubIfExpanded(p.append(lastField));\n }\n const lastChild = p.node.children[p.node.childCount - 1];\n // return last child or its last sub if expanded\n return lastSubIfExpanded(p.append(lastChild));\n }\n // return prev sibling or its last child if expanded\n return lastSubIfExpanded(p.append(prev));\n }\n\n findBelow(path: Path): Path | null {\n // TODO: find a way to indicate pseudo \"new\" node for expanded leaf nodes\n const p = path.clone();\n if (this.getExpanded(path.head, path.node) && path.node.getLinked(\"Fields\").length > 0) {\n // if expanded and fields, return first field\n return p.append(path.node.getLinked(\"Fields\")[0]);\n }\n if (this.getExpanded(path.head, path.node) && path.node.childCount > 0) {\n // if expanded and children, return first child\n return p.append(path.node.children[0]);\n }\n const nextSiblingOrParentNextSibling = (p: Path): Path | null => {\n const next = p.node.nextSibling;\n if (next) {\n p.pop(); // pop to parent\n // if next sibling, return that\n return p.append(next);\n }\n const parent = p.previous;\n if (!parent) {\n // if no parent, return null\n return null;\n }\n if (p.node.raw.Rel === \"Fields\" && parent.childCount > 0) {\n p.pop(); // pop to parent\n // if field and parent has children, return first child\n return p.append(parent.children[0]);\n }\n p.pop(); // pop to parent\n // return parents next sibling or parents parents next sibling\n return nextSiblingOrParentNextSibling(p);\n }\n // return next sibling or parents next sibling\n return nextSiblingOrParentNextSibling(p);\n }\n\n}\n\n\nfunction debounce(func, timeout = 3000) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => { func.apply(this, args); }, timeout);\n };\n}\n", "import { bindingSymbols } from \"../action/keybinds.ts\";\n\nexport const Menu: m.Component = {\n view({attrs: {workbench, x, y, items, align, commands, ctx}}) {\n const onclick = (item, cmd) => (e) => {\n e.stopPropagation();\n if (item.disabled) {\n return;\n }\n if (item.onclick) {\n item.onclick();\n }\n if (cmd) {\n workbench.executeCommand(cmd.id, ctx);\n }\n workbench.hideMenu();\n };\n let posStyle = {left: `${x}px`};\n if (align === \"right\") {\n posStyle = {right: `${x}px`};\n }\n return (\n
    \n {items.filter(i => !i.when || i.when()).map(i => {\n let title = \"\";\n let binding = undefined;\n let cmd = undefined;\n if (i.command) {\n cmd = commands.find(c => c.id === i.command);\n binding = workbench.keybindings.getBinding(cmd.id);\n title = cmd.title;\n }\n if (i.title) {\n title = i.title();\n }\n return (\n
  • \n
    {title}
    \n {binding &&
    {bindingSymbols(binding.key).join(\" \").toUpperCase()}
    }\n
  • \n )\n })}\n
\n ) \n }\n};\n\n/*
  • Indent
    shift+A
  • \n
  • Open in new panel
    shift+meta+Backspace
  • \n
    \n
  • Show list view
  • \n
  • Move
  • \n
  • Delete node
  • \n
    */\n", "\nexport const CommandPalette: m.Component = {\n onupdate({ state, dom }) {\n const children = dom.querySelector(\".commands\").children;\n if (state.selected !== undefined && children.length > 0) {\n children[state.selected].scrollIntoView({ block: \"nearest\" });\n }\n },\n\n oncreate({ state, dom }) {\n dom.querySelector(\"input\").focus();\n if (state.selected === undefined) {\n state.selected = 0;\n }\n },\n\n view({ attrs, state }) {\n const workbench = attrs.workbench;\n state.filter = (state.filter === undefined) ? \"\" : state.filter;\n const cmds = Object.values(workbench.commands.commands);\n const filtered = cmds.filter(cmd => {\n const value = cmd.title || cmd.id;\n return value.toLowerCase().startsWith(state.filter.toLowerCase());\n })\n const onkeydown = (e) => {\n const mod = (a, b) => ((a % b) + b) % b;\n if (e.key === \"ArrowDown\") {\n if (state.selected === undefined) {\n state.selected = 0;\n return;\n }\n state.selected = mod(state.selected + 1, filtered.length);\n return false;\n }\n if (e.key === \"ArrowUp\") {\n if (state.selected === undefined) {\n state.selected = 0;\n }\n state.selected = mod(state.selected - 1, filtered.length);\n return false;\n }\n if (e.key === \"Enter\") {\n if (state.selected !== undefined) {\n workbench.commands.executeCommand(filtered[state.selected].id, attrs.ctx);\n workbench.hidePalette();\n }\n return false;\n }\n }\n const onclick = (cmd) => {\n workbench.commands.executeCommand(cmd.id, attrs.ctx);\n workbench.hidePalette();\n }\n const autocomplete = (e) => {\n state.filter = e.target.value;\n state.selected = 0;\n }\n return (\n
    \n
    \n
    \n {filtered.map((cmd, idx) =>
    onclick(cmd)}>{cmd.title || cmd.id}
    )}\n
    \n
    \n )\n }\n}\n", "import { objectCall, objectHas } from \"../../model/hooks.ts\";\n\nexport const NodeEditor: m.Component = {\n view ({attrs: {workbench, path, onkeydown, disallowEmpty, editValue}, state}) {\n const node = path.node;\n let prop = (editValue) ? \"value\" : \"name\";\n \n const display = () => {\n if (prop === \"name\") {\n return objectHas(node, \"displayName\") ? objectCall(node, \"displayName\", node) : node.name;\n }\n return node[prop] || \"\";\n }\n const onfocus = () => {\n state.initialValue = node[prop];\n workbench.context.node = node;\n workbench.context.path = path;\n }\n const getter = () => {\n return node[prop];\n }\n const setter = (v, finished) => {\n if (!node.isDestroyed) {\n if (disallowEmpty && v.length === 0) {\n node[prop] = state.initialValue;\n } else {\n node[prop] = v;\n }\n }\n if (finished) {\n workbench.context.node = null;\n }\n }\n\n let placeholder;\n if (node.raw.Rel === \"Fields\") {\n placeholder = (editValue) ? \"Value\" : \"Field\";\n }\n \n let id = `input-${path.id}-${node.id}`;\n if (prop === \"value\") {\n id = id+\"-value\";\n }\n return m(TextEditor, {id, getter, setter, display, onkeydown, onfocus, placeholder});\n }\n}\n\n\ninterface Attrs {\n id?: string;\n onkeydown?: Function;\n onfocus?: Function;\n onblur?: Function;\n onmount?: Function;\n getter: Function;\n setter: Function;\n display?: Function;\n}\n\ninterface State {\n editing: boolean;\n buffer: string;\n}\n\nexport const TextEditor: m.Component = {\n oncreate({dom,attrs}) {\n const textarea = dom.querySelector(\"textarea\");\n const initialHeight = textarea.offsetHeight;\n const span = dom.querySelector(\"span\");\n this.updateHeight = () => {\n span.style.width = `${Math.max(textarea.offsetWidth, 100)}px`;\n span.innerHTML = textarea.value.replace(\"\\n\", \"
    \");\n textarea.style.height = (span.offsetHeight > 0) ? `${span.offsetHeight}px` : `${initialHeight}px`;\n }\n textarea.addEventListener(\"input\", () => this.updateHeight());\n textarea.addEventListener(\"blur\", () => span.innerHTML = \"\");\n setTimeout(() => this.updateHeight(), 50);\n if (attrs.onmount) attrs.onmount(textarea);\n },\n onupdate() {\n this.updateHeight();\n },\n view ({attrs: {id, onkeydown, onfocus, onblur, getter, setter, display, placeholder}, state}) {\n const value = (state.editing) \n ? state.buffer \n : (display) ? display() : getter();\n \n const defaultKeydown = (e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n const startEdit = (e) => {\n if (onfocus) onfocus(e);\n state.editing = true;\n state.buffer = getter();\n }\n const finishEdit = (e) => {\n // safari can trigger blur more than once\n // for a given element, namely when clicking\n // into devtools. this prevents the second \n // blur setting node name to undefined/empty.\n if (state.editing) {\n state.editing = false;\n setter(state.buffer, true);\n state.buffer = undefined;\n }\n if (onblur) onblur(e);\n }\n const edit = (e) => {\n state.buffer = e.target.value;\n setter(state.buffer, false);\n }\n \n // TODO: node-container => text-editor\n return (\n
    \n {value}\n \n
    \n )\n }\n}", "import { NewNode } from \"../ui/node/new.tsx\";\nimport { OutlineNode } from \"../ui/outline.tsx\";\n\nexport default {\n view({attrs: {node, workbench, panel}}) {\n return (\n
    \n
    \n )\n }\n}", "\nexport const NewNode = {\n view({attrs: {workbench, path}}) {\n const startNew = (e) => {\n workbench.executeCommand(\"insert-child\", {node: path.node, path}, e.target.value);\n }\n const tabNew = (e) => {\n if (e.key === \"Tab\") {\n e.stopPropagation();\n e.preventDefault();\n if (node.childCount > 0) {\n const lastchild = path.node.children[path.node.childCount-1];\n workbench.executeCommand(\"insert-child\", {node: lastchild, path});\n }\n }\n }\n return (\n
    \n \n \n \n \n
    \n \n
    \n
    \n )\n }\n}", "import { NewNode } from \"../ui/node/new.tsx\";\nimport { OutlineNode } from \"../ui/outline.tsx\";\n\nexport default {\n view({attrs: {workbench, path}}) {\n let node = path.node;\n if (path.node.refTo) {\n node = path.node.refTo;\n }\n return (\n
    \n
    \n {(node.getLinked(\"Fields\").length > 0) &&\n node.getLinked(\"Fields\").map(n => )\n }\n
    \n
    \n {(node.childCount > 0)\n ?node.children.map(n => )\n :\n }\n
    \n
    \n )\n }\n}", "import { NodeEditor, TextEditor } from \"../ui/node/editor.tsx\";\nimport { OutlineNode } from \"../ui/outline.tsx\";\n\nexport default {\n view({attrs: {workbench, path}, state}) {\n const node = path.node;\n state.fields = (state.fields === undefined) ? new Set() : state.fields;\n node.children.forEach(n => {\n n.getLinked(\"Fields\").forEach(f => state.fields.add(f.name));\n });\n const getFieldEditor = (node, field) => {\n const fields = node.getLinked(\"Fields\").filter(f => f.name === field);\n if (fields.length === 0) return \"\";\n return \n }\n return (\n \n \n \n \n {[...state.fields].map(f => )}\n \n \n \n {node.children.map(n => (\n \n \n {[...state.fields].map(f => )}\n \n ))}\n \n
    {f}
    {getFieldEditor(n, f)}
    \n )\n }\n}", "import empty from \"./empty.tsx\";\nimport list from \"./list.tsx\";\nimport table from \"./table.tsx\";\n\nexport const views = {\n list,\n table\n}\n\nexport function getView(name) {\n return views[name] || empty;\n}\n\nwindow.registerView = (name, view) => {\n views[name] = view;\n workbench.commands.registerCommand({\n id: `view-${name}`,\n title: `View as ${toTitleCase(name)}`,\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.setAttr(\"view\", name);\n }\n });\n}\n\nfunction toTitleCase(str) {\n return str.replace(\n /\\w\\S*/g,\n function(txt) {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n }\n );\n}", "\nimport { Workbench, Path } from \"../workbench/mod.ts\";\nimport { objectCall, objectHas } from \"../model/hooks.ts\";\nimport { NewNode } from \"./node/new.tsx\";\nimport { NodeEditor } from \"./node/editor.tsx\";\n\nimport { Checkbox } from \"../com/checkbox.tsx\";\nimport { Clock } from \"../com/clock.tsx\";\nimport { getView } from \"../view/views.ts\";\n\ninterface Attrs {\n path: Path;\n workbench: Workbench;\n}\n\ninterface State {\n hover: boolean;\n editing: boolean;\n buffer?: string;\n}\n\nexport const OutlineEditor: m.Component = {\n view ({attrs: {workbench, path}}) {\n return m(getView(path.node.getAttr(\"view\")||\"list\"), {workbench, path});\n }\n}\n\n// handles: expanded state, node menu+handle, children\nexport const OutlineNode: m.Component = {\n view ({attrs, state, children}) {\n let {path, workbench} = attrs;\n let node = path.node;\n\n let isRef = false;\n let handleNode = node;\n if (node.refTo) {\n isRef = true;\n node = handleNode.refTo;\n }\n\n const expanded = workbench.workspace.getExpanded(path.head, handleNode); \n\n const hover = (e) => {\n state.hover = true;\n e.stopPropagation();\n }\n \n const unhover = (e) => {\n state.hover = false;\n e.stopPropagation();\n }\n \n const toggle = (e) => {\n if (expanded) {\n workbench.executeCommand(\"collapse\", {node: handleNode, path});\n } else {\n workbench.executeCommand(\"expand\", {node: handleNode, path});\n }\n e.stopPropagation();\n }\n \n const checkCommands = (e) => {\n const anyModifiers = e.shiftKey || e.metaKey || e.altKey || e.ctrlKey;\n switch (e.key) {\n case \"ArrowUp\":\n if (e.target.selectionStart !== 0 && !anyModifiers) {\n e.stopPropagation()\n }\n break;\n case \"ArrowDown\":\n if (e.target.selectionStart !== e.target.value.length && e.target.selectionStart !== 0 && !anyModifiers) {\n e.stopPropagation()\n }\n break;\n case \"Backspace\":\n // cursor at beginning of empty text\n if (e.target.value === \"\") {\n e.preventDefault();\n e.stopPropagation();\n if (node.childCount > 0) {\n return;\n }\n workbench.executeCommand(\"delete\", {node, path, event: e});\n return;\n }\n // cursor at beginning of non-empty text\n if (e.target.value !== \"\" && e.target.selectionStart === 0 && e.target.selectionEnd === 0) {\n e.preventDefault();\n e.stopPropagation();\n \n // TODO: make this work as a command?\n const above = workbench.workspace.findAbove(path);\n if (!above) {\n return;\n }\n const oldName = above.node.name;\n above.node.name = oldName+e.target.value;\n node.destroy();\n m.redraw.sync();\n workbench.focus(above, oldName.length);\n \n return;\n }\n break;\n case \"Enter\":\n e.preventDefault();\n if (e.ctrlKey || e.shiftKey || e.metaKey || e.altKey) return;\n // cursor at end of text\n if (e.target.selectionStart === e.target.value.length) {\n if (node.childCount > 0 && workbench.workspace.getExpanded(path.head, node)) {\n workbench.executeCommand(\"insert-child\", {node, path}, \"\", 0);\n } else {\n workbench.executeCommand(\"insert\", {node, path});\n }\n e.stopPropagation();\n return;\n }\n // cursor at beginning of text\n if (e.target.selectionStart === 0) {\n workbench.executeCommand(\"insert-before\", {node, path});\n e.stopPropagation();\n return;\n }\n // cursor in middle of text\n if (e.target.selectionStart > 0 && e.target.selectionStart < e.target.value.length) {\n workbench.executeCommand(\"insert\", {node, path}, e.target.value.slice(e.target.selectionStart)).then(() => {\n node.name = e.target.value.slice(0, e.target.selectionStart);\n });\n e.stopPropagation();\n return;\n }\n break;\n }\n }\n\n const open = (e) => {\n e.preventDefault();\n e.stopPropagation();\n \n workbench.executeCommand(\"open\", {node, path});\n \n // clear text selection that happens after from double click\n if (document.selection && document.selection.empty) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n }\n\n const subCount = (n) => {\n return n.childCount + n.getLinked(\"Fields\").length;\n }\n\n const showHandle = () => {\n if (node.id === workbench.context?.node?.id || state.hover) {\n return true;\n }\n return node.name.length > 0;\n }\n\n return (\n
    \n
    \n workbench.showMenu(e, {node: handleNode, path})}\n oncontextmenu={(e) => workbench.showMenu(e, {node: handleNode, path})} \n data-menu=\"node\"\n viewBox=\"0 0 16 16\">\n {state.hover && }\n \n
    workbench.showMenu(e, {node: handleNode, path})} data-menu=\"node\" style={{ display: showHandle() ? 'block' : 'none' }}>\n {(objectHas(node, \"handleIcon\"))\n ? objectCall(node, \"handleIcon\")\n : \n {(subCount(node) > 0 && !expanded)?:null}\n ,\n {(isRef)?:null}\n \n }\n
    \n {(node.raw.Rel === \"Fields\") \n ?
    \n
    \n \n
    \n \n
    \n :
    \n {objectHas(node, \"beforeEditor\") && m(objectCall(node, \"beforeEditor\"), {node})}\n \n {objectHas(node, \"afterEditor\") && m(objectCall(node, \"afterEditor\"), {node})}\n
    \n }\n
    \n {objectHas(node, \"belowEditor\") && m(objectCall(node, \"belowEditor\"), {node})}\n {(expanded === true) &&\n
    \n
    \n
    \n {m(getView(node.getAttr(\"view\")||\"list\"), {workbench, path})}\n
    \n
    \n }\n
    \n )\n }\n};\n\n\n\n\n\n\n\n", "import { component } from \"../model/components.ts\";\nimport { Node } from \"../model/mod.ts\";\n\n@component\nexport class Page {\n markdown: string;\n\n constructor() {\n this.markdown = \"\";\n }\n}\n", "import { OutlineEditor } from \"./outline.tsx\";\nimport { NodeEditor } from \"./node/editor.tsx\";\nimport { Page } from \"../com/page.tsx\";\n\nexport const Panel = {\n view({ attrs }) {\n const path = attrs.path;\n const workbench = attrs.workbench;\n const node = path.node;\n\n const close = (e) => {\n workbench.executeCommand(\"close-panel\", {}, path);\n }\n const goBack = (e) => {\n path.pop();\n }\n const maximize = (e) => {\n // todo: should be a command\n workbench.panels = [path];\n workbench.context.path = path;\n }\n const editMarkdown = (e) => {\n node.getComponent(Page).markdown = e.target.value;\n node.changed();\n }\n function calcHeight(value = \"\") {\n let numberOfLineBreaks = (value.match(/\\n/g) || []).length;\n // min-height + lines x line-height + padding + border\n let newHeight = 20 + numberOfLineBreaks * 20;\n return newHeight;\n }\n return
    \n
    \n {(path.length > 1) ?\n
    \n \n \n \n
    \n : null}\n\n
    \n {(node.parent && node.parent.id !== \"@root\") ? workbench.open(node.parent)}>{node.parent.name} :  }\n
    \n\n {(workbench.panels.length > 1) ?\n
    \n \n \n
    \n : null}\n
    \n\n
    \n
    workbench.showMenu(e, { node, path })} data-menu=\"node\">\n \n
    \n {(node.hasComponent(Page)) ?\n \n : null}\n \n
    \n
    \n }\n};\n", "import { OutlineEditor } from \"./outline.tsx\";\nimport { Path } from \"../workbench/mod.ts\";\n\nexport const QuickAdd = {\n view({attrs: {workbench}}) {\n const path = new Path(workbench.quickadd, \"quickadd\");\n return (\n
    \n \n
    workbench.closeQuickAdd()} style={{\n position: \"absolute\",\n background: \"black\",\n opacity: \"50%\",\n width: \"100%\",\n height: \"100%\"\n }}>
    \n \n
    \n

    Quick Add

    \n \n
    \n \n \n
    \n
    \n
    \n )\n }\n}", "\nexport const Search: m.Component = {\n onupdate({state,dom}) {\n const results = dom.querySelector(\".results\");\n if (results && state.selected !== undefined && results.children.length > 0) {\n results.children[state.selected].scrollIntoView({block: \"nearest\"});\n }\n },\n\n view({attrs: {workbench}, state}) {\n \n state.query = (state.query === undefined) ? \"\" : state.query;\n state.results = (state.results === undefined) ? [] : state.results;\n\n const clear = () => {\n state.query = \"\";\n state.results = [];\n workbench.curtain = null;\n }\n\n const open = (node) => {\n workbench.open(node);\n clear();\n }\n \n const onkeydown = (e) => {\n const mod = (a,b) => ((a % b) + b) % b;\n if (e.key === \"ArrowDown\") {\n if (state.selected === undefined) {\n state.selected = 0;\n return;\n }\n state.selected = mod(state.selected+1, state.results.length);\n return false;\n }\n if (e.key === \"ArrowUp\") {\n if (state.selected === undefined) {\n state.selected = 0;\n }\n state.selected = mod(state.selected-1, state.results.length);\n return false;\n }\n if (e.key === \"Enter\") {\n if (state.selected !== undefined) {\n open(state.results[state.selected]);\n }\n return false;\n }\n if (e.key === \"Escape\") {\n clear();\n }\n }\n\n const autocomplete = (e) => {\n state.query = e.target.value;\n state.selected = 0;\n\n if (state.query) {\n let splitQuery = state.query.split(/[ ]+/);\n let textQuery = splitQuery.filter(term => !term.includes(\":\")).join(\" \");\n let fieldQuery = Object.fromEntries(splitQuery.filter(term => term.includes(\":\")).map(term => term.toLowerCase().split(\":\")));\n if (!textQuery && Object.keys(fieldQuery).length > 0) {\n // when text query is empty, no results will show up,\n // but we index field names, so this works for now.\n textQuery = Object.keys(fieldQuery)[0];\n }\n state.results = workbench.backend.index.search(textQuery).map(id => {\n let node = workbench.workspace.find(id);\n if (!node) {\n return undefined;\n }\n // if component value, get the parent\n if (node.value) {\n node = node.parent;\n // parent might not actually exist\n if (!node.raw) return undefined;\n }\n // kludgy filter on fields\n if (Object.keys(fieldQuery).length > 0) {\n const fields = {};\n for (const f of node.getLinked(\"Fields\")) {\n fields[f.name.toLowerCase()] = f.value.toLowerCase();\n }\n for (const f in fieldQuery) {\n if (!fields[f] || fields[f] !== fieldQuery[f]) {\n return undefined;\n }\n }\n }\n return node;\n }).filter(n => n !== undefined);\n } else {\n state.results = [];\n }\n\n if (state.query && state.results.length > 0) {\n workbench.curtain = {\n visible: false,\n onclick: () => clear()\n };\n } else {\n workbench.curtain = null;\n }\n \n }\n\n\n\n return (\n
    0)?\"search active flex grow\":\"search flex grow\"}>\n
    \n
    0)?\"0\":\"1px\"}}>\n \n \n
    \n {(state.results.length > 0)?\n
    \n {state.results.map((result, idx) =>
    open(result)} class={(state.selected===idx)?\"selected\":\"\"}>{result.name}
    )}\n
    \n :null}\n
    \n
    \n )\n }\n}\n", "\nexport const LockStolenMessage = {\n view({attrs: {workbench, finished}}) {\n return (\n
    \n

    Refresh to view latest updates

    \n

    \n Your notes were updated in another browser session. Refresh the page to view the latest version.\n

    \n
    \n \n \n
    \n
    \n )\n }\n}\n\nexport const FirstTimeMessage = {\n view({attrs: {workbench}}) {\n return (\n
    \n

    Treehouse is under active development

    \n

    This is a preview based on our main branch, which is actively being developed.

    \n

    If you find a bug, please report it via \n [ \n \n > Submit Issue ].\n

    \n

    \n Data is stored using localstorage, which you can reset via \n [ \n \n > Reset Demo ].\n

    \n
    \n \n \n
    \n
    \n )\n }\n}\n\nexport const GitHubMessage = {\n view({attrs: {workbench, finished}}) {\n return (\n
    \n

    Login with GitHub

    \n

    The GitHub backend is experimental so use at your own risk!

    \n

    To store your workbench we will create a public repository called

    <username>.treehouse.sh
    if it doesn't already exist. You can manually make this repository private via GitHub if you want.

    \n

    You can Logout via the \n \n \n \n menu in the top right to return to the localstorage backend.\n

    \n
    \n \n \n
    \n
    \n )\n }\n}\n\nexport const Notice = {\n view({attrs: {workbench, message, finished}}) {\n return (\n
    \n \n
    \n \n
    \n {m({\n \"firsttime\": FirstTimeMessage,\n \"github\": GitHubMessage,\n \"lockstolen\": LockStolenMessage,\n }[message], {workbench, finished})}\n
    \n
    \n )\n }\n}", "import { Menu } from \"./menu.tsx\";\nimport { CommandPalette } from \"./palette.tsx\";\nimport { Panel as PanelComponent } from \"./panel.tsx\";\nimport { QuickAdd } from \"./quickadd.tsx\";\nimport { Search } from \"./search.tsx\";\nimport { Notice } from \"./notices.tsx\";\n\nexport const App: m.Component = {\n view ({attrs: {workbench}, state}) {\n state.open = (state.open === undefined) ? true : state.open;\n const toggle = (e) => {\n if (state.open) {\n state.open = false;\n } else {\n state.open = true;\n }\n }\n return (\n
    \n
    \n
    \n \n
    \n
    \n {state.open && workbench.workspace.bus.root().children.map(node => )}\n
    \n
    \n \n
    \n
    \n
    \n
    \n
    workbench.openToday()} style={{cursor: \"pointer\", marginLeft: \"var(--padding)\", marginRight: \"var(--padding)\", display: \"flex\", alignItems: \"center\"}}>\n \n \n {/* {(new Date()).getDate()} */}\n \n
    Today
    \n
    \n
    workbench.openQuickAdd()} style={{cursor: \"pointer\", marginLeft: \"var(--padding)\", marginRight: \"var(--padding)\", display: \"flex\", alignItems: \"center\"}}>\n \n
    Quick Add
    \n
    \n\n \n \n
    workbench.showMenu(e)} data-menu=\"settings\" data-align=\"right\" style={{cursor: \"pointer\", marginLeft: \"var(--padding)\", marginRight: \"var(--padding)\"}}>\n \n
    \n
    \n
    \n {workbench.panels.map(path =>
    )}\n
    \n
    \n \n {workbench.curtain && \n
    }\n {workbench.menu && }\n {workbench.palette && }\n {workbench.quickadd && }\n {workbench.notice && }\n
    \n )\n }\n};\n\nconst NavNode: m.Component = {\n view ({attrs: {node, workbench, expanded, level}, state}) {\n state.expanded = (state.expanded === undefined) ? expanded : state.expanded;\n const expandable = (node.childCount > 0 && level < 3);\n const toggle = (e) => {\n if (!expandable) return;\n if (state.expanded) {\n state.expanded = false;\n } else {\n state.expanded = true;\n }\n e.stopPropagation();\n }\n const open = (e) => {\n workbench.open(node);\n }\n return (\n
    \n
    \n \n {(expandable)\n ?(state.expanded)\n ? \n : \n :null}\n \n \n
    \n {node.name}\n
    \n
    \n {state.expanded && \n
    \n {node.children.filter(n => n.name !== \"\").map(n => )}\n
    \n }\n
    \n )\n }\n};\n", "import { SearchIndex } from \"../backend/mod.ts\";\nimport { component } from \"../model/components.ts\";\nimport { Node } from \"../model/mod.ts\";\n\nfunction debounce(func, timeout = 1000){\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => { func.apply(this, args); }, timeout);\n };\n}\n\n@component\nexport class SearchNode {\n index: SearchIndex;\n component?: Node;\n object?: Node;\n results?: Node[];\n\n lastQuery?: string;\n lastResultCount?: number;\n\n constructor() {\n this.index = window.workbench.backend.index;\n this.searchDebounce = debounce(this.search.bind(this));\n }\n\n handleIcon(): any {\n return \n }\n\n displayName(node: Node): any {\n return `Search for \"${node.name}\"`;\n }\n\n onAttach(node: Node) {\n this.component = node;\n this.object = node.parent;\n node.bus.observe((n: Node) => {\n if (!node.isDestroyed) {\n this.searchDebounce();\n }\n })\n }\n\n search() {\n console.log(\"searched\");\n if (!this.object) return;\n\n let query = this.object.name;\n let splitQuery = query.split(/[ ]+/);\n let textQuery = splitQuery.filter(term => !term.includes(\":\")).join(\" \");\n let fieldQuery = Object.fromEntries(splitQuery.filter(term => term.includes(\":\")).map(term => term.toLowerCase().split(\":\")));\n if (!textQuery && Object.keys(fieldQuery).length > 0) {\n // when text query is empty, no results will show up,\n // but we index field names, so this works for now.\n textQuery = Object.keys(fieldQuery)[0];\n }\n const results = this.index.search(textQuery)\n .map(id => {\n let node = window.workbench.workspace.find(id);\n if (!node) {\n return undefined;\n }\n // if component/field value, get the parent\n if (node.value) {\n node = node.parent;\n // parent might not actually exist\n if (!node.raw) return undefined;\n }\n // kludgy filter on fields\n if (Object.keys(fieldQuery).length > 0) {\n const fields = {};\n for (const f of node.getLinked(\"Fields\")) {\n fields[f.name.toLowerCase()] = f.value.toLowerCase();\n }\n for (const f in fieldQuery) {\n if (!fields[f] || fields[f] !== fieldQuery[f]) {\n return undefined;\n }\n }\n }\n return node;\n })\n .filter(n => n !== undefined)\n .filter(n => n.id !== this.object.id && n.id !== this.component.id);\n if (results.length !== this.lastResultCount || query !== this.lastQuery) {\n if (this.results) {\n // clean up old results\n this.results.forEach((n) => n.destroy());\n }\n this.results = results.map(n => {\n const ref = this.object.bus.make(\"\");\n ref.raw.Parent = \"@tmp\"; // cleaned up next import\n ref.refTo = n;\n return ref;\n });\n this.lastQuery = query;\n this.lastResultCount = results.length;\n }\n }\n\n objectChildren(node: Node, children: Node[]): Node[] {\n if (!this.results) this.search();\n return this.results;\n }\n\n toJSON(key: string): any {\n return {};\n }\n\n fromJSON(obj: any) {\n //console.log(\"fromJson\");\n }\n}", "import { component } from \"../model/components.ts\";\nimport { Node } from \"../model/mod.ts\";\n\n@component\nexport class Checkbox {\n checked: boolean;\n\n constructor() {\n this.checked = false;\n }\n\n beforeEditor() {\n return CheckboxEditor;\n }\n}\n\nconst CheckboxEditor = {\n view({attrs: {node}}) {\n const toggleCheckbox = (e) => {\n const checkbox = node.getComponent(Checkbox);\n checkbox.checked = !checkbox.checked;\n node.changed();\n }\n return \n }\n}", "import { component } from \"../model/components.ts\";\nimport { Node } from \"../model/mod.ts\";\n\n@component\nexport class TextField {\n constructor() {\n \n }\n\n handleIcon(): any {\n return \n }\n}", "import { component } from \"../model/components.ts\";\nimport { Node } from \"../model/mod.ts\";\nimport { Workbench, Context } from \"../workbench/mod.ts\";\n\n@component\nexport class Clock {\n startedAt?: Date;\n log: Date[][];\n showLog: boolean;\n\n component?: Node;\n object?: Node;\n\n constructor() {\n this.log = [];\n this.showLog = false;\n }\n\n onAttach(node: Node) {\n this.component = node;\n this.object = node.parent;\n }\n\n\n fromJSON(obj: any) {\n if (obj.startedAt) {\n this.startedAt = new Date(obj.startedAt);\n }\n this.log = (obj.log||[]).map(entry => [new Date(entry[0]), new Date(entry[1])]);\n this.showLog = obj.showLog;\n }\n\n toJSON(key: string): any {\n return {\n startedAt: this.startedAt, \n log: this.log,\n showLog: this.showLog\n };\n }\n\n localTotal(): number {\n return this.log.map(this.entryDuration).reduce((acc, val) => acc+val, 0);\n }\n\n grandTotal(): number {\n let total = this.localTotal();\n if (this.object) {\n this.object.children.forEach(child => {\n if (child.hasComponent(Clock)) {\n total += child.getComponent(Clock).grandTotal();\n }\n });\n }\n return total;\n }\n\n start() {\n if (this.startedAt) return;\n this.startedAt = new Date();\n }\n\n stop() {\n if (!this.startedAt) return;\n let now = new Date();\n let diff = now.getTime() - this.startedAt.getTime();\n if (diff/1000 >= 60) {\n // only log if more than a minute\n this.log.push([this.startedAt, now]);\n }\n this.startedAt = undefined;\n }\n\n formatEntry(entry: Date[]): string {\n if (entry.length !== 2) return \"\";\n return `${this.formatDate(entry[0])} - ${new Intl.DateTimeFormat(\"en\", {\n timeStyle: \"short\",\n }).format(entry[1])}`;\n }\n\n // duration in seconds\n entryDuration(entry: Date[]): number {\n const a = entry[0];\n const b = entry[1] || new Date();\n return (b.getTime() - a.getTime()) / 1000;\n }\n\n formatDate(d?: Date): string {\n if (!d) {\n return \"\";\n }\n return new Intl.DateTimeFormat(\"en\", {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }).format(d);\n }\n\n formatDuration(seconds: number): string {\n let dur = seconds / 60;\n let min = Math.floor(dur % 60);\n dur = dur / 60;\n let hrs = Math.floor(dur % 60);\n return `${hrs}:${min.toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping: false})}`;\n }\n\n afterEditor() {\n return ClockBadge;\n }\n\n belowEditor() {\n return ClockLog;\n }\n\n static initialize(workbench: Workbench) {\n\n workbench.commands.registerCommand({\n id: \"stop-clock\",\n title: \"Stop clock\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (!ctx.node.hasComponent(Clock)) {\n const clock = new Clock();\n ctx.node.addComponent(clock);\n }\n ctx.node.getComponent(Clock).stop();\n ctx.node.changed();\n }\n });\n workbench.keybindings.registerBinding({command: \"stop-clock\", key: \"meta+o\" });\n workbench.commands.registerCommand({\n id: \"start-clock\",\n title: \"Start clock\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (!ctx.node.hasComponent(Clock)) {\n const clock = new Clock();\n ctx.node.addComponent(clock);\n }\n ctx.node.getComponent(Clock).start();\n ctx.node.changed();\n }\n });\n workbench.keybindings.registerBinding({command: \"start-clock\", key: \"meta+i\" });\n workbench.commands.registerCommand({\n id: \"remove-clock\",\n title: \"Remove clock\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.removeComponent(Clock);\n }\n });\n }\n}\n\nconst ClockBadge = {\n view({attrs: {node}}) {\n const clock = node.getComponent(Clock);\n const toggleLog = () => {\n clock.showLog = !clock.showLog;\n node.changed();\n }\n if (!clock.showLog && clock.startedAt) {\n return (\n
    \n \n
    {clock.formatDuration(clock.entryDuration([clock.startedAt]))}
    \n
    \n )\n }\n return (\n
    \n \n
    {clock.formatDuration(clock.grandTotal())}
    \n
    \n )\n }\n}\n\nconst ClockLog = {\n view({attrs: {node}}) {\n const clock = node.getComponent(Clock);\n if (!clock.showLog) return;\n return (\n
    \n
    \n
    \n {clock.startedAt &&\n
    \n
    {clock.formatDate(clock.startedAt)} - ...
    \n
    \n \n
    {clock.formatDuration(clock.entryDuration([clock.startedAt]))}
    \n
    \n
    \n }\n {clock.log.toReversed().map(entry => (\n
    \n
    {clock.formatEntry(entry)}
    \n
    \n \n
    {clock.formatDuration(clock.entryDuration(entry))}
    \n
    \n
    \n ))}\n
    \n
    \n )\n }\n}", "import {RawNode} from \"../model/mod.ts\";\n\n\nexport class BrowserBackend {\n auth: null;\n index: SearchIndex;\n files: FileStore;\n\n constructor() {\n this.auth = null;\n this.files = new FileStore();\n if (window.MiniSearch) {\n this.index = new SearchIndex_MiniSearch();\n } else {\n this.index = new SearchIndex_Dumb();\n }\n }\n}\n\nexport class SearchIndex_MiniSearch {\n indexer: any; // MiniSearch\n\n constructor() {\n this.indexer = new MiniSearch({\n idField: \"ID\",\n fields: ['ID', 'Name', 'Value', 'Value.markdown'], // fields to index for full-text search\n storeFields: ['ID'], // fields to return with search results\n extractField: (document, fieldName) => {\n return fieldName.split('.').reduce((doc, key) => doc && doc[key], document);\n }\n });\n }\n\n index(node: RawNode) {\n if (this.indexer.has(node.ID)) {\n this.indexer.replace(node); \n } else {\n this.indexer.add(node);\n }\n }\n\n remove(id: string) {\n try {\n this.indexer.discard(id);\n } catch {}\n }\n\n search(query: string): string[] {\n const suggested = this.indexer.autoSuggest(query);\n if (suggested.length === 0) return [];\n return this.indexer.search(suggested[0].suggestion, {prefix: true}).map(doc => doc.ID);\n }\n}\n\n\nexport class SearchIndex_Dumb {\n nodes: Record;\n\n constructor() {\n this.nodes = {};\n }\n\n index(node: RawNode) {\n this.nodes[node.ID] = node.Name;\n }\n\n remove(id: string) {\n delete this.nodes[id];\n }\n\n search(query: string): string[] {\n const results: string[] = [];\n for (const id in this.nodes) {\n if (this.nodes[id].includes(query)) {\n results.push(id);\n }\n }\n return results;\n }\n}\n\n\n\nexport class FileStore {\n async readFile(path: string): string|null {\n return localStorage.getItem(`treehouse:${path}`);\n }\n\n async writeFile(path: string, contents: string) {\n localStorage.setItem(`treehouse:${path}`, contents);\n }\n}", "\nimport { Authenticator, SearchIndex, FileStore } from \"./mod.ts\";\nimport { BrowserBackend } from \"./browser.ts\";\nimport { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.7.5/base64.mjs';\n\nexport interface Options {\n domain: string; // domain used with username subdomain to produce repo name\n checkDomain: boolean; // redirect to user domain if it is not current location\n authFallbackURL?: string; // URL to redirect to if auth fails\n}\n\nexport class GitHubBackend {\n auth: Authenticator;\n\n index: SearchIndex;\n files: FileStore;\n\n loginURL: string;\n clientFactory: any; // Octokit class\n client: any; // Octokit instance\n user: User|null;\n shas: Record; // path => sha\n \n opts: Options;\n\n constructor(loginURL: string, octokit: any, opts?: Options) {\n this.loginURL = loginURL;\n this.clientFactory = octokit;\n this.auth = this;\n this.shas = {};\n\n this.opts = Object.assign({\n domain: \"treehouse.sh\",\n checkDomain: false,\n }, opts || {});\n\n const localbackend = new BrowserBackend();\n this.index = localbackend.index;\n this.files = localbackend.files;\n\n \n }\n\n get repo(): string {\n return `${this.user?.userID()}.${this.opts.domain}`;\n }\n\n async initialize() {\n // delegate authorize callback to loginURL\n const code = new URL(location.href).searchParams.get(\"code\");\n if (code) {\n try {\n // remove ?code=... from URL\n const querystring = location.search.replace(/\\bcode=\\w+/, \"\").replace(/\\?$/, \"\");\n history.pushState({}, \"\", `${location.pathname}${querystring}`);\n \n const response = await fetch(this.loginURL, {\n method: \"POST\",\n mode: \"cors\",\n headers: {\"content-type\": \"application/json\"},\n body: JSON.stringify({ code })\n });\n \n const result = await response.json();\n if (result.error) {\n throw result.error;\n }\n \n localStorage.setItem(\"treehouse:gh-token\", result.token);\n \n } catch (e: Error) {\n this.reset();\n console.error(e);\n return;\n }\n }\n\n // capture access token if provided directly\n const token = new URL(location.href).searchParams.get(\"access_token\");\n if (token) {\n try {\n // remove ?access_token=... from URL\n const querystring = location.search.replace(/\\baccess_token=\\w+/, \"\").replace(/\\?$/, \"\");\n history.pushState({}, \"\", `${location.pathname}${querystring}`);\n \n localStorage.setItem(\"treehouse:gh-token\", token);\n } catch (e: Error) {\n this.reset();\n console.error(e);\n return;\n }\n }\n\n try {\n await this.authenticate();\n if (!this.user) {\n throw \"authentication failed\";\n }\n } catch (e: Error) {\n console.error(e);\n if (this.opts.authFallbackURL) {\n location.href = this.opts.authFallbackURL;\n }\n return;\n }\n \n // check domain if set to\n if (this.opts.checkDomain && this.repo !== location.hostname) {\n location.hostname = this.repo;\n return;\n }\n\n // check if repo exists\n try {\n await this.client.rest.repos.get({\n owner: this.user.userID(), \n repo: this.repo\n });\n } catch (e: Error) {\n if (e.message !== \"Not Found\") {\n throw e;\n }\n // create if not\n console.log(\"Creating repository...\");\n const resp = await this.client.rest.repos.createForAuthenticatedUser({name: this.repo});\n if (resp.status !== 201) {\n console.error(resp);\n return;\n }\n }\n\n // check for workspace.json now\n try {\n await this.client.rest.repos.getContent({\n owner: this.user.userID(), \n repo: this.repo,\n path: \"workspace.json\"\n });\n } catch (e: Error) {\n if (e.name !== \"HttpError\") {\n throw e;\n }\n // create empty if not\n console.log(\"Creating workspace.json...\");\n const resp = await this.client.rest.repos.createOrUpdateFileContents({\n owner: this.user.userID(), \n repo: this.repo,\n path: \"workspace.json\", \n message: \"initial commit\", \n content: btoa(JSON.stringify([]))\n });\n if (resp.status !== 201) {\n console.error(resp);\n return;\n }\n }\n \n this.files = this;\n\n \n \n const sessID = uniqueID();\n await this.readFile(\"treehouse.lock\");\n await this.writeFile(\"treehouse.lock\", sessID);\n const lockCheck = setInterval(async () => {\n const lockFile = await this.readFile(\"treehouse.lock\");\n if (lockFile !== sessID) {\n clearInterval(lockCheck);\n document.dispatchEvent(new CustomEvent(\"BackendError\"));\n console.warn(\"lock stolen!\");\n }\n }, 5000);\n }\n\n async loadExtensions() {\n try {\n const dirCheck = await this.client.rest.repos.getContent({\n owner: this.user?.userID(), \n repo: this.repo, \n path: \"\",\n random: Math.random().toString(36).substring(2)\n });\n if (dirCheck.data.find(o => o.type === \"dir\" && o.name === \"ext\")) {\n const dirList = await this.client.rest.repos.getContent({\n owner: this.user?.userID(), \n repo: this.repo, \n path: \"ext\",\n random: Math.random().toString(36).substring(2)\n });\n for (const file of dirList.data) {\n if (file.name.endsWith(\".css\")) {\n // Load CSS \n const resp = await this.client.rest.repos.getContent({\n owner: this.user?.userID(), \n repo: this.repo, \n path: file.path,\n random: Math.random().toString(36).substring(2)\n });\n const css = document.createElement(\"link\");\n css.setAttribute(\"href\", `data:text/css;charset=utf-8;base64,${resp.data.content}`);\n css.setAttribute(\"rel\", \"stylesheet\");\n css.setAttribute(\"type\", \"text/css\");\n document.head.appendChild(css);\n } else if (file.name.endsWith(\".js\")) {\n // Load JavaScript\n const resp = await this.client.rest.repos.getContent({\n owner: this.user?.userID(), \n repo: this.repo, \n path: file.path,\n random: Math.random().toString(36).substring(2)\n });\n const js = document.createElement(\"script\");\n js.setAttribute(\"type\", \"module\");\n js.setAttribute(\"src\", `data:text/javascript;charset=utf-8;base64,${resp.data.content}`);\n document.head.appendChild(js);\n }\n }\n }\n \n } catch (e: Error) {}\n \n }\n \n async authenticate() {\n const token = localStorage.getItem(\"treehouse:gh-token\");\n if (!token) {\n return;\n }\n\n this.client = new this.clientFactory({auth: token});\n const resp = await this.client.rest.users.getAuthenticated();\n if (!resp || resp.error) {\n return;\n }\n this.user = new User(resp.data);\n\n if(m)m.redraw();\n }\n\n currentUser(): User|null {\n return this.user;\n }\n\n login() {\n location.assign(this.loginURL);\n }\n\n reset() {\n localStorage.removeItem(\"treehouse:gh-token\");\n this.user = null;\n\n if(m)m.redraw();\n }\n \n logout() {\n this.reset();\n location.reload();\n }\n\n\n async readFile(path: string): string|null {\n try {\n const resp = await this.client.rest.repos.getContent({\n owner: this.user?.userID(), \n repo: this.repo, \n path: path,\n random: Math.random().toString(36).substring(2)\n });\n this.shas[path] = resp.data.sha;\n return decode(resp.data.content);\n } catch (e: Error) {\n if (e.name !== \"HttpError\") {\n console.error(e);\n }\n return null;\n }\n }\n\n async writeFile(path: string, contents: string) {\n const resp = await this.client.rest.repos.createOrUpdateFileContents({\n owner: this.user?.userID(), \n repo: this.repo, \n path: path, \n message: \"autosave\", \n content: encode(contents), \n sha: this.shas[path]\n });\n this.shas[path] = resp.data.content.sha;\n }\n}\n\nexport class User {\n user: any; // github user object\n\n constructor(user: any) {\n this.user = user;\n }\n\n userID(): string {\n return this.user.login;\n }\n\n displayName(): string {\n return this.user.name;\n }\n\n avatarURL(): string {\n return this.user.avatar_url;\n }\n}\n\nfunction uniqueID() {\n const dateString = Date.now().toString(36);\n const randomness = Math.random().toString(36).substring(2);\n return dateString + randomness;\n};", "/**\n * A configurable, embeddable frontend for a graph/outline based note-taking tool.\n * \n * Treehouse can be embedded on a page and given a backend for a fully functional\n * SPA. The backend adapter provides hooks to integrate with various backends.\n * \n * Typical usage involves including resource dependencies on the page then running:\n * \n * ```ts\n * import {setup, BrowserBackend} from \"https://treehouse.sh/lib/treehouse.min.js\";\n * setup(document, document.body, new BrowserBackend());\n * ```\n * \n * In this case using the built-in BrowserBackend to store state in localStorage.\n * For more information see the [Quickstart Guide](https://treehouse.sh/docs/quickstart/).\n * \n * @module\n */\nimport { Path, Workbench } from \"./workbench/mod.ts\";\nimport { App } from \"./ui/app.tsx\";\nimport { Backend } from \"./backend/mod.ts\";\nimport { SearchNode } from \"./com/search.tsx\";\nimport { Checkbox } from \"./com/checkbox.tsx\";\nimport { Page } from \"./com/page.tsx\";\nimport { TextField } from \"./com/textfield.tsx\";\nimport { Clock } from \"./com/clock.tsx\";\n\nexport { BrowserBackend, SearchIndex_MiniSearch } from \"./backend/browser.ts\";\nexport { GitHubBackend } from \"./backend/github.ts\";\n\n\n/**\n * setup initializes and mounts a workbench UI with a given backend adapter to a document.\n * More specifically, first it initializes the given backend, then creates and initializes\n * a Workbench instance with that backend, then it mounts the App component to the given\n * target element. It will also add some event listeners to the document and currently\n * this is where it registers all the built-in commands and their keybindings, as well\n * as menus. \n */\nexport async function setup(document: Document, target: HTMLElement, backend: Backend) {\n if (backend.initialize) {\n await backend.initialize();\n }\n\n const workbench = new Workbench(backend);\n window.workbench = workbench;\n\n await workbench.initialize();\n\n // TODO: better way to initialize components? \n [\n Clock,\n TextField,\n Page,\n Checkbox,\n ].forEach(com => {\n if (com.initialize) {\n com.initialize(workbench);\n }\n });\n\n\n // pretty specific to github backend right now\n document.addEventListener(\"BackendError\", () => {\n workbench.showNotice(\"lockstolen\", () => {\n location.reload();\n });\n });\n\n workbench.commands.registerCommand({\n id: \"create-search\",\n title: \"Create Search Node\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const search = new SearchNode();\n ctx.node.addComponent(search);\n workbench.workspace.setExpanded(ctx.path.head, ctx.node, true);\n }\n });\n\n\n workbench.commands.registerCommand({\n id: \"view-list\",\n title: \"View as List\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.setAttr(\"view\", \"list\");\n }\n });\n\n workbench.commands.registerCommand({\n id: \"view-table\",\n title: \"View as Table\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.setAttr(\"view\", \"table\");\n }\n });\n\n\n workbench.commands.registerCommand({\n id: \"add-page\",\n title: \"Add page\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const page = new Page();\n ctx.node.addComponent(page);\n }\n });\n\n workbench.commands.registerCommand({\n id: \"remove-page\",\n title: \"Remove page\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.removeComponent(Page);\n }\n });\n\n workbench.commands.registerCommand({\n id: \"add-checkbox\",\n title: \"Add checkbox\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const checkbox = new Checkbox();\n ctx.node.addComponent(checkbox);\n }\n });\n\n workbench.commands.registerCommand({\n id: \"remove-checkbox\",\n title: \"Remove checkbox\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n ctx.node.removeComponent(Checkbox);\n }\n });\n\n workbench.commands.registerCommand({\n id: \"create-field\",\n title: \"Create Field\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (ctx.node.childCount > 0) return;\n if (ctx.node.componentCount > 0) return;\n const path = ctx.path.clone();\n path.pop(); // drop node\n const field = workbench.workspace.new(ctx.node.name, \"\");\n field.raw.Parent = ctx.node.parent.id;\n const text = new TextField();\n field.addComponent(text);\n ctx.node.parent.addLinked(\"Fields\", field);\n path.push(field);\n ctx.node.destroy();\n m.redraw.sync();\n workbench.focus(path);\n }\n });\n\n workbench.commands.registerCommand({\n id: \"mark-done\",\n title: \"Mark done\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (ctx.node.hasComponent(Checkbox)) {\n const checkbox = ctx.node.getComponent(Checkbox);\n if (!checkbox.checked) {\n checkbox.checked = true;\n ctx.node.changed();\n } else {\n ctx.node.removeComponent(Checkbox);\n }\n } else {\n const checkbox = new Checkbox();\n ctx.node.addComponent(checkbox);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"mark-done\", key: \"meta+enter\" });\n\n\n\n workbench.commands.registerCommand({\n id: \"expand\",\n title: \"Expand\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n workbench.workspace.setExpanded(ctx.path.head, ctx.node, true);\n m.redraw();\n }\n });\n workbench.keybindings.registerBinding({ command: \"expand\", key: \"meta+arrowdown\" });\n workbench.commands.registerCommand({\n id: \"collapse\",\n title: \"Collapse\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n workbench.workspace.setExpanded(ctx.path.head, ctx.node, false);\n m.redraw();\n }\n });\n workbench.keybindings.registerBinding({ command: \"collapse\", key: \"meta+arrowup\" });\n workbench.commands.registerCommand({\n id: \"indent\",\n title: \"Indent\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (ctx.node.raw.Rel === \"Fields\") return;\n const node = ctx.node; // redraw seems to unset ctx.node\n const path = ctx.path.clone();\n const prev = node.prevSibling;\n if (prev !== null) {\n path.pop(); // drop node\n path.push(prev);\n node.parent = prev;\n path.push(node);\n workbench.workspace.setExpanded(ctx.path.head, prev, true);\n m.redraw.sync();\n workbench.focus(path);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"indent\", key: \"tab\" });\n workbench.commands.registerCommand({\n id: \"outdent\",\n title: \"Outdent\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (ctx.node.raw.Rel === \"Fields\") return;\n const node = ctx.node; // redraw seems to unset ctx.node\n const parent = ctx.path.previous;\n const path = ctx.path.clone();\n if (parent !== null && parent.id !== \"@root\") {\n path.pop(); // drop node\n path.pop(); // drop parent\n node.parent = parent.parent;\n path.push(node);\n node.siblingIndex = parent.siblingIndex + 1;\n if (parent.childCount === 0) {\n workbench.workspace.setExpanded(ctx.path.head, parent, false);\n }\n m.redraw.sync();\n workbench.focus(path);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"outdent\", key: \"shift+tab\" });\n workbench.commands.registerCommand({\n id: \"move-up\",\n title: \"Move Up\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const node = ctx.node; // redraw seems to unset ctx.node\n const parent = node.parent;\n if (parent !== null && parent.id !== \"@root\") {\n const children = parent.childCount;\n if (node.siblingIndex === 0) {\n if (!parent.prevSibling) {\n return;\n }\n const p = ctx.path.clone();\n p.pop(); // drop node\n p.pop(); // drop parent\n const parentSib = parent.prevSibling;\n p.push(parentSib);\n p.push(node);\n node.parent = parentSib;\n node.siblingIndex = parentSib.childCount - 1;\n workbench.workspace.setExpanded(ctx.path.head, parentSib, true);\n m.redraw.sync();\n workbench.focus(p);\n } else {\n if (children === 1) {\n return;\n }\n node.siblingIndex = node.siblingIndex - 1;\n m.redraw.sync();\n }\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"move-up\", key: \"shift+meta+arrowup\" });\n workbench.commands.registerCommand({\n id: \"move-down\",\n title: \"Move Down\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const node = ctx.node; // redraw seems to unset ctx.node\n const parent = node.parent;\n if (parent !== null && parent.id !== \"@root\") {\n const children = parent.childCount;\n // if last child\n if (node.siblingIndex === children - 1) {\n if (!parent.nextSibling) {\n return;\n }\n const p = ctx.path.clone();\n p.pop(); // drop node\n p.pop(); // drop parent\n const parentSib = parent.nextSibling;\n p.push(parentSib);\n p.push(node);\n node.parent = parentSib;\n node.siblingIndex = 0;\n workbench.workspace.setExpanded(ctx.path.head, parentSib, true);\n m.redraw.sync();\n workbench.focus(p);\n } else {\n if (children === 1) {\n return;\n }\n node.siblingIndex = node.siblingIndex + 1;\n m.redraw.sync();\n }\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"move-down\", key: \"shift+meta+arrowdown\" });\n workbench.commands.registerCommand({\n id: \"insert-child\",\n title: \"Insert Child\",\n action: (ctx: Context, name: string = \"\", siblingIndex?: number) => {\n if (!ctx.node) return;\n const node = workbench.workspace.new(name);\n node.parent = ctx.node;\n if (siblingIndex !== undefined) {\n node.siblingIndex = siblingIndex;\n }\n workbench.workspace.setExpanded(ctx.path.head, ctx.node, true);\n m.redraw.sync();\n workbench.focus(ctx.path.append(node), name.length);\n }\n });\n workbench.commands.registerCommand({\n id: \"insert-before\",\n title: \"Insert Before\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const node = workbench.workspace.new(\"\");\n node.parent = ctx.node.parent;\n node.siblingIndex = ctx.node.siblingIndex;\n m.redraw.sync();\n const p = ctx.path.clone();\n p.pop();\n workbench.focus(p.append(node));\n }\n });\n workbench.commands.registerCommand({\n id: \"insert\",\n title: \"Insert Node\",\n action: (ctx: Context, name: string = \"\") => {\n if (!ctx.node) return;\n const node = workbench.workspace.new(name);\n node.parent = ctx.node.parent;\n node.siblingIndex = ctx.node.siblingIndex + 1;\n m.redraw.sync();\n const p = ctx.path.clone();\n p.pop();\n workbench.focus(p.append(node));\n }\n });\n workbench.keybindings.registerBinding({ command: \"insert\", key: \"shift+enter\" });\n workbench.commands.registerCommand({\n id: \"create-reference\",\n title: \"Create Reference\",\n action: (ctx: Context) => {\n // TODO: prevent creating reference to reference\n if (!ctx.node) return;\n const node = workbench.workspace.new(\"\");\n node.parent = ctx.node.parent;\n node.siblingIndex = ctx.node.siblingIndex + 1;\n node.refTo = ctx.node;\n m.redraw.sync();\n const p = ctx.path.clone();\n p.pop();\n workbench.focus(p.append(node));\n }\n });\n workbench.commands.registerCommand({\n id: \"delete\",\n title: \"Delete node\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n if (ctx.node.id.startsWith(\"@\")) return;\n const above = workbench.workspace.findAbove(ctx.path);\n ctx.node.destroy();\n m.redraw.sync();\n if (above) {\n let pos = 0;\n if (ctx.event && ctx.event.key === \"Backspace\") {\n pos = above.node.name.length;\n }\n if (above.node.childCount === 0) {\n // TODO: use subCount\n workbench.workspace.setExpanded(ctx.path.head, above.node, false);\n }\n workbench.focus(above, pos);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"delete\", key: \"shift+meta+backspace\" });\n workbench.commands.registerCommand({\n id: \"prev\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const above = workbench.workspace.findAbove(ctx.path);\n if (above) {\n workbench.focus(above);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"prev\", key: \"arrowup\" });\n workbench.commands.registerCommand({\n id: \"next\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n const below = workbench.workspace.findBelow(ctx.path);\n if (below) {\n workbench.focus(below);\n }\n }\n });\n workbench.keybindings.registerBinding({ command: \"next\", key: \"arrowdown\" });\n workbench.commands.registerCommand({\n id: \"pick-command\",\n action: (ctx: Context) => {\n let node = ctx.node;\n let path = ctx.path;\n let posBelow = false;\n if (!node) {\n node = ctx.path.head;\n path = new Path(ctx.path.head, ctx.path.name);\n posBelow = true;\n }\n const trigger = workbench.getInput(path);\n const rect = trigger.getBoundingClientRect();\n let x = document.body.scrollLeft + rect.x + (trigger.selectionStart * 10) + 20;\n let y = document.body.scrollTop + rect.y - 8;\n if (posBelow) {\n x = document.body.scrollLeft + rect.x;\n y = document.body.scrollTop + rect.y + rect.height;\n }\n workbench.showPalette(x, y, workbench.newContext({ node }));\n }\n });\n workbench.keybindings.registerBinding({ command: \"pick-command\", key: \"meta+k\" });\n workbench.commands.registerCommand({\n id: \"new-panel\",\n title: \"Open in New Panel\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n workbench.openNewPanel(ctx.node);\n m.redraw();\n }\n });\n workbench.commands.registerCommand({\n id: \"close-panel\",\n title: \"Close Panel\",\n action: (ctx: Context, panel?: Path) => {\n workbench.closePanel(panel || ctx.path);\n workbench.context.path = workbench.mainPanel;\n m.redraw();\n }\n });\n workbench.commands.registerCommand({\n id: \"zoom\",\n title: \"Open\",\n action: (ctx: Context) => {\n workbench.workspace.lastOpenedID = ctx.node.id;\n workbench.workspace.save();\n workbench.context.path = ctx.path.append(ctx.node);\n workbench.panels[0] = workbench.context.path;\n m.redraw();\n }\n });\n workbench.commands.registerCommand({\n id: \"generate-random\",\n title: \"Generate Random Children\",\n action: (ctx: Context) => {\n if (!ctx.node) return;\n [...Array(100)].forEach(() => {\n const node = workbench.workspace.new(generateName(8));\n node.parent = ctx.node;\n });\n }\n });\n\n\n workbench.menus.registerMenu(\"node\", [\n { command: \"zoom\" },\n { command: \"new-panel\" },\n { command: \"indent\" },\n { command: \"outdent\" },\n { command: \"move-up\" },\n { command: \"move-down\" },\n { command: \"delete\" },\n // {command: \"add-checkbox\"}, \n // {command: \"remove-checkbox\"},\n // {command: \"mark-done\"},\n // {command: \"add-page\"},\n // {command: \"remove-page\"},\n // {command: \"generate-random\"},\n // {command: \"create-reference\"},\n ]);\n\n workbench.menus.registerMenu(\"settings\", [\n { title: () => `${workbench.backend.auth?.currentUser()?.userID()} @ GitHub`, disabled: true, when: () => workbench.authenticated() },\n {\n title: () => \"Login with GitHub\", when: () => !workbench.authenticated(), onclick: () => {\n if (!localStorage.getItem(\"github\")) {\n workbench.showNotice(\"github\", () => {\n workbench.backend.auth.login()\n })\n } else {\n workbench.backend.auth.login()\n }\n }\n },\n {\n title: () => \"Reset Demo\", when: () => !workbench.authenticated(), onclick: () => {\n localStorage.clear();\n location.reload();\n }\n },\n { title: () => \"Submit Issue\", onclick: () => window.open(\"https://github.com/treehousedev/treehouse/issues\", \"_blank\") },\n { title: () => \"Logout\", when: () => workbench.authenticated(), onclick: () => workbench.backend.auth.logout() },\n ]);\n\n document.addEventListener(\"keydown\", (e) => {\n const binding = workbench.keybindings.evaluateEvent(e);\n if (binding) {\n workbench.executeCommand(binding.command, workbench.context);\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n\n // TODO: find a better way to do this?\n if (e.key === \"Escape\") {\n if (workbench.curtain && workbench.curtain.onclick) {\n workbench.curtain.onclick(e);\n }\n }\n });\n\n\n m.mount(target, { view: () => m(App, { workbench }) });\n}\n\n\n\nfunction generateName(length = 10) {\n const random = (min: any, max: any) => {\n return Math.round(Math.random() * (max - min) + min)\n };\n const word = () => {\n const words = [\n 'got',\n 'ability',\n 'shop',\n 'recall',\n 'fruit',\n 'easy',\n 'dirty',\n 'giant',\n 'shaking',\n 'ground',\n 'weather',\n 'lesson',\n 'almost',\n 'square',\n 'forward',\n 'bend',\n 'cold',\n 'broken',\n 'distant',\n 'adjective'\n ];\n return words[random(0, words.length - 1)];\n };\n const words = (length) => (\n [...Array(length)]\n .map((_, i) => word())\n .join(' ')\n .trim()\n );\n return words(random(2, length))\n}\n"], + "mappings": "gQACA,IAA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AAK,CAAE,UAAApC,CAAU,CAAC,CAAE,CAAC,CACvD,CA5fsBqC,EAAAzC,GAAA,SAggBtB,SAASqC,GAAaK,EAAS,GAAI,CACjC,IAAMC,EAASF,EAAA,CAACG,EAAUC,IACjB,KAAK,MAAM,KAAK,OAAO,GAAKA,EAAMD,GAAOA,CAAG,EADtC,UAGTE,EAAOL,EAAA,IAAM,CACjB,IAAMM,EAAQ,CACZ,MACA,UACA,OACA,SACA,QACA,OACA,QACA,QACA,UACA,SACA,UACA,SACA,SACA,SACA,UACA,OACA,OACA,SACA,UACA,WACF,EACA,OAAOA,EAAMJ,EAAO,EAAGI,EAAM,OAAS,CAAC,CAAC,CAC1C,EAxBa,QA+Bb,OANcN,EAACC,GACb,CAAC,GAAG,MAAMA,CAAM,CAAC,EACd,IAAI,CAACM,EAAGC,IAAMH,EAAK,CAAC,EACpB,KAAK,GAAG,EACR,KAAK,EAJI,SAMDH,EAAO,EAAGD,CAAM,CAAC,CAChC,CApCSD,EAAAJ,GAAA", + "names": ["isMac", "bindingSymbols", "key", "symbols", "filterKeyForNonMacMeta", "k", "__name", "KeyBindings", "binding", "commandId", "b", "event", "bindings", "modifiers", "checkMod", "hasMod", "modState", "CommandRegistry", "cmd", "id", "rest", "resolve", "ret", "__name", "MenuRegistry", "id", "items", "__name", "Workbench", "backend", "CommandRegistry", "KeyBindings", "MenuRegistry", "Workspace", "n", "com", "node", "today", "dayNode", "weekNode", "getWeekOfYear", "todayPath", "todayNode", "p", "Path", "panel", "path", "pos", "input", "id", "ctx", "rest", "event", "trigger", "rect", "align", "x", "y", "items", "cmds", "i", "message", "finished", "__name", "date", "d", "dayNum", "yearStart", "SHA1", "msg", "rotate_left", "n", "s", "t4", "__name", "lsb_hex", "val", "str", "i", "vh", "vl", "cvt_hex", "v", "Utf8Encode", "string", "utftext", "c", "blockstart", "j", "W", "H0", "H1", "H2", "H3", "H4", "A", "B", "C", "D", "E", "temp", "msg_len", "word_array", "Path", "head", "name", "node", "p", "SHA1", "n", "__name", "registry", "component", "target", "componentName", "__name", "getComponent", "com", "inflateToComponent", "obj", "o", "hasHook", "node", "hook", "__name", "triggerHook", "args", "objectHas", "obj", "com", "objectCall", "Bus", "n", "cb", "nodes", "getComponent", "inflateToComponent", "node", "triggerHook", "name", "value", "parent", "parts", "i", "child", "id", "uniqueId", "Node", "p", "rel", "root", "path", "byId", "cur", "findChild", "__name", "fn", "opts", "dateString", "randomness", "Node", "bus", "id", "raw", "val", "n", "p", "triggerHook", "rel", "i", "anc", "cur", "path", "children", "com", "hasHook", "node", "obj", "componentName", "type", "coms", "linked", "idx", "oldIdx", "name", "value", "fn", "opts", "child", "nodes", "__name", "Workspace", "fs", "Bus", "debounce", "path", "contents", "e", "fn", "doc", "n", "i", "main", "root", "ws", "cal", "home", "name", "value", "head", "expanded", "b", "p", "prev", "fieldCount", "lastSubIfExpanded", "__name", "lastField", "lastChild", "nextSiblingOrParentNextSibling", "next", "parent", "func", "timeout", "timer", "args", "Menu", "workbench", "x", "y", "items", "align", "commands", "ctx", "onclick", "__name", "item", "cmd", "e", "posStyle", "i", "title", "binding", "c", "bindingSymbols", "CommandPalette", "state", "dom", "children", "attrs", "workbench", "filtered", "cmd", "onkeydown", "__name", "e", "mod", "a", "b", "onclick", "autocomplete", "idx", "NodeEditor", "workbench", "path", "onkeydown", "disallowEmpty", "editValue", "state", "node", "prop", "display", "__name", "objectHas", "objectCall", "onfocus", "getter", "setter", "v", "finished", "placeholder", "id", "TextEditor", "dom", "attrs", "textarea", "initialHeight", "span", "onblur", "value", "e", "empty_default", "node", "workbench", "panel", "NewNode", "workbench", "path", "__name", "e", "lastchild", "list_default", "workbench", "path", "node", "OutlineNode", "NewNode", "table_default", "workbench", "path", "state", "node", "n", "f", "getFieldEditor", "__name", "field", "fields", "NodeEditor", "OutlineNode", "views", "list_default", "table_default", "getView", "name", "empty_default", "__name", "view", "toTitleCase", "ctx", "str", "txt", "OutlineEditor", "workbench", "path", "getView", "OutlineNode", "attrs", "state", "children", "node", "isRef", "handleNode", "expanded", "hover", "__name", "e", "unhover", "toggle", "checkCommands", "anyModifiers", "above", "oldName", "open", "subCount", "n", "showHandle", "objectHas", "objectCall", "NodeEditor", "Page", "__name", "__decorateClass", "component", "Panel", "attrs", "path", "workbench", "node", "close", "__name", "e", "goBack", "maximize", "editMarkdown", "Page", "calcHeight", "value", "NodeEditor", "OutlineEditor", "QuickAdd", "workbench", "path", "Path", "OutlineEditor", "Search", "state", "dom", "results", "workbench", "clear", "__name", "open", "node", "onkeydown", "e", "mod", "a", "b", "autocomplete", "splitQuery", "textQuery", "term", "fieldQuery", "id", "fields", "f", "n", "result", "idx", "LockStolenMessage", "workbench", "finished", "FirstTimeMessage", "GitHubMessage", "Notice", "message", "App", "workbench", "state", "toggle", "__name", "e", "node", "NavNode", "Search", "path", "Panel", "Menu", "CommandPalette", "QuickAdd", "Notice", "expanded", "level", "expandable", "open", "n", "debounce", "func", "timeout", "timer", "args", "__name", "SearchNode", "node", "n", "query", "splitQuery", "textQuery", "term", "fieldQuery", "results", "id", "fields", "f", "ref", "children", "key", "obj", "__decorateClass", "component", "Checkbox", "CheckboxEditor", "__name", "__decorateClass", "component", "node", "e", "checkbox", "TextField", "__name", "__decorateClass", "component", "Clock", "node", "obj", "entry", "key", "acc", "val", "total", "child", "now", "a", "d", "seconds", "dur", "min", "ClockBadge", "ClockLog", "workbench", "ctx", "clock", "__name", "__decorateClass", "component", "toggleLog", "BrowserBackend", "FileStore", "SearchIndex_MiniSearch", "SearchIndex_Dumb", "__name", "document", "fieldName", "doc", "key", "node", "id", "query", "suggested", "results", "path", "contents", "encode", "decode", "GitHubBackend", "loginURL", "octokit", "opts", "localbackend", "BrowserBackend", "code", "querystring", "result", "e", "token", "resp", "sessID", "uniqueID", "lockCheck", "o", "dirList", "file", "css", "js", "User", "path", "decode", "contents", "encode", "__name", "user", "dateString", "randomness", "setup", "document", "target", "backend", "workbench", "Workbench", "Clock", "TextField", "Page", "Checkbox", "com", "ctx", "search", "SearchNode", "page", "checkbox", "path", "field", "text", "node", "prev", "parent", "children", "p", "parentSib", "name", "siblingIndex", "above", "pos", "below", "posBelow", "Path", "trigger", "rect", "x", "y", "panel", "generateName", "e", "binding", "App", "__name", "length", "random", "min", "max", "word", "words", "_", "i"] +}