@inkandswitch/patchwork-pkg-base 0.0.107 → 0.0.108

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.
@@ -0,0 +1,1210 @@
1
+ import{a as Ye,b as qr}from"./chunk-FW4363Y4.js";var kt=Ye((Ni,xt)=>{var ie=1e3,se=ie*60,le=se*60,te=le*24,po=te*7,ho=te*365.25;xt.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return fo(e);if(t==="number"&&isFinite(e))return r.long?go(e):mo(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function fo(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*ho;case"weeks":case"week":case"w":return t*po;case"days":case"day":case"d":return t*te;case"hours":case"hour":case"hrs":case"hr":case"h":return t*le;case"minutes":case"minute":case"mins":case"min":case"m":return t*se;case"seconds":case"second":case"secs":case"sec":case"s":return t*ie;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function mo(e){var r=Math.abs(e);return r>=te?Math.round(e/te)+"d":r>=le?Math.round(e/le)+"h":r>=se?Math.round(e/se)+"m":r>=ie?Math.round(e/ie)+"s":e+"ms"}function go(e){var r=Math.abs(e);return r>=te?Fe(e,r,te,"day"):r>=le?Fe(e,r,le,"hour"):r>=se?Fe(e,r,se,"minute"):r>=ie?Fe(e,r,ie,"second"):e+" ms"}function Fe(e,r,t,o){var n=r>=t*1.5;return Math.round(e/t)+" "+o+(n?"s":"")}});var $t=Ye((qi,Ct)=>{function bo(e){t.debug=t,t.default=t,t.coerce=l,t.disable=i,t.enable=n,t.enabled=d,t.humanize=kt(),t.destroy=c,Object.keys(e).forEach(s=>{t[s]=e[s]}),t.names=[],t.skips=[],t.formatters={};function r(s){let u=0;for(let h=0;h<s.length;h++)u=(u<<5)-u+s.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=r;function t(s){let u,h=null,b,_;function m(...p){if(!m.enabled)return;let f=m,w=Number(new Date),T=w-(u||w);f.diff=T,f.prev=u,f.curr=w,u=w,p[0]=t.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let F=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(j,Q)=>{if(j==="%%")return"%";F++;let O=t.formatters[Q];if(typeof O=="function"){let J=p[F];j=O.call(f,J),p.splice(F,1),F--}return j}),t.formatArgs.call(f,p),(f.log||t.log).apply(f,p)}return m.namespace=s,m.useColors=t.useColors(),m.color=t.selectColor(s),m.extend=o,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(b!==t.namespaces&&(b=t.namespaces,_=t.enabled(s)),_),set:p=>{h=p}}),typeof t.init=="function"&&t.init(m),m}function o(s,u){let h=t(this.namespace+(typeof u>"u"?":":u)+s);return h.log=this.log,h}function n(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let u=(typeof s=="string"?s:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of u)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function a(s,u){let h=0,b=0,_=-1,m=0;for(;h<s.length;)if(b<u.length&&(u[b]===s[h]||u[b]==="*"))u[b]==="*"?(_=b,m=h,b++):(h++,b++);else if(_!==-1)b=_+1,m++,h=m;else return!1;for(;b<u.length&&u[b]==="*";)b++;return b===u.length}function i(){let s=[...t.names,...t.skips.map(u=>"-"+u)].join(",");return t.enable(""),s}function d(s){for(let u of t.skips)if(a(s,u))return!1;for(let u of t.names)if(a(s,u))return!0;return!1}function l(s){return s instanceof Error?s.stack||s.message:s}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Ct.exports=bo});var St=Ye((P,Pe)=>{P.formatArgs=wo;P.save=yo;P.load=_o;P.useColors=vo;P.storage=xo();P.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();P.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function vo(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function wo(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Pe.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(o=t))}),e.splice(o,0,r)}P.log=console.debug||console.log||(()=>{});function yo(e){try{e?P.storage.setItem("debug",e):P.storage.removeItem("debug")}catch{}}function _o(){let e;try{e=P.storage.getItem("debug")||P.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function xo(){try{return localStorage}catch{}}Pe.exports=$t()(P);var{formatters:ko}=Pe.exports;ko.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});import{template as Hr}from"solid-js/web";import{createComponent as si}from"solid-js/web";import{setAttribute as li}from"solid-js/web";import{effect as ci}from"solid-js/web";import{insert as Nr}from"solid-js/web";import{getOwner as di}from"solid-js/web";import{createMemo as jr}from"solid-js";import{createStore as hi,reconcile as fi}from"solid-js/store";import{render as mi}from"solid-js/web";import{template as Ae}from"solid-js/web";import{insert as ne}from"solid-js/web";import{getOwner as Ee}from"solid-js/web";import{use as Te}from"solid-js/web";import{createComponent as U}from"solid-js/web";import{createUniqueId as Br,untrack as ht}from"solid-js";import{isServer as Jr,isDev as ft}from"solid-js/web";import{reconcile as Vr}from"solid-js/store";function Xe(e,r={}){let t=r.storage||globalThis.localStorage,o=r.name||`storage-${Br()}`;if(!t)return Object.assign(e,{2:null});let n=r.storageOptions,a=r.serialize||JSON.stringify.bind(JSON),i=r.deserialize||JSON.parse.bind(JSON),d=t.getItem(o,n),l=typeof e[0]=="function"?s=>{try{let u=i(s);e[1](()=>u)}catch(u){ft&&console.warn(u)}}:s=>{try{let u=i(s);e[1](Vr(u))}catch(u){ft&&console.warn(u)}},c=!0;if(d instanceof Promise?d.then(s=>c&&s&&l(s)):d&&l(d),typeof r.sync?.[0]=="function"){let s=typeof e[0]=="function"?e[0]:()=>e[0];r.sync[0](u=>{u.key!==o||!Jr&&(u.url||globalThis.location.href)!==globalThis.location.href||u.newValue===a(ht(s))||l(u.newValue)})}return Object.assign([],e,{1:typeof e[0]=="function"?s=>{let u=e[1](s),h=s!=null?a(u):s;return r.sync?.[1](o,h),h!=null?t.setItem(o,h,n):t.removeItem(o,n),c=!1,u}:(...s)=>{e[1](...s);let u=ht(()=>a(e[0]));r.sync?.[1](o,u),t.setItem(o,u,n),c=!1},2:d})}import{createEffect as Lr,createMemo as pt,createSignal as Z,on as Mr,onCleanup as oi,onMount as ni,Show as me}from"solid-js";import{createEffect as mt,createSignal as gt,on as bt}from"solid-js";var V={leftCollapsed:"patchwork:leftSidebarCollapsed",rightCollapsed:"patchwork:rightSidebarCollapsed",leftWidth:"patchwork:leftSidebarWidth",rightWidth:"patchwork:rightSidebarWidth",contextToolId:"patchwork:contextSidebarToolId"},Ie="patchwork:collapse-context-sidebar",Re=400;function vt(e,r){let t=localStorage.getItem(e);return t?parseInt(t,10):r}function wt(e){return localStorage.getItem(e)==="true"}function Kr(){let[e,r]=gt(wt(V.leftCollapsed)),[t,o]=gt(vt(V.leftWidth,Re));return mt(bt(e,n=>{localStorage.setItem(V.leftCollapsed,String(n))})),mt(bt(t,n=>{localStorage.setItem(V.leftWidth,String(n))})),{isSidebarCollapsed:e,setIsSidebarCollapsed:r,leftSidebarWidth:t,setLeftSidebarWidth:o}}import{onCleanup as Yr,onMount as Xr}from"solid-js";var yt=180,Gr=720,Zr=120,_t=3;function Ge(e,{isCollapsed:r,setCollapsed:t,setWidth:o}){let n=!1,a=null,i=!1,d=null,l=f=>{if(f<Zr){r()||t(!0),d=null;return}r()&&t(!1);let w=Math.min(Gr,f);o(w),d=w},c=()=>{r()||d!==null&&d<yt&&o(yt)},s=null,u=()=>{document.body.setAttribute("data-sidebar-resizing",e),s=document.createElement("div"),s.style.cssText="position:fixed;inset:0;z-index:2147483647;cursor:col-resize;",document.body.appendChild(s)},h=()=>{n=!1,a=null,document.body.style.userSelect="",document.body.removeAttribute("data-sidebar-resizing"),s?.remove(),s=null},b=f=>{f.preventDefault(),a={x:f.clientX,y:f.clientY},i=!1,d=null,n=!0,document.body.style.userSelect="none"},_=()=>{let f=n,w=i;h(),f&&w&&c()},m=f=>{if(!n||!a)return;let w=Math.abs(f.clientX-a.x),T=Math.abs(f.clientY-a.y);!i&&(w>_t||T>_t)&&(i=!0,u()),l(e==="left"?f.clientX:window.innerWidth-f.clientX)},p=f=>{if(i){f.preventDefault(),f.stopPropagation(),i=!1;return}t(w=>!w)};return Xr(()=>{document.addEventListener("mousemove",m),document.addEventListener("mouseup",_),Yr(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",_),n&&h()})}),{handleMouseDown:b,handleToggleClick:p}}import{createEffect as Qr,createSignal as eo,onCleanup as to}from"solid-js";var ee=(e,r)=>{let[t,o]=eo(!1);return Qr(()=>{let n=r();if(!n)return;o(!1);let a=i=>{i.detail?.componentId===e&&o(!0)};n.addEventListener("patchwork:mounted",a),to(()=>n.removeEventListener("patchwork:mounted",a))}),t};import{createEffect as ro,createSignal as oo,onCleanup as no}from"solid-js";var ao=5e3,io=(e,r)=>{let[t,o]=oo(!1);return ro(()=>{if(t())return;let n=e(),a=r();if(!n||!a)return;let i=l=>{let c=l.detail;c?.url&&c.url!==a||o(!0)};n.addEventListener("patchwork:mounted",i),n.addEventListener("patchwork:no-tool",i);let d=setTimeout(()=>o(!0),ao);no(()=>{n.removeEventListener("patchwork:mounted",i),n.removeEventListener("patchwork:no-tool",i),clearTimeout(d)})}),t};import{getRegistry as so}from"@inkandswitch/patchwork-plugins";import{createMemo as lo,createSignal as co,onCleanup as uo}from"solid-js";function ae(e){let r=so("patchwork:component"),[t,o]=co(0),n=r.on("changed",()=>o(a=>a+1));return uo(n),lo(()=>(t(),(r.all?.()??[]).filter(a=>(a.tags??[]).includes(e)).map(a=>({id:a.id,name:a.name||a.id,icon:a.icon})).sort((a,i)=>a.name.localeCompare(i.name))))}import{template as ke}from"solid-js/web";import{delegateEvents as fn}from"solid-js/web";import{getOwner as mn}from"solid-js/web";import{effect as Qt}from"solid-js/web";import{setAttribute as gn}from"solid-js/web";import{memo as er}from"solid-js/web";import{insert as ue}from"solid-js/web";import{createComponent as pe}from"solid-js/web";import{For as xn,Show as ot}from"solid-js";import{template as Lt}from"solid-js/web";import{delegateEvents as Po}from"solid-js/web";import{setAttribute as Lo}from"solid-js/web";import{insert as Mo}from"solid-js/web";import"solid-js/web";import{effect as Pt}from"solid-js/web";import{use as Mt}from"solid-js/web";import{createComponent as Ze}from"solid-js/web";var At=qr(St(),1),Dt=(0,At.default)("cabbages");function Et(e){return typeof e=="object"&&typeof e!=null&&Object.getPrototypeOf(e)==Object.prototype}var Co="\uFFFC";function It(e,...r){if(r.length==0){Dt("empty patch");return}let[t,o,n]=r,a=[...t];for(;;){let i=a.shift();if(!a.length){let l=Array.isArray(o);if(Et(e)&&l&&typeof i>"u"&&typeof o[0]=="string"){delete e[o[0]];return}if(l||typeof o=="number"){if(typeof i>"u")throw new Error("cant treat top level as a seq");i=i;let[c,s]=Array.isArray(o)?o:[o,o+1],u=Array.isArray(o)&&o.length==0;if(!u&&(c==null||s==null))throw new RangeError("it's all or nothing, no half measures");let h=typeof n>"u",b=c===s&&!h,_=u&&!h,m=!b&&!h&&!_;if(typeof e[i]>"u"){if(typeof e=="string")return;typeof n=="string"?e[i]="":e[i]=[]}let p=e[i];if(Array.isArray(p)){if(_){Array.isArray(n)?p.push(...n):p.push(n);return}if(b||m){Array.isArray(n)?p.splice(c,s-c,...n):p.splice(c,s-c,n);return}if(h){p.splice(c,s-c);return}throw new Error("i don't know what happened")}if(typeof p=="string"){if(_){e[i]=p+n;return}if(m||b){e[i]=p.slice(0,c)+(typeof n=="string"?n:n.map(f=>typeof f=="string"?f:Co).join(""))+p.slice(s);return}if(h){e[i]=p.slice(0,c)+p.slice(s);return}throw new Error("i don't know what happened")}if(Et(p)&&l&&typeof o[0]=="string"){delete p[o[0]];return}throw new Error("not implemented")}if(typeof i>"u"){if(typeof o!="string")throw new Error(`can't index top-level map with ${o}`);typeof n>"u"?delete e[o]:e[o]=n;return}if(typeof e[i]>"u"&&(e[i]={}),l){let[c,s]=o;c!=null&&s!=null&&(typeof n>"u"&&c!=null&&s!=null?delete e[i][c||s]:e[i][c||s]=n)}else if(typeof n>"u")delete e[i][o];else{if(typeof e[i]=="string")return;e[i][o]=n}return}if(typeof i>"u")throw new Error("cant treat top level as a seq");i=i;let d=a[0];if(typeof e[i]>"u")if(typeof d=="string")e[i]={};else if(typeof d=="number")e[i]=[];else throw new Error(`can't go down this road ${e}.${i}.${d}`);e=e[i]}}function Tt(e,r){for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e}function Rt(e,r){let t=e.path.slice(0,-1),o=e.path[e.path.length-1];switch(e.action){case"mark":case"unmark":return Dt(`skipping ${e.action} because it doesn't affect material reality`),[];case"inc":if(r)return[t,o,Tt(r.patchInfo.after,e.path)];throw new Error(`can't apply ${e.action} without payload argument`);case"conflict":if(r)return[t,o,Tt(r.patchInfo.after,e.path)];throw new Error(`can't apply ${e.action} without payload argument`);case"del":return typeof o=="string"?[t,o]:[t,[o,o+(e.length||1)]];case"insert":return[t,[o,o],structuredClone(e.values)];case"splice":return[t,[o,o],[e.value]];case"put":return[t,o,structuredClone(e.value)]}}function Le(e){return r=>{for(let t of e.patches)It(r,...Rt(t,e))}}import{createMemo as To}from"solid-js";import{onCleanup as $o}from"solid-js";import{createStore as So,produce as Eo,reconcile as Ft}from"solid-js/store";var ve=new WeakMap;function Me(e){if($o(()=>{let a=ve.get(e);a&&(a.refs--||a.cleanup())}),ve.has(e)){let a=ve.get(e);return a.refs++,a.store}let[r,t]=So(structuredClone(e.doc()));ve.set(e,{refs:0,store:r,cleanup(){e.off("change",o),e.off("delete",n),ve.delete(e)}});function o(a){if(a.scopeReplaced){t(Ft(a.doc??{}));return}t(Eo(Le(a)))}function n(){t(Ft({}))}return e.on("change",o),e.on("delete",n),e.whenReady().then(()=>{t(structuredClone(e.doc()))}),r}import{getOwner as Qi,onCleanup as es,createSignal as ts,untrack as rs,sharedConfig as os,onMount as ns,DEV as as,equalFn as is}from"solid-js";import{isServer as ls}from"solid-js/web";var ce=e=>typeof e=="function"&&!e.length?e():e;function Oe(e){return To(()=>ce(e)&&Me(ce(e)))}import{createEffect as Do,createResource as Io,useContext as Ro}from"solid-js";import{createContext as Ao}from"solid-js";var ze=Ao(null);function we(e,r){let t=Ro(ze);if(!r?.repo&&!t)throw new Error("use outside <RepoContext> requires options.repo");let o=r?.repo||t;function n(){if(r?.["~skipInitialValue"])return;let d=ce(e);if(!d)return;let l=o.findWithProgress(d).peek();return l.state==="ready"?l.handle:void 0}let[a,{mutate:i}]=Io(e,d=>o.findWithProgress(d).whenReady(),{initialValue:n()});return Do(()=>{ce(e)||i()}),a}function Ue(e,r){let t=we(e,r);return[Oe(t),t]}import{onCleanup as $s}from"solid-js";import{createSignal as Es}from"solid-js";import{createEffect as Ds,onCleanup as Is}from"solid-js";import{createSignal as Fs}from"solid-js";import{useContext as js}from"solid-js";import{getType as zo}from"@inkandswitch/patchwork-filesystem";import{getRegistry as Uo,isLoadedPlugin as jo}from"@inkandswitch/patchwork-plugins";import{createEffect as Wo,createMemo as je,createSignal as Qe,onCleanup as Ho,onMount as zt,Show as Ut}from"solid-js";var Ot=Lt("<span class=threepane__title-text>"),Oo=Lt("<input class=threepane__title-input type=text>");function jt(e){let r,[t,o]=Qe();return zt(()=>{o(r.closest("repo-provider")?.repo)}),Ze(Ut,{get when(){return t()},get fallback(){return(()=>{var n=Ot(),a=r;return typeof a=="function"?Mt(a,n):r=n,n})()},children:n=>Ze(No,{get docUrl(){return e.docUrl},get repo(){return n()}})})}function No(e){let[r,t]=Ue(()=>e.docUrl(),{repo:e.repo}),o=Uo("patchwork:datatype"),[n,a]=Qe(0);zt(()=>{let m=o.on("changed",()=>a(p=>p+1));Ho(m)});let i=je(()=>{let m=r();return m?zo(m):void 0});Wo(()=>{let m=i();m&&o.load(m)});let d=je(()=>{n();let m=i();if(!m)return;let p=o.get(m);return p&&jo(p)?p:void 0}),l=je(()=>{let m=r(),p=d();if(!(!m||!p))return p.module.getTitle(m)}),c=je(()=>!!t()&&typeof d()?.module.setTitle=="function"),[s,u]=Qe(!1),h;function b(){c()&&(u(!0),queueMicrotask(()=>{h?.focus(),h?.select()}))}function _(m){if(!s()||(u(!1),!m))return;let p=h?.value.trim();if(!p||p===l())return;let f=t(),w=d()?.module.setTitle;!f||!w||f.change(T=>{w(T,p);let F=T["@patchwork"];F&&(F.title=p)})}return Ze(Ut,{get when(){return s()},get fallback(){return(()=>{var m=Ot();return m.$$click=b,Mo(m,()=>l()??"Untitled"),Pt(p=>{var f=!!c(),w=c()?"Rename":void 0;return f!==p.e&&m.classList.toggle("threepane__title-text--editable",p.e=f),w!==p.t&&Lo(m,"title",p.t=w),p},{e:void 0,t:void 0}),m})()},get children(){var m=Oo();m.$$keydown=f=>{f.key==="Enter"?(f.preventDefault(),_(!0)):f.key==="Escape"&&(f.preventDefault(),_(!1))},m.addEventListener("blur",()=>_(!0));var p=h;return typeof p=="function"?Mt(p,m):h=m,Pt(()=>m.value=l()??""),m}})}Po(["keydown","click"]);import{template as xe}from"solid-js/web";import{delegateEvents as rn}from"solid-js/web";import{getOwner as on}from"solid-js/web";import{insert as _e}from"solid-js/web";import{createComponent as de}from"solid-js/web";import{Show as et}from"solid-js";import{template as qt}from"solid-js/web";import{delegateEvents as qo}from"solid-js/web";import{setStyleProperty as Bo}from"solid-js/web";import{insert as Jo}from"solid-js/web";import{setAttribute as We}from"solid-js/web";import{effect as Wt}from"solid-js/web";import{memo as ye}from"solid-js/web";import{createComponent as Ht}from"solid-js/web";import{Show as Nt}from"solid-js";var Vo=qt('<button class="sidebar-toggle sidebar-toggle--resizable">'),Ko=qt("<div class=sidebar>");function Bt(e){let r=()=>`${e.isCollapsed()?0:e.width()}px`,t=()=>e.canExpand?.()??!0,o=()=>Ht(Nt,{get when(){return!e.isCollapsed()},get children(){return e.children}}),n=()=>Ht(Nt,{get when(){return!e.isCollapsed()||t()},get children(){var a=Vo();return a.$$mousedown=i=>e.onMouseDown(i),a.$$click=i=>e.onToggleClick(i),Wt(i=>{var d=e.isCollapsed()?"Expand sidebar":"Toggle or resize sidebar",l=e.isCollapsed()?"Click to expand, drag to resize":"Click to toggle, drag to resize";return d!==i.e&&We(a,"aria-label",i.e=d),l!==i.t&&We(a,"title",i.t=l),i},{e:void 0,t:void 0}),a}});return(()=>{var a=Ko();return Jo(a,(()=>{var i=ye(()=>e.side==="left");return()=>i()?[ye(o),ye(n)]:[ye(n),ye(o)]})()),Wt(i=>{var d=e.side,l=e.isCollapsed()?"":void 0,c=r();return d!==i.e&&We(a,"data-side",i.e=d),l!==i.t&&We(a,"data-collapsed",i.t=l),c!==i.a&&Bo(a,"width",i.a=c),i},{e:void 0,t:void 0,a:void 0}),a})()}qo(["click","mousedown"]);import{template as Vt}from"solid-js/web";import{delegateEvents as Yo}from"solid-js/web";import{setAttribute as Xo}from"solid-js/web";import{effect as Go}from"solid-js/web";import{insert as Jt}from"solid-js/web";import{createComponent as Zo}from"solid-js/web";import{For as tn}from"solid-js";var Qo=Vt("<div role=tablist class=context-sidebar__tablist>"),en=Vt("<button type=button role=tab class=context-sidebar__tab>");function Kt(e){let r=()=>{let t=e.items().map(n=>n.id),o=e.selectedToolId();return o&&t.includes(o)?o:t[0]};return(()=>{var t=Qo();return Jt(t,Zo(tn,{get each(){return e.items()},children:o=>(()=>{var n=en();return n.$$click=()=>e.setSelectedToolId(o.id),Jt(n,()=>o.name),Go(()=>Xo(n,"data-active",r()===o.id?"":void 0)),n})()})),t})()}Yo(["click"]);var nn=xe('<div class=context-sidebar__tabs><button type=button class=context-sidebar__close title="Hide context sidebar"aria-label="Hide context sidebar">'),an=xe("<div class=context-sidebar__content>"),sn=xe("<div class=context-sidebar>"),ln=xe("<patchwork-view>",!0,!1,!1),cn=xe('<svg xmlns=http://www.w3.org/2000/svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=var(--studio-chrome-line) stroke-width=1.75 stroke-linecap=round stroke-linejoin=round><rect width=18 height=18 x=3 y=3 rx=2></rect><path d="M15 3v18">');function Yt(e){let r=ae("context-tool"),t=()=>{let o=r().map(a=>a.id),n=e.selectedToolId();return n&&o.includes(n)?n:o[0]};return de(Bt,{side:"right",get isCollapsed(){return e.isCollapsed},get width(){return e.width},get onMouseDown(){return e.onMouseDown},get onToggleClick(){return e.onToggleClick},get canExpand(){return e.canExpand},get children(){var o=sn();return _e(o,de(et,{get when(){return r().length},get children(){var n=nn(),a=n.firstChild;return _e(n,de(Kt,{items:r,get selectedToolId(){return e.selectedToolId},get setSelectedToolId(){return e.setSelectedToolId}}),a),a.$$click=()=>e.onCollapse(),_e(a,de(tt,{})),n}}),null),_e(o,de(et,{get when(){return!e.isCollapsed()},get children(){var n=an();return _e(n,de(et,{get when(){return t()},keyed:!0,children:a=>(()=>{var i=ln();return i.component=a,i._$owner=on(),i})()})),n}}),null),o}})}function tt(){return cn()}rn(["click"]);import{template as dn}from"solid-js/web";import{effect as Xt}from"solid-js/web";import{getOwner as Gt}from"solid-js/web";import{createComponent as un}from"solid-js/web";import{memo as pn}from"solid-js/web";import{Show as hn}from"solid-js";var Zt=dn("<patchwork-view>",!0,!1,!1),rt=e=>Array.isArray(e)?String(e[0]):String(e);function Xl(e){let r=new Set;return e.filter(t=>{let o=rt(t);return r.has(o)?!1:(r.add(o),!0)})}function Gl(e){return un(hn,{get when(){return pn(()=>!!Array.isArray(e.slot))()?e.slot:!1},get fallback(){return(()=>{var r=Zt();return r._$owner=Gt(),Xt(()=>r.component=String(e.slot)),r})()},children:r=>(()=>{var t=Zt();return t._$owner=Gt(),Xt(o=>{var n=r()[1],a=r()[0];return n!==o.e&&(t.docUrl=o.e=n),a!==o.t&&(t.toolId=o.t=a),o},{e:void 0,t:void 0}),t})()})}var bn=ke("<div class=threepane__title>"),vn=ke("<div class=threepane__doctitle-tools>"),wn=ke('<button type=button class=frame__sidebar-toggle title="Show context sidebar"aria-label="Show context sidebar">'),yn=ke("<div class=frame__topbar><div class=threepane__spacer>"),_n=ke("<patchwork-view>",!0,!1,!1);function tr(e){let r=()=>e.toolSlots()??[];return(()=>{var t=yn(),o=t.firstChild;return ue(t,pe(ot,{get when(){return e.docUrl()},get children(){var n=bn();return ue(n,pe(jt,{get docUrl(){return e.docUrl}})),n}}),o),ue(t,pe(ot,{get when(){return er(()=>!!e.docUrl())()&&r().length},get children(){var n=vn();return ue(n,pe(xn,{get each(){return r()},children:a=>(()=>{var i=_n();return i._$owner=mn(),Qt(d=>{var l=rt(a),c=e.docUrl();return l!==d.e&&(i.toolId=d.e=l),c!==d.t&&(i.docUrl=d.t=c),d},{e:void 0,t:void 0}),i})()})),n}}),null),ue(t,pe(ot,{get when(){return er(()=>!!e.hasContext())()&&e.isRightCollapsed()},get children(){var n=wn();return n.$$click=()=>e.onToggleRight(),gn(n,"aria-pressed",!1),ue(n,pe(tt,{})),n}}),null),Qt(()=>t.classList.toggle("frame__topbar--left-collapsed",!!e.isLeftCollapsed())),t})()}fn(["click"]);import{template as Ve}from"solid-js/web";import{effect as Ar}from"solid-js/web";import{getOwner as Dr}from"solid-js/web";import{insert as Y}from"solid-js/web";import{createComponent as R}from"solid-js/web";import{memo as Se}from"solid-js/web";import{use as Ir}from"solid-js/web";import{parseAutomergeUrl as Wa}from"@automerge/automerge-repo/slim";import{getSuggestedImportUrl as Ha,getType as Na}from"@inkandswitch/patchwork-filesystem";import{getFallbackTool as qa,getRegistry as Ba}from"@inkandswitch/patchwork-plugins";import{createEffect as ut,createMemo as Je,createSignal as K,onCleanup as oe,onMount as Ja,Show as B}from"solid-js";import{template as C}from"solid-js/web";import{delegateEvents as sa}from"solid-js/web";import{setAttribute as Be}from"solid-js/web";import{effect as ct}from"solid-js/web";import"solid-js/web";import{createComponent as D}from"solid-js/web";import{insert as I}from"solid-js/web";import{use as la}from"solid-js/web";import{importPackage as Ra}from"@inkandswitch/patchwork-filesystem";import{registerPlugins as Fa}from"@inkandswitch/patchwork-plugins";import{createResource as Pa,createSignal as fe,onCleanup as lt,onMount as La,Show as q}from"solid-js";import{template as k}from"solid-js/web";import{delegateEvents as Dn}from"solid-js/web";import{effect as hr}from"solid-js/web";import{memo as In}from"solid-js/web";import{insert as v}from"solid-js/web";import{createComponent as x}from"solid-js/web";import{use as Rn}from"solid-js/web";import{setAttribute as Ce}from"solid-js/web";import{createResource as ta,createSignal as Ne,For as st,Match as he,onMount as ra,Show as z,Switch as cr}from"solid-js";import*as or from"@automerge/automerge/slim";import{getImportableUrlFromAutomergeUrl as kn}from"@inkandswitch/patchwork-filesystem";var nt=e=>e.startsWith("automerge:");function Cn(e){return e.replace(/[#?].*$/,"")}function nr(e){let r=e.split("#")[1];return r?r.split("|").filter(Boolean):[]}var N=e=>typeof e=="string"&&e.trim()?e.trim():void 0;function $n(e){if(typeof e=="string")return N(e);if(e&&typeof e=="object"){let{name:r,email:t}=e,o=N(r),n=N(t);return o&&n?`${o} <${n}>`:o??n}}function ar(e){if(!e||typeof e!="object")return{};let r=e,t=r.supportedDatatypes;return{id:N(r.id),name:N(r.name),type:N(r.type),supportedDatatypes:typeof t=="string"?[t]:Array.isArray(t)?t.filter(o=>typeof o=="string"):void 0}}async function rr(e){try{let r=await fetch(e);return r.ok?await r.json():void 0}catch{return}}var Sn=new Set(["dist","build","lib","out","esm","src","public"]);async function En(e){if(nt(e)){let o=kn(e);return rr(new URL("package.json",o).href)}let r;try{r=new URL(e)}catch{return}let t=r.pathname.split("/").filter(Boolean);for(/\.[a-z0-9]+$/i.test(t.at(-1)??"")&&t.pop();;){let o=`${r.origin}/${t.join("/")}${t.length?"/":""}`,n=await rr(new URL("package.json",o).href);if(n&&typeof n=="object")return n;if(!Sn.has(t.at(-1)?.toLowerCase()??""))return;t.pop()}}async function ir(e){let r=await En(e);if(r)return{name:N(r.name),title:N(r.title),version:N(r.version),description:N(r.description),author:$n(r.author),plugins:Array.isArray(r.plugins)?r.plugins.map(ar):void 0}}var He,Tn=1,re=new Map;function An(){if(He)return He;let e=new Worker("/module-loader-worker.js",{type:"module",name:"threepane-package-preview"});return e.addEventListener("message",r=>{let t=r.data,o=t&&re.get(t.id);o&&(re.delete(t.id),t.type==="descriptors"?o.resolve(t.descriptors.map(ar)):o.reject(new Error(t.error)))}),e.addEventListener("error",r=>{let t=new Error(`the background worker stopped: ${r.message??"no reason given"}`);for(let o of re.values())o.reject(t);re.clear(),He=void 0}),He=e,e}function sr(e,r=15e3){let t=Tn++;return new Promise((o,n)=>{let a=setTimeout(()=>{re.delete(t)&&n(new Error("it took too long to answer"))},r);re.set(t,{resolve:i=>{clearTimeout(a),o(i)},reject:i=>{clearTimeout(a),n(i)}});try{An().postMessage({type:"discover",id:t,url:e})}catch(i){clearTimeout(a),re.delete(t),n(i instanceof Error?i:new Error(String(i)))}})}async function lr(e,r){let t=await e.find(Cn(r)),o=t.doc();await new Promise(i=>setTimeout(i,0));let n=or.getChangesMetaSince(o,[]),a=new Map;for(let i of n){let d=i.time??0,l=a.get(i.actor);if(!l){a.set(i.actor,{actor:i.actor,changes:1,first:d,last:d});continue}l.changes++,d&&(!l.first||d<l.first)&&(l.first=d),d>l.last&&(l.last=d)}return{heads:[...t.heads()],changes:n.length,writers:[...a.values()].sort((i,d)=>d.changes-i.changes)}}var Fn=k("<button type=button class=doc-card__link>see package details"),Pn=k("<p class=pkg-about__quiet>reading\u2026"),Ln=k("<p class=pkg-about__quiet>no package.json."),Mn=k("<dl class=pkg-about__facts><dt>plugins</dt><dd>"),On=k("<dt>pinned"),it=k("<dd>"),at=k("<dt>history"),zn=k("<dd class=pkg-about__quiet>reading\u2026"),Un=k("<dd class=pkg-about__quiet>couldn't get its folder."),jn=k('<div class=pkg-about popover=auto><header class=pkg-about__header><h3 class=doc-card__rough></h3><button type=button class="doc-card__link pkg-about__close"popovertargetaction=hide aria-label=close>\xD7</button></header><section class="pkg-about__section pkg-about__section--claims"><h4>self-reported <span class=pkg-about__tag>unverified</span></h4></section><section class=pkg-about__section><h4>source</h4><dl class=pkg-about__facts><dt>url</dt><dd><code class="doc-card__code doc-card__url">'),Wn=k("<span class=pkg-about__version> "),Hn=k("<button type=button class=doc-card__link>"),Nn=k("<span class=pkg-about__quiet>unknown until loaded"),qn=k("<p class=doc-card__notice>"),Bn=k("<dt>heads"),Jn=k("<dd> <!>, <!> <p class=pkg-about__quiet>writers are devices, not people. folder only."),Vn=k("<dt>"),fr=k("<ul class=pkg-about__list>"),Kn=k("<span>nothing"),Yn=k("<span class=pkg-about__quiet> for "),Xn=k("<li>"),mr=k("<span class=pkg-about__quiet> \xB7 "),Gn=k("<span class=pkg-about__heads>"),Zn=k("<code class=doc-card__code>"),Qn=k("<li class=pkg-about__quiet>and <!> more"),ea=k("<li><code class=doc-card__code></code> <!> "),oa=0;function gr(e){let r=`pkg-about-${++oa}`,t=nt(e.url),o=nr(e.url),[n,a]=Ne(!1),[i]=ta(()=>n()&&t?e.url:void 0,f=>lr(e.repo,f)),[d,l]=Ne(!1),[c,s]=Ne(),[u,h]=Ne();async function b(){if(window.confirm(`Listing its plugins runs the package's code in a background worker.
2
+
3
+ ${e.url}
4
+
5
+ It can use the network and this site's stored data, including your documents. Only run it if you trust where it came from.
6
+
7
+ Run it?`)){h(void 0),l(!0);try{s(await sr(e.url))}catch(w){h(w?.message??String(w))}finally{l(!1)}}}let _;ra(()=>{_.addEventListener("toggle",f=>{f.newState==="open"&&a(!0)})});let m=()=>e.claims?.title??e.claims?.name??"package",p=()=>c()??e.claims?.plugins;return[(()=>{var f=Fn();return Ce(f,"popovertarget",r),f})(),(()=>{var f=jn(),w=f.firstChild,T=w.firstChild,F=T.nextSibling,M=w.nextSibling,j=M.firstChild,Q=M.nextSibling,O=Q.firstChild,J=O.nextSibling,ge=J.firstChild,be=ge.nextSibling,De=be.firstChild,X=_;return typeof X=="function"?Rn(X,f):_=f,Ce(f,"id",r),v(T,m,null),v(T,x(z,{get when(){return e.claims?.version},children:S=>(()=>{var $=Wn(),G=$.firstChild;return v($,S,null),$})()}),null),Ce(F,"popovertarget",r),v(M,x(cr,{get children(){return[x(he,{get when(){return e.claimsLoading},get children(){return Pn()}}),x(he,{get when(){return In(()=>!e.claims)()&&!c()},get children(){return Ln()}}),x(he,{when:!0,get children(){var S=Mn(),$=S.firstChild,G=$.nextSibling;return v(S,x(qe,{label:"name",get value(){return e.claims?.name}}),$),v(S,x(qe,{label:"title",get value(){return e.claims?.title}}),$),v(S,x(qe,{label:"author",get value(){return e.claims?.author}}),$),v(S,x(qe,{label:"description",get value(){return e.claims?.description}}),$),v(G,x(z,{get when(){return p()},get fallback(){return x(z,{when:t,get fallback(){return Nn()},get children(){var L=Hn();return L.$$click=()=>void b(),v(L,()=>d()?"listing\u2026":"list them"),hr(()=>L.disabled=d()),L}})},children:L=>x(na,{get plugins(){return L()}})}),null),v(G,x(z,{get when(){return u()},children:L=>(()=>{var g=qn();return v(g,L),g})()}),null),S}})]}}),null),v(De,()=>e.url),v(J,x(z,{get when(){return o.length},get children(){return[On(),(()=>{var S=it();return v(S,x(dr,{heads:o})),S})()]}}),null),v(J,x(z,{when:t,get children(){return x(cr,{get children(){return[x(he,{get when(){return i.loading},get children(){return[at(),zn()]}}),x(he,{get when(){return i.error},get children(){return[at(),Un()]}}),x(he,{get when(){return i()},children:S=>[Bn(),(()=>{var $=it();return v($,x(dr,{get heads(){return S().heads}})),$})(),at(),(()=>{var $=Jn(),G=$.firstChild,L=G.nextSibling,g=L.nextSibling,y=g.nextSibling,E=y.nextSibling,A=E.nextSibling;return v($,()=>S().changes,G),v($,()=>S().changes===1?"change":"changes",L),v($,()=>S().writers.length,y),v($,()=>S().writers.length===1?"writer":"writers",A),v($,x(aa,{get writers(){return S().writers}}),A),$})()]})]}})}}),null),f})()]}function qe(e){return x(z,{get when(){return e.value},get children(){return[(()=>{var r=Vn();return v(r,()=>e.label),r})(),(()=>{var r=it();return v(r,()=>e.value),r})()]}})}function na(e){return x(z,{get when(){return e.plugins.length},get fallback(){return Kn()},get children(){var r=fr();return v(r,x(st,{get each(){return e.plugins},children:t=>(()=>{var o=Xn();return v(o,()=>t.name??t.id??"(unnamed)",null),v(o,x(z,{get when(){return t.type},children:n=>(()=>{var a=mr(),i=a.firstChild;return v(a,n,null),a})()}),null),v(o,x(z,{get when(){return t.supportedDatatypes?.length},get children(){var n=Yn(),a=n.firstChild;return v(n,()=>t.supportedDatatypes.join(", "),null),n}}),null),o})()})),r}})}function dr(e){return(()=>{var r=Gn();return v(r,x(st,{get each(){return e.heads},children:t=>(()=>{var o=Zn();return Ce(o,"title",t),v(o,()=>t.slice(0,7)),o})()})),r})()}var ur=6;function aa(e){let r=()=>e.writers.length-ur;return(()=>{var t=fr();return v(t,x(st,{get each(){return e.writers.slice(0,ur)},children:o=>(()=>{var n=ea(),a=n.firstChild,i=a.nextSibling,d=i.nextSibling,l=d.nextSibling;return v(a,()=>o.actor.slice(0,8)),v(n,()=>o.changes,d),v(n,()=>o.changes===1?"change":"changes",null),v(n,x(z,{get when(){return o.last},get children(){var c=mr(),s=c.firstChild;return v(c,()=>ia(o),null),c}}),null),hr(()=>Ce(a,"title",o.actor)),n})()}),null),v(t,x(z,{get when(){return r()>0},get children(){var o=Qn(),n=o.firstChild,a=n.nextSibling,i=a.nextSibling;return v(o,r,a),o}}),null),t})()}function pr(e){return new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ia(e){let r=pr(e.last),t=e.first?pr(e.first):r;return t===r?r:`${t} \u2013 ${r}`}Dn(["click"]);var ca=C("<div class=doc-card><svg class=doc-card__defs aria-hidden=true><filter id=doc-card-rough><feTurbulence type=fractalNoise baseFrequency=0.04 numOctaves=2 seed=1></feTurbulence><feDisplacementMap in=SourceGraphic scale=1.4></feDisplacementMap></filter></svg><div class=doc-card__sheet><h2 class=doc-card__rough>"),da=C('<div class="doc-card doc-card--finding"role=status><span class=doc-card__dot></span><span class=doc-card__finding-label>finding this doc\u2026'),ua=C("<p>it's a <code class=doc-card__code></code>.<br>nothing here opens one yet."),pa=C("<p class=doc-card__links>"),ha=C("<p>it'll open here if a package adds a tool for it."),fa=C("<p>the doc suggests "),dt=C('<div class=doc-card__actions><button type=button class="doc-card__button doc-card__button--primary">'),ma=C("<strong class=pkg-line>"),ga=C("<span class=pkg-line__version> "),ba=C("<p class=doc-card__notice>couldn't load it: "),va=C("<button type=button class=doc-card__link>open doc with "),wa=C("<p>we couldn't get it from anywhere we looked.<br>that might mean:"),ya=C("<ul class=doc-card__reasons><li>the person who sent you the link hasn't given you access yet</li><li>it hasn't finished syncing from their device yet</li><li>something's wrong with the "),_a=C("<p>we'll keep looking. if it turns up, it'll open right here."),xa=C("<button type=button class=doc-card__sync>sync server"),ka=C("<span class=doc-card__sync-told role=status> (<!>)"),Ca=C("<p>found it, but it's private."),$a=C("<p>ask the owner to share it. if you're not in their phonebook, send them your card."),Sa=C("<p>it'll open right here once they do."),Ea=C("<p>the doc is here, but the tool that shows it didn't load."),Ta=C("<p class=doc-card__notice>"),Aa=C("<p>a bit of it got lost or changed on the way here, so it can't point at any doc. maybe a character dropped when it was copied, or the link got cut short."),Da=C("<p>if someone sent it to you, ask them for the link again."),Ia=C('<p class=doc-card__aside><code class="doc-card__code doc-card__url">');function $e(e){let r;return La(()=>{r.dispatchEvent(new CustomEvent("patchwork:no-tool",{bubbles:!0,composed:!0,detail:{url:e.url}}))}),(()=>{var t=ca(),o=t.firstChild,n=o.nextSibling,a=n.firstChild,i=r;return typeof i=="function"?la(i,t):r=t,I(a,()=>e.title),I(n,()=>e.children,null),t})()}function br(){return da()}function vr(e){let[r,t]=fe(!1),[o,n]=fe(),[a]=Pa(()=>e.suggestion,l=>ir(l).catch(()=>{}));async function i(l){if(window.confirm(`Load this package?
8
+
9
+ ${l}
10
+
11
+ Its code runs in this page and can read and change your documents. Only load it if you trust where it came from.`)){n(void 0),t(!0);try{let s=await Ra(l);if(!Array.isArray(s?.plugins))throw new Error("it doesn't export any plugins");Fa(s.plugins,l)}catch(s){console.error(`couldn't load the package at ${l}`,s),n(s?.message??String(s))}finally{t(!1)}}}let d=()=>{let l=a();return l&&(l.title||l.name)?l:void 0};return D($e,{get url(){return e.url},title:"no tool for this",get children(){return[(()=>{var l=ua(),c=l.firstChild,s=c.nextSibling;return I(s,()=>e.type),l})(),D(q,{get when(){return e.suggestion},get fallback(){return ha()},children:l=>[(()=>{var c=fa(),s=c.firstChild;return I(c,D(q,{get when(){return d()},fallback:"a package.",children:u=>[(()=>{var h=ma();return I(h,()=>u().title??u().name),h})(),D(q,{get when(){return u().version},children:h=>(()=>{var b=ga(),_=b.firstChild;return I(b,h,null),b})()}),"."]}),null),c})(),(()=>{var c=dt(),s=c.firstChild;return s.$$click=()=>void i(l()),I(s,()=>r()?"loading\u2026":"load package"),ct(()=>s.disabled=r()),c})(),D(q,{get when(){return o()},children:c=>(()=>{var s=ba(),u=s.firstChild;return I(s,c,null),s})()})]}),D(q,{get when(){return e.suggestion||e.anything},get children(){var l=pa();return I(l,D(q,{get when(){return e.suggestion},children:c=>D(gr,{get url(){return c()},get repo(){return e.repo},get claims(){return a()},get claimsLoading(){return a.loading}})}),null),I(l,D(q,{get when(){return e.anything},children:c=>(()=>{var s=va(),u=s.firstChild;return s.$$click=()=>e.onPeek(c().id),I(s,()=>c().name.toLowerCase(),null),s})()}),null),l}})]}})}function wr(e){let r=e.repo,t=typeof r.isSubductionConnected=="function",[o,n]=fe(t?r.isSubductionConnected():void 0),a=i=>{let d=o();n(i),i&&d===!1&&e.onRetry()};if(t&&r.on&&r.off){let i=d=>a(d.connected);r.on("subduction-connection",i),lt(()=>r.off("subduction-connection",i))}if(t){let i=setInterval(()=>a(r.isSubductionConnected()),2e3);lt(()=>clearInterval(i))}return D($e,{get url(){return e.url},title:"can't load this doc",get children(){return[wa(),(()=>{var i=ya(),d=i.firstChild,l=d.nextSibling,c=l.nextSibling,s=c.firstChild;return I(c,D(q,{get when(){return o()!==void 0},fallback:"sync server",get children(){return D(Ma,{get connected(){return o()}})}}),null),i})(),_a()]}})}function Ma(e){let[r,t]=fe(!1),o=()=>`sync server: ${e.connected?"connected":"disconnected"}`;return[(()=>{var n=xa();return n.$$click=()=>t(a=>!a),ct(a=>{var i=e.connected?"":void 0,d=o(),l=o(),c=r();return i!==a.e&&Be(n,"data-connected",a.e=i),d!==a.t&&Be(n,"title",a.t=d),l!==a.a&&Be(n,"aria-label",a.a=l),c!==a.o&&Be(n,"aria-expanded",a.o=c),a},{e:void 0,t:void 0,a:void 0,o:void 0}),n})(),D(q,{get when(){return r()},get children(){var n=ka(),a=n.firstChild,i=a.nextSibling,d=i.nextSibling;return I(n,()=>e.connected?"connected":"disconnected",i),n}})]}function yr(e){let[r,t]=fe(!1),o;lt(()=>clearTimeout(o));let n=async()=>{e.card&&(await navigator.clipboard.writeText(e.card),t(!0),clearTimeout(o),o=setTimeout(()=>t(!1),1500))};return D($e,{get url(){return e.url},title:"not shared with you yet",get children(){return[Ca(),$a(),Sa(),D(q,{get when(){return e.card},get children(){var a=dt(),i=a.firstChild;return i.$$click=()=>void n(),I(i,()=>r()?"copied":"copy my card"),a}})]}})}function _r(e){let[r,t]=fe(!1),o=async()=>{t(!0);try{await e.onRetry()}finally{t(!1)}};return D($e,{get url(){return e.url},get title(){return`can't load ${e.name}`},get children(){return[Ea(),(()=>{var n=Ta();return I(n,()=>e.error),n})(),(()=>{var n=dt(),a=n.firstChild;return a.$$click=()=>void o(),I(a,()=>r()?"trying\u2026":"try again"),ct(()=>a.disabled=r()),n})()]}})}function xr(e){return D($e,{get url(){return e.url},title:"this link is broken",get children(){return[Aa(),Da(),(()=>{var r=Ia(),t=r.firstChild;return I(t,()=>e.url),r})()]}})}sa(["click"]);import*as Cr from"@inkandswitch/patchwork-elements";import{isKeyhiveDoc as Oa}from"@inkandswitch/patchwork-plugins";var kr=Cr.hasActiveAccess,$r=()=>globalThis.hive;async function Sr(e,r){if(Oa(r))try{if(kr)return await kr(e,r);let t=e.active.individual.id;return!!(e.bestAccessForDoc?await e.bestAccessForDoc(t,r):await e.accessForDoc(t,r))}catch{return}}function Er(e,r){return e.networkAdapter?.on("ingest-remote",r),()=>e.networkAdapter?.off("ingest-remote",r)}function Tr(e){try{let r="";for(let t of e.active.contactCard.toBytes())r+=String.fromCharCode(t);return btoa(r)}catch{return}}var za=Ve("<div class=document-view>"),Rr=Ve("<patchwork-view>",!0,!1,!1),Ua=Ve("<div class=placeholder>Select a document in the sidebar"),ja=Ve("<div class=doc-stack>"),Va=5e3;function Fr({viewKey:e,selectedDocUrl:r,toolId:t,ref:o}){let n,[a,i]=K();return Ja(()=>{i(n.closest("repo-provider")?.repo??null)}),(()=>{var d=za();return Ir(l=>{n=l,o?.(l)},d),Y(d,R(B,{get when(){return Se(()=>a()!==void 0)()&&e()},keyed:!0,children:l=>R(B,{get when(){return a()},get fallback(){return(()=>{var c=Rr();return c._$owner=Dr(),Ar(s=>{var u=r(),h=t();return u!==s.e&&(c.docUrl=s.e=u),h!==s.t&&(c.toolId=s.t=h),s},{e:void 0,t:void 0}),c})()},children:c=>R(Ka,{get url(){return r()},toolId:t,get repo(){return c()}})})}),null),Y(d,(()=>{var l=Se(()=>!r());return()=>l()&&Ua()})(),null),d})()}function Ka(e){let r=Ba("patchwork:tool"),[t,o]=K(0);oe(r.on("changed",()=>{o(g=>g+1)}));let[n,a]=K({state:"finding"}),[i,d]=K(),l=()=>e.toolId()??i(),[c,s]=K(!1),[u,h]=K(0),b=!1;oe(()=>b=!0);async function _(){try{let g=await e.repo.find(e.url);if(b)return;let y=n().state==="unavailable";a({state:"ready",doc:g.doc()}),y&&!c()&&h(E=>E+1)}catch(g){if(b)return;let y=Xa(g);a({state:y?"invalid":"unavailable"}),y||p(E=>E+1)}}let[m,p]=K(0),f,w;function T(){w?.(),f=Ya(e.repo,e.url),w=f?.subscribe(g=>{g.state==="ready"&&n().state==="unavailable"&&_()})}oe(()=>w?.()),_(),T();function F(){let g=e.repo;if(typeof g.resyncSubduction=="function")try{g.resyncSubduction(Wa(e.url).documentId)}catch{}}let M;oe(()=>clearTimeout(M));function j(g=1e3){F(),clearTimeout(M),M=setTimeout(()=>void _(),g)}ut(()=>{let g=m();g===0||n().state!=="unavailable"||c()||(j(Math.min(3e4,3e3*2**(g-1))),oe(()=>clearTimeout(M)))});let Q=Je(()=>{t();let g=n();if(g.state!=="ready")return g;let y=g.doc,E=y?Na(y):void 0;if(!E)return{state:"open",toolId:void 0};let A=l(),H;if(!A){let W=Pr(()=>qa(y));W&&Ga(W.supportedDatatypes,E)?H={id:W.id,name:W.name}:W&&(A=W.id)}return A&&r.get(A)?{state:"open",toolId:A}:{state:"no-tool",type:E,suggestion:Ha(y),anything:H}}),O=Je(()=>Q().state),J=Je(()=>{let g=Q();return g.state==="open"?g.toolId:void 0}),[ge,be]=K();async function De(g){try{return await r.load(g),J()===g&&be(void 0),!0}catch(y){return J()===g&&be({id:g,message:y instanceof Error?y.message:String(y)}),!1}}ut(()=>{let g=J();be(void 0),g&&De(g)});let X=$r(),[S,$]=K();ut(()=>{if(!X||O()!=="open"){$(void 0);return}let g=e.url,y=!0,E=()=>void Sr(X,g).then(W=>{y&&$(W)});E();let A=Er(X,E),H=setInterval(()=>{S()===!1&&E()},Va);oe(()=>{y=!1,A(),clearInterval(H)})});async function G(){let g=ge()?.id;g&&await De(g)&&h(y=>y+1)}let L=Je(()=>{let g=Q();return g.state==="no-tool"?g:void 0});return(()=>{var g=ja();return Ir(y=>{let E=A=>{let H=A.detail;H?.url&&H.url!==e.url||(s(!0),n().state==="unavailable"&&_())};y.addEventListener("patchwork:mounted",E),oe(()=>y.removeEventListener("patchwork:mounted",E))},g),Y(g,R(B,{get when(){return Se(()=>O()==="open")()&&!ge()||O()==="unavailable"},get children(){return R(B,{get when(){return u()+1},keyed:!0,children:y=>(()=>{var E=Rr();return E._$owner=Dr(),Ar(A=>{var H=e.url,W=l();return H!==A.e&&(E.docUrl=A.e=H),W!==A.t&&(E.toolId=A.t=W),A},{e:void 0,t:void 0}),E})()})}}),null),Y(g,R(B,{get when(){return O()==="finding"},get children(){return R(br,{})}}),null),Y(g,R(B,{get when(){return Se(()=>O()==="open")()&&S()===!1},get children(){return R(yr,{get url(){return e.url},get card(){return X&&Tr(X)}})}}),null),Y(g,R(B,{get when(){return ge()},children:y=>R(_r,{get url(){return e.url},get name(){return r.get(y().id)?.name??y().id},get error(){return y().message},onRetry:G})}),null),Y(g,R(B,{get when(){return O()==="invalid"},get children(){return R(xr,{get url(){return e.url}})}}),null),Y(g,R(B,{get when(){return Se(()=>O()==="unavailable")()&&!c()},get children(){return R(wr,{get url(){return e.url},get repo(){return e.repo},onRetry:j})}}),null),Y(g,R(B,{get when(){return L()},children:y=>R(vr,{get url(){return e.url},get type(){return y().type},get suggestion(){return y().suggestion},get anything(){return y().anything},onPeek:d,get repo(){return e.repo}})}),null),g})()}function Ya(e,r){let t=e.findWithProgress;if(typeof t=="function")return Pr(()=>{let o=t.call(e,r);return typeof o?.subscribe=="function"&&typeof o?.peek=="function"?o:void 0})}function Xa(e){let r=e?.message??String(e);return/invalid (automergeurl|document url|documentid|document id)/i.test(r)}function Ga(e,r){let t=e==="*"?["*"]:e??[];return t.includes("*")&&!t.includes(r)}function Pr(e){try{return e()}catch{return}}var Za=Ae("<patchwork-view component=patchwork-draft-state-provider>",!0,!1,!1),Qa=Ae("<patchwork-view component=patchwork-draft-overlay-provider>",!0,!1,!1),ei=Ae("<div class=frame__main-column><div class=frame__doc-column><div class=main-area>"),ti=Ae("<patchwork-view component=patchwork-comments-provider><patchwork-view component=patchwork-focus-provider>",!0,!1,!1),ri=Ae("<patchwork-view>",!0,!1,!1);function Or(e){let[r,t]=Z(e.initialRightCollapsed()),[o,n]=Z(e.initialRightWidth());Lr(Mr(r,h=>{try{localStorage.setItem(V.rightCollapsed,String(h))}catch{}},{defer:!0})),Lr(Mr(o,h=>{try{localStorage.setItem(V.rightWidth,String(h))}catch{}},{defer:!0}));let a=Ge("right",{isCollapsed:r,setCollapsed:t,setWidth:n});ni(()=>{let h=()=>t(!0);window.addEventListener(Ie,h),oi(()=>window.removeEventListener(Ie,h))});let[i,d]=Xe(Z(),{name:V.contextToolId}),[l,c]=Z(),s=ee("patchwork-draft-state-provider",l),u=()=>s()?l():void 0;return U(me,{get when(){return e.selectedDocUrl()},keyed:!0,children:h=>(()=>{var b=Za();return Te(c,b),b.docUrl=h,b._$owner=Ee(),ne(b,U(me,{get when(){return u()},children:_=>U(ai,{get host(){return _()},get setMainDocElement(){return e.setMainDocElement},get selectedDocUrl(){return e.selectedDocUrl},get selectedToolId(){return e.selectedToolId},get doctitleSlots(){return e.doctitleSlots},get isLeftCollapsed(){return e.isLeftCollapsed},isRightSidebarCollapsed:r,setIsRightSidebarCollapsed:t,rightSidebarWidth:o,get handleMouseDown(){return a.handleMouseDown},get handleToggleClick(){return a.handleToggleClick},selectedContextToolId:i,setSelectedContextToolId:d})})),b})()})}function ai(e){let r=ae("context-tool"),t=()=>r().length>0,o=pt(()=>e.selectedDocUrl()),[n,a]=Z(),i=ee("patchwork-draft-overlay-provider",n),[d,l]=Z(),c=ee("patchwork-comments-provider",d),[s,u]=Z(),h=ee("patchwork-focus-provider",s),b=pt(()=>i()&&c()&&h()),_=ae("document-provider"),m=pt(()=>_().map(p=>p.id),[],{equals:(p,f)=>p.length===f.length&&p.every((w,T)=>w===f[T])});return(()=>{var p=Qa();return Te(a,p),p._$owner=Ee(),ne(p,U(zr,{get ids(){return m()},render:()=>(()=>{var f=ti(),w=f.firstChild;return Te(l,f),f._$owner=Ee(),Te(u,w),w._$owner=Ee(),ne(w,U(me,{get when(){return b()},get children(){var T=ei(),F=T.firstChild,M=F.firstChild;return ne(F,U(tr,{get docUrl(){return e.selectedDocUrl},get toolSlots(){return e.doctitleSlots},get isLeftCollapsed(){return e.isLeftCollapsed},hasContext:t,get isRightCollapsed(){return e.isRightSidebarCollapsed},onToggleRight:()=>e.setIsRightSidebarCollapsed(j=>!j)}),M),ne(M,U(Fr,{viewKey:o,get selectedDocUrl(){return e.selectedDocUrl},get toolId(){return e.selectedToolId},ref:j=>e.setMainDocElement?.(j)})),ne(T,U(me,{get when(){return t()},get children(){return U(Yt,{get selectedToolId(){return e.selectedContextToolId},get setSelectedToolId(){return e.setSelectedContextToolId},get isCollapsed(){return e.isRightSidebarCollapsed},get width(){return e.rightSidebarWidth},get onMouseDown(){return e.handleMouseDown},get onToggleClick(){return e.handleToggleClick},onCollapse:()=>e.setIsRightSidebarCollapsed(!0)})}}),null),T}})),f})()})),p})()}function zr(e){return U(me,{get when(){return e.ids[0]},keyed:!0,get fallback(){return e.render()},children:r=>{let[t,o]=Z(),n=ee(r,t);return(()=>{var a=ri();return Te(o,a),a.component=r,a._$owner=Ee(),ne(a,U(me,{get when(){return n()},get children(){return U(zr,{get ids(){return e.ids.slice(1)},get render(){return e.render}})}})),a})()}})}var Ke=`:root,
12
+ :host,
13
+ [theme] {
14
+ --threepane-bg: var(--studio-fill, white);
15
+ --threepane-sidebar-fill: var(--studio-chrome, var(--studio-fill, white));
16
+ --threepane-fg: var(--studio-line, black);
17
+ /* ink for text sitting ON the sidebar/account-bar chrome surface. mirrors the
18
+ toolbar/context-sidebar fg: it rides --studio-chrome-line (the chrome's own
19
+ ink) so it tracks the chrome palette, not the content page. --threepane-fg
20
+ is content ink and only belongs on --threepane-bg surfaces. */
21
+ --threepane-sidebar-fg: var(--studio-chrome-line, var(--studio-line, black));
22
+ --threepane-muted: var(--studio-line-offset-50, #999);
23
+ --threepane-family: var(--studio-family-sans, system-ui, sans-serif);
24
+ --threepane-family-code: var(--studio-family-code, ui-monospace, monospace);
25
+
26
+ /* spacing scale, aliased from the base theme */
27
+ --threepane-space-3xs: var(--studio-space-3xs, 0.125rem);
28
+ --threepane-space-2xs: var(--studio-space-2xs, 0.25rem);
29
+ --threepane-space-xs: var(--studio-space-xs, 0.375rem);
30
+ --threepane-space-sm: var(--studio-space-sm, 0.5rem);
31
+ --threepane-space: var(--studio-space, 0.75rem);
32
+ --threepane-space-md: var(--studio-space-md, 1rem);
33
+ --threepane-space-2xl: var(--studio-space-2xl, 3rem);
34
+
35
+ /* radius scale, aliased from the base theme */
36
+ --threepane-radius-xs: var(--studio-radius-xs, 2px);
37
+ --threepane-radius-sm: var(--studio-radius-sm, 4px);
38
+ --threepane-radius-md: var(--studio-radius-md, 8px);
39
+ --threepane-radius-round: var(--studio-radius-round, 9999px);
40
+
41
+ /* Height of the frame's top strip: the top bar over the main column, and the
42
+ matching empty space reserved above the left sidebar's widgets so the two
43
+ line up and the left toggle has a home. */
44
+ --threepane-header-height: calc(
45
+ env(safe-area-inset-top, 0px) + var(--threepane-space-2xl)
46
+ );
47
+
48
+ /* the left footer and right tray boxes share one height so they line up. */
49
+ --threepane-tray-height: var(--threepane-space-2xl);
50
+ /* sidebar toggles ride a touch paler than the line (first ink offset). they
51
+ sit on chrome (left toggle over the sidebar, right over the toolbar), so
52
+ they use the chrome ink ramp, not the content one. */
53
+ --threepane-toggle-fg: var(--studio-chrome-line-offset-10, var(--studio-line-offset-10, #333));
54
+
55
+ --threepane-toolbar: var(--studio-chrome, white);
56
+ /* toolbar text rides on the chrome surface, so it uses the chrome ink */
57
+ --threepane-toolbar-fg: var(--studio-chrome-line, var(--studio-line, black));
58
+ --threepane-toolbar-border: var(--studio-chrome-offset-10, #ddd);
59
+ /* Resize handle: a faint 1px divider that tracks the chrome ramp's contrast
60
+ (it mixes toward the chrome ink, so it reads darker on light themes and
61
+ lighter on dark ones), plus a primary-tinted glow + grab pill on hover. */
62
+ --threepane-sidebar-divider: var(--studio-chrome-offset-20, #d4d4d4);
63
+ --threepane-resize-glow: color-mix(in oklch, var(--studio-primary-fill, var(--studio-primary, #35f7ca)), transparent 35%);
64
+ --threepane-resize-pill: var(--studio-primary-fill, var(--studio-primary, #35f7ca));
65
+
66
+ /* The context (right) sidebar sits on a chrome surface stepped one offset off
67
+ the toolbar's flat chrome, so the two chrome regions read as distinct. */
68
+ --threepane-context-sidebar-fill: var(--studio-chrome-offset-10, #ececec);
69
+
70
+ /* Context sidebar (tabbed) */
71
+ --context-sidebar-bg: var(--threepane-context-sidebar-fill);
72
+ /* the tab-bar header rides on the same flat chrome as the toolbar above it,
73
+ so the two chrome strips read as one continuous band */
74
+ --context-sidebar-header-bg: var(--studio-chrome, #f2f2f2);
75
+ --context-sidebar-fg: var(--studio-chrome-line, var(--studio-line, black));
76
+ /* match the lines drawn around the document-view so tab/tray edges read as
77
+ one continuous frame */
78
+ --context-sidebar-border: var(--threepane-toolbar-border);
79
+ --context-sidebar-tab-fg: var(--studio-chrome-line-offset-40, var(--studio-line-offset-40, #666));
80
+ --context-sidebar-tab-hover: var(--studio-chrome-offset-10, #e5e5e5);
81
+ --context-sidebar-tab-active-bg: var(--studio-fill, white);
82
+ --context-sidebar-tab-active-fg: var(--studio-line, black);
83
+ --context-sidebar-tab-active-accent: var(--studio-primary-line, var(--studio-primary, #35f7ca));
84
+ /* the content panel shares the active tab's surface so the selected tab
85
+ connects seamlessly into the tool view below it */
86
+ --context-sidebar-content-bg: var(--context-sidebar-tab-active-bg);
87
+ --context-sidebar-family: var(--studio-family-sans, system-ui, sans-serif);
88
+ }
89
+
90
+ .frame-shell {
91
+ display: flex;
92
+ flex-direction: column;
93
+ width: 100%;
94
+ height: 100%;
95
+ }
96
+
97
+ .frame-warning-banner {
98
+ flex: none;
99
+ padding: var(--threepane-space-2xs) var(--threepane-space-sm);
100
+ text-align: center;
101
+ text-transform: uppercase;
102
+ font-family: var(--studio-family-ui, var(--threepane-family));
103
+ font-size: 0.75rem;
104
+ background: var(--studio-warning-fill, yellow);
105
+ color: var(--studio-warning-line);
106
+ }
107
+
108
+ .frame {
109
+ position: relative;
110
+ display: flex;
111
+ width: 100%;
112
+ flex: 1;
113
+ min-height: 0;
114
+ font-family: var(--threepane-family);
115
+ color: var(--threepane-fg);
116
+ background: var(--threepane-bg);
117
+ }
118
+
119
+ .frame__version {
120
+ position: absolute;
121
+ top: var(--threepane-space-2xs);
122
+ right: var(--threepane-space-sm);
123
+ z-index: var(--studio-layer-raised, 10);
124
+ color: var(--threepane-muted);
125
+ font-size: 0.75rem;
126
+ font-weight: 500;
127
+ pointer-events: none;
128
+ user-select: none;
129
+ }
130
+
131
+ .sidebar {
132
+ position: relative;
133
+ display: flex;
134
+ flex: none;
135
+ /* visible so the resize handle can straddle the boundary (sit on *both*
136
+ sides of the divider line); the content clips itself instead. z-index lifts
137
+ the handle's outer half above the main area so it stays grabbable. */
138
+ overflow: visible;
139
+ z-index: 1;
140
+ }
141
+
142
+ .sidebar[data-collapsed] {
143
+ overflow: visible;
144
+ }
145
+
146
+ .sidebar[data-side="left"] {
147
+ background: var(--threepane-sidebar-fill);
148
+ color: var(--threepane-sidebar-fg);
149
+ }
150
+
151
+ .sidebar[data-side="right"] {
152
+ background: var(--threepane-context-sidebar-fill);
153
+ }
154
+
155
+ .main-area {
156
+ flex: 1;
157
+ min-width: 0;
158
+ display: flex;
159
+ flex-direction: column;
160
+ height: 100%;
161
+ overflow: hidden;
162
+ }
163
+
164
+ /* The main column (right of the left sidebar): a row of
165
+ [document column | right sidebar], so the right sidebar spans the full frame
166
+ height and its resize divider runs top-to-bottom exactly like the left one. */
167
+ .frame__main-column {
168
+ position: relative;
169
+ flex: 1;
170
+ min-width: 0;
171
+ display: flex;
172
+ flex-direction: row;
173
+ height: 100%;
174
+ overflow: hidden;
175
+ }
176
+
177
+ /* The document column: the top bar over the main document view. Sits left of the
178
+ full-height context sidebar. */
179
+ .frame__doc-column {
180
+ flex: 1;
181
+ min-width: 0;
182
+ width: 100%;
183
+ display: flex;
184
+ flex-direction: column;
185
+ height: 100%;
186
+ overflow: hidden;
187
+ }
188
+
189
+ .frame__doc-column > patchwork-view,
190
+ .frame__doc-column > patchwork-view > patchwork-view,
191
+ .frame__doc-column > patchwork-view > patchwork-view > patchwork-view,
192
+ .frame__doc-column
193
+ > patchwork-view
194
+ > patchwork-view
195
+ > patchwork-view
196
+ > patchwork-view {
197
+ display: contents;
198
+ }
199
+
200
+ /* The full-width top toolbar. Its height + top safe-area inset match the
201
+ sideboard's reserved top margin so the bar reads as continuous across the top
202
+ (the left sidebar's empty top region lines up with it). */
203
+ .frame__topbar {
204
+ display: flex;
205
+ align-items: stretch;
206
+ box-sizing: border-box;
207
+ min-height: var(--threepane-space-2xl);
208
+ padding-top: env(safe-area-inset-top, 0px);
209
+ padding-inline: var(--threepane-space-2xs);
210
+ gap: var(--threepane-space-2xs);
211
+ background: var(--threepane-toolbar);
212
+ color: var(--threepane-toolbar-fg);
213
+ /* A hairline along the bottom, in the same colour as the document-view's
214
+ border, so the line under the bar runs unbroken across the whole width
215
+ (document column + context tabs). The active tab pulls down 1px to break
216
+ through it and connect to its panel below. */
217
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
218
+ /* Animate the collapsed left-slot in step with the sidebar's width transition
219
+ so the title glides up against the pinned toggle instead of jumping. */
220
+ transition: padding-left var(--studio-transition-slow, 0.25s ease);
221
+ }
222
+
223
+ /* When the left sidebar is collapsed the bar's left edge reaches the frame edge,
224
+ where the pinned left toggle lives; reserve a matching slot so the title slides
225
+ up against the toggle rather than under it. */
226
+ .frame__topbar--left-collapsed {
227
+ padding-left: var(--threepane-space-2xl);
228
+ }
229
+
230
+ /* The left sidebar toggle, pinned to the frame's top-left corner so it keeps the
231
+ same spot whether the sidebar is open or closed. Square, filling the top strip;
232
+ sits over the sidebar's reserved (empty) top area when open. */
233
+ .frame__left-toggle {
234
+ position: absolute;
235
+ top: 0;
236
+ left: 0;
237
+ z-index: 5;
238
+ width: var(--threepane-space-2xl);
239
+ height: var(--threepane-header-height);
240
+ padding-top: env(safe-area-inset-top, 0px);
241
+ }
242
+
243
+ /* A sidebar toggle at either end of the top bar (always present). */
244
+ .frame__sidebar-toggle {
245
+ display: flex;
246
+ align-items: center;
247
+ justify-content: center;
248
+ flex-shrink: 0;
249
+ padding-inline: var(--threepane-space-sm);
250
+ border: none;
251
+ background: transparent;
252
+ color: var(--threepane-toggle-fg);
253
+ cursor: var(--studio-cursor-pointer, pointer);
254
+ transition: color var(--studio-transition-fast, 0.1s ease);
255
+ }
256
+
257
+ .frame__sidebar-toggle:hover {
258
+ color: var(--threepane-sidebar-fg);
259
+ }
260
+
261
+ /* The document title, rendered intrinsically: shrinks to the title's width but
262
+ never past half the bar; ellipsis beyond. */
263
+ .threepane__title {
264
+ display: flex;
265
+ align-items: center;
266
+ flex: 0 1 auto;
267
+ min-width: 0;
268
+ max-width: 50%;
269
+ overflow: hidden;
270
+ padding-inline: var(--threepane-space-sm);
271
+ }
272
+
273
+ .threepane__title-text {
274
+ font-weight: 600;
275
+ white-space: nowrap;
276
+ min-width: 0;
277
+ overflow: hidden;
278
+ text-overflow: ellipsis;
279
+ }
280
+
281
+ .threepane__title-text--editable {
282
+ cursor: var(--studio-cursor-text, text);
283
+ }
284
+
285
+ .threepane__title-text--editable:hover {
286
+ opacity: 0.7;
287
+ }
288
+
289
+ .threepane__title-input {
290
+ font: inherit;
291
+ font-weight: 600;
292
+ color: inherit;
293
+ min-width: 0;
294
+ width: 100%;
295
+ padding: 0;
296
+ margin: 0;
297
+ border: none;
298
+ outline: none;
299
+ background: transparent;
300
+ }
301
+
302
+ /* built-in spacer between the title and the right-hand tools */
303
+ .threepane__spacer {
304
+ flex: 1;
305
+ min-width: var(--threepane-space-sm);
306
+ }
307
+
308
+ /* configured doctitle tools at the right end; scroll horizontally when they
309
+ overflow rather than squashing. */
310
+ .threepane__doctitle-tools {
311
+ display: flex;
312
+ align-items: center;
313
+ gap: var(--threepane-space-sm);
314
+ min-width: 0;
315
+ padding-inline: var(--threepane-space-sm);
316
+ overflow-x: auto;
317
+ overflow-y: hidden;
318
+ scrollbar-width: none;
319
+ }
320
+
321
+ .threepane__doctitle-tools::-webkit-scrollbar {
322
+ display: none;
323
+ }
324
+
325
+ .threepane__doctitle-tools patchwork-view {
326
+ display: flex;
327
+ align-items: center;
328
+ height: 2rem;
329
+ flex-shrink: 0;
330
+ width: auto;
331
+ }
332
+
333
+ .document-view {
334
+ flex: 1;
335
+ min-height: 0;
336
+ overflow: hidden;
337
+ /* Left divider only, square corners. The top line is the top bar's
338
+ border-bottom and the bottom is open to the frame edge. The right divider
339
+ (to the context sidebar) is the sidebar's own full-height border-left, so
340
+ it runs the whole frame height rather than just the document view. When the
341
+ left sidebar is collapsed the left divider is dropped (see the :has rule
342
+ below) so nothing rides the frame edge. */
343
+ border-left: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
344
+ }
345
+
346
+ /* Left sidebar collapsed to 0: drop the document-view's left divider so there's
347
+ no stray line hugging the frame's left edge. */
348
+ .frame:has(.sidebar[data-side="left"][data-collapsed]) .document-view {
349
+ border-left: none;
350
+ }
351
+
352
+ .document-view patchwork-view {
353
+ display: block;
354
+ width: 100%;
355
+ height: 100%;
356
+ }
357
+
358
+ .placeholder {
359
+ display: flex;
360
+ align-items: center;
361
+ justify-content: center;
362
+ height: 100%;
363
+ color: var(--threepane-fg);
364
+ }
365
+
366
+ /* the main doc, and what's said in its place when it can't be shown. the
367
+ cards lie over the patchwork-view (which may still be recovering) */
368
+ .doc-stack {
369
+ position: relative;
370
+ width: 100%;
371
+ height: 100%;
372
+ }
373
+
374
+ /* a card in place of a doc: the sheet lattice and knit draw, in the theme's
375
+ colours, with its serif drawn a little by hand (but holding still) */
376
+ .doc-card {
377
+ --doc-card-ink: var(--studio-line, #1c1a17);
378
+ --doc-card-muted: var(--studio-line-offset-50, color-mix(in oklab, var(--doc-card-ink) 55%, transparent));
379
+ --doc-card-line: var(--studio-chrome-line, var(--doc-card-ink));
380
+ --doc-card-sheet: var(--editor-fill, var(--text-editor-fill, var(--studio-fill, #fffdf5)));
381
+ --doc-card-highlighter: var(--studio-selection-fill, #ffee8888);
382
+ --doc-card-accent: var(--studio-primary-fill, var(--studio-primary, #ff2284));
383
+ --doc-card-accent-ink: var(--studio-primary-line, #fff);
384
+ --doc-card-danger: var(--studio-danger-text, var(--studio-danger, #d33a4c));
385
+ --doc-card-good: var(--studio-added, #40dcba);
386
+ --doc-card-radius: var(--studio-radius-sm, 3px);
387
+ --doc-card-serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
388
+ --doc-card-mono: var(--studio-family-code, Monaco, ui-monospace, monospace);
389
+
390
+ position: absolute;
391
+ inset: 0;
392
+ z-index: 1;
393
+ display: grid;
394
+ box-sizing: border-box;
395
+ place-items: center;
396
+ overflow: auto;
397
+ padding: 16px;
398
+ background: var(--threepane-bg);
399
+ color: var(--doc-card-ink);
400
+ font-family: var(--studio-family-ui, var(--threepane-family));
401
+ /* a doc that's only slow shouldn't flash a card on its way in */
402
+ animation: doc-card-in var(--studio-duration-slow, 0.3s) ease 0.4s both;
403
+ }
404
+
405
+ @keyframes doc-card-in {
406
+ from { opacity: 0; }
407
+ }
408
+
409
+ @media (prefers-reduced-motion: reduce) {
410
+ .doc-card {
411
+ animation-duration: 0.01s;
412
+ }
413
+ }
414
+
415
+ .doc-card__defs {
416
+ position: absolute;
417
+ width: 0;
418
+ height: 0;
419
+ }
420
+
421
+ .doc-card__sheet {
422
+ box-sizing: border-box;
423
+ max-width: 440px;
424
+ padding: 24px 28px 20px;
425
+ border: 1px solid var(--doc-card-line);
426
+ border-radius: 0.5em;
427
+ background: var(--doc-card-sheet);
428
+ box-shadow: 0 0 10px 2px #66003322;
429
+ text-align: center;
430
+
431
+ & p {
432
+ margin: 0 0 12px;
433
+ color: var(--doc-card-muted);
434
+ }
435
+ }
436
+
437
+ .doc-card__rough {
438
+ margin: 0 0 6px;
439
+ font: 400 28px/1.1 var(--doc-card-serif);
440
+ filter: url(#doc-card-rough);
441
+ }
442
+
443
+ .doc-card__code {
444
+ padding: 1px 5px;
445
+ border-radius: var(--doc-card-radius);
446
+ background: var(--doc-card-highlighter);
447
+ color: var(--doc-card-ink);
448
+ font: 11px var(--doc-card-mono);
449
+ }
450
+
451
+ .doc-card__url {
452
+ display: inline-block;
453
+ max-width: 100%;
454
+ margin-top: 4px;
455
+ overflow-wrap: anywhere;
456
+ }
457
+
458
+ .doc-card__reasons {
459
+ margin: 0 0 12px;
460
+ padding: 0 0 0 1.2em;
461
+ color: var(--doc-card-muted);
462
+ text-align: left;
463
+
464
+ & li + li {
465
+ margin-top: 4px;
466
+ }
467
+ }
468
+
469
+ /* how the sync server looks from here */
470
+ /* "sync server", in the colour of the connection as it stands. a button, so
471
+ a tap can say which on a phone, where a title never shows */
472
+ .doc-card__sync {
473
+ padding: 0;
474
+ border: none;
475
+ background: none;
476
+ color: var(--doc-card-danger);
477
+ font: inherit;
478
+ text-decoration: underline dotted;
479
+ text-underline-offset: 3px;
480
+ cursor: help;
481
+
482
+ &[data-connected] {
483
+ color: var(--doc-card-good);
484
+ }
485
+ }
486
+
487
+ .doc-card__sync-told {
488
+ color: var(--doc-card-ink);
489
+ }
490
+
491
+ .doc-card__actions {
492
+ display: flex;
493
+ justify-content: center;
494
+ gap: 8px;
495
+ margin: 0 0 12px;
496
+ }
497
+
498
+ .doc-card__button {
499
+ padding: 2px 10px;
500
+ border: 1px solid var(--doc-card-line);
501
+ border-radius: 2px;
502
+ background: var(--doc-card-sheet);
503
+ box-shadow: 1px 1px 0 var(--doc-card-line);
504
+ color: inherit;
505
+ font: inherit;
506
+ cursor: pointer;
507
+
508
+ &:hover:not(:disabled) {
509
+ translate: -1px -1px;
510
+ box-shadow: 2px 2px 0 var(--doc-card-line);
511
+ }
512
+
513
+ &:active:not(:disabled) {
514
+ translate: 1px 1px;
515
+ box-shadow: none;
516
+ }
517
+
518
+ &:disabled {
519
+ cursor: progress;
520
+ opacity: 0.7;
521
+ }
522
+ }
523
+
524
+ .doc-card__button--primary {
525
+ min-width: 5em;
526
+ background: var(--doc-card-accent);
527
+ color: var(--doc-card-accent-ink);
528
+ font-weight: 600;
529
+ }
530
+
531
+ .doc-card__link {
532
+ padding: 0;
533
+ border: none;
534
+ background: none;
535
+ color: inherit;
536
+ font: inherit;
537
+ text-decoration: underline;
538
+ text-underline-offset: 2px;
539
+ cursor: pointer;
540
+ }
541
+
542
+ .doc-card__aside {
543
+ font-size: 0.9em;
544
+
545
+ &:last-child {
546
+ margin-bottom: 0;
547
+ }
548
+ }
549
+
550
+ .doc-card__notice {
551
+ color: var(--doc-card-danger) !important;
552
+ }
553
+
554
+ /* a suggested package, as its package.json names it */
555
+ .pkg-line {
556
+ color: var(--doc-card-ink);
557
+ }
558
+
559
+ .pkg-line__version {
560
+ color: var(--doc-card-muted);
561
+ }
562
+
563
+ /* the card's quieter ways on, one to a line */
564
+ .doc-card__links {
565
+ display: flex;
566
+ flex-direction: column;
567
+ align-items: center;
568
+ gap: 4px;
569
+ font-size: 0.9em;
570
+
571
+ &:last-child {
572
+ margin-bottom: 0;
573
+ }
574
+ }
575
+
576
+ /* everything known about a suggested package. a popover, so it sits in the
577
+ top layer, but still inherits the card's colours */
578
+ .pkg-about[popover] {
579
+ box-sizing: border-box;
580
+ width: min(440px, calc(100vw - 32px));
581
+ max-height: calc(100vh - 64px);
582
+ margin: auto;
583
+ overflow: auto;
584
+ padding: 18px 22px 16px;
585
+ border: 1px solid var(--doc-card-line);
586
+ border-radius: 0.5em;
587
+ background: var(--doc-card-sheet);
588
+ box-shadow: 0 0 10px 2px #66003322, 3px 3px 0 var(--doc-card-line);
589
+ color: var(--doc-card-ink);
590
+ font: 13px/1.45 var(--studio-family-ui, var(--threepane-family));
591
+ text-align: left;
592
+
593
+ &::backdrop {
594
+ background: color-mix(in oklab, var(--doc-card-ink) 12%, transparent);
595
+ }
596
+
597
+ & h3 {
598
+ margin: 0;
599
+ font-size: 22px;
600
+ }
601
+
602
+ & h4 {
603
+ margin: 0 0 6px;
604
+ font-size: 11px;
605
+ font-weight: 600;
606
+ letter-spacing: 0.08em;
607
+ text-transform: uppercase;
608
+ color: var(--doc-card-muted);
609
+ }
610
+ }
611
+
612
+ .pkg-about__header {
613
+ display: flex;
614
+ align-items: baseline;
615
+ justify-content: space-between;
616
+ margin-bottom: 12px;
617
+ }
618
+
619
+ .pkg-about__close {
620
+ font-size: 20px;
621
+ line-height: 1;
622
+ text-decoration: none;
623
+ }
624
+
625
+ .pkg-about__section {
626
+ margin: 0 0 14px;
627
+ padding: 10px 12px;
628
+ border: 1px solid var(--doc-card-line);
629
+ border-radius: var(--doc-card-radius);
630
+
631
+ &:last-child {
632
+ margin-bottom: 0;
633
+ }
634
+ }
635
+
636
+ /* the package's own word gets a dashed edge and the highlighter: it's quoted,
637
+ not vouched for */
638
+ .pkg-about__section--claims {
639
+ border-style: dashed;
640
+ background: color-mix(in oklab, var(--doc-card-highlighter) 35%, transparent);
641
+ }
642
+
643
+ .pkg-about__version {
644
+ color: var(--doc-card-muted);
645
+ font-size: 0.7em;
646
+ }
647
+
648
+ /* the claims are the package's own: say so where they're headed */
649
+ .pkg-about__tag {
650
+ margin-left: 4px;
651
+ padding: 0 5px;
652
+ border: 1px dashed currentColor;
653
+ border-radius: var(--doc-card-radius);
654
+ font-weight: 400;
655
+ letter-spacing: 0.04em;
656
+ }
657
+
658
+ .pkg-about__quiet {
659
+ color: var(--doc-card-muted);
660
+ }
661
+
662
+ .pkg-about__facts {
663
+ display: grid;
664
+ grid-template-columns: max-content 1fr;
665
+ gap: 4px 12px;
666
+ margin: 0 0 8px;
667
+
668
+ & dt {
669
+ color: var(--doc-card-muted);
670
+ }
671
+
672
+ & dd {
673
+ min-width: 0;
674
+ margin: 0;
675
+ overflow-wrap: anywhere;
676
+ }
677
+ }
678
+
679
+ .pkg-about__list {
680
+ margin: 4px 0;
681
+ padding: 0 0 0 1.1em;
682
+ }
683
+
684
+ .pkg-about__heads {
685
+ display: inline-flex;
686
+ flex-wrap: wrap;
687
+ gap: 4px;
688
+ }
689
+
690
+ .pkg-about__ask {
691
+ & .doc-card__notice {
692
+ margin: 6px 0 0;
693
+ }
694
+ }
695
+
696
+ /* still finding it: a quiet dot, once it's been a moment */
697
+ .doc-card--finding {
698
+ display: flex;
699
+ justify-content: center;
700
+ gap: 8px;
701
+ color: var(--doc-card-muted);
702
+ font-size: 0.9em;
703
+ animation-delay: 1.5s;
704
+ }
705
+
706
+ .doc-card__dot {
707
+ width: 8px;
708
+ height: 8px;
709
+ border-radius: 50%;
710
+ background: currentColor;
711
+ animation: doc-card-pulse 2s ease-in-out infinite;
712
+ }
713
+
714
+ @keyframes doc-card-pulse {
715
+ 0%, 100% { opacity: 0.25; transform: scale(0.6); }
716
+ 50% { opacity: 1; transform: scale(1); }
717
+ }
718
+
719
+ @media (prefers-reduced-motion: reduce) {
720
+ .doc-card__dot {
721
+ animation: none;
722
+ }
723
+ }
724
+
725
+ .sidebar patchwork-view {
726
+ display: block;
727
+ width: 100%;
728
+ height: 100%;
729
+ /* the sidebar itself doesn't clip, so the content does */
730
+ overflow: hidden;
731
+ }
732
+
733
+ /* Context sidebar (tabbed): lifted tabs with a top accent bar and surface fill
734
+ on the active tab, a hover surface, and a bottom-border separator between the
735
+ tab bar and the mounted tool view. */
736
+ .context-sidebar {
737
+ flex: 1;
738
+ min-width: 0;
739
+ width: 100%;
740
+ height: 100%;
741
+ display: flex;
742
+ flex-direction: column;
743
+ overflow: hidden;
744
+ font-family: var(--context-sidebar-family);
745
+ color: var(--context-sidebar-fg);
746
+ background: var(--context-sidebar-bg);
747
+ /* The full-height divider between the document column and the sidebar. Lives
748
+ here (not on the document view) so it runs the whole frame height \u2014 top bar
749
+ level included \u2014 and the resize handle straddling this edge is grabbable end
750
+ to end, matching the left sidebar. */
751
+ border-left: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--context-sidebar-border);
752
+ }
753
+
754
+ /* Tab bar: the row holding the tab list and the collapse button. Its height +
755
+ top safe-area inset match the document column's top bar so the two header
756
+ strips line up and their bottom hairlines read as one continuous line across
757
+ the divider. */
758
+ .context-sidebar__tabs {
759
+ display: flex;
760
+ align-items: flex-end;
761
+ box-sizing: border-box;
762
+ min-height: var(--threepane-space-2xl);
763
+ padding-top: env(safe-area-inset-top, 0px);
764
+ background: var(--context-sidebar-header-bg);
765
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--context-sidebar-border);
766
+ }
767
+
768
+ .context-sidebar__tablist {
769
+ display: flex;
770
+ flex: 1;
771
+ min-width: 0;
772
+ align-items: flex-end;
773
+ gap: var(--threepane-space-2xs);
774
+ padding-inline: var(--threepane-space-2xs);
775
+ /* when there are more tabs than fit, scroll them horizontally rather than
776
+ letting them shrink/wrap; scrollbar hidden for a clean header. */
777
+ overflow-x: auto;
778
+ overflow-y: hidden;
779
+ scrollbar-width: none;
780
+ /* extend the clip box 1px past the tab-bar border (compensated by the
781
+ negative margin so layout is unchanged) so the active tab's -1px overflow
782
+ isn't clipped by the horizontal scroll container, and it can still cover
783
+ the border-bottom to connect into the panel. */
784
+ padding-bottom: 1px;
785
+ margin-bottom: -1px;
786
+ }
787
+ .context-sidebar__tablist::-webkit-scrollbar {
788
+ display: none;
789
+ }
790
+
791
+ /* A single tab. */
792
+ .context-sidebar__tab {
793
+ display: flex;
794
+ align-items: center;
795
+ flex-shrink: 0;
796
+ padding: var(--threepane-space-xs) var(--threepane-space-sm);
797
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) transparent;
798
+ border-bottom: none;
799
+ border-top-left-radius: var(--threepane-radius-xs);
800
+ border-top-right-radius: var(--threepane-radius-xs);
801
+ background: transparent;
802
+ font-family: inherit;
803
+ font-size: 0.875rem;
804
+ white-space: nowrap;
805
+ color: var(--context-sidebar-tab-fg);
806
+ cursor: var(--studio-cursor-pointer, pointer);
807
+ user-select: none;
808
+ transition: background var(--studio-transition-fast, 0.1s ease),
809
+ color var(--studio-transition-fast, 0.1s ease);
810
+ }
811
+
812
+ .context-sidebar__tab:hover {
813
+ background: var(--studio-chrome-hover-fill, var(--context-sidebar-tab-hover));
814
+ color: var(--context-sidebar-tab-active-fg);
815
+ }
816
+
817
+ /* Exception: the selected tab. Pulled down 1px so its fill covers the tab-bar's
818
+ bottom border, connecting the tab seamlessly into the panel below. */
819
+ .context-sidebar__tab[data-active] {
820
+ position: relative;
821
+ margin-bottom: -1px;
822
+ background: var(--context-sidebar-tab-active-bg);
823
+ color: var(--context-sidebar-tab-active-fg);
824
+ border-color: var(--context-sidebar-border);
825
+ box-shadow: inset 0 1px 0 0 var(--context-sidebar-tab-active-accent);
826
+ }
827
+
828
+ /* The close (collapse) button. Centred vertically in the tab header (the header
829
+ is otherwise flex-end for the tabs) so it lands at the same height as the
830
+ reopen toggle in the top bar when the sidebar is collapsed. */
831
+ .context-sidebar__close {
832
+ display: flex;
833
+ align-items: center;
834
+ justify-content: center;
835
+ align-self: center;
836
+ flex-shrink: 0;
837
+ padding-inline: var(--threepane-space-sm);
838
+ margin-right: var(--threepane-space-2xs);
839
+ border: none;
840
+ background: transparent;
841
+ color: var(--context-sidebar-fg);
842
+ cursor: var(--studio-cursor-pointer, pointer);
843
+ opacity: 0.5;
844
+ transition: opacity var(--studio-transition-fast, 0.1s ease);
845
+ }
846
+
847
+ .context-sidebar__close:hover {
848
+ opacity: 1;
849
+ }
850
+
851
+ /* The mounted tool view. */
852
+ .context-sidebar__content {
853
+ flex: 1;
854
+ min-height: 0;
855
+ overflow: auto;
856
+ background: var(--context-sidebar-content-bg);
857
+ contain: content;
858
+ }
859
+
860
+ .context-sidebar__content patchwork-view {
861
+ display: block;
862
+ width: 100%;
863
+ height: 100%;
864
+ }
865
+
866
+ /* Left sidebar body: a stack of widgets with the account footer pinned below. */
867
+ .threepane-sidebar {
868
+ display: flex;
869
+ flex-direction: column;
870
+ width: 100%;
871
+ height: 100%;
872
+ min-height: 0;
873
+ }
874
+
875
+ /* Reserve the docked tray's height at the sidebar's bottom so the account bar
876
+ sits above the tray (which is pinned outside this collapsing column). */
877
+ .threepane-sidebar--has-tray {
878
+ padding-bottom: calc(
879
+ var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px)
880
+ );
881
+ }
882
+
883
+ /* account / packages / settings footer, pinned to the sidebar bottom */
884
+ .threepane-sidebar--has-tray .threepane-sidebar__footer {
885
+ flex: none;
886
+ margin-bottom: calc(var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px));
887
+ }
888
+
889
+ /* The inlined account bar: avatar (account picker) + Packages + Settings. */
890
+ .threepane-account-bar {
891
+ container-type: inline-size;
892
+ display: flex;
893
+ align-items: center;
894
+ gap: var(--threepane-space-md);
895
+ min-height: var(--threepane-space-2xl);
896
+ box-sizing: border-box;
897
+ background: var(--threepane-sidebar-fill);
898
+ color: var(--threepane-sidebar-fg);
899
+ border-top: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-sidebar-divider);
900
+ padding-block: var(--threepane-space-2xs);
901
+ padding-bottom: calc(var(--threepane-space-2xs) + env(safe-area-inset-bottom));
902
+ padding-left: calc(env(safe-area-inset-left) + var(--threepane-space-md));
903
+ padding-right: calc(env(safe-area-inset-right) + var(--threepane-space-md));
904
+ justify-content: space-between;
905
+ overflow: hidden;
906
+ }
907
+
908
+ .threepane-account-bar__button {
909
+ display: flex;
910
+ align-items: center;
911
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) transparent;
912
+ padding-inline: var(--threepane-space-2xs);
913
+ padding-block: var(--threepane-space-3xs);
914
+ border-radius: var(--threepane-radius-xs);
915
+ background: transparent;
916
+ color: inherit;
917
+ font: inherit;
918
+ white-space: nowrap;
919
+ cursor: var(--studio-cursor-pointer, pointer);
920
+ }
921
+
922
+ .threepane-account-bar__button:hover {
923
+ border-color: var(--threepane-sidebar-divider);
924
+ }
925
+
926
+ .threepane-account-bar__avatar {
927
+ padding: 0;
928
+ }
929
+
930
+ .threepane-account-bar__avatar patchwork-view {
931
+ display: block;
932
+ width: 100%;
933
+ height: 100%;
934
+ }
935
+
936
+ /* Left sidebar: a stack of configured widgets. The widgets start below the
937
+ frame's top strip (the empty space matching the top bar), so the frame owns
938
+ that spacing rather than each widget reserving its own top margin. */
939
+ .threepane-widgets {
940
+ flex: 1;
941
+ display: flex;
942
+ flex-direction: column;
943
+ width: 100%;
944
+ min-height: 0;
945
+ padding-top: var(--threepane-header-height);
946
+ gap: 1rem;
947
+ }
948
+
949
+ .threepane-widget {
950
+ position: relative;
951
+ flex: 1;
952
+ min-height: 0;
953
+ overflow: hidden;
954
+ }
955
+
956
+ .threepane-widget patchwork-view {
957
+ display: block;
958
+ width: 100%;
959
+ height: 100%;
960
+ }
961
+
962
+ /* empty state: offer to add the document list */
963
+ .threepane-widgets__empty {
964
+ flex: 1;
965
+ display: flex;
966
+ align-items: flex-start;
967
+ justify-content: center;
968
+ }
969
+
970
+ .threepane-widgets__add {
971
+ padding: var(--threepane-space-xs) var(--threepane-space-sm);
972
+ border: var(--studio-border-width, 1px) dashed var(--threepane-sidebar-divider);
973
+ border-radius: var(--threepane-radius-sm);
974
+ background: transparent;
975
+ color: var(--threepane-muted);
976
+ font: inherit;
977
+ cursor: var(--studio-cursor-pointer, pointer);
978
+ white-space: nowrap;
979
+ }
980
+
981
+ .threepane-widgets__add:hover:not(:disabled) {
982
+ color: var(--threepane-sidebar-fg);
983
+ border-color: var(--threepane-sidebar-fg);
984
+ }
985
+
986
+ .threepane-widgets__add:disabled {
987
+ opacity: var(--studio-disabled-opacity, 0.5);
988
+ cursor: var(--studio-cursor-default, default);
989
+ }
990
+
991
+ /* System tray dock: pinned to the frame's bottom-left. Lives outside the
992
+ collapsing left sidebar so it isn't torn down when the sidebar closes. When
993
+ the sidebar is open the dock spans its width (set inline) and fills the space
994
+ reserved by \`threepane-sidebar--has-tray\`; when the sidebar closes the dock is
995
+ hidden (\`display: none\`) but stays mounted, so the tray is invisible while its
996
+ tools keep running. */
997
+ .frame__tray-dock {
998
+ position: absolute;
999
+ left: 0;
1000
+ bottom: 0;
1001
+ z-index: 4;
1002
+ box-sizing: border-box;
1003
+ /* Fade the tray in only *after* the sidebar's width animation completes, so it
1004
+ doesn't flash at full size over the still-expanding sidebar. The delay equals
1005
+ the sidebar's transition duration; collapsing overrides this to hide at once. */
1006
+ opacity: 1;
1007
+ transition: opacity var(--studio-transition-fast, 0.1s ease) 0.25s;
1008
+ }
1009
+
1010
+ .frame__tray-dock--collapsed {
1011
+ opacity: 0;
1012
+ pointer-events: none;
1013
+ /* Hide immediately on collapse \u2014 no wait, no fade. */
1014
+ transition: opacity 0s;
1015
+ }
1016
+
1017
+ /* A row of tray-tagged tools, filling the dock. */
1018
+ .frame-tray {
1019
+ display: flex;
1020
+ align-items: center;
1021
+ gap: var(--threepane-space-2xs);
1022
+ box-sizing: border-box;
1023
+ /* min-height includes the safe-area inset (border-box), and the matching
1024
+ padding-bottom lifts the tray's contents clear of it while the tray's own
1025
+ background fills the inset down to the very bottom edge. */
1026
+ min-height: calc(
1027
+ var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px)
1028
+ );
1029
+ padding-inline: var(--threepane-space-sm);
1030
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1031
+ border-top: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-sidebar-divider);
1032
+ background: var(--threepane-sidebar-fill);
1033
+ }
1034
+
1035
+ .frame-tray__item {
1036
+ display: flex;
1037
+ align-items: center;
1038
+ }
1039
+
1040
+ .frame-tray patchwork-view {
1041
+ display: flex;
1042
+ width: auto;
1043
+ height: auto;
1044
+ }
1045
+
1046
+ /* Isolation-mode chrome popover.
1047
+ In isolation the main document area is a sandboxed iframe, so host-realm tools
1048
+ opened from the account bar (account picker / Packages / Settings) are floated
1049
+ over the frame here instead of being routed into the iframe. The backdrop is a
1050
+ lowish-opacity, theme-tinted ink wash (dims the frame + picks up the theme's
1051
+ ink hue); the panel carries a soft drop shadow so it reads as lifted. Absolute
1052
+ inset:0 resolves to the \`.frame\` (its nearest positioned ancestor). */
1053
+ .frame__popover-backdrop {
1054
+ position: absolute;
1055
+ inset: 0;
1056
+ z-index: var(--studio-layer-modal, 1000);
1057
+ display: flex;
1058
+ align-items: center;
1059
+ justify-content: center;
1060
+ padding: var(--threepane-space-2xl);
1061
+ background: var(--studio-backdrop, color-mix(in oklch, var(--threepane-fg), transparent 82%));
1062
+ animation: frame-popover-fade var(--studio-transition, 0.15s ease);
1063
+ }
1064
+
1065
+ .frame__popover {
1066
+ display: flex;
1067
+ flex-direction: column;
1068
+ width: min(1100px, 100%);
1069
+ height: min(900px, 100%);
1070
+ overflow: hidden;
1071
+ background: var(--threepane-bg);
1072
+ color: var(--threepane-fg);
1073
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
1074
+ border-radius: var(--threepane-radius-md);
1075
+ box-shadow:
1076
+ 0 32px 80px color-mix(in oklch, var(--threepane-fg), transparent 45%),
1077
+ 0 12px 32px color-mix(in oklch, var(--threepane-fg), transparent 60%),
1078
+ 0 2px 8px color-mix(in oklch, var(--threepane-fg), transparent 70%);
1079
+ animation: frame-popover-pop var(--studio-transition, 0.15s ease);
1080
+ }
1081
+
1082
+ /* The "Open with" picker, docked to the popover's top. Sits at its natural
1083
+ height above the tool body; the doc-openwith tool renders a small titlebar
1084
+ button, so this is left-aligned chrome rather than a full-height view. */
1085
+ .frame__popover-toolbar {
1086
+ display: flex;
1087
+ align-items: center;
1088
+ flex: 0 0 auto;
1089
+ gap: var(--threepane-space-sm);
1090
+ padding: var(--threepane-space-sm) var(--threepane-space-md);
1091
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
1092
+ }
1093
+
1094
+ .frame__popover-toolbar patchwork-view {
1095
+ display: block;
1096
+ }
1097
+
1098
+ .frame__popover-body {
1099
+ flex: 1 1 auto;
1100
+ min-height: 0;
1101
+ overflow: auto;
1102
+ }
1103
+
1104
+ .frame__popover-body patchwork-view {
1105
+ display: block;
1106
+ width: 100%;
1107
+ height: 100%;
1108
+ overflow: auto;
1109
+ }
1110
+
1111
+ @keyframes frame-popover-fade {
1112
+ from {
1113
+ opacity: 0;
1114
+ }
1115
+ to {
1116
+ opacity: 1;
1117
+ }
1118
+ }
1119
+
1120
+ @keyframes frame-popover-pop {
1121
+ from {
1122
+ opacity: 0;
1123
+ transform: translateY(8px) scale(0.98);
1124
+ }
1125
+ to {
1126
+ opacity: 1;
1127
+ transform: none;
1128
+ }
1129
+ }
1130
+
1131
+ .frame {
1132
+ .sidebar-toggle {
1133
+ position: relative;
1134
+ align-self: stretch;
1135
+ height: 100%;
1136
+ padding: 0;
1137
+ /* 1px wide, overlapping the divider border while reserving no layout column
1138
+ (content stays flush against the view's border - no offset-bg seam). The
1139
+ divider border is painted inside the following column, so a centered 2px
1140
+ strip reads half a pixel left of the line. */
1141
+ width: 1px;
1142
+ margin-inline: 0 -1px;
1143
+ margin-block: 0;
1144
+ border: 0;
1145
+ z-index: 1;
1146
+ cursor: var(--studio-cursor-pointer, pointer);
1147
+ /* transparent at rest - the visible divider is the main view's border; the
1148
+ handle lights up (full-height glow + pill) on hover to signal resize. */
1149
+ background: transparent;
1150
+ transition: background-color var(--studio-transition, 0.15s ease);
1151
+ /* invisible hit target straddling the divider. The toggle sits on opposite
1152
+ edges of the two sidebars (right edge of the left pane, left edge of the
1153
+ right pane). The grab area reaches 6px past the line on both sides, so it
1154
+ works the same on either edge without per-side rules. */
1155
+ &::before {
1156
+ content: "";
1157
+ position: absolute;
1158
+ inset-block: 0;
1159
+ inset-inline: -6px;
1160
+ }
1161
+ &::after {
1162
+ content: "";
1163
+ position: absolute;
1164
+ top: 50%;
1165
+ left: 50%;
1166
+ width: 5px;
1167
+ height: 44px;
1168
+ border-radius: var(--threepane-radius-round);
1169
+ background: var(--threepane-resize-pill);
1170
+ opacity: 0;
1171
+ transform: translate(-50%, -50%) scaleY(0.55);
1172
+ transition: opacity var(--studio-transition, 0.15s ease),
1173
+ transform var(--studio-transition, 0.15s ease);
1174
+ pointer-events: none;
1175
+ }
1176
+ /* on hover the divider line lights up in the frame primary */
1177
+ &:hover,
1178
+ &:active {
1179
+ background: var(--threepane-resize-glow);
1180
+ }
1181
+ &:hover::after,
1182
+ &:active::after {
1183
+ opacity: 1;
1184
+ transform: translate(-50%, -50%) scaleY(1);
1185
+ }
1186
+ }
1187
+
1188
+ .sidebar-toggle--resizable {
1189
+ cursor: var(--studio-cursor-resize-col, col-resize);
1190
+ &:hover {
1191
+ cursor: var(--studio-cursor-resize-col, col-resize);
1192
+ }
1193
+ &:active {
1194
+ cursor: var(--studio-cursor-resize-col, col-resize);
1195
+ }
1196
+ }
1197
+
1198
+ }
1199
+
1200
+ /* Animate sidebar width on collapse/expand, but never while the handle is being
1201
+ actively dragged - the width must track the pointer 1:1 with no easing lag.
1202
+ The body flag is set for the duration of a drag by \`useSidebarResize\`. */
1203
+ .sidebar {
1204
+ transition: width var(--studio-transition-slow, 0.25s ease);
1205
+ }
1206
+ body[data-sidebar-resizing] .sidebar {
1207
+ transition: none;
1208
+ }
1209
+ `;function Ur(){let e="patchwork-frame-styles",r=document.getElementById(e);if(r){r.textContent!==Ke&&(r.textContent=Ke);return}let t=document.createElement("style");t.id=e,t.textContent=Ke,document.head.append(t)}var ui=Hr("<patchwork-view component=patchwork-isolation root-component=threepane-isolation-root shared-providers=patchwork:contact,patchwork:selected-doc,patchwork:worker-channel shared-tools=llm-config-tray style=display:contents><script type=application/json data-root-component-data>",!0,!1,!1),pi=Hr("<div class=frame>");function Dd(e){let r=jr(()=>{let o=new Set,n=e.selectedDocUrl();return n&&o.add(n),e.contactUrl&&o.add(e.contactUrl),[...o]}),t=jr(()=>JSON.stringify({selectedDocUrl:e.selectedDocUrl(),selectedToolId:e.selectedToolId(),doctitleSlots:e.doctitleSlots(),isLeftCollapsed:e.isLeftCollapsed(),initialRightWidth:e.initialRightWidth(),initialRightCollapsed:e.initialRightCollapsed()}));return(()=>{var o=ui(),n=o.firstChild;return o._$owner=di(),Nr(n,t),ci(()=>li(o,"automerge-allowlist",r().join(","))),o})()}function Wr(e){if(!e?.textContent)return{};try{return JSON.parse(e.textContent)}catch(r){return console.error("[threepane-isolation-root] bad props JSON:",r),{}}}function Id(e){Ur();let r=e.querySelector('script[type="application/json"]'),[t,o]=hi(Wr(r)),n=new MutationObserver(()=>{o(fi(Wr(r)))});r&&n.observe(r,{characterData:!0,childList:!0,subtree:!0});let a=mi(()=>(()=>{var i=pi();return Nr(i,si(Or,{selectedDocUrl:()=>t.selectedDocUrl,selectedToolId:()=>t.selectedToolId,doctitleSlots:()=>t.doctitleSlots,isLeftCollapsed:()=>t.isLeftCollapsed??!1,initialRightWidth:()=>t.initialRightWidth??Re,initialRightCollapsed:()=>t.initialRightCollapsed??!1})),i})(),e);return()=>{n.disconnect(),a()}}export{St as a,we as b,V as c,Ie as d,Re as e,vt as f,wt as g,Kr as h,Ge as i,io as j,Bt as k,rt as l,Xl as m,Gl as n,Fr as o,Or as p,Ur as q,Dd as r,Id as s};
1210
+ //# sourceMappingURL=chunk-XOKWELWP.js.map