sliccy 2.30.1 → 2.32.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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/ui/assets/{anthropic-8eDzq16s.js → anthropic-B7P0L8Bb.js} +2 -2
  3. package/dist/ui/assets/{azure-openai-responses-Co3U-CRE.js → azure-openai-responses-Dh38ZOMJ.js} +1 -1
  4. package/dist/ui/assets/{dist-DNaqKK1b.js → dist-9WxiJAzp.js} +1 -1
  5. package/dist/ui/assets/{dist-B7jV583z.js → dist-BTmb3iYn.js} +2 -2
  6. package/dist/ui/assets/{dist-CGaze1Ny.js → dist-DDaqk4vO.js} +1 -1
  7. package/dist/ui/assets/{dist-BDtNNOSH.js → dist-DJJ5BcAp.js} +1 -1
  8. package/dist/ui/assets/{dist-v3lhJeTU.js → dist-DJjqNd_E.js} +1 -1
  9. package/dist/ui/assets/{es-KCOGljoE.js → es-B_FZ6bs3.js} +1 -1
  10. package/dist/ui/assets/{fs-C-hr4_Ra.js → fs-CaPY5ftT.js} +3 -3
  11. package/dist/ui/assets/{google-B8XMNP05.js → google-Bi_lIJsW.js} +1 -1
  12. package/dist/ui/assets/{google-vertex-raK4Y0YQ.js → google-vertex-D2yGwh3C.js} +1 -1
  13. package/dist/ui/assets/{index-DI4uugll.js → index-BYi91L97.js} +893 -893
  14. package/dist/ui/assets/{magick-wasm-BzLDiChi.js → magick-wasm-Bq3dEoCR.js} +1 -1
  15. package/dist/ui/assets/{mistral-DpS0NWQx.js → mistral-CgWQ_I1G.js} +1 -1
  16. package/dist/ui/assets/mount-8M6hfkXR.js +1 -0
  17. package/dist/ui/assets/{mount-table-store-CpeaTcOk.js → mount-table-store-Nn99HagS.js} +1 -1
  18. package/dist/ui/assets/offscreen-client-B1AxJwgF.js +1 -0
  19. package/dist/ui/assets/{onboarding-orchestrator-Bkcax_hg.js → onboarding-orchestrator-CnluGl3B.js} +1 -1
  20. package/dist/ui/assets/{openai-codex-responses-BuHA5WLv.js → openai-codex-responses-Db0S7Kw4.js} +2 -2
  21. package/dist/ui/assets/{openai-completions-B56vntFT.js → openai-completions-DJyaY3wV.js} +1 -1
  22. package/dist/ui/assets/{openai-responses-C5MVlySt.js → openai-responses-Ss5keHNB.js} +1 -1
  23. package/dist/ui/assets/provider-settings-DoLETgrA.js +95 -0
  24. package/dist/ui/assets/proxy-error-CrmvLOqz.js +1 -0
  25. package/dist/ui/assets/{skills-QfRZv1Vq.js → skills-DntCVcJc.js} +1 -1
  26. package/dist/ui/assets/{slicc-editor-BoYj4oN5.js → slicc-editor-BVHodj4l.js} +2 -2
  27. package/dist/ui/assets/tray-follower-status-Bmnx6GQ2.js +1 -0
  28. package/dist/ui/index.html +19 -17
  29. package/dist/ui/packages/webapp/index.html +19 -17
  30. package/package.json +2 -2
  31. package/dist/ui/assets/mount-BtPHnOYR.js +0 -1
  32. package/dist/ui/assets/offscreen-client-CfxxcGbf.js +0 -1
  33. package/dist/ui/assets/provider-settings-C4zA1iDl.js +0 -95
  34. /package/dist/ui/assets/{addon-fit-CnTv21Qe.js → addon-fit-CTgRqR5i.js} +0 -0
  35. /package/dist/ui/assets/{browser-BdRkQqGs.js → browser-DTqiPYX-.js} +0 -0
  36. /package/dist/ui/assets/{bsh-watchdog-D2IOkdFT.js → bsh-watchdog-CIn8d13D.js} +0 -0
  37. /package/dist/ui/assets/{chat-fixture-BUlIqjmp.js → chat-fixture-CPqBWweU.js} +0 -0
  38. /package/dist/ui/assets/{db-CogIG09c.js → db-UiVJ_81p.js} +0 -0
  39. /package/dist/ui/assets/{dist-D3b8uvJq.js → dist-CdiravWB.js} +0 -0
  40. /package/dist/ui/assets/{dist-DDsR80Yu.js → dist-Vf0lpDBK.js} +0 -0
  41. /package/dist/ui/assets/{fetch-body-DlhSI6C_.js → fetch-body-BbyAckTk.js} +0 -0
  42. /package/dist/ui/assets/{github-copilot-headers-CILwC7Cq.js → github-copilot-headers-Be1b_P8M.js} +0 -0
  43. /package/dist/ui/assets/{global-db-Ch1iyQkU.js → global-db-CY0a6mwh.js} +0 -0
  44. /package/dist/ui/assets/{google-shared-C81jZNkD.js → google-shared-CeWucPWM.js} +0 -0
  45. /package/dist/ui/assets/{lick-manager-proxy-CogaR9kt.js → lick-manager-proxy-BaSPvznK.js} +0 -0
  46. /package/dist/ui/assets/{mount-id-aPpP4D52.js → mount-id-D-aIZ7cM.js} +0 -0
  47. /package/dist/ui/assets/{oauth-service-CfTUWB9P.js → oauth-service-DbVY17PU.js} +0 -0
  48. /package/dist/ui/assets/{openai-BR_xAflc.js → openai-BcJAGVMr.js} +0 -0
  49. /package/dist/ui/assets/{path-utils-d3qOVZOu.js → path-utils-C99GOg2c.js} +0 -0
  50. /package/dist/ui/assets/{pdfjs-BoIgQO-R.js → pdfjs-CVemzvEQ.js} +0 -0
  51. /package/dist/ui/assets/{pyodide-O3MDgCSV.js → pyodide-URxi9wGY.js} +0 -0
  52. /package/dist/ui/assets/{remote-cache-BMnV55WX.js → remote-cache-B04zkF5q.js} +0 -0
  53. /package/dist/ui/assets/{rum-BEM52ixi.js → rum-DCU8sePD.js} +0 -0
  54. /package/dist/ui/assets/{secret-masking-Bg1u5YcF.js → secret-masking-C8bS91CE.js} +0 -0
  55. /package/dist/ui/assets/{sql-wasm-ClMy9maw.js → sql-wasm-F9DxfQVa.js} +0 -0
  56. /package/dist/ui/assets/{src-CgSXdUB7.js → src-DGdmJN2h.js} +0 -0
  57. /package/dist/ui/assets/{xterm-CAZt1iF4.js → xterm-BcRgm-P0.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{r as e}from"./chunk-jRWAZmH_.js";import"./fs-C-hr4_Ra.js";import{t}from"./browser-BdRkQqGs.js";import{r as n,t as r}from"./path-utils-d3qOVZOu.js";var i=`skills`,a=`.skill`,o=50*1024*1024,s=1e3,c=`/workspace/skills`,l=`SKILL.md`,u=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function d(e){if(e===`__MACOSX`||e.startsWith(`__MACOSX/`))return!0;let t=e.includes(`/`)?e.slice(e.lastIndexOf(`/`)+1):e;return!!(t===`.DS_Store`||t===`Thumbs.db`||t===`desktop.ini`||t.startsWith(`._`))}var f=class extends Error{};function p(e){let t=e.replace(/\\/g,`/`);if(!t||t.endsWith(`/`))return null;if(t.startsWith(`/`)||/^[A-Za-z]:\//.test(t))throw Error(`Blocked suspicious path "${e}".`);let n=t.split(`/`);if(n.some(e=>e===``||e===`.`||e===`..`))throw Error(`Blocked suspicious path "${e}".`);return n.join(`/`)}function m(e){if(!u.test(e))throw Error(`Invalid skill: skill name "${e}" must be a simple directory name.`)}function h(e){let t=[];for(let[n,r]of Object.entries(e)){let e=p(n);e&&(d(e)||t.push({originalPath:n,path:e,bytes:r}))}return t}function g(e){let t=e.filter(e=>e.path===`SKILL.md`||e.path.endsWith(`/SKILL.md`));if(t.length===0)throw Error(`Skill archive is missing ${l}.`);if(t.length>1)throw Error(`Skill archive contains multiple ${l} files.`);return t[0]}function _(e){let n=0,r=0;return t(e,{filter(e){if(n++,n>1e3)throw new f(`Skill archives may contain at most ${s} entries.`);if(r+=e.originalSize,r>52428800)throw new f(`Skill archives must expand to 50 MB or smaller after extraction.`);return!0}})}function v(e){return r(c,`.${e}.tmp-${`${Date.now()}-${Math.random().toString(16).slice(2,8)}`}`)}function y(e,t){return t===`SKILL.md`?e.replace(/\.skill$/i,``):t.slice(0,-9).split(`/`).pop()??``}async function b(e,t){if(!t.name.toLowerCase().endsWith(`.skill`))throw Error(`Only ${a} archives can be installed with drag and drop.`);if(t.size>52428800)throw Error(`Skill archives must be 50 MB or smaller.`);let i;try{i=_(new Uint8Array(await t.arrayBuffer()))}catch(e){if(e instanceof f)throw e;let t=e instanceof Error?e.message:String(e);throw Error(`Invalid .skill archive: ${t}`)}let o=h(i),s=g(o),u=y(t.name,s.path);m(u);let d=r(c,u);if(await e.exists(d))throw Error(`Skill "${u}" already exists at ${d}.`);let p=v(u),b=s.path===`SKILL.md`?``:s.path.slice(0,-(l.length+1));await e.mkdir(p,{recursive:!0});try{let t=0;for(let i of o){if(b&&(i.path===b||!i.path.startsWith(`${b}/`)))continue;let a=b?i.path.slice(b.length+1):i.path;if(!a)continue;let o=r(p,a),{dir:s}=n(o);s!==`/`&&await e.mkdir(s,{recursive:!0}),await e.writeFile(o,i.bytes),t++}return await e.rename(p,d),{skillName:u,destinationPath:d,fileCount:t}}catch(t){throw await e.exists(p)&&await e.rm(p,{recursive:!0}),t}}var x=[`native`,`agents`,`claude`],S=new Map([[`.agents`,`agents`],[`.claude`,`claude`]]),C=new Set([`.git`,`.slicc`]),w=[`mkdir`,`mount`,`rename`,`rm`,`unmount`,`writeFile`],T=new WeakMap,E=new WeakSet;async function D(e,t=c){let n=await A(e,t),r=await O(e);return[...x.flatMap(e=>(e===`native`?n:r.filter(t=>t.source===e)).sort((e,t)=>e.path.localeCompare(t.path)))]}async function O(e){M(e);let t=e,n=T.get(t);if(n)return n.map(e=>({...e}));let r=await j(e);return T.set(t,r),r.map(e=>({...e}))}function k(e,t){let n=new Map,r=new Map;for(let i of e){let e=t(i);if(!n.has(e)){n.set(e,i);continue}let a=r.get(e)??{name:e,winner:n.get(e),shadowed:[]};a.shadowed.push(i),r.set(e,a)}return{winners:Array.from(n.values()),collisions:Array.from(r.values())}}async function A(e,t){let n=await P(e,t),r=[];for(let i of n){if(i.type!==`directory`)continue;let n=`${t}/${i.name}`,a=`${n}/${l}`;await N(e,a)&&r.push({source:`native`,sourceRoot:t,path:n,skillFilePath:a})}return r}async function j(e){let t=[],n=new Set,r=[`/`];for(let i=0;i<r.length;i+=1){let a=r[i],o=await P(e,a);for(let i of o){if(i.type!==`directory`)continue;let o=a===`/`?`/${i.name}`:`${a}/${i.name}`,s=S.get(i.name);if(s){let r=`${o}/skills`,i=await P(e,r);for(let a of i){if(a.type!==`directory`)continue;let i=`${r}/${a.name}`,o=`${i}/${l}`;!await N(e,o)||n.has(i)||(n.add(i),t.push({source:s,sourceRoot:r,path:i,skillFilePath:o}))}}C.has(i.name)||r.push(o)}}return t}function M(e){let t=e;if(E.has(t))return;E.add(t);let n=e;for(let r of w){let i=n[r];if(typeof i!=`function`)continue;let a=i;try{n[r]=async(...n)=>{let r=await a.apply(e,n);return T.delete(t),r}}catch{}}}async function N(e,t){try{return await e.stat(t),!0}catch{return!1}}async function P(e,t){try{return[...await e.readDir(t)].sort((e,t)=>e.name.localeCompare(t.name))}catch{return[]}}async function F(e,t=`/workspace/skills`){let n=await D(e,t),r=[];for(let t of n){let n=t.path.split(`/`).pop()??t.path,i=``;if(t.skillFilePath)try{i=R(await e.readTextFile(t.skillFilePath))??``}catch{}r.push({name:n,source:t.source,sourceRoot:t.sourceRoot,path:t.path,skillFilePath:t.skillFilePath,description:i})}let{winners:i,collisions:a}=k(r,e=>e.name),o=new Map(a.map(e=>[e.winner.path,e.shadowed.map(e=>e.path)]));return i.map(e=>({...e,shadowedPaths:o.get(e.path)}))}async function I(e,t,n=`/workspace/skills`){return(await F(e,n)).find(e=>e.name===t)||null}async function L(e,t,n=`/workspace/skills`){let r=await I(e,t,n);if(!r?.skillFilePath)return null;try{return await e.readTextFile(r.skillFilePath)}catch{return null}}function R(e){let t=e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
1
+ import{r as e}from"./chunk-jRWAZmH_.js";import"./fs-CaPY5ftT.js";import{t}from"./browser-DTqiPYX-.js";import{r as n,t as r}from"./path-utils-C99GOg2c.js";var i=`skills`,a=`.skill`,o=50*1024*1024,s=1e3,c=`/workspace/skills`,l=`SKILL.md`,u=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function d(e){if(e===`__MACOSX`||e.startsWith(`__MACOSX/`))return!0;let t=e.includes(`/`)?e.slice(e.lastIndexOf(`/`)+1):e;return!!(t===`.DS_Store`||t===`Thumbs.db`||t===`desktop.ini`||t.startsWith(`._`))}var f=class extends Error{};function p(e){let t=e.replace(/\\/g,`/`);if(!t||t.endsWith(`/`))return null;if(t.startsWith(`/`)||/^[A-Za-z]:\//.test(t))throw Error(`Blocked suspicious path "${e}".`);let n=t.split(`/`);if(n.some(e=>e===``||e===`.`||e===`..`))throw Error(`Blocked suspicious path "${e}".`);return n.join(`/`)}function m(e){if(!u.test(e))throw Error(`Invalid skill: skill name "${e}" must be a simple directory name.`)}function h(e){let t=[];for(let[n,r]of Object.entries(e)){let e=p(n);e&&(d(e)||t.push({originalPath:n,path:e,bytes:r}))}return t}function g(e){let t=e.filter(e=>e.path===`SKILL.md`||e.path.endsWith(`/SKILL.md`));if(t.length===0)throw Error(`Skill archive is missing ${l}.`);if(t.length>1)throw Error(`Skill archive contains multiple ${l} files.`);return t[0]}function _(e){let n=0,r=0;return t(e,{filter(e){if(n++,n>1e3)throw new f(`Skill archives may contain at most ${s} entries.`);if(r+=e.originalSize,r>52428800)throw new f(`Skill archives must expand to 50 MB or smaller after extraction.`);return!0}})}function v(e){return r(c,`.${e}.tmp-${`${Date.now()}-${Math.random().toString(16).slice(2,8)}`}`)}function y(e,t){return t===`SKILL.md`?e.replace(/\.skill$/i,``):t.slice(0,-9).split(`/`).pop()??``}async function b(e,t){if(!t.name.toLowerCase().endsWith(`.skill`))throw Error(`Only ${a} archives can be installed with drag and drop.`);if(t.size>52428800)throw Error(`Skill archives must be 50 MB or smaller.`);let i;try{i=_(new Uint8Array(await t.arrayBuffer()))}catch(e){if(e instanceof f)throw e;let t=e instanceof Error?e.message:String(e);throw Error(`Invalid .skill archive: ${t}`)}let o=h(i),s=g(o),u=y(t.name,s.path);m(u);let d=r(c,u);if(await e.exists(d))throw Error(`Skill "${u}" already exists at ${d}.`);let p=v(u),b=s.path===`SKILL.md`?``:s.path.slice(0,-(l.length+1));await e.mkdir(p,{recursive:!0});try{let t=0;for(let i of o){if(b&&(i.path===b||!i.path.startsWith(`${b}/`)))continue;let a=b?i.path.slice(b.length+1):i.path;if(!a)continue;let o=r(p,a),{dir:s}=n(o);s!==`/`&&await e.mkdir(s,{recursive:!0}),await e.writeFile(o,i.bytes),t++}return await e.rename(p,d),{skillName:u,destinationPath:d,fileCount:t}}catch(t){throw await e.exists(p)&&await e.rm(p,{recursive:!0}),t}}var x=[`native`,`agents`,`claude`],S=new Map([[`.agents`,`agents`],[`.claude`,`claude`]]),C=new Set([`.git`,`.slicc`]),w=[`mkdir`,`mount`,`rename`,`rm`,`unmount`,`writeFile`],T=new WeakMap,E=new WeakSet;async function D(e,t=c){let n=await A(e,t),r=await O(e);return[...x.flatMap(e=>(e===`native`?n:r.filter(t=>t.source===e)).sort((e,t)=>e.path.localeCompare(t.path)))]}async function O(e){M(e);let t=e,n=T.get(t);if(n)return n.map(e=>({...e}));let r=await j(e);return T.set(t,r),r.map(e=>({...e}))}function k(e,t){let n=new Map,r=new Map;for(let i of e){let e=t(i);if(!n.has(e)){n.set(e,i);continue}let a=r.get(e)??{name:e,winner:n.get(e),shadowed:[]};a.shadowed.push(i),r.set(e,a)}return{winners:Array.from(n.values()),collisions:Array.from(r.values())}}async function A(e,t){let n=await P(e,t),r=[];for(let i of n){if(i.type!==`directory`)continue;let n=`${t}/${i.name}`,a=`${n}/${l}`;await N(e,a)&&r.push({source:`native`,sourceRoot:t,path:n,skillFilePath:a})}return r}async function j(e){let t=[],n=new Set,r=[`/`];for(let i=0;i<r.length;i+=1){let a=r[i],o=await P(e,a);for(let i of o){if(i.type!==`directory`)continue;let o=a===`/`?`/${i.name}`:`${a}/${i.name}`,s=S.get(i.name);if(s){let r=`${o}/skills`,i=await P(e,r);for(let a of i){if(a.type!==`directory`)continue;let i=`${r}/${a.name}`,o=`${i}/${l}`;!await N(e,o)||n.has(i)||(n.add(i),t.push({source:s,sourceRoot:r,path:i,skillFilePath:o}))}}C.has(i.name)||r.push(o)}}return t}function M(e){let t=e;if(E.has(t))return;E.add(t);let n=e;for(let r of w){let i=n[r];if(typeof i!=`function`)continue;let a=i;try{n[r]=async(...n)=>{let r=await a.apply(e,n);return T.delete(t),r}}catch{}}}async function N(e,t){try{return await e.stat(t),!0}catch{return!1}}async function P(e,t){try{return[...await e.readDir(t)].sort((e,t)=>e.name.localeCompare(t.name))}catch{return[]}}async function F(e,t=`/workspace/skills`){let n=await D(e,t),r=[];for(let t of n){let n=t.path.split(`/`).pop()??t.path,i=``;if(t.skillFilePath)try{i=R(await e.readTextFile(t.skillFilePath))??``}catch{}r.push({name:n,source:t.source,sourceRoot:t.sourceRoot,path:t.path,skillFilePath:t.skillFilePath,description:i})}let{winners:i,collisions:a}=k(r,e=>e.name),o=new Map(a.map(e=>[e.winner.path,e.shadowed.map(e=>e.path)]));return i.map(e=>({...e,shadowedPaths:o.get(e.path)}))}async function I(e,t,n=`/workspace/skills`){return(await F(e,n)).find(e=>e.name===t)||null}async function L(e,t,n=`/workspace/skills`){let r=await I(e,t,n);if(!r?.skillFilePath)return null;try{return await e.readTextFile(r.skillFilePath)}catch{return null}}function R(e){let t=e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
2
2
  `).trimStart().match(/^---\s*\n([\s\S]*?)\n---/);if(!t)return null;for(let e of t[1].split(`
3
3
  `)){let t=e.match(/^description:\s*(.*)$/);if(t)return t[1].trim()}return null}var z=e({MAX_SKILL_ARCHIVE_SIZE_BYTES:()=>o,SKILLS_DIR:()=>i,SKILL_ARCHIVE_EXTENSION:()=>a,SKILL_FILE:()=>l,WORKSPACE_SKILLS_PATH:()=>c,discoverSkillCandidates:()=>D,discoverSkills:()=>F,getSkillInfo:()=>I,installSkillFromDrop:()=>b,readSkillInstructions:()=>L,resolveSkillNameCollisions:()=>k});export{a as i,F as n,b as r,z as t};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CGaze1Ny.js","assets/dist-DDsR80Yu.js","assets/dist-BDtNNOSH.js","assets/dist-DNaqKK1b.js","assets/dist-v3lhJeTU.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-DzyYoeor.js";import{$ as t,A as n,B as r,D as i,E as a,F as o,H as s,I as c,J as l,L as u,N as d,P as f,Q as p,R as m,S as ee,U as te,V as h,X as g,Y as ne,Z as re,at as _,c as ie,d as ae,j as oe,k as se,n as ce,nt as v,q as y,t as le,v as b,w as x,x as S,y as C,z as ue}from"./dist-DDsR80Yu.js";var de=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=T(e.state,n.from);return r.line?fe(e):r.block?me(e):!1};function w(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 fe=w(ve,0),pe=w(_e,0),me=w((e,t)=>_e(e,t,ge(t)),0);function T(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var E=50;function he(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-E,r),o=e.sliceDoc(i,i+E),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<=2*E?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+E),d=e.sliceDoc(i-E,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 ge(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 _e(e,t,n=t.selection.ranges){let r=n.map(e=>T(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>he(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 ve(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=T(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)}}else 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 D=u.define(),ye=u.define(),be=te.define(),xe=te.define({combine(e){return re(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)})}}),Se=l.define({create(){return P.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(D);if(r){let i=A.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?j(o,o.length,n.minDepth,i):je(o,t.startState.selection),new P(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(ye);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(g.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=A.fromTransaction(t),o=t.annotation(g.time),s=t.annotation(g.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 P(e.done.map(A.fromJSON),e.undone.map(A.fromJSON))}});function Ce(e={}){return[Se,xe.of(e),n.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?we:e.inputType==`historyRedo`?k:null;return n?(e.preventDefault(),n(t)):!1}})]}function O(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Se,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var we=O(0,!1),k=O(1,!1),Te=O(0,!0),Ee=O(1,!0),A=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&&ue.fromJSON(t.changes),[],t.mapped&&m.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=M;for(let e of t.startState.facet(be)){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,M)}static selection(t){return new e(void 0,M,void 0,void 0,t)}};function j(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 De(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 Oe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function ke(e,t){return e.length?t.length?e.concat(t):e:t}var M=[],Ae=200;function je(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ae));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),j(e,e.length-1,1e9,n.setSelAfter(r)))}else return[A.selection([t])]}function Me(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 N(e,t){if(!e.length)return e;let n=e.length,r=M;for(;n;){let i=Ne(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}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[A.selection(r)]:M}function Ne(e,t,n){let r=ke(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):M,n);if(!e.changes)return A.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new A(i,y.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Pe=/^(input\.type|delete)($|\.)/,P=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||Pe.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,De(s.changes,t.changes))||r==`input.type.compose`)?j(o,o.length-1,i.minDepth,new A(t.changes.compose(s.changes),ke(y.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,M)):j(o,o.length,i.minDepth,t),new e(o,M,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:M;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Oe(a[a.length-1],t)?this:new e(je(this.done,t),this.undone,n,r)}addMapping(t){return new e(N(this.done,t),N(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:D.of({side:e,rest:Me(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?M:r.slice(0,r.length-1);return i.mapped&&(n=N(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:D.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};P.empty=new P(M,M);var Fe=[{key:`Mod-z`,run:we,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:k,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:k,preventDefault:!0},{key:`Mod-u`,run:Te,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ee,preventDefault:!0}];function F(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return r.eq(e.selection,!0)?!1:(t(I(e,r)),!0)}function R(e,t){return h.cursor(t?e.to:e.from)}function Ie(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function z(e){return e.textDirectionAt(e.state.selection.main.head)==se.LTR}var B=e=>Ie(e,!z(e)),V=e=>Ie(e,z(e));function H(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var Le=e=>H(e,!z(e)),Re=e=>H(e,z(e));typeof Intl<`u`&&Intl.Segmenter;function ze(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 U(e,t,n){let r=i(e).resolveInner(t.head),a=n?_.closedBy:_.openedBy;for(let i=t.head;;){let t=n?r.childAfter(i):r.childBefore(i);if(!t)break;ze(e,t,a)?r=t:i=n?t.to:t.from}let o=r.type.prop(a),s,c;return c=o&&(s=n?x(e,r.from,1):x(e,r.to,-1))&&s.matched?n?s.end.to:s.end.from:n?r.to:r.from,h.cursor(c,n?-1:1)}var Be=e=>L(e,t=>U(e.state,t,!z(e))),Ve=e=>L(e,t=>U(e.state,t,z(e)));function W(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var He=e=>W(e,!1),Ue=e=>W(e,!0);function We(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0,a;if(t){for(let t of e.state.facet(n.scrollMargins)){let n=t(e);n?.top&&(r=Math.max(n?.top,r)),n?.bottom&&(i=Math.max(n?.bottom,i))}a=e.scrollDOM.clientHeight-r-i}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,a-5)}}function Ge(e,t){let r=We(e),{state:i}=e,a=F(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):R(n,t));if(a.eq(i.selection))return!1;let o;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),c=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>c&&t.bottom<l&&(o=n.scrollIntoView(a.main.head,{y:`start`,yMargin:t.top-c}))}return e.dispatch(I(i,a),{effects:o}),!0}var Ke=e=>Ge(e,!1),G=e=>Ge(e,!0);function K(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=h.cursor(r.from+n))}return i}var qe=e=>L(e,t=>K(e,t,!0)),Je=e=>L(e,t=>K(e,t,!1)),Ye=e=>L(e,t=>K(e,t,!z(e))),Xe=e=>L(e,t=>K(e,t,z(e))),Ze=e=>L(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Qe=e=>L(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function $e(e,t,n){let r=!1,i=F(e.selection,t=>{let i=x(e,t.head,-1)||x(e,t.head,1)||t.head>0&&x(e,t.head-1,1)||t.head<e.doc.length&&x(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?h.range(t.anchor,a):h.cursor(a)});return r?(t(I(e,i)),!0):!1}var et=({state:e,dispatch:t})=>$e(e,t,!1);function q(e,t){let n=F(e.state.selection,e=>{let n=t(e);return h.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(I(e.state,n)),!0)}function tt(e,t){return q(e,n=>e.moveByChar(n,t))}var nt=e=>tt(e,!z(e)),rt=e=>tt(e,z(e));function it(e,t){return q(e,n=>e.moveByGroup(n,t))}var at=e=>it(e,!z(e)),ot=e=>it(e,z(e)),st=e=>q(e,t=>U(e.state,t,!z(e))),ct=e=>q(e,t=>U(e.state,t,z(e)));function lt(e,t){return q(e,n=>e.moveVertically(n,t))}var ut=e=>lt(e,!1),dt=e=>lt(e,!0);function ft(e,t){return q(e,n=>e.moveVertically(n,t,We(e).height))}var pt=e=>ft(e,!1),mt=e=>ft(e,!0),ht=e=>q(e,t=>K(e,t,!0)),gt=e=>q(e,t=>K(e,t,!1)),_t=e=>q(e,t=>K(e,t,!z(e))),vt=e=>q(e,t=>K(e,t,z(e))),yt=e=>q(e,t=>h.cursor(e.lineBlockAt(t.head).from)),bt=e=>q(e,t=>h.cursor(e.lineBlockAt(t.head).to)),xt=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),St=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),Ct=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),wt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Tt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Et=({state:e,dispatch:t})=>{let n=Q(e).map(({from:t,to:n})=>h.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:`select`})),!0},Dt=({state:e,dispatch:t})=>{let n=F(e.selection,t=>{let n=i(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 h.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(I(e,n)),!0)};function Ot(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}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(I(n,h.create(i,i.length-1))),!0)}var kt=e=>Ot(e,!1),At=e=>Ot(e,!0),jt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(I(e,r)),!0):!1};function J(e,t){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(n=>{let{from:i,to:a}=n;if(i==a){let o=t(n);o<i?(r=`delete.backward`,o=Y(e,o,!1)):o>i&&(r=`delete.forward`,o=Y(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Y(e,i,!1),a=Y(e,a,!0);return i==a?{range:n}:{changes:{from:i,to:a},range:h.cursor(i,i<n.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?n.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function Y(e,t,r){if(e instanceof n)for(let i of e.state.facet(n.atomicRanges).map(t=>t(e)))i.between(t,t,(e,n)=>{e<t&&n>t&&(t=r?n:e)});return t}var Mt=(e,n,r)=>J(e,i=>{let a=i.from,{state:o}=e,s=o.doc.lineAt(a),c,l;if(r&&!n&&a>s.from&&a<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,a-s.from))){if(c[c.length-1]==` `)return a-1;let e=p(c,o.tabSize)%b(o)||b(o);for(let t=0;t<e&&c[c.length-1-t]==` `;t++)a--;l=a}else l=t(s.text,a-s.from,n,n)+s.from,l==a&&s.number!=(n?o.doc.lines:1)?l+=n?1:-1:!n&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,a-s.from))&&(l=t(s.text,l-s.from,!1,!1)+s.from);return l}),X=e=>Mt(e,!1,!0),Nt=e=>Mt(e,!0,!1),Pt=(e,n)=>J(e,r=>{let i=r.head,{state:a}=e,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let e=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=t(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(e!=null&&u!=e)break;(l!=` `||i!=r.head)&&(e=u),i=c}return i}),Z=e=>Pt(e,!1),Ft=e=>Pt(e,!0),It=e=>J(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Lt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Rt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),zt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ne.of([``,``])},range:h.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Bt=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let r=n.from,i=e.doc.lineAt(r),a=r==i.from?r-1:t(i.text,r-i.from,!1)+i.from,o=r==i.to?r+1:t(i.text,r-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(r,o).append(e.doc.slice(a,r))},range:h.cursor(o)}});return r.changes.empty?!1:(n(e.update(r,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(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 Vt(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Q(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(h.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(h.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Ht=({state:e,dispatch:t})=>Vt(e,t,!1),Ut=({state:e,dispatch:t})=>Vt(e,t,!0);function Wt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(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 Gt=({state:e,dispatch:t})=>Wt(e,t,!1),Kt=({state:e,dispatch:t})=>Wt(e,t,!0),qt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(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 Jt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=i(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),o;return r&&a&&r.to<=t&&a.from>=t&&(o=r.type.prop(_.closedBy))&&o.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}var Yt=Zt(!1),Xt=Zt(!0);function Zt(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&&Jt(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new ce(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=C(s,r);for(c??=p(/^\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=[``,S(t,c)];return o&&l.push(S(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:ne.of(l)},range:h.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function $(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:h.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Qt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ce(e,{overrideIndentation:e=>n[e]??-1}),i=$(e,(t,i,a)=>{let o=C(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=S(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},$t=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ee)})}),{userEvent:`input.indent`})),!0),en=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=p(r,e.tabSize),a=0,o=S(e,Math.max(0,i-b(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),tn=e=>(e.setTabFocusMode(),!0),nn=[{key:`Ctrl-b`,run:B,shift:nt,preventDefault:!0},{key:`Ctrl-f`,run:V,shift:rt},{key:`Ctrl-p`,run:He,shift:ut},{key:`Ctrl-n`,run:Ue,shift:dt},{key:`Ctrl-a`,run:Ze,shift:yt},{key:`Ctrl-e`,run:Qe,shift:bt},{key:`Ctrl-d`,run:Nt},{key:`Ctrl-h`,run:X},{key:`Ctrl-k`,run:It},{key:`Ctrl-Alt-h`,run:Z},{key:`Ctrl-o`,run:zt},{key:`Ctrl-t`,run:Bt},{key:`Ctrl-v`,run:G}],rn=[{key:`ArrowLeft`,run:B,shift:nt,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Le,shift:at,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Ye,shift:_t,preventDefault:!0},{key:`ArrowRight`,run:V,shift:rt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Re,shift:ot,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Xe,shift:vt,preventDefault:!0},{key:`ArrowUp`,run:He,shift:ut,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:xt,shift:Ct},{mac:`Ctrl-ArrowUp`,run:Ke,shift:pt},{key:`ArrowDown`,run:Ue,shift:dt,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:St,shift:wt},{mac:`Ctrl-ArrowDown`,run:G,shift:mt},{key:`PageUp`,run:Ke,shift:pt},{key:`PageDown`,run:G,shift:mt},{key:`Home`,run:Je,shift:gt,preventDefault:!0},{key:`Mod-Home`,run:xt,shift:Ct},{key:`End`,run:qe,shift:ht,preventDefault:!0},{key:`Mod-End`,run:St,shift:wt},{key:`Enter`,run:Yt,shift:Yt},{key:`Mod-a`,run:Tt},{key:`Backspace`,run:X,shift:X,preventDefault:!0},{key:`Delete`,run:Nt,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Z,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Ft,preventDefault:!0},{mac:`Mod-Backspace`,run:Lt,preventDefault:!0},{mac:`Mod-Delete`,run:Rt,preventDefault:!0}].concat(nn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),an=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Be,shift:st},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Ve,shift:ct},{key:`Alt-ArrowUp`,run:Ht},{key:`Shift-Alt-ArrowUp`,run:Gt},{key:`Alt-ArrowDown`,run:Ut},{key:`Shift-Alt-ArrowDown`,run:Kt},{key:`Mod-Alt-ArrowUp`,run:kt},{key:`Mod-Alt-ArrowDown`,run:At},{key:`Escape`,run:jt},{key:`Mod-Enter`,run:Xt},{key:`Alt-l`,mac:`Ctrl-l`,run:Et},{key:`Mod-i`,run:Dt,preventDefault:!0},{key:`Mod-[`,run:en},{key:`Mod-]`,run:$t},{key:`Mod-Alt-\\`,run:Qt},{key:`Shift-Mod-k`,run:qt},{key:`Shift-Mod-\\`,run:et},{key:`Mod-/`,run:de},{key:`Alt-A`,run:pe},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:tn}].concat(rn),on={json:async()=>{let{json:t}=await e(async()=>{let{json:e}=await import(`./dist-CGaze1Ny.js`);return{json:e}},__vite__mapDeps([0,1,2]));return t()},markdown:async()=>{let{markdown:t}=await e(async()=>{let{markdown:e}=await import(`./dist-DNaqKK1b.js`);return{markdown:e}},__vite__mapDeps([3,4,1,2]));return t()},html:async()=>{let{html:t}=await e(async()=>{let{html:e}=await import(`./dist-v3lhJeTU.js`);return{html:e}},__vite__mapDeps([4,1,2]));return t()}};function sn(e){return e?le.define([{tag:v.keyword,color:`#d19afc`},{tag:v.string,color:`#87d68d`},{tag:v.number,color:`#f5a76c`},{tag:v.comment,color:`#8a8a8a`,fontStyle:`italic`},{tag:v.punctuation,color:`#7cc5e9`},{tag:v.function(v.variableName),color:`#7ea8f8`},{tag:v.propertyName,color:`#7ea8f8`},{tag:v.bool,color:`#f5a76c`},{tag:v.null,color:`#f5a76c`},{tag:v.operator,color:`#7cc5e9`},{tag:v.typeName,color:`#d19afc`},{tag:v.tagName,color:`#d19afc`},{tag:v.attributeName,color:`#87d68d`},{tag:v.attributeValue,color:`#87d68d`},{tag:v.heading,fontWeight:`bold`},{tag:v.emphasis,fontStyle:`italic`},{tag:v.strong,fontWeight:`bold`}]):le.define([{tag:v.keyword,color:`#8839ef`},{tag:v.string,color:`#40a02b`},{tag:v.number,color:`#d05d1a`},{tag:v.comment,color:`#8a8a8a`,fontStyle:`italic`},{tag:v.punctuation,color:`#1e66f5`},{tag:v.function(v.variableName),color:`#2b6cb0`},{tag:v.propertyName,color:`#2b6cb0`},{tag:v.bool,color:`#d05d1a`},{tag:v.null,color:`#d05d1a`},{tag:v.operator,color:`#1e66f5`},{tag:v.typeName,color:`#8839ef`},{tag:v.tagName,color:`#8839ef`},{tag:v.attributeName,color:`#40a02b`},{tag:v.attributeValue,color:`#40a02b`},{tag:v.heading,fontWeight:`bold`},{tag:v.emphasis,fontStyle:`italic`},{tag:v.strong,fontWeight:`bold`}])}function cn(e){return!(e.closest?.(`.theme-light`)||document.documentElement.classList.contains(`theme-light`))}function ln(){return n.theme({"&":{fontSize:`13px`,border:`1px solid var(--s2-border-subtle, #333)`,borderRadius:`var(--s2-radius-default, 8px)`,overflow:`hidden`},"&.cm-focused":{outline:`none`,borderColor:`var(--s2-border-focus, var(--s2-accent, #3562ff))`},".cm-content":{fontFamily:`var(--s2-font-mono, "SF Mono", "Fira Code", Consolas, monospace)`,caretColor:`var(--s2-accent, #3562ff)`,padding:`8px 0`},".cm-scroller":{overflow:`auto`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--s2-accent, #3562ff)`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground":{background:`color-mix(in srgb, var(--s2-accent, #3562ff) 20%, transparent)`},".cm-activeLine":{background:`color-mix(in srgb, var(--s2-accent, #3562ff) 5%, transparent)`},".cm-gutters":{backgroundColor:`var(--s2-bg-layer-1, #1a1a1a)`,color:`var(--s2-content-tertiary, #5a5a5a)`,borderRight:`none`,borderRadius:`var(--s2-radius-default, 8px) 0 0 var(--s2-radius-default, 8px)`},".cm-lineNumbers .cm-gutterElement":{padding:`0 8px 0 12px`,minWidth:`32px`},".cm-placeholder":{color:`var(--s2-content-tertiary, #5a5a5a)`,fontStyle:`italic`}})}var un=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DDaqk4vO.js","assets/dist-Vf0lpDBK.js","assets/dist-DJJ5BcAp.js","assets/dist-9WxiJAzp.js","assets/dist-DJjqNd_E.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./preload-helper-DzyYoeor.js";import{$ as t,A as n,B as r,D as i,E as a,F as o,H as s,I as c,J as l,L as u,N as d,P as f,Q as p,R as m,S as ee,U as te,V as h,X as g,Y as ne,Z as re,at as _,c as ie,d as ae,j as oe,k as se,n as ce,nt as v,q as y,t as le,v as b,w as x,x as S,y as C,z as ue}from"./dist-Vf0lpDBK.js";var de=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=T(e.state,n.from);return r.line?fe(e):r.block?me(e):!1};function w(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 fe=w(ve,0),pe=w(_e,0),me=w((e,t)=>_e(e,t,ge(t)),0);function T(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var E=50;function he(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-E,r),o=e.sliceDoc(i,i+E),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<=2*E?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+E),d=e.sliceDoc(i-E,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 ge(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 _e(e,t,n=t.selection.ranges){let r=n.map(e=>T(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>he(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 ve(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=T(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)}}else 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 D=u.define(),ye=u.define(),be=te.define(),xe=te.define({combine(e){return re(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)})}}),Se=l.define({create(){return P.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(D);if(r){let i=A.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?j(o,o.length,n.minDepth,i):je(o,t.startState.selection),new P(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(ye);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(g.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=A.fromTransaction(t),o=t.annotation(g.time),s=t.annotation(g.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 P(e.done.map(A.fromJSON),e.undone.map(A.fromJSON))}});function Ce(e={}){return[Se,xe.of(e),n.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?we:e.inputType==`historyRedo`?k:null;return n?(e.preventDefault(),n(t)):!1}})]}function O(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Se,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var we=O(0,!1),k=O(1,!1),Te=O(0,!0),Ee=O(1,!0),A=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&&ue.fromJSON(t.changes),[],t.mapped&&m.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=M;for(let e of t.startState.facet(be)){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,M)}static selection(t){return new e(void 0,M,void 0,void 0,t)}};function j(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 De(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 Oe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function ke(e,t){return e.length?t.length?e.concat(t):e:t}var M=[],Ae=200;function je(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ae));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),j(e,e.length-1,1e9,n.setSelAfter(r)))}else return[A.selection([t])]}function Me(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 N(e,t){if(!e.length)return e;let n=e.length,r=M;for(;n;){let i=Ne(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}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[A.selection(r)]:M}function Ne(e,t,n){let r=ke(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):M,n);if(!e.changes)return A.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new A(i,y.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Pe=/^(input\.type|delete)($|\.)/,P=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||Pe.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,De(s.changes,t.changes))||r==`input.type.compose`)?j(o,o.length-1,i.minDepth,new A(t.changes.compose(s.changes),ke(y.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,M)):j(o,o.length,i.minDepth,t),new e(o,M,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:M;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Oe(a[a.length-1],t)?this:new e(je(this.done,t),this.undone,n,r)}addMapping(t){return new e(N(this.done,t),N(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:D.of({side:e,rest:Me(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?M:r.slice(0,r.length-1);return i.mapped&&(n=N(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:D.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};P.empty=new P(M,M);var Fe=[{key:`Mod-z`,run:we,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:k,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:k,preventDefault:!0},{key:`Mod-u`,run:Te,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ee,preventDefault:!0}];function F(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return r.eq(e.selection,!0)?!1:(t(I(e,r)),!0)}function R(e,t){return h.cursor(t?e.to:e.from)}function Ie(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function z(e){return e.textDirectionAt(e.state.selection.main.head)==se.LTR}var B=e=>Ie(e,!z(e)),V=e=>Ie(e,z(e));function H(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var Le=e=>H(e,!z(e)),Re=e=>H(e,z(e));typeof Intl<`u`&&Intl.Segmenter;function ze(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 U(e,t,n){let r=i(e).resolveInner(t.head),a=n?_.closedBy:_.openedBy;for(let i=t.head;;){let t=n?r.childAfter(i):r.childBefore(i);if(!t)break;ze(e,t,a)?r=t:i=n?t.to:t.from}let o=r.type.prop(a),s,c;return c=o&&(s=n?x(e,r.from,1):x(e,r.to,-1))&&s.matched?n?s.end.to:s.end.from:n?r.to:r.from,h.cursor(c,n?-1:1)}var Be=e=>L(e,t=>U(e.state,t,!z(e))),Ve=e=>L(e,t=>U(e.state,t,z(e)));function W(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var He=e=>W(e,!1),Ue=e=>W(e,!0);function We(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0,a;if(t){for(let t of e.state.facet(n.scrollMargins)){let n=t(e);n?.top&&(r=Math.max(n?.top,r)),n?.bottom&&(i=Math.max(n?.bottom,i))}a=e.scrollDOM.clientHeight-r-i}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,a-5)}}function Ge(e,t){let r=We(e),{state:i}=e,a=F(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):R(n,t));if(a.eq(i.selection))return!1;let o;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),c=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>c&&t.bottom<l&&(o=n.scrollIntoView(a.main.head,{y:`start`,yMargin:t.top-c}))}return e.dispatch(I(i,a),{effects:o}),!0}var Ke=e=>Ge(e,!1),G=e=>Ge(e,!0);function K(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=h.cursor(r.from+n))}return i}var qe=e=>L(e,t=>K(e,t,!0)),Je=e=>L(e,t=>K(e,t,!1)),Ye=e=>L(e,t=>K(e,t,!z(e))),Xe=e=>L(e,t=>K(e,t,z(e))),Ze=e=>L(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Qe=e=>L(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function $e(e,t,n){let r=!1,i=F(e.selection,t=>{let i=x(e,t.head,-1)||x(e,t.head,1)||t.head>0&&x(e,t.head-1,1)||t.head<e.doc.length&&x(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?h.range(t.anchor,a):h.cursor(a)});return r?(t(I(e,i)),!0):!1}var et=({state:e,dispatch:t})=>$e(e,t,!1);function q(e,t){let n=F(e.state.selection,e=>{let n=t(e);return h.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(I(e.state,n)),!0)}function tt(e,t){return q(e,n=>e.moveByChar(n,t))}var nt=e=>tt(e,!z(e)),rt=e=>tt(e,z(e));function it(e,t){return q(e,n=>e.moveByGroup(n,t))}var at=e=>it(e,!z(e)),ot=e=>it(e,z(e)),st=e=>q(e,t=>U(e.state,t,!z(e))),ct=e=>q(e,t=>U(e.state,t,z(e)));function lt(e,t){return q(e,n=>e.moveVertically(n,t))}var ut=e=>lt(e,!1),dt=e=>lt(e,!0);function ft(e,t){return q(e,n=>e.moveVertically(n,t,We(e).height))}var pt=e=>ft(e,!1),mt=e=>ft(e,!0),ht=e=>q(e,t=>K(e,t,!0)),gt=e=>q(e,t=>K(e,t,!1)),_t=e=>q(e,t=>K(e,t,!z(e))),vt=e=>q(e,t=>K(e,t,z(e))),yt=e=>q(e,t=>h.cursor(e.lineBlockAt(t.head).from)),bt=e=>q(e,t=>h.cursor(e.lineBlockAt(t.head).to)),xt=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),St=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),Ct=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),wt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Tt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Et=({state:e,dispatch:t})=>{let n=Q(e).map(({from:t,to:n})=>h.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:`select`})),!0},Dt=({state:e,dispatch:t})=>{let n=F(e.selection,t=>{let n=i(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 h.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(I(e,n)),!0)};function Ot(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}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(I(n,h.create(i,i.length-1))),!0)}var kt=e=>Ot(e,!1),At=e=>Ot(e,!0),jt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(I(e,r)),!0):!1};function J(e,t){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(n=>{let{from:i,to:a}=n;if(i==a){let o=t(n);o<i?(r=`delete.backward`,o=Y(e,o,!1)):o>i&&(r=`delete.forward`,o=Y(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Y(e,i,!1),a=Y(e,a,!0);return i==a?{range:n}:{changes:{from:i,to:a},range:h.cursor(i,i<n.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?n.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function Y(e,t,r){if(e instanceof n)for(let i of e.state.facet(n.atomicRanges).map(t=>t(e)))i.between(t,t,(e,n)=>{e<t&&n>t&&(t=r?n:e)});return t}var Mt=(e,n,r)=>J(e,i=>{let a=i.from,{state:o}=e,s=o.doc.lineAt(a),c,l;if(r&&!n&&a>s.from&&a<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,a-s.from))){if(c[c.length-1]==` `)return a-1;let e=p(c,o.tabSize)%b(o)||b(o);for(let t=0;t<e&&c[c.length-1-t]==` `;t++)a--;l=a}else l=t(s.text,a-s.from,n,n)+s.from,l==a&&s.number!=(n?o.doc.lines:1)?l+=n?1:-1:!n&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,a-s.from))&&(l=t(s.text,l-s.from,!1,!1)+s.from);return l}),X=e=>Mt(e,!1,!0),Nt=e=>Mt(e,!0,!1),Pt=(e,n)=>J(e,r=>{let i=r.head,{state:a}=e,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let e=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=t(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(e!=null&&u!=e)break;(l!=` `||i!=r.head)&&(e=u),i=c}return i}),Z=e=>Pt(e,!1),Ft=e=>Pt(e,!0),It=e=>J(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Lt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Rt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),zt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ne.of([``,``])},range:h.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Bt=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let r=n.from,i=e.doc.lineAt(r),a=r==i.from?r-1:t(i.text,r-i.from,!1)+i.from,o=r==i.to?r+1:t(i.text,r-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(r,o).append(e.doc.slice(a,r))},range:h.cursor(o)}});return r.changes.empty?!1:(n(e.update(r,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(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 Vt(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Q(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(h.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(h.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Ht=({state:e,dispatch:t})=>Vt(e,t,!1),Ut=({state:e,dispatch:t})=>Vt(e,t,!0);function Wt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(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 Gt=({state:e,dispatch:t})=>Wt(e,t,!1),Kt=({state:e,dispatch:t})=>Wt(e,t,!0),qt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(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 Jt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=i(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),o;return r&&a&&r.to<=t&&a.from>=t&&(o=r.type.prop(_.closedBy))&&o.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}var Yt=Zt(!1),Xt=Zt(!0);function Zt(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&&Jt(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new ce(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=C(s,r);for(c??=p(/^\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=[``,S(t,c)];return o&&l.push(S(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:ne.of(l)},range:h.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function $(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:h.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Qt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ce(e,{overrideIndentation:e=>n[e]??-1}),i=$(e,(t,i,a)=>{let o=C(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=S(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},$t=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ee)})}),{userEvent:`input.indent`})),!0),en=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=p(r,e.tabSize),a=0,o=S(e,Math.max(0,i-b(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),tn=e=>(e.setTabFocusMode(),!0),nn=[{key:`Ctrl-b`,run:B,shift:nt,preventDefault:!0},{key:`Ctrl-f`,run:V,shift:rt},{key:`Ctrl-p`,run:He,shift:ut},{key:`Ctrl-n`,run:Ue,shift:dt},{key:`Ctrl-a`,run:Ze,shift:yt},{key:`Ctrl-e`,run:Qe,shift:bt},{key:`Ctrl-d`,run:Nt},{key:`Ctrl-h`,run:X},{key:`Ctrl-k`,run:It},{key:`Ctrl-Alt-h`,run:Z},{key:`Ctrl-o`,run:zt},{key:`Ctrl-t`,run:Bt},{key:`Ctrl-v`,run:G}],rn=[{key:`ArrowLeft`,run:B,shift:nt,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Le,shift:at,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Ye,shift:_t,preventDefault:!0},{key:`ArrowRight`,run:V,shift:rt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Re,shift:ot,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Xe,shift:vt,preventDefault:!0},{key:`ArrowUp`,run:He,shift:ut,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:xt,shift:Ct},{mac:`Ctrl-ArrowUp`,run:Ke,shift:pt},{key:`ArrowDown`,run:Ue,shift:dt,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:St,shift:wt},{mac:`Ctrl-ArrowDown`,run:G,shift:mt},{key:`PageUp`,run:Ke,shift:pt},{key:`PageDown`,run:G,shift:mt},{key:`Home`,run:Je,shift:gt,preventDefault:!0},{key:`Mod-Home`,run:xt,shift:Ct},{key:`End`,run:qe,shift:ht,preventDefault:!0},{key:`Mod-End`,run:St,shift:wt},{key:`Enter`,run:Yt,shift:Yt},{key:`Mod-a`,run:Tt},{key:`Backspace`,run:X,shift:X,preventDefault:!0},{key:`Delete`,run:Nt,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Z,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Ft,preventDefault:!0},{mac:`Mod-Backspace`,run:Lt,preventDefault:!0},{mac:`Mod-Delete`,run:Rt,preventDefault:!0}].concat(nn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),an=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Be,shift:st},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Ve,shift:ct},{key:`Alt-ArrowUp`,run:Ht},{key:`Shift-Alt-ArrowUp`,run:Gt},{key:`Alt-ArrowDown`,run:Ut},{key:`Shift-Alt-ArrowDown`,run:Kt},{key:`Mod-Alt-ArrowUp`,run:kt},{key:`Mod-Alt-ArrowDown`,run:At},{key:`Escape`,run:jt},{key:`Mod-Enter`,run:Xt},{key:`Alt-l`,mac:`Ctrl-l`,run:Et},{key:`Mod-i`,run:Dt,preventDefault:!0},{key:`Mod-[`,run:en},{key:`Mod-]`,run:$t},{key:`Mod-Alt-\\`,run:Qt},{key:`Shift-Mod-k`,run:qt},{key:`Shift-Mod-\\`,run:et},{key:`Mod-/`,run:de},{key:`Alt-A`,run:pe},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:tn}].concat(rn),on={json:async()=>{let{json:t}=await e(async()=>{let{json:e}=await import(`./dist-DDaqk4vO.js`);return{json:e}},__vite__mapDeps([0,1,2]));return t()},markdown:async()=>{let{markdown:t}=await e(async()=>{let{markdown:e}=await import(`./dist-9WxiJAzp.js`);return{markdown:e}},__vite__mapDeps([3,4,1,2]));return t()},html:async()=>{let{html:t}=await e(async()=>{let{html:e}=await import(`./dist-DJjqNd_E.js`);return{html:e}},__vite__mapDeps([4,1,2]));return t()}};function sn(e){return e?le.define([{tag:v.keyword,color:`#d19afc`},{tag:v.string,color:`#87d68d`},{tag:v.number,color:`#f5a76c`},{tag:v.comment,color:`#8a8a8a`,fontStyle:`italic`},{tag:v.punctuation,color:`#7cc5e9`},{tag:v.function(v.variableName),color:`#7ea8f8`},{tag:v.propertyName,color:`#7ea8f8`},{tag:v.bool,color:`#f5a76c`},{tag:v.null,color:`#f5a76c`},{tag:v.operator,color:`#7cc5e9`},{tag:v.typeName,color:`#d19afc`},{tag:v.tagName,color:`#d19afc`},{tag:v.attributeName,color:`#87d68d`},{tag:v.attributeValue,color:`#87d68d`},{tag:v.heading,fontWeight:`bold`},{tag:v.emphasis,fontStyle:`italic`},{tag:v.strong,fontWeight:`bold`}]):le.define([{tag:v.keyword,color:`#8839ef`},{tag:v.string,color:`#40a02b`},{tag:v.number,color:`#d05d1a`},{tag:v.comment,color:`#8a8a8a`,fontStyle:`italic`},{tag:v.punctuation,color:`#1e66f5`},{tag:v.function(v.variableName),color:`#2b6cb0`},{tag:v.propertyName,color:`#2b6cb0`},{tag:v.bool,color:`#d05d1a`},{tag:v.null,color:`#d05d1a`},{tag:v.operator,color:`#1e66f5`},{tag:v.typeName,color:`#8839ef`},{tag:v.tagName,color:`#8839ef`},{tag:v.attributeName,color:`#40a02b`},{tag:v.attributeValue,color:`#40a02b`},{tag:v.heading,fontWeight:`bold`},{tag:v.emphasis,fontStyle:`italic`},{tag:v.strong,fontWeight:`bold`}])}function cn(e){return!(e.closest?.(`.theme-light`)||document.documentElement.classList.contains(`theme-light`))}function ln(){return n.theme({"&":{fontSize:`13px`,border:`1px solid var(--s2-border-subtle, #333)`,borderRadius:`var(--s2-radius-default, 8px)`,overflow:`hidden`},"&.cm-focused":{outline:`none`,borderColor:`var(--s2-border-focus, var(--s2-accent, #3562ff))`},".cm-content":{fontFamily:`var(--s2-font-mono, "SF Mono", "Fira Code", Consolas, monospace)`,caretColor:`var(--s2-accent, #3562ff)`,padding:`8px 0`},".cm-scroller":{overflow:`auto`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--s2-accent, #3562ff)`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground":{background:`color-mix(in srgb, var(--s2-accent, #3562ff) 20%, transparent)`},".cm-activeLine":{background:`color-mix(in srgb, var(--s2-accent, #3562ff) 5%, transparent)`},".cm-gutters":{backgroundColor:`var(--s2-bg-layer-1, #1a1a1a)`,color:`var(--s2-content-tertiary, #5a5a5a)`,borderRight:`none`,borderRadius:`var(--s2-radius-default, 8px) 0 0 var(--s2-radius-default, 8px)`},".cm-lineNumbers .cm-gutterElement":{padding:`0 8px 0 12px`,minWidth:`32px`},".cm-placeholder":{color:`var(--s2-content-tertiary, #5a5a5a)`,fontStyle:`italic`}})}var un=`
3
3
  :host {
4
4
  display: block;
5
5
  background: var(--s2-bg-layer-2, var(--s2-gray-75, #252525));
@@ -0,0 +1 @@
1
+ var e=`tray`,t=`trayWorkerUrl`,n=`lead`;function r(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``,t.pathname!==`/`&&(t.pathname=t.pathname.replace(/\/+$/,``)||`/`);let n=t.toString();return n.endsWith(`/`)?n.slice(0,-1):n}catch{return null}}function i(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.toString(),i=t.pathname.split(`/`).filter(Boolean);if(i.length<2||i.at(-2)!==`join`)return null;let[a,o,...s]=decodeURIComponent(i.at(-1)).split(`.`);if(!a||!o||s.length>0)return null;i.splice(-2,2),t.pathname=i.length>0?`/${i.join(`/`)}`:`/`;let c=r(t.toString());return c?{workerBaseUrl:c,trayId:a,joinUrl:n}:null}catch{return null}}function a(r,i){let a=new URL(r);return a.searchParams.delete(t),a.searchParams.delete(n),a.searchParams.set(e,i),a.toString()}var o=`slicc.trayWorkerBaseUrl`,s=`slicc.trayJoinUrl`,c=`https://www.sliccy.ai`;function l(e,t){let n=r(e);if(!n)throw Error(`Invalid tray worker base URL: ${e}`);let i=t.replace(/^\/+/,``);return new URL(i,`${n}/`).toString()}function u(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),a=null;if(n.length>=2&&n.at(-2)===`tray`)a=decodeURIComponent(n.at(-1)),n.splice(-2,2),t.pathname=n.length>0?`/${n.join(`/`)}`:`/`;else if(n.length>=2&&n.at(-2)===`join`)return i(t.toString());let o=r(t.toString());return o?{workerBaseUrl:o,trayId:a,joinUrl:null}:null}catch{return null}}function d(e){let t=u(e);return t?.joinUrl?t:null}function f(e,t){let n=d(t);return n?(e.setItem(s,n.joinUrl),e.setItem(o,n.workerBaseUrl),n):null}function p(e){return!!d(e?.getItem(`slicc.trayJoinUrl`)??null)}function m(e,t){let n=r(e);if(!n)throw Error(`Invalid tray worker base URL: ${e}`);let i=t?.trim();return i?new URL(`tray/${encodeURIComponent(i)}`,`${n}/`).toString():n}function h(e,t,n){return a(e,m(t,n))}async function g(e){let t=v(e.locationHref);if(t)return e.storage&&(t.joinUrl&&e.storage.setItem(s,t.joinUrl),e.storage.setItem(o,t.workerBaseUrl)),t;let n=d(e.storage?.getItem(`slicc.trayJoinUrl`)??null);if(n)return e.storage&&e.storage.setItem(o,n.workerBaseUrl),n;let i=e.runtimeConfigFetcher?await y(e.runtimeConfigFetcher):null;if(i?.joinConfig)return e.storage&&(e.storage.setItem(s,i.joinConfig.joinUrl),e.storage.setItem(o,i.joinConfig.workerBaseUrl)),i.joinConfig;let a=i?.workerBaseUrl??null,c=r(e.storage?.getItem(`slicc.trayWorkerBaseUrl`)??null),l=r(e.envBaseUrl??null),u=r(e.defaultWorkerBaseUrl??null),f=a??c??l??u;return f?(e.storage&&e.storage.setItem(o,f),{workerBaseUrl:f,trayId:null,joinUrl:null}):null}async function _(e=fetch){try{let t=await e(`/api/runtime-config`,{cache:`no-store`});return t.ok?await t.json():null}catch{return null}}function v(a){try{let o=new URL(a),s=u(o.searchParams.get(e));if(s)return s;let c=u(o.searchParams.get(n));if(c)return c;let l=r(o.searchParams.get(t));return l?{workerBaseUrl:l,trayId:null,joinUrl:null}:i(a)||null}catch{return null}}async function y(e){let t=await e();if(!t)return null;let n=d(t.trayJoinUrl??null);return{workerBaseUrl:r(t.trayWorkerBaseUrl??null),joinConfig:n}}var b={state:`inactive`,joinUrl:null,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null};function x(){return{...b}}var S=new Set;function C(){if(S.size!==0)for(let e of[...S])try{e({...b})}catch{}}function w(e){b={...e},C()}function T(e){b={...b,lastPingTime:e},C()}export{s as a,l as c,g as d,f,c as i,_ as l,T as n,o,w as r,h as s,x as t,p as u};
@@ -5,32 +5,34 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/index-DI4uugll.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BYi91L97.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-jRWAZmH_.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-DzyYoeor.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/simple-options-xknIywaW.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/headers-C5V-E251.js">
13
- <link rel="modulepreload" crossorigin href="/assets/openai-codex-responses-BuHA5WLv.js">
14
- <link rel="modulepreload" crossorigin href="/assets/openai-BR_xAflc.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/openai-codex-responses-Db0S7Kw4.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/openai-BcJAGVMr.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-Bmnx6GQ2.js">
15
16
  <link rel="modulepreload" crossorigin href="/assets/logger-GnnuzSDq.js">
16
- <link rel="modulepreload" crossorigin href="/assets/global-db-Ch1iyQkU.js">
17
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-C4zA1iDl.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/global-db-CY0a6mwh.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-DoLETgrA.js">
18
19
  <link rel="modulepreload" crossorigin href="/assets/hash-Bt1aVMQ3.js">
19
- <link rel="modulepreload" crossorigin href="/assets/browser-BdRkQqGs.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/browser-DTqiPYX-.js">
20
21
  <link rel="modulepreload" crossorigin href="/assets/mime-types-D4mOIoVQ.js">
21
- <link rel="modulepreload" crossorigin href="/assets/mount-id-aPpP4D52.js">
22
- <link rel="modulepreload" crossorigin href="/assets/mount-table-store-CpeaTcOk.js">
23
- <link rel="modulepreload" crossorigin href="/assets/remote-cache-BMnV55WX.js">
24
- <link rel="modulepreload" crossorigin href="/assets/mount-BtPHnOYR.js">
25
- <link rel="modulepreload" crossorigin href="/assets/path-utils-d3qOVZOu.js">
26
- <link rel="modulepreload" crossorigin href="/assets/db-CogIG09c.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/proxy-error-CrmvLOqz.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/mount-id-D-aIZ7cM.js">
24
+ <link rel="modulepreload" crossorigin href="/assets/mount-table-store-Nn99HagS.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/remote-cache-B04zkF5q.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/mount-8M6hfkXR.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/path-utils-C99GOg2c.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/db-UiVJ_81p.js">
27
29
  <link rel="modulepreload" crossorigin href="/assets/types-U7svdiTt.js">
28
- <link rel="modulepreload" crossorigin href="/assets/fetch-body-DlhSI6C_.js">
29
- <link rel="modulepreload" crossorigin href="/assets/magick-wasm-BzLDiChi.js">
30
- <link rel="modulepreload" crossorigin href="/assets/skills-QfRZv1Vq.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/fetch-body-BbyAckTk.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/magick-wasm-Bq3dEoCR.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/skills-DntCVcJc.js">
31
33
  <link rel="modulepreload" crossorigin href="/assets/__vite-browser-external-B-U7N2L4.js">
32
- <link rel="modulepreload" crossorigin href="/assets/index-DI4uugll.js">
33
- <link rel="modulepreload" crossorigin href="/assets/fs-C-hr4_Ra.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/index-BYi91L97.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/fs-CaPY5ftT.js">
34
36
  <link rel="stylesheet" crossorigin href="/assets/index-B83C5cLK.css">
35
37
  </head>
36
38
  <body>
@@ -5,32 +5,34 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/index-DI4uugll.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BYi91L97.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-jRWAZmH_.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-DzyYoeor.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/simple-options-xknIywaW.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/headers-C5V-E251.js">
13
- <link rel="modulepreload" crossorigin href="/assets/openai-codex-responses-BuHA5WLv.js">
14
- <link rel="modulepreload" crossorigin href="/assets/openai-BR_xAflc.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/openai-codex-responses-Db0S7Kw4.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/openai-BcJAGVMr.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-Bmnx6GQ2.js">
15
16
  <link rel="modulepreload" crossorigin href="/assets/logger-GnnuzSDq.js">
16
- <link rel="modulepreload" crossorigin href="/assets/global-db-Ch1iyQkU.js">
17
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-C4zA1iDl.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/global-db-CY0a6mwh.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-DoLETgrA.js">
18
19
  <link rel="modulepreload" crossorigin href="/assets/hash-Bt1aVMQ3.js">
19
- <link rel="modulepreload" crossorigin href="/assets/browser-BdRkQqGs.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/browser-DTqiPYX-.js">
20
21
  <link rel="modulepreload" crossorigin href="/assets/mime-types-D4mOIoVQ.js">
21
- <link rel="modulepreload" crossorigin href="/assets/mount-id-aPpP4D52.js">
22
- <link rel="modulepreload" crossorigin href="/assets/mount-table-store-CpeaTcOk.js">
23
- <link rel="modulepreload" crossorigin href="/assets/remote-cache-BMnV55WX.js">
24
- <link rel="modulepreload" crossorigin href="/assets/mount-BtPHnOYR.js">
25
- <link rel="modulepreload" crossorigin href="/assets/path-utils-d3qOVZOu.js">
26
- <link rel="modulepreload" crossorigin href="/assets/db-CogIG09c.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/proxy-error-CrmvLOqz.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/mount-id-D-aIZ7cM.js">
24
+ <link rel="modulepreload" crossorigin href="/assets/mount-table-store-Nn99HagS.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/remote-cache-B04zkF5q.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/mount-8M6hfkXR.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/path-utils-C99GOg2c.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/db-UiVJ_81p.js">
27
29
  <link rel="modulepreload" crossorigin href="/assets/types-U7svdiTt.js">
28
- <link rel="modulepreload" crossorigin href="/assets/fetch-body-DlhSI6C_.js">
29
- <link rel="modulepreload" crossorigin href="/assets/magick-wasm-BzLDiChi.js">
30
- <link rel="modulepreload" crossorigin href="/assets/skills-QfRZv1Vq.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/fetch-body-BbyAckTk.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/magick-wasm-Bq3dEoCR.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/skills-DntCVcJc.js">
31
33
  <link rel="modulepreload" crossorigin href="/assets/__vite-browser-external-B-U7N2L4.js">
32
- <link rel="modulepreload" crossorigin href="/assets/index-DI4uugll.js">
33
- <link rel="modulepreload" crossorigin href="/assets/fs-C-hr4_Ra.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/index-BYi91L97.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/fs-CaPY5ftT.js">
34
36
  <link rel="stylesheet" crossorigin href="/assets/index-B83C5cLK.css">
35
37
  </head>
36
38
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliccy",
3
- "version": "2.30.1",
3
+ "version": "2.32.0",
4
4
  "description": "Browser-based coding agent with thin CLI server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "test:coverage": "vitest run --coverage",
46
46
  "test:coverage:cloudflare-worker": "vitest run --project cloudflare-worker --coverage --coverage.thresholds.lines=75 --coverage.thresholds.statements=75 --coverage.thresholds.functions=85 --coverage.thresholds.branches=65",
47
47
  "test:coverage:node-server": "vitest run --project node-server --coverage --coverage.thresholds.lines=65 --coverage.thresholds.statements=65 --coverage.thresholds.functions=65 --coverage.thresholds.branches=55",
48
- "test:coverage:chrome-extension": "vitest run --project chrome-extension --coverage --coverage.thresholds.lines=55 --coverage.thresholds.statements=55 --coverage.thresholds.functions=60 --coverage.thresholds.branches=45",
48
+ "test:coverage:chrome-extension": "vitest run --project chrome-extension --coverage --coverage.exclude='**/node_modules/**' --coverage.exclude='**/dist/**' --coverage.exclude='**/tests/**' --coverage.exclude='**/*.d.ts' --coverage.exclude='**/*.config.{ts,js,mjs}' --coverage.exclude='**/types.ts' --coverage.exclude='**/index.html' --coverage.exclude='**/shims/**' --coverage.exclude='packages/*/src/**/*.test.ts' --coverage.exclude='packages/webapp/src/scoops/**' --coverage.exclude='packages/webapp/src/core/proxy-error.ts' --coverage.exclude='packages/node-server/src/**' --coverage.thresholds.lines=55 --coverage.thresholds.statements=55 --coverage.thresholds.functions=60 --coverage.thresholds.branches=45",
49
49
  "test:coverage:webapp": "vitest run --project webapp --coverage",
50
50
  "test:server-integration": "vitest run --config packages/node-server/tests/integration/server/vitest.config.ts",
51
51
  "test:e2e": "npx playwright test --config packages/webapp/tests/e2e/playwright.config.ts",
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-jRWAZmH_.js";import{t}from"./remote-cache-BMnV55WX.js";import{a as n,i as r,n as i,r as a}from"./index-DI4uugll.js";var o=e({DaMountBackend:()=>r,RemoteMountCache:()=>t,S3MountBackend:()=>n,makeSignedFetchDa:()=>i,makeSignedFetchS3:()=>a});export{o as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./logger-GnnuzSDq.js";var t=e(`offscreen-client`),n=class{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;selectedScoopJid=null;constructor(e){this.callbacks=e,this.setupMessageListener()}setLocalFS(e){this.localFs=e}createAgentHandle(){return{sendMessage:(e,t,n)=>{if(!this.selectedScoopJid){this.emitToUI({type:`error`,error:`No scoop selected`});return}this.send({type:`user-message`,scoopJid:this.selectedScoopJid,text:e,attachments:n,messageId:t??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`})},onEvent:e=>(this.eventListeners.add(e),()=>this.eventListeners.delete(e)),stop:()=>{this.selectedScoopJid&&this.send({type:`abort`,scoopJid:this.selectedScoopJid})}}}getScoops(){return this.scoops}getScoop(e){return this.scoops.find(t=>t.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)===`processing`}async registerScoop(e){if(!e.isCone)throw Error(`OffscreenClient.registerScoop is cone-only; use scoop_scoop for non-cone scoops`);this.scoops.find(t=>t.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,`initializing`)),this.send({type:`cone-create`,name:e.name})}async unregisterScoop(e){this.send({type:`scoop-drop`,scoopJid:e}),this.scoops=this.scoops.filter(t=>t.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return``;try{let e=await this.localFs.readFile(`/shared/CLAUDE.md`,{encoding:`utf-8`});return typeof e==`string`?e:new TextDecoder().decode(e)}catch{return``}}getScoopContext(e){if(this.localFs)return{getFS:()=>this.localFs}}getSharedFS(){return this.localFs}stopScoop(e){this.send({type:`abort`,scoopJid:e})}async clearQueuedMessages(e){}async deleteQueuedMessage(e,t){}updateModel(){this.send({type:`refresh-model`})}setScoopThinkingLevel(e,t){this.send({type:`set-thinking-level`,scoopJid:e,level:t})}async clearAllMessages(){this.send({type:`clear-chat`})}clearFilesystem(){this.send({type:`clear-filesystem`})}requestState(){this.send({type:`request-state`});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null);return}t.debug(`Retrying request-state`,{attempt:e}),this.send({type:`request-state`})},500)}isReady(){return this.ready}sprinkleOpHandler=null;sendSprinkleLick(e,t,n){this.send({type:`sprinkle-lick`,sprinkleName:e,body:t,targetScoop:n})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}setupMessageListener(){chrome.runtime.onMessage.addListener((e,t,n)=>{if(!i(e))return!1;let r=e;if(r.source===`offscreen`){let e=r.payload;if(e?.type===`debug-tabs`){let t=window.__slicc_debug_tabs;t?.(!!e.show)}else e?.type===`sprinkle-op`&&this.sprinkleOpHandler?this.sprinkleOpHandler(e):this.handleOffscreenMessage(r.payload)}return!1})}handleOffscreenMessage(e){switch(e.type){case`offscreen-ready`:t.info(`Offscreen engine ready`),this.ready||this.send({type:`request-state`});break;case`agent-event`:this.handleAgentEvent(e);break;case`scoop-status`:this.handleScoopStatus(e);break;case`scoop-created`:this.handleScoopCreated(e);break;case`scoop-list`:this.handleScoopList(e);break;case`state-snapshot`:this.handleStateSnapshot(e);break;case`error`:this.handleError(e);break;case`incoming-message`:this.handleIncomingMessage(e);break;case`scoop-messages-replaced`:{let t=e;this.callbacks.onScoopMessagesReplaced?.(t.scoopJid,t.messages);break}}}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case`text_delta`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${r()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`content_delta`,messageId:t,text:e.text??``});break}case`tool_start`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${r()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_use_start`,messageId:t,toolName:e.toolName??``,toolInput:e.toolInput});break}case`tool_end`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_result`,messageId:t,toolName:e.toolName??``,result:e.toolResult??``,isError:e.isError});break}case`tool_ui`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${r()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_ui`,messageId:t,toolName:e.toolName??``,requestId:e.requestId??``,html:e.html??``});break}case`tool_ui_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_ui_done`,messageId:t,requestId:e.requestId??``});break}case`response_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&(this.emitToUI({type:`content_done`,messageId:t}),this.currentMessageId.delete(e.scoopJid));break}case`turn_end`:{let t=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${r()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:`turn_end`,messageId:t});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){let t=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(e=>e.name!==t.name||e.jid===t.jid),this.scoops.find(e=>e.jid===t.jid)||this.scoops.push(t),this.scoopStatuses.set(t.jid,e.scoop.status),this.callbacks.onScoopCreated(t)}handleScoopList(e){this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){t.info(`Received state snapshot`,{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);let n=!this.ready;n&&(this.ready=!0,this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null)),this.callbacks.onScoopListUpdate(e.scoops),n&&this.callbacks.onReady?.()}handleError(e){e.scoopJid===this.selectedScoopJid&&this.emitToUI({type:`error`,error:e.error})}handleIncomingMessage(e){this.callbacks.onIncomingMessage(e.scoopJid,e.message)}msgScoopToRegistered(e){return{jid:e.jid,name:e.name,folder:e.folder,isCone:e.isCone,type:e.isCone?`cone`:`scoop`,requiresTrigger:!e.isCone,assistantLabel:e.assistantLabel,addedAt:new Date().toISOString(),...e.config?{config:{...e.config}}:{}}}emitToUI(e){for(let n of this.eventListeners)try{n(e)}catch(e){t.error(`Listener error`,{error:e instanceof Error?e.message:String(e)})}}send(e){chrome.runtime.sendMessage({source:`panel`,payload:e}).catch(e=>{t.error(`Failed to send to offscreen`,{error:e instanceof Error?e.message:String(e)})})}};function r(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function i(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}export{n as OffscreenClient};