collabmd 0.1.36 → 0.1.38
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/README.md +1 -0
- package/dist/client/assets/{drawio-editor-D4Qoluwz.js → drawio-editor-BHI0pLby.js} +1 -1
- package/dist/client/assets/{drawioEditor-B65FWq-b.js → drawioEditor-DOaXwaY2.js} +2 -2
- package/dist/client/assets/{editor-session-DV80PhYL.js → editor-session-BFsA-WRc.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-hiJQt1cX.js → excalidraw-editor-6pgH2kf5.js} +1 -1
- package/dist/client/assets/{excalidrawEditor-BnbblxK4.js → excalidrawEditor-Ck9hgrTa.js} +2 -2
- package/dist/client/assets/export-page-4M8Zo-AL.js +39 -0
- package/dist/client/assets/exportDocument-BAqaHlIn.css +1 -0
- package/dist/client/assets/{exportDocument-CULEGKmb.js → exportDocument-mlXOym-R.js} +2 -2
- package/dist/client/assets/{index-BjdYZiBM.js → index-CCfHrm_9.js} +2 -2
- package/dist/client/assets/{index-BryqP9QY.css → index-maPm_Kvk.css} +1 -1
- package/dist/client/assets/main-BQMPQ4CW.js +1410 -0
- package/dist/client/assets/preview-render-compiler-9SmLUP5V.js +1 -0
- package/dist/client/assets/{preview-render-compiler-Tkc6JX1O.js → preview-render-compiler-IUtgIlOM.js} +1 -1
- package/dist/client/assets/{preview-render-worker-1LBLqgKu.js → preview-render-worker-BwQ5sPy9.js} +1 -1
- package/dist/client/assets/runtime-config-BcUbZKho.js +1 -0
- package/dist/client/assets/{vault-api-client-DSx3mWkH.js → vault-api-client-BDKKvtOF.js} +1 -1
- package/dist/client/drawio-editor.html +1 -1
- package/dist/client/excalidraw-editor.html +1 -1
- package/dist/client/export-document.html +2 -2
- package/dist/client/index.html +2 -2
- package/docker-compose.yml +1 -0
- package/package.json +12 -9
- package/src/client/application/app-shell/ui-feature-shell.js +237 -0
- package/src/client/application/preview-render-compiler.js +120 -1
- package/src/client/application/preview-render-executor.js +4 -0
- package/src/client/application/preview-render-worker.js +2 -0
- package/src/client/application/preview-renderer.js +5 -2
- package/src/client/application/wiki-link-file-controller.js +7 -0
- package/src/client/application/workspace-route-controller.js +9 -0
- package/src/client/bootstrap/collabmd-app-shell.js +13 -0
- package/src/client/domain/hash-routes.js +49 -0
- package/src/client/domain/runtime-paths.js +1 -0
- package/src/client/export/export-pipeline.js +100 -26
- package/src/client/infrastructure/runtime-config.js +22 -24
- package/src/client/presentation/outline-controller.js +28 -7
- package/src/client/styles/features/preview-markdown.css +51 -0
- package/src/server/config/env.js +1 -0
- package/src/server/infrastructure/http/create-static-handler.js +2 -0
- package/dist/client/assets/export-page-BKDarp9x.js +0 -39
- package/dist/client/assets/exportDocument-BbkN85c4.css +0 -1
- package/dist/client/assets/main-QJcxyvDa.js +0 -1404
- package/dist/client/assets/preview-render-compiler-BCB8u6iM.js +0 -1
- package/dist/client/assets/runtime-config-DWTejofP.js +0 -1
package/README.md
CHANGED
|
@@ -605,6 +605,7 @@ vite.config.mjs Vite multi-page build and dev-server proxy config
|
|
|
605
605
|
| `BASE_PATH` | URL path prefix for subpath deployments | |
|
|
606
606
|
| `PLANTUML_SERVER_URL` | Upstream PlantUML server base URL used for server-side SVG rendering | `https://www.plantuml.com/plantuml` |
|
|
607
607
|
| `COLLABMD_DRAWIO_BASE_URL` | diagrams.net base URL used for `.drawio` viewing and editing | `https://embed.diagrams.net` |
|
|
608
|
+
| `COLLABMD_WIKI_LINK_AUTO_CREATE` | Create missing markdown files when clicking unresolved wiki-links; set to `false` to disable | `true` |
|
|
608
609
|
| `COLLABMD_VAULT_DIR` | Vault directory path | CLI: current directory, server entrypoint: `data/vault`, Docker: `/data` |
|
|
609
610
|
| `COLLABMD_GIT_ENABLED` | Enable or disable git integration in the UI and API | `true` |
|
|
610
611
|
| `COLLABMD_GIT_REPO_URL` | Remote git repository used to bootstrap the vault checkout | |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* empty css */import{n as e,r as t,t as n}from"./vault-api-client-
|
|
1
|
+
/* empty css */import{n as e,r as t,t as n}from"./vault-api-client-BDKKvtOF.js";import{m as r,n as i}from"./runtime-config-BcUbZKho.js";import{n as ee,r as te,t as a}from"./yjs-provider-reset-guard-DSPzcvAO.js";import{n as o,t as s}from"./drawio-room-1i6Nn0_Z.js";var c=4e3;function l(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}var u=class{constructor({clearIntervalFn:e=e=>window.clearInterval(e),filePath:t=``,heartbeatIntervalMs:n=s,now:i=()=>Date.now(),onStateChange:a=()=>{},resolveWsBaseUrlFn:l=r,roomName:u=``,setIntervalFn:d=(e,t)=>window.setInterval(e,t),setTimeoutFn:f=(e,t)=>window.setTimeout(e,t),staleLeaseMs:p=o,syncTimeoutMs:m=c,websocketProviderFactory:h=(e,t,n,r)=>new ee(e,t,n,r),ydocFactory:g=()=>new te}){this.clearIntervalFn=e,this.filePath=t,this.heartbeatIntervalMs=n,this.now=i,this.onStateChange=a,this.resolveWsBaseUrlFn=l,this.roomName=u,this.setIntervalFn=d,this.setTimeoutFn=f,this.staleLeaseMs=p,this.syncTimeoutMs=m,this.websocketProviderFactory=h,this.ydocFactory=g,this.ydoc=null,this.provider=null,this.awareness=null,this.leaseMap=null,this.statusMap=null,this.localUser=null,this.localMode=`viewer`,this.heartbeatTimer=null,this.currentState=this.createState(),this.handleLeaseChange=()=>this.emitState(),this.handleStatusChange=()=>this.emitState(),this.handleAwarenessChange=()=>this.emitState()}createState(e={}){return{acquiredAt:0,canClaim:!1,hasHealthyHolder:!1,heartbeatAt:0,holderClientId:``,holderName:``,holderPeerId:``,isEditor:!1,isStale:!0,mode:`viewer`,savedAt:0,savedVersion:0,...e}}async connect({initialUser:e=null,requestedMode:t=`edit`}={}){return this.localUser=e??null,this.localMode=`viewer`,this.roomName?(this.ydoc=this.ydocFactory(),this.provider=this.websocketProviderFactory(this.resolveWsBaseUrlFn(),this.roomName,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),a(this.provider),this.awareness=this.provider.awareness,this.leaseMap=this.ydoc.getMap(`lease`),this.statusMap=this.ydoc.getMap(`status`),this.setLocalAwareness({mode:`viewer`}),this.leaseMap.observe(this.handleLeaseChange),this.statusMap.observe(this.handleStatusChange),this.awareness.on(`change`,this.handleAwarenessChange),await this.waitForSync(),t===`edit`?this.tryAcquireLease():this.emitState(),this.currentState):(this.currentState=this.createState(),this.onStateChange(this.currentState),this.currentState)}waitForSync(){return this.provider?new Promise(e=>{let t=!1,n=this.setTimeoutFn(()=>{t||(t=!0,this.provider.off?.(`sync`,r),e(!1))},this.syncTimeoutMs),r=i=>{!i||t||(t=!0,clearTimeout(n),this.provider.off?.(`sync`,r),e(!0))};this.provider.on?.(`sync`,r)}):Promise.resolve(!1)}setLocalUser(e=null){return this.localUser=e??null,this.setLocalAwareness({mode:this.currentState.isEditor?`editor`:`viewer`}),this.localUser}setLocalAwareness({mode:e=`viewer`}={}){this.localMode=e,this.awareness&&this.awareness.setLocalStateField(`drawio`,{filePath:this.filePath,mode:e,name:this.localUser?.name||``,peerId:this.localUser?.peerId||``})}getLocalClientId(){return this.ydoc?String(this.ydoc.clientID):``}getLeaseSnapshot(){return{acquiredAt:l(this.leaseMap?.get(`acquiredAt`)),heartbeatAt:l(this.leaseMap?.get(`heartbeatAt`)),holderClientId:String(this.leaseMap?.get(`holderClientId`)||``),holderName:String(this.leaseMap?.get(`holderName`)||``),holderPeerId:String(this.leaseMap?.get(`holderPeerId`)||``)}}findHolderAwarenessState(e){if(!e||!this.awareness)return null;for(let[t,n]of this.awareness.getStates())if(String(t)===String(e)&&n?.drawio?.filePath===this.filePath)return n.drawio;return null}isLeaseStale(e=this.getLeaseSnapshot()){return!e.holderClientId||!this.findHolderAwarenessState(e.holderClientId)?!0:this.now()-e.heartbeatAt>this.staleLeaseMs}isLeaseHeldByLocal(e=this.getLeaseSnapshot()){return!!e.holderClientId&&e.holderClientId===this.getLocalClientId()}tryAcquireLease(){if(!this.leaseMap)return!1;let e=this.getLeaseSnapshot();if(e.holderClientId&&!this.isLeaseStale(e)&&!this.isLeaseHeldByLocal(e))return this.emitState(),!1;let t=this.now();return this.ydoc.transact(()=>{this.leaseMap.set(`holderClientId`,this.getLocalClientId()),this.leaseMap.set(`holderName`,this.localUser?.name||``),this.leaseMap.set(`holderPeerId`,this.localUser?.peerId||``),this.leaseMap.set(`acquiredAt`,t),this.leaseMap.set(`heartbeatAt`,t)},`drawio-lease-acquire`),this.emitState(),this.currentState.isEditor}renewLeaseHeartbeat(){return!this.leaseMap||!this.isLeaseHeldByLocal()?!1:(this.leaseMap.set(`heartbeatAt`,this.now()),!0)}startHeartbeat(){this.heartbeatTimer||=this.setIntervalFn(()=>{this.renewLeaseHeartbeat()},this.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer&&=(this.clearIntervalFn(this.heartbeatTimer),null)}releaseLease(){return!this.leaseMap||!this.isLeaseHeldByLocal()?!1:(this.stopHeartbeat(),this.ydoc.transact(()=>{this.leaseMap.delete(`holderClientId`),this.leaseMap.delete(`holderName`),this.leaseMap.delete(`holderPeerId`),this.leaseMap.delete(`acquiredAt`),this.leaseMap.delete(`heartbeatAt`)},`drawio-lease-release`),this.setLocalAwareness({mode:`viewer`}),this.emitState(),!0)}publishSave(){if(!this.statusMap)return 0;let e=l(this.statusMap.get(`savedVersion`))+1,t=this.now();return this.ydoc.transact(()=>{this.statusMap.set(`savedVersion`,e),this.statusMap.set(`savedAt`,t)},`drawio-save-status`),this.emitState(),e}emitState(){let e=this.getLeaseSnapshot(),t=this.isLeaseStale(e),n=this.isLeaseHeldByLocal(e),r=this.createState({acquiredAt:e.acquiredAt,canClaim:!n&&t,hasHealthyHolder:!!e.holderClientId&&!t,heartbeatAt:e.heartbeatAt,holderClientId:e.holderClientId,holderName:e.holderName,holderPeerId:e.holderPeerId,isEditor:n,isStale:t,mode:n?`editor`:`viewer`,savedAt:l(this.statusMap?.get(`savedAt`)),savedVersion:l(this.statusMap?.get(`savedVersion`))});return n?(this.startHeartbeat(),this.setLocalAwareness({mode:`editor`})):(this.stopHeartbeat(),this.setLocalAwareness({mode:`viewer`})),this.currentState=r,this.onStateChange(r),r}destroy(){this.releaseLease(),this.stopHeartbeat(),this.leaseMap?.unobserve?.(this.handleLeaseChange),this.statusMap?.unobserve?.(this.handleStatusChange),this.awareness?.off?.(`change`,this.handleAwarenessChange),this.provider?.destroy?.(),this.ydoc?.destroy?.(),this.provider=null,this.ydoc=null,this.awareness=null,this.leaseMap=null,this.statusMap=null}},d=1e3,f=15e3,p=window.location.origin,m=new URLSearchParams(window.location.search),h=m.get(`file`)||``,g=m.get(`leaseRoom`)||``,_=m.get(`mode`)===`view`?`view`:`edit`,v=m.get(`hostMode`)||``,y=m.get(`instanceId`)||``,b=m.get(`theme`)===`light`?`light`:`dark`,x=v===`export-image`,S=Number.parseInt(m.get(`previewWidth`)||``,10),C=i(),w=``,T=b,E=null,D=null,O=!1,k=null,A=null,j=null,M=null,N=0,P=!1,F=!1,I=document.getElementById(`loadingState`),L=document.getElementById(`root`),R={bannerText:``,canClaim:!1,isEditor:!1},z=document.createElement(`div`);z.className=`drawio-shell`;var B=document.createElement(`div`);B.className=`drawio-banner`,B.innerHTML=`
|
|
2
2
|
<div class="drawio-banner-status">
|
|
3
3
|
<span class="drawio-banner-pill" id="drawioModePill">Loading</span>
|
|
4
4
|
<span class="drawio-banner-copy" id="drawioBannerText">Connecting…</span>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./drawio-editor-
|
|
2
|
-
import{t as e}from"./runtime-config-loader-_D2KZKn-.js";import{t}from"./preload-helper-Bo9GmnuQ.js";await e(),await t(()=>import(`./drawio-editor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./drawio-editor-BHI0pLby.js","./yjs-provider-reset-guard-DSPzcvAO.js","./runtime-config-BcUbZKho.js","./vault-api-client-BDKKvtOF.js","./vault-api-client-D7Ck0CvR.css","./drawio-room-1i6Nn0_Z.js","./drawio-editor-UQQ8XHou.css","./embedded-editor-base-CgEkjNYn.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-config-loader-_D2KZKn-.js";import{t}from"./preload-helper-Bo9GmnuQ.js";await e(),await t(()=>import(`./drawio-editor-BHI0pLby.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-BE8C_ouo.js","./dist-WXLmfDGg.js","./dist-CaMl1R6P.js","./dist-D34Xzrah.js","./dist-CQVTTk81.js","./dist-CcG3Y7Wp.js","./dist-CJWCCWEW.js","./dist-v3i1ifes.js","./dist-DLyohOXi.js","./dist-Bn8WRPs1.js","./dist-mPPUaHhq.js","./dist-DQiph4qx.js","./dist-Csbx9lQ-.js","./dist-DdAqzGFU.js","./dist-DZ2t5lUX.js","./dist-DPCUH5MO.js","./dist-DWRyOl2w.js","./dist-CghBwrO3.js","./dist-Brrlevif.js","./dist-BPEi1dEF.js","./dist-BiCgLddE.js","./dist-aE0_04fl.js","./dist-CBEw2W2P.js","./dist-BEKQo64E.js","./dist-Dbg8P4C5.js","./dist-BfVljg0L2.js","./dist-BScEL4VP.js","./dockerfile-D8_6_FRV.js","./simple-mode-pOKc0mfx.js","./factor-Cz-hzBGH.js","./javascript-qUBHINSy.js","./javascript-gTK9fxz6.js","./nsis-QPGhLAeY.js","./pug-lkTEco3G.js","./dist-B98fHn5m.js","./dist-BOP-dC-R.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Bo9GmnuQ.js";import{$ as t,A as n,B as r,F as i,G as a,H as o,J as s,K as c,L as l,P as u,Q as d,R as f,St as p,Tt as m,V as h,W as g,Z as _,_t as ee,a as v,bt as te,c as ne,ct as y,et as re,f as ie,ft as ae,g as oe,gt as b,l as se,lt as x,mt as ce,nt as S,o as le,ot as C,pt as ue,q as de,rt as fe,st as pe,t as me,ut as w,v as he,w as ge,wt as _e,xt as ve,z as ye}from"./dist-CaMl1R6P.js";import{i as be,n as xe,r as Se}from"./dist-WXLmfDGg.js";import{a as Ce,s as we}from"./dist-Brrlevif.js";import{t as Te}from"./dist-BScEL4VP.js";import{a as Ee,c as De,i as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./dist-DwvSvkOE.js";import{d as Pe,i as Fe}from"./file-kind-DmKq2MvD.js";import{f as Ie}from"./runtime-config-DWTejofP.js";import{a as Le,c as T,d as E,f as Re,g as ze,h as Be,i as Ve,l as D,m as O,n as He,o as k,p as A,r as Ue,s as We,t as Ge,u as j}from"./yjs-provider-reset-guard-DSPzcvAO.js";import{a as Ke,c as qe,d as Je,i as Ye,n as Xe,o as Ze,s as Qe,t as $e,u as et}from"./room-z2w9b96b.js";function tt({body:e,user:t}){return{body:e,createdAt:Date.now(),id:Ye(`comment`),peerId:t?.peerId??``,reactions:[],userColor:t?.color??``,userName:t?.name??`Anonymous`}}function nt(e,t){return e instanceof k?e.get(t):e?.[t]}function rt(e=[]){return Array.isArray(e)?e.map(e=>({emoji:typeof e?.emoji==`string`?e.emoji:``,users:Array.isArray(e?.users)?e.users.map(e=>({reactedAt:Number.isFinite(e?.reactedAt)?e.reactedAt:Date.now(),userColor:typeof e?.userColor==`string`?e.userColor:``,userId:typeof e?.userId==`string`?e.userId:``,userName:typeof e?.userName==`string`&&e.userName?e.userName:`Anonymous`})).filter(e=>e.userId):[]})).filter(e=>e.emoji&&e.users.length>0):[]}function it(e,t){let n=t?.doc;if(!n)return null;let r=e?.anchor??e,i=r?.anchorKind===`text`?`text`:`line`,a=n.lines,o=Math.min(Math.max(Math.round(r?.startLine??1),1),a),s=Math.min(Math.max(Math.round(r?.endLine??o),o),a),c=n.line(o).from,l=n.line(s).to,u=Math.min(Math.max(Math.round(r?.startIndex??c),0),n.length),d=Math.min(Math.max(Math.round(r?.endIndex??l),u),n.length);return{anchorEndLine:s,anchorKind:i,anchorQuote:qe(r?.anchorQuote||n.sliceString(u,d)),anchorStartLine:o,endIndex:d,startIndex:u}}var at=class{constructor({getDoc:e,getEditorState:t,getLocalUser:n,onCommentsChange:r=null}){this.getDoc=e,this.getEditorState=t,this.getLocalUser=n,this.onCommentsChange=r,this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}bind({commentThreads:e,ydoc:t,ytext:n}){this.unbind(),this.commentThreads=e,this.ydoc=t,this.ytext=n,this.handleCommentThreadsChange=()=>{this.emitCommentsChange()},this.handleTextChange=()=>{this.emitCommentsChange()},this.commentThreads.observeDeep(this.handleCommentThreadsChange),this.ytext?.observe?.(this.handleTextChange),this.emitCommentsChange()}unbind(){this.commentThreads&&this.handleCommentThreadsChange&&this.commentThreads.unobserveDeep(this.handleCommentThreadsChange),this.ytext&&this.handleTextChange&&this.ytext.unobserve(this.handleTextChange),this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}emitCommentsChange(){this.onCommentsChange?.(this.getCommentThreads())}refreshComments(){this.emitCommentsChange()}getCommentThreads(){return this.commentThreads?et(this.commentThreads).map(e=>this.resolveCommentThread(e)).filter(Boolean):[]}createCommentThread({anchor:e,body:t}){let n=this.getEditorState();if(!n||!this.commentThreads||!this.ytext||!this.ydoc)return null;let r=Qe(t),i=it(e,n);if(!r||!i)return null;let a=Ke({anchorEnd:E(j(this.ytext,i.endIndex)),anchorEndLine:i.anchorEndLine,anchorKind:i.anchorKind,anchorQuote:i.anchorQuote,anchorStart:E(j(this.ytext,i.startIndex)),anchorStartLine:i.anchorStartLine,createdAt:Date.now(),createdByColor:this.getLocalUser()?.color??``,createdByName:this.getLocalUser()?.name??`Anonymous`,createdByPeerId:this.getLocalUser()?.peerId??``,id:Ye(`thread`),messages:[tt({body:r,user:this.getLocalUser()})]});return a?(this.ydoc.transact(()=>{this.commentThreads.push([a])},`comment-thread-create`),a.get(`id`)):null}replyToCommentThread(e,t){let n=Qe(t);if(!n||!this.ydoc)return null;let r=this.findSharedCommentThread(e)?.get(`messages`);if(!(r instanceof Le))return null;let i=tt({body:n,user:this.getLocalUser()});return this.ydoc.transact(()=>{r.push([i])},`comment-thread-reply`),i.id}toggleCommentReaction(e,t,n){if(!this.ydoc||!e||!t||typeof n!=`string`||!n.trim())return!1;let r=this.getLocalUser?.(),i=typeof r?.userId==`string`?r.userId:``;if(!i)return!1;let a=this.findSharedCommentThread(e)?.get(`messages`);if(!(a instanceof Le))return!1;let o=a.toArray(),s=o.findIndex(e=>nt(e,`id`)===t);if(s<0)return!1;let c=o[s]instanceof k?o[s].toJSON():{...o[s]},l=rt(c.reactions),u=l.findIndex(e=>e.emoji===n);if(u>=0){let e=l[u].users.filter(e=>e.userId!==i);e.length===l[u].users.length&&e.push({reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}),e.length===0?l.splice(u,1):l[u]={...l[u],users:e}}else l.push({emoji:n,users:[{reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}]});let d={...c,reactions:l};return this.ydoc.transact(()=>{a.delete(s,1),a.insert(s,[d])},`comment-reaction-toggle`),!0}deleteCommentThread(e){if(!this.commentThreads||!this.ydoc)return!1;let t=this.findSharedCommentThreadIndex(e);return t<0?!1:(this.ydoc.transact(()=>{this.commentThreads.delete(t,1)},`comment-thread-resolve`),!0)}findSharedCommentThread(e){return this.commentThreads?this.commentThreads.toArray().find(t=>t instanceof k&&t.get(`id`)===e)??null:null}findSharedCommentThreadIndex(e){return this.commentThreads?this.commentThreads.toArray().findIndex(t=>t instanceof k&&t.get(`id`)===e):-1}resolveCommentThread(e){let t=this.getEditorState();if(!e||!t||!this.ydoc)return null;let n=Ze(e);if(!n)return null;let r=this.resolveCommentPosition(n.anchorStart),i=this.resolveCommentPosition(n.anchorEnd),a=r?.index??t.doc.line(n.anchorStartLine).from,o=Math.min(Math.max(n.anchorEndLine??n.anchorStartLine,n.anchorStartLine),t.doc.lines),s=i?.index??t.doc.line(o).to,c=t.doc.lineAt(a).number,l=Math.min(Math.max(s,a),t.doc.length),u=t.doc.lineAt(l).number,d=Je(t.doc.sliceString(a,n.anchorKind===`text`?Math.max(s,a):t.doc.line(u).to))||n.anchorQuote;return{...e,anchor:{endIndex:s,endLine:u,excerpt:d,quote:n.anchorQuote,startIndex:a,startLine:c,kind:n.anchorKind},anchorEnd:n.anchorEnd,anchorEndLine:n.anchorEndLine,anchorKind:n.anchorKind,anchorQuote:n.anchorQuote,anchorStart:n.anchorStart,anchorStartLine:n.anchorStartLine}}resolveCommentPosition(e){if(!e||!this.ydoc||!this.ytext)return null;try{let t=T(D(e),this.ydoc);return!t||t.type!==this.ytext?null:t}catch{return null}}},ot=class{constructor({localUser:e=null,onAwarenessChange:t=null,onConnectionChange:n=null,onInitialSync:r=null,preferredUserName:i,resolveAwarenessCursor:a=null}){this.onAwarenessChange=t,this.onConnectionChange=n,this.onInitialSync=r,this.preferredUserName=i,this.providedLocalUser=e,this.resolveAwarenessCursor=a??(()=>null),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc=null,this.ytext=null,this.commentThreads=null,this.wsBaseUrl=``,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.resolveInitialSync=null}normalizeViewport(e){if(!e||typeof e!=`object`)return null;let t=Number(e.topLine),n=Number(e.viewportRatio);return!Number.isFinite(t)||t<1?null:{topLine:Math.max(1,Math.round(t)),viewportRatio:Number.isFinite(n)?Math.min(Math.max(n,0),1):.35}}async initialize(e){this.wsBaseUrl=Ie(),this.ydoc=new Ue,this.ytext=this.ydoc.getText(`codemirror`),this.commentThreads=this.ydoc.getArray(`comments`);let t=new Ve(this.ytext),n=new He(this.wsBaseUrl,e,this.ydoc,{disableBc:!0,maxBackoffTime:5e3});Ge(n);let r=n.awareness,i=this.providedLocalUser??$e(this.preferredUserName);this.provider=n,this.awareness=r,this.localUser=i,this.initialSyncComplete=!1,this.initialSyncPromise=new Promise(e=>{this.resolveInitialSync=e}),r.setLocalStateField(`user`,i),r.on(`change`,()=>{this.onAwarenessChange?.(this.collectUsers(this.resolveAwarenessCursor))}),this.trackConnectionStatus();let a=!1;return n.on(`sync`,e=>{!e||a||(a=!0,this.initialSyncComplete=!0,this.resolveInitialSync?.(),this.resolveInitialSync=null,this.onInitialSync?.())}),{awareness:r,commentThreads:this.commentThreads,localUser:this.localUser,undoManager:t,ydoc:this.ydoc,ytext:this.ytext}}destroy(){this.resolveInitialSync?.(),this.resolveInitialSync=null,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc?.destroy(),this.ydoc=null,this.ytext=null,this.commentThreads=null}waitForInitialSync(e=1500){return this.initialSyncComplete?Promise.resolve():e==null||e===!1?this.initialSyncPromise:Promise.race([this.initialSyncPromise,new Promise(t=>{window.setTimeout(t,e)})])}getText(){return this.ytext?.toString()??``}getLocalUser(){return this.localUser}setUserName(e){let t=Xe(e);return!t||!this.awareness||!this.localUser?null:(this.localUser={...this.localUser,name:t},this.awareness.setLocalStateField(`user`,this.localUser),t)}getUserCursor(e,t){return this.awareness?t(this.awareness.getStates().get(e)?.cursor):null}getUserViewport(e){if(!this.awareness)return null;let t=this.awareness.getStates().get(e);return this.normalizeViewport(t?.viewport)}setLocalViewport(e){if(!this.awareness)return null;let t=this.normalizeViewport(e);return this.awareness.setLocalStateField(`viewport`,t),t}collectUsers(e=()=>null){if(!this.awareness)return[];let t=[];return this.awareness.getStates().forEach((n,r)=>{if(!n.user)return;let i=e(n.cursor);t.push({...i??{},...n.user,clientId:r,hasCursor:!!i,isLocal:r===this.awareness.clientID,viewport:this.normalizeViewport(n.viewport)})}),t}trackConnectionStatus(){if(!this.provider)return;let e=0,t=!1;this.provider.on(`status`,({status:n})=>{n===`connecting`&&(e+=1);let r=n===`connected`&&!t;n===`connected`&&(e=0,t=!0),this.onConnectionChange?.({attempts:e,firstConnection:r,hasEverConnected:t,status:n,unreachable:!t&&e>=3,wsBaseUrl:this.wsBaseUrl})})}};function M(e){return new le(ne.define(e))}function N(t){return e(()=>import(`./dist-BE8C_ouo.js`).then(e=>e.sql({dialect:e[t]})),__vite__mapDeps([0,1,2,3]),import.meta.url)}var st=[v.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return N(`Cassandra`)}}),v.of({name:`CSS`,extensions:[`css`],load(){return e(()=>import(`./dist-CcG3Y7Wp.js`).then(e=>e.css()),__vite__mapDeps([5,6,2,3]),import.meta.url)}}),v.of({name:`Go`,extensions:[`go`],load(){return e(()=>import(`./dist-v3i1ifes.js`).then(e=>e.go()),__vite__mapDeps([7,1,2,3]),import.meta.url)}}),v.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return e(()=>import(`./dist-DLyohOXi.js`).then(e=>e.html()),__vite__mapDeps([8,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Java`,extensions:[`java`],load(){return e(()=>import(`./dist-DQiph4qx.js`).then(e=>e.java()),__vite__mapDeps([11,2,3]),import.meta.url)}}),v.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript()),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return e(()=>import(`./dist-DdAqzGFU.js`).then(e=>e.jinja()),__vite__mapDeps([13,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return e(()=>import(`./dist-DZ2t5lUX.js`).then(e=>e.json()),__vite__mapDeps([14,2,3]),import.meta.url)}}),v.of({name:`JSX`,extensions:[`jsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`LESS`,extensions:[`less`],load(){return e(()=>import(`./dist-DPCUH5MO.js`).then(e=>e.less()),__vite__mapDeps([15,6,2,3]),import.meta.url)}}),v.of({name:`Liquid`,extensions:[`liquid`],load(){return e(()=>import(`./dist-DWRyOl2w.js`).then(e=>e.liquid()),__vite__mapDeps([16,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`MariaDB SQL`,load(){return N(`MariaSQL`)}}),v.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return e(()=>import(`./dist-CghBwrO3.js`).then(e=>e.markdown()),__vite__mapDeps([17,18,1,2,9,6,3,10]),import.meta.url)}}),v.of({name:`MS SQL`,load(){return N(`MSSQL`)}}),v.of({name:`MySQL`,load(){return N(`MySQL`)}}),v.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return e(()=>import(`./dist-BPEi1dEF.js`).then(e=>e.php()),__vite__mapDeps([19,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`PLSQL`,extensions:[`pls`],load(){return N(`PLSQL`)}}),v.of({name:`PostgreSQL`,load(){return N(`PostgreSQL`)}}),v.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return e(()=>import(`./dist-BiCgLddE.js`).then(e=>e.python()),__vite__mapDeps([20,1,2,3]),import.meta.url)}}),v.of({name:`Rust`,extensions:[`rs`],load(){return e(()=>import(`./dist-aE0_04fl.js`).then(e=>e.rust()),__vite__mapDeps([21,2,3]),import.meta.url)}}),v.of({name:`Sass`,extensions:[`sass`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SCSS`,extensions:[`scss`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass()),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SQL`,extensions:[`sql`],load(){return N(`StandardSQL`)}}),v.of({name:`SQLite`,load(){return N(`SQLite`)}}),v.of({name:`TSX`,extensions:[`tsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return e(()=>import(`./dist-BEKQo64E.js`).then(e=>e.wast()),__vite__mapDeps([23,2,3]),import.meta.url)}}),v.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return e(()=>import(`./dist-Dbg8P4C5.js`).then(e=>e.xml()),__vite__mapDeps([24,2,3]),import.meta.url)}}),v.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return e(()=>import(`./dist-BfVljg0L2.js`).then(e=>e.yaml()),__vite__mapDeps([25,26,2,3]),import.meta.url)}}),v.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return e(()=>import(`./apl-C1JYSI8J.js`).then(e=>M(e.apl)),[],import.meta.url)}}),v.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return e(()=>import(`./asciiarmor-DHW75j1s.js`).then(e=>M(e.asciiArmor)),[],import.meta.url)}}),v.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return e(()=>import(`./asn1-CQiG40kG.js`).then(e=>M(e.asn1({}))),[],import.meta.url)}}),v.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return e(()=>import(`./asterisk-BWExh0n4.js`).then(e=>M(e.asterisk)),[],import.meta.url)}}),v.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return e(()=>import(`./brainfuck-CTNFyOLg.js`).then(e=>M(e.brainfuck)),[],import.meta.url)}}),v.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return e(()=>import(`./cobol-DP4QggbL.js`).then(e=>M(e.cobol)),[],import.meta.url)}}),v.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.csharp)),[],import.meta.url)}}),v.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`ClojureScript`,extensions:[`cljs`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return e(()=>import(`./css-CmhPNxBE.js`).then(e=>M(e.gss)),[],import.meta.url)}}),v.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return e(()=>import(`./cmake-DtGL-Unu.js`).then(e=>M(e.cmake)),[],import.meta.url)}}),v.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return e(()=>import(`./coffeescript-B7GZajzV.js`).then(e=>M(e.coffeeScript)),[],import.meta.url)}}),v.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return e(()=>import(`./commonlisp-COlJYiQT.js`).then(e=>M(e.commonLisp)),[],import.meta.url)}}),v.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return e(()=>import(`./cypher-DEGl2llJ.js`).then(e=>M(e.cypher)),[],import.meta.url)}}),v.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return e(()=>import(`./python-BUyhM0Ew.js`).then(e=>M(e.cython)),[],import.meta.url)}}),v.of({name:`Crystal`,extensions:[`cr`],load(){return e(()=>import(`./crystal-I_dE9xG-.js`).then(e=>M(e.crystal)),[],import.meta.url)}}),v.of({name:`D`,extensions:[`d`],load(){return e(()=>import(`./d-BspB0dox.js`).then(e=>M(e.d)),[],import.meta.url)}}),v.of({name:`Dart`,extensions:[`dart`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.dart)),[],import.meta.url)}}),v.of({name:`diff`,extensions:[`diff`,`patch`],load(){return e(()=>import(`./diff-BWuPUsEo.js`).then(e=>M(e.diff)),[],import.meta.url)}}),v.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return e(()=>import(`./dockerfile-D8_6_FRV.js`).then(e=>M(e.dockerFile)),__vite__mapDeps([27,28]),import.meta.url)}}),v.of({name:`DTD`,extensions:[`dtd`],load(){return e(()=>import(`./dtd-C6brJFPg.js`).then(e=>M(e.dtd)),[],import.meta.url)}}),v.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return e(()=>import(`./dylan-Bft86ZSB.js`).then(e=>M(e.dylan)),[],import.meta.url)}}),v.of({name:`EBNF`,load(){return e(()=>import(`./ebnf-D6ifG44A.js`).then(e=>M(e.ebnf)),[],import.meta.url)}}),v.of({name:`ECL`,extensions:[`ecl`],load(){return e(()=>import(`./ecl-D9rhJ9-u.js`).then(e=>M(e.ecl)),[],import.meta.url)}}),v.of({name:`edn`,extensions:[`edn`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Eiffel`,extensions:[`e`],load(){return e(()=>import(`./eiffel-DwxtewZF.js`).then(e=>M(e.eiffel)),[],import.meta.url)}}),v.of({name:`Elm`,extensions:[`elm`],load(){return e(()=>import(`./elm-B1TncobV.js`).then(e=>M(e.elm)),[],import.meta.url)}}),v.of({name:`Erlang`,extensions:[`erl`],load(){return e(()=>import(`./erlang-BDJZNtt8.js`).then(e=>M(e.erlang)),[],import.meta.url)}}),v.of({name:`Esper`,load(){return e(()=>import(`./sql-GL7dVWcd.js`).then(e=>M(e.esper)),[],import.meta.url)}}),v.of({name:`Factor`,extensions:[`factor`],load(){return e(()=>import(`./factor-Cz-hzBGH.js`).then(e=>M(e.factor)),__vite__mapDeps([29,28]),import.meta.url)}}),v.of({name:`FCL`,load(){return e(()=>import(`./fcl-CUXJFJn1.js`).then(e=>M(e.fcl)),[],import.meta.url)}}),v.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return e(()=>import(`./forth-nvhcMz63.js`).then(e=>M(e.forth)),[],import.meta.url)}}),v.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return e(()=>import(`./fortran-BZID-z10.js`).then(e=>M(e.fortran)),[],import.meta.url)}}),v.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.fSharp)),[],import.meta.url)}}),v.of({name:`Gas`,extensions:[`s`],load(){return e(()=>import(`./gas-DjQsZDGE.js`).then(e=>M(e.gas)),[],import.meta.url)}}),v.of({name:`Gherkin`,extensions:[`feature`],load(){return e(()=>import(`./gherkin-S0kHlzux.js`).then(e=>M(e.gherkin)),[],import.meta.url)}}),v.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return e(()=>import(`./groovy-Di--Vb9Z.js`).then(e=>M(e.groovy)),[],import.meta.url)}}),v.of({name:`Haskell`,extensions:[`hs`],load(){return e(()=>import(`./haskell-C6qH3-aI.js`).then(e=>M(e.haskell)),[],import.meta.url)}}),v.of({name:`Haxe`,extensions:[`hx`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.haxe)),[],import.meta.url)}}),v.of({name:`HXML`,extensions:[`hxml`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.hxml)),[],import.meta.url)}}),v.of({name:`HTTP`,load(){return e(()=>import(`./http-DG1Y9fpK.js`).then(e=>M(e.http)),[],import.meta.url)}}),v.of({name:`IDL`,extensions:[`pro`],load(){return e(()=>import(`./idl-B64p3NTJ.js`).then(e=>M(e.idl)),[],import.meta.url)}}),v.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return e(()=>import(`./javascript-qUBHINSy.js`).then(e=>M(e.jsonld)),__vite__mapDeps([30,31]),import.meta.url)}}),v.of({name:`Julia`,extensions:[`jl`],load(){return e(()=>import(`./julia-B22G9Bym.js`).then(e=>M(e.julia)),[],import.meta.url)}}),v.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.kotlin)),[],import.meta.url)}}),v.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return e(()=>import(`./livescript-CkcuHqeS.js`).then(e=>M(e.liveScript)),[],import.meta.url)}}),v.of({name:`Lua`,extensions:[`lua`],load(){return e(()=>import(`./lua-Cg0FqIlO.js`).then(e=>M(e.lua)),[],import.meta.url)}}),v.of({name:`mIRC`,extensions:[`mrc`],load(){return e(()=>import(`./mirc-BVG2S5rO.js`).then(e=>M(e.mirc)),[],import.meta.url)}}),v.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return e(()=>import(`./mathematica-CKVhKnoY.js`).then(e=>M(e.mathematica)),[],import.meta.url)}}),v.of({name:`Modelica`,extensions:[`mo`],load(){return e(()=>import(`./modelica-vJ-Qa9jV.js`).then(e=>M(e.modelica)),[],import.meta.url)}}),v.of({name:`MUMPS`,extensions:[`mps`],load(){return e(()=>import(`./mumps-D0KfUTSd.js`).then(e=>M(e.mumps)),[],import.meta.url)}}),v.of({name:`Mbox`,extensions:[`mbox`],load(){return e(()=>import(`./mbox-DANyzFJ2.js`).then(e=>M(e.mbox)),[],import.meta.url)}}),v.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return e(()=>import(`./nginx-DkVceJrH.js`).then(e=>M(e.nginx)),[],import.meta.url)}}),v.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return e(()=>import(`./nsis-QPGhLAeY.js`).then(e=>M(e.nsis)),__vite__mapDeps([32,28]),import.meta.url)}}),v.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return e(()=>import(`./ntriples-BBuCIfS0.js`).then(e=>M(e.ntriples)),[],import.meta.url)}}),v.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveC)),[],import.meta.url)}}),v.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveCpp)),[],import.meta.url)}}),v.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.oCaml)),[],import.meta.url)}}),v.of({name:`Octave`,extensions:[`m`],load(){return e(()=>import(`./octave-BTv2CqSQ.js`).then(e=>M(e.octave)),[],import.meta.url)}}),v.of({name:`Oz`,extensions:[`oz`],load(){return e(()=>import(`./oz-D8SjVDNU.js`).then(e=>M(e.oz)),[],import.meta.url)}}),v.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return e(()=>import(`./pascal-T-tfhVyx.js`).then(e=>M(e.pascal)),[],import.meta.url)}}),v.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return e(()=>import(`./perl-BDrCkHRd.js`).then(e=>M(e.perl)),[],import.meta.url)}}),v.of({name:`Pig`,extensions:[`pig`],load(){return e(()=>import(`./pig-BEyI4fPq.js`).then(e=>M(e.pig)),[],import.meta.url)}}),v.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return e(()=>import(`./powershell-DtnFc6GG.js`).then(e=>M(e.powerShell)),[],import.meta.url)}}),v.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return e(()=>import(`./properties-DWUvbxV9.js`).then(e=>M(e.properties)),[],import.meta.url)}}),v.of({name:`ProtoBuf`,extensions:[`proto`],load(){return e(()=>import(`./protobuf-CQGoYyfE.js`).then(e=>M(e.protobuf)),[],import.meta.url)}}),v.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return e(()=>import(`./pug-lkTEco3G.js`).then(e=>M(e.pug)),__vite__mapDeps([33,31]),import.meta.url)}}),v.of({name:`Puppet`,extensions:[`pp`],load(){return e(()=>import(`./puppet-Dd-qWO3p.js`).then(e=>M(e.puppet)),[],import.meta.url)}}),v.of({name:`Q`,extensions:[`q`],load(){return e(()=>import(`./q-Dls1OX0D.js`).then(e=>M(e.q)),[],import.meta.url)}}),v.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return e(()=>import(`./r-DeZ8Mdev.js`).then(e=>M(e.r)),[],import.meta.url)}}),v.of({name:`RPM Changes`,load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmChanges)),[],import.meta.url)}}),v.of({name:`RPM Spec`,extensions:[`spec`],load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmSpec)),[],import.meta.url)}}),v.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return e(()=>import(`./ruby-CB34f2Gf.js`).then(e=>M(e.ruby)),[],import.meta.url)}}),v.of({name:`SAS`,extensions:[`sas`],load(){return e(()=>import(`./sas-Bji4HDQq.js`).then(e=>M(e.sas)),[],import.meta.url)}}),v.of({name:`Scala`,extensions:[`scala`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.scala)),[],import.meta.url)}}),v.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return e(()=>import(`./scheme-C3elI80V.js`).then(e=>M(e.scheme)),[],import.meta.url)}}),v.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return e(()=>import(`./shell-DUveK2Hb.js`).then(e=>M(e.shell)),[],import.meta.url)}}),v.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return e(()=>import(`./sieve-2ogwMVx4.js`).then(e=>M(e.sieve)),[],import.meta.url)}}),v.of({name:`Smalltalk`,extensions:[`st`],load(){return e(()=>import(`./smalltalk-BuGhc6lW.js`).then(e=>M(e.smalltalk)),[],import.meta.url)}}),v.of({name:`Solr`,load(){return e(()=>import(`./solr-DTxshpm8.js`).then(e=>M(e.solr)),[],import.meta.url)}}),v.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.sml)),[],import.meta.url)}}),v.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return e(()=>import(`./sparql-vm8qNO8J.js`).then(e=>M(e.sparql)),[],import.meta.url)}}),v.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return e(()=>import(`./spreadsheet-C6Vbtl9-.js`).then(e=>M(e.spreadsheet)),[],import.meta.url)}}),v.of({name:`Squirrel`,extensions:[`nut`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.squirrel)),[],import.meta.url)}}),v.of({name:`Stylus`,extensions:[`styl`],load(){return e(()=>import(`./stylus-D1SZIMDs.js`).then(e=>M(e.stylus)),[],import.meta.url)}}),v.of({name:`Swift`,extensions:[`swift`],load(){return e(()=>import(`./swift-CKcKnWv9.js`).then(e=>M(e.swift)),[],import.meta.url)}}),v.of({name:`sTeX`,load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`Tcl`,extensions:[`tcl`],load(){return e(()=>import(`./tcl-SPk7uiDB.js`).then(e=>M(e.tcl)),[],import.meta.url)}}),v.of({name:`Textile`,extensions:[`textile`],load(){return e(()=>import(`./textile-C48beRus.js`).then(e=>M(e.textile)),[],import.meta.url)}}),v.of({name:`TiddlyWiki`,load(){return e(()=>import(`./tiddlywiki-CiImjFLN.js`).then(e=>M(e.tiddlyWiki)),[],import.meta.url)}}),v.of({name:`Tiki wiki`,load(){return e(()=>import(`./tiki-HkXZ4BIW.js`).then(e=>M(e.tiki)),[],import.meta.url)}}),v.of({name:`TOML`,extensions:[`toml`],load(){return e(()=>import(`./toml-BmfpMy1_.js`).then(e=>M(e.toml)),[],import.meta.url)}}),v.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return e(()=>import(`./troff-BjbEOT5E.js`).then(e=>M(e.troff)),[],import.meta.url)}}),v.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return e(()=>import(`./ttcn-NA-V4KnY.js`).then(e=>M(e.ttcn)),[],import.meta.url)}}),v.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return e(()=>import(`./ttcn-cfg-TPHncdGN.js`).then(e=>M(e.ttcnCfg)),[],import.meta.url)}}),v.of({name:`Turtle`,extensions:[`ttl`],load(){return e(()=>import(`./turtle-BkP3ExOG.js`).then(e=>M(e.turtle)),[],import.meta.url)}}),v.of({name:`Web IDL`,extensions:[`webidl`],load(){return e(()=>import(`./webidl-DttrYZRT.js`).then(e=>M(e.webIDL)),[],import.meta.url)}}),v.of({name:`VB.NET`,extensions:[`vb`],load(){return e(()=>import(`./vb-C19AQWqO.js`).then(e=>M(e.vb)),[],import.meta.url)}}),v.of({name:`VBScript`,extensions:[`vbs`],load(){return e(()=>import(`./vbscript-CHJk3s95.js`).then(e=>M(e.vbScript)),[],import.meta.url)}}),v.of({name:`Velocity`,extensions:[`vtl`],load(){return e(()=>import(`./velocity-Ya0P4sQU.js`).then(e=>M(e.velocity)),[],import.meta.url)}}),v.of({name:`Verilog`,extensions:[`v`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return e(()=>import(`./vhdl-CnYyYTpa.js`).then(e=>M(e.vhdl)),[],import.meta.url)}}),v.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return e(()=>import(`./xquery-CEDTd8qs.js`).then(e=>M(e.xQuery)),[],import.meta.url)}}),v.of({name:`Yacas`,extensions:[`ys`],load(){return e(()=>import(`./yacas-C7dxlPB0.js`).then(e=>M(e.yacas)),[],import.meta.url)}}),v.of({name:`Z80`,extensions:[`z80`],load(){return e(()=>import(`./z80-BqEfFSnA.js`).then(e=>M(e.z80)),[],import.meta.url)}}),v.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.mscgen)),[],import.meta.url)}}),v.of({name:`Xù`,extensions:[`xu`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.xu)),[],import.meta.url)}}),v.of({name:`MsGenny`,extensions:[`msgenny`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.msgenny)),[],import.meta.url)}}),v.of({name:`Vue`,extensions:[`vue`],load(){return e(()=>import(`./dist-B98fHn5m.js`).then(e=>e.vue()),__vite__mapDeps([34,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Angular Template`,load(){return e(()=>import(`./dist-BOP-dC-R.js`).then(e=>e.angular()),__vite__mapDeps([35,9,6,2,3,10,1]),import.meta.url)}})],ct=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,P=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ct(e)):ct,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=m(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(P.prototype[Symbol.iterator]=function(){return this});var lt={from:-1,to:-1,match:/.*/.exec(``),precise:!0},ut=`gm`+(/x/.unicode==null?``:`u`),dt=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=lt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new mt(e,t,n,r,i);this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=F(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=F(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},ft=new WeakMap,pt=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=ft.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return ft.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),ft.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},mt=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=lt,this.matchPos=F(e,r),this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=pt.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=F(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(dt.prototype[Symbol.iterator]=mt.prototype[Symbol.iterator]=function(){return this});function ht(e){try{return new RegExp(e,ut),!0}catch{return!1}}function F(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var gt=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=t(e,{label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,u]=r,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&u){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),f=Math.round(n.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,f))),m=y.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[i,l.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},_t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vt=w.define({combine(e){return p(e,_t,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[Tt,wt];return e&&t.push(vt.of(e)),t}var bt=i.mark({class:`cm-selectionMatch`}),xt=i.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function St(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=C.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=C.Word)}function Ct(e,t,n,r){return e(t.sliceDoc(n,n+1))==C.Word&&e(t.sliceDoc(r-1,r))==C.Word}var wt=f.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(vt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return i.none;let a=r.main,o,s=null;if(a.empty){if(!t.highlightWordAroundCursor)return i.none;let e=n.wordAt(a.head);if(!e)return i.none;s=n.charCategorizer(a.head),o=n.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<t.minSelectionLength||e>200)return i.none;if(t.wholeWords){if(o=n.sliceDoc(a.from,a.to),s=n.charCategorizer(a.head),!(St(s,n,a.from,a.to)&&Ct(s,n,a.from,a.to)))return i.none}else if(o=n.sliceDoc(a.from,a.to),!o)return i.none}let c=[];for(let r of e.visibleRanges){let e=new P(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||St(s,n,r,o))&&(a.empty&&r<=a.from&&o>=a.to?c.push(xt.range(r,o)):(r>=a.to||o<=a.from)&&c.push(bt.range(r,o)),c.length>t.maxMatches))return i.none}}return i.set(c)}},{decorations:e=>e.decorations}),Tt=l.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Et=({state:e,dispatch:t})=>{let{selection:n}=e,r=y.create(n.ranges.map(t=>e.wordAt(t.head)||y.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Dt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new P(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new P(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Ot=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Et({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Dt(e,r);return i?(t(e.update({selection:e.selection.addRange(y.range(i.from,i.to),!1),effects:l.scrollIntoView(i.to)})),!0):!1},I=w.define({combine(e){return p(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new $t(e),scrollToMatch:e=>l.scrollIntoView(e)})}}),kt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ht(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
|
+
import{t as e}from"./preload-helper-Bo9GmnuQ.js";import{$ as t,A as n,B as r,F as i,G as a,H as o,J as s,K as c,L as l,P as u,Q as d,R as f,St as p,Tt as m,V as h,W as g,Z as _,_t as ee,a as v,bt as te,c as ne,ct as y,et as re,f as ie,ft as ae,g as oe,gt as b,l as se,lt as x,mt as ce,nt as S,o as le,ot as C,pt as ue,q as de,rt as fe,st as pe,t as me,ut as w,v as he,w as ge,wt as _e,xt as ve,z as ye}from"./dist-CaMl1R6P.js";import{i as be,n as xe,r as Se}from"./dist-WXLmfDGg.js";import{a as Ce,s as we}from"./dist-Brrlevif.js";import{t as Te}from"./dist-BScEL4VP.js";import{a as Ee,c as De,i as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./dist-DwvSvkOE.js";import{d as Pe,i as Fe}from"./file-kind-DmKq2MvD.js";import{m as Ie}from"./runtime-config-BcUbZKho.js";import{a as Le,c as T,d as E,f as Re,g as ze,h as Be,i as Ve,l as D,m as O,n as He,o as k,p as A,r as Ue,s as We,t as Ge,u as j}from"./yjs-provider-reset-guard-DSPzcvAO.js";import{a as Ke,c as qe,d as Je,i as Ye,n as Xe,o as Ze,s as Qe,t as $e,u as et}from"./room-z2w9b96b.js";function tt({body:e,user:t}){return{body:e,createdAt:Date.now(),id:Ye(`comment`),peerId:t?.peerId??``,reactions:[],userColor:t?.color??``,userName:t?.name??`Anonymous`}}function nt(e,t){return e instanceof k?e.get(t):e?.[t]}function rt(e=[]){return Array.isArray(e)?e.map(e=>({emoji:typeof e?.emoji==`string`?e.emoji:``,users:Array.isArray(e?.users)?e.users.map(e=>({reactedAt:Number.isFinite(e?.reactedAt)?e.reactedAt:Date.now(),userColor:typeof e?.userColor==`string`?e.userColor:``,userId:typeof e?.userId==`string`?e.userId:``,userName:typeof e?.userName==`string`&&e.userName?e.userName:`Anonymous`})).filter(e=>e.userId):[]})).filter(e=>e.emoji&&e.users.length>0):[]}function it(e,t){let n=t?.doc;if(!n)return null;let r=e?.anchor??e,i=r?.anchorKind===`text`?`text`:`line`,a=n.lines,o=Math.min(Math.max(Math.round(r?.startLine??1),1),a),s=Math.min(Math.max(Math.round(r?.endLine??o),o),a),c=n.line(o).from,l=n.line(s).to,u=Math.min(Math.max(Math.round(r?.startIndex??c),0),n.length),d=Math.min(Math.max(Math.round(r?.endIndex??l),u),n.length);return{anchorEndLine:s,anchorKind:i,anchorQuote:qe(r?.anchorQuote||n.sliceString(u,d)),anchorStartLine:o,endIndex:d,startIndex:u}}var at=class{constructor({getDoc:e,getEditorState:t,getLocalUser:n,onCommentsChange:r=null}){this.getDoc=e,this.getEditorState=t,this.getLocalUser=n,this.onCommentsChange=r,this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}bind({commentThreads:e,ydoc:t,ytext:n}){this.unbind(),this.commentThreads=e,this.ydoc=t,this.ytext=n,this.handleCommentThreadsChange=()=>{this.emitCommentsChange()},this.handleTextChange=()=>{this.emitCommentsChange()},this.commentThreads.observeDeep(this.handleCommentThreadsChange),this.ytext?.observe?.(this.handleTextChange),this.emitCommentsChange()}unbind(){this.commentThreads&&this.handleCommentThreadsChange&&this.commentThreads.unobserveDeep(this.handleCommentThreadsChange),this.ytext&&this.handleTextChange&&this.ytext.unobserve(this.handleTextChange),this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}emitCommentsChange(){this.onCommentsChange?.(this.getCommentThreads())}refreshComments(){this.emitCommentsChange()}getCommentThreads(){return this.commentThreads?et(this.commentThreads).map(e=>this.resolveCommentThread(e)).filter(Boolean):[]}createCommentThread({anchor:e,body:t}){let n=this.getEditorState();if(!n||!this.commentThreads||!this.ytext||!this.ydoc)return null;let r=Qe(t),i=it(e,n);if(!r||!i)return null;let a=Ke({anchorEnd:E(j(this.ytext,i.endIndex)),anchorEndLine:i.anchorEndLine,anchorKind:i.anchorKind,anchorQuote:i.anchorQuote,anchorStart:E(j(this.ytext,i.startIndex)),anchorStartLine:i.anchorStartLine,createdAt:Date.now(),createdByColor:this.getLocalUser()?.color??``,createdByName:this.getLocalUser()?.name??`Anonymous`,createdByPeerId:this.getLocalUser()?.peerId??``,id:Ye(`thread`),messages:[tt({body:r,user:this.getLocalUser()})]});return a?(this.ydoc.transact(()=>{this.commentThreads.push([a])},`comment-thread-create`),a.get(`id`)):null}replyToCommentThread(e,t){let n=Qe(t);if(!n||!this.ydoc)return null;let r=this.findSharedCommentThread(e)?.get(`messages`);if(!(r instanceof Le))return null;let i=tt({body:n,user:this.getLocalUser()});return this.ydoc.transact(()=>{r.push([i])},`comment-thread-reply`),i.id}toggleCommentReaction(e,t,n){if(!this.ydoc||!e||!t||typeof n!=`string`||!n.trim())return!1;let r=this.getLocalUser?.(),i=typeof r?.userId==`string`?r.userId:``;if(!i)return!1;let a=this.findSharedCommentThread(e)?.get(`messages`);if(!(a instanceof Le))return!1;let o=a.toArray(),s=o.findIndex(e=>nt(e,`id`)===t);if(s<0)return!1;let c=o[s]instanceof k?o[s].toJSON():{...o[s]},l=rt(c.reactions),u=l.findIndex(e=>e.emoji===n);if(u>=0){let e=l[u].users.filter(e=>e.userId!==i);e.length===l[u].users.length&&e.push({reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}),e.length===0?l.splice(u,1):l[u]={...l[u],users:e}}else l.push({emoji:n,users:[{reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}]});let d={...c,reactions:l};return this.ydoc.transact(()=>{a.delete(s,1),a.insert(s,[d])},`comment-reaction-toggle`),!0}deleteCommentThread(e){if(!this.commentThreads||!this.ydoc)return!1;let t=this.findSharedCommentThreadIndex(e);return t<0?!1:(this.ydoc.transact(()=>{this.commentThreads.delete(t,1)},`comment-thread-resolve`),!0)}findSharedCommentThread(e){return this.commentThreads?this.commentThreads.toArray().find(t=>t instanceof k&&t.get(`id`)===e)??null:null}findSharedCommentThreadIndex(e){return this.commentThreads?this.commentThreads.toArray().findIndex(t=>t instanceof k&&t.get(`id`)===e):-1}resolveCommentThread(e){let t=this.getEditorState();if(!e||!t||!this.ydoc)return null;let n=Ze(e);if(!n)return null;let r=this.resolveCommentPosition(n.anchorStart),i=this.resolveCommentPosition(n.anchorEnd),a=r?.index??t.doc.line(n.anchorStartLine).from,o=Math.min(Math.max(n.anchorEndLine??n.anchorStartLine,n.anchorStartLine),t.doc.lines),s=i?.index??t.doc.line(o).to,c=t.doc.lineAt(a).number,l=Math.min(Math.max(s,a),t.doc.length),u=t.doc.lineAt(l).number,d=Je(t.doc.sliceString(a,n.anchorKind===`text`?Math.max(s,a):t.doc.line(u).to))||n.anchorQuote;return{...e,anchor:{endIndex:s,endLine:u,excerpt:d,quote:n.anchorQuote,startIndex:a,startLine:c,kind:n.anchorKind},anchorEnd:n.anchorEnd,anchorEndLine:n.anchorEndLine,anchorKind:n.anchorKind,anchorQuote:n.anchorQuote,anchorStart:n.anchorStart,anchorStartLine:n.anchorStartLine}}resolveCommentPosition(e){if(!e||!this.ydoc||!this.ytext)return null;try{let t=T(D(e),this.ydoc);return!t||t.type!==this.ytext?null:t}catch{return null}}},ot=class{constructor({localUser:e=null,onAwarenessChange:t=null,onConnectionChange:n=null,onInitialSync:r=null,preferredUserName:i,resolveAwarenessCursor:a=null}){this.onAwarenessChange=t,this.onConnectionChange=n,this.onInitialSync=r,this.preferredUserName=i,this.providedLocalUser=e,this.resolveAwarenessCursor=a??(()=>null),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc=null,this.ytext=null,this.commentThreads=null,this.wsBaseUrl=``,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.resolveInitialSync=null}normalizeViewport(e){if(!e||typeof e!=`object`)return null;let t=Number(e.topLine),n=Number(e.viewportRatio);return!Number.isFinite(t)||t<1?null:{topLine:Math.max(1,Math.round(t)),viewportRatio:Number.isFinite(n)?Math.min(Math.max(n,0),1):.35}}async initialize(e){this.wsBaseUrl=Ie(),this.ydoc=new Ue,this.ytext=this.ydoc.getText(`codemirror`),this.commentThreads=this.ydoc.getArray(`comments`);let t=new Ve(this.ytext),n=new He(this.wsBaseUrl,e,this.ydoc,{disableBc:!0,maxBackoffTime:5e3});Ge(n);let r=n.awareness,i=this.providedLocalUser??$e(this.preferredUserName);this.provider=n,this.awareness=r,this.localUser=i,this.initialSyncComplete=!1,this.initialSyncPromise=new Promise(e=>{this.resolveInitialSync=e}),r.setLocalStateField(`user`,i),r.on(`change`,()=>{this.onAwarenessChange?.(this.collectUsers(this.resolveAwarenessCursor))}),this.trackConnectionStatus();let a=!1;return n.on(`sync`,e=>{!e||a||(a=!0,this.initialSyncComplete=!0,this.resolveInitialSync?.(),this.resolveInitialSync=null,this.onInitialSync?.())}),{awareness:r,commentThreads:this.commentThreads,localUser:this.localUser,undoManager:t,ydoc:this.ydoc,ytext:this.ytext}}destroy(){this.resolveInitialSync?.(),this.resolveInitialSync=null,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc?.destroy(),this.ydoc=null,this.ytext=null,this.commentThreads=null}waitForInitialSync(e=1500){return this.initialSyncComplete?Promise.resolve():e==null||e===!1?this.initialSyncPromise:Promise.race([this.initialSyncPromise,new Promise(t=>{window.setTimeout(t,e)})])}getText(){return this.ytext?.toString()??``}getLocalUser(){return this.localUser}setUserName(e){let t=Xe(e);return!t||!this.awareness||!this.localUser?null:(this.localUser={...this.localUser,name:t},this.awareness.setLocalStateField(`user`,this.localUser),t)}getUserCursor(e,t){return this.awareness?t(this.awareness.getStates().get(e)?.cursor):null}getUserViewport(e){if(!this.awareness)return null;let t=this.awareness.getStates().get(e);return this.normalizeViewport(t?.viewport)}setLocalViewport(e){if(!this.awareness)return null;let t=this.normalizeViewport(e);return this.awareness.setLocalStateField(`viewport`,t),t}collectUsers(e=()=>null){if(!this.awareness)return[];let t=[];return this.awareness.getStates().forEach((n,r)=>{if(!n.user)return;let i=e(n.cursor);t.push({...i??{},...n.user,clientId:r,hasCursor:!!i,isLocal:r===this.awareness.clientID,viewport:this.normalizeViewport(n.viewport)})}),t}trackConnectionStatus(){if(!this.provider)return;let e=0,t=!1;this.provider.on(`status`,({status:n})=>{n===`connecting`&&(e+=1);let r=n===`connected`&&!t;n===`connected`&&(e=0,t=!0),this.onConnectionChange?.({attempts:e,firstConnection:r,hasEverConnected:t,status:n,unreachable:!t&&e>=3,wsBaseUrl:this.wsBaseUrl})})}};function M(e){return new le(ne.define(e))}function N(t){return e(()=>import(`./dist-BE8C_ouo.js`).then(e=>e.sql({dialect:e[t]})),__vite__mapDeps([0,1,2,3]),import.meta.url)}var st=[v.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return N(`Cassandra`)}}),v.of({name:`CSS`,extensions:[`css`],load(){return e(()=>import(`./dist-CcG3Y7Wp.js`).then(e=>e.css()),__vite__mapDeps([5,6,2,3]),import.meta.url)}}),v.of({name:`Go`,extensions:[`go`],load(){return e(()=>import(`./dist-v3i1ifes.js`).then(e=>e.go()),__vite__mapDeps([7,1,2,3]),import.meta.url)}}),v.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return e(()=>import(`./dist-DLyohOXi.js`).then(e=>e.html()),__vite__mapDeps([8,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Java`,extensions:[`java`],load(){return e(()=>import(`./dist-DQiph4qx.js`).then(e=>e.java()),__vite__mapDeps([11,2,3]),import.meta.url)}}),v.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript()),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return e(()=>import(`./dist-DdAqzGFU.js`).then(e=>e.jinja()),__vite__mapDeps([13,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return e(()=>import(`./dist-DZ2t5lUX.js`).then(e=>e.json()),__vite__mapDeps([14,2,3]),import.meta.url)}}),v.of({name:`JSX`,extensions:[`jsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`LESS`,extensions:[`less`],load(){return e(()=>import(`./dist-DPCUH5MO.js`).then(e=>e.less()),__vite__mapDeps([15,6,2,3]),import.meta.url)}}),v.of({name:`Liquid`,extensions:[`liquid`],load(){return e(()=>import(`./dist-DWRyOl2w.js`).then(e=>e.liquid()),__vite__mapDeps([16,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`MariaDB SQL`,load(){return N(`MariaSQL`)}}),v.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return e(()=>import(`./dist-CghBwrO3.js`).then(e=>e.markdown()),__vite__mapDeps([17,18,1,2,9,6,3,10]),import.meta.url)}}),v.of({name:`MS SQL`,load(){return N(`MSSQL`)}}),v.of({name:`MySQL`,load(){return N(`MySQL`)}}),v.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return e(()=>import(`./dist-BPEi1dEF.js`).then(e=>e.php()),__vite__mapDeps([19,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`PLSQL`,extensions:[`pls`],load(){return N(`PLSQL`)}}),v.of({name:`PostgreSQL`,load(){return N(`PostgreSQL`)}}),v.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return e(()=>import(`./dist-BiCgLddE.js`).then(e=>e.python()),__vite__mapDeps([20,1,2,3]),import.meta.url)}}),v.of({name:`Rust`,extensions:[`rs`],load(){return e(()=>import(`./dist-aE0_04fl.js`).then(e=>e.rust()),__vite__mapDeps([21,2,3]),import.meta.url)}}),v.of({name:`Sass`,extensions:[`sass`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SCSS`,extensions:[`scss`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass()),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SQL`,extensions:[`sql`],load(){return N(`StandardSQL`)}}),v.of({name:`SQLite`,load(){return N(`SQLite`)}}),v.of({name:`TSX`,extensions:[`tsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return e(()=>import(`./dist-BEKQo64E.js`).then(e=>e.wast()),__vite__mapDeps([23,2,3]),import.meta.url)}}),v.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return e(()=>import(`./dist-Dbg8P4C5.js`).then(e=>e.xml()),__vite__mapDeps([24,2,3]),import.meta.url)}}),v.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return e(()=>import(`./dist-BfVljg0L2.js`).then(e=>e.yaml()),__vite__mapDeps([25,26,2,3]),import.meta.url)}}),v.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return e(()=>import(`./apl-C1JYSI8J.js`).then(e=>M(e.apl)),[],import.meta.url)}}),v.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return e(()=>import(`./asciiarmor-DHW75j1s.js`).then(e=>M(e.asciiArmor)),[],import.meta.url)}}),v.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return e(()=>import(`./asn1-CQiG40kG.js`).then(e=>M(e.asn1({}))),[],import.meta.url)}}),v.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return e(()=>import(`./asterisk-BWExh0n4.js`).then(e=>M(e.asterisk)),[],import.meta.url)}}),v.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return e(()=>import(`./brainfuck-CTNFyOLg.js`).then(e=>M(e.brainfuck)),[],import.meta.url)}}),v.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return e(()=>import(`./cobol-DP4QggbL.js`).then(e=>M(e.cobol)),[],import.meta.url)}}),v.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.csharp)),[],import.meta.url)}}),v.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`ClojureScript`,extensions:[`cljs`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return e(()=>import(`./css-CmhPNxBE.js`).then(e=>M(e.gss)),[],import.meta.url)}}),v.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return e(()=>import(`./cmake-DtGL-Unu.js`).then(e=>M(e.cmake)),[],import.meta.url)}}),v.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return e(()=>import(`./coffeescript-B7GZajzV.js`).then(e=>M(e.coffeeScript)),[],import.meta.url)}}),v.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return e(()=>import(`./commonlisp-COlJYiQT.js`).then(e=>M(e.commonLisp)),[],import.meta.url)}}),v.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return e(()=>import(`./cypher-DEGl2llJ.js`).then(e=>M(e.cypher)),[],import.meta.url)}}),v.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return e(()=>import(`./python-BUyhM0Ew.js`).then(e=>M(e.cython)),[],import.meta.url)}}),v.of({name:`Crystal`,extensions:[`cr`],load(){return e(()=>import(`./crystal-I_dE9xG-.js`).then(e=>M(e.crystal)),[],import.meta.url)}}),v.of({name:`D`,extensions:[`d`],load(){return e(()=>import(`./d-BspB0dox.js`).then(e=>M(e.d)),[],import.meta.url)}}),v.of({name:`Dart`,extensions:[`dart`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.dart)),[],import.meta.url)}}),v.of({name:`diff`,extensions:[`diff`,`patch`],load(){return e(()=>import(`./diff-BWuPUsEo.js`).then(e=>M(e.diff)),[],import.meta.url)}}),v.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return e(()=>import(`./dockerfile-D8_6_FRV.js`).then(e=>M(e.dockerFile)),__vite__mapDeps([27,28]),import.meta.url)}}),v.of({name:`DTD`,extensions:[`dtd`],load(){return e(()=>import(`./dtd-C6brJFPg.js`).then(e=>M(e.dtd)),[],import.meta.url)}}),v.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return e(()=>import(`./dylan-Bft86ZSB.js`).then(e=>M(e.dylan)),[],import.meta.url)}}),v.of({name:`EBNF`,load(){return e(()=>import(`./ebnf-D6ifG44A.js`).then(e=>M(e.ebnf)),[],import.meta.url)}}),v.of({name:`ECL`,extensions:[`ecl`],load(){return e(()=>import(`./ecl-D9rhJ9-u.js`).then(e=>M(e.ecl)),[],import.meta.url)}}),v.of({name:`edn`,extensions:[`edn`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Eiffel`,extensions:[`e`],load(){return e(()=>import(`./eiffel-DwxtewZF.js`).then(e=>M(e.eiffel)),[],import.meta.url)}}),v.of({name:`Elm`,extensions:[`elm`],load(){return e(()=>import(`./elm-B1TncobV.js`).then(e=>M(e.elm)),[],import.meta.url)}}),v.of({name:`Erlang`,extensions:[`erl`],load(){return e(()=>import(`./erlang-BDJZNtt8.js`).then(e=>M(e.erlang)),[],import.meta.url)}}),v.of({name:`Esper`,load(){return e(()=>import(`./sql-GL7dVWcd.js`).then(e=>M(e.esper)),[],import.meta.url)}}),v.of({name:`Factor`,extensions:[`factor`],load(){return e(()=>import(`./factor-Cz-hzBGH.js`).then(e=>M(e.factor)),__vite__mapDeps([29,28]),import.meta.url)}}),v.of({name:`FCL`,load(){return e(()=>import(`./fcl-CUXJFJn1.js`).then(e=>M(e.fcl)),[],import.meta.url)}}),v.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return e(()=>import(`./forth-nvhcMz63.js`).then(e=>M(e.forth)),[],import.meta.url)}}),v.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return e(()=>import(`./fortran-BZID-z10.js`).then(e=>M(e.fortran)),[],import.meta.url)}}),v.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.fSharp)),[],import.meta.url)}}),v.of({name:`Gas`,extensions:[`s`],load(){return e(()=>import(`./gas-DjQsZDGE.js`).then(e=>M(e.gas)),[],import.meta.url)}}),v.of({name:`Gherkin`,extensions:[`feature`],load(){return e(()=>import(`./gherkin-S0kHlzux.js`).then(e=>M(e.gherkin)),[],import.meta.url)}}),v.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return e(()=>import(`./groovy-Di--Vb9Z.js`).then(e=>M(e.groovy)),[],import.meta.url)}}),v.of({name:`Haskell`,extensions:[`hs`],load(){return e(()=>import(`./haskell-C6qH3-aI.js`).then(e=>M(e.haskell)),[],import.meta.url)}}),v.of({name:`Haxe`,extensions:[`hx`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.haxe)),[],import.meta.url)}}),v.of({name:`HXML`,extensions:[`hxml`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.hxml)),[],import.meta.url)}}),v.of({name:`HTTP`,load(){return e(()=>import(`./http-DG1Y9fpK.js`).then(e=>M(e.http)),[],import.meta.url)}}),v.of({name:`IDL`,extensions:[`pro`],load(){return e(()=>import(`./idl-B64p3NTJ.js`).then(e=>M(e.idl)),[],import.meta.url)}}),v.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return e(()=>import(`./javascript-qUBHINSy.js`).then(e=>M(e.jsonld)),__vite__mapDeps([30,31]),import.meta.url)}}),v.of({name:`Julia`,extensions:[`jl`],load(){return e(()=>import(`./julia-B22G9Bym.js`).then(e=>M(e.julia)),[],import.meta.url)}}),v.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.kotlin)),[],import.meta.url)}}),v.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return e(()=>import(`./livescript-CkcuHqeS.js`).then(e=>M(e.liveScript)),[],import.meta.url)}}),v.of({name:`Lua`,extensions:[`lua`],load(){return e(()=>import(`./lua-Cg0FqIlO.js`).then(e=>M(e.lua)),[],import.meta.url)}}),v.of({name:`mIRC`,extensions:[`mrc`],load(){return e(()=>import(`./mirc-BVG2S5rO.js`).then(e=>M(e.mirc)),[],import.meta.url)}}),v.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return e(()=>import(`./mathematica-CKVhKnoY.js`).then(e=>M(e.mathematica)),[],import.meta.url)}}),v.of({name:`Modelica`,extensions:[`mo`],load(){return e(()=>import(`./modelica-vJ-Qa9jV.js`).then(e=>M(e.modelica)),[],import.meta.url)}}),v.of({name:`MUMPS`,extensions:[`mps`],load(){return e(()=>import(`./mumps-D0KfUTSd.js`).then(e=>M(e.mumps)),[],import.meta.url)}}),v.of({name:`Mbox`,extensions:[`mbox`],load(){return e(()=>import(`./mbox-DANyzFJ2.js`).then(e=>M(e.mbox)),[],import.meta.url)}}),v.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return e(()=>import(`./nginx-DkVceJrH.js`).then(e=>M(e.nginx)),[],import.meta.url)}}),v.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return e(()=>import(`./nsis-QPGhLAeY.js`).then(e=>M(e.nsis)),__vite__mapDeps([32,28]),import.meta.url)}}),v.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return e(()=>import(`./ntriples-BBuCIfS0.js`).then(e=>M(e.ntriples)),[],import.meta.url)}}),v.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveC)),[],import.meta.url)}}),v.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveCpp)),[],import.meta.url)}}),v.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.oCaml)),[],import.meta.url)}}),v.of({name:`Octave`,extensions:[`m`],load(){return e(()=>import(`./octave-BTv2CqSQ.js`).then(e=>M(e.octave)),[],import.meta.url)}}),v.of({name:`Oz`,extensions:[`oz`],load(){return e(()=>import(`./oz-D8SjVDNU.js`).then(e=>M(e.oz)),[],import.meta.url)}}),v.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return e(()=>import(`./pascal-T-tfhVyx.js`).then(e=>M(e.pascal)),[],import.meta.url)}}),v.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return e(()=>import(`./perl-BDrCkHRd.js`).then(e=>M(e.perl)),[],import.meta.url)}}),v.of({name:`Pig`,extensions:[`pig`],load(){return e(()=>import(`./pig-BEyI4fPq.js`).then(e=>M(e.pig)),[],import.meta.url)}}),v.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return e(()=>import(`./powershell-DtnFc6GG.js`).then(e=>M(e.powerShell)),[],import.meta.url)}}),v.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return e(()=>import(`./properties-DWUvbxV9.js`).then(e=>M(e.properties)),[],import.meta.url)}}),v.of({name:`ProtoBuf`,extensions:[`proto`],load(){return e(()=>import(`./protobuf-CQGoYyfE.js`).then(e=>M(e.protobuf)),[],import.meta.url)}}),v.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return e(()=>import(`./pug-lkTEco3G.js`).then(e=>M(e.pug)),__vite__mapDeps([33,31]),import.meta.url)}}),v.of({name:`Puppet`,extensions:[`pp`],load(){return e(()=>import(`./puppet-Dd-qWO3p.js`).then(e=>M(e.puppet)),[],import.meta.url)}}),v.of({name:`Q`,extensions:[`q`],load(){return e(()=>import(`./q-Dls1OX0D.js`).then(e=>M(e.q)),[],import.meta.url)}}),v.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return e(()=>import(`./r-DeZ8Mdev.js`).then(e=>M(e.r)),[],import.meta.url)}}),v.of({name:`RPM Changes`,load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmChanges)),[],import.meta.url)}}),v.of({name:`RPM Spec`,extensions:[`spec`],load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmSpec)),[],import.meta.url)}}),v.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return e(()=>import(`./ruby-CB34f2Gf.js`).then(e=>M(e.ruby)),[],import.meta.url)}}),v.of({name:`SAS`,extensions:[`sas`],load(){return e(()=>import(`./sas-Bji4HDQq.js`).then(e=>M(e.sas)),[],import.meta.url)}}),v.of({name:`Scala`,extensions:[`scala`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.scala)),[],import.meta.url)}}),v.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return e(()=>import(`./scheme-C3elI80V.js`).then(e=>M(e.scheme)),[],import.meta.url)}}),v.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return e(()=>import(`./shell-DUveK2Hb.js`).then(e=>M(e.shell)),[],import.meta.url)}}),v.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return e(()=>import(`./sieve-2ogwMVx4.js`).then(e=>M(e.sieve)),[],import.meta.url)}}),v.of({name:`Smalltalk`,extensions:[`st`],load(){return e(()=>import(`./smalltalk-BuGhc6lW.js`).then(e=>M(e.smalltalk)),[],import.meta.url)}}),v.of({name:`Solr`,load(){return e(()=>import(`./solr-DTxshpm8.js`).then(e=>M(e.solr)),[],import.meta.url)}}),v.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.sml)),[],import.meta.url)}}),v.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return e(()=>import(`./sparql-vm8qNO8J.js`).then(e=>M(e.sparql)),[],import.meta.url)}}),v.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return e(()=>import(`./spreadsheet-C6Vbtl9-.js`).then(e=>M(e.spreadsheet)),[],import.meta.url)}}),v.of({name:`Squirrel`,extensions:[`nut`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.squirrel)),[],import.meta.url)}}),v.of({name:`Stylus`,extensions:[`styl`],load(){return e(()=>import(`./stylus-D1SZIMDs.js`).then(e=>M(e.stylus)),[],import.meta.url)}}),v.of({name:`Swift`,extensions:[`swift`],load(){return e(()=>import(`./swift-CKcKnWv9.js`).then(e=>M(e.swift)),[],import.meta.url)}}),v.of({name:`sTeX`,load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`Tcl`,extensions:[`tcl`],load(){return e(()=>import(`./tcl-SPk7uiDB.js`).then(e=>M(e.tcl)),[],import.meta.url)}}),v.of({name:`Textile`,extensions:[`textile`],load(){return e(()=>import(`./textile-C48beRus.js`).then(e=>M(e.textile)),[],import.meta.url)}}),v.of({name:`TiddlyWiki`,load(){return e(()=>import(`./tiddlywiki-CiImjFLN.js`).then(e=>M(e.tiddlyWiki)),[],import.meta.url)}}),v.of({name:`Tiki wiki`,load(){return e(()=>import(`./tiki-HkXZ4BIW.js`).then(e=>M(e.tiki)),[],import.meta.url)}}),v.of({name:`TOML`,extensions:[`toml`],load(){return e(()=>import(`./toml-BmfpMy1_.js`).then(e=>M(e.toml)),[],import.meta.url)}}),v.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return e(()=>import(`./troff-BjbEOT5E.js`).then(e=>M(e.troff)),[],import.meta.url)}}),v.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return e(()=>import(`./ttcn-NA-V4KnY.js`).then(e=>M(e.ttcn)),[],import.meta.url)}}),v.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return e(()=>import(`./ttcn-cfg-TPHncdGN.js`).then(e=>M(e.ttcnCfg)),[],import.meta.url)}}),v.of({name:`Turtle`,extensions:[`ttl`],load(){return e(()=>import(`./turtle-BkP3ExOG.js`).then(e=>M(e.turtle)),[],import.meta.url)}}),v.of({name:`Web IDL`,extensions:[`webidl`],load(){return e(()=>import(`./webidl-DttrYZRT.js`).then(e=>M(e.webIDL)),[],import.meta.url)}}),v.of({name:`VB.NET`,extensions:[`vb`],load(){return e(()=>import(`./vb-C19AQWqO.js`).then(e=>M(e.vb)),[],import.meta.url)}}),v.of({name:`VBScript`,extensions:[`vbs`],load(){return e(()=>import(`./vbscript-CHJk3s95.js`).then(e=>M(e.vbScript)),[],import.meta.url)}}),v.of({name:`Velocity`,extensions:[`vtl`],load(){return e(()=>import(`./velocity-Ya0P4sQU.js`).then(e=>M(e.velocity)),[],import.meta.url)}}),v.of({name:`Verilog`,extensions:[`v`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return e(()=>import(`./vhdl-CnYyYTpa.js`).then(e=>M(e.vhdl)),[],import.meta.url)}}),v.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return e(()=>import(`./xquery-CEDTd8qs.js`).then(e=>M(e.xQuery)),[],import.meta.url)}}),v.of({name:`Yacas`,extensions:[`ys`],load(){return e(()=>import(`./yacas-C7dxlPB0.js`).then(e=>M(e.yacas)),[],import.meta.url)}}),v.of({name:`Z80`,extensions:[`z80`],load(){return e(()=>import(`./z80-BqEfFSnA.js`).then(e=>M(e.z80)),[],import.meta.url)}}),v.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.mscgen)),[],import.meta.url)}}),v.of({name:`Xù`,extensions:[`xu`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.xu)),[],import.meta.url)}}),v.of({name:`MsGenny`,extensions:[`msgenny`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.msgenny)),[],import.meta.url)}}),v.of({name:`Vue`,extensions:[`vue`],load(){return e(()=>import(`./dist-B98fHn5m.js`).then(e=>e.vue()),__vite__mapDeps([34,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Angular Template`,load(){return e(()=>import(`./dist-BOP-dC-R.js`).then(e=>e.angular()),__vite__mapDeps([35,9,6,2,3,10,1]),import.meta.url)}})],ct=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,P=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ct(e)):ct,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=m(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(P.prototype[Symbol.iterator]=function(){return this});var lt={from:-1,to:-1,match:/.*/.exec(``),precise:!0},ut=`gm`+(/x/.unicode==null?``:`u`),dt=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=lt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new mt(e,t,n,r,i);this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=F(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=F(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},ft=new WeakMap,pt=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=ft.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return ft.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),ft.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},mt=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=lt,this.matchPos=F(e,r),this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=pt.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=F(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(dt.prototype[Symbol.iterator]=mt.prototype[Symbol.iterator]=function(){return this});function ht(e){try{return new RegExp(e,ut),!0}catch{return!1}}function F(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var gt=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=t(e,{label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,u]=r,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&u){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),f=Math.round(n.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,f))),m=y.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[i,l.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},_t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vt=w.define({combine(e){return p(e,_t,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[Tt,wt];return e&&t.push(vt.of(e)),t}var bt=i.mark({class:`cm-selectionMatch`}),xt=i.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function St(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=C.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=C.Word)}function Ct(e,t,n,r){return e(t.sliceDoc(n,n+1))==C.Word&&e(t.sliceDoc(r-1,r))==C.Word}var wt=f.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(vt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return i.none;let a=r.main,o,s=null;if(a.empty){if(!t.highlightWordAroundCursor)return i.none;let e=n.wordAt(a.head);if(!e)return i.none;s=n.charCategorizer(a.head),o=n.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<t.minSelectionLength||e>200)return i.none;if(t.wholeWords){if(o=n.sliceDoc(a.from,a.to),s=n.charCategorizer(a.head),!(St(s,n,a.from,a.to)&&Ct(s,n,a.from,a.to)))return i.none}else if(o=n.sliceDoc(a.from,a.to),!o)return i.none}let c=[];for(let r of e.visibleRanges){let e=new P(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||St(s,n,r,o))&&(a.empty&&r<=a.from&&o>=a.to?c.push(xt.range(r,o)):(r>=a.to||o<=a.from)&&c.push(bt.range(r,o)),c.length>t.maxMatches))return i.none}}return i.set(c)}},{decorations:e=>e.decorations}),Tt=l.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Et=({state:e,dispatch:t})=>{let{selection:n}=e,r=y.create(n.ranges.map(t=>e.wordAt(t.head)||y.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Dt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new P(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new P(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Ot=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Et({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Dt(e,r);return i?(t(e.update({selection:e.selection.addRange(y.range(i.from,i.to),!1),effects:l.scrollIntoView(i.to)})),!0):!1},I=w.define({combine(e){return p(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new $t(e),scrollToMatch:e=>l.scrollIntoView(e)})}}),kt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ht(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
3
3
|
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new It(this):new Nt(this)}getCursor(e,t=0,n){let r=e.doc?e:x.create({doc:e});return n??=r.doc.length,this.regexp?R(this,r,t,n):L(this,r,t,n)}},At=class{constructor(e){this.spec=e}};function jt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function L(e,t,n,r){let i;return e.wholeWord&&(i=Mt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=jt(e.test,t,i)),new P(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Mt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(z(i,n-a))!=C.Word||t(B(i,n-a))!=C.Word)&&(t(B(i,r-a))!=C.Word||t(z(i,r-a))!=C.Word))}var Nt=class extends At{constructor(e){super(e)}nextMatch(e,t,n){let r=L(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=L(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=L(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=L(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=L(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Pt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function R(e,t,n,r){let i;return e.wholeWord&&(i=Ft(t.charCategorizer(t.selection.main.head))),e.test&&(i=Pt(e.test,t,i)),new dt(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function z(e,t){return e.slice(_e(e,t,!1),t)}function B(e,t){return e.slice(t,_e(e,t))}function Ft(e){return(t,n,r)=>!r[0].length||(e(z(r.input,r.index))!=C.Word||e(B(r.input,r.index))!=C.Word)&&(e(B(r.input,r.index+r[0].length))!=C.Word||e(z(r.input,r.index+r[0].length))!=C.Word)}var It=class extends At{nextMatch(e,t,n){let r=R(this.spec,e,n,e.doc.length).next();return r.done&&(r=R(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=R(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=R(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=R(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},V=b.define(),Lt=b.define(),H=ee.define({create(e){return new Rt(qt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(V)?e=new Rt(n.value.create(),e.panel):n.is(Lt)&&(e=new Rt(e.query,n.value?Kt:null));return e},provide:e=>re.from(e,e=>e.panel)}),Rt=class{constructor(e,t){this.query=e,this.panel=t}},zt=i.mark({class:`cm-searchMatch`}),Bt=i.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Vt=f.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(H))}update(e){let t=e.state.field(H);(t!=e.startState.field(H)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return i.none;let{view:n}=this,r=new ce;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Bt:zt)})}return r.finish()}},{decorations:e=>e.decorations});function U(e){return t=>{let n=t.state.field(H,!1);return n&&n.query.spec.valid?e(t,n):Xt(t)}}var W=U((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=y.single(r.from,r.to),a=e.state.facet(I);return e.dispatch({selection:i,effects:[en(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Yt(e),!0}),G=U((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=y.single(i.from,i.to),o=e.state.facet(I);return e.dispatch({selection:a,effects:[en(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Yt(e),!0}),Ht=U((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:y.create(n.map(e=>y.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Ut=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new P(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(y.range(t.value.from,t.value.to))}return t(e.update({selection:y.create(a,o),userEvent:`select.search.matches`})),!0},Wt=U((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,u,d=[];o.precise?o.from==r&&o.to==i&&(u=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),d.push(l.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(s);return o&&(c=y.single(o.from,o.to).map(f),d.push(en(e,o)),d.push(n.facet(I).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:`input.replace`}),!0}),Gt=U((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:l.announce.of(r),userEvent:`input.replace.all`}),!0});function Kt(e){return e.state.facet(I).createPanel(e)}function qt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(I);return new kt({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Jt(e){let t=o(e,Kt);return t&&t.dom.querySelector(`[main-field]`)}function Yt(e){let t=Jt(e);t&&t==e.root.activeElement&&t.select()}var Xt=e=>{let t=e.state.field(H,!1);if(t&&t.panel){let n=Jt(e);if(n&&n!=e.root.activeElement){let r=qt(e.state,t.query.spec);r.valid&&e.dispatch({effects:V.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Lt.of(!0),t?V.of(qt(e.state,t.query.spec)):b.appendConfig.of(nn)]});return!0},Zt=e=>{let t=e.state.field(H,!1);if(!t||!t.panel)return!1;let n=o(e,Kt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Lt.of(!1)}),!0},Qt=[{key:`Mod-f`,run:Xt,scope:`editor search-panel`},{key:`F3`,run:W,shift:G,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:W,shift:G,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Zt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Ut},{key:`Mod-Alt-g`,run:gt},{key:`Mod-d`,run:Ot,preventDefault:!0}],$t=class{constructor(e){this.view=e;let t=this.query=e.state.field(H).query.spec;this.commit=this.commit.bind(this),this.searchField=S(`input`,{value:t.search,placeholder:K(e,`Find`),"aria-label":K(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=S(`input`,{value:t.replace,placeholder:K(e,`Replace`),"aria-label":K(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=S(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=S(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=S(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return S(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=S(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>W(e),[K(e,`next`)]),n(`prev`,()=>G(e),[K(e,`previous`)]),n(`select`,()=>Ht(e),[K(e,`all`)]),S(`label`,null,[this.caseField,K(e,`match case`)]),S(`label`,null,[this.reField,K(e,`regexp`)]),S(`label`,null,[this.wordField,K(e,`by word`)]),...e.state.readOnly?[]:[S(`br`),this.replaceField,n(`replace`,()=>Wt(e),[K(e,`replace`)]),n(`replaceAll`,()=>Gt(e),[K(e,`replace all`)])],S(`button`,{name:`close`,onclick:()=>Zt(e),"aria-label":K(e,`close`),type:`button`},[`×`])])}commit(){let e=new kt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:V.of(e)}))}keydown(e){d(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?G:W)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(V)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}};function K(e,t){return e.state.phrase(t)}var q=30,J=/[\s\.,:;?!]/;function en(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-q),o=Math.min(i,n+q),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<q;e++)if(!J.test(s[e+1])&&J.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-q;e--)if(!J.test(s[e-1])&&J.test(s[e])){s=s.slice(0,e);break}}return l.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var tn=l.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),nn=[H,ae.low(Vt),tn],rn=`#e5c07b`,an=`#e06c75`,on=`#56b6c2`,sn=`#ffffff`,Y=`#abb2bf`,cn=`#7d8799`,ln=`#61afef`,un=`#98c379`,dn=`#d19a66`,fn=`#c678dd`,pn=`#21252b`,mn=`#2c313a`,hn=`#282c34`,gn=`#353a42`,_n=`#3E4451`,vn=`#528bff`,yn=[l.theme({"&":{color:Y,backgroundColor:hn},".cm-content":{caretColor:vn},".cm-cursor, .cm-dropCursor":{borderLeftColor:vn},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_n},".cm-panels":{backgroundColor:pn,color:Y},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:hn,color:cn,border:`none`},".cm-activeLineGutter":{backgroundColor:mn},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:gn},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gn,borderBottomColor:gn},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:mn,color:Y}}},{dark:!0}),n(me.define([{tag:u.keyword,color:fn},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:an},{tag:[u.function(u.variableName),u.labelName],color:ln},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:dn},{tag:[u.definition(u.name),u.separator],color:Y},{tag:[u.typeName,u.className,u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:rn},{tag:[u.operator,u.operatorKeyword,u.url,u.escape,u.regexp,u.link,u.special(u.string)],color:on},{tag:[u.meta,u.comment],color:cn},{tag:u.strong,fontWeight:`bold`},{tag:u.emphasis,fontStyle:`italic`},{tag:u.strikethrough,textDecoration:`line-through`},{tag:u.link,color:cn,textDecoration:`underline`},{tag:u.heading,fontWeight:`bold`,color:an},{tag:[u.atom,u.bool,u.special(u.variableName)],color:dn},{tag:[u.processingInstruction,u.string,u.inserted],color:un},{tag:u.invalid,color:sn}]))],bn=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:E(this.yanchor),yhead:E(this.yhead)}}static fromJSON(t){return new e(D(t.yanchor),D(t.yhead))}},xn=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new Ve(e)}toYPos(e,t=0){return j(this.ytext,e,t)}fromYPos(e){let t=T(D(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new bn(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?y.cursor(n.pos,n.assoc):y.range(t.pos,n.pos)}},X=w.define({combine(e){return e[e.length-1]}}),Sn=fe.define(),Cn=class{constructor(e){this.view=e,this.conf=e.state.facet(X),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[Sn.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(Sn)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
4
4
|
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},wn=f.fromClass(Cn),Tn=l.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),En=fe.define(),Dn=class extends ye{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return Re(`span`,[O(`class`,`cm-ySelectionCaret`),O(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[A(``),Re(`div`,[O(`class`,`cm-ySelectionCaretDot`)]),A(``),Re(`div`,[O(`class`,`cm-ySelectionInfo`)],[A(this.name)]),A(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},On=class{constructor(e){this.conf=e.state.facet(X),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[En.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=ue.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,a=[],o=this.conf.awareness.getLocalState();if(o!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,a=o.cursor==null?null:D(o.cursor.anchor),s=o.cursor==null?null:D(o.cursor.head);if(i!=null){let e=j(t,i.anchor),n=j(t,i.head);(o.cursor==null||!We(a,e)||!We(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else o.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((o,s)=>{if(s===r.doc.clientID)return;let c=o.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=T(c.anchor,n),u=T(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:d=`#30bced`,name:f=`Anonymous`}=o.user||{},p=o.user&&o.user.colorLight||d+`33`,m=ze(l.index,u.index),h=Be(l.index,u.index),g=e.view.state.doc.lineAt(m),_=e.view.state.doc.lineAt(h);if(g.number===_.number)a.push({from:m,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});else{a.push({from:m,to:g.from+g.length,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})}),a.push({from:_.from,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});for(let t=g.number+1;t<_.number;t++){let n=e.view.state.doc.line(t).from;a.push({from:n,to:n,value:i.line({attributes:{style:`background-color: ${p}`,class:`cm-yLineSelection`}})})}}a.push({from:u.index,to:u.index,value:i.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new Dn(d,f)})})}),this.decorations=i.set(a,!0)}},kn=f.fromClass(On,{decorations:e=>e.decorations}),An=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},jn=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},Mn=w.define({combine(e){return e[e.length-1]}});fe.define();var Nn=class{constructor(e){this.view=e,this.conf=e.state.facet(Mn),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(X),this._beforeChangeSelection=null,this._mux=An(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[l.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(Sn)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Pn=f.fromClass(Nn),Fn=({state:e,dispatch:t})=>e.facet(Mn).undo()||!0,In=({state:e,dispatch:t})=>e.facet(Mn).redo()||!0,Ln=(e,t,{undoManager:n=new Ve(e)}={})=>{let r=new xn(e,t),i=[X.of(r),wn];return t&&i.push(Tn,kn),n!==!1&&i.push(Mn.of(new jn(n)),Pn,l.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Fn(t):e.inputType===`historyRedo`?In(t):!1}})),i},Rn=Object.freeze({bold:`bold text`,code:`code`,italic:`emphasis`,strikethrough:`struck text`}),zn=`link text`,Bn=`https://`,Vn=`alt text`,Hn=`https://`,Un=`Video`,Wn=`https://`,Gn=`code`,Kn=Object.freeze([`Column 1`,`Column 2`]),qn=`Value`,Z=Object.freeze({heading:/^#{1,6}\s+/,quote:/^>\s+/,bulletList:/^[-*+]\s+/,numberedList:/^\d+\.\s+/,taskList:/^-\s\[(?: |x|X)\]\s+/});function Jn(e,t){return{from:Math.max(0,Math.min(e.from,e.to,t)),to:Math.max(0,Math.min(Math.max(e.from,e.to),t))}}function Yn(e,t){return t===0||e[t-1]===`
|
|
5
5
|
`}function Xn(e,t){if(t<=0)return 0;let n=e.lastIndexOf(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./chunk-YHkbxXgt.js";import{n}from"./jsx-runtime-1KUJVfx8.js";import{X as r,gi as i,k as a}from"./chunk-YKPWT25G-GISHuloq.js";/* empty css */import{n as o,r as s,t as c}from"./vault-api-client-
|
|
1
|
+
import{s as e,t}from"./chunk-YHkbxXgt.js";import{n}from"./jsx-runtime-1KUJVfx8.js";import{X as r,gi as i,k as a}from"./chunk-YKPWT25G-GISHuloq.js";/* empty css */import{n as o,r as s,t as c}from"./vault-api-client-BDKKvtOF.js";import{m as l}from"./runtime-config-BcUbZKho.js";import{n as u,o as d,r as f,t as p}from"./yjs-provider-reset-guard-DSPzcvAO.js";import{a as m,c as h,d as g,i as _,n as v,o as y,r as b,s as x,t as ee,u as te}from"./excalidraw-scene-MyNAJi2A.js";var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=re(),r=n(),i=g();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),ee=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case ne:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case ee:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
|
|
2
2
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
3
|
`+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
4
|
`),l=s.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./excalidraw-editor-
|
|
2
|
-
import{t as e}from"./runtime-config-loader-_D2KZKn-.js";import{t}from"./preload-helper-Bo9GmnuQ.js";await e(),await t(()=>import(`./excalidraw-editor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./excalidraw-editor-6pgH2kf5.js","./chunk-YHkbxXgt.js","./chunk-YKPWT25G-GISHuloq.js","./preload-helper-Bo9GmnuQ.js","./chunk-A66AFZZU-BFHL744F.js","./chunk-SRAX5OIU-yDw8XRsi.js","./excalidraw-scene-MyNAJi2A.js","./chunk-3PELD44J-DymL2rGq.js","./chunk-LOOWOR4L-C5BUwXgZ.js","./jsx-runtime-1KUJVfx8.js","./excalidraw-mermaid-stub-DzxtBcQW.js","./yjs-provider-reset-guard-DSPzcvAO.js","./runtime-config-BcUbZKho.js","./vault-api-client-BDKKvtOF.js","./vault-api-client-D7Ck0CvR.css","./excalidraw-editor-BZCE9ydu.css","./embedded-editor-base-CgEkjNYn.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-config-loader-_D2KZKn-.js";import{t}from"./preload-helper-Bo9GmnuQ.js";await e(),await t(()=>import(`./excalidraw-editor-6pgH2kf5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid-runtime-BGlnoUXY.js","./preload-helper-Bo9GmnuQ.js","./chunk-U2HBQHQK-BBXgsocS.js","./src-BuiVcSz-.js","./chunk-YHkbxXgt.js","./chunk-5PVQY5BW-ciE7eHID.js","./dist-wkd-N1L5.js","./chunk-ICPOFSXX-DqJi89rc.js","./_baseFor-BSErPbF2.js","./isEmpty-CpfhGGBo.js","./chunk-336JU56O-DvrrHsJT.js","./chunk-5FUZZQ4R-CxIIxXPy.js","./chunk-X2U36JSP-D3OEPG7k.js","./chunk-ZZ45TVLE-DGIhE_ST.js","./rough.esm-BU2knLt9.js","./chunk-ENJZ2VHE-BQj_1YA_.js","./line-BCItEgq3.js","./path-DIlZIGue.js","./array-B3agRrCs.js","./chunk-BSJP7CBP-D2KkrA_B.js","./chunk-426QAEUC-CEbmCgux.js","./chunk-XPW4576I-BUfyrOtN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Bo9GmnuQ.js";import{f as t}from"./file-kind-DmKq2MvD.js";import{t as n}from"./preview-render-compiler-IUtgIlOM.js";import{d as r,p as i}from"./runtime-config-BcUbZKho.js";import{a,l as o,o as s}from"./excalidraw-scene-MyNAJi2A.js";import{p as c}from"./preview-diagram-utils-Nqpp4FNV.js";var l=`collabmd-export-page`,u=`collabmd-export-host`,d=Object.freeze({htmlLabels:!1,flowchart:{defaultRenderer:`dagre-wrapper`,useMaxWidth:!0},class:{defaultRenderer:`dagre-wrapper`,useMaxWidth:!0},startOnLoad:!1,theme:`default`}),f=1e4,ee=10*1024*1024,p=1e4,te=1e4,m=1,h=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/svg+xml`]),g=new Set([`image/gif`,`image/webp`]),ne=new Map([[`image/gif`,`GIF`],[`image/webp`,`WebP`]]),_=null,v=0;function y(e=`asset`){return v+=1,`${e}-${v.toString(36)}`}function b(e,n=``){return String(n??``).trim()||t(String(e??``).split(`/`).filter(Boolean).pop()||`document`)||`document`}function x(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function re(e){let t=new TextEncoder().encode(String(e??``)),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode(...t.subarray(e,e+n));return`data:image/svg+xml;base64,${btoa(r)}`}function S(){return new Promise(e=>requestAnimationFrame(()=>e()))}function ie(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`load`,()=>t(String(r.result??``))),r.addEventListener(`error`,()=>n(r.error??Error(`Failed to read blob`))),r.readAsDataURL(e)})}function C(e){return new Promise((t,n)=>{let r=new Image;r.decoding=`async`,r.addEventListener(`load`,()=>t(r),{once:!0}),r.addEventListener(`error`,()=>n(Error(`Failed to load image: ${e}`)),{once:!0}),r.src=e})}function w(e){let t=Number.parseFloat(e.getAttribute(`width`)||``),n=Number.parseFloat(e.getAttribute(`height`)||``),r=(e.getAttribute(`viewBox`)||``).split(/\s+/).map(e=>Number.parseFloat(e)),i=Number.isFinite(t)&&t>0?t:Number.isFinite(r[2])&&r[2]>0?r[2]:1200;return{height:Number.isFinite(n)&&n>0?n:Number.isFinite(r[3])&&r[3]>0?r[3]:800,width:i}}function ae(e,{padding:t=16}={}){let n=document.createElement(`div`);n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0`,n.style.visibility=`hidden`,n.style.pointerEvents=`none`,n.innerHTML=e,document.body.appendChild(n);try{let r=n.querySelector(`svg`);if(!(r instanceof SVGSVGElement))return e;let i=null;try{i=r.getBBox()}catch{return e}if(!i||i.width<=0||i.height<=0)return e;let a=Math.max(0,Number(t)||0),o=[Math.floor(i.x-a),Math.floor(i.y-a),Math.ceil(i.width+a*2),Math.ceil(i.height+a*2)],s=Math.ceil(i.width+a*2),c=Math.ceil(i.height+a*2);return r.setAttribute(`viewBox`,o.join(` `)),r.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),r.setAttribute(`width`,String(s)),r.setAttribute(`height`,String(c)),r.outerHTML}finally{n.remove()}}function T(e,t={}){return ae(c(e),t)}async function E(e){let t=URL.createObjectURL(new Blob([e],{type:`image/svg+xml;charset=utf-8`})),n=document.createElement(`div`);n.innerHTML=e;let r=n.querySelector(`svg`);try{let n;try{n=await C(t)}catch{n=await C(re(e))}let{width:i,height:a}=r?w(r):{height:n.naturalHeight||800,width:n.naturalWidth||1200},o=document.createElement(`canvas`);o.width=Math.max(1,Math.ceil(i)),o.height=Math.max(1,Math.ceil(a));let s=o.getContext(`2d`);if(!s)throw Error(`Canvas is unavailable`);return s.fillStyle=`#ffffff`,s.fillRect(0,0,o.width,o.height),s.drawImage(n,0,0,o.width,o.height),o.toDataURL(`image/png`)}finally{URL.revokeObjectURL(t)}}async function D(e){let t=await C(e),n=document.createElement(`canvas`);n.width=Math.max(1,t.naturalWidth||t.width||1),n.height=Math.max(1,t.naturalHeight||t.height||1);let r=n.getContext(`2d`);if(!r)throw Error(`Canvas is unavailable`);return r.drawImage(t,0,0,n.width,n.height),n.toDataURL(`image/png`)}function O(e=``){return String(e??``).match(/^data:([^;,]+)/iu)?.[1]?.toLowerCase()||``}async function k(e,{warnings:t=[]}={}){let n=O(e);if(h.has(n)||!g.has(n))return e;let r=ne.get(n)||n;try{return await D(e)}catch(n){let i=n instanceof Error?n.message:`Failed to convert ${r} image for DOCX`;return t.push(`Failed to convert ${r} image for DOCX: ${i}`),e}}async function oe(e,{timeoutMs:t=p}={}){e instanceof HTMLImageElement&&e.getAttribute(`src`)&&(e.complete||await new Promise(n=>{let r=!1,i=()=>{r||(r=!0,window.clearTimeout(o),e.removeEventListener(`load`,a),e.removeEventListener(`error`,a))},a=()=>{i(),n()},o=window.setTimeout(a,t);e.addEventListener(`load`,a,{once:!0}),e.addEventListener(`error`,a,{once:!0}),e.complete&&a()}),typeof e.decode==`function`&&await e.decode().catch(()=>{}))}async function A(e,t={}){let n=await fetch(e,{headers:{Accept:`application/json`,...t.headers??{}},...t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Request failed: ${n.status}`);return r}async function j(e){let t=await A(r(`/file?path=${encodeURIComponent(e)}`));if(typeof t?.content!=`string`)throw Error(`Failed to load ${e}`);return t.content}async function M(e,{maxBytes:t=ee,timeoutMs:n=f}={}){let r=new URL(e,window.location.href),i=new AbortController,a=window.setTimeout(()=>i.abort(),n),o;try{o=await fetch(r.toString(),{credentials:r.origin===window.location.origin?`same-origin`:`omit`,signal:i.signal})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`Timed out while fetching asset: ${r.toString()}`,{cause:e}):e}finally{window.clearTimeout(a)}if(!o.ok)throw Error(`Failed to fetch asset: ${r.toString()}`);let s=Number.parseInt(o.headers.get(`content-length`)||``,10);if(Number.isFinite(s)&&s>t)throw Error(`Asset is too large to inline: ${r.toString()}`);let c=await o.blob();if(c.size>t)throw Error(`Asset is too large to inline: ${r.toString()}`);return ie(c)}function se(e){let t=new URL(i(`/`),window.location.origin);return t.hash=new URLSearchParams({file:e}).toString(),t.toString()}function N(e=``){let t;try{t=new URL(String(e||``).trim())}catch{return``}let n=t.hostname.toLowerCase();if(n===`youtu.be`||n===`www.youtu.be`)return t.pathname.split(`/`).filter(Boolean)[0]||``;if(n.includes(`youtube`)||n.includes(`youtube-nocookie`)){if(t.pathname===`/watch`)return t.searchParams.get(`v`)||``;if(t.pathname.startsWith(`/embed/`))return t.pathname.split(`/`).filter(Boolean)[1]||``}return``}function P(e,{assetId:t=``,docxPosterDataUrl:n=``,posterDataUrl:r=``}={}){let i=document.createElement(`figure`);i.className=`export-video-poster`,t&&i.setAttribute(`data-export-asset-id`,t);let a=document.createElement(`div`);if(a.className=`export-video-poster-card`,r){let t=document.createElement(`div`);t.className=`export-video-poster-media`;let i=document.createElement(`img`);i.alt=`${e.dataset.videoEmbedLabel||`Embedded video`} poster`,i.className=`export-video-poster-image`,i.src=r,i.setAttribute(`data-export-docx-src`,n||r),t.appendChild(i);let o=document.createElement(`span`);o.className=`export-video-play-badge`,o.setAttribute(`aria-hidden`,`true`),o.textContent=`Play`,t.appendChild(o),a.appendChild(t)}let o=document.createElement(`div`);o.className=`export-video-poster-copy`;let s=document.createElement(`strong`);s.textContent=e.dataset.videoEmbedLabel||`Embedded video`;let c=document.createElement(`span`);c.className=`export-video-poster-meta`,c.textContent=e.dataset.videoEmbedKind===`youtube`?`YouTube video`:`Video link`,o.append(s,c),a.appendChild(o);let l=document.createElement(`a`);return l.className=`export-video-link`,l.href=e.dataset.videoEmbedOriginalUrl||e.dataset.videoEmbedSource||e.dataset.videoEmbedUrl||`#`,l.target=`_blank`,l.rel=`noopener noreferrer`,l.textContent=l.href,i.append(a,l),i}async function F(e){let t=document.createElement(`video`);return t.muted=!0,t.playsInline=!0,t.preload=`metadata`,t.crossOrigin=`anonymous`,t.style.position=`fixed`,t.style.left=`-10000px`,t.style.top=`0`,t.style.width=`1px`,t.style.height=`1px`,new Promise((n,r)=>{let i=!1,a=e=>{i||(i=!0,window.clearTimeout(d),t.pause?.(),t.removeEventListener(`error`,c),t.removeEventListener(`loadeddata`,u),t.removeEventListener(`seeked`,l),t.remove(),e())},o=e=>{a(()=>r(Error(e)))},s=()=>{if(t.videoWidth<=0||t.videoHeight<=0){o(`Video poster capture returned no frame: ${e}`);return}try{let e=document.createElement(`canvas`);e.width=t.videoWidth,e.height=t.videoHeight;let r=e.getContext(`2d`);if(!r){o(`Canvas is unavailable`);return}r.drawImage(t,0,0,e.width,e.height);let i=e.toDataURL(`image/png`);a(()=>n(i))}catch(t){o(t instanceof Error?t.message:`Failed to capture video poster: ${e}`)}},c=()=>{o(`Failed to load video poster: ${e}`)},l=()=>{s()},u=()=>{let e=Number.isFinite(t.duration)?t.duration:0,n=e>0?Math.min(m,Math.max(e*.1,0)):0;if(n>.05)try{t.currentTime=n;return}catch{}s()},d=window.setTimeout(()=>{o(`Timed out while loading video poster: ${e}`)},te);t.addEventListener(`error`,c,{once:!0}),t.addEventListener(`loadeddata`,u,{once:!0}),t.addEventListener(`seeked`,l,{once:!0}),document.body.appendChild(t),t.src=e,t.load()})}async function I(e){let t=e.dataset.videoEmbedOriginalUrl||e.dataset.videoEmbedSource||``,n=e.dataset.videoEmbedUrl||``;if((e.dataset.videoEmbedKind||``)===`youtube`){let e=N(t)||N(n);if(!e)throw Error(`Failed to resolve YouTube video id for export`);let r=[`https://i.ytimg.com/vi_webp/${e}/maxresdefault.webp`,`https://i.ytimg.com/vi_webp/${e}/hqdefault.webp`,`https://i.ytimg.com/vi/${e}/maxresdefault.jpg`,`https://i.ytimg.com/vi/${e}/hqdefault.jpg`],i=null;for(let e of r)try{return await M(e,{maxBytes:3*1024*1024,timeoutMs:f})}catch(e){i=e}throw i instanceof Error?i:Error(`Failed to fetch YouTube thumbnail`)}if(!t)throw Error(`Missing video source for export poster`);return F(t)}async function L(e,t){let n=await I(t),r=await D(n).catch(()=>n),i=K(e,{dataUrl:n,id:y(`video-poster`),kind:`video-poster`,mimeType:n.startsWith(`data:image/webp`)?`image/webp`:`image/png`,variants:{docx:r}});t.replaceWith(P(t,{assetId:i,docxPosterDataUrl:r,posterDataUrl:n}))}function R({alt:e=``,message:t=``,src:n=``}={}){let r=document.createElement(`span`);if(r.className=`export-warning export-image-fallback`,r.textContent=t||`Image export failed`,!n)return r;r.append(` `);let i=document.createElement(`a`);return i.href=n,i.rel=`noopener noreferrer`,i.target=`_blank`,i.textContent=e||n,r.append(i),r}function z({alt:e,assetId:t,className:n,dataUrl:r,docxDataUrl:i,svgMarkup:a=``}){let o=document.createElement(`figure`);if(o.className=`export-diagram ${n}`.trim(),o.setAttribute(`data-export-asset-id`,t),o.setAttribute(`data-export-label`,e),i&&o.setAttribute(`data-export-docx-src`,i),a){let t=document.createElement(`div`);t.className=`export-diagram-surface`,t.innerHTML=a;let n=t.querySelector(`svg`);if(n){let{width:r}=w(n);t.style.width=`100%`,t.style.maxWidth=`${Math.ceil(r)}px`,n.classList.add(`export-diagram-svg`),n.setAttribute(`role`,`img`),n.setAttribute(`aria-label`,e),n.removeAttribute(`width`),n.removeAttribute(`height`)}return o.appendChild(t),o}let s=document.createElement(`img`);return s.alt=e,s.className=`export-diagram-image`,s.src=r,i&&s.setAttribute(`data-export-docx-src`,i),o.appendChild(s),o}async function B(){return _||(_=e(()=>import(`./mermaid-runtime-BGlnoUXY.js`).then(e=>{let t=e?.default;if(!t)throw Error(`Mermaid runtime failed to initialize`);return t.initialize(d),t}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url),_)}function V(e){let t=String(e??``);if(/%%\{[\s\S]*?\binit\s*:/m.test(t)||(/^\s*stateDiagram(?:-v2)?\b/m.test(t)||/^\s*classDiagram\b/m.test(t)||/^\s*gantt\b/m.test(t))&&(t=`%%{init: ${JSON.stringify({htmlLabels:!1})}}%%\n${t}`),/^\s*gantt\b/m.test(t)&&!/\btodayMarker\b/.test(t)){let e=t.split(`
|
|
3
|
+
`),n=e.findIndex(e=>/^\s*gantt\b/.test(e));n!==-1&&(e.splice(n+1,0,` todayMarker off`),t=e.join(`
|
|
4
|
+
`))}return t}async function H(e){let t=await B();t.initialize(d);let n=document.createElement(`div`);n.style.position=`fixed`,n.style.left=`-10000px`,n.style.top=`0`,n.style.width=`1200px`,document.body.appendChild(n);try{let r=document.createElement(`div`);r.className=`mermaid`,r.id=y(`mermaid-render`),r.textContent=V(e),n.appendChild(r),await t.run({nodes:[r]});let i=r.querySelector(`svg`);if(!i)throw Error(`Mermaid render returned no SVG`);return T(i.outerHTML,{padding:24})}finally{n.remove()}}async function U(e){let t=await A(r(`/plantuml/render`),{body:JSON.stringify({source:e}),headers:{"Content-Type":`application/json`},method:`POST`});if(typeof t?.svg!=`string`||!t.svg.includes(`<svg`))throw Error(`PlantUML render returned no SVG`);return T(t.svg,{padding:16})}async function W(e){let t=s(a(await j(e)),{theme:`light`});return T((await o({appState:{...t.appState,exportBackground:!0,exportWithDarkMode:!1},elements:t.elements.filter(e=>!e.isDeleted),exportPadding:24,files:t.files||null})).outerHTML,{padding:24})}async function G(e){let t=y(`drawio-export`);return new Promise((n,r)=>{let a=document.createElement(`iframe`);a.className=`drawio-export-iframe`,a.src=(()=>{let n=new URL(i(`/drawio-editor.html`),window.location.origin);return n.searchParams.set(`file`,e),n.searchParams.set(`hostMode`,`export-image`),n.searchParams.set(`instanceId`,t),n.searchParams.set(`mode`,`view`),n.searchParams.set(`theme`,`light`),n.searchParams.set(`previewWidth`,`1200`),n.toString()})();let o=window.setTimeout(()=>{c(),r(Error(`Timed out while exporting draw.io diagram`))},2e4),s=e=>{if(e.origin!==window.location.origin)return;let i=e.data;if(!(!i||i.source!==`drawio-editor`||i.instanceId!==t)){if(i.type===`export-image`&&typeof i.data==`string`&&i.data){c(),n(i.data);return}(i.type===`error`||i.type===`fallback-text`)&&(c(),r(Error(i.message||`Failed to export draw.io diagram`)))}},c=()=>{window.clearTimeout(o),window.removeEventListener(`message`,s),a.remove()};window.addEventListener(`message`,s),document.body.appendChild(a)})}function K(e,t){return e.assets[t.id]=t,t.id}async function q(e,t,{label:n,prefix:r,render:i}){let a=t.querySelector(`.${r}-source`)?.textContent??``,o=t.dataset[`${r}Target`];if(!a.trim()&&o&&(a=await j(o)),!a.trim())throw Error(`${n} source is empty`);let s=await i(a,o),c=x(s),l=await E(s).catch(()=>c),u=K(e,{dataUrl:c,id:y(r),kind:`svg`,mimeType:`image/svg+xml`,text:s,variants:{docx:l}});t.replaceWith(z({alt:n,assetId:u,className:`export-diagram--${r}`,dataUrl:c,docxDataUrl:l,svgMarkup:s}))}async function ce(e,t){let n=String(t.dataset.embedTarget??``).trim();if(!n)throw Error(`Missing Excalidraw file path`);let r=await W(n),i=x(r),a=await E(r).catch(()=>i),o=K(e,{dataUrl:i,id:y(`excalidraw`),kind:`svg`,mimeType:`image/svg+xml`,text:r,variants:{docx:a}});t.replaceWith(z({alt:t.dataset.embedLabel||`Excalidraw diagram`,assetId:o,className:`export-diagram--excalidraw`,dataUrl:i,docxDataUrl:a,svgMarkup:r}))}async function le(e,t){let n=String(t.dataset.drawioTarget??``).trim();if(!n)throw Error(`Missing draw.io file path`);let r=await G(n),i=K(e,{dataUrl:r,id:y(`drawio`),kind:`png`,mimeType:`image/png`});t.replaceWith(z({alt:t.dataset.drawioLabel||`draw.io diagram`,assetId:i,className:`export-diagram--drawio`,dataUrl:r,docxDataUrl:r}))}async function ue(e,t){let n=Array.from(t.querySelectorAll(`img`));for(let t of n){let n=t.getAttribute(`src`)||``;if(n){if(n.startsWith(`data:`)){let r=await k(n,{warnings:e.warnings});t.setAttribute(`data-export-docx-src`,r);continue}try{let r=await M(new URL(n,window.location.href).toString()),i=await k(r,{warnings:e.warnings}),a=K(e,{dataUrl:r,id:y(`image`),kind:`image`,mimeType:O(r)||`application/octet-stream`});t.src=r,t.setAttribute(`data-export-asset-id`,a),t.setAttribute(`data-export-docx-src`,i)}catch(r){let i=r instanceof Error?r.message:`Failed to inline ${n}`;e.warnings.push(i),t.replaceWith(R({alt:t.getAttribute(`alt`)||``,message:`Image export failed: ${i}. Source:`,src:n}))}}}}function de(e){Array.from(e.querySelectorAll(`.wiki-link[data-wiki-target]`)).forEach(e=>{let t=String(e.getAttribute(`data-wiki-target`)||``).trim();t&&(e.setAttribute(`href`,se(t)),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))})}function fe(e){Array.from(e.querySelectorAll(`.task-list-item input[type="checkbox"]`)).forEach(e=>{e.setAttribute(`disabled`,`true`)})}async function pe(e,{container:t}={}){de(t),fe(t);let n=Array.from(t.querySelectorAll(`.video-embed-placeholder[data-video-embed-key]`));for(let t of n)try{await L(e,t)}catch(n){e.warnings.push(n instanceof Error?n.message:`Failed to render video poster`),t.replaceWith(P(t))}let r=Array.from(t.querySelectorAll(`.mermaid-shell[data-mermaid-key]`));for(let t of r)try{await q(e,t,{label:t.dataset.mermaidLabel||`Mermaid diagram`,prefix:`mermaid`,render:e=>H(e)})}catch(n){e.warnings.push(n instanceof Error?n.message:`Failed to render Mermaid diagram`),t.replaceWith(Object.assign(document.createElement(`p`),{className:`export-warning`,textContent:`Mermaid export failed: ${n instanceof Error?n.message:`Unknown error`}`}))}let i=Array.from(t.querySelectorAll(`.plantuml-shell[data-plantuml-key]`));for(let t of i)try{await q(e,t,{label:t.dataset.plantumlLabel||`PlantUML diagram`,prefix:`plantuml`,render:e=>U(e)})}catch(n){e.warnings.push(n instanceof Error?n.message:`Failed to render PlantUML diagram`),t.replaceWith(Object.assign(document.createElement(`p`),{className:`export-warning`,textContent:`PlantUML export failed: ${n instanceof Error?n.message:`Unknown error`}`}))}let a=Array.from(t.querySelectorAll(`.excalidraw-embed-placeholder[data-embed-key]`));for(let t of a)try{await ce(e,t)}catch(n){e.warnings.push(n instanceof Error?n.message:`Failed to render Excalidraw diagram`),t.replaceWith(Object.assign(document.createElement(`p`),{className:`export-warning`,textContent:`Excalidraw export failed: ${n instanceof Error?n.message:`Unknown error`}`}))}let o=Array.from(t.querySelectorAll(`.drawio-embed-placeholder[data-drawio-key]`));for(let t of o)try{await le(e,t)}catch(n){e.warnings.push(n instanceof Error?n.message:`Failed to render draw.io diagram`),t.replaceWith(Object.assign(document.createElement(`p`),{className:`export-warning`,textContent:`draw.io export failed: ${n instanceof Error?n.message:`Unknown error`}`}))}return await ue(e,t),e}async function me({fileList:e=[],filePath:t,markdownText:i=``,title:a=``}={}){let o=String(t??``).trim(),s=String(i??``),c={assets:{},filePath:o,generatedAt:new Date().toISOString(),html:``,sourceMarkdown:s,title:b(o,a),warnings:[]},l=n({attachmentApiPath:r(`/attachment`),fileList:e,markdownText:s,sourceFilePath:o}),u=document.createElement(`div`);return u.className=`preview-content export-content`,u.innerHTML=l.html,await pe(c,{container:u}),c.html=u.innerHTML,c}function J(e,{borderColor:t=`#d1d5db`,cellPadding:n=`8px 10px`,headerBackground:r=`#f3f4f6`}={}){e.setAttribute(`border`,`1`),e.setAttribute(`cellpadding`,`0`),e.setAttribute(`cellspacing`,`0`),e.style.width=`100%`,e.style.borderCollapse=`collapse`,e.style.border=`1px solid ${t}`,e.style.margin=`0 0 16px`,Array.from(e.querySelectorAll(`th`)).forEach(e=>{e.style.border=`1px solid ${t}`,e.style.padding=n,e.style.background=r,e.style.textAlign=`left`,e.style.verticalAlign=`top`}),Array.from(e.querySelectorAll(`td`)).forEach(e=>{e.style.border=`1px solid ${t}`,e.style.padding=n,e.style.textAlign=`left`,e.style.verticalAlign=`top`})}function Y({contentNodes:e=[],borderColor:t=`#d1d5db`,padding:n=`12px`,shade:r=``}={}){let i=document.createElement(`table`);i.setAttribute(`border`,`1`),i.setAttribute(`cellpadding`,`0`),i.setAttribute(`cellspacing`,`0`),i.style.width=`100%`,i.style.borderCollapse=`collapse`,i.style.border=`1px solid ${t}`,i.style.margin=`0 0 16px`;let a=document.createElement(`tr`),o=document.createElement(`td`);return o.style.border=`1px solid ${t}`,o.style.padding=n,o.style.verticalAlign=`top`,r&&(o.style.background=r),e.forEach(e=>{e&&o.appendChild(e)}),a.appendChild(o),i.appendChild(a),i}function he(e){let t=document.createElement(`table`);t.setAttribute(`role`,`presentation`),t.setAttribute(`cellpadding`,`0`),t.setAttribute(`cellspacing`,`0`),t.style.width=`100%`,t.style.borderCollapse=`collapse`,t.style.margin=`0 0 16px`,t.style.tableLayout=`fixed`;let n=document.createElement(`colgroup`),r=document.createElement(`col`);r.style.width=`6px`;let i=document.createElement(`col`);n.append(r,i),t.appendChild(n);let a=document.createElement(`tr`),o=document.createElement(`td`);o.style.background=`#6366f1`,o.style.width=`6px`,o.style.padding=`0`,o.style.fontSize=`0`,o.style.lineHeight=`0`,o.innerHTML=` `;let s=document.createElement(`td`);s.style.background=`#f8fafc`,s.style.padding=`12px 16px`,s.style.verticalAlign=`top`,s.style.color=`#4b5563`,Array.from(e.childNodes).forEach(e=>{s.appendChild(e.cloneNode(!0))});let c=s.querySelector(`p`);c&&(c.style.marginTop=`0`),Array.from(s.querySelectorAll(`p`)).forEach(e=>{e.style.margin=`0 0 10px`});let l=s.querySelector(`p:last-of-type`);return l&&(l.style.marginBottom=`0`),a.append(o,s),t.appendChild(a),t}function ge(e){let t=(e.textContent||``).replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`),n=[];return t.forEach((e,r)=>{let i=document.createElement(`p`);i.style.margin=`0`,r<t.length-1&&(i.style.marginBottom=`2px`),i.style.fontFamily=`'JetBrains Mono', 'Courier New', monospace`,i.style.fontSize=`12px`,i.style.lineHeight=`1.55`,i.style.color=`#111827`;let a=(e||``).replace(/\t/g,` `);a?(i.textContent=a,i.innerHTML=i.innerHTML.replace(/ /g,` `)):i.innerHTML=` `,n.push(i)}),Y({borderColor:`#d1d5db`,contentNodes:n,padding:`12px 14px`,shade:`#f8fafc`})}function _e(e){let t=document.createElement(`template`);return t.innerHTML=e.html,Array.from(t.content.querySelectorAll(`.table-wrapper`)).forEach(e=>{let t=e.querySelector(`:scope > table`);t&&(J(t),e.replaceWith(t))}),Array.from(t.content.querySelectorAll(`table`)).forEach(e=>{J(e)}),Array.from(t.content.querySelectorAll(`pre`)).forEach(e=>{e.replaceWith(ge(e))}),Array.from(t.content.querySelectorAll(`figure.export-diagram[data-export-docx-src]`)).forEach(e=>{let t=e.getAttribute(`data-export-docx-src`),n=e.querySelector(`svg`);if(!t||!n)return;let r=document.createElement(`img`);r.alt=e.getAttribute(`data-export-label`)||`Diagram`,r.className=`export-diagram-image`,r.src=t,r.style.display=`block`,r.style.width=`100%`,r.style.height=`auto`,e.replaceWith(Y({contentNodes:[r],padding:`12px`}))}),Array.from(t.content.querySelectorAll(`figure.export-video-poster`)).forEach(e=>{let t=e.querySelector(`.export-video-poster-card`),n=e.querySelector(`.export-video-poster-image`),r=e.querySelector(`.export-video-link`),i=e.querySelector(`.export-video-poster-copy strong`),a=e.querySelector(`.export-video-poster-meta`),o=document.createElement(`div`);if(o.className=`export-video-poster-docx`,n instanceof HTMLImageElement){let e=document.createElement(`img`);e.alt=n.alt||i?.textContent||`Embedded video poster`,e.className=`export-video-poster-image`,e.src=n.getAttribute(`data-export-docx-src`)||n.getAttribute(`src`)||``,o.appendChild(e)}if(i?.textContent){let e=document.createElement(`p`),t=document.createElement(`strong`);t.textContent=i.textContent,e.appendChild(t),o.appendChild(e)}if(a?.textContent){let e=document.createElement(`p`);e.className=`export-video-poster-meta`,e.textContent=a.textContent,o.appendChild(e)}if(r instanceof HTMLAnchorElement&&r.href){let e=document.createElement(`p`),t=document.createElement(`a`);t.href=r.href,t.textContent=r.textContent||r.href,e.appendChild(t),o.appendChild(e)}if(!o.childNodes.length&&t?.textContent){let e=document.createElement(`p`);e.textContent=t.textContent,o.appendChild(e)}e.replaceWith(Y({contentNodes:[o],padding:`12px`}))}),Array.from(t.content.querySelectorAll(`[data-export-docx-src]`)).forEach(e=>{if(!(e instanceof HTMLImageElement))return;let t=e.getAttribute(`data-export-docx-src`);t&&e.setAttribute(`src`,t)}),Array.from(t.content.querySelectorAll(`blockquote`)).forEach(e=>{e.replaceWith(he(e))}),Array.from(t.content.querySelectorAll(`figure`)).forEach(e=>{if(e.closest(`table`))return;let t=e.querySelector(`img`);if(!(t instanceof HTMLImageElement))return;let n=t.cloneNode(!0);n.style.display=`block`,n.style.width=`100%`,n.style.height=`auto`,e.replaceWith(Y({contentNodes:[n],padding:`12px`}))}),`<!DOCTYPE html>
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<title>${e.title}</title>
|
|
11
|
+
<style>
|
|
12
|
+
body { font-family: Arial, sans-serif; color: #111827; line-height: 1.6; }
|
|
13
|
+
main { max-width: 760px; margin: 0 auto; }
|
|
14
|
+
h1, h2, h3, h4, h5, h6 { color: #111827; margin: 1.3em 0 0.6em; line-height: 1.2; }
|
|
15
|
+
h1 { font-size: 28px; border-bottom: 1px solid #d1d5db; padding-bottom: 8px; }
|
|
16
|
+
h2 { font-size: 22px; }
|
|
17
|
+
h3 { font-size: 18px; }
|
|
18
|
+
p, ul, ol, blockquote, pre, table, figure { margin: 0 0 16px; }
|
|
19
|
+
a { color: #4338ca; text-decoration: underline; }
|
|
20
|
+
pre { padding: 12px; border: 1px solid #d1d5db; background: #f8fafc; overflow: hidden; }
|
|
21
|
+
code { font-family: 'JetBrains Mono', 'Courier New', monospace; background: #f3f4f6; padding: 2px 4px; }
|
|
22
|
+
pre code { background: transparent; padding: 0; display: block; white-space: pre-wrap; }
|
|
23
|
+
blockquote { padding-left: 14px; border-left: 3px solid #6366f1; color: #4b5563; }
|
|
24
|
+
table { width: 100%; border-collapse: collapse; border: 1px solid #d1d5db; }
|
|
25
|
+
th, td { border: 1px solid #d1d5db; padding: 8px 10px; text-align: left; vertical-align: top; }
|
|
26
|
+
th { background: #f3f4f6; }
|
|
27
|
+
img { max-width: 100%; height: auto; }
|
|
28
|
+
.export-video-poster-docx { margin: 0 0 16px; }
|
|
29
|
+
.export-video-poster-card { padding: 14px 16px; border: 1px solid #d1d5db; background: #f8fafc; }
|
|
30
|
+
.export-video-poster-image { display: block; margin: 0 0 12px; }
|
|
31
|
+
.export-video-poster-meta { display: block; color: #6b7280; font-size: 12px; margin-top: 4px; }
|
|
32
|
+
.export-video-link { display: block; margin-top: 8px; word-break: break-word; }
|
|
33
|
+
.export-warning { color: #b45309; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<main>${t.innerHTML}</main>
|
|
38
|
+
</body>
|
|
39
|
+
</html>`}async function ve(e){let t=await fetch(r(`/export/docx`),{body:JSON.stringify({filePath:e.filePath,html:_e(e),title:e.title}),headers:{"Content-Type":`application/json`},method:`POST`});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||`Failed to export DOCX`)}let n=await t.blob(),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${b(e.filePath,e.title)}.docx`,document.body.appendChild(a),a.click(),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),1e3)}async function ye(){await S(),await S(),await new Promise(e=>{let t=window.setTimeout(e,1500),n=()=>{window.clearTimeout(t),window.removeEventListener(`afterprint`,n),e()};window.addEventListener(`afterprint`,n,{once:!0}),window.print()})}async function be(e,{settleFrames:t=2,timeoutMs:n=p}={}){if(!e)return``;let r=Array.from(e.querySelectorAll(`img`)).map(e=>oe(e,{timeoutMs:n})),i=document.fonts?.ready?Promise.resolve(document.fonts.ready).catch(()=>{}):Promise.resolve();await Promise.allSettled([i,...r]);for(let e=0;e<t;e+=1)await S();return e.innerHTML}async function xe(e,t){if(t===`pdf`){await ye(e);return}await ve(e)}function X(e,t={}){!window.opener||window.opener.closed||window.opener.postMessage({...t,source:l,type:e},window.location.origin)}async function Se(){let e=new URL(window.location.href),t=e.searchParams.get(`action`)===`pdf`?`pdf`:`docx`,n=e.searchParams.get(`file`)||``,r=e.searchParams.get(`job`)||``;return r&&window.opener&&!window.opener.closed?(X(`ready`,{jobId:r}),new Promise((e,i)=>{let a=window.setTimeout(()=>{o(),i(Error(`Timed out waiting for export data`))},1e4),o=()=>{window.clearTimeout(a),window.removeEventListener(`message`,s)},s=i=>{if(i.origin!==window.location.origin)return;let a=i.data;!a||a.source!==u||a.type!==`bootstrap`||a.jobId!==r||(o(),e({action:t,fileList:Array.isArray(a.fileList)?a.fileList:[],filePath:a.filePath||n,title:a.title||``,markdownText:a.markdownText||``}))};window.addEventListener(`message`,s)})):{action:t,fileList:[],filePath:n,markdownText:n?await j(n):``,title:``}}var Z=`h1, h2, h3, h4, h5, h6`,Ce=[`figure`,`pre`,`blockquote`,`table`].join(`, `);function Q(e){return!!e?.matches?.(Ce)}function we(e){e&&Array.from(e.querySelectorAll(Z)).forEach(e=>{if(e.parentElement?.classList.contains(`export-keep-with-next`))return;let t=e.nextElementSibling;if(!t||t.classList.contains(`export-keep-with-next`))return;let n=[e],r=t;if(r.tagName===`P`){let e=r.nextElementSibling;if(!e||!Q(e))return;n.push(r),r=e}else if(!Q(r))return;n.push(r);let i=document.createElement(`section`);i.className=`export-keep-with-next`,e.before(i),n.forEach(e=>i.appendChild(e))})}function $(e){let t=document.getElementById(`exportStatus`);t&&(t.textContent=e)}function Te(e){let t=document.getElementById(`exportWarnings`),n=document.getElementById(`exportWarningsSection`);if(!t||!n)return;t.replaceChildren();let r=e.warnings??[];n.hidden=r.length===0,r.forEach(e=>{let n=document.createElement(`li`);n.textContent=e,t.appendChild(n)})}function Ee(e){let t=document.getElementById(`exportContent`);return t?(document.title=`${e.title} — Export`,t.innerHTML=e.html,we(t),Te(e),t):null}async function De(){try{$(`Loading export content…`);let e=await Se(),t=await me(e);t.html=await be(Ee(t)),$(e.action===`pdf`?`Opening print dialog…`:`Preparing DOCX download…`),await xe(t,e.action),$(e.action===`pdf`?`Print dialog opened.`:`DOCX download started.`),X(`complete`,{jobId:new URL(window.location.href).searchParams.get(`job`)||``})}catch(e){let t=e instanceof Error?e.message:`Export failed`;$(t),X(`error`,{jobId:new URL(window.location.href).searchParams.get(`job`)||``,message:t})}}De();
|