@inkeep/open-knowledge 0.20.0-beta.7 → 0.20.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +9 -9
- package/dist/constants-guHl6645.mjs +2 -0
- package/dist/{dist-BD4HwRwv.mjs → dist-CX2NKvL3.mjs} +5 -5
- package/dist/{dist-C7UX8Qzt.mjs → dist-n9uYOrGl.mjs} +1 -1
- package/dist/{gh-detect-BDIdc7oG.mjs → gh-detect-D4j_2KZA.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-tXC9WSsK.mjs → init-CMfDQGkl.mjs} +4 -4
- package/dist/init-xPihugg8.mjs +1 -0
- package/dist/loader-C8nqTo1Q.mjs +1 -0
- package/dist/{loader-Djfd-Wlm.mjs → loader-C9FLjkmp.mjs} +2 -2
- package/dist/{preview-C6hRCpi4.mjs → preview-D2CQ6yHX.mjs} +2 -2
- package/dist/preview-DVTHD8sU.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Bw1oRtQH.js → ActivityModeContent-DbFWb8AO.js} +1 -1
- package/dist/public/assets/{DocumentContext-o-LUu0wz.js → DocumentContext-B2qgy31k.js} +2 -2
- package/dist/public/assets/{GraphPanel-BVt0SfrM.js → GraphPanel-sDi-_TRH.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-D-xwymUR.js → ManagedArtifactProperties-D40g_fzP.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CeeQNbcR.js → PropertyPanel-Ca0E5GKl.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-wC0Rm8N5.js → SettingsDialogBody-DAgimxsR.js} +2 -2
- package/dist/public/assets/{SkillEditorActions-Y_e1zC_b.js → SkillEditorActions-DKVNhzBj.js} +1 -1
- package/dist/public/assets/{SourceEditor-4ljQqBHw.js → SourceEditor-DxmNPlc5.js} +2 -2
- package/dist/public/assets/{TerminalPanel-C9rmhBG2.js → TerminalPanel-DIRUaDNy.js} +1 -1
- package/dist/public/assets/{config-validation-events-mtT7Nmop.js → config-validation-events-Ct_n4YVx.js} +4 -4
- package/dist/public/assets/dist-BrFh1X3E.js +524 -0
- package/dist/public/assets/{documents-events-DMS5a4By.js → documents-events-keB3Tua2.js} +1 -1
- package/dist/public/assets/index-JZXtAkn1.js +2004 -0
- package/dist/public/assets/{keyboard-shortcuts-DGu1nhPQ.js → keyboard-shortcuts-DWO3dbNP.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-Bvt3X7yV.js → open-managed-artifact-tab-BpWVbrq3.js} +1 -1
- package/dist/public/assets/{prop-types-Cf7ylXsu.js → prop-types-DAdpyyQb.js} +1 -1
- package/dist/public/assets/{selection-context-CFA_dZau.js → selection-context-CvCY4HqN.js} +1 -1
- package/dist/public/assets/{skill-actions-CQ-n4sOB.js → skill-actions-IJVLen8G.js} +1 -1
- package/dist/public/assets/{skills-api-q4V5pwth.js → skills-api-BNk9GDF4.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-CCRb_XMp.js → target-navigation-intent-UQ8it6hJ.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BfS-xBMY.js → typing-burst-detector-DunF9z9v.js} +2 -2
- package/dist/public/index.html +14 -14
- package/dist/{repair-launch-json-TUK_SdBP.mjs → repair-launch-json-C9KJ4bPN.mjs} +2 -2
- package/dist/{repair-mcp-configs-AXgjVWOZ.mjs → repair-mcp-configs-BtoZ6M_S.mjs} +2 -2
- package/dist/{repair-skills-DSxz7qY4.mjs → repair-skills-B98v58k0.mjs} +2 -2
- package/dist/repair-skills-BnIHtXhN.mjs +1 -0
- package/dist/server-lock-8Lv6A-Xa-Cwb8QI-d.mjs +1 -0
- package/dist/{server-lock-CN2YHwpP-COM23IWb.mjs → server-lock-CN2YHwpP-BhBKViGp.mjs} +114 -114
- package/dist/{src-CjUcbTUv.mjs → src-CThY_5pJ.mjs} +2 -2
- package/dist/{start-D6KVRcwv.mjs → start-Bc4ER1Ku.mjs} +2 -2
- package/dist/start-D8Ns1Flr.mjs +1 -0
- package/dist/{write-project-skill-CHLl9ySs.mjs → write-project-skill-C4u_YHBP.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-C1DCSZPa.mjs +0 -2
- package/dist/init-DaBG9Vt5.mjs +0 -1
- package/dist/loader-CpxBkx-l.mjs +0 -1
- package/dist/preview-DmtYPtUD.mjs +0 -1
- package/dist/public/assets/dist-Dst_hB5H.js +0 -524
- package/dist/public/assets/index-BZo7KSQC.js +0 -2004
- package/dist/repair-skills-CLwWZbvZ.mjs +0 -1
- package/dist/server-lock-8Lv6A-Xa-iDqi_bbE.mjs +0 -1
- package/dist/start-DYwAiJfq.mjs +0 -1
package/dist/public/assets/{SkillEditorActions-Y_e1zC_b.js → SkillEditorActions-DKVNhzBj.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i}from"./dist-CQw2y-s3.js";import{N as ee,Tt as a}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i}from"./dist-CQw2y-s3.js";import{N as ee,Tt as a}from"./dist-BrFh1X3E.js";import{l as te,t as ne}from"./button-DGf25ccp.js";import{t as o}from"./chevron-down-BaPMAfbX.js";import{i as s,r as c}from"./skill-actions-IJVLen8G.js";import{T as re,_ as l,h as u,m as ie,p as ae,v as oe,x as d}from"./skills-api-BNk9GDF4.js";var se=r(),f=e(t(),1),p=n(),m=a.options;function h(e){let t=(0,se.c)(74),{scope:n,name:r}=e,a=s(),h=c(),g;t[0]!==r||t[1]!==n||t[2]!==a.data||t[3]!==a.status?(g=a.status===`ready`?a.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=a.data,t[3]=a.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=ae;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let s;t[38]!==E||t[39]!==b?(s=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=s):s=t[40];let c;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(o,{"aria-hidden":!0}),t[41]=c):c=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==s?(W=(0,p.jsx)(re,{asChild:!0,children:(0,p.jsxs)(ne,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[s,c]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=s,t[46]=W):W=t[46],L=u,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(oe,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(ie,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ee[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(d,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(l,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(l,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$ as i,An as a,At as o,
|
|
2
|
-
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},he=A.fromClass(G),ge=M.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),_e=F.define(),ve=class extends w{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return v(`span`,[u(`class`,`cm-ySelectionCaret`),u(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[c(``),v(`div`,[u(`class`,`cm-ySelectionCaretDot`)]),c(``),v(`div`,[u(`class`,`cm-ySelectionInfo`)],[c(this.name)]),c(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},ye=class{constructor(e){this.conf=e.state.facet(U),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[_e.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=N.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],o=this.conf.awareness.getLocalState();if(o!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,a=o.cursor==null?null:b(o.cursor.anchor),s=o.cursor==null?null:b(o.cursor.head);if(i!=null){let e=p(t,i.anchor),n=p(t,i.head);(o.cursor==null||!x(a,e)||!x(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else o.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((o,s)=>{if(s===r.doc.clientID)return;let c=o.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=a(c.anchor,n),u=a(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:f=`#30bced`,name:p=`Anonymous`}=o.user||{},m=o.user&&o.user.colorLight||f+`33`,h=y(l.index,u.index),g=d(l.index,u.index),_=e.view.state.doc.lineAt(h),v=e.view.state.doc.lineAt(g);if(_.number===v.number)i.push({from:h,to:g,value:D.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})});else{i.push({from:h,to:_.from+_.length,value:D.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})}),i.push({from:v.from,to:g,value:D.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})});for(let t=_.number+1;t<v.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:D.line({attributes:{style:`background-color: ${m}`,class:`cm-yLineSelection`}})})}}i.push({from:u.index,to:u.index,value:D.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new ve(f,p)})})}),this.decorations=D.set(i,!0)}},be=A.fromClass(ye,{decorations:e=>e.decorations}),xe=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},K=O.define({combine(e){return e[e.length-1]}});F.define();var Se=class{constructor(e){this.view=e,this.conf=e.state.facet(K),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(U),this._beforeChangeSelection=null,this._mux=s(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[M.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(W)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Ce=A.fromClass(Se),we=({state:e,dispatch:t})=>e.facet(K).undo()||!0,Te=({state:e,dispatch:t})=>e.facet(K).redo()||!0,Ee=(e,t,{undoManager:n=new g(e)}={})=>{let r=new H(e,t),i=[U.of(r),he];return t&&i.push(ge,be),n!==!1&&i.push(K.of(new xe(n)),Ce,M.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?we(t):e.inputType===`historyRedo`?Te(t):!1}})),i},De=D.mark({class:`cm-link-ref-broken`}),q=/^\s{0,3}\[([^\]]+)\]:\s/,J=/\[([^\]]*)\]\[([^\]]*)\]/g,Oe=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Y(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function ke(e){let t=[];return k(e).iterate({enter(e){if(Oe.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function X(e){let t=new Set,n=[],r=e.doc,i=ke(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Y(n.from,i))continue;let a=q.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Y(t.from,i)&&!q.test(t.text))for(J.lastIndex=0;;){let e=J.exec(t.text);if(!e)break;let r=t.from+e.index;if(Y(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(De.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),D.set(a)}var Ae=E.define({create(e){return X(e)},update(e,t){return t.docChanged?X(t.state):e},provide:e=>M.decorations.from(e)}),je=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Me=D.mark({class:`cm-del`}),Ne=D.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),Z=D.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Pe(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Fe(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!S.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(S.test(r.text))return{from:t.from,to:r.to}}return null}function Q(e,t){let n=[],r=k(e),i=Fe(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(Me.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=je.exec(r.text),a=i?i[1].length:2,o=D.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=Pe(r.text),a=D.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(Ne.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),D.set(n)}var Ie=class{decorations;constructor(e){this.decorations=Q(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||k(e.startState)!==k(e.state))&&(this.decorations=Q(e.view.state,e.view.visibleRanges))}},Le=A.fromClass(Ie,{decorations:e=>e.decorations});function Re(){return[Le,Ae]}var ze=n(),Be=56;function $(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&S.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(S.test(n.line(e).text)){r=e+1;break}}let i=C(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:T.cursor(r.from),effects:M.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Ve(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:T.cursor(r),effects:M.scrollIntoView(r,{y:`center`})}),e.focus()})}function He(e){let t=(0,me.c)(33),{docName:n,ytext:r,provider:a,placeholder:s,isSourceModeActive:c}=e,l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,p]=(0,B.useState)(null);if(d)throw d;let{resolvedTheme:h}=ne(),{merged:g}=ie(),v=(0,B.useRef)(c),y=g?.editor?.wordWrap??!0,b,x;t[0]===c?(b=t[1],x=t[2]):(b=()=>{v.current=c},x=[c],t[0]=c,t[1]=b,t[2]=x),(0,B.useEffect)(b,x);let S=(0,B.useRef)(null),C;t[3]!==s||t[4]!==a||t[5]!==h||t[6]!==y||t[7]!==r?(C=()=>{let e=l.current;if(!e)return;let t=a.configuration.name??``,n,c=Ge;try{n=o({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let n=null,o=i({ydoc:a.document,ytext:r}),l=new j,u=new j,d=new j,p=new M({state:oe.create({doc:r.toString(),extensions:[pe,le({scrollToMatch:We}),se.of([ee]),Ee(r,a.awareness),...f({themeCompartment:l,resolvedTheme:h,ydoc:a.document,wordWrapCompartment:u,wordWrap:y,currentDocName:t}),Re(),o,M.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,L(t,`source`,ce(e.view)),z(t,`source`,R(e.view,t))},120))}),M.domEventHandlers({keydown:(e,t)=>!v.current||!re()||!ae(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),fe(),!0)}),d.of(P(s??``)),M.theme({"&":{height:`100%`}}),M.scrollMargins.of(Ue)]}),parent:e});L(t,`source`,ce(p)),z(t,`source`,R(p,t));let m=p.contentDOM;return m.addEventListener(`keydown`,c),m.addEventListener(`paste`,c),m.addEventListener(`drop`,c),m.addEventListener(`cut`,c),{view:p,ydoc:a.document,ytext:r,provider:a,themeCompartment:l,wordWrapCompartment:u,placeholderCompartment:d}}}),S.current=n,u.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),S.current=null,u.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=S.current;e&&te(e),S.current=null,u.current=null}},t[3]=s,t[4]=a,t[5]=h,t[6]=y,t[7]=r,t[8]=C):C=t[8];let w;t[9]!==a||t[10]!==r?(w=[r,a],t[9]=a,t[10]=r,t[11]=w):w=t[11],(0,B.useEffect)(C,w);let T,E;t[12]===n?(T=t[13],E=t[14]):(T=()=>{},E=[n],t[12]=n,t[13]=T,t[14]=E),(0,B.useEffect)(T,E);let D,O;t[15]===h?(D=t[16],O=t[17]):(D=()=>{let e=S.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?m:_)})},O=[h],t[15]=h,t[16]=D,t[17]=O),(0,B.useEffect)(D,O);let k,A;t[18]===y?(k=t[19],A=t[20]):(A=()=>{let e=S.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(y?M.lineWrapping:[])})},k=[y],t[18]=y,t[19]=k,t[20]=A),(0,B.useEffect)(A,k);let N,F;t[21]===s?(N=t[22],F=t[23]):(N=()=>{let e=S.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(P(s??``))})},F=[s],t[21]=s,t[22]=N,t[23]=F),(0,B.useEffect)(N,F);let V,H;t[24]!==n||t[25]!==c?(V=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!c)return;let r=u.current;r&&($(r,t),de(n))};return window.addEventListener(I,e),()=>window.removeEventListener(I,e)},H=[n,c],t[24]=n,t[25]=c,t[26]=V,t[27]=H):(V=t[26],H=t[27]),(0,B.useEffect)(V,H);let U,W;t[28]!==n||t[29]!==c?(U=()=>{if(!c)return;let e=u.current;if(!e)return;let t=ue(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}Ve(e,t.detail)}},W=[n,c],t[28]=n,t[29]=c,t[30]=U,t[31]=W):(U=t[30],W=t[31]),(0,B.useEffect)(U,W);let G;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,ze.jsx)(`div`,{ref:l,className:`source-editor h-full pb-3`}),t[32]=G):G=t[32],G}function Ue(){return{top:Be}}function We(e){return M.scrollIntoView(e,{y:`start`})}function Ge(){return l()}export{He as SourceEditor};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$ as i,An as a,At as o,Dn as s,Fn as c,G as l,In as u,Ln as d,M as f,Mn as p,N as m,Nn as h,P as g,Pn as _,Rn as v,Z as ee,jn as y,jt as te,kn as b,zn as x}from"./DocumentContext-B2qgy31k.js";import{I as S,Ri as ne,hn as C,si as re}from"./dist-BrFh1X3E.js";import{n as ie}from"./config-context-DhhN0rlf.js";import{l as ae}from"./keyboard-shortcuts-DWO3dbNP.js";import{$ as w,Dt as oe,Et as T,Ft as E,J as D,Ot as O,P as k,Q as A,Tt as j,X as M,jt as N,pt as P,ut as se,xt as F}from"./dist-BXTYSiRS.js";import{a as ce,d as le,f as I,h as ue,i as L,m as de,t as fe,u as pe}from"./typing-burst-detector-DunF9z9v.js";import{o as R,r as z}from"./selection-context-CvCY4HqN.js";var B=e(t(),1),me=r(),V=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:_(this.yanchor),yhead:_(this.yhead)}}static fromJSON(t){return new e(p(t.yanchor),p(t.yhead))}},H=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new b(e)}toYPos(e,t=0){return h(this.ytext,e,t)}fromYPos(e){let t=y(p(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new V(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?T.cursor(n.pos,n.assoc):T.range(t.pos,n.pos)}},U=O.define({combine(e){return e[e.length-1]}}),W=F.define(),G=class{constructor(e){this.view=e,this.conf=e.state.facet(U),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[W.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(W)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
2
|
+
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},he=A.fromClass(G),ge=M.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),_e=F.define(),ve=class extends w{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return c(`span`,[d(`class`,`cm-ySelectionCaret`),d(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[u(``),c(`div`,[d(`class`,`cm-ySelectionCaretDot`)]),u(``),c(`div`,[d(`class`,`cm-ySelectionInfo`)],[u(this.name)]),u(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},ye=class{constructor(e){this.conf=e.state.facet(U),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[_e.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=N.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],o=this.conf.awareness.getLocalState();if(o!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,s=o.cursor==null?null:p(o.cursor.anchor),c=o.cursor==null?null:p(o.cursor.head);if(i!=null){let e=h(t,i.anchor),n=h(t,i.head);(o.cursor==null||!a(s,e)||!a(c,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else o.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=y(s.anchor,n),l=y(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,p=x(c.index,l.index),m=v(c.index,l.index),h=e.view.state.doc.lineAt(p),g=e.view.state.doc.lineAt(m);if(h.number===g.number)i.push({from:p,to:m,value:D.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:p,to:h.from+h.length,value:D.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:g.from,to:m,value:D.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=h.number+1;t<g.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:D.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:D.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new ve(u,d)})})}),this.decorations=D.set(i,!0)}},be=A.fromClass(ye,{decorations:e=>e.decorations}),xe=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},K=O.define({combine(e){return e[e.length-1]}});F.define();var Se=class{constructor(e){this.view=e,this.conf=e.state.facet(K),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(U),this._beforeChangeSelection=null,this._mux=s(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[M.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(W)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Ce=A.fromClass(Se),we=({state:e,dispatch:t})=>e.facet(K).undo()||!0,Te=({state:e,dispatch:t})=>e.facet(K).redo()||!0,Ee=(e,t,{undoManager:n=new b(e)}={})=>{let r=new H(e,t),i=[U.of(r),he];return t&&i.push(ge,be),n!==!1&&i.push(K.of(new xe(n)),Ce,M.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?we(t):e.inputType===`historyRedo`?Te(t):!1}})),i},De=D.mark({class:`cm-link-ref-broken`}),q=/^\s{0,3}\[([^\]]+)\]:\s/,J=/\[([^\]]*)\]\[([^\]]*)\]/g,Oe=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Y(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function ke(e){let t=[];return k(e).iterate({enter(e){if(Oe.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function X(e){let t=new Set,n=[],r=e.doc,i=ke(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Y(n.from,i))continue;let a=q.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Y(t.from,i)&&!q.test(t.text))for(J.lastIndex=0;;){let e=J.exec(t.text);if(!e)break;let r=t.from+e.index;if(Y(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(De.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),D.set(a)}var Ae=E.define({create(e){return X(e)},update(e,t){return t.docChanged?X(t.state):e},provide:e=>M.decorations.from(e)}),je=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Me=D.mark({class:`cm-del`}),Ne=D.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),Z=D.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Pe(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Fe(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!S.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(S.test(r.text))return{from:t.from,to:r.to}}return null}function Q(e,t){let n=[],r=k(e),i=Fe(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(Me.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=je.exec(r.text),a=i?i[1].length:2,o=D.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=Pe(r.text),a=D.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(Ne.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),D.set(n)}var Ie=class{decorations;constructor(e){this.decorations=Q(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||k(e.startState)!==k(e.state))&&(this.decorations=Q(e.view.state,e.view.visibleRanges))}},Le=A.fromClass(Ie,{decorations:e=>e.decorations});function Re(){return[Le,Ae]}var ze=n(),Be=56;function $(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&S.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(S.test(n.line(e).text)){r=e+1;break}}let i=C(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:T.cursor(r.from),effects:M.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Ve(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:T.cursor(r),effects:M.scrollIntoView(r,{y:`center`})}),e.focus()})}function He(e){let t=(0,me.c)(33),{docName:n,ytext:r,provider:a,placeholder:s,isSourceModeActive:c}=e,l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,p]=(0,B.useState)(null);if(d)throw d;let{resolvedTheme:h}=ne(),{merged:_}=ie(),v=(0,B.useRef)(c),y=_?.editor?.wordWrap??!0,b,x;t[0]===c?(b=t[1],x=t[2]):(b=()=>{v.current=c},x=[c],t[0]=c,t[1]=b,t[2]=x),(0,B.useEffect)(b,x);let S=(0,B.useRef)(null),C;t[3]!==s||t[4]!==a||t[5]!==h||t[6]!==y||t[7]!==r?(C=()=>{let e=l.current;if(!e)return;let t=a.configuration.name??``,n,c=Ge;try{n=o({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let n=null,o=i({ydoc:a.document,ytext:r}),l=new j,u=new j,d=new j,p=new M({state:oe.create({doc:r.toString(),extensions:[pe,le({scrollToMatch:We}),se.of([ee]),Ee(r,a.awareness),...f({themeCompartment:l,resolvedTheme:h,ydoc:a.document,wordWrapCompartment:u,wordWrap:y,currentDocName:t}),Re(),o,M.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,L(t,`source`,ce(e.view)),z(t,`source`,R(e.view,t))},120))}),M.domEventHandlers({keydown:(e,t)=>!v.current||!re()||!ae(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),fe(),!0)}),d.of(P(s??``)),M.theme({"&":{height:`100%`}}),M.scrollMargins.of(Ue)]}),parent:e});L(t,`source`,ce(p)),z(t,`source`,R(p,t));let m=p.contentDOM;return m.addEventListener(`keydown`,c),m.addEventListener(`paste`,c),m.addEventListener(`drop`,c),m.addEventListener(`cut`,c),{view:p,ydoc:a.document,ytext:r,provider:a,themeCompartment:l,wordWrapCompartment:u,placeholderCompartment:d}}}),S.current=n,u.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),S.current=null,u.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=S.current;e&&te(e),S.current=null,u.current=null}},t[3]=s,t[4]=a,t[5]=h,t[6]=y,t[7]=r,t[8]=C):C=t[8];let w;t[9]!==a||t[10]!==r?(w=[r,a],t[9]=a,t[10]=r,t[11]=w):w=t[11],(0,B.useEffect)(C,w);let T,E;t[12]===n?(T=t[13],E=t[14]):(T=()=>{},E=[n],t[12]=n,t[13]=T,t[14]=E),(0,B.useEffect)(T,E);let D,O;t[15]===h?(D=t[16],O=t[17]):(D=()=>{let e=S.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?m:g)})},O=[h],t[15]=h,t[16]=D,t[17]=O),(0,B.useEffect)(D,O);let k,A;t[18]===y?(k=t[19],A=t[20]):(A=()=>{let e=S.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(y?M.lineWrapping:[])})},k=[y],t[18]=y,t[19]=k,t[20]=A),(0,B.useEffect)(A,k);let N,F;t[21]===s?(N=t[22],F=t[23]):(N=()=>{let e=S.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(P(s??``))})},F=[s],t[21]=s,t[22]=N,t[23]=F),(0,B.useEffect)(N,F);let V,H;t[24]!==n||t[25]!==c?(V=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!c)return;let r=u.current;r&&($(r,t),de(n))};return window.addEventListener(I,e),()=>window.removeEventListener(I,e)},H=[n,c],t[24]=n,t[25]=c,t[26]=V,t[27]=H):(V=t[26],H=t[27]),(0,B.useEffect)(V,H);let U,W;t[28]!==n||t[29]!==c?(U=()=>{if(!c)return;let e=u.current;if(!e)return;let t=ue(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}Ve(e,t.detail)}},W=[n,c],t[28]=n,t[29]=c,t[30]=U,t[31]=W):(U=t[30],W=t[31]),(0,B.useEffect)(U,W);let G;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,ze.jsx)(`div`,{ref:l,className:`source-editor h-full pb-3`}),t[32]=G):G=t[32],G}function Ue(){return{top:Be}}function We(e){return M.scrollIntoView(e,{y:`start`})}function Ge(){return l()}export{He as SourceEditor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{Kt as a,Ri as o,kt as s}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{Kt as a,Ri as o,kt as s}from"./dist-BrFh1X3E.js";import{l as c,t as l}from"./button-DGf25ccp.js";import{n as u,r as d}from"./dist-BLu8fLv5.js";import{t as f}from"./terminal-theme-BxhEvVX2.js";var p=r(),m=2,h=1,g=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],v=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],y;function b(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var x=class{constructor(){if(this.version=`6`,!y){y=new Uint8Array(65536),y.fill(1),y[0]=0,y.fill(0,1,32),y.fill(0,127,160),y.fill(2,4352,4448),y[9001]=2,y[9002]=2,y.fill(2,11904,42192),y[12351]=1,y.fill(2,44032,55204),y.fill(2,63744,64256),y.fill(2,65040,65050),y.fill(2,65072,65136),y.fill(2,65280,65377),y.fill(2,65504,65511);for(let e=0;e<_.length;++e)y.fill(0,_[e][0],_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?y[e]:b(e,v)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ue.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ue.createPropertyValue(0,n,r)}},S=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?T.isErrorNoTelemetry(e)?new T(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|