texlite 0.8.2 → 0.8.3
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/client/assets/{GitDialog-ULwrGkKd.js → GitDialog-Ds1IhVJ3.js} +1 -1
- package/dist/client/assets/{HistoryDialog-BE7jyWWP.js → HistoryDialog-BOLQxHvV.js} +1 -1
- package/dist/client/assets/{LatexEditor-DbU8fMFZ.js → LatexEditor-2BD2xa8h.js} +1 -1
- package/dist/client/assets/{PdfPreview-BputjYeR.js → PdfPreview-DwKlkGl9.js} +1 -1
- package/dist/client/assets/{ProjectNavigationDialogs-BVE1JsHd.js → ProjectNavigationDialogs-D6grphxz.js} +1 -1
- package/dist/client/assets/{SystemMetricsDialog-DxQsGcIH.js → SystemMetricsDialog-CxiyDnsC.js} +1 -1
- package/dist/client/assets/{index-Dx9UqMyC.js → index-BoLY1azn.js} +21 -21
- package/dist/client/assets/{minus-B08vgSQJ.js → minus-DK3ejRQp.js} +1 -1
- package/dist/client/assets/{spellCheck-9fdyhJtV.js → spellCheck-BAgtQ60E.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/preview-1.png +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as ye,r as n,j as e}from"./react-BoEjKzFZ.js";import{j as u,M as H,L as p,G as q,K as ke,C as ie,k as ne,T as be,l as ve,P as Ce,a as l}from"./index-Dx9UqMyC.js";import{M as Ne,a as we}from"./minus-B08vgSQJ.js";const ze=u("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const ae=u("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const G=u("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oe=u("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const W=u("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const Se=u("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const Ee=u("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);const Te=u("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function $e({open:h,project:o,onOpenChange:y,onBeforeMutation:r}){const{t:s,i18n:E}=ye(),[i,m]=n.useState(null),[J,K]=n.useState([]),[T,k]=n.useState(""),[F,V]=n.useState(()=>re(o.name)),[_,ce]=n.useState(!0),[D,Z]=n.useState(""),[b,M]=n.useState(null),[f,j]=n.useState(null),[U,$]=n.useState(!1),[le,v]=n.useState(!1),[R,L]=n.useState(!0),[P,A]=n.useState(!0),[a,C]=n.useState(""),[Q,N]=n.useState(""),[X,B]=n.useState(""),[g,x]=n.useState(!1),[w,Y]=n.useState(10),O=n.useRef(null),z=async(t=!1)=>{const c=await l(`/api/projects/${o.id}/git`);if(m(c.status),t&&(L(!c.status.tokenConfigured),A(!c.status.remoteUrl)),c.status.initialized&&c.status.latestCommit){const S=await l(`/api/projects/${o.id}/git/history`);K(S.commits)}else K([])};n.useEffect(()=>{if(!h){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),x(!1),k("");return}N(""),B(""),M(null),x(!1),V(re(o.name)),C("load"),r().then(()=>z(!0)).catch(t=>N(t instanceof Error?t.message:s("errors.generic"))).finally(()=>C(""))},[h,o.id]),n.useEffect(()=>{const t=()=>x(document.fullscreenElement===O.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),n.useEffect(()=>{if(!g)return;const t=c=>{c.key==="Escape"&&!document.fullscreenElement&&x(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[g]);const d=async(t,c,S,ee)=>{C(t),N(""),B("");try{await c(),S&&B(S)}catch(se){const te=se instanceof Error?se.message:s("errors.generic");N(ee?`${ee}: ${te}`:te)}finally{C("")}},de=()=>d("token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"PUT",body:JSON.stringify({token:T})});m(t.status),k(""),L(!1)},s("git.tokenSaved")),he=()=>d("remove-token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"DELETE"});m(t.status),k("")},s("git.tokenRemoved")),ge=()=>d("repository",async()=>{const t=await l(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:_})});m(t.status),A(!1)},s("git.repositoryCreated")),ue=()=>d("commit",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});m(t.status),Z(""),M(null),await z()},s("git.committed")),me=()=>d("push",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/push`,{method:"POST"});m(t.status),await z()},s("git.pushed"),s("git.pushFailed")),I=t=>d("diff",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const c=t?`?revision=${encodeURIComponent(t)}`:"";M(await l(`/api/projects/${o.id}/git/diff${c}`))}),fe=async()=>{if(g){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),x(!1);return}const t=O.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}x(!0)},xe=()=>{const t=f;t&&(j(null),d("checkout",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:t==="branch"?null:t.sha,force:U})}),window.location.reload()}))},pe=()=>{v(!1),d("discard",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},je=a==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(H,{open:h,extraWide:!0,className:g?"git-dialog-modal-fullscreen":void 0,title:s("git.title"),description:s("git.description"),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:s("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[je&&e.jsxs("div",{className:"git-loading",children:[e.jsx(p,{className:"spin",size:22}),s("common.loading")]}),Q&&e.jsx("p",{className:"git-message error",children:Q}),X&&e.jsxs("p",{className:"git-message success",children:[e.jsx(q,{size:14}),X]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":R,onClick:()=>L(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(ke,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?s("git.connectedAs",{login:i.githubLogin}):s("git.authenticationHint")})]})]}),R?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),R&&e.jsxs("div",{className:"git-section-content",children:[e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:s("git.recommendedAccessTitle")}),e.jsx("span",{children:s("git.recommendedAccess")})]}),i.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(W,{size:17}),e.jsx("span",{children:s("git.connectedAs",{login:i.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:he,children:[e.jsx(be,{size:14}),s("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[i.tokenConfigured?s("git.replaceToken"):s("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:T,placeholder:s("git.tokenPlaceholder"),onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"git-inline-actions",children:[e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[s("git.createToken"),e.jsx(ae,{size:12})]}),e.jsxs("button",{disabled:!!a||T.trim().length<20,onClick:de,children:[a==="token"&&e.jsx(p,{className:"spin",size:13}),s("git.saveToken")]})]})]})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,onClick:()=>A(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(W,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?s("git.localReady"):s("git.localPending")})]})]}),P?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),P&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??s("git.origin")}),e.jsxs("small",{children:[i.branch??s("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?s("git.changedFiles",{count:i.changedFiles}):s("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(ae,{size:14}),s("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[s("git.repositoryName"),e.jsx("input",{value:F,onChange:t=>V(t.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:t=>ce(t.target.checked)}),s("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!a||!i.tokenConfigured||!F.trim(),onClick:ge,children:[a==="repository"?e.jsx(p,{className:"spin",size:14}):e.jsx(W,{size:14}),s("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(oe,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.commitAndPush")}),e.jsx("small",{children:i.branch?s("git.identity",{username:o.ownerUsername}):s("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[s("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:s("git.commitPlaceholder"),onChange:t=>Z(t.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:s("git.noChangesToCommit"),disabled:!!a||!i.branch||!i.dirty||!D.trim(),onClick:ue,children:[a==="commit"?e.jsx(p,{className:"spin",size:14}):e.jsx(oe,{size:14}),s("git.commit")]}),e.jsxs("button",{disabled:!!a||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit,onClick:me,children:[a==="push"?e.jsx(p,{className:"spin",size:14}):e.jsx(ze,{size:14}),s("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!a||!i.latestCommit,onClick:()=>{I()},children:[a==="diff"?e.jsx(p,{className:"spin",size:14}):e.jsx(G,{size:14}),s("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?s("git.discardChanges"):s("git.noChangesToDiscard"),disabled:!!a||!i.latestCommit||!i.restorable,onClick:()=>v(!0),children:[e.jsx(ve,{size:14}),s("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!a,onClick:()=>{$(!1),j("branch")},children:[e.jsx(q,{size:14}),s("git.returnToBranch",{branch:i.defaultBranch})]}),e.jsxs("button",{disabled:!!a,onClick:()=>{d("refresh",z)},children:[e.jsx(Ee,{className:a==="refresh"?"spin":"",size:14}),s("git.refresh")]})]})]}),b&&e.jsxs("section",{ref:O,className:`git-section git-diff-section${g?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.diffTitle")}),e.jsxs("small",{children:[b.title,b.truncated?` · ${s("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>Y(t=>Math.max(8,t-1)),children:e.jsx(Ne,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>Y(t=>Math.min(24,t+1)),children:e.jsx(Ce,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{fe()},children:g?e.jsx(Se,{size:15}):e.jsx(we,{size:15})})]})]}),e.jsx(Fe,{content:b.diff,empty:s("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(q,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.history")}),e.jsx("small",{children:s("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[J.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:t.message}),e.jsxs("small",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleString(E.resolvedLanguage)]})]}),e.jsxs("span",{children:[e.jsx("button",{title:s("git.viewCommitDiff"),disabled:!!a,onClick:()=>{I(t.sha)},children:e.jsx(G,{size:14})}),e.jsx("button",{title:s("git.checkoutVersion"),disabled:!!a,onClick:()=>{$(!1),j(t)},children:e.jsx(Te,{size:14})})]})]},t.sha)),J.length===0&&e.jsx("p",{className:"muted",children:s("git.noCommits")})]})]})]})]})}),e.jsx(H,{open:!!f,title:s(f==="branch"?"git.returnTitle":"git.checkoutTitle"),description:f==="branch"?s("git.returnDescription",{branch:i?.defaultBranch??"main"}):s("git.checkoutDescription",{revision:f?.shortSha??"",message:f?.message??""}),onOpenChange:t=>{t||j(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>j(null),children:s("common.cancel")}),e.jsx("button",{className:U?"danger":"primary",onClick:xe,children:s("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:U,onChange:t=>$(t.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.forceCheckout")}),e.jsx("small",{children:s("git.forceCheckoutDescription")})]})]})}),e.jsx(H,{open:le,title:s("git.discardTitle"),description:s("git.discardDescription"),onOpenChange:v,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(!1),children:s("common.cancel")}),e.jsx("button",{className:"danger",onClick:pe,children:s("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function Fe({content:h,empty:o,fontSize:y}){return h.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${y}px`},children:h.split(`
|
|
1
|
+
import{u as ye,r as n,j as e}from"./react-BoEjKzFZ.js";import{j as u,M as H,L as p,G as q,K as ke,C as ie,k as ne,T as be,l as ve,P as Ce,a as l}from"./index-BoLY1azn.js";import{M as Ne,a as we}from"./minus-DK3ejRQp.js";const ze=u("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const ae=u("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const G=u("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oe=u("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const W=u("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const Se=u("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const Ee=u("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);const Te=u("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function $e({open:h,project:o,onOpenChange:y,onBeforeMutation:r}){const{t:s,i18n:E}=ye(),[i,m]=n.useState(null),[J,K]=n.useState([]),[T,k]=n.useState(""),[F,V]=n.useState(()=>re(o.name)),[_,ce]=n.useState(!0),[D,Z]=n.useState(""),[b,M]=n.useState(null),[f,j]=n.useState(null),[U,$]=n.useState(!1),[le,v]=n.useState(!1),[R,L]=n.useState(!0),[P,A]=n.useState(!0),[a,C]=n.useState(""),[Q,N]=n.useState(""),[X,B]=n.useState(""),[g,x]=n.useState(!1),[w,Y]=n.useState(10),O=n.useRef(null),z=async(t=!1)=>{const c=await l(`/api/projects/${o.id}/git`);if(m(c.status),t&&(L(!c.status.tokenConfigured),A(!c.status.remoteUrl)),c.status.initialized&&c.status.latestCommit){const S=await l(`/api/projects/${o.id}/git/history`);K(S.commits)}else K([])};n.useEffect(()=>{if(!h){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),x(!1),k("");return}N(""),B(""),M(null),x(!1),V(re(o.name)),C("load"),r().then(()=>z(!0)).catch(t=>N(t instanceof Error?t.message:s("errors.generic"))).finally(()=>C(""))},[h,o.id]),n.useEffect(()=>{const t=()=>x(document.fullscreenElement===O.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),n.useEffect(()=>{if(!g)return;const t=c=>{c.key==="Escape"&&!document.fullscreenElement&&x(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[g]);const d=async(t,c,S,ee)=>{C(t),N(""),B("");try{await c(),S&&B(S)}catch(se){const te=se instanceof Error?se.message:s("errors.generic");N(ee?`${ee}: ${te}`:te)}finally{C("")}},de=()=>d("token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"PUT",body:JSON.stringify({token:T})});m(t.status),k(""),L(!1)},s("git.tokenSaved")),he=()=>d("remove-token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"DELETE"});m(t.status),k("")},s("git.tokenRemoved")),ge=()=>d("repository",async()=>{const t=await l(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:_})});m(t.status),A(!1)},s("git.repositoryCreated")),ue=()=>d("commit",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});m(t.status),Z(""),M(null),await z()},s("git.committed")),me=()=>d("push",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/push`,{method:"POST"});m(t.status),await z()},s("git.pushed"),s("git.pushFailed")),I=t=>d("diff",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const c=t?`?revision=${encodeURIComponent(t)}`:"";M(await l(`/api/projects/${o.id}/git/diff${c}`))}),fe=async()=>{if(g){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),x(!1);return}const t=O.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}x(!0)},xe=()=>{const t=f;t&&(j(null),d("checkout",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:t==="branch"?null:t.sha,force:U})}),window.location.reload()}))},pe=()=>{v(!1),d("discard",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},je=a==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(H,{open:h,extraWide:!0,className:g?"git-dialog-modal-fullscreen":void 0,title:s("git.title"),description:s("git.description"),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:s("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[je&&e.jsxs("div",{className:"git-loading",children:[e.jsx(p,{className:"spin",size:22}),s("common.loading")]}),Q&&e.jsx("p",{className:"git-message error",children:Q}),X&&e.jsxs("p",{className:"git-message success",children:[e.jsx(q,{size:14}),X]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":R,onClick:()=>L(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(ke,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?s("git.connectedAs",{login:i.githubLogin}):s("git.authenticationHint")})]})]}),R?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),R&&e.jsxs("div",{className:"git-section-content",children:[e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:s("git.recommendedAccessTitle")}),e.jsx("span",{children:s("git.recommendedAccess")})]}),i.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(W,{size:17}),e.jsx("span",{children:s("git.connectedAs",{login:i.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:he,children:[e.jsx(be,{size:14}),s("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[i.tokenConfigured?s("git.replaceToken"):s("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:T,placeholder:s("git.tokenPlaceholder"),onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"git-inline-actions",children:[e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[s("git.createToken"),e.jsx(ae,{size:12})]}),e.jsxs("button",{disabled:!!a||T.trim().length<20,onClick:de,children:[a==="token"&&e.jsx(p,{className:"spin",size:13}),s("git.saveToken")]})]})]})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,onClick:()=>A(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(W,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?s("git.localReady"):s("git.localPending")})]})]}),P?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),P&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??s("git.origin")}),e.jsxs("small",{children:[i.branch??s("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?s("git.changedFiles",{count:i.changedFiles}):s("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(ae,{size:14}),s("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[s("git.repositoryName"),e.jsx("input",{value:F,onChange:t=>V(t.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:t=>ce(t.target.checked)}),s("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!a||!i.tokenConfigured||!F.trim(),onClick:ge,children:[a==="repository"?e.jsx(p,{className:"spin",size:14}):e.jsx(W,{size:14}),s("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(oe,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.commitAndPush")}),e.jsx("small",{children:i.branch?s("git.identity",{username:o.ownerUsername}):s("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[s("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:s("git.commitPlaceholder"),onChange:t=>Z(t.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:s("git.noChangesToCommit"),disabled:!!a||!i.branch||!i.dirty||!D.trim(),onClick:ue,children:[a==="commit"?e.jsx(p,{className:"spin",size:14}):e.jsx(oe,{size:14}),s("git.commit")]}),e.jsxs("button",{disabled:!!a||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit,onClick:me,children:[a==="push"?e.jsx(p,{className:"spin",size:14}):e.jsx(ze,{size:14}),s("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!a||!i.latestCommit,onClick:()=>{I()},children:[a==="diff"?e.jsx(p,{className:"spin",size:14}):e.jsx(G,{size:14}),s("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?s("git.discardChanges"):s("git.noChangesToDiscard"),disabled:!!a||!i.latestCommit||!i.restorable,onClick:()=>v(!0),children:[e.jsx(ve,{size:14}),s("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!a,onClick:()=>{$(!1),j("branch")},children:[e.jsx(q,{size:14}),s("git.returnToBranch",{branch:i.defaultBranch})]}),e.jsxs("button",{disabled:!!a,onClick:()=>{d("refresh",z)},children:[e.jsx(Ee,{className:a==="refresh"?"spin":"",size:14}),s("git.refresh")]})]})]}),b&&e.jsxs("section",{ref:O,className:`git-section git-diff-section${g?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.diffTitle")}),e.jsxs("small",{children:[b.title,b.truncated?` · ${s("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>Y(t=>Math.max(8,t-1)),children:e.jsx(Ne,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>Y(t=>Math.min(24,t+1)),children:e.jsx(Ce,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{fe()},children:g?e.jsx(Se,{size:15}):e.jsx(we,{size:15})})]})]}),e.jsx(Fe,{content:b.diff,empty:s("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(q,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.history")}),e.jsx("small",{children:s("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[J.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:t.message}),e.jsxs("small",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleString(E.resolvedLanguage)]})]}),e.jsxs("span",{children:[e.jsx("button",{title:s("git.viewCommitDiff"),disabled:!!a,onClick:()=>{I(t.sha)},children:e.jsx(G,{size:14})}),e.jsx("button",{title:s("git.checkoutVersion"),disabled:!!a,onClick:()=>{$(!1),j(t)},children:e.jsx(Te,{size:14})})]})]},t.sha)),J.length===0&&e.jsx("p",{className:"muted",children:s("git.noCommits")})]})]})]})]})}),e.jsx(H,{open:!!f,title:s(f==="branch"?"git.returnTitle":"git.checkoutTitle"),description:f==="branch"?s("git.returnDescription",{branch:i?.defaultBranch??"main"}):s("git.checkoutDescription",{revision:f?.shortSha??"",message:f?.message??""}),onOpenChange:t=>{t||j(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>j(null),children:s("common.cancel")}),e.jsx("button",{className:U?"danger":"primary",onClick:xe,children:s("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:U,onChange:t=>$(t.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.forceCheckout")}),e.jsx("small",{children:s("git.forceCheckoutDescription")})]})]})}),e.jsx(H,{open:le,title:s("git.discardTitle"),description:s("git.discardDescription"),onOpenChange:v,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(!1),children:s("common.cancel")}),e.jsx("button",{className:"danger",onClick:pe,children:s("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function Fe({content:h,empty:o,fontSize:y}){return h.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${y}px`},children:h.split(`
|
|
2
2
|
`).map((r,s)=>{const E=r.startsWith("+")&&!r.startsWith("+++")?"addition":r.startsWith("-")&&!r.startsWith("---")?"deletion":r.startsWith("@@")?"hunk":r.startsWith("diff ")?"header":"";return e.jsxs("span",{className:E,children:[r,`
|
|
3
3
|
`]},s)})}):e.jsx("div",{className:"git-diff-empty",children:o})}function re(h){return h.trim().replace(/\s+/g,"-").replace(/[^A-Za-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"").slice(0,100)||"texlite-project"}export{$e as GitDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as re,u as ne,r as I,j as u}from"./react-BoEjKzFZ.js";import{j as H,a as R,M as ie,L as U,H as se,T as J,l as Q,S as ae,F as te,n as G}from"./index-
|
|
1
|
+
import{g as re,u as ne,r as I,j as u}from"./react-BoEjKzFZ.js";import{j as H,a as R,M as ie,L as U,H as se,T as J,l as Q,S as ae,F as te,n as G}from"./index-BoLY1azn.js";const le=H("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const O=H("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);const he=H("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var V={exports:{}},K;function oe(){return K||(K=1,(function(C){var o=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},k=-1,A=1,f=0;o.Diff=function(e,r){return[e,r]},o.prototype.diff_main=function(e,r,n,s){typeof s>"u"&&(this.Diff_Timeout<=0?s=Number.MAX_VALUE:s=new Date().getTime()+this.Diff_Timeout*1e3);var a=s;if(e==null||r==null)throw new Error("Null input. (diff_main)");if(e==r)return e?[new o.Diff(f,e)]:[];typeof n>"u"&&(n=!0);var i=n,t=this.diff_commonPrefix(e,r),l=e.substring(0,t);e=e.substring(t),r=r.substring(t),t=this.diff_commonSuffix(e,r);var h=e.substring(e.length-t);e=e.substring(0,e.length-t),r=r.substring(0,r.length-t);var g=this.diff_compute_(e,r,i,a);return l&&g.unshift(new o.Diff(f,l)),h&&g.push(new o.Diff(f,h)),this.diff_cleanupMerge(g),g},o.prototype.diff_compute_=function(e,r,n,s){var a;if(!e)return[new o.Diff(A,r)];if(!r)return[new o.Diff(k,e)];var i=e.length>r.length?e:r,t=e.length>r.length?r:e,l=i.indexOf(t);if(l!=-1)return a=[new o.Diff(A,i.substring(0,l)),new o.Diff(f,t),new o.Diff(A,i.substring(l+t.length))],e.length>r.length&&(a[0][0]=a[2][0]=k),a;if(t.length==1)return[new o.Diff(k,e),new o.Diff(A,r)];var h=this.diff_halfMatch_(e,r);if(h){var g=h[0],c=h[1],v=h[2],m=h[3],b=h[4],p=this.diff_main(g,v,n,s),M=this.diff_main(c,m,n,s);return p.concat([new o.Diff(f,b)],M)}return n&&e.length>100&&r.length>100?this.diff_lineMode_(e,r,s):this.diff_bisect_(e,r,s)},o.prototype.diff_lineMode_=function(e,r,n){var s=this.diff_linesToChars_(e,r);e=s.chars1,r=s.chars2;var a=s.lineArray,i=this.diff_main(e,r,!1,n);this.diff_charsToLines_(i,a),this.diff_cleanupSemantic(i),i.push(new o.Diff(f,""));for(var t=0,l=0,h=0,g="",c="";t<i.length;){switch(i[t][0]){case A:h++,c+=i[t][1];break;case k:l++,g+=i[t][1];break;case f:if(l>=1&&h>=1){i.splice(t-l-h,l+h),t=t-l-h;for(var v=this.diff_main(g,c,!1,n),m=v.length-1;m>=0;m--)i.splice(t,0,v[m]);t=t+v.length}h=0,l=0,g="",c="";break}t++}return i.pop(),i},o.prototype.diff_bisect_=function(e,r,n){for(var s=e.length,a=r.length,i=Math.ceil((s+a)/2),t=i,l=2*i,h=new Array(l),g=new Array(l),c=0;c<l;c++)h[c]=-1,g[c]=-1;h[t+1]=0,g[t+1]=0;for(var v=s-a,m=v%2!=0,b=0,p=0,M=0,E=0,_=0;_<i&&!(new Date().getTime()>n);_++){for(var S=-_+b;S<=_-p;S+=2){var D=t+S,y;S==-_||S!=_&&h[D-1]<h[D+1]?y=h[D+1]:y=h[D-1]+1;for(var N=y-S;y<s&&N<a&&e.charAt(y)==r.charAt(N);)y++,N++;if(h[D]=y,y>s)p+=2;else if(N>a)b+=2;else if(m){var j=t+v-S;if(j>=0&&j<l&&g[j]!=-1){var T=s-g[j];if(y>=T)return this.diff_bisectSplit_(e,r,y,N,n)}}}for(var P=-_+M;P<=_-E;P+=2){var j=t+P,T;P==-_||P!=_&&g[j-1]<g[j+1]?T=g[j+1]:T=g[j-1]+1;for(var B=T-P;T<s&&B<a&&e.charAt(s-T-1)==r.charAt(a-B-1);)T++,B++;if(g[j]=T,T>s)E+=2;else if(B>a)M+=2;else if(!m){var D=t+v-P;if(D>=0&&D<l&&h[D]!=-1){var y=h[D],N=t+y-D;if(T=s-T,y>=T)return this.diff_bisectSplit_(e,r,y,N,n)}}}}return[new o.Diff(k,e),new o.Diff(A,r)]},o.prototype.diff_bisectSplit_=function(e,r,n,s,a){var i=e.substring(0,n),t=r.substring(0,s),l=e.substring(n),h=r.substring(s),g=this.diff_main(i,t,!1,a),c=this.diff_main(l,h,!1,a);return g.concat(c)},o.prototype.diff_linesToChars_=function(e,r){var n=[],s={};n[0]="";function a(h){for(var g="",c=0,v=-1,m=n.length;v<h.length-1;){v=h.indexOf(`
|
|
2
2
|
`,c),v==-1&&(v=h.length-1);var b=h.substring(c,v+1);(s.hasOwnProperty?s.hasOwnProperty(b):s[b]!==void 0)?g+=String.fromCharCode(s[b]):(m==i&&(b=h.substring(c),v=h.length),g+=String.fromCharCode(m),s[b]=m,n[m++]=b),c=v+1}return g}var i=4e4,t=a(e);i=65535;var l=a(r);return{chars1:t,chars2:l,lineArray:n}},o.prototype.diff_charsToLines_=function(e,r){for(var n=0;n<e.length;n++){for(var s=e[n][1],a=[],i=0;i<s.length;i++)a[i]=r[s.charCodeAt(i)];e[n][1]=a.join("")}},o.prototype.diff_commonPrefix=function(e,r){if(!e||!r||e.charAt(0)!=r.charAt(0))return 0;for(var n=0,s=Math.min(e.length,r.length),a=s,i=0;n<a;)e.substring(i,a)==r.substring(i,a)?(n=a,i=n):s=a,a=Math.floor((s-n)/2+n);return a},o.prototype.diff_commonSuffix=function(e,r){if(!e||!r||e.charAt(e.length-1)!=r.charAt(r.length-1))return 0;for(var n=0,s=Math.min(e.length,r.length),a=s,i=0;n<a;)e.substring(e.length-a,e.length-i)==r.substring(r.length-a,r.length-i)?(n=a,i=n):s=a,a=Math.floor((s-n)/2+n);return a},o.prototype.diff_commonOverlap_=function(e,r){var n=e.length,s=r.length;if(n==0||s==0)return 0;n>s?e=e.substring(n-s):n<s&&(r=r.substring(0,n));var a=Math.min(n,s);if(e==r)return a;for(var i=0,t=1;;){var l=e.substring(a-t),h=r.indexOf(l);if(h==-1)return i;t+=h,(h==0||e.substring(a-t)==r.substring(0,t))&&(i=t,t++)}},o.prototype.diff_halfMatch_=function(e,r){if(this.Diff_Timeout<=0)return null;var n=e.length>r.length?e:r,s=e.length>r.length?r:e;if(n.length<4||s.length*2<n.length)return null;var a=this;function i(p,M,E){for(var _=p.substring(E,E+Math.floor(p.length/4)),S=-1,D="",y,N,j,T;(S=M.indexOf(_,S+1))!=-1;){var P=a.diff_commonPrefix(p.substring(E),M.substring(S)),B=a.diff_commonSuffix(p.substring(0,E),M.substring(0,S));D.length<B+P&&(D=M.substring(S-B,S)+M.substring(S,S+P),y=p.substring(0,E-B),N=p.substring(E+P),j=M.substring(0,S-B),T=M.substring(S+P))}return D.length*2>=p.length?[y,N,j,T,D]:null}var t=i(n,s,Math.ceil(n.length/4)),l=i(n,s,Math.ceil(n.length/2)),h;if(!t&&!l)return null;l?t?h=t[4].length>l[4].length?t:l:h=l:h=t;var g,c,v,m;e.length>r.length?(g=h[0],c=h[1],v=h[2],m=h[3]):(v=h[0],m=h[1],g=h[2],c=h[3]);var b=h[4];return[g,c,v,m,b]},o.prototype.diff_cleanupSemantic=function(e){for(var r=!1,n=[],s=0,a=null,i=0,t=0,l=0,h=0,g=0;i<e.length;)e[i][0]==f?(n[s++]=i,t=h,l=g,h=0,g=0,a=e[i][1]):(e[i][0]==A?h+=e[i][1].length:g+=e[i][1].length,a&&a.length<=Math.max(t,l)&&a.length<=Math.max(h,g)&&(e.splice(n[s-1],0,new o.Diff(k,a)),e[n[s-1]+1][0]=A,s--,s--,i=s>0?n[s-1]:-1,t=0,l=0,h=0,g=0,a=null,r=!0)),i++;for(r&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==k&&e[i][0]==A){var c=e[i-1][1],v=e[i][1],m=this.diff_commonOverlap_(c,v),b=this.diff_commonOverlap_(v,c);m>=b?(m>=c.length/2||m>=v.length/2)&&(e.splice(i,0,new o.Diff(f,v.substring(0,m))),e[i-1][1]=c.substring(0,c.length-m),e[i+1][1]=v.substring(m),i++):(b>=c.length/2||b>=v.length/2)&&(e.splice(i,0,new o.Diff(f,c.substring(0,b))),e[i-1][0]=A,e[i-1][1]=v.substring(0,v.length-b),e[i+1][0]=k,e[i+1][1]=c.substring(b),i++),i++}i++}},o.prototype.diff_cleanupSemanticLossless=function(e){function r(b,p){if(!b||!p)return 6;var M=b.charAt(b.length-1),E=p.charAt(0),_=M.match(o.nonAlphaNumericRegex_),S=E.match(o.nonAlphaNumericRegex_),D=_&&M.match(o.whitespaceRegex_),y=S&&E.match(o.whitespaceRegex_),N=D&&M.match(o.linebreakRegex_),j=y&&E.match(o.linebreakRegex_),T=N&&b.match(o.blanklineEndRegex_),P=j&&p.match(o.blanklineStartRegex_);return T||P?5:N||j?4:_&&!D&&y?3:D||y?2:_||S?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==f&&e[n+1][0]==f){var s=e[n-1][1],a=e[n][1],i=e[n+1][1],t=this.diff_commonSuffix(s,a);if(t){var l=a.substring(a.length-t);s=s.substring(0,s.length-t),a=l+a.substring(0,a.length-t),i=l+i}for(var h=s,g=a,c=i,v=r(s,a)+r(a,i);a.charAt(0)===i.charAt(0);){s+=a.charAt(0),a=a.substring(1)+i.charAt(0),i=i.substring(1);var m=r(s,a)+r(a,i);m>=v&&(v=m,h=s,g=a,c=i)}e[n-1][1]!=h&&(h?e[n-1][1]=h:(e.splice(n-1,1),n--),e[n][1]=g,c?e[n+1][1]=c:(e.splice(n+1,1),n--))}n++}},o.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,o.whitespaceRegex_=/\s/,o.linebreakRegex_=/[\r\n]/,o.blanklineEndRegex_=/\n\r?\n$/,o.blanklineStartRegex_=/^\r?\n\r?\n/,o.prototype.diff_cleanupEfficiency=function(e){for(var r=!1,n=[],s=0,a=null,i=0,t=!1,l=!1,h=!1,g=!1;i<e.length;)e[i][0]==f?(e[i][1].length<this.Diff_EditCost&&(h||g)?(n[s++]=i,t=h,l=g,a=e[i][1]):(s=0,a=null),h=g=!1):(e[i][0]==k?g=!0:h=!0,a&&(t&&l&&h&&g||a.length<this.Diff_EditCost/2&&t+l+h+g==3)&&(e.splice(n[s-1],0,new o.Diff(k,a)),e[n[s-1]+1][0]=A,s--,a=null,t&&l?(h=g=!0,s=0):(s--,i=s>0?n[s-1]:-1,h=g=!1),r=!0)),i++;r&&this.diff_cleanupMerge(e)},o.prototype.diff_cleanupMerge=function(e){e.push(new o.Diff(f,""));for(var r=0,n=0,s=0,a="",i="",t;r<e.length;)switch(e[r][0]){case A:s++,i+=e[r][1],r++;break;case k:n++,a+=e[r][1],r++;break;case f:n+s>1?(n!==0&&s!==0&&(t=this.diff_commonPrefix(i,a),t!==0&&(r-n-s>0&&e[r-n-s-1][0]==f?e[r-n-s-1][1]+=i.substring(0,t):(e.splice(0,0,new o.Diff(f,i.substring(0,t))),r++),i=i.substring(t),a=a.substring(t)),t=this.diff_commonSuffix(i,a),t!==0&&(e[r][1]=i.substring(i.length-t)+e[r][1],i=i.substring(0,i.length-t),a=a.substring(0,a.length-t))),r-=n+s,e.splice(r,n+s),a.length&&(e.splice(r,0,new o.Diff(k,a)),r++),i.length&&(e.splice(r,0,new o.Diff(A,i)),r++),r++):r!==0&&e[r-1][0]==f?(e[r-1][1]+=e[r][1],e.splice(r,1)):r++,s=0,n=0,a="",i="";break}e[e.length-1][1]===""&&e.pop();var l=!1;for(r=1;r<e.length-1;)e[r-1][0]==f&&e[r+1][0]==f&&(e[r][1].substring(e[r][1].length-e[r-1][1].length)==e[r-1][1]?(e[r][1]=e[r-1][1]+e[r][1].substring(0,e[r][1].length-e[r-1][1].length),e[r+1][1]=e[r-1][1]+e[r+1][1],e.splice(r-1,1),l=!0):e[r][1].substring(0,e[r+1][1].length)==e[r+1][1]&&(e[r-1][1]+=e[r+1][1],e[r][1]=e[r][1].substring(e[r+1][1].length)+e[r+1][1],e.splice(r+1,1),l=!0)),r++;l&&this.diff_cleanupMerge(e)},o.prototype.diff_xIndex=function(e,r){var n=0,s=0,a=0,i=0,t;for(t=0;t<e.length&&(e[t][0]!==A&&(n+=e[t][1].length),e[t][0]!==k&&(s+=e[t][1].length),!(n>r));t++)a=n,i=s;return e.length!=t&&e[t][0]===k?i:i+(r-a)},o.prototype.diff_prettyHtml=function(e){for(var r=[],n=/&/g,s=/</g,a=/>/g,i=/\n/g,t=0;t<e.length;t++){var l=e[t][0],h=e[t][1],g=h.replace(n,"&").replace(s,"<").replace(a,">").replace(i,"¶<br>");switch(l){case A:r[t]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case k:r[t]='<del style="background:#ffe6e6;">'+g+"</del>";break;case f:r[t]="<span>"+g+"</span>";break}}return r.join("")},o.prototype.diff_text1=function(e){for(var r=[],n=0;n<e.length;n++)e[n][0]!==A&&(r[n]=e[n][1]);return r.join("")},o.prototype.diff_text2=function(e){for(var r=[],n=0;n<e.length;n++)e[n][0]!==k&&(r[n]=e[n][1]);return r.join("")},o.prototype.diff_levenshtein=function(e){for(var r=0,n=0,s=0,a=0;a<e.length;a++){var i=e[a][0],t=e[a][1];switch(i){case A:n+=t.length;break;case k:s+=t.length;break;case f:r+=Math.max(n,s),n=0,s=0;break}}return r+=Math.max(n,s),r},o.prototype.diff_toDelta=function(e){for(var r=[],n=0;n<e.length;n++)switch(e[n][0]){case A:r[n]="+"+encodeURI(e[n][1]);break;case k:r[n]="-"+e[n][1].length;break;case f:r[n]="="+e[n][1].length;break}return r.join(" ").replace(/%20/g," ")},o.prototype.diff_fromDelta=function(e,r){for(var n=[],s=0,a=0,i=r.split(/\t/g),t=0;t<i.length;t++){var l=i[t].substring(1);switch(i[t].charAt(0)){case"+":try{n[s++]=new o.Diff(A,decodeURI(l))}catch{throw new Error("Illegal escape in diff_fromDelta: "+l)}break;case"-":case"=":var h=parseInt(l,10);if(isNaN(h)||h<0)throw new Error("Invalid number in diff_fromDelta: "+l);var g=e.substring(a,a+=h);i[t].charAt(0)=="="?n[s++]=new o.Diff(f,g):n[s++]=new o.Diff(k,g);break;default:if(i[t])throw new Error("Invalid diff operation in diff_fromDelta: "+i[t])}}if(a!=e.length)throw new Error("Delta length ("+a+") does not equal source text length ("+e.length+").");return n},o.prototype.match_main=function(e,r,n){if(e==null||r==null||n==null)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==r?0:e.length?e.substring(n,n+r.length)==r?n:this.match_bitap_(e,r,n):-1},o.prototype.match_bitap_=function(e,r,n){if(r.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var s=this.match_alphabet_(r),a=this;function i(y,N){var j=y/r.length,T=Math.abs(n-N);return a.Match_Distance?j+T/a.Match_Distance:T?1:j}var t=this.Match_Threshold,l=e.indexOf(r,n);l!=-1&&(t=Math.min(i(0,l),t),l=e.lastIndexOf(r,n+r.length),l!=-1&&(t=Math.min(i(0,l),t)));var h=1<<r.length-1;l=-1;for(var g,c,v=r.length+e.length,m,b=0;b<r.length;b++){for(g=0,c=v;g<c;)i(b,n+c)<=t?g=c:v=c,c=Math.floor((v-g)/2+g);v=c;var p=Math.max(1,n-c+1),M=Math.min(n+c,e.length)+r.length,E=Array(M+2);E[M+1]=(1<<b)-1;for(var _=M;_>=p;_--){var S=s[e.charAt(_-1)];if(b===0?E[_]=(E[_+1]<<1|1)&S:E[_]=(E[_+1]<<1|1)&S|((m[_+1]|m[_])<<1|1)|m[_+1],E[_]&h){var D=i(b,_-1);if(D<=t)if(t=D,l=_-1,l>n)p=Math.max(1,2*n-l);else break}}if(i(b+1,n)>t)break;m=E}return l},o.prototype.match_alphabet_=function(e){for(var r={},n=0;n<e.length;n++)r[e.charAt(n)]=0;for(var n=0;n<e.length;n++)r[e.charAt(n)]|=1<<e.length-n-1;return r},o.prototype.patch_addContext_=function(e,r){if(r.length!=0){if(e.start2===null)throw Error("patch not initialized");for(var n=r.substring(e.start2,e.start2+e.length1),s=0;r.indexOf(n)!=r.lastIndexOf(n)&&n.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)s+=this.Patch_Margin,n=r.substring(e.start2-s,e.start2+e.length1+s);s+=this.Patch_Margin;var a=r.substring(e.start2-s,e.start2);a&&e.diffs.unshift(new o.Diff(f,a));var i=r.substring(e.start2+e.length1,e.start2+e.length1+s);i&&e.diffs.push(new o.Diff(f,i)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+i.length,e.length2+=a.length+i.length}},o.prototype.patch_make=function(e,r,n){var s,a;if(typeof e=="string"&&typeof r=="string"&&typeof n>"u")s=e,a=this.diff_main(s,r,!0),a.length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&typeof e=="object"&&typeof r>"u"&&typeof n>"u")a=e,s=this.diff_text1(a);else if(typeof e=="string"&&r&&typeof r=="object"&&typeof n>"u")s=e,a=r;else if(typeof e=="string"&&typeof r=="string"&&n&&typeof n=="object")s=e,a=n;else throw new Error("Unknown call format to patch_make.");if(a.length===0)return[];for(var i=[],t=new o.patch_obj,l=0,h=0,g=0,c=s,v=s,m=0;m<a.length;m++){var b=a[m][0],p=a[m][1];switch(!l&&b!==f&&(t.start1=h,t.start2=g),b){case A:t.diffs[l++]=a[m],t.length2+=p.length,v=v.substring(0,g)+p+v.substring(g);break;case k:t.length1+=p.length,t.diffs[l++]=a[m],v=v.substring(0,g)+v.substring(g+p.length);break;case f:p.length<=2*this.Patch_Margin&&l&&a.length!=m+1?(t.diffs[l++]=a[m],t.length1+=p.length,t.length2+=p.length):p.length>=2*this.Patch_Margin&&l&&(this.patch_addContext_(t,c),i.push(t),t=new o.patch_obj,l=0,c=v,h=g);break}b!==A&&(h+=p.length),b!==k&&(g+=p.length)}return l&&(this.patch_addContext_(t,c),i.push(t)),i},o.prototype.patch_deepCopy=function(e){for(var r=[],n=0;n<e.length;n++){var s=e[n],a=new o.patch_obj;a.diffs=[];for(var i=0;i<s.diffs.length;i++)a.diffs[i]=new o.Diff(s.diffs[i][0],s.diffs[i][1]);a.start1=s.start1,a.start2=s.start2,a.length1=s.length1,a.length2=s.length2,r[n]=a}return r},o.prototype.patch_apply=function(e,r){if(e.length==0)return[r,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);r=n+r+n,this.patch_splitMax(e);for(var s=0,a=[],i=0;i<e.length;i++){var t=e[i].start2+s,l=this.diff_text1(e[i].diffs),h,g=-1;if(l.length>this.Match_MaxBits?(h=this.match_main(r,l.substring(0,this.Match_MaxBits),t),h!=-1&&(g=this.match_main(r,l.substring(l.length-this.Match_MaxBits),t+l.length-this.Match_MaxBits),(g==-1||h>=g)&&(h=-1))):h=this.match_main(r,l,t),h==-1)a[i]=!1,s-=e[i].length2-e[i].length1;else{a[i]=!0,s=h-t;var c;if(g==-1?c=r.substring(h,h+l.length):c=r.substring(h,g+this.Match_MaxBits),l==c)r=r.substring(0,h)+this.diff_text2(e[i].diffs)+r.substring(h+l.length);else{var v=this.diff_main(l,c,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(v)/l.length>this.Patch_DeleteThreshold)a[i]=!1;else{this.diff_cleanupSemanticLossless(v);for(var m=0,b,p=0;p<e[i].diffs.length;p++){var M=e[i].diffs[p];M[0]!==f&&(b=this.diff_xIndex(v,m)),M[0]===A?r=r.substring(0,h+b)+M[1]+r.substring(h+b):M[0]===k&&(r=r.substring(0,h+b)+r.substring(h+this.diff_xIndex(v,m+M[1].length))),M[0]!==k&&(m+=M[1].length)}}}}}return r=r.substring(n.length,r.length-n.length),[r,a]},o.prototype.patch_addPadding=function(e){for(var r=this.Patch_Margin,n="",s=1;s<=r;s++)n+=String.fromCharCode(s);for(var s=0;s<e.length;s++)e[s].start1+=r,e[s].start2+=r;var a=e[0],i=a.diffs;if(i.length==0||i[0][0]!=f)i.unshift(new o.Diff(f,n)),a.start1-=r,a.start2-=r,a.length1+=r,a.length2+=r;else if(r>i[0][1].length){var t=r-i[0][1].length;i[0][1]=n.substring(i[0][1].length)+i[0][1],a.start1-=t,a.start2-=t,a.length1+=t,a.length2+=t}if(a=e[e.length-1],i=a.diffs,i.length==0||i[i.length-1][0]!=f)i.push(new o.Diff(f,n)),a.length1+=r,a.length2+=r;else if(r>i[i.length-1][1].length){var t=r-i[i.length-1][1].length;i[i.length-1][1]+=n.substring(0,t),a.length1+=t,a.length2+=t}return n},o.prototype.patch_splitMax=function(e){for(var r=this.Match_MaxBits,n=0;n<e.length;n++)if(!(e[n].length1<=r)){var s=e[n];e.splice(n--,1);for(var a=s.start1,i=s.start2,t="";s.diffs.length!==0;){var l=new o.patch_obj,h=!0;for(l.start1=a-t.length,l.start2=i-t.length,t!==""&&(l.length1=l.length2=t.length,l.diffs.push(new o.Diff(f,t)));s.diffs.length!==0&&l.length1<r-this.Patch_Margin;){var g=s.diffs[0][0],c=s.diffs[0][1];g===A?(l.length2+=c.length,i+=c.length,l.diffs.push(s.diffs.shift()),h=!1):g===k&&l.diffs.length==1&&l.diffs[0][0]==f&&c.length>2*r?(l.length1+=c.length,a+=c.length,h=!1,l.diffs.push(new o.Diff(g,c)),s.diffs.shift()):(c=c.substring(0,r-l.length1-this.Patch_Margin),l.length1+=c.length,a+=c.length,g===f?(l.length2+=c.length,i+=c.length):h=!1,l.diffs.push(new o.Diff(g,c)),c==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(c.length))}t=this.diff_text2(l.diffs),t=t.substring(t.length-this.Patch_Margin);var v=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);v!==""&&(l.length1+=v.length,l.length2+=v.length,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===f?l.diffs[l.diffs.length-1][1]+=v:l.diffs.push(new o.Diff(f,v))),h||e.splice(++n,0,l)}}},o.prototype.patch_toText=function(e){for(var r=[],n=0;n<e.length;n++)r[n]=e[n];return r.join("")},o.prototype.patch_fromText=function(e){var r=[];if(!e)return r;for(var n=e.split(`
|
|
3
3
|
`),s=0,a=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<n.length;){var i=n[s].match(a);if(!i)throw new Error("Invalid patch string: "+n[s]);var t=new o.patch_obj;for(r.push(t),t.start1=parseInt(i[1],10),i[2]===""?(t.start1--,t.length1=1):i[2]=="0"?t.length1=0:(t.start1--,t.length1=parseInt(i[2],10)),t.start2=parseInt(i[3],10),i[4]===""?(t.start2--,t.length2=1):i[4]=="0"?t.length2=0:(t.start2--,t.length2=parseInt(i[4],10)),s++;s<n.length;){var l=n[s].charAt(0);try{var h=decodeURI(n[s].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+h)}if(l=="-")t.diffs.push(new o.Diff(k,h));else if(l=="+")t.diffs.push(new o.Diff(A,h));else if(l==" ")t.diffs.push(new o.Diff(f,h));else{if(l=="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+h)}s++}}return r},o.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},o.patch_obj.prototype.toString=function(){var e,r;this.length1===0?e=this.start1+",0":this.length1==1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?r=this.start2+",0":this.length2==1?r=this.start2+1:r=this.start2+1+","+this.length2;for(var n=["@@ -"+e+" +"+r+` @@
|
|
4
4
|
`],s,a=0;a<this.diffs.length;a++){switch(this.diffs[a][0]){case A:s="+";break;case k:s="-";break;case f:s=" ";break}n[a+1]=s+encodeURI(this.diffs[a][1])+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/katex-CEK31ho9.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as ki,r as Y,j as $e}from"./react-BoEjKzFZ.js";import{s as rr,E as se,V as dt,D as te,a as Ht,R as wi,P as ir,S as xt,b as Me,f as xi,M as or,m as Bn,i as Si,c as bi,d as Mi,e as Li,g as Ai,h as Ei,j as Dn,k as ar,l as St,n as Oi,o as Ri,p as Ti,q as Ii,r as Ni,t as Pi,u as Bi,v as Di,w as _i,x as Ki,y as it,F as Yt,A as Xt,z as $i,W as sr,B as lr,C as _n,G as Fi,H as _t,I as Kt,J as Hi,K as Vi,L as ji,N as Wi,O as Ui,Q as zi,T as Qi,U as qi,X as Ji,Y as Zi,Z as Yi,_ as Xi,$ as Gi,a0 as eo,a1 as to,a2 as no,a3 as ro,a4 as io,a5 as oo,a6 as Gt,a7 as ao,a8 as so,a9 as lo,aa as co,ab as be,ac as uo,ad as fo}from"./editor-CiK7TK0p.js";import{r as Kn,c as ht,U as cr,b as Vt,d as jt,e as $n,m as ho,f as po,g as $t,t as Ct,h as kt,_ as Fn,i as go}from"./index-Dx9UqMyC.js";function vo(a){var i=a.Pos;function l(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line),o=r.charCodeAt(t.ch);55296<=o&&o<=55551&&(n.ch+=1)}return{start:t,end:n}}var c=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"gc",type:"operator",operator:"toggleComment",isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],f=Object.create(null),v=c.length,C=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"put",shortName:"pu"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],x=nn("");function S(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),a.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",On),Ee(e),a.on(e.getInputField(),"paste",R(e))}function T(e){e.setOption("disableInput",!1),e.off("cursorActivity",On),a.off(e.getInputField(),"paste",R(e)),e.state.vim=null,ut&&clearTimeout(ut)}function R(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(ie(e.getCursor(),0,1)),Ze.enterInsertMode(e,{},t))}),t.onPasteFn}var L=/[\d]/,A=[a.isWordChar,function(e){return e&&!a.isWordChar(e)&&!/\s/.test(e)}],D=[function(e){return/\S/.test(e)}],_=["<",">"],j=["-",'"',".",":","_","/","+"],z=/^\w$/,q=/^[A-Z]$/;try{q=new RegExp("^[\\p{Lu}]$","u")}catch{}function W(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function ae(e){return/^[a-z]$/.test(e)}function le(e){return"()[]{}".indexOf(e)!=-1}function J(e){return L.test(e)}function ye(e){return q.test(e)}function re(e){return/^\s*$/.test(e)}function He(e){return".?!".indexOf(e)!=-1}function et(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var Ae={};function Ve(e,t,n,r,o){if(t===void 0&&!o)throw Error("defaultValue is required unless callback is provided");if(n||(n="string"),Ae[e]={type:n,defaultValue:t,callback:o},r)for(var s=0;s<r.length;s++)Ae[r[s]]=Ae[e];t&&Qe(e,t)}function Qe(e,t,n,r){var o=Ae[e];r=r||{};var s=r.scope;if(!o)return new Error("Unknown option: "+e);if(o.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}o.callback?(s!=="local"&&o.callback(t,void 0),s!=="global"&&n&&o.callback(t,n)):(s!=="local"&&(o.value=o.type=="boolean"?!!t:t),s!=="global"&&n&&(n.state.vim.options[e]={value:t}))}function de(e,t,n){var r=Ae[e];n=n||{};var o=n.scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){let s=t&&r.callback(void 0,t);return o!=="global"&&s!==void 0?s:o!=="local"?r.callback():void 0}else return(o!=="global"&&t&&t.state.vim.options[e]||o!=="local"&&r||{}).value}Ve("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let n=t.getOption("mode");return n=="null"?"":n}else{let n=e==""?"null":e;t.setOption("mode",n)}}),Ve("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var n=t.getOption("textwidth");return n}else{var r=Math.round(e);r>1&&t.setOption("textwidth",r)}});var pt=function(){var e=100,t=-1,n=0,r=0,o=new Array(e);function s(d,p,g){var y=t%e,k=o[y];function w(b){var M=++t%e,P=o[M];P&&P.clear(),o[M]=d.setBookmark(b)}if(k){var m=k.find();m&&!Re(m,p)&&w(p)}else w(p);w(g),n=t,r=t-e+1,r<0&&(r=0)}function u(d,p){t+=p,t>n?t=n:t<r&&(t=r);var g=o[(e+t)%e];if(g&&!g.find()){var y=p>0?1:-1,k,w=d.getCursor();do if(t+=y,g=o[(e+t)%e],g&&(k=g.find())&&!Re(w,k))break;while(t<n&&t>r)}return g}function h(d,p){var g=t,y=u(d,p);return t=g,y&&y.find()}return{cachedCursor:void 0,add:s,find:h,move:u}},at=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class gt{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=at()}exitMacroRecordMode(){var t=E.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,n){var r=E.registerController.getRegister(n);if(r){if(r.clear(),this.latestRegister=n,t.openDialog){var o=Ne("span",{class:"cm-vim-message"},"recording @"+n);this.onRecordingDone=t.openDialog(o,function(){},{bottom:!0})}this.isRecording=!0}}}function Ee(e){return e.state.vim||(e.state.vim={inputState:new rn,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new i(0,0),head:new i(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var E;function tt(){E={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:pt(),macroModeState:new gt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Rr({}),searchHistoryController:new on,exCommandHistoryController:new on};for(var e in Ae){var t=Ae[e];t.value=t.defaultValue}}class we{constructor(t,n){this.keyName=t,this.key=n.key,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.metaKey=n.metaKey,this.shiftKey=n.shiftKey}}var xe,pe={enterVimMode:S,leaveVimMode:T,buildKeyMap:function(){},getRegisterController:function(){return E.registerController},resetVimGlobalState_:tt,getVimGlobalState_:function(){return E},maybeInitVimState_:Ee,suppressErrorLogging:!1,InsertModeKey:we,map:function(e,t,n){Ce.map(e,t,n)},unmap:function(e,t){return Ce.unmap(e,t)},noremap:function(e,t,n){Ce.map(e,t,n,!0)},mapclear:function(e){var t=c.length,n=v,r=c.slice(0,t-n);if(c=c.slice(t-n),e)for(var o=r.length-1;o>=0;o--){var s=r[o];if(e!==s.context)if(s.context)this._mapCommand(s);else{var u=["normal","insert","visual"];for(var h in u)if(u[h]!==e){var d=Object.assign({},s);d.context=u[h],this._mapCommand(d)}}}},langmap:lt,vimKeyFromEvent:qe,setOption:Qe,getOption:de,defineOption:Ve,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');An[e]=n,Ce.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r=="function")return r()},multiSelectHandleKey:Ci,findKey:function(e,t,n){var r=Ee(e),o=e;function s(){var g=E.macroModeState;if(g.isRecording){if(t=="q")return g.exitMacroRecordMode(),ce(o),!0;n!="mapping"&&vi(g,t)}}function u(){if(t=="<Esc>"){if(r.visualMode)_e(o);else if(r.insertMode)ze(o);else return;return ce(o),!0}}function h(){if(u())return!0;r.inputState.keyBuffer.push(t);var g=r.inputState.keyBuffer.join(""),y=t.length==1,k=Je.matchCommand(g,c,r.inputState,"insert"),w=r.inputState.changeQueue;if(k.type=="none")return ce(o),!1;if(k.type=="partial"){if(k.expectLiteralNext&&(r.expectLiteralNext=!0),xe&&window.clearTimeout(xe),xe=y&&window.setTimeout(function(){r.insertMode&&r.inputState.keyBuffer.length&&ce(o)},de("insertModeEscKeysTimeout")),y){var m=o.listSelections();(!w||w.removed.length!=m.length)&&(w=r.inputState.changeQueue=new Er),w.inserted+=t;for(var b=0;b<m.length;b++){var M=me(m[b].anchor,m[b].head),P=Ue(m[b].anchor,m[b].head),I=o.getRange(M,o.state.overwrite?ie(P,0,1):P);w.removed[b]=(w.removed[b]||"")+I}}return!y}else k.type=="full"&&(r.inputState.keyBuffer.length=0);if(r.expectLiteralNext=!1,xe&&window.clearTimeout(xe),k.command&&w){for(var m=o.listSelections(),b=0;b<m.length;b++){var N=m[b].head;o.replaceRange(w.removed[b]||"",ie(N,0,-w.inserted.length),N,"+input")}E.macroModeState.lastInsertModeChanges.changes.pop()}return k.command||ce(o),k.command}function d(){if(s()||u())return!0;r.inputState.keyBuffer.push(t);var g=r.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(g))return!0;var y=/^(\d*)(.*)$/.exec(g);if(!y)return ce(o),!1;var k=r.visualMode?"visual":"normal",w=y[2]||y[1];r.inputState.operatorShortcut&&r.inputState.operatorShortcut.slice(-1)==w&&(w=r.inputState.operatorShortcut);var m=Je.matchCommand(w,c,r.inputState,k);return m.type=="none"?(ce(o),!1):m.type=="partial"?(m.expectLiteralNext&&(r.expectLiteralNext=!0),!0):m.type=="clear"?(ce(o),!0):(r.expectLiteralNext=!1,r.inputState.keyBuffer.length=0,y=/^(\d*)(.*)$/.exec(g),y&&y[1]&&y[1]!="0"&&r.inputState.pushRepeatDigit(y[1]),m.command)}var p=r.insertMode?h():d();if(p===!1)return!r.insertMode&&(t.length===1||a.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(p===!0)return function(){return!0};if(p)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof p!="object")return;p.type=="keyToKey"?U(o,p.toKeys,p):Je.processCommand(o,r,p)}catch(g){throw o.state.vim=void 0,Ee(o),pe.suppressErrorLogging||console.log(g),g}return!0})}},handleEx:function(e,t){Ce.processCommand(e,t)},defineMotion:Tr,defineAction:Nr,defineOperator:Ir,mapCommand:pi,_mapCommand:Nt,defineRegister:Or,exitVisualMode:_e,exitInsertMode:ze},B=[],X=!1,O;function Z(e){if(!O)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),n=t.split("-");if(t=n.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
|
|
2
|
+
import{u as ki,r as Y,j as $e}from"./react-BoEjKzFZ.js";import{s as rr,E as se,V as dt,D as te,a as Ht,R as wi,P as ir,S as xt,b as Me,f as xi,M as or,m as Bn,i as Si,c as bi,d as Mi,e as Li,g as Ai,h as Ei,j as Dn,k as ar,l as St,n as Oi,o as Ri,p as Ti,q as Ii,r as Ni,t as Pi,u as Bi,v as Di,w as _i,x as Ki,y as it,F as Yt,A as Xt,z as $i,W as sr,B as lr,C as _n,G as Fi,H as _t,I as Kt,J as Hi,K as Vi,L as ji,N as Wi,O as Ui,Q as zi,T as Qi,U as qi,X as Ji,Y as Zi,Z as Yi,_ as Xi,$ as Gi,a0 as eo,a1 as to,a2 as no,a3 as ro,a4 as io,a5 as oo,a6 as Gt,a7 as ao,a8 as so,a9 as lo,aa as co,ab as be,ac as uo,ad as fo}from"./editor-CiK7TK0p.js";import{r as Kn,c as ht,U as cr,b as Vt,d as jt,e as $n,m as ho,f as po,g as $t,t as Ct,h as kt,_ as Fn,i as go}from"./index-BoLY1azn.js";function vo(a){var i=a.Pos;function l(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line),o=r.charCodeAt(t.ch);55296<=o&&o<=55551&&(n.ch+=1)}return{start:t,end:n}}var c=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"gc",type:"operator",operator:"toggleComment",isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],f=Object.create(null),v=c.length,C=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"put",shortName:"pu"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],x=nn("");function S(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),a.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",On),Ee(e),a.on(e.getInputField(),"paste",R(e))}function T(e){e.setOption("disableInput",!1),e.off("cursorActivity",On),a.off(e.getInputField(),"paste",R(e)),e.state.vim=null,ut&&clearTimeout(ut)}function R(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(ie(e.getCursor(),0,1)),Ze.enterInsertMode(e,{},t))}),t.onPasteFn}var L=/[\d]/,A=[a.isWordChar,function(e){return e&&!a.isWordChar(e)&&!/\s/.test(e)}],D=[function(e){return/\S/.test(e)}],_=["<",">"],j=["-",'"',".",":","_","/","+"],z=/^\w$/,q=/^[A-Z]$/;try{q=new RegExp("^[\\p{Lu}]$","u")}catch{}function W(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function ae(e){return/^[a-z]$/.test(e)}function le(e){return"()[]{}".indexOf(e)!=-1}function J(e){return L.test(e)}function ye(e){return q.test(e)}function re(e){return/^\s*$/.test(e)}function He(e){return".?!".indexOf(e)!=-1}function et(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var Ae={};function Ve(e,t,n,r,o){if(t===void 0&&!o)throw Error("defaultValue is required unless callback is provided");if(n||(n="string"),Ae[e]={type:n,defaultValue:t,callback:o},r)for(var s=0;s<r.length;s++)Ae[r[s]]=Ae[e];t&&Qe(e,t)}function Qe(e,t,n,r){var o=Ae[e];r=r||{};var s=r.scope;if(!o)return new Error("Unknown option: "+e);if(o.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}o.callback?(s!=="local"&&o.callback(t,void 0),s!=="global"&&n&&o.callback(t,n)):(s!=="local"&&(o.value=o.type=="boolean"?!!t:t),s!=="global"&&n&&(n.state.vim.options[e]={value:t}))}function de(e,t,n){var r=Ae[e];n=n||{};var o=n.scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){let s=t&&r.callback(void 0,t);return o!=="global"&&s!==void 0?s:o!=="local"?r.callback():void 0}else return(o!=="global"&&t&&t.state.vim.options[e]||o!=="local"&&r||{}).value}Ve("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let n=t.getOption("mode");return n=="null"?"":n}else{let n=e==""?"null":e;t.setOption("mode",n)}}),Ve("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var n=t.getOption("textwidth");return n}else{var r=Math.round(e);r>1&&t.setOption("textwidth",r)}});var pt=function(){var e=100,t=-1,n=0,r=0,o=new Array(e);function s(d,p,g){var y=t%e,k=o[y];function w(b){var M=++t%e,P=o[M];P&&P.clear(),o[M]=d.setBookmark(b)}if(k){var m=k.find();m&&!Re(m,p)&&w(p)}else w(p);w(g),n=t,r=t-e+1,r<0&&(r=0)}function u(d,p){t+=p,t>n?t=n:t<r&&(t=r);var g=o[(e+t)%e];if(g&&!g.find()){var y=p>0?1:-1,k,w=d.getCursor();do if(t+=y,g=o[(e+t)%e],g&&(k=g.find())&&!Re(w,k))break;while(t<n&&t>r)}return g}function h(d,p){var g=t,y=u(d,p);return t=g,y&&y.find()}return{cachedCursor:void 0,add:s,find:h,move:u}},at=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class gt{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=at()}exitMacroRecordMode(){var t=E.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,n){var r=E.registerController.getRegister(n);if(r){if(r.clear(),this.latestRegister=n,t.openDialog){var o=Ne("span",{class:"cm-vim-message"},"recording @"+n);this.onRecordingDone=t.openDialog(o,function(){},{bottom:!0})}this.isRecording=!0}}}function Ee(e){return e.state.vim||(e.state.vim={inputState:new rn,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new i(0,0),head:new i(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var E;function tt(){E={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:pt(),macroModeState:new gt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Rr({}),searchHistoryController:new on,exCommandHistoryController:new on};for(var e in Ae){var t=Ae[e];t.value=t.defaultValue}}class we{constructor(t,n){this.keyName=t,this.key=n.key,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.metaKey=n.metaKey,this.shiftKey=n.shiftKey}}var xe,pe={enterVimMode:S,leaveVimMode:T,buildKeyMap:function(){},getRegisterController:function(){return E.registerController},resetVimGlobalState_:tt,getVimGlobalState_:function(){return E},maybeInitVimState_:Ee,suppressErrorLogging:!1,InsertModeKey:we,map:function(e,t,n){Ce.map(e,t,n)},unmap:function(e,t){return Ce.unmap(e,t)},noremap:function(e,t,n){Ce.map(e,t,n,!0)},mapclear:function(e){var t=c.length,n=v,r=c.slice(0,t-n);if(c=c.slice(t-n),e)for(var o=r.length-1;o>=0;o--){var s=r[o];if(e!==s.context)if(s.context)this._mapCommand(s);else{var u=["normal","insert","visual"];for(var h in u)if(u[h]!==e){var d=Object.assign({},s);d.context=u[h],this._mapCommand(d)}}}},langmap:lt,vimKeyFromEvent:qe,setOption:Qe,getOption:de,defineOption:Ve,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');An[e]=n,Ce.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r=="function")return r()},multiSelectHandleKey:Ci,findKey:function(e,t,n){var r=Ee(e),o=e;function s(){var g=E.macroModeState;if(g.isRecording){if(t=="q")return g.exitMacroRecordMode(),ce(o),!0;n!="mapping"&&vi(g,t)}}function u(){if(t=="<Esc>"){if(r.visualMode)_e(o);else if(r.insertMode)ze(o);else return;return ce(o),!0}}function h(){if(u())return!0;r.inputState.keyBuffer.push(t);var g=r.inputState.keyBuffer.join(""),y=t.length==1,k=Je.matchCommand(g,c,r.inputState,"insert"),w=r.inputState.changeQueue;if(k.type=="none")return ce(o),!1;if(k.type=="partial"){if(k.expectLiteralNext&&(r.expectLiteralNext=!0),xe&&window.clearTimeout(xe),xe=y&&window.setTimeout(function(){r.insertMode&&r.inputState.keyBuffer.length&&ce(o)},de("insertModeEscKeysTimeout")),y){var m=o.listSelections();(!w||w.removed.length!=m.length)&&(w=r.inputState.changeQueue=new Er),w.inserted+=t;for(var b=0;b<m.length;b++){var M=me(m[b].anchor,m[b].head),P=Ue(m[b].anchor,m[b].head),I=o.getRange(M,o.state.overwrite?ie(P,0,1):P);w.removed[b]=(w.removed[b]||"")+I}}return!y}else k.type=="full"&&(r.inputState.keyBuffer.length=0);if(r.expectLiteralNext=!1,xe&&window.clearTimeout(xe),k.command&&w){for(var m=o.listSelections(),b=0;b<m.length;b++){var N=m[b].head;o.replaceRange(w.removed[b]||"",ie(N,0,-w.inserted.length),N,"+input")}E.macroModeState.lastInsertModeChanges.changes.pop()}return k.command||ce(o),k.command}function d(){if(s()||u())return!0;r.inputState.keyBuffer.push(t);var g=r.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(g))return!0;var y=/^(\d*)(.*)$/.exec(g);if(!y)return ce(o),!1;var k=r.visualMode?"visual":"normal",w=y[2]||y[1];r.inputState.operatorShortcut&&r.inputState.operatorShortcut.slice(-1)==w&&(w=r.inputState.operatorShortcut);var m=Je.matchCommand(w,c,r.inputState,k);return m.type=="none"?(ce(o),!1):m.type=="partial"?(m.expectLiteralNext&&(r.expectLiteralNext=!0),!0):m.type=="clear"?(ce(o),!0):(r.expectLiteralNext=!1,r.inputState.keyBuffer.length=0,y=/^(\d*)(.*)$/.exec(g),y&&y[1]&&y[1]!="0"&&r.inputState.pushRepeatDigit(y[1]),m.command)}var p=r.insertMode?h():d();if(p===!1)return!r.insertMode&&(t.length===1||a.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(p===!0)return function(){return!0};if(p)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof p!="object")return;p.type=="keyToKey"?U(o,p.toKeys,p):Je.processCommand(o,r,p)}catch(g){throw o.state.vim=void 0,Ee(o),pe.suppressErrorLogging||console.log(g),g}return!0})}},handleEx:function(e,t){Ce.processCommand(e,t)},defineMotion:Tr,defineAction:Nr,defineOperator:Ir,mapCommand:pi,_mapCommand:Nt,defineRegister:Or,exitVisualMode:_e,exitInsertMode:ze},B=[],X=!1,O;function Z(e){if(!O)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),n=t.split("-");if(t=n.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
|
|
3
3
|
`;else if(We[t]){var r=O.value||"",o={key:We[t],target:{value:r,selectionEnd:r.length,selectionStart:r.length}};O.onKeyDown&&O.onKeyDown(o,O.value,u),O&&O.onKeyUp&&O.onKeyUp(o,O.value,u);return}}if(e==`
|
|
4
4
|
`){var s=O;O=null,s.onClose&&s.onClose(s.value)}else O.value=(O.value||"")+e;function u(h){O&&(typeof h=="string"?O.value=h:O=null)}}function U(e,t,n){var r=X;if(n){if(B.indexOf(n)!=-1)return;B.push(n),X=n.noremap!=!1}try{for(var o=Ee(e),s=/<(?:[CSMA]-)*\w+>|./gi,u;u=s.exec(t);){var h=u[0],d=o.insertMode;if(O){Z(h);continue}var p=pe.handleKey(e,h,"mapping");if(!p&&d&&o.insertMode){if(h[0]=="<"){var g=h.toLowerCase().slice(1,-1),y=g.split("-");if(g=y.pop()||"",g=="lt")h="<";else if(g=="space")h=" ";else if(g=="cr")h=`
|
|
5
5
|
`;else if(We.hasOwnProperty(g)){h=We[g],Nn(e,h);continue}else h=h[0],s.lastIndex=u.index+1}e.replaceSelection(h)}}}finally{if(B.pop(),X=B.length?r:!1,!B.length&&O){var k=O;O=null,mt(e,k)}}}var Oe={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},st={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},We={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(Oe)).forEach(function(e){We[(Oe[e]||"").toLowerCase()]=We[e.toLowerCase()]=e});function qe(e,t){var n=e.key;if(!st[n]){n.length>1&&n[0]=="n"&&(n=n.replace("Numpad","")),n=Oe[n]||n;var r="";if(e.ctrlKey&&(r+="C-"),e.altKey&&(r+="A-"),e.metaKey&&(r+="M-"),a.isMac&&r=="A-"&&n.length==1&&(r=r.slice(2)),(r||n.length>1)&&e.shiftKey&&(r+="S-"),t&&!t.expectLiteralNext&&n.length==1){if(x.keymap&&n in x.keymap)(x.remapCtrl!=!1||!r)&&(n=x.keymap[n]);else if(n.charCodeAt(0)>128&&!f[n]){var o=e.code?.slice(-1)||"";e.shiftKey||(o=o.toLowerCase()),o&&(n=o,!r&&e.altKey&&(r="A-"))}}return r+=n,r.length>1&&(r="<"+r+">"),r}}function lt(e,t){x.string!==e&&(x=nn(e)),x.remapCtrl=t}function nn(e){let t={};if(!e)return{keymap:t,string:""};function n(r){return r.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(r=>{if(!r)return;const o=r.split(/((?:[^\\;]|\\.)+);/);if(o.length==3){const s=n(o[1]),u=n(o[2]);if(s.length!==u.length)return;for(let h=0;h<s.length;++h)t[s[h]]=u[h]}else if(o.length==1){const s=n(r);if(s.length%2!==0)return;for(let u=0;u<s.length;u+=2)t[s[u]]=s[u+1]}}),{keymap:t,string:e}}Ve("langmap",void 0,"string",["lmap"],function(e,t){if(e===void 0)return x.string;lt(e)});class rn{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(t){this.operator?this.motionRepeat=this.motionRepeat.concat(t):this.prefixRepeat=this.prefixRepeat.concat(t)}getRepeat(){var t=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(t=1,this.prefixRepeat.length>0&&(t*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(t*=parseInt(this.motionRepeat.join(""),10))),t}}function ce(e,t){e.state.vim.inputState=new rn,e.state.vim.expectLiteralNext=!1,a.signal(e,"vim-command-done",t)}function Er(){this.removed=[],this.inserted=""}class Be{constructor(t,n,r){this.clear(),this.keyBuffer=[t||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!n,this.blockwise=!!r}setText(t,n,r){this.keyBuffer=[t||""],this.linewise=!!n,this.blockwise=!!r}pushText(t,n){n&&(this.linewise||this.keyBuffer.push(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as Z,r as c,j as s}from"./react-BoEjKzFZ.js";import{P as H,g as q,w as G,G as K}from"./pdf-BB1XvBIF.js";import{M as J,a as Q}from"./minus-
|
|
1
|
+
import{u as Z,r as c,j as s}from"./react-BoEjKzFZ.js";import{P as H,g as q,w as G,G as K}from"./pdf-BB1XvBIF.js";import{M as J,a as Q}from"./minus-DK3ejRQp.js";import{P as ee,L as B}from"./index-BoLY1azn.js";K.workerSrc=G;const F=new H,O=2,S=new Map;async function le(){await F.promise}function X(a,t){const n=`${t}:${a}`,f=S.get(n);if(f)return f.lastUsed=Date.now(),f;const h=q({url:a,worker:F,disableRange:t==="full"}),r={task:h,promise:h.promise,consumers:0,settled:!1,lastUsed:Date.now()};return S.set(n,r),r.promise.then(()=>{r.settled=!0,Y()},()=>{r.settled=!0,S.get(n)===r&&S.delete(n)}),r}function Y(){if(S.size<=O)return;const a=[...S.entries()].filter(([,t])=>t.consumers===0&&t.settled).sort((t,n)=>t[1].lastUsed-n[1].lastUsed);for(;S.size>O&&a.length;){const[t,n]=a.shift();S.get(t)===n&&(S.delete(t),n.task.destroy())}}function ae(a,t){if(!a)return;X(a,t).promise.catch(()=>{})}function te(a,t){const n=X(a,t);n.consumers+=1,n.lastUsed=Date.now();let f=!1;return{promise:n.promise,release:()=>{f||(f=!0,n.consumers=Math.max(0,n.consumers-1),n.lastUsed=Date.now(),Y())}}}function de({url:a,loadingMode:t,target:n,compiling:f=!1,onViewportLocation:h,onDoubleClickLocation:r}){const{t:g}=Z(),v=c.useRef(null),[x,N]=c.useState(null),[b,w]=c.useState(0),[d,z]=c.useState(100),[j,I]=c.useState(""),M=c.useRef(new Map),D=c.useCallback((e,i)=>{i?M.current.set(e,i):M.current.delete(e)},[]),E=async e=>{if(!x||e==null)return;let i=e;if(typeof e=="string"&&(i=await x.getDestination(e).catch(()=>null)),!Array.isArray(i)||i.length===0)return;const u=i[0];let p=null;if(typeof u=="number"&&Number.isInteger(u))p=u;else if(u!=null)try{p=await x.getPageIndex(u)}catch{return}p==null||p<0||p>=x.numPages||M.current.get(p+1)?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},y=()=>{const e=v.current;if(!e)return;const i=e.getBoundingClientRect(),u=i.left+i.width/2,p=i.top+i.height/2,o=[...e.querySelectorAll(".pdf-page")],m=o.find(U=>{const P=U.getBoundingClientRect();return p>=P.top&&p<=P.bottom})??o.reduce((U,P)=>{if(!U)return P;const W=Math.abs(P.getBoundingClientRect().top-p),_=Math.abs(U.getBoundingClientRect().top-p);return W<_?P:U},null);if(!m)return;const l=m.getBoundingClientRect(),R=Number(m.dataset.scale)||1,L=Number(m.dataset.page),A=Math.max(0,Math.min(l.width,u-l.left))/R,T=Math.max(0,Math.min(l.height,p-l.top))/R;L&&h(L,A,T)};c.useEffect(()=>{const e=v.current;if(!e)return;const i=()=>w(e.clientWidth);i();const u=new ResizeObserver(i);return u.observe(e),()=>u.disconnect()},[]),c.useEffect(()=>{let e=!1;N(null),I("");const i=te(a,t);return i.promise.then(u=>{e||N(u)}).catch(()=>{e||I(g("editor.pdfLoadFailed"))}),()=>{e=!0,i.release()}},[a,t]),c.useEffect(()=>{d>100||!v.current||(v.current.scrollLeft=0)},[d,b,x]);const C=e=>z(i=>Math.min(200,Math.max(50,i+e))),k=()=>{v.current&&(v.current.scrollLeft=0),z(100)},$=e=>{!e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY,y())};return s.jsxs("div",{className:"pdf-viewer",children:[s.jsxs("div",{className:"pdf-toolbar",role:"toolbar","aria-label":g("editor.pdfZoomControls"),children:[s.jsx("button",{disabled:d<=50,title:g("editor.pdfZoomOut"),"aria-label":g("editor.pdfZoomOut"),onClick:()=>C(-10),children:s.jsx(J,{size:14})}),s.jsxs("span",{className:"pdf-zoom-value","aria-live":"polite",children:[d,"%"]}),s.jsx("button",{disabled:d>=200,title:g("editor.pdfZoomIn"),"aria-label":g("editor.pdfZoomIn"),onClick:()=>C(10),children:s.jsx(ee,{size:14})}),s.jsxs("button",{className:"pdf-fit-width",title:g("editor.pdfFitWidth"),onClick:k,children:[s.jsx(Q,{size:13}),g("editor.pdfFitWidth")]})]}),f&&s.jsxs("div",{className:"pdf-compiling-overlay",role:"status","aria-live":"polite",children:[s.jsx(B,{className:"spin",size:20}),s.jsx("span",{children:g("editor.compiling")})]}),s.jsx("div",{className:"pdf-document",ref:v,onScroll:y,onWheel:$,children:s.jsxs("div",{className:"pdf-pages",style:{width:`${Math.max(1,b-28)*Math.max(1,d/100)}px`},children:[!x&&!j&&s.jsxs("div",{className:"pdf-loading",role:"status","aria-live":"polite",children:[s.jsx(B,{className:"spin",size:24}),s.jsx("span",{children:g("editor.loadingPdf")})]}),j&&s.jsx("div",{className:"preview-empty",children:s.jsx("strong",{children:j})}),x&&b>0&&Array.from({length:x.numPages},(e,i)=>s.jsx(se,{document:x,pageNumber:i+1,availableWidth:b-28,zoom:d/100,target:n?.page===i+1?n:null,onReady:y,onPageElement:D,onInternalLink:E,onDoubleClickLocation:r},i+1))]})})]})}function se({document:a,pageNumber:t,availableWidth:n,zoom:f,target:h,onReady:r,onPageElement:g,onInternalLink:v,onDoubleClickLocation:x}){const N=c.useRef(null),b=c.useRef(null),w=c.useRef(null),[d,z]=c.useState(1),[j,I]=c.useState({width:0,height:0}),[M,D]=c.useState(t===1),[E,y]=c.useState(!1),[C,k]=c.useState(null),[$,e]=c.useState([]);c.useEffect(()=>{const o=N.current;if(!o||M)return;if(!("IntersectionObserver"in window)){D(!0);return}const m=new IntersectionObserver(l=>{l.some(R=>R.isIntersecting)&&(D(!0),m.disconnect())},{rootMargin:"900px 0px"});return m.observe(o),()=>m.disconnect()},[M]),c.useEffect(()=>{h&&D(!0)},[h?.nonce]),c.useEffect(()=>{if(!M)return;let o=!1,m=null;return y(!1),k(null),e([]),a.getPage(t).then(l=>{if(o)return;const R=l.getViewport({scale:1}),L=n/R.width,A=Math.min(3.3,Math.max(.175,L*f)),T=l.getViewport({scale:A});if(z(A),I({width:T.width,height:T.height}),k(T),l.getAnnotations({intent:"display"}).then(W=>{o||e(W)}).catch(()=>{o||e([])}),!b.current)return;const U=Math.max(1,window.devicePixelRatio||1),P=l.getViewport({scale:A*U});return b.current.width=Math.floor(P.width),b.current.height=Math.floor(P.height),m=l.render({canvas:b.current,viewport:P}),m.promise.then(()=>{o||(y(!0),window.requestAnimationFrame(r))})}).catch(()=>{}),()=>{o=!0,m?.cancel()}},[a,t,n,f,M]),c.useEffect(()=>{!h||!w.current||w.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},[h?.nonce,d]);const i=o=>{if(!x||!E||o.target instanceof HTMLElement&&o.target.closest("a"))return;const m=b.current;if(!m)return;const l=m.getBoundingClientRect();if(o.clientX<l.left||o.clientX>l.right||o.clientY<l.top||o.clientY>l.bottom)return;const R=d||1,L=Math.max(0,Math.min(l.width,o.clientX-l.left))/R,A=Math.max(0,Math.min(l.height,o.clientY-l.top))/R;x(t,L,A)},u=Math.max(1,n*f),p=u*(792/612);return s.jsxs("figure",{ref:o=>{N.current=o,g(t,o)},onDoubleClick:i,className:`pdf-page${E?" rendered":" loading"}`,"data-page":t,"data-scale":d,style:{width:`${j.width||u}px`,minHeight:`${j.height||p}px`},children:[s.jsx("canvas",{ref:b,style:{width:`${j.width||u}px`,height:`${j.height||p}px`}}),E&&C&&s.jsx(ne,{annotations:$,viewport:C,onInternalLink:v}),h&&s.jsx("span",{ref:w,className:"pdf-sync-marker",style:{left:h.x*d,top:h.y*d}}),s.jsx("figcaption",{children:t})]})}function ne({annotations:a,viewport:t,onInternalLink:n}){const{t:f}=Z(),h=f("editor.pdfLink");return s.jsx("div",{className:"pdf-annotation-layer","aria-label":f("editor.pdfLinks"),children:a.filter(r=>r.subtype==="Link"&&Array.isArray(r.rect)&&r.rect.length>=4).map((r,g)=>{const[v,x]=t.convertToViewportPoint(r.rect[0],r.rect[1]),[N,b]=t.convertToViewportPoint(r.rect[2],r.rect[3]),w=[v,x,N,b],d=Math.min(w[0],w[2]),z=Math.min(w[1],w[3]),j=Math.abs(w[2]-w[0]),I=Math.abs(w[3]-w[1]),M=typeof r.title=="string"?r.title.trim():"",D=typeof r.unsafeUrl=="string"?r.unsafeUrl.trim():"",E=typeof r.url=="string"?r.url.trim():"",y=V(E)?E:V(D)?D:"",C=r.dest;if(!y&&C==null)return null;const k=!!y;return s.jsx("a",{className:"pdf-annotation-link",href:y||"#",target:k?"_blank":void 0,rel:k?"noreferrer":void 0,title:M||(k?y:h),"aria-label":M||(k?y:h),style:{left:d,top:z,width:j,height:I},onClick:k?void 0:$=>{$.preventDefault(),n(C)}},`${g}-${d}-${z}`)})})}function V(a){return/^(?:https?|mailto|ftp):/i.test(a)}export{de as PdfPreview,ae as preloadPdf,le as preloadPdfRuntime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as A,r,j as e}from"./react-BoEjKzFZ.js";import{j as U,a as z,M as F,o as $,L as V,p as B,n as J,F as K,q as G}from"./index-
|
|
1
|
+
import{u as A,r,j as e}from"./react-BoEjKzFZ.js";import{j as U,a as z,M as F,o as $,L as V,p as B,n as J,F as K,q as G}from"./index-BoLY1azn.js";const L=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);function Z({open:n,files:h,onOpenChange:u,onOpenFile:p}){const{t:a}=A(),[c,f]=r.useState(""),[d,o]=r.useState(0),m=r.useRef(null),y=r.useRef(null),l=r.useMemo(()=>h.filter(s=>s.type==="file").map(s=>({entry:s,score:H(s.path,c)})).filter(s=>s.score>=0).sort((s,i)=>i.score-s.score||s.entry.path.localeCompare(i.entry.path)).slice(0,100),[h,c]);r.useEffect(()=>{n&&(f(""),o(0),window.setTimeout(()=>m.current?.focus(),0))},[n]),r.useEffect(()=>o(s=>Math.min(s,Math.max(0,l.length-1))),[l.length]),r.useEffect(()=>{n&&y.current?.scrollIntoView({block:"nearest"})},[n,d]);const S=s=>{p(s),u(!1)};return e.jsx(F,{open:n,wide:!0,title:a("navigation.quickOpen"),description:a("navigation.quickOpenDescription"),onOpenChange:u,children:e.jsxs("div",{className:"quick-open-dialog",children:[e.jsxs("label",{children:[e.jsx($,{size:16}),e.jsx("input",{ref:m,value:c,placeholder:a("navigation.filePlaceholder"),onChange:s=>{f(s.target.value),o(0)},onKeyDown:s=>{s.key==="ArrowDown"&&(s.preventDefault(),o(i=>Math.min(l.length-1,i+1))),s.key==="ArrowUp"&&(s.preventDefault(),o(i=>Math.max(0,i-1))),s.key==="Enter"&&l[d]&&(s.preventDefault(),S(l[d].entry.path))}})]}),e.jsxs("div",{className:"quick-open-results",children:[l.map(({entry:s},i)=>e.jsxs("button",{ref:i===d?y:void 0,className:i===d?"active":"",onMouseEnter:()=>o(i),onClick:()=>S(s.path),children:[e.jsx(K,{size:14}),e.jsx("span",{children:s.path}),i===d&&e.jsx(G,{size:13})]},s.path)),l.length===0&&e.jsx("p",{className:"muted padded",children:a("navigation.noFiles")})]})]})})}function _({open:n,project:h,onOpenChange:u,onJump:p}){const{t:a}=A(),[c,f]=r.useState(""),[d,o]=r.useState(""),[m,y]=r.useState(!1),[l,S]=r.useState(!1),[s,i]=r.useState([]),[g,C]=r.useState(0),[P,D]=r.useState(!1),[b,k]=r.useState(!1),[W,N]=r.useState(!1),[R,M]=r.useState(""),[q,w]=r.useState(""),[O,Q]=r.useState(0),v=r.useRef(null);r.useEffect(()=>{if(!n){v.current?.abort();return}if(M(""),w(""),!c.trim()){i([]),C(0),D(!1);return}const t=window.setTimeout(()=>{v.current?.abort();const x=new AbortController;v.current=x,k(!0);const E=new URLSearchParams({q:c});m&&E.set("caseSensitive","1"),l&&E.set("wholeWord","1"),z(`/api/projects/${h.id}/search?${E}`,{signal:x.signal}).then(j=>{i(j.matches),C(j.total),D(j.truncated)}).catch(j=>{j instanceof DOMException&&j.name==="AbortError"||w(T(j))}).finally(()=>{v.current===x&&(v.current=null,k(!1))})},250);return()=>window.clearTimeout(t)},[n,h.id,c,m,l,O]);const I=async()=>{N(!1),k(!0),w(""),M("");try{const t=await z(`/api/projects/${h.id}/search/replace`,{method:"POST",body:JSON.stringify({query:c,replacement:d,caseSensitive:m,wholeWord:l})});M(a("navigation.replaced",{count:t.replacements,files:t.files.length})),i([]),C(0),Q(x=>x+1)}catch(t){w(T(t))}finally{k(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(F,{open:n,extraWide:!0,title:a("navigation.projectSearch"),description:a("navigation.projectSearchDescription"),onOpenChange:u,footer:e.jsx("button",{onClick:()=>u(!1),children:a("common.close")}),children:e.jsxs("div",{className:"project-search-dialog",children:[q&&e.jsx("p",{className:"error",children:q}),R&&e.jsx("p",{className:"success",children:R}),e.jsxs("div",{className:"project-search-form",children:[e.jsxs("label",{className:"project-search-query",children:[e.jsx($,{size:16}),e.jsx("input",{autoFocus:!0,value:c,placeholder:a("navigation.searchPlaceholder"),onChange:t=>f(t.target.value)})]}),h.permission!=="read"&&e.jsxs("label",{className:"project-search-query",children:[e.jsx(L,{size:16}),e.jsx("input",{value:d,placeholder:a("navigation.replacePlaceholder"),onChange:t=>o(t.target.value)})]}),e.jsxs("div",{className:"project-search-options",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:m,onChange:t=>y(t.target.checked)}),a("editor.search.matchCase")]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>S(t.target.checked)}),a("editor.search.wholeWord")]}),h.permission!=="read"&&e.jsxs("button",{className:"danger-text",disabled:!c.trim()||g===0||b,onClick:()=>N(!0),children:[e.jsx(L,{size:13}),a("navigation.replaceAll",{count:g})]})]})]}),e.jsxs("div",{className:"project-search-summary",children:[e.jsx("span",{children:b?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"spin",size:13}),a("common.loading")]}):a("navigation.matchSummary",{count:g})}),P&&e.jsx("small",{children:a("navigation.truncated",{count:s.length})})]}),e.jsxs("div",{className:"project-search-results",children:[s.map((t,x)=>e.jsxs("button",{onClick:()=>{p(t.path,t.line,t.column),u(!1)},children:[e.jsx(B,{size:14}),e.jsxs("span",{children:[e.jsxs("strong",{children:[t.path,e.jsxs("small",{children:[":",t.line,":",t.column]})]}),e.jsxs("code",{children:[t.preview.slice(0,t.matchStart),e.jsx("mark",{children:t.preview.slice(t.matchStart,t.matchEnd)}),t.preview.slice(t.matchEnd)]})]})]},`${t.path}-${t.line}-${t.column}-${x}`)),!b&&c.trim()&&s.length===0&&e.jsx("p",{className:"muted padded",children:a("editor.search.noMatches")})]})]})}),e.jsx(J,{open:W,title:a("navigation.replaceConfirmTitle"),description:a("navigation.replaceConfirmDescription",{count:g}),confirmLabel:a("navigation.replaceAll",{count:g}),danger:!0,onCancel:()=>N(!1),onConfirm:()=>{I()}})]})}function H(n,h){const u=n.toLocaleLowerCase(),p=h.trim().toLocaleLowerCase();if(!p)return 1;const a=u.indexOf(p);if(a>=0)return 1e4-a-u.length;let c=0,f=0;for(const d of p){const o=u.indexOf(d,c);if(o<0)return-1;f+=o===c?5:1,c=o+1}return f-u.length/100}function T(n){return n instanceof Error?n.message:String(n)}export{_ as ProjectSearchDialog,Z as QuickOpenDialog};
|
package/dist/client/assets/{SystemMetricsDialog-DxQsGcIH.js → SystemMetricsDialog-CxiyDnsC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as f,r as a,j as e}from"./react-BoEjKzFZ.js";import{a as y,M as b,A as M,R as $}from"./index-
|
|
1
|
+
import{u as f,r as a,j as e}from"./react-BoEjKzFZ.js";import{a as y,M as b,A as M,R as $}from"./index-BoLY1azn.js";function w({open:t,onOpenChange:c}){const{t:s}=f(),[r,p]=a.useState(null),[u,x]=a.useState(!1),[m,j]=a.useState(""),o=a.useCallback(async()=>{x(!0);try{p(await y("/api/health/metrics")),j("")}catch(i){j(i instanceof Error?i.message:s("errors.generic"))}finally{x(!1)}},[s]);return a.useEffect(()=>{if(!t)return;o();const i=window.setInterval(()=>{o()},5e3);return()=>window.clearInterval(i)},[t,o]),e.jsxs(b,{open:t,onOpenChange:c,wide:!0,title:s("metrics.title"),description:s("metrics.description"),footer:e.jsxs("button",{onClick:()=>{o()},disabled:u,children:[e.jsx($,{size:14,className:u?"spin":""}),s("metrics.refresh")]}),children:[m&&e.jsx("p",{className:"error",children:m}),!r&&!m&&e.jsx("p",{className:"muted",children:s("common.loading")}),r&&e.jsxs("div",{className:"system-metrics",children:[e.jsxs("div",{className:"metric-summary-grid",children:[e.jsx(l,{label:s("metrics.uptime"),value:v(r.uptimeSeconds)}),e.jsx(l,{label:s("metrics.memory"),value:`${h(r.memory.rssBytes)} RSS`,detail:`${h(r.memory.heapUsedBytes)} / ${h(r.memory.heapTotalBytes)} ${s("metrics.heap")}`}),e.jsx(l,{label:s("metrics.compileQueue"),value:`${r.compileQueue.running} / ${r.compileQueue.concurrency}`,detail:s("metrics.pending",{count:r.compileQueue.pending})}),e.jsx(l,{label:s("metrics.collaboration"),value:s("metrics.sessions",{count:r.collaboration.sessions}),detail:s("metrics.roomsAndDirty",{rooms:r.collaboration.rooms,dirty:r.collaboration.dirtyFiles})})]}),e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(M,{size:15}),s("metrics.eventLoop")]}),e.jsx("p",{children:s("metrics.latencySummary",r.eventLoopDelay)})]}),e.jsxs("section",{className:"metric-section",children:[e.jsx("h3",{children:s("metrics.operationDurations")}),Object.keys(r.durationsMs).length===0?e.jsx("p",{className:"muted",children:s("metrics.noSamples")}):e.jsx("div",{className:"metric-table-wrap",children:e.jsxs("table",{className:"metric-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("metrics.operation")}),e.jsx("th",{children:s("metrics.samples")}),e.jsx("th",{children:s("metrics.last")}),e.jsx("th",{children:"P50"}),e.jsx("th",{children:"P95"}),e.jsx("th",{children:s("metrics.max")})]})}),e.jsx("tbody",{children:Object.entries(r.durationsMs).sort(([i],[n])=>i.localeCompare(n)).map(([i,n])=>e.jsxs("tr",{children:[e.jsx("td",{children:g(i,s)}),e.jsx("td",{children:n.count}),e.jsx("td",{children:d(n.last)}),e.jsx("td",{children:d(n.p50)}),e.jsx("td",{children:d(n.p95)}),e.jsx("td",{children:d(n.max)})]},i))})]})})]})]})]})}function l({label:t,value:c,detail:s}){return e.jsxs("article",{className:"metric-card",children:[e.jsx("span",{children:t}),e.jsx("strong",{children:c}),s&&e.jsx("small",{children:s})]})}function h(t){return`${Math.round(t/1024/1024*10)/10} MB`}function v(t){const c=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return c?`${c}d ${s}h`:s?`${s}h ${r}m`:`${r}m`}function d(t){return t>=1e3?`${Math.round(t/100)/10}s`:`${Math.round(t*10)/10}ms`}function g(t,c){return c(`metrics.operations.${t}`,{defaultValue:t})}export{w as SystemMetricsDialog};
|