isorite 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +757 -98
- package/docs/terminal.md +3 -1
- package/guide/out-of-the-base/web-and-code-links.md +3 -1
- package/package.json +1 -1
- package/web/_app/immutable/assets/0.BEFtmzIh.css +1 -0
- package/web/_app/immutable/assets/4.LR47AJKA.css +1 -0
- package/web/_app/immutable/assets/NoteList.C2GYAaLW.css +1 -0
- package/web/_app/immutable/chunks/{BWE_HS0c.js → 0B47b24t.js} +1 -1
- package/web/_app/immutable/chunks/{CzYPMYd4.js → 1j--pDqt.js} +1 -1
- package/web/_app/immutable/chunks/{e2LGvGEb.js → AnnzTlE8.js} +1 -1
- package/web/_app/immutable/chunks/{DRcTlHZP.js → B7LnLClC.js} +1 -1
- package/web/_app/immutable/chunks/{ZwM5k8r0.js → BAVnZFPa.js} +1 -1
- package/web/_app/immutable/chunks/BHORylQC.js +1 -0
- package/web/_app/immutable/chunks/{BiATTH-R.js → BLe29cGh.js} +1 -1
- package/web/_app/immutable/chunks/{C8h1oeAZ.js → BLzZIf7l.js} +1 -1
- package/web/_app/immutable/chunks/BMijTvgG.js +1 -0
- package/web/_app/immutable/chunks/{DCZYeMlH.js → BPpUSQ2Y.js} +1 -1
- package/web/_app/immutable/chunks/{kG4HctVa.js → BQeONalw.js} +1 -1
- package/web/_app/immutable/chunks/{CtkUy_15.js → BZX8cNYL.js} +1 -1
- package/web/_app/immutable/chunks/{Bb_N98K9.js → BiHyHFlW.js} +1 -1
- package/web/_app/immutable/chunks/{BGW1TKtR.js → BtYMl4bD.js} +1 -1
- package/web/_app/immutable/chunks/{DKqMzyyE.js → BtcGx-KQ.js} +1 -1
- package/web/_app/immutable/chunks/{BK31dpt6.js → Bytzbt5l.js} +1 -1
- package/web/_app/immutable/chunks/{DDAG55ce.js → C1FDDux-.js} +1 -1
- package/web/_app/immutable/chunks/C7qBBO-i.js +1 -0
- package/web/_app/immutable/chunks/{NyWzYSz1.js → C8FxuPry.js} +1 -1
- package/web/_app/immutable/chunks/{CdY1G_wk.js → C9Qdslk3.js} +1 -1
- package/web/_app/immutable/chunks/CA-rzUq8.js +524 -0
- package/web/_app/immutable/chunks/{CMIt1Ma8.js → CSKABQj2.js} +1 -1
- package/web/_app/immutable/chunks/CSTv2fL0.js +1 -0
- package/web/_app/immutable/chunks/{Dzi94aDH.js → CTuuQ66F.js} +1 -1
- package/web/_app/immutable/chunks/{PsfIQCJ1.js → CUB9vnd0.js} +1 -1
- package/web/_app/immutable/chunks/{DrVtdHUW.js → CUNetmvQ.js} +1 -1
- package/web/_app/immutable/chunks/{Djr0h_v1.js → CVqwkR8N.js} +1 -1
- package/web/_app/immutable/chunks/{CTDYUZPz.js → CWc-mNzo.js} +1 -1
- package/web/_app/immutable/chunks/{CryuQgNh.js → CZSmkKvQ.js} +1 -1
- package/web/_app/immutable/chunks/{BA78_vo5.js → CcE14TDI.js} +1 -1
- package/web/_app/immutable/chunks/{DBLoWLMb.js → CglDFp51.js} +1 -1
- package/web/_app/immutable/chunks/{DjUnonHY.js → Ch5Z7cbP.js} +1 -1
- package/web/_app/immutable/chunks/{DFuPQaNa.js → Cpjqsnqr.js} +1 -1
- package/web/_app/immutable/chunks/{Bd-WxALw.js → CwHHpacD.js} +1 -1
- package/web/_app/immutable/chunks/{UDPiRmKc.js → D7jLdCNu.js} +1 -1
- package/web/_app/immutable/chunks/{CIYFNih-.js → D9uNsgxP.js} +1 -1
- package/web/_app/immutable/chunks/{CFf_dAzX.js → DAVMwq6b.js} +1 -1
- package/web/_app/immutable/chunks/{C2npZzkn.js → DEQsS4Ez.js} +1 -1
- package/web/_app/immutable/chunks/{B-DzK7Gb.js → DFo4P1vU.js} +1 -1
- package/web/_app/immutable/chunks/{CdmC_l9F.js → DH_19--P.js} +1 -1
- package/web/_app/immutable/chunks/{l1LsK1sB.js → DJQ6favH.js} +1 -1
- package/web/_app/immutable/chunks/{BvPxdlBc.js → DJT73ARj.js} +1 -1
- package/web/_app/immutable/chunks/{BCGaqnao.js → DW5uy3Jw.js} +1 -1
- package/web/_app/immutable/chunks/{BT_btfh0.js → DWwu8a1P.js} +1 -1
- package/web/_app/immutable/chunks/{BhEqJU15.js → DY0M2GMn.js} +1 -1
- package/web/_app/immutable/chunks/{TanDZqdf.js → DbtvzL7r.js} +1 -1
- package/web/_app/immutable/chunks/DtEVmiYo.js +1 -0
- package/web/_app/immutable/chunks/{CT4_O9X_.js → DxRGLDbV.js} +1 -1
- package/web/_app/immutable/chunks/{D6sVhEz3.js → Ih6r6QR2.js} +1 -1
- package/web/_app/immutable/chunks/{BXBhaEho.js → Kem7IXj7.js} +1 -1
- package/web/_app/immutable/chunks/{Ct_EK1xu.js → MrW4zd8l.js} +1 -1
- package/web/_app/immutable/chunks/{BqipEJXw.js → Mwr1r9aw.js} +1 -1
- package/web/_app/immutable/chunks/{D1LK3xRu.js → OG9GsKke.js} +1 -1
- package/web/_app/immutable/chunks/{DymLl-qY.js → Qej0SEux.js} +1 -1
- package/web/_app/immutable/chunks/TmxIGCN3.js +1 -0
- package/web/_app/immutable/chunks/{CPSlCQsu.js → Wv-ICQRy.js} +4 -4
- package/web/_app/immutable/chunks/{B35sQTcK.js → ZTEErEOd.js} +1 -1
- package/web/_app/immutable/chunks/{Cf-5I5_6.js → e7GRa0yc.js} +1 -1
- package/web/_app/immutable/chunks/{C5Z-Y7Lu.js → f7mFVWQS.js} +1 -1
- package/web/_app/immutable/chunks/{Bj-5n5Pb.js → hjSZ041d.js} +1 -1
- package/web/_app/immutable/chunks/{DHJ8FcFD.js → mhWk5y4o.js} +1 -1
- package/web/_app/immutable/chunks/{CMikI1NP.js → zasx25UV.js} +3 -3
- package/web/_app/immutable/entry/app.B9TPZNFw.js +2 -0
- package/web/_app/immutable/entry/start.WU9HKeyT.js +1 -0
- package/web/_app/immutable/nodes/0.C9NFEqJd.js +3 -0
- package/web/_app/immutable/nodes/1.B5PJwWOG.js +1 -0
- package/web/_app/immutable/nodes/2.DRtC7zjs.js +1 -0
- package/web/_app/immutable/nodes/3.EEMisvUL.js +1 -0
- package/web/_app/immutable/nodes/4.DthmsFQC.js +19 -0
- package/web/_app/immutable/nodes/5.CEu0DlpQ.js +1 -0
- package/web/_app/immutable/nodes/6.DzvF0ZPt.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/index.html +16 -16
- package/web/_app/immutable/assets/0.BPP604gH.css +0 -1
- package/web/_app/immutable/assets/4.fOHsAKBF.css +0 -1
- package/web/_app/immutable/assets/NoteList.E6jC-AtZ.css +0 -1
- package/web/_app/immutable/chunks/BPrp4s2r.js +0 -1
- package/web/_app/immutable/chunks/CAlIuau0.js +0 -1
- package/web/_app/immutable/chunks/Cl5gQm2e.js +0 -1
- package/web/_app/immutable/chunks/DFKYo3Wx.js +0 -1
- package/web/_app/immutable/chunks/DxVFSMVD.js +0 -523
- package/web/_app/immutable/chunks/X3aTZRe_.js +0 -1
- package/web/_app/immutable/chunks/ej_0XxR7.js +0 -1
- package/web/_app/immutable/entry/app.BzA5QYtw.js +0 -2
- package/web/_app/immutable/entry/start.BOh0Gj31.js +0 -1
- package/web/_app/immutable/nodes/0.BmaxMLzC.js +0 -2
- package/web/_app/immutable/nodes/1.IQDu8pD1.js +0 -1
- package/web/_app/immutable/nodes/2.D2Oi-ADx.js +0 -1
- package/web/_app/immutable/nodes/3.CF1W85jb.js +0 -1
- package/web/_app/immutable/nodes/4.BMYBn904.js +0 -15
- package/web/_app/immutable/nodes/5.1vm6WZdM.js +0 -1
- package/web/_app/immutable/nodes/6.C9ia8cDm.js +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{$ as e,A as t,D as n,E as r,F as i,K as a,L as o,M as s,N as c,O as l,P as u,Q as d,R as f,T as p,U as m,V as h,W as g,X as _,Z as v,_ as y,a as b,b as x,ct as S,d as C,et as w,f as T,ft as E,ht as D,i as O,it as k,j as A,k as j,l as M,lt as N,mt as P,n as F,nt as I,ot as ee,p as te,pt as L,q as R,rt as z,tt as ne,u as B,v as V,w as H,z as re}from"../chunks/AnnzTlE8.js";import{o as ie,s as ae,t as oe}from"../chunks/BMijTvgG.js";import"../chunks/xihTtKlq.js";import{A as U,D as se,E as W,F as ce,M as le,N as ue,O as de,S as fe,T as pe,_ as me,a as G,b as he,c as ge,f as _e,g as ve,h as ye,i as be,j as xe,k as Se,l as Ce,m as we,o as Te,s as Ee,v as De,w as Oe,x as ke,y as Ae}from"../chunks/Wv-ICQRy.js";import{D as je,E as Me,O as Ne,S as Pe,T as Fe,_ as Ie,a as Le,b as Re,c as ze,d as Be,f as Ve,g as He,i as Ue,l as We,m as Ge,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as Ze,v as Qe,w as $e,x as et,y as tt}from"../chunks/CA-rzUq8.js";import{t as nt}from"../chunks/CTuuQ66F.js";import{B as rt,D as K,E as it,F as q,G as at,H as ot,I as st,J,K as ct,L as lt,M as Y,N as X,P as ut,R as dt,S as ft,W as pt,X as mt,Y as ht,at as gt,ct as _t,et as vt,it as yt,lt as bt,mt as xt,n as St,nt as Ct,rt as wt,t as Tt,ut as Et,v as Dt,w as Ot,x as kt,y as At}from"../chunks/BxTFtVqu.js";import{i as jt,l as Mt,n as Nt,o as Pt,r as Ft}from"../chunks/yxd8jSz3.js";import{t as It}from"../chunks/TmxIGCN3.js";var Lt=[`kit.js`,`chart.js`,`model.js`,`math.js`,`math.css`,`isorite.css`,`plain.css`,`kit.css`],Rt=e=>e.replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`);function zt(e,t){for(let n of e.matchAll(/<meta\b[^>]*>/gi)){let e=n[0];if((e.match(/\bname\s*=\s*["']([^"']*)["']/i)?.[1])?.toLowerCase()===t)return Rt(e.match(/\bcontent\s*=\s*"([^"]*)"|\bcontent\s*=\s*'([^']*)'/i)?.slice(1).find(e=>e!==void 0)??``)}return null}function Bt(e){return{title:Rt(e.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1]?.trim()??``),description:zt(e,`description`)??``,author:zt(e,`author`)??``,date:zt(e,`date`)??``,kit:zt(e,`isorite:kit`),uses:(zt(e,`isorite:uses`)??``).split(/[\s,]+/).filter(Boolean)}}function Vt(e){let t=[];/<iso-chart[\s>]|\bPlot\.\w/.test(e)&&t.push(`chart`),/<iso-model[\s>]|<iso-chart3d[\s>]|\bTHREE\.\w/.test(e)&&t.push(`model`);let n=e.replace(/<script\b[\s\S]*?<\/script>/gi,``).replace(/<style\b[\s\S]*?<\/style>/gi,``);return(/<iso-math[\s>]|\biso\.math\(|\$\$[\s\S]+?\$\$|\\\(|\$(?=\S)[^$\n]+?(?<=\S)\$(?!\d)/.test(n)||/\biso\.math\(/.test(e))&&t.push(`math`),t}var Ht=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; media-src data: blob:; connect-src 'none'">`,Ut=e=>e.replace(/<\/(script|style)/gi,`<\\/$1`),Wt=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);function Gt(e,t,n={}){let r=n.look??`isorite`,i=n.ground??`lapis`,a=e.replace(/<link\b[^>]*\bhref\s*=\s*["'](?:\.\/)?kit\/[^"']*["'][^>]*>\s*/gi,``).replace(/<script\b[^>]*\bsrc\s*=\s*["'](?:\.\/)?kit\/[^"']*["'][^>]*>\s*<\/script>\s*/gi,``),o=Object.entries(n.data??{}).map(([e,t])=>typeof t==`string`?`<script type="text/plain" data-path="${Wt(e)}">${Ut(t)}<\/script>`:`<script type="application/octet-stream" data-encoding="base64" data-path="${Wt(e)}">${Kt(t)}<\/script>`),s=Vt(a).map(e=>`${e===`math`?`<style>\n${Ut(t[`math.css`])}\n</style>\n`:``}<script>\n${Ut(t[`${e}.js`])}\n<\/script>`),c=[Ht,`<style data-look="isorite">\n${Ut(t[`isorite.css`])}\n</style>`,`<style data-look="plain">\n${Ut(t[`plain.css`])}\n</style>`,`<style>\n${Ut(t[`kit.css`])}\n</style>`,...o,`<script>\n${Ut(t[`kit.js`])}\n<\/script>`,...s].join(`
|
|
2
|
+
`);return(/<head\b[^>]*>/i.test(a)?a.replace(/<head\b[^>]*>/i,e=>`${e}\n${c}\n`):`<!doctype html><html><head><meta charset="utf-8">\n${c}\n</head><body>${a}</body></html>`).replace(/<html\b([^>]*)>/i,(e,t)=>`<html${t.replace(/\s+data-(?:look|ground)\s*=\s*("[^"]*"|'[^']*'|\S+)/gi,``)} data-look="${r}" data-ground="${i}">`)}function Kt(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}var qt=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/,Jt=e=>e===``?null:qt.test(e.trim())?+e:e;function*Yt(e,t){let n=``,r=[],i=!1;for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(n+=`"`,a++):i=!1:n+=o:o===`"`&&n===``?i=!0:o===t?(r.push(n),n=``):o===`
|
|
3
|
+
`||o===`\r`?(o===`\r`&&e[a+1]===`
|
|
4
|
+
`&&a++,r.push(n),n=``,(r.length>1||r[0]!==``)&&(yield r),r=[]):n+=o}r.push(n),(r.length>1||r[0]!==``)&&(yield r)}function Xt(e,t=`,`){let n=Yt(e.replace(/^/,``),t),r=n.next();if(r.done)return[];let i=r.value.map(e=>e.trim()),a=[];for(let e of n)a.push(Object.fromEntries(i.map((t,n)=>[t,Jt(e[n]??``)])));return a}function Zt(e,t){let n=e.toLowerCase().split(`.`).pop();if(n===`json`){let n=JSON.parse(t);if(Array.isArray(n))return n;let r=n&&typeof n==`object`?Object.values(n).find(Array.isArray):null;if(r)return r;throw Error(`${e}: not an array of rows`)}if(n===`jsonl`||n===`ndjson`)return t.split(/\r?\n/).filter(e=>e.trim()).map(e=>JSON.parse(e));if(n===`tsv`)return Xt(t,` `);if(n===`csv`)return Xt(t,`,`);throw Error(`${e}: the kit reads CSV, TSV, JSON and JSON lines`)}function Qt(e){let t=new Set;for(let n of e.slice(0,1e3))for(let e of Object.keys(n))t.add(e);return[...t]}function $t(e,t,n=5){return{path:e,rows:t.length,head:t.slice(0,n),columns:Qt(t).map(e=>{let n=t.map(t=>t[e]),r=n.filter(e=>e!=null&&e!==``),i=n.length-r.length;if(!r.length)return{name:e,type:`empty`,empty:i};if(r.every(e=>typeof e==`number`)){let t=1/0,n=-1/0,a=0;for(let e of r)e<t&&(t=e),e>n&&(n=e),a+=e;return{name:e,type:`number`,min:t,max:n,mean:a/r.length,empty:i}}if(r.every(e=>typeof e==`boolean`))return{name:e,type:`boolean`,empty:i};let a=[...new Set(r.map(String))];return{name:e,type:`text`,distinct:a.length,values:a.slice(0,12),empty:i}})}}function en(e){let t=e=>String(Number.isInteger(e)?e:+e.toPrecision(4)),n=[`${e.path}: ${e.rows} rows, ${e.columns.length} columns`];for(let r of e.columns){let e=r.empty?`, ${r.empty} empty`:``;r.type===`number`?n.push(`- ${r.name}: number, ${t(r.min)} to ${t(r.max)} (mean ${t(r.mean)})${e}`):r.type===`text`?n.push(`- ${r.name}: text, ${r.distinct} distinct: ${r.values.join(`, `)}${r.distinct>r.values.length?`, …`:``}${e}`):n.push(`- ${r.name}: ${r.type}${e}`)}let r=e.columns.map(e=>e.name);return n.push(`First rows:`,r.join(`,`),...e.head.map(e=>r.map(t=>e[t]??``).join(`,`))),n.join(`
|
|
5
|
+
`)}function tn(e,t=-1){if(typeof e!=`number`||Number.isNaN(e))return`–`;if(!Number.isFinite(e))return e>0?`∞`:`−∞`;if(t>=0)return e.toFixed(t).replace(`-`,`−`);if(e===0)return`0`;let n=Math.abs(e);if(n>=.001&&n<1e6)return Number.isInteger(e)?String(e).replace(`-`,`−`):String(+e.toPrecision(3)).replace(`-`,`−`);let[r,i]=e.toExponential(2).split(`e`);return`${String(+r).replace(`-`,`−`)}×10${(e=>e.replace(/[-+\d]/g,e=>({"-":`⁻`,"+":``})[e]??`⁰¹²³⁴⁵⁶⁷⁸⁹`[+e]))(String(+i))}`}var nn=null;function rn(){return nn??=Promise.all(Lt.map(async e=>{let t=await fetch(ie(`/kit/${e}`));if(!t.ok)throw Error(`the kit's ${e} isn't there (${t.status}): build the app again`);return[e,await t.text()]})).then(e=>Object.fromEntries(e)).catch(e=>{throw nn=null,e}),nn}var an=e=>e.split(`/`).slice(0,-1).join(`/`);function on(e,t){let n=an(e).split(`/`).filter(Boolean);for(let e of t.replace(/^\.\//,``).split(`/`))if(e!==``&&e!==`.`){if(e===`..`){if(!n.length)return null;n.pop()}else n.push(e)}return n.join(`/`)}async function sn(e,t){let n=await e.file(t);if(!n)throw Error(`no artifact at ${t}`);let r=new TextDecoder().decode(n.bytes);return{html:r,manifest:Bt(r)}}async function cn(e,t,n){let r={};for(let i of n){let n=on(t,i),a=n===null?null:await e.file(n);a&&(r[i]=/^(text\/|application\/(json|jsonl|x-ndjson))/.test(a.type)?new TextDecoder().decode(a.bytes):a.bytes)}return r}async function ln(e,t){return Gt(e,await rn(),t)}function un(e,t,n,r,i){let a=(t,n=[])=>e.contentWindow?.postMessage({isorite:0,...t},`*`,n),o=async o=>{if(o.source!==e.contentWindow)return;let s=o.data;if(s&&s.isorite===0){if(s.type===`ready`){let e=i.current();a({type:`ground`,ground:e.ground}),a({type:`look`,look:e.look})}else if(s.type===`file`||s.type===`bytes`){let e=String(s.path??``);if(!r().includes(e)){a({type:`reply`,id:s.id,error:`${e} is not in the artifact's manifest (isorite:uses)`});return}let i=on(n,e);try{let n=i===null?null:await t.file(i);if(!n)a({type:`reply`,id:s.id,error:`${e}: no such file beside the artifact`});else if(s.type===`bytes`){let e=n.bytes.slice().buffer;a({type:`reply`,id:s.id,bytes:e},[e])}else a({type:`reply`,id:s.id,text:new TextDecoder().decode(n.bytes)})}catch(t){a({type:`reply`,id:s.id,error:`${e}: ${t.message}`})}}else s.type===`height`?i.onHeight(Number(s.height)||0):s.type===`error`?i.onError(String(s.message)):s.type===`open`&&i.onOpen(String(s.note))}};return addEventListener(`message`,o),{tell:a,stop:()=>removeEventListener(`message`,o)}}function dn(e,t){let n=e.split(/[#?]/)[0].trim();if(!n||/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith(`//`)||!/\.html?$/i.test(n))return null;let r=n.startsWith(`/`)?n.slice(1):on(`${t}.md`,n);return r?decodeURI(r):null}function fn(){let e=document.documentElement.dataset.ground;return e===`lapis`||e===`quartz`?e:matchMedia(`(prefers-color-scheme: light)`).matches?`quartz`:`lapis`}function pn(e){let t=e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);return`<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${t}</title><meta name="isorite:kit" content="1"><meta name="isorite:uses" content="${t}"></head><body><iso-model src="${t}" height="440"></iso-model></body></html>`}var mn=u(`<p class="problem svelte-klp1mb" role="alert"> </p>`),hn=u(`<!> <iframe sandbox="allow-scripts" class="svelte-klp1mb"></iframe>`,1);function gn(n,r){N(r,!0);let i=O(r,`look`,3,`isorite`),o=z(void 0),c=z(480),u=z(``),f=z(ne(fn()));R(()=>{let e=new MutationObserver(()=>{I(f,fn(),!0)});e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-ground`]});let t=matchMedia(`(prefers-color-scheme: light)`),n=()=>{I(f,fn(),!0)};return t.addEventListener(`change`,n),()=>{e.disconnect(),t.removeEventListener(`change`,n)}});let p=null;R(()=>h(o)?(p=un(h(o),G.api,r.path,()=>r.uses,{onHeight:e=>{I(c,Math.max(120,Math.min(2e4,Math.ceil(e)+4)),!0)},onError:e=>r.onerror?.(e),onOpen:e=>{be.open(e.replace(/^\/+/,``).replace(/\.md$/,``))},current:()=>({ground:h(f),look:i()})}),()=>{p?.stop(),p=null}):void 0),R(()=>{if(!h(o))return;let e=h(o),t=r.html,n=g(()=>({look:i(),ground:h(f)}));I(u,``),ln(t,n).then(t=>{e.srcdoc=t},e=>{I(u,e.message,!0)})}),R(()=>{p?.tell({type:`ground`,ground:h(f)})}),R(()=>{p?.tell({type:`look`,look:i()})});var m=hn(),_=d(m),v=n=>{var r=mn(),i=e(r,!0);a(()=>t(i,h(u))),s(n,r)};l(_,e=>{h(u)&&e(v)});var b=w(_,2);let x;M(b,e=>I(o,e),()=>h(o)),a(()=>{T(b,`title`,r.title),x=y(b,``,x,{height:`${h(c)??``}px`})}),s(n,m),S()}var _n=u(`<p class="stand svelte-16i7bpz"> </p>`),vn=u(`<span> </span><span class="sep svelte-16i7bpz">/</span>`,1),yn=u(`<a class="br svelte-16i7bpz"> </a>`),bn=u(`<span class="br svelte-16i7bpz"> </span>`),xn=u(`<span class="uses">uses <!></span>`),Sn=u(`<span class="faint"> </span>`),Cn=u(`<button type="button" role="radio" class="svelte-16i7bpz"> </button>`),wn=u(`<span class="tools svelte-16i7bpz"><span class="seg svelte-16i7bpz" role="radiogroup" aria-label="look"></span> <button type="button" class="btn quiet svelte-16i7bpz">standalone</button></span>`),Tn=u(`<p class="said svelte-16i7bpz" role="status"> </p>`),En=u(`<li> </li>`),Dn=u(`<ul class="errors svelte-16i7bpz" role="alert"></ul>`),On=u(`<p class="problem svelte-16i7bpz" role="alert"> </p>`),kn=u(`<img class="picture svelte-16i7bpz"/>`),An=u(`<iframe class="pdf svelte-16i7bpz"></iframe>`),jn=u(`<th> </th>`),Mn=u(`<td> </td>`),Nn=u(`<tr></tr>`),Pn=u(`<p class="faint"> </p>`),Fn=u(`<pre class="shape svelte-16i7bpz"> </pre> <div class="rows svelte-16i7bpz"><table class="svelte-16i7bpz"><thead><tr></tr></thead><tbody></tbody></table></div> <!>`,1),In=u(`<article class="file svelte-16i7bpz"><header><h1 class="serif svelte-16i7bpz"> </h1> <!> <div class="label svelte-16i7bpz"><span class="kind svelte-16i7bpz"><!> </span> <span class="path svelte-16i7bpz"><!><span class="name svelte-16i7bpz"> </span></span> <!> <!> <!></div> <!> <!></header> <!> <!></article>`);function Ln(n,i){N(i,!0);let o=k(()=>W(i.path)??`misc`),u=k(()=>i.path.split(`/`).at(-1)??i.path),m=k(()=>i.path.split(`/`).slice(0,-1)),g=/\.(glb|gltf|stl|obj)$/i,_=/\.(csv|tsv|json|jsonl|ndjson)$/i,y=z(``),b=z(null),x=z(null),C=z(null),D=z(ne([])),O=z(`isorite`),A=z(``);R(()=>{let e=i.path,t=h(o);I(y,``),I(b,null),I(x,null),I(C,null),I(D,[],!0),I(A,``);let n;return(async()=>{if(t===`artifact`){let{html:t,manifest:n}=await sn(G.api,e);I(b,{html:t,title:n.title||e.split(`/`).at(-1),description:n.description,uses:n.uses});return}if(g.test(e)){I(b,{html:pn(e.split(`/`).at(-1)),title:e.split(`/`).at(-1),description:``,uses:[e.split(`/`).at(-1)]});return}let r=await G.api.file(e);if(!r)throw Error(`no file at ${e}`);if((t===`image`||r.type===`application/pdf`)&&(n=URL.createObjectURL(new Blob([r.bytes],{type:r.type}))),I(x,{size:r.bytes.length,type:r.type,...n?{url:n}:{}}),t===`data`&&_.test(e)){let t=Zt(e,new TextDecoder().decode(r.bytes));I(C,{shape:$t(e,t),rows:t.slice(0,50)})}})().catch(e=>{I(y,e.message,!0)}),()=>{n&&URL.revokeObjectURL(n)}});let j=k(()=>h(b)?.title??h(u)),M=e=>e<1024?`${e} bytes`:e<1024**2?`${(e/1024).toFixed(1)} kB`:`${(e/1024**2).toFixed(1)} MB`,P=e=>typeof e==`number`?tn(e):String(e??``);async function F(){if(h(b))try{let e=await ln(h(b).html,{look:h(O),ground:fn(),data:await cn(G.api,i.path,h(b).uses)}),t=document.createElement(`a`);t.href=URL.createObjectURL(new Blob([e],{type:`text/html`})),t.download=h(u).replace(/\.html?$/i,``)+`.standalone.html`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),I(A,`saved ${t.download}, ${M(e.length)}`)}catch(e){I(y,e.message,!0)}}let ee=e=>{let t=on(i.path,e);return t===null?null:Ee(t)};var te=In(),B=v(te),H=v(B),re=e(H,!0),ie=w(H,2),ae=n=>{var r=_n(),i=e(r,!0);a(()=>t(i,h(b).description)),s(n,r)};l(ie,e=>{h(b)?.description&&e(ae)});var oe=w(ie,2),U=v(oe),se=v(U);Je(se,{get kind(){return h(o)}});var ce=w(se,1,!0);L(U);var le=w(U,2),ue=v(le);p(ue,16,()=>h(m),e=>e,(n,r)=>{var i=vn(),o=d(i),c=e(o,!0);E(),a(()=>t(c,r)),s(n,i)});var de=w(ue),fe=e(de,!0);L(le);var pe=w(le,2),me=n=>{var r=xn(),i=w(v(r));p(i,16,()=>h(b).uses,e=>e,(n,r)=>{let i=k(()=>ee(r));var o=c(),u=d(o),f=n=>{var o=yn(),c=e(o,!0);a(()=>{T(o,`href`,h(i)),t(c,r)}),s(n,o)},p=n=>{var i=bn(),o=e(i,!0);a(()=>t(o,r)),s(n,i)};l(u,e=>{h(i)?e(f):e(p,-1)}),s(n,o)}),L(r),s(n,r)};l(pe,e=>{h(o)===`artifact`&&h(b)?.uses.length&&e(me)});var he=w(pe,2),ge=n=>{var r=Sn(),i=e(r,!0);a(e=>t(i,e),[()=>M(h(x).size)]),s(n,r)};l(he,e=>{h(x)&&e(ge)});var _e=w(he,2),ve=n=>{var r=wn(),i=v(r);p(i,20,()=>[`isorite`,`plain`],e=>e,(n,r)=>{var i=Cn(),o=e(i,!0);a(()=>{T(i,`aria-checked`,h(O)===r),t(o,r)}),f(`click`,i,()=>I(O,r,!0)),s(n,i)}),L(i);var o=w(i,2);L(r),f(`click`,o,()=>void F()),s(n,r)};l(_e,e=>{h(o)===`artifact`&&e(ve)}),L(oe);var ye=w(oe,2),be=n=>{var r=Tn(),i=e(r,!0);a(()=>t(i,h(A))),s(n,r)};l(ye,e=>{h(A)&&e(be)});var xe=w(ye,2),Se=n=>{var r=Dn();p(r,20,()=>h(D),e=>e,(n,r)=>{var i=En(),o=e(i,!0);a(()=>t(o,r)),s(n,i)}),L(r),s(n,r)};l(xe,e=>{h(D).length&&e(Se)}),L(B);var Ce=w(B,2),we=n=>{var r=On(),i=e(r,!0);a(()=>t(i,h(y))),s(n,r)};l(Ce,e=>{h(y)&&e(we)});var Te=w(Ce,2),De=e=>{gn(e,{get path(){return i.path},get html(){return h(b).html},get uses(){return h(b).uses},get look(){return h(O)},get title(){return h(j)},onerror:e=>{h(D).includes(e)||I(D,[...h(D),e],!0)}})},Oe=e=>{var t=kn();a(()=>{T(t,`src`,h(x).url),T(t,`alt`,h(u))}),s(e,t)},ke=e=>{var t=An();a(()=>{T(t,`src`,h(x).url),T(t,`title`,h(u))}),s(e,t)},Ae=n=>{var i=Fn(),o=d(i),c=e(o,!0),u=w(o,2),f=v(u),m=v(f),g=v(m);p(g,21,()=>h(C).shape.columns,e=>e.name,(n,r)=>{var i=jn();let o;var c=e(i,!0);a(()=>{o=V(i,1,`svelte-16i7bpz`,null,o,{n:h(r).type===`number`}),t(c,h(r).name)}),s(n,i)}),L(g),L(m);var _=w(m);p(_,21,()=>h(C).rows,r,(n,r)=>{var i=Nn();p(i,21,()=>h(C).shape.columns,e=>e.name,(n,i)=>{var o=Mn();let c;var l=e(o,!0);a(e=>{c=V(o,1,`svelte-16i7bpz`,null,c,{n:h(i).type===`number`}),t(l,e)},[()=>P(h(r)[h(i).name])]),s(n,o)}),L(i),s(n,i)}),L(_),L(f),L(u);var y=w(u,2),b=n=>{var r=Pn(),i=e(r);a(()=>t(i,`the first ${h(C).rows.length??``} of ${h(C).shape.rows??``} rows`)),s(n,r)};l(y,e=>{h(C).shape.rows>h(C).rows.length&&e(b)}),a(e=>t(c,e),[()=>en({...h(C).shape,head:[]}).split(`
|
|
6
|
+
First rows:`)[0]]),s(n,i)},je=n=>{var r=Pn(),i=e(r,!0);a(()=>t(i,h(x).type)),s(n,r)};l(Te,e=>{h(b)?e(De):h(o)===`image`&&h(x)?.url?e(Oe,1):h(x)?.type===`application/pdf`&&h(x).url?e(ke,2):h(C)?e(Ae,3):h(x)&&e(je,4)}),L(te),a(()=>{t(re,h(j)),t(ce,Ge[h(o)]),t(fe,h(u))}),s(n,te),S()}o([`click`]);var Rn=i(`<svg class="logo drawing svelte-1dt0rua" viewBox="-0.4 -6.5 32.4 7"><path pathLength="1" d="M2 0L2 -2L0 -4M2 -2L2 -4L4 -6M5.6 0L6.6 0L7.6 -1L5.6 -3L6.6 -4L7.6 -4M11.2 0L13.2 -2L11.2 -4L9.2 -2ZM14.8 0L14.8 -2L15.8 -3L16.8 -4M14.8 -2L14.8 -4M20.4 0L20.4 -2L18.4 -4M20.4 -2L20.4 -4L22.4 -6M26 0L25 -1L25 -4L24 -4M25 -4L26 -4M25 -4L25 -5M30.6 0L29.6 0L27.6 -2L29.6 -4L31.6 -2L27.6 -2" class="svelte-1dt0rua"></path></svg>`);function zn(e,t){let n=O(t,`width`,3,26),r=O(t,`label`,3,``);var i=Rn();a(()=>{T(i,`width`,n()),T(i,`height`,n()*7/32.4),T(i,`role`,r()?`img`:void 0),T(i,`aria-label`,r()||void 0),T(i,`aria-hidden`,r()?void 0:`true`)}),s(e,i)}var Bn=class{note;#e=z([]);get entries(){return h(this.#e)}set entries(e){I(this.#e,e)}#t=z(null);get failed(){return h(this.#t)}set failed(e){I(this.#t,e)}#n=z(null);get cursor(){return h(this.#n)}set cursor(e){I(this.#n,e)}#r=z(``);get busy(){return h(this.#r)}set busy(e){I(this.#r,e,!0)}#i=z(null);get editing(){return h(this.#i)}set editing(e){I(this.#i,e,!0)}stop=null;constructor(e){this.note=e}#a=k(()=>De(this.entries));get waiting(){return h(this.#a)}set waiting(e){I(this.#a,e)}#o=k(()=>this.waiting.filter(e=>e.form===`insert`));get proposals(){return h(this.#o)}set proposals(e){I(this.#o,e)}#s=k(()=>{let e=[],t=fe(this.note.text);for(let n of this.waiting)if(n.form===`rewrite`)for(let r of n.open??[]){let i=n.regions[r],a=we(this.note.text,i.old),o=a?this.note.text.slice(0,a.from).split(`
|
|
7
|
+
`).length-1:-1,s=t.find(e=>e.from<=o&&o<e.to);e.push({key:`r:${n.id}:${r}`,proposal:n,k:r,at:a,block:/\n/.test(i.old.text.trim())||/\n/.test(i.new.trim()),code:!!(s&&/^\s*(```|~~~)/.test(s.text))})}return e.sort((e,t)=>(e.at?.from??1/0)-(t.at?.from??1/0))});get changes(){return h(this.#s)}set changes(e){I(this.#s,e)}#c=k(()=>{try{let e=pe(this.note.text)[0];return{lines:e.split(`
|
|
8
|
+
`).length-1,chars:e.length}}catch{return{lines:0,chars:0}}});get head(){return h(this.#c)}set head(e){I(this.#c,e)}get foot(){return this.note.text.split(`
|
|
9
|
+
`).length}placed(e){return ve(this.note.text,e)!==null}#l=k(()=>{let e=[];for(let t of this.proposals){let n=ve(this.note.text,t);e.push({key:`p:${t.id}`,line:n?.form===`insert`?n.line:this.foot})}this.changes.some(e=>!e.at)&&e.push({key:`lost`,line:this.foot}),this.failed&&e.push({key:`failed`,line:this.failed.line});let t=this.changes.filter(e=>e.at);for(let n of t)n.block&&e.push({key:n.key,line:this.note.text.slice(0,n.at.to).split(`
|
|
10
|
+
`).length});return{blocks:e,old:t.map(e=>e.at),inline:t.filter(e=>!e.block).map(e=>({key:e.key,at:e.at.to}))}});get layout(){return h(this.#l)}set layout(e){I(this.#l,e)}async open(){this.stop=G.on(e=>this.hear(e));try{this.entries=await G.api.journal(this.note.id)}catch{}}close(){this.stop?.()}hear(e){if(e.type!==`journal`||e.id!==this.note.id||this.entries.some(t=>t.id===e.entry.id))return;this.entries=[...this.entries,e.entry];let t=e.entry.kind===`discard`||e.entry.kind===`change`?e.entry.proposal:void 0;t&&this.editing?.id===t&&(this.editing=null)}say(e,t){this.failed={line:e??this.foot,message:t.message}}lineOf(e){return this.layout.blocks.find(t=>t.key===`p:${e.id}`)?.line}edit(e){this.editing={id:e.id,text:e.text}}async done(e){let t=this.editing;if(t?.id===e.id)try{await G.api.revise(this.note.id,e.id,t.text),this.editing=null}catch(t){this.say(this.lineOf(e),t)}}async keep(e){this.busy=e.id;try{await this.note.save(),this.editing?.id===e.id&&await this.done(e),this.note.adopt(await G.api.keep(this.note.id,e.id))}catch(t){this.say(this.lineOf(e),t)}finally{this.busy=``}}async discard(e){this.busy=e.id;try{await G.api.discard(this.note.id,e.id)}catch(t){this.say(this.lineOf(e),t)}finally{this.busy=``}}async keepChange(e){this.busy=e.key;try{await this.note.save(),this.note.adopt(await G.api.keep(this.note.id,e.proposal.id,e.k))}catch(e){this.say(void 0,e)}finally{this.busy=``}}async discardChange(e){this.busy=e.key;try{await G.api.discard(this.note.id,e.proposal.id,e.k)}catch(e){this.say(void 0,e)}finally{this.busy=``}}async settleAll(e){this.busy=`all`;try{e&&await this.note.save();for(let t of[...this.changes].reverse())(!e||t.at)&&(e?this.note.adopt(await G.api.keep(this.note.id,t.proposal.id,t.k)):await G.api.discard(this.note.id,t.proposal.id,t.k))}catch(e){this.say(void 0,e)}finally{this.busy=``}}},Vn=1500,Hn=e=>_e(`isorite.draft.${e}`);function Un(e,t){try{if(t===void 0)return JSON.parse(localStorage.getItem(Hn(e))??`null`);t?localStorage.setItem(Hn(e),JSON.stringify(t)):localStorage.removeItem(Hn(e))}catch{}return null}var Wn=e=>typeof e==`string`?e:e==null?``:String(e),Gn=class{id;#e=z(`loading`);get loaded(){return h(this.#e)}set loaded(e){I(this.#e,e,!0)}#t=z(`saved`);get saving(){return h(this.#t)}set saving(e){I(this.#t,e,!0)}#n=z(``);get message(){return h(this.#n)}set message(e){I(this.#n,e,!0)}#r=z(``);get text(){return h(this.#r)}set text(e){I(this.#r,e,!0)}#i=z(void 0);get theirs(){return h(this.#i)}set theirs(e){I(this.#i,e)}#a=z(0);get revision(){return h(this.#a)}set revision(e){I(this.#a,e,!0)}base=``;saved=``;timer=null;inFlight=null;stop=null;constructor(e){this.id=e}#o=k(()=>{try{return ce(this.text)[0]??{}}catch{return null}});get meta(){return h(this.#o)}set meta(e){I(this.#o,e)}#s=k(()=>{let e=this.meta??{};return{title:Wn(e.title),type:Wn(e.type),description:Wn(e.description),tags:Array.isArray(e.tags)?e.tags.map(String).join(`, `):Wn(e.tags)}});get fields(){return h(this.#s)}set fields(e){I(this.#s,e)}#c=k(()=>{try{return pe(this.text)[2]}catch{return this.text}});get body(){return h(this.#c)}set body(e){I(this.#c,e)}async open(){try{let e=await G.api.readNote(this.id),t=Un(this.id);this.take(e),t&&t.text!==e.text&&(this.text=t.text,t.base===e.version?this.changed():(this.theirs=e,this.saving=`conflict`,Un(this.id,t))),this.loaded=`ready`,this.stop=G.on(e=>this.hear(e))}catch(e){this.loaded=e instanceof Ce&&e.status===404?`missing`:`error`,this.message=e.message}}async close(){this.stop?.(),await this.save()}adopt(e){this.take(e)}async restore(e){await this.settle(),this.take(await G.api.restore(this.id,e,this.base))}async move(e){await this.settle();let t=await G.api.moveNote(this.id,e,this.base);return this.stop?.(),t.id}async setDone(e){await this.settle(),this.take(await G.api.setDone(this.id,e,this.base)),await G.refresh()}async remove(){await this.settle(),await G.api.deleteNote(this.id,this.base),this.stop?.()}async settle(){if(this.saving!==`saved`&&await this.save(),this.saving!==`saved`)throw Error(this.message||`the note could not be saved first`)}take(e){this.text=this.saved=e.text,this.base=e.version,this.theirs=void 0,this.saving=`saved`,this.message=``,Un(this.id,null),this.revision++}setText(e){e!==this.text&&(this.text=e,this.changed())}setBody(e){e!==this.body&&this.setText(Oe(this.text,{},e))}setFields(e){let t={};for(let[n,r]of Object.entries(e)){let e=r.trim();t[n]=n===`tags`?e?e.split(`,`).map(e=>e.trim()).filter(Boolean):null:e||null}this.setMeta(t)}setMeta(e){try{this.setText(Oe(this.text,e,null))}catch{}}changed(){Un(this.id,{base:this.base,text:this.text}),this.saving!==`conflict`&&(this.saving=`unsaved`,this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.save()},Vn))}save(){return this.timer&&=(clearTimeout(this.timer),null),this.inFlight=(this.inFlight??Promise.resolve()).then(()=>this.send()),this.inFlight}async send(){if(this.loaded!==`ready`||this.saving===`conflict`||this.text===this.saved)return;let e=this.text;this.saving=`saving`;try{let t=await G.api.saveNote(this.id,{base:this.base,text:e});this.base=t.version,this.saved=e,this.message=``,this.text===e?(this.saving=`saved`,Un(this.id,null)):this.changed()}catch(t){if(t instanceof Ce&&t.status===409&&t.current!==void 0){if(t.current?.text===e)return this.take(t.current);this.theirs=t.current,this.saving=`conflict`}else this.saving=`failed`,this.message=t.message,this.timer=setTimeout(()=>{this.save()},5e3)}}hear(e){e.type===`note-changed`&&e.id===this.id&&e.version!==this.base&&e.version!==ye(this.text)&&this.saving===`saved`&&G.api.readNote(this.id).then(e=>{this.saving===`saved`&&e.version!==this.base&&this.take(e)},()=>void 0)}keepMine(){let e=this.theirs;return e===void 0?Promise.resolve():(this.theirs=void 0,this.saving=`unsaved`,e===null?G.api.createNote(this.id,this.text).then(e=>this.take(e),e=>{this.saving=`failed`,this.message=e.message}):(this.base=e.version,this.saved=e.text,this.save()))}keepTheirs(){this.theirs&&this.take(this.theirs)}},Kn=u(`<button type="button" role="radio" data-lustre=""><!> </button>`),qn=u(`<span class="field svelte-ml08v2"><!></span>`),Jn=u(`<button type="button" class="seg svelte-ml08v2"> </button>`),Yn=u(`<input class="name svelte-ml08v2" spellcheck="false" autocomplete="off" aria-label="name"/>`),Xn=u(`<button type="button" class="seg name svelte-ml08v2"> </button>`),Zn=u(`<span class="path svelte-ml08v2"><!> <span class="sep svelte-ml08v2">/</span> <!></span>`),Qn=u(`<button type="button" class="br svelte-ml08v2"> </button>`),$n=u(`<input class="adding svelte-ml08v2" size="10" aria-label="new tag"/>`),er=u(`<button type="button" class="add svelte-ml08v2" aria-label="add a tag">+</button>`),tr=u(`<button type="button" class="x svelte-ml08v2">×</button>`),nr=u(`<a class="br svelte-ml08v2"> </a><!>`,1),rr=u(`<option> </option>`),ir=u(`<input class="adding svelte-ml08v2" list="label-notes" size="18"/> <datalist id="label-notes"></datalist>`,1),ar=u(`<button type="button" class="add svelte-ml08v2">+</button>`),or=u(`<div><span class="word svelte-ml08v2"> </span> <!> <!> <span class="grow svelte-ml08v2"></span> <button type="button"> </button></div>`),sr=u(`<p class="problem svelte-ml08v2" role="alert"> </p>`),cr=u(`<textarea rows="1" aria-label="description"></textarea> <div class="label svelte-ml08v2"><span class="kinds svelte-ml08v2" role="radiogroup" aria-label="kind"></span> <!> <span class="parts svelte-ml08v2"><!> <!></span></div> <!> <!>`,1);function lr(n,r){N(r,!0);let i=k(()=>!r.note.id.startsWith(`@`)),o=z(``),c=[[`note`,`concept`,`Concept`],[`question`,`question`,`Question`],[`problem`,`problem`,`Problem`]];function u(e,t,n){e!==r.kind&&(r.note.setFields({type:t}),m().then(()=>$e(n,!0)))}let g=e=>e.split(`/`).slice(0,-1).join(`/`),_=e=>e.split(`/`).at(-1),y=z(null),b=z(``);async function E(e,t){let n=e=>e.trim().replace(/^\/+|\/+$/g,``).replace(/\.md$/,``),i=[n(e),n(t)].filter(Boolean).join(`/`);if(I(y,null),n(t)&&i!==r.note.id){I(o,``);try{let e=await r.note.move(i);await G.refresh(),await oe(Ee(e),{replaceState:!0})}catch(e){I(o,e.message,!0)}}}let O=e=>{let t=e instanceof HTMLInputElement?e:e.querySelector(`input`);t?.focus(),t?.select()},A=k(()=>r.note.fields.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),j=z(!1);function M(e){let t=e.trim();I(j,!1),t&&!h(A).includes(t)&&r.note.setMeta({tags:[...h(A),t]})}let P=e=>r.note.setMeta({tags:h(A).filter(t=>t!==e).length?h(A).filter(t=>t!==e):null}),F=k(()=>r.kind===`note`?null:se[r.kind]),R=k(()=>h(F)?xe(r.note.meta?.[h(F)]):[]),ne=k(()=>h(F)?[...new Set([...h(R),...G.listing.notes.find(e=>e.id===r.note.id)?.attached??[]])]:[]),B=e=>G.listing.notes.find(t=>t.id===e)?.title??_(e),H=z(!1);function ie(e){I(H,!1);let t=e.trim().replace(/^\/+/,``).replace(/\.md$/,``),n=G.listing.notes.find(e=>e.id===t||e.title.toLowerCase()===t.toLowerCase());h(F)&&n&&!h(R).includes(n.id)&&n.id!==r.note.id&&r.note.setMeta({[h(F)]:[...h(R),n.id]})}let ae=e=>{h(F)&&r.note.setMeta({[h(F)]:h(R).filter(t=>t!==e).length?h(R).filter(t=>t!==e):null})};var U=cr(),W=d(U);ee(W);let ce;var le=w(W,2),ue=v(le);p(ue,21,()=>c,([e,t,n])=>e,(e,n)=>{var i=k(()=>D(h(n),3));let o=()=>h(i)[0],c=()=>h(i)[1],l=()=>h(i)[2];var d=Kn(),p=v(d);{let e=k(()=>o()===`note`?`concept`:o());Je(p,{get kind(){return h(e)}})}var m=w(p,1,!0);L(d),a(()=>{V(d,1,`slot ${o()??``}`,`svelte-ml08v2`),T(d,`aria-checked`,r.kind===o()),t(m,c())}),f(`click`,d,e=>u(o(),l(),e.currentTarget)),s(e,d)}),L(ue);var de=w(ue,2),fe=n=>{var i=Zn(),o=v(i),c=e=>{var t=qn(),n=v(t);It(n,{id:`note-folder`,quiet:!0,label:`folder`,placeholder:`the top of the base`,onpick:e=>void E(e,_(r.note.id)),onkeydown:e=>{e.key===`Escape`&&I(y,null)},get value(){return h(b)},set value(e){I(b,e,!0)}}),L(t),x(t,e=>O?.(e)),s(e,t)},u=n=>{var i=Jn(),o=e(i,!0);a((e,n)=>{T(i,`aria-label`,e),t(o,n)},[()=>g(r.note.id)?void 0:`the top of the base`,()=>g(r.note.id).replaceAll(`/`,` / `)||`·`]),f(`click`,i,()=>{I(b,g(r.note.id),!0),I(y,`folder`)}),s(n,i)};l(o,e=>{h(y)===`folder`?e(c):e(u,-1)});var d=w(o,4),p=e=>{var t=Yn();C(t),x(t,e=>O?.(e)),a((e,n)=>{te(t,e),T(t,`size`,n)},[()=>_(r.note.id),()=>Math.max(8,_(r.note.id).length)]),re(`blur`,t,e=>void E(g(r.note.id),e.currentTarget.value)),f(`keydown`,t,e=>{e.key===`Enter`?e.currentTarget.blur():e.key===`Escape`&&I(y,null)}),s(e,t)},m=n=>{var i=Xn(),o=e(i,!0);a(e=>t(o,e),[()=>_(r.note.id)]),f(`click`,i,()=>I(y,`name`)),s(n,i)};l(d,e=>{h(y)===`name`?e(p):e(m,-1)}),L(i),s(n,i)};l(de,e=>{h(i)&&e(fe)});var pe=w(de,2),me=v(pe);p(me,16,()=>h(A),e=>e,(n,r)=>{var i=Qn(),o=e(i,!0);a(()=>{T(i,`aria-label`,`tag ${r??``}: remove`),t(o,r)}),f(`click`,i,()=>P(r)),s(n,i)});var he=w(me,2),ge=e=>{var t=$n();x(t,e=>O?.(e)),re(`blur`,t,e=>M(e.currentTarget.value)),f(`keydown`,t,e=>{e.key===`Enter`?e.currentTarget.blur():e.key===`Escape`&&I(j,!1)}),s(e,t)},_e=e=>{var t=er();f(`click`,t,()=>I(j,!0)),s(e,t)};l(he,e=>{h(j)?e(ge):e(_e,-1)}),L(pe),L(le);var ve=w(le,2),ye=n=>{var i=or(),o=v(i),c=e(o,!0),u=w(o,2);p(u,16,()=>h(ne),e=>e,(n,r)=>{var i=nr(),o=d(i),c=e(o,!0),u=w(o),p=e=>{var t=tr();a(e=>T(t,`aria-label`,`${e??``}: take away`),[()=>B(r)]),f(`click`,t,()=>ae(r)),s(e,t)},m=k(()=>h(R).includes(r));l(u,e=>{h(m)&&e(p)}),a((e,n)=>{T(o,`href`,e),t(c,n)},[()=>Ee(r),()=>B(r)]),s(n,i)});var m=w(u,2),g=n=>{var i=ir(),o=d(i);x(o,e=>O?.(e));var c=w(o,2);p(c,21,()=>G.listing.notes.filter(e=>e.id!==r.note.id&&!e.id.startsWith(`@`)),e=>e.id,(n,r)=>{var i=rr(),o=e(i,!0),c={};a(()=>{t(o,h(r).title),c!==(c=h(r).id)&&(i.value=(i.__value=c)??``)}),s(n,i)}),L(c),a(()=>T(o,`aria-label`,`a note it's ${h(F)===`about`?`about`:`using`}`)),re(`blur`,o,e=>ie(e.currentTarget.value)),f(`keydown`,o,e=>{e.key===`Enter`?e.currentTarget.blur():e.key===`Escape`&&I(H,!1)}),s(n,i)},_=e=>{var t=ar();a(()=>T(t,`aria-label`,`add a note it's ${h(F)===`about`?`about`:`using`}`)),f(`click`,t,()=>I(H,!0)),s(e,t)};l(m,e=>{h(H)?e(g):e(_,-1)});var y=w(m,4);let b;var S=e(y,!0);L(i),a(()=>{V(i,1,`extra ${r.kind??``}`,`svelte-ml08v2`),t(c,h(F)),b=V(y,1,`mark svelte-ml08v2`,null,b,{done:!!r.done}),T(y,`aria-pressed`,!!r.done),y.disabled=r.marking,T(y,`title`,r.done?`since ${r.done}`:void 0),t(S,r.kind===`question`?r.done?`◆ resolved`:`◇ open`:r.done?`◆ solved`:`◇ unsolved`)}),f(`click`,y,function(...e){r.onmark?.apply(this,e)}),s(n,i)};l(ve,e=>{h(F)&&e(ye)});var be=w(ve,2),Se=n=>{var r=sr(),i=e(r,!0);a(()=>t(i,h(o))),s(n,r)};l(be,e=>{h(o)&&e(Se)}),a(()=>{ce=V(W,1,`stand serif svelte-ml08v2`,null,ce,{empty:!r.note.fields.description}),te(W,r.note.fields.description)}),f(`input`,W,e=>r.note.setFields({description:e.currentTarget.value.replace(/\s*\n\s*/g,` `)})),f(`keydown`,W,e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur())}),s(n,U),S()}o([`input`,`keydown`,`click`]);var ur=u(`<span class="sym svelte-wdtkre"> </span>`),dr=u(`<span class="lines svelte-wdtkre"> </span>`),fr=u(`<span class="why svelte-wdtkre"> </span>`),pr=u(`<span class="ln svelte-wdtkre"></span>`),mr=u(`<span class="pre svelte-wdtkre"></span> <!> <!>`,1),hr=u(`<span data-code-embed=""><span class="head svelte-wdtkre"><span class="file svelte-wdtkre"> </span> <!> <!></span> <!></span>`);function gr(n,i){N(i,!0);let o=z(null),c=z(null),u=z(``);async function f(){try{let e=await G.api.code(i.href);I(o,e),I(c,e.state===`ok`?await qe(e.text,e.path):null,!0),I(u,``)}catch(e){I(u,e.message,!0)}}R(()=>{i.href,f();let e=()=>{document.visibilityState===`visible`&&f()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)});let m={"no-repository":`no repository is named for this base's code links`,"no-file":`not in the repository`,"no-symbol":`no longer in the file by that name`,unsupported:`isorite can find symbols in this kind of file only by lines`,"too-large":`too large to show`},g=k(()=>h(o)?.state===`ok`?h(o).start===h(o).end?`line ${h(o).start}`:`lines ${h(o).start}–${h(o).end}`:``);var _=hr();let b;var x=v(_),C=v(x),E=e(C,!0),D=w(C,2),O=n=>{var r=ur(),i=e(r,!0);a(()=>t(i,h(o).symbol)),s(n,r)};l(D,e=>{h(o)?.symbol&&e(O)});var A=w(D,2),j=n=>{var r=dr(),i=e(r,!0);a(()=>t(i,h(g))),s(n,r)};l(A,e=>{h(g)&&e(j)}),L(x);var M=w(x,2),P=n=>{var r=fr(),i=e(r,!0);a(()=>t(i,h(u))),s(n,r)},F=n=>{var r=fr(),i=e(r,!0);a(()=>t(i,m[h(o).state])),s(n,r)},ee=n=>{var i=mr(),u=d(i);let f;p(u,21,()=>h(o).text.split(`
|
|
11
|
+
`),r,(e,t,n)=>{var r=pr();H(r,()=>(h(c)?.split(`
|
|
12
|
+
`)[n]??h(t).replace(/&/g,`&`).replace(/</g,`<`))||` `,!0),L(r),a(()=>T(r,`data-n`,h(o).start+n)),s(e,r)}),L(u);var m=w(u,2),g=n=>{var r=fr(),i=e(r);a(()=>t(i,`… ${h(o).end-h(o).start+1-120} more lines in the file`)),s(n,r)};l(m,e=>{h(o).more&&e(g)});var _=w(m,2),v=n=>{var r=fr(),i=e(r);a(()=>t(i,`${h(o).count??``} declarations of this name: the first is shown`)),s(n,r)};l(_,e=>{h(o).count&&e(v)}),a(()=>f=y(u,``,f,{"--from":h(o).start})),s(n,i)};l(M,e=>{h(u)?e(P):h(o)&&h(o).state!==`ok`?e(F,1):h(o)?.state===`ok`&&e(ee,2)}),L(_),a(e=>{b=V(_,1,`code svelte-wdtkre`,null,b,{broken:h(o)&&h(o).state!==`ok`}),t(E,e)},[()=>h(o)?.path??i.href.slice(5).split(`#`)[0]]),s(n,_),S()}var _r=u(`<span class="problem svelte-zlq7nn"> </span>`),vr=u(`<span class="embed svelte-zlq7nn"><a class="name svelte-zlq7nn"><!> </a> <!> <!></span>`);function yr(n,r){N(r,!0);let i=z(null),o=z(``),c=z(ne([]));R(()=>{let e=r.path;sn(G.api,e).then(e=>{I(i,e)},e=>{I(o,e.message,!0)})});var u=vr(),d=v(u),f=v(d);Je(f,{kind:`artifact`,size:11});var m=w(f,1,!0);L(d);var g=w(d,2),_=n=>{var r=_r(),i=e(r,!0);a(()=>t(i,h(o))),s(n,r)},y=e=>{{let t=k(()=>h(i).manifest.title||r.path);gn(e,{get path(){return r.path},get html(){return h(i).html},get uses(){return h(i).manifest.uses},get title(){return h(t)},onerror:e=>{h(c).includes(e)||I(c,[...h(c),e],!0)}})}};l(g,e=>{h(o)?e(_):h(i)&&e(y,1)});var b=w(g,2);p(b,16,()=>h(c),e=>e,(n,r)=>{var i=_r(),o=e(i,!0);a(()=>t(o,r)),s(n,i)}),L(u),a((e,n)=>{T(d,`href`,e),t(m,n)},[()=>Ee(r.path),()=>h(i)?.manifest.title||r.path.split(`/`).at(-1)]),s(n,u),S()}var br=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Tr(e.state,n.from);return r.line?Sr(e):r.block?wr(e):!1};function xr(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Sr=xr(Ar,0),Cr=xr(kr,0),wr=xr((e,t)=>kr(e,t,Or(t)),0);function Tr(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var Er=50;function Dr(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-Er,r),o=e.sliceDoc(i,i+Er),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+Er),d=e.sliceDoc(i-Er,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Or(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function kr(e,t,n=t.selection.ranges){let r=n.map(e=>Tr(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>Dr(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Ar(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Tr(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var jr=pt.define(),Mr=pt.define(),Nr=mt.define(),Pr=mt.define({combine(e){return _t(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Fr=wt.define({create(){return $r.empty},update(e,t){let n=t.state.facet(Pr),r=t.annotation(jr);if(r){let i=Hr.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Ur(o,o.length,n.minDepth,i):Jr(o,t.startState.selection),new $r(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Mr);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(gt.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Hr.fromTransaction(t),o=t.annotation(gt.time),s=t.annotation(gt.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new $r(e.done.map(Hr.fromJSON),e.undone.map(Hr.fromJSON))}});function Ir(e={}){return[Fr,Pr.of(e),q.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Rr:e.inputType==`historyRedo`?zr:null;return n?(e.preventDefault(),n(t)):!1}})]}function Lr(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Fr,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Rr=Lr(0,!1),zr=Lr(1,!1),Br=Lr(0,!0),Vr=Lr(1,!0),Hr=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&ct.fromJSON(t.changes),[],t.mapped&&at.fromJSON(t.mapped),t.startSelection&&J.fromJSON(t.startSelection),t.selectionsAfter.map(J.fromJSON))}static fromTransaction(t,n){let r=Z;for(let e of t.startState.facet(Nr)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Z)}static selection(t){return new e(void 0,Z,void 0,void 0,t)}};function Ur(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Wr(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Gr(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Kr(e,t){return e.length?t.length?e.concat(t):e:t}var Z=[],qr=200;function Jr(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-qr));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Ur(e,e.length-1,1e9,n.setSelAfter(r)))}return[Hr.selection([t])]}function Yr(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Xr(e,t){if(!e.length)return e;let n=e.length,r=Z;for(;n;){let i=Zr(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Hr.selection(r)]:Z}function Zr(e,t,n){let r=Kr(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Z,n);if(!e.changes)return Hr.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Hr(i,Ct.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Qr=/^(input\.type|delete)($|\.)/,$r=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Qr.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Wr(s.changes,t.changes))||r==`input.type.compose`)?Ur(o,o.length-1,i.minDepth,new Hr(t.changes.compose(s.changes),Kr(Ct.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Z)):Ur(o,o.length,i.minDepth,t),new e(o,Z,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Z;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Gr(a[a.length-1],t)?this:new e(Jr(this.done,t),this.undone,n,r)}addMapping(t){return new e(Xr(this.done,t),Xr(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:jr.of({side:e,rest:Yr(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Z:r.slice(0,r.length-1);return i.mapped&&(n=Xr(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:jr.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};$r.empty=new $r(Z,Z);var ei=[{key:`Mod-z`,run:Rr,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:zr,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:zr,preventDefault:!0},{key:`Mod-u`,run:Br,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Vr,preventDefault:!0}];function ti(e,t){return J.create(e.ranges.map(t),e.mainIndex)}function ni(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function ri({state:e,dispatch:t},n){let r=ti(e.selection,n);return!r.eq(e.selection,!0)&&(t(ni(e,r)),!0)}function ii(e,t){return J.cursor(t?e.to:e.from)}function ai(e,t){return ri(e,n=>n.empty?e.moveByChar(n,t):ii(n,t))}function Q(e){return e.textDirectionAt(e.state.selection.main.head)==ut.LTR}var oi=e=>ai(e,!Q(e)),si=e=>ai(e,Q(e));function ci(e,t){return ri(e,n=>n.empty?e.moveByGroup(n,t):ii(n,t))}var li=e=>ci(e,!Q(e)),ui=e=>ci(e,Q(e));typeof Intl<`u`&&Intl.Segmenter;function di(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function fi(e,t,n){let r=K(e).resolveInner(t.head),i=n?xt.closedBy:xt.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;di(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?Ot(e,r.from,1):Ot(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,J.cursor(s,n?-1:1)}var pi=e=>ri(e,t=>fi(e.state,t,!Q(e))),mi=e=>ri(e,t=>fi(e.state,t,Q(e)));function hi(e,t){return ri(e,n=>{if(!n.empty)return ii(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var gi=e=>hi(e,!1),_i=e=>hi(e,!0);function vi(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(q.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function yi(e,t){let n=vi(e),{state:r}=e,i=ti(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):ii(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=q.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(ni(r,i),{effects:a}),!0}var bi=e=>yi(e,!1),xi=e=>yi(e,!0);function Si(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=J.cursor(r.from+n))}return i}var Ci=e=>ri(e,t=>Si(e,t,!0)),wi=e=>ri(e,t=>Si(e,t,!1)),Ti=e=>ri(e,t=>Si(e,t,!Q(e))),Ei=e=>ri(e,t=>Si(e,t,Q(e))),Di=e=>ri(e,t=>e.moveToLineBoundary(t,!1,!1)),Oi=e=>ri(e,t=>e.moveToLineBoundary(t,!0,!1));function ki(e,t,n){let r=!1,i=ti(e.selection,t=>{let i=Ot(e,t.head,-1)||Ot(e,t.head,1)||t.head>0&&Ot(e,t.head-1,1)||t.head<e.doc.length&&Ot(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?J.range(t.anchor,a):J.cursor(a)});return r?(t(ni(e,i)),!0):!1}var Ai=({state:e,dispatch:t})=>ki(e,t,!1);function $(e,t,n){let r=ti(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=J.range(e.head,e.anchor));let r=n(e);return J.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(ni(e.state,r)),!0)}function ji(e,t){return $(e,t,n=>e.moveByChar(n,t))}var Mi=e=>ji(e,!Q(e)),Ni=e=>ji(e,Q(e));function Pi(e,t){return $(e,t,n=>e.moveByGroup(n,t))}var Fi=e=>Pi(e,!Q(e)),Ii=e=>Pi(e,Q(e)),Li=e=>{let t=!Q(e);return $(e,t,n=>fi(e.state,n,t))},Ri=e=>{let t=Q(e);return $(e,t,n=>fi(e.state,n,t))};function zi(e,t){return $(e,t,n=>e.moveVertically(n,t))}var Bi=e=>zi(e,!1),Vi=e=>zi(e,!0);function Hi(e,t){return $(e,t,n=>e.moveVertically(n,t,vi(e).height))}var Ui=e=>Hi(e,!1),Wi=e=>Hi(e,!0),Gi=e=>$(e,!0,t=>Si(e,t,!0)),Ki=e=>$(e,!1,t=>Si(e,t,!1)),qi=e=>{let t=!Q(e);return $(e,t,n=>Si(e,n,t))},Ji=e=>{let t=Q(e);return $(e,t,n=>Si(e,n,t))},Yi=e=>$(e,!1,t=>J.cursor(e.lineBlockAt(t.head).from)),Xi=e=>$(e,!0,t=>J.cursor(e.lineBlockAt(t.head).to)),Zi=({state:e,dispatch:t})=>(t(ni(e,{anchor:0})),!0),Qi=({state:e,dispatch:t})=>(t(ni(e,{anchor:e.doc.length})),!0),$i=({state:e,dispatch:t})=>(t(ni(e,{anchor:e.selection.main.anchor,head:0})),!0),ea=({state:e,dispatch:t})=>(t(ni(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ta=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),na=({state:e,dispatch:t})=>{let n=xa(e).map(({from:t,to:n})=>J.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:J.create(n),userEvent:`select`})),!0},ra=({state:e,dispatch:t})=>{let n=ti(e.selection,t=>{let n=K(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return J.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(ni(e,n)),!0)};function ia(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(ni(n,J.create(i,i.length-1))),!0)}var aa=e=>ia(e,!1),oa=e=>ia(e,!0),sa=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=J.create([n.main]):n.main.empty||(r=J.create([J.cursor(n.main.head)])),r?(t(ni(e,r)),!0):!1};function ca(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=la(e,o,!1)):o>i&&(n=`delete.forward`,o=la(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=la(e,i,!1),a=la(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:J.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?q.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function la(e,t,n){if(e instanceof q)for(let r of e.state.facet(q.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var ua=(e,t,n)=>ca(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=bt(s,a.tabSize)%Dt(a)||Dt(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Et(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=Et(o.text,c-o.from,!1,!1)+o.from);return c}),da=e=>ua(e,!1,!0),fa=e=>ua(e,!0,!1),pa=(e,t)=>ca(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=Et(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),ma=e=>pa(e,!1),ha=e=>pa(e,!0),ga=e=>ca(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),_a=e=>ca(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),va=e=>ca(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ya=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:yt.of([``,``])},range:J.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},ba=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Et(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Et(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:J.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function xa(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Sa(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of xa(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(J.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(J.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:J.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Ca=({state:e,dispatch:t})=>Sa(e,t,!1),wa=({state:e,dispatch:t})=>Sa(e,t,!0);function Ta(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of xa(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Ea=({state:e,dispatch:t})=>Ta(e,t,!1),Da=({state:e,dispatch:t})=>Ta(e,t,!0),Oa=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(xa(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=ti(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function ka(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=K(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(xt.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Aa=Ma(!1),ja=Ma(!0);function Ma(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&ka(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new St(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=At(s,r);for(c??=bt(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,kt(t,c)];return o&&l.push(kt(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:yt.of(l)},range:J.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Na(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:J.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Pa=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new St(e,{overrideIndentation:e=>n[e]??-1}),i=Na(e,(t,i,a)=>{let o=At(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=kt(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},Fa=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Na(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ft)})}),{userEvent:`input.indent`})),!0),Ia=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Na(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=bt(r,e.tabSize),a=0,o=kt(e,Math.max(0,i-Dt(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),La=e=>(e.setTabFocusMode(),!0),Ra=[{key:`Ctrl-b`,run:oi,shift:Mi,preventDefault:!0},{key:`Ctrl-f`,run:si,shift:Ni},{key:`Ctrl-p`,run:gi,shift:Bi},{key:`Ctrl-n`,run:_i,shift:Vi},{key:`Ctrl-a`,run:Di,shift:Yi},{key:`Ctrl-e`,run:Oi,shift:Xi},{key:`Ctrl-d`,run:fa},{key:`Ctrl-h`,run:da},{key:`Ctrl-k`,run:ga},{key:`Ctrl-Alt-h`,run:ma},{key:`Ctrl-o`,run:ya},{key:`Ctrl-t`,run:ba},{key:`Ctrl-v`,run:xi}],za=[{key:`ArrowLeft`,run:oi,shift:Mi,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:li,shift:Fi,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Ti,shift:qi,preventDefault:!0},{key:`ArrowRight`,run:si,shift:Ni,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:ui,shift:Ii,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Ei,shift:Ji,preventDefault:!0},{key:`ArrowUp`,run:gi,shift:Bi,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Zi,shift:$i},{mac:`Ctrl-ArrowUp`,run:bi,shift:Ui},{key:`ArrowDown`,run:_i,shift:Vi,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Qi,shift:ea},{mac:`Ctrl-ArrowDown`,run:xi,shift:Wi},{key:`PageUp`,run:bi,shift:Ui},{key:`PageDown`,run:xi,shift:Wi},{key:`Home`,run:wi,shift:Ki,preventDefault:!0},{key:`Mod-Home`,run:Zi,shift:$i},{key:`End`,run:Ci,shift:Gi,preventDefault:!0},{key:`Mod-End`,run:Qi,shift:ea},{key:`Enter`,run:Aa,shift:Aa},{key:`Mod-a`,run:ta},{key:`Backspace`,run:da,shift:da,preventDefault:!0},{key:`Delete`,run:fa,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:ma,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ha,preventDefault:!0},{mac:`Mod-Backspace`,run:_a,preventDefault:!0},{mac:`Mod-Delete`,run:va,preventDefault:!0}].concat(Ra.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Ba=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:pi,shift:Li},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:mi,shift:Ri},{key:`Alt-ArrowUp`,run:Ca},{key:`Shift-Alt-ArrowUp`,run:Ea},{key:`Alt-ArrowDown`,run:wa},{key:`Shift-Alt-ArrowDown`,run:Da},{key:`Mod-Alt-ArrowUp`,run:aa},{key:`Mod-Alt-ArrowDown`,run:oa},{key:`Escape`,run:sa},{key:`Mod-Enter`,run:ja},{key:`Alt-l`,mac:`Ctrl-l`,run:na},{key:`Mod-i`,run:ra,preventDefault:!0},{key:`Mod-[`,run:Ia},{key:`Mod-]`,run:Fa},{key:`Mod-Alt-\\`,run:Pa},{key:`Shift-Mod-k`,run:Oa},{key:`Shift-Mod-\\`,run:Ai},{key:`Mod-/`,run:br},{key:`Alt-A`,mac:`Ctrl-A`,run:Cr},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:La}].concat(za),Va={key:`Tab`,run:Fa,shift:Ia},Ha=mt.define({combine:e=>e[0]??null}),Ua=/^[ \t]*\[\[!([^\]\n]+)\]\][ \t]*$/,Wa={question:`<path d="M8 2.5L13.5 8L8 13.5L2.5 8Z"/>`,problem:`<path d="M8 2.5l5.8 10.5H2.2z"/>`,note:`<rect x="3.5" y="2.5" width="9" height="11"/>`},Ga=`<path d="M3 8.5l3 3 7-7"/>`,Ka=class extends lt{ref;found;at;constructor(e,t,n){super(),this.ref=e,this.found=t,this.at=n}eq(e){return e.ref===this.ref&&JSON.stringify(e.found)===JSON.stringify(this.found)&&e.at===this.at}toDOM(e){let t=this.found,n=document.createElement(`div`);n.className=`cm-lp-embed${t?` cm-lp-embed-${t.kind}`:` cm-lp-embed-broken`}${t?.done?` cm-lp-embed-done`:``}`,n.title=`[[!${this.ref}]]`;let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);r.setAttribute(`viewBox`,`0 0 16 16`),r.setAttribute(`width`,`16`),r.setAttribute(`height`,`16`),r.setAttribute(`aria-hidden`,`true`),r.innerHTML=t?.done?Ga:Wa[t?.kind??`question`];let i=document.createElement(`span`);return i.textContent=t?t.title:this.ref,n.append(r,i),n.addEventListener(`mousedown`,n=>{n.preventDefault(),t&&!n.altKey?e.state.facet(Ha)?.open(t.id):(e.dispatch({selection:{anchor:this.at},scrollIntoView:!0}),e.focus())}),n}ignoreEvent(){return!0}get estimatedHeight(){return 44}},qa=class extends lt{kind;source;at;beneath;constructor(e,t,n,r){super(),this.kind=e,this.source=t,this.at=n,this.beneath=r}eq(e){return e.kind===this.kind&&e.source===this.source&&e.at===this.at&&e.beneath===this.beneath}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lp-block cm-lp-${this.kind}${this.beneath?` cm-lp-beneath`:``}`;let n=document.createElement(`div`);return n.className=`prose`,t.append(n),n.innerHTML=Ue(this.source),this.beneath||(t.title=`Click to edit`,t.addEventListener(`mousedown`,t=>{t.preventDefault(),e.dispatch({selection:{anchor:this.at},scrollIntoView:!0}),e.focus()})),t}ignoreEvent(){return!0}get estimatedHeight(){return this.kind===`maths`?60:120}},Ja=new WeakMap,Ya=class extends lt{source;at;beneath;constructor(e,t,n){super(),this.source=e,this.at=t,this.beneath=n}eq(e){return e.source===this.source&&e.at===this.at&&e.beneath===this.beneath}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lp-block cm-lp-diagram${this.beneath?` cm-lp-beneath`:``}`;let n=document.createElement(`pre`);n.className=`cm-lp-diagram-src`,n.textContent=this.source;let r=document.createElement(`div`);return r.className=`diagram`,t.append(n,r),Ja.set(t,{mounted:Ke(r,this.source,()=>t.classList.add(`cm-lp-broken-diagram`)),source:this.source}),this.beneath||(t.title=`Click to edit`,t.addEventListener(`mousedown`,t=>{t.preventDefault(),e.dispatch({selection:{anchor:this.at},scrollIntoView:!0}),e.focus()})),t}updateDOM(e){let t=Ja.get(e);return!t||!this.beneath||!e.classList.contains(`cm-lp-beneath`)?!1:(t.source!==this.source&&(t.source=this.source,e.classList.remove(`cm-lp-broken-diagram`),e.querySelector(`.cm-lp-diagram-src`).textContent=this.source,t.mounted.then(e=>Ye(e,this.source))),!0)}ignoreEvent(){return!0}get estimatedHeight(){return 160}},Xa=(e,t)=>t!==null&&e.sliceDoc(t.from,t.to).trim().split(/\s/)[0].toLowerCase()===`mermaid`;function Za(e){let t=[],n=e.selection.ranges;K(e).iterate({enter:r=>{let i=null,a=``;if(r.name===`BlockMath`)i=`maths`,a=e.sliceDoc(r.from,r.to);else if(r.name===`Table`)i=`table`,a=e.sliceDoc(r.from,r.to);else if(r.name===`FencedCode`&&Xa(e,r.node.getChild(`CodeInfo`))){let i=r.node.getChild(`CodeText`),a=i?e.sliceDoc(i.from,i.to):``,o=e.doc.lineAt(r.from).from,s=e.doc.lineAt(r.to).to;return n.some(e=>e.to>=o&&e.from<=s)?a.trim()&&t.push(X.widget({widget:new Ya(a,r.from,!0),block:!0,side:1}).range(s)):t.push(X.replace({widget:new Ya(a,r.from,!1),block:!0}).range(o,s)),!1}else if(r.name===`Document`||r.name===`Blockquote`||/List|ListItem/.test(r.name))return;if(!i)return!1;let o=e.doc.lineAt(r.from).from,s=e.doc.lineAt(r.to).to;return n.some(e=>e.to>=o&&e.from<=s)?i!==`table`&&a.trim()&&t.push(X.widget({widget:new qa(i,a,r.from,!0),block:!0,side:1}).range(s)):t.push(X.replace({widget:new qa(i,a,r.from,!1),block:!0}).range(o,s)),!1}});let r=e.facet(Ha);if(r){let i=!1;for(let a=1;a<=e.doc.lines;a++){let o=e.doc.line(a);if(/^\s*(```|~~~)/.test(o.text)){i=!i;continue}let s=i?null:Ua.exec(o.text);if(!s||n.some(e=>e.to>=o.from&&e.from<=o.to))continue;let c=s[1].trim();t.push(X.replace({widget:new Ka(c,r.find(c),o.from),block:!0}).range(o.from,o.to))}}return X.set(t,!0)}var Qa=wt.define({create:Za,update(e,t){return t.docChanged||t.selection||K(t.startState)!==K(t.state)?Za(t.state):e},provide:e=>q.decorations.from(e)}),$a=q.theme({".cm-lp-block":{padding:`0`,cursor:`text`},".cm-lp-block .katex-display > .katex":{fontSize:`1.17em`},".cm-lp-block .prose":{maxWidth:`none`},".cm-lp-block .prose > :last-child, .cm-lp-block .table-wrap":{marginBottom:`0`},".cm-lp-block .katex-display":{margin:`0`},".cm-lp-diagram .diagram":{overflowX:`auto`,overflowY:`hidden`},".cm-lp-diagram-src":{display:`none`,margin:`0`,font:`13px/20px var(--font-mono)`,whiteSpace:`pre-wrap`,color:`var(--text-soft)`},".cm-lp-diagram.cm-lp-broken-diagram:not(.cm-lp-beneath) .cm-lp-diagram-src":{display:`block`},".cm-lp-beneath":{borderLeft:`2px solid var(--line)`,paddingLeft:`12px`,marginTop:`4px`,opacity:`.9`},".cm-lp-block:not(.cm-lp-beneath):hover":{outline:`1px dashed var(--line)`,outlineOffset:`2px`},".cm-lp-embed":{display:`flex`,alignItems:`center`,gap:`10px`,padding:`9px 12px`,border:`1px solid var(--rose)`,borderLeftWidth:`3px`,background:`var(--rose-soft)`,fontFamily:`var(--font-text)`,fontSize:`16px`,lineHeight:`1.45`,cursor:`pointer`},".cm-lp-embed svg":{flex:`none`,fill:`none`,stroke:`var(--rose)`,strokeWidth:`1.4`},".cm-lp-embed-problem":{borderColor:`var(--line-strong)`,background:`var(--ground-1)`},".cm-lp-embed-problem svg":{stroke:`var(--text-soft)`},".cm-lp-embed-done":{borderColor:`var(--malachite)`,background:`var(--malachite-soft)`},".cm-lp-embed-done svg":{stroke:`var(--malachite)`},".cm-lp-embed-broken":{borderStyle:`dashed`,borderColor:`var(--line-strong)`,background:`none`,color:`var(--text-faint)`},".cm-lp-embed-broken svg":{stroke:`var(--text-faint)`},".cm-lp-embed:hover":{borderColor:`var(--text-soft)`}});function eo(e,t){let{state:n}=e,r=t.length;return e.dispatch(n.changeByRange(e=>{let i=n.sliceDoc(e.from-r,e.from),a=n.sliceDoc(e.to,e.to+r);return i===t&&a===t?{changes:[{from:e.from-r,to:e.from},{from:e.to,to:e.to+r}],range:J.range(e.from-r,e.to-r)}:{changes:[{from:e.from,insert:t},{from:e.to,insert:t}],range:J.range(e.from+r,e.to+r)}}),{scrollIntoView:!0,userEvent:`input`}),!0}function to(e){let{state:t}=e,n=new Map;for(let e of t.selection.ranges)for(let r=e.from;r<=e.to;){let e=t.doc.lineAt(r);n.set(e.number,{from:e.from,text:e.text}),r=e.to+1}return[...n.values()]}function no(e){let t=to(e).map(({from:e,text:t})=>{let n=/^(#{1,6}) /.exec(t),r=n?n[1].length:0,i=r>=3?``:`#`.repeat(r+1)+` `;return{from:e,to:e+(n?n[0].length:0),insert:i}});return e.dispatch({changes:t,scrollIntoView:!0,userEvent:`input`}),!0}function ro(e){let t=to(e),n=t.every(({text:e})=>/^\s*[-*+] /.test(e)),r=t.map(({from:e,text:t})=>{if(n){let n=/^(\s*)[-*+] /.exec(t);return{from:e+n[1].length,to:e+n[0].length}}return{from:e+/^\s*/.exec(t)[0].length,insert:`- `}});return e.dispatch({changes:r,scrollIntoView:!0,userEvent:`input`}),!0}function io(e){let{state:t}=e,n=t.selection.main;if(n.empty)e.dispatch({changes:{from:n.from,insert:`[[]]`},selection:{anchor:n.from+2},userEvent:`input`});else{let r=t.sliceDoc(n.from,n.to);e.dispatch({changes:{from:n.from,to:n.to,insert:`[${r}]()`},selection:{anchor:n.from+r.length+3},userEvent:`input`})}return Mt(e),!0}function ao(e,t){switch(t){case`bold`:return eo(e,`**`);case`italic`:return eo(e,`*`);case`maths`:return eo(e,`$`);case`heading`:return no(e);case`list`:return ro(e);case`link`:return io(e);case`undo`:return Rr(e);case`redo`:return zr(e)}}var oo=[{key:`Mod-b`,preventDefault:!0,run:e=>ao(e,`bold`)},{key:`Mod-i`,preventDefault:!0,run:e=>ao(e,`italic`)},{key:`Mod-k`,preventDefault:!0,run:e=>ao(e,`link`)},{key:`Mod-Shift-m`,preventDefault:!0,run:e=>ao(e,`maths`)},{key:`Mod-Shift-h`,preventDefault:!0,run:e=>ao(e,`heading`)},{key:`Mod-Shift-8`,preventDefault:!0,run:e=>ao(e,`list`)}],so=[`requires`,`uses`,`see also`];function co(e){if(!e||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`#`))return null;let t=e.split(`#`)[0].split(`?`)[0];return/\.html?$/i.test(t)?`artifact`:/\.(png|jpe?g|gif|svg|webp|avif)$/i.test(t)?`image`:/\.md$/i.test(t)||t.endsWith(`/`)?`note`:null}function lo(e,t){let n=K(e);for(let r of[-1,1])for(let i=n.resolveInner(t,r);i;i=i.parent){if(i.name!==`Link`&&i.name!==`Image`)continue;let t=i.getChild(`URL`);if(!t)break;let n=e.sliceDoc(t.from,t.to),r=co(n);if(!r)return null;let a=i.getChild(`LinkTitle`),o=a?e.sliceDoc(a.from,a.to):null;return{from:i.from,to:i.to,embed:i.name===`Image`,url:n,urlTo:t.to,title:o===null?null:o.replace(/^["'(]|["')]$/g,``),titleFrom:a?a.from:t.to,titleTo:a?a.to:t.to,kind:r}}return null}var uo=e=>e.kind===`note`||e.kind===`artifact`&&!e.embed;function fo(e,t,n){let r=[];return K(e).iterate({from:t,to:n,enter:i=>{if(i.name!==`Link`&&i.name!==`Image`)return;if(i.from<t||i.to>n)return!1;let a=lo(e,i.from+1);return a&&a.from===i.from&&uo(a)&&r.push(a),!1}}),r}var po=(e,t)=>e.filter(e=>ho(e)!==t).map(e=>_o(e,t)),mo=e=>(e??``).trim().toLowerCase().replace(/[-_]/g,` `),ho=e=>so.includes(mo(e.title))?mo(e.title):mo(e.title)===`seealso`?`see also`:null,go=e=>mo(e.title)===`left`?`left`:`center`;function _o(e,t){return t===null?{from:e.urlTo,to:e.titleTo,insert:``}:e.titleFrom===e.titleTo?{from:e.urlTo,insert:` "${t}"`}:{from:e.titleFrom,to:e.titleTo,insert:`"${t}"`}}function vo(e,t){if(e.embed===t)return[];let n=[t?{from:e.from,insert:`!`}:{from:e.from,to:e.from+1,insert:``}];return e.title!==null&&(e.kind===`image`||ho(e)!==null)&&n.push(_o(e,null)),n}var yo=(e,t)=>e.dispatch({changes:t,userEvent:`input.link`});function bo(e){let t=[...so.map(t=>({label:t[0].toUpperCase()+t.slice(1),on:ho(e)===t,run:(e,n)=>yo(e,_o(n,t)),hint:t===`requires`?`This note cannot be followed without it: it shapes the Atlas and the study order`:t===`uses`?`It draws on it: it shapes the Atlas`:`Related reading: shown, but it does not shape the Atlas`})),{label:`Unrated`,on:ho(e)===null,run:(e,t)=>yo(e,_o(t,null)),hint:`No rating: counted as uses`}];if(e.kind===`note`)return t;let n=[{label:`Shown here`,on:e.embed,run:(e,t)=>yo(e,vo(t,!0)),hint:e.kind===`image`?`The picture is shown in the note`:`The artifact is shown in the note, working`},{label:`Link`,on:!e.embed,run:(e,t)=>yo(e,vo(t,!1)),hint:`A link to it; it opens on its own`}];return e.kind===`image`?e.embed?[...n,{label:`Centre`,on:go(e)===`center`,run:(e,t)=>yo(e,_o(t,null)),hint:`In the middle, 80% of the text's width`},{label:`Left`,on:go(e)===`left`,run:(e,t)=>yo(e,_o(t,`left`)),hint:`At the left, 80% of the text's width`}]:n:e.embed?n:[...n,...t]}function xo(e){let t=t=>e.every(e=>ho(e)===t),n=e.length;return[...so.map(e=>({label:e[0].toUpperCase()+e.slice(1),on:t(e),run:t=>yo(t,po(fo(t.state,t.state.selection.main.from,t.state.selection.main.to),e)),hint:`Rate all ${n} links ${e}`})),{label:`Unrated`,on:t(null),run:e=>yo(e,po(fo(e.state,e.state.selection.main.from,e.state.selection.main.to),null)),hint:`Take the rating from all ${n} links`}]}function So(e){let t=ho(e[0]),n=e.every(e=>ho(e)===t);return`${e.length} links, ${n?t??`unrated`:`mixed`}`}function Co(e){return e.kind===`note`?ho(e)?ho(e)[0].toUpperCase()+ho(e).slice(1):`Unrated`:e.embed?e.kind===`image`?go(e)===`left`?`Shown, left`:`Shown, centre`:`Shown here`:ho(e)?`Link, ${ho(e)}`:`Link`}var wo=(e,t)=>e===t||!!e&&!!t&&e.from===t.from&&e.to===t.to&&e.title===t.title&&e.embed===t.embed,To=class{view;layer;button;menu;leader;path;link=null;hover=null;many=[];open=!1;at=0;constructor(e){this.view=e,this.layer=document.createElement(`div`),this.layer.className=`cm-link-control`,this.layer.hidden=!0,this.leader=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this.leader.setAttribute(`class`,`cm-link-leader`),this.leader.setAttribute(`aria-hidden`,`true`),this.path=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this.leader.append(this.path),this.button=document.createElement(`button`),this.button.type=`button`,this.button.className=`cm-link-button`,this.button.setAttribute(`aria-haspopup`,`menu`),this.button.addEventListener(`mousedown`,e=>e.preventDefault()),this.button.addEventListener(`click`,()=>this.toggle(!this.open,!1)),this.menu=document.createElement(`div`),this.menu.className=`cm-link-menu`,this.menu.setAttribute(`role`,`menu`),this.menu.hidden=!0,this.menu.tabIndex=-1,this.menu.addEventListener(`keydown`,e=>this.keys(e)),this.layer.append(this.leader,this.button,this.menu),e.dom.append(this.layer),e.dom.addEventListener(`mousemove`,this.onMove),e.dom.addEventListener(`mouseleave`,this.onLeave)}onMove=e=>{if(this.open||this.layer.contains(e.target))return;let t=this.view.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t===null?null:lo(this.view.state,t);wo(n,this.hover)||(this.hover=n,this.view.requestMeasure(this.measure))};onLeave=e=>{this.open||this.layer.contains(e.relatedTarget)||this.hover&&(this.hover=null,this.view.requestMeasure(this.measure))};selected(){let e=this.view.state.selection.main;if(e.empty)return[];let t=fo(this.view.state,e.from,e.to);return t.length>=2?t:[]}current(){let e=this.view.state.selection.main,t=this.selected();return t.length?t[0]:lo(this.view.state,e.head)??(e.empty?this.hover:null)}update(e){e.docChanged&&(this.hover=null),(e.docChanged||e.selectionSet||e.geometryChanged||e.viewportChanged||e.focusChanged)&&this.view.requestMeasure(this.measure)}measure={key:`link-control`,read:e=>{let t=this.current();if(!t)return null;let n=this.selected(),r=e.dom.getBoundingClientRect(),i=e.contentDOM.getBoundingClientRect(),a=e.coordsAtPos(Math.max(t.from,t.to-1),1)??e.coordsAtPos(t.to,-1);if(n.length){let t=Math.max(r.top,0),i=Math.min(r.bottom,window.innerHeight);a=null;for(let r=n.length-1;r>=0&&!a;r--){let o=e.coordsAtPos(Math.max(n[r].from,n[r].to-1),1);o&&o.top>=t&&o.bottom<=i-34&&(a=o)}a??=e.coordsAtPos(Math.max(n[0].from,n[0].to-1),1)}return a?{l:t,many:n,x:a.right-r.left,y:(a.top+a.bottom)/2-r.top,right:i.right-r.left,width:r.width}:null},write:e=>{if(!e){this.link=null,this.many=[],this.layer.hidden=!0,this.toggle(!1,!1);return}let t=e.many.length?So(e.many):Co(e.l),n=!wo(e.l,this.link)||e.many.length!==this.many.length||t!==this.button.textContent;this.link=e.l,this.many=e.many,this.layer.hidden=!1,this.button.textContent=t,this.button.title=e.many.length?`Rate all the selected links (Alt+L)`:`What this link is (Alt+L)`,this.button.setAttribute(`aria-label`,e.many.length?`${t}. Rate them all`:`This link: ${t}. Change it`);let r=this.button.offsetWidth||90,i=e.width-e.right>=r+20,a=i?e.right+14:Math.max(0,e.width-r-2),o=i?e.y-13:e.y+12;this.button.style.transform=`translate(${Math.round(a)}px, ${Math.round(o)}px)`,this.menu.style.transform=`translate(${Math.round(Math.min(a,e.width-250))}px, ${Math.round(o+30)}px)`;let s=a,c=o+13;this.path.setAttribute(`d`,i?`M${e.x+3} ${e.y} H${Math.max(e.x+3,s-3)}`:`M${e.x+3} ${e.y} V${c} H${s-3}`),n&&this.open&&(this.fill(),this.mark(this.at))}};fill(){let e=this.link;e&&this.menu.replaceChildren(...(this.many.length?xo(this.many):bo(e)).map((t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.tabIndex=-1,r.id=`cm-link-choice-${n}`,r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`mousemove`,()=>this.mark(n)),r.setAttribute(`role`,`menuitemradio`),r.setAttribute(`aria-checked`,String(t.on)),r.title=t.hint,r.innerHTML=`<b></b><span></span>`,r.querySelector(`b`).textContent=t.label,r.querySelector(`span`).textContent=t.hint,r.addEventListener(`click`,()=>{let n=this.current()??e;t.run(this.view,n),this.toggle(!1,!0)}),r}))}toggle(e,t){if(e&&(this.link=this.current()??this.link,this.many=this.selected()),!e||this.link){if(this.open=e,this.menu.hidden=!e,this.layer.classList.toggle(`open`,e),this.button.setAttribute(`aria-expanded`,String(e)),e){this.fill();let e=[...this.menu.querySelectorAll(`button`)];this.mark(Math.max(0,e.findIndex(e=>e.getAttribute(`aria-checked`)===`true`))),this.menu.focus()}else t&&this.view.focus()}}mark(e){let t=[...this.menu.querySelectorAll(`button`)];this.at=t.length?(e+t.length)%t.length:0,t.forEach((e,t)=>e.classList.toggle(`on`,t===this.at)),this.menu.setAttribute(`aria-activedescendant`,t[this.at]?.id??``)}keys(e){let t=[...this.menu.querySelectorAll(`button`)],n=!0;if(e.key===`Escape`)this.toggle(!1,!0);else if(e.key===`Enter`||e.key===` `)t[this.at]?.click();else if(e.key===`ArrowDown`)this.mark(this.at+1);else if(e.key===`ArrowUp`)this.mark(this.at-1);else if(e.key===`Home`)this.mark(0);else if(e.key===`End`)this.mark(t.length-1);else if(e.key===`Tab`)this.toggle(!1,!0);else if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let r=t.findIndex(t=>t.textContent.toLowerCase().startsWith(e.key.toLowerCase()));r>=0?this.mark(r):n=!1}else n=!1;n&&(e.preventDefault(),e.stopPropagation())}destroy(){this.view.dom.removeEventListener(`mousemove`,this.onMove),this.view.dom.removeEventListener(`mouseleave`,this.onLeave),this.layer.remove()}},Eo=st.fromClass(To),Do=e=>t=>{let n=lo(t.state,t.state.selection.main.head);return n?(e(t,n),!0):!1},Oo=e=>t=>{let n=t.state.selection.main,r=n.empty?[]:fo(t.state,n.from,n.to);return r.length>=2?(yo(t,po(r,e)),!0):Do((t,n)=>{uo(n)&&yo(t,_o(n,e))})(t)},ko=[{key:`Alt-l`,run:e=>{let t=e.plugin(Eo);return!t||!t.current()?!1:(t.toggle(!0,!1),!0)}},{key:`Alt-1`,run:Oo(`requires`)},{key:`Alt-2`,run:Oo(`uses`)},{key:`Alt-3`,run:Oo(`see also`)},{key:`Alt-0`,run:Oo(null)},{key:`Alt-e`,run:Do((e,t)=>{t.kind!==`note`&&yo(e,vo(t,!t.embed))})}],Ao=[Eo,q.baseTheme({"&":{position:`relative`},".cm-link-control":{position:`absolute`,inset:`0`,pointerEvents:`none`,zIndex:`4`,overflow:`visible`},".cm-link-control[hidden]":{display:`none`},".cm-link-leader":{position:`absolute`,left:`0`,top:`0`,width:`100%`,height:`100%`,overflow:`visible`},".cm-link-leader path":{fill:`none`,stroke:`var(--lattice)`,strokeWidth:`1.75`,strokeDasharray:`.1 5`,strokeLinecap:`round`,opacity:`.7`},".cm-link-control:hover .cm-link-leader path, .cm-link-control:focus-within .cm-link-leader path, .cm-link-control.open .cm-link-leader path":{opacity:`1`,animation:`cm-link-run .6s linear infinite`},"@keyframes cm-link-run":{to:{strokeDashoffset:`-5.1`}},"@media (prefers-reduced-motion: reduce)":{".cm-link-leader path":{animation:`none !important`}},".cm-link-button":{position:`absolute`,left:`0`,top:`0`,pointerEvents:`auto`,height:`26px`,padding:`0 9px`,font:`12.5px var(--font-ui)`,whiteSpace:`nowrap`,color:`var(--text)`,background:`var(--ground-1)`,border:`1px solid var(--lattice)`,cursor:`pointer`},".cm-link-button:hover, .cm-link-button[aria-expanded=true]":{background:`var(--lattice-soft)`},".cm-link-button:focus-visible":{outline:`2px solid var(--focus-ring)`,outlineOffset:`2px`},".cm-link-menu":{position:`absolute`,left:`0`,top:`0`,pointerEvents:`auto`,width:`248px`,padding:`4px`,background:`var(--ground-1)`,border:`1px solid var(--line)`,display:`grid`,gap:`1px`},".cm-link-menu[hidden]":{display:`none`},".cm-link-menu button":{display:`grid`,gap:`1px`,textAlign:`left`,padding:`6px 8px 6px 24px`,background:`none`,border:`0`,color:`var(--text)`,font:`13.5px var(--font-ui)`,cursor:`pointer`,position:`relative`},".cm-link-menu button b":{fontWeight:`600`},".cm-link-menu button span":{fontSize:`12px`,color:`var(--text-faint)`,lineHeight:`1.3`},".cm-link-menu button[aria-checked=true]::before":{content:`"●"`,position:`absolute`,left:`8px`,top:`7px`,fontSize:`10px`,color:`var(--lattice)`},".cm-link-menu:focus":{outline:`none`},".cm-link-menu button.on":{background:`var(--lattice-soft)`},".cm-link-menu:focus-visible button.on":{outline:`2px solid var(--focus-ring)`,outlineOffset:`-2px`}}),rt.of(ko)];function jo(e){return t=>{let n=t.matchBefore(/\[\[(?!!)[^\]\n]*$/);if(!n)return null;let r=e().map(e=>({label:e.title,detail:e.folder,apply:(t,n,r,i)=>{let a=`[${e.title}](/${e.id}.md)`,o=r-2,s=t.state.sliceDoc(i,i+2)===`]]`?i+2:i;t.dispatch({changes:{from:o,to:s,insert:a},selection:{anchor:o+a.length}})}}));return{from:n.from+2,options:r,filter:!0,validFor:/^[^\]\n]*$/}}}var Mo=e=>e.split(`/`).at(-1).replace(/\.[^.]+$/,``).replace(/[-_]+/g,` `).trim(),No=e=>/[\s()<>]/.test(e)?`<${e}>`:e;function Po(e,t){return async n=>{let r=n.matchBefore(/\[\[![^\]\n]*$/);if(!r)return null;let i=(e,t,n,r,i)=>{let a=t-3,o=e.state.sliceDoc(n,n+2)===`]]`?n+2:n;e.dispatch({changes:{from:a,to:o,insert:r},selection:i?{anchor:a+i[0],head:a+i[1]}:{anchor:a+r.length}})},a=t?.here()??``,o=a.includes(`/`)?a.slice(0,a.lastIndexOf(`/`)):``,s=(t?await t.pictures().catch(()=>[]):[]).map(e=>{let t=e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):``;return{label:e.path.split(`/`).at(-1),detail:t,picture:e,type:`picture`,boost:t===a?2:+(t===o),info:()=>Lo(e),apply:(t,n,r,a)=>{let o=Mo(e.path),s=`})`;i(t,r,a,s,[2,2+o.length])}}}),c=e().map(e=>e.id);for(let t of e())t.kind&&s.push({label:t.title,detail:t.kind,boost:-1,apply:(e,n,r,a)=>i(e,r,a,U(t.id,c))});return t&&s.push({label:`Paste or drop a picture to add one`,type:`hint`,boost:-99,apply:()=>void 0}),{from:r.from+3,options:s,filter:!0,validFor:/^[^\]\n]*$/}}}function Fo(e,t){return async n=>{let r=n.matchBefore(/\]\([^)\s]*$/);if(!r)return null;let i=t?await t.pictures().catch(()=>[]):[];return{from:r.from+2,options:[...e().map(e=>({label:`/${e.id}.md`,detail:e.title})),...i.map(e=>({label:`/${e.path}`,detail:`picture`,picture:e,type:`picture`,info:()=>Lo(e)}))],validFor:/^[^)\s]*$/}}}function Io(e,t){e.alt=``,e.decoding=`async`,typeof t.src==`string`?e.src=t.src:t.src.then(t=>{t&&(e.src=t)})}function Lo(e){let t=document.createElement(`div`);t.className=`cm-picture-preview`;let n=document.createElement(`img`);Io(n,e);let r=document.createElement(`div`);return r.className=`cm-picture-size`,r.textContent=e.width&&e.height?`${e.width} × ${e.height}`:``,t.append(n,r),t}function Ro(e,t=null){return Nt({override:[Po(e,t),jo(e),Fo(e,t)],icons:!1,activateOnTyping:!0,addToOptions:[{position:20,render:e=>{if(!e.picture)return null;let t=document.createElement(`img`);return t.className=`cm-picture-thumb`,t.loading=`lazy`,Io(t,e.picture),t}}]})}var zo=36,Bo=92,Vo=40,Ho=/^\$\$([^$]*?[^\\])\$\$/,Uo=/^\$((?:[^\s\\])|(?:\S.*?[^\s\\]))\$(?!\d)/,Wo=/^\\\((.+?)\\\)/,Go=/^\$\$([^$]*?[^\\])\$\$(?:[ \t]*\([^)\s]+?\))?(?=[ \t]*(?:\n|$))/,Ko=/^\\\[([\s\S]+?)\\\](?:[ \t]*\([^)$\r\n]+?\))?(?=[ \t]*(?:\n|$))/;function qo(e,t,n){if(t===zo){if(n>e.offset&&e.char(n-1)===Bo)return-1;let t=e.slice(n,e.end),r=(t.charCodeAt(1)===zo?Ho:Uo).exec(t);return r?e.addElement(e.elt(`InlineMath`,n,n+r[0].length,[e.elt(`MathMark`,n,n+(r[0].startsWith(`$$`)?2:1)),e.elt(`MathMark`,n+r[0].length-(r[0].startsWith(`$$`)?2:1),n+r[0].length)])):-1}if(t===Bo&&e.char(n+1)===Vo){let t=Wo.exec(e.slice(n,e.end));if(!t)return-1;let r=n+t[0].length;return e.addElement(e.elt(`InlineMath`,n,r,[e.elt(`MathMark`,n,n+2),e.elt(`MathMark`,r-2,r)]))}return-1}var Jo=2e4;function Yo(e,t){let n=t.text.slice(t.pos),r=n.startsWith(`$$`)?Go:n.startsWith(`\\[`)?Ko:null;if(!r)return!1;let i=e.lineStart+t.pos,a=e.input,o=r.exec(a.read(i,Math.min(a.length,i+Jo)));if(!o)return!1;let s=i+o[0].length;for(;e.lineStart+t.text.length<s&&e.nextLine(););return e.addElement(e.elt(`BlockMath`,i,s)),e.nextLine(),!0}var Xo={defineNodes:[{name:`InlineMath`,style:Y.special(Y.content)},{name:`BlockMath`,block:!0,style:Y.special(Y.content)},{name:`MathMark`,style:Y.processingInstruction}],parseInline:[{name:`InlineMath`,parse:qo,before:`Escape`}],parseBlock:[{name:`BlockMath`,parse:Yo,before:`FencedCode`}]};function Zo(e){let t;return(t=/^\$\$([\s\S]*?)\$\$/.exec(e))||(t=/^\\\[([\s\S]*?)\\\]/.exec(e))?{tex:t[1],display:!0}:(t=/^\\\(([\s\S]*?)\\\)$/.exec(e))||(t=/^\$([\s\S]*?)\$$/.exec(e))?{tex:t[1],display:!1}:{tex:e,display:!1}}var Qo=class extends lt{eq(){return!0}toDOM(){let e=document.createElement(`span`);return e.className=`cm-lp-bullet`,e.textContent=`•`,e}},$o=class extends lt{eq(){return!0}toDOM(){let e=document.createElement(`span`);return e.className=`cm-lp-hr`,e}},es=class extends lt{name;constructor(e){super(),this.name=e}eq(e){return e.name===this.name}toDOM(){let e=document.createElement(`span`);return e.className=`cm-lp-lang`,e.textContent=this.name,e}},ts=class extends lt{source;constructor(e){super(),this.source=e}eq(e){return e.source===this.source}toDOM(){let e=document.createElement(`span`);e.className=`cm-lp-imaths`;let{tex:t,display:n}=Zo(this.source);return e.innerHTML=Be.renderToString(t,{displayMode:n,throwOnError:!1}),e}},ns=class extends lt{key;src;alt;left;constructor(e,t,n,r){super(),this.key=e,this.src=t,this.alt=n,this.left=r}eq(e){return e.key===this.key&&e.alt===this.alt&&e.left===this.left}toDOM(e){let t=document.createElement(`span`);t.className=this.left?`cm-lp-picture cm-lp-picture-left`:`cm-lp-picture`;let n=()=>{t.replaceChildren(),t.classList.add(`cm-lp-picture-broken`),t.textContent=this.key.replace(/^notes:/,``),t.title=this.key.startsWith(`code:`)?`not in the repository`:`not in the notes`,e.requestMeasure()},r=document.createElement(`img`);return r.alt=this.alt,this.alt&&(r.title=this.alt),r.loading=`lazy`,r.decoding=`async`,r.onload=()=>e.requestMeasure(),r.onerror=n,t.append(r),typeof this.src==`string`?r.src=this.src:this.src.then(e=>{e?r.src=e:n()}),t}ignoreEvent(){return!1}},rs=class extends lt{path;mount;constructor(e,t){super(),this.path=e,this.mount=t}eq(e){return e.path===this.path}stop=null;toDOM(e){let t=document.createElement(`span`);return t.className=`cm-lp-artifact`,this.stop=this.mount(t),new ResizeObserver(()=>e.requestMeasure()).observe(t),t}destroy(){this.stop?.(),this.stop=null}ignoreEvent(){return!0}},is=X.replace({}),as=X.replace({widget:new Qo}),os=X.replace({widget:new $o}),ss=e=>X.mark({class:e}),cs=e=>X.line({class:e});function ls(e,t){let n=new Set;if(!t)return n;for(let t of e.selection.ranges){let r=e.doc.lineAt(t.from).number,i=e.doc.lineAt(t.to).number;for(let e=r;e<=i;e++)n.add(e)}return n}function us(e){let{state:t}=e,n=ls(t,e.hasFocus),r=e=>n.has(t.doc.lineAt(e).number),i=[],a=(e,n,r)=>{for(let a=t.doc.lineAt(e).number,o=t.doc.lineAt(n).number;a<=o;a++)i.push(cs(r).range(t.doc.line(a).from))},o=e.visibleRanges;if(o.length){let e=o[0].from,s=o[o.length-1].to,c=/^ {0,3}([-*_])(?: *\1){2,} *$/,l=t.doc.lineAt(e).number,u=t.doc.lineAt(s).number,d=e=>e>=1&&e<=t.doc.lines?t.doc.line(e).text:``;for(let e=l;e<=u;e++){let r=t.doc.line(e);if(r.length!==0||/Code|Math|HTML|Comment/.test(K(t).resolveInner(r.from,1).name))continue;let a=e>1&&t.doc.line(e-1).length===0&&!n.has(e),o=c.test(d(e-1))||c.test(d(e+1));i.push(cs(a?`cm-lp-gap cm-lp-gap-more`:o?`cm-lp-gap cm-lp-gap-rule`:`cm-lp-gap`).range(r.from))}K(t).iterate({from:e,to:s,enter:e=>{let n=e.name,o=/^(?:ATX|Setext)Heading(\d)$/.exec(n);if(o)a(e.from,e.to,`cm-lp-h${o[1]}`);else switch(n){case`HeaderMark`:{if(r(e.from))break;if((e.node.parent?.name??``).startsWith(`SetextHeading`)){i.push(is.range(t.doc.lineAt(e.from).from,e.to));break}let n=t.sliceDoc(e.to,e.to+1)===` `?e.to+1:e.to;n>e.from&&i.push(is.range(e.from,n));break}case`EmphasisMark`:case`StrikethroughMark`:r(e.from)||i.push(is.range(e.from,e.to));break;case`Emphasis`:i.push(ss(`cm-lp-em`).range(e.from,e.to));break;case`StrongEmphasis`:i.push(ss(`cm-lp-strong`).range(e.from,e.to));break;case`Strikethrough`:i.push(ss(`cm-lp-strike`).range(e.from,e.to));break;case`InlineCode`:if(i.push(ss(`cm-lp-code`).range(e.from,e.to)),!r(e.from)){let t=e.node;for(let e=t.firstChild;e;e=e.nextSibling)e.name===`CodeMark`&&i.push(is.range(e.from,e.to))}return!1;case`InlineMath`:return r(e.from)?i.push(ss(`cm-lp-mathsrc`).range(e.from,e.to)):i.push(X.replace({widget:new ts(t.sliceDoc(e.from,e.to))}).range(e.from,e.to)),!1;case`BlockMath`:case`Table`:return a(e.from,e.to,`cm-lp-codeblock`),!1;case`Link`:{let n=e.node,a=[],o=!1;for(let e=n.firstChild;e;e=e.nextSibling)e.name===`LinkMark`&&a.push(e),e.name===`URL`&&(o=!0);let s=a[0],c=a[1],l=n.getChild(`URL`),u=l?t.sliceDoc(l.from,l.to):``,d=u.startsWith(`code:`),f=/^https?:/i.test(u),p=n.getChild(`LinkTitle`),m=ue(p?t.sliceDoc(p.from+1,p.to-1):null),h=d?t.facet(ps)(u)?`cm-lp-link cm-lp-codelink cm-lp-broken`:`cm-lp-link cm-lp-codelink`:f?`cm-lp-link cm-lp-weblink vein web`:`cm-lp-link vein ${m===`requires`?`requires`:m===`see also`?`also`:`uses`}`;s&&c&&c.from>s.to&&i.push((d?X.mark({class:h,attributes:{title:t.facet(ps)(u)?`${u.slice(5)}: not in the repository`:u.slice(5)}}):ss(h)).range(s.to,c.from)),!r(e.from)&&o&&s&&c&&(i.push(is.range(s.from,s.to)),i.push(is.range(c.from,e.to)));break}case`Image`:{let n=e.node,a=n.getChild(`URL`),o=n.getChildren(`LinkMark`),s=a?t.facet(fs)(t.sliceDoc(a.from,a.to)):null;if(s&&o.length>=2){let t=new rs(s.path,s.mount);return r(e.from)?i.push(X.widget({widget:t,side:1}).range(e.to)):i.push(X.replace({widget:t}).range(e.from,e.to)),!1}let c=a?t.facet(ds)(t.sliceDoc(a.from,a.to)):null;if(!c||o.length<2)break;let l=n.getChild(`LinkTitle`),u=l?t.sliceDoc(l.from+1,l.to-1).trim().toLowerCase():``,d=new ns(c.key,c.src,t.sliceDoc(o[0].to,o[1].from),u===`left`);return r(e.from)?i.push(X.widget({widget:d,side:1}).range(e.to)):i.push(X.replace({widget:d}).range(e.from,e.to)),!1}case`ListMark`:{let n=t.sliceDoc(e.from,e.to);!r(e.from)&&/^[-*+]$/.test(n)?i.push(as.range(e.from,e.to)):i.push(ss(`cm-lp-listmark`).range(e.from,e.to));break}case`TaskMarker`:i.push(ss(`cm-lp-task`).range(e.from,e.to));break;case`Blockquote`:a(e.from,e.to,`cm-lp-quote`);break;case`QuoteMark`:if(!r(e.from)){let n=t.sliceDoc(e.to,e.to+1)===` `?e.to+1:e.to;i.push(is.range(e.from,n))}break;case`HorizontalRule`:r(e.from)||(i.push(os.range(e.from,e.to)),a(e.from,e.to,`cm-lp-ruleline`));break;case`FencedCode`:{a(e.from,e.to,`cm-lp-codeblock`);let n=e.node,o=t.doc.lineAt(e.from),s=t.doc.lineAt(e.to),c=n.getChild(`CodeInfo`),l=n.lastChild?.name===`CodeMark`&&n.lastChild.from>=s.from?n.lastChild:null;if(!r(o.from)){i.push(cs(`cm-lp-fence`).range(o.from));let e=c?t.sliceDoc(c.from,c.to).trim().split(/\s/)[0]:``;i.push((e?X.replace({widget:new es(e)}):is).range(o.from,o.to))}return l&&s.number>o.number&&!r(s.from)&&(i.push(cs(`cm-lp-fence`).range(s.from)),s.to>s.from&&i.push(is.range(s.from,s.to))),!1}case`CodeBlock`:return a(e.from,e.to,`cm-lp-codeblock`),!1;case`HTMLBlock`:case`CommentBlock`:return a(e.from,e.to,`cm-lp-codeblock`),!1}}})}i.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide);let s=new vt;for(let e of i)s.add(e.from,e.to,e.value);return s.finish()}var ds=mt.define({combine:e=>e[0]??(()=>null)}),fs=mt.define({combine:e=>e[0]??(()=>null)}),ps=mt.define({combine:e=>e[0]??(()=>!1)}),ms=st.fromClass(class{decorations;constructor(e){this.decorations=us(e)}update(e){(e.docChanged||e.viewportChanged||e.selectionSet||e.focusChanged||K(e.startState)!==K(e.state))&&(this.decorations=us(e.view))}},{decorations:e=>e.decorations}),hs=q.theme({".cm-scroller":{fontFamily:`var(--font-text)`,fontSize:`var(--text-size)`,lineHeight:`1.55`},".cm-lp-gap":{lineHeight:`20px`},".cm-lp-gap-rule":{lineHeight:`10px`},".cm-lp-gap-more":{lineHeight:`4px`},".cm-lp-ruleline":{lineHeight:`12px`},".cm-content":{fontVariationSettings:`"opsz" 18`},".cm-lp-h1, .cm-lp-h2, .cm-lp-h3, .cm-lp-h4, .cm-lp-h5, .cm-lp-h6":{fontWeight:`600`,lineHeight:`1.3`,fontVariationSettings:`"opsz" 36`,paddingTop:`.5em !important`},".cm-lp-h1":{fontSize:`26px`},".cm-lp-artifact":{display:`block`,margin:`8px 0 12px`,fontFamily:`var(--font-ui)`,fontSize:`12px`,lineHeight:`1.4`},".cm-lp-h2":{fontSize:`22px`},".cm-lp-h3":{fontSize:`19px`},".cm-lp-h4":{fontSize:`17px`,fontWeight:`700`},".cm-lp-em":{fontStyle:`italic`},".cm-lp-strong":{fontWeight:`700`},".cm-lp-strike":{textDecoration:`line-through`},".cm-lp-code":{fontFamily:`var(--font-mono)`,fontSize:`.86em`,background:`color-mix(in srgb, var(--text) 8%, transparent)`,padding:`.1em .2em`},".cm-lp-codelink":{color:`var(--lattice)`,fontFamily:`var(--font-mono)`,fontSize:`.86em`,textDecoration:`none`,borderBottom:`1px solid color-mix(in srgb, var(--lattice) 50%, transparent)`},".cm-lp-broken":{color:`var(--rose)`,textDecoration:`line-through`,borderBottomColor:`transparent`},".cm-lp-picture":{display:`block`,margin:`6px auto`,width:`fit-content`,maxWidth:`100%`,lineHeight:`0`},".cm-lp-picture img":{display:`block`,maxWidth:`100%`,height:`auto`},".cm-lp-picture-left":{float:`left`,margin:`4px 16px 4px 0`,maxWidth:`50%`},".cm-lp-picture-broken":{display:`inline-block`,lineHeight:`1.4`,fontFamily:`var(--font-mono)`,fontSize:`.86em`,color:`var(--rose)`,textDecoration:`line-through`,border:`1px dashed color-mix(in srgb, var(--rose) 50%, transparent)`,padding:`6px 10px`,margin:`4px 0`},".cm-lp-bullet":{color:`var(--text-faint)`,display:`inline-block`,minWidth:`1ch`},".cm-lp-listmark, .cm-lp-task":{color:`var(--text-faint)`,fontFamily:`var(--font-mono)`},".cm-lp-quote":{borderLeft:`3px solid var(--lattice)`,paddingLeft:`14px !important`,color:`var(--text-soft)`},".cm-lp-codeblock":{fontFamily:`var(--font-mono)`,fontSize:`13px`,lineHeight:`20px`,background:`color-mix(in srgb, var(--line) 38%, transparent)`,borderLeft:`2px solid var(--line-strong)`,padding:`0 16px !important`},".cm-lp-codeblock.cm-lp-fence":{lineHeight:`12px`,position:`relative`},".cm-lp-lang":{position:`absolute`,top:`8px`,right:`12px`,fontFamily:`var(--font-ui)`,fontSize:`12px`,lineHeight:`16px`,color:`var(--text-faint)`,pointerEvents:`none`},".cm-lp-mathsrc":{fontFamily:`var(--font-mono)`,fontSize:`.86em`,color:`var(--text-soft)`},".cm-lp-imaths .katex":{fontSize:`1.05em`},".cm-lp-imaths .katex-display":{margin:`0`,padding:`6px 0`},".cm-lp-imaths .katex-display > .katex":{fontSize:`1.17em`},".cm-lp-hr":{display:`inline-block`,width:`100%`,borderTop:`1px solid var(--line)`,verticalAlign:`middle`}});function gs(e){let t=e.split(`#`)[0];return t.startsWith(`/`)&&t.endsWith(`.md`)?t.slice(1,-3):null}function _s(e){let t=e.split(/[#?]/)[0];return t.startsWith(`/`)&&!t.startsWith(`//`)&&/\/[^/]*\.[^./]+$/.test(t)&&!t.endsWith(`.md`)?decodeURI(t.slice(1)):null}var vs=Ct.define(),ys=Ct.define(),bs=[wt.define({create:()=>X.none,update(e,t){for(let e of t.effects){if(!e.is(ys))continue;let n=t.state.doc,r=e.value;if(!r)return X.none;let i=X.line({class:`cm-touched cm-touched-${r.who}`});return X.set([...new Set(r.lines)].filter(e=>e>=0&&e<n.lines&&n.line(e+1).text.trim()!==``).sort((e,t)=>e-t).map(e=>i.range(n.line(e+1).from)))}return t.docChanged?e.map(t.changes):e},provide:e=>q.decorations.from(e)}),q.theme({".cm-line.cm-touched-you":{background:`var(--lattice-soft)`,boxShadow:`-10px 0 0 var(--lattice-soft), -13px 0 0 var(--lattice), 10px 0 0 var(--lattice-soft)`},".cm-line.cm-touched-iso":{background:`var(--growth-soft)`,boxShadow:`-10px 0 0 var(--growth-soft), -13px 0 0 var(--growth), 10px 0 0 var(--growth-soft)`}})],xs=Ct.define(),Ss=class extends lt{key;mount;block;down=null;watch=null;constructor(e,t,n){super(),this.key=e,this.mount=t,this.block=n}eq(e){return e.key===this.key&&e.block===this.block}toDOM(e){let t=document.createElement(this.block?`div`:`span`);return t.className=this.block?`cm-overlay`:`cm-iso-change`,t.contentEditable=`false`,this.down=this.mount(t,this.key),this.watch=new ResizeObserver(()=>e.requestMeasure()),this.watch.observe(t),t}destroy(){this.watch?.disconnect(),this.watch=null,this.down?.(),this.down=null}ignoreEvent(){return!0}get estimatedHeight(){return this.block?120:-1}};function Cs(e){return[wt.define({create:()=>X.none,update(t,n){for(let t of n.effects){if(!t.is(vs))continue;let r=n.state.doc;return X.set(t.value.map(t=>{let n=t.line>=r.lines,i=n?r.length:r.line(Math.max(1,t.line+1)).from;return X.widget({widget:new Ss(t.key,e,!0),block:!0,side:n?1:-1}).range(i)}),!0)}return n.docChanged?t.map(n.changes):t},provide:e=>q.decorations.from(e)}),wt.define({create:()=>X.none,update(t,n){for(let t of n.effects){if(!t.is(xs))continue;let r=n.state.doc.length,i=[];for(let e of t.value.marks){let t=Math.max(0,Math.min(r,e.from)),n=Math.max(0,Math.min(r,e.to));n>t&&i.push(X.mark({class:`cm-iso-${e.kind}`}).range(t,n))}for(let n of t.value.inline)i.push(X.widget({widget:new Ss(n.key,e,!1),side:1}).range(Math.max(0,Math.min(r,n.at))));return X.set(i,!0)}return n.docChanged?t.map(n.changes):t},provide:e=>q.decorations.from(e)}),q.theme({".cm-overlay":{cursor:`default`,userSelect:`text`,padding:`10px 0`,display:`flow-root`,whiteSpace:`normal`},".cm-iso-old":{textDecoration:`line-through`,textDecorationColor:`var(--text-faint)`,color:`var(--text-faint)`},".cm-iso-old *":{color:`var(--text-faint) !important`},".cm-iso-change":{cursor:`default`},".cm-iso-by-iso":{background:`var(--growth-soft)`,boxShadow:`inset 0 -1.5px 0 var(--growth)`},".cm-iso-given":{textDecoration:`underline dashed var(--growth)`,textUnderlineOffset:`4px`,textDecorationThickness:`1.5px`}})]}function ws(e){let t=e.split(`#`)[0].split(`?`)[0];return!t.startsWith(`/`)||t.startsWith(`//`)?null:t.endsWith(`.md`)?{id:decodeURIComponent(t.slice(1,-3)),folder:!1}:t.endsWith(`/`)&&t.length>1?{id:decodeURIComponent(t.slice(1,-1)),folder:!0}:null}var Ts=Ct.define(),Es=X.mark({class:`cm-pointed`});function Ds(e,t){if(!t)return X.none;let n=[];return K(e).iterate({enter:r=>{if(r.name!==`Link`)return;let i=lo(e,r.from+1);return i&&!i.embed&&i.from===r.from&&ws(i.url)?.id===t&&n.push(Es.range(i.from,i.to)),!1}}),X.set(n)}var Os=wt.define({create:()=>({id:``,marks:X.none}),update(e,t){let n=e.id;for(let e of t.effects)e.is(Ts)&&(n=e.value);return n!==e.id||n&&t.docChanged?{id:n,marks:Ds(t.state,n)}:e},provide:e=>q.decorations.from(e,e=>e.marks)}),ks=q.theme({".cm-pointed":{backgroundColor:`var(--lattice-soft)`,boxShadow:`0 2px 0 var(--lattice)`}});function As(e){if(!e)return[Os,ks];let t=``,n=n=>{let r=n?`${n.folder?`d`:`n`}:${n.id}`:``;r!==t&&(t=r,e(n))};return[Os,ks,q.domEventHandlers({pointermove(e,t){if(e.pointerType!==`mouse`)return!1;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=r===null?null:lo(t.state,r);return n(i&&!i.embed?ws(i.url):null),!1},pointerleave(){return n(null),!1}})]}var js=q.theme({".cm-scroller":{fontFamily:`var(--font-mono)`,fontSize:`14px`,lineHeight:`1.6`}}),Ms=q.theme({"&":{color:`var(--text)`,backgroundColor:`transparent`,fontSize:`16px`},"&.cm-focused":{outline:`none`},".cm-scroller":{overflow:`visible`},".cm-content":{padding:`12px 0 40vh`,caretColor:`var(--lattice)`},".cm-line":{padding:`0 2px`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--lattice)`,borderLeftWidth:`2px`},".cm-selectionBackground":{backgroundColor:`color-mix(in srgb, var(--lattice) 22%, transparent) !important`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`color-mix(in srgb, var(--lattice) 40%, transparent) !important`},".cm-placeholder":{color:`var(--text-faint)`},".cm-tooltip-autocomplete":{background:`var(--ground-1)`,border:`1px solid var(--line-strong)`,fontFamily:`var(--font-ui)`,fontSize:`13px`},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:`var(--font-ui)`,maxHeight:`16em`},".cm-tooltip-autocomplete > ul > li":{padding:`6px 10px !important`,lineHeight:`1.3`},".cm-picture-thumb":{width:`32px`,height:`32px`,objectFit:`cover`,verticalAlign:`middle`,marginRight:`8px`,background:`var(--ground-2)`},".cm-tooltip-autocomplete > ul > li:has(.cm-picture-thumb)":{padding:`3px 10px !important`},".cm-picture-preview":{padding:`8px`},".cm-picture-preview img":{display:`block`,maxWidth:`240px`,maxHeight:`240px`},".cm-picture-size":{fontFamily:`var(--font-ui)`,fontSize:`12px`,color:`var(--text-faint)`,marginTop:`4px`},".cm-completionInfo":{background:`var(--ground-1)`,border:`1px solid var(--line-strong)`,padding:`0`},".cm-tooltip-autocomplete > ul > li[aria-selected]":{background:`var(--lattice-soft)`,color:`var(--text)`},".cm-completionDetail":{color:`var(--text-faint)`,fontStyle:`normal`,marginLeft:`10px`}}),Ns=Tt.define([{tag:Y.heading,fontWeight:`700`,color:`var(--text)`},{tag:Y.strong,fontWeight:`700`},{tag:Y.emphasis,fontStyle:`italic`},{tag:Y.strikethrough,textDecoration:`line-through`},{tag:[Y.link,Y.url],color:`var(--lattice)`},{tag:[Y.processingInstruction,Y.punctuation,Y.contentSeparator],color:`var(--text-faint)`},{tag:Y.monospace,color:`var(--text-soft)`},{tag:Y.quote,color:`var(--text-soft)`,fontStyle:`italic`}]);function Ps(e){let t=e.selection.main;return{line:e.doc.lineAt(t.to).number-1,from:t.from,to:t.to}}function Fs(e){let t=e=>[...e??[]].filter(e=>e.type.startsWith(`image/`));return q.domEventHandlers({paste(n,r){let i=t(n.clipboardData?.files);return i.length?(n.preventDefault(),e(i,r.state.selection.main.head,!0),!0):!1},drop(n,r){let i=t(n.dataTransfer?.files);return i.length?(n.preventDefault(),e(i,r.posAtCoords({x:n.clientX,y:n.clientY})??r.state.selection.main.head,!1),!0):!1}})}function Is(e,t){let n=ht.create({doc:t.doc,extensions:[Ir(),dt(),q.lineWrapping,ze({base:We,extensions:[Xo],completeHTMLTags:!1,codeLanguages:Xe}),it(Ns),it(Le),Ms,...t.source?[js]:[ms,hs,Qa,$a,Ao,...t.embeds?[Ha.of(t.embeds)]:[],...t.codeBroken?[ps.of(t.codeBroken)]:[],...t.pictures?[ds.of(t.pictures)]:[],...t.artifacts?[fs.of(t.artifacts)]:[]],Ft(),ht.languageData.of(()=>[{closeBrackets:{brackets:[`(`,`[`]}}]),...t.mountOverlay?[Cs(t.mountOverlay)]:[],bs,As(t.onPoint),...t.readOnly?[ht.readOnly.of(!0),q.editable.of(!1)]:[],Ro(t.notes,t.pictureSource??null),...t.onPictures&&!t.readOnly?[Fs(t.onPictures)]:[],ot(t.placeholder??`Write the note here. # for a heading, [[ to link to another note, [[! to show a picture, $x$ for maths.`),q.contentAttributes.of({"aria-label":t.label,spellcheck:`true`,autocapitalize:`sentences`,autocorrect:`on`}),rt.of([{key:`Mod-s`,preventDefault:!0,run:()=>(t.onSave(),!0)},{key:`Mod-Enter`,preventDefault:!0,run:e=>(t.onAsk?.(Ps(e.state)),!!t.onAsk)},...oo,...jt,...Pt,Va,...Ba,...ei]),q.domEventHandlers({mousedown(e,n){if(!t.onFollow||!(e.ctrlKey||e.metaKey)||e.button!==0)return!1;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=r===null?null:lo(n.state,r),a=i?i.embed?_s(i.url):gs(i.url)??_s(i.url):null;return a!==null&&(e.preventDefault(),t.onFollow(a),!0)}}),q.updateListener.of(e=>{e.docChanged&&t.onChange(e.state.doc.toString()),t.onCursor&&(e.selectionSet||e.docChanged)&&t.onCursor(Ps(e.state))})]});return new q({state:n,parent:e})}function Ls(e,t){if(t===e.state.doc.toString())return;let n=Math.min(e.state.selection.main.head,t.length);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t},selection:{anchor:n}})}var Rs=2e7,zs={type:`string`};({...zs}),{...zs},{...zs},{...zs},{...zs};var Bs=`conversations`,Vs={type:`string`},Hs=(e,t,n,r)=>({type:`function`,function:{name:e,description:t,parameters:{type:`object`,properties:n,required:r,additionalProperties:!1}}});({...Vs}),{...Vs};var Us=Hs(`read_data`,`A data file's shape: its columns with their types and ranges, the row count and the first rows. Read it before writing anything that uses the file, so the column names are real.`,{path:{...Vs,description:`The file's path in the base: folder/name.csv.`}},[`path`]),Ws=Hs(`artifact_recipe`,`A recipe for an artifact: a complete working one to start from, the kit's reference, and the rules write_artifact checks. dashboard: numbers, charts and a table of one data file. compare: two data files side by side. simulation: a model with parameters and play. explorable: inputs, derived numbers and linked views. viewer: a 3D model.`,{name:{type:`string`,enum:[`dashboard`,`compare`,`simulation`,`explorable`,`viewer`]}},[`name`]),Gs=Hs(`write_artifact`,`Write an artifact: a whole HTML file on the kit. The title, description and uses given here are written into it. It is checked, and run where it can be; the result says what to fix. Nothing is written while a rule is broken.`,{path:{...Vs,description:`Where: folder/name.html, beside the notes it belongs to.`},title:Vs,description:{...Vs,description:`One sentence: what it shows, and what can be done with it.`},uses:{type:`array`,items:Vs,description:`The data or model files it reads, relative to it (runs.csv). Those its markup and script name are added.`},html:{...Vs,description:`The whole file.`}},[`path`,`title`,`description`,`uses`,`html`]),Ks=Hs(`read_artifact`,`An artifact's whole file, to change it and write it again.`,{path:{...Vs,description:`folder/name.html`}},[`path`]);({...Vs}),{...Vs},`${Bs}`,new Set([Us,Ws,Ks,Gs].map(e=>e.function.name));var qs=`The change is written at once, under your name: the person sees your words marked in the note, and can undo it from the browser. Use this, never edit or write, for any note of the knowledge base.`;`${qs}`,`${qs}`;var Js=u(`<p class="same svelte-18j5w6l">This picture is already in the notes as <code> </code>.</p>`),Ys=u(`<code> </code> is taken: Enter makes it <code> </code>`,1),Xs=u(`<code> </code>`),Zs=u(`<label class="svelte-18j5w6l"><span class="svelte-18j5w6l">name</span> <span class="name svelte-18j5w6l"><input class="field mono svelte-18j5w6l" spellcheck="false" autocomplete="off" aria-label="Its name"/><span class="ext svelte-18j5w6l"> </span></span></label> <p><!></p>`,1),Qs=u(`<button class="btn" type="button"> </button>`),$s=u(`<div class="picture-name svelte-18j5w6l" role="dialog" aria-label="Name the picture" tabindex="-1"><img alt="" class="svelte-18j5w6l"/> <div class="fields svelte-18j5w6l"><!> <label class="svelte-18j5w6l"><span class="svelte-18j5w6l">what it shows</span> <input class="field" placeholder="Iso reads this, not the picture" aria-label="What it shows" autocomplete="off"/></label> <div class="actions svelte-18j5w6l"><!> <button class="btn" type="button">Cancel</button> <button class="btn primary" type="button"> </button></div></div></div>`);function ec(n,r){N(r,!0);let i=k(()=>({"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/webp":`webp`,"image/svg+xml":`svg`,"image/avif":`avif`})[r.file.type]??`png`),o=z(ne(r.suggested)),c=z(``),u=z(!1),p=z(void 0),m,g=k(()=>Pe(h(o))||`picture`),_=k(()=>`${r.folder?r.folder+`/`:``}${h(g)}.${h(i)}`),b=k(()=>r.taken(h(_))),x=k(()=>{for(let e=2;;e++)if(!r.taken(`${r.folder?r.folder+`/`:``}${h(g)}-${e}.${h(i)}`))return`${h(g)}-${e}`}),D=k(()=>r.same!==null&&!h(u));F(()=>{h(p)?(h(p).focus(),h(p).select()):m.focus()});function O(e){e.key===`Escape`?(e.preventDefault(),r.onDone(null)):e.key===`Enter`&&(e.preventDefault(),A())}function A(){if(!h(D)&&h(b)){I(o,h(x),!0);return}let e=h(D)?r.same:h(_);r.onDone({path:e,alt:h(c).trim()||Mo(e),save:!h(D)})}var j=$s();let P;var ee=v(j),te=w(ee,2),R=v(te),H=n=>{var i=Js(),o=w(v(i)),c=e(o,!0);E(),L(i),a(()=>t(c,r.same)),s(n,i)},re=n=>{var r=Zs(),c=d(r),u=w(v(c),2),f=v(u);C(f),M(f,e=>I(p,e),()=>h(p));var m=w(f),g=e(m);L(u),L(c);var y=w(c,2);let S;var T=v(y),E=n=>{var r=Ys(),o=d(r),c=e(o,!0),l=w(o,2),u=e(l);a(()=>{t(c,h(_)),t(u,`${h(x)??``}.${h(i)??``}`)}),s(n,r)},D=n=>{var r=Xs(),i=e(r,!0);a(()=>t(i,h(_))),s(n,r)};l(T,e=>{h(b)?e(E):e(D,-1)}),L(y),a(()=>{t(g,`.${h(i)??``}`),S=V(y,1,`path svelte-18j5w6l`,null,S,{taken:h(b)})}),B(f,()=>h(o),e=>I(o,e)),s(n,r)};l(R,e=>{h(D)?e(H):e(re,-1)});var ie=w(R,2),ae=w(v(ie),2);C(ae),M(ae,e=>m=e,()=>m),L(ie);var oe=w(ie,2),U=v(oe),se=n=>{var r=Qs(),i=e(r,!0);a(()=>t(i,h(u)?`Use the one there`:`Save a copy`)),f(`click`,r,()=>{I(u,!h(u)),h(u)&&requestAnimationFrame(()=>{h(p)?.focus(),h(p)?.select()})}),s(n,r)};l(U,e=>{r.same!==null&&e(se)});var W=w(U,2),ce=w(W,2),le=e(ce,!0);L(oe),L(te),L(j),a(()=>{P=y(j,``,P,{left:`${r.at.left??``}px`,top:`${r.at.top??``}px`}),T(ee,`src`,r.src),t(le,h(D)?`Show it`:`Save`)}),f(`keydown`,j,O),B(ae,()=>h(c),e=>I(c,e)),f(`click`,W,()=>r.onDone(null)),f(`click`,ce,A),s(n,j),S()}o([`keydown`,`click`]);var tc=u(`<div class="between stopped svelte-192cp36" role="alert"><p class="bad svelte-192cp36"> </p> <div class="foot svelte-192cp36"><span class="grow"></span><button class="link svelte-192cp36" type="button">dismiss</button></div></div>`),nc=u(`<p class="soft lost svelte-192cp36"><span class="strike svelte-192cp36"> </span> </p>`),rc=u(`<div class="between stopped svelte-192cp36"><p class="label"> </p> <!> <div class="foot svelte-192cp36"><span class="grow"></span><button class="btn remove" type="button">remove</button></div></div>`),ic=u(`<p class="label">The place this was written for is no longer in the note, so it is shown here. Keeping it adds it at the end.</p>`),ac=u(`<textarea class="revision svelte-192cp36" aria-label="Iso's text, to edit"></textarea>`),oc=u(`<div class="prose said svelte-192cp36"></div>`),sc=u(`<p class="label"> </p>`),cc=u(`<button class="btn edit" type="button">done</button>`),lc=u(`<button class="btn edit" type="button">edit</button>`),uc=u(`<div class="between svelte-192cp36"><!> <!> <!> <div class="foot svelte-192cp36"><i class="dia svelte-192cp36" aria-hidden="true"></i> <span class="grow"></span> <button class="btn keep" type="button">keep</button> <!> <button class="btn remove" type="button">remove</button></div></div>`);function dc(n,r){N(r,!0);let i=O(r,`iso`,7),o=k(()=>r.key.startsWith(`p:`)?i().proposals.find(e=>e.id===r.key.slice(2)):void 0),u=k(()=>h(o)&&i().editing?.id===h(o).id?i().editing:null),m=k(()=>!!h(o)&&i().busy===h(o)?.id),g=k(()=>i().changes.filter(e=>!e.at));var _=c(),y=d(_),b=n=>{var r=tc(),o=v(r),c=e(o,!0),l=w(o,2),u=w(v(l));L(l),L(r),a(()=>t(c,i().failed.message)),f(`click`,u,()=>i().failed=null),s(n,r)},C=n=>{var r=rc(),o=v(r),c=e(o),l=w(o,2);p(l,17,()=>h(g),e=>e.key,(n,r)=>{var i=nc(),o=v(i),c=e(o,!0),l=w(o);L(i),a((e,n)=>{t(c,e),t(l,` → ${n??``}`)},[()=>h(r).proposal.regions[h(r).k].old.text.trim(),()=>h(r).proposal.regions[h(r).k].new.trim()||`(taken out)`]),s(n,i)});var u=w(l,2),d=w(v(u));L(u),L(r),a(()=>t(c,`${h(g).length===1?`One change Iso offered is`:`${h(g).length} changes Iso offered are`} for text that is no longer in the note as it was, so ${h(g).length===1?`it`:`they`} cannot be kept.`)),f(`click`,d,()=>{for(let e of h(g))i().discardChange(e)}),s(n,r)},E=n=>{var r=uc(),c=v(r),d=e=>{var t=ic();s(e,t)},p=k(()=>!i().placed(h(o)));l(c,e=>{h(p)&&e(d)});var g=w(c,2),_=e=>{var t=ac();ee(t),a(e=>T(t,`rows`,e),[()=>Math.max(3,h(u).text.split(`
|
|
13
|
+
`).length+1)]),B(t,()=>h(u).text,e=>h(u).text=e),s(e,t)},y=e=>{var t=oc();H(t,()=>Ue(h(o).text),!0),L(t),x(t,(e,t)=>Ze?.(e,t),()=>({given:h(o).text,copy:!0})),s(e,t)};l(g,e=>{h(u)?e(_):e(y,-1)});var b=w(g,2),S=n=>{var r=sc(),i=e(r,!0);a(()=>t(i,h(o).notice)),s(n,r)};l(b,e=>{h(o).notice&&e(S)});var C=w(b,2),E=w(v(C),4),D=w(E,2),O=e=>{var t=cc();f(`click`,t,()=>i().done(h(o))),s(e,t)},A=e=>{var t=lc();a(()=>t.disabled=h(m)),f(`click`,t,()=>i().edit(h(o))),s(e,t)};l(D,e=>{h(u)?e(O):e(A,-1)});var j=w(D,2);L(C),L(r),a(()=>{T(r,`data-proposal`,h(o).id),E.disabled=h(m),j.disabled=h(m)}),f(`click`,E,()=>i().keep(h(o))),f(`click`,j,()=>i().discard(h(o))),s(n,r)};l(y,e=>{r.key===`failed`&&i().failed?e(b):r.key===`lost`&&h(g).length?e(C,1):h(o)&&e(E,2)}),s(n,_),S()}o([`click`]);var fc=u(`<span class="label who svelte-1o10yjh"> </span>`),pc=u(`<!> <span class="act svelte-1o10yjh"><button class="keep svelte-1o10yjh" type="button" aria-label="Keep this change">keep</button><button class="remove svelte-1o10yjh" type="button" aria-label="Remove this change">remove</button></span>`,1),mc=u(`<span class="gone svelte-1o10yjh">the passage above is taken out</span>`),hc=u(`<pre class="new svelte-1o10yjh"> </pre>`),gc=u(`<div class="new prose svelte-1o10yjh"></div>`),_c=u(`<div><!> <div class="foot svelte-1o10yjh"><i class="dia svelte-1o10yjh" aria-hidden="true"></i><span class="label">in place of the lines struck through above</span><span class="grow"></span><!></div></div>`),vc=u(`<span class="new svelte-1o10yjh"></span>`),yc=u(`<span class="gone svelte-1o10yjh">taken out</span>`),bc=u(`<span class="change svelte-1o10yjh"><!> <!></span>`);function xc(n,r){N(r,!0);let i=n=>{var i=pc(),c=d(i),u=n=>{var r=fc(),i=e(r,!0);a(()=>{T(r,`title`,h(o)?.proposal.asked),t(i,h(_))}),s(n,r)};l(c,e=>{h(_)&&e(u)});var m=w(c,2),g=v(m),y=w(g);L(m),a(()=>{g.disabled=h(p),y.disabled=h(p)}),f(`click`,g,()=>h(o)&&r.iso.keepChange(h(o))),f(`click`,y,()=>h(o)&&r.iso.discardChange(h(o))),s(n,i)},o=k(()=>r.iso.changes.find(e=>e.key===r.key)),u=k(()=>h(o)?h(o).proposal.regions[h(o).k].new:``),p=k(()=>r.iso.busy===r.key||r.iso.busy===`all`),m=k(()=>Ue(h(u).trim())),g=k(()=>h(m).replace(/^<p>([\s\S]*)<\/p>\s*$/,`$1`)),_=k(()=>h(o)?Ne(h(o).proposal.who):``);var y=c(),b=d(y),C=n=>{var c=_c();let d;var f=v(c),p=e=>{var t=mc();s(e,t)},g=k(()=>!h(u).trim()),_=n=>{var r=hc(),i=e(r,!0);a(e=>t(i,e),[()=>h(u).replace(/^\n+|\s+$/g,``)]),s(n,r)},y=e=>{var t=gc();H(t,()=>h(m),!0),L(t),x(t,(e,t)=>Ze?.(e,t),()=>h(m)),s(e,t)};l(f,e=>{h(g)?e(p):h(o).code?e(_,1):e(y,-1)});var b=w(f,2),S=w(v(b),3);i(S),L(b),L(c),a(()=>{d=V(c,1,`change block svelte-1o10yjh`,null,d,{code:h(o).code}),T(c,`data-change`,r.key)}),s(n,c)},E=e=>{var t=bc(),n=v(t),o=e=>{var t=vc();H(t,()=>h(g),!0),L(t),s(e,t)},c=k(()=>h(u).trim()),d=e=>{var t=yc();s(e,t)};l(n,e=>{h(c)?e(o):e(d,-1)});var f=w(n,2);i(f),L(t),a(()=>T(t,`data-change`,r.key)),s(e,t)};l(b,e=>{h(o)?.block?e(C):h(o)&&e(E,1)}),s(n,y),S()}o([`click`]);var Sc=u(`<p class="said svelte-hrl8lz" role="status"> </p>`),Cc=u(`<div></div> <!> <!>`,1);function wc(n,r){N(r,!0);let i=O(r,`iso`,7),o=O(r,`reading`,3,!1),c=O(r,`touched`,3,null),u=O(r,`lens`,19,()=>[]),f,p=z(void 0),m=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`image/avif`],_=z(null),v=z(null),y,x=e=>{I(v,e,!0),clearTimeout(y),y=setTimeout(()=>I(v,null),8e3)};async function C(e,t,n){if(!h(p)||h(_))return;let i=r.note.id,a=!i.startsWith(`@`),o=a?i:`pictures`,s=e=>a&&e.startsWith(`${i}/`)?No(e.slice(i.lastIndexOf(`/`)+1)):`/${No(e)}`,c=[];try{c=await G.api.pictures()}catch{}let l=new Set(c.map(e=>e.path));for(let r of e){if(!m.includes(r.type)){x(`${r.name||`That`} isn't a picture isorite keeps: png, jpg, gif, webp, svg and avif are.`);continue}if(r.size>2e7){x(`${r.name||`That picture`} is larger than isorite takes (${Rs/1e6} MB).`);continue}let e=new Uint8Array(await r.arrayBuffer()),i=await Qe(e),a=c.find(e=>e.sha256===i)?.path??null,u=URL.createObjectURL(r),d=h(p),g=d.coordsAtPos(Math.min(t,d.state.doc.length)),v=f.getBoundingClientRect(),y=await new Promise(e=>{I(_,{file:r,src:u,folder:o,same:a,onDone:e,suggested:n||!r.name?tt():Pe(r.name)||`picture`,taken:e=>l.has(e),at:{left:Math.max(16,Math.min(g?.left??v.left,innerWidth-476)),top:Math.min((g?.bottom??v.top)+6,innerHeight-220)}})});if(I(_,null),URL.revokeObjectURL(u),!y)continue;if(y.save)try{let t=await G.api.savePicture(y.path,e);c.push(t),l.add(t.path)}catch(e){x(`It wasn't saved: ${e.message}`);continue}let b=`![${y.alt.replace(/[[\]]/g,``)}](${s(y.path)})`;d.dispatch({changes:{from:t,insert:b},selection:{anchor:t+b.length}}),t+=b.length}h(p).focus()}let T=k(()=>r.source||!i()?{lines:0,chars:0}:i().head),E=k(()=>{if(!i())return{blocks:[],marks:[],inline:[]};let e=e=>t=>({kind:e,from:t.from-h(T).chars,to:t.to-h(T).chars});return{blocks:i().layout.blocks.map(e=>({key:e.key,line:Math.max(0,e.line-h(T).lines)})).sort((e,t)=>e.line-t.line),marks:[...i().layout.old.map(e(`old`)),...u().map(t=>e(t.kind)(t))].filter(e=>e.to>0),inline:i().layout.inline.map(e=>({key:e.key,at:e.at-h(T).chars})).filter(e=>e.at>=0)}});F(()=>{let e=Is(f,{doc:r.source?r.note.text:r.note.body,source:r.source,readOnly:o(),label:r.source?`The note's file`:`The note`,notes:()=>G.listing.notes.filter(e=>e.id!==r.note.id).map(e=>({id:e.id,title:e.title,folder:e.dir,...e.kind?{kind:e.kind}:{}})),onPictures:(e,t,n)=>{C(e,t,n)},pictureSource:{pictures:async()=>(await G.api.pictures()).map(e=>({path:e.path,width:e.width,height:e.height,src:et(G.api,{path:e.path,from:`notes`})})),here:()=>r.note.id},onChange:e=>r.source?r.note.setText(e):r.note.setBody(e),onSave:()=>{r.note.save()},onFollow:e=>{oe(Ee(e))},embeds:{find:Te,open:e=>{oe(Ee(e))}},onPoint:e=>He.set(`note`,e?{...e,who:`you`}:null),codeBroken:e=>G.listing.notes.find(e=>e.id===r.note.id)?.broken?.includes(e)??!1,pictures:e=>{let t=Re(e,r.note.id);return t?{key:`${t.from}:${t.path}`,src:et(G.api,t)}:null},artifacts:e=>{let t=e.trim().startsWith(`code:`)?de(e.trim()):null;if(t&&W(t.path)!==`image`)return{path:e,mount:t=>{let n=j(gr,{target:t,props:{href:e.trim()}});return()=>{A(n)}}};let n=dn(e,r.note.id);return n?{path:n,mount:e=>{let t=j(yr,{target:e,props:{path:n}});return()=>{A(t)}}}:null},...i()?{onAsk:e=>{let t=r.note.text.slice(e.from+h(T).chars,e.to+h(T).chars).trim();t&&Ie.add({kind:`passage`,id:r.note.id,title:r.note.fields.title||r.note.id,text:t}),be.to(`iso`),requestAnimationFrame(()=>document.getElementById(`iso-box`)?.focus())},onCursor:e=>{i().cursor={line:e.line+h(T).lines,from:e.from+h(T).chars,to:e.to+h(T).chars}},mountOverlay:(e,t)=>{let n=j(t.startsWith(`r:`)?xc:dc,{target:e,props:{iso:i(),key:t}});return()=>{A(n)}}}:{placeholder:g(()=>r.placeholder)??`Write what you understand, what you do not, and what you want from Iso. [[ links a note it should rest on.`}});return I(p,e),()=>{e.destroy(),He.set(`note`,null)}}),R(()=>{r.note.revision,g(()=>{h(p)&&Ls(h(p),r.source?r.note.text:r.note.body)})}),R(()=>{let e=c(),t=h(T).lines;h(p)&&h(p).dispatch({effects:ys.of(e?{who:e.who,lines:e.lines.map(e=>e-t)}:null)})}),R(()=>{let e=He.onAtlas;h(p)&&h(p).dispatch({effects:Ts.of(e)})}),R(()=>{let{blocks:e,marks:t,inline:n}=h(E);h(p)&&h(p).dispatch({effects:[vs.of(e),xs.of({marks:t,inline:n})]})});var D=Cc(),P=d(D);let ee;M(P,e=>f=e,()=>f);var te=w(P,2),L=e=>{ec(e,b(()=>h(_)))};l(te,e=>{h(_)&&e(L)});var ne=w(te,2),B=n=>{var r=Sc(),i=e(r,!0);a(()=>t(i,h(v))),s(n,r)};l(ne,e=>{h(v)&&e(B)}),a(()=>ee=V(P,1,`editor svelte-hrl8lz`,null,ee,{source:r.source})),s(n,D),S()}var Tc=u(`<h1 class="serif title svelte-130pv1o"> </h1>`),Ec=u(`<p class="asked svelte-130pv1o"><i class="dia svelte-130pv1o" aria-hidden="true"></i><span> </span></p>`),Dc=u(`<div class="offered svelte-130pv1o" aria-label="What Iso offered"><p class="serif svelte-130pv1o"> </p></div>`),Oc=u(`<div class="version svelte-130pv1o"><!> <!> <div class="text svelte-130pv1o"></div> <!></div>`);function kc(n,r){N(r,!0);let i=k(()=>{try{let[e,t,n]=pe(r.text);return{title:/^title:\s*(.*)$/m.exec(t??``)?.[1]?.trim().replace(/^["']|["']$/g,``)??``,body:n,lines:e.split(`
|
|
14
|
+
`).length-1}}catch{return{title:``,body:r.text,lines:0}}}),o,c=z(void 0);F(()=>(I(c,Is(o,{doc:h(i).body,onChange:()=>void 0,onSave:()=>void 0,label:`The note as it was`,notes:()=>[],readOnly:!0,pictures:e=>{let t=Re(e,r.id);return t?{key:`${t.from}:${t.path}`,src:et(G.api,t)}:null}})),()=>h(c)?.destroy())),R(()=>{let e=r.touched,t=h(i).lines;h(c)?.dispatch({effects:ys.of(e?{who:e.who,lines:e.lines.map(e=>e-t)}:null)})});var u=Oc(),d=v(u),f=n=>{var r=Tc(),o=e(r,!0);a(()=>t(o,h(i).title)),s(n,r)};l(d,e=>{h(i).title&&h(i).title!==r.title&&e(f)});var p=w(d,2),m=n=>{var i=Ec(),o=w(v(i)),c=e(o,!0);L(i),a(()=>t(c,r.asked)),s(n,i)};l(p,e=>{r.asked!==void 0&&e(m)});var g=w(p,2);M(g,e=>o=e,()=>o);var _=w(g,2),y=n=>{var i=Dc(),o=v(i),c=e(o,!0);L(i),a(()=>t(c,r.offered)),s(n,i)};l(_,e=>{r.offered!==void 0&&e(y)}),L(u),s(n,u),S()}var Ac=(e,t=P,n=P)=>{var r=Nc();let i;var o=v(r),c=e=>{var t=jc();a(()=>T(t,`fill`,n()?`currentColor`:`none`)),s(e,t)},u=e=>{var t=Mc();a(()=>T(t,`fill`,n()?`currentColor`:`none`)),s(e,t)};l(o,e=>{t()===`question`?e(c):e(u,-1)}),L(r),a(()=>i=V(r,0,`glyph ${t()??``}`,`svelte-18ltlst`,i,{solved:n()})),s(e,r)},jc=i(`<path d="M8 2.5L13.5 8L8 13.5L2.5 8Z"></path>`),Mc=i(`<path d="M8 2.5l5.8 10.5H2.2z"></path>`),Nc=i(`<svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.4"><!></svg>`),Pc=u(`<p class="faint"><!></p>`),Fc=u(`<p class="soft">There is no note at <span class="faint"> </span>.</p> <p><a>all notes</a></p>`,1),Ic=u(`<p class="bad svelte-18ltlst"> </p>`),Lc=u(`<button class="btn" type="button">take theirs</button>`),Rc=u(`<div class="frame choice svelte-18ltlst" role="alert"><span class="frame-title">changed elsewhere</span> <p> </p> <div class="row svelte-18ltlst"><button class="btn primary" type="button">keep mine</button> <!></div> <p class="faint">Whichever you keep, the other stays in the note's journal.</p></div>`),zc=u(`<div class="titlerow svelte-18ltlst"><!> <h1 class="serif title read svelte-18ltlst"> </h1></div>`),Bc=u(`<div class="titlerow svelte-18ltlst"><!> <label class="hidden-label" for="title">Title</label> <textarea id="title" class="serif title svelte-18ltlst" rows="1" autocomplete="off"></textarea></div>`),Vc=u(`<span class="grow faint"> </span>`),Hc=u(`<div class="tl-col svelte-18ltlst"><!></div>`),Uc=u(`<span class="bad svelte-18ltlst" role="alert"> </span>`),Wc=u(`<div class="atbar svelte-18ltlst" role="status"><span class="label"> </span> <span class="grow"></span> <!> <button class="icon svelte-18ltlst" type="button" aria-label="restore to here" title="restore to here"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M3.2 9.5A5 5 0 1 0 4.6 4.3" stroke="currentColor" stroke-width="1.3" fill="none"></path><path d="M3 1.8v3.4h3.4" stroke="currentColor" stroke-width="1.3" fill="none"></path></svg></button> <button class="icon svelte-18ltlst" type="button" aria-label="back to now" title="back to now"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2 8h9M8 4.8 11.2 8 8 11.2" stroke="currentColor" stroke-width="1.3" fill="none"></path><path d="M13.5 3v10" stroke="currentColor" stroke-width="1.3"></path></svg></button></div> <!>`,1),Gc=u(`<span class="toiso svelte-18ltlst" role="group" aria-label="The selected passage"><button type="button" title="Put it above Iso's box, to go with your next message from the pane" class="svelte-18ltlst"><i class="dia svelte-18ltlst" aria-hidden="true">◆</i>add to Iso's message</button> <button type="button" title="Copy it with the note it is from, to paste into an agent in your terminal" class="svelte-18ltlst"> </button></span>`),Kc=i(`<svg class="ok svelte-18ltlst" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8.5l3 3 7-7"></path></svg>`),qc=u(`<li><a><!><span class="svelte-18ltlst"> </span><!></a></li>`),Jc=u(`<ul class="attached svelte-18ltlst"></ul>`),Yc=u(`<div class="changes svelte-18ltlst" role="status"><i class="dia svelte-18ltlst" aria-hidden="true"></i> <span class="soft"> </span> <span class="grow"></span> <button class="link svelte-18ltlst" type="button">keep all</button> <button class="link svelte-18ltlst" type="button">remove all</button></div>`),Xc=u(`<!> <div class="head svelte-18ltlst"><!> <div class="side svelte-18ltlst"><div class="tools svelte-18ltlst"><button class="btn quiet svelte-18ltlst" type="button" title="The note as it is read, to be read and not edited">read</button> <button class="btn quiet svelte-18ltlst" type="button">source</button></div></div></div> <!> <!> <!> <!> <div class="live"><!></div> <!> <!>`,1),Zc=u(`<article><!></article>`);function Qc(r,i){N(i,!0);let o=new Gn(i.id),c=new Bn(o),u=z(!1),g=k(()=>h(u)||o.meta===null),b=z(!1),x=k(()=>h(b)&&!h(g)),C=k(()=>be.on.timeline),D=z(null),O=z(null),A=z(!1),j=z(``),P=k(()=>me(c.entries)),B=e=>e.who.startsWith(`iso:`)||e.who.startsWith(`agent:`),H=e=>e.flatMap(e=>Array.from({length:e.to-e.from},(t,n)=>e.from+n)),ie=k(()=>{if(!h(C)||h(O)||h(g))return null;let e=h(D)??(h(ce)?void 0:h(P).findLast(e=>B(e)&&(e.what===`kept`||e.what===`edited`)));if(!e)return null;let t=H(he(c.entries,e.ids).runs);return t.length?{who:B(e)?`iso`:`you`,lines:t}:null}),U=k(()=>{if(!h(O))return null;let e=je(h(O)),t=Ae(c.entries,e);if(t===null)return null;let n=c.entries.filter(t=>t.id<=e),r=c.entries.find(e=>e.id===h(O).ids[0]),i=(h(O).what===`offered`||h(O).what===`discarded`)&&r?.kind===`proposal`?r.form===`insert`?r.text:r.regions.map(e=>e.new).join(`
|
|
15
|
+
|
|
16
|
+
`):void 0;return{text:t,touched:{who:B(h(O))?`iso`:`you`,lines:H(he(n,h(O).ids).runs)},asked:h(O).asked,offered:i}}),se=()=>nt.url.searchParams.get(`at`)??new URLSearchParams(location.hash.split(`?`)[1]??``).get(`at`),W=z(ne(se()));R(()=>{let e=se();e&&I(W,e,!0)}),R(()=>{if(!h(W))return;let e=h(P).find(e=>e.ids.includes(h(W)));e&&(I(W,null),be.flip(`timeline`,!0),I(O,e))});let ce=k(()=>be.on.provenance);R(()=>{h(C)||(I(O,null),I(D,null))});let ue=k(()=>{if(!h(ce)||o.loaded!==`ready`)return[];let e=[],t=ke(c.entries),n=o.text.split(`
|
|
17
|
+
`);if(t&&t.length===n.length){let r=0;for(let[i,a]of n.entries()){for(let n of t[i])(n.who.startsWith(`iso:`)||n.who.startsWith(`agent:`))&&n.to<=a.length&&a.slice(n.from,n.to).trim()&&e.push({kind:`by-iso`,from:r+n.from,to:r+n.to});r+=a.length+1}}for(let t of Ie.parts){if(t.kind!==`passage`||t.id!==i.id)continue;let n=o.text.indexOf(t.text);n>=0&&e.push({kind:`given`,from:n,to:n+t.text.length})}return e});function de(e){I(j,``),I(O,h(O)===e?null:e)}function fe(e){if(!h(O))return;let t=h(P).indexOf(h(O))+e;t>=0&&t<h(P).length&&I(O,h(P)[t])}async function pe(){if(h(O)){I(A,!0),I(j,``);try{await o.restore(je(h(O))),I(O,null)}catch(e){I(j,e.message,!0)}finally{I(A,!1)}}}function _e(e){!h(O)||e.altKey||e.ctrlKey||e.metaKey||e.target instanceof HTMLElement&&(e.target.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName))||(e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),fe(-1)):e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),fe(1)):e.key===`Escape`&&(e.preventDefault(),I(O,null)))}F(()=>{G.open=i.id,o.open().then(()=>c.open());let e=()=>{o.save()};return addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,e),()=>{removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,e),c.close(),o.close(),G.here=``,G.open=``,G.saving=null}});async function ve(){let e=i.id.split(`/`).at(-1),t=o.fields.title.trim();if(!/^untitled-(note|question|problem)(-\d+)?$/.test(e)||!t||/^untitled (note|question|problem)( \d+)?$/i.test(t))return;let n=[...i.id.split(`/`).slice(0,-1),ge(t)].filter(Boolean).join(`/`);if(ge(t)&&!G.listing.notes.some(e=>e.id===n))try{let e=await o.move(n);await G.refresh(),await oe(Ee(e),{replaceState:!0})}catch{}}R(()=>{o.loaded===`ready`&&be.fresh===i.id&&(be.fresh=``,m().then(()=>{let e=document.getElementById(`title`);e?.focus(),e?.select()}))});let ye={saved:`saved`,unsaved:`not saved yet`,saving:`saving`,conflict:`changed elsewhere: choose below`,failed:`not saved`};R(()=>{G.here=o.loaded===`ready`?o.fields.title||i.id.split(`/`).at(-1):``,G.saving=o.loaded===`ready`?{text:o.saving===`failed`?`not saved: ${o.message}`:ye[o.saving],bad:o.saving===`failed`||o.saving===`conflict`}:null});let xe=k(()=>[...new Set(c.changes.map(e=>Ne(e.proposal.who)||`Iso`))].join(` and `)),Ce=k(()=>le(String(o.meta?.type??``))),we=k(()=>h(Ce)===`note`?null:Se(o.meta??{},h(Ce))),Te=k(()=>G.listing.notes.filter(e=>e.kind&&e.id!==i.id&&e.attached?.includes(i.id)).sort((e,t)=>e.kind===t.kind?0:e.kind===`question`?-1:1)),De=z(!1);async function Oe(){I(De,!0);try{await o.setDone(!h(we))}catch{}finally{I(De,!1)}}let Pe=k(()=>c.cursor&&c.cursor.to>c.cursor.from?o.text.slice(c.cursor.from,c.cursor.to).trim():``),Le=z(void 0),Re=z(null);R(()=>{if(c.cursor,!h(Pe)||!h(Le)||h(g)||h(O)){I(Re,null);return}let e=requestAnimationFrame(()=>{let e=getSelection(),t=h(Le).getBoundingClientRect(),n=e?.rangeCount?e.getRangeAt(0).getBoundingClientRect():null;!n||!n.width&&!n.height?I(Re,{top:8,left:t.width-140},!0):I(Re,{top:be.narrow?n.bottom-t.top+30:n.top-t.top-36,left:Math.max(8,Math.min(n.left-t.left,t.width-140))},!0)});return()=>cancelAnimationFrame(e)});let ze=z(!1);function Be(){if(!h(Pe))return;let e=h(Pe).split(`
|
|
18
|
+
`).map(e=>`> ${e}`).join(`
|
|
19
|
+
`);navigator.clipboard?.writeText(`From /${i.id}.md in the notes:\n\n${e}\n`).then(()=>{I(ze,!0),setTimeout(()=>{I(ze,!1),I(Re,null)},900)},()=>void 0)}function He(){h(Pe)&&(Ie.add({kind:`passage`,id:i.id,title:o.fields.title||i.id,text:h(Pe)}),I(Re,null))}var Ue=Zc();re(`keydown`,_,_e);let We;var Ge=v(Ue),Ke=e=>{var t=Pc();zn(v(t),{label:`opening`}),L(t),s(e,t)},qe=n=>{var r=Fc(),o=d(r),c=w(v(o)),l=e(c,!0);E(),L(o);var u=w(o,2),f=e(u);a(e=>{t(l,i.id),T(f,`href`,e)},[()=>ae(`/notes`)]),s(n,r)},Je=n=>{var r=Ic(),i=e(r,!0);a(()=>t(i,o.message)),s(n,r)},Ye=r=>{var m=Xc(),_=d(m),S=n=>{var r=Rc(),i=w(v(r),2),c=e(i,!0),u=w(i,2),d=v(u),p=w(d,2),m=e=>{var t=Lc();f(`click`,t,()=>o.keepTheirs()),s(e,t)};l(p,e=>{o.theirs&&e(m)}),L(u),E(2),L(r),a(()=>t(c,o.theirs===null?`This note was deleted or moved while you were writing.`:`This note was changed somewhere else while you were writing. Nothing here has been saved over it.`)),f(`click`,d,()=>o.keepMine()),s(n,r)};l(_,e=>{o.saving===`conflict`&&e(S)});var M=w(_,2),N=v(M),F=n=>{var r=zc(),c=v(r),u=e=>{Ac(e,()=>h(Ce),()=>!!h(we))};l(c,e=>{h(Ce)!==`note`&&e(u)});var d=w(c,2),f=e(d,!0);L(r),a(e=>t(f,e),[()=>o.fields.title||i.id.split(`/`).at(-1)]),s(n,r)},R=e=>{var t=Bc(),n=v(t),r=e=>{Ac(e,()=>h(Ce),()=>!!h(we))};l(n,e=>{h(Ce)!==`note`&&e(r)});var c=w(n,4);ee(c),L(t),a(e=>{te(c,o.fields.title),T(c,`placeholder`,e)},[()=>i.id.split(`/`).at(-1)]),f(`input`,c,e=>o.setFields({title:e.currentTarget.value.replace(/\s*\n\s*/g,` `)})),f(`keydown`,c,e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur())}),re(`blur`,c,()=>void ve()),s(e,t)},z=n=>{var r=Vc(),c=e(r);a(()=>t(c,`${i.id??``}.md${o.meta===null?`: the frontmatter cannot be read, so the file is shown as it is`:``}`)),s(n,r)};l(N,e=>{h(x)?e(F):h(g)?e(z,-1):e(R,1)});var ne=w(N,2),B=v(ne),H=v(B),ae=w(H,2);L(B),L(ne),L(M);var oe=w(M,2),se=e=>{lr(e,{get note(){return o},get kind(){return h(Ce)},get done(){return h(we)},get marking(){return h(De)},onmark:()=>void Oe()})};l(oe,e=>{!h(g)&&!h(x)&&e(se)});var W=w(oe,2),ce=e=>{var t=Hc(),n=v(t);{let e=k(()=>h(O)?je(h(O)):null);Ve(n,{get moments(){return h(P)},strata:!0,get at(){return h(e)},get pointed(){return h(D)},point:e=>I(D,e),pick:de})}L(t),s(e,t)};l(W,e=>{h(C)&&!h(g)&&!h(x)&&e(ce)});var le=w(W,2),fe=r=>{var i=Wc(),c=d(i),u=v(c),p=e(u),m=w(u,4),g=n=>{var r=Uc(),i=e(r,!0);a(()=>t(i,h(j))),s(n,r)};l(m,e=>{h(j)&&e(g)});var _=w(m,2),y=w(_,2);L(c);var b=w(c,2);n(b,()=>je(h(O)),e=>{kc(e,{get id(){return o.id},get text(){return h(U).text},get title(){return o.fields.title},get touched(){return h(U).touched},get asked(){return h(U).asked},get offered(){return h(U).offered}})}),a((e,n)=>{t(p,`${e??``} · ${n??``}`),_.disabled=h(A)||h(U).text===o.text},[()=>Me(h(O)),()=>Fe(h(O).at)]),f(`click`,_,pe),f(`click`,y,()=>I(O,null)),s(r,i)};l(le,e=>{h(O)&&h(U)&&e(fe)});var me=w(le,2),G=n=>{var r=Gc();let i;var o=v(r),c=w(o,2),l=e(c,!0);L(r),a(()=>{i=y(r,``,i,{top:`${h(Re).top??``}px`,left:`${h(Re).left??``}px`}),t(l,h(ze)?`copied`:`copy for a terminal`)}),f(`pointerdown`,o,e=>{e.preventDefault(),He()}),f(`click`,o,e=>{e.detail===0&&He()}),f(`pointerdown`,c,e=>{e.preventDefault(),Be()}),f(`click`,c,e=>{e.detail===0&&Be()}),s(n,r)};l(me,e=>{h(Re)&&e(G)});var he=w(me,2),ge=v(he);n(ge,()=>`${h(g)}${h(x)}`,e=>{wc(e,{get note(){return o},get iso(){return c},get source(){return h(g)},get reading(){return h(x)},get touched(){return h(ie)},get lens(){return h(ue)}})}),L(he);var _e=w(he,2),ye=n=>{var r=Jc();p(r,21,()=>h(Te),e=>e.id,(n,r)=>{var i=qc(),o=v(i);let c;var u=v(o);Ac(u,()=>h(r).kind??`question`,()=>!!h(r).done);var d=w(u),f=e(d,!0),p=w(d),m=e=>{var t=Kc();s(e,t)};l(p,e=>{h(r).done&&e(m)}),L(o),L(i),a(e=>{T(o,`href`,e),c=V(o,1,`svelte-18ltlst`,null,c,{done:!!h(r).done&&h(r).kind===`question`}),t(f,h(r).title)},[()=>Ee(h(r).id)]),s(n,i)}),L(r),s(n,r)};l(_e,e=>{h(Te).length&&!h(g)&&!h(O)&&!h(x)&&e(ye)});var be=w(_e,2),Se=n=>{var r=Yc(),i=w(v(r),2),o=e(i),l=w(i,4),u=w(l,2);L(r),a(()=>{t(o,`${c.changes.length??``} ${c.changes.length===1?`change`:`changes`} from ${h(xe)??``} waiting`),l.disabled=c.busy===`all`,u.disabled=c.busy===`all`}),f(`click`,l,()=>c.settleAll(!0)),f(`click`,u,()=>c.settleAll(!1)),s(n,r)};l(be,e=>{c.changes.length&&e(Se)}),a(e=>{T(H,`aria-pressed`,h(x)),H.disabled=h(g),T(ae,`aria-pressed`,h(g)),ae.disabled=o.meta===null,T(he,`hidden`,e)},[()=>!!(h(O)&&h(U))]),f(`click`,H,()=>I(b,!h(b))),f(`click`,ae,()=>{I(b,!1),I(u,!h(u))}),s(r,m)};l(Ge,e=>{o.loaded===`loading`?e(Ke):o.loaded===`missing`?e(qe,1):o.loaded===`error`?e(Je,2):e(Ye,-1)}),L(Ue),M(Ue,e=>I(Le,e),()=>h(Le)),a(()=>We=V(Ue,1,`note svelte-18ltlst`,null,We,{reading:h(x),timed:h(C)&&o.loaded===`ready`&&!h(g)&&!h(x)})),s(r,Ue),S()}o([`click`,`input`,`keydown`,`pointerdown`]);function $c(e,t){N(t,!0);let r=k(()=>nt.params.id??``),i=k(()=>!h(r).startsWith(`@`)&&W(h(r))!==null&&!G.listing.notes.some(e=>e.id===h(r)));var a=c(),o=d(a);n(o,()=>h(r),e=>{var t=c(),n=d(t),a=e=>{Ln(e,{get path(){return h(r)}})},o=e=>{Qc(e,{get id(){return h(r)}})};l(n,e=>{h(i)?e(a):e(o,-1)}),s(e,t)}),s(e,a),S()}export{$c as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/AnnzTlE8.js";import"../chunks/xihTtKlq.js";import{t as e}from"../chunks/BHORylQC.js";import"../chunks/C7qBBO-i.js";function t(t){e(t,{})}export{t as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,A as t,F as n,K as r,L as i,M as a,P as o,Q as s,R as c,T as l,V as u,Z as d,_ as f,ct as p,et as m,f as h,ft as g,ht as _,i as v,it as y,lt as b,pt as x,s as S,v as C}from"../chunks/AnnzTlE8.js";import"../chunks/xihTtKlq.js";import{a as w,i as T,n as E}from"../chunks/CSTv2fL0.js";import"../chunks/C7qBBO-i.js";var D=n(`<svg class="logo" viewBox="-0.4 -9.5 32.4 9.9" role="img" aria-label="isorite"><path d="M2 0L2 -2L0 -4M2 -2L2 -4L4 -6M5.6 0L6.6 0L7.6 -1L5.6 -3L6.6 -4L7.6 -4M11.2 0L13.2 -2L11.2 -4L9.2 -2ZM14.8 0L14.8 -2L15.8 -3L16.8 -4M14.8 -2L14.8 -4M20.4 0L20.4 -2L18.4 -4M20.4 -2L20.4 -4L22.4 -6M26 0L25 -1L25 -4L24 -4M25 -4L26 -4M25 -4L25 -5M30.6 0L29.6 0L27.6 -2L29.6 -4L31.6 -2L27.6 -2"></path><path class="iso" d="M2 -9.05l1.2 1.2l-1.2 1.2l-1.2 -1.2z"></path><path class="right" d="M20.4 -9.05l1.2 1.2l-1.2 1.2l-1.2 -1.2z"></path></svg>`);function O(e,t){let n=v(t,`width`,3,72);var i=D();r(()=>{h(i,`width`,n()),h(i,`height`,n()*9.9/32.4)}),a(e,i)}var k=o(`<button type="button" role="radio"> </button>`),A=o(`<div class="swatch svelte-h119xx"><i class="svelte-h119xx"></i><span> </span></div>`),j=o(`<div class="swatch svelte-h119xx"><i class="svelte-h119xx"></i><span> </span></div> <div class="swatch svelte-h119xx"><i class="svelte-h119xx"></i><span> </span></div>`,1),M=o(`<!><!>`,1),N=o(`<div class="parts svelte-h119xx"><section class="svelte-h119xx"><h2 class="label svelte-h119xx">the ground</h2> <div class="row svelte-h119xx" role="radiogroup" aria-label="Ground"></div></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">the name</h2> <div class="row svelte-h119xx"><!><!></div></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">colour</h2> <div class="swatches svelte-h119xx"></div> <div class="swatches svelte-h119xx"></div> <div class="swatches svelte-h119xx"></div></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">type</h2> <p class="pixel">Departure Mono, for display</p> <p>Ioskeley Mono, for the interface. <b>Bold.</b> <i>Italic.</i> 0123456789</p> <p class="serif">Charter, for what is read: the entropy of a source is the average surprise of its symbols. <b>Bold</b>, <i>italic</i>.</p></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">buttons and chips</h2> <div class="row svelte-h119xx"><button class="btn" type="button">plain</button> <button class="btn primary" type="button">primary</button> <button class="btn danger" type="button">delete</button> <button class="btn quiet" type="button">quiet</button> <button class="btn" type="button" disabled="">off</button> <button class="btn tall primary" type="button">tall</button></div> <div class="row svelte-h119xx"><button class="btn keep" type="button">keep</button> <button class="btn edit" type="button">edit</button> <button class="btn remove" type="button">remove</button></div> <div class="row svelte-h119xx"><span class="chip">plain</span><span class="chip lattice">lattice</span><span class="chip growth">growth</span> <span class="chip malachite">malachite</span><span class="chip rose">rose</span></div></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">crystals (M24, I): growing while Iso works, at 28 and 88; at rest, a conversation's mark</h2> <div class="row crystals svelte-h119xx"><!><!><!><!></div> <div class="row crystals rest svelte-h119xx"></div></section> <section class="svelte-h119xx"><h2 class="label svelte-h119xx">a frame, a field, the marks</h2> <div class="frame box svelte-h119xx"><span class="frame-title">a frame</span> <input class="field" placeholder="a field" aria-label="A field"/> <div class="row svelte-h119xx"><i class="sq"></i><span>you</span><i class="sq empty"></i><span>not yet</span><i class="dia"></i><span>Iso</span><i class="dia open"></i><span>Iso, unkept</span></div></div> <div class="dots ground svelte-h119xx"></div></section></div>`);function P(n,i){b(i,!1);let o=[`ground-0`,`ground-1`,`ground-2`,`ground-3`,`line`,`line-strong`],v=[`text`,`text-soft`,`text-faint`],D=[`lattice`,`growth`,`malachite`,`rose`];S();var P=N(),F=d(P),I=m(d(F),2);l(I,5,()=>E,([e,t])=>e,(n,i)=>{var o=y(()=>_(u(i),2));let s=()=>u(o)[0],l=()=>u(o)[1];var d=k();let f;var p=e(d,!0);r(()=>{f=C(d,1,`btn`,null,f,{primary:T.chosen===s()}),h(d,`aria-checked`,T.chosen===s()),t(p,l())}),c(`click`,d,()=>T.choose(s())),a(n,d)}),x(I),x(F);var L=m(F,2),R=m(d(L),2),z=d(R);O(z,{width:216}),O(m(z),{}),x(R),x(L);var B=m(L,2),V=m(d(B),2);l(V,5,()=>o,e=>e,(n,i)=>{var o=A(),s=d(o);let c;var l=m(s),p=e(l,!0);x(o),r(()=>{c=f(s,``,c,{background:`var(--${u(i)})`}),t(p,u(i))}),a(n,o)}),x(V);var H=m(V,2);l(H,5,()=>v,e=>e,(n,i)=>{var o=A(),s=d(o);let c;var l=m(s),p=e(l,!0);x(o),r(()=>{c=f(s,``,c,{background:`var(--${u(i)})`}),t(p,u(i))}),a(n,o)}),x(H);var U=m(H,2);l(U,5,()=>D,e=>e,(n,i)=>{var o=j(),c=s(o),l=d(c);let p;var h=m(l),g=e(h,!0);x(c);var _=m(c,2),v=d(_);let y;var b=m(v),S=e(b);x(_),r(()=>{p=f(l,``,p,{background:`var(--${u(i)})`}),t(g,u(i)),y=f(v,``,y,{background:`var(--${u(i)}-soft)`}),t(S,`${u(i)??``}-soft`)}),a(n,o)}),x(U),x(B);var W=m(B,2),G=m(d(W),2);f(G,``,{},{"font-size":`22px`});var K=m(G,4);f(K,``,{},{"font-size":`18px`}),x(W);var q=m(W,4),J=m(d(q),2),Y=d(J);w(Y,{id:`a`,size:28,growing:!0});var X=m(Y);w(X,{id:`a`,size:88,growing:!0});var Z=m(X);w(Z,{id:`b`,size:88,growing:!0});var Q=m(Z);w(Q,{id:`c`,size:88,growing:!0}),x(J);var $=m(J,2);l($,4,()=>[`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`],e=>e,(e,t)=>{var n=M(),r=s(n);w(r,{get id(){return t},size:44});var i=m(r);w(i,{get id(){return t},size:20}),a(e,n)}),x($),x(q),g(2),x(P),a(n,P),p()}i([`click`]);export{P as component};
|
package/web/_app/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"1793616076710"}
|
package/web/index.html
CHANGED
|
@@ -36,41 +36,41 @@
|
|
|
36
36
|
history.replaceState(history.state, "", location.pathname.slice(0, -1) + location.search + location.hash);
|
|
37
37
|
}
|
|
38
38
|
</script>
|
|
39
|
-
<link href="/_app/immutable/entry/start.
|
|
40
|
-
<link href="/_app/immutable/chunks/
|
|
41
|
-
<link href="/_app/immutable/chunks/
|
|
42
|
-
<link href="/_app/immutable/entry/app.
|
|
39
|
+
<link href="/_app/immutable/entry/start.WU9HKeyT.js" rel="modulepreload">
|
|
40
|
+
<link href="/_app/immutable/chunks/BMijTvgG.js" rel="modulepreload">
|
|
41
|
+
<link href="/_app/immutable/chunks/AnnzTlE8.js" rel="modulepreload">
|
|
42
|
+
<link href="/_app/immutable/entry/app.B9TPZNFw.js" rel="modulepreload">
|
|
43
43
|
<link href="/_app/immutable/chunks/CRzLMJPS.js" rel="modulepreload">
|
|
44
44
|
<link href="/_app/immutable/chunks/xihTtKlq.js" rel="modulepreload">
|
|
45
|
-
<link href="/_app/immutable/nodes/0.
|
|
46
|
-
<link href="/_app/immutable/chunks/
|
|
47
|
-
<link href="/_app/immutable/chunks/
|
|
45
|
+
<link href="/_app/immutable/nodes/0.C9NFEqJd.js" rel="modulepreload">
|
|
46
|
+
<link href="/_app/immutable/chunks/Wv-ICQRy.js" rel="modulepreload">
|
|
47
|
+
<link href="/_app/immutable/chunks/CA-rzUq8.js" rel="modulepreload">
|
|
48
48
|
<link href="/_app/immutable/chunks/BxTFtVqu.js" rel="modulepreload">
|
|
49
49
|
<link href="/_app/immutable/chunks/yxd8jSz3.js" rel="modulepreload">
|
|
50
|
-
<link href="/_app/immutable/chunks/
|
|
51
|
-
<link href="/_app/immutable/chunks/
|
|
52
|
-
<link href="/_app/immutable/chunks/
|
|
53
|
-
<link href="/_app/immutable/chunks/
|
|
50
|
+
<link href="/_app/immutable/chunks/CTuuQ66F.js" rel="modulepreload">
|
|
51
|
+
<link href="/_app/immutable/chunks/CSTv2fL0.js" rel="modulepreload">
|
|
52
|
+
<link href="/_app/immutable/chunks/BHORylQC.js" rel="modulepreload">
|
|
53
|
+
<link href="/_app/immutable/chunks/TmxIGCN3.js" rel="modulepreload">
|
|
54
54
|
|
|
55
55
|
<link href="/_app/immutable/assets/drawn.D6lJzDcc.css" rel="stylesheet">
|
|
56
56
|
<link href="/_app/immutable/assets/ground.hxi5N5fC.css" rel="stylesheet">
|
|
57
57
|
<link href="/_app/immutable/assets/FolderField._A4_sc1Z.css" rel="stylesheet">
|
|
58
|
-
<link href="/_app/immutable/assets/NoteList.
|
|
59
|
-
<link href="/_app/immutable/assets/0.
|
|
58
|
+
<link href="/_app/immutable/assets/NoteList.C2GYAaLW.css" rel="stylesheet">
|
|
59
|
+
<link href="/_app/immutable/assets/0.BEFtmzIh.css" rel="stylesheet">
|
|
60
60
|
</head>
|
|
61
61
|
<body>
|
|
62
62
|
<div style="display: contents">
|
|
63
63
|
<script>
|
|
64
64
|
{
|
|
65
|
-
|
|
65
|
+
__sveltekit_19obb1b = {
|
|
66
66
|
base: new URL('.', location).pathname.slice(0, -1)
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const element = document.currentScript.parentElement;
|
|
70
70
|
|
|
71
71
|
Promise.all([
|
|
72
|
-
import("/_app/immutable/entry/start.
|
|
73
|
-
import("/_app/immutable/entry/app.
|
|
72
|
+
import("/_app/immutable/entry/start.WU9HKeyT.js"),
|
|
73
|
+
import("/_app/immutable/entry/app.B9TPZNFw.js")
|
|
74
74
|
]).then(([kit, app]) => {
|
|
75
75
|
kit.start(app, element);
|
|
76
76
|
});
|