mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
3 lines
63 KiB
JavaScript
3 lines
63 KiB
JavaScript
|
|
import{Facet as t,EditorState as e,StateEffect as r,StateField as n,countColumn as i,RangeSet as s,combineConfig as o,Prec as l,RangeSetBuilder as a}from"./codemirror_state-BKbyfKsm.js";import{V as h,l as f,E as u,a as c,W as d,p,D as g,G as m,S as b}from"./codemirror_view-C0PMO2z_.js";const x=1024;let k=0;class y{constructor(t,e){this.from=t,this.to=e}}class w{constructor(t={}){this.id=k++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=A.match(t)),e=>{let r=t(e);return void 0===r?null:[this,r]}}}w.closedBy=new w({deserialize:t=>t.split(" ")}),w.openedBy=new w({deserialize:t=>t.split(" ")}),w.group=new w({deserialize:t=>t.split(" ")}),w.isolate=new w({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),w.contextHash=new w({perNode:!0}),w.lookAhead=new w({perNode:!0}),w.mounted=new w({perNode:!0});class v{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[w.mounted.id]}}const S=Object.create(null);class A{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):S,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new A(t.name||"",e,t.id,r);if(t.props)for(let r of t.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(w.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(" "))e[n]=t[r];return t=>{for(let r=t.prop(w.group),n=-1;n<(r?r.length:0);n++){let i=e[n<0?t.name:r[n]];if(i)return i}}}}A.none=new A("",Object.create(null),0,8);class C{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let r of this.types){let n=null;for(let e of t){let t=e(r);t&&(n||(n=Object.assign({},r.props)),n[t[0].id]=t[1])}e.push(n?new A(r.name,n,r.id,r.flags):r)}return new C(e)}}const N=new WeakMap,P=new WeakMap;var I;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(I||(I={}));class T{constructor(t,e,r,n,i){if(this.type=t,this.children=e,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[t,e]of i)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=v.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let r=t.toString();r&&(e&&(e+=","),e+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new F(this.topNode,t)}cursorAt(t,e=0,r=0){let n=N.get(this)||this.topNode,i=new F(n);return i.moveTo(t,e),N.set(this,i._tree),i}get topNode(){return new L(this,0,0,null)}resolve(t,e=0){let r=M(N.get(this)||this.topNode,t,e,!1);return N.set(this,r),r}resolveInner(t,e=0){let r=M(P.get(this)||this.topNode,t,e,!0);return P.set(this,r),r}resolveStack(t,e=0){return function(t,e,r){let n=t.resolveInner(e,r),i=null;for(let t=n instanceof L?n:n.context.parent;t;t=t.parent)if(t.index<0){let s=t.parent;(i||(i=[n])).push(s.resolve(e,r)),t=s}else{let s=v.get(t.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let o=new L(s.tree,s.overlay[0].from+t.from,-1,t);(i||(i=[n])).push(M(o,e,r,!1))}}return i?W(i):n}(this,t,e)}iterate(t){let{enter:e,leave:r,f
|
||
|
|
//# sourceMappingURL=codemirror_language-_XiX6II0.js.map
|