From 17475e6955529046f8fc96e1aba23d4d6248c1dd Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 9 Dec 2025 15:52:10 +0100 Subject: [PATCH] Add .obisidan so we can share between machines. --- .gitignore | 4 +- content/.obsidian/app.json | 12 + content/.obsidian/community-plugins.json | 12 + content/.obsidian/core-plugins.json | 33 + content/.obsidian/hotkeys.json | 20 + content/.obsidian/page-preview.json | 3 + .../.obsidian/plugins/agent-client/data.json | 42 + .../.obsidian/plugins/agent-client/main.js | 151 + .../plugins/agent-client/manifest.json | 1 + .../.obsidian/plugins/agent-client/styles.css | 1100 + content/.obsidian/plugins/dataview/data.json | 27 + content/.obsidian/plugins/dataview/main.js | 20876 ++++++++++++++++ .../.obsidian/plugins/dataview/manifest.json | 11 + content/.obsidian/plugins/dataview/styles.css | 141 + .../plugins/emoji-shortcodes/data.json | 26 + .../plugins/emoji-shortcodes/main.js | 2071 ++ .../plugins/emoji-shortcodes/manifest.json | 11 + .../plugins/emoji-shortcodes/styles.css | 31 + .../.obsidian/plugins/obsidian-git/data.json | 62 + .../.obsidian/plugins/obsidian-git/main.js | 426 + .../plugins/obsidian-git/manifest.json | 10 + .../.obsidian/plugins/obsidian-git/styles.css | 629 + .../plugins/obsidian42-brat/data.json | 23 + .../.obsidian/plugins/obsidian42-brat/main.js | 45 + .../plugins/obsidian42-brat/manifest.json | 14 + .../plugins/obsidian42-brat/styles.css | 110 + .../.obsidian/plugins/omnisearch/data.json | 42 + content/.obsidian/plugins/omnisearch/main.js | 171 + .../plugins/omnisearch/manifest.json | 14 + .../.obsidian/plugins/omnisearch/styles.css | 135 + .../plugins/pretty-properties/data.json | 124 + .../plugins/pretty-properties/main.js | 8 + .../plugins/pretty-properties/manifest.json | 10 + .../plugins/pretty-properties/styles.css | 1332 + .../plugins/spoiler-block-obsidian/main.js | 53 + .../spoiler-block-obsidian/manifest.json | 10 + .../plugins/spoiler-block-obsidian/styles.css | 42 + .../plugins/text-extractor/data.json | 8 + .../.obsidian/plugins/text-extractor/main.js | 5525 ++++ .../plugins/text-extractor/manifest.json | 14 + content/.obsidian/workspace.json | 253 + 41 files changed, 33630 insertions(+), 2 deletions(-) create mode 100644 content/.obsidian/app.json create mode 100644 content/.obsidian/community-plugins.json create mode 100644 content/.obsidian/core-plugins.json create mode 100644 content/.obsidian/hotkeys.json create mode 100644 content/.obsidian/page-preview.json create mode 100644 content/.obsidian/plugins/agent-client/data.json create mode 100644 content/.obsidian/plugins/agent-client/main.js create mode 100644 content/.obsidian/plugins/agent-client/manifest.json create mode 100644 content/.obsidian/plugins/agent-client/styles.css create mode 100644 content/.obsidian/plugins/dataview/data.json create mode 100644 content/.obsidian/plugins/dataview/main.js create mode 100644 content/.obsidian/plugins/dataview/manifest.json create mode 100644 content/.obsidian/plugins/dataview/styles.css create mode 100644 content/.obsidian/plugins/emoji-shortcodes/data.json create mode 100644 content/.obsidian/plugins/emoji-shortcodes/main.js create mode 100644 content/.obsidian/plugins/emoji-shortcodes/manifest.json create mode 100644 content/.obsidian/plugins/emoji-shortcodes/styles.css create mode 100644 content/.obsidian/plugins/obsidian-git/data.json create mode 100644 content/.obsidian/plugins/obsidian-git/main.js create mode 100644 content/.obsidian/plugins/obsidian-git/manifest.json create mode 100644 content/.obsidian/plugins/obsidian-git/styles.css create mode 100644 content/.obsidian/plugins/obsidian42-brat/data.json create mode 100644 content/.obsidian/plugins/obsidian42-brat/main.js create mode 100644 content/.obsidian/plugins/obsidian42-brat/manifest.json create mode 100644 content/.obsidian/plugins/obsidian42-brat/styles.css create mode 100644 content/.obsidian/plugins/omnisearch/data.json create mode 100644 content/.obsidian/plugins/omnisearch/main.js create mode 100644 content/.obsidian/plugins/omnisearch/manifest.json create mode 100644 content/.obsidian/plugins/omnisearch/styles.css create mode 100644 content/.obsidian/plugins/pretty-properties/data.json create mode 100644 content/.obsidian/plugins/pretty-properties/main.js create mode 100644 content/.obsidian/plugins/pretty-properties/manifest.json create mode 100644 content/.obsidian/plugins/pretty-properties/styles.css create mode 100644 content/.obsidian/plugins/spoiler-block-obsidian/main.js create mode 100644 content/.obsidian/plugins/spoiler-block-obsidian/manifest.json create mode 100644 content/.obsidian/plugins/spoiler-block-obsidian/styles.css create mode 100644 content/.obsidian/plugins/text-extractor/data.json create mode 100644 content/.obsidian/plugins/text-extractor/main.js create mode 100644 content/.obsidian/plugins/text-extractor/manifest.json create mode 100644 content/.obsidian/workspace.json diff --git a/.gitignore b/.gitignore index 74a08b5..7315e6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .DS_Store .idea -.obsidian .quartz-cache node_modules public -wip/output \ No newline at end of file +wip/output +content/.obsidian/plugins/text-extractor/cache diff --git a/content/.obsidian/app.json b/content/.obsidian/app.json new file mode 100644 index 0000000..58d7a23 --- /dev/null +++ b/content/.obsidian/app.json @@ -0,0 +1,12 @@ +{ + "promptDelete": false, + "alwaysUpdateLinks": true, + "newFileLocation": "current", + "spellcheck": false, + "tabSize": 4, + "attachmentFolderPath": "attachments", + "showInlineTitle": true, + "strictLineBreaks": true, + "showLineNumber": false, + "readableLineLength": false +} \ No newline at end of file diff --git a/content/.obsidian/community-plugins.json b/content/.obsidian/community-plugins.json new file mode 100644 index 0000000..f0977ff --- /dev/null +++ b/content/.obsidian/community-plugins.json @@ -0,0 +1,12 @@ +[ + "obsidian-git", + "omnisearch", + "text-extractor", + "spoiler-block-obsidian", + "pretty-properties", + "dataview", + "emoji-shortcodes", + "obsidian42-brat", + "agent-client", + "manual-sorting" +] \ No newline at end of file diff --git a/content/.obsidian/core-plugins.json b/content/.obsidian/core-plugins.json new file mode 100644 index 0000000..7f63f5e --- /dev/null +++ b/content/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": false, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": false, + "daily-notes": false, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": true, + "editor-status": true, + "bookmarks": false, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": false, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/content/.obsidian/hotkeys.json b/content/.obsidian/hotkeys.json new file mode 100644 index 0000000..2a5ff0d --- /dev/null +++ b/content/.obsidian/hotkeys.json @@ -0,0 +1,20 @@ +{ + "omnisearch:show-modal": [ + { + "modifiers": [ + "Mod", + "Shift" + ], + "key": "O" + } + ], + "editor:toggle-source": [ + { + "modifiers": [ + "Mod" + ], + "key": "S" + } + ], + "editor:save-file": [] +} \ No newline at end of file diff --git a/content/.obsidian/page-preview.json b/content/.obsidian/page-preview.json new file mode 100644 index 0000000..b64ea25 --- /dev/null +++ b/content/.obsidian/page-preview.json @@ -0,0 +1,3 @@ +{ + "file-explorer": false +} \ No newline at end of file diff --git a/content/.obsidian/plugins/agent-client/data.json b/content/.obsidian/plugins/agent-client/data.json new file mode 100644 index 0000000..c5c7f83 --- /dev/null +++ b/content/.obsidian/plugins/agent-client/data.json @@ -0,0 +1,42 @@ +{ + "claude": { + "id": "claude-code-acp", + "displayName": "Claude Code", + "apiKey": "", + "command": "", + "args": [], + "env": [] + }, + "codex": { + "id": "codex-acp", + "displayName": "Codex", + "apiKey": "", + "command": "/opt/homebrew/bin/codex-acp", + "args": [], + "env": [] + }, + "gemini": { + "id": "gemini-cli", + "displayName": "Gemini CLI", + "apiKey": "", + "command": "", + "args": [ + "--experimental-acp" + ], + "env": [] + }, + "customAgents": [], + "activeAgentId": "codex-acp", + "autoAllowPermissions": false, + "autoMentionActiveNote": true, + "debugMode": false, + "nodePath": "/opt/homebrew/bin/node", + "exportSettings": { + "defaultFolder": "Agent Client", + "filenameTemplate": "agent_client_{date}_{time}", + "autoExportOnNewChat": false, + "autoExportOnCloseChat": false, + "openFileAfterExport": true + }, + "windowsWslMode": false +} \ No newline at end of file diff --git a/content/.obsidian/plugins/agent-client/main.js b/content/.obsidian/plugins/agent-client/main.js new file mode 100644 index 0000000..474a4fd --- /dev/null +++ b/content/.obsidian/plugins/agent-client/main.js @@ -0,0 +1,151 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var xy=Object.create;var Es=Object.defineProperty;var wy=Object.getOwnPropertyDescriptor;var Ty=Object.getOwnPropertyNames;var Cy=Object.getPrototypeOf,Ey=Object.prototype.hasOwnProperty;var My=(e,t,n)=>t in e?Es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Yt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vf=(e,t)=>{for(var n in t)Es(e,n,{get:t[n],enumerable:!0})},yf=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ty(t))!Ey.call(e,i)&&i!==n&&Es(e,i,{get:()=>t[i],enumerable:!(a=wy(t,i))||a.enumerable});return e};var H=(e,t,n)=>(n=e!=null?xy(Cy(e)):{},yf(t||!e||!e.__esModule?Es(n,"default",{value:e,enumerable:!0}):n,e)),Ny=e=>yf(Es({},"__esModule",{value:!0}),e);var Kl=(e,t,n)=>(My(e,typeof t!="symbol"?t+"":t,n),n),Jr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var L=(e,t,n)=>(Jr(e,t,"read from private field"),n?n.call(e):t.get(e)),Re=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ht=(e,t,n,a)=>(Jr(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),bf=(e,t,n,a)=>({set _(i){Ht(e,t,i,n)},get _(){return L(e,t,a)}}),Zt=(e,t,n)=>(Jr(e,t,"access private method"),n);var Of=Yt(I=>{"use strict";var Fr=Symbol.for("react.transitional.element"),Ry=Symbol.for("react.portal"),Oy=Symbol.for("react.fragment"),Dy=Symbol.for("react.strict_mode"),ky=Symbol.for("react.profiler"),zy=Symbol.for("react.consumer"),Uy=Symbol.for("react.context"),qy=Symbol.for("react.forward_ref"),jy=Symbol.for("react.suspense"),Hy=Symbol.for("react.memo"),Tf=Symbol.for("react.lazy"),Sf=Symbol.iterator;function Ly(e){return e===null||typeof e!="object"?null:(e=Sf&&e[Sf]||e["@@iterator"],typeof e=="function"?e:null)}var Cf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ef=Object.assign,Mf={};function gi(e,t,n){this.props=e,this.context=t,this.refs=Mf,this.updater=n||Cf}gi.prototype.isReactComponent={};gi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};gi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Nf(){}Nf.prototype=gi.prototype;function eu(e,t,n){this.props=e,this.context=t,this.refs=Mf,this.updater=n||Cf}var tu=eu.prototype=new Nf;tu.constructor=eu;Ef(tu,gi.prototype);tu.isPureReactComponent=!0;var Af=Array.isArray,pe={H:null,A:null,T:null,S:null,V:null},Rf=Object.prototype.hasOwnProperty;function nu(e,t,n,a,i,s){return n=s.ref,{$$typeof:Fr,type:e,key:t,ref:n!==void 0?n:null,props:s}}function By(e,t){return nu(e.type,t,void 0,void 0,void 0,e.props)}function au(e){return typeof e=="object"&&e!==null&&e.$$typeof===Fr}function Vy(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var _f=/\/+/g;function Wr(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Vy(""+e.key):t.toString(36)}function xf(){}function Gy(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(xf,xf):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function mi(e,t,n,a,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(s){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case Fr:case Ry:l=!0;break;case Tf:return l=e._init,mi(l(e._payload),t,n,a,i)}}if(l)return i=i(e),l=a===""?"."+Wr(e,0):a,Af(i)?(n="",l!=null&&(n=l.replace(_f,"$&/")+"/"),mi(i,t,n,"",function(c){return c})):i!=null&&(au(i)&&(i=By(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(_f,"$&/")+"/")+l)),t.push(i)),1;l=0;var o=a===""?".":a+":";if(Af(e))for(var u=0;u{"use strict";Df.exports=Of()});var Gf=Yt(he=>{"use strict";function ou(e,t){var n=e.length;e.push(t);e:for(;0>>1,i=e[a];if(0>>1;aWl(o,n))uWl(c,o)?(e[a]=c,e[u]=n,a=u):(e[a]=o,e[l]=n,a=l);else if(uWl(c,n))e[a]=c,e[u]=n,a=u;else break e}}return t}function Wl(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}he.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(kf=performance,he.unstable_now=function(){return kf.now()}):(iu=Date,zf=iu.now(),he.unstable_now=function(){return iu.now()-zf});var kf,iu,zf,cn=[],Vn=[],Zy=1,xt=null,Ze=3,ru=!1,Ms=!1,Ns=!1,uu=!1,jf=typeof setTimeout=="function"?setTimeout:null,Hf=typeof clearTimeout=="function"?clearTimeout:null,Uf=typeof setImmediate!="undefined"?setImmediate:null;function Fl(e){for(var t=Qt(Vn);t!==null;){if(t.callback===null)eo(Vn);else if(t.startTime<=e)eo(Vn),t.sortIndex=t.expirationTime,ou(cn,t);else break;t=Qt(Vn)}}function cu(e){if(Ns=!1,Fl(e),!Ms)if(Qt(cn)!==null)Ms=!0,hi||(hi=!0,pi());else{var t=Qt(Vn);t!==null&&du(cu,t.startTime-e)}}var hi=!1,Rs=-1,Lf=5,Bf=-1;function Vf(){return uu?!0:!(he.unstable_now()-Bfe&&Vf());){var a=xt.callback;if(typeof a=="function"){xt.callback=null,Ze=xt.priorityLevel;var i=a(xt.expirationTime<=e);if(e=he.unstable_now(),typeof i=="function"){xt.callback=i,Fl(e),t=!0;break t}xt===Qt(cn)&&eo(cn),Fl(e)}else eo(cn);xt=Qt(cn)}if(xt!==null)t=!0;else{var s=Qt(Vn);s!==null&&du(cu,s.startTime-e),t=!1}}break e}finally{xt=null,Ze=n,ru=!1}t=void 0}}finally{t?pi():hi=!1}}}var pi;typeof Uf=="function"?pi=function(){Uf(su)}:typeof MessageChannel!="undefined"?(lu=new MessageChannel,qf=lu.port2,lu.port1.onmessage=su,pi=function(){qf.postMessage(null)}):pi=function(){jf(su,0)};var lu,qf;function du(e,t){Rs=jf(function(){e(he.unstable_now())},t)}he.unstable_IdlePriority=5;he.unstable_ImmediatePriority=1;he.unstable_LowPriority=4;he.unstable_NormalPriority=3;he.unstable_Profiling=null;he.unstable_UserBlockingPriority=2;he.unstable_cancelCallback=function(e){e.callback=null};he.unstable_forceFrameRate=function(e){0>e||125a?(e.sortIndex=n,ou(Vn,e),Qt(cn)===null&&e===Qt(Vn)&&(Ns?(Hf(Rs),Rs=-1):Ns=!0,du(cu,n-a))):(e.sortIndex=i,ou(cn,e),Ms||ru||(Ms=!0,hi||(hi=!0,pi()))),e};he.unstable_shouldYield=Vf;he.unstable_wrapCallback=function(e){var t=Ze;return function(){var n=Ze;Ze=t;try{return e.apply(this,arguments)}finally{Ze=n}}}});var Yf=Yt((Mx,If)=>{"use strict";If.exports=Gf()});var Qf=Yt(Fe=>{"use strict";var Qy=we();function Zf(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function Xf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xf)}catch(e){console.error(e)}}Xf(),Pf.exports=Qf()});var Jh=Yt(wr=>{"use strict";var ke=Yf(),vg=we(),$y=$f();function _(e){var t="https://react.dev/errors/"+e;if(1wi||(e.current=Pu[wi],Pu[wi]=null,wi--)}function ye(e,t){wi++,Pu[wi]=e.current,e.current=t}var Kt=Ft(null),il=Ft(null),ta=Ft(null),ko=Ft(null);function zo(e,t){switch(ye(ta,t),ye(il,e),ye(Kt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ag(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ag(t),e=Lh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Le(Kt),ye(Kt,e)}function Ii(){Le(Kt),Le(il),Le(ta)}function $u(e){e.memoizedState!==null&&ye(ko,e);var t=Kt.current,n=Lh(t,e.type);t!==n&&(ye(il,e),ye(Kt,n))}function Uo(e){il.current===e&&(Le(Kt),Le(il)),ko.current===e&&(Le(ko),gl._currentValue=Ma)}var Ku=Object.prototype.hasOwnProperty,Bc=ke.unstable_scheduleCallback,fu=ke.unstable_cancelCallback,t0=ke.unstable_shouldYield,n0=ke.unstable_requestPaint,Jt=ke.unstable_now,a0=ke.unstable_getCurrentPriorityLevel,xg=ke.unstable_ImmediatePriority,wg=ke.unstable_UserBlockingPriority,qo=ke.unstable_NormalPriority,i0=ke.unstable_LowPriority,Tg=ke.unstable_IdlePriority,s0=ke.log,l0=ke.unstable_setDisableYieldValue,bl=null,gt=null;function Jn(e){if(typeof s0=="function"&&l0(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(bl,e)}catch(t){}}var pt=Math.clz32?Math.clz32:u0,o0=Math.log,r0=Math.LN2;function u0(e){return e>>>=0,e===0?32:31-(o0(e)/r0|0)|0}var ao=256,io=4194304;function Ta(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ur(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var i=0,s=e.suspendedLanes,l=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~s,a!==0?i=Ta(a):(l&=o,l!==0?i=Ta(l):n||(n=o&~e,n!==0&&(i=Ta(n))))):(o=a&~s,o!==0?i=Ta(o):l!==0?i=Ta(l):n||(n=a&~e,n!==0&&(i=Ta(n)))),i===0?0:t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function Sl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function c0(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Cg(){var e=ao;return ao<<=1,!(ao&4194048)&&(ao=256),e}function Eg(){var e=io;return io<<=1,!(io&62914560)&&(io=4194304),e}function mu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Al(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function d0(e,t,n,a,i,s){var l=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,u=e.expirationTimes,c=e.hiddenUpdates;for(n=l&~n;0)":-1i||u[a]!==c[i]){var d=` +`+u[a].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=a&&0<=i);break}}}finally{pu=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Si(n):""}function v0(e){switch(e.tag){case 26:case 27:case 5:return Si(e.type);case 16:return Si("Lazy");case 13:return Si("Suspense");case 19:return Si("SuspenseList");case 0:case 15:return hu(e.type,!1);case 11:return hu(e.type.render,!1);case 1:return hu(e.type,!0);case 31:return Si("Activity");default:return""}}function nm(e){try{var t="";do t+=v0(e),e=e.return;while(e);return t}catch(n){return` +Error generating stack: `+n.message+` +`+n.stack}}function Tt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function y0(e){var t=kg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){a=""+l,s.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(l){a=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jo(e){e._valueTracker||(e._valueTracker=y0(e))}function zg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=kg(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Ho(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch(t){return e.body}}var b0=/[\n"\\]/g;function Mt(e){return e.replace(b0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wu(e,t,n,a,i,s,l,o){e.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.type=l:e.removeAttribute("type"),t!=null?l==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Tt(t)):e.value!==""+Tt(t)&&(e.value=""+Tt(t)):l!=="submit"&&l!=="reset"||e.removeAttribute("value"),t!=null?Fu(e,l,Tt(t)):n!=null?Fu(e,l,Tt(n)):a!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Tt(o):e.removeAttribute("name")}function Ug(e,t,n,a,i,s,l,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null))return;n=n!=null?""+Tt(n):"",t=t!=null?""+Tt(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a!=null?a:i,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=o?e.checked:!!a,e.defaultChecked=!!a,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.name=l)}function Fu(e,t,n){t==="number"&&Ho(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function qi(e,t,n,a){if(e=e.options,t){t={};for(var i=0;i=Ys),um=String.fromCharCode(32),cm=!1;function Gg(e,t){switch(e){case"keyup":return X0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ig(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ei=!1;function $0(e,t){switch(e){case"compositionend":return Ig(t);case"keypress":return t.which!==32?null:(cm=!0,um);case"textInput":return e=t.data,e===um&&cm?null:e;default:return null}}function K0(e,t){if(Ei)return e==="compositionend"||!Pc&&Gg(e,t)?(e=Bg(),_o=Qc=Wn=null,Ei=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=gm(n)}}function Xg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ho(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch(a){n=!1}if(n)e=t.contentWindow;else break;t=Ho(e.document)}return t}function $c(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var ib=_n&&"documentMode"in document&&11>=document.documentMode,Mi=null,nc=null,Qs=null,ac=!1;function hm(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ac||Mi==null||Mi!==Ho(a)||(a=Mi,"selectionStart"in a&&$c(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Qs&&ol(Qs,a)||(Qs=a,a=nr(nc,"onSelect"),0>=l,i-=l,hn=1<<32-pt(t)+i|n<s?s:8;var l=j.T,o={};j.T=o,hd(e,!1,t,n);try{var u=i(),c=j.S;if(c!==null&&c(o,u),u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=mb(u,a);Ws(e,t,d,ht(e))}else Ws(e,t,a,ht(e))}catch(p){Ws(e,t,{then:function(){},status:"rejected",reason:p},ht())}finally{W.p=s,j.T=l}}function yb(){}function hc(e,t,n,a){if(e.tag!==5)throw Error(_(476));var i=kp(e).queue;Dp(e,i,t,Ma,n===null?yb:function(){return zp(e),n(a)})}function kp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ma,baseState:Ma,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xn,lastRenderedState:Ma},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zp(e){var t=kp(e).next.queue;Ws(e,t,{},ht())}function pd(){return Xe(gl)}function Up(){return Ne().memoizedState}function qp(){return Ne().memoizedState}function bb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ht();e=na(n);var a=aa(t,e,n);a!==null&&(vt(a,t,n),$s(a,t,n)),t={cache:td()},e.payload=t;return}t=t.return}}function Sb(e,t,n){var a=ht();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},yr(e)?Hp(t,n):(n=Jc(e,t,n,a),n!==null&&(vt(n,e,a),Lp(n,t,a)))}function jp(e,t,n){var a=ht();Ws(e,t,n,a)}function Ws(e,t,n,a){var i={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(yr(e))Hp(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var l=t.lastRenderedState,o=s(l,n);if(i.hasEagerState=!0,i.eagerState=o,yt(o,l))return gr(e,t,i,0),re===null&&mr(),!1}catch(u){}finally{}if(n=Jc(e,t,i,a),n!==null)return vt(n,e,a),Lp(n,t,a),!0}return!1}function hd(e,t,n,a){if(a={lane:2,revertLane:wd(),action:a,hasEagerState:!1,eagerState:null,next:null},yr(e)){if(t)throw Error(_(479))}else t=Jc(e,n,a,2),t!==null&&vt(t,e,2)}function yr(e){var t=e.alternate;return e===Z||t!==null&&t===Z}function Hp(e,t){Li=Yo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Lp(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Ng(e,n)}}var Qo={readContext:Xe,use:hr,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useLayoutEffect:Te,useInsertionEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useSyncExternalStore:Te,useId:Te,useHostTransitionStatus:Te,useFormState:Te,useActionState:Te,useOptimistic:Te,useMemoCache:Te,useCacheRefresh:Te},Bp={readContext:Xe,use:hr,useCallback:function(e,t){return tt().memoizedState=[e,t===void 0?null:t],e},useContext:Xe,useEffect:Dm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Eo(4194308,4,Ep.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Eo(4194308,4,e,t)},useInsertionEffect:function(e,t){Eo(4,2,e,t)},useMemo:function(e,t){var n=tt();t=t===void 0?null:t;var a=e();if(ja){Jn(!0);try{e()}finally{Jn(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=tt();if(n!==void 0){var i=n(t);if(ja){Jn(!0);try{n(t)}finally{Jn(!1)}}}else i=t;return a.memoizedState=a.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},a.queue=e,e=e.dispatch=Sb.bind(null,Z,e),[a.memoizedState,e]},useRef:function(e){var t=tt();return e={current:e},t.memoizedState=e},useState:function(e){e=gc(e);var t=e.queue,n=jp.bind(null,Z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:md,useDeferredValue:function(e,t){var n=tt();return gd(n,e,t)},useTransition:function(){var e=gc(!1);return e=Dp.bind(null,Z,e.queue,!0,!1),tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Z,i=tt();if(J){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),re===null)throw Error(_(349));$&124||mp(a,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Dm(pp.bind(null,a,s,e),[e]),a.flags|=2048,Pi(9,vr(),gp.bind(null,a,s,n,t),null),n},useId:function(){var e=tt(),t=re.identifierPrefix;if(J){var n=vn,a=hn;n=(a&~(1<<32-pt(a)-1)).toString(32)+n,t="\xAB"+t+"R"+n,n=Zo++,0T?(D=x,x=null):D=x.sibling;var M=f(h,x,v[T],y);if(M===null){x===null&&(x=D);break}e&&x&&M.alternate===null&&t(h,x),g=s(M,g,T),E===null?A=M:E.sibling=M,E=M,x=D}if(T===v.length)return n(h,x),J&&Ca(h,T),A;if(x===null){for(;TT?(D=x,x=null):D=x.sibling;var K=f(h,x,M.value,y);if(K===null){x===null&&(x=D);break}e&&x&&K.alternate===null&&t(h,x),g=s(K,g,T),E===null?A=K:E.sibling=K,E=K,x=D}if(M.done)return n(h,x),J&&Ca(h,T),A;if(x===null){for(;!M.done;T++,M=v.next())M=p(h,M.value,y),M!==null&&(g=s(M,g,T),E===null?A=M:E.sibling=M,E=M);return J&&Ca(h,T),A}for(x=a(x);!M.done;T++,M=v.next())M=m(x,h,T,M.value,y),M!==null&&(e&&M.alternate!==null&&x.delete(M.key===null?T:M.key),g=s(M,g,T),E===null?A=M:E.sibling=M,E=M);return e&&x.forEach(function(ge){return t(h,ge)}),J&&Ca(h,T),A}function C(h,g,v,y){if(typeof v=="object"&&v!==null&&v.type===xi&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case no:e:{for(var A=v.key;g!==null;){if(g.key===A){if(A=v.type,A===xi){if(g.tag===7){n(h,g.sibling),y=i(g,v.props.children),y.return=h,h=y;break e}}else if(g.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===Zn&&km(A)===g.type){n(h,g.sibling),y=i(g,v.props),Us(y,v),y.return=h,h=y;break e}n(h,g);break}else t(h,g);g=g.sibling}v.type===xi?(y=Na(v.props.children,h.mode,y,v.key),y.return=h,h=y):(y=wo(v.type,v.key,v.props,null,h.mode,y),Us(y,v),y.return=h,h=y)}return l(h);case Bs:e:{for(A=v.key;g!==null;){if(g.key===A)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(h,g.sibling),y=i(g,v.children||[]),y.return=h,h=y;break e}else{n(h,g);break}else t(h,g);g=g.sibling}y=wu(v,h.mode,y),y.return=h,h=y}return l(h);case Zn:return A=v._init,v=A(v._payload),C(h,g,v,y)}if(Vs(v))return b(h,g,v,y);if(Ds(v)){if(A=Ds(v),typeof A!="function")throw Error(_(150));return v=A.call(v),S(h,g,v,y)}if(typeof v.then=="function")return C(h,g,fo(v),y);if(v.$$typeof===pn)return C(h,g,uo(h,v),y);mo(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,g!==null&&g.tag===6?(n(h,g.sibling),y=i(g,v),y.return=h,h=y):(n(h,g),y=xu(v,h.mode,y),y.return=h,h=y),l(h)):n(h,g)}return function(h,g,v,y){try{cl=0;var A=C(h,g,v,y);return Vi=null,A}catch(x){if(x===El||x===pr)throw x;var E=mt(29,x,null,h.mode);return E.lanes=y,E.return=h,E}finally{}}}var $i=Gp(!0),Ip=Gp(!1),Ot=Ft(null),Wt=null;function Pn(e){var t=e.alternate;ye(De,De.current&1),ye(Ot,e),Wt===null&&(t===null||Xi.current!==null||t.memoizedState!==null)&&(Wt=e)}function Yp(e){if(e.tag===22){if(ye(De,De.current),ye(Ot,e),Wt===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Wt=e)}}else $n(e)}function $n(){ye(De,De.current),ye(Ot,Ot.current)}function bn(e){Le(Ot),Wt===e&&(Wt=null),Le(De)}var De=Ft(0);function Xo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||kc(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Eu(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:ue({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vc={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=ht(),i=na(a);i.payload=t,n!=null&&(i.callback=n),t=aa(e,i,a),t!==null&&(vt(t,e,a),$s(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=ht(),i=na(a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=aa(e,i,a),t!==null&&(vt(t,e,a),$s(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ht(),a=na(n);a.tag=2,t!=null&&(a.callback=t),t=aa(e,a,n),t!==null&&(vt(t,e,n),$s(t,e,n))}};function zm(e,t,n,a,i,s,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,s,l):t.prototype&&t.prototype.isPureReactComponent?!ol(n,a)||!ol(i,s):!0}function Um(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&vc.enqueueReplaceState(t,t.state,null)}function Ha(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=ue({},n));for(var i in e)n[i]===void 0&&(n[i]=e[i])}return n}var Po=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function Zp(e){Po(e)}function Qp(e){console.error(e)}function Xp(e){Po(e)}function $o(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function qm(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function yc(e,t,n){return n=na(n),n.tag=3,n.payload={element:null},n.callback=function(){$o(e,t)},n}function Pp(e){return e=na(e),e.tag=3,e}function $p(e,t,n,a){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=a.value;e.payload=function(){return i(s)},e.callback=function(){qm(t,n,a)}}var l=n.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(e.callback=function(){qm(t,n,a),typeof i!="function"&&(ia===null?ia=new Set([this]):ia.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function _b(e,t,n,a,i){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&Tl(t,n,i,!0),n=Ot.current,n!==null){switch(n.tag){case 13:return Wt===null?Cc():n.alternate===null&&xe===0&&(xe=3),n.flags&=-257,n.flags|=65536,n.lanes=i,a===cc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Hu(e,a,i)),!1;case 22:return n.flags|=65536,a===cc?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Hu(e,a,i)),!1}throw Error(_(435,n.tag))}return Hu(e,a,i),Cc(),!1}if(J)return t=Ot.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,a!==sc&&(e=Error(_(422),{cause:a}),rl(Nt(e,n)))):(a!==sc&&(t=Error(_(423),{cause:a}),rl(Nt(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,a=Nt(a,n),i=yc(e.stateNode,a,i),Tu(e,i),xe!==4&&(xe=2)),!1;var s=Error(_(520),{cause:a});if(s=Nt(s,n),tl===null?tl=[s]:tl.push(s),xe!==4&&(xe=2),t===null)return!0;a=Nt(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=yc(n.stateNode,a,e),Tu(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(ia===null||!ia.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Pp(i),$p(i,e,n,a),Tu(n,i),!1}n=n.return}while(n!==null);return!1}var Kp=Error(_(461)),He=!1;function Ve(e,t,n,a){t.child=e===null?Ip(t,null,n,a):$i(t,e.child,n,a)}function jm(e,t,n,a,i){n=n.render;var s=t.ref;if("ref"in a){var l={};for(var o in a)o!=="ref"&&(l[o]=a[o])}else l=a;return qa(t),a=ld(e,t,n,l,s,i),o=od(),e!==null&&!He?(rd(e,t,i),wn(e,t,i)):(J&&o&&Fc(t),t.flags|=1,Ve(e,t,a,i),t.child)}function Hm(e,t,n,a,i){if(e===null){var s=n.type;return typeof s=="function"&&!Wc(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Jp(e,t,s,a,i)):(e=wo(n.type,null,a,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!vd(e,i)){var l=s.memoizedProps;if(n=n.compare,n=n!==null?n:ol,n(l,a)&&e.ref===t.ref)return wn(e,t,i)}return t.flags|=1,e=Sn(s,a),e.ref=t.ref,e.return=t,t.child=e}function Jp(e,t,n,a,i){if(e!==null){var s=e.memoizedProps;if(ol(s,a)&&e.ref===t.ref)if(He=!1,t.pendingProps=a=s,vd(e,i))e.flags&131072&&(He=!0);else return t.lanes=e.lanes,wn(e,t,i)}return bc(e,t,n,a,i)}function Wp(e,t,n){var a=t.pendingProps,i=a.children,s=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=s!==null?s.baseLanes|n:n,e!==null){for(i=t.child=e.child,s=0;i!==null;)s=s|i.lanes|i.childLanes,i=i.sibling;t.childLanes=s&~a}else t.childLanes=0,t.child=null;return Lm(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&To(t,s!==null?s.cachePool:null),s!==null?Cm(t,s):mc(),Yp(t);else return t.lanes=t.childLanes=536870912,Lm(e,t,s!==null?s.baseLanes|n:n,n)}else s!==null?(To(t,s.cachePool),Cm(t,s),$n(t),t.memoizedState=null):(e!==null&&To(t,null),mc(),$n(t));return Ve(e,t,i,n),t.child}function Lm(e,t,n,a){var i=nd();return i=i===null?null:{parent:Oe._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&To(t,null),mc(),Yp(t),e!==null&&Tl(e,t,a,!0),null}function Mo(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(_(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bc(e,t,n,a,i){return qa(t),n=ld(e,t,n,a,void 0,i),a=od(),e!==null&&!He?(rd(e,t,i),wn(e,t,i)):(J&&a&&Fc(t),t.flags|=1,Ve(e,t,n,i),t.child)}function Bm(e,t,n,a,i,s){return qa(t),t.updateQueue=null,n=dp(t,a,n,i),cp(e),a=od(),e!==null&&!He?(rd(e,t,s),wn(e,t,s)):(J&&a&&Fc(t),t.flags|=1,Ve(e,t,n,s),t.child)}function Vm(e,t,n,a,i){if(qa(t),t.stateNode===null){var s=Oi,l=n.contextType;typeof l=="object"&&l!==null&&(s=Xe(l)),s=new n(a,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=vc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=a,s.state=t.memoizedState,s.refs={},ad(t),l=n.contextType,s.context=typeof l=="object"&&l!==null?Xe(l):Oi,s.state=t.memoizedState,l=n.getDerivedStateFromProps,typeof l=="function"&&(Eu(t,n,l,a),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(l=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),l!==s.state&&vc.enqueueReplaceState(s,s.state,null),Js(t,a,s,i),Ks(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){s=t.stateNode;var o=t.memoizedProps,u=Ha(n,o);s.props=u;var c=s.context,d=n.contextType;l=Oi,typeof d=="object"&&d!==null&&(l=Xe(d));var p=n.getDerivedStateFromProps;d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o||c!==l)&&Um(t,s,a,l),Qn=!1;var f=t.memoizedState;s.state=f,Js(t,a,s,i),Ks(),c=t.memoizedState,o||f!==c||Qn?(typeof p=="function"&&(Eu(t,n,p,a),c=t.memoizedState),(u=Qn||zm(t,n,u,a,f,c,l))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=c),s.props=a,s.state=c,s.context=l,a=u):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{s=t.stateNode,dc(e,t),l=t.memoizedProps,d=Ha(n,l),s.props=d,p=t.pendingProps,f=s.context,c=n.contextType,u=Oi,typeof c=="object"&&c!==null&&(u=Xe(c)),o=n.getDerivedStateFromProps,(c=typeof o=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==p||f!==u)&&Um(t,s,a,u),Qn=!1,f=t.memoizedState,s.state=f,Js(t,a,s,i),Ks();var m=t.memoizedState;l!==p||f!==m||Qn||e!==null&&e.dependencies!==null&&Go(e.dependencies)?(typeof o=="function"&&(Eu(t,n,o,a),m=t.memoizedState),(d=Qn||zm(t,n,d,a,f,m,u)||e!==null&&e.dependencies!==null&&Go(e.dependencies))?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(a,m,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(a,m,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=m),s.props=a,s.state=m,s.context=u,a=d):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),a=!1)}return s=a,Mo(e,t),a=(t.flags&128)!==0,s||a?(s=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&a?(t.child=$i(t,e.child,null,i),t.child=$i(t,null,n,i)):Ve(e,t,n,i),t.memoizedState=s.state,e=t.child):e=wn(e,t,i),e}function Gm(e,t,n,a){return wl(),t.flags|=256,Ve(e,t,n,a),t.child}var Mu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nu(e){return{baseLanes:e,cachePool:sp()}}function Ru(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Rt),e}function Fp(e,t,n){var a=t.pendingProps,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(De.current&2)!==0),l&&(i=!0,t.flags&=-129),l=(t.flags&32)!==0,t.flags&=-33,e===null){if(J){if(i?Pn(t):$n(t),J){var o=_e,u;if(u=o){e:{for(u=o,o=Pt;u.nodeType!==8;){if(!o){o=null;break e}if(u=Bt(u.nextSibling),u===null){o=null;break e}}o=u}o!==null?(t.memoizedState={dehydrated:o,treeContext:Ra!==null?{id:hn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},u=mt(18,null,null,0),u.stateNode=o,u.return=t,t.child=u,et=t,_e=null,u=!0):u=!1}u||Ua(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return kc(o)?t.lanes=32:t.lanes=536870912,null;bn(t)}return o=a.children,a=a.fallback,i?($n(t),i=t.mode,o=Ko({mode:"hidden",children:o},i),a=Na(a,i,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,i=t.child,i.memoizedState=Nu(n),i.childLanes=Ru(e,l,n),t.memoizedState=Mu,a):(Pn(t),Sc(t,o))}if(u=e.memoizedState,u!==null&&(o=u.dehydrated,o!==null)){if(s)t.flags&256?(Pn(t),t.flags&=-257,t=Ou(e,t,n)):t.memoizedState!==null?($n(t),t.child=e.child,t.flags|=128,t=null):($n(t),i=a.fallback,o=t.mode,a=Ko({mode:"visible",children:a.children},o),i=Na(i,o,n,null),i.flags|=2,a.return=t,i.return=t,a.sibling=i,t.child=a,$i(t,e.child,null,n),a=t.child,a.memoizedState=Nu(n),a.childLanes=Ru(e,l,n),t.memoizedState=Mu,t=i);else if(Pn(t),kc(o)){if(l=o.nextSibling&&o.nextSibling.dataset,l)var c=l.dgst;l=c,a=Error(_(419)),a.stack="",a.digest=l,rl({value:a,source:null,stack:null}),t=Ou(e,t,n)}else if(He||Tl(e,t,n,!1),l=(n&e.childLanes)!==0,He||l){if(l=re,l!==null&&(a=n&-n,a=a&42?1:Vc(a),a=a&(l.suspendedLanes|n)?0:a,a!==0&&a!==u.retryLane))throw u.retryLane=a,ns(e,a),vt(l,e,a),Kp;o.data==="$?"||Cc(),t=Ou(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,_e=Bt(o.nextSibling),et=t,J=!0,Oa=null,Pt=!1,e!==null&&(Ct[Et++]=hn,Ct[Et++]=vn,Ct[Et++]=Ra,hn=e.id,vn=e.overflow,Ra=t),t=Sc(t,a.children),t.flags|=4096);return t}return i?($n(t),i=a.fallback,o=t.mode,u=e.child,c=u.sibling,a=Sn(u,{mode:"hidden",children:a.children}),a.subtreeFlags=u.subtreeFlags&65011712,c!==null?i=Sn(c,i):(i=Na(i,o,n,null),i.flags|=2),i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,o=e.child.memoizedState,o===null?o=Nu(n):(u=o.cachePool,u!==null?(c=Oe._currentValue,u=u.parent!==c?{parent:c,pool:c}:u):u=sp(),o={baseLanes:o.baseLanes|n,cachePool:u}),i.memoizedState=o,i.childLanes=Ru(e,l,n),t.memoizedState=Mu,a):(Pn(t),n=e.child,e=n.sibling,n=Sn(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(l=t.deletions,l===null?(t.deletions=[e],t.flags|=16):l.push(e)),t.child=n,t.memoizedState=null,n)}function Sc(e,t){return t=Ko({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ko(e,t){return e=mt(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Ou(e,t,n){return $i(t,e.child,null,n),e=Sc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Im(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),oc(e.return,t,n)}function Du(e,t,n,a,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=a,s.tail=n,s.tailMode=i)}function eh(e,t,n){var a=t.pendingProps,i=a.revealOrder,s=a.tail;if(Ve(e,t,a.children,n),a=De.current,a&2)a=a&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Im(e,n,t);else if(e.tag===19)Im(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}a&=1}switch(ye(De,a),i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Xo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Du(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Xo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Du(t,!0,n,null,s);break;case"together":Du(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function wn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),da|=t.lanes,!(n&t.childLanes))if(e!==null){if(Tl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(_(153));if(t.child!==null){for(e=t.child,n=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vd(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Go(e)))}function xb(e,t,n){switch(t.tag){case 3:zo(t,t.stateNode.containerInfo),Xn(t,Oe,e.memoizedState.cache),wl();break;case 27:case 5:$u(t);break;case 4:zo(t,t.stateNode.containerInfo);break;case 10:Xn(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Pn(t),t.flags|=128,null):n&t.child.childLanes?Fp(e,t,n):(Pn(t),e=wn(e,t,n),e!==null?e.sibling:null);Pn(t);break;case 19:var i=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(Tl(e,t,n,!1),a=(n&t.childLanes)!==0),i){if(a)return eh(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ye(De,De.current),a)break;return null;case 22:case 23:return t.lanes=0,Wp(e,t,n);case 24:Xn(t,Oe,e.memoizedState.cache)}return wn(e,t,n)}function th(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)He=!0;else{if(!vd(e,n)&&!(t.flags&128))return He=!1,xb(e,t,n);He=!!(e.flags&131072)}else He=!1,J&&t.flags&1048576&&ap(t,Vo,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,i=a._init;if(a=i(a._payload),t.type=a,typeof a=="function")Wc(a)?(e=Ha(a,e),t.tag=1,t=Vm(null,t,a,e,n)):(t.tag=0,t=bc(null,t,a,e,n));else{if(a!=null){if(i=a.$$typeof,i===Hc){t.tag=11,t=jm(null,t,a,e,n);break e}else if(i===Lc){t.tag=14,t=Hm(null,t,a,e,n);break e}}throw t=Xu(a)||a,Error(_(306,t,""))}}return t;case 0:return bc(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,i=Ha(a,t.pendingProps),Vm(e,t,a,i,n);case 3:e:{if(zo(t,t.stateNode.containerInfo),e===null)throw Error(_(387));a=t.pendingProps;var s=t.memoizedState;i=s.element,dc(e,t),Js(t,a,null,n);var l=t.memoizedState;if(a=l.cache,Xn(t,Oe,a),a!==s.cache&&rc(t,[Oe],n,!0),Ks(),a=l.element,s.isDehydrated)if(s={element:a,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Gm(e,t,a,n);break e}else if(a!==i){i=Nt(Error(_(424)),t),rl(i),t=Gm(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_e=Bt(e.firstChild),et=t,J=!0,Oa=null,Pt=!0,n=Ip(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(wl(),a===i){t=wn(e,t,n);break e}Ve(e,t,a,n)}t=t.child}return t;case 26:return Mo(e,t),e===null?(n=rg(t.type,null,t.pendingProps,null))?t.memoizedState=n:J||(n=t.type,e=t.pendingProps,a=ar(ta.current).createElement(n),a[Qe]=t,a[it]=e,Ie(a,n,e),je(a),t.stateNode=a):t.memoizedState=rg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $u(t),e===null&&J&&(a=t.stateNode=Vh(t.type,t.pendingProps,ta.current),et=t,Pt=!0,i=_e,ma(t.type)?(zc=i,_e=Bt(a.firstChild)):_e=i),Ve(e,t,t.pendingProps.children,n),Mo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&J&&((i=a=_e)&&(a=$b(a,t.type,t.pendingProps,Pt),a!==null?(t.stateNode=a,et=t,_e=Bt(a.firstChild),Pt=!1,i=!0):i=!1),i||Ua(t)),$u(t),i=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,a=s.children,Oc(i,s)?a=null:l!==null&&Oc(i,l)&&(t.flags|=32),t.memoizedState!==null&&(i=ld(e,t,pb,null,null,n),gl._currentValue=i),Mo(e,t),Ve(e,t,a,n),t.child;case 6:return e===null&&J&&((e=n=_e)&&(n=Kb(n,t.pendingProps,Pt),n!==null?(t.stateNode=n,et=t,_e=null,e=!0):e=!1),e||Ua(t)),null;case 13:return Fp(e,t,n);case 4:return zo(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=$i(t,null,a,n):Ve(e,t,a,n),t.child;case 11:return jm(e,t,t.type,t.pendingProps,n);case 7:return Ve(e,t,t.pendingProps,n),t.child;case 8:return Ve(e,t,t.pendingProps.children,n),t.child;case 12:return Ve(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Xn(t,t.type,a.value),Ve(e,t,a.children,n),t.child;case 9:return i=t.type._context,a=t.pendingProps.children,qa(t),i=Xe(i),a=a(i),t.flags|=1,Ve(e,t,a,n),t.child;case 14:return Hm(e,t,t.type,t.pendingProps,n);case 15:return Jp(e,t,t.type,t.pendingProps,n);case 19:return eh(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=Ko(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Sn(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Wp(e,t,n);case 24:return qa(t),a=Xe(Oe),e===null?(i=nd(),i===null&&(i=re,s=td(),i.pooledCache=s,s.refCount++,s!==null&&(i.pooledCacheLanes|=n),i=s),t.memoizedState={parent:a,cache:i},ad(t),Xn(t,Oe,i)):(e.lanes&n&&(dc(e,t),Js(t,null,null,n),Ks()),i=e.memoizedState,s=t.memoizedState,i.parent!==a?(i={parent:a,cache:a},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Xn(t,Oe,a)):(a=s.cache,Xn(t,Oe,a),a!==i.cache&&rc(t,[Oe],n,!0))),Ve(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(_(156,t.tag))}function fn(e){e.flags|=4}function Ym(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Yh(t)){if(t=Ot.current,t!==null&&(($&4194048)===$?Wt!==null:($&62914560)!==$&&!($&536870912)||t!==Wt))throw Ps=cc,lp;e.flags|=8192}}function go(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Eg():536870912,e.lanes|=t,Ki|=t)}function qs(e,t){if(!J)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Ae(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags&65011712,a|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags,a|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function wb(e,t,n){var a=t.pendingProps;switch(ed(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ae(t),null;case 1:return Ae(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),An(Oe),Ii(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(zs(t)?fn(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Sm())),Ae(t),null;case 26:return n=t.memoizedState,e===null?(fn(t),n!==null?(Ae(t),Ym(t,n)):(Ae(t),t.flags&=-16777217)):n?n!==e.memoizedState?(fn(t),Ae(t),Ym(t,n)):(Ae(t),t.flags&=-16777217):(e.memoizedProps!==a&&fn(t),Ae(t),t.flags&=-16777217),null;case 27:Uo(t),n=ta.current;var i=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&fn(t);else{if(!a){if(t.stateNode===null)throw Error(_(166));return Ae(t),null}e=Kt.current,zs(t)?ym(t,e):(e=Vh(i,a,n),t.stateNode=e,fn(t))}return Ae(t),null;case 5:if(Uo(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&fn(t);else{if(!a){if(t.stateNode===null)throw Error(_(166));return Ae(t),null}if(e=Kt.current,zs(t))ym(t,e);else{switch(i=ar(ta.current),e){case 1:e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=i.createElement("div"),e.innerHTML=" {#if metadata} +function create_catch_block(ctx) { + return { + c: noop, + m: noop, + p: noop, + i: noop, + o: noop, + d: noop + }; +} + +// (8:37) ; export let metadata; {#if metadata} +function create_pending_block(ctx) { + return { + c: noop, + m: noop, + p: noop, + i: noop, + o: noop, + d: noop + }; +} + +function create_fragment$5(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block$1, create_else_block]; + const if_blocks = []; + + function select_block_type(ctx, dirty) { + if (/*metadata*/ ctx[0]) return 0; + return 1; + } + + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx); + + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx, dirty); + } else { + group_outros(); + + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + + check_outros(); + if_block = if_blocks[current_block_type_index]; + + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + if_block.c(); + } else { + if_block.p(ctx, dirty); + } + + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if_blocks[current_block_type_index].d(detaching); + if (detaching) detach(if_block_anchor); + } + }; +} + +function instance$5($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + + let { metadata } = $$props; + + $$self.$$set = $$props => { + if ("metadata" in $$props) $$invalidate(0, metadata = $$props.metadata); + if ("$$scope" in $$props) $$invalidate(1, $$scope = $$props.$$scope); + }; + + return [metadata, $$scope, slots]; +} + +class MetadataResolver extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$5, create_fragment$5, not_equal, { metadata: 0 }); + } +} + +function isMacOS() { + return navigator.appVersion.indexOf("Mac") !== -1; +} +function isMetaPressed(e) { + return isMacOS() ? e.metaKey : e.ctrlKey; +} +function getDaysOfWeek(..._args) { + return window.moment.weekdaysShort(true); +} +function isWeekend(date) { + return date.isoWeekday() === 6 || date.isoWeekday() === 7; +} +function getStartOfWeek(days) { + return days[0].weekday(0); +} +/** + * Generate a 2D array of daily information to power + * the calendar view. + */ +function getMonth(displayedMonth, ..._args) { + const locale = window.moment().locale(); + const month = []; + let week; + const startOfMonth = displayedMonth.clone().locale(locale).date(1); + const startOffset = startOfMonth.weekday(); + let date = startOfMonth.clone().subtract(startOffset, "days"); + for (let _day = 0; _day < 42; _day++) { + if (_day % 7 === 0) { + week = { + days: [], + weekNum: date.week(), + }; + month.push(week); + } + week.days.push(date); + date = date.clone().add(1, "days"); + } + return month; +} + +/* src/components/Day.svelte generated by Svelte v3.35.0 */ + +function add_css$4() { + var style = element("style"); + style.id = "svelte-q3wqg9-style"; + style.textContent = ".day.svelte-q3wqg9{background-color:var(--color-background-day);border-radius:4px;color:var(--color-text-day);cursor:pointer;font-size:0.8em;height:100%;padding:4px;position:relative;text-align:center;transition:background-color 0.1s ease-in, color 0.1s ease-in;vertical-align:baseline}.day.svelte-q3wqg9:hover{background-color:var(--interactive-hover)}.day.active.svelte-q3wqg9:hover{background-color:var(--interactive-accent-hover)}.adjacent-month.svelte-q3wqg9{opacity:0.25}.today.svelte-q3wqg9{color:var(--color-text-today)}.day.svelte-q3wqg9:active,.active.svelte-q3wqg9,.active.today.svelte-q3wqg9{color:var(--text-on-accent);background-color:var(--interactive-accent)}.dot-container.svelte-q3wqg9{display:flex;flex-wrap:wrap;justify-content:center;line-height:6px;min-height:6px}"; + append(document.head, style); +} + +function get_each_context$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (36:8) {#each metadata.dots as dot} +function create_each_block$2(ctx) { + let dot; + let current; + const dot_spread_levels = [/*dot*/ ctx[11]]; + let dot_props = {}; + + for (let i = 0; i < dot_spread_levels.length; i += 1) { + dot_props = assign(dot_props, dot_spread_levels[i]); + } + + dot = new Dot({ props: dot_props }); + + return { + c() { + create_component(dot.$$.fragment); + }, + m(target, anchor) { + mount_component(dot, target, anchor); + current = true; + }, + p(ctx, dirty) { + const dot_changes = (dirty & /*metadata*/ 128) + ? get_spread_update(dot_spread_levels, [get_spread_object(/*dot*/ ctx[11])]) + : {}; + + dot.$set(dot_changes); + }, + i(local) { + if (current) return; + transition_in(dot.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dot.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dot, detaching); + } + }; +} + +// (22:2) +function create_default_slot$1(ctx) { + let div1; + let t0_value = /*date*/ ctx[0].format("D") + ""; + let t0; + let t1; + let div0; + let div1_class_value; + let current; + let mounted; + let dispose; + let each_value = /*metadata*/ ctx[7].dots; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); + } + + const out = i => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + + let div1_levels = [ + { + class: div1_class_value = `day ${/*metadata*/ ctx[7].classes.join(" ")}` + }, + /*metadata*/ ctx[7].dataAttributes || {} + ]; + + let div1_data = {}; + + for (let i = 0; i < div1_levels.length; i += 1) { + div1_data = assign(div1_data, div1_levels[i]); + } + + return { + c() { + div1 = element("div"); + t0 = text(t0_value); + t1 = space(); + div0 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(div0, "class", "dot-container svelte-q3wqg9"); + set_attributes(div1, div1_data); + toggle_class(div1, "active", /*selectedId*/ ctx[6] === getDateUID_1(/*date*/ ctx[0], "day")); + toggle_class(div1, "adjacent-month", !/*date*/ ctx[0].isSame(/*displayedMonth*/ ctx[5], "month")); + toggle_class(div1, "today", /*date*/ ctx[0].isSame(/*today*/ ctx[4], "day")); + toggle_class(div1, "svelte-q3wqg9", true); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, t0); + append(div1, t1); + append(div1, div0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen(div1, "click", function () { + if (is_function(/*onClick*/ ctx[2] && /*click_handler*/ ctx[8])) (/*onClick*/ ctx[2] && /*click_handler*/ ctx[8]).apply(this, arguments); + }), + listen(div1, "contextmenu", function () { + if (is_function(/*onContextMenu*/ ctx[3] && /*contextmenu_handler*/ ctx[9])) (/*onContextMenu*/ ctx[3] && /*contextmenu_handler*/ ctx[9]).apply(this, arguments); + }), + listen(div1, "pointerover", function () { + if (is_function(/*onHover*/ ctx[1] && /*pointerover_handler*/ ctx[10])) (/*onHover*/ ctx[1] && /*pointerover_handler*/ ctx[10]).apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if ((!current || dirty & /*date*/ 1) && t0_value !== (t0_value = /*date*/ ctx[0].format("D") + "")) set_data(t0, t0_value); + + if (dirty & /*metadata*/ 128) { + each_value = /*metadata*/ ctx[7].dots; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$2(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$2(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div0, null); + } + } + + group_outros(); + + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + + check_outros(); + } + + set_attributes(div1, div1_data = get_spread_update(div1_levels, [ + (!current || dirty & /*metadata*/ 128 && div1_class_value !== (div1_class_value = `day ${/*metadata*/ ctx[7].classes.join(" ")}`)) && { class: div1_class_value }, + dirty & /*metadata*/ 128 && (/*metadata*/ ctx[7].dataAttributes || {}) + ])); + + toggle_class(div1, "active", /*selectedId*/ ctx[6] === getDateUID_1(/*date*/ ctx[0], "day")); + toggle_class(div1, "adjacent-month", !/*date*/ ctx[0].isSame(/*displayedMonth*/ ctx[5], "month")); + toggle_class(div1, "today", /*date*/ ctx[0].isSame(/*today*/ ctx[4], "day")); + toggle_class(div1, "svelte-q3wqg9", true); + }, + i(local) { + if (current) return; + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div1); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} + +function create_fragment$4(ctx) { + let td; + let metadataresolver; + let current; + + metadataresolver = new MetadataResolver({ + props: { + metadata: /*metadata*/ ctx[7], + $$slots: { + default: [ + create_default_slot$1, + ({ metadata }) => ({ 7: metadata }), + ({ metadata }) => metadata ? 128 : 0 + ] + }, + $$scope: { ctx } + } + }); + + return { + c() { + td = element("td"); + create_component(metadataresolver.$$.fragment); + }, + m(target, anchor) { + insert(target, td, anchor); + mount_component(metadataresolver, td, null); + current = true; + }, + p(ctx, [dirty]) { + const metadataresolver_changes = {}; + if (dirty & /*metadata*/ 128) metadataresolver_changes.metadata = /*metadata*/ ctx[7]; + + if (dirty & /*$$scope, metadata, selectedId, date, displayedMonth, today, onClick, onContextMenu, onHover*/ 16639) { + metadataresolver_changes.$$scope = { dirty, ctx }; + } + + metadataresolver.$set(metadataresolver_changes); + }, + i(local) { + if (current) return; + transition_in(metadataresolver.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(metadataresolver.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(td); + destroy_component(metadataresolver); + } + }; +} + +function instance$4($$self, $$props, $$invalidate) { + + + let { date } = $$props; + let { metadata } = $$props; + let { onHover } = $$props; + let { onClick } = $$props; + let { onContextMenu } = $$props; + let { today } = $$props; + let { displayedMonth = null } = $$props; + let { selectedId = null } = $$props; + const click_handler = e => onClick(date, isMetaPressed(e)); + const contextmenu_handler = e => onContextMenu(date, e); + const pointerover_handler = e => onHover(date, e.target, isMetaPressed(e)); + + $$self.$$set = $$props => { + if ("date" in $$props) $$invalidate(0, date = $$props.date); + if ("metadata" in $$props) $$invalidate(7, metadata = $$props.metadata); + if ("onHover" in $$props) $$invalidate(1, onHover = $$props.onHover); + if ("onClick" in $$props) $$invalidate(2, onClick = $$props.onClick); + if ("onContextMenu" in $$props) $$invalidate(3, onContextMenu = $$props.onContextMenu); + if ("today" in $$props) $$invalidate(4, today = $$props.today); + if ("displayedMonth" in $$props) $$invalidate(5, displayedMonth = $$props.displayedMonth); + if ("selectedId" in $$props) $$invalidate(6, selectedId = $$props.selectedId); + }; + + return [ + date, + onHover, + onClick, + onContextMenu, + today, + displayedMonth, + selectedId, + metadata, + click_handler, + contextmenu_handler, + pointerover_handler + ]; +} + +class Day extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-q3wqg9-style")) add_css$4(); + + init(this, options, instance$4, create_fragment$4, not_equal, { + date: 0, + metadata: 7, + onHover: 1, + onClick: 2, + onContextMenu: 3, + today: 4, + displayedMonth: 5, + selectedId: 6 + }); + } +} + +/* src/components/Arrow.svelte generated by Svelte v3.35.0 */ + +function add_css$3() { + var style = element("style"); + style.id = "svelte-156w7na-style"; + style.textContent = ".arrow.svelte-156w7na.svelte-156w7na{align-items:center;cursor:pointer;display:flex;justify-content:center;width:24px}.arrow.is-mobile.svelte-156w7na.svelte-156w7na{width:32px}.right.svelte-156w7na.svelte-156w7na{transform:rotate(180deg)}.arrow.svelte-156w7na svg.svelte-156w7na{color:var(--color-arrow);height:16px;width:16px}"; + append(document.head, style); +} + +function create_fragment$3(ctx) { + let div; + let svg; + let path; + let mounted; + let dispose; + + return { + c() { + div = element("div"); + svg = svg_element("svg"); + path = svg_element("path"); + attr(path, "fill", "currentColor"); + attr(path, "d", "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"); + attr(svg, "focusable", "false"); + attr(svg, "role", "img"); + attr(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr(svg, "viewBox", "0 0 320 512"); + attr(svg, "class", "svelte-156w7na"); + attr(div, "class", "arrow svelte-156w7na"); + attr(div, "aria-label", /*tooltip*/ ctx[1]); + toggle_class(div, "is-mobile", /*isMobile*/ ctx[3]); + toggle_class(div, "right", /*direction*/ ctx[2] === "right"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, svg); + append(svg, path); + + if (!mounted) { + dispose = listen(div, "click", function () { + if (is_function(/*onClick*/ ctx[0])) /*onClick*/ ctx[0].apply(this, arguments); + }); + + mounted = true; + } + }, + p(new_ctx, [dirty]) { + ctx = new_ctx; + + if (dirty & /*tooltip*/ 2) { + attr(div, "aria-label", /*tooltip*/ ctx[1]); + } + + if (dirty & /*direction*/ 4) { + toggle_class(div, "right", /*direction*/ ctx[2] === "right"); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(div); + mounted = false; + dispose(); + } + }; +} + +function instance$3($$self, $$props, $$invalidate) { + let { onClick } = $$props; + let { tooltip } = $$props; + let { direction } = $$props; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + $$self.$$set = $$props => { + if ("onClick" in $$props) $$invalidate(0, onClick = $$props.onClick); + if ("tooltip" in $$props) $$invalidate(1, tooltip = $$props.tooltip); + if ("direction" in $$props) $$invalidate(2, direction = $$props.direction); + }; + + return [onClick, tooltip, direction, isMobile]; +} + +class Arrow extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-156w7na-style")) add_css$3(); + init(this, options, instance$3, create_fragment$3, safe_not_equal, { onClick: 0, tooltip: 1, direction: 2 }); + } +} + +/* src/components/Nav.svelte generated by Svelte v3.35.0 */ + +function add_css$2() { + var style = element("style"); + style.id = "svelte-1vwr9dd-style"; + style.textContent = ".nav.svelte-1vwr9dd.svelte-1vwr9dd{align-items:center;display:flex;margin:0.6em 0 1em;padding:0 8px;width:100%}.nav.is-mobile.svelte-1vwr9dd.svelte-1vwr9dd{padding:0}.title.svelte-1vwr9dd.svelte-1vwr9dd{color:var(--color-text-title);font-size:1.5em;margin:0}.is-mobile.svelte-1vwr9dd .title.svelte-1vwr9dd{font-size:1.3em}.month.svelte-1vwr9dd.svelte-1vwr9dd{font-weight:500;text-transform:capitalize}.year.svelte-1vwr9dd.svelte-1vwr9dd{color:var(--interactive-accent)}.right-nav.svelte-1vwr9dd.svelte-1vwr9dd{display:flex;justify-content:center;margin-left:auto}.reset-button.svelte-1vwr9dd.svelte-1vwr9dd{cursor:pointer;border-radius:4px;color:var(--text-muted);font-size:0.7em;font-weight:600;letter-spacing:1px;margin:0 4px;padding:0px 4px;text-transform:uppercase}.is-mobile.svelte-1vwr9dd .reset-button.svelte-1vwr9dd{display:none}"; + append(document.head, style); +} + +function create_fragment$2(ctx) { + let div2; + let h3; + let span0; + let t0_value = /*displayedMonth*/ ctx[0].format("MMM") + ""; + let t0; + let t1; + let span1; + let t2_value = /*displayedMonth*/ ctx[0].format("YYYY") + ""; + let t2; + let t3; + let div1; + let arrow0; + let t4; + let div0; + let t6; + let arrow1; + let current; + let mounted; + let dispose; + + arrow0 = new Arrow({ + props: { + direction: "left", + onClick: /*decrementDisplayedMonth*/ ctx[3], + tooltip: "Previous Month" + } + }); + + arrow1 = new Arrow({ + props: { + direction: "right", + onClick: /*incrementDisplayedMonth*/ ctx[2], + tooltip: "Next Month" + } + }); + + return { + c() { + div2 = element("div"); + h3 = element("h3"); + span0 = element("span"); + t0 = text(t0_value); + t1 = space(); + span1 = element("span"); + t2 = text(t2_value); + t3 = space(); + div1 = element("div"); + create_component(arrow0.$$.fragment); + t4 = space(); + div0 = element("div"); + div0.textContent = `${/*todayDisplayStr*/ ctx[4]}`; + t6 = space(); + create_component(arrow1.$$.fragment); + attr(span0, "class", "month svelte-1vwr9dd"); + attr(span1, "class", "year svelte-1vwr9dd"); + attr(h3, "class", "title svelte-1vwr9dd"); + attr(div0, "class", "reset-button svelte-1vwr9dd"); + attr(div1, "class", "right-nav svelte-1vwr9dd"); + attr(div2, "class", "nav svelte-1vwr9dd"); + toggle_class(div2, "is-mobile", /*isMobile*/ ctx[5]); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, h3); + append(h3, span0); + append(span0, t0); + append(h3, t1); + append(h3, span1); + append(span1, t2); + append(div2, t3); + append(div2, div1); + mount_component(arrow0, div1, null); + append(div1, t4); + append(div1, div0); + append(div1, t6); + mount_component(arrow1, div1, null); + current = true; + + if (!mounted) { + dispose = [ + listen(h3, "click", function () { + if (is_function(/*resetDisplayedMonth*/ ctx[1])) /*resetDisplayedMonth*/ ctx[1].apply(this, arguments); + }), + listen(div0, "click", function () { + if (is_function(/*resetDisplayedMonth*/ ctx[1])) /*resetDisplayedMonth*/ ctx[1].apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, [dirty]) { + ctx = new_ctx; + if ((!current || dirty & /*displayedMonth*/ 1) && t0_value !== (t0_value = /*displayedMonth*/ ctx[0].format("MMM") + "")) set_data(t0, t0_value); + if ((!current || dirty & /*displayedMonth*/ 1) && t2_value !== (t2_value = /*displayedMonth*/ ctx[0].format("YYYY") + "")) set_data(t2, t2_value); + const arrow0_changes = {}; + if (dirty & /*decrementDisplayedMonth*/ 8) arrow0_changes.onClick = /*decrementDisplayedMonth*/ ctx[3]; + arrow0.$set(arrow0_changes); + const arrow1_changes = {}; + if (dirty & /*incrementDisplayedMonth*/ 4) arrow1_changes.onClick = /*incrementDisplayedMonth*/ ctx[2]; + arrow1.$set(arrow1_changes); + }, + i(local) { + if (current) return; + transition_in(arrow0.$$.fragment, local); + transition_in(arrow1.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(arrow0.$$.fragment, local); + transition_out(arrow1.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(div2); + destroy_component(arrow0); + destroy_component(arrow1); + mounted = false; + run_all(dispose); + } + }; +} + +function instance$2($$self, $$props, $$invalidate) { + + let { displayedMonth } = $$props; + let { today } = $$props; + let { resetDisplayedMonth } = $$props; + let { incrementDisplayedMonth } = $$props; + let { decrementDisplayedMonth } = $$props; + + // Get the word 'Today' but localized to the current language + const todayDisplayStr = today.calendar().split(/\d|\s/)[0]; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + $$self.$$set = $$props => { + if ("displayedMonth" in $$props) $$invalidate(0, displayedMonth = $$props.displayedMonth); + if ("today" in $$props) $$invalidate(6, today = $$props.today); + if ("resetDisplayedMonth" in $$props) $$invalidate(1, resetDisplayedMonth = $$props.resetDisplayedMonth); + if ("incrementDisplayedMonth" in $$props) $$invalidate(2, incrementDisplayedMonth = $$props.incrementDisplayedMonth); + if ("decrementDisplayedMonth" in $$props) $$invalidate(3, decrementDisplayedMonth = $$props.decrementDisplayedMonth); + }; + + return [ + displayedMonth, + resetDisplayedMonth, + incrementDisplayedMonth, + decrementDisplayedMonth, + todayDisplayStr, + isMobile, + today + ]; +} + +class Nav extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-1vwr9dd-style")) add_css$2(); + + init(this, options, instance$2, create_fragment$2, safe_not_equal, { + displayedMonth: 0, + today: 6, + resetDisplayedMonth: 1, + incrementDisplayedMonth: 2, + decrementDisplayedMonth: 3 + }); + } +} + +/* src/components/WeekNum.svelte generated by Svelte v3.35.0 */ + +function add_css$1() { + var style = element("style"); + style.id = "svelte-egt0yd-style"; + style.textContent = "td.svelte-egt0yd{border-right:1px solid var(--background-modifier-border)}.week-num.svelte-egt0yd{background-color:var(--color-background-weeknum);border-radius:4px;color:var(--color-text-weeknum);cursor:pointer;font-size:0.65em;height:100%;padding:4px;text-align:center;transition:background-color 0.1s ease-in, color 0.1s ease-in;vertical-align:baseline}.week-num.svelte-egt0yd:hover{background-color:var(--interactive-hover)}.week-num.active.svelte-egt0yd:hover{background-color:var(--interactive-accent-hover)}.active.svelte-egt0yd{color:var(--text-on-accent);background-color:var(--interactive-accent)}.dot-container.svelte-egt0yd{display:flex;flex-wrap:wrap;justify-content:center;line-height:6px;min-height:6px}"; + append(document.head, style); +} + +function get_each_context$1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (35:8) {#each metadata.dots as dot} +function create_each_block$1(ctx) { + let dot; + let current; + const dot_spread_levels = [/*dot*/ ctx[11]]; + let dot_props = {}; + + for (let i = 0; i < dot_spread_levels.length; i += 1) { + dot_props = assign(dot_props, dot_spread_levels[i]); + } + + dot = new Dot({ props: dot_props }); + + return { + c() { + create_component(dot.$$.fragment); + }, + m(target, anchor) { + mount_component(dot, target, anchor); + current = true; + }, + p(ctx, dirty) { + const dot_changes = (dirty & /*metadata*/ 64) + ? get_spread_update(dot_spread_levels, [get_spread_object(/*dot*/ ctx[11])]) + : {}; + + dot.$set(dot_changes); + }, + i(local) { + if (current) return; + transition_in(dot.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dot.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dot, detaching); + } + }; +} + +// (24:2) +function create_default_slot(ctx) { + let div1; + let t0; + let t1; + let div0; + let div1_class_value; + let current; + let mounted; + let dispose; + let each_value = /*metadata*/ ctx[6].dots; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); + } + + const out = i => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + + return { + c() { + div1 = element("div"); + t0 = text(/*weekNum*/ ctx[0]); + t1 = space(); + div0 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(div0, "class", "dot-container svelte-egt0yd"); + attr(div1, "class", div1_class_value = "" + (null_to_empty(`week-num ${/*metadata*/ ctx[6].classes.join(" ")}`) + " svelte-egt0yd")); + toggle_class(div1, "active", /*selectedId*/ ctx[5] === getDateUID_1(/*days*/ ctx[1][0], "week")); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, t0); + append(div1, t1); + append(div1, div0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen(div1, "click", function () { + if (is_function(/*onClick*/ ctx[3] && /*click_handler*/ ctx[8])) (/*onClick*/ ctx[3] && /*click_handler*/ ctx[8]).apply(this, arguments); + }), + listen(div1, "contextmenu", function () { + if (is_function(/*onContextMenu*/ ctx[4] && /*contextmenu_handler*/ ctx[9])) (/*onContextMenu*/ ctx[4] && /*contextmenu_handler*/ ctx[9]).apply(this, arguments); + }), + listen(div1, "pointerover", function () { + if (is_function(/*onHover*/ ctx[2] && /*pointerover_handler*/ ctx[10])) (/*onHover*/ ctx[2] && /*pointerover_handler*/ ctx[10]).apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (!current || dirty & /*weekNum*/ 1) set_data(t0, /*weekNum*/ ctx[0]); + + if (dirty & /*metadata*/ 64) { + each_value = /*metadata*/ ctx[6].dots; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$1(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$1(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div0, null); + } + } + + group_outros(); + + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + + check_outros(); + } + + if (!current || dirty & /*metadata*/ 64 && div1_class_value !== (div1_class_value = "" + (null_to_empty(`week-num ${/*metadata*/ ctx[6].classes.join(" ")}`) + " svelte-egt0yd"))) { + attr(div1, "class", div1_class_value); + } + + if (dirty & /*metadata, selectedId, getDateUID, days*/ 98) { + toggle_class(div1, "active", /*selectedId*/ ctx[5] === getDateUID_1(/*days*/ ctx[1][0], "week")); + } + }, + i(local) { + if (current) return; + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div1); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} + +function create_fragment$1(ctx) { + let td; + let metadataresolver; + let current; + + metadataresolver = new MetadataResolver({ + props: { + metadata: /*metadata*/ ctx[6], + $$slots: { + default: [ + create_default_slot, + ({ metadata }) => ({ 6: metadata }), + ({ metadata }) => metadata ? 64 : 0 + ] + }, + $$scope: { ctx } + } + }); + + return { + c() { + td = element("td"); + create_component(metadataresolver.$$.fragment); + attr(td, "class", "svelte-egt0yd"); + }, + m(target, anchor) { + insert(target, td, anchor); + mount_component(metadataresolver, td, null); + current = true; + }, + p(ctx, [dirty]) { + const metadataresolver_changes = {}; + if (dirty & /*metadata*/ 64) metadataresolver_changes.metadata = /*metadata*/ ctx[6]; + + if (dirty & /*$$scope, metadata, selectedId, days, onClick, startOfWeek, onContextMenu, onHover, weekNum*/ 16639) { + metadataresolver_changes.$$scope = { dirty, ctx }; + } + + metadataresolver.$set(metadataresolver_changes); + }, + i(local) { + if (current) return; + transition_in(metadataresolver.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(metadataresolver.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(td); + destroy_component(metadataresolver); + } + }; +} + +function instance$1($$self, $$props, $$invalidate) { + + + let { weekNum } = $$props; + let { days } = $$props; + let { metadata } = $$props; + let { onHover } = $$props; + let { onClick } = $$props; + let { onContextMenu } = $$props; + let { selectedId = null } = $$props; + let startOfWeek; + const click_handler = e => onClick(startOfWeek, isMetaPressed(e)); + const contextmenu_handler = e => onContextMenu(days[0], e); + const pointerover_handler = e => onHover(startOfWeek, e.target, isMetaPressed(e)); + + $$self.$$set = $$props => { + if ("weekNum" in $$props) $$invalidate(0, weekNum = $$props.weekNum); + if ("days" in $$props) $$invalidate(1, days = $$props.days); + if ("metadata" in $$props) $$invalidate(6, metadata = $$props.metadata); + if ("onHover" in $$props) $$invalidate(2, onHover = $$props.onHover); + if ("onClick" in $$props) $$invalidate(3, onClick = $$props.onClick); + if ("onContextMenu" in $$props) $$invalidate(4, onContextMenu = $$props.onContextMenu); + if ("selectedId" in $$props) $$invalidate(5, selectedId = $$props.selectedId); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*days*/ 2) { + $$invalidate(7, startOfWeek = getStartOfWeek(days)); + } + }; + + return [ + weekNum, + days, + onHover, + onClick, + onContextMenu, + selectedId, + metadata, + startOfWeek, + click_handler, + contextmenu_handler, + pointerover_handler + ]; +} + +class WeekNum extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-egt0yd-style")) add_css$1(); + + init(this, options, instance$1, create_fragment$1, not_equal, { + weekNum: 0, + days: 1, + metadata: 6, + onHover: 2, + onClick: 3, + onContextMenu: 4, + selectedId: 5 + }); + } +} + +async function metadataReducer(promisedMetadata) { + const meta = { + dots: [], + classes: [], + dataAttributes: {}, + }; + const metas = await Promise.all(promisedMetadata); + return metas.reduce((acc, meta) => ({ + classes: [...acc.classes, ...(meta.classes || [])], + dataAttributes: Object.assign(acc.dataAttributes, meta.dataAttributes), + dots: [...acc.dots, ...(meta.dots || [])], + }), meta); +} +function getDailyMetadata(sources, date, ..._args) { + return metadataReducer(sources.map((source) => source.getDailyMetadata(date))); +} +function getWeeklyMetadata(sources, date, ..._args) { + return metadataReducer(sources.map((source) => source.getWeeklyMetadata(date))); +} + +/* src/components/Calendar.svelte generated by Svelte v3.35.0 */ + +function add_css() { + var style = element("style"); + style.id = "svelte-pcimu8-style"; + style.textContent = ".container.svelte-pcimu8{--color-background-heading:transparent;--color-background-day:transparent;--color-background-weeknum:transparent;--color-background-weekend:transparent;--color-dot:var(--text-muted);--color-arrow:var(--text-muted);--color-button:var(--text-muted);--color-text-title:var(--text-normal);--color-text-heading:var(--text-muted);--color-text-day:var(--text-normal);--color-text-today:var(--interactive-accent);--color-text-weeknum:var(--text-muted)}.container.svelte-pcimu8{padding:0 8px}.container.is-mobile.svelte-pcimu8{padding:0}th.svelte-pcimu8{text-align:center}.weekend.svelte-pcimu8{background-color:var(--color-background-weekend)}.calendar.svelte-pcimu8{border-collapse:collapse;width:100%}th.svelte-pcimu8{background-color:var(--color-background-heading);color:var(--color-text-heading);font-size:0.6em;letter-spacing:1px;padding:4px;text-transform:uppercase}"; + append(document.head, style); +} + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[18] = list[i]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[21] = list[i]; + return child_ctx; +} + +function get_each_context_2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[24] = list[i]; + return child_ctx; +} + +function get_each_context_3(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[27] = list[i]; + return child_ctx; +} + +// (55:6) {#if showWeekNums} +function create_if_block_2(ctx) { + let col; + + return { + c() { + col = element("col"); + }, + m(target, anchor) { + insert(target, col, anchor); + }, + d(detaching) { + if (detaching) detach(col); + } + }; +} + +// (58:6) {#each month[1].days as date} +function create_each_block_3(ctx) { + let col; + + return { + c() { + col = element("col"); + attr(col, "class", "svelte-pcimu8"); + toggle_class(col, "weekend", isWeekend(/*date*/ ctx[27])); + }, + m(target, anchor) { + insert(target, col, anchor); + }, + p(ctx, dirty) { + if (dirty & /*isWeekend, month*/ 16384) { + toggle_class(col, "weekend", isWeekend(/*date*/ ctx[27])); + } + }, + d(detaching) { + if (detaching) detach(col); + } + }; +} + +// (64:8) {#if showWeekNums} +function create_if_block_1(ctx) { + let th; + + return { + c() { + th = element("th"); + th.textContent = "W"; + attr(th, "class", "svelte-pcimu8"); + }, + m(target, anchor) { + insert(target, th, anchor); + }, + d(detaching) { + if (detaching) detach(th); + } + }; +} + +// (67:8) {#each daysOfWeek as dayOfWeek} +function create_each_block_2(ctx) { + let th; + let t_value = /*dayOfWeek*/ ctx[24] + ""; + let t; + + return { + c() { + th = element("th"); + t = text(t_value); + attr(th, "class", "svelte-pcimu8"); + }, + m(target, anchor) { + insert(target, th, anchor); + append(th, t); + }, + p(ctx, dirty) { + if (dirty & /*daysOfWeek*/ 32768 && t_value !== (t_value = /*dayOfWeek*/ ctx[24] + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) detach(th); + } + }; +} + +// (75:10) {#if showWeekNums} +function create_if_block(ctx) { + let weeknum; + let current; + + const weeknum_spread_levels = [ + /*week*/ ctx[18], + { + metadata: getWeeklyMetadata(/*sources*/ ctx[8], /*week*/ ctx[18].days[0], /*today*/ ctx[10]) + }, + { onClick: /*onClickWeek*/ ctx[7] }, + { + onContextMenu: /*onContextMenuWeek*/ ctx[5] + }, + { onHover: /*onHoverWeek*/ ctx[3] }, + { selectedId: /*selectedId*/ ctx[9] } + ]; + + let weeknum_props = {}; + + for (let i = 0; i < weeknum_spread_levels.length; i += 1) { + weeknum_props = assign(weeknum_props, weeknum_spread_levels[i]); + } + + weeknum = new WeekNum({ props: weeknum_props }); + + return { + c() { + create_component(weeknum.$$.fragment); + }, + m(target, anchor) { + mount_component(weeknum, target, anchor); + current = true; + }, + p(ctx, dirty) { + const weeknum_changes = (dirty & /*month, getWeeklyMetadata, sources, today, onClickWeek, onContextMenuWeek, onHoverWeek, selectedId*/ 18344) + ? get_spread_update(weeknum_spread_levels, [ + dirty & /*month*/ 16384 && get_spread_object(/*week*/ ctx[18]), + dirty & /*getWeeklyMetadata, sources, month, today*/ 17664 && { + metadata: getWeeklyMetadata(/*sources*/ ctx[8], /*week*/ ctx[18].days[0], /*today*/ ctx[10]) + }, + dirty & /*onClickWeek*/ 128 && { onClick: /*onClickWeek*/ ctx[7] }, + dirty & /*onContextMenuWeek*/ 32 && { + onContextMenu: /*onContextMenuWeek*/ ctx[5] + }, + dirty & /*onHoverWeek*/ 8 && { onHover: /*onHoverWeek*/ ctx[3] }, + dirty & /*selectedId*/ 512 && { selectedId: /*selectedId*/ ctx[9] } + ]) + : {}; + + weeknum.$set(weeknum_changes); + }, + i(local) { + if (current) return; + transition_in(weeknum.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(weeknum.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(weeknum, detaching); + } + }; +} + +// (85:10) {#each week.days as day (day.format())} +function create_each_block_1(key_1, ctx) { + let first; + let day; + let current; + + day = new Day({ + props: { + date: /*day*/ ctx[21], + today: /*today*/ ctx[10], + displayedMonth: /*displayedMonth*/ ctx[0], + onClick: /*onClickDay*/ ctx[6], + onContextMenu: /*onContextMenuDay*/ ctx[4], + onHover: /*onHoverDay*/ ctx[2], + metadata: getDailyMetadata(/*sources*/ ctx[8], /*day*/ ctx[21], /*today*/ ctx[10]), + selectedId: /*selectedId*/ ctx[9] + } + }); + + return { + key: key_1, + first: null, + c() { + first = empty(); + create_component(day.$$.fragment); + this.first = first; + }, + m(target, anchor) { + insert(target, first, anchor); + mount_component(day, target, anchor); + current = true; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const day_changes = {}; + if (dirty & /*month*/ 16384) day_changes.date = /*day*/ ctx[21]; + if (dirty & /*today*/ 1024) day_changes.today = /*today*/ ctx[10]; + if (dirty & /*displayedMonth*/ 1) day_changes.displayedMonth = /*displayedMonth*/ ctx[0]; + if (dirty & /*onClickDay*/ 64) day_changes.onClick = /*onClickDay*/ ctx[6]; + if (dirty & /*onContextMenuDay*/ 16) day_changes.onContextMenu = /*onContextMenuDay*/ ctx[4]; + if (dirty & /*onHoverDay*/ 4) day_changes.onHover = /*onHoverDay*/ ctx[2]; + if (dirty & /*sources, month, today*/ 17664) day_changes.metadata = getDailyMetadata(/*sources*/ ctx[8], /*day*/ ctx[21], /*today*/ ctx[10]); + if (dirty & /*selectedId*/ 512) day_changes.selectedId = /*selectedId*/ ctx[9]; + day.$set(day_changes); + }, + i(local) { + if (current) return; + transition_in(day.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(day.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(first); + destroy_component(day, detaching); + } + }; +} + +// (73:6) {#each month as week (week.weekNum)} +function create_each_block(key_1, ctx) { + let tr; + let t0; + let each_blocks = []; + let each_1_lookup = new Map(); + let t1; + let current; + let if_block = /*showWeekNums*/ ctx[1] && create_if_block(ctx); + let each_value_1 = /*week*/ ctx[18].days; + const get_key = ctx => /*day*/ ctx[21].format(); + + for (let i = 0; i < each_value_1.length; i += 1) { + let child_ctx = get_each_context_1(ctx, each_value_1, i); + let key = get_key(child_ctx); + each_1_lookup.set(key, each_blocks[i] = create_each_block_1(key, child_ctx)); + } + + return { + key: key_1, + first: null, + c() { + tr = element("tr"); + if (if_block) if_block.c(); + t0 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t1 = space(); + this.first = tr; + }, + m(target, anchor) { + insert(target, tr, anchor); + if (if_block) if_block.m(tr, null); + append(tr, t0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tr, null); + } + + append(tr, t1); + current = true; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + + if (/*showWeekNums*/ ctx[1]) { + if (if_block) { + if_block.p(ctx, dirty); + + if (dirty & /*showWeekNums*/ 2) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx); + if_block.c(); + transition_in(if_block, 1); + if_block.m(tr, t0); + } + } else if (if_block) { + group_outros(); + + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + + check_outros(); + } + + if (dirty & /*month, today, displayedMonth, onClickDay, onContextMenuDay, onHoverDay, getDailyMetadata, sources, selectedId*/ 18261) { + each_value_1 = /*week*/ ctx[18].days; + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value_1, each_1_lookup, tr, outro_and_destroy_block, create_each_block_1, t1, get_each_context_1); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + + for (let i = 0; i < each_value_1.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + transition_out(if_block); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(tr); + if (if_block) if_block.d(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + } + }; +} + +function create_fragment(ctx) { + let div; + let nav; + let t0; + let table; + let colgroup; + let t1; + let t2; + let thead; + let tr; + let t3; + let t4; + let tbody; + let each_blocks = []; + let each2_lookup = new Map(); + let current; + + nav = new Nav({ + props: { + today: /*today*/ ctx[10], + displayedMonth: /*displayedMonth*/ ctx[0], + incrementDisplayedMonth: /*incrementDisplayedMonth*/ ctx[11], + decrementDisplayedMonth: /*decrementDisplayedMonth*/ ctx[12], + resetDisplayedMonth: /*resetDisplayedMonth*/ ctx[13] + } + }); + + let if_block0 = /*showWeekNums*/ ctx[1] && create_if_block_2(); + let each_value_3 = /*month*/ ctx[14][1].days; + let each_blocks_2 = []; + + for (let i = 0; i < each_value_3.length; i += 1) { + each_blocks_2[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i)); + } + + let if_block1 = /*showWeekNums*/ ctx[1] && create_if_block_1(); + let each_value_2 = /*daysOfWeek*/ ctx[15]; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks_1[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); + } + + let each_value = /*month*/ ctx[14]; + const get_key = ctx => /*week*/ ctx[18].weekNum; + + for (let i = 0; i < each_value.length; i += 1) { + let child_ctx = get_each_context(ctx, each_value, i); + let key = get_key(child_ctx); + each2_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); + } + + return { + c() { + div = element("div"); + create_component(nav.$$.fragment); + t0 = space(); + table = element("table"); + colgroup = element("colgroup"); + if (if_block0) if_block0.c(); + t1 = space(); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].c(); + } + + t2 = space(); + thead = element("thead"); + tr = element("tr"); + if (if_block1) if_block1.c(); + t3 = space(); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + t4 = space(); + tbody = element("tbody"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(table, "class", "calendar svelte-pcimu8"); + attr(div, "id", "calendar-container"); + attr(div, "class", "container svelte-pcimu8"); + toggle_class(div, "is-mobile", /*isMobile*/ ctx[16]); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(nav, div, null); + append(div, t0); + append(div, table); + append(table, colgroup); + if (if_block0) if_block0.m(colgroup, null); + append(colgroup, t1); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].m(colgroup, null); + } + + append(table, t2); + append(table, thead); + append(thead, tr); + if (if_block1) if_block1.m(tr, null); + append(tr, t3); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(tr, null); + } + + append(table, t4); + append(table, tbody); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tbody, null); + } + + current = true; + }, + p(ctx, [dirty]) { + const nav_changes = {}; + if (dirty & /*today*/ 1024) nav_changes.today = /*today*/ ctx[10]; + if (dirty & /*displayedMonth*/ 1) nav_changes.displayedMonth = /*displayedMonth*/ ctx[0]; + nav.$set(nav_changes); + + if (/*showWeekNums*/ ctx[1]) { + if (if_block0) ; else { + if_block0 = create_if_block_2(); + if_block0.c(); + if_block0.m(colgroup, t1); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if (dirty & /*isWeekend, month*/ 16384) { + each_value_3 = /*month*/ ctx[14][1].days; + let i; + + for (i = 0; i < each_value_3.length; i += 1) { + const child_ctx = get_each_context_3(ctx, each_value_3, i); + + if (each_blocks_2[i]) { + each_blocks_2[i].p(child_ctx, dirty); + } else { + each_blocks_2[i] = create_each_block_3(child_ctx); + each_blocks_2[i].c(); + each_blocks_2[i].m(colgroup, null); + } + } + + for (; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].d(1); + } + + each_blocks_2.length = each_value_3.length; + } + + if (/*showWeekNums*/ ctx[1]) { + if (if_block1) ; else { + if_block1 = create_if_block_1(); + if_block1.c(); + if_block1.m(tr, t3); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if (dirty & /*daysOfWeek*/ 32768) { + each_value_2 = /*daysOfWeek*/ ctx[15]; + let i; + + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2(ctx, each_value_2, i); + + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_2(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(tr, null); + } + } + + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + + each_blocks_1.length = each_value_2.length; + } + + if (dirty & /*month, today, displayedMonth, onClickDay, onContextMenuDay, onHoverDay, getDailyMetadata, sources, selectedId, getWeeklyMetadata, onClickWeek, onContextMenuWeek, onHoverWeek, showWeekNums*/ 18431) { + each_value = /*month*/ ctx[14]; + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each2_lookup, tbody, outro_and_destroy_block, create_each_block, null, get_each_context); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(nav.$$.fragment, local); + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + transition_out(nav.$$.fragment, local); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div); + destroy_component(nav); + if (if_block0) if_block0.d(); + destroy_each(each_blocks_2, detaching); + if (if_block1) if_block1.d(); + destroy_each(each_blocks_1, detaching); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + } + }; +} + +function instance($$self, $$props, $$invalidate) { + + + let { localeData } = $$props; + let { showWeekNums = false } = $$props; + let { onHoverDay } = $$props; + let { onHoverWeek } = $$props; + let { onContextMenuDay } = $$props; + let { onContextMenuWeek } = $$props; + let { onClickDay } = $$props; + let { onClickWeek } = $$props; + let { sources = [] } = $$props; + let { selectedId } = $$props; + let { today = window.moment() } = $$props; + let { displayedMonth = today } = $$props; + let month; + let daysOfWeek; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + function incrementDisplayedMonth() { + $$invalidate(0, displayedMonth = displayedMonth.clone().add(1, "month")); + } + + function decrementDisplayedMonth() { + $$invalidate(0, displayedMonth = displayedMonth.clone().subtract(1, "month")); + } + + function resetDisplayedMonth() { + $$invalidate(0, displayedMonth = today.clone()); + } + + $$self.$$set = $$props => { + if ("localeData" in $$props) $$invalidate(17, localeData = $$props.localeData); + if ("showWeekNums" in $$props) $$invalidate(1, showWeekNums = $$props.showWeekNums); + if ("onHoverDay" in $$props) $$invalidate(2, onHoverDay = $$props.onHoverDay); + if ("onHoverWeek" in $$props) $$invalidate(3, onHoverWeek = $$props.onHoverWeek); + if ("onContextMenuDay" in $$props) $$invalidate(4, onContextMenuDay = $$props.onContextMenuDay); + if ("onContextMenuWeek" in $$props) $$invalidate(5, onContextMenuWeek = $$props.onContextMenuWeek); + if ("onClickDay" in $$props) $$invalidate(6, onClickDay = $$props.onClickDay); + if ("onClickWeek" in $$props) $$invalidate(7, onClickWeek = $$props.onClickWeek); + if ("sources" in $$props) $$invalidate(8, sources = $$props.sources); + if ("selectedId" in $$props) $$invalidate(9, selectedId = $$props.selectedId); + if ("today" in $$props) $$invalidate(10, today = $$props.today); + if ("displayedMonth" in $$props) $$invalidate(0, displayedMonth = $$props.displayedMonth); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*displayedMonth, localeData*/ 131073) { + $$invalidate(14, month = getMonth(displayedMonth, localeData)); + } + + if ($$self.$$.dirty & /*today, localeData*/ 132096) { + $$invalidate(15, daysOfWeek = getDaysOfWeek(today, localeData)); + } + }; + + return [ + displayedMonth, + showWeekNums, + onHoverDay, + onHoverWeek, + onContextMenuDay, + onContextMenuWeek, + onClickDay, + onClickWeek, + sources, + selectedId, + today, + incrementDisplayedMonth, + decrementDisplayedMonth, + resetDisplayedMonth, + month, + daysOfWeek, + isMobile, + localeData + ]; +} + +class Calendar extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-pcimu8-style")) add_css(); + + init(this, options, instance, create_fragment, not_equal, { + localeData: 17, + showWeekNums: 1, + onHoverDay: 2, + onHoverWeek: 3, + onContextMenuDay: 4, + onContextMenuWeek: 5, + onClickDay: 6, + onClickWeek: 7, + sources: 8, + selectedId: 9, + today: 10, + displayedMonth: 0, + incrementDisplayedMonth: 11, + decrementDisplayedMonth: 12, + resetDisplayedMonth: 13 + }); + } + + get incrementDisplayedMonth() { + return this.$$.ctx[11]; + } + + get decrementDisplayedMonth() { + return this.$$.ctx[12]; + } + + get resetDisplayedMonth() { + return this.$$.ctx[13]; + } +} + +/** Generic code for embedded Dataviews. */ +class DataviewRefreshableRenderer extends obsidian.MarkdownRenderChild { + container; + index; + app; + settings; + lastReload; + constructor(container, index, app, settings) { + super(container); + this.container = container; + this.index = index; + this.app = app; + this.settings = settings; + this.lastReload = 0; + } + onload() { + this.render(); + this.lastReload = this.index.revision; + // Refresh after index changes stop. + this.registerEvent(this.app.workspace.on("dataview:refresh-views", this.maybeRefresh)); + // ...or when the DOM is shown (sidebar expands, tab selected, nodes scrolled into view). + this.register(this.container.onNodeInserted(this.maybeRefresh)); + } + maybeRefresh = () => { + // If the index revision has changed recently, then queue a reload. + // But only if we're mounted in the DOM and auto-refreshing is active. + if (this.lastReload != this.index.revision && this.container.isShown() && this.settings.refreshEnabled) { + this.lastReload = this.index.revision; + this.render(); + } + }; +} + +class DataviewCalendarRenderer extends DataviewRefreshableRenderer { + query; + container; + index; + origin; + settings; + app; + calendar; + constructor(query, container, index, origin, settings, app) { + super(container, index, app, settings); + this.query = query; + this.container = container; + this.index = index; + this.origin = origin; + this.settings = settings; + this.app = app; + } + async render() { + this.container.innerHTML = ""; + let maybeResult = await asyncTryOrPropagate(() => executeCalendar(this.query, this.index, this.origin, this.settings)); + if (!maybeResult.successful) { + renderErrorPre(this.container, "Dataview: " + maybeResult.error); + return; + } + else if (maybeResult.value.data.length == 0 && this.settings.warnOnEmptyResult) { + renderErrorPre(this.container, "Dataview: Query returned 0 results."); + return; + } + let dateMap = new Map(); + for (let data of maybeResult.value.data) { + const dot = { + color: "default", + className: "note", + isFilled: true, + link: data.link, + }; + const d = data.date.toFormat("yyyyLLdd"); + if (!dateMap.has(d)) { + dateMap.set(d, [dot]); + } + else { + dateMap.get(d)?.push(dot); + } + } + const querySource = { + getDailyMetadata: async (date) => { + return { + dots: dateMap.get(date.format("YYYYMMDD")) || [], + }; + }, + }; + const sources = [querySource]; + const renderer = this; + this.calendar = new Calendar({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + target: this.container, + props: { + onHoverDay(date, targetEl) { + const vals = dateMap.get(date.format("YYYYMMDD")); + if (!vals || vals.length == 0) { + return; + } + if (vals?.length == 0) { + return; + } + renderer.app.workspace.trigger("link-hover", {}, targetEl, vals[0].link.path, vals[0].link.path); + }, + onClickDay: async (date) => { + const vals = dateMap.get(date.format("YYYYMMDD")); + if (!vals || vals.length == 0) { + return; + } + if (vals?.length == 0) { + return; + } + const file = renderer.app.metadataCache.getFirstLinkpathDest(vals[0].link.path, ""); + if (file == null) { + return; + } + const leaf = renderer.app.workspace.getUnpinnedLeaf(); + await leaf.openFile(file, { active: true }); + }, + showWeekNums: false, + sources, + }, + }); + } + onClose() { + if (this.calendar) { + this.calendar.$destroy(); + } + return Promise.resolve(); + } +} + +/** Fancy wrappers for the JavaScript API, used both by external plugins AND by the dataview javascript view. */ +/** Asynchronous API calls related to file / system IO. */ +class DataviewInlineIOApi { + api; + currentFile; + constructor(api, currentFile) { + this.api = api; + this.currentFile = currentFile; + } + /** Load the contents of a CSV asynchronously, returning a data array of rows (or undefined if it does not exist). */ + async csv(path, originFile) { + return this.api.csv(path, originFile || this.currentFile); + } + /** Asynchronously load the contents of any link or path in an Obsidian vault. */ + async load(path, originFile) { + return this.api.load(path, originFile || this.currentFile); + } + /** Normalize a link or path relative to an optional origin file. Returns a textual fully-qualified-path. */ + normalize(path, originFile) { + return this.api.normalize(path, originFile || this.currentFile); + } +} +class DataviewInlineApi { + /** + * The raw dataview indices, which track file <-> metadata relations. Use these if the intuitive API does not support + * your use case. + */ + index; + /** The component that handles the lifetime of this view. Use it if you are adding custom event handlers/components. */ + component; + /** The path to the current file this script is running in. */ + currentFilePath; + /** + * The container which holds the output of this view. You can directly append fields to this, if you wish, though + * the rendering API is likely to be easier for straight-forward purposes. + */ + container; + /** Directly access the Obsidian app object, such as for reaching out to other plugins. */ + app; + /** The general plugin API which much of this inline API delegates to. */ + api; + /** Settings which determine defaults, incl. many rendering options. */ + settings; + /** Evaluation context which expressions can be evaluated in. */ + evaluationContext; + /** Value utilities which allow for type-checking and comparisons. */ + value = Values; + /** Widget utility functions for creating built-in widgets. */ + widget = Widgets; + /** IO utilities which are largely asynchronous. */ + io; + /** Re-exporting of luxon for people who can't easily require it. Sorry! */ + luxon = Luxon; + /** Dataview functions which can be called from DataviewJS. */ + func; + constructor(api, component, container, currentFilePath) { + this.index = api.index; + this.app = api.app; + this.settings = api.settings; + this.component = component; + this.container = container; + this.currentFilePath = currentFilePath; + this.api = api; + this.io = new DataviewInlineIOApi(this.api.io, this.currentFilePath); + // Set up the evaluation context with variables from the current file. + let fileMeta = this.index.pages.get(this.currentFilePath)?.serialize(this.index) ?? {}; + this.evaluationContext = new Context(defaultLinkHandler(this.index, this.currentFilePath), this.settings, { + this: fileMeta, + }); + this.func = Functions.bindAll(DEFAULT_FUNCTIONS, this.evaluationContext); + } + ///////////////////////////// + // Index + Data Collection // + ///////////////////////////// + /** Return an array of paths (as strings) corresponding to pages which match the query. */ + pagePaths(query) { + return this.api.pagePaths(query, this.currentFilePath); + } + /** Map a page path to the actual data contained within that page. */ + page(path) { + return this.api.page(path, this.currentFilePath); + } + /** Return an array of page objects corresponding to pages which match the query. */ + pages(query) { + return this.api.pages(query, this.currentFilePath); + } + /** Return the information about the current page. */ + current() { + return this.page(this.currentFilePath); + } + /////////////////////////////// + // Dataview Query Evaluation // + /////////////////////////////// + /** Execute a Dataview query, returning the results in programmatic form. */ + async query(source, originFile, settings) { + return this.api.query(source, originFile ?? this.currentFilePath, settings); + } + /** Error-throwing version of {@link query}. */ + async tryQuery(source, originFile, settings) { + return this.api.tryQuery(source, originFile ?? this.currentFilePath, settings); + } + /** Execute a Dataview query, returning the results in Markdown. */ + async queryMarkdown(source, originFile, settings) { + return this.api.queryMarkdown(source, originFile ?? this.currentFilePath, settings); + } + /** Error-throwing version of {@link queryMarkdown}. */ + async tryQueryMarkdown(source, originFile, settings) { + return this.api.tryQueryMarkdown(source, originFile ?? this.currentFilePath, settings); + } + /** + * Evaluate a dataview expression (like '2 + 2' or 'link("hello")'), returning the evaluated result. + * This takes an optional second argument which provides definitions for variables, such as: + * + * ``` + * dv.evaluate("x + 6", { x: 2 }) = 8 + * dv.evaluate('link(target)', { target: "Okay" }) = [[Okay]] + * ``` + * + * Note that `this` is implicitly available and refers to the current file. + * + * This method returns a Result type instead of throwing an error; you can check the result of the + * execution via `result.successful` and obtain `result.value` or `result.error` accordingly. If + * you'd rather this method throw on an error, use `dv.tryEvaluate`. + */ + evaluate(expression, context) { + let field = EXPRESSION.field.parse(expression); + if (!field.status) + return Result.failure(`Failed to parse expression "${expression}"`); + return this.evaluationContext.evaluate(field.value, context); + } + /** Error-throwing version of `dv.evaluate`. */ + tryEvaluate(expression, context) { + return this.evaluate(expression, context).orElseThrow(); + } + /** Execute a Dataview query and embed it into the current view. */ + async execute(source) { + this.api.execute(source, this.container, this.component, this.currentFilePath); + } + /** Execute a DataviewJS query and embed it into the current view. */ + async executeJs(code) { + this.api.executeJs(code, this.container, this.component, this.currentFilePath); + } + ///////////// + // Utility // + ///////////// + /** + * Convert an input element or array into a Dataview data-array. If the input is already a data array, + * it is returned unchanged. + */ + array(raw) { + return this.api.array(raw); + } + /** Return true if the given value is a javascript array OR a dataview data array. */ + isArray(raw) { + return this.api.isArray(raw); + } + /** Return true if the given value is a dataview data array; this returns FALSE for plain JS arrays. */ + isDataArray(raw) { + return DataArray.isDataArray(raw); + } + /** Create a dataview file link to the given path. */ + fileLink(path, embed = false, display) { + return Link.file(path, embed, display); + } + /** Create a dataview section link to the given path. */ + sectionLink(path, section, embed = false, display) { + return Link.header(path, section, embed, display); + } + /** Create a dataview block link to the given path. */ + blockLink(path, blockId, embed = false, display) { + return Link.block(path, blockId, embed, display); + } + /** Attempt to extract a date from a string, link or date. */ + date(pathlike) { + return this.api.date(pathlike); + } + /** Attempt to extract a duration from a string or duration. */ + duration(dur) { + return this.api.duration(dur); + } + /** Parse a raw textual value into a complex Dataview type, if possible. */ + parse(value) { + return this.api.parse(value); + } + /** Convert a basic JS type into a Dataview type by parsing dates, links, durations, and so on. */ + literal(value) { + return this.api.literal(value); + } + /** Deep clone the given literal, returning a new literal which is independent of the original. */ + clone(value) { + return Values.deepCopy(value); + } + /** + * Compare two arbitrary JavaScript values using Dataview's default comparison rules. Returns a negative value if + * a < b, 0 if a = b, and a positive value if a > b. + */ + compare(a, b) { + return Values.compareValue(a, b); + } + /** Return true if the two given JavaScript values are equal using Dataview's default comparison rules. */ + equal(a, b) { + return this.compare(a, b) == 0; + } + ///////////////////////// + // Rendering Functions // + ///////////////////////// + /** Render an HTML element, containing arbitrary text. */ + el(el, text, { container = this.container, ...options } = {}) { + let wrapped = Values.wrapValue(text); + if (wrapped === null || wrapped === undefined) { + return container.createEl(el, Object.assign({ text }, options)); + } + let _el = container.createEl(el, options); + renderValue(this.app, wrapped.value, _el, this.currentFilePath, this.component, this.settings, true); + return _el; + } + /** Render an HTML header; the level can be anything from 1 - 6. */ + header(level, text, options) { + let header = { 1: "h1", 2: "h2", 3: "h3", 4: "h4", 5: "h5", 6: "h6" }[level]; + if (!header) + throw Error(`Unrecognized level '${level}' (expected 1, 2, 3, 4, 5, or 6)`); + return this.el(header, text, options); + } + /** Render an HTML paragraph, containing arbitrary text. */ + paragraph(text, options) { + return this.el("p", text, options); + } + /** Render an inline span, containing arbitrary text. */ + span(text, options) { + return this.el("span", text, options); + } + /** + * Render HTML from the output of a template "view" saved as a file in the vault. + * Takes a filename and arbitrary input data. + */ + async view(viewName, input) { + // Look for `${viewName}.js` first, then for `${viewName}/view.js`. + const simpleViewPath = `${viewName}.js`; + const complexViewPath = `${viewName}/view.js`; + let checkForCss = false; + let cssElement = undefined; + let viewFile = this.app.metadataCache.getFirstLinkpathDest(simpleViewPath, this.currentFilePath); + if (!viewFile) { + viewFile = this.app.metadataCache.getFirstLinkpathDest(complexViewPath, this.currentFilePath); + checkForCss = true; + } + if (!viewFile) { + renderErrorPre(this.container, `Dataview: custom view not found for '${simpleViewPath}' or '${complexViewPath}'.`); + return; + } + if (checkForCss) { + // Check for optional CSS. + let cssFile = this.app.metadataCache.getFirstLinkpathDest(`${viewName}/view.css`, this.currentFilePath); + if (cssFile) { + let cssContents = await this.app.vault.read(cssFile); + cssContents += `\n/*# sourceURL=${location.origin}/${cssFile.path} */`; + cssElement = this.container.createEl("style", { text: cssContents, attr: { scope: " " } }); + } + } + let contents = await this.app.vault.read(viewFile); + if (contents.contains("await")) + contents = "(async () => { " + contents + " })()"; + contents += `\n//# sourceURL=${viewFile.path}`; + let func = new Function("dv", "input", contents); + try { + // This may directly render, in which case it will likely return undefined or null. + let result = await Promise.resolve(func(this, input)); + if (result) + await renderValue(this.app, result, this.container, this.currentFilePath, this.component, this.settings, true); + } + catch (ex) { + if (cssElement) + this.container.removeChild(cssElement); + renderErrorPre(this.container, `Dataview: Failed to execute view '${viewFile.path}'.\n\n${ex}`); + } + } + /** Render a dataview list of the given values. */ + list(values) { + return this.api.list(values, this.container, this.component, this.currentFilePath); + } + /** Render a dataview table with the given headers, and the 2D array of values. */ + table(headers, values) { + return this.api.table(headers, values, this.container, this.component, this.currentFilePath); + } + /** Render a dataview task view with the given tasks. */ + taskList(tasks, groupByFile = true) { + return this.api.taskList(tasks, groupByFile, this.container, this.component, this.currentFilePath); + } + //////////////////////// + // Markdown Rendering // + //////////////////////// + /** Render a table directly to markdown, returning the markdown. */ + markdownTable(headers, values, settings) { + return this.api.markdownTable(headers, values, settings); + } + /** Render a list directly to markdown, returning the markdown. */ + markdownList(values, settings) { + return this.api.markdownList(values, settings); + } + /** Render at ask list directly to markdown, returning the markdown. */ + markdownTaskList(values, settings) { + return this.api.markdownTaskList(values, settings); + } +} +/** + * Evaluate a script where 'this' for the script is set to the given context. Allows you to define global variables. + */ +function evalInContext(script, context) { + return function () { + return eval(script); + }.call(context); +} +/** + * Evaluate a script possibly asynchronously, if the script contains `async/await` blocks. + */ +async function asyncEvalInContext(script, context) { + if (script.includes("await")) { + return evalInContext("(async () => { " + script + " })()", context); + } + else { + return Promise.resolve(evalInContext(script, context)); + } +} + +class DataviewJSRenderer extends DataviewRefreshableRenderer { + api; + script; + container; + origin; + static PREAMBLE = "const dataview = this;const dv = this;"; + constructor(api, script, container, origin) { + super(container, api.index, api.app, api.settings); + this.api = api; + this.script = script; + this.container = container; + this.origin = origin; + } + async render() { + this.container.innerHTML = ""; + if (!this.settings.enableDataviewJs) { + this.containerEl.innerHTML = ""; + renderErrorPre(this.container, "Dataview JS queries are disabled. You can enable them in the Dataview settings."); + return; + } + // Assume that the code is javascript, and try to eval it. + try { + await asyncEvalInContext(DataviewJSRenderer.PREAMBLE + this.script, new DataviewInlineApi(this.api, this, this.container, this.origin)); + } + catch (e) { + this.containerEl.innerHTML = ""; + renderErrorPre(this.container, "Evaluation Error: " + e.stack); + } + } +} +/** Inline JS renderer accessible using '=$' by default. */ +class DataviewInlineJSRenderer extends DataviewRefreshableRenderer { + api; + script; + container; + target; + origin; + static PREAMBLE = "const dataview = this;const dv=this;"; + // The box that the error is rendered in, if relevant. + errorbox; + constructor(api, script, container, target, origin) { + super(container, api.index, api.app, api.settings); + this.api = api; + this.script = script; + this.container = container; + this.target = target; + this.origin = origin; + } + async render() { + this.errorbox?.remove(); + if (!this.settings.enableDataviewJs || !this.settings.enableInlineDataviewJs) { + let temp = document.createElement("span"); + temp.innerText = "(disabled; enable in settings)"; + this.target.replaceWith(temp); + this.target = temp; + return; + } + // Assume that the code is javascript, and try to eval it. + try { + let temp = document.createElement("span"); + let result = await asyncEvalInContext(DataviewInlineJSRenderer.PREAMBLE + this.script, new DataviewInlineApi(this.api, this, temp, this.origin)); + this.target.replaceWith(temp); + this.target = temp; + if (result === undefined) + return; + renderValue(this.api.app, result, temp, this.origin, this, this.settings, false); + } + catch (e) { + this.errorbox = this.container.createEl("div"); + renderErrorPre(this.errorbox, "Dataview (for inline JS query '" + this.script + "'): " + e); + } + } +} + +//////////// +// Tables // +//////////// +/** Render a table of literals to Markdown. */ +function markdownTable(headers, values, settings) { + if (values.length > 0 && headers.length != values[0].length) + throw new Error(`The number of headers (${headers.length}) must match the number of columns (${values[0].length})`); + settings = settings ?? DEFAULT_SETTINGS; + const mvalues = []; + const maxLengths = Array.from(headers, v => escapeTable(v).length); + // Pre-construct the table in memory so we can size columns. + for (let row = 0; row < values.length; row++) { + const current = []; + for (let col = 0; col < values[row].length; col++) { + const text = tableLiteral(values[row][col], settings.allowHtml, settings); + current.push(text); + maxLengths[col] = Math.max(maxLengths[col], text.length); + } + mvalues.push(current); + } + // Then construct the actual table... + // Append the header fields first. + let table = `| ${headers.map((v, i) => padright(escapeTable(v), " ", maxLengths[i])).join(" | ")} |\n`; + // Then the separating column. + table += `| ${maxLengths.map(i => padright("", "-", i)).join(" | ")} |\n`; + // Then the data columns. + for (let row = 0; row < values.length; row++) { + table += `| ${mvalues[row].map((v, i) => padright(v, " ", maxLengths[i])).join(" | ")} |\n`; + } + return table; +} +/** Convert a value to a Markdown-friendly string. */ +function tableLiteral(value, allowHtml = true, settings) { + return escapeTable(rawTableLiteral(value, allowHtml, settings)); +} +/** Convert a value to a Markdown-friendly string; does not do escaping. */ +function rawTableLiteral(value, allowHtml = true, settings) { + if (!allowHtml) + return Values.toString(value, settings); + if (Values.isArray(value)) { + return `
    ${value.map(v => "
  • " + tableLiteral(v, allowHtml, settings) + "
  • ").join("")}
`; + } + else if (Values.isObject(value)) { + const inner = Object.entries(value) + .map(([k, v]) => { + return `
  • ${tableLiteral(k, allowHtml, settings)}: ${tableLiteral(v, allowHtml, settings)}
  • `; + }) + .join(""); + return `
      ${inner}
    `; + } + else { + return Values.toString(value, settings); + } +} +/** Don't need to import a library for this one... */ +function padright(text, padding, length) { + if (text.length >= length) + return text; + return text + padding.repeat(length - text.length); +} +/** Escape bars inside table content to prevent it from messing up table rows. */ +function escapeTable(text) { + return text.split(/(?!\\)\|/i).join("\\|"); +} +/////////// +// Lists // +/////////// +/** Render a list of literal elements to a markdown list. */ +function markdownList(values, settings) { + return markdownListRec(values, settings, 0); +} +/** Internal recursive function which renders markdown lists. */ +function markdownListRec(input, settings, depth = 0) { + if (Values.isArray(input)) { + let result = depth == 0 ? "" : "\n"; + for (let value of input) { + result += " ".repeat(depth) + "- "; + result += markdownListRec(value, settings, depth); + result += "\n"; + } + return result; + } + else if (Values.isObject(input)) { + let result = depth == 0 ? "" : "\n"; + for (let [key, value] of Object.entries(input)) { + result += " ".repeat(depth) + "- "; + result += Values.toString(key) + ": "; + result += markdownListRec(value, settings, depth); + result += "\n"; + } + return result; + } + else if (Values.isWidget(input) && Widgets.isListPair(input)) { + return `${Values.toString(input.key)}: ${markdownListRec(input.value, settings, depth + 1)}`; + } + return Values.toString(input); +} +/////////// +// Tasks // +/////////// +/** Render the result of a task query to markdown. */ +function markdownTaskList(tasks, settings, depth = 0) { + if (Groupings.isGrouping(tasks)) { + let result = ""; + for (let element of tasks) { + result += "#".repeat(depth + 1) + " " + Values.toString(element.key) + "\n\n"; + result += markdownTaskList(element.rows, settings, depth + 1); + } + return result; + } + else { + // Remove task line duplicates if present to match `taskList()` behavior. + const [dedupTasks, _] = nestItems(tasks); + let result = ""; + for (let element of dedupTasks) { + result += " ".repeat(depth) + "- "; + if (element.task) { + result += `[${element.status}] ${(element.visual ?? element.text).split("\n").join(" ")}\n`; + } + else { + result += `${(element.visual ?? element.text).split("\n").join(" ")}\n`; + } + result += markdownTaskList(element.children, settings, depth + 1); + } + return result; + } +} + +/** The general, externally accessible plugin API (available at `app.plugins.plugins.dataview.api` or as global `DataviewAPI`). */ +/** Asynchronous API calls related to file / system IO. */ +class DataviewIOApi { + api; + constructor(api) { + this.api = api; + } + /** Load the contents of a CSV asynchronously, returning a data array of rows (or undefined if it does not exist). */ + async csv(path, originFile) { + if (!Values.isLink(path) && !Values.isString(path)) { + throw Error(`dv.io.csv only handles string or link paths; was provided type '${typeof path}'.`); + } + let data = await this.api.index.csv.get(this.normalize(path, originFile)); + if (data.successful) + return DataArray.from(data.value, this.api.settings); + else + throw Error(`Could not find CSV for path '${path}' (relative to origin '${originFile ?? "/"}')`); + } + /** Asynchronously load the contents of any link or path in an Obsidian vault. */ + async load(path, originFile) { + if (!Values.isLink(path) && !Values.isString(path)) { + throw Error(`dv.io.load only handles string or link paths; was provided type '${typeof path}'.`); + } + let existingFile = this.api.index.vault.getAbstractFileByPath(this.normalize(path, originFile)); + if (!existingFile || !(existingFile instanceof obsidian.TFile)) + return undefined; + return this.api.index.vault.cachedRead(existingFile); + } + /** Normalize a link or path relative to an optional origin file. Returns a textual fully-qualified-path. */ + normalize(path, originFile) { + let realPath; + if (Values.isLink(path)) + realPath = path.path; + else + realPath = path; + return this.api.index.prefix.resolveRelative(realPath, originFile); + } +} +/** Global API for accessing the Dataview API, executing dataview queries, and */ +class DataviewApi { + app; + index; + settings; + verNum; + /** Evaluation context which expressions can be evaluated in. */ + evaluationContext; + /** IO API which supports asynchronous loading of data directly. */ + io; + /** Dataview functions which can be called from DataviewJS. */ + func; + /** Value utility functions for comparisons and type-checking. */ + value = Values; + /** Widget utility functions for creating built-in widgets. */ + widget = Widgets; + /** Re-exporting of luxon for people who can't easily require it. Sorry! */ + luxon = Luxon; + constructor(app, index, settings, verNum) { + this.app = app; + this.index = index; + this.settings = settings; + this.verNum = verNum; + this.evaluationContext = new Context(defaultLinkHandler(index, ""), settings); + this.func = Functions.bindAll(DEFAULT_FUNCTIONS, this.evaluationContext); + this.io = new DataviewIOApi(this); + } + /** Utilities to check the current Dataview version and compare it to SemVer version ranges. */ + version = (() => { + const self = this; + return { + get current() { + return self.verNum; + }, + compare: (op, ver) => compare(this.verNum, ver, op), + satisfies: (range) => satisfies(this.verNum, range), + }; + })(); + ///////////////////////////// + // Index + Data Collection // + ///////////////////////////// + /** Return an array of paths (as strings) corresponding to pages which match the query. */ + pagePaths(query, originFile) { + let source; + try { + if (!query || query.trim() === "") + source = Sources.folder(""); + else + source = EXPRESSION.source.tryParse(query); + } + catch (ex) { + throw new Error(`Failed to parse query in 'pagePaths': ${ex}`); + } + return matchingSourcePaths(source, this.index, originFile) + .map(s => DataArray.from(s, this.settings)) + .orElseThrow(); + } + /** Map a page path to the actual data contained within that page. */ + page(path, originFile) { + if (!(typeof path === "string") && !Values.isLink(path)) { + throw Error("dv.page only handles string and link paths; was provided type '" + typeof path + "'"); + } + let rawPath = path instanceof Link ? path.path : path; + let normPath = this.app.metadataCache.getFirstLinkpathDest(rawPath, originFile ?? ""); + if (!normPath) + return undefined; + let pageObject = this.index.pages.get(normPath.path); + if (!pageObject) + return undefined; + return this._addDataArrays(pageObject.serialize(this.index)); + } + /** Return an array of page objects corresponding to pages which match the source query. */ + pages(query, originFile) { + return this.pagePaths(query, originFile).flatMap(p => { + let res = this.page(p, originFile); + return res ? [res] : []; + }); + } + /** Remaps important metadata to add data arrays. */ + _addDataArrays(pageObject) { + // Remap the "file" metadata entries to be data arrays. + for (let [key, value] of Object.entries(pageObject.file)) { + if (Array.isArray(value)) + pageObject.file[key] = DataArray.wrap(value, this.settings); + } + return pageObject; + } + ///////////// + // Utility // + ///////////// + /** + * Convert an input element or array into a Dataview data-array. If the input is already a data array, + * it is returned unchanged. + */ + array(raw) { + if (DataArray.isDataArray(raw)) + return raw; + if (Array.isArray(raw)) + return DataArray.wrap(raw, this.settings); + return DataArray.wrap([raw], this.settings); + } + /** Return true if the given value is a javascript array OR a dataview data array. */ + isArray(raw) { + return DataArray.isDataArray(raw) || Array.isArray(raw); + } + /** Return true if the given value is a dataview data array; this returns FALSE for plain JS arrays. */ + isDataArray(raw) { + return DataArray.isDataArray(raw); + } + /** Create a dataview file link to the given path. */ + fileLink(path, embed = false, display) { + return Link.file(path, embed, display); + } + /** Create a dataview section link to the given path. */ + sectionLink(path, section, embed = false, display) { + return Link.header(path, section, embed, display); + } + /** Create a dataview block link to the given path. */ + blockLink(path, blockId, embed = false, display) { + return Link.block(path, blockId, embed, display); + } + /** Attempt to extract a date from a string, link or date. */ + date(pathlike) { + return this.func.date(pathlike); + } + /** Attempt to extract a duration from a string or duration. */ + duration(str) { + return this.func.dur(str); + } + /** Parse a raw textual value into a complex Dataview type, if possible. */ + parse(value) { + let raw = EXPRESSION.inlineField.parse(value); + if (raw.status) + return raw.value; + else + return value; + } + /** Convert a basic JS type into a Dataview type by parsing dates, links, durations, and so on. */ + literal(value) { + return parseFrontmatter(value); + } + /** Deep clone the given literal, returning a new literal which is independent of the original. */ + clone(value) { + return Values.deepCopy(value); + } + /** + * Compare two arbitrary JavaScript values using Dataview's default comparison rules. Returns a negative value if + * a < b, 0 if a = b, and a positive value if a > b. + */ + compare(a, b) { + return Values.compareValue(a, b, this.evaluationContext.linkHandler.normalize); + } + /** Return true if the two given JavaScript values are equal using Dataview's default comparison rules. */ + equal(a, b) { + return this.compare(a, b) == 0; + } + /////////////////////////////// + // Dataview Query Evaluation // + /////////////////////////////// + /** + * Execute an arbitrary Dataview query, returning a query result which: + * + * 1. Indicates the type of query, + * 2. Includes the raw AST of the parsed query. + * 3. Includes the output in the form relevant to that query type. + * + * List queries will return a list of objects ({ id, value }); table queries return a header array + * and a 2D array of values; and task arrays return a Grouping type which allows for recursive + * task nesting. + */ + async query(source, originFile, settings) { + const query = typeof source === "string" ? parseQuery(source) : Result.success(source); + if (!query.successful) + return query.cast(); + const header = query.value.header; + switch (header.type) { + case "calendar": + const cres = await executeCalendar(query.value, this.index, originFile ?? "", this.settings); + if (!cres.successful) + return cres.cast(); + return Result.success({ type: "calendar", values: cres.value.data }); + case "task": + const tasks = await executeTask(query.value, originFile ?? "", this.index, this.settings); + if (!tasks.successful) + return tasks.cast(); + return Result.success({ type: "task", values: tasks.value.tasks }); + case "list": + if (settings?.forceId !== undefined) + header.showId = settings.forceId; + const lres = await executeList(query.value, this.index, originFile ?? "", this.settings); + if (!lres.successful) + return lres.cast(); + // TODO: WITHOUT ID probably shouldn't exist, or should be moved to the engine itself. + // For now, until I fix it up in an upcoming refactor, we re-implement the behavior here. + return Result.success({ + type: "list", + values: lres.value.data, + primaryMeaning: lres.value.primaryMeaning, + }); + case "table": + if (settings?.forceId !== undefined) + header.showId = settings.forceId; + const tres = await executeTable(query.value, this.index, originFile ?? "", this.settings); + if (!tres.successful) + return tres.cast(); + return Result.success({ + type: "table", + values: tres.value.data, + headers: tres.value.names, + idMeaning: tres.value.idMeaning, + }); + } + } + /** Error-throwing version of {@link query}. */ + async tryQuery(source, originFile, settings) { + return (await this.query(source, originFile, settings)).orElseThrow(); + } + /** Execute an arbitrary dataview query, returning the results in well-formatted markdown. */ + async queryMarkdown(source, originFile, settings) { + const result = await this.query(source, originFile, settings); + if (!result.successful) + return result.cast(); + switch (result.value.type) { + case "list": + return Result.success(this.markdownList(result.value.values, settings)); + case "table": + return Result.success(this.markdownTable(result.value.headers, result.value.values, settings)); + case "task": + return Result.success(this.markdownTaskList(result.value.values, settings)); + case "calendar": + return Result.failure("Cannot render calendar queries to markdown."); + } + } + /** Error-throwing version of {@link queryMarkdown}. */ + async tryQueryMarkdown(source, originFile, settings) { + return (await this.queryMarkdown(source, originFile, settings)).orElseThrow(); + } + /** + * Evaluate a dataview expression (like '2 + 2' or 'link("hello")'), returning the evaluated result. + * This takes an optional second argument which provides definitions for variables, such as: + * + * ``` + * dv.evaluate("x + 6", { x: 2 }) = 8 + * dv.evaluate('link(target)', { target: "Okay" }) = [[Okay]] + * ``` + * + * This method returns a Result type instead of throwing an error; you can check the result of the + * execution via `result.successful` and obtain `result.value` or `result.error` accordingly. If + * you'd rather this method throw on an error, use `dv.tryEvaluate`. + */ + evaluate(expression, context, originFile) { + let field = EXPRESSION.field.parse(expression); + if (!field.status) + return Result.failure(`Failed to parse expression "${expression}"`); + let evaluationContext = originFile + ? new Context(defaultLinkHandler(this.index, originFile), this.settings) + : this.evaluationContext; + return evaluationContext.evaluate(field.value, context); + } + /** Error-throwing version of `dv.evaluate`. */ + tryEvaluate(expression, context, originFile) { + return this.evaluate(expression, context, originFile).orElseThrow(); + } + /** Evaluate an expression in the context of the given file. */ + evaluateInline(expression, origin) { + let field = EXPRESSION.field.parse(expression); + if (!field.status) + return Result.failure(`Failed to parse expression "${expression}"`); + return executeInline(field.value, origin, this.index, this.settings); + } + /////////////// + // Rendering // + /////////////// + /** + * Execute the given query, rendering results into the given container using the components lifecycle. + * Your component should be a *real* component which calls onload() on it's child components at some point, + * or a MarkdownPostProcessorContext! + * + * Note that views made in this way are live updating and will automatically clean themselves up when + * the component is unloaded or the container is removed. + */ + async execute(source, container, component, filePath) { + if (isDataviewDisabled(filePath)) { + renderCodeBlock(container, source); + return; + } + let maybeQuery = tryOrPropagate(() => parseQuery(source)); + // In case of parse error, just render the error. + if (!maybeQuery.successful) { + renderErrorPre(container, "Dataview: " + maybeQuery.error); + return; + } + let query = maybeQuery.value; + let init = { app: this.app, settings: this.settings, index: this.index, container }; + let childComponent; + switch (query.header.type) { + case "task": + childComponent = createTaskView(init, query, filePath); + component.addChild(childComponent); + break; + case "list": + childComponent = createListView(init, query, filePath); + component.addChild(childComponent); + break; + case "table": + childComponent = createTableView(init, query, filePath); + component.addChild(childComponent); + break; + case "calendar": + childComponent = new DataviewCalendarRenderer(query, container, this.index, filePath, this.settings, this.app); + component.addChild(childComponent); + break; + } + childComponent.load(); + } + /** + * Execute the given DataviewJS query, rendering results into the given container using the components lifecycle. + * See {@link execute} for general rendering semantics. + */ + async executeJs(code, container, component, filePath) { + if (isDataviewDisabled(filePath)) { + renderCodeBlock(container, code, "javascript"); + return; + } + const renderer = new DataviewJSRenderer(this, code, container, filePath); + renderer.load(); + component.addChild(renderer); + } + /** Render a dataview list of the given values. */ + async list(values, container, component, filePath) { + if (!values) + return; + if (values !== undefined && values !== null && !Array.isArray(values) && !DataArray.isDataArray(values)) + values = Array.from(values); + // Append a child div, since React will keep re-rendering otherwise. + let subcontainer = container.createEl("div"); + component.addChild(createFixedListView({ app: this.app, settings: this.settings, index: this.index, container: subcontainer }, values, filePath)); + } + /** Render a dataview table with the given headers, and the 2D array of values. */ + async table(headers, values, container, component, filePath) { + if (!headers) + headers = []; + if (!values) + values = []; + if (!Array.isArray(headers) && !DataArray.isDataArray(headers)) + headers = Array.from(headers); + // Append a child div, since React will keep re-rendering otherwise. + let subcontainer = container.createEl("div"); + component.addChild(createFixedTableView({ app: this.app, settings: this.settings, index: this.index, container: subcontainer }, headers, values, filePath)); + } + /** Render a dataview task view with the given tasks. */ + async taskList(tasks, groupByFile = true, container, component, filePath = "") { + let groupedTasks = !Groupings.isGrouping(tasks) && groupByFile ? this.array(tasks).groupBy(t => Link.file(t.path)) : tasks; + // Append a child div, since React will override several task lists otherwise. + let taskContainer = container.createEl("div"); + component.addChild(createFixedTaskView({ app: this.app, settings: this.settings, index: this.index, container: taskContainer }, groupedTasks, filePath)); + } + /** Render an arbitrary value into a container. */ + async renderValue(value, container, component, filePath, inline = false) { + return renderValue(this.app, value, container, filePath, component, this.settings, inline); + } + ///////////////// + // Data Export // + ///////////////// + /** Render data to a markdown table. */ + markdownTable(headers, values, settings) { + if (!headers) + headers = []; + if (!values) + values = []; + const combined = Object.assign({}, this.settings, settings); + return markdownTable(headers, values, combined); + } + /** Render data to a markdown list. */ + markdownList(values, settings) { + if (!values) + values = []; + const combined = Object.assign({}, this.settings, settings); + return markdownList(values, combined); + } + /** Render tasks or list items to a markdown task list. */ + markdownTaskList(values, settings) { + if (!values) + values = []; + const sparse = nestGroups(values); + const combined = Object.assign({}, this.settings, settings); + return markdownTaskList(sparse, combined); + } +} +/** Determines if source-path has a `?no-dataview` annotation that disables dataview. */ +function isDataviewDisabled(sourcePath) { + if (!sourcePath) + return false; + let questionLocation = sourcePath.lastIndexOf("?"); + if (questionLocation == -1) + return false; + return sourcePath.substring(questionLocation).contains("no-dataview"); +} + +/** Refreshable renderer which renders inline instead of in a div. */ +class DataviewInlineRenderer extends DataviewRefreshableRenderer { + field; + fieldText; + container; + target; + index; + origin; + settings; + app; + // The box that the error is rendered in, if relevant. + errorbox; + constructor(field, fieldText, container, target, index, origin, settings, app) { + super(container, index, app, settings); + this.field = field; + this.fieldText = fieldText; + this.container = container; + this.target = target; + this.index = index; + this.origin = origin; + this.settings = settings; + this.app = app; + } + async render() { + this.errorbox?.remove(); + let result = tryOrPropagate(() => executeInline(this.field, this.origin, this.index, this.settings)); + if (!result.successful) { + this.errorbox = this.container.createEl("div"); + renderErrorPre(this.errorbox, "Dataview (for inline query '" + this.fieldText + "'): " + result.error); + } + else { + let temp = document.createElement("span"); + temp.addClasses(["dataview", "dataview-inline-query"]); + await renderValue(this.app, result.value, temp, this.origin, this, this.settings, false); + this.target.replaceWith(temp); + } + } +} + +/** Replaces raw textual inline fields in text containers with pretty HTML equivalents. */ +async function replaceInlineFields(ctx, init) { + const inlineFields = extractInlineFields(init.container.innerHTML); + if (inlineFields.length == 0) + return; + const component = new obsidian.MarkdownRenderChild(init.container); + ctx.addChild(component); + // Iterate through the raw HTML and replace inline field matches with corresponding rendered values. + let result = init.container.innerHTML; + for (let x = inlineFields.length - 1; x >= 0; x--) { + let field = inlineFields[x]; + let renderContainer = document.createElement("span"); + renderContainer.addClasses(["dataview", "inline-field"]); + // Block inline fields render the key, parenthesis ones do not. + if (field.wrapping == "[") { + const key = renderContainer.createSpan({ + cls: ["dataview", "inline-field-key"], + attr: { + "data-dv-key": field.key, + "data-dv-norm-key": canonicalizeVarName(field.key), + }, + }); + // Explicitly set the inner HTML to respect any key formatting that we should carry over. + key.innerHTML = field.key; + renderContainer.createSpan({ + cls: ["dataview", "inline-field-value"], + attr: { id: "dataview-inline-field-" + x }, + }); + } + else { + renderContainer.createSpan({ + cls: ["dataview", "inline-field-standalone-value"], + attr: { + id: "dataview-inline-field-" + x, + "data-dv-key": field.key, + "data-dv-norm-key": canonicalizeVarName(field.key), + }, + }); + } + result = result.slice(0, field.start) + renderContainer.outerHTML + result.slice(field.end); + } + // Use a