vault backup: 2026-10-05 09:03:01
This commit is contained in:
1 parent
074301848f
commit
1ae0b5509a
5 files changed
+297
-270
No files matched your search
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"snippets": "export default [\n // Math mode\n\t{trigger: \"mk\", replacement: \"$$0$\", options: \"tA\"},\n {trigger: \"dm\", replacement: \"$$\\n\\t$0\\n$$\", options: \"tAw\"},\n\t{trigger: /(?<=\\S.*)dm/, replacement: \"\\n$$\\n\\t$0\\n$$\", options: \"tAw\", priority: 1},\n\n\t{trigger: /([^\\\\])beg/, replacement: \"[[0]]\\\\begin{$0}\\n\\t$1\\n\\\\end{$0}\", options: \"MA\"},\n\t{trigger: /([^\\\\])beg/, replacement: \"[[0]]\\\\begin{$0} $1 \\\\end{$0}\", options: \"nA\"},\n\n // Dashes\n\t// {trigger: \"--\", replacement: \"–\", options: \"tA\"},\n\t// {trigger: \"–-\", replacement: \"—\", options: \"tA\"},\n\t// {trigger: \"—-\", replacement: \"---\", options: \"tA\"},\n\n // Greek letters\n\t{trigger: \"@a\", replacement: \"\\\\alpha\", options: \"mA\"},\n\t{trigger: \"@b\", replacement: \"\\\\beta\", options: \"mA\"},\n\t{trigger: \"@g\", replacement: \"\\\\gamma\", options: \"mA\"},\n\t{trigger: \"@G\", replacement: \"\\\\Gamma\", options: \"mA\"},\n\t{trigger: \"@d\", replacement: \"\\\\delta\", options: \"mA\"},\n\t{trigger: \"@D\", replacement: \"\\\\Delta\", options: \"mA\"},\n\t{trigger: \"@e\", replacement: \"\\\\epsilon\", options: \"mA\"},\n\t{trigger: \":e\", replacement: \"\\\\varepsilon\", options: \"mA\"},\n\t{trigger: \"@z\", replacement: \"\\\\zeta\", options: \"mA\"},\n\t{trigger: \"@t\", replacement: \"\\\\theta\", options: \"mA\"},\n\t{trigger: \"@T\", replacement: \"\\\\Theta\", options: \"mA\"},\n\t{trigger: \":t\", replacement: \"\\\\vartheta\", options: \"mA\"},\n\t{trigger: \"@i\", replacement: \"\\\\iota\", options: \"mA\"},\n\t{trigger: \"@k\", replacement: \"\\\\kappa\", options: \"mA\"},\n\t{trigger: \"@l\", replacement: \"\\\\lambda\", options: \"mA\"},\n\t{trigger: \"@L\", replacement: \"\\\\Lambda\", options: \"mA\"},\n\t{trigger: \"@s\", replacement: \"\\\\sigma\", options: \"mA\"},\n\t{trigger: \"@S\", replacement: \"\\\\Sigma\", options: \"mA\"},\n\t{trigger: \"@u\", replacement: \"\\\\upsilon\", options: \"mA\"},\n\t{trigger: \"@U\", replacement: \"\\\\Upsilon\", options: \"mA\"},\n\t{trigger: \"@o\", replacement: \"\\\\omega\", options: \"mA\"},\n\t{trigger: \"@O\", replacement: \"\\\\Omega\", options: \"mA\"},\n\t{trigger: \"ome\", replacement: \"\\\\omega\", options: \"mA\"},\n\t{trigger: \"Ome\", replacement: \"\\\\Omega\", options: \"mA\"},\n\n // Text environment\n {trigger: \"text\", replacement: \"\\\\text{$0}$1\", options: \"mA\"},\n {trigger: \"\\\"\", replacement: \"\\\\text{$0}$1\", options: \"mA\"},\n\n // Basic operations\n {trigger: \"sr\", replacement: \"^{2}\", options: \"mA\"},\n\t{trigger: \"cb\", replacement: \"^{3}\", options: \"mA\"},\n\t{trigger: \"rd\", replacement: \"^{$0}$1\", options: \"mA\"},\n\t{trigger: \"_\", replacement: \"_{$0}$1\", options: \"mA\"},\n\t{trigger: \"sts\", replacement: \"_\\\\text{$0}\", options: \"mA\"},\n\t{trigger: \"sq\", replacement: \"\\\\sqrt{ $0 }$1\", options: \"mA\"},\n\t{trigger: \"//\", replacement: \"\\\\frac{$0}{$1}$2\", options: \"mA\"},\n\t{trigger: \"ee\", replacement: \"e^{ $0 }$1\", options: \"mA\"},\n {trigger: \"invs\", replacement: \"^{-1}\", options: \"mA\"},\n\n {trigger: /([^\\\\])(exp|log|ln)/, replacement: \"[[0]]\\\\[[1]]\", options: \"rmA\"},\n {trigger: \"conj\", replacement: \"^{*}\", options: \"mA\"},\n {trigger: \"Re\", replacement: \"\\\\mathrm{Re}\", options: \"mA\"},\n\t{trigger: \"Im\", replacement: \"\\\\mathrm{Im}\", options: \"mA\"},\n {trigger: \"bf\", replacement: \"\\\\mathbf{$0}\", options: \"mA\"},\n\t{trigger: \"rm\", replacement: \"\\\\mathrm{$0}$1\", options: \"mA\"},\n\n // Linear algebra\n {trigger: /([^\\\\])(det)/, replacement: \"[[0]]\\\\[[1]]\", options: \"rmA\"},\n {trigger: \"trace\", replacement: \"\\\\mathrm{Tr}\", options: \"mA\"},\n\n // More operations\n\t{trigger: \"([a-zA-Z])hat\", replacement: \"\\\\hat{[[0]]}\", options: \"rmA\"},\n {trigger: \"([a-zA-Z])bar\", replacement: \"\\\\bar{[[0]]}\", options: \"rmA\"},\n\t{trigger: \"([a-zA-Z])dot\", replacement: \"\\\\dot{[[0]]}\", options: \"rmA\", priority: -1},\n\t{trigger: \"([a-zA-Z])ddot\", replacement: \"\\\\ddot{[[0]]}\", options: \"rmA\", priority: 1},\n\t{trigger: \"([a-zA-Z])tilde\", replacement: \"\\\\tilde{[[0]]}\", options: \"rmA\"},\n\t{trigger: \"([a-zA-Z])und\", replacement: \"\\\\underline{[[0]]}\", options: \"rmA\"},\n\t{trigger: \"([a-zA-Z])vec\", replacement: \"\\\\vec{[[0]]}\", options: \"rmA\"},\n {trigger: \"([a-zA-Z]),\\\\.\", replacement: \"\\\\mathbf{[[0]]}\", options: \"rmA\"},\n\t{trigger: \"([a-zA-Z])\\\\.,\", replacement: \"\\\\mathbf{[[0]]}\", options: \"rmA\"},\n\t{trigger: \"\\\\\\\\(${GREEK}),\\\\.\", replacement: \"\\\\boldsymbol{\\\\[[0]]}\", options: \"rmA\"},\n\t{trigger: \"\\\\\\\\(${GREEK})\\\\.,\", replacement: \"\\\\boldsymbol{\\\\[[0]]}\", options: \"rmA\"},\n\n\t{trigger: \"hat\", replacement: \"\\\\hat{$0}$1\", options: \"mA\"},\n {trigger: \"bar\", replacement: \"\\\\bar{$0}$1\", options:Line truncated
|
||||||
|
"snippetVariables": "export default {\n\t\"${GREEK}\": \"(?:alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|vartheta|Theta|iota|kappa|lambda|Lambda|mu|nu|xi|omicron|pi|rho|varrho|sigma|Sigma|tau|upsilon|Upsilon|phi|varphi|Phi|chi|psi|omega|Omega)\",\n\t\"${SYMBOL}\": \"(?:parallel|perp|partial|nabla|hbar|ell|infty|oplus|ominus|otimes|oslash|square|star|dagger|vee|wedge|subseteq|subset|supseteq|supset|emptyset|exists|nexists|forall|implies|impliedby|iff|setminus|neg|lor|land|bigcup|bigcap|cdot|times|simeq|approx)\",\n\t\"${MORE_SYMBOLS}\": \"(?:leq|geq|neq|gg|ll|equiv|sim|propto|rightarrow|leftarrow|Rightarrow|Leftarrow|leftrightarrow|to|mapsto|cap|cup|in|sum|prod|exp|ln|log|det|dots|vdots|ddots|pm|mp|int|iint|iiint|oint)\",\n \"${ACCENT}\": \"(?:dot|ddot|hat|bar|tilde|vec|underline|overline|mathbf|mathcal|mathrm|mathbb)\",\n}\n",
|
||||||
|
"snippetsEnabled": true,
|
||||||
|
"snippetsTrigger": "Tab",
|
||||||
|
"snippetNextTabstopTrigger": "Tab",
|
||||||
|
"snippetPreviousTabstopTrigger": "Shift-Tab",
|
||||||
|
"suppressSnippetTriggerOnIME": true,
|
||||||
|
"suppressIMEWarning": false,
|
||||||
|
"removeSnippetWhitespace": true,
|
||||||
|
"autoDelete$": true,
|
||||||
|
"loadSnippetsFromFile": false,
|
||||||
|
"loadSnippetVariablesFromFile": false,
|
||||||
|
"snippetsFileLocation": "",
|
||||||
|
"snippetVariablesFileLocation": "",
|
||||||
|
"concealEnabled": false,
|
||||||
|
"concealRevealTimeout": 0,
|
||||||
|
"colorPairedBracketsEnabled": true,
|
||||||
|
"highlightCursorBracketsEnabled": true,
|
||||||
|
"mathPreviewEnabled": true,
|
||||||
|
"mathPreviewPositionIsAbove": true,
|
||||||
|
"mathPreviewCursor": "▶",
|
||||||
|
"mathPreviewBracketHighlighting": false,
|
||||||
|
"mathPreviewLivePreviewDisplay": false,
|
||||||
|
"autofractionEnabled": true,
|
||||||
|
"autofractionSymbol": "\\frac",
|
||||||
|
"autofractionBreakingChars": "+-=\t",
|
||||||
|
"matrixShortcutsEnabled": true,
|
||||||
|
"taboutEnabled": true,
|
||||||
|
"taboutExitEquationOnlyOnEOL": true,
|
||||||
|
"taboutTrigger": "Tab",
|
||||||
|
"autoEnlargeBrackets": true,
|
||||||
|
"autoEnlargeBracketsSpace": true,
|
||||||
|
"wordDelimiters": "., +-\\n\t:;!?\\/{}[]()=~$'\"|`<>*^%#@&",
|
||||||
|
"autofractionExcludedEnvs": "[\n\t\t[\"^{\", \"}\"],\n\t\t[\"\\\\pu{\", \"}\"]\n\t]",
|
||||||
|
"matrixShortcutsEnvNames": "pmatrix, cases, align, gather, bmatrix, Bmatrix, vmatrix, Vmatrix, array, matrix",
|
||||||
|
"matrixShortcutsMacroNames": "eqalign",
|
||||||
|
"taboutClosingSymbols": "), ], \\rbrack, \\}, \\rbrace, \\rangle, \\rvert, \\rVert, \\rfloor, \\rceil, \\urcorner, }",
|
||||||
|
"autoEnlargeBracketsTriggers": "sum, int, frac, prod, bigcup, bigcap",
|
||||||
|
"forceMathLanguages": "math",
|
||||||
|
"snippetDebug": "off",
|
||||||
|
"vimEnabled": false,
|
||||||
|
"vimSelectMode": "<C-g>",
|
||||||
|
"vimVisualMode": "<C-g>",
|
||||||
|
"vimMatrixEnter": "o",
|
||||||
|
"snippetRecursion": 0,
|
||||||
|
"snippetIMEVersion": false,
|
||||||
|
"highlightDollarEnabled": true,
|
||||||
|
"excalidrawSupportEnabled": true,
|
||||||
|
"logLevel": "off",
|
||||||
|
"autofractionTrigger": "/",
|
||||||
|
"matrixShortcutsCellTrigger": "Tab",
|
||||||
|
"matrixShortcutsNewlineTrigger": "Enter",
|
||||||
|
"matrixShortcutsExitTrigger": "Shift-Enter"
|
||||||
|
}
|
||||||
+201
-99
@@ -3,18 +3,18 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|||||||
if you want to view the source, please visit the github repository of this plugin
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var nr=Object.defineProperty,qa=Object.defineProperties,ja=Object.getOwnPropertyDescriptor,Za=Object.getOwnPropertyDescriptors,Xa=Object.getOwnPropertyNames,qi=Object.getOwnPropertySymbols;var ji=Object.prototype.hasOwnProperty,Wa=Object.prototype.propertyIsEnumerable;var pn=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var un=(t,e,r)=>e in t?nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oe=(t,e)=>{for(var r in e||(e={}))ji.call(e,r)&&un(t,r,e[r]);if(qi)for(var r of qi(e))Wa.call(e,r)&&un(t,r,e[r]);return t},ye=(t,e)=>qa(t,Za(e));var Va=(t,e)=>{for(var r in e)nr(t,r,{get:e[r],enumerable:!0})},Ia=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xa(e))!ji.call(t,i)&&i!==r&&nr(t,i,{get:()=>e[i],enumerable:!(n=ja(e,i))||n.enumerable});return t};var Ma=t=>Ia(nr({},"__esModule",{value:!0}),t);var Zi=(t,e,r)=>(un(t,typeof e!="symbol"?e+"":e,r),r);var v=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())}),Ga=function(t,e){this[0]=t,this[1]=e};var Xi=t=>{var e=t[pn("asyncIterator")],r=!1,n,i={};return e==null?(e=t[pn("iterator")](),n=s=>i[s]=o=>e[s](o)):(e=e.call(t),n=s=>i[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new Ga(new Promise(a=>{var l=e[s](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[pn("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=s=>{throw s},"return"in e&&n("return"),i};var au={};Va(au,{default:()=>on});module.exports=Ma(au);var er=require("@codemirror/state"),ge=require("obsidian");var te=require("obsidian");var Ba=class extends Error{constructor(e){super(e[0].message);Zi(this,"issues");this.name="ValiError",this.issues=e}},cu=Symbol("brand");function Da(t){return typeof t=="function"?t():t}function at(t,e){return Array.isArray(t)?[void 0,t]:[t,e]}function ir(t,e,r){return{typed:t,output:e,issues:r}}function za(t,e,r){if(!t||typeof t=="object"&&!Array.isArray(t)){let[s,o]=at(e,r);return[t,s,o]}let[n,i]=at(t,e);return[void 0,n,i]}function La(t,e){return{reason:t==null?void 0:t.reason,validation:e.validation,origin:(t==null?void 0:t.origin)||"value",message:e.message,input:e.input,requirement:e==null?void 0:e.requirement,path:e.path,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}}function Ua(t,e){return{reason:e,origin:t==null?void 0:t.origin,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}}function _t(t,e,r,n,i){let s,o=t;if(e!=null&&e.length&&!(r!=null&&r.skipPipe))for(let a of e){let l=a._parse(o);if(l.issues){s=s||Ua(r,n);for(let c of l.issues){let p=La(s,c);i?i.push(p):i=[p]}if(s.abortEarly||s.abortPipeEarly)break}else o=l.output}return ir(!0,o,i)}function lt(t,e,r,n,i,s){return{typed:!1,output:i,issues:[{reason:e,validation:r,origin:(t==null?void 0:t.origin)||"value",message:Da(n),input:i,issues:s,abortEarly:t==null?void 0:t.abortEarly,abortPipeEarly:t==null?void 0:t.abortPipeEarly,skipPipe:t==null?void 0:t.skipPipe}]}}function Na(t){return typeof t.default=="function"?t.default():t.default}function Wi(t,e,r){let[n="Invalid type",i]=at(e,r);return{type:"instance",async:!1,class:t,message:n,pipe:i,_parse(s,o){return s instanceof this.class?_t(s,this.pipe,o,"instance"):lt(o,"type","instance",this.message,s)}}}function Vi(t,e){let[r="Invalid type",n]=at(t,e);return{type:"number",async:!1,message:r,pipe:n,_parse(i,s){return typeof i!="number"||isNaN(i)?lt(s,"type","number",this.message,i):_t(i,this.pipe,s,"number")}}}function Ii(t,e,r,n){let[i,s="Invalid type",o]=za(e,r,n),a;return{type:"object",async:!1,entries:t,rest:i,message:s,pipe:o,_parse(l,c){if(!l||typeof l!="object")return lt(c,"type","object",this.message,l);a=a||Object.entries(this.entries);let p=!0,u,d={};for(let[O,h]of a){let f=l[O],g=h._parse(f,c);if(g.issues){let b={type:"object",input:l,key:O,value:f};for(let y of g.issues)y.path?y.path.unshift(b):y.path=[b],u==null||u.push(y);if(u||(u=g.issues),c!=null&&c.abortEarly){p=!1;break}}g.typed||(p=!1),(g.output!==void 0||O in l)&&(d[O]=g.output)}if(this.rest&&!(c!=null&&c.abortEarly&&u)){for(let O in l)if(!(O in this.entries)){let h=l[O],f=this.rest._parse(h,c);if(f.issues){let g={type:"object",input:l,key:O,value:h};for(let b of f.issues)b.path?b.path.unshift(g):b.path=[g],u==null||u.push(b);if(u||(u=f.issues),c!=null&&c.abortEarly){p=!1;break}}f.typed||(p=!1),d[O]=f.output}}return p?_t(d,this.pipe,c,"object",u):ir(!1,d,u)}}}function ct(t,e){return{type:"optional",async:!1,wrapped:t,default:e,_parse(r,n){if(r===void 0){let i=Na(this);if(i===void 0)return ir(!0,r);r=i}return this.wrapped._parse(r,n)}}}function Xe(t,e){let[r="Invalid type",n]=at(t,e);return{type:"string",async:!1,message:r,pipe:n,_parse(i,s){return typeof i!="string"?lt(s,"type","string",this.message,i):_t(i,this.pLine truncated
|
var or=Object.defineProperty,ku=Object.defineProperties,wu=Object.getOwnPropertyDescriptor,Tu=Object.getOwnPropertyDescriptors,Eu=Object.getOwnPropertyNames,wa=Object.getOwnPropertySymbols;var Ea=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable;var ki=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var Ta=(e,t,n)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))Ea.call(t,n)&&Ta(e,n,t[n]);if(wa)for(var n of wa(t))Pu.call(t,n)&&Ta(e,n,t[n]);return e},j=(e,t)=>ku(e,Tu(t));var Pa=(e,t)=>{for(var n in t)or(e,n,{get:t[n],enumerable:!0})},Cu=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Eu(t))!Ea.call(e,i)&&i!==n&&or(e,i,{get:()=>t[i],enumerable:!(r=wu(t,i))||r.enumerable});return e};var qu=e=>Cu(or({},"__esModule",{value:!0}),e);var y=(e,t,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(e,t)).next())}),Ru=function(e,t){this[0]=e,this[1]=t};var sr=e=>{var t=e[ki("asyncIterator")],n=!1,r,i={};return t==null?(t=e[ki("iterator")](),r=o=>i[o]=s=>t[o](s)):(t=t.call(e),r=o=>i[o]=s=>{if(n){if(n=!1,o==="throw")throw s;return s}return n=!0,{done:!1,value:new Ru(new Promise(a=>{var l=t[o](s);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[ki("iterator")]=()=>i,r("next"),"throw"in t?r("throw"):i.throw=o=>{throw o},"return"in t&&r("return"),i};var ig={};Pa(ig,{default:()=>vi});module.exports=qu(ig);var Jn=require("@codemirror/state"),he=require("obsidian");var de=require("obsidian");var ar=class e{constructor({mode:t,automatic:n,regex:r,onWordBoundary:i,visual:o,undoKey:s}){this.mode=t,this.automatic=n,this.regex=r,this.onWordBoundary=i,this.visual=o,this.undoKey=s}static fromSource(t,n){let r=Lt.fromSource(t,n),i=!1,o=!1,s=!1,a=!1,l=!0;for(let c of t)switch(c){case"A":i=!0;break;case"r":o=!0;break;case"w":s=!0;break;case"v":a=!0;break;case"U":l=!1;break}return new e({mode:r,automatic:i,regex:o,onWordBoundary:s,visual:a,undoKey:l})}snippetShouldRunInMode(t,n=!1){return t.snippetlessEnv&&!n?!1:!!((this.mode.inlineMath&&t.inlineMath||this.mode.blockMath&&t.blockMath||(this.mode.inlineMath||this.mode.blockMath)&&t.codeMath)&&t.textEnv===this.mode.textEnv||this.mode.text&&t.text||this.mode.codeBlock===t.codeBlock&&t.codeBlock!==!1||this.mode.codeBlock===!0&&t.codeBlock!==!1||this.mode.code&&t.code)}copy(){return new e(j(A({},this),{mode:this.mode.copy()}))}},Lt=class e{constructor({text:t,inlineMath:n,blockMath:r,codeMath:i,codeBlock:o,code:s,textEnv:a,snippetlessEnv:l}){this.text=t,this.inlineMath=n,this.blockMath=r,this.codeMath=i,this.codeBlock=o,this.code=s,this.textEnv=a,this.snippetlessEnv=l}inEquation(){return this.inlineMath||this.blockMath}inMath(){return this.inlineMath||this.blockMath||this.codeMath}inDisplayMath(){return this.blockMath||this.codeMath}strictlyInMath(){return this.inMath()&&!this.textEnv}invert(){this.text=!this.text,this.blockMath=!this.blockMath,this.inlineMath=!this.inlineMath,this.codeMath=!this.codeMath,this.codeBlock=this.codeBlock===!1,this.code=!this.code,this.textEnv=!this.textEnv,this.snippetlessEnv=!this.snippetlessEnv}static fromSource(t,n){let r=!1,i=!1,o=!1,s=!1,a=!1,l=!1,c=!1,p=!1;for(let O of t)switch(O){case"m":r=!0,i=!0;break;case"n":i=!0;break;case"M":r=!0;break;case"t":o=!0;break;case"T":c=!0;break;case"c":a=!0;break;case"C":l=!0;break}n!==void 0&&(a=n),c&&!(r||i)&&(r=!0,i=!0);let u=new e({text:o,inlineMath:i,blockMath:r,codeMath:s,codeBlock:a,code:l,textEnv:c,snippetlessEnv:p});return u.text||u.inlineMath||u.blockMath||u.codeMath||u.codeBlock!==!1||u.textEnv||u.code||u.invert(),u}copy(){return new e(A({},this))}};var Fe={captures:{match:[],groups:{}}},ve=class{constructor(t,n=[]){this.insert=t;this.tabstops=n}applyInsert(t=Fe){if(typeof this.insert=="string")return{insert:this.insert,tabstops:this.tabstops};let n=this.insert(t);if(typeof n=="string")return{insert:n,tabstops:this.tabstops};let r=0,i=n.map(a=>a.applyInsert(t)).map(({insert:a,tabstops:l})=>{let c=r;return r+=a.length,{insert:a,tabstops:[...l.map(p=>j(A({},p),{from:p.from+c,to:p.to+c})),...this.tabstops.map(p=>j(A({},p),{from:p.from+c,to:p.to+c}))]}}),o=i.map(a=>a.insert).join(""),s=i.flatMap(a=>a.tabstops);return{insert:o,tabstops:s}}},le=class extends ve{constructor(t){super(t)}},qe=class extends ve{constructor(t,n=""){super(n,[{index:[t],from:0,to:n.length}])}},lr=class extends ve{constructor(t,n=""){typeof t=="number"?super(({captures:r})=>{var i;return(i=r.match[t])!=null?i:n}):typeof t=="string"&&super(({captures:r})=>{var i;return(i=r.groups[t])!=null?i:n})}};function wi(e,t){t.sort((i,o)=>i.start-o.start);let n=0,r=[];for(let{start:i,end:o,replacement:s}of t)r.push(e.slice(n,i),s),n=o;return r.join("")+e.slice(n)}var je=class extends ve{constructor(n){super(r=>this.parseSnippet(r.captures));this.snippet=n}parseSnippet(n){let r=this.expandCaptures(n);Line truncated
|
||||||
Erroring snippet:
|
|
||||||
${lr(s)}`}})}catch(i){throw`Invalid snippet format: ${i}`}return n=pr(n),n})}function Li(t){return v(this,null,function*(){let e;try{e=yield import(t)}catch(r){throw`failed to import module ${t}`}if(!("default"in e))throw`No default export provided for module ${t}`;return e.default})}var cl=Ii({trigger:On([Xe(),Wi(RegExp)]),replacement:On([Xe(),Mi(t=>typeof t=="function")]),options:Xe(),flags:ct(Xe(),""),priority:ct(Vi(),0),description:ct(Xe(),"no description provided"),triggerKey:ct(Xe(),""),language:ct(Xe())});function pl(t){if(!Array.isArray(t))throw"Expected snippets to be an array";return t.flat().map(e=>{try{return Gi(cl,e)}catch(r){throw`Value does not resemble snippet.
|
|
||||||
Erroring snippet:
|
|
||||||
${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr.fromSource(t.options,t.language),o,a,l=gn(t.triggerKey);if(s.regex||t.trigger instanceof RegExp){let c,p=t.flags;t.trigger instanceof RegExp?(c=t.trigger.source,p=`${t.trigger.flags}${p}`):c=t.trigger,p=Ol(p),c=Ui(c,e),a=Ni(c),c=`(?:${c})$`,o=new RegExp(c,p),s.regex=!0;let u={trigger:o,replacement:r,options:s,priority:n,description:i,excludedEnvironments:a,triggerKey:l};return new or(u)}else{let c=t.trigger;c=Ui(c,e),a=Ni(c),typeof r=="string"&&r.includes(fn)&&(s.visual=!0);let p={trigger:c,replacement:r,options:s,priority:n,description:i,excludedEnvironments:a,triggerKey:l};return s.visual?new sr(p):new ar(p)}}function Ol(t){let e=["i","m","s","u","v"];return Array.from(new Set(t.split(""))).filter(r=>e.includes(r)).join("")}function Ui(t,e){for(let[r,n]of Object.entries(e))t=t.replaceAll(r,n);return t}function Ni(t){let e=[];return mn.hasOwnProperty(t)&&e.push(...mn[t]),e}function gn(t){return t.split(/ (?!$)/).map(e=>hl(e)).join(" ")}function hl(t){let e=t.split(/-(?!$)/),r=e[e.length-1];r==="Space"&&(r=" ");let n,i,s,o;for(let a=0;a<e.length-1;++a){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Fi.Platform.isMacOS?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),i&&(r="Ctrl-"+r),o&&(r="Meta-"+r),s&&(r="Shift-"+r),r}var dl=(t,e)=>{let r=t.keys(),n=e.keys(),i=[];for(let s of r)e.has(s)||i.push(s);for(let s of n)t.has(s)||i.push(s);return new Set(i)},fl=(t,e)=>{let r=t.keys(),n=[];for(let i of r)e.has(i)&&n.push(i);return new Set(n)},Hi,ml=((Hi=Set.prototype)==null?void 0:Hi.difference)&&((t,e)=>t.difference(e)),Ki,gl=((Ki=Set.prototype)==null?void 0:Ki.intersection)&&((t,e)=>t.intersection(e)),bn=ml||dl,ur=gl||fl;function bl(t,e){let r=t.parent,n=0;for(;r&&!r.isRoot()&&n<100;){if(r.path===e.path)return!0;r=r.parent,n++}return!1}function Or(t,e,r){let n=t.app.vault.getAbstractFileByPath(e);return n instanceof te.TFolder&&bl(r,n)}var yn=(0,te.debounce)(t=>v(void 0,null,function*(){(t.settings.loadSnippetVariablesFromFile||t.settings.loadSnippetsFromFile)&&(yield t.processSettings(!1,!0))}),500,!0),es=(t,e)=>v(void 0,null,function*(){e instanceof te.TFile&&(t.settings.loadSnippetVariablesFromFile&&e.path===t.settings.snippetVariablesFileLocation||t.settings.loadSnippetsFromFile&&e.path===t.settings.snippetsFileLocation||Or(t,t.settings.snippetVariablesFileLocation,e)||Or(t,t.settings.snippetsFileLocation,e))&&yn(t)}),ts=(t,e)=>{e instanceof te.TFile&&(t.settings.loadSnippetVariablesFromFile&&Or(t,t.settings.snippetVariablesFileLocation,e)||t.settings.loadSnippetsFromFile&&Or(t,t.settings.snippetsFileLocation,e))&&yn(t)},rs=(t,e)=>{if(!(e instanceof te.TFile))return;let r=t.app.vault.getAbstractFileByPath(t.settings.snippetVariablesFileLocation),n=t.app.vault.getAbstractFileByPath(t.settings.snippetsFileLocation);(t.settings.loadSnippetVariablesFromFile&&r instanceof te.TFolder&&e.path.contains(r.path)||t.settings.loadSnippetsFromFile&&n instanceof te.TFolder&&e.path.contains(n.path))&&yn(t)};function*ns(t){if(t instanceof te.TFile)yield t;else if(t instanceof te.TFolder)for(let e of t.children)yield*Xi(ns(e))}function Ji(t,e){let r=t.getAbstractFileByPath(e);if(!r)return console.warn(`Could not find file or folder at path ${e}`),new Set;let n=ns(r);return new Set(n)}function is(t){let e=t.settings.loadSnippetVariablesFromFile?Ji(t.app.vault,t.settings.snippetVariablesFileLocation):new Set,r=t.settings.loadSnippetsFromFile?Ji(t.app.vault,t.settings.snippetsFileLocation):new Set,n=bn(e,r),i=bn(r,e),s=ur(e,r);return{definitelyVariableFiles:n,definitelySnippetFiles:i,snippetOrVariableFiles:s}}function ss(t,e){return v(this,null,function*(){let r={};for(let n of e.definitelyVariableFiles){let i=yield t.app.vault.cachedRead(n);try{Object.assign(r,yield ze(i))}catch(s){new te.Notice(`Failed to parse variable file ${n.name}: ${s}`),console.error(`Failed to parse variable file ${n.name}: ${s}`),e.definitelyVariableFiles.delete(n)}}return r})}function os(t,e){return v(this,null,function*(){let r={};for(let n of e.snippetOrVariableFiles){let i=yield t.app.vault.cachedRead(n);try{Object.assign(r,yield ze(i)),e.definitelyVariableFiles.add(n)}catch(s){e.definitelySnippetFiles.add(n)}e.snippetOrVariableFiles.delete(n)}return r})}function as(t,e,r){return v(this,null,function*(){let n=[];for(let i of e.definitelySnippetFiles){let s=yield t.app.vault.cachedRead(i);try{n.push(...yield ut(s,r))}catch(o){new te.Notice(`Failed to parse snippet file ${i.name}: ${o}`),console.error(`Failed to parse snippet file ${i.name}: ${o}`),e.definitelySnippetFiles.delete(i)}}return pr(n)})}var ls=`export default [
|
|
||||||
// Math mode
|
// Math mode
|
||||||
{trigger: "mk", replacement: "$$0$", options: "tA"},
|
// \${}$0{}$ or \${} $0 {}$ is recommended over $$0$ as this avoids the flickering when typing spaces
|
||||||
{trigger: "dm", replacement: "$$\\n\\t$0\\n$$", options: "tAw"},
|
// and also avoids a lag issues when on an empty line and everything below is suddenly display math for a short second.
|
||||||
{trigger: /(?<=\\S.*)dm/, replacement: "\\n$$\\n\\t$0\\n$$", options: "tAw", priority: 1},
|
{trigger: "mk", replacement: "\${}$0{}$", options: "tA"},
|
||||||
|
{trigger: "mk", replacement: "\\\\($0\\\\)", options: "TA"},
|
||||||
|
// display math behaves like codeblocks, as in no text is allowed on the same line of the opening $$ thus a newline is added.
|
||||||
|
{trigger: "dm", replacement: "\\n$$\\n$0\\n$$", options: "tAw", description: "Display Math on empty line"},
|
||||||
|
// the other dm snippets are more advanced thus they are sectioned below in Misc
|
||||||
|
|
||||||
{trigger: /([^\\\\])beg/, replacement: "[[0]]\\\\begin{$0}\\n\\t$1\\n\\\\end{$0}", options: "MA"},
|
{trigger: /([^\\\\\\w])beg/, replacement: "[[0]]\\\\begin{$0}\\n$1\\n\\\\end{$0}", options: "MA"},
|
||||||
{trigger: /([^\\\\])beg/, replacement: "[[0]]\\\\begin{$0} $1 \\\\end{$0}", options: "nA"},
|
{trigger: /([^\\\\\\w])beg/, replacement: "[[0]]\\\\begin{$0} $1 \\\\end{$0}", options: "nA"},
|
||||||
|
|
||||||
// Dashes
|
// Dashes
|
||||||
// {trigger: "--", replacement: "\u2013", options: "tA"},
|
// {trigger: "--", replacement: "\u2013", options: "tA"},
|
||||||
@@ -48,18 +48,20 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "Ome", replacement: "\\\\Omega", options: "mA"},
|
{trigger: "Ome", replacement: "\\\\Omega", options: "mA"},
|
||||||
|
|
||||||
// Text environment
|
// Text environment
|
||||||
{trigger: "text", replacement: "\\\\text{$0}$1", options: "mA"},
|
{trigger: /\\n\\s*\\"/, replacement: "\\n\\\\text{$0 } $1", options: "mrA"}, // Text at the beginning of a line
|
||||||
{trigger: "\\"", replacement: "\\\\text{$0}$1", options: "mA"},
|
{trigger: "text", replacement: "\\\\text{$0}$1", options: "mA", priority: -1},
|
||||||
|
{trigger: "\\"", replacement: "\\\\text{$0}$1", options: "mA", priority: -1},
|
||||||
|
|
||||||
// Basic operations
|
// Basic operations
|
||||||
{trigger: "sr", replacement: "^{2}", options: "mA"},
|
{trigger: "sr", replacement: "^{2}", options: "mA"},
|
||||||
{trigger: "cb", replacement: "^{3}", options: "mA"},
|
{trigger: "cb", replacement: "^{3}", options: "mA"},
|
||||||
{trigger: "rd", replacement: "^{$0}$1", options: "mA"},
|
{trigger: "rd", replacement: "^{$0}$1", options: "mA", description: "Raise to (D)the power of"}, // the \`th\` in the phrase is spoken like a d so rd for short.
|
||||||
{trigger: "_", replacement: "_{$0}$1", options: "mA"},
|
{trigger: "_", replacement: "_{$0}$1", options: "mA"},
|
||||||
{trigger: "sts", replacement: "_\\\\text{$0}", options: "mA"},
|
{trigger: "sts", replacement: "_\\\\text{$0}", options: "mA"},
|
||||||
{trigger: "sq", replacement: "\\\\sqrt{ $0 }$1", options: "mA"},
|
{trigger: "sq", replacement: "\\\\sqrt{ $0 }$1", options: "mA"},
|
||||||
|
{trigger: /(\\d)rt/, replacement: "\\\\sqrt[[[0]]]{ $0 }$1", options: "mA", description: "Nth RooT"},
|
||||||
{trigger: "//", replacement: "\\\\frac{$0}{$1}$2", options: "mA"},
|
{trigger: "//", replacement: "\\\\frac{$0}{$1}$2", options: "mA"},
|
||||||
{trigger: "ee", replacement: "e^{ $0 }$1", options: "mA"},
|
{trigger: /\\bee/, replacement: "e^{ $0 }$1", options: "mA"},
|
||||||
{trigger: "invs", replacement: "^{-1}", options: "mA"},
|
{trigger: "invs", replacement: "^{-1}", options: "mA"},
|
||||||
|
|
||||||
{trigger: /([^\\\\])(exp|log|ln)/, replacement: "[[0]]\\\\[[1]]", options: "rmA"},
|
{trigger: /([^\\\\])(exp|log|ln)/, replacement: "[[0]]\\\\[[1]]", options: "rmA"},
|
||||||
@@ -81,6 +83,8 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "([a-zA-Z])tilde", replacement: "\\\\tilde{[[0]]}", options: "rmA"},
|
{trigger: "([a-zA-Z])tilde", replacement: "\\\\tilde{[[0]]}", options: "rmA"},
|
||||||
{trigger: "([a-zA-Z])und", replacement: "\\\\underline{[[0]]}", options: "rmA"},
|
{trigger: "([a-zA-Z])und", replacement: "\\\\underline{[[0]]}", options: "rmA"},
|
||||||
{trigger: "([a-zA-Z])vec", replacement: "\\\\vec{[[0]]}", options: "rmA"},
|
{trigger: "([a-zA-Z])vec", replacement: "\\\\vec{[[0]]}", options: "rmA"},
|
||||||
|
// \\\\overrightarrow might look better than \\\\vec
|
||||||
|
// {trigger: "([a-zA-Z])vec", replacement: "\\\\overrightarrow{[[0]]}", options: "rmA"},
|
||||||
{trigger: "([a-zA-Z]),\\\\.", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
|
{trigger: "([a-zA-Z]),\\\\.", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
|
||||||
{trigger: "([a-zA-Z])\\\\.,", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
|
{trigger: "([a-zA-Z])\\\\.,", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}),\\\\.", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}),\\\\.", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},
|
||||||
@@ -94,6 +98,7 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "tilde", replacement: "\\\\tilde{$0}$1", options: "mA"},
|
{trigger: "tilde", replacement: "\\\\tilde{$0}$1", options: "mA"},
|
||||||
{trigger: "und", replacement: "\\\\underline{$0}$1", options: "mA"},
|
{trigger: "und", replacement: "\\\\underline{$0}$1", options: "mA"},
|
||||||
{trigger: "vec", replacement: "\\\\vec{$0}$1", options: "mA"},
|
{trigger: "vec", replacement: "\\\\vec{$0}$1", options: "mA"},
|
||||||
|
// {trigger: "vec", replacement: "\\\\overrightarrow{$0}$1", options: "mA"},
|
||||||
{
|
{
|
||||||
trigger: "pmod",
|
trigger: "pmod",
|
||||||
replacement: "\\\\pmod{\${0:n}}$1",
|
replacement: "\\\\pmod{\${0:n}}$1",
|
||||||
@@ -101,14 +106,33 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
description: "Parenthesized modulo (\\\\pmod{n})",
|
description: "Parenthesized modulo (\\\\pmod{n})",
|
||||||
},
|
},
|
||||||
|
|
||||||
// Auto letter subscript
|
// Auto letter subscript and add space after other macros
|
||||||
//
|
//
|
||||||
// x3 -> x_{3}, \\alpha3 -> \\alpha_{3}
|
// - x3 -> x_{3}
|
||||||
|
// - \\alpha3 -> \\alpha_{3}
|
||||||
|
// - \\leq -> \\leq 1
|
||||||
{
|
{
|
||||||
trigger: "(\\\\\\\\\${GREEK}|[A-Za-z])(\\\\d)",
|
trigger: /(\\\\?)([A-Za-z]+)(\\d)/,
|
||||||
replacement: "[[0]]_{[[1]]}",
|
replacement: (match) => {
|
||||||
|
const isMacro = match[1] === "\\\\";
|
||||||
|
const digit = match[3];
|
||||||
|
if (!isMacro) {
|
||||||
|
const variable = match[2];
|
||||||
|
return \`\${variable}_{\${digit}}\`;
|
||||||
|
}
|
||||||
|
const greek = require("latex-suite").snippetVariables["\${GREEK}"];
|
||||||
|
const greek_pattern = new RegExp("^(?:" + greek + ")$");
|
||||||
|
const macro_name = match[2];
|
||||||
|
if (greek_pattern.test(macro_name)) {
|
||||||
|
return \`\\\\\${macro_name}_{\${digit}}\`;
|
||||||
|
} else {
|
||||||
|
return \`\\\\\${macro_name} \${digit}\`;
|
||||||
|
}
|
||||||
|
},
|
||||||
options: "rmA",
|
options: "rmA",
|
||||||
priority: -1,
|
priority: -1,
|
||||||
|
excludedMacros: ["pu", "ce"],
|
||||||
|
description: "Auto letter subscript for variables and greek letters, add space after other macros",
|
||||||
},
|
},
|
||||||
// x_{3}4 -> x_{34}, \\alpha_{3}4 -> \\alpha_{34}
|
// x_{3}4 -> x_{34}, \\alpha_{3}4 -> \\alpha_{34}
|
||||||
{
|
{
|
||||||
@@ -116,33 +140,22 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
replacement: "[[0]]_{[[1]][[2]]}",
|
replacement: "[[0]]_{[[1]][[2]]}",
|
||||||
options: "rmA",
|
options: "rmA",
|
||||||
priority: -1,
|
priority: -1,
|
||||||
|
description: "Combine subscripts for variables and greek letters",
|
||||||
},
|
},
|
||||||
|
|
||||||
// \\dot{x}3 -> \\dot{x}_{3}, \\dot{\\alpha}3 -> \\dot{\\alpha}_{3}
|
// \\dot{x}3 -> \\dot{x}_{3}, \\dot{\\alpha}3 -> \\dot{\\alpha}_{3}
|
||||||
{
|
|
||||||
trigger: "\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}(\\\\d)",
|
|
||||||
replacement: "\\\\[[0]]{[[1]]}_{[[2]]}",
|
|
||||||
options: "rmA",
|
|
||||||
priority: -1,
|
|
||||||
},
|
|
||||||
|
|
||||||
// \\dot{x}_{3}4 -> \\dot{x}_{34}
|
// \\dot{x}_{3}4 -> \\dot{x}_{34}
|
||||||
{
|
{
|
||||||
trigger: "\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}_\\\\{(\\\\d+)\\\\}(\\\\d)",
|
trigger: "\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}(?:_\\\\{(\\\\d+)\\\\})?(\\\\d)",
|
||||||
replacement: "\\\\[[0]]{[[1]]}_{[[2]][[3]]}",
|
replacement: "\\\\[[0]]{[[1]]}_{[[2]][[3]]}",
|
||||||
options: "rmA",
|
options: "rmA",
|
||||||
priority: -1,
|
priority: -1,
|
||||||
},
|
},
|
||||||
|
|
||||||
// \\dot{\\vec{a}}3 -> \\dot{\\vec{a}}_{3}
|
// \\dot{\\vec{a}}3 -> \\dot{\\vec{a}}_{3}
|
||||||
{
|
|
||||||
trigger: "\\\\\\\\(\${ACCENT})\\\\{\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}\\\\}(\\\\d)",
|
|
||||||
replacement: "\\\\[[0]]{\\\\[[1]]{[[2]]}}_{[[3]]}",
|
|
||||||
options: "rmA",
|
|
||||||
priority: -1,
|
|
||||||
},
|
|
||||||
// \\dot{\\vec{a}}_{3}4 -> \\dot{\\vec{a}}_{34}
|
// \\dot{\\vec{a}}_{3}4 -> \\dot{\\vec{a}}_{34}
|
||||||
{
|
{
|
||||||
trigger: "\\\\\\\\(\${ACCENT})\\\\{\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}\\\\}_\\\\{(\\\\d+)\\\\}(\\\\d)",
|
trigger: "\\\\\\\\(\${ACCENT})\\\\{\\\\\\\\(\${ACCENT})\\\\{(\\\\\\\\\${GREEK}|[A-Za-z])\\\\}\\\\}(?:_\\\\{(\\\\d+)\\\\})?(\\\\d)",
|
||||||
replacement: "\\\\[[0]]{\\\\[[1]]{[[2]]}}_{[[3]][[4]]}",
|
replacement: "\\\\[[0]]{\\\\[[1]]{[[2]]}}_{[[3]][[4]]}",
|
||||||
options: "rmA",
|
options: "rmA",
|
||||||
priority: -1,
|
priority: -1,
|
||||||
@@ -172,6 +185,7 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "xx", replacement: "\\\\times", options: "mA"},
|
{trigger: "xx", replacement: "\\\\times", options: "mA"},
|
||||||
{trigger: "**", replacement: "\\\\cdot", options: "mA"},
|
{trigger: "**", replacement: "\\\\cdot", options: "mA"},
|
||||||
{trigger: "para", replacement: "\\\\parallel", options: "mA"},
|
{trigger: "para", replacement: "\\\\parallel", options: "mA"},
|
||||||
|
{trigger: "deg", replacement: "\\\\degree", options: "mA"},
|
||||||
|
|
||||||
{trigger: "===", replacement: "\\\\equiv", options: "mA"},
|
{trigger: "===", replacement: "\\\\equiv", options: "mA"},
|
||||||
{trigger: "!=", replacement: "\\\\neq", options: "mA"},
|
{trigger: "!=", replacement: "\\\\neq", options: "mA"},
|
||||||
@@ -185,12 +199,12 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
|
|
||||||
|
|
||||||
{trigger: "<->", replacement: "\\\\leftrightarrow ", options: "mA"},
|
{trigger: "<->", replacement: "\\\\leftrightarrow ", options: "mA"},
|
||||||
{trigger: "->", replacement: "\\\\to", options: "mA"},
|
{trigger: "->", replacement: "\\\\to", options: "mA", excludedMacros: ["ce"]},
|
||||||
{trigger: "!>", replacement: "\\\\mapsto", options: "mA"},
|
{trigger: "!>", replacement: "\\\\mapsto", options: "mA"},
|
||||||
{trigger: "=>", replacement: "\\\\implies", options: "mA"},
|
{trigger: "=>", replacement: "\\\\implies", options: "mA"},
|
||||||
{trigger: "=<", replacement: "\\\\impliedby", options: "mA"},
|
{trigger: "=<", replacement: "\\\\impliedby", options: "mA"},
|
||||||
|
|
||||||
{trigger: "and", replacement: "\\\\cap", options: "mA"},
|
{trigger: "and", replacement: "\\\\cap", options: "wmA"},
|
||||||
{trigger: "orr", replacement: "\\\\cup", options: "mA"},
|
{trigger: "orr", replacement: "\\\\cup", options: "mA"},
|
||||||
{trigger: "inn", replacement: "\\\\in", options: "mA"},
|
{trigger: "inn", replacement: "\\\\in", options: "mA"},
|
||||||
{trigger: "notin", replacement: "\\\\not\\\\in", options: "mA"},
|
{trigger: "notin", replacement: "\\\\not\\\\in", options: "mA"},
|
||||||
@@ -198,8 +212,8 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "sub=", replacement: "\\\\subseteq", options: "mA"},
|
{trigger: "sub=", replacement: "\\\\subseteq", options: "mA"},
|
||||||
{trigger: "sup=", replacement: "\\\\supseteq", options: "mA"},
|
{trigger: "sup=", replacement: "\\\\supseteq", options: "mA"},
|
||||||
{trigger: "eset", replacement: "\\\\emptyset", options: "mA"},
|
{trigger: "eset", replacement: "\\\\emptyset", options: "mA"},
|
||||||
{trigger: "set", replacement: "\\\\{ $0 \\\\}$1", options: "mA"},
|
{trigger: "set", replacement: "\\\\{ $0 \\\\}$1", options: "wmA"},
|
||||||
{trigger: "e\\\\xi sts", replacement: "\\\\exists", options: "mA", priority: 1},
|
{trigger: /(n?)e\\\\xi sts/, replacement: "\\\\[[0]]exists", options: "mA", priority: 1},
|
||||||
|
|
||||||
{trigger: "LL", replacement: "\\\\mathcal{L}", options: "mA"},
|
{trigger: "LL", replacement: "\\\\mathcal{L}", options: "mA"},
|
||||||
{trigger: "HH", replacement: "\\\\mathcal{H}", options: "mA"},
|
{trigger: "HH", replacement: "\\\\mathcal{H}", options: "mA"},
|
||||||
@@ -207,18 +221,18 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "RR", replacement: "\\\\mathbb{R}", options: "mA"},
|
{trigger: "RR", replacement: "\\\\mathbb{R}", options: "mA"},
|
||||||
{trigger: "ZZ", replacement: "\\\\mathbb{Z}", options: "mA"},
|
{trigger: "ZZ", replacement: "\\\\mathbb{Z}", options: "mA"},
|
||||||
{trigger: "NN", replacement: "\\\\mathbb{N}", options: "mA"},
|
{trigger: "NN", replacement: "\\\\mathbb{N}", options: "mA"},
|
||||||
|
{trigger: "QQ", replacement: "\\\\mathbb{Q}", options: "mA"},
|
||||||
|
|
||||||
// Handle spaces and backslashes
|
// Handle spaces and backslashes
|
||||||
|
|
||||||
// Snippet variables can be used as shortcuts when writing snippets.
|
// Snippet variables can be used as shortcuts when writing snippets.
|
||||||
// For example, \${GREEK} below is shorthand for "alpha|beta|gamma|Gamma|delta|..."
|
// For example, \${GREEK} below is shorthand for "alpha|beta|gamma|Gamma|delta|..."
|
||||||
// You can edit snippet variables under the Advanced snippet settings section.
|
// You can edit snippet variables under the Advanced snippet section.
|
||||||
|
|
||||||
{trigger: "([^\\\\\\\\])(\${GREEK})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before Greek letters"},
|
{trigger: "([^\\\\\\\\])(\${GREEK})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before Greek letters"},
|
||||||
{trigger: "([^\\\\\\\\])(\${SYMBOL})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before symbols"},
|
{trigger: "([^\\\\\\\\])(\${SYMBOL})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before symbols"},
|
||||||
|
|
||||||
// Insert space after Greek letters and symbols
|
|
||||||
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}|\${MORE_SYMBOLS})([A-Za-z])", replacement: "\\\\[[0]] [[1]]", options: "rmA"},
|
|
||||||
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) sr", replacement: "\\\\[[0]]^{2}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) sr", replacement: "\\\\[[0]]^{2}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) cb", replacement: "\\\\[[0]]^{3}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) cb", replacement: "\\\\[[0]]^{3}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) rd", replacement: "\\\\[[0]]^{$0}$1", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}|\${SYMBOL}) rd", replacement: "\\\\[[0]]^{$0}$1", options: "rmA"},
|
||||||
@@ -226,18 +240,22 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "\\\\\\\\(\${GREEK}) dot", replacement: "\\\\dot{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}) dot", replacement: "\\\\dot{\\\\[[0]]}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}) bar", replacement: "\\\\bar{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}) bar", replacement: "\\\\bar{\\\\[[0]]}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}) vec", replacement: "\\\\vec{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}) vec", replacement: "\\\\vec{\\\\[[0]]}", options: "rmA"},
|
||||||
|
// \\\\overrightarrow might look better than \\\\vec
|
||||||
|
// {trigger: "\\\\\\\\(\${GREEK}) vec", replacement: "\\\\overrightarrow{\\\\[[0]]}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}) tilde", replacement: "\\\\tilde{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}) tilde", replacement: "\\\\tilde{\\\\[[0]]}", options: "rmA"},
|
||||||
{trigger: "\\\\\\\\(\${GREEK}) und", replacement: "\\\\underline{\\\\[[0]]}", options: "rmA"},
|
{trigger: "\\\\\\\\(\${GREEK}) und", replacement: "\\\\underline{\\\\[[0]]}", options: "rmA"},
|
||||||
|
|
||||||
|
|
||||||
// Derivatives and integrals
|
// Derivatives and integrals
|
||||||
{trigger: "par", replacement: "\\\\frac{ \\\\partial \${0:y} }{ \\\\partial \${1:x} } $2", options: "m"},
|
{trigger: "par", replacement: "\\\\frac{ \\\\partial \${0:y} }{ \\\\partial \${1:x} } $2", options: "m"},
|
||||||
|
{trigger: /par([0-9])/, replacement: "\\\\frac{ \\\\partial^{[[0]]} \${0:y} }{ \\\\partial \${1:x}^{[[0]]} } $2", options: "mA"},
|
||||||
|
{trigger: /parn/, replacement: "\\\\frac{ \\\\partial^{\${0:n}} \${1:y} }{ \\\\partial \${2:x}^{\${0:n}} } $2", options: "mA"},
|
||||||
{trigger: /pa([A-Za-z])([A-Za-z])/, replacement: "\\\\frac{ \\\\partial [[0]] }{ \\\\partial [[1]] } ", options: "rm"},
|
{trigger: /pa([A-Za-z])([A-Za-z])/, replacement: "\\\\frac{ \\\\partial [[0]] }{ \\\\partial [[1]] } ", options: "rm"},
|
||||||
{trigger: "ddt", replacement: "\\\\frac{d}{dt} ", options: "mA"},
|
{trigger: "ddt", replacement: "\\\\frac{d}{dt} ", options: "mA"},
|
||||||
|
|
||||||
{trigger: /([^\\\\])int/, replacement: "[[0]]\\\\int", options: "mA", priority: -1},
|
{trigger: /([^\\\\])int/, replacement: "[[0]]\\\\int", options: "mA", priority: -1},
|
||||||
{trigger: "\\\\int", replacement: "\\\\int $0 \\\\, d\${1:x} $2", options: "m"},
|
{trigger: "\\\\int", replacement: "\\\\int $0 \\\\, d\${1:x} $2", options: "m"},
|
||||||
{trigger: "dint", replacement: "\\\\int_{\${0:0}}^{\${1:1}} $2 \\\\, d\${3:x} $4", options: "mA"},
|
{trigger: "dint", replacement: "\\\\int_{\${0:0}}^{\${1:1}} $2 \\\\, d\${3:x} $4", options: "mA", description: "Definite integral"},
|
||||||
{trigger: "oint", replacement: "\\\\oint", options: "mA"},
|
{trigger: "oint", replacement: "\\\\oint", options: "mA"},
|
||||||
{trigger: "iint", replacement: "\\\\iint", options: "mA"},
|
{trigger: "iint", replacement: "\\\\iint", options: "mA"},
|
||||||
{trigger: "iiint", replacement: "\\\\iiint", options: "mA"},
|
{trigger: "iiint", replacement: "\\\\iiint", options: "mA"},
|
||||||
@@ -247,15 +265,6 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
|
|
||||||
// Trigonometry
|
// Trigonometry
|
||||||
{trigger: /([^\\\\])(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)/, replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before trig funcs"},
|
{trigger: /([^\\\\])(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)/, replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before trig funcs"},
|
||||||
|
|
||||||
{trigger: /\\\\(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)([A-Za-gi-z])/,
|
|
||||||
replacement: "\\\\[[0]] [[1]]", options: "rmA",
|
|
||||||
description: "Add space after trig funcs. Skips letter h to allow sinh, cosh, etc."},
|
|
||||||
|
|
||||||
{trigger: /\\\\(sinh|cosh|tanh|coth)([A-Za-z])/,
|
|
||||||
replacement: "\\\\[[0]] [[1]]", options: "rmA",
|
|
||||||
description: "Add space after hyperbolic trig funcs"},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
trigger: /(arccsc|arcsec|arccot)/,
|
trigger: /(arccsc|arcsec|arccot)/,
|
||||||
replacement: "\\\\operatorname{[[0]]}$0",
|
replacement: "\\\\operatorname{[[0]]}$0",
|
||||||
@@ -265,12 +274,12 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Visual operations
|
// Visual operations
|
||||||
{trigger: "U", replacement: "\\\\underbrace{ \${VISUAL} }_{ $0 }", options: "mA"},
|
{trigger: "U", replacement: "\\\\underbrace{ \${VISUAL} }_{ $0 }", options: "mv"},
|
||||||
{trigger: "O", replacement: "\\\\overbrace{ \${VISUAL} }^{ $0 }", options: "mA"},
|
{trigger: "O", replacement: "\\\\overbrace{ \${VISUAL} }^{ $0 }", options: "mv"},
|
||||||
{trigger: "B", replacement: "\\\\underset{ $0 }{ \${VISUAL} }", options: "mA"},
|
{trigger: "B", replacement: "\\\\underset{ $0 }{ \${VISUAL} }", options: "mv"},
|
||||||
{trigger: "C", replacement: "\\\\cancel{ \${VISUAL} }", options: "mA"},
|
{trigger: "C", replacement: "\\\\cancel{ \${VISUAL} }", options: "mv"},
|
||||||
{trigger: "K", replacement: "\\\\cancelto{ $0 }{ \${VISUAL} }", options: "mA"},
|
{trigger: "K", replacement: "\\\\cancelto{ $0 }{ \${VISUAL} }", options: "mv"},
|
||||||
{trigger: "S", replacement: "\\\\sqrt{ \${VISUAL} }", options: "mA"},
|
{trigger: "S", replacement: "\\\\sqrt{ \${VISUAL} }", options: "mv"},
|
||||||
|
|
||||||
|
|
||||||
// Physics
|
// Physics
|
||||||
@@ -280,7 +289,7 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
// Quantum mechanics
|
// Quantum mechanics
|
||||||
{trigger: "dag", replacement: "^{\\\\dagger}", options: "mA"},
|
{trigger: "dag", replacement: "^{\\\\dagger}", options: "mA"},
|
||||||
{trigger: "o+", replacement: "\\\\oplus ", options: "mA"},
|
{trigger: "o+", replacement: "\\\\oplus ", options: "mA"},
|
||||||
{trigger: "ox", replacement: "\\\\otimes ", options: "mA"},
|
{trigger: "ox", replacement: "\\\\otimes ", options: "wmA"},
|
||||||
{trigger: "bra", replacement: "\\\\bra{$0} $1", options: "mA"},
|
{trigger: "bra", replacement: "\\\\bra{$0} $1", options: "mA"},
|
||||||
{trigger: "ket", replacement: "\\\\ket{$0} $1", options: "mA"},
|
{trigger: "ket", replacement: "\\\\ket{$0} $1", options: "mA"},
|
||||||
{trigger: "brk", replacement: "\\\\braket{ $0 | $1 } $2", options: "mA"},
|
{trigger: "brk", replacement: "\\\\braket{ $0 | $1 } $2", options: "mA"},
|
||||||
@@ -327,9 +336,9 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
{trigger: "floor", replacement: "\\\\lfloor $0 \\\\rfloor $1", options: "mA"},
|
{trigger: "floor", replacement: "\\\\lfloor $0 \\\\rfloor $1", options: "mA"},
|
||||||
// For the modulo operator, see the section "More operations" above
|
// For the modulo operator, see the section "More operations" above
|
||||||
{trigger: "mod", replacement: "|$0|$1", options: "mA"},
|
{trigger: "mod", replacement: "|$0|$1", options: "mA"},
|
||||||
{trigger: "(", replacement: "(\${VISUAL})", options: "mA"},
|
{trigger: "(", replacement: "(\${VISUAL})", options: "mv"},
|
||||||
{trigger: "[", replacement: "[\${VISUAL}]", options: "mA"},
|
{trigger: "[", replacement: "[\${VISUAL}]", options: "mv"},
|
||||||
{trigger: "{", replacement: "{\${VISUAL}}", options: "mA"},
|
{trigger: "{", replacement: "{\${VISUAL}}", options: "mv"},
|
||||||
{trigger: "(", replacement: "($0)$1", options: "mA"},
|
{trigger: "(", replacement: "($0)$1", options: "mA"},
|
||||||
{trigger: "{", replacement: "{$0}$1", options: "mA"},
|
{trigger: "{", replacement: "{$0}$1", options: "mA"},
|
||||||
{trigger: "[", replacement: "[$0]$1", options: "mA"},
|
{trigger: "[", replacement: "[$0]$1", options: "mA"},
|
||||||
@@ -353,6 +362,52 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
// {trigger: /([A-Za-z]=\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "rtAw"},
|
// {trigger: /([A-Za-z]=\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "rtAw"},
|
||||||
// {trigger: /([A-Za-z]=[A-Za-z][+-]\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "tAw"},
|
// {trigger: /([A-Za-z]=[A-Za-z][+-]\\d+)([\\n\\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "tAw"},
|
||||||
|
|
||||||
|
// Disable automatic snippets while typing macros
|
||||||
|
// This is a catch all rule that may disable other snippets in some cases.
|
||||||
|
// Increase the priority of the snippets that shouldn't be disabled.
|
||||||
|
// {trigger: /(\\\\[A-Za-z]+)/, replacement: "[[0]]$0", options: "mAU", priority: 100, description: "Disable snippets while typing macros"},
|
||||||
|
|
||||||
|
// Disable snippets while typing macros, doesn't insert an undo stop because of the option "U", thus its treated normal typing.
|
||||||
|
// like \\top -> \\top but \\tox -> \\to x as \\tox is not a macro but \\top is.
|
||||||
|
// In order to add your custom macros to the list, you can do require("latex-suite").ALL_MACROS.push("\\\\my_macro") at the top or bottom of this file.
|
||||||
|
// outside this function and array.
|
||||||
|
{
|
||||||
|
trigger: /\\\\[A-Za-z]{2,}/,
|
||||||
|
replacement: function (match) {
|
||||||
|
/** @type {string} */
|
||||||
|
const string = match[0];
|
||||||
|
const trigger = string.slice(1);
|
||||||
|
|
||||||
|
const names = require("latex-suite").ALL_MACROS;
|
||||||
|
if (names.some(name => name.startsWith(string))) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
options: "mAU",
|
||||||
|
priority: 3,
|
||||||
|
description: "Disable snippets while typing macros",
|
||||||
|
},
|
||||||
|
// Add space after macros if not part of another macro
|
||||||
|
{
|
||||||
|
trigger: /\\\\[A-Za-z]{2,}/,
|
||||||
|
replacement: function (match) {
|
||||||
|
/** @type {string} */
|
||||||
|
const string = match[0];
|
||||||
|
const trigger = string.slice(1);
|
||||||
|
|
||||||
|
const names = require("latex-suite").ALL_MACROS;
|
||||||
|
if (!names.some(name => name.startsWith(string))) {
|
||||||
|
const macro = trigger.slice(0, -1);
|
||||||
|
const letter = trigger.slice(-1);
|
||||||
|
return "\\\\" + macro + " " + letter;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
options: "mA",
|
||||||
|
priority: 3,
|
||||||
|
description: "Insert space after macros if not part of another macro",
|
||||||
|
},
|
||||||
|
|
||||||
// Snippet replacements can have placeholders.
|
// Snippet replacements can have placeholders.
|
||||||
{trigger: "tayl", replacement: "\${0:f}(\${1:x} + \${2:h}) = \${0:f}(\${1:x}) + \${0:f}'(\${1:x})\${2:h} + \${0:f}''(\${1:x}) \\\\frac{\${2:h}^{2}}{2!} + \\\\dots$3", options: "mA", description: "Taylor expansion"},
|
{trigger: "tayl", replacement: "\${0:f}(\${1:x} + \${2:h}) = \${0:f}(\${1:x}) + \${0:f}'(\${1:x})\${2:h} + \${0:f}''(\${1:x}) \\\\frac{\${2:h}^{2}}{2!} + \\\\dots$3", options: "mA", description: "Taylor expansion"},
|
||||||
@@ -374,64 +429,100 @@ ${lr(e)}`}})}function ul(t,e){let{replacement:r,priority:n,description:i}=t,s=cr
|
|||||||
output = \`\\\\begin{pmatrix}\\n\${output}\\n\\\\end{pmatrix}\`;
|
output = \`\\\\begin{pmatrix}\\n\${output}\\n\\\\end{pmatrix}\`;
|
||||||
return output;
|
return output;
|
||||||
}, options: "mA", description: "N x N identity matrix"},
|
}, options: "mA", description: "N x N identity matrix"},
|
||||||
|
// start with the correct indentation of 3 spaces when typing at the start of a list.
|
||||||
{
|
{
|
||||||
trigger: /(?<=(?:\\n|^)[ \\t]*>*)(?<marker>\\d+[.)]|[-*+])(?<whitespace>[ \\t]+)(?<text>.*)dm/,
|
trigger: /(?<positive_lookbehind>(?:\\n|^)[ \\t]*>*)(?<marker>\\d+[.)]|[-*+])(?<whitespace>[ \\t]+)(?<text>.*)dm/,
|
||||||
replacement: (m) => {
|
replacement: (m) => {
|
||||||
const { whitespace, text, marker } = m.groups;
|
const { positive_lookbehind, whitespace, text, marker } = m.groups;
|
||||||
const firstLine = marker + whitespace + text;
|
const firstLine = marker + whitespace + text;
|
||||||
const indent = " ".repeat(marker.length) + whitespace;
|
const indent = " ".repeat(marker.length) + whitespace;
|
||||||
return \`\${firstLine}\\n\${indent}$$\\n\${indent}\\t$0\\n\${indent}$$\`;
|
return \`\${positive_lookbehind}\${firstLine}\\n\${indent}$$\\n\${indent}$0\\n\${indent}$$\`;
|
||||||
},
|
},
|
||||||
options: "rtA",
|
options: "rtA",
|
||||||
priority: 2,
|
priority: 2,
|
||||||
description: "Display math when in a list"
|
description: "Display math when in a list"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// positive lookbehind is not available on ios <16.4 and inline flags like (?m:$) are not since ios <26, using this as a workaround.
|
||||||
|
// otherwise the regex would be /(?<=\\n|^)([ \\t]*(?:> ?)*[ \\t])*dm/
|
||||||
|
// or /(?m:^)([ \\t]*(?:> ?)*[ \\t])*dm/
|
||||||
|
trigger: new (class extends RegExp {
|
||||||
|
exec(source) {
|
||||||
|
const result = super.exec(source);
|
||||||
|
if (result === null) return result;
|
||||||
|
result
|
||||||
|
return /([ \\t]*(?:> ?)*[ \\t]*)dm$/.exec(source);
|
||||||
|
}
|
||||||
|
})(/(\\n|^)[ \\t]*(?:> ?)*[ \\t]*dm/.source),
|
||||||
|
replacement: "[[0]]$$\\n$0\\n$$",
|
||||||
|
options: "tAw",
|
||||||
|
description: "Display Math on empty line",
|
||||||
|
priority: 2,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
`;var At=ls;var cs=`export default {
|
`;var bn=Ga;var Ha=`export default {
|
||||||
"\${GREEK}": "(?:alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|vartheta|Theta|iota|kappa|lambda|Lambda|mu|nu|xi|omicron|pi|rho|varrho|sigma|Sigma|tau|upsilon|Upsilon|phi|varphi|Phi|chi|psi|omega|Omega)",
|
"\${GREEK}": "(?:alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|vartheta|Theta|iota|kappa|lambda|Lambda|mu|nu|xi|omicron|pi|rho|varrho|sigma|Sigma|tau|upsilon|Upsilon|phi|varphi|Phi|chi|psi|omega|Omega)",
|
||||||
"\${SYMBOL}": "(?:parallel|perp|partial|nabla|hbar|ell|infty|oplus|ominus|otimes|oslash|square|star|dagger|vee|wedge|subseteq|subset|supseteq|supset|emptyset|exists|nexists|forall|implies|impliedby|iff|setminus|neg|lor|land|bigcup|bigcap|cdot|times|simeq|approx)",
|
"\${SYMBOL}": "(?:parallel|perp|partial|nabla|hbar|ell|infty|oplus|ominus|otimes|oslash|square|star|dagger|vee|wedge|subseteq|subset|supseteq|supset|emptyset|exists|nexists|forall|implies|impliedby|iff|setminus|neg|lor|land|bigcup|bigcap|cdot|times|simeq|approx)",
|
||||||
"\${MORE_SYMBOLS}": "(?:leq|geq|neq|gg|ll|equiv|sim|propto|rightarrow|leftarrow|Rightarrow|Leftarrow|leftrightarrow|to|mapsto|cap|cup|in|sum|prod|exp|ln|log|det|dots|vdots|ddots|pm|mp|int|iint|iiint|oint)",
|
"\${MORE_SYMBOLS}": "(?:leq|geq|neq|gg|ll|equiv|sim|propto|rightarrow|leftarrow|Rightarrow|Leftarrow|leftrightarrow|to|top|mapsto|cap|cup|in|sum|prod|exp|ln|log|det|dots|vdots|ddots|pm|mp|int|iint|iiint|oint)",
|
||||||
"\${ACCENT}": "(?:dot|ddot|hat|bar|tilde|vec|underline|overline|mathbf|mathcal|mathrm|mathbb)",
|
"\${ACCENT}": "(?:dot|ddot|hat|bar|tilde|vec|underline|overline|mathbf|mathcal|mathrm|mathbb)",
|
||||||
}
|
}
|
||||||
`;var ps=cs;var W={snippets:At,snippetVariables:ps,snippetsEnabled:!0,snippetsTrigger:"Tab",snippetNextTabstopTrigger:"Tab",snippetPreviousTabstopTrigger:"Shift-Tab",suppressSnippetTriggerOnIME:!0,suppressIMEWarning:!1,removeSnippetWhitespace:!0,autoDelete$:!0,loadSnippetsFromFile:!1,loadSnippetVariablesFromFile:!1,snippetsFileLocation:"",snippetVariablesFileLocation:"",concealEnabled:!1,concealRevealTimeout:0,colorPairedBracketsEnabled:!0,highlightCursorBracketsEnabled:!0,mathPreviewEnabled:!0,mathPreviewPositionIsAbove:!0,mathPreviewCursor:"\u25B6",mathPreviewBracketHighlighting:!1,autofractionEnabled:!0,autofractionSymbol:"\\frac",autofractionBreakingChars:"+-= ",matrixShortcutsEnabled:!0,taboutEnabled:!0,taboutTrigger:"Tab",autoEnlargeBrackets:!0,wordDelimiters:"., +-\\n :;!?\\/{}[]()=~$'\"|`<>*^%#@&",autofractionExcludedEnvs:`[
|
`;var Ba=Ha;var q={snippets:bn,snippetVariables:Ba,snippetsEnabled:!0,snippetsTrigger:"Tab",snippetNextTabstopTrigger:"Tab",snippetPreviousTabstopTrigger:"Shift-Tab",suppressSnippetTriggerOnIME:!0,suppressIMEWarning:!1,removeSnippetWhitespace:!0,autoDelete$:!0,loadSnippetsFromFile:!1,loadSnippetVariablesFromFile:!1,snippetsFileLocation:"",snippetVariablesFileLocation:"",concealEnabled:!1,concealRevealTimeout:0,colorPairedBracketsEnabled:!0,highlightCursorBracketsEnabled:!0,mathPreviewEnabled:!0,mathPreviewPositionIsAbove:!0,mathPreviewCursor:"\u25B6",mathPreviewBracketHighlighting:!1,mathPreviewLivePreviewDisplay:!1,autofractionEnabled:!0,autofractionSymbol:"\\frac",autofractionBreakingChars:"+-= ",matrixShortcutsEnabled:!0,taboutEnabled:!0,taboutExitEquationOnlyOnEOL:!0,taboutTrigger:"Tab",autoEnlargeBrackets:!0,autoEnlargeBracketsSpace:!0,wordDelimiters:"., +-\\n :;!?\\/{}[]()=~$'\"|`<>*^%#@&",autofractionExcludedEnvs:`[
|
||||||
["^{", "}"],
|
["^{", "}"],
|
||||||
["\\\\pu{", "}"]
|
["\\\\pu{", "}"]
|
||||||
]`,matrixShortcutsEnvNames:"pmatrix, cases, align, gather, bmatrix, Bmatrix, vmatrix, Vmatrix, array, matrix",taboutClosingSymbols:"), ], \\rbrack, \\}, \\rbrace, \\rangle, \\rvert, \\rVert, \\rfloor, \\rceil, \\urcorner, }",autoEnlargeBracketsTriggers:"sum, int, frac, prod, bigcup, bigcap",forceMathLanguages:"math",snippetDebug:"off",vimEnabled:!1,vimSelectMode:"<C-g>",vimVisualMode:"<C-g>",vimMatrixEnter:"o"};function qt(t,e){function r(i){return i.replace(/\s/g,"").split(",")}function n(i){let s=[];try{s=JSON.parse(i).map(function(a){return{openSymbol:a[0],closeSymbol:a[1]}})}catch(o){console.error(o)}return s}return ye(oe({},e),{snippets:t,autofractionExcludedEnvs:n(e.autofractionExcludedEnvs),matrixShortcutsEnvNames:r(e.matrixShortcutsEnvNames),taboutClosingSymbols:new Set(r(e.taboutClosingSymbols)),autoEnlargeBracketsTriggers:r(e.autoEnlargeBracketsTriggers).map(i=>/[A-Za-z]+/.test(i)?`\\${i}`:i),forceMathLanguages:r(e.forceMathLanguages)})}var Ur=require("@codemirror/state"),gi=require("@codemirror/view"),w=require("obsidian");var As=require("obsidian");var V="top",U="bottom",D="right",M="left",hr="auto",We=[V,U,D,M],_e="start",Le="end",us="clippingParents",dr="viewport",Ot="popper",Os="reference",xn=We.reduce(function(t,e){return t.concat([e+"-"+_e,e+"-"+Le])},[]),fr=[].concat(We,[hr]).reduce(function(t,e){return t.concat([e,e+"-"+_e,e+"-"+Le])},[]),Ql="beforeRead",Sl="read",$l="afterRead",vl="beforeMain",Tl="main",wl="afterMain",kl="beforeWrite",Pl="write",El="afterWrite",hs=[Ql,Sl,$l,vl,Tl,wl,kl,Pl,El];function F(t){return t?(t.nodeName||"").toLowerCase():null}function G(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Te(t){var e=G(t).Element;return t instanceof e||t instanceof Element}function N(t){var e=G(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ht(t){if(typeof ShadowRoot=="undefined")return!1;var e=G(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function _l(t){var e=t.state;Object.keys(e.elements).forEach(function(r){var n=e.styles[r]||{},i=e.attributes[r]||{},s=e.elements[r];!N(s)||!F(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Cl(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:r[n]),a=o.reduce(function(l,c){return l[c]="",l},{});!N(i)||!F(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}var ds={name:"applyStyles",enabled:!0,phase:"write",fn:_l,effect:Cl,requires:["computeStyles"]};function Y(t){return t.split("-")[0]}var xe=Math.max,Ue=Math.min,Ce=Math.round;function Oe(t,e){e===void 0&&(e=!1);var r=t.getBoundingClientRect(),n=1,i=1;if(N(t)&&e){var s=t.offsetHeight,o=t.offsetWidth;o>0&&(n=Ce(r.width)/o||1),s>0&&(i=Ce(r.height)/s||1)}return{width:r.width/n,height:r.height/i,top:r.top/i,right:r.right/n,bottom:r.bottom/i,left:r.left/n,x:r.left/n,y:r.top/i}}function Ne(t){var e=Oe(t),r=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:n}}function jt(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&ht(r)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function re(t){return G(t).getComputedStyle(t)}function Qn(t){return["table","td","th"].indexOf(F(t))>=0}function K(t){return((Te(t)?t.ownerDocument:t.document)||window.document).documentElement}function Re(t){return F(t)==="html"?t:t.assignedSlot||t.parentNode||(ht(t)?t.host:null)||K(t)}function fs(t){return!N(t)||re(t).position==="fixed"?null:t.offsetParent}function Rl(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,r=navigator.userAgent.indexOf("Trident")!==-1;if(r&&N(t)){var n=re(t);if(n.position==="fixed")return null}var i=Re(t);for(ht(i)&&(i=i.host);N(i)&&["html","body"].indexOf(F(i))<0;){var s=re(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Qe(t){for(var e=G(t),r=fs(t);r&&Qn(r)&&re(r).position==="static";)r=fs(r);return r&&(F(r)==="html"||F(r)==="body"&&re(r).position==="static")?e:r||Rl(t)||e}function Fe(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ye(t,e,r){return xe(t,Ue(e,r))}function ms(t,e,r){var n=Ye(t,e,r);return n>r?r:n}function Zt(){return{top:0,right:0,bottom:0,left:0}}function Xt(t){return Object.assign({},Zt(),t)}functio
Line truncated
|
]`,matrixShortcutsEnvNames:"pmatrix, cases, align, gather, bmatrix, Bmatrix, vmatrix, Vmatrix, array, matrix",matrixShortcutsMacroNames:"eqalign",taboutClosingSymbols:"), ], \\rbrack, \\}, \\rbrace, \\rangle, \\rvert, \\rVert, \\rfloor, \\rceil, \\urcorner, }",autoEnlargeBracketsTriggers:"sum, int, frac, prod, bigcup, bigcap",forceMathLanguages:"math",snippetDebug:"off",vimEnabled:!1,vimSelectMode:"<C-g>",vimVisualMode:"<C-g>",vimMatrixEnter:"o",snippetRecursion:0,snippetIMEVersion:!1,highlightDollarEnabled:!0,excalidrawSupportEnabled:!0,logLevel:"off",autofractionTrigger:"/",matrixShortcutsCellTrigger:"Tab",matrixShortcutsNewlineTrigger:"Enter",matrixShortcutsExitTrigger:"Shift-Enter"},Li=Vt(H(),qi(),Re(Wi([H(),H()],"Every item needs to be an array with 2 items"),"Needs to be an array [item1,item2]"),mn(([e,t])=>({openSymbol:e,closeSymbol:t})));function vn(e,t){function n(o){return o.replace(/\s/g,"").split(",")}function r(o){let s=[];try{s=rt(Li,o)}catch(a){console.error(a)}return s}let i={automatic:e.filter(o=>o.options.automatic),all:e};return j(A({},t),{snippets:i,autofractionExcludedEnvs:r(t.autofractionExcludedEnvs),matrixShortcutsEnvNames:n(t.matrixShortcutsEnvNames),matrixShortcutsMacroNames:n(t.matrixShortcutsMacroNames),taboutClosingSymbols:new Set(n(t.taboutClosingSymbols)),autoEnlargeBracketsTriggers:n(t.autoEnlargeBracketsTriggers).map(o=>/[A-Za-z]+/.test(o)?`\\${o}`:o),forceMathLanguages:n(t.forceMathLanguages)})}function De(e,t){if(e==="off")return!1;let n=Na(e);return Na(t)<=n}function Na(e){switch(e){case"off":return 0;case"info":return 1;case"verbose":return 2;case"vverbose":return 3}}var Fa=za.Facet.define({combine:e=>{var n;return(n=e[0])!=null?n:vn([],q)}});function W(e){return(e instanceof Ua.EditorView?e.state:e).facet(Fa)}function Ya(e){return Fa.of(e)}var xs=require("@codemirror/language");var Iu=hn({name:H(),arguments:Qe(Re(fn()))}),Di=Vt(Qe(Re(Ye([H(),Iu])),[]),mn(e=>typeof e=="string"?{name:e,arguments:[0]}:e)),Gu=[{name:"text",arguments:[0]},{name:"textrm",arguments:[0]},{name:"textup",arguments:[0]},{name:"textit",arguments:[0]},{name:"textbf",arguments:[0]},{name:"textsf",arguments:[0]},{name:"texttt",arguments:[0]},{name:"textnormal",arguments:[0]},{name:"clap",arguments:[0]},{name:"textllap",arguments:[0]},{name:"textrlap",arguments:[0]},{name:"textclap",arguments:[0]},{name:"hbox",arguments:[0]},{name:"mbox",arguments:[0]},{name:"fbox",arguments:[0]},{name:"framebox",arguments:[0]},{name:"colorbox",arguments:[1]},{name:"fcolorbox",arguments:[2]}],Vi=[{name:"tag",arguments:[0]},{name:"begin",arguments:[0]},{name:"end",arguments:[0]},{name:"mmlToken",arguments:[0,1]},{name:"unicode",arguments:[0]},{name:"textcolor",arguments:[0]},{name:"color",arguments:[0]},{name:"colorbox",arguments:[0]},{name:"fcolorbox",arguments:[0,1]},{name:"operatorname",arguments:[0]},{name:"style",arguments:[0]}],Ka=[...Gu,...Vi],Hu=["label","ref","eqref","operatorname","operatorname*","DeclareMathOperator","DeclareMathOperator*","mathrm","mathup","mathnormal","mathbf","mathbfup","mathit","mathbfit","mathbb","Bbb","mathfrak","mathbffrak","mathscr","mathbfscr","mathsf","mathsfup","mathbfsf","mathbfsfup","mathsfit","mathbfsfit","mathtt","mathcal","mathbfcal","symrm","symup","symnormal","symbf","symbfup","symit","symbfit","symbb","symfrak","symbffrak","symscr","symbfscr","symsf","symsfup","symbfsf","symbfsfup","symsfit","symbfsfit","symtt","symcal","symbfcal","Bbb"],Ag=`[${Hu.map(e=>`
|
||||||
|
["${e}", "}"]`).join("")}
|
||||||
|
]`;var tc=require("@codemirror/view");var vy=require("@codemirror/state");var Nt=require("@codemirror/language"),xr=require("@codemirror/state"),Sr=require("@codemirror/view"),ay=require("@lezer/common");var Os=require("@lezer/common");var hl=require("@lezer/lr");var xt=require("@lezer/lr");var pr={aleph:"\u2135",amalg:"\u2A3F",And:"&",angle:"\u2220",approx:"\u2248",approxeq:"\u224A",ast:"\u2217",asymp:"\u224D",backepsilon:"\u220D",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",backslash:"\u2216",barwedge:"\u22BC",Bbbk:"k",because:"\u2235",beth:"\u2136",between:"\u226C",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",blacklozenge:"\u29EB",blacksquare:"\u25FC",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",bot:"\u22A5",bowtie:"\u22C8",Box:"\u25FB",boxdot:"\u22A1",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",bullet:"\u2219",bumpeq:"\u224F",Bumpeq:"\u224E",Cap:"\u22D2",cap:"\u2229",cdot:"\u22C5",cdotp:"\u22C5",cdots:"\u22EF",celsius:"\u2103",centerdot:"\u22C5",checkmark:"\u2713",circ:"\u2218",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",circledR:"\xAE",circledS:"\u24C8",clubsuit:"\u2663",complement:"\u2201",cong:"\u2245",coprod:"\u2210",copyright:"\xA9",cp:"\xD7",cross:"\xD7",crossproduct:"\xD7",Cup:"\u22D3",cup:"\u222A",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",dagger:"\u2020",daleth:"\u2138",dashleftarrow:"\u21E0",dashrightarrow:"\u21E2",dashv:"\u22A3",ddagger:"\u2021",ddots:"\u22F1",degree:"\xB0",diagdown:"\u2572",diagup:"\u2571",Diamond:"\u25CA",diamond:"\u22C4",diamondsuit:"\u2662",digamma:"\u03DD",div:"\xF7",divideontimes:"\u22C7",divsymbol:"\xF7",Doteq:"\u2251",doteq:"\u2250",doteqdot:"\u2251",dotplus:"\u2214",dotproduct:"\u22C5",dots:"\u2026",dotsb:"\u22EF",dotsc:"\u2026",dotsi:"\u22EF",dotsm:"\u22EF",dotso:"\u2026",doublebarwedge:"\u2A5E",doublecap:"\u22D2",doublecup:"\u22D3",downarrow:"\u2193",Downarrow:"\u21D3",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",ell:"\u2113",emptyset:"\u2205",eqcirc:"\u2256",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",equiv:"\u2261",eth:"\xF0",exists:"\u2203",fallingdotseq:"\u2252",Finv:"\u2132",flat:"\u266D",forall:"\u2200",frown:"\u2322",Game:"\u2141",ge:"\u2265",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",gets:"\u2190",gg:"\u226B",ggg:"\u22D9",gggtr:"\u22D9",gimel:"\u2137",gnapprox:"\u2A8A",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gradientnabla:"\u2207",gt:">",gtrapprox:"\u2A86",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269",hbar:"\u210F",heartsuit:"\u2661",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hslash:"\u210F",iff:"\u21D4",iiiint:"\u2A0C",iiint:"\u222D",iint:"\u222C",Im:"\u2111",imaginary:"\u2111",imath:"\u0131",in:"\u2208",infty:"\u221E",injlim:"inj lim",int:"\u222B",intercal:"\u22BA",intop:"\u222B",jmath:"\u0237",Join:"\u22C8",land:"\u2227",ldotp:".",ldots:"\u2026",le:"\u2264",leadsto:"\u21DD",left:"",Leftarrow:"\u21D0",leftarrow:"\u2190",leftarrowtail:"\u21A2",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",leftthreetimes:"\u22CB",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",lessgtr:"\u2276",lesssim:"\u2272",lhd:"\u22B2",ll:"\u226A",Lleftarrow:"\u21DA",lll:"\u22D8",llless:"\u22D8",lnapprox:"\u2A89",lneq:"\u2A87",lneqq:"\u2268",lnot:"\xAC",lnsim:"\u22E6",longleftarrow:"\u27F5",Longleftarrow:"\u27F8",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",Longrightarrow:"\u27F9",looparrowleft:"\u21AB",looparrowright:"\u21AC",lor:"\u2228",lozenge:"\u25CA",Lsh:"\u21B0",lt:"<",ltimes:"\u22C9",lvertneqq:"\u2268",maltese:"\u2720",mapsto:"\u21A6",measuredangle:"\u2221",mho:"\u2127",micro:"\xB5",mid:"\u2223",middle:"",models:"\u22A8",mp:"\u2213",multimap:"\u22B8",nabla:"\u2207",natural:"\u266E",ncong:"\u2247",ne:"\u2260",nearrow:"\u2197",neg:"\xAC",neq:"\u2260",neqslant:"\u2260",nexists:"\u2204",ngeq:"\u2271",ngeqq:"\u2271",ngeqslant:"\u2A88",ngtr:"\u226F",ni:"\u220B",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2270",nleqslant:"\u2A87",nless:"\u226E",nmid:"\u2224",notChar:"\u29F8",notin:"\u2209",nparallel:"\u2226",nprec:"\u2280",npreceq:"\u22E0",nrightarrow:"\u219B",nRightarrow:"\u21CF",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsubseteq:"\u2288",nsubseteqq:"\u2288",nsucc:"\u2281",nsuc
Line truncated
|
||||||
|
`),Ol=e=>new xt.ExternalTokenizer(t=>{for(let n=0;n<GO;++n){let r=t.peek(n);if(r===YO||r===FO)continue;let i=e(r);if(i){t.acceptToken(i);return}}},{contextual:!1,fallback:!0}),dl=Ol(e=>e===ul?188:189),ml=Ol(e=>e===ul||e===UO?190:191),JO=it("@"),fl=new xt.ExternalTokenizer((e,t)=>{let n=0,r=-1,i=e.peek(n);if(i!==-1&&i===NO){for(n++;;){let o=e.peek(n);if(o===-1||!(BO(o)||o===JO)){r=n-1;break}r=n,n++}if(r!==-1)return e.acceptToken(3,r+1)}}),ed=new Set(["\\eqref"]),td=new Set(["\\ref"]),nd=new Set(["\\label"]),rd=new Set(["\\text","\\tag","\\textrm"]),id={"\\href":10,"\\verb":11,"\\def":12,"\\let":13,"\\left":14,"\\right":15,"\\newcommand":16,"\\renewcommand":17,"\\newenvironment":18,"\\renewenvironment":19,"\\textcolor":20,"\\hline":21,"\\toprule":22,"\\midrule":23,"\\bottomrule":24,"\\emph":25,"\\underline":26},od={"\\text":28,"\\textrm":29,"\\textup":30,"\\textit":31,"\\textbf":32,"\\textsf":33,"\\texttt":34,"\\textnormal":35,"\\clap":36,"\\textllap":37,"\\textrlap":38,"\\textclap":36,"\\hbox":39,"\\mbox":40,"\\fbox":41,"\\framebox":42,"\\colorbox":43,"\\fcolorbox":44},Ho=(e,t)=>{if(e==="\\begin")return 4;if(e==="\\end")return 5;if(ed.has(e))return 6;if(td.has(e))return 7;if(nd.has(e))return 8;if(rd.has(e))return 9;let n=od[e];if(n!==void 0)return n;let r=id[e];if(r!==void 0)return r;let i=e.slice(1);return(pr[i]||Ht[i])!==void 0?27:-1},sd=new Set(["equation","equation*","displaymath","math","multline","multline*","matrix"]),ad=new Set(["array","eqnarray","eqnarray*","align","align*","alignat","alignat*","flalign","flalign*","gather","gather*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*","smallmatrix","smallmatrix*","split","gathered","aligned","alignedat","cases","cases*","dcases","dcases*","rcases","rcases*"]),Bo=(e,t)=>sd.has(e)?45:ad.has(e)?46:-1,ld={"\\(":47,"\\)":48,"\\[":49,"\\]":50,"\\\\":51},No=(e,t)=>ld[e]||-1;var St=hl.LRParser.deserialize({version:14,states:"!?pOVQWOOO$kQWO'#DuO$pQWO'#DtO$pQWO'#EOOOQO'#Ds'#DsOVQWO'#ESO(cQ#|O'#EoOOQ#t'#En'#EnO(yQWO'#FOO(yQWO'#FPO(yQWO'#FQO(yQWO'#FRO)OQWO'#FSO(yQWO'#FTO(yQWO'#FUO(yQWO'#FVO(yQWO'#FWO(yQWO'#FXO(yQWO'#FYO(yQWO'#FZO(yQWO'#F[O(yQWO'#F]O(yQWO'#F^O(yQWO'#F_OOQ#t'#Gw'#GwO)WQWO'#DgO)`QWO'#FjO)hQWO'#FkO)pQXO'#FlO)uQWO'#FmO)}QWO'#FnO*YQ`O'#FnO*hQ[O'#FoO*sQ[O'#FpO*xQ[O'#FqO+TQ[O'#FrO+`QWO'#FsO+hQ[O'#FtO+sQ`O'#FuO,OQWO'#FvO/vQWO'#FwO/vQWO'#FxOOQO'#Fy'#FyOOQO'#Df'#DfO2rQ#|O'#GxOOQO'#Gx'#GxOOQO'#Fz'#FzOOQO'#De'#DeO2zQWO'#F{O5eQpO'#F}O5lQWO'#F|OOQO'#GS'#GSO5sQWO'#DdQOQWOOO6ZQ`O'#EUO6iQWO,5:aO:QQWO,5:kO=iQWO,5:oOOQO'#D|'#D|O@}QWO,5:`OASQWO,5:jOOQO'#EW'#EWOAXQWO,5:nODrQ!bO'#DwOOQ#t,5;Z,5;ZODyQ!bO'#DoOOQ#t,5;j,5;jOOQ#t,5;k,5;kOOQ#t,5;l,5;lOOQ#t,5;m,5;mOOQ#t,5;n,5;nO(yQWO,5;nOOQ#t,5;o,5;oOOQ#t,5;p,5;pOOQ#t,5;q,5;qOOQ#t,5;r,5;rOOQ#t,5;s,5;sOOQ#t,5;t,5;tOOQ#t,5;u,5;uOOQ#t,5;v,5;vOOQ#t,5;w,5;wOOQ#t,5;x,5;xOOQ#t,5;y,5;yOHqQ!bO'#DiOLcQWO,5:RO)ZQWO,5:ROLjQWO,5<UO)ZQWO,5<UOLqQYO'#E]O)ZQWO,5<VO)kQWO,5<VOOQO,5<W,5<WOOQ#t'#E`'#E`OOQO,5<X,5<XO)ZQWO,5<XOOQ#t'#Eb'#EbOOQO,5<Y,5<YOLvQWO,5<YOLvQWO,5<YOMRQWO,5<YOM^Q`O,5<ZOMoQ[O,5<ZOMwQdO,5<[ONSQWO,5<]ONbQYO,5<]ONgQ[O,5<]ONSQWO,5<^ONoQYO,5<^ONtQ[O,5<^ON|QYO,5<_O! RQWO,5<_ONSQWO,5<`O! WQYO,5<`O! ]Q[O,5<`OOQO,5<a,5<aO(yQWO,5<aO! eQ`O,5<aOOQO,5<b,5<bO! mQWO'#DnO! uQWO'#EZO! }QWO'#E[O!!VQXO'#E^O!![QWO'#E_O!!dQWO'#EaO!!oQ`O'#EaO!!}Q[O'#EcO!#YQ[O'#EuO!#_Q[O'#EvO!#jQ[O'#EwO!#uQWO'#ExO!#}Q[O'#EyO!$YQ`O'#EzO!(PQ#|O'#E{O(yQWO'#E|O(yQWO'#E}OOQ#t'#F`'#F`OOQ#t'#Dm'#DmO!+xQWO'#FaOOQ#t'#Fa'#FaOOQ#t'#Dl'#DlO!,cQWO'#FhOOQ#t'#Fh'#FhOOQO,5<c,5<cOOQO,5<d,5<dO!/fQWO'#G^O!/mQ#|O,5=dOOQO,5=d,5=dOOQO,5<g,5<gO!/uQWO,5<gOOQO'#GO'#GOO!/zQ`O'#GOOOQO,5<i,5<iO3RQpO,5<iO!0PQpO'#GPOOQO,5<h,5<hO!0WQWO,5<hOOQO-E:Q-E:QO!0]QWO,5:bO!0bQWO,5:lOOQO,5:p,5:pO!0gQWO,5:pOOQO'#GW'#GWO!0lQWO1G/{O!0lQWO1G/{O!4TQWO1G0VO!4TQWO1G0VO!7lQWO1G0ZO!7lQWO1G0ZO!;QQWO'#D}OOQO1G/z1G/zO!;VQWO'#EROOQO1G0U1G0UO!;[QWO'#EXOOQO1G0Y1G0YO!;aQ!bO'#DzOOQO'#GV'#GVO!;hQ!bO'#DyO!;rQWO,5:cO!;wQ!bO'#EoO!<eQ!bO'#E{O!@mQ!bO'#FaO!@tQWO'#FbOOQO'#Fe'#FeO!@{QWO'#FdOOQO'#Gf'#GfODyQ!bO'#DqOOQO'#GU'#GUO!DeQ!bO'#DpO!EOQWO,5:ZOOQO'#Ge'#GeOOQ#t1G1Y1G1YOHqQ!bO'#FgOOQO'#GT'#GTO!ETQ!bO'#DkO!EhQWO,5:TOOQO1G/m1G/mO/vQWO1G/mO!EmQWO1G/mOOQO1G1p1G1pO/vQWO1G1pO!EtQWO1G1pO!E{QWO,5:wOOQO1G1q1G1qO)ZQWO1G1qOOQO1G1s1G1sOOQO1G1t1G1tO!FQQWO1G1tO!FYQWO1G1tO!FeQWO1G1tO!FeQWO1G1tO!FpQ`O'#EeOMjQ`O'#EfOOQO'#GX'#GXO!G_Q`O1G1uO!G_Q`O1G1uO!GpQWO'#EgO!KyQ!bO'#EgO!GpQWO'#EgOOQO1G1u1G1uO!LQQ`O1G1uOOQO1G1v1G1vO!LcQ[O1G1vO!LkQdO1G1vOOQO'#GY'#GYO!LvQWO'#GvOOQO1G1w1G1wO!MUQWO1G1wO!MaQWO1G1wONSQWO1G1wO!MfQYO1G1wOOQO1G1x1G1xO!MUQWO1G1xO!MkQWO1G1xONSQWO1G1xO!MpQYO1G1xO!MuQWO1G1yO!MzQYO1G1yO!MUQWO1G1zO!MUQWO1G1zO!NPQWO1G1zONSQWO1G1zO!NUQYO1G1zOOQO1G1{1G1{O(yQWO1G1{O!NZQWO,5:YO)ZQWO,5:YO!NcQWO,5:uO)ZQWO,5:uO)ZQWO,5:vO)kQWO,5:vOOQ#t,5:x,5:xOOQ#t,5:y,5:yO)ZQWO,5:yOOQ#t,5:{,5:{O!NkQWO,5:{O!NkQWO,5:{O!NvQWO,5:{O# RQ`O,5:}O# dQ[O,5:}O# lQdO,5;aONSQWO,5;bO# wQYO,5;bO# |Q[O,5;bONSQWO,5;cO#!UQYO,5;cO#!ZQ[O,5;cO#!cQYO,5;dO#!hQWO,5;dONSQWO,5;eO#!mQYO,5;eO#!rQ[O,5;eOOQ#t,5;f,5;fO(yQWO,5;fO#!zQ`O,5;fOOQ#t,Line truncated
|
||||||
|
`+n.scrub(),o=this.advance(i);return o>-1&&o<i.length?this.complete(t,r,o):!1}finish(t,n){return(this.stage==2||this.stage==3)&&Qn(n.content,this.pos)==n.content.length?this.complete(t,n,n.content.length):!1}complete(t,n,r){return t.addLeafElement(n,M(x.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(t){return t?(this.pos=t.to-this.start,this.elts.push(t),this.stage++,!0):(t===!1&&(this.stage=-1),!1)}advance(t){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Gl(t,this.pos,this.start,!0)))return-1;if(t.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(M(x.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Vl(t,Qn(t,this.pos),this.start)))return-1}else if(this.stage==2){let n=Qn(t,this.pos),r=0;if(n>this.pos){let i=Il(t,n,this.start);if(i){let o=Uo(t,i.to-this.start);o>0&&(this.nextStage(i),r=o)}}return r||(r=Uo(t,this.pos)),r>0&&r<t.length?r:-1}else return Uo(t,this.pos)}}};function Uo(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!Te(n))return-1}return t}var ts=class{nextLine(t,n,r){let i=n.depth<t.stack.length?-1:Xl(n),o=n.next;if(i<0)return!1;let s=M(x.HeaderMark,t.lineStart+n.pos,t.lineStart+i);return t.nextLine(),t.addLeafElement(r,M(o==61?x.SetextHeading1:x.SetextHeading2,r.start,t.prevLineEnd(),[...t.parser.parseInline(r.content,r.start),s])),!0}finish(){return!1}},Ml={LinkReference(e,t){return t.content.charCodeAt(0)==91?new es(t):null},SetextHeading(){return new ts}},cd=[(e,t)=>Rl(t)>=0,(e,t)=>Pl(t)>=0,(e,t)=>Cl(t)>=0,(e,t)=>cs(t,e,!0)>=0,(e,t)=>ps(t,e,!0)>=0,(e,t)=>ls(t,e,!0)>=0,(e,t)=>Wl(t,e,!0)>=0],pd={text:"",end:0},ns=class{constructor(t,n,r,i){this.parser=t,this.input=n,this.ranges=i,this.line=new Yo,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=hr.create(x.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new ss(r,n):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:t}=this;for(;;){for(let r=0;;){let i=t.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<t.markers.length&&(!i||t.markers[r].from<i.end);){let o=t.markers[r++];this.addNode(o.type,o.from,o.to)}if(!i)break;this.finishContext()}if(t.pos<t.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(t.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let i=r(this,t);if(i!=!1){if(i==!0)return null;t.forward();continue e}}break}if(t.pos==t.text.length)return this.nextLine()?null:this.finish();let n=new Fo(this.lineStart+t.pos,t.text.slice(t.pos));for(let r of this.parser.leafBlockParsers)if(r){let i=r(this,n);i&&n.parsers.push(i)}e:for(;this.nextLine()&&t.pos!=t.text.length;){if(t.indent<t.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,t,n))break e}for(let r of n.parsers)if(r.nextLine(this,t,n))return null;n.content+=`
|
||||||
|
`+t.scrub();for(let r of t.markers)n.marks.push(r)}return this.finishLeaf(n),null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}reuseFragment(t){if(!this.fragments.moveTo(this.absoluteLineStart+t,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=Hl(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(t=this.depth-1){return this.parser.nodeSet.types[this.stack[t].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(t){let n=pd;if(n.end=t,t>=this.to)n.text="";else if(n.text=this.lineChunkAt(t),n.end+=n.text.length,this.ranges.length>1){let r=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<n.end;){i++;let o=this.ranges[i].from,s=this.lineChunkAt(o);n.end=o+s.length,n.text=n.text.slice(0,this.ranges[i-1].to-r)+s,r=n.end-n.text.length}}return n}readLine(){let{line:t}=this,{text:n,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,t.reset(n);t.depth<this.stack.length;t.depth++){let i=this.stack[t.depth],o=this.parser.skipContextMarkup[i.type];if(!o)throw new Error("Unhandled block context "+x[i.type]);let s=this.line.markers.length;if(!o(i,this,t)){this.line.markers.length>s&&(i.end=this.line.markers[this.line.markers.length-1].to),t.forward();break}t.forward()}}lineChunkAt(t){let n=this.input.chunk(t),r;if(this.input.lineChunks)r=n==`
|
||||||
|
`?"":n;else{let i=n.indexOf(`
|
||||||
|
`);r=i<0?n:n.slice(0,i)}return t+r.length>this.to?r.slice(0,this.to-t):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,n,r=0){this.block=hr.create(t,r,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,n,r=0){this.startContext(this.parser.getNodeType(t),n,r)}addNode(t,n,r){typeof t=="number"&&(t=new L.Tree(this.parser.nodeSet.types[t],Bt,Bt,(r!=null?r:this.prevLineEnd())-n)),this.block.addChild(t,n-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,n){this.addNode(this.buffer.writeElements(os(n.children,t.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let t=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(t.toTree(this.parser.nodeSet),t.from-n.from),this.block=n}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?jl(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let r of t.parsers)if(r.finish(this,t))return;let n=os(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(n,-t.start).finish(x.Paragraph,t.content.length),t.start)}elt(t,n,r,i){return typeof t=="string"?M(this.parser.getNodeType(t),n,r,i):new yr(t,n)}get buffer(){return new gr(this.parser.nodeSet)}};function jl(e,t,n,r,i){let o=e[t].to,s=[],a=[],l=n.from+r;function c(p,u){for(;u?p>=o:p>o;){let O=e[t+1].from-o;r+=O,p+=O,t++,o=e[t].to}}for(let p=n.firstChild;p;p=p.nextSibling){c(p.from+r,!0);let u=p.from+r,O,d=i.get(p.tree);d?O=d:p.to+r>o?(O=jl(e,t,p,r,i),c(p.to+r,!1)):O=p.toTree(),s.push(O),a.push(u-l)}return c(n.to+r,!1),new L.Tree(n.type,s,a,n.to+r-l,n.tree?n.tree.propValues:void 0)}var rs=class e extends L.Parser{constructor(t,n,r,i,o,s,a,l,c){super(),this.nodeSet=t,this.blockParsers=n,this.leafBlockParsers=r,this.blockNames=i,this.endLeafBlock=o,this.skipContextMarkup=s,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let p of t.types)this.nodeTypes[p.name]=p.id}createParse(t,n,r){let i=new ns(this,t,n,r);for(let o of this.wrappers)i=o(i,t,n,r);return i}configure(t){let n=is(t);if(!n)return this;let{nodeSet:r,skipContextMarkup:i}=this,o=this.blockParsers.slice(),s=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),p=this.endLeafBlock.slice(),u=this.wrappers;if(Sn(n.defineNodes)){i=Object.assign({},i);let O=r.types.slice(),d;for(let f of n.defineNodes){let{name:m,block:g,composite:b,style:v}=typeof f=="string"?{name:f}:f;if(O.some(E=>E.name==m))continue;b&&(i[O.length]=(E,T,P)=>b(T,P,E.value));let $=O.length,S=b?["Block","BlockContext"]:g?$>=x.ATXHeading1&&$<=x.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;O.push(L.NodeType.define({id:$,name:m,props:S&&[[L.NodeProp.group,S]]})),v&&(d||(d={}),Array.isArray(v)||v instanceof X.Tag?d[m]=v:Object.assign(d,v))}r=new L.NodeSet(O),d&&(r=r.extend((0,X.styleTags)(d)))}if(Sn(n.props)&&(r=r.extend(...n.props)),Sn(n.remove))for(let O of n.remove){let d=this.blockNames.indexOf(O),f=this.inlineNames.indexOf(O);d>-1&&(o[d]=s[d]=void 0),f>-1&&(l[f]=void 0)}if(Sn(n.parseBlock))for(let O of n.parseBlock){let d=a.indexOf(O.name);if(d>-1)o[d]=O.parse,s[d]=O.leaf;else{let f=O.before?fr(a,O.before):O.after?fr(a,O.after)+1:a.length-1;o.splice(f,0,O.parse),s.splice(f,0,O.leaf),a.splice(f,0,O.name)}O.endLeaf&&p.push(O.endLeaf)}if(Sn(n.parseInline))for(let O of n.parseInline){let d=c.indexOf(O.name);if(d>-1)l[d]=O.parse;else{let f=O.before?fr(c,O.before):O.after?fr(c,O.after)+1:c.length-1;l.splice(f,0,O.parse),c.splice(f,0,O.name)}}return n.wrap&&(u=u.concat(n.wrap)),new e(r,o,s,a,p,i,l,c,u)}getNodeType(t){let n=this.nodeTypes[t];if(n==null)throw new RangeError(`Unknown node type '${t}'`);return n}parseInline(t,n){let r=new wn(this,t,n);e:for(let i=n;i<r.end;){let o=r.char(i);for(let s of this.inlineParsers)if(s){let a=s(r,o,i);if(a>=0){i=a;continue e}}i++}return r.resolveMarkers(0)}};function Sn(e){return e!=null&&e.length>0}function is(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=is(e[0]);if(e.length==1)return t;let n=is(e.slice(1));if(!n||!t)return t||n;let r=(s,a)=>(s||Bt).concat(a||Bt),i=t.wrap,o=n.wrap;return{props:r(t.props,n.props),defineNodes:r(t.defineNodes,n.defineNodes),parseBlock:r(t.parseBlock,n.parseBlock),parseInline:r(t.parseInline,n.parseInline),remove:r(t.remove,n.remove),wrap:i?o?(s,a,l,c)=>i(o(s,a,l,c),a,l,c):i:o}}function fr(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}var Zl=[L.NodeType.none];for(let e=1,t;t=x[e];e++)Zl[e]=L.NodeType.define({id:e,name:t,props:e>=x.Escape?[]:[[L.NodeProp.group,e in El?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});var Bt=[],gr=cl
Line truncated
|
||||||
|
`;)o--;this.fragmentEnd=o?o-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=t+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=n;if(!r.childAfter(i))return!1}}matches(t){let n=this.cursor.tree;return n&&n.prop(L.NodeProp.contextHash)==t}takeNodes(t){let n=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),o=t.absoluteLineStart,s=o,a=t.block.children.length,l=s,c=a;for(;;){if(n.to-r>i){if(n.type.isAnonymous&&n.firstChild())continue;break}let p=Hl(n.from-r,t.ranges);if(n.to-r<=t.ranges[t.rangeI].to)t.addNode(n.tree,p);else{let u=new L.Tree(t.parser.nodeSet.types[x.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(u,n.tree),t.addNode(u,p)}if(n.type.is("Block")&&(Od.indexOf(n.type.id)<0?(s=n.to-r,a=t.block.children.length):(s=l,a=c),l=n.to-r,c=t.block.children.length),!n.nextSibling())break}for(;t.block.children.length>a;)t.block.children.pop(),t.block.positions.pop();return s-o}};function Hl(e,t){let n=e;for(let r=1;r<t.length;r++){let i=t[r-1].to,o=t[r].from;i<e&&(n-=o-i)}return n}var dd=(0,X.styleTags)({"Blockquote/...":X.tags.quote,HorizontalRule:X.tags.contentSeparator,"ATXHeading1/... SetextHeading1/...":X.tags.heading1,"ATXHeading2/... SetextHeading2/...":X.tags.heading2,"ATXHeading3/...":X.tags.heading3,"ATXHeading4/...":X.tags.heading4,"ATXHeading5/...":X.tags.heading5,"ATXHeading6/...":X.tags.heading6,"Comment CommentBlock":X.tags.comment,Escape:X.tags.escape,Entity:X.tags.character,"Emphasis/...":X.tags.emphasis,"StrongEmphasis/...":X.tags.strong,"Link/... Image/...":X.tags.link,"OrderedList/... BulletList/...":X.tags.list,"BlockQuote/...":X.tags.quote,"InlineCode CodeText":X.tags.monospace,"URL Autolink":X.tags.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":X.tags.processingInstruction,"CodeInfo LinkLabel":X.tags.labelName,LinkTitle:X.tags.string,Paragraph:X.tags.content}),us=new rs(new L.NodeSet(Zl).extend(dd),Object.keys(mr).map(e=>mr[e]),Object.keys(mr).map(e=>Ml[e]),Object.keys(mr),cd,El,Object.keys(zo).map(e=>zo[e]),Object.keys(zo),[]);function md(e,t,n){let r=[];for(let i=e.firstChild,o=t;;i=i.nextSibling){let s=i?i.from:n;if(s>o&&r.push({from:o,to:s}),!i)break;o=i.to}return r}function Bl(e){let{codeParser:t,htmlParser:n}=e;return{wrap:(0,L.parseMixed)((i,o)=>{let s=i.type.id;if(t&&(s==x.CodeBlock||s==x.FencedCode)){let a="";if(s==x.FencedCode){let c=i.node.getChild(x.CodeInfo);c&&(a=o.read(c.from,c.to))}let l=t(a);if(l)return{parser:l,overlay:c=>c.type.id==x.CodeText,bracketed:s==x.FencedCode}}else if(n&&(s==x.HTMLBlock||s==x.HTMLTag||s==x.CommentBlock))return{parser:n,overlay:md(i.node,i.from,i.to)};return null})}}var fd={resolve:"Strikethrough",mark:"StrikethroughMark"},hd={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":X.tags.strikethrough}},{name:"StrikethroughMark",style:X.tags.processingInstruction}],parseInline:[{name:"Strikethrough",parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),o=/\s|^$/.test(r),s=/\s|^$/.test(i),a=kn.test(r),l=kn.test(i);return e.addDelimiter(fd,n,n+2,!s&&(!l||o||a),!o&&(!a||s||l))},after:"Emphasis"}]};function $n(e,t,n=0,r,i=0){let o=0,s=!0,a=-1,l=-1,c=!1,p=()=>{r.push(e.elt("TableCell",i+a,i+l,e.parser.parseInline(t.slice(a,l),i+a)))};for(let u=n;u<t.length;u++){let O=t.charCodeAt(u);O==124&&!c?((!s||a>-1)&&o++,s=!1,r&&(a>-1&&p(),r.push(e.elt("TableDelimiter",u+i,u+i+1))),a=l=-1):(c||O!=32&&O!=9)&&(a<0&&(a=u),l=u+1),c=!c&&O==92}return a>-1&&(o++,r&&p()),o}function xl(e,t){for(let n=t;n<e.length;n++){let r=e.charCodeAt(n);if(r==124)return!0;r==92&&n++}return!1}var Nl=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,vr=class{constructor(){this.rows=null}nextLine(t,n,r){if(this.rows==null){this.rows=!1;let i;if((n.next==45||n.next==58||n.next==124)&&Nl.test(i=n.text.slice(n.pos))){let o=[];$n(t,r.content,0,o,r.start)==$n(t,i,0)&&(this.rows=[t.elt("TableHeader",r.start,r.start+r.content.length,o),t.elt("TableDelimiter",t.lineStart+n.pos,t.lineStart+n.text.length)])}}else if(this.rows){let i=[];$n(t,n.text,n.pos,i,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+n.pos,t.lineStart+n.text.length,i))}return!1}finish(t,n){return this.rows?(t.addLeafElement(n,t.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}},gd={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":X.tags.heading}},"TableRow",{name:"TableCell",style:X.tags.content},{name:"TableDelimiter",style:X.tags.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return xl(t.content,0)?new vr:null},endLeaf(e,t,n){if(n.parsers.some(i=>i instanceof vr)||!xl(t.text,t.basePos))return!1;let r=e.peekLine();return Nl.test(r)&&$n(e,t.text,t.basePos)==$n(e,r,t.basePos)},before:"SetextHeading"}]},as=class{nextLine(){return!1}finish(t,n){return t.addLeafElement(n,t.elt("Task",n.start,n.start+n.content.length,[t.elt("TaskMarker"
Line truncated
|
||||||
|
//# sourceURL=latex-suite:${t}`,r=new Blob([n],{type:"text/javascript"}),i=URL.createObjectURL(r),o=import(i);return URL.revokeObjectURL(i),o}function gc(e,t,n=!1){return y(this,null,function*(){let r;try{r=yield mc(e,t)}catch(i){if(console.error(i),!n)throw new Error("Invalid format. Make sure its a valid javascript file and has a default export. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#snippet-files");r={}}if("default"in r)return r.default;console.warn("No default export found. Please add `export default` to your snippet file. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#snippet-files.");try{r=yield mc("export default "+e,t)}catch(i){throw console.error(i),new Error("Invalid format (with `export default` added). Make sure its a valid javascript file and has a default export. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#snippet-files")}if("default"in r)return r.default;throw new Error("No default export found (with `export default` added to the source). Make sure its a valid javascript file and has a default export. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#snippet-files")})}function Ie(e,t){return y(this,null,function*(){let n=yield gc(e,t,!0);if(Array.isArray(n))throw new Error("Cannot parse an array as a variables object");let r={};for(let[i,o]of Object.entries(n))if(i.startsWith("${")){if(!i.endsWith("}"))throw new Error(`Invalid snippet variable name '${i}': Starts with '\${' but does not end with '}'. You need to have both or neither.`);r[i]=o}else{if(i.endsWith("}"))throw new Error(`Invalid snippet variable name '${i}': Ends with '}' but does not start with '\${'. You need to have both or neither.`);r["${"+i+"}"]=o}return r})}var tm=String.raw`
|
||||||
|
var __latex_suite_require = window.__latex_suite_require;
|
||||||
|
function require(module) {
|
||||||
|
if (!__latex_suite_require) {
|
||||||
|
__latex_suite_require = window.__latex_suite_require;
|
||||||
|
}
|
||||||
|
return __latex_suite_require(module);
|
||||||
|
}
|
||||||
|
`;function nm(e){let t=cc(e),n=require;return function(i){return i==="latex-suite"?t:n(i)}}function lt(e,t,n){return y(this,null,function*(){window.__latex_suite_require=nm(t);let r=yield gc(e+tm,n),i;try{i=im(r).flatMap(s=>{try{return om(s,t)}catch(a){let l=a;throw new Error(`${l}
|
||||||
|
Erroring snippet:
|
||||||
|
${wr(s)}`)}})}catch(o){let s=o;throw new Error(`Invalid snippet format: ${s}`)}return i=Tr(i),i})}var rm=hn({trigger:Qe(Ye([H(),bt(RegExp)])),triggerAfter:Qe(Ye([H(),bt(RegExp)])),replacement:Ye([H(),Vt(Re(bt(ve)),Ri(e=>new U(e))),_i(e=>typeof e=="function")]),options:H(),flags:Qe(H(),""),priority:Qe(fn(),0),description:Qe(H(),"no description provided"),triggerKey:Qe(H(),""),language:Qe(H()),excludedMacros:Di,excludedEnvironments:Qe(Re(H()),[]),includedMacros:Di});function im(e){if(!Array.isArray(e))throw new Error("Expected snippets to be an array");return e.flat().map(t=>{try{return rt(rm,t)}catch(n){throw new Error(`Value does not resemble snippet.
|
||||||
|
Erroring snippet:
|
||||||
|
${wr(t)}`)}})}function om(e,t){var p;let{replacement:n,priority:r,description:i,excludedEnvironments:o,excludedMacros:s,includedMacros:a}=e,l=ar.fromSource(e.options,e.language),c=sm(e.triggerKey);if(e.trigger===void 0&&e.triggerKey.length===0)throw new Error("Either trigger has to be defined or triggerKey must be non-zero length");if((p=e.trigger)!=null||(e.trigger=""),l.regex||e.trigger instanceof RegExp){let u=typeof e.replacement=="string"?new U([new je(e.replacement)]):e.replacement,O,d,f=e.flags,m=f;e.trigger instanceof RegExp?(O=e.trigger.source,f=`${e.trigger.flags}${f}`):O=e.trigger,e.triggerAfter instanceof RegExp?(d=e.triggerAfter.source,m=`${e.triggerAfter.flags}${m}`):d=e.triggerAfter,f=fc(f),m=fc(m),O=Cr(O,t),d=d&&Cr(d,t);let g=[...hc(O),...s];O=`(?:${O})$`;let b=typeof e.trigger=="string"?RegExp:e.trigger.constructor,v=typeof e.triggerAfter=="string"||e.triggerAfter===void 0?RegExp:e.triggerAfter.constructor,$=new b(O,f);d=d?`^(?:${d})`:void 0;let S=d?new v(d,m):void 0;l.regex=!0;let E={trigger:$,replacement:u,options:l,priority:r,description:i,excludedMacros:g,triggerKey:c,triggerAfter:S,excludedEnvironments:o,includedMacros:a},T=[new Cn(E)];if(c&&l.automatic){let P=l.copy();P.automatic=!1;let Z=j(A({},E),{trigger:new RegExp(""),options:P});T.push(new Cn(Z))}return T}else{let u=Cr(e.trigger,t),O=e.triggerAfter;if(O!==void 0&&typeof O=="string")O=Cr(O,t);else if(O instanceof RegExp)throw new Error("triggerAfter cannot be a RegExp for non-regex snippets");let d=[...hc(u),...s];if(typeof n=="string"&&n.includes(dn)&&u.length<=1&&(l.visual=!0),l.visual){if(u.length>1)throw new Error("trigger should be a single character for visual snippets");if(u.length===1&&c.length>0)throw new Error("trigger and triggerKey can't both be defined for visual snippets");if(u.length===0&&c.length===0)throw new Error("Either trigger or triggerKey have to be defined for visual snippets");let f=typeof e.replacement=="string"?new U([new cr(e.replacement)]):e.replacement;l.automatic=!1;let m={trigger:u,replacement:f,options:l,priority:r,description:i,excludedEnvironments:o,excludedMacros:d,includedMacros:a,triggerKey:c,triggerAfter:O},g=[];return u?g.push(new Pn(j(A({},m),{triggerKey:u,trigger:""}))):g.push(new Pn(m)),g}else{let f=typeof e.replacement=="string"?new U([new Dt(e.replacement)]):e.replacement,m={trigger:u,replacement:f,options:l,priority:r,description:i,excludedEnvironments:o,excludedMacros:d,includedMacros:a,triggerKey:c,triggerAfter:O},g=[new qn(m)];if(c&&l.automatic){let b=l.copy();b.automatic=!1;let v=j(A({},m),{trigger:"",options:b});g.push(new qn(v))}return g}}}function fc(e){let t=["i","m","s","u","v"];return Array.from(new Set(e.split(""))).filter(n=>t.includes(n)).join("")}function Cr(e,t){for(let[n,r]of Object.entries(t))e=e.replaceAll(n,r);return e}function hc(e){let t=[],n=oc[e];return n&&t.push(...n),t}function sm(e){return e.split(/ (?!$)/).map(t=>am(t)).join(" ")}function am(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<t.length-1;++a){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))dc()?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}var lm=(e,t)=>{let n=e.keys(),r=t.keys(),i=[];for(let o of n)t.has(o)||i.push(o);for(let o of r)e.has(o)||i.push(o);return new Set(i)},cm=(e,t)=>{let n=e.keys(),r=[];for(let i of n)t.has(i)&&r.push(i);return new Set(r)},yc,bc;if(Set.prototype.difference){let e=Set.prototype.difference;yc=(t,n)=>e.call(t,n)}if(Set.prototype.intersection){let e=Set.prototype.intersection;bc=(t,n)=>e.call(t,n)}var $s=yc||lm,qr=bc||cm;function pm(e,t){let n=e.parent,r=0;for(;n&&!n.isRoot()&&r<100;){if(n.path===t.path)return!0;n=n.parent,r++}return!1}function vc(e,t,n){let r=e.app.vault.getAbstractFileByPath(t);return r instanceof de.TFolder&&pm(n,r)}var ws=(0,de.debounce)(e=>y(void 0,null,function*(){(e.settings.loadSnippetVariablesFromFile||e.settings.loadSnippetsFromFile)&&(yield e.processSettings(!1,!0))}),3e3,!0);function Sc(e){return y(this,null,function*(){let t=e.settings.snippetsFileLocation,n=e.settings.snippetVariablesFileLocation;if(e.settings.loadSnippetVariablesFromFile&&e.settings.loadSnippetsFromFile){if(t===n)return kt(e,t);let o=l=>l.startsWith("/")||l.startsWith("\\");if(t.startsWith(n)&&o(n.slice(t.length)))return kt(e,t);if(n.startsWith(t)&&o(t.slice(n.length)))return kt(e,n);let s=yield kt(e,t),a=yield kt(e,n);return()=>{s(),a()}}let r=e.settings.loadSnippetVariablesFromFile?yield kt(e,e.settings.snippetVariablesFileLocation):null,i=e.settings.loadSnippetsFromFile?yield kt(e,e.settings.snippetsFileLocation):null;return()=>{r==null||r(),i==null||i()}})}function Qc(e){return y(this,null,function*(){if(!de.Platform.isDesktop)return null;let t=require("fs"),n=require("path");if(e.slice(0,2)==="~/"){
Line truncated
|
||||||
\${}
|
\${}
|
||||||
} catch (\${error}) {
|
} catch (\${error}) {
|
||||||
\${}
|
\${}
|
||||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),(0,ee.snippetCompletion)("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),(0,ee.snippetCompletion)(`if (\${}) {
|
}`,{label:"try",detail:"/ catch block",type:"keyword"}),(0,ce.snippetCompletion)("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),(0,ce.snippetCompletion)(`if (\${}) {
|
||||||
\${}
|
\${}
|
||||||
} else {
|
} else {
|
||||||
\${}
|
\${}
|
||||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),(0,ee.snippetCompletion)(`class \${name} {
|
}`,{label:"if",detail:"/ else block",type:"keyword"}),(0,ce.snippetCompletion)(`class \${name} {
|
||||||
constructor(\${params}) {
|
constructor(\${params}) {
|
||||||
\${}
|
\${}
|
||||||
}
|
}
|
||||||
}`,{label:"class",detail:"definition",type:"keyword"}),(0,ee.snippetCompletion)('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),(0,ee.snippetCompletion)('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Js=new vr,no=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Dt(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var Xc=["FunctionDeclaration"],Wc={FunctionDeclaration:Dt("function"),ClassDeclaration:Dt("class"),ClassExpression:()=>!0,EnumDeclaration:Dt("constant"),TypeAliasDeclaration:Dt("type"),NamespaceDeclaration:Dt("namespace"),VariableDefinition(t,e){t.matchContext(Xc)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function io(t,e){let r=Js.get(e);if(r)return r;let n=[],i=!0;function s(o,a){let l=t.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(z.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Wc[o.name];if(a&&a(o,s)||no.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of io(t,o.node))n.push(a);return!1}}),Js.set(e,n),n}var eo=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,so=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Vc(t){let e=(0,B.syntaxTree)(t.state).resolveInner(t.pos,-1);if(so.indexOf(e.name)>-1)return null;let r=e.to-e.from<20&&eo.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)no.has(i.name)&&(n=n.concat(io(t.state.doc,i)));return{options:n,from:r?e.from:t.pos,validFor:eo}}var rt=B.LRLanguage.define({parser:Ks.configure({props:[B.indentNodeProp.add({IfStatement:(0,B.continuedIndent)({except:/^\s*({|else\b)/}),TryStatement:(0,B.continuedIndent)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:B.flatIndent,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:(0,B.delimitedIndent)({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,B.continuedIndent)({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),B.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":B.foldInside,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ic=rt.configure({dialect:"ts"}),Mc=rt.configure({dialect:"jsx"}),Gc=rt.configure({dialect:"jsx ts"}),Bc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(t=>({label:t,type:"keyword"}));function oo(t={}){let e=t.jsx?t.typescript?Gc:Mc:t.typescript?Ic:rt;return new B.LanguageSupport(e,[rt.data.of({autocomplete:(0,ee.ifNotIn)(so,(0,ee.completeFromList)(Zc.concat(Bc)))}),rt.data.of({autocomplete:Vc}),t.jsx?zc:[]])}function to(t,e,r=t.length){if(!e)return"";let n=e.getChild("JSXIdentifier");return n?t.sliceString(n.from,Math.min(n.to,r)):""}var Dc=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),zc=ro.EditorView.inputHandler.of((t,e,r,n)=>{if((Dc?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!rt.isActiveAt(t.state,e,-1))return!1;let{state:i}=t,s=i.changeByRange(o=>{var a,l,c;let{head:p}=o,u=(0,B.syntaxTree)(i).resolveInner(p,-1),d;if(u.name=="JSXStartTag"&&(u=u.parent),n==">"&&u.name=="JSXFragmentTag")return{range:Cr.EditorSelection.cursor(p+1),changes:{from:p,insert:"><>"}};if(n==">"&&u.name=="JSXIdentifier"){if(((l=(a=u.parent)===null||a===void 0?void 0:a.lastChild)===null||l===void 0?void 0:l.name)!="JSXEndTag"&&(d=to(i.doc,u.parent,p)))return{range:Cr.EditorSelection.cursor(p+1),changes:{from:p,insert:`></${d}>`}}}else if(n=="/"&&u.name=="JSXFragmentTag"){let O=u.parent,h=O==null?void 0:O.parent;if(O.from==p-1&&((c=h.lastChild)===null||c===void 0?void 0:c.name)!="JSXEndTag"&&(d=to(i.doc,h==null?void 0:h.firstChild,p))){let f=`/${d}>`;return{range:Cr.EditorSelection.cursor(p+f.length),changes:{from:p,insert:f}}}}return{range:o}});return s.changes.empty?!1:(t.dispatch(s,{userEvent:"input.type",scrollIntoView:!0}),!0)});var we=require("@codemirror/language"),Me=require("@codemirror/commands"),Ar=require("@codemirror/autocomplete"),qr=require("@codemirror/search"),po=require("@codemirror/lint");var ao=require("@codemirror/view"),Rr=require("@codemirror/language"),_=require("@lezer
Line truncated
|
}`,{label:"class",detail:"definition",type:"keyword"}),(0,ce.snippetCompletion)('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),(0,ce.snippetCompletion)('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ip=new Dr.NodeWeakMap,lp=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function jn(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}var $f=["FunctionDeclaration"],kf={FunctionDeclaration:jn("function"),ClassDeclaration:jn("class"),ClassExpression:()=>!0,EnumDeclaration:jn("constant"),TypeAliasDeclaration:jn("type"),NamespaceDeclaration:jn("namespace"),VariableDefinition(e,t){e.matchContext($f)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function cp(e,t){let n=ip.get(t);if(n)return n;let r=[],i=!0;function o(s,a){let l=e.sliceString(s.from,s.to);r.push({label:l,type:a})}return t.cursor(Dr.IterMode.IncludeAnonymous).iterate(s=>{if(i)i=!1;else if(s.name){let a=kf[s.name];if(a&&a(s,o)||lp.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of cp(e,s.node))r.push(a);return!1}}),ip.set(t,r),r}var op=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,pp=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function wf(e){let t=(0,Y.syntaxTree)(e.state).resolveInner(e.pos,-1);if(pp.indexOf(t.name)>-1)return null;let n=t.to-t.from<20&&op.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)lp.has(i.name)&&(r=r.concat(cp(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:op}}var _t=Y.LRLanguage.define({parser:rp.configure({props:[Y.indentNodeProp.add({IfStatement:(0,Y.continuedIndent)({except:/^\s*({|else\b)/}),TryStatement:(0,Y.continuedIndent)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Y.flatIndent,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:(0,Y.delimitedIndent)({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,Y.continuedIndent)({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Y.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":Y.foldInside,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Tf=_t.configure({dialect:"ts"}),Ef=_t.configure({dialect:"jsx"}),Pf=_t.configure({dialect:"jsx ts"}),Cf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(e=>({label:e,type:"keyword"}));function up(e={}){let t=e.jsx?e.typescript?Pf:Ef:e.typescript?Tf:_t;return new Y.LanguageSupport(t,[_t.data.of({autocomplete:(0,ce.ifNotIn)(pp,(0,ce.completeFromList)(Qf.concat(Cf)))}),_t.data.of({autocomplete:wf}),e.jsx?Rf:[]])}function sp(e,t,n=e.length){if(!t)return"";let r=t.getChild("JSXIdentifier");return r?e.sliceString(r.from,Math.min(r.to,n)):""}var qf=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Rf=ap.EditorView.inputHandler.of((e,t,n,r)=>{if((qf?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!_t.isActiveAt(e.state,t,-1))return!1;let{state:i}=e,o=i.changeByRange(s=>{var a,l,c;let{head:p}=s,u=(0,Y.syntaxTree)(i).resolveInner(p,-1),O;if(u.name=="JSXStartTag"&&(u=u.parent),r==">"&&u.name=="JSXFragmentTag")return{range:Lr.EditorSelection.cursor(p+1),changes:{from:p,insert:"><>"}};if(r==">"&&u.name=="JSXIdentifier"){if(((l=(a=u.parent)===null||a===void 0?void 0:a.lastChild)===null||l===void 0?void 0:l.name)!="JSXEndTag"&&(O=sp(i.doc,u.parent,p)))return{range:Lr.EditorSelection.cursor(p+1),changes:{from:p,insert:`></${O}>`}}}else if(r=="/"&&u.name=="JSXFragmentTag"){let d=u.parent,f=d==null?void 0:d.parent;if(d.from==p-1&&((c=f.lastChild)===null||c===void 0?void 0:c.name)!="JSXEndTag"&&(O=sp(i.doc,f==null?void 0:f.firstChild,p))){let m=`/${O}>`;return{range:Lr.EditorSelection.cursor(p+m.length),changes:{from:p,insert:m}}}}return{range:s}});return o.changes.empty?!1:(e.dispatch(o,{userEvent:"input.type",scrollIntoView:!0}),!0)});var Be=require("@codemirror/language"),ut=require("@codemirror/commands"),Ir=require("@codemirror/autocomplete"),Gr=require("@codemirror/search"),fp=require("@codemirror/lint");var Op=require("@codemirror/view"),Vr=require("@codemirror/langua
Line truncated
|
||||||
["${t}", "}"]`)}
|
`+a+$,E=S.length-g[0].length;for(let T of d)T.from-m>g.index&&(T.from+=E),T.to-m>g.index&&(T.to+=E);m+=E,f.push({start:g.index,end:g.index+g[0].length,replacement:S})}return{insert:wi(r.insert,f),tabstops:d}};function Gs(e){Ur(e).clearSnippetQueue()}var l$=require("@codemirror/view"),Gn=require("@codemirror/state");var n$=require("@codemirror/view"),In=require("@codemirror/state"),$p=require("@codemirror/commands");var Dn=require("@codemirror/view"),Vn=require("@codemirror/state");var Ln=require("@codemirror/state"),Ot=require("@codemirror/view");var yp="latex-suite-snippet-placeholder";function Wf(e,t,n){let r=`${yp} ${yp}-${n}`;if(e===t){let i=Ot.Decoration.mark({inclusive:!0,color:n,class:r});return Ot.Decoration.prototype.range.call(i,e,t)}else return Ot.Decoration.mark({inclusive:!0,color:n,class:r}).range(e,t)}var Hs=class e{constructor(t,n){let r=t.map(i=>Wf(i.from,i.to,n));this.decos=Ot.Decoration.set(r,!0),this.color=n,this.hidden=!1}select(t,n,r){let i=this.toEditorSelection(),o=n?bp(i):i;t.dispatch({selection:o,effects:r?dt.of(null):void 0}),It(t),this.hideFromEditor()}toSelectionRanges(){let t=[],n=this.decos.iter();for(;n.value!=null;)t.push(Ln.EditorSelection.range(n.from,n.to)),n.next();return t}toEditorSelection(t=!1){let n=Ln.EditorSelection.create(this.toSelectionRanges());return t&&(n=bp(n)),n}containsSelection(t){function n(o,s){for(let a of s)if(a.from<=o.from&&a.to>=o.to)return!0;return!1}let r=this.toSelectionRanges(),i=!0;for(let o of t.ranges)if(!n(o,r)){i=!1;break}return i}hideFromEditor(){this.hidden=!0}map(t){this.decos=this.decos.map(t)}getRanges(){let t=[],n=this.decos.iter();for(;n.value!=null;)n.from!=n.to?t.push(n.value.range(n.from,n.to)):t.push(jf(n.from,n.to)),n.next();return t}copy(){let t=new e([],this.color);return t.decos=this.decos,t.hidden=this.hidden,t}};function vp(e,t){let n=[],r=0,i=e.slice().sort((s,a)=>{for(let l=0;l<Math.min(s.index.length,a.index.length);l++)if(s.index[l]!=a.index[l])return s.index[l]-a.index[l];return s.index.length-a.index.length}).map((s,a,l)=>{if(a===0)return j(A({},s),{index:r});let c=s.index.length===l[a-1].index.length&&s.index.every((p,u)=>p===l[a-1].index[u]);return r+=c?0:1,j(A({},s),{index:r})});for(let s of i){let a=s.index;n[a]?n[a].push(s):n[a]=[s]}let o=[];for(let s of n){let a=new Hs(s,t);o.push(a)}return o}function bp(e){let t=e.ranges.map(n=>Ln.EditorSelection.range(n.to,n.to));return Ln.EditorSelection.create(t)}var Mf=Ot.Decoration.widget({widget:new class extends Ot.WidgetType{toDOM(){let e=$t("span");return e.className=Bs,e}ignoreEvent(){return!1}}});function jf(e,t){return Mf.range(e,t)}var Fr=Vn.StateEffect.define(),Yr=Vn.StateEffect.define(),mt=Vn.StateField.define({create(){return{index:0,tabstopGroups:[],color:0}},update(e,t){let n=e.tabstopGroups,r=e.color;n.forEach(o=>o.map(t.changes));for(let o of t.effects)o.is(Fr)?n.splice(e.index,1,...o.value):o.is(Yr)&&(n=[],r=0);let i=e.index;return t.selection&&(i=Zf(n,t.selection),n.length<=1||i>=n.length-1?(n=[],i=0,r=0):n[0].hideFromEditor()),{index:i,tabstopGroups:n,color:r}},provide:e=>Dn.EditorView.outerDecorations.of(t=>{let n=t.state.field(e).tabstopGroups,r=[];for(let i of n)i.hidden||r.push(...i.getRanges());return Dn.Decoration.set(r,!0)})});function Zf(e,t){for(let[n,r]of e.entries())if(r.containsSelection(t))return n;return e.length}function Kr(e){return{effects:[Fr.of(e)]}}function xp(e){e.dispatch({effects:[Yr.of(null)]})}var Lf=3;function Sp(e){return e.state.field(mt).color++%Lf}var Bs="cm-snippetFieldPosition",ke="latex-suite-snippet-placeholder",zr="--placeholder-bg",At="--placeholder-outline",Qp=Dn.EditorView.baseTheme({[`.${Bs}`]:{verticalAlign:"text-top",width:"0",height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},[`.${ke}`]:{borderRadius:"2px",backgroundColor:`var(${zr})`,outline:`var(${At}) solid 1px`},[`.${ke}-0, span.${ke}-0 span`]:{[zr]:"#87cefa2e",[At]:"#87cefa6e"},[`${se} .${ke}-0, span.${ke}-0 span`]:{[At]:"#87cefa43"},[`.${ke}-1, span.${ke}-1 span`]:{[zr]:"#ffa50033",[At]:"#ffa5006b"},[`${se} .${ke}-1, span.${ke}-1 span`]:{[At]:"#ffa5004d"},[`.${ke}-2, span.${ke}-2 span`]:{[zr]:"#0f02",[At]:"#00ff0060"},[`${se} .${ke}-2, span.${ke}-2 span`]:{[At]:"#00ff003d"}});var Wt=In.StateEffect.define(),dt=In.StateEffect.define(),Jr=In.StateEffect.define(),ei=In.StateEffect.define(),ti=$p.invertedEffects.of(e=>{let t=[];for(let n of e.effects)n.is(Wt)?t.push(Jr.of(n.value)):n.is(Jr)?t.push(Wt.of(n.value)):n.is(dt)?t.push(ei.of(null)):n.is(ei)&&t.push(dt.of(null));return t}),kp=e=>{let t=e.transactions.find(r=>r.isUserEvent("undo")),n=e.transactions.find(r=>r.isUserEvent("redo"));for(let r of e.transactions)for(let i of r.effects)i.is(Wt)&&n&&e.view.dispatch({effects:Kr(i.value.map(o=>o.copy())).effects});return t&&xp(e.view),!!(t||n)};var Ns=require("@codemirror/commands");function Us(e,t){let n;return typeof t.insert=="string"?n=new je(t.insert).applyInsert():Array.isArray(t.insert)?n=new U(t.insert).applyIns
Line truncated
|
||||||
]`;var ri="formatting_formatting-math_formatting-math-begin_keyword_math",Yc="formatting_formatting-math_formatting-math-end_keyword_math_math-",$o="formatting_formatting-math_formatting-math-begin_keyword_math_math-block",Hc="formatting_formatting-math_formatting-math-end_keyword_math_math-",Zr=new Set([ri,$o]),Xr=new Set([Yc,Hc]),So="HyperMD-codeblock_HyperMD-codeblock-begin_HyperMD-codeblock-begin-bg_HyperMD-codeblock-bg",ti="HyperMD-codeblock_HyperMD-codeblock-bg_HyperMD-codeblock-end_HyperMD-codeblock-end-bg",ii=ni.ViewPlugin.fromClass(class{constructor(e){this.codeblockLanguage=null;this.shouldUpdate=!1;this.updateFromView(e)}init(e){return this.shouldUpdate&&(this.updateFromView(e),this.shouldUpdate=!1),this}update(e){(e.docChanged||e.selectionSet||e.viewportChanged)&&(this.shouldUpdate=!0)}updateFromView(e){var u;let r=e.state,n=r.selection;this.view=e,this.state=r,this.pos=n.main.to,this.ranges=Array.from(n.ranges).reverse(),this.mode=new pt,this.boundsCache=new Map,this.innerBoundsCache=new Map,this.codeblockLanguage=null;let i=ep(r),s=(u=i==null?void 0:i.codeblockLanguage)!=null?u:null,o=s!==null,a=X(r),l=o&&a.forceMathLanguages.contains(s);this.mode.codeMath=l,this.mode.code=o&&!l?s:!1,o&&this.mode.code!==!1&&(this.codeblockLanguage=s,this.boundsCache.set(this.pos,i));let c=nt(e),p=l||c.inMathBound(r,this.pos);if(p!==!0&&p!==null){let d=p.mode===0;this.mode.blockMath=!d,this.mode.inlineMath=d,this.boundsCache.set(this.pos,p)}if(p){let d=this.inTextEnvironment();d==="text"?this.mode.textEnv=!0:d==="none"&&(this.mode.inlineMath=!1,this.mode.blockMath=!1,this.mode.codeMath=!1)}this.mode.text=!o&&!p}isWithinEnvironment(e,r){if(!this.mode.inMath())return null;let n=this.getInnerBounds();if(!n)return null;let{inner_start:i,inner_end:s}=n,o=this.state.sliceDoc(i,s);e-=i,Array.isArray(r)||(r=[r]);e:for(let a of r){let l=a.openSymbol.slice(-1),c=xt(l),p,u;["{","[","("].contains(l)&&a.closeSymbol===c?(p=a.openSymbol.length-1,u=l):(p=0,u=a.openSymbol);let d=o.lastIndexOf(a.openSymbol,e-1);for(;d!=-1;){let O=J(o,d+p,u,a.closeSymbol,!1);if(O===-1)continue e;if(O>=e&&e>=d+a.openSymbol.length)return ye(oe({},a),{inner_start:d+a.openSymbol.length+i,inner_end:O+i,outer_start:d+i,outer_end:O+a.closeSymbol.length+i});if(d<=0)continue e;d=o.lastIndexOf(a.openSymbol,d-1)}}return null}inTextEnvironment(){let e=this.isWithinEnvironment(this.pos,Qo);if(!e)return null;let r=e.openSymbol.slice(1,-1);return ei.includes(r)?"none":"text"}getBounds(e=this.pos){let r=this.boundsCache.get(e);if(r!==void 0)return r;let n;return this.mode.codeMath?n=Jc(this.state,e):n=nt(this.view).inMathBound(this.state,e),this.boundsCache.set(e,n),n}getInnerBounds(e=this.pos){let r,n=this.innerBoundsCache.get(e);return n!==void 0?n:(this.mode.codeMath?r=this.getBounds(e):r=Kc(this.view),this.innerBoundsCache.set(e,r),r)}}),I=t=>{let e=t.plugin(ii);if(!e)throw new Error("Context plugin not found, something went wrong with the plugin initialization");return e.init(t)};var Kc=(t,e)=>{e||(e=t.state.selection.main.to);let r=nt(t).inMathBound(t.state,e);if(!r)return null;let n=t.state.sliceDoc(r.inner_start,r.inner_end);n=n.replaceAll("\\$","\\R");let i=n.lastIndexOf("$",e-1),s=n.indexOf("$",e);return i===-1||s===-1?r:{inner_start:i+1,inner_end:s,outer_start:i,outer_end:s+1}},Jc=(t,e=t.selection.main.from)=>{let r=vo(t,e);if(!r)return null;let{begin:n,end:i}=r;return{inner_start:n.to,inner_end:i.from,outer_start:n.from,outer_end:i.to}},vo=(t,e=t.selection.main.from)=>{let n=(0,Wr.syntaxTree)(t).cursor();if(n.childBefore(e),!n.name.contains("codeblock")||n.name===So&&e<=n.to||n.name===ti)return null;do if(n.name===So)break;while(n.prev());let i=n.node;if(!i)return null;n.childAfter(e);do if(n.name===ti)break;while(n.next());let s=n.node;return!s||s.name!==ti?null:{begin:i,end:s}},ep=t=>{let e=t.selection.ranges[0].from,r=vo(t,e);if(!r)return null;let{begin:n,end:i}=r,s=t.sliceDoc(n.from,n.to).replace(/`+|~+/g,"");return{inner_start:n.to,inner_end:i.from,outer_start:n.from,outer_end:i.to,codeblockLanguage:s}},si=ni.ViewPlugin.fromClass(class{constructor(e){this.mathBounds=[];this.equations=null;this.shouldUpdate=!1;this.inMathBound=(e,r)=>{var o,a;let n=this.mathBounds;if(r<=((o=n[0])==null?void 0:o.outer_start)||r>=((a=n[n.length-1])==null?void 0:a.outer_end))return this.getEquationBounds(e,r);let i=0,s=n.length-1;for(;i<=s;){let l=i+s>>1,c=n[l];if(r<c.outer_start)s=l-1;else if(r>=c.outer_end)i=l+1;else{if(r<=c.inner_start||r>=c.inner_end)break;return c}}return this.getEquationBounds(e,r)};this.computeEquationBounds=(e,r)=>{r===void 0&&(r=e.selection.main.to);let i=(0,Wr.syntaxTree)(e).cursor();if(i.childBefore(r),i.node.firstChild&&i.name!=="Document"){let l=r;for(;e.sliceDoc(l,l+1)===`
|
`;)r++;return{token:{start:t,end:r,text:e.slice(t,r)},nextIndex:r}},Hf=(e,t)=>{let n=e.length,r=t+1,i=e[r];if(/[A-Za-z]/.test(i))do r++;while(r<n&&/[A-Za-z]/.test(e[r]));else r++;return{token:{start:t,end:r,text:e.slice(t,r)},nextIndex:r}},Bf=(e,t)=>{let n=t+1;return{token:{start:t,end:n,text:e.slice(t,n)},nextIndex:n}};function wp(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return null}function*Jt(e,t=0){for(let n of e){yield{region:n,depth:t};let r=n.kind==="bracket"?t+1:t;yield*sr(Jt(n.children,r))}}function Nf(e,t){return e.from===t.from&&e.to===t.to&&e.name===t.name}function*en(e,t){let n=e.cursor();if(n.moveTo(t.from,1),!(n.node.from<t.from)){for(;n.node.parent&&n.node.parent.from>=t.from&&n.parent()&&!Nf(e,n.node););do t.skipCursorMove=!1,!(n.to>t.to)&&(yield n);while((t.skipCursorMove||n.next())&&n.from<=t.to&&n.node!==e)}}var fe=class e{constructor(t,n,r,i=n){this.eqn=t;this.from=n;this.to=r;this.offset=i;this.skipCursorMove=!1}slice(t,n){return this.eqn.slice(t-this.offset,n-this.offset)}static fromNode(t,n){return new e(n.sliceString(t.from,t.to),t.from,t.to)}};var Uf=new Set(["\\left","\\bigl","\\Bigl","\\biggl","\\Biggl"]),zf=new Set(["\\right","\\bigr","\\Bigr","\\biggr","\\Biggr"]),Ff=new Set(["(",")","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","<",">","\\langle","\\rangle","\\lt","\\gt","|","\\vert","\\lvert","\\rvert","\\|","\\Vert","\\lVert","\\rVert","\\lfloor","\\rfloor","\\lceil","\\rceil","\\ulcorner","\\urcorner","/","\\\\","\\backslash","\\uparrow","\\downarrow","\\Uparrow","\\Downarrow","."]),Ys={"(":")","[":"]","{":"}","\\lbrack":"\\rbrack","\\lbrace":"\\rbrace","\\langle":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\ulcorner":"\\urcorner","<":">"},Yf=e=>Uf.has(e.text),Tp=e=>zf.has(e.text),Ks=e=>Ff.has(e.text),Kf=(e,t)=>t.has(e.text),Jf=(e,t,n,r)=>{if(t>0){let i=e[t-1];if(Tp(i)&&Ks(r))return!0;if(Yf(i)&&Ks(r))return!1}return Kf(r,n)},eh=(e,t,n)=>{if(!Tp(n))return!1;if(t+1>=e.length)return!0;let r=e[t+1];return!Ks(r)},Js=(e,t)=>{var v;if(!t.mode.inMath())return!1;let n=t.getBounds();if(!n)return!1;let{inner_start:r,inner_end:i,outer_end:o,outer_start:s}=n;if(o<=t.pos)return!1;let a=e.state.doc,l=e.state.selection.main.to,c=l-r,p=a.sliceString(r,i),u=Fs(p),O=W(e),d=O.taboutClosingSymbols,f=u.findIndex($=>$.end>c),m=f===-1?u.length:f;for(let $=m;$<u.length;$++){let S=u[$];if(Jf(u,$,d,S))return Le(e,r+S.end),!0;if(eh(u,$,S))return console.warn("[tabout] Found right command without following delimiter:",S.text,"at index",r+S.start),Le(e,r+S.end),!0}if(!(a.sliceString(l,i).trim().length===0)&&O.taboutExitEquationOnlyOnEOL)return!1;if(!vt(e,n))Le(e,o);else{let $=a.lineAt(o),S=[],E=((v=a.lineAt(s).text.match(/^\s*/))==null?void 0:v[0])||"";if($.number===a.lines)S.push({changes:{from:$.to,to:$.to,insert:`
|
||||||
`&&l>0;)l-=1;i.moveTo(l,-1)}if(!(i.name.contains("math")&&!i.name.startsWith("hashtag_hashtag-end_meta_tag"))||Xr.has(i.name)&&r>=i.to)return null;do if(Zr.has(i.name))break;while(i.prev());let s=i.node;if(!s)return null;i.childAfter(r);do if(Xr.has(i.name))break;while(i.next());let o=i.node;return o?s.to>r&&s.from<r&&s.name===$o?{inner_start:r,inner_end:r,outer_start:s.from,outer_end:s.to,mode:0}:o.from<r||s.to>r?null:{inner_start:s.to,inner_end:o.from,outer_start:s.from,outer_end:o.to,mode:s.name===ri?0:1}:null};this.addMathBound=e=>{if(this.mathBounds.length===0)this.mathBounds.push(e);else if(e.outer_end<=this.mathBounds[0].outer_start)this.mathBounds.unshift(e);else if(e.outer_start>=this.mathBounds[this.mathBounds.length-1].outer_end)this.mathBounds.push(e);else{let r=0,n=this.mathBounds.length-1;for(;r<=n;){let i=r+n>>1;e.outer_start<this.mathBounds[i].outer_start?n=i-1:r=i+1}this.mathBounds.splice(r,0,e)}return e};this.updateMathBounds(e)}init(e){return this.shouldUpdate&&(this.equations=null,this.updateMathBounds(e),this.shouldUpdate=!1),this}update(e){(e.docChanged||e.viewportChanged)&&(this.shouldUpdate=!0)}updateMathBounds(e){var s,o,a;let r=(0,Wr.syntaxTree)(e.state),n=[];e.visibleRanges.forEach(({from:l,to:c},p)=>{n.push([]),r.iterate({from:l,to:c,enter:u=>{(Zr.has(u.name)&&u.to<c||Xr.has(u.name)&&u.from>l)&&n[p].push(u.node)}})});let i=[];for(let l of n){if(Xr.has((s=l[0])==null?void 0:s.name)){let p=this.computeEquationBounds(e.state,l[0].from);p&&i.push(p)}let c=Zr.has((o=l[0])==null?void 0:o.name)?0:1;for(let p=c;p<l.length-1;p+=2){let u=l[p],d=l[p+1];i.push({inner_start:u.to,inner_end:d.from,outer_start:u.from,outer_end:d.to,mode:u.name===ri?0:1})}if(Zr.has((a=l[l.length-1])==null?void 0:a.name)){let p=l[l.length-1],u=this.computeEquationBounds(e.state,p.to);u&&i.push(u)}}this.mathBounds=i.filter((l,c)=>{if(c===0)return!0;let p=i[c-1];return!(p.outer_start===l.outer_start&&p.outer_end===l.outer_end)})}getEquationBounds(e,r){r||(r=e.selection.main.to);let n=this.computeEquationBounds(e,r);return n?(this.addMathBound(n),n):null}getEquations(e){return this.equations?this.equations:(this.equations=new Map(this.mathBounds.map(r=>[r.inner_start,e.sliceDoc(r.inner_start,r.inner_end)])),this.equations)}}),nt=t=>{let e=t.plugin(si);if(!e)throw new Error("MathBoundsPlugin not found, something went wrong with the plugin initialization");return e.init(t)};var To=require("@codemirror/view");var Ut=class{constructor(e,r,n,i){this.from=e,this.to=r,this.insert=n,this.keyPressed=i}getTabstops(e,r){let n=[];for(let i=r;i<r+this.insert.length;i++){if(e.charAt(i)!=="$")continue;let s=parseInt(e.charAt(i+1)),o=i,a=o+2,l="";if(isNaN(s)){if(e.charAt(i+1)!=="{")continue;let p=J(e,i+1,"{","}",!1,r+this.insert.length),u=e.slice(i,p+1);if(!u.includes(":"))continue;let d=u.indexOf(":");if(s=parseInt(u.slice(2,d)),isNaN(s)||p===-1)continue;l=e.slice(i+d+1,p),a=p+1,i=p}let c={number:s,from:o,to:a,replacement:l};n.push(c)}return n}toChangeSpec(){return this}};var Vr=require("@codemirror/language"),wo=require("@codemirror/state"),oi=To.ViewPlugin.fromClass(class{constructor(){this.snippetQueue=[]}clearSnippetQueue(){this.snippetQueue=[]}QueueSnippets(t){this.snippetQueue=this.snippetQueue.concat(t)}get snippetQueueValue(){return this.snippetQueue.map(t=>new Ut(t.from,t.to,t.insert,t.keyPressed))}});function Ir(t){let e=t.plugin(oi);if(!e)throw new Error("SnippetQueue plugin not found, something went wrong with the plugin initialization");return e}function qe(t,e,r,n,i){let s=new Ut(e,r,tp(t.state,e,r,n),i);Ir(t).QueueSnippets([s])}var tp=(t,e,r,n)=>{let o=t.doc.lineAt(r).text.match(/^(>*)(\s*)/);if(!o)return n;let a=o[1],l=o[2],c=(0,wo.countColumn)(l,t.tabSize),p=(0,Vr.getIndentUnit)(t),u=c%p;return n=n.replace(/\n(\t*)/g,(d,O)=>{let h=O.length*p+c-(O.length&&u),f=(0,Vr.indentString)(t,h);return`
|
`+E},selection:{anchor:$.to+1+E.length}});else{let P=a.lineAt($.to+1);P.text.trim()===""?S.push({changes:{from:P.from,to:P.to,insert:E},selection:{anchor:$.to+1+E.length}}):S.push({selection:{anchor:$.to+1}})}let T=a.lineAt(l);T.text.trimEnd()!==T.text&&S.push({changes:{from:T.from,to:T.to,insert:T.text.trimEnd()}}),e.dispatch(...S)}return!0},Ep=(e,t)=>{let n=Fs(t),r=W(e).taboutClosingSymbols,i=[],o=qr(new Set(Object.values(Ys)),r),s=new Set(Object.keys(Ys).filter(a=>o.has(Ys[a])));for(let a of n)if(o.has(a.text)){if(i.length===0)return a.end;i.pop()}else s.has(a.text)&&i.push(a.text);return null},Pp=(e,t)=>{let n=e.state.selection.main;if(!n.empty)return!1;let r=n.from,i=Ma(e,r);return i===t&&[")","]","}"].includes(i)};var th=(e,t)=>{var s;let n=G(e),i=e.state.doc.lineAt(n.pos).text.match(/(\\begin{[^]]*}|\\\\|^)((?:\s|&)+)/),o=(s=i==null?void 0:i[2].trimStart())!=null?s:"";if(vt(e,t)){let a=new U([new le(` \\\\
|
||||||
`+a+f}),n};function Qt(t){Ir(t).clearSnippetQueue()}var Kt=require("@codemirror/state");var Yt=require("@codemirror/state"),Ro=require("@codemirror/commands");var Mr=require("@codemirror/view"),Nt=require("@codemirror/state"),ko=Nt.StateEffect.define(),Po=Nt.StateEffect.define(),St=Nt.StateField.define({create(){return{index:0,tabstopGroups:[],color:0}},update(t,e){let r=t.tabstopGroups,n=t.color;r.forEach(s=>s.map(e.changes));for(let s of e.effects)s.is(ko)?r.splice(t.index,1,...s.value):s.is(Po)&&(r=[],n=0);let i=t.index;return e.selection&&(i=rp(r,e.selection),r.length<=1||i>=r.length-1?(r=[],i=0,n=0):r[0].hideFromEditor()),{index:i,tabstopGroups:r,color:n}},provide:t=>Mr.EditorView.decorations.of(e=>{let r=e.state.field(t).tabstopGroups,n=[];for(let i of r)i.hidden||n.push(...i.getRanges());return Mr.Decoration.set(n,!0)})});function rp(t,e){for(let r=0;r<t.length;r++)if(t[r].containsSelection(e))return r;return t.length}function Gr(t){return{effects:[ko.of(t)]}}function Br(t){t.dispatch({effects:[Po.of(null)]})}var np=3;function Eo(t){return t.state.field(St).color++%np}var Ft=Yt.StateEffect.define(),$t=Yt.StateEffect.define(),_o=Yt.StateEffect.define(),Co=Yt.StateEffect.define(),Ao=Ro.invertedEffects.of(t=>{let e=[];for(let r of t.effects)r.is(Ft)?e.push(_o.of(r.value)):r.is(_o)?e.push(Ft.of(r.value)):r.is($t)?e.push(Co.of(null)):r.is(Co)&&e.push($t.of(null));return e}),qo=t=>{let e=t.transactions.find(n=>n.isUserEvent("undo")),r=t.transactions.find(n=>n.isUserEvent("redo"));for(let n of t.transactions)for(let i of n.effects)i.is(Ft)&&r&&t.view.dispatch({effects:Gr(i.value).effects});e&&Br(t.view)};var Xo=require("@codemirror/commands");var Ht=require("@codemirror/state"),vt=require("@codemirror/view");var jo="latex-suite-snippet-placeholder";function ip(t,e,r){let n=`${jo} ${jo}-${r}`;return vt.Decoration.mark({inclusive:!0,color:r,class:n}).range(t,e)}var ai=class{constructor(e,r){let n=e.map(i=>ip(i.from,i.to,r));this.decos=vt.Decoration.set(n,!0),this.color=r,this.hidden=!1}select(e,r,n){let i=this.toEditorSelection(),s=r?Zo(i):i;e.dispatch({selection:s,effects:n?$t.of(null):void 0}),yt(),this.hideFromEditor()}toSelectionRanges(){let e=[],r=this.decos.iter();for(;r.value!=null;)e.push(Ht.EditorSelection.range(r.from,r.to)),r.next();return e}toEditorSelection(e=!1){let r=Ht.EditorSelection.create(this.toSelectionRanges());return e&&(r=Zo(r)),r}containsSelection(e){function r(s,o){for(let a of o)if(a.from<=s.from&&a.to>=s.to)return!0;return!1}let n=this.toSelectionRanges(),i=!0;for(let s of e.ranges)if(!r(s,n)){i=!1;break}return i}hideFromEditor(){this.hidden=!0}map(e){this.decos=this.decos.map(e)}getRanges(){let e=[],r=this.decos.iter();for(;r.value!=null;)r.from!=r.to?e.push(r.value.range(r.from,r.to)):e.push(op(r.from,r.to)),r.next();return e}};function li(t,e){let r={};for(let s of t){let o=String(s.number);r[o]?r[o].push(s):r[o]=[s]}let n=[],i=Object.keys(r);i.sort((s,o)=>parseInt(s)-parseInt(o));for(let s of i){let o=new ai(r[s],e);n.push(o)}return n}function Zo(t){let e=t.ranges.map(r=>Ht.EditorSelection.range(r.to,r.to));return Ht.EditorSelection.create(e)}var sp=vt.Decoration.widget({widget:new class extends vt.WidgetType{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}});function op(t,e){return sp.range(t,e)}function Ge(t){let e=Ir(t).snippetQueueValue;if(e.length===0)return!1;let r=t.state.doc.length,n=ap(t,e),i=t.state.selection.map(n,1),s=n.apply(t.state.doc).toString(),o=lp(s,e,r),a={changes:n,selection:i};return o.length===0?(t.dispatch(a),Qt(t),!0):(cp(t,o,a,s.length),Qt(t),!0)}function ap(t,e){let r=t.state.doc,n=r.length,i=[];for(let l of e)if(l.keyPressed&&l.keyPressed.length===1){let c=t.state.doc.sliceString(l.to-1,l.to),p=l.to===0?0:l.to-1;i.push({from:p,to:l.to,insert:c+l.keyPressed})}i.length>0&&t.dispatch({changes:i,annotations:Xo.isolateHistory.of("full")});let s=Kt.ChangeSet.of(i,n).invert(r),o=Kt.ChangeSet.of(e,n);return s.compose(o)}function lp(t,e,r){let n=Kt.ChangeSet.of(e,r),s=e.map(a=>a.from).map(a=>n.mapPos(a)),o=[];for(let a=0;a<e.length;a++)o.push(...e[a].getTabstops(t,s[a]));return o}function cp(t,e,r,n){let i=Kt.ChangeSet.of(e.map(d=>({from:d.from,to:d.to,insert:d.replacement})),n),s=Eo(t),o=li(e,s);o.forEach(d=>d.map(i));let a=li(e,s);a.forEach(d=>d.map(i));let l=Gr(o).effects,u={selection:o[0].toEditorSelection(),effects:$t.of(null),sequential:!0};t.dispatch({effects:[...l,Ft.of(a)],changes:r.changes.compose(i),selection:r.selection},u)}function ci(t,e){let r=t.state.field(St).tabstopGroups,n=t.state.field(St).index;function i(o,a){let l=r[o];if(!l)return!1;let c=t.state.selection,p=l.toEditorSelection();return l.containsSelection(c)&&(p=l.toEditorSelection(!0)),c.eq(p)?i(o+a,a):(t.dispatch({selection:p}),yt(),!0)}let s=e?-1:1;return i(n+s,s)}var pi=t=>{let e=[],r=0;for(;r<t.length;){let n=t[r];if(/\s/.test(n)){r++;continue}let{token:i,nextIndex:s}=pp(t,r);e.push(i),r=s}return e},pp=(t,e)=>{s
Line truncated
|
`+o),new qe(0,"")]);We(e,n.pos,n.pos,a.applyInsert(Fe)),tt(e)}else e.dispatch(e.state.replaceSelection(` \\\\ ${o}`));return!0},nh=(e,t)=>{let n=G(e);if(vt(e,t)){let r=e.state.doc,i=r.lineAt(n.pos).number+1,o=r.line(i),s=o.text,a=/\\end{([^}]*)}/.exec(s),l=o.to;if(a&&a[1]&&a.index!==void 0){let c=a[1];W(e).matrixShortcutsEnvNames.includes(c)&&(l=o.from+a.index+a[0].length)}Le(e,l)}else Le(e,t.outer_end);return!0},rh=e=>e.state.selection.main.empty?(e.dispatch(e.state.replaceSelection(" & ")),!0):!1,ni=e=>t=>{let n=G(t);if(!n.mode.strictlyInMath()||!n.getBounds())return!1;let i=n.getEnvNames(n.pos).next().value;if(!i)return!1;let{matrixShortcutsEnvNames:o,matrixShortcutsMacroNames:s}=W(t);return i.kind==="environment"&&!o.includes(i.name)||i.kind==="command"&&!s.includes(i.name)||i.kind==="math"?!1:e(t,i)},ih=e=>{let t=G(e),n=e.state.doc.lineAt(t.pos),r=n.text.slice(t.pos-n.from),i=Ep(e,r);return i!==null?(Le(e,t.pos+i),!0):!1},tn=ni(th),ri=ni(nh),ii=ni(rh),oi=ni(ih);var qp=require("@codemirror/commands"),Y$=require("@codemirror/state");function oh(e){let n=G(e).getBounds();if(!n)return!1;let{inner_start:r,inner_end:i}=n,o="\\boxed{"+e.state.sliceDoc(r,i)+"}",s=e.state.sliceDoc(r-2,r)==="$$"&&e.state.sliceDoc(i,i+2)==="$$";s&&(o=`
|
||||||
`;)n++;return{token:{start:e,end:n,text:t.slice(e,n)},nextIndex:n}},Op=(t,e)=>{let r=t.length,n=e+1,i=t[n];if(/[A-Za-z]/.test(i))do n++;while(n<r&&/[A-Za-z]/.test(t[n]));else n++;return{token:{start:e,end:n,text:t.slice(e,n)},nextIndex:n}},hp=(t,e)=>{let r=e+1;return{token:{start:e,end:r,text:t.slice(e,r)},nextIndex:r}};var dp=new Set(["\\left","\\bigl","\\Bigl","\\biggl","\\Biggl"]),fp=new Set(["\\right","\\bigr","\\Bigr","\\biggr","\\Biggr"]),mp=new Set(["(",")","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","<",">","\\langle","\\rangle","\\lt","\\gt","|","\\vert","\\lvert","\\rvert","\\|","\\Vert","\\lVert","\\rVert","\\lfloor","\\rfloor","\\lceil","\\rceil","\\ulcorner","\\urcorner","/","\\\\","\\backslash","\\uparrow","\\downarrow","\\Uparrow","\\Downarrow","."]),ui={"(":")","[":"]","{":"}","\\lbrack":"\\rbrack","\\lbrace":"\\rbrace","\\langle":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\ulcorner":"\\urcorner","<":">"},gp=t=>dp.has(t.text),Wo=t=>fp.has(t.text),Oi=t=>mp.has(t.text),bp=(t,e)=>e.has(t.text),yp=(t,e,r)=>{let n=t[e];if(e>0){let i=t[e-1];if(Wo(i)&&Oi(n))return!0;if(gp(i)&&Oi(n))return!1}return bp(n,r)},xp=(t,e)=>{let r=t[e];if(!Wo(r))return!1;if(e+1>=t.length)return!0;let n=t[e+1];return!Oi(n)},hi=(t,e)=>{var b;if(!e.mode.inMath())return!1;let r=e.getBounds();if(!r)return!1;let{inner_start:n,inner_end:i,outer_end:s,outer_start:o}=r;if(s<=e.pos)return!1;let a=t.state.doc,l=t.state.selection.main.to,c=l-n,p=a.sliceString(n,i),u=pi(p),d=X(t).taboutClosingSymbols,O=u.findIndex(y=>y.end>c),h=O===-1?u.length:O;for(let y=h;y<u.length;y++){if(yp(u,y,d))return ke(t,n+u[y].end),!0;if(xp(u,y))return console.warn("[tabout] Found right command without following delimiter:",u[y].text,"at index",n+u[y].start),ke(t,n+u[y].end),!0}if(!(a.sliceString(l,i).trim().length===0))return!1;if(e.mode.inlineMath||e.mode.codeMath)ke(t,s);else{let y=a.lineAt(s),x=[],S=((b=a.lineAt(o).text.match(/^\s*/))==null?void 0:b[0])||"";if(y.number===a.lines)x.push({changes:{from:y.to,to:y.to,insert:`
|
`+o+`
|
||||||
`+S},selection:{anchor:y.to+1+S.length}});else{let m=a.lineAt(y.to+1);m.text.trim()===""?x.push({changes:{from:m.from,to:m.to,insert:S},selection:{anchor:y.to+1+S.length}}):x.push({selection:{anchor:y.to+1}})}let Q=a.lineAt(l);Q.text.trimEnd()!==Q.text&&x.push({changes:{from:Q.from,to:Q.to,insert:Q.text.trimEnd()}}),t.dispatch(...x)}return!0},Vo=(t,e)=>{let r=pi(e),n=X(t).taboutClosingSymbols,i=[],s=ur(new Set(Object.values(ui)),n),o=new Set(Object.keys(ui).filter(a=>s.has(ui[a])));for(let a=0;a<r.length;a++){let l=r[a];if(s.has(l.text)){if(i.length===0)return l.end;i.pop()}else o.has(l.text)&&i.push(l.text)}return null},Io=(t,e)=>{let r=t.state.selection.main;if(!r.empty)return!1;let n=r.from,i=zt(t,n);return i===e&&[")","]","}"].includes(i)};var Qp=t=>{var s;let e=I(t),n=t.state.doc.lineAt(e.pos).text.match(new RegExp("(?<=\\\\begin{[^]]*}|\\\\\\\\|^)(\\s|\\&)+")),i=(s=n==null?void 0:n[0].trimStart())!=null?s:"";return e.mode.blockMath?(qe(t,e.pos,e.pos,` \\\\
|
`);let a=e.state.selection.main.to;yn(e,r,i,o),Le(e,a+7+(s?1:0))}function sh(){return{id:"latex-suite-box-equation",name:"Box current equation",editorCheckCallback:(e,t)=>{let n=t.cm,i=G(n).mode.inMath();if(e)return i;i&&oh(n)}}}function ah(){return{id:"latex-suite-select-equation",name:"Select current equation",editorCheckCallback:(e,t)=>{let n=t.cm,r=G(n),i=r.mode.inMath();if(e)return i;if(!i)return;let o=r.getBounds();if(!o)return!1;let{inner_start:s,inner_end:a}=o,l=n.state.doc.toString();l.charAt(s)===`
|
||||||
${i}$0`),Ge(t)):t.dispatch(t.state.replaceSelection(` \\\\ ${i}`)),!0},Sp=(t,e)=>{let r=I(t);if(r.mode.blockMath){let n=t.state.doc,i=n.lineAt(r.pos).number+1,s=n.line(i);ke(t,s.to)}else r.mode.inlineMath&&ke(t,e.outer_end);return!0},$p=t=>t.state.selection.main.empty?(t.dispatch(t.state.replaceSelection(" & ")),!0):!1,Dr=t=>e=>{let r=I(e);if(!r.mode.strictlyInMath())return!1;let i=X(e).matrixShortcutsEnvNames.map(o=>({openSymbol:"\\begin{"+o+"}",closeSymbol:"\\end{"+o+"}"})),s=r.isWithinEnvironment(r.pos,i);return s?t(e,s):!1},vp=t=>{let e=I(t),r=t.state.doc.lineAt(e.pos),n=r.text.slice(e.pos-r.from),i=Vo(t,n);return i!==null?(ke(t,e.pos+i),!0):!1},zr=Dr(Qp),Mo=Dr(Sp),Go=Dr($p),Bo=Dr(vp);var zo=require("@codemirror/commands");function Tp(t){let r=I(t).getBounds();if(!r)return!1;let{inner_start:n,inner_end:i}=r,s="\\boxed{"+t.state.sliceDoc(n,i)+"}",o=t.state.sliceDoc(n-2,n)==="$$"&&t.state.sliceDoc(i,i+2)==="$$";o&&(s=`
|
`&&s++,l.charAt(a-1)===`
|
||||||
`+s+`
|
`&&a--,ja(n,s,a)}}}function lh(e){return{id:"latex-suite-enable-all-features",name:"Enable all features",callback:()=>y(this,null,function*(){e.settings.snippetsEnabled=!0,e.settings.autofractionEnabled=!0,e.settings.matrixShortcutsEnabled=!0,e.settings.taboutEnabled=!0,e.settings.autoEnlargeBrackets=!0,yield e.saveSettings()})}}function ch(e){return{id:"latex-suite-disable-all-features",name:"Disable all features",callback:()=>y(this,null,function*(){e.settings.snippetsEnabled=!1,e.settings.autofractionEnabled=!1,e.settings.matrixShortcutsEnabled=!1,e.settings.taboutEnabled=!1,e.settings.autoEnlargeBrackets=!1,yield e.saveSettings()})}}function ph(e){return{id:"latex-suite-toggle-all-features",name:"Toggle all features",callback:()=>y(this,null,function*(){let t=e.settings.snippetsEnabled||e.settings.autofractionEnabled||e.settings.matrixShortcutsEnabled||e.settings.taboutEnabled||e.settings.autoEnlargeBrackets;e.settings.snippetsEnabled=!t,e.settings.autofractionEnabled=!t,e.settings.matrixShortcutsEnabled=!t,e.settings.taboutEnabled=!t,e.settings.autoEnlargeBrackets=!t,yield e.saveSettings()})}}function uh(e){return{id:"latex-suite-toggle-conceal",name:"Toggle conceal",callback:()=>y(this,null,function*(){e.settings.concealEnabled=!e.settings.concealEnabled,yield e.saveSettings()})}}var Rp=e=>[sh(),ah(),lh(e),ch(e),uh(e),ph(e)];function ea(e){return{id:"latex-suite-vim-select-mode",defineType:"defineAction",type:"action",action:t=>{var i;let n=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;if(!n)return;let r=t.listSelections();n.enterInsertMode(t),t.setSelections(r)},key:e.vimSelectMode,context:"visual"}}function ta(e){return{id:"latex-suite-vim-visual-mode",defineType:"defineAction",type:"action",action:t=>{var i;if(!t.somethingSelected())return;let n=t.listSelections(),r=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;r&&(r.exitInsertMode(t),t.setSelections(n))},key:e.vimVisualMode,context:"insert"}}function Hn(e){return{id:"latex-suite-vim-special-enter",defineType:"defineAction",type:"action",action:t=>{var a;let n=(a=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:a.Vim;if(!n)return;let r=t.getCursor().line,i=t.getLine(r);t.setCursor({line:r,ch:i.length+1});let o=Cp.EditorView.findFromDOM(t.getWrapperElement());if(!o)return;if(tn(o)){n.enterInsertMode(t);return}(0,qp.insertNewlineAndIndent)({state:t.cm6.state,dispatch:l=>{let c=t.cm6;if(c.state.readOnly)return;let p="input.type.compose";if(t.curOp&&!t.curOp.lastChange&&(p="input.type.compose.start"),Array.isArray(l.annotations))try{l.annotations.forEach(u=>{u.value==="input"&&(u.value=p)})}catch(u){console.error(u)}else l.userEvent=p;c.dispatch(l)}})||console.error("Failed to insert newline and indent latex-suite-insert-newline-and-indent"),n.enterInsertMode(t)},key:e.vimMatrixEnter,context:"normal"}}function si(e){return[ea(e),ta(e),Hn(e)]}var te=require("obsidian");var Xp=window.i18next,na=Xp.createInstance();na.init({lng:Xp.language,fallbackLng:"en"});var _p=na,h=na.getFixedT(null,"settings");var li=require("@codemirror/state"),ra=require("@codemirror/view");var ci=class extends te.SettingTab{constructor(n,r){super();this.app=n;this.plugin=r;this.snippetsEditor=null;this.snippetVariablesEditor=null}getSettingDefinitions(){return[...this.getSnippetDefinitions(),...this.getConcealDefinitions(),...this.getColorHighlightBracketsDefinitions(),...this.getPopupPreviewDefinitions(),...this.getAutofractionDefinitions(),...this.getMatrixShortcutsDefinitions(),...this.getTaboutDefinitions(),...this.getAutoEnlargeBracketsDefinitions(),...this.getVimSettingDefinitions(),...this.getKeyMapDefinitions(),...this.getExperimentalDefinitions()]}getSnippetDefinitions(){let n=[];n.push({name:h("snippets.enabled.name"),desc:this.renderHtml(h("snippets.enabled.desc")),control:N("snippetsEnabled")},{name:h("snippets.snippets.name"),desc:this.renderHtml(h("snippets.snippets.desc")),render:i=>{var o;(o=this.snippetsEditor)==null||o.destroy(),this.snippetsEditor=Ap(i,this.plugin,{type:"snippets",validate:s=>y(this,null,function*(){let a=yield Ie(this.plugin.settings.snippetVariables,"snippet-variables.js");yield lt(s,a,"snippets.js")}),deleted:`export default [
|
||||||
`);let a=t.state.selection.main.to;jr(t,n,i,s),ke(t,a+7+(o?1:0))}function wp(){return{id:"latex-suite-box-equation",name:"Box current equation",editorCheckCallback:(t,e)=>{let r=e.cm,i=I(r).mode.inMath();if(t)return i;i&&Tp(r)}}}function kp(){return{id:"latex-suite-select-equation",name:"Select current equation",editorCheckCallback:(t,e)=>{let r=e.cm,n=I(r),i=n.mode.inMath();if(t)return i;if(!i)return;let s=n.getBounds();if(!s)return!1;let{inner_start:o,inner_end:a}=s,l=r.state.doc.toString();l.charAt(o)===`
|
|
||||||
`&&o++,l.charAt(a-1)===`
|
]`})},visible:()=>!this.plugin.settings.loadSnippetsFromFile},{name:h("snippets.load-from-file.name"),desc:this.renderHtml(h("snippets.load-from-file.desc")),control:N("loadSnippetsFromFile")},{name:h("snippets.file-path.name"),desc:this.renderHtml(h("snippets.file-path.desc")),render:i=>{this.fileSearch(i,"snippetsFileLocation")},visible:()=>this.plugin.settings.loadSnippetsFromFile});let r=[{name:h("advanced-snippets.variables.name"),desc:this.renderHtml(h("advanced-snippets.variables.desc")),render:i=>{var o;(o=this.snippetVariablesEditor)==null||o.destroy(),this.snippetVariablesEditor=Ap(i,this.plugin,{type:"snippetVariables",validate:s=>y(this,null,function*(){yield Ie(s,"snippet-variables.js")}),deleted:`export default {
|
||||||
`&&a--,fo(r,o,a)}}}function Pp(t){return{id:"latex-suite-enable-all-features",name:"Enable all features",callback:()=>v(this,null,function*(){t.settings.snippetsEnabled=!0,t.settings.autofractionEnabled=!0,t.settings.matrixShortcutsEnabled=!0,t.settings.taboutEnabled=!0,t.settings.autoEnlargeBrackets=!0,yield t.saveSettings()})}}function Ep(t){return{id:"latex-suite-disable-all-features",name:"Disable all features",callback:()=>v(this,null,function*(){t.settings.snippetsEnabled=!1,t.settings.autofractionEnabled=!1,t.settings.matrixShortcutsEnabled=!1,t.settings.taboutEnabled=!1,t.settings.autoEnlargeBrackets=!1,yield t.saveSettings()})}}function _p(t){return{id:"latex-suite-toggle-all-features",name:"Toggle all features",callback:()=>v(this,null,function*(){let e=t.settings.snippetsEnabled||t.settings.autofractionEnabled||t.settings.matrixShortcutsEnabled||t.settings.taboutEnabled||t.settings.autoEnlargeBrackets;t.settings.snippetsEnabled=!e,t.settings.autofractionEnabled=!e,t.settings.matrixShortcutsEnabled=!e,t.settings.taboutEnabled=!e,t.settings.autoEnlargeBrackets=!e,yield t.saveSettings()})}}function Cp(t){return{id:"latex-suite-toggle-conceal",name:"Toggle conceal",callback:()=>v(this,null,function*(){t.settings.concealEnabled=!t.settings.concealEnabled,yield t.saveSettings()})}}var Lo=t=>[wp(),kp(),Pp(t),Ep(t),Cp(t),_p(t)];function di(t){return{id:"latex-suite-vim-select-mode",defineType:"defineAction",type:"action",action:e=>{var i;let r=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;if(!r)return;let n=e.listSelections();r.enterInsertMode(e),e.setSelections(n)},key:t.vimSelectMode,context:"visual"}}function fi(t){return{id:"latex-suite-vim-visual-mode",defineType:"defineAction",type:"action",action:e=>{var i;if(!e.somethingSelected())return;let r=e.listSelections(),n=(i=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:i.Vim;n&&(n.exitInsertMode(e),e.setSelections(r))},key:t.vimVisualMode,context:"insert"}}function mi(t){return{id:"latex-suite-vim-special-enter",defineType:"defineAction",type:"action",action:e=>{var a;let r=(a=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:a.Vim;if(!r)return;let n=e.getCursor().line,i=e.getLine(n);e.setCursor({line:n,ch:i.length+1});let s=Do.EditorView.findFromDOM(e.getWrapperElement());if(!s)return;if(zr(s)){r.enterInsertMode(e);return}(0,zo.insertNewlineAndIndent)({state:e.cm6.state,dispatch:l=>{let c=e.cm6;if(c.state.readOnly)return;let p="input.type.compose";if(e.curOp&&!e.curOp.lastChange&&(p="input.type.compose.start"),Array.isArray(l.annotations))try{l.annotations.forEach(u=>{u.value==="input"&&(u.value=p)})}catch(u){console.error(u)}else l.userEvent=p;c.dispatch(l)}})||console.error("Failed to insert newline and indent latex-suite-insert-newline-and-indent"),r.enterInsertMode(e)},key:t.vimMatrixEnter,context:"normal"}}function Lr(t){return[di(t),fi(t),mi(t)]}var Nr=class extends w.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}hide(){var e;(e=this.snippetsEditor)==null||e.destroy()}addHeading(e,r,n="math"){let s=new w.Setting(e).setName(r).setHeading().settingEl,o=s.createDiv();(0,w.setIcon)(o,n),o.addClass("latex-suite-settings-icon"),s.prepend(o)}display(){let{containerEl:e}=this;e.empty(),this.displaySnippetSettings(),this.displayConcealSettings(),this.displayColorHighlightBracketsSettings(),this.displayPopupPreviewSettings(),this.displayAutofractionSettings(),this.displayMatrixShortcutsSettings(),this.displayTaboutSettings(),this.displayAutoEnlargeBracketsSettings(),this.displayAdvancedSnippetSettings()}displaySnippetSettings(){let e=this.containerEl;this.addHeading(e,"Snippets","ballpen"),new w.Setting(e).setName("Enabled").setDesc("Whether snippets are enabled.").addToggle(a=>a.setValue(this.plugin.settings.snippetsEnabled).onChange(l=>v(this,null,function*(){this.plugin.settings.snippetsEnabled=l,yield this.plugin.saveSettings()})));let r=new w.Setting(e).setName("Snippets").setDesc('Enter snippets here. Remember to add a comma after each snippet, and escape all backslashes with an extra \\. Lines starting with "//" will be treated as comments and ignored.').setClass("snippets-text-area");this.createSnippetsEditor(r),new w.Setting(e).setName("Load snippets from file or folder").setDesc("Whether to load snippets from a specified file, or from all files within a folder (instead of from the plugin settings).").addToggle(a=>a.setValue(this.plugin.settings.loadSnippetsFromFile).onChange(l=>v(this,null,function*(){this.plugin.settings.loadSnippetsFromFile=l,r.settingEl.toggleClass("hidden",l),this.snippetsFileLocEl!=null&&this.snippetsFileLocEl.toggleClass("hidden",!l),yield this.plugin.saveSettings()})));let n=new DocumentFragment;n.createDiv({},a=>{a.innerHTML=`
|
|
||||||
The file or folder to load snippets from. The file or folder must be within your vault, and not within a hidden folder (such as <code>.obsidian/</code>).`});let i=new w.Setting(e).setName("Snippets file or folder location").setDesc(n),s;i.addSearch(a=>{a.setPlaceholder(W.snippetsFileLocation).setValue(this.plugin.settings.snippetsFileLocation).onChange((0,w.debounce)(l=>v(this,null,function*(){this.plugin.settings.snippetsFileLocation=l,yield this.plugin.saveSettings(!0)}),500,!0)),s=a.inputEl,s.addClass("latex-suite-location-input-el"),new It(this.app,s)}),this.snippetsFileLocEl=i.settingEl;let o=this.plugin.settings.loadSnippetsFromFile;r.settingEl.toggleClass("hidden",o),this.snippetsFileLocEl.toggleClass("hidden",!o),this.createTriggerSetting(e,"non-auto snippets","snippetsTrigger"),this.createTriggerSetting(e,"next tabstop","snippetNextTabstopTrigger"),this.createTriggerSetting(e,"previous tabstop","snippetPreviousTabstopTrigger")}displayConcealSettings(){let e=this.containerEl;this.addHeading(e,"Conceal","math-integral-x");let r=new DocumentFragment;r.createDiv({},i=>i.setText("Make equations more readable by hiding LaTeX syntax and instead displaying it in a pretty format.")),r.createDiv({},i=>i.innerHTML=`
|
}`})},visible:()=>!this.plugin.settings.loadSnippetVariablesFromFile},{name:h("advanced-snippets.load-variables-from-file.name"),desc:this.renderHtml(h("advanced-snippets.load-variables-from-file.desc")),control:N("loadSnippetVariablesFromFile")},{name:h("advanced-snippets.variables-file-path.name"),desc:this.renderHtml(h("advanced-snippets.variables-file-path.desc")),render:i=>{this.fileSearch(i,"snippetVariablesFileLocation")},visible:()=>this.plugin.settings.loadSnippetVariablesFromFile},{name:h("advanced-snippets.word-delimiters.name"),desc:this.renderHtml(h("advanced-snippets.word-delimiters.desc")),control:{type:"text",key:"wordDelimiters",defaultValue:q.wordDelimiters}},{name:h("advanced-snippets.trailing-whitespace.name"),desc:this.renderHtml(h("advanced-snippets.trailing-whitespace.desc")),control:N("removeSnippetWhitespace")},{name:h("advanced-snippets.auto-delete$.name"),desc:this.renderHtml(h("advanced-snippets.auto-delete$.desc")),control:N("autoDelete$")},{name:h("advanced-snippets.suppress-IME-warning.name"),desc:this.renderHtml(h("advanced-snippets.suppress-IME-warning.desc")),control:N("suppressIMEWarning"),visible:()=>dh()&&this.plugin.settings.suppressSnippetTriggerOnIME},{name:h("advanced-snippets.suppress-IME.name"),desc:this.renderHtml(h("advanced-snippets.suppress-IME.desc")),control:N("suppressSnippetTriggerOnIME")},{name:h("advanced-snippets.code-languages.name"),desc:this.renderHtml(h("advanced-snippets.code-languages.desc")),control:ai("forceMathLanguages")},{name:h("advanced-snippets.snippet-debug-mode.name"),desc:this.renderHtml(h("advanced-snippets.snippet-debug-mode.desc")),control:{type:"dropdown",key:"snippetDebug",options:{off:h("advanced-snippets.snippet-debug-mode.options.off"),info:h("advanced-snippets.snippet-debug-mode.options.info"),verbose:h("advanced-snippets.snippet-debug-mode.options.verbose")},defaultValue:q.snippetDebug}}];return[{type:"page",name:h("snippets.heading"),items:[...n,{type:"group",heading:h("advanced-snippets.heading"),items:r}]}]}getConcealDefinitions(){let n=[{name:h("conceal.enabled.name"),desc:this.renderHtml(h("conceal.enabled.desc")),control:N("concealEnabled")},{name:h("conceal.reveal-delay.name"),desc:this.renderHtml(h("conceal.reveal-delay.desc")),control:{type:"number",key:"concealRevealTimeout",defaultValue:q.concealRevealTimeout,min:0}}];return[{type:"page",name:h("conceal.heading"),items:n}]}getColorHighlightBracketsDefinitions(){let n=[{name:h("highlight-brackets.color-brackets.name"),desc:this.renderHtml(h("highlight-brackets.color-brackets.desc")),control:N("colorPairedBracketsEnabled")},{name:h("highlight-brackets.highlight-brackets.name"),desc:this.renderHtml(h("highlight-brackets.highlight-brackets.desc")),control:N("highlightCursorBracketsEnabled")},{name:h("highlight-brackets.color-math.name"),desc:this.renderHtml(h("highlight-brackets.color-math.desc")),control:N("highlightDollarEnabled")}];return[{type:"page",name:h("highlight-brackets.heading"),items:n}]}getPopupPreviewDefinitions(){let n=[{name:h("math-preview.enabled.name"),desc:this.renderHtml(h("math-preview.enabled.desc")),control:N("mathPreviewEnabled")},{name:h("math-preview.position.name"),desc:this.renderHtml(h("math-preview.position.desc")),render:r=>{r.addDropdown(i=>i.addOption("above",h("math-preview.position.options.above")).addOption("below",h("math-preview.position.options.below")).setValue(this.plugin.settings.mathPreviewPositionIsAbove?"above":"below").onChange(o=>y(this,null,function*(){this.plugin.settings.mathPreviewPositionIsAbove=o==="above",yield this.plugin.saveSettings()})))}},{name:h("math-preview.cursor-symbol.name"),desc:this.renderHtml(h("math-preview.cursor-symbol.desc")),render:r=>{r.addText(i=>{i.setPlaceholder(q.mathPreviewCursor).setValue(this.plugin.settings.mathPreviewCursor).onChange(s=>y(this,null,function*(){this.plugin.settings.mathPreviewCursor=s,yield this.plugin.saveSettings()}));let o=r.controlEl.createEl("datalist",{attr:{id:"math-preview-cursor-list"}});return["\u25B6","\u2503","|","\\_","{\\mid}","{\\triangle}"].forEach(s=>o.createEl("option",{value:s})),i.inputEl.setAttribute("list","math-preview-cursor-list"),i})}},{name:h("math-preview.highlight-brackets.name"),desc:this.renderHtml(h("math-preview.highlight-brackets.desc")),control:N("mathPreviewBracketHighlighting")},{name:h("math-preview.display-live-preview.name"),desc:this.renderHtml(h("math-preview.display-live-preview.desc")),control:N("mathPreviewLivePreviewDisplay")}];return[{type:"page",name:h("math-preview.heading"),items:n}]}getAutofractionDefinitions(){let n=[{name:h("auto-fraction.enabled.name"),desc:this.renderHtml(h("auto-fraction.enabled.desc")),control:N("autofractionEnabled")},{name:h("auto-fraction.fraction-symbol.name"),desc:this.renderHtml(h("auto-fraction.fraction-symbol.desc")),render:r=>{r.addText(i=>{i.setPlaceholder(q.autofractionSymbol).setValue(this.plugin.settings.autofractionSymbol).onChange(s=>y(this,null,function*(){this.plugin.settings.autof
Line truncated
|
||||||
e.g. <code>\\dot{x}^{2} + \\dot{y}^{2}</code> will display as \u1E8B\xB2 + \u1E8F\xB2, and <code>\\sqrt{ 1-\\beta^{2} }</code> will display as \u221A{ 1-\u03B2\xB2 }.
|
|
||||||
`),r.createDiv({},i=>i.setText("LaTeX beneath the cursor will be revealed.")),r.createEl("br"),r.createDiv({},i=>i.setText("Disabled by default to not confuse new users. However, I recommend turning this on once you are comfortable with the plugin!")),new w.Setting(e).setName("Enabled").setDesc(r).addToggle(i=>i.setValue(this.plugin.settings.concealEnabled).onChange(s=>v(this,null,function*(){this.plugin.settings.concealEnabled=s,yield this.plugin.saveSettings()})));let n=new DocumentFragment;n.createDiv({},i=>i.setText("How long to delay the reveal of LaTeX for, in milliseconds, when the cursor moves over LaTeX. Defaults to 0 (LaTeX under the cursor is revealed immediately).")),n.createEl("br"),n.createDiv({},i=>i.setText("Can be set to a positive number, e.g. 300, to delay the reveal of LaTeX, making it much easier to navigate equations using arrow keys.")),n.createEl("br"),n.createDiv({},i=>i.setText("Must be an integer \u2265 0.")),new w.Setting(e).setName("Reveal delay (ms)").setDesc(n).addText(i=>i.setPlaceholder(String(W.concealRevealTimeout)).setValue(String(this.plugin.settings.concealRevealTimeout)).onChange(s=>{/^\d+$/.test(s)&&(this.plugin.settings.concealRevealTimeout=Number(s),this.plugin.saveSettings())}))}displayColorHighlightBracketsSettings(){let e=this.containerEl;this.addHeading(e,"Highlight and color brackets","parentheses"),new w.Setting(e).setName("Color paired brackets").setDesc("Whether to colorize matching brackets.").addToggle(r=>r.setValue(this.plugin.settings.colorPairedBracketsEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.colorPairedBracketsEnabled=n,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Highlight matching bracket beneath cursor").setDesc("When the cursor is adjacent to a bracket, highlight the matching bracket.").addToggle(r=>r.setValue(this.plugin.settings.highlightCursorBracketsEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.highlightCursorBracketsEnabled=n,yield this.plugin.saveSettings()})))}displayPopupPreviewSettings(){let e=this.containerEl;this.addHeading(e,"Math popup preview","superscript");let r=document.createDocumentFragment(),n=document.createElement("div");n.setText("When inside an equation, show a popup preview window of the rendered math.");let i=document.createElement("br"),s=document.createElement("div");s.setText("The popup preview will be shown for all inline math equations, as well as for block math equations in Source mode."),r.append(n,i,s);let o=new w.Setting(e).setName("Enabled").setDesc(r),a=new w.Setting(e).setName("Position").setDesc("Where to display the popup preview relative to the equation source.").addDropdown(u=>u.addOption("Above","Above").addOption("Below","Below").setValue(this.plugin.settings.mathPreviewPositionIsAbove?"Above":"Below").onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewPositionIsAbove=d==="Above",yield this.plugin.saveSettings()}))),l=new w.Setting(e).setName("Cursor symbol").setDesc(`The symbol to use as the cursor in the popup preview such as ${W.mathPreviewCursor}. Leave it blank to turn it off.`).addText(u=>{u.setPlaceholder(W.mathPreviewCursor).setValue(this.plugin.settings.mathPreviewCursor).onChange(O=>v(this,null,function*(){this.plugin.settings.mathPreviewCursor=O,yield this.plugin.saveSettings()}));let d=e.createEl("datalist",{attr:{id:"math-preview-cursor-list"}});return["\u25B6","\u2503","|","\\_","{\\mid}","{\\triangle}"].forEach(O=>d.createEl("option",{value:O})),u.inputEl.setAttribute("list","math-preview-cursor-list"),u}),c=new w.Setting(e).setName("Highlight brackets in preview").setDesc("Whether to highlight the area within the nearest pair of brackets around the cursor in the popup preview.").addToggle(u=>u.setValue(this.plugin.settings.mathPreviewBracketHighlighting).onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewBracketHighlighting=d,yield this.plugin.saveSettings()}))),p=[a,l,c];p.forEach(u=>u.settingEl.toggleClass("hidden",!this.plugin.settings.mathPreviewEnabled)),o.addToggle(u=>u.setValue(this.plugin.settings.mathPreviewEnabled).onChange(d=>v(this,null,function*(){this.plugin.settings.mathPreviewEnabled=d,p.forEach(O=>O.settingEl.toggleClass("hidden",!d)),yield this.plugin.saveSettings()})))}displayAutofractionSettings(){let e=this.containerEl;this.addHeading(e,"Auto-fraction","math-x-divide-y-2"),new w.Setting(e).setName("Enabled").setDesc("Whether auto-fraction is enabled.").addToggle(r=>r.setValue(this.plugin.settings.autofractionEnabled).onChange(n=>v(this,null,function*(){this.plugin.settings.autofractionEnabled=n,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Fraction symbol").setDesc("The fraction symbol to use in the replacement. e.g. \\frac, \\dfrac, \\tfrac").addText(r=>{r.setPlaceholder(W.autofractionSymbol).setValue(this.plugin.settings.autofractionSymbol).onChange(i=>v(this,null,function*(){this.plugin.settings.autofractionSymbol=i,yield this.plugin.saveSettings()}))
Line truncated
|
|
||||||
The file or folder to load snippet variables from. The file or folder must be within your vault, and not within a hidden folder (such as <code>.obsidian/</code>).`});let i=new w.Setting(e).setName("Snippet variables file or folder location").setDesc(n);i.addSearch(O=>{O.setPlaceholder(W.snippetVariablesFileLocation).setValue(this.plugin.settings.snippetVariablesFileLocation).onChange((0,w.debounce)(f=>v(this,null,function*(){this.plugin.settings.snippetVariablesFileLocation=f,yield this.plugin.saveSettings(!0)}),500,!0));let h=O.inputEl;h.addClass("latex-suite-location-input-el"),new It(this.app,h)}),this.snippetVariablesFileLocEl=i.settingEl;let s=this.plugin.settings.loadSnippetVariablesFromFile;r.settingEl.toggleClass("hidden",s),this.snippetVariablesFileLocEl.toggleClass("hidden",!s),new w.Setting(e).setName("Word delimiters").setDesc('Symbols that will be treated as word delimiters, for use with the "w" snippet option.').addText(O=>O.setPlaceholder(W.wordDelimiters).setValue(this.plugin.settings.wordDelimiters).onChange(h=>v(this,null,function*(){this.plugin.settings.wordDelimiters=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Remove trailing whitespaces in snippets in inline math").setDesc("Whether to remove trailing whitespaces when expanding snippets at the end of inline math blocks.").addToggle(O=>O.setValue(this.plugin.settings.removeSnippetWhitespace).onChange(h=>v(this,null,function*(){this.plugin.settings.removeSnippetWhitespace=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Remove closing $ when backspacing inside blank inline math").setDesc("Whether to also remove the closing $ when you delete the opening $ symbol inside blank inline math.").addToggle(O=>O.setValue(this.plugin.settings.autoDelete$).onChange(h=>v(this,null,function*(){this.plugin.settings.autoDelete$=h,yield this.plugin.saveSettings()})));let o=new w.Setting(e).setName("Don't trigger snippets when IME is active").setDesc("Whether to suppress snippets triggering when an IME is active."),a=new w.Setting(e).setName("Suppress IME warning").setDesc("Whether a warning is shown on startup if `Don't trigger snippets when IME is active` is enabled. Disable that setting if you are aware of the IME limitations. Currently only ios and android touch/swipe keyboards like gboard have support for IME. See https://github.com/artisticat1/obsidian-latex-suite/blob/main/DOCS.md#IME-keyboards for more info.").addToggle(O=>O.setValue(this.plugin.settings.suppressIMEWarning).onChange(h=>v(this,null,function*(){this.plugin.settings.suppressIMEWarning=h,yield this.plugin.saveSettings()})));a.settingEl.toggleClass("hidden",!(this.plugin.settings.suppressSnippetTriggerOnIME&&Yr())),o.addToggle(O=>O.setValue(this.plugin.settings.suppressSnippetTriggerOnIME).onChange(h=>v(this,null,function*(){this.plugin.settings.suppressSnippetTriggerOnIME=h,a.settingEl.toggleClass("hidden",!(h&&Yr())),yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Code languages to interpret as math mode").setDesc("Codeblock languages where the whole code block should be treated like a math block, separated by commas.").addText(O=>O.setPlaceholder(W.forceMathLanguages).setValue(this.plugin.settings.forceMathLanguages).onChange(h=>v(this,null,function*(){this.plugin.settings.forceMathLanguages=h,yield this.plugin.saveSettings()}))),new w.Setting(e).setName("Snippet debug mode").setDesc('Set the level of debug information to log about snippet expansion. Set to "info" or "verbose" to help identify issues with snippet syntax or why a snippet is not expanding. Verbose mode will log most information to the developer console on debug level.').addDropdown(O=>O.addOption("off","Off").addOption("info","Info").addOption("verbose","Verbose").setValue(this.plugin.settings.snippetDebug).onChange(h=>v(this,null,function*(){this.plugin.settings.snippetDebug=h,yield this.plugin.saveSettings()})));let l=new w.Setting(e).setName("Vim key bindings").setDesc("turn on/off vim keybindings. Note vim needs to be enabled in obsidian itself."),c=[],p=new w.Setting(e).setName("Vim: Switch from visual mode to select mode").setDesc(`maps the key to switch from visual mode to select mode.
|
|
||||||
Keymap must be a vim keymap and can't contain any spaces. Use empty string to disable this feature.
|
Keymap must be a vim keymap and can't contain any spaces. Use empty string to disable this feature.
|
||||||
(select mode=insert keybindings)`).addText(O=>O.setPlaceholder(W.vimSelectMode).setValue(this.plugin.settings.vimSelectMode).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimSelectMode;this.plugin.settings.vimSelectMode=h,yield this.plugin.saveSettings();let g=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;if(!g)return;let b=di(this.plugin.settings);g[b.defineType](b.id,b.action),g.mapCommand(b.key,b.type,b.id,{},{context:b.context}),g.unmap(f,b.context)})));c.push(p);let u=new w.Setting(e).setName("Vim: Switch from select mode to visual mode").setDesc(`maps the key to switch from select mode to visual mode.
|
(select mode=insert keybindings)`).addText(f=>f.setPlaceholder(q.vimSelectMode).setValue(this.plugin.settings.vimSelectMode).onChange(m=>y(this,null,function*(){var $;let g=this.plugin.settings.vimSelectMode;this.plugin.settings.vimSelectMode=m,yield this.plugin.saveSettings();let b=($=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:$.Vim;if(!b)return;let v=ea(this.plugin.settings);b[v.defineType](v.id,v.action),b.mapCommand(v.key,v.type,v.id,{},{context:v.context}),b.unmap(g,v.context)})));p.push(u);let O=new Q.Setting(n).setName("Vim: Switch from select mode to visual mode").setDesc(`maps the key to switch from select mode to visual mode.
|
||||||
must be a vim keymap and can't contain any spaces. Example <C-g><C-A-i> = Ctrl-g + Ctrl-Alt-i.
|
must be a vim keymap and can't contain any spaces. Example <C-g><C-A-i> = Ctrl-g + Ctrl-Alt-i.
|
||||||
Please check the vim keybinding first on another command like w before reporting it. Some keybindings like shift don't work due to the original vim plugin. Use empty string to disable this feature.
|
Please check the vim keybinding first on another command like w before reporting it. Some keybindings like shift don't work due to the original vim plugin. Use empty string to disable this feature.
|
||||||
(select mode=insert keybindings)`).addText(O=>{O.setPlaceholder(W.vimVisualMode).setValue(this.plugin.settings.vimVisualMode).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimVisualMode;this.plugin.settings.vimVisualMode=h,yield this.plugin.saveSettings();let g=fi(this.plugin.settings),b=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;b&&(b[g.defineType](g.id,g.action),b.mapCommand(g.key,g.type,g.id,{},{context:g.context}),b.unmap(f,g.context))}))});c.push(u);let d=new w.Setting(e).setName("Vim: run matrix enter").setDesc(`maps the key to the action of inserting a new line below while appending \\\\ to the current line in a matrix environment.
|
(select mode=insert keybindings)`).addText(f=>{f.setPlaceholder(q.vimVisualMode).setValue(this.plugin.settings.vimVisualMode).onChange(m=>y(this,null,function*(){var $;let g=this.plugin.settings.vimVisualMode;this.plugin.settings.vimVisualMode=m,yield this.plugin.saveSettings();let b=ta(this.plugin.settings),v=($=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:$.Vim;v&&(v[b.defineType](b.id,b.action),v.mapCommand(b.key,b.type,b.id,{},{context:b.context}),v.unmap(g,b.context))}))});p.push(O);let d=new Q.Setting(n).setName("Vim: run matrix enter").setDesc(`maps the key to the action of inserting a new line below while appending \\\\ to the current line in a matrix environment.
|
||||||
Use empty string to disable this feature.`).addText(O=>{O.setPlaceholder(W.vimMatrixEnter).setValue(this.plugin.settings.vimMatrixEnter).onChange(h=>v(this,null,function*(){var y;let f=this.plugin.settings.vimMatrixEnter;this.plugin.settings.vimMatrixEnter=h,yield this.plugin.saveSettings();let g=(y=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:y.Vim;if(!g)return;g.unmap(f,"normal");let b=mi(this.plugin.settings);g[b.defineType](b.id,b.action),g.mapCommand(b.key,b.type,b.id,{},{context:b.context}),g.unmap(f,b.context)}))});c.push(d),l.addToggle(O=>{let h=this.plugin.settings.vimEnabled&&(app==null?void 0:app.isVimEnabled());c.forEach(f=>f.settingEl.toggleClass("hidden",!h)),O.setValue(this.plugin.settings.vimEnabled&&(app==null?void 0:app.isVimEnabled())).onChange(f=>v(this,null,function*(){var b;this.plugin.settings.vimEnabled=f,yield this.plugin.saveSettings(),c.forEach(y=>y.settingEl.toggleClass("hidden",!f));let g=(b=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:b.Vim;if(g)for(let y of Lr(this.plugin.settings))g.unmap(y.key,y.context)}))})}createSnippetsEditor(e){let r=e.controlEl.createDiv("snippets-editor-wrapper"),n=e.controlEl.createDiv("snippets-footer"),i=n.createDiv("snippets-editor-validity"),s=new w.ExtraButtonComponent(i);s.setIcon("checkmark").extraSettingsEl.addClass("snippets-editor-validity-indicator");let o=i.createDiv("snippets-editor-validity-text");o.addClass("setting-item-description"),o.style.padding="0";function a(O){s.setIcon(O?"checkmark":"cross"),s.extraSettingsEl.removeClass(O?"invalid":"valid"),s.extraSettingsEl.addClass(O?"valid":"invalid"),o.setText(O?"Saved":"Invalid syntax. Changes not saved")}let l=uo,c=gi.EditorView.updateListener.of(O=>v(this,null,function*(){if(O.docChanged){let h=O.state.doc.toString(),f=!0,g;try{g=yield ze(this.plugin.settings.snippetVariables),yield ut(h,g)}catch(b){f=!1}if(a(f),!f)return;this.plugin.settings.snippets=h,yield this.plugin.saveSettings()}}));l.push(c),this.snippetsEditor=Rp(this.plugin.settings.snippets,l),r.appendChild(this.snippetsEditor.dom);let p=n.createDiv("snippets-editor-buttons");new w.ButtonComponent(p).setIcon("switch").setTooltip("Reset to default snippets").onClick(()=>v(this,null,function*(){new Fr(this.plugin.app,"Are you sure? This will delete any custom snippets you have written.",O=>O.setButtonText("Reset to default snippets").setWarning(),()=>v(this,null,function*(){this.snippetsEditor.setState(Ur.EditorState.create({doc:At,extensions:l})),a(!0),this.plugin.settings.snippets=At,yield this.plugin.saveSettings()})).open()})),new w.ButtonComponent(p).setIcon("trash").setTooltip("Remove all snippets").onClick(()=>v(this,null,function*(){new Fr(this.plugin.app,"Are you sure? This will delete any custom snippets you have written.",O=>O.setButtonText("Remove all snippets").setWarning(),()=>v(this,null,function*(){let O=`[
|
Use empty string to disable this feature.`).addText(f=>{f.setPlaceholder(q.vimMatrixEnter).setValue(this.plugin.settings.vimMatrixEnter).onChange(m=>y(this,null,function*(){var $;let g=this.plugin.settings.vimMatrixEnter;this.plugin.settings.vimMatrixEnter=m,yield this.plugin.saveSettings();let b=($=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:$.Vim;if(!b)return;b.unmap(g,"normal");let v=Hn(this.plugin.settings);b[v.defineType](v.id,v.action),b.mapCommand(v.key,v.type,v.id,{},{context:v.context}),b.unmap(g,v.context)}))});p.push(d),c.addToggle(f=>{var g,b,v,$;let m=this.plugin.settings.vimEnabled&&!!((b=(g=this.app).isVimEnabled)!=null&&b.call(g));p.forEach(S=>S.settingEl.toggleClass("hidden",!m)),f.setValue(this.plugin.settings.vimEnabled&&!!(($=(v=this.app).isVimEnabled)!=null&&$.call(v))).onChange(S=>y(this,null,function*(){var T;this.plugin.settings.vimEnabled=S,yield this.plugin.saveSettings(),p.forEach(P=>P.settingEl.toggleClass("hidden",!S));let E=(T=window==null?void 0:window.CodeMirrorAdapter)==null?void 0:T.Vim;if(E)for(let P of si(this.plugin.settings))E.unmap(P.key,P.context)}))})}displayKeymapSettings(){let n=this.containerEl;this.addHeading(n,"Keymap","keyboard");let r=[["snippet","snippetsTrigger"],["next-tabstop","snippetNextTabstopTrigger"],["prev-tabstop","snippetPreviousTabstopTrigger"],["auto-fraction","autofractionTrigger"],["matrix-newline","matrixShortcutsNewlineTrigger"],["matrix-cell","matrixShortcutsCellTrigger"],["matrix-exit","matrixShortcutsExitTrigger"],["tabout","taboutTrigger"]],i=new Q.Setting(n).setDesc(this.renderMarkdown(h("keymap.desc")));i.setClass("latex-suite-keymap-list"),i.settingEl.createEl("ul",{},o=>{for(let[s,a]of r)o.createEl("li",{cls:"latex-suite-keymap-item"},l=>{new Q.Setting(l).setName(h(`keymap.${s}`)).addText(c=>c.setPlaceholder(q[a]).setValue(this.plugin.settings[a]).onChange(p=>y(this,null,function*(){this.plugin.settings[a]=p,yield this.plugin.saveSettings()})))})})}displayExperimentalSettings(){let n=this.containerEl;this.addHeading(n,"Experimental features","experiment").setDesc("Features that are still in testing and may need user feedback. Backwards compatibility may break for these features/ these settings can be overriden.");let r=new DocumentFragment;r.createDiv({text:"How many times to run snippets in a row. Set to 0 disable recursion. "}).createEl("a",{href:"https://github.com/artisticat1/obsidian-latex-suite/pull/536",text:"Related pr/feedback."}),new Q.Setting(n).setName("Snippet recursion").setDesc(r).addText(o=>o.setPlaceholder(String(q.snippetRecursion)).setValue(String(this.plugin.settings.snippetRecursion)).onChange(s=>y(this,null,function*(){try{let a=parseInt(s,10);if(a<0){new Q.Notice("Snippet recursion must be a non-negative integer.");return}this.plugin.settings.snippetRecursion=a}catch(a){return}yield this.plugin.saveSettings()}))),new Q.Setting(n).setName(h("experimental.excalidraw-enabled.name")).setDesc(h("experimental.excalidraw-enabled.desc")).addToggle(o=>o.setValue(this.plugin.settings.excalidrawSupportEnabled).onChange(s=>y(this,null,function*(){this.plugin.settings.excalidrawSupportEnabled=s,yield this.plugin.saveSettings()}))),new Q.Setting(n).setName(h("experimental.log-level.name")).setDesc(h("experimental.log-level.desc")).addDropdown(o=>o.setValue(this.plugin.settings.logLevel).addOption("off",h("experimental.log-level.options.off")).addOption("info",h("experimental.log-level.options.info")).addOption("verbose",h("experimental.log-level.options.verbose")).addOption("vverbose",h("experimental.log-level.options.vverbose")).onChange(s=>y(this,null,function*(){this.plugin.settings.logLevel=s,yield this.plugin.saveSettings()})))}createSnippetsEditor(n){let r=n.controlEl.createDiv("snippets-editor-wrapper"),i=n.controlEl.createDiv("snippets-footer"),o=i.createDiv("snippets-editor-validity"),s=new Q.ExtraButtonComponent(o);s.setIcon("checkmark").extraSettingsEl.addClass("snippets-editor-validity-indicator");let a=o.createDiv("snippets-editor-validity-text");a.addClass("setting-item-description");function l(m){s.setIcon(m?"checkmark":"cross"),s.extraSettingsEl.removeClass(m?"invalid":"valid"),s.extraSettingsEl.addClass(m?"valid":"invalid"),a.setText(m?"Saved":"Invalid syntax. Changes not saved")}let c=Hr,p=ia.EditorView.updateListener.of(m=>void y(this,null,function*(){if(m.docChanged){let g=m.state.doc.toString(),b=!0,v;try{v=yield Ie(this.plugin.settings.snippetVariables,"snippet-variables.js"),yield lt(g,v,"snippets.js")}catch($){b=!1}if(l(b),!b)return;this.plugin.settings.snippets=g,yield this.plugin.saveSettings(!1,!0)}}));c.push(p);let u=mh(this.plugin.settings.snippets,c,r);this.snippetsEditor=u;let O=i.createDiv("snippets-editor-buttons");new Q.ButtonComponent(O).setIcon("switch").setTooltip("Reset to default snippets").onClick(()=>y(this,null,function*(){new mi(this.plugin.app,"Are you sure? This will delete any custom snippets you have written.",m=>void Bn(m).setButtonText("Reset to default sni
Line truncated
|
||||||
|
|
||||||
]`;this.snippetsEditor.setState(Ur.EditorState.create({doc:O,extensions:l})),a(!0),this.plugin.settings.snippets=O,yield this.plugin.saveSettings()})).open()}))}createTriggerSetting(e,r,n){return new w.Setting(e).setName(`Key trigger for ${r}`).setDesc(Ap(r)).addText(i=>i.setValue(this.plugin.settings[n]).setPlaceholder(W[n]).onChange(s=>v(this,null,function*(){gn(s),this.plugin.settings[n]=s,yield this.plugin.saveSettings()})))}},Fr=class extends w.Modal{constructor(e,r,n,i){super(e),this.contentEl.addClass("latex-suite-confirmation-modal"),this.contentEl.createEl("p",{text:r}),new w.Setting(this.contentEl).addButton(s=>{n(s),s.onClick(()=>v(this,null,function*(){yield i(),this.close()}))}).addButton(s=>s.setButtonText("Cancel").onClick(()=>this.close()))}};function Rp(t,e){return new gi.EditorView({state:Ur.EditorState.create({doc:t,extensions:e})})}function Yr(){return w.Platform.isMobileApp}function Ap(t){let e=new DocumentFragment,r=e.createDiv();return r.innerHTML=`What key to press to trigger ${t}. Should follow codemirror keymap syntax such as "Ctrl-k Ctrl-a". For more info see <a href="https://codemirror.net/docs/ref/#view.KeyBinding">codemirror keymap documentation</a>.`,e}var Uo={math:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
]`;u.setState(Oi.EditorState.create({doc:m,extensions:c})),l(!0),this.plugin.settings.snippets=m,yield this.plugin.saveSettings()})).open()}))}renderMarkdown(n){return ui(n)}},mi=class extends Q.Modal{constructor(t,n,r,i){super(t),this.contentEl.addClass("latex-suite-confirmation-modal"),this.contentEl.createEl("p",{text:n}),new Q.Setting(this.contentEl).addButton(o=>{r(o),o.onClick(()=>y(this,null,function*(){yield i(),this.close()}))}).addButton(o=>o.setButtonText("Cancel").onClick(()=>this.close()))}};function mh(e,t,n){return new ia.EditorView({state:Oi.EditorState.create({doc:e,extensions:t}),parent:n})}function fi(){return Q.Platform.isMobileApp}function Bn(e){return(0,Q.requireApiVersion)("1.13.0")?e.setDestructive().setCta():e.setWarning(),e}var Wp={math:`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
<path d="M19 5h-7l-4 14l-3 -6h-2"></path>
|
<path d="M19 5h-7l-4 14l-3 -6h-2"></path>
|
||||||
<path d="M14 13l6 6"></path>
|
<path d="M14 13l6 6"></path>
|
||||||
@@ -491,15 +582,26 @@ ${i}$0`),Ge(t)):t.dispatch(t.state.replaceSelection(` \\\\ ${i}`)),!0},Sp=(t,e)
|
|||||||
<path d="M-9.136 8.694v5.17a1 1 0 0 0 1 1h23.658a1 1 0 0 0 1-1v-5.17" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)"/>
|
<path d="M-9.136 8.694v5.17a1 1 0 0 0 1 1h23.658a1 1 0 0 0 1-1v-5.17" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)"/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
`};var nn=require("@codemirror/view");var me=require("@codemirror/view"),it=require("@codemirror/state");var Hr=require("obsidian");function H(...t){return t}var bi=class extends me.WidgetType{constructor(r,n,i){super();this.symbol=r;this.className=n||"",this.elementType=i||"span"}eq(r){return r.symbol==this.symbol&&r.className===this.className&&r.elementType===this.elementType}toDOM(){let r=document.createElement(this.elementType);return r.className="cm-math "+this.className,r.textContent=this.symbol,r}ignoreEvent(){return!1}},yi=class extends me.WidgetType{constructor(r){super();this.symbol=r}eq(r){return r.symbol==this.symbol}toDOM(){let r=document.createElement("span");return r.className="cm-math",r.textContent=this.symbol,r}ignoreEvent(){return!1}};function qp(t,e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;++n){let i=t.changes.mapPos(e[n].start,1),s=t.changes.mapPos(e[n].end,-1);if(!(i==r[n].start&&s==r[n].end))return!1}return!0}function jp(t,e){let r="apart";for(let n of t.ranges)for(let i of e){let s=Math.max(n.from,i.start),o=Math.min(n.to,i.end);if(s===o&&(s===i.start||s===i.end)){r="edge";continue}if(s<=o)return"within"}return r}function Zp(t,e,r,n){return r||e==="apart"?"conceal":e==="within"||!n||!t||t==="within"?"reveal":"delay"}function No(t){let e=[];for(let r of t)if(r.enable)for(let n of r.spec)if(n.start===n.end)e.push(me.Decoration.widget({widget:new yi(n.text),block:!1}).range(n.start,n.end));else{let i=n.text==="";e.push(me.Decoration.replace({widget:new bi(n.text,n.class,n.elementType),inclusiveStart:i,inclusiveEnd:!1,block:!1}).range(n.start,n.end))}return me.Decoration.set(e,!0)}function Fo(t){let e=t.filter(i=>i.enable).flatMap(i=>i.spec).sort((i,s)=>i.start-s.start),r=new class extends it.RangeValue{},n=new it.RangeSetBuilder;for(let i=0;i<e.length;i++)e[i].text===""?i+1!=e.length&&e[i].end==e[i+1].start?(n.add(e[i].start,e[i+1].end,r),i++):n.add(e[i].start,e[i].end+1,r):n.add(e[i].start,e[i].end,r);return n.finish()}var Yo=me.ViewPlugin.fromClass(class{constructor(t){this.delayedRevealCallback=(t,e)=>{var r;for(let n of t)n.enable=!1;this.decorations=No(this.concealments),this.atomicRanges=Fo(this.concealments),e.dispatch(),(r=e==null?void 0:e.cm)==null||r.signal("vim-command-done")};this.concealments=[],this.decorations=me.Decoration.none,this.atomicRanges=it.RangeSet.empty;let e=X(t).concealRevealTimeout;this.delayEnabled=e>0,this.cached_equations={},this.concealSpecs=[],this.delayedReveal=(0,Hr.debounce)(this.delayedRevealCallback,e,!0),this.update({view:t,state:t.state,docChanged:!0})}update(t){if(t.docChanged||t.viewportChanged||t.selectionSet)if(this.delayedReveal.cancel(),!t.docChanged&&!t.viewportChanged)this.updateFromConcealSpecs(this.concealSpecs,t);else{let{specs:e,cached_equations:r}=Ho(t.view,this.cached_equations);this.cached_equations=r,this.concealSpecs=e,this.updateFromConcealSpecs(e,t)}}updateFromConcealSpecs(t,e){var o,a;let r=e.state.selection,n=(a=(o=e.view.plugin(Hr.livePreviewState))==null?void 0:o.mousedown)!=null?a:!1,i=[],s=[];for(let l of t){let c=jp(r,l),p=this.concealments.find(O=>qp(e,O.spec,l)),u=Zp(p==null?void 0:p.cursorPosType,c,n,this.delayEnabled),d={spec:l,cursorPosType:c,enable:u!=="reveal"};u==="delay"&&s.push(d),i.push(d)}s.length>0&&this.delayedReveal(s,e.view),this.concealments=i,this.decorations=No(this.concealments),this.atomicRanges=Fo(this.concealments)}},{decorations:t=>t.decorations,provide:t=>me.EditorView.atomicRanges.of(e=>{var r,n;return(n=(r=e.plugin(t))==null?void 0:r.atomicRanges)!=null?n:it.RangeSet.empty})});var Ko={aleph:"\u2135",amalg:"\u2A3F",And:"&",angle:"\u2220",approx:"\u2248",approxeq:"\u224A",ast:"\u2217",asymp:"\u224D",backepsilon:"\u220D",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",backslash:"\u2216",barwedge:"\u22BC",Bbbk:"k",because:"\u2235",beth:"\u2136",between:"\u226C",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",blacklozenge:"\u29EB",blacksquare:"\u25FC",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",bot:"\u22A5",bowtie:"\u22C8",Box:"\u25FB",boxdot:"\u22A1",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",bullet:"\u2219",bumpeq:"\u224F",Bumpeq:"\u224E",Cap:"\u22D2",cap:"\u2229",cdot:"\u22C5",cdotp:"\u22C5",cdots:"\u22EF",celsius:"\u2103",centerdot:"\u22C5",checkmark:"\u2713",circ:"\u2218",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",circledR:"\xAE",circledS:"\u24C8",clubsuit:"\u2663",complement:"\u2201",cong:"\u2245",coprod:"\u2210",copyright:"\xA9",cp:"\xD7",cross:"\xD7",crossproduct:"\xD7",Cup:"\u22D3",cup:"\u222A",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",da
Line truncated
|
`};var Yn=require("@codemirror/view");var sw=require("@codemirror/view"),lw=require("@codemirror/state");var Bk=require("@codemirror/view");function Mp(e,t){return e.includes(t)}var Me=require("@codemirror/view"),Dp=require("@codemirror/state");var Wk=require("@lezer/common");var fh=3,nn="latex-suite-highlighted-bracket",pe="latex-suite-color-bracket",Nn="latex-suite-mismatched-bracket";function hi(e,t,n){return Me.Decoration.mark({inclusive:!0,attributes:{},class:t}).range(e,e+n)}var oa={"{":"}","[":"}","(":")","\\{":"\\}","\\left<":"\\right>","\\langle ":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\right\\lt":"\\right\\gt","\\lbrace":"\\rbrace","\\lbrack":"\\rbrack","\\lceil":"\\rceil","\\lfloor":"\\rfloor","\\lgroup":"\\rgroup","\\llcorner":"\\lrcorner","\\lmoustache":"\\rmoustache","\\lparen":"\\rparen"},sa=Object.fromEntries(Object.entries(oa).map(([e,t])=>[t,e]));function hh(e,t){var l;let n=e.node.getChild(_.MathOpening),r=e.node.getChild(_.MathClosing),i=e.node.getChild(_.Math),o=i?rn(i,new fe(t.eqn,i.from,i.to,t.offset)):[];if(!n||!r)return[];let s=(l=r==null?void 0:r.to)!=null?l:n.to;s&&e.moveTo(s,-1);let a;if(n&&r)return a={kind:"bracket",open:n,close:r,children:o},[a];if(n)return a={kind:"error_open",open:n,bracket:t.slice(n.from,n.to)},[a,...o];if(r){let c=t.slice(r.from,r.to);return a={kind:"error_close",close:r,bracket:c},[...o,a]}return[]}function gh(e,t){let n=e.node,r=t.slice(n.from,n.to),i=r in oa,o=r in sa,s;if(i)s={kind:"error_open",open:n,bracket:t.slice(n.from,n.to)};else if(o)s={kind:"error_close",close:n,bracket:t.slice(n.from,n.to)};else return[];return[s]}var yh={OpenBrace:"CloseBrace",OpenBracket:"CloseBracket",OpenParenMath:"CloseParenMath"};function bh(e,t){let n=e.node,r=n,i=yh[n.name],o=[];for(;e.nextSibling();){let s=e.node;if(s&&s.name===i)return[{kind:"bracket",open:r,close:s,children:o}];if(s){let a=new fe(t.eqn,s.from,s.to,t.offset);o.push(...rn(s,a))}}return[{kind:"error_open",open:r,bracket:t.slice(r.from,r.to)},...o]}function vh(e,t){let n=t.slice(e.from,e.to),r=[];for(let i=0;i<n.length;i++){let o=n[i],s={from:e.from+i,to:e.from+i+1},a=o in oa,l=o in sa;a?r.push({kind:"error_open",open:s,bracket:t.slice(s.from,s.to)}):l&&r.push({kind:"error_close",close:s,bracket:t.slice(s.from,s.to)})}return r}function rn(e,t){let n=[],r={[_.MathDelimitedGroup]:hh};for(let i of en(e,t)){let o=i.node,s=r[o.type.id];if(s){let a=s(i,t);n.push(...a)}else o.name.endsWith("CtrlSeq")||o.type.is(_.CtrlSym)?n.push(...gh(i,t)):o.type.is(_.MathSpecialChar)?n.push(...vh(i,t)):o.type.is(_.OpenBrace)||o.type.is(_.OpenBracket)||o.type.is(_.OpenParenMath)?n.push(...bh(i,t)):(o.type.is(_.CloseBrace)||o.type.is(_.CloseBracket))&&n.push({kind:"error_close",close:o,bracket:t.slice(o.from,o.to)})}return n}function Un(e){var i;let t=[],n=null,r=[];for(let o of e){let s=(i=n==null?void 0:n.children)!=null?i:t,a=j(A({},o),{parent:n,children:[]});if(a.kind==="error_open")r.push(a),s.push(a),n=a;else if(a.kind==="error_close"){let l=sa[a.bracket],c=wp(r,p=>p.bracket===l);if(c!==null){let p=r[c];n=p,r.length=c,Object.assign(p,{kind:"bracket",close:a.close}),n=p.parent}else s.push(a)}else a.kind==="bracket"&&o.kind==="bracket"&&(s.push(a),Un(o.children).forEach(c=>{c.parent=a,a.children.push(c)}))}return t}function jp(e,t){let n=oe(e).getEquationOverlays(e.state),r={},i=[];for(let s of n){let a=t[s.text];if(a){r[s.text]=a;for(let O of a)i.push(hi(O.pos+s.overlay.from,O.className,O.bracket));continue}let l=new fe(s.text,s.overlay.from,s.overlay.to),c=rn(s.bound.tree,l),p=Un(c),u=[];for(let{region:O,depth:d}of Jt(p)){if(O.kind==="error_close"||O.kind==="error_open"){let m=O.kind==="error_open"?O.open.from:O.close.from;u.push({pos:m,className:Nn,bracket:O.bracket.length});continue}let f=d%fh;u.push({pos:O.open.from,className:`${pe}-${f}`,bracket:O.open.to-O.open.from}),u.push({pos:O.close.from,className:`${pe}-${f}`,bracket:O.close.to-O.close.from})}i.push(...u.map(O=>hi(O.pos,O.className,O.bracket))),r[s.text]=u.map(O=>j(A({},O),{pos:O.pos-l.offset}))}return t=r,{decorations:Me.Decoration.set(i,!0),cached_equations:t}}function Zp(e){let t=[],r=e.state.selection.ranges;if(!G(e).mode.inMath())return Me.Decoration.none;let o=oe(e).getEquationOverlays(e.state);for(let s of r){let a=o.find(O=>O.overlay.from<=s.from&&O.bound.inner_end>=O.overlay.to);if(!a)continue;let l=new fe(a.text,a.overlay.from,a.overlay.to),c=Un(rn(a.bound.tree,l)),p=null,u={from:s.from,to:s.to,empty:s.empty};for(let{region:O,depth:d}of Jt(c))if(O.kind==="bracket"){if(!u.empty&&(O.close.to<=u.to&&O.close.to>=u.from||O.open.from>=u.to&&O.open.from<=u.from)){p={region:O,depth:d};break}if(O.open.from<=u.to&&O.close.to>=u.to){p={region:O,depth:d};continue}if(O.open.from>u.to)break}p&&t.push(hi(p.region.open.from,nn,p.region.open.to-p.region.open.from),hi(p.region.close.from,nn,p.region.close.to-p.region.close.from))}return Me.Decoration.set(t,!0)}var aa=Me.ViewPlugin.fromClass(class{constructor(e){this.cached_equations={};({decorations:th
Line truncated
|
||||||
`),o=r[0][0]===`
|
`),u)return o;if(s.from===n.from){let f=i.match(/^(> ?)*\s*/);f&&(n.from+=f[0].length,i=i.replace(a,""))}return{range:{original:t,parsed:n},sel:{original:r,parsed:i}}},Th=(e,t,n,r,i)=>{var f;let o=W(e),{line:s,effectiveLineAfter:a}=kh(e,r.to),l=r.to,{range:c,sel:p}=wh(e,r),u=(f=n.key)!=null?f:"";if(n.key&&n.key.length!==1)return{success:!1,shouldAutoEnlargeBrackets:!1};let O=Array.from(t.getEnvNames(l)),d=s+u;for(let[m,g]of n.snippets.entries()){let b=g.isWithinIncludedScope(O);if(!g.options.snippetShouldRunInMode(t.mode,b===1)||b===2)continue;let v=g.process({effectiveLine:d,range:c,sel:p,effectiveLineAfter:a,view:e});if(v===null||g.isWithinExcludedScope(O))continue;let $=v.triggerPos,S=v.triggerEndPos?v.triggerEndPos-u.length:l;if(g.options.onWordBoundary&&!Eh(e.state,$,l,o.wordDelimiters))continue;let E=v.replacement;t.mode.inlineMath&&o.removeSnippetWhitespace&&(E=Ph(E,t));let T=$,P=g.options.automatic&&g.type!=="visual"&&g.options.undoKey?u:void 0;We(e,T,S,E,P,l);let Z=o.autoEnlargeBracketsTriggers.some(V=>E.insert.contains(V));return(i==="info"||i==="verbose")&&Oc(e.state,g,E.insert,Z),i==="verbose"&&console.debug({snippets_unexpanded:n.snippets.slice(0,m).map(V=>({description:V.description,trigger:V.trigger,options:V.options,replacement:V.replacement})),current_mode:t.mode,updatedLine:d}),{success:!0,shouldAutoEnlargeBrackets:Z}}return{success:!1,shouldAutoEnlargeBrackets:!1}},Eh=(e,t,n,r)=>{let i=e.sliceDoc(t-1,t),o=e.sliceDoc(n,n+1);return r=r.replace("\\n",`
|
||||||
`?" ":"",a=r.index+r[0].length-1,l=n+1;e.push(H({start:s,end:a,text:o},{start:a,end:a+1,text:"(",class:"cm-bracket"},{start:n,end:n+1,text:")",class:"cm-bracket"},{start:n+1,end:n+1,text:"/",class:"cm-bracket"},{start:l,end:l+1,text:"(",class:"cm-bracket"},{start:i,end:i+1,text:")",class:"cm-bracket"}))}return e}function Up(t){let e="\\\\operatorname{([A-Za-z]+)}",r=new RegExp(e,"g"),n=[...t.matchAll(r)],i=[];for(let s of n){let o=s[1],a=s.index,l=a+s[0].length;i.push(H({start:a,end:l,text:o,class:"cm-concealed-mathrm cm-variable-2"}))}return i}function Ho(t,e){let r=nt(t).getEquations(t.state),n={};for(let s of r.values()){if(s in e){n[s]=e[s];continue}let o=[...Tt(s,"\\^","",ra),...Tt(s,"_","",na),...Tt(s,"\\\\frac","",ta),...Wp(s,Qi,Xp),...aa(s,!0,Qi),...aa(s,!1,Qi),...st(s,"hat","\u0302"),...st(s,"dot","\u0307"),...st(s,"ddot","\u0308"),...st(s,"overline","\u0304"),...st(s,"bar","\u0304"),...st(s,"tilde","\u0303"),...st(s,"vec","\u20D7"),...Tt(s,"\\\\","",ia,"cm-bracket"),...Bp(s,"\\\\mathcal{","}",oa),...Ip(s,xi),...Vp(s,sa),...Mp(s),...Dp(s),...zp(s),...Lp(s),...Gp(s,ea),...Up(s)];n[s]=o}e=n;let i=[];for(let[s,o]of r.entries())for(let a of n[o])i.push(a.map(l=>ye(oe({},l),{start:l.start+s,end:l.end+s})));return{specs:i,cached_equations:e}}function Si(t,e){return t.includes(e)}function ca(t,e){return e in t}var ua=["\\big","\\Big","\\bigg","\\Bigg","\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\left","\\right"],Oa=["{","}"],Kr={"(":")","[":"]","\\{":"\\}","\\langle":"\\rangle","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lceil":"\\rceil","\\lfloor":"\\rfloor"},Np=[...ua,...Object.keys(Kr),...Object.values(Kr)],Fp=[...Np.map(wt).sort((t,e)=>t.length-e.length),...Oa.map(wt)].join("|"),pa=new RegExp(Fp,"g"),Yp=Object.fromEntries(Object.entries(Kr).map(([t,e])=>[e,t])),Jr=t=>{let e=X(t);if(!e.autoEnlargeBrackets)return;let n=I(t).getBounds();if(!n)return!1;let{inner_start:i,inner_end:s}=n,o=t.state.sliceDoc(i,s),a="\\left",l="\\right",c=[],p,u=null;pa.lastIndex=0;let d=0,O=[d];for(;(p=pa.exec(o))!==null;){let h=p[0],f=p.index;if(Si(ua,h)){u=f+h.length;continue}else if(Si(Oa,h)){h==="{"?O.push(++d):O.length>1&&O.pop();continue}else if(ca(Kr,h)){u===null||/\S/.test(o.slice(u,f))?c.push({index:f,match:h,level:O[O.length-1]}):u!==null&&c.push({match:h,ignore:!0,level:O[O.length-1]}),u=null;continue}let g=u!==null&&!/\S/.test(o.slice(u,f));u=null;let b=Yp[h];for(let y=c.length-1;y>=0;y--){let x=c[y];if(x.match===b&&("ignore"in x||g)){c.splice(y,1);break}if("ignore"in x||x.level!==O[O.length-1]||x.match!==b)continue;let S=x.index,Q=x.match,m=S+Q.length,T=p.index,C=o.slice(m,T);if(!e.autoEnlargeBracketsTriggers.some(k=>C.contains(k)))break;qe(t,i+S,i+m,a+Q+" "),qe(t,i+T,i+T+h.length," "+l+h),c.splice(y,1);break}}Ge(t)};var ha=require("obsidian"),en=null,$i=(t,e,r,n)=>{let i=!1;for(let o of e.ranges)Hp(t,e,r,o,n).shouldAutoEnlargeBrackets&&(i=!0);let s=Ge(t);return i&&Jr(t),s},Hp=(t,e,r,n,i)=>{var d;let s=X(t),{from:o,to:a}=n,l=t.state.sliceDoc(o,a),c=t.state.sliceDoc(0,a),p=(d=r.key)!=null?d:"";if(r.key&&r.key.length!==1)return{success:!1,shouldAutoEnlargeBrackets:!1};let u=c+p;for(let O=0;O<r.snippets.length;O++){let h=r.snippets[O];if(!Kp(h.options,e.mode))continue;let f=h.process(u,n,l);if(f===null)continue;let g=!1;for(let m of h.excludedEnvironments)e.isWithinEnvironment(a,m)&&(g=!0);if(g)continue;let b=f.triggerPos;if(h.options.onWordBoundary&&!Jp(t.state,b,a,s.wordDelimiters))continue;let y=f.replacement;e.mode.inlineMath&&s.removeSnippetWhitespace&&(y=eu(y,e));let x=b,S=h.options.automatic&&h.type!=="visual"?p:void 0;qe(t,x,a,y,S);let Q=s.autoEnlargeBracketsTriggers.some(m=>y.contains(m));if(i==="info"||i==="verbose"){let m=h.trigger.toString(),T=h.triggerKey?`<li>Trigger key: ${new Option(h.triggerKey).innerHTML}
|
`),r.contains(i)&&r.contains(o)},Ph=(e,t)=>{let n=e.tabstops;e.insert=e.insert.trimEnd();for(let r of n)r.to=Math.min(r.to,e.insert.length),r.from=Math.min(r.from,e.insert.length);return e};var vw=require("@codemirror/view"),Sw=require("@codemirror/state");var gi=e=>{let t=G(e);for(let r of t.ranges)qh(e,t,r);let n=tt(e);return n&&on(e),n},Ch="alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|Theta|iota|kappa|lambda|Lambda|mu|nu|omicron|xi|Xi|pi|Pi|rho|sigma|Sigma|tau|upsilon|Upsilon|varphi|phi|Phi|chi|psi|Psi|omega|Omega",Gp=new RegExp("("+Ch+") ([^ ])","g"),qh=(e,t,n)=>{let r=W(e),{from:i,to:o}=n;for(let d of r.autofractionExcludedEnvs)if(t.isWithinEnvironment(o,d))return!1;let s=t.getBounds();if(!s)return!1;let a=s.inner_start,l=e.state.sliceDoc(a,o),c=a;if(i!=o)c=i;else{Gp.lastIndex=0,l=l.replace(Gp,"$1#$2");for(let d=l.length-1;d>=0;d--){let f=l.charAt(d);if([")","]","}"].contains(f)){let m=f,g=Za(m),b=Gt(l,d,g,m,!0);if(b===null)return!1;d=b}if(` $([{
|
||||||
</li>`:"",C=h.description,E=`Latex Suite: <br><ul><li>Description: ${new Option(C).innerHTML}
|
`.concat(r.autofractionBreakingChars).contains(f)){c=d+1+a;break}}}if(c===o)return!1;let p=e.state.sliceDoc(c,o);p.at(0)==="("&&p.at(-1)===")"&&Gt(p,0,"(",")",!1)===p.length-1&&(p=p.slice(1,-1));let u=new U([new le(r.autofractionSymbol+"{"),p===""?new qe(0):new le(p),new le("}{"),new qe(1),new le("}"),new qe(2)]),O=i!=o?void 0:"/";return We(e,c,o,u.applyInsert(Fe),O),!0};var bi=require("@codemirror/view"),sn=require("@codemirror/state"),an=require("obsidian");var Hp=require("@codemirror/language");var yi="latex-suite-math-preview-highlight",zn=sn.StateEffect.define(),Fn=sn.StateField.define({create:()=>[],update(e,t){for(let n of t.effects)if(n.is(zn))return n.value;return e},provide:e=>bi.showTooltip.computeN([e],t=>t.field(e).map(n=>n.tooltip))}),Rh=(e,t,n,r)=>{let i=(l,c,p,u,O)=>{let d=0;for(let f=c;f>=0&&f<l.length;f+=O)if(l[f]===p&&d++,l[f]===u){if(d===0)return f;d--}return-1},o=e[t]===r?t-1:t,s=i(e,o,r,n,-1),a=i(e,t,n,r,1);return{left:s,right:a}};function Bp(e){if(!(e.docChanged||e.selectionSet))return;let n=W(e.state),r=G(e.view),i=Xh(e.state,r);if(!i){e.state.field(Fn).length>0&&e.view.dispatch({effects:[zn.of([])]});return}let o=e.state.sliceDoc(i.inner_start,i.inner_end),s=r.pos,l=(0,Hp.syntaxTree)(e.state).cursor();l.moveTo(s,-1);let c;l.name==="math_tag"&&l.from<s&&l.to>=s?c=l.from:c=s;let p=c-i.inner_start,u,O=o.replaceAll(/\\[\\{}]/g,"\\R"),{left:d,right:f}=n.mathPreviewBracketHighlighting?Rh(O,p,"{","}"):{left:-1,right:-1};if(f!==-1&&d!==-1){let S=Math.max(d+1,p);u=o.slice(0,d+1)+`\\style{background-color: var(--${yi});}{`+o.slice(d+1,S)+n.mathPreviewCursor+o.slice(S,f)+"}"+o.slice(f)}else u=o.slice(0,p)+n.mathPreviewCursor+o.slice(p);let m=e.state.field(Fn);if(m.length===1&&m[0].equation===u&&m[0].bounds.inner_start===i.inner_start&&m[0].bounds.inner_end===i.inner_end)return;let g=vt(e.view,i),b=n.mathPreviewPositionIsAbove,v=()=>{var E;let S=$t("div");if(S.addClass("cm-tooltip-cursor"),S.addClass(b?"cm-tooltip-above":"cm-tooltip-below"),r.mode.blockMath){let T=(E=e.state.doc.lineAt(i.inner_start).text.match(/^ {0,3}(>+)/))==null?void 0:E[1].length;if(T){let P=new RegExp(`^ {0,3}>{${T}}`,"gm");P.test(o)&&(u=u.replaceAll(P,""))}}try{let T=(0,an.renderMath)(u,r.mode.inDisplayMath()),P=T.querySelector(`[style*="background-color: var(--${yi})"]`);P==null||P.addClass(yi),P==null||P.style.removeProperty("background-color"),S.appendChild(T),(0,an.finishRenderMath)()}catch(T){console.error("Error rendering math in tooltip:",T),S.textContent=o}return{dom:S}},$=[];if(g)$=[{pos:b?i.inner_start:i.inner_end,above:b,strictSide:!0,arrow:!0,create:v}];else if(!g&&b)$=[{pos:i.inner_start,above:!0,strictSide:!0,arrow:!0,create:v}];else if(!g&&!b){let S=sn.EditorSelection.range(i.inner_end,i.inner_end);$=[{pos:Math.max(i.inner_start,e.view.moveToLineBoundary(S,!1).anchor),above:!1,strictSide:!0,arrow:!0,create:v}]}e.view.dispatch({effects:[zn.of($.map(S=>({equation:u,bounds:i,pos:S.pos,tooltip:S})))]})}function Xh(e,t){if(!t.mode.inMath())return null;let n=W(e),r=e.field(an.editorLivePreviewField);if(t.mode.blockMath&&r&&!n.mathPreviewLivePreviewDisplay)return null;let i=t.getBounds();return!i||e.sliceDoc(i.inner_start,i.inner_end).trim()===""?null:i}var Np=bi.EditorView.baseTheme({".cm-tooltip.cm-tooltip-cursor":{backgroundColor:"var(--background-secondary)",color:"var(--text-normal)",border:"1px solid var(--background-modifier-border-hover)",padding:"4px 6px",borderRadius:"6px","& .cm-tooltip-arrow:before":{borderTopColor:"var(--background-modifier-border-hover)",borderBottomColor:"var(--background-modifier-border-hover)"},"& .cm-tooltip-arrow:after":{borderTopColor:"var(--background-secondary)",borderBottomColor:"var(--background-secondary)"},"& p":{margin:"0px"},"& mjx-container":{padding:"2px !important"},"&.cm-tooltip-above":{display:"flex"},"&.cm-tooltip-above > .MathJax":{overflowY:"auto",maxHeight:"70%",display:"inline-block",alignSelf:"flex-end"},"&.cm-tooltip-below > .MathJax":{overflowY:"auto",maxHeight:"90%"}},[`.${yi}`]:{backgroundColor:"var(--text-selection)"},[`${se} .cm-tooltip.cm-tooltip-cursor`]:{boxShadow:"0 1px 2px rgb(0 0 0 / 10%), 0 3.4px 6.7px rgb(0 0 0 / 15%), 0 0 30px rgb(0 0 0 / 27%)"},[`${$e} .cm-tooltip.cm-tooltip-cursor`]:{boxShadow:"0 1px 2px rgb(0 0 0 / 2.8%), 0 3.4px 6.7px rgb(0 0 0 / 4.2%), 0 5px 20px rgb(0 0 0 / 7%)"}});function Up(e){if(!W(e).autoDelete$)return!1;let t=oe(e),n=e.state.selection.main.head,i=t.getTree(e.state).resolveInner(n,-1);if(i.name!==w.Dollar)return!1;let o=i.prevSibling,s=i.nextSibling,a=s==null?void 0:s.nextSibling,l=i.parent;return i.from<n&&i.to>n&&i.to-i.from==2?(yn(e,i.from,i.to,""),!0):o||!a||!l||a.name!==w.Dollar||l.name!==w.DollarInlineMath||i.to!==a.from||n!==i.to?!1:(yn(e,i.from,a.to,""),!0)}var zp=e=>{let t=W(e.state);if(t.mathPreviewEnabled&&!e.transactions.some(i=>i.annotation(Ne))&&Bp(e),kp(e)||e.transactions.filter(i=>i.isUserEvent("input.type")).length===0||!t.snippetIMEVersion)return;pa("",!1,e.view.composing,e.view)&&console.debug("H
Line truncated
|
||||||
</li><li>Parsed trigger: <code>${new Option(m).innerHTML}</code>
|
`),c=Ia(l.map(u=>u.length+1));c.unshift(0);let p=0;return a.bound.overlay.map(u=>{let O=[];for(;p<c.length-1&&!(c[p]+a.overlay.from>=u.to);p++){let d=Math.min(c[p+1]+a.overlay.from-1,u.to),f=Math.max(c[p]+a.overlay.from,u.from);O.push({text:a.text.slice(f-a.overlay.from,d-a.overlay.from),bound:a.bound,overlay:{from:f,to:d}})}return O})}).flat(2),o={},s=[];for(let a of i){let l=t[a.text];if(l){o[a.text]=l,s.push(...l.map(u=>u.map(O=>j(A({},O),{start:O.start+a.overlay.from,end:O.end+a.overlay.from}))));continue}else if(a.text.trim()==="")continue;let c=a.bound;o[a.text]=[];let p=ru(c.tree,new fe(a.text,a.overlay.from,a.overlay.to));s.push(...p),o[a.text]=p.map(u=>u.map(O=>j(A({},O),{start:O.start-a.overlay.from,end:O.end-a.overlay.from})))}return t=o,{specs:s,cached_equations:t}}var ln=require("obsidian");var ua=class extends we.WidgetType{constructor(n,r,i){super();this.symbol=n;this.className=r||"",this.elementType=i||"span"}eq(n){return n.symbol==this.symbol&&n.className===this.className&&n.elementType===this.elementType}toDOM(){let n=$t(this.elementType);return n.className="cm-math "+this.className,n.textContent=this.symbol,n}ignoreEvent(){return!1}},Oa=class extends we.WidgetType{constructor(n){super();this.symbol=n}eq(n){return n.symbol==this.symbol}toDOM(){let n=$t("span");return n.className="cm-math",n.textContent=this.symbol,n}ignoreEvent(){return!1}};function Fh(e,t,n){if(t.length!==n.length)return!1;for(let r=0;r<t.length;++r){let i=t[r],o=n[r],s=e.changes.mapPos(i.start,1),a=e.changes.mapPos(i.end,-1);if(!(s==o.start&&a==o.end))return!1}return!0}function Yh(e,t){let n="apart";for(let r of e.ranges)for(let i of t){let o=Math.max(r.from,i.start),s=Math.min(r.to,i.end);if(o===s&&(o===i.start||o===i.end)){n="edge";continue}if(o<=s)return"within"}return n}function Kh(e,t,n,r){return n||t==="apart"?"conceal":t==="within"||!r||!e||e==="within"?"reveal":"delay"}function ou(e){let t=[];for(let n of e)if(n.enable)for(let r of n.spec)if(r.start===r.end)t.push(we.Decoration.widget({widget:new Oa(r.text),block:!1}).range(r.start,r.end));else{let i=r.text==="";t.push(we.Decoration.replace({widget:new ua(r.text,r.class,r.elementType),inclusiveStart:i,inclusiveEnd:!1,block:!1}).range(r.start,r.end))}return we.Decoration.set(t,!0)}function su(e){let t=e.filter(i=>i.enable).flatMap(i=>i.spec).sort((i,o)=>i.start-o.start),n=new class extends Ue.RangeValue{},r=new Ue.RangeSetBuilder;for(let i=0;i<t.length;i++){let o=t[i],s=t[i+1];o.text===""?s&&o.end==s.start?(r.add(o.start,s.end,n),i++):r.add(o.start,o.end+1,n):r.add(o.start,o.end,n)}return r.finish()}var Jh=(0,ln.debounce)(e=>{let t=e.state.selection.ranges.map(n=>Ue.EditorSelection.range(n.from,n.to,n.assoc));e.dispatch({selection:Ue.EditorSelection.create(t)})},50),da=class{constructor(t){this.mousedown=!1;this.delayedRevealCallback=(t,n)=>{var r;for(let i of t)i.enable=!1;this.decorations=ou(this.concealments),this.atomicRanges=su(this.concealments),n.dispatch(),(r=n==null?void 0:n.cm)==null||r.signal("vim-command-done")};var i,o;this.concealments=[],this.decorations=we.Decoration.none,this.atomicRanges=Ue.RangeSet.empty;let n=W(t).concealRevealTimeout;this.delayEnabled=n>0,this.cached_equations={},this.concealSpecs=[],this.delayedReveal=(0,ln.debounce)(this.delayedRevealCallback,n,!0);let r=[];this.update({view:t,state:t.state,docChanged:!0,transactions:r}),this.mousedown=(o=(i=t.plugin(ln.livePreviewState))==null?void 0:i.mousedown)!=null?o:!1}update(t){if(t.docChanged||t.viewportChanged||t.selectionSet){if(t.transactions.some(n=>n.annotation(Ne))){this.decorations=this.decorations.map(t.changes),this.atomicRanges=this.atomicRanges.map(t.changes);return}if(this.delayedReveal.cancel(),!t.docChanged&&!t.viewportChanged)this.updateFromConcealSpecs(this.concealSpecs,t);else{let{specs:n,cached_equations:r}=iu(t.view,this.cached_equations);this.cached_equations=r,this.concealSpecs=n,this.updateFromConcealSpecs(n,t)}}}updateFromConcealSpecs(t,n){var l,c;let r=n.state.selection,i=this.mousedown;this.mousedown=(c=(l=n.view.plugin(ln.livePreviewState))==null?void 0:l.mousedown)!=null?c:!1;let o=[],s=[],a=!1;for(let p of t){let u=Yh(r,p),O=this.concealments.find(m=>Fh(n,m.spec,p)),d=Kh(O==null?void 0:O.cursorPosType,u,this.mousedown,this.delayEnabled);a=a||d==="reveal";let f={spec:p,cursorPosType:u,enable:d!=="reveal"};d==="delay"&&s.push(f),o.push(f)}a&&i&&!this.mousedown&&n.view.state.selection.ranges.some(p=>!p.empty)&&Jh(n.view),s.length>0&&this.delayedReveal(s,n.view),this.concealments=o,this.decorations=ou(this.concealments),this.atomicRanges=su(this.concealments)}},eg=we.EditorView.baseTheme({"span.cm-math.cm-concealed-bold":{fontWeight:"bold"},"span.cm-math.cm-concealed-underline":{textDecoration:"underline"},"span.cm-math.cm-concealed-mathrm, sub.cm-math.cm-concealed-mathrm":{fontStyle:"normal"},"sup.cm-math":{lineHeight:0},"sup.cm-math, sub.cm-math":{fontStyle:"italic"}});function au(){return[we.ViewPlugin.fromClass(da,{decorations:t=>t.decorations,provide:t=>
Line truncated
|
||||||
</li>`+T+`<li>Replacement: <code>${new Option(y).innerHTML}</code>
|
`,this.treeInfo),console.debug(`Mounted Trees:
|
||||||
</li><li>Auto-enlarge brackets: ${Q}
|
`,this.mountedTreeInfo.join(`
|
||||||
</li></ul>`,k=new DocumentFragment,P=k.createDiv();P.innerHTML=E,en==null||en.hide(),en=new ha.Notice(k,5e3),console.info(P.textContent)}return i==="verbose"&&console.debug({snippets_unexpanded:r.snippets.slice(0,O).map(m=>({description:m.description,trigger:m.trigger,options:m.options,replacement:m.replacement})),current_mode:e.mode,updatedLine:u}),{success:!0,shouldAutoEnlargeBrackets:Q}}return{success:!1,shouldAutoEnlargeBrackets:!1}},Kp=(t,e)=>{if((t.mode.inlineMath&&e.inlineMath||t.mode.blockMath&&e.blockMath||(t.mode.inlineMath||t.mode.blockMath)&&e.codeMath)&&!e.textEnv||e.inMath()&&e.textEnv&&t.mode.text||t.mode.text&&e.text||t.mode.code===e.code&&e.code!==!1||t.mode.code===!0&&e.code!==!1)return!0},Jp=(t,e,r,n)=>{let i=t.sliceDoc(e-1,e),s=t.sliceDoc(r,r+1);return n=n.replace("\\n",`
|
`)))}catch(r){console.error(r)}}printMountedTrees(t){let n=at(t),r=[];n.iterate({enter:o=>{if(o.name===w.DollarDisplayBlockMath){let a=o.node.getChildren(w.DisplayMath).last();if(a){let l=o.node.enter(a.to,-1);if(!l)return;r.push(l)}}else if(o.name==="FencedCode"){if(!o.node.getChild("CodeInfo"))return;let l=o.node.getChildren("CodeText").last();if(!l)return;let c=o.node.enter(l.to,-1);c&&r.push(c)}}});let i=t.doc.sliceString(0,t.doc.length);return r.map(o=>gu(o,i))}},ha=yu.ViewPlugin.fromClass(fa);function gu(e,t){let n=[];function r(o,s=0){let{name:a,from:l,to:c}=o,p=s,u=o.node;for(;u=u.parent;)p++;n.push({name:a,from:l,to:c,indent:p})}function i(o){let s=o.firstChild;for(;s;)r(s),i(s),s=s.nextSibling}return i({firstChild:e,nextSibling:null}),n.map(({name:o,from:s,to:a,indent:l})=>`${" ".repeat(l)}${o}: (${s}, ${a}): `+t.slice(s,a).replace(/\n/g,"\\n")).join(`
|
||||||
`),n.contains(i)&&n.contains(s)},eu=(t,e)=>{let r=0;if(t.endsWith(" "))r=-1;else{let n=t.slice(-3),i=n.slice(-1);n.slice(0,2)===" $"&&!isNaN(parseInt(i))&&(r=-3)}return r!=0&&(r===-1?t=t.trimEnd():r===-3&&(t=t.slice(0,-3)+t.slice(-2))),t};var da=(t,e)=>{for(let n of e.ranges)tu(t,e,n);let r=Ge(t);return r&&Jr(t),r},tu=(t,e,r)=>{let n=X(t),{from:i,to:s}=r;for(let O of n.autofractionExcludedEnvs)if(e.isWithinEnvironment(s,O))return!1;let o=e.getBounds();if(!o)return!1;let a=o.inner_start,l=t.state.sliceDoc(0,s),c=a;if(i!=s)c=i;else{let O="alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|Theta|iota|kappa|lambda|Lambda|mu|nu|omicron|xi|Xi|pi|Pi|rho|sigma|Sigma|tau|upsilon|Upsilon|varphi|phi|Phi|chi|psi|Psi|omega|Omega",h=new RegExp("("+O+") ([^ ])","g");l=l.replace(h,"$1#$2");for(let f=l.length-1;f>=a;f--){let g=l.charAt(f);if([")","]","}"].contains(g)){let b=g,y=Lt(b),x=J(l,f,y,b,!0);if(x===-1)return!1;if(f=x,f<a){c=a;break}}if(` $([{
|
`)}var vi=class extends he.Plugin{constructor(){super(...arguments);this.settings=mu;this.CMSettings=vn([],this.settings);this.editorExtensions=[];this.disableMath=n=>{try{G(n,!1).disableMath()}catch(r){console.error("Error occurred while disabling math:",r)}};this.modifiedSyntaxTree=at;this.snippet=Us;this.api={effects:{snippetInvertedEffects:ti,startSnippet:Wt,endSnippet:dt,undidStartSnippet:Jr,undidEndSnippet:ei,LanguageSetStateEffect:hs,addTabstopsEffect:Fr,removeAllTabstopsEffect:Yr,updateTooltipEffect:zn},fields:{cursorTooltipField:Fn,notice:Pr,languageStateField:st,tabstopsStateField:mt},annotations:{tempKeyPress:Ne},plugin:{keyboardEventPlugin:Kn,colorPairedBracketsPlugin:aa,highlightCursorBracketsPlugin:la,parseWorker:gs,mathParserPlugin:ha,snippetQueuePlugin:Zn,contextPlugin:$r,mathBoundsPlugin:Qr},shortcuts:{autoEnlargeBrackets:on,runAutoFraction:gi,exitMatrixShortCut:ri,addCellMatrixShortcut:ii,newlineMatrixShortcut:tn,getVimRunMatrixEnterCommand:Hn,priorityTaboutMatrixShortcut:oi,snippet:Us},snippetApi:pc};this.createWatcherCloser=(0,he.debounce)(()=>y(this,null,function*(){var r;(r=this.watcherCloser)==null||r.call(this);let n=yield Sc(this);this.register(()=>{n()}),this.watcherCloser=n!=null?n:void 0}),3e3,!0)}onload(){return y(this,null,function*(){_p.addResourceBundle("en","settings",hu.en.settings),yield this.loadSettings(),this.loadIcons(),this.addSettingTab(new di(this.app,this)),yield(0,he.loadMathJax)(),this.legacyEditorWarning(),this.IMEEditorWarning(),this.registerEditorExtension(this.editorExtensions),this.watchFiles(),this.addEditorCommands()})}onunload(){}legacyEditorWarning(){var n;if((n=this.app.vault.config)!=null&&n.legacyEditor){let r="Latex Suite: This plugin does not support the legacy editor. Switch to Live Preview mode to use this plugin.";new he.Notice(r,1e5),console.error(r);return}}IMEEditorWarning(){if(fi()&&!this.settings.suppressIMEWarning&&this.settings.suppressSnippetTriggerOnIME){let n=createFragment();n.appendText("Latex Suite: this plugin supports your IME keyboard, but "),n.createEl("code",{text:"Advanced settings > Don't trigger snippets when IME is active"}),n.appendText(" is currently enabled. You may want to disable it in the plugin settings to fully enable automatic snippets. Be aware that this may cause unexpected snippet triggers while using your IME. To turn this warning off, enable "),n.createEl("code",{text:"Advanced settings > Suppress IME warning"}),n.appendText("."),new he.Notice(n,1e4),console.warn(n)}}loadSettings(){return y(this,null,function*(){var o;let n=rt(Mi(H(),Xi()),(o=yield this.loadData())!=null?o:{}),r=n?"basicSettings"in n:!1;function i(s){let a=s;return j(A(A({},a.basicSettings),a.rawSettings),{snippets:a.snippets})}r&&(n=i(n)),this.settings=A(A({},q),n),r&&(yield this.saveSettings()),this.settings.loadSnippetsFromFile||this.settings.loadSnippetVariablesFromFile?this.app.workspace.onLayoutReady(()=>{this.processSettings(!1,!0)}):yield this.processSettings(!1,!0)})}saveSettings(n=!1,r=!1){return y(this,null,function*(){yield this.saveData(this.settings),yield this.processSettings(n,r)})}getSettingsSnippetVariables(){return y(this,null,function*(){try{return yield Ie(this.settings.snippetVariables,"snippet-variables.js")}catch(n){let r=n;return new he.Notice(`Failed to load snippet variables from settings: ${r}`),console.error(`Failed to load snippet variables from settings: ${r}`),{}}})}getSettingsSnippets(n){return y(this,null,function*(){try{return yield lt(this.settings.snippets,n,"snippets.js")}catch(r){let i=r;return new he.Notice(`Failed to load snippets from settings: ${i}`),console.error(`Failed to load snippets from settings: ${i}`),[]}})}getSnippets(n,r){return y(this,null,function*(){if(!n&&!r)return this.CMSettings.snippets.all;let i=yield kc(this),o=this.settings.loadSnippetVariablesFromFile?yield Tc(i):yield this.getSettingsSnippetVariables(),s=yield Ec(i);this.settings.loadSnippetVariablesFromFile&&Object.assign(o,s);let a=this.settings.loadSnippetsFromFile?yield Pc(i,o):yield this.getSettingsSnippets(o);return this.showSnippetsLoadedNotice(a.length,Object.keys(o).length,n,r),a})}processSettings(n=!1,r=!1){return y(this,null,function*(){n&&this.watchFiles(),this.CMSettings=vn(yield this.getSnippets(n,r),this.settings),this.setEditorExtensions(),this.app.workspace.updateOptions()})}setEditorExtensions(){for(;this.editorExtensions.length;)this.editorExtensions.pop();this.editorExtensions.push([Jn.Prec.highest(Qr.extension),Jn.Prec.highest($r.extension),Ya(this.CMSettings),Jn.Prec.highest(Kn.extension),Jn.Prec.highest(jt.EditorView.inputHandler.of(Fp)),jt.EditorView.updateListener.of(zp),Kp,ec]);let n=Yp(this.CMSettings);this.editorExtensions.push(jt.keymap.of(n)),this.CMSettings.concealEnabled&&this.editorExtensions.push(au()),this.CMSettings.colorPairedBracketsEnabled&&this.editorExtensions.push(Vp),this.CMSettings.highlightCursorBracketsEnabled&&this.editorExtensions.push(Ip),this.CMSettings.mathPreviewEnabled&&this.e
Line truncated
|
||||||
`.concat(n.autofractionBreakingChars).contains(g)){c=f+1;break}}}if(c===s)return!1;let p=t.state.sliceDoc(c,s);p.at(0)==="("&&p.at(-1)===")"&&J(p,0,"(",")",!1)===p.length-1&&(p=p.slice(1,-1));let u=p===""?`${n.autofractionSymbol}{$0}{$1}$2`:`${n.autofractionSymbol}{${p}}{$0}$1`,d=i!=s?void 0:"/";return qe(t,c,s,u,d),!0};var rn=require("@codemirror/view"),kt=require("@codemirror/state"),Pt=require("obsidian");var fa=require("@codemirror/language"),vi=kt.StateEffect.define(),tn=kt.StateField.define({create:()=>[],update(t,e){for(let r of e.effects)if(r.is(vi))return r.value;return t},provide:t=>rn.showTooltip.computeN([t],e=>e.field(t).map(r=>r.tooltip))}),ru=(t,e,r,n)=>{let i=(l,c,p,u,d)=>{let O=0;for(let h=c;h>=0&&h<l.length;h+=d)if(l[h]===p&&O++,l[h]===u){if(O===0)return h;O--}return-1},s=t[e]===n?e-1:e,o=i(t,s,n,r,-1),a=i(t,e,r,n,1);return{left:o,right:a}};function ma(t){if(!(t.docChanged||t.selectionSet))return;let r=X(t.state),n=I(t.view),i=nu(t.state,n);if(!i){t.state.field(tn).length>0&&t.view.dispatch({effects:[vi.of([])]});return}let s=t.state.sliceDoc(i.inner_start,i.inner_end),o=n.pos,l=(0,fa.syntaxTree)(t.state).cursor();l.moveTo(o,-1);let c;l.name==="math_tag"&&l.from<o&&l.to>=o?c=l.from:c=o;let p=c-i.inner_start,u,d=s.replaceAll(/\\[\\{}]/g,"\\R"),{left:O,right:h}=r.mathPreviewBracketHighlighting?ru(d,p,"{","}"):{left:-1,right:-1};if(h!==-1&&O!==-1){let x=Math.max(O+1,p);u=s.slice(0,O+1)+"\\style{background-color: var(--latex-suite-math-preview-highlight);}{"+s.slice(O+1,x)+r.mathPreviewCursor+s.slice(x,h)+"}"+s.slice(h)}else u=s.slice(0,p)+r.mathPreviewCursor+s.slice(p);let f=t.state.field(tn);if(f.length===1&&f[0].equation===u&&f[0].bounds.inner_start===i.inner_start&&f[0].bounds.inner_end===i.inner_end)return;let g=r.mathPreviewPositionIsAbove,b=()=>{var S;let x=document.createElement("div");if(x.addClass("cm-tooltip-cursor"),x.addClass(g?"cm-tooltip-above":"cm-tooltip-below"),n.mode.blockMath){let Q=(S=t.state.doc.lineAt(i.inner_start).text.match(/^ {0,3}(>+)/))==null?void 0:S[1].length;if(Q){let m=new RegExp(`^ {0,3}>{${Q}}`,"gm");m.test(s)&&(u=u.replaceAll(m,""))}}try{let Q=(0,Pt.renderMath)(u,n.mode.blockMath||n.mode.codeMath),m=Q.querySelector('[style*="background-color: var(--latex-suite-math-preview-highlight)"]');m==null||m.addClass("latex-suite-math-preview-highlight"),m==null||m.style.removeProperty("background-color"),x.appendChild(Q),(0,Pt.finishRenderMath)()}catch(Q){console.error("Error rendering math in tooltip:",Q),x.textContent=s}return{dom:x}},y=[];if(n.mode.blockMath||n.mode.codeMath)y=[{pos:g?i.inner_start:i.inner_end,above:g,strictSide:!0,arrow:!0,create:b}];else if(n.mode.inlineMath&&g)y=[{pos:i.inner_start,above:!0,strictSide:!0,arrow:!0,create:b}];else if(n.mode.inlineMath&&!g){let x=kt.EditorSelection.range(i.inner_end,i.inner_end);y=[{pos:Math.max(i.inner_start,t.view.moveToLineBoundary(x,!1).anchor),above:!1,strictSide:!0,arrow:!0,create:b}]}t.view.dispatch({effects:[vi.of(y.map(x=>({equation:u,bounds:i,pos:x.pos,tooltip:x})))]})}function nu(t,e){if(!e.mode.inMath())return null;let r=t.field(Pt.editorLivePreviewField);if(e.mode.blockMath&&r)return null;let n=e.getBounds();return!n||t.sliceDoc(n.inner_start,n.inner_end).trim()===""?null:n}var ga=rn.EditorView.baseTheme({".cm-tooltip.cm-tooltip-cursor":{backgroundColor:"var(--background-secondary)",color:"var(--text-normal)",border:"1px solid var(--background-modifier-border-hover)",padding:"4px 6px",borderRadius:"6px","& .cm-tooltip-arrow:before":{borderTopColor:"var(--background-modifier-border-hover)",borderBottomColor:"var(--background-modifier-border-hover)"},"& .cm-tooltip-arrow:after":{borderTopColor:"var(--background-secondary)",borderBottomColor:"var(--background-secondary)"},"& p":{margin:"0px"},"& mjx-container":{padding:"2px !important"}}});var ba=t=>{X(t.state).mathPreviewEnabled&&ma(t),qo(t)},sn=nn.ViewPlugin.fromClass(class{constructor(){this.lastKeyboardEvent=null}onKeydown(t,e){if(t.key=="Unidentified"||t.key=="Process"||t.key=="Dead"){this.lastKeyboardEvent=t;return}else this.lastKeyboardEvent=null;(xa(t.key,t.ctrlKey||t.metaKey,Jn(e,t),e)||(0,nn.runScopeHandlers)(e,t,"latex-suite"))&&t.preventDefault()}},{eventHandlers:{keydown(t,e){e.plugin(sn).onKeydown(t,e)}}}),ya=(t,e,r,n)=>{var s;let i=(s=t.plugin(sn))==null?void 0:s.lastKeyboardEvent;return n==="\0\0"?!0:n.length==1&&i&&(n===" "&&(n="Tab"),xa(n,i.ctrlKey||i.metaKey,Jn(t,i),t))?(mo(t),!0):!1},xa=(t,e,r,n)=>{if(t.length>1)return!1;let i=X(n),s=I(n);if(!i.snippetsEnabled||i.suppressSnippetTriggerOnIME&&r||e)return!1;let o=i.snippets.filter(a=>a.options.automatic);try{if($i(n,s,{snippets:o,key:t},i.snippetDebug))return!0}catch(a){Qt(n),console.error(a)}return!1};function Qa(t){let e=[];t.autoDelete$&&e.push({key:"Backspace",run:function(a){if(!X(a).autoDelete$)return!1;let l=I(a);if(!l.mode.strictlyInMath())return!1;let c=zt(a,l.pos),p=zt(a,l.pos-1);return c==="$"&&p==="$"?(jr(a,l.pos-1,l.pos+1,""),Br(a),!0):!1}});let r=new Set(t.snippets.map(o=
Line truncated
|
/**
|
||||||
|
* @license
|
||||||
|
* Force end an IME composition.
|
||||||
|
* MIT License
|
||||||
|
* Copyright (C) 2018-2021 by Marijn Haverbeke <marijnh@gmail.com> and others
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* implementation of background lezer parser.
|
||||||
|
* MIT License
|
||||||
|
* Copyright (C) 2018-2021 by Marijn Haverbeke <marijnh@gmail.com> and others
|
||||||
|
*/
|
||||||
|
|
||||||
/* nosourcemap */
|
/* nosourcemap */
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-latex-suite",
|
"id": "obsidian-latex-suite",
|
||||||
"name": "Latex Suite",
|
"name": "Latex Suite",
|
||||||
"version": "1.11.5",
|
"version": "1.13.4",
|
||||||
"minAppVersion": "1.0.0",
|
"minAppVersion": "1.1.0",
|
||||||
"description": "Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements",
|
"description": "Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements.",
|
||||||
"author": "artisticat",
|
"author": "artisticat",
|
||||||
"authorUrl": "https://github.com/artisticat1",
|
"authorUrl": "https://github.com/artisticat1",
|
||||||
"fundingUrl": "https://ko-fi.com/artisticat",
|
"fundingUrl": "https://ko-fi.com/artisticat",
|
||||||
|
|||||||
+26
-165
@@ -1,3 +1,5 @@
|
|||||||
|
/* stylelint-disable selector-class-pattern */
|
||||||
|
|
||||||
/* Settings panel */
|
/* Settings panel */
|
||||||
|
|
||||||
.setting-item.hidden {
|
.setting-item.hidden {
|
||||||
@@ -9,33 +11,29 @@
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) {
|
.setting-item.setting-item-heading.latex-suite-settings-heading {
|
||||||
border-bottom: 1px solid var(--background-modifier-border);
|
border-bottom: 1px solid var(--background-modifier-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) + .setting-item {
|
.latex-suite-confirmation-modal .setting-item {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-item.setting-item-heading.latex-suite-settings-heading + .setting-item {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) ~ .setting-item:not(.setting-item-heading), .latex-suite-snippet-variables-setting + .setting-item-control {
|
.setting-item.setting-item-heading.latex-suite-settings-heading ~ .setting-item:not(.setting-item-heading) {
|
||||||
width: calc(100% - 26px);
|
width: calc(100% - 26px);
|
||||||
margin-left: 26px;
|
margin-left: 26px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.latex-suite-snippet-variables-setting .setting-item-control {
|
.snippets-text-area {
|
||||||
height: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.latex-suite-snippet-variables-setting .setting-item-control textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.snippets-text-area, .latex-suite-snippet-variables-setting {
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snippets-text-area .setting-item-info, .latex-suite-snippet-variables-setting .setting-item-info {
|
.snippets-text-area .setting-item-info {
|
||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: var(--font-inputs);
|
font-size: var(--font-inputs);
|
||||||
height: 20em;
|
height: 20em;
|
||||||
outline: none !important;
|
outline: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +73,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.snippets-editor-validity-indicator {
|
.snippets-editor-validity-indicator {
|
||||||
color: white;
|
color: #fff;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
@@ -84,12 +82,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.snippets-editor-validity-indicator svg {
|
.snippets-editor-validity-indicator svg {
|
||||||
width: 16px !important;
|
width: 16px;
|
||||||
height: 16px !important;
|
height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snippets-editor-validity-indicator:hover {
|
.snippets-editor-validity-indicator:hover {
|
||||||
color: white;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snippets-editor-validity-indicator.valid {
|
.snippets-editor-validity-indicator.valid {
|
||||||
@@ -102,163 +100,26 @@
|
|||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.snippets-editor-validity-text.setting-item-description {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.snippets-editor-buttons {
|
.snippets-editor-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.latex-suite-confirmation-modal .setting-item {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input-container input.latex-suite-location-input-el {
|
.search-input-container input.latex-suite-location-input-el {
|
||||||
width: initial;
|
width: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Snippet color classes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* These extra selectors enforce their color on all children, because CodeMirror does weird nesting of spans when
|
.setting-item.latex-suite-keymap-list {
|
||||||
nesting multiple decorations. */
|
|
||||||
|
|
||||||
.latex-suite-snippet-placeholder {
|
|
||||||
border-radius: 2px;
|
|
||||||
background-color: var(--placeholder-bg);
|
|
||||||
outline: var(--placeholder-outline) solid 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
|
|
||||||
--placeholder-bg: #87cefa2e;
|
|
||||||
--placeholder-outline: #87cefa6e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
|
|
||||||
--placeholder-outline: #87cefa43;
|
|
||||||
}
|
|
||||||
|
|
||||||
.latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
|
|
||||||
--placeholder-bg: #ffa50033;
|
|
||||||
--placeholder-outline: #ffa5006b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
|
|
||||||
--placeholder-outline: #ffa5004d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
|
|
||||||
--placeholder-bg: #00ff0022;
|
|
||||||
--placeholder-outline: #00ff0060;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
|
|
||||||
--placeholder-outline: #00ff003d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Conceal */
|
|
||||||
|
|
||||||
span.cm-math.cm-concealed-bold {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.cm-math.cm-concealed-underline {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.cm-math.cm-concealed-mathrm, sub.cm-math.cm-concealed-mathrm {
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Conceal superscripts without changing line height */
|
|
||||||
sup.cm-math {
|
|
||||||
line-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sup.cm-math, sub.cm-math {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Inline math tooltip styling */
|
|
||||||
|
|
||||||
.theme-light .cm-tooltip.cm-tooltip-cursor {
|
|
||||||
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, .042), 0px 5px 20px rgba(0, 0, 0, .07);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .cm-tooltip.cm-tooltip-cursor {
|
|
||||||
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1),
|
|
||||||
0px 3.4px 6.7px rgba(0, 0, 0, 0.15),
|
|
||||||
0px 0px 30px rgba(0, 0, 0, 0.27);
|
|
||||||
}
|
|
||||||
/* CM6 puts the top of the tooltip higher than what's viewable (negative top value),
|
|
||||||
so to compensate for this, we align the content to the bottom of the tooltip container,
|
|
||||||
and limit the height.
|
|
||||||
*/
|
|
||||||
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-above {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-above > .MathJax {
|
.latex-suite-keymap-item {
|
||||||
overflow-y: auto;
|
list-style: none;
|
||||||
max-height: 70%;
|
align-self: flex-start;
|
||||||
display: inline-block;
|
|
||||||
align-self: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cm-tooltip.cm-tooltip-cursor.cm-tooltip-below > .MathJax {
|
|
||||||
overflow-y: auto;
|
|
||||||
max-height: 90%;
|
|
||||||
}
|
|
||||||
/* Highlight brackets */
|
|
||||||
.theme-light .latex-suite-highlighted-bracket, .theme-light .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
|
|
||||||
background-color: hsl(var(--accent-h), var(--accent-s), 40%, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-highlighted-bracket, .theme-dark .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
|
|
||||||
background-color: hsl(var(--accent-h), var(--accent-s), 70%, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Color matching brackets */
|
|
||||||
|
|
||||||
.theme-light .latex-suite-color-bracket-0, .theme-light .latex-suite-color-bracket-0 .cm-bracket {
|
|
||||||
color: #527aff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-color-bracket-0, .theme-dark .latex-suite-color-bracket-0 .cm-bracket {
|
|
||||||
color: #47b8ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-light .latex-suite-color-bracket-1, .theme-light .latex-suite-color-bracket-1 .cm-bracket {
|
|
||||||
color: #ff50b7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-color-bracket-1, .theme-dark .latex-suite-color-bracket-1 .cm-bracket {
|
|
||||||
color: #ff55cd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-light .latex-suite-color-bracket-2, .theme-light .latex-suite-color-bracket-2 .cm-bracket {
|
|
||||||
color: #69ba00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-dark .latex-suite-color-bracket-2, .theme-dark .latex-suite-color-bracket-2 .cm-bracket {
|
|
||||||
color: #73ff63;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .latex-suite-color-bracket-3 {
|
|
||||||
color: #8de15c;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.latex-suite-math-preview-highlight {
|
|
||||||
background-color: var(--text-selection);
|
|
||||||
}
|
|
||||||
.cm-snippetFieldPosition {
|
|
||||||
vertical-align: text-top;
|
|
||||||
width: 0;
|
|
||||||
height: 1.15em;
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0 -0.7px -.7em;
|
|
||||||
border-left: 1.4px dotted #888;
|
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,17 @@ $$\begin{bmatrix}
|
|||||||
3 & 6 & 2 \\ h & 12 & k
|
3 & 6 & 2 \\ h & 12 & k
|
||||||
\end{bmatrix} \sim \begin{bmatrix}
|
\end{bmatrix} \sim \begin{bmatrix}
|
||||||
h & 2h & \frac{2h}{3} \\ h & 12 & k
|
h & 2h & \frac{2h}{3} \\ h & 12 & k
|
||||||
\end{bmatrix} \sim \begin{bmatrix}
|
\end{bmatrix} \sim \left[\begin{array}{cc|c}
|
||||||
h & 2h & \frac{2h}{3} \\ 0 & 12 - 2h & k - \frac{2h}{3}
|
h & 2h & \frac{2h}{3} \\ 0 & 12 - 2h & k - \frac{2h}{3}
|
||||||
\end{bmatrix} $$
|
\end{array}\right] $$
|
||||||
There are no solutions the system of equations when there is no pivot in a row and the value on the right is not equal to zero (if the value on the right is also equal to zero than that equation is essentially $0=0$ which is always true).
|
There are no solutions the system of equations when there is no pivot in a row and the value on the right is not equal to zero (if the value on the right is also equal to zero than that equation is essentially $0=0$ which is always true).
|
||||||
This means that there are no solutions when $$12-2h = 0 \to h=6$$ and $$k-\frac{2h}{3} \ne 0$$
|
This means that there are no solutions when $$12-2h = 0 \to h=6$$ and $$k-\frac{2h}{3} \ne 0 \to k-4 \ne 0 \to k \ne 4$$
|
||||||
|
$$
|
||||||
|
\left[
|
||||||
|
\begin{array}{cccc|c}
|
||||||
|
1 & 0 & 3 & -1 & 0 \\
|
||||||
|
0 & 1 & 1 & -1 & 0 \\
|
||||||
|
0 & 0 & 0 & 0 & 0 \\
|
||||||
|
\end{array}
|
||||||
|
\right]
|
||||||
|
$$
|
||||||
Reference in new issue
Block a user