@hjd-hitsz/claudex-web 4.1.4 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.env.example +2 -0
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +13 -1
  4. package/bin/auth.mjs +86 -0
  5. package/bin/claudex-web.mjs +20 -0
  6. package/bin/p2p.mjs +134 -0
  7. package/build-info.json +4 -4
  8. package/client/dist/app.js +104 -104
  9. package/client/dist/code-highlight-style.js +1 -1
  10. package/client/dist/document-editor.js +55 -54
  11. package/client/dist/file-panel.js +5 -5
  12. package/client/dist/notification-worker.js +2 -1
  13. package/client/dist/p2p-sw.js +162 -0
  14. package/client/dist/style.css +1 -1
  15. package/client/dist/terminal-panel.js +11 -11
  16. package/docs/architecture/backends.md +9 -2
  17. package/docs/architecture/behavior.md +167 -53
  18. package/docs/architecture.md +36 -337
  19. package/docs/background-tasks.md +30 -26
  20. package/docs/deployment.md +47 -6
  21. package/docs/development.md +111 -153
  22. package/docs/images/desktop-dark.png +0 -0
  23. package/docs/images/desktop-light.png +0 -0
  24. package/docs/images/mobile-sidebar.png +0 -0
  25. package/docs/images/mobile.png +0 -0
  26. package/docs/releases/v4.1.5.md +6 -0
  27. package/docs/releases/v4.2.0.md +13 -0
  28. package/docs/versioning.md +13 -3
  29. package/package.json +14 -5
  30. package/packages/background-terminal/LICENSE +674 -0
  31. package/packages/background-terminal/README.md +17 -0
  32. package/packages/background-terminal/background-jobs.mjs +457 -0
  33. package/packages/background-terminal/background-mcp.mjs +79 -0
  34. package/packages/background-terminal/background-protocol.mjs +80 -0
  35. package/packages/background-terminal/cli.mjs +14 -0
  36. package/packages/background-terminal/client.mjs +61 -0
  37. package/packages/background-terminal/codex.mjs +88 -0
  38. package/packages/background-terminal/delivery.mjs +192 -0
  39. package/packages/background-terminal/log.mjs +25 -0
  40. package/packages/background-terminal/native-watches.mjs +160 -0
  41. package/packages/background-terminal/package.json +15 -0
  42. package/packages/background-terminal/service.mjs +126 -0
  43. package/packages/translation-engine/package.json +1 -1
  44. package/server/src/application.mjs +82 -10
  45. package/server/src/auth-http.mjs +187 -0
  46. package/server/src/auth-login.mjs +144 -0
  47. package/server/src/auth-totp.mjs +233 -0
  48. package/server/src/auth.mjs +169 -220
  49. package/server/src/backends/claude/background-tasks.mjs +88 -35
  50. package/server/src/backends/claude/messages.mjs +1 -1
  51. package/server/src/backends/claude/worker-client.mjs +47 -35
  52. package/server/src/backends/claude/worker-lines.mjs +17 -0
  53. package/server/src/backends/claude/worker-server.mjs +49 -69
  54. package/server/src/backends/codex/adapter.mjs +46 -5
  55. package/server/src/backends/codex/background-service.mjs +85 -0
  56. package/server/src/backends/codex/background-task-views.mjs +87 -0
  57. package/server/src/backends/codex/background-terminals.mjs +91 -0
  58. package/server/src/backends/codex/events.mjs +11 -0
  59. package/server/src/backends/codex/methods.mjs +1 -0
  60. package/server/src/backends/codex/native-background-handoff.mjs +72 -0
  61. package/server/src/backends/codex/requests.mjs +51 -38
  62. package/server/src/backends/codex/subscriptions.mjs +34 -4
  63. package/server/src/backends/configuration.mjs +8 -0
  64. package/server/src/backends/manager.mjs +35 -33
  65. package/server/src/backends/storage.mjs +3 -14
  66. package/server/src/config.mjs +13 -0
  67. package/server/src/http/business.mjs +21 -0
  68. package/server/src/http/router.mjs +12 -25
  69. package/server/src/p2p/http.mjs +136 -0
  70. package/server/src/p2p/peers.mjs +132 -0
  71. package/server/src/p2p/service.mjs +229 -0
  72. package/server/src/p2p/storage.mjs +45 -0
  73. package/server/src/p2p/tunnel.mjs +95 -0
  74. package/server/src/p2p-http.mjs +149 -0
  75. package/server/src/p2p-peer.mjs +135 -0
  76. package/server/src/private-file.mjs +14 -0
  77. package/server/src/summary-translation.mjs +1 -1
  78. package/server/src/thread-folders.mjs +3 -13
  79. package/server/src/translation-service.mjs +3 -8
  80. package/server/src/workspace/file-search.mjs +244 -0
  81. package/server/src/workspace/service.mjs +17 -3
  82. package/shared/codex-preferences.mjs +9 -0
  83. package/shared/p2p-wire.mjs +157 -0
@@ -1,12 +1,12 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["index.js","code-highlight-style.js","app.js","index2.js","index12.js","index5.js","index13.js","index4.js","index6.js","index14.js","index3.js","index15.js","index7.js","index8.js","index16.js","index17.js","index18.js","index19.js","index20.js","index9.js","index21.js","index22.js","dockerfile.js","simple-mode.js","factor.js","nsis.js","pug.js","javascript.js","index10.js","index11.js"])))=>i.map(i=>d[i]);
2
- import{ab as et,aa as Xe,ac as Dg,a8 as Ce,ad as Wr,a0 as ko,a1 as Je,F as D,a as Bg,S as zg,Z as d1,E as tr,ae as Ng,t as pe,af as Ve,ag as Me,ah as g2,ai as dt,aj as He,ak as gn,al as Dt,am as ne,an as Bt,ao as v2,ap as Oa,aq as Pn,a7 as qr,ar as $e,as as Ls,at as Hg,a2 as os,au as nc,av as y2,aw as jt,ax as $g,ay as qg,az as is,aA as h1,aB as Fg,aC as Vg,aD as Pa,aE as Wg,aF as jg,aG as f1,aH as Ug,aI as Gg,aJ as Vi,aK as b2,aL as Kg,a9 as ti,aM as Zg,O as ru,A as na,U as w2,u as p1,aN as ai,aO as m1,g as Fr,aP as Xg,aQ as Yg,aR as x2,M as bt,K as C2,aS as k2,r as Jg,aT as Qg,aU as ev,aV as g1,aW as v1,aX as Cr,aY as _2,aZ as tv,a_ as at,a$ as rv,b0 as S2,b1 as nv,b2 as ov,W as iv,Q as sv,b3 as av,b4 as lv,R as cv,b5 as uv,b6 as dv,b7 as hv,b8 as fv,b9 as pv,ba as mv,bb as gv,bc as vv,bd as yv,V as bv,be as wv,X as A2,Y as xv,bf as Cv,bg as kv,bh as Di,a5 as _v,a4 as mo,a3 as T2,bi as y1,bj as b1,bk as fa,bl as Sv,bm as Av,bn as Tv,bo as Mv,bp as Ev,bq as oc,br as Iv,bs as Lv,bt as Rv,bu as Ov,bv as Pv,bw as k0,bx as Dv,by as Bv,bz as zv,bA as Nv,bB as Hv,bC as $v,bD as qv,bE as Fv,bF as Vv,bG as Wv,bH as jv,bI as Uv,bJ as Gv,bK as Kv,bL as M2,bM as Zv,bN as Ot,bO as Or,bP as no,bQ as E2,bR as co,bS as I2,bT as uo,bU as L2,bV as R2,bW as O2,bX as P2,bY as bi,bZ as D2,b_ as Xv,b$ as B2,c0 as z2,c1 as Yv,c2 as N2,c3 as Gu,c4 as Jv,c5 as Qv,$ as e8,c6 as t8,c7 as r8}from"./code-highlight-style.js";import{ae as up,af as n8,ag as wi,ah as H2,l as o8,s as i8,R as $2,u as s8,ai as a8,_ as z,ab as w1,aj as l8,ak as q2,al as c8}from"./app.js";import{p as Tr}from"./purify.es.js";import{r as u8,a as _0,f as d8,u as h8}from"./isArrayLikeObject.js";import{t as dp,b as F2,c as f8}from"./_baseMerge.js";var S0=200,Tt=function(){};Tt.prototype.append=function(e){return e.length?(e=Tt.from(e),!this.length&&e||e.length<S0&&this.leafAppend(e)||this.length<S0&&e.leafPrepend(this)||this.appendInner(e)):this};Tt.prototype.prepend=function(e){return e.length?Tt.from(e).append(this):this};Tt.prototype.appendInner=function(e){return new p8(this,e)};Tt.prototype.slice=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=this.length),e>=r?Tt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,r))};Tt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Tt.prototype.forEach=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(e,r,n,0):this.forEachInvertedInner(e,r,n,0)};Tt.prototype.map=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},r,n),o};Tt.from=function(e){return e instanceof Tt?e:e&&e.length?new V2(e):Tt.empty};var V2=(function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=S0)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=S0)return new e(o.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(e.prototype,r),e})(Tt);Tt.empty=new V2([]);var p8=(function(t){function e(r,n){t.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(n,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(n,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(n,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(n,Math.min(o,a),i,s)===!1)return!1},e.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(n,o):n>=i?this.right.slice(n-i,o-i):this.left.slice(n,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new e(o,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Tt);const m8=500;class Dr{constructor(e,r){this.items=e,this.eventCount=r}popEvent(e,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let o,i;r&&(o=this.remapping(n,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){o||(o=this.remapping(n,h+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Jr(d.map));let p=d.step.map(o.slice(i)),g;p&&s.maybeStep(p).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],c.push(new Jr(g,void 0,void 0,c.length+u.length))),i--,g&&o.appendMap(g,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new Dr(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,r,n,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new Jr(e.mapping.maps[u],d,r),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),r&&(s++,r=void 0),o||(l=h)}let c=s-n.depth;return c>v8&&(a=g8(a,c),s-=c),new Dr(a.append(i),s)}remapping(e,r){let n=new Dg;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?n.maps.length-o.mirrorOffset:void 0;n.appendMap(o.map,s)},e,r),n}addMaps(e){return this.eventCount==0?this:new Dr(this.items.append(e.map(r=>new Jr(r))),this.eventCount)}rebased(e,r){if(!this.eventCount)return this;r=Math.min(this.items.length,r);let n=[],o=this.items.length-r,i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=r;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let g=i.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(i.slice(l+1,p));v&&a++,n.push(new Jr(g,y,v))}else n.push(new Jr(g))},o);let c=[];for(let h=r;h<s;h++)c.push(new Jr(i.maps[h]));let u=this.items.slice(0,o).append(c).append(n),d=new Dr(u,a);return d.emptyItemCount()>m8&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(r=>{r.step||e++}),e}compress(e=this.items.length){let r=this.remapping(0,e),n=r.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(r.slice(n)),c=l&&l.getMap();if(n--,c&&r.appendMap(c,n),l){let u=s.selection&&s.selection.map(r.slice(n));u&&i++;let d=new Jr(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(d))?o[p]=h:o.push(d)}}else s.map&&n--},this.items.length,0),new Dr(Tt.from(o.reverse()),i)}}Dr.empty=new Dr(Tt.empty,0);function g8(t,e){let r;return t.forEach((n,o)=>{if(n.selection&&e--==0)return r=o,!1}),t.slice(r)}class Jr{constructor(e,r,n,o){this.map=e,this.step=r,this.selection=n,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let r=e.step.merge(this.step);if(r)return new Jr(r.getMap().invert(),r,this.selection)}}}class oo{constructor(e,r,n,o,i){this.done=e,this.undone=r,this.prevRanges=n,this.prevTime=o,this.prevComposition=i}}const v8=20;function y8(t,e,r,n){let o=r.getMeta(Ko),i;if(o)return o.historyState;r.getMeta(W2)&&(t=new oo(t.done,t.undone,null,0,-1));let s=r.getMeta("appendedTransaction");if(r.steps.length==0)return t;if(s&&s.getMeta(Ko))return s.getMeta(Ko).redo?new oo(t.done.addTransform(r,void 0,n,Il(e)),t.undone,hp(r.mapping.maps),t.prevTime,t.prevComposition):new oo(t.done,t.undone.addTransform(r,void 0,n,Il(e)),null,t.prevTime,t.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=r.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(r.time||0)-n.newGroupDelay||!b8(r,t.prevRanges)),c=s?nu(t.prevRanges,r.mapping):hp(r.mapping.maps);return new oo(t.done.addTransform(r,l?e.selection.getBookmark():void 0,n,Il(e)),Dr.empty,c,r.time,a??t.prevComposition)}else return(i=r.getMeta("rebased"))?new oo(t.done.rebased(r,i),t.undone.rebased(r,i),nu(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new oo(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),nu(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}function b8(t,e){if(!e)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((n,o)=>{for(let i=0;i<e.length;i+=2)n<=e[i+1]&&o>=e[i]&&(r=!0)}),r}function hp(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach((n,o,i,s)=>e.push(i,s));return e}function nu(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let o=e.map(t[n],1),i=e.map(t[n+1],-1);o<=i&&r.push(o,i)}return r}function w8(t,e,r){let n=Il(e),o=Ko.get(e).spec.config,i=(r?t.undone:t.done).popEvent(e,n);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(r?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,n),l=new oo(r?a:i.remaining,r?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ko,{redo:r,historyState:l})}let ou=!1,fp=null;function Il(t){let e=t.plugins;if(fp!=e){ou=!1,fp=e;for(let r=0;r<e.length;r++)if(e[r].spec.historyPreserveItems){ou=!0;break}}return ou}function kr(t){return t.setMeta(W2,!0)}const Ko=new et("history"),W2=new et("closeHistory");function x8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Xe({key:Ko,state:{init(){return new oo(Dr.empty,Dr.empty,null,0,-1)},apply(e,r,n){return y8(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,r){let n=r.inputType,o=n=="historyUndo"?ic:n=="historyRedo"?Wi:null;return!o||!e.editable?!1:(r.preventDefault(),o(e.state,e.dispatch))}}}})}function j2(t,e){return(r,n)=>{let o=Ko.getState(r);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(n){let i=w8(o,r,t);i&&n(e?i.scrollIntoView():i)}return!0}}const ic=j2(!1,!0),Wi=j2(!0,!0);function x1(t){if(!t.hasFocus()||t.composing)return;const e=t.dom.ownerDocument.getSelection();if(!e||!t.dom.contains(e.anchorNode)||!t.dom.contains(e.focusNode))return;const r=t.posAtDOM(e.anchorNode,e.anchorOffset),n=t.posAtDOM(e.focusNode,e.focusOffset),o=Ce.between(t.state.doc.resolve(r),t.state.doc.resolve(n));o.eq(t.state.selection)||t.dispatch(t.state.tr.setSelection(o))}function Ku(t,e,r){const n="CODEXCURSOR"+crypto.randomUUID().replaceAll("-",""),o=t.state.tr.insertText(n,r).doc;return e(o).indexOf(n)}function C8(t,e,r=!1){return x1(t),Ku(t,e,r?t.state.selection.to:t.state.selection.from)}function Ri(t,e,r){const n=[];t.state.doc.descendants((c,u)=>{c.isText?n.push({from:u,to:u+c.nodeSize}):c.isInline&&c.isAtom?n.push({from:u,to:u+c.nodeSize}):c.isTextblock&&!c.content.size&&n.push({from:u+1,to:u+1})});let o=0,i=n.length-1,s=n[0];for(;o<=i;){const c=o+i>>1;Ku(t,e,n[c].from)<=r?(s=n[c],o=c+1):i=c-1}if(!s)return 1;let a=s.from,l=s.to;for(;a<l;){const c=Math.ceil((a+l)/2);Ku(t,e,c)<=r?a=c:l=c-1}return a}function k8(t,e,r,n=r){t.dispatch(t.state.tr.setSelection(Ce.create(t.state.doc,Ri(t,e,r),Ri(t,e,n))).scrollIntoView())}function pp(t){if(t.type!=="link"||t.children.some(r=>r.type==="image"))return null;const e=H2(t.url);return wi(e,t.children.map(r=>r.value||"").join(""),t.title)}function _8(t){const e={"data-inline-reference":JSON.stringify(t)},r=t.kind==="skill"?"skill":t.kind==="thread"?"agent":"at";return e[r+"-mention-path"]=t.path,e[r+"-mention-"+(r==="at"?"label":"name")]=t.name,r==="at"?e["at-mention-fs-path"]=t.path:e[r+"-mention-display-name"]=t.name,e}const U2=Wr("reference_inline",()=>({inline:!0,group:"inline",atom:!0,selectable:!1,draggable:!1,attrs:{reference:{default:null}},leafText:t=>t.attrs.reference.name,parseDOM:[{tag:"span[at-mention-label][at-mention-path]",getAttrs:t=>{const e=t.getAttribute("at-mention-fs-path")||t.getAttribute("at-mention-path"),r=t.getAttribute("at-mention-path").endsWith("/"),n=wi(e+(r&&!e.endsWith("/")?"/":""),t.getAttribute("at-mention-label"),"file-reference");return n?{reference:n}:!1}},{tag:"span[skill-mention-name][skill-mention-path]",getAttrs:t=>{const e=wi(t.getAttribute("skill-mention-path"),"$"+t.getAttribute("skill-mention-name"));return e?{reference:e}:!1}},{tag:"span[agent-mention-name][agent-mention-path]",getAttrs:t=>{const e=wi(t.getAttribute("agent-mention-path"),t.getAttribute("agent-mention-display-name")||t.getAttribute("agent-mention-name"));return e?{reference:e}:!1}},{tag:"a[href]",getAttrs:t=>{const e=wi(H2(t.getAttribute("href")),t.textContent,t.title);return e?{reference:e}:!1}},{tag:"span[data-inline-reference]",getAttrs:t=>{try{const e=JSON.parse(t.dataset.inlineReference),r=wi(e.path,(e.kind==="skill"?"$":"")+e.name,up(e));return r?{reference:r}:!1}catch{return!1}}}],toDOM:t=>["span",_8(t.attrs.reference),t.attrs.reference.name],parseMarkdown:{match:t=>!!pp(t),runner:(t,e,r)=>t.addNode(r,{reference:pp(e)})},toMarkdown:{match:t=>t.type.name==="reference_inline",runner:(t,e)=>{const r=e.attrs.reference;t.openNode("link",void 0,{url:n8(r.path),title:up(r)}),t.addNode("text",void 0,(r.kind==="skill"?"$":"")+r.name),t.closeNode()}}}));function S8({reference:t,onOpen:e}){const{skills:r}=s8(),n=t.kind==="skill"?r.find(o=>o.path===t.path||t.native&&o.name===t.name):null;return $2.createElement(a8,{reference:{...t,displayName:n?.interface?.displayName},onOpen:e})}const A8=ko(U2.node,()=>(t,e)=>{const r=document.createElement("span");r.contentEditable="false",r.className="document-reference";const n=o8.createRoot(r);let o=t;function i(){r.dataset.inlineReference=JSON.stringify(o.attrs.reference);const s=o.attrs.reference,a=["file","directory"].includes(s.kind)?()=>{e.focus(),i8({panel:"files",panelFile:s.kind==="directory"?{path:s.path,view:"directory"}:s.path})}:void 0;n.render($2.createElement(S8,{reference:s,onOpen:a}))}return i(),{dom:r,update(s){return s.type!==o.type?!1:(o=s,i(),!0)},ignoreMutation:()=>!0,destroy:()=>n.unmount()}}),T8=Je(()=>new Xe({props:{handleDOMEvents:{keydown(t,e){if(t.composing||e.ctrlKey||e.metaKey||e.altKey||!t.state.selection.empty||!["Backspace","Delete"].includes(e.key))return!1;x1(t);const{$from:r}=t.state.selection,n=e.key==="Backspace",o=n?r.nodeBefore:r.nodeAfter;if(o?.type.name!=="reference_inline")return!1;const i=r.pos-(n?o.nodeSize:0);return e.preventDefault(),t.dispatch(t.state.tr.delete(i,i+o.nodeSize).scrollIntoView()),!0}}}}));function M8(t){let e=!1;if(t.content.descendants(r=>{r.type.name==="reference_inline"&&(e=!0)}),!!e)return t.content.textBetween(0,t.content.size,`
2
+ import{ab as et,aa as Xe,ac as Dg,a8 as Ce,ad as Wr,a1 as Je,a0 as ko,F as D,a as Bg,S as zg,Z as d1,E as tr,ae as Ng,t as pe,af as Ve,ag as Me,ah as v2,ai as dt,aj as He,ak as gn,al as Dt,am as ne,an as Bt,ao as y2,ap as Oa,aq as Pn,a7 as qr,ar as $e,as as Ls,at as Hg,a2 as os,au as nc,av as b2,aw as jt,ax as $g,ay as qg,az as is,aA as h1,aB as Fg,aC as Vg,aD as Pa,aE as Wg,aF as jg,aG as f1,aH as Ug,aI as Gg,aJ as Vi,aK as w2,aL as Kg,a9 as ti,aM as Zg,O as ru,A as na,U as x2,u as p1,aN as ai,aO as m1,g as Fr,aP as Xg,aQ as Yg,aR as C2,M as bt,K as k2,aS as _2,r as Jg,aT as Qg,aU as ev,aV as g1,aW as v1,aX as Cr,aY as S2,aZ as tv,a_ as at,a$ as rv,b0 as A2,b1 as nv,b2 as ov,W as iv,Q as sv,b3 as av,b4 as lv,R as cv,b5 as uv,b6 as dv,b7 as hv,b8 as fv,b9 as pv,ba as mv,bb as gv,bc as vv,bd as yv,V as bv,be as wv,X as T2,Y as xv,bf as Cv,bg as kv,bh as Di,a5 as _v,a4 as mo,a3 as M2,bi as y1,bj as b1,bk as fa,bl as Sv,bm as Av,bn as Tv,bo as Mv,bp as Ev,bq as oc,br as Iv,bs as Lv,bt as Rv,bu as Ov,bv as Pv,bw as k0,bx as Dv,by as Bv,bz as zv,bA as Nv,bB as Hv,bC as $v,bD as qv,bE as Fv,bF as Vv,bG as Wv,bH as jv,bI as Uv,bJ as Gv,bK as Kv,bL as E2,bM as Zv,bN as Ot,bO as Or,bP as no,bQ as I2,bR as co,bS as L2,bT as uo,bU as R2,bV as O2,bW as P2,bX as D2,bY as bi,bZ as B2,b_ as Xv,b$ as z2,c0 as N2,c1 as Yv,c2 as H2,c3 as Gu,c4 as Jv,c5 as Qv,$ as e8,c6 as t8,c7 as r8}from"./code-highlight-style.js";import{v as n8,ak as up,R as o8,al as i8,am as dp,an as s8,ao as wi,ap as $2,_ as z,ah as w1,aq as a8,ar as q2,as as l8}from"./app.js";import{p as Tr}from"./purify.es.js";import{r as c8,a as _0,f as u8,u as d8}from"./isArrayLikeObject.js";import{t as hp,b as F2,c as h8}from"./_baseMerge.js";var S0=200,Tt=function(){};Tt.prototype.append=function(e){return e.length?(e=Tt.from(e),!this.length&&e||e.length<S0&&this.leafAppend(e)||this.length<S0&&e.leafPrepend(this)||this.appendInner(e)):this};Tt.prototype.prepend=function(e){return e.length?Tt.from(e).append(this):this};Tt.prototype.appendInner=function(e){return new f8(this,e)};Tt.prototype.slice=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=this.length),e>=r?Tt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,r))};Tt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Tt.prototype.forEach=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(e,r,n,0):this.forEachInvertedInner(e,r,n,0)};Tt.prototype.map=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},r,n),o};Tt.from=function(e){return e instanceof Tt?e:e&&e.length?new V2(e):Tt.empty};var V2=(function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=S0)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=S0)return new e(o.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(e.prototype,r),e})(Tt);Tt.empty=new V2([]);var f8=(function(t){function e(r,n){t.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(n,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(n,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(n,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(n,Math.min(o,a),i,s)===!1)return!1},e.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(n,o):n>=i?this.right.slice(n-i,o-i):this.left.slice(n,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new e(o,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Tt);const p8=500;class Dr{constructor(e,r){this.items=e,this.eventCount=r}popEvent(e,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let o,i;r&&(o=this.remapping(n,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){o||(o=this.remapping(n,h+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Jr(d.map));let p=d.step.map(o.slice(i)),g;p&&s.maybeStep(p).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],c.push(new Jr(g,void 0,void 0,c.length+u.length))),i--,g&&o.appendMap(g,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new Dr(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,r,n,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new Jr(e.mapping.maps[u],d,r),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),r&&(s++,r=void 0),o||(l=h)}let c=s-n.depth;return c>g8&&(a=m8(a,c),s-=c),new Dr(a.append(i),s)}remapping(e,r){let n=new Dg;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?n.maps.length-o.mirrorOffset:void 0;n.appendMap(o.map,s)},e,r),n}addMaps(e){return this.eventCount==0?this:new Dr(this.items.append(e.map(r=>new Jr(r))),this.eventCount)}rebased(e,r){if(!this.eventCount)return this;r=Math.min(this.items.length,r);let n=[],o=this.items.length-r,i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=r;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let g=i.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(i.slice(l+1,p));v&&a++,n.push(new Jr(g,y,v))}else n.push(new Jr(g))},o);let c=[];for(let h=r;h<s;h++)c.push(new Jr(i.maps[h]));let u=this.items.slice(0,o).append(c).append(n),d=new Dr(u,a);return d.emptyItemCount()>p8&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(r=>{r.step||e++}),e}compress(e=this.items.length){let r=this.remapping(0,e),n=r.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(r.slice(n)),c=l&&l.getMap();if(n--,c&&r.appendMap(c,n),l){let u=s.selection&&s.selection.map(r.slice(n));u&&i++;let d=new Jr(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(d))?o[p]=h:o.push(d)}}else s.map&&n--},this.items.length,0),new Dr(Tt.from(o.reverse()),i)}}Dr.empty=new Dr(Tt.empty,0);function m8(t,e){let r;return t.forEach((n,o)=>{if(n.selection&&e--==0)return r=o,!1}),t.slice(r)}class Jr{constructor(e,r,n,o){this.map=e,this.step=r,this.selection=n,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let r=e.step.merge(this.step);if(r)return new Jr(r.getMap().invert(),r,this.selection)}}}class oo{constructor(e,r,n,o,i){this.done=e,this.undone=r,this.prevRanges=n,this.prevTime=o,this.prevComposition=i}}const g8=20;function v8(t,e,r,n){let o=r.getMeta(Ko),i;if(o)return o.historyState;r.getMeta(W2)&&(t=new oo(t.done,t.undone,null,0,-1));let s=r.getMeta("appendedTransaction");if(r.steps.length==0)return t;if(s&&s.getMeta(Ko))return s.getMeta(Ko).redo?new oo(t.done.addTransform(r,void 0,n,Il(e)),t.undone,fp(r.mapping.maps),t.prevTime,t.prevComposition):new oo(t.done,t.undone.addTransform(r,void 0,n,Il(e)),null,t.prevTime,t.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=r.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(r.time||0)-n.newGroupDelay||!y8(r,t.prevRanges)),c=s?nu(t.prevRanges,r.mapping):fp(r.mapping.maps);return new oo(t.done.addTransform(r,l?e.selection.getBookmark():void 0,n,Il(e)),Dr.empty,c,r.time,a??t.prevComposition)}else return(i=r.getMeta("rebased"))?new oo(t.done.rebased(r,i),t.undone.rebased(r,i),nu(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new oo(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),nu(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}function y8(t,e){if(!e)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((n,o)=>{for(let i=0;i<e.length;i+=2)n<=e[i+1]&&o>=e[i]&&(r=!0)}),r}function fp(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach((n,o,i,s)=>e.push(i,s));return e}function nu(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let o=e.map(t[n],1),i=e.map(t[n+1],-1);o<=i&&r.push(o,i)}return r}function b8(t,e,r){let n=Il(e),o=Ko.get(e).spec.config,i=(r?t.undone:t.done).popEvent(e,n);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(r?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,n),l=new oo(r?a:i.remaining,r?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ko,{redo:r,historyState:l})}let ou=!1,pp=null;function Il(t){let e=t.plugins;if(pp!=e){ou=!1,pp=e;for(let r=0;r<e.length;r++)if(e[r].spec.historyPreserveItems){ou=!0;break}}return ou}function kr(t){return t.setMeta(W2,!0)}const Ko=new et("history"),W2=new et("closeHistory");function w8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Xe({key:Ko,state:{init(){return new oo(Dr.empty,Dr.empty,null,0,-1)},apply(e,r,n){return v8(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,r){let n=r.inputType,o=n=="historyUndo"?ic:n=="historyRedo"?Wi:null;return!o||!e.editable?!1:(r.preventDefault(),o(e.state,e.dispatch))}}}})}function j2(t,e){return(r,n)=>{let o=Ko.getState(r);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(n){let i=b8(o,r,t);i&&n(e?i.scrollIntoView():i)}return!0}}const ic=j2(!1,!0),Wi=j2(!0,!0);function x1(t){if(!t.hasFocus()||t.composing)return;const e=t.dom.ownerDocument.getSelection();if(!e||!t.dom.contains(e.anchorNode)||!t.dom.contains(e.focusNode))return;const r=t.posAtDOM(e.anchorNode,e.anchorOffset),n=t.posAtDOM(e.focusNode,e.focusOffset),o=Ce.between(t.state.doc.resolve(r),t.state.doc.resolve(n));o.eq(t.state.selection)||t.dispatch(t.state.tr.setSelection(o))}function Ku(t,e,r){const n="CODEXCURSOR"+crypto.randomUUID().replaceAll("-",""),o=t.state.tr.insertText(n,r).doc;return e(o).indexOf(n)}function x8(t,e,r=!1){return x1(t),Ku(t,e,r?t.state.selection.to:t.state.selection.from)}function Ri(t,e,r){const n=[];t.state.doc.descendants((c,u)=>{c.isText?n.push({from:u,to:u+c.nodeSize}):c.isInline&&c.isAtom?n.push({from:u,to:u+c.nodeSize}):c.isTextblock&&!c.content.size&&n.push({from:u+1,to:u+1})});let o=0,i=n.length-1,s=n[0];for(;o<=i;){const c=o+i>>1;Ku(t,e,n[c].from)<=r?(s=n[c],o=c+1):i=c-1}if(!s)return 1;let a=s.from,l=s.to;for(;a<l;){const c=Math.ceil((a+l)/2);Ku(t,e,c)<=r?a=c:l=c-1}return a}function C8(t,e,r,n=r){t.dispatch(t.state.tr.setSelection(Ce.create(t.state.doc,Ri(t,e,r),Ri(t,e,n))).scrollIntoView())}function mp(t){if(t.type!=="link"||t.children.some(r=>r.type==="image"))return null;const e=$2(t.url);return wi(e,t.children.map(r=>r.value||"").join(""),t.title)}function k8(t){const e={"data-inline-reference":JSON.stringify(t)},r=t.kind==="skill"?"skill":t.kind==="thread"?"agent":"at";return e[r+"-mention-path"]=t.path,e[r+"-mention-"+(r==="at"?"label":"name")]=t.name,r==="at"?e["at-mention-fs-path"]=t.path:e[r+"-mention-display-name"]=t.name,e}const U2=Wr("reference_inline",()=>({inline:!0,group:"inline",atom:!0,selectable:!1,draggable:!1,attrs:{reference:{default:null}},leafText:t=>t.attrs.reference.name,parseDOM:[{tag:"span[at-mention-label][at-mention-path]",getAttrs:t=>{const e=t.getAttribute("at-mention-fs-path")||t.getAttribute("at-mention-path"),r=t.getAttribute("at-mention-path").endsWith("/"),n=wi(e+(r&&!e.endsWith("/")?"/":""),t.getAttribute("at-mention-label"),"file-reference");return n?{reference:n}:!1}},{tag:"span[skill-mention-name][skill-mention-path]",getAttrs:t=>{const e=wi(t.getAttribute("skill-mention-path"),"$"+t.getAttribute("skill-mention-name"));return e?{reference:e}:!1}},{tag:"span[agent-mention-name][agent-mention-path]",getAttrs:t=>{const e=wi(t.getAttribute("agent-mention-path"),t.getAttribute("agent-mention-display-name")||t.getAttribute("agent-mention-name"));return e?{reference:e}:!1}},{tag:"a[href]",getAttrs:t=>{const e=wi($2(t.getAttribute("href")),t.textContent,t.title);return e?{reference:e}:!1}},{tag:"span[data-inline-reference]",getAttrs:t=>{try{const e=JSON.parse(t.dataset.inlineReference),r=wi(e.path,(e.kind==="skill"?"$":"")+e.name,dp(e));return r?{reference:r}:!1}catch{return!1}}}],toDOM:t=>["span",k8(t.attrs.reference),t.attrs.reference.name],parseMarkdown:{match:t=>!!mp(t),runner:(t,e,r)=>t.addNode(r,{reference:mp(e)})},toMarkdown:{match:t=>t.type.name==="reference_inline",runner:(t,e)=>{const r=e.attrs.reference;t.openNode("link",void 0,{url:s8(r.path),title:dp(r)}),t.addNode("text",void 0,(r.kind==="skill"?"$":"")+r.name),t.closeNode()}}}));function _8(t=[],e){const r=new Set;return{plugin:ko(U2.node,()=>(o,i)=>{const s=i.dom.ownerDocument.createElement("span");s.contentEditable="false",s.className="document-reference";const a=n8.createRoot(s);let l=o,c;function u(){const p=l.attrs.reference;c=up(p,t);const g=e&&(p.kind==="file"||p.kind==="directory")?()=>{i.focus(),e(p)}:void 0;a.render(o8.createElement(i8,{reference:{...p,displayName:c},onOpen:g}))}function d(){c!==up(l.attrs.reference,t)&&u()}function h(){const{reference:p}=l.attrs;s.dataset.inlineReference=JSON.stringify(p),p.kind==="skill"?r.add(d):r.delete(d),u()}return h(),{dom:s,update(p){return p.type!==l.type?!1:(l=p,h(),!0)},ignoreMutation:()=>!0,destroy(){r.delete(d),queueMicrotask(()=>a.unmount())}}}),setSkills(o){if(t!==o){t=o;for(const i of r)i()}}}}const S8=Je(()=>new Xe({props:{handleDOMEvents:{keydown(t,e){if(t.composing||e.ctrlKey||e.metaKey||e.altKey||!t.state.selection.empty||!["Backspace","Delete"].includes(e.key))return!1;x1(t);const{$from:r}=t.state.selection,n=e.key==="Backspace",o=n?r.nodeBefore:r.nodeAfter;if(o?.type.name!=="reference_inline")return!1;const i=r.pos-(n?o.nodeSize:0);return e.preventDefault(),t.dispatch(t.state.tr.delete(i,i+o.nodeSize).scrollIntoView()),!0}}}}));function A8(t){let e=!1;if(t.content.descendants(r=>{r.type.name==="reference_inline"&&(e=!0)}),!!e)return t.content.textBetween(0,t.content.size,`
3
3
 
4
- `,r=>r.type.spec.leafText?.(r)||r.attrs.alt||"")}var iu=function(){return u8.Date.now()},E8="Expected a function",I8=Math.max,L8=Math.min;function sc(t,e,r){var n,o,i,s,a,l,c=0,u=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(E8);e=dp(e)||0,_0(r)&&(u=!!r.leading,d="maxWait"in r,i=d?I8(dp(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h);function p(R){var H=n,O=o;return n=o=void 0,c=R,s=t.apply(O,H),s}function g(R){return c=R,a=setTimeout(w,e),u?p(R):s}function y(R){var H=R-l,O=R-c,P=e-H;return d?L8(P,i-O):P}function v(R){var H=R-l,O=R-c;return l===void 0||H>=e||H<0||d&&O>=i}function w(){var R=iu();if(v(R))return C(R);a=setTimeout(w,y(R))}function C(R){return a=void 0,h&&n?p(R):(n=o=void 0,s)}function k(){a!==void 0&&clearTimeout(a),c=0,n=l=o=a=void 0}function A(){return a===void 0?s:C(iu())}function I(){var R=iu(),H=v(R);if(n=arguments,o=this,l=R,H){if(a===void 0)return g(l);if(d)return clearTimeout(a),a=setTimeout(w,e),p(l)}return a===void 0&&(a=setTimeout(w,e)),s}return I.cancel=k,I.flush=A,I}function G2(t,e,r,n,o,i){return _0(t)&&_0(e)&&(i.set(e,t),F2(t,e,void 0,G2,i),i.delete(e)),t}var R8=f8(function(t,e,r,n){F2(t,e,r,n)}),O8=d8(function(t){return t.push(void 0,G2),h8(R8,void 0,t)}),P8="Expected a function";function ac(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(P8);return _0(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),sc(t,e,{leading:n,maxWait:e,trailing:o})}function V(t){return new Bg(zg.define(t))}function Gn(t){return z(()=>import("./index.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const D8=[D.of({name:"C",extensions:["c","h","ino"],load(){return z(()=>import("./index12.js"),__vite__mapDeps([4,3,1,2])).then(t=>t.cpp())}}),D.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return z(()=>import("./index12.js"),__vite__mapDeps([4,3,1,2])).then(t=>t.cpp())}}),D.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Gn("Cassandra")}}),D.of({name:"CSS",extensions:["css"],load(){return z(()=>import("./index5.js"),__vite__mapDeps([5,3,1,2])).then(t=>t.css())}}),D.of({name:"Go",extensions:["go"],load(){return z(()=>import("./index13.js"),__vite__mapDeps([6,3,1,2])).then(t=>t.go())}}),D.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return z(()=>import("./index4.js"),__vite__mapDeps([7,3,1,2,5,8])).then(t=>t.html())}}),D.of({name:"Java",extensions:["java"],load(){return z(()=>import("./index14.js"),__vite__mapDeps([9,3,1,2])).then(t=>t.java())}}),D.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript())}}),D.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return z(()=>import("./index3.js"),__vite__mapDeps([10,1,2,7,3,5,8])).then(t=>t.jinja())}}),D.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return z(()=>import("./index15.js"),__vite__mapDeps([11,3,1,2])).then(t=>t.json())}}),D.of({name:"JSX",extensions:["jsx"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({jsx:!0}))}}),D.of({name:"LESS",extensions:["less"],load(){return z(()=>import("./index7.js"),__vite__mapDeps([12,1,2,5,3])).then(t=>t.less())}}),D.of({name:"Liquid",extensions:["liquid"],load(){return z(()=>import("./index8.js"),__vite__mapDeps([13,1,2,7,3,5,8])).then(t=>t.liquid())}}),D.of({name:"MariaDB SQL",load(){return Gn("MariaSQL")}}),D.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return z(()=>import("./index16.js"),__vite__mapDeps([14,1,2,7,3,5,8])).then(t=>t.markdown())}}),D.of({name:"MS SQL",load(){return Gn("MSSQL")}}),D.of({name:"MySQL",load(){return Gn("MySQL")}}),D.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return z(()=>import("./index17.js"),__vite__mapDeps([15,3,1,2,7,5,8])).then(t=>t.php())}}),D.of({name:"PLSQL",extensions:["pls"],load(){return Gn("PLSQL")}}),D.of({name:"PostgreSQL",load(){return Gn("PostgreSQL")}}),D.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return z(()=>import("./index18.js"),__vite__mapDeps([16,3,1,2])).then(t=>t.python())}}),D.of({name:"Rust",extensions:["rs"],load(){return z(()=>import("./index19.js"),__vite__mapDeps([17,3,1,2])).then(t=>t.rust())}}),D.of({name:"Sass",extensions:["sass"],load(){return z(()=>import("./index20.js"),__vite__mapDeps([18,3,1,2,5])).then(t=>t.sass({indented:!0}))}}),D.of({name:"SCSS",extensions:["scss"],load(){return z(()=>import("./index20.js"),__vite__mapDeps([18,3,1,2,5])).then(t=>t.sass())}}),D.of({name:"SQL",extensions:["sql"],load(){return Gn("StandardSQL")}}),D.of({name:"SQLite",load(){return Gn("SQLite")}}),D.of({name:"TSX",extensions:["tsx"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),D.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({typescript:!0}))}}),D.of({name:"WebAssembly",extensions:["wat","wast"],load(){return z(()=>import("./index9.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),D.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return z(()=>import("./index21.js"),__vite__mapDeps([20,3,1,2])).then(t=>t.xml())}}),D.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return z(()=>import("./index22.js"),__vite__mapDeps([21,3,1,2])).then(t=>t.yaml())}}),D.of({name:"APL",extensions:["dyalog","apl"],load(){return z(()=>import("./apl.js"),[]).then(t=>V(t.apl))}}),D.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return z(()=>import("./asciiarmor.js"),[]).then(t=>V(t.asciiArmor))}}),D.of({name:"ASN.1",extensions:["asn","asn1"],load(){return z(()=>import("./asn1.js"),[]).then(t=>V(t.asn1({})))}}),D.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return z(()=>import("./asterisk.js"),[]).then(t=>V(t.asterisk))}}),D.of({name:"Brainfuck",extensions:["b","bf"],load(){return z(()=>import("./brainfuck.js"),[]).then(t=>V(t.brainfuck))}}),D.of({name:"Cobol",extensions:["cob","cpy"],load(){return z(()=>import("./cobol.js"),[]).then(t=>V(t.cobol))}}),D.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.csharp))}}),D.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"ClojureScript",extensions:["cljs"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return z(()=>import("./css.js"),[]).then(t=>V(t.gss))}}),D.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return z(()=>import("./cmake.js"),[]).then(t=>V(t.cmake))}}),D.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return z(()=>import("./coffeescript.js"),[]).then(t=>V(t.coffeeScript))}}),D.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return z(()=>import("./commonlisp.js"),[]).then(t=>V(t.commonLisp))}}),D.of({name:"Cypher",extensions:["cyp","cypher"],load(){return z(()=>import("./cypher.js"),[]).then(t=>V(t.cypher))}}),D.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return z(()=>import("./python.js"),[]).then(t=>V(t.cython))}}),D.of({name:"Crystal",extensions:["cr"],load(){return z(()=>import("./crystal.js"),[]).then(t=>V(t.crystal))}}),D.of({name:"D",extensions:["d"],load(){return z(()=>import("./d.js"),[]).then(t=>V(t.d))}}),D.of({name:"Dart",extensions:["dart"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.dart))}}),D.of({name:"diff",extensions:["diff","patch"],load(){return z(()=>import("./diff.js"),[]).then(t=>V(t.diff))}}),D.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return z(()=>import("./dockerfile.js"),__vite__mapDeps([22,23])).then(t=>V(t.dockerFile))}}),D.of({name:"DTD",extensions:["dtd"],load(){return z(()=>import("./dtd.js"),[]).then(t=>V(t.dtd))}}),D.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return z(()=>import("./dylan.js"),[]).then(t=>V(t.dylan))}}),D.of({name:"EBNF",load(){return z(()=>import("./ebnf.js"),[]).then(t=>V(t.ebnf))}}),D.of({name:"ECL",extensions:["ecl"],load(){return z(()=>import("./ecl.js"),[]).then(t=>V(t.ecl))}}),D.of({name:"edn",extensions:["edn"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"Eiffel",extensions:["e"],load(){return z(()=>import("./eiffel.js"),[]).then(t=>V(t.eiffel))}}),D.of({name:"Elm",extensions:["elm"],load(){return z(()=>import("./elm.js"),[]).then(t=>V(t.elm))}}),D.of({name:"Erlang",extensions:["erl"],load(){return z(()=>import("./erlang.js"),[]).then(t=>V(t.erlang))}}),D.of({name:"Esper",load(){return z(()=>import("./sql.js"),[]).then(t=>V(t.esper))}}),D.of({name:"Factor",extensions:["factor"],load(){return z(()=>import("./factor.js"),__vite__mapDeps([24,23])).then(t=>V(t.factor))}}),D.of({name:"FCL",load(){return z(()=>import("./fcl.js"),[]).then(t=>V(t.fcl))}}),D.of({name:"Forth",extensions:["forth","fth","4th"],load(){return z(()=>import("./forth.js"),[]).then(t=>V(t.forth))}}),D.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return z(()=>import("./fortran.js"),[]).then(t=>V(t.fortran))}}),D.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.fSharp))}}),D.of({name:"Gas",extensions:["s"],load(){return z(()=>import("./gas.js"),[]).then(t=>V(t.gas))}}),D.of({name:"Gherkin",extensions:["feature"],load(){return z(()=>import("./gherkin.js"),[]).then(t=>V(t.gherkin))}}),D.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return z(()=>import("./groovy.js"),[]).then(t=>V(t.groovy))}}),D.of({name:"Haskell",extensions:["hs"],load(){return z(()=>import("./haskell.js"),[]).then(t=>V(t.haskell))}}),D.of({name:"Haxe",extensions:["hx"],load(){return z(()=>import("./haxe.js"),[]).then(t=>V(t.haxe))}}),D.of({name:"HXML",extensions:["hxml"],load(){return z(()=>import("./haxe.js"),[]).then(t=>V(t.hxml))}}),D.of({name:"HTTP",load(){return z(()=>import("./http.js"),[]).then(t=>V(t.http))}}),D.of({name:"IDL",extensions:["pro"],load(){return z(()=>import("./idl.js"),[]).then(t=>V(t.idl))}}),D.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return z(()=>import("./javascript.js"),[]).then(t=>V(t.jsonld))}}),D.of({name:"Julia",extensions:["jl"],load(){return z(()=>import("./julia.js"),[]).then(t=>V(t.julia))}}),D.of({name:"Kotlin",extensions:["kt","kts"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.kotlin))}}),D.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return z(()=>import("./livescript.js"),[]).then(t=>V(t.liveScript))}}),D.of({name:"Lua",extensions:["lua"],load(){return z(()=>import("./lua.js"),[]).then(t=>V(t.lua))}}),D.of({name:"mIRC",extensions:["mrc"],load(){return z(()=>import("./mirc.js"),[]).then(t=>V(t.mirc))}}),D.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return z(()=>import("./mathematica.js"),[]).then(t=>V(t.mathematica))}}),D.of({name:"Modelica",extensions:["mo"],load(){return z(()=>import("./modelica.js"),[]).then(t=>V(t.modelica))}}),D.of({name:"MUMPS",extensions:["mps"],load(){return z(()=>import("./mumps.js"),[]).then(t=>V(t.mumps))}}),D.of({name:"Mbox",extensions:["mbox"],load(){return z(()=>import("./mbox.js"),[]).then(t=>V(t.mbox))}}),D.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return z(()=>import("./nginx.js"),[]).then(t=>V(t.nginx))}}),D.of({name:"NSIS",extensions:["nsh","nsi"],load(){return z(()=>import("./nsis.js"),__vite__mapDeps([25,23])).then(t=>V(t.nsis))}}),D.of({name:"NTriples",extensions:["nt","nq"],load(){return z(()=>import("./ntriples.js"),[]).then(t=>V(t.ntriples))}}),D.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.objectiveC))}}),D.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.objectiveCpp))}}),D.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.oCaml))}}),D.of({name:"Octave",extensions:["m"],load(){return z(()=>import("./octave.js"),[]).then(t=>V(t.octave))}}),D.of({name:"Oz",extensions:["oz"],load(){return z(()=>import("./oz.js"),[]).then(t=>V(t.oz))}}),D.of({name:"Pascal",extensions:["p","pas"],load(){return z(()=>import("./pascal.js"),[]).then(t=>V(t.pascal))}}),D.of({name:"Perl",extensions:["pl","pm"],load(){return z(()=>import("./perl.js"),[]).then(t=>V(t.perl))}}),D.of({name:"Pig",extensions:["pig"],load(){return z(()=>import("./pig.js"),[]).then(t=>V(t.pig))}}),D.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return z(()=>import("./powershell.js"),[]).then(t=>V(t.powerShell))}}),D.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return z(()=>import("./properties.js"),[]).then(t=>V(t.properties))}}),D.of({name:"ProtoBuf",extensions:["proto"],load(){return z(()=>import("./protobuf.js"),[]).then(t=>V(t.protobuf))}}),D.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return z(()=>import("./pug.js"),__vite__mapDeps([26,27])).then(t=>V(t.pug))}}),D.of({name:"Puppet",extensions:["pp"],load(){return z(()=>import("./puppet.js"),[]).then(t=>V(t.puppet))}}),D.of({name:"Q",extensions:["q"],load(){return z(()=>import("./q.js"),[]).then(t=>V(t.q))}}),D.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return z(()=>import("./r.js"),[]).then(t=>V(t.r))}}),D.of({name:"RPM Changes",load(){return z(()=>import("./rpm.js"),[]).then(t=>V(t.rpmChanges))}}),D.of({name:"RPM Spec",extensions:["spec"],load(){return z(()=>import("./rpm.js"),[]).then(t=>V(t.rpmSpec))}}),D.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return z(()=>import("./ruby.js"),[]).then(t=>V(t.ruby))}}),D.of({name:"SAS",extensions:["sas"],load(){return z(()=>import("./sas.js"),[]).then(t=>V(t.sas))}}),D.of({name:"Scala",extensions:["scala"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.scala))}}),D.of({name:"Scheme",extensions:["scm","ss"],load(){return z(()=>import("./scheme.js"),[]).then(t=>V(t.scheme))}}),D.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return z(()=>import("./shell.js"),[]).then(t=>V(t.shell))}}),D.of({name:"Sieve",extensions:["siv","sieve"],load(){return z(()=>import("./sieve.js"),[]).then(t=>V(t.sieve))}}),D.of({name:"Smalltalk",extensions:["st"],load(){return z(()=>import("./smalltalk.js"),[]).then(t=>V(t.smalltalk))}}),D.of({name:"Solr",load(){return z(()=>import("./solr.js"),[]).then(t=>V(t.solr))}}),D.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.sml))}}),D.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return z(()=>import("./sparql.js"),[]).then(t=>V(t.sparql))}}),D.of({name:"Spreadsheet",alias:["excel","formula"],load(){return z(()=>import("./spreadsheet.js"),[]).then(t=>V(t.spreadsheet))}}),D.of({name:"Squirrel",extensions:["nut"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.squirrel))}}),D.of({name:"Stylus",extensions:["styl"],load(){return z(()=>import("./stylus.js"),[]).then(t=>V(t.stylus))}}),D.of({name:"Swift",extensions:["swift"],load(){return z(()=>import("./swift.js"),[]).then(t=>V(t.swift))}}),D.of({name:"sTeX",load(){return z(()=>import("./stex.js"),[]).then(t=>V(t.stex))}}),D.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return z(()=>import("./stex.js"),[]).then(t=>V(t.stex))}}),D.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return z(()=>import("./verilog.js"),[]).then(t=>V(t.verilog))}}),D.of({name:"Tcl",extensions:["tcl"],load(){return z(()=>import("./tcl.js"),[]).then(t=>V(t.tcl))}}),D.of({name:"Textile",extensions:["textile"],load(){return z(()=>import("./textile.js"),[]).then(t=>V(t.textile))}}),D.of({name:"TiddlyWiki",load(){return z(()=>import("./tiddlywiki.js"),[]).then(t=>V(t.tiddlyWiki))}}),D.of({name:"Tiki wiki",load(){return z(()=>import("./tiki.js"),[]).then(t=>V(t.tiki))}}),D.of({name:"TOML",extensions:["toml"],load(){return z(()=>import("./toml.js"),[]).then(t=>V(t.toml))}}),D.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return z(()=>import("./troff.js"),[]).then(t=>V(t.troff))}}),D.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return z(()=>import("./ttcn.js"),[]).then(t=>V(t.ttcn))}}),D.of({name:"TTCN_CFG",extensions:["cfg"],load(){return z(()=>import("./ttcn-cfg.js"),[]).then(t=>V(t.ttcnCfg))}}),D.of({name:"Turtle",extensions:["ttl"],load(){return z(()=>import("./turtle.js"),[]).then(t=>V(t.turtle))}}),D.of({name:"Web IDL",extensions:["webidl"],load(){return z(()=>import("./webidl.js"),[]).then(t=>V(t.webIDL))}}),D.of({name:"VB.NET",extensions:["vb"],load(){return z(()=>import("./vb.js"),[]).then(t=>V(t.vb))}}),D.of({name:"VBScript",extensions:["vbs"],load(){return z(()=>import("./vbscript.js"),[]).then(t=>V(t.vbScript))}}),D.of({name:"Velocity",extensions:["vtl"],load(){return z(()=>import("./velocity.js"),[]).then(t=>V(t.velocity))}}),D.of({name:"Verilog",extensions:["v"],load(){return z(()=>import("./verilog.js"),[]).then(t=>V(t.verilog))}}),D.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return z(()=>import("./vhdl.js"),[]).then(t=>V(t.vhdl))}}),D.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return z(()=>import("./xquery.js"),[]).then(t=>V(t.xQuery))}}),D.of({name:"Yacas",extensions:["ys"],load(){return z(()=>import("./yacas.js"),[]).then(t=>V(t.yacas))}}),D.of({name:"Z80",extensions:["z80"],load(){return z(()=>import("./z80.js"),[]).then(t=>V(t.z80))}}),D.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.mscgen))}}),D.of({name:"Xù",extensions:["xu"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.xu))}}),D.of({name:"MsGenny",extensions:["msgenny"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.msgenny))}}),D.of({name:"Vue",extensions:["vue"],load(){return z(()=>import("./index10.js"),__vite__mapDeps([28,1,2,7,3,5,8])).then(t=>t.vue())}}),D.of({name:"Angular Template",load(){return z(()=>import("./index11.js"),__vite__mapDeps([29,1,2,7,3,5,8])).then(t=>t.angular())}})],B8="#e5c07b",mp="#e06c75",z8="#56b6c2",N8="#ffffff",Ll="#abb2bf",Zu="#7d8799",H8="#61afef",$8="#98c379",gp="#d19a66",q8="#c678dd",F8="#21252b",vp="#2c313a",yp="#282c34",su="#353a42",V8="#3E4451",bp="#528bff",W8=tr.theme({"&":{color:Ll,backgroundColor:yp},".cm-content":{caretColor:bp},".cm-cursor, .cm-dropCursor":{borderLeftColor:bp},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:V8},".cm-panels":{backgroundColor:F8,color:Ll},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:yp,color:Zu,border:"none"},".cm-activeLineGutter":{backgroundColor:vp},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:su},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:su,borderBottomColor:su},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:vp,color:Ll}}},{dark:!0}),j8=Ng.define([{tag:pe.keyword,color:q8},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:mp},{tag:[pe.function(pe.variableName),pe.labelName],color:H8},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:gp},{tag:[pe.definition(pe.name),pe.separator],color:Ll},{tag:[pe.typeName,pe.className,pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:B8},{tag:[pe.operator,pe.operatorKeyword,pe.url,pe.escape,pe.regexp,pe.link,pe.special(pe.string)],color:z8},{tag:[pe.meta,pe.comment],color:Zu},{tag:pe.strong,fontWeight:"bold"},{tag:pe.emphasis,fontStyle:"italic"},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.link,color:Zu,textDecoration:"underline"},{tag:pe.heading,fontWeight:"bold",color:mp},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:gp},{tag:[pe.processingInstruction,pe.string,pe.inserted],color:$8},{tag:pe.invalid,color:N8}]),U8=[W8,d1(j8)];function G8(t){let e=t.schema.cached.changeSetIDs||(t.schema.cached.changeSetIDs=Object.create(null)),r=e[t.name];return r==null&&(e[t.name]=r=Object.keys(t.schema.nodes).indexOf(t.name)+1),r}const K2={encodeCharacter:t=>t,encodeNodeStart:t=>t.type.name,encodeNodeEnd:t=>-G8(t.type),compareTokens:(t,e)=>t===e};function Xu(t,e,r,n,o){for(let i=0,s=0;i<t.childCount;i++){let a=t.child(i),l=s+a.nodeSize,c=Math.max(s,r),u=Math.min(l,n);if(c<u)if(a.isText)for(let d=c;d<u;d++)o.push(e.encodeCharacter(a.text.charCodeAt(d-s),a.marks));else a.isLeaf?o.push(e.encodeNodeStart(a)):(c==s&&o.push(e.encodeNodeStart(a)),Xu(a.content,e,Math.max(s+1,c)-s-1,Math.min(l-1,u)-s-1,o),u==l&&o.push(e.encodeNodeEnd(a)));s=l}return o}const wp=2500,xp=1e4;function K8(t,e){return Math.min(15,Math.max(2,Math.floor(Math.max(t,e)/10)))}function Z2(t,e,r,n=K2){if(Math.max(r.toA-r.fromA,r.toB-r.fromB)>xp){let s=t.cut(r.fromA,r.toA),a=e.cut(r.fromB,r.toB),l=s.findDiffStart(a);if(l==null)return[];let c=s.findDiffEnd(a);if(r=r.slice(l,c.a,l,c.b),Math.max(r.toA-r.fromA,r.toB-r.fromB)>xp)return[r]}let o=Xu(t,n,r.fromA,r.toA,[]),i=Xu(e,n,r.fromB,r.toB,[]);return Z8(o,i,r,n.compareTokens)}function Z8(t,e,r,n){let o=0,i=t.length,s=e.length;for(;o<t.length&&o<e.length&&n(t[o],e[o]);)o++;if(o==t.length&&o==e.length)return[];for(;i>o&&s>o&&n(t[i-1],e[s-1]);)i--,s--;if(i==o&&s==o)return[];if(i==o||s==o||i==s&&i==o+1||Math.max(i,s)-o>wp)return[r.slice(o,i,o,s)];let a=i-o,l=s-o,c=Math.min(wp,a+l),u=[],d=new Int16Array((c+1)*2).fill(-1);for(let h=0;h<=c;h++){for(let p=-h;p<=h;p+=2){let g=d[p+1+c],y=d[p-1+c],v=g<y?y:g+1,w=v+p;for(;v<a&&w<l&&n(t[o+v],e[o+w]);)v++,w++;if(d[p+c]=v,v>=a&&w>=l){let C=[],k=K8(i-o,s-o),A=-1,I=-1,R=-1,H=-1,O=(P,$,ie,N)=>{A>-1&&A<$+k?(A=P,R=ie):(A>-1&&C.push(r.slice(A,I,R,H)),A=P,I=$,R=ie,H=N)};for(let P=h-1;P>=0;P--){let $=d[p+1+c],ie=d[p-1+c];$<ie?(p--,v=ie+o,w=v+p,O(v,v,w,w+1)):(p++,v=$+o,w=v+p,O(v,v+1,w,w)),d=u[P>>1]}return A>-1&&C.push(r.slice(A,I,R,H)),C.reverse()}}h%2==0&&u.push(d.slice())}return[r.slice(o,i,o,s)]}let At=class Rs{constructor(e,r){this.length=e,this.data=r}cut(e){return e==this.length?this:new Rs(e,this.data)}static slice(e,r,n){if(r==n)return Rs.none;if(r==0&&n==Rs.len(e))return e;let o=[];for(let i=0,s=0;s<n;i++){let a=e[i],l=s+a.length,c=Math.min(n,l)-Math.max(r,s);c>0&&o.push(a.cut(c)),s=l}return o}static join(e,r,n){if(e.length==0)return r;if(r.length==0)return e;let o=n(e[e.length-1].data,r[0].data);if(o==null)return e.concat(r);let i=e.slice(0,e.length-1);i.push(new Rs(e[e.length-1].length+r[0].length,o));for(let s=1;s<r.length;s++)i.push(r[s]);return i}static len(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n].length;return r}};At.none=[];class ur{constructor(e,r,n,o,i,s){this.fromA=e,this.toA=r,this.fromB=n,this.toB=o,this.deleted=i,this.inserted=s}get lenA(){return this.toA-this.fromA}get lenB(){return this.toB-this.fromB}slice(e,r,n,o){return e==0&&n==0&&r==this.toA-this.fromA&&o==this.toB-this.fromB?this:new ur(this.fromA+e,this.fromA+r,this.fromB+n,this.fromB+o,At.slice(this.deleted,e,r),At.slice(this.inserted,n,o))}static merge(e,r,n){if(e.length==0)return r;if(r.length==0)return e;let o=[];for(let i=0,s=0,a=e[0],l=r[0];;){if(!a&&!l)return o;if(a&&(!l||a.toB<l.fromA)){let c=s?r[s-1].toB-r[s-1].toA:0;o.push(c==0?a:new ur(a.fromA,a.toA,a.fromB+c,a.toB+c,a.deleted,a.inserted)),a=i++==e.length?null:e[i]}else if(l&&(!a||l.toA<a.fromB)){let c=i?e[i-1].toB-e[i-1].toA:0;o.push(c==0?l:new ur(l.fromA-c,l.toA-c,l.fromB,l.toB,l.deleted,l.inserted)),l=s++==r.length?null:r[s]}else{let c=Math.min(a.fromB,l.fromA),u=Math.min(a.fromA,l.fromA-(i?e[i-1].toB-e[i-1].toA:0)),d=u,h=Math.min(l.fromB,a.fromB+(s?r[s-1].toB-r[s-1].toA:0)),p=h,g=At.none,y=At.none,v=!1,w=!1;for(;;){let C=a?c>=a.fromB?a.toB:a.fromB:2e8,k=l?c>=l.fromA?l.toA:l.fromA:2e8,A=Math.min(C,k),I=a&&c>=a.fromB,R=l&&c>=l.fromA;if(!I&&!R)break;I&&c==a.fromB&&!v&&(g=At.join(g,a.deleted,n),d+=a.lenA,v=!0),I&&!R&&(y=At.join(y,At.slice(a.inserted,c-a.fromB,A-a.fromB),n),p+=A-c),R&&c==l.fromA&&!w&&(y=At.join(y,l.inserted,n),p+=l.lenB,w=!0),R&&!I&&(g=At.join(g,At.slice(l.deleted,c-l.fromA,A-l.fromA),n),d+=A-c),I&&A==a.toB&&(a=i++==e.length?null:e[i],v=!1),R&&A==l.toA&&(l=s++==r.length?null:r[s],w=!1),c=A}(u<d||h<p)&&o.push(new ur(u,d,h,p,g,y))}}}static fromJSON(e){return new ur(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(r=>new At(r.length,r.data)),e.inserted.map(r=>new At(r.length,r.data)))}toJSON(){return this}}let X8;try{X8=new RegExp("[\\p{Alphabetic}_]","u")}catch{}class Zo{constructor(e,r){this.config=e,this.changes=r}addSteps(e,r,n){let o=[];for(let l=0;l<r.length;l++){let c=Array.isArray(n)?n[l]:n,u=0;r[l].forEach((d,h,p,g)=>{o.push(new ur(d+u,h+u,p,g,d==h?At.none:[new At(h-d,c)],p==g?At.none:[new At(g-p,c)])),u=g-p-(h-d)})}if(o.length==0)return this;let i=Yu(o,this.config.combine),s=ur.merge(this.changes,i,this.config.combine),a=s;for(let l=0;l<a.length;l++){let c=a[l];if(c.fromA==c.toA||c.fromB==c.toB||!i.some(d=>d.toB>c.fromB&&d.fromB<c.toB))continue;let u=Z2(this.config.doc.content,e.content,c,this.config.encoder);u.length==1&&u[0].fromB==0&&u[0].toB==c.toB-c.fromB||(a==s&&(a=s.slice()),u.length==1?a[l]=u[0]:(a.splice(l,1,...u),l+=u.length-1))}return new Zo(this.config,a)}get startDoc(){return this.config.doc}map(e){let r=n=>{let o=e(n);return o===n.data?n:new At(n.length,o)};return new Zo(this.config,this.changes.map(n=>new ur(n.fromA,n.toA,n.fromB,n.toB,n.deleted.map(r),n.inserted.map(r))))}changedRange(e,r){if(e==this)return null;let n=r&&Y8(r),o=n?n.toB-n.fromB-(n.toA-n.fromA):0;function i(d){return!n||d<=n.fromA?d:d+o}let s=n?n.fromB:2e8,a=n?n.toB:-2e8;function l(d,h=d){s=Math.min(d,s),a=Math.max(h,a)}let c=this.changes,u=e.changes;for(let d=0,h=0;d<c.length&&h<u.length;){let p=c[d],g=u[h];p&&g&&J8(p,g,i)?(d++,h++):g&&(!p||i(p.fromB)>=g.fromB)?(l(g.fromB,g.toB),h++):(l(i(p.fromB),i(p.toB)),d++)}return s<=a?{from:s,to:a}:null}static create(e,r=(i,s)=>i===s?i:null,n=K2,o=[]){return new Zo({combine:r,doc:e,encoder:n},o)}}Zo.computeDiff=Z2;function Yu(t,e,r=0,n=t.length){if(n==r+1)return[t[r]];let o=r+n>>1;return ur.merge(Yu(t,e,r,o),Yu(t,e,o,n),e)}function Cp(t){let e=2e8,r=-2e8;for(let n=0;n<t.length;n++){let o=t[n];e!=2e8&&(e=o.map(e,-1),r=o.map(r,1)),o.forEach((i,s,a,l)=>{e=Math.min(e,a),r=Math.max(r,l)})}return e==2e8?null:{from:e,to:r}}function Y8(t){let e=Cp(t);if(!e)return null;let r=Cp(t.map(n=>n.invert()).reverse());return{fromA:r.from,toA:r.to,fromB:e.from,toB:e.to}}function J8(t,e,r){return r(t.fromB)==e.fromB&&r(t.toB)==e.toB&&kp(t.deleted,e.deleted)&&kp(t.inserted,e.inserted)}function kp(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(t[r].length!=e[r].length||t[r].data!==e[r].data)return!1;return!0}function vn(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-diff",...e}}),t}var _p=500;function Q8(t={}){const e=new WeakMap,r=new WeakMap;function n(o){let i=e.get(o);if(i!=null)return i;const s=o.attrs,a=s?Object.keys(s).filter(l=>s[l]!=null).sort():[];if(a.length===0)i=o.type.name;else{const l={};for(const c of a)l[c]=s[c];i=`${o.type.name}:${JSON.stringify(l)}`}return e.set(o,i),i}return{encodeCharacter:(o,i)=>{if(i.length===0)return o;let s=r.get(i);return s==null&&(s=i.map(n).join(","),r.set(i,s)),`${o}:${s}`},encodeNodeStart:o=>{const i=o.attrs;if(i&&Object.keys(i).length>0){const s=t[o.type.name]??[],a=Object.keys(i).filter(l=>{if(s.includes(l))return!1;const c=o.type.spec.attrs?.[l]?.default;return i[l]!==c});if(a.length>0){const l={};for(const c of a.sort())l[c]=i[c];return`${o.type.name}:${JSON.stringify(l)}`}}return o.type.name},encodeNodeEnd:o=>{const i=o.type.schema,s=i.cached.changeSetIDs||(i.cached.changeSetIDs=Object.create(null));let a=s[o.type.name];return a==null&&(s[o.type.name]=a=Object.keys(i.nodes).indexOf(o.type.name)+1),-a},compareTokens:(o,i)=>o===i}}function X2(t,e,r){const n=r.get(t);if(n!=null)return n;const o=[String(e.encodeNodeStart(t))];if(t.isText){const s=t.text;for(let a=0;a<s.length;a++)o.push(":"+String(e.encodeCharacter(s.charCodeAt(a),t.marks)))}else t.content.forEach(s=>{o.push("/"+X2(s,e,r))});o.push("\\"+String(e.encodeNodeEnd(t)));const i=o.join("");return r.set(t,i),i}function Sp(t,e,r){const n=[];let o=0;return t.content.forEach(i=>{n.push({node:i,offset:o,size:i.nodeSize,signature:X2(i,r.encoder,r.sigCache)}),o+=i.nodeSize}),{node:t,contentStart:e,content:n}}function e9(t,e){const r=t.length,n=e.length,o=Array.from({length:r+1},()=>Array.from({length:n+1},()=>0));for(let l=r-1;l>=0;l--)for(let c=n-1;c>=0;c--)t[l].signature===e[c].signature?o[l][c]=o[l+1][c+1]+1:o[l][c]=Math.max(o[l+1][c],o[l][c+1]);const i=[];let s=0,a=0;for(;s<r&&a<n;)t[s].signature===e[a].signature?(i.push([s,a]),s++,a++):o[s+1][a]>=o[s][a+1]?s++:a++;return i}function t9(t,e){if(t.type!==e.type)return!1;const r=t.type;return!(r.isTextblock||r.isAtom||r.spec.code===!0||!r.isBlock)}function Y2(t,e,r){return ur.fromJSON({fromA:t.fromA+e,toA:t.toA+e,fromB:t.fromB+r,toB:t.toB+r,deleted:t.deleted.map(n=>({length:n.length,data:n.data})),inserted:t.inserted.map(n=>({length:n.length,data:n.data}))})}function r9(t,e,r){const n=t.parent.copy(He.from(t.node)),o=e.parent.copy(He.from(e.node)),i=new g2(0,n.content.size,new dt(o.content,0,0));return Zo.create(n,void 0,r.encoder).addSteps(o,[i.getMap()],null).changes.map(s=>Y2(s,t.abs,e.abs))}function Ap(t,e){const r=t.content;if(e<r.length)return t.contentStart+r[e].offset;if(e>0){const n=r[e-1];return t.contentStart+n.offset+n.size}return t.contentStart+t.node.content.size}function n9(t,e,r){return ur.fromJSON({fromA:e,toA:e+t.size,fromB:r,toB:r,deleted:[{length:t.size,data:null}],inserted:[]})}function o9(t,e,r){return ur.fromJSON({fromA:e,toA:e,fromB:r,toB:r+t.size,deleted:[],inserted:[{length:t.size,data:null}]})}function i9(t,e,r,n,o){const i=new g2(0,t.content.size,new dt(e.content,0,0));return Zo.create(t,void 0,o.encoder).addSteps(e,[i.getMap()],null).changes.map(s=>Y2(s,r,n))}function Rl(t,e,r,n,o){if(t.childCount>_p||e.childCount>_p)return i9(t,e,r,n,o);const i=Sp(t,r,o),s=Sp(e,n,o),a=e9(i.content,s.content),l=[];let c=0,u=0;for(const[d,h]of a)Tp(i,s,{oldStart:c,oldEnd:d,newStart:u,newEnd:h},o,l),c=d+1,u=h+1;return Tp(i,s,{oldStart:c,oldEnd:i.content.length,newStart:u,newEnd:s.content.length},o,l),l}function Tp(t,e,r,n,o){const i=t.content,s=e.content;let a=r.oldStart,l=r.newStart;for(;a<r.oldEnd||l<r.newEnd;){const c=a<r.oldEnd?i[a]:null,u=l<r.newEnd?s[l]:null,d=c&&u&&c.node.type===u.node.type;if(c&&u&&d){o.push(...s9(t,e,c,u,n)),a++,l++;continue}if(c&&(!u||!d)){const h=t.contentStart+c.offset;o.push(n9(c,h,Ap(e,l))),a++;continue}if(u){const h=e.contentStart+u.offset;o.push(o9(u,Ap(t,a),h)),l++}}}function s9(t,e,r,n,o){const i=t.contentStart+r.offset,s=e.contentStart+n.offset;return t9(r.node,n.node)&&a9(r.node,n.node,o.encoder)?Rl(r.node,n.node,i+1,s+1,o):r9({node:r.node,parent:t.node,abs:i},{node:n.node,parent:e.node,abs:s},o)}function a9(t,e,r){return r.encodeNodeStart(t)===r.encodeNodeStart(e)}function l9(t,e,r,n,o){const i=t.resolve(r),s=t.resolve(n),a=e.resolve(r),l=e.resolve(n),c=i.sharedDepth(n);if(a.sharedDepth(n)!==c)throw new RangeError(`computeDocDiff: range [${r}, ${n}) resolves to different sharedDepth in old and new docs`);for(let y=0;y<=c;y++){if(o.encodeNodeStart(i.node(y))!==o.encodeNodeStart(a.node(y)))throw new RangeError(`computeDocDiff: ancestor at depth ${y} differs in type or non-ignored attrs along the path to the shared ancestor`);if(i.start(y)!==a.start(y))throw new RangeError(`computeDocDiff: ancestor at depth ${y} starts at different absolute positions in old and new docs (content before the range differs in size)`)}const u=i.node(c);if(u.isTextblock)throw new RangeError(`computeDocDiff: range [${r}, ${n}) lands inside a textblock; widen the range to a block boundary`);if(i.depth!==c||s.depth!==c||a.depth!==c||l.depth!==c)throw new RangeError(`computeDocDiff: range [${r}, ${n}) endpoints must be aligned to child boundaries of the shared ancestor`);const d=a.node(c),h=i.start(c),p=r-h,g=n-h;return{oldCut:u.copy(u.content.cut(p,g)),newCut:d.copy(d.content.cut(p,g)),cutAbsStart:r}}function A0(t,e,r){const n=Q8(r?.ignoreAttrs),o={encoder:n,sigCache:new WeakMap},i=t.content.size,s=e.content.size,a=r?.range;if(a==null)return Rl(t,e,0,0,o);const l=Math.min(i,s),c=Math.max(0,Math.min(a.from??0,l)),u=Math.max(c,Math.min(a.to??l,l));if(c===u)return[];if(c===0&&u===l&&i===s)return Rl(t,e,0,0,o);const d=l9(t,e,c,u,n);return Rl(d.oldCut,d.newCut,d.cutAbsStart,d.cutAbsStart,o)}var lc=Ve({ignoreAttrs:{heading:["id"]}},"diffConfig");vn(lc,{displayName:"Ctx<diffConfig>",group:"Diff"});var it=new et("MILKDOWN_DIFF");function c9(t,e,r){const n=A0(t,e.newDoc,r);return{...e,changes:n}}function u9(t,e){return e.some(r=>t.fromB<r.toB&&t.toB>r.fromB)}function Da(t){return t.changes.filter(e=>!u9(e,t.rejectedRanges))}var J2=Je(t=>{const e=t.get(lc.key);return new Xe({key:it,state:{init:()=>null,apply(r,n,o,i){const s=r.getMeta(it);if(!n){if(s?.type==="start"){const c=A0(i.doc,s.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:s.newDoc,changes:c,rejectedRanges:[],active:!0}}return null}let a=n;if(r.docChanged&&a.active&&(a=c9(i.doc,a,{ignoreAttrs:e.ignoreAttrs})),!s)return a;let l;switch(s.type){case"start":{const c=A0(i.doc,s.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:s.newDoc,changes:c,rejectedRanges:[],active:!0}}case"accept":case"acceptRange":l=a;break;case"reject":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:s.fromB,toB:s.toB}]};break;case"rejectRange":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:s.range.fromB,toB:s.range.toB}]};break;case"acceptAll":case"clear":return null;default:return a}return l.active&&Da(l).length===0?null:l}},filterTransaction(r,n){return!it.getState(n)?.active||r.getMeta(it)?!0:!r.docChanged}})});vn(J2,{displayName:"Prose<diff>",group:"Diff"});function d9(t,e){const r=Da(e);for(let n=r.length-1;n>=0;n--){const o=r[n],i=e.newDoc.slice(o.fromB,o.toB);t=t.replace(o.fromA,o.toA,i)}return t}var Q2=Me("StartDiffReview",t=>e=>(r,n)=>{if(e==null)return!1;const o=t.get(gn)(e);return o?(n&&n(r.tr.setMeta(it,{type:"start",newDoc:o})),!0):!1});vn(Q2,{displayName:"Command<startDiffReview>",group:"Diff"});var C1=Me("StartDiffReviewFromDoc",()=>t=>(e,r)=>!t||t.type!==e.doc.type?!1:(r&&r(e.tr.setMeta(it,{type:"start",newDoc:t})),!0));vn(C1,{displayName:"Command<startDiffReviewFromDoc>",group:"Diff"});var e5=Me("AcceptDiffChunk",()=>t=>(e,r)=>{if(t==null)return!1;const n=it.getState(e);if(!n)return!1;const o=Da(n)[t];if(!o)return!1;if(r){const i=n.newDoc.slice(o.fromB,o.toB);let s=e.tr.replace(o.fromA,o.toA,i);s=s.setMeta(it,{type:"accept",changeIndex:t}),r(s)}return!0});vn(e5,{displayName:"Command<acceptDiffChunk>",group:"Diff"});var t5=Me("RejectDiffChunk",()=>t=>(e,r)=>{if(t==null)return!1;const n=it.getState(e);if(!n)return!1;const o=Da(n)[t];return o?(r&&r(e.tr.setMeta(it,{type:"reject",fromB:o.fromB,toB:o.toB})),!0):!1});vn(t5,{displayName:"Command<rejectDiffChunk>",group:"Diff"});var k1=Me("AcceptDiffRange",()=>t=>(e,r)=>{if(!t)return!1;const n=it.getState(e);if(!n)return!1;if(r){const o=n.newDoc.slice(t.fromB,t.toB);let i=e.tr.replace(t.fromA,t.toA,o);i=i.setMeta(it,{type:"acceptRange",range:t}),r(i)}return!0});vn(k1,{displayName:"Command<acceptDiffRange>",group:"Diff"});var _1=Me("RejectDiffRange",()=>t=>(e,r)=>!t||!it.getState(e)?!1:(r&&r(e.tr.setMeta(it,{type:"rejectRange",range:t})),!0));vn(_1,{displayName:"Command<rejectDiffRange>",group:"Diff"});var cc=Me("AcceptAllDiffs",()=>()=>(t,e)=>{const r=it.getState(t);return r?(e&&e((r.rejectedRanges.length===0?t.tr.replaceWith(0,t.doc.content.size,r.newDoc.content):d9(t.tr,r)).setMeta(it,{type:"acceptAll"})),!0):!1});vn(cc,{displayName:"Command<acceptAllDiffs>",group:"Diff"});var T0=Me("ClearDiffReview",()=>()=>(t,e)=>it.getState(t)?(e&&e(t.tr.setMeta(it,{type:"clear"})),!0):!1);vn(T0,{displayName:"Command<clearDiffReview>",group:"Diff"});var h9=[lc,J2,Q2,C1,e5,k1,t5,_1,cc,T0],f9=Object.defineProperty,Mp=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,Ep=(t,e,r)=>e in t?f9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g9=(t,e)=>{for(var r in e||(e={}))p9.call(e,r)&&Ep(t,r,e[r]);if(Mp)for(var r of Mp(e))m9.call(e,r)&&Ep(t,r,e[r]);return t};function r5(t,e){return Object.assign(t,{meta:g9({package:"@milkdown/components"},e)}),t}const Rn="milkdown-diff",v9={acceptLabel:"Accept",rejectLabel:"Reject",customBlockTypes:[]},uc=Ve(v9,"diffComponentConfig");r5(uc,{displayName:"Ctx<diffComponentConfig>",group:"DiffComponent"});function y9(t,e,r){if(e===r)return!1;const n=t.resolve(e),o=t.resolve(r),i=n.index(0),s=o.depth===0?Math.max(0,o.index(0)-1):o.index(0);return i!==s}function Ip(t,e,r){if(e>=r)return!1;const n=t.resolve(e),o=t.resolve(r);if(n.sameParent(o)&&n.parent.isTextblock)return!1;let i=!1;return t.nodesBetween(e,r,(s,a)=>{if(i)return!1;if(!s.isBlock)return!0;const l=a+s.nodeSize;return a>=e&&l<=r?(i=!0,!1):!0}),i}function b9(t,e,r){if(r!==t.content.size)return!1;const n=t.resolve(e);if(n.depth!==0)return!1;for(let o=n.index(0);o<t.childCount;o++){const i=t.child(o);if(i.type.name!=="paragraph"||i.content.size>0)return!1}return!0}function w9(t){let e=t.content.size;for(let r=t.childCount-1;r>=0;r--){const n=t.child(r);if(n.type.name!=="paragraph"||n.content.size>0)break;e-=n.nodeSize}return e}function Ju(t,e){const r=t.resolve(e);for(let n=r.depth;n>=1;n--)if(r.node(n).isTextblock)return r.before(n);return e}function n5(t,e,r,n){let o=0;for(let i=0;i<t.childCount;i++){const s=t.child(i),a=o+s.nodeSize;if(o>=r)break;a>e&&o<r&&n(s,o,a),o=a}}function o5(t,e,r,n){n5(t,e,r,(o,i,s)=>{s===t.content.size&&o.type.name==="paragraph"&&o.content.size===0||n.push(Bt.node(i,s,{class:`${Rn}-removed-block`}))})}function au(t,e,r=!1){if(e<0||e>t.content.size)return null;const n=t.resolve(Math.min(e,t.content.size));if(n.depth>=1)return{from:n.before(1),to:n.after(1)};if(r){const o=n.nodeBefore;if(o)return{from:e-o.nodeSize,to:e};const i=n.nodeAfter;if(i)return{from:e,to:e+i.nodeSize}}else{const o=n.nodeAfter;if(o)return{from:e,to:e+o.nodeSize};const i=n.nodeBefore;if(i)return{from:e-i.nodeSize,to:e}}return null}function S1(t,e,r){if(e<0||e>t.content.size)return null;const n=t.resolve(Math.min(e,t.content.size));for(let o=n.depth;o>=0;o--){const i=n.node(o).type.name;if(r.has(i))return i}return null}function M0(t,e,r,n=!1){const o=S1(t,e,r);if(o)return o;const i=t.resolve(Math.min(Math.max(e,0),t.content.size)),s=n?i.nodeBefore:i.nodeAfter;return s&&r.has(s.type.name)?s.type.name:null}function x9(t,e,r){const n=[];let o=!0,i=-1,s=-1;return n5(t,e,r,(a,l,c)=>{i===-1&&(i=l),s=c,n.push(a)}),(n.length===0||i!==e||s!==r)&&(o=!1),o?n:[]}function tl(t,e,r,n){return t<n&&e>r}function Lp(t,e,r,n){return e===r?S1(t,e,n)!=null:M0(t,e,n)!=null||M0(t,r,n,!0)!=null}function C9(t,e,r){const n=t.resolve(r.fromA);if(!n.parent.isTextblock||n.depth<1||!n.node(1).isTextblock)return null;const o=n.after(1),i=e.resolve(r.fromB);let s;if(i.depth>=1&&i.node(1).isTextblock?(s=i.after(1),s>r.toB&&(s=r.toB)):s=r.fromB,o>=r.toA&&s>=r.toB)return null;const a=[];return(o>r.fromA||s>r.fromB)&&a.push({fromA:r.fromA,toA:Math.min(o,r.toA),fromB:r.fromB,toB:s,isBlock:!1}),(r.toA>o||r.toB>s)&&a.push({fromA:o,toA:Math.max(o,r.toA),fromB:s,toB:r.toB,isBlock:!0}),a.length>1?a:null}function k9(t,e,r,n){return Lp(e,t.fromA,t.toA,n)||Lp(r,t.fromB,t.toB,n)}function _9(t,e,r,n){var o,i,s,a;const l=[],c=new Set;for(let u=0;u<t.length;u++){if(c.has(u))continue;const d=t[u];if(!k9(d,e,r,n)){l.push({fromA:d.fromA,toA:d.toA,fromB:d.fromB,toB:d.toB,isCustomBlock:!1});continue}const h=Rp(e,d.fromA,d.toA,n),p=Rp(r,d.fromB,d.toB,n),g={fromA:Math.min((o=h?.from)!=null?o:d.fromA,d.fromA),toA:Math.max((i=h?.to)!=null?i:d.toA,d.toA),fromB:Math.min((s=p?.from)!=null?s:d.fromB,d.fromB),toB:Math.max((a=p?.to)!=null?a:d.toB,d.toB),isCustomBlock:!0};c.add(u);for(let v=u+1;v<t.length;v++){if(c.has(v))continue;const w=t[v],C=h&&tl(w.fromA,w.toA,h.from,h.to),k=p&&tl(w.fromB,w.toB,p.from,p.to);!C&&!k||(c.add(v),g.fromA=Math.min(g.fromA,w.fromA),g.toA=Math.max(g.toA,w.toA),g.fromB=Math.min(g.fromB,w.fromB),g.toB=Math.max(g.toB,w.toB))}const y=[];for(let v=0;v<l.length;v++){const w=l[v];if(!w.isCustomBlock)continue;const C=tl(g.fromA,g.toA,w.fromA,w.toA),k=tl(g.fromB,g.toB,w.fromB,w.toB);!C&&!k||(g.fromA=Math.min(g.fromA,w.fromA),g.toA=Math.max(g.toA,w.toA),g.fromB=Math.min(g.fromB,w.fromB),g.toB=Math.max(g.toB,w.toB),y.push(v))}for(let v=y.length-1;v>=0;v--)l.splice(y[v],1);l.push(g)}return l}function S9(t,e){const r=w9(e);if(r!==e.content.size)for(const n of t)n.fromA===n.toA&&n.fromB<n.toB&&n.fromA>=r&&(n.fromA=r,n.toA=r)}function Rp(t,e,r,n){return e===r?S1(t,e,n)==null?null:au(t,e):M0(t,e,n)!=null?au(t,e):M0(t,r,n,!0)!=null?au(t,r,!0):null}const Op=new et("MILKDOWN_DIFF_DECORATION"),i5=Je(t=>{const e=t.get(uc.key);return new Xe({key:Op,state:{init:()=>Dt.empty,apply(r,n,o,i){const s=it.getState(i);return s?.active?r.getMeta(it)||r.docChanged?T9(t,i.doc,s,e):n.map(r.mapping,r.doc):Dt.empty}},props:{decorations(r){var n;return(n=Op.getState(r))!=null?n:Dt.empty}}})});r5(i5,{displayName:"Prose<diffDecoration>",group:"DiffComponent"});function A9({doc:t,newDoc:e,segments:r,change:n,changeIndex:o,commands:i,acceptLabel:s,rejectLabel:a,decorations:l}){for(let p=0;p<r.length;p++){const g=r[p],y=g.fromA<g.toA,v=g.fromB<g.toB;if(y&&(g.isBlock?o5(t,g.fromA,g.toA,l):l.push(Bt.inline(g.fromA,g.toA,{class:`${Rn}-removed`}))),v){const w=g.isBlock?Ju(t,y?g.toA:g.fromA):y?g.toA:g.fromA,C=s5(e,g,g.isBlock);l.push(Bt.widget(w,C,{side:-1,key:`added-${o}-${p}`}))}}const c=r[r.length-1],u=c.isBlock?c.fromA<c.toA?c.toA:c.fromA:n.toA,d=Ju(t,u),h=a5({commands:i,isBlockLevel:!0,change:n,acceptLabel:s,rejectLabel:a});l.push(Bt.widget(d,h,{side:-1,key:`controls-${o}`}))}function T9(t,e,r,n){const o=[],i=t.get(ne),s=new Set(n.customBlockTypes),a=Da(r),l=_9(a,e,r.newDoc,s);S9(l,e);for(let c=0;c<l.length;c++){const u=l[c],d=u.fromA<u.toA,h=u.fromB<u.toB;if(d&&!h&&b9(e,u.fromA,u.toA))continue;const p=d&&y9(e,u.fromA,u.toA),g=d&&Ip(e,u.fromA,u.toA),y=h&&Ip(r.newDoc,u.fromB,u.toB),v=d&&!p&&!g&&!u.isCustomBlock&&!y,w=(p||g||y)&&!v;if(w&&!u.isCustomBlock){const I=C9(e,r.newDoc,u);if(I){A9({doc:e,newDoc:r.newDoc,segments:I,change:u,changeIndex:c,commands:i,acceptLabel:n.acceptLabel,rejectLabel:n.rejectLabel,decorations:o});continue}}d&&(u.isCustomBlock||w?o5(e,u.fromA,u.toA,o):o.push(Bt.inline(u.fromA,u.toA,{class:`${Rn}-removed`})));const C=d?u.toA:u.fromA,k=w?Ju(e,C):C;if(h){const I=s5(r.newDoc,u,w);o.push(Bt.widget(k,I,{side:-1,key:`added-${c}`}))}const A=a5({commands:i,isBlockLevel:w,change:u,acceptLabel:n.acceptLabel,rejectLabel:n.rejectLabel});o.push(Bt.widget(k,A,{side:w?-1:1,key:`controls-${c}`}))}return Dt.create(e,o)}function s5(t,e,r){var n;const o=document.createElement(r?"div":"span");o.className=`${Rn}-added`,o.contentEditable="false",r&&o.classList.add(`${Rn}-added-block`);const i=v2.fromSchema(t.type.schema);if(r){const l=x9(t,e.fromB,e.toB);if(l.length>0){const c=document.createDocumentFragment();for(const u of l)c.appendChild(i.serializeNode(u));return o.appendChild(c),o}}const s=t.slice(e.fromB,e.toB),a=i.serializeFragment(s.content);if(o.appendChild(a),!((n=o.textContent)!=null&&n.trim())&&!o.querySelector("img, video, audio, canvas, svg")){const l=t.textBetween(e.fromB,e.toB,`
4
+ `,r=>r.type.spec.leafText?.(r)||r.attrs.alt||"")}var iu=function(){return c8.Date.now()},T8="Expected a function",M8=Math.max,E8=Math.min;function sc(t,e,r){var n,o,i,s,a,l,c=0,u=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(T8);e=hp(e)||0,_0(r)&&(u=!!r.leading,d="maxWait"in r,i=d?M8(hp(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h);function p(R){var H=n,O=o;return n=o=void 0,c=R,s=t.apply(O,H),s}function g(R){return c=R,a=setTimeout(w,e),u?p(R):s}function y(R){var H=R-l,O=R-c,P=e-H;return d?E8(P,i-O):P}function v(R){var H=R-l,O=R-c;return l===void 0||H>=e||H<0||d&&O>=i}function w(){var R=iu();if(v(R))return C(R);a=setTimeout(w,y(R))}function C(R){return a=void 0,h&&n?p(R):(n=o=void 0,s)}function k(){a!==void 0&&clearTimeout(a),c=0,n=l=o=a=void 0}function S(){return a===void 0?s:C(iu())}function E(){var R=iu(),H=v(R);if(n=arguments,o=this,l=R,H){if(a===void 0)return g(l);if(d)return clearTimeout(a),a=setTimeout(w,e),p(l)}return a===void 0&&(a=setTimeout(w,e)),s}return E.cancel=k,E.flush=S,E}function G2(t,e,r,n,o,i){return _0(t)&&_0(e)&&(i.set(e,t),F2(t,e,void 0,G2,i),i.delete(e)),t}var I8=h8(function(t,e,r,n){F2(t,e,r,n)}),L8=u8(function(t){return t.push(void 0,G2),d8(I8,void 0,t)}),R8="Expected a function";function ac(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(R8);return _0(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),sc(t,e,{leading:n,maxWait:e,trailing:o})}function V(t){return new Bg(zg.define(t))}function Gn(t){return z(()=>import("./index.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const O8=[D.of({name:"C",extensions:["c","h","ino"],load(){return z(()=>import("./index12.js"),__vite__mapDeps([4,3,1,2])).then(t=>t.cpp())}}),D.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return z(()=>import("./index12.js"),__vite__mapDeps([4,3,1,2])).then(t=>t.cpp())}}),D.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Gn("Cassandra")}}),D.of({name:"CSS",extensions:["css"],load(){return z(()=>import("./index5.js"),__vite__mapDeps([5,3,1,2])).then(t=>t.css())}}),D.of({name:"Go",extensions:["go"],load(){return z(()=>import("./index13.js"),__vite__mapDeps([6,3,1,2])).then(t=>t.go())}}),D.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return z(()=>import("./index4.js"),__vite__mapDeps([7,3,1,2,5,8])).then(t=>t.html())}}),D.of({name:"Java",extensions:["java"],load(){return z(()=>import("./index14.js"),__vite__mapDeps([9,3,1,2])).then(t=>t.java())}}),D.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript())}}),D.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return z(()=>import("./index3.js"),__vite__mapDeps([10,1,2,7,3,5,8])).then(t=>t.jinja())}}),D.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return z(()=>import("./index15.js"),__vite__mapDeps([11,3,1,2])).then(t=>t.json())}}),D.of({name:"JSX",extensions:["jsx"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({jsx:!0}))}}),D.of({name:"LESS",extensions:["less"],load(){return z(()=>import("./index7.js"),__vite__mapDeps([12,1,2,5,3])).then(t=>t.less())}}),D.of({name:"Liquid",extensions:["liquid"],load(){return z(()=>import("./index8.js"),__vite__mapDeps([13,1,2,7,3,5,8])).then(t=>t.liquid())}}),D.of({name:"MariaDB SQL",load(){return Gn("MariaSQL")}}),D.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return z(()=>import("./index16.js"),__vite__mapDeps([14,1,2,7,3,5,8])).then(t=>t.markdown())}}),D.of({name:"MS SQL",load(){return Gn("MSSQL")}}),D.of({name:"MySQL",load(){return Gn("MySQL")}}),D.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return z(()=>import("./index17.js"),__vite__mapDeps([15,3,1,2,7,5,8])).then(t=>t.php())}}),D.of({name:"PLSQL",extensions:["pls"],load(){return Gn("PLSQL")}}),D.of({name:"PostgreSQL",load(){return Gn("PostgreSQL")}}),D.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return z(()=>import("./index18.js"),__vite__mapDeps([16,3,1,2])).then(t=>t.python())}}),D.of({name:"Rust",extensions:["rs"],load(){return z(()=>import("./index19.js"),__vite__mapDeps([17,3,1,2])).then(t=>t.rust())}}),D.of({name:"Sass",extensions:["sass"],load(){return z(()=>import("./index20.js"),__vite__mapDeps([18,3,1,2,5])).then(t=>t.sass({indented:!0}))}}),D.of({name:"SCSS",extensions:["scss"],load(){return z(()=>import("./index20.js"),__vite__mapDeps([18,3,1,2,5])).then(t=>t.sass())}}),D.of({name:"SQL",extensions:["sql"],load(){return Gn("StandardSQL")}}),D.of({name:"SQLite",load(){return Gn("SQLite")}}),D.of({name:"TSX",extensions:["tsx"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),D.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return z(()=>import("./index6.js"),__vite__mapDeps([8,3,1,2])).then(t=>t.javascript({typescript:!0}))}}),D.of({name:"WebAssembly",extensions:["wat","wast"],load(){return z(()=>import("./index9.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),D.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return z(()=>import("./index21.js"),__vite__mapDeps([20,3,1,2])).then(t=>t.xml())}}),D.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return z(()=>import("./index22.js"),__vite__mapDeps([21,3,1,2])).then(t=>t.yaml())}}),D.of({name:"APL",extensions:["dyalog","apl"],load(){return z(()=>import("./apl.js"),[]).then(t=>V(t.apl))}}),D.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return z(()=>import("./asciiarmor.js"),[]).then(t=>V(t.asciiArmor))}}),D.of({name:"ASN.1",extensions:["asn","asn1"],load(){return z(()=>import("./asn1.js"),[]).then(t=>V(t.asn1({})))}}),D.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return z(()=>import("./asterisk.js"),[]).then(t=>V(t.asterisk))}}),D.of({name:"Brainfuck",extensions:["b","bf"],load(){return z(()=>import("./brainfuck.js"),[]).then(t=>V(t.brainfuck))}}),D.of({name:"Cobol",extensions:["cob","cpy"],load(){return z(()=>import("./cobol.js"),[]).then(t=>V(t.cobol))}}),D.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.csharp))}}),D.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"ClojureScript",extensions:["cljs"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return z(()=>import("./css.js"),[]).then(t=>V(t.gss))}}),D.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return z(()=>import("./cmake.js"),[]).then(t=>V(t.cmake))}}),D.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return z(()=>import("./coffeescript.js"),[]).then(t=>V(t.coffeeScript))}}),D.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return z(()=>import("./commonlisp.js"),[]).then(t=>V(t.commonLisp))}}),D.of({name:"Cypher",extensions:["cyp","cypher"],load(){return z(()=>import("./cypher.js"),[]).then(t=>V(t.cypher))}}),D.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return z(()=>import("./python.js"),[]).then(t=>V(t.cython))}}),D.of({name:"Crystal",extensions:["cr"],load(){return z(()=>import("./crystal.js"),[]).then(t=>V(t.crystal))}}),D.of({name:"D",extensions:["d"],load(){return z(()=>import("./d.js"),[]).then(t=>V(t.d))}}),D.of({name:"Dart",extensions:["dart"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.dart))}}),D.of({name:"diff",extensions:["diff","patch"],load(){return z(()=>import("./diff.js"),[]).then(t=>V(t.diff))}}),D.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return z(()=>import("./dockerfile.js"),__vite__mapDeps([22,23])).then(t=>V(t.dockerFile))}}),D.of({name:"DTD",extensions:["dtd"],load(){return z(()=>import("./dtd.js"),[]).then(t=>V(t.dtd))}}),D.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return z(()=>import("./dylan.js"),[]).then(t=>V(t.dylan))}}),D.of({name:"EBNF",load(){return z(()=>import("./ebnf.js"),[]).then(t=>V(t.ebnf))}}),D.of({name:"ECL",extensions:["ecl"],load(){return z(()=>import("./ecl.js"),[]).then(t=>V(t.ecl))}}),D.of({name:"edn",extensions:["edn"],load(){return z(()=>import("./clojure.js"),[]).then(t=>V(t.clojure))}}),D.of({name:"Eiffel",extensions:["e"],load(){return z(()=>import("./eiffel.js"),[]).then(t=>V(t.eiffel))}}),D.of({name:"Elm",extensions:["elm"],load(){return z(()=>import("./elm.js"),[]).then(t=>V(t.elm))}}),D.of({name:"Erlang",extensions:["erl"],load(){return z(()=>import("./erlang.js"),[]).then(t=>V(t.erlang))}}),D.of({name:"Esper",load(){return z(()=>import("./sql.js"),[]).then(t=>V(t.esper))}}),D.of({name:"Factor",extensions:["factor"],load(){return z(()=>import("./factor.js"),__vite__mapDeps([24,23])).then(t=>V(t.factor))}}),D.of({name:"FCL",load(){return z(()=>import("./fcl.js"),[]).then(t=>V(t.fcl))}}),D.of({name:"Forth",extensions:["forth","fth","4th"],load(){return z(()=>import("./forth.js"),[]).then(t=>V(t.forth))}}),D.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return z(()=>import("./fortran.js"),[]).then(t=>V(t.fortran))}}),D.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.fSharp))}}),D.of({name:"Gas",extensions:["s"],load(){return z(()=>import("./gas.js"),[]).then(t=>V(t.gas))}}),D.of({name:"Gherkin",extensions:["feature"],load(){return z(()=>import("./gherkin.js"),[]).then(t=>V(t.gherkin))}}),D.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return z(()=>import("./groovy.js"),[]).then(t=>V(t.groovy))}}),D.of({name:"Haskell",extensions:["hs"],load(){return z(()=>import("./haskell.js"),[]).then(t=>V(t.haskell))}}),D.of({name:"Haxe",extensions:["hx"],load(){return z(()=>import("./haxe.js"),[]).then(t=>V(t.haxe))}}),D.of({name:"HXML",extensions:["hxml"],load(){return z(()=>import("./haxe.js"),[]).then(t=>V(t.hxml))}}),D.of({name:"HTTP",load(){return z(()=>import("./http.js"),[]).then(t=>V(t.http))}}),D.of({name:"IDL",extensions:["pro"],load(){return z(()=>import("./idl.js"),[]).then(t=>V(t.idl))}}),D.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return z(()=>import("./javascript.js"),[]).then(t=>V(t.jsonld))}}),D.of({name:"Julia",extensions:["jl"],load(){return z(()=>import("./julia.js"),[]).then(t=>V(t.julia))}}),D.of({name:"Kotlin",extensions:["kt","kts"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.kotlin))}}),D.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return z(()=>import("./livescript.js"),[]).then(t=>V(t.liveScript))}}),D.of({name:"Lua",extensions:["lua"],load(){return z(()=>import("./lua.js"),[]).then(t=>V(t.lua))}}),D.of({name:"mIRC",extensions:["mrc"],load(){return z(()=>import("./mirc.js"),[]).then(t=>V(t.mirc))}}),D.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return z(()=>import("./mathematica.js"),[]).then(t=>V(t.mathematica))}}),D.of({name:"Modelica",extensions:["mo"],load(){return z(()=>import("./modelica.js"),[]).then(t=>V(t.modelica))}}),D.of({name:"MUMPS",extensions:["mps"],load(){return z(()=>import("./mumps.js"),[]).then(t=>V(t.mumps))}}),D.of({name:"Mbox",extensions:["mbox"],load(){return z(()=>import("./mbox.js"),[]).then(t=>V(t.mbox))}}),D.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return z(()=>import("./nginx.js"),[]).then(t=>V(t.nginx))}}),D.of({name:"NSIS",extensions:["nsh","nsi"],load(){return z(()=>import("./nsis.js"),__vite__mapDeps([25,23])).then(t=>V(t.nsis))}}),D.of({name:"NTriples",extensions:["nt","nq"],load(){return z(()=>import("./ntriples.js"),[]).then(t=>V(t.ntriples))}}),D.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.objectiveC))}}),D.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.objectiveCpp))}}),D.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.oCaml))}}),D.of({name:"Octave",extensions:["m"],load(){return z(()=>import("./octave.js"),[]).then(t=>V(t.octave))}}),D.of({name:"Oz",extensions:["oz"],load(){return z(()=>import("./oz.js"),[]).then(t=>V(t.oz))}}),D.of({name:"Pascal",extensions:["p","pas"],load(){return z(()=>import("./pascal.js"),[]).then(t=>V(t.pascal))}}),D.of({name:"Perl",extensions:["pl","pm"],load(){return z(()=>import("./perl.js"),[]).then(t=>V(t.perl))}}),D.of({name:"Pig",extensions:["pig"],load(){return z(()=>import("./pig.js"),[]).then(t=>V(t.pig))}}),D.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return z(()=>import("./powershell.js"),[]).then(t=>V(t.powerShell))}}),D.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return z(()=>import("./properties.js"),[]).then(t=>V(t.properties))}}),D.of({name:"ProtoBuf",extensions:["proto"],load(){return z(()=>import("./protobuf.js"),[]).then(t=>V(t.protobuf))}}),D.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return z(()=>import("./pug.js"),__vite__mapDeps([26,27])).then(t=>V(t.pug))}}),D.of({name:"Puppet",extensions:["pp"],load(){return z(()=>import("./puppet.js"),[]).then(t=>V(t.puppet))}}),D.of({name:"Q",extensions:["q"],load(){return z(()=>import("./q.js"),[]).then(t=>V(t.q))}}),D.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return z(()=>import("./r.js"),[]).then(t=>V(t.r))}}),D.of({name:"RPM Changes",load(){return z(()=>import("./rpm.js"),[]).then(t=>V(t.rpmChanges))}}),D.of({name:"RPM Spec",extensions:["spec"],load(){return z(()=>import("./rpm.js"),[]).then(t=>V(t.rpmSpec))}}),D.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return z(()=>import("./ruby.js"),[]).then(t=>V(t.ruby))}}),D.of({name:"SAS",extensions:["sas"],load(){return z(()=>import("./sas.js"),[]).then(t=>V(t.sas))}}),D.of({name:"Scala",extensions:["scala"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.scala))}}),D.of({name:"Scheme",extensions:["scm","ss"],load(){return z(()=>import("./scheme.js"),[]).then(t=>V(t.scheme))}}),D.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return z(()=>import("./shell.js"),[]).then(t=>V(t.shell))}}),D.of({name:"Sieve",extensions:["siv","sieve"],load(){return z(()=>import("./sieve.js"),[]).then(t=>V(t.sieve))}}),D.of({name:"Smalltalk",extensions:["st"],load(){return z(()=>import("./smalltalk.js"),[]).then(t=>V(t.smalltalk))}}),D.of({name:"Solr",load(){return z(()=>import("./solr.js"),[]).then(t=>V(t.solr))}}),D.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return z(()=>import("./mllike.js"),[]).then(t=>V(t.sml))}}),D.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return z(()=>import("./sparql.js"),[]).then(t=>V(t.sparql))}}),D.of({name:"Spreadsheet",alias:["excel","formula"],load(){return z(()=>import("./spreadsheet.js"),[]).then(t=>V(t.spreadsheet))}}),D.of({name:"Squirrel",extensions:["nut"],load(){return z(()=>import("./clike.js"),[]).then(t=>V(t.squirrel))}}),D.of({name:"Stylus",extensions:["styl"],load(){return z(()=>import("./stylus.js"),[]).then(t=>V(t.stylus))}}),D.of({name:"Swift",extensions:["swift"],load(){return z(()=>import("./swift.js"),[]).then(t=>V(t.swift))}}),D.of({name:"sTeX",load(){return z(()=>import("./stex.js"),[]).then(t=>V(t.stex))}}),D.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return z(()=>import("./stex.js"),[]).then(t=>V(t.stex))}}),D.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return z(()=>import("./verilog.js"),[]).then(t=>V(t.verilog))}}),D.of({name:"Tcl",extensions:["tcl"],load(){return z(()=>import("./tcl.js"),[]).then(t=>V(t.tcl))}}),D.of({name:"Textile",extensions:["textile"],load(){return z(()=>import("./textile.js"),[]).then(t=>V(t.textile))}}),D.of({name:"TiddlyWiki",load(){return z(()=>import("./tiddlywiki.js"),[]).then(t=>V(t.tiddlyWiki))}}),D.of({name:"Tiki wiki",load(){return z(()=>import("./tiki.js"),[]).then(t=>V(t.tiki))}}),D.of({name:"TOML",extensions:["toml"],load(){return z(()=>import("./toml.js"),[]).then(t=>V(t.toml))}}),D.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return z(()=>import("./troff.js"),[]).then(t=>V(t.troff))}}),D.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return z(()=>import("./ttcn.js"),[]).then(t=>V(t.ttcn))}}),D.of({name:"TTCN_CFG",extensions:["cfg"],load(){return z(()=>import("./ttcn-cfg.js"),[]).then(t=>V(t.ttcnCfg))}}),D.of({name:"Turtle",extensions:["ttl"],load(){return z(()=>import("./turtle.js"),[]).then(t=>V(t.turtle))}}),D.of({name:"Web IDL",extensions:["webidl"],load(){return z(()=>import("./webidl.js"),[]).then(t=>V(t.webIDL))}}),D.of({name:"VB.NET",extensions:["vb"],load(){return z(()=>import("./vb.js"),[]).then(t=>V(t.vb))}}),D.of({name:"VBScript",extensions:["vbs"],load(){return z(()=>import("./vbscript.js"),[]).then(t=>V(t.vbScript))}}),D.of({name:"Velocity",extensions:["vtl"],load(){return z(()=>import("./velocity.js"),[]).then(t=>V(t.velocity))}}),D.of({name:"Verilog",extensions:["v"],load(){return z(()=>import("./verilog.js"),[]).then(t=>V(t.verilog))}}),D.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return z(()=>import("./vhdl.js"),[]).then(t=>V(t.vhdl))}}),D.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return z(()=>import("./xquery.js"),[]).then(t=>V(t.xQuery))}}),D.of({name:"Yacas",extensions:["ys"],load(){return z(()=>import("./yacas.js"),[]).then(t=>V(t.yacas))}}),D.of({name:"Z80",extensions:["z80"],load(){return z(()=>import("./z80.js"),[]).then(t=>V(t.z80))}}),D.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.mscgen))}}),D.of({name:"Xù",extensions:["xu"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.xu))}}),D.of({name:"MsGenny",extensions:["msgenny"],load(){return z(()=>import("./mscgen.js"),[]).then(t=>V(t.msgenny))}}),D.of({name:"Vue",extensions:["vue"],load(){return z(()=>import("./index10.js"),__vite__mapDeps([28,1,2,7,3,5,8])).then(t=>t.vue())}}),D.of({name:"Angular Template",load(){return z(()=>import("./index11.js"),__vite__mapDeps([29,1,2,7,3,5,8])).then(t=>t.angular())}})],P8="#e5c07b",gp="#e06c75",D8="#56b6c2",B8="#ffffff",Ll="#abb2bf",Zu="#7d8799",z8="#61afef",N8="#98c379",vp="#d19a66",H8="#c678dd",$8="#21252b",yp="#2c313a",bp="#282c34",su="#353a42",q8="#3E4451",wp="#528bff",F8=tr.theme({"&":{color:Ll,backgroundColor:bp},".cm-content":{caretColor:wp},".cm-cursor, .cm-dropCursor":{borderLeftColor:wp},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:q8},".cm-panels":{backgroundColor:$8,color:Ll},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:bp,color:Zu,border:"none"},".cm-activeLineGutter":{backgroundColor:yp},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:su},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:su,borderBottomColor:su},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:yp,color:Ll}}},{dark:!0}),V8=Ng.define([{tag:pe.keyword,color:H8},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:gp},{tag:[pe.function(pe.variableName),pe.labelName],color:z8},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:vp},{tag:[pe.definition(pe.name),pe.separator],color:Ll},{tag:[pe.typeName,pe.className,pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:P8},{tag:[pe.operator,pe.operatorKeyword,pe.url,pe.escape,pe.regexp,pe.link,pe.special(pe.string)],color:D8},{tag:[pe.meta,pe.comment],color:Zu},{tag:pe.strong,fontWeight:"bold"},{tag:pe.emphasis,fontStyle:"italic"},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.link,color:Zu,textDecoration:"underline"},{tag:pe.heading,fontWeight:"bold",color:gp},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:vp},{tag:[pe.processingInstruction,pe.string,pe.inserted],color:N8},{tag:pe.invalid,color:B8}]),W8=[F8,d1(V8)];function j8(t){let e=t.schema.cached.changeSetIDs||(t.schema.cached.changeSetIDs=Object.create(null)),r=e[t.name];return r==null&&(e[t.name]=r=Object.keys(t.schema.nodes).indexOf(t.name)+1),r}const K2={encodeCharacter:t=>t,encodeNodeStart:t=>t.type.name,encodeNodeEnd:t=>-j8(t.type),compareTokens:(t,e)=>t===e};function Xu(t,e,r,n,o){for(let i=0,s=0;i<t.childCount;i++){let a=t.child(i),l=s+a.nodeSize,c=Math.max(s,r),u=Math.min(l,n);if(c<u)if(a.isText)for(let d=c;d<u;d++)o.push(e.encodeCharacter(a.text.charCodeAt(d-s),a.marks));else a.isLeaf?o.push(e.encodeNodeStart(a)):(c==s&&o.push(e.encodeNodeStart(a)),Xu(a.content,e,Math.max(s+1,c)-s-1,Math.min(l-1,u)-s-1,o),u==l&&o.push(e.encodeNodeEnd(a)));s=l}return o}const xp=2500,Cp=1e4;function U8(t,e){return Math.min(15,Math.max(2,Math.floor(Math.max(t,e)/10)))}function Z2(t,e,r,n=K2){if(Math.max(r.toA-r.fromA,r.toB-r.fromB)>Cp){let s=t.cut(r.fromA,r.toA),a=e.cut(r.fromB,r.toB),l=s.findDiffStart(a);if(l==null)return[];let c=s.findDiffEnd(a);if(r=r.slice(l,c.a,l,c.b),Math.max(r.toA-r.fromA,r.toB-r.fromB)>Cp)return[r]}let o=Xu(t,n,r.fromA,r.toA,[]),i=Xu(e,n,r.fromB,r.toB,[]);return G8(o,i,r,n.compareTokens)}function G8(t,e,r,n){let o=0,i=t.length,s=e.length;for(;o<t.length&&o<e.length&&n(t[o],e[o]);)o++;if(o==t.length&&o==e.length)return[];for(;i>o&&s>o&&n(t[i-1],e[s-1]);)i--,s--;if(i==o&&s==o)return[];if(i==o||s==o||i==s&&i==o+1||Math.max(i,s)-o>xp)return[r.slice(o,i,o,s)];let a=i-o,l=s-o,c=Math.min(xp,a+l),u=[],d=new Int16Array((c+1)*2).fill(-1);for(let h=0;h<=c;h++){for(let p=-h;p<=h;p+=2){let g=d[p+1+c],y=d[p-1+c],v=g<y?y:g+1,w=v+p;for(;v<a&&w<l&&n(t[o+v],e[o+w]);)v++,w++;if(d[p+c]=v,v>=a&&w>=l){let C=[],k=U8(i-o,s-o),S=-1,E=-1,R=-1,H=-1,O=(P,$,ie,N)=>{S>-1&&S<$+k?(S=P,R=ie):(S>-1&&C.push(r.slice(S,E,R,H)),S=P,E=$,R=ie,H=N)};for(let P=h-1;P>=0;P--){let $=d[p+1+c],ie=d[p-1+c];$<ie?(p--,v=ie+o,w=v+p,O(v,v,w,w+1)):(p++,v=$+o,w=v+p,O(v,v+1,w,w)),d=u[P>>1]}return S>-1&&C.push(r.slice(S,E,R,H)),C.reverse()}}h%2==0&&u.push(d.slice())}return[r.slice(o,i,o,s)]}let At=class Rs{constructor(e,r){this.length=e,this.data=r}cut(e){return e==this.length?this:new Rs(e,this.data)}static slice(e,r,n){if(r==n)return Rs.none;if(r==0&&n==Rs.len(e))return e;let o=[];for(let i=0,s=0;s<n;i++){let a=e[i],l=s+a.length,c=Math.min(n,l)-Math.max(r,s);c>0&&o.push(a.cut(c)),s=l}return o}static join(e,r,n){if(e.length==0)return r;if(r.length==0)return e;let o=n(e[e.length-1].data,r[0].data);if(o==null)return e.concat(r);let i=e.slice(0,e.length-1);i.push(new Rs(e[e.length-1].length+r[0].length,o));for(let s=1;s<r.length;s++)i.push(r[s]);return i}static len(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n].length;return r}};At.none=[];class ur{constructor(e,r,n,o,i,s){this.fromA=e,this.toA=r,this.fromB=n,this.toB=o,this.deleted=i,this.inserted=s}get lenA(){return this.toA-this.fromA}get lenB(){return this.toB-this.fromB}slice(e,r,n,o){return e==0&&n==0&&r==this.toA-this.fromA&&o==this.toB-this.fromB?this:new ur(this.fromA+e,this.fromA+r,this.fromB+n,this.fromB+o,At.slice(this.deleted,e,r),At.slice(this.inserted,n,o))}static merge(e,r,n){if(e.length==0)return r;if(r.length==0)return e;let o=[];for(let i=0,s=0,a=e[0],l=r[0];;){if(!a&&!l)return o;if(a&&(!l||a.toB<l.fromA)){let c=s?r[s-1].toB-r[s-1].toA:0;o.push(c==0?a:new ur(a.fromA,a.toA,a.fromB+c,a.toB+c,a.deleted,a.inserted)),a=i++==e.length?null:e[i]}else if(l&&(!a||l.toA<a.fromB)){let c=i?e[i-1].toB-e[i-1].toA:0;o.push(c==0?l:new ur(l.fromA-c,l.toA-c,l.fromB,l.toB,l.deleted,l.inserted)),l=s++==r.length?null:r[s]}else{let c=Math.min(a.fromB,l.fromA),u=Math.min(a.fromA,l.fromA-(i?e[i-1].toB-e[i-1].toA:0)),d=u,h=Math.min(l.fromB,a.fromB+(s?r[s-1].toB-r[s-1].toA:0)),p=h,g=At.none,y=At.none,v=!1,w=!1;for(;;){let C=a?c>=a.fromB?a.toB:a.fromB:2e8,k=l?c>=l.fromA?l.toA:l.fromA:2e8,S=Math.min(C,k),E=a&&c>=a.fromB,R=l&&c>=l.fromA;if(!E&&!R)break;E&&c==a.fromB&&!v&&(g=At.join(g,a.deleted,n),d+=a.lenA,v=!0),E&&!R&&(y=At.join(y,At.slice(a.inserted,c-a.fromB,S-a.fromB),n),p+=S-c),R&&c==l.fromA&&!w&&(y=At.join(y,l.inserted,n),p+=l.lenB,w=!0),R&&!E&&(g=At.join(g,At.slice(l.deleted,c-l.fromA,S-l.fromA),n),d+=S-c),E&&S==a.toB&&(a=i++==e.length?null:e[i],v=!1),R&&S==l.toA&&(l=s++==r.length?null:r[s],w=!1),c=S}(u<d||h<p)&&o.push(new ur(u,d,h,p,g,y))}}}static fromJSON(e){return new ur(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(r=>new At(r.length,r.data)),e.inserted.map(r=>new At(r.length,r.data)))}toJSON(){return this}}let K8;try{K8=new RegExp("[\\p{Alphabetic}_]","u")}catch{}class Zo{constructor(e,r){this.config=e,this.changes=r}addSteps(e,r,n){let o=[];for(let l=0;l<r.length;l++){let c=Array.isArray(n)?n[l]:n,u=0;r[l].forEach((d,h,p,g)=>{o.push(new ur(d+u,h+u,p,g,d==h?At.none:[new At(h-d,c)],p==g?At.none:[new At(g-p,c)])),u=g-p-(h-d)})}if(o.length==0)return this;let i=Yu(o,this.config.combine),s=ur.merge(this.changes,i,this.config.combine),a=s;for(let l=0;l<a.length;l++){let c=a[l];if(c.fromA==c.toA||c.fromB==c.toB||!i.some(d=>d.toB>c.fromB&&d.fromB<c.toB))continue;let u=Z2(this.config.doc.content,e.content,c,this.config.encoder);u.length==1&&u[0].fromB==0&&u[0].toB==c.toB-c.fromB||(a==s&&(a=s.slice()),u.length==1?a[l]=u[0]:(a.splice(l,1,...u),l+=u.length-1))}return new Zo(this.config,a)}get startDoc(){return this.config.doc}map(e){let r=n=>{let o=e(n);return o===n.data?n:new At(n.length,o)};return new Zo(this.config,this.changes.map(n=>new ur(n.fromA,n.toA,n.fromB,n.toB,n.deleted.map(r),n.inserted.map(r))))}changedRange(e,r){if(e==this)return null;let n=r&&Z8(r),o=n?n.toB-n.fromB-(n.toA-n.fromA):0;function i(d){return!n||d<=n.fromA?d:d+o}let s=n?n.fromB:2e8,a=n?n.toB:-2e8;function l(d,h=d){s=Math.min(d,s),a=Math.max(h,a)}let c=this.changes,u=e.changes;for(let d=0,h=0;d<c.length&&h<u.length;){let p=c[d],g=u[h];p&&g&&X8(p,g,i)?(d++,h++):g&&(!p||i(p.fromB)>=g.fromB)?(l(g.fromB,g.toB),h++):(l(i(p.fromB),i(p.toB)),d++)}return s<=a?{from:s,to:a}:null}static create(e,r=(i,s)=>i===s?i:null,n=K2,o=[]){return new Zo({combine:r,doc:e,encoder:n},o)}}Zo.computeDiff=Z2;function Yu(t,e,r=0,n=t.length){if(n==r+1)return[t[r]];let o=r+n>>1;return ur.merge(Yu(t,e,r,o),Yu(t,e,o,n),e)}function kp(t){let e=2e8,r=-2e8;for(let n=0;n<t.length;n++){let o=t[n];e!=2e8&&(e=o.map(e,-1),r=o.map(r,1)),o.forEach((i,s,a,l)=>{e=Math.min(e,a),r=Math.max(r,l)})}return e==2e8?null:{from:e,to:r}}function Z8(t){let e=kp(t);if(!e)return null;let r=kp(t.map(n=>n.invert()).reverse());return{fromA:r.from,toA:r.to,fromB:e.from,toB:e.to}}function X8(t,e,r){return r(t.fromB)==e.fromB&&r(t.toB)==e.toB&&_p(t.deleted,e.deleted)&&_p(t.inserted,e.inserted)}function _p(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(t[r].length!=e[r].length||t[r].data!==e[r].data)return!1;return!0}function vn(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-diff",...e}}),t}var Sp=500;function Y8(t={}){const e=new WeakMap,r=new WeakMap;function n(o){let i=e.get(o);if(i!=null)return i;const s=o.attrs,a=s?Object.keys(s).filter(l=>s[l]!=null).sort():[];if(a.length===0)i=o.type.name;else{const l={};for(const c of a)l[c]=s[c];i=`${o.type.name}:${JSON.stringify(l)}`}return e.set(o,i),i}return{encodeCharacter:(o,i)=>{if(i.length===0)return o;let s=r.get(i);return s==null&&(s=i.map(n).join(","),r.set(i,s)),`${o}:${s}`},encodeNodeStart:o=>{const i=o.attrs;if(i&&Object.keys(i).length>0){const s=t[o.type.name]??[],a=Object.keys(i).filter(l=>{if(s.includes(l))return!1;const c=o.type.spec.attrs?.[l]?.default;return i[l]!==c});if(a.length>0){const l={};for(const c of a.sort())l[c]=i[c];return`${o.type.name}:${JSON.stringify(l)}`}}return o.type.name},encodeNodeEnd:o=>{const i=o.type.schema,s=i.cached.changeSetIDs||(i.cached.changeSetIDs=Object.create(null));let a=s[o.type.name];return a==null&&(s[o.type.name]=a=Object.keys(i.nodes).indexOf(o.type.name)+1),-a},compareTokens:(o,i)=>o===i}}function X2(t,e,r){const n=r.get(t);if(n!=null)return n;const o=[String(e.encodeNodeStart(t))];if(t.isText){const s=t.text;for(let a=0;a<s.length;a++)o.push(":"+String(e.encodeCharacter(s.charCodeAt(a),t.marks)))}else t.content.forEach(s=>{o.push("/"+X2(s,e,r))});o.push("\\"+String(e.encodeNodeEnd(t)));const i=o.join("");return r.set(t,i),i}function Ap(t,e,r){const n=[];let o=0;return t.content.forEach(i=>{n.push({node:i,offset:o,size:i.nodeSize,signature:X2(i,r.encoder,r.sigCache)}),o+=i.nodeSize}),{node:t,contentStart:e,content:n}}function J8(t,e){const r=t.length,n=e.length,o=Array.from({length:r+1},()=>Array.from({length:n+1},()=>0));for(let l=r-1;l>=0;l--)for(let c=n-1;c>=0;c--)t[l].signature===e[c].signature?o[l][c]=o[l+1][c+1]+1:o[l][c]=Math.max(o[l+1][c],o[l][c+1]);const i=[];let s=0,a=0;for(;s<r&&a<n;)t[s].signature===e[a].signature?(i.push([s,a]),s++,a++):o[s+1][a]>=o[s][a+1]?s++:a++;return i}function Q8(t,e){if(t.type!==e.type)return!1;const r=t.type;return!(r.isTextblock||r.isAtom||r.spec.code===!0||!r.isBlock)}function Y2(t,e,r){return ur.fromJSON({fromA:t.fromA+e,toA:t.toA+e,fromB:t.fromB+r,toB:t.toB+r,deleted:t.deleted.map(n=>({length:n.length,data:n.data})),inserted:t.inserted.map(n=>({length:n.length,data:n.data}))})}function e9(t,e,r){const n=t.parent.copy(He.from(t.node)),o=e.parent.copy(He.from(e.node)),i=new v2(0,n.content.size,new dt(o.content,0,0));return Zo.create(n,void 0,r.encoder).addSteps(o,[i.getMap()],null).changes.map(s=>Y2(s,t.abs,e.abs))}function Tp(t,e){const r=t.content;if(e<r.length)return t.contentStart+r[e].offset;if(e>0){const n=r[e-1];return t.contentStart+n.offset+n.size}return t.contentStart+t.node.content.size}function t9(t,e,r){return ur.fromJSON({fromA:e,toA:e+t.size,fromB:r,toB:r,deleted:[{length:t.size,data:null}],inserted:[]})}function r9(t,e,r){return ur.fromJSON({fromA:e,toA:e,fromB:r,toB:r+t.size,deleted:[],inserted:[{length:t.size,data:null}]})}function n9(t,e,r,n,o){const i=new v2(0,t.content.size,new dt(e.content,0,0));return Zo.create(t,void 0,o.encoder).addSteps(e,[i.getMap()],null).changes.map(s=>Y2(s,r,n))}function Rl(t,e,r,n,o){if(t.childCount>Sp||e.childCount>Sp)return n9(t,e,r,n,o);const i=Ap(t,r,o),s=Ap(e,n,o),a=J8(i.content,s.content),l=[];let c=0,u=0;for(const[d,h]of a)Mp(i,s,{oldStart:c,oldEnd:d,newStart:u,newEnd:h},o,l),c=d+1,u=h+1;return Mp(i,s,{oldStart:c,oldEnd:i.content.length,newStart:u,newEnd:s.content.length},o,l),l}function Mp(t,e,r,n,o){const i=t.content,s=e.content;let a=r.oldStart,l=r.newStart;for(;a<r.oldEnd||l<r.newEnd;){const c=a<r.oldEnd?i[a]:null,u=l<r.newEnd?s[l]:null,d=c&&u&&c.node.type===u.node.type;if(c&&u&&d){o.push(...o9(t,e,c,u,n)),a++,l++;continue}if(c&&(!u||!d)){const h=t.contentStart+c.offset;o.push(t9(c,h,Tp(e,l))),a++;continue}if(u){const h=e.contentStart+u.offset;o.push(r9(u,Tp(t,a),h)),l++}}}function o9(t,e,r,n,o){const i=t.contentStart+r.offset,s=e.contentStart+n.offset;return Q8(r.node,n.node)&&i9(r.node,n.node,o.encoder)?Rl(r.node,n.node,i+1,s+1,o):e9({node:r.node,parent:t.node,abs:i},{node:n.node,parent:e.node,abs:s},o)}function i9(t,e,r){return r.encodeNodeStart(t)===r.encodeNodeStart(e)}function s9(t,e,r,n,o){const i=t.resolve(r),s=t.resolve(n),a=e.resolve(r),l=e.resolve(n),c=i.sharedDepth(n);if(a.sharedDepth(n)!==c)throw new RangeError(`computeDocDiff: range [${r}, ${n}) resolves to different sharedDepth in old and new docs`);for(let y=0;y<=c;y++){if(o.encodeNodeStart(i.node(y))!==o.encodeNodeStart(a.node(y)))throw new RangeError(`computeDocDiff: ancestor at depth ${y} differs in type or non-ignored attrs along the path to the shared ancestor`);if(i.start(y)!==a.start(y))throw new RangeError(`computeDocDiff: ancestor at depth ${y} starts at different absolute positions in old and new docs (content before the range differs in size)`)}const u=i.node(c);if(u.isTextblock)throw new RangeError(`computeDocDiff: range [${r}, ${n}) lands inside a textblock; widen the range to a block boundary`);if(i.depth!==c||s.depth!==c||a.depth!==c||l.depth!==c)throw new RangeError(`computeDocDiff: range [${r}, ${n}) endpoints must be aligned to child boundaries of the shared ancestor`);const d=a.node(c),h=i.start(c),p=r-h,g=n-h;return{oldCut:u.copy(u.content.cut(p,g)),newCut:d.copy(d.content.cut(p,g)),cutAbsStart:r}}function A0(t,e,r){const n=Y8(r?.ignoreAttrs),o={encoder:n,sigCache:new WeakMap},i=t.content.size,s=e.content.size,a=r?.range;if(a==null)return Rl(t,e,0,0,o);const l=Math.min(i,s),c=Math.max(0,Math.min(a.from??0,l)),u=Math.max(c,Math.min(a.to??l,l));if(c===u)return[];if(c===0&&u===l&&i===s)return Rl(t,e,0,0,o);const d=s9(t,e,c,u,n);return Rl(d.oldCut,d.newCut,d.cutAbsStart,d.cutAbsStart,o)}var lc=Ve({ignoreAttrs:{heading:["id"]}},"diffConfig");vn(lc,{displayName:"Ctx<diffConfig>",group:"Diff"});var it=new et("MILKDOWN_DIFF");function a9(t,e,r){const n=A0(t,e.newDoc,r);return{...e,changes:n}}function l9(t,e){return e.some(r=>t.fromB<r.toB&&t.toB>r.fromB)}function Da(t){return t.changes.filter(e=>!l9(e,t.rejectedRanges))}var J2=Je(t=>{const e=t.get(lc.key);return new Xe({key:it,state:{init:()=>null,apply(r,n,o,i){const s=r.getMeta(it);if(!n){if(s?.type==="start"){const c=A0(i.doc,s.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:s.newDoc,changes:c,rejectedRanges:[],active:!0}}return null}let a=n;if(r.docChanged&&a.active&&(a=a9(i.doc,a,{ignoreAttrs:e.ignoreAttrs})),!s)return a;let l;switch(s.type){case"start":{const c=A0(i.doc,s.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:s.newDoc,changes:c,rejectedRanges:[],active:!0}}case"accept":case"acceptRange":l=a;break;case"reject":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:s.fromB,toB:s.toB}]};break;case"rejectRange":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:s.range.fromB,toB:s.range.toB}]};break;case"acceptAll":case"clear":return null;default:return a}return l.active&&Da(l).length===0?null:l}},filterTransaction(r,n){return!it.getState(n)?.active||r.getMeta(it)?!0:!r.docChanged}})});vn(J2,{displayName:"Prose<diff>",group:"Diff"});function c9(t,e){const r=Da(e);for(let n=r.length-1;n>=0;n--){const o=r[n],i=e.newDoc.slice(o.fromB,o.toB);t=t.replace(o.fromA,o.toA,i)}return t}var Q2=Me("StartDiffReview",t=>e=>(r,n)=>{if(e==null)return!1;const o=t.get(gn)(e);return o?(n&&n(r.tr.setMeta(it,{type:"start",newDoc:o})),!0):!1});vn(Q2,{displayName:"Command<startDiffReview>",group:"Diff"});var C1=Me("StartDiffReviewFromDoc",()=>t=>(e,r)=>!t||t.type!==e.doc.type?!1:(r&&r(e.tr.setMeta(it,{type:"start",newDoc:t})),!0));vn(C1,{displayName:"Command<startDiffReviewFromDoc>",group:"Diff"});var e5=Me("AcceptDiffChunk",()=>t=>(e,r)=>{if(t==null)return!1;const n=it.getState(e);if(!n)return!1;const o=Da(n)[t];if(!o)return!1;if(r){const i=n.newDoc.slice(o.fromB,o.toB);let s=e.tr.replace(o.fromA,o.toA,i);s=s.setMeta(it,{type:"accept",changeIndex:t}),r(s)}return!0});vn(e5,{displayName:"Command<acceptDiffChunk>",group:"Diff"});var t5=Me("RejectDiffChunk",()=>t=>(e,r)=>{if(t==null)return!1;const n=it.getState(e);if(!n)return!1;const o=Da(n)[t];return o?(r&&r(e.tr.setMeta(it,{type:"reject",fromB:o.fromB,toB:o.toB})),!0):!1});vn(t5,{displayName:"Command<rejectDiffChunk>",group:"Diff"});var k1=Me("AcceptDiffRange",()=>t=>(e,r)=>{if(!t)return!1;const n=it.getState(e);if(!n)return!1;if(r){const o=n.newDoc.slice(t.fromB,t.toB);let i=e.tr.replace(t.fromA,t.toA,o);i=i.setMeta(it,{type:"acceptRange",range:t}),r(i)}return!0});vn(k1,{displayName:"Command<acceptDiffRange>",group:"Diff"});var _1=Me("RejectDiffRange",()=>t=>(e,r)=>!t||!it.getState(e)?!1:(r&&r(e.tr.setMeta(it,{type:"rejectRange",range:t})),!0));vn(_1,{displayName:"Command<rejectDiffRange>",group:"Diff"});var cc=Me("AcceptAllDiffs",()=>()=>(t,e)=>{const r=it.getState(t);return r?(e&&e((r.rejectedRanges.length===0?t.tr.replaceWith(0,t.doc.content.size,r.newDoc.content):c9(t.tr,r)).setMeta(it,{type:"acceptAll"})),!0):!1});vn(cc,{displayName:"Command<acceptAllDiffs>",group:"Diff"});var T0=Me("ClearDiffReview",()=>()=>(t,e)=>it.getState(t)?(e&&e(t.tr.setMeta(it,{type:"clear"})),!0):!1);vn(T0,{displayName:"Command<clearDiffReview>",group:"Diff"});var u9=[lc,J2,Q2,C1,e5,k1,t5,_1,cc,T0],d9=Object.defineProperty,Ep=Object.getOwnPropertySymbols,h9=Object.prototype.hasOwnProperty,f9=Object.prototype.propertyIsEnumerable,Ip=(t,e,r)=>e in t?d9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p9=(t,e)=>{for(var r in e||(e={}))h9.call(e,r)&&Ip(t,r,e[r]);if(Ep)for(var r of Ep(e))f9.call(e,r)&&Ip(t,r,e[r]);return t};function r5(t,e){return Object.assign(t,{meta:p9({package:"@milkdown/components"},e)}),t}const Rn="milkdown-diff",m9={acceptLabel:"Accept",rejectLabel:"Reject",customBlockTypes:[]},uc=Ve(m9,"diffComponentConfig");r5(uc,{displayName:"Ctx<diffComponentConfig>",group:"DiffComponent"});function g9(t,e,r){if(e===r)return!1;const n=t.resolve(e),o=t.resolve(r),i=n.index(0),s=o.depth===0?Math.max(0,o.index(0)-1):o.index(0);return i!==s}function Lp(t,e,r){if(e>=r)return!1;const n=t.resolve(e),o=t.resolve(r);if(n.sameParent(o)&&n.parent.isTextblock)return!1;let i=!1;return t.nodesBetween(e,r,(s,a)=>{if(i)return!1;if(!s.isBlock)return!0;const l=a+s.nodeSize;return a>=e&&l<=r?(i=!0,!1):!0}),i}function v9(t,e,r){if(r!==t.content.size)return!1;const n=t.resolve(e);if(n.depth!==0)return!1;for(let o=n.index(0);o<t.childCount;o++){const i=t.child(o);if(i.type.name!=="paragraph"||i.content.size>0)return!1}return!0}function y9(t){let e=t.content.size;for(let r=t.childCount-1;r>=0;r--){const n=t.child(r);if(n.type.name!=="paragraph"||n.content.size>0)break;e-=n.nodeSize}return e}function Ju(t,e){const r=t.resolve(e);for(let n=r.depth;n>=1;n--)if(r.node(n).isTextblock)return r.before(n);return e}function n5(t,e,r,n){let o=0;for(let i=0;i<t.childCount;i++){const s=t.child(i),a=o+s.nodeSize;if(o>=r)break;a>e&&o<r&&n(s,o,a),o=a}}function o5(t,e,r,n){n5(t,e,r,(o,i,s)=>{s===t.content.size&&o.type.name==="paragraph"&&o.content.size===0||n.push(Bt.node(i,s,{class:`${Rn}-removed-block`}))})}function au(t,e,r=!1){if(e<0||e>t.content.size)return null;const n=t.resolve(Math.min(e,t.content.size));if(n.depth>=1)return{from:n.before(1),to:n.after(1)};if(r){const o=n.nodeBefore;if(o)return{from:e-o.nodeSize,to:e};const i=n.nodeAfter;if(i)return{from:e,to:e+i.nodeSize}}else{const o=n.nodeAfter;if(o)return{from:e,to:e+o.nodeSize};const i=n.nodeBefore;if(i)return{from:e-i.nodeSize,to:e}}return null}function S1(t,e,r){if(e<0||e>t.content.size)return null;const n=t.resolve(Math.min(e,t.content.size));for(let o=n.depth;o>=0;o--){const i=n.node(o).type.name;if(r.has(i))return i}return null}function M0(t,e,r,n=!1){const o=S1(t,e,r);if(o)return o;const i=t.resolve(Math.min(Math.max(e,0),t.content.size)),s=n?i.nodeBefore:i.nodeAfter;return s&&r.has(s.type.name)?s.type.name:null}function b9(t,e,r){const n=[];let o=!0,i=-1,s=-1;return n5(t,e,r,(a,l,c)=>{i===-1&&(i=l),s=c,n.push(a)}),(n.length===0||i!==e||s!==r)&&(o=!1),o?n:[]}function tl(t,e,r,n){return t<n&&e>r}function Rp(t,e,r,n){return e===r?S1(t,e,n)!=null:M0(t,e,n)!=null||M0(t,r,n,!0)!=null}function w9(t,e,r){const n=t.resolve(r.fromA);if(!n.parent.isTextblock||n.depth<1||!n.node(1).isTextblock)return null;const o=n.after(1),i=e.resolve(r.fromB);let s;if(i.depth>=1&&i.node(1).isTextblock?(s=i.after(1),s>r.toB&&(s=r.toB)):s=r.fromB,o>=r.toA&&s>=r.toB)return null;const a=[];return(o>r.fromA||s>r.fromB)&&a.push({fromA:r.fromA,toA:Math.min(o,r.toA),fromB:r.fromB,toB:s,isBlock:!1}),(r.toA>o||r.toB>s)&&a.push({fromA:o,toA:Math.max(o,r.toA),fromB:s,toB:r.toB,isBlock:!0}),a.length>1?a:null}function x9(t,e,r,n){return Rp(e,t.fromA,t.toA,n)||Rp(r,t.fromB,t.toB,n)}function C9(t,e,r,n){var o,i,s,a;const l=[],c=new Set;for(let u=0;u<t.length;u++){if(c.has(u))continue;const d=t[u];if(!x9(d,e,r,n)){l.push({fromA:d.fromA,toA:d.toA,fromB:d.fromB,toB:d.toB,isCustomBlock:!1});continue}const h=Op(e,d.fromA,d.toA,n),p=Op(r,d.fromB,d.toB,n),g={fromA:Math.min((o=h?.from)!=null?o:d.fromA,d.fromA),toA:Math.max((i=h?.to)!=null?i:d.toA,d.toA),fromB:Math.min((s=p?.from)!=null?s:d.fromB,d.fromB),toB:Math.max((a=p?.to)!=null?a:d.toB,d.toB),isCustomBlock:!0};c.add(u);for(let v=u+1;v<t.length;v++){if(c.has(v))continue;const w=t[v],C=h&&tl(w.fromA,w.toA,h.from,h.to),k=p&&tl(w.fromB,w.toB,p.from,p.to);!C&&!k||(c.add(v),g.fromA=Math.min(g.fromA,w.fromA),g.toA=Math.max(g.toA,w.toA),g.fromB=Math.min(g.fromB,w.fromB),g.toB=Math.max(g.toB,w.toB))}const y=[];for(let v=0;v<l.length;v++){const w=l[v];if(!w.isCustomBlock)continue;const C=tl(g.fromA,g.toA,w.fromA,w.toA),k=tl(g.fromB,g.toB,w.fromB,w.toB);!C&&!k||(g.fromA=Math.min(g.fromA,w.fromA),g.toA=Math.max(g.toA,w.toA),g.fromB=Math.min(g.fromB,w.fromB),g.toB=Math.max(g.toB,w.toB),y.push(v))}for(let v=y.length-1;v>=0;v--)l.splice(y[v],1);l.push(g)}return l}function k9(t,e){const r=y9(e);if(r!==e.content.size)for(const n of t)n.fromA===n.toA&&n.fromB<n.toB&&n.fromA>=r&&(n.fromA=r,n.toA=r)}function Op(t,e,r,n){return e===r?S1(t,e,n)==null?null:au(t,e):M0(t,e,n)!=null?au(t,e):M0(t,r,n,!0)!=null?au(t,r,!0):null}const Pp=new et("MILKDOWN_DIFF_DECORATION"),i5=Je(t=>{const e=t.get(uc.key);return new Xe({key:Pp,state:{init:()=>Dt.empty,apply(r,n,o,i){const s=it.getState(i);return s?.active?r.getMeta(it)||r.docChanged?S9(t,i.doc,s,e):n.map(r.mapping,r.doc):Dt.empty}},props:{decorations(r){var n;return(n=Pp.getState(r))!=null?n:Dt.empty}}})});r5(i5,{displayName:"Prose<diffDecoration>",group:"DiffComponent"});function _9({doc:t,newDoc:e,segments:r,change:n,changeIndex:o,commands:i,acceptLabel:s,rejectLabel:a,decorations:l}){for(let p=0;p<r.length;p++){const g=r[p],y=g.fromA<g.toA,v=g.fromB<g.toB;if(y&&(g.isBlock?o5(t,g.fromA,g.toA,l):l.push(Bt.inline(g.fromA,g.toA,{class:`${Rn}-removed`}))),v){const w=g.isBlock?Ju(t,y?g.toA:g.fromA):y?g.toA:g.fromA,C=s5(e,g,g.isBlock);l.push(Bt.widget(w,C,{side:-1,key:`added-${o}-${p}`}))}}const c=r[r.length-1],u=c.isBlock?c.fromA<c.toA?c.toA:c.fromA:n.toA,d=Ju(t,u),h=a5({commands:i,isBlockLevel:!0,change:n,acceptLabel:s,rejectLabel:a});l.push(Bt.widget(d,h,{side:-1,key:`controls-${o}`}))}function S9(t,e,r,n){const o=[],i=t.get(ne),s=new Set(n.customBlockTypes),a=Da(r),l=C9(a,e,r.newDoc,s);k9(l,e);for(let c=0;c<l.length;c++){const u=l[c],d=u.fromA<u.toA,h=u.fromB<u.toB;if(d&&!h&&v9(e,u.fromA,u.toA))continue;const p=d&&g9(e,u.fromA,u.toA),g=d&&Lp(e,u.fromA,u.toA),y=h&&Lp(r.newDoc,u.fromB,u.toB),v=d&&!p&&!g&&!u.isCustomBlock&&!y,w=(p||g||y)&&!v;if(w&&!u.isCustomBlock){const E=w9(e,r.newDoc,u);if(E){_9({doc:e,newDoc:r.newDoc,segments:E,change:u,changeIndex:c,commands:i,acceptLabel:n.acceptLabel,rejectLabel:n.rejectLabel,decorations:o});continue}}d&&(u.isCustomBlock||w?o5(e,u.fromA,u.toA,o):o.push(Bt.inline(u.fromA,u.toA,{class:`${Rn}-removed`})));const C=d?u.toA:u.fromA,k=w?Ju(e,C):C;if(h){const E=s5(r.newDoc,u,w);o.push(Bt.widget(k,E,{side:-1,key:`added-${c}`}))}const S=a5({commands:i,isBlockLevel:w,change:u,acceptLabel:n.acceptLabel,rejectLabel:n.rejectLabel});o.push(Bt.widget(k,S,{side:w?-1:1,key:`controls-${c}`}))}return Dt.create(e,o)}function s5(t,e,r){var n;const o=document.createElement(r?"div":"span");o.className=`${Rn}-added`,o.contentEditable="false",r&&o.classList.add(`${Rn}-added-block`);const i=y2.fromSchema(t.type.schema);if(r){const l=b9(t,e.fromB,e.toB);if(l.length>0){const c=document.createDocumentFragment();for(const u of l)c.appendChild(i.serializeNode(u));return o.appendChild(c),o}}const s=t.slice(e.fromB,e.toB),a=i.serializeFragment(s.content);if(o.appendChild(a),!((n=o.textContent)!=null&&n.trim())&&!o.querySelector("img, video, audio, canvas, svg")){const l=t.textBetween(e.fromB,e.toB,`
5
5
  `,`
6
- `);l.trim()&&(o.textContent=l)}return o}function a5({commands:t,isBlockLevel:e,change:r,acceptLabel:n,rejectLabel:o}){const i=document.createElement(e?"div":"span");i.className=`${Rn}-controls`,i.contentEditable="false",e&&i.classList.add(`${Rn}-controls-block`);const s=c=>u=>{u.preventDefault(),u.stopPropagation();const d={fromA:r.fromA,toA:r.toA,fromB:r.fromB,toB:r.toB},h=c==="accept"?k1.key:_1.key;t.call(h,d)},a=document.createElement("button");a.className=`${Rn}-accept`,a.textContent=n,a.addEventListener("click",s("accept"));const l=document.createElement("button");return l.className=`${Rn}-reject`,l.textContent=o,l.addEventListener("click",s("reject")),i.appendChild(a),i.appendChild(l),i}const M9=[uc,i5];function ss(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-streaming",...e}}),t}var li=Ve({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:["id"]}},"streamingConfig");ss(li,{displayName:"Ctx<streamingConfig>",group:"Streaming"});function E9(t,e,r){const n=dc(t.get(gn),r);if(!n)return{tr:e,newDoc:null};const o=t.get(li.key).ignoreAttrs,i=A0(e.doc,n,o?{ignoreAttrs:o}:void 0);for(let s=i.length-1;s>=0;s--){const a=i[s],l=n.slice(a.fromB,a.toB);e=e.replace(a.fromA,a.toA,l)}return{tr:e,newDoc:n}}function I9(t){if(t.parent.type.spec.code)return{type:"plain-text",preserveNewlines:!0};for(let e=t.depth;e>0;e--)if(t.node(e).type.name==="table")return{type:"plain-text",preserveNewlines:!1};return t.depth>=1?{type:"split-block"}:{type:"block"}}function l5(t){if(t.childCount===0)return t;const e=t.lastChild;return e.type.name==="paragraph"&&e.content.size===0?t.cut(0,t.size-e.nodeSize):t}function L9(t,e,r){const{insertPos:n,currentEndPos:o}=r,i=r.buffer.replace(/\r\n?/g,`
7
- `);if(!i)return{tr:e,applied:!1,insertEndPos:o};const s=e.doc.content.size,a=Math.max(0,Math.min(n,s)),l=Math.max(a,Math.min(o,s)),c=e.doc.resolve(a),u=(t.get(li.key).insertStrategy??I9)(c),d={ctx:t,tr:e,buffer:i,from:a,to:l,resolved:c};switch(u.type){case"plain-text":return R9(d,u.preserveNewlines??!1);case"split-block":return z9(d);case"block":return N9(d)}}function R9({tr:t,buffer:e,from:r,to:n},o){const i=o?e:e.replace(/\n/g," "),s=t.doc.type.schema.text(i);return t=t.replaceWith(r,n,s),{tr:t,applied:!0,insertEndPos:r+i.length}}var O9=/[*_~`[\\<]|https?:\/\/|www\.|[\w.+-]@\w|&[a-zA-Z#]/,P9=/\$(?!\s)(?:[^$\n]*[^\s$])?\$(?!\d)/,D9=/:[\w+-]+:/;function B9(t,e){return!!(O9.test(e)||t.nodes.math_inline&&P9.test(e)||t.nodes.emoji&&D9.test(e))}function dc(t,e){try{return t(e)??null}catch{return null}}function lu(t,e,r){if(!r)return He.empty;if(!B9(e,r))return He.from(e.text(r));const n=dc(t.get(gn),r)?.firstChild;if(n?.type.name!=="paragraph"||n.content.size===0)return He.from(e.text(r));let o=n.content;const i=/^[ \t]+/.exec(r)?.[0];i&&(o=He.from(e.text(i)).append(o));const s=/[ \t]+$/.exec(r)?.[0];return s&&(o=o.append(He.from(e.text(s)))),o}function z9({ctx:t,tr:e,buffer:r,from:n,to:o,resolved:i}){const s=e.doc.type.schema,a=r.indexOf(`
8
- `);if(a<0){const I=lu(t,s,r);return e=e.replaceWith(n,o,I),{tr:e,applied:!0,insertEndPos:n+I.size}}const l=r.substring(0,a),c=r.substring(a+1),u=t.get(gn),d=c.trim()?dc(u,c):null,h=d?l5(d.content):He.empty;if(h.childCount===0){const I=lu(t,s,r.replace(/\n/g," "));return e=e.replaceWith(n,o,I),{tr:e,applied:!0,insertEndPos:n+I.size}}const p=i.depth;let g=lu(t,s,l);for(let I=p;I>0;I--)g=He.from(i.node(I).copy(g));const y=g.append(h),v=new dt(y,p,0),w=e.doc.content.size,C=e.doc.resolve(Math.min(o,w));let k=o;p>0&&C.depth===p&&C.parentOffset===C.parent.content.size&&(k=C.after(p)),e=e.replace(n,k,v);const A=y.size-p;return{tr:e,applied:!0,insertEndPos:n+A}}function N9({ctx:t,tr:e,buffer:r,from:n,to:o}){const i=dc(t.get(gn),r);if(!i)return{tr:e,applied:!1,insertEndPos:o};const s=l5(i.content);return s.size===0?{tr:e,applied:!1,insertEndPos:o}:(e=e.replace(n,o,new dt(s,0,0)),{tr:e,applied:!0,insertEndPos:n+s.size})}function A1(t,e,r){if(r.insertPos!=null){const n=r.insertPos,o=L9(t,e,{buffer:r.buffer,insertPos:n,currentEndPos:r.insertEndPos??n});return{tr:o.tr,newDoc:o.applied?o.tr.doc:null,insertEndPos:o.insertEndPos}}return E9(t,e,r.buffer)}var ht=new et("MILKDOWN_STREAMING");function H9(t,e){if(!t&&e?.type!=="start")return null;if(!e)return t;switch(e.type){case"start":return{buffer:"",originalDoc:e.originalDoc,active:!0,lastApplyTime:e.lastApplyTime,insertPos:e.insertPos??null,insertEndPos:e.insertEndPos??e.insertPos??null};case"push":return t?{...t,buffer:t.buffer+e.token}:null;case"apply":return t?{...t,lastApplyTime:e.lastApplyTime,insertEndPos:e.insertEndPos??t.insertEndPos}:null;case"end":case"abort":return null;default:return t}}var c5=Je(t=>{const e=t.get(li.key);return new Xe({key:ht,state:{init:()=>null,apply(r,n){return H9(n,r.getMeta(ht))}},filterTransaction(r,n){return!ht.getState(n)?.active||r.getMeta(ht)?!0:!r.docChanged},view(){return $9(t,e)}})});ss(c5,{displayName:"Prose<streaming>",group:"Streaming"});function $9(t,e){let r=null,n=-1,o=null;function i(){if(!o)return;const a=ht.getState(o.state);if(!a?.active||a.buffer.length===n)return;n=a.buffer.length;const l=A1(t,o.state.tr,a);if(!l.newDoc)return;let c=l.tr;!c.docChanged&&l.insertEndPos==null||(c=c.setMeta(ht,{type:"apply",lastApplyTime:Date.now(),insertEndPos:l.insertEndPos}),e.scrollFollow&&(c=c.scrollIntoView()),o.dispatch(c))}function s(){r!=null&&clearTimeout(r),r=setTimeout(i,e.throttleMs)}return{update(a){o=a;const l=ht.getState(a.state);if(!l?.active){r!=null&&(clearTimeout(r),r=null),n=-1;return}l.buffer.length!==n&&(Date.now()-l.lastApplyTime>=e.throttleMs?i():s())},destroy(){r!=null&&(clearTimeout(r),r=null),o=null}}}var T1=Me("StartStreaming",()=>t=>(e,r)=>{if(ht.getState(e)?.active)return!1;if(r){let n,o;if(t?.insertAt!=null)if(t.insertAt==="selection"){if(n=e.selection.from,o=e.selection.to,e.selection.empty){const i=e.doc.resolve(n);i.parent.isTextblock&&!i.parent.type.spec.code&&i.parent.content.size===0&&i.depth===1&&(n=i.before(i.depth),o=i.after(i.depth))}}else{const i=t.insertAt==="cursor"?e.selection.head:t.insertAt;if(!Number.isFinite(i))return!1;n=Math.max(0,Math.min(Math.round(i),e.doc.content.size));const s=e.doc.resolve(n);s.parent.isTextblock&&!s.parent.type.spec.code&&s.parent.content.size===0&&s.depth===1&&(n=s.before(s.depth),o=s.after(s.depth))}r(e.tr.setMeta(ht,{type:"start",originalDoc:e.doc,insertPos:n,insertEndPos:o,lastApplyTime:Date.now()}))}return!0});ss(T1,{displayName:"Command<startStreaming>",group:"Streaming"});var M1=Me("PushChunk",()=>t=>(e,r)=>t==null||!ht.getState(e)?.active?!1:(r&&r(e.tr.setMeta(ht,{type:"push",token:t})),!0));ss(M1,{displayName:"Command<pushChunk>",group:"Streaming"});var E1=Me("EndStreaming",t=>e=>(r,n)=>{const o=ht.getState(r);if(!o?.active)return!1;if(n){const i=t.get(li.key),s=e?.diffReview??i.diffReviewOnEnd,a=A1(t,r.tr,o);let l=a.tr;if(l=l.setMeta(ht,{type:"end"}),s&&a.newDoc){const c=l.doc;l=l.replace(0,l.doc.content.size,new dt(o.originalDoc.content,0,0)),n(l);try{t.get(ne).call(C1.key,c)}catch(u){console.warn("[milkdown/streaming] diff review handoff skipped:",u)}return!0}n(l)}return!0});ss(E1,{displayName:"Command<endStreaming>",group:"Streaming"});var as=Me("AbortStreaming",t=>e=>(r,n)=>{const o=ht.getState(r);if(!o?.active)return!1;if(n){const i=e?.keep??!1;let s=r.tr;i?s=A1(t,s,o).tr:s=s.replace(0,r.doc.content.size,new dt(o.originalDoc.content,0,0)),s=s.setMeta(ht,{type:"abort"}),n(s)}return!0});ss(as,{displayName:"Command<abortStreaming>",group:"Streaming"});var q9=[li,c5,T1,M1,E1,as];const E0=Math.min,Xo=Math.max,I0=Math.round,rl=Math.floor,Dn=t=>({x:t,y:t}),F9={left:"right",right:"left",bottom:"top",top:"bottom"};function V9(t,e,r){return Xo(t,E0(e,r))}function hc(t,e){return typeof t=="function"?t(e):t}function ji(t){return t.split("-")[0]}function fc(t){return t.split("-")[1]}function u5(t){return t==="x"?"y":"x"}function d5(t){return t==="y"?"height":"width"}function ho(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function h5(t){return u5(ho(t))}function W9(t,e,r){r===void 0&&(r=!1);const n=fc(t),o=h5(t),i=d5(o);let s=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=L0(s)),[s,L0(s)]}function j9(t){const e=L0(t);return[Qu(t),e,Qu(e)]}function Qu(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Pp=["left","right"],Dp=["right","left"],U9=["top","bottom"],G9=["bottom","top"];function K9(t,e,r){switch(t){case"top":case"bottom":return r?e?Dp:Pp:e?Pp:Dp;case"left":case"right":return e?U9:G9;default:return[]}}function Z9(t,e,r,n){const o=fc(t);let i=K9(ji(t),r==="start",n);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(Qu)))),i}function L0(t){const e=ji(t);return F9[e]+t.slice(e.length)}function X9(t){var e,r,n,o;return{top:(e=t.top)!=null?e:0,right:(r=t.right)!=null?r:0,bottom:(n=t.bottom)!=null?n:0,left:(o=t.left)!=null?o:0}}function Y9(t){return typeof t!="number"?X9(t):{top:t,right:t,bottom:t,left:t}}function R0(t){const{x:e,y:r,width:n,height:o}=t;return{width:n,height:o,top:r,left:e,right:e+n,bottom:r+o,x:e,y:r}}function Bp(t,e,r){let{reference:n,floating:o}=t;const i=ho(e),s=h5(e),a=d5(s),l=ji(e),c=i==="y",u=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,h=n[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:n.y-o.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-o.width,y:d};break;default:p={x:n.x,y:n.y}}const g=fc(e);return g&&(p[s]+=h*(g==="end"?1:-1)*(r&&c?-1:1)),p}async function J9(t,e){var r;e===void 0&&(e={});const{x:n,y:o,platform:i,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=hc(e,t),g=Y9(p),v=a[h?d==="floating"?"reference":"floating":d],w=R0(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),C=d==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),A=await(i.isElement==null?void 0:i.isElement(k))&&await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1},I=R0(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:k,strategy:l}):C);return{top:(w.top-I.top+g.top)/A.y,bottom:(I.bottom-w.bottom+g.bottom)/A.y,left:(w.left-I.left+g.left)/A.x,right:(I.right-w.right+g.right)/A.x}}const Q9=50,ey=async(t,e,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:s}=r,a=s.detectOverflow?s:{...s,detectOverflow:J9},l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Bp(c,n,l),h=n,p=0;const g={};for(let y=0;y<i.length;y++){const v=i[y];if(!v)continue;const{name:w,fn:C}=v,{x:k,y:A,data:I,reset:R}=await C({x:u,y:d,initialPlacement:n,placement:h,strategy:o,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});u=k??u,d=A??d,g[w]={...g[w],...I},R&&p<Q9&&(p++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):R.rects),{x:u,y:d}=Bp(c,h,l)),y=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:g}},ty=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...v}=hc(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const w=ji(o),C=ho(a),k=ji(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),I=h||(k||!y?[L0(a)]:j9(a)),R=g!=="none";!h&&R&&I.push(...Z9(a,y,g,A));const H=[a,...I],O=await l.detectOverflow(e,v),P=[];let $=((n=i.flip)==null?void 0:n.overflows)||[];if(u&&P.push(O[w]),d){const be=W9(o,s,A);P.push(O[be[0]],O[be[1]])}if($=[...$,{placement:o,overflows:P}],!P.every(be=>be<=0)){var ie,N;const be=(((ie=i.flip)==null?void 0:ie.index)||0)+1,Fe=H[be];if(Fe&&(!(d==="alignment"?C!==ho(Fe):!1)||$.every(fe=>ho(fe.placement)===C?fe.overflows[0]>0:!0)))return{data:{index:be,overflows:$},reset:{placement:Fe}};let ke=(N=$.filter(we=>we.overflows[0]<=0).sort((we,fe)=>we.overflows[1]-fe.overflows[1])[0])==null?void 0:N.placement;if(!ke)switch(p){case"bestFit":{var ye;const we=(ye=$.filter(fe=>{if(R){const rt=ho(fe.placement);return rt===C||rt==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(rt=>rt>0).reduce((rt,kt)=>rt+kt,0)]).sort((fe,rt)=>fe[1]-rt[1])[0])==null?void 0:ye[0];we&&(ke=we);break}case"initialPlacement":ke=a;break}if(o!==ke)return{reset:{placement:ke}}}return{}}}},ry=new Set(["left","top"]);async function ny(t,e){const{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=ji(r),a=fc(r),l=ho(r)==="y",c=ry.has(s)?-1:1,u=i&&l?-1:1,d=hc(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const oy=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:o,y:i,placement:s,middlewareData:a}=e,l=await ny(e,t);return s===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},iy=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:C=>{let{x:k,y:A}=C;return{x:k,y:A}}},...c}=hc(t,e),u={x:r,y:n},d=await i.detectOverflow(e,c),h=ho(o),p=u5(h);let g=u[p],y=u[h];const v=(C,k)=>V9(k+d[C==="y"?"top":"left"],k,k-d[C==="y"?"bottom":"right"]);s&&(g=v(p,g)),a&&(y=v(h,y));const w=l.fn({...e,[p]:g,[h]:y});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[p]:s,[h]:a}}}}}};function pc(){return typeof window<"u"}function ls(t){return f5(t)?(t.nodeName||"").toLowerCase():"#document"}function er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $n(t){var e;return(e=(f5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function f5(t){return pc()?t instanceof Node||t instanceof er(t).Node:!1}function cn(t){return pc()?t instanceof Element||t instanceof er(t).Element:!1}function _o(t){return pc()?t instanceof HTMLElement||t instanceof er(t).HTMLElement:!1}function zp(t){return!pc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof er(t).ShadowRoot}function mc(t){const{overflow:e,overflowX:r,overflowY:n,display:o}=un(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&o!=="inline"&&o!=="contents"}function sy(t){return/^(table|td|th)$/.test(ls(t))}function gc(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const ay=/transform|translate|scale|rotate|perspective|filter/,ly=/paint|layout|strict|content/,Eo=t=>!!t&&t!=="none";let cu;function I1(t){const e=cn(t)?un(t):t;return Eo(e.transform)||Eo(e.translate)||Eo(e.scale)||Eo(e.rotate)||Eo(e.perspective)||!L1()&&(Eo(e.backdropFilter)||Eo(e.filter))||ay.test(e.willChange||"")||ly.test(e.contain||"")}function cy(t){let e=ri(t);for(;_o(e)&&!pa(e);){if(I1(e))return e;if(gc(e))return null;e=ri(e)}return null}function L1(){return cu==null&&(cu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),cu}function pa(t){return/^(html|body|#document)$/.test(ls(t))}function un(t){return er(t).getComputedStyle(t)}function vc(t){return cn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ri(t){if(ls(t)==="html")return t;const e=t.assignedSlot||t.parentNode||zp(t)&&t.host||$n(t);return zp(e)?e.host:e}function p5(t){const e=ri(t);return pa(e)?(t.ownerDocument||t).body:_o(e)&&mc(e)?e:p5(e)}function ma(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const o=p5(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),s=er(o);if(i){const a=ed(s);return e.concat(s,s.visualViewport||[],mc(o)?o:[],a&&r?ma(a):[])}else return e.concat(o,ma(o,[],r))}function ed(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function m5(t){const e=un(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=_o(t),i=o?t.offsetWidth:r,s=o?t.offsetHeight:n,a=I0(r)!==i||I0(n)!==s;return a&&(r=i,n=s),{width:r,height:n,$:a}}function R1(t){return cn(t)?t:t.contextElement}function Bi(t){const e=R1(t);if(!_o(e))return Dn(1);const r=e.getBoundingClientRect(),{width:n,height:o,$:i}=m5(e);let s=(i?I0(r.width):r.width)/n,a=(i?I0(r.height):r.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const uy=Dn(0);function g5(t){const e=er(t);return!L1()||!e.visualViewport?uy:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dy(t,e,r){return e===void 0&&(e=!1),!!r&&e&&r===er(t)}function ni(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const o=t.getBoundingClientRect(),i=R1(t);let s=Dn(1);e&&(n?cn(n)&&(s=Bi(n)):s=Bi(t));const a=dy(i,r,n)?g5(i):Dn(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i&&n){const h=er(i),p=cn(n)?er(n):n;let g=h,y=ed(g);for(;y&&p!==g;){const v=Bi(y),w=y.getBoundingClientRect(),C=un(y),k=w.left+(y.clientLeft+parseFloat(C.paddingLeft))*v.x,A=w.top+(y.clientTop+parseFloat(C.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=k,c+=A,g=er(y),y=ed(g)}}return R0({width:u,height:d,x:l,y:c})}function yc(t,e){const r=vc(t).scrollLeft;return e?e.left+r:ni($n(t)).left+r}function v5(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-yc(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function hy(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t;const i=o==="fixed",s=$n(n),a=e?gc(e.floating):!1;if(n===s||a&&i)return r;let l={scrollLeft:0,scrollTop:0},c=Dn(1);const u=Dn(0),d=_o(n);if((d||!i)&&((ls(n)!=="body"||mc(s))&&(l=vc(n)),d)){const p=ni(n);c=Bi(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const h=s&&!d&&!i?v5(s,l):Dn(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:r.y*c.y-l.scrollTop*c.y+u.y+h.y}}function fy(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function py(t){const e=vc(t),r=t.ownerDocument.body,n=Xo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Xo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-e.scrollLeft+yc(t);const s=-e.scrollTop;return un(r).direction==="rtl"&&(i+=Xo(t.clientWidth,r.clientWidth)-n),{width:n,height:o,x:i,y:s}}const my=25;function gy(t,e,r){r===void 0&&(r="viewport");const n=r==="layoutViewport",o=er(t),i=$n(t),s=o.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(s){const h=!L1()||e==="fixed";n?h||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,h&&(c=s.offsetLeft,u=s.offsetTop))}if(yc(i)<=0){const h=i.ownerDocument,p=h.body,g=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(i.clientWidth-p.clientWidth-y),w=getComputedStyle(i).scrollbarGutter==="stable both-edges"?v/2:v;w<=my&&(a-=w)}return{width:a,height:l,x:c,y:u}}function vy(t,e){const r=ni(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Bi(t),s=t.clientWidth*i.x,a=t.clientHeight*i.y,l=o*i.x,c=n*i.y;return{width:s,height:a,x:l,y:c}}function Np(t,e,r){let n;if(e==="viewport"||e==="layoutViewport")n=gy(t,r,e);else if(e==="document")n=py($n(t));else if(cn(e))n=vy(e,r);else{const o=g5(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return R0(n)}function yy(t,e){const r=e.get(t);if(r)return r;let n=ma(t,[],!1).filter(a=>cn(a)&&ls(a)!=="body"),o=null;const i=un(t).position==="fixed";let s=i?ri(t):t;for(;cn(s)&&!pa(s);){const a=un(s),l=I1(s),c=o?o.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?n=n.filter(d=>d!==s):o=a,s=ri(s)}return e.set(t,n),n}function by(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t;const s=[...r==="clippingAncestors"?gc(e)?[]:yy(e,this._c):[].concat(r),n],a=Np(e,s[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<s.length;h++){const p=Np(e,s[h],o);l=Xo(p.top,l),c=E0(p.right,c),u=E0(p.bottom,u),d=Xo(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function wy(t){const{width:e,height:r}=m5(t);return{width:e,height:r}}function xy(t,e,r){const n=_o(e),o=$n(e),i=r==="fixed",s=ni(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Dn(0);if((n||!i)&&((ls(e)!=="body"||mc(o))&&(a=vc(e)),n)){const h=ni(e,!0,i,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!n&&o&&(l.x=yc(o));const c=o&&!n&&!i?v5(o,a):Dn(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function uu(t){return un(t).position==="static"}function Hp(t,e){if(!_o(t)||un(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return $n(t)===r&&(r=r.ownerDocument.body),r}function y5(t,e){const r=er(t);if(gc(t))return r;if(!_o(t)){let o=ri(t);for(;o&&!pa(o);){if(cn(o)&&!uu(o))return o;o=ri(o)}return r}let n=Hp(t,e);for(;n&&sy(n)&&uu(n);)n=Hp(n,e);return n&&pa(n)&&uu(n)&&!I1(n)?r:n||cy(t)||r}const Cy=async function(t){const e=this.getOffsetParent||y5,r=this.getDimensions,n=await r(t.floating);return{reference:xy(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ky(t){return un(t).direction==="rtl"}const _y={convertOffsetParentRelativeRectToViewportRelativeRect:hy,getDocumentElement:$n,getClippingRect:by,getOffsetParent:y5,getElementRects:Cy,getClientRects:fy,getDimensions:wy,getScale:Bi,isElement:cn,isRTL:ky};function b5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Sy(t,e,r){let n=null,o;const i=$n(t);function s(){var u;clearTimeout(o),(u=n)==null||u.disconnect(),n=null}function a(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();const h=t.getBoundingClientRect(),{left:p,top:g,width:y,height:v}=h;if(u||e(),!y||!v)return;const w=rl(g),C=rl(i.clientWidth-(p+y)),k=rl(i.clientHeight-(g+v)),A=rl(p),R={rootMargin:-w+"px "+-C+"px "+-k+"px "+-A+"px",threshold:Xo(0,E0(1,d))||1};let H=!0;function O(P){const $=P[0].intersectionRatio;if(!b5(h,t.getBoundingClientRect()))return a();if($!==d){if(!H)return a();$?a(!1,$):o=setTimeout(()=>{a(!1,1e-7)},1e3)}H=!1}try{n=new IntersectionObserver(O,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(O,R)}n.observe(t)}const l=er(t),c=()=>a(r);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),s()}}function $p(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=R1(t),u=o||i?[...c?ma(c):[],...e?ma(e):[]]:[];u.forEach(w=>{o&&w.addEventListener("scroll",r),i&&w.addEventListener("resize",r)});const d=c&&a?Sy(c,r,i):null;let h=-1,p=null;s&&(p=new ResizeObserver(w=>{let[C]=w;C&&C.target===c&&p&&e&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),r()}),c&&!l&&p.observe(c),e&&p.observe(e));let g,y=l?ni(t):null;l&&v();function v(){const w=ni(t);y&&!b5(y,w)&&r(),y=w,g=requestAnimationFrame(v)}return r(),()=>{var w;u.forEach(C=>{o&&C.removeEventListener("scroll",r),i&&C.removeEventListener("resize",r)}),d?.(),(w=p)==null||w.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const oi=oy,Ay=iy,O1=ty,dn=(t,e,r)=>{const n=new Map,o=r??{},i={..._y,...o.platform,_c:n};return ey(t,e,{...o,platform:i})};var Ba=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;#l;#u;constructor(t){this.#t=!1,this.onShow=()=>{},this.onHide=()=>{},this.#d=e=>{dn(e,this.element,{placement:this.#r.placement??"top",middleware:[O1(),oi(this.#a),Ay(this.#l),...this.#n],...this.#r}).then(({x:r,y:n})=>{Object.assign(this.element.style,{left:`${r}px`,top:`${n}px`})}).catch(console.error)},this.#h=e=>this.#c!==e.dom.parentElement,this.#f=(e,r)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map(p=>p.$from.pos)),c=Math.max(...a.map(p=>p.$to.pos)),u=p=>!!p&&p.doc.eq(s)&&p.selection.eq(i),d=u(r)&&u(this.#s);if(this.#t||((this.#c??e.dom.parentElement??document.body).appendChild(this.element),this.#t=!0),o||d)return;if(this.#s=n,this.#i?.(),this.#i=void 0,!this.#o(e,r)){this.hide();return}const h={getBoundingClientRect:()=>Oa(e,l,c),contextElement:e.dom};this.#h(e)?this.#i=$p(h,this.element,()=>this.#d(h)):this.#d(h),this.show()},this.update=(e,r)=>{this.#u(e,r)},this.#p=e=>{const{doc:r,selection:n}=e.state,{empty:o,from:i,to:s}=n,a=!r.textBetween(i,s).length&&e.state.selection instanceof Ce,l=this.element.contains(document.activeElement),c=!e.hasFocus()&&!l,u=!e.editable;return!(c||o||a||u)},this.destroy=()=>{this.#i?.(),this.#u.cancel()},this.show=(e,r)=>{if(this.element.dataset.show="true",e){this.#i?.(),this.#i=void 0;const n={...e,contextElement:r?.dom};r&&this.#h(r)?this.#i=$p(n,this.element,()=>this.#d(n)):this.#d(n)}this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=t.content,this.#e=t.debounce??200,this.#o=t.shouldShow??this.#p,this.#a=t.offset,this.#l=t.shift,this.#n=t.middleware??[],this.#r=t.floatingUIOptions??{},this.#c=t.root,this.element.dataset.show="false",this.#u=ac(this.#f,this.#e)}#d;#h;#f;#p};function za(t){const e=Ve({},`${t}_TOOLTIP_SPEC`),r=Je(o=>{const i=o.get(e.key);return new Xe({key:new et(`${t}_TOOLTIP`),...i})}),n=[e,r];return n.key=e.key,n.pluginKey=r.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${t}`},r.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${t}`},n}function P1(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const Ke={},Oi=[],zr=()=>{},w5=()=>!1,bc=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),wc=t=>t.startsWith("onUpdate:"),Lt=Object.assign,D1=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},Ty=Object.prototype.hasOwnProperty,De=(t,e)=>Ty.call(t,e),ve=Array.isArray,Yo=t=>Na(t)==="[object Map]",td=t=>Na(t)==="[object Set]",qp=t=>Na(t)==="[object Date]",xe=t=>typeof t=="function",mt=t=>typeof t=="string",go=t=>typeof t=="symbol",Ze=t=>t!==null&&typeof t=="object",x5=t=>(Ze(t)||xe(t))&&xe(t.then)&&xe(t.catch),My=Object.prototype.toString,Na=t=>My.call(t),Ey=t=>Na(t).slice(8,-1),Iy=t=>Na(t)==="[object Object]",B1=t=>mt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,oa=P1(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xc=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},Ly=/-\w/g,Nr=xc(t=>t.replace(Ly,e=>e.slice(1).toUpperCase())),Ry=/\B([A-Z])/g,ci=xc(t=>t.replace(Ry,"-$1").toLowerCase()),C5=xc(t=>t.charAt(0).toUpperCase()+t.slice(1)),du=xc(t=>t?`on${C5(t)}`:""),nn=(t,e)=>!Object.is(t,e),hu=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},O0=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},Oy=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Fp;const Jo=()=>Fp||(Fp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function z1(t){if(ve(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],o=mt(n)?zy(n):z1(n);if(o)for(const i in o)e[i]=o[i]}return e}else if(mt(t)||Ze(t))return t}const Py=/;(?![^(]*\))/g,Dy=/:([^]+)/,By=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function zy(t){const e={};return t.replace(By,r=>r.startsWith("/*")?"":r).split(Py).forEach(r=>{if(r){const n=r.split(Dy);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function N1(t){let e="";if(mt(t))e=t;else if(ve(t))for(let r=0;r<t.length;r++){const n=N1(t[r]);n&&(e+=n+" ")}else if(Ze(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const Ny="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly",Hy=P1(Ny);function k5(t){return!!t||t===""}function $y(t,e,r){if(t.length!==e.length)return!1;let n=!0;for(let o=0;n&&o<t.length;o++)n=Cc(t[o],e[o],r);return n}function Vp(t,e,r){if(t.size!==e.size)return!1;const n=Array.from(e),o=new Uint8Array(n.length);for(const i of t){let s=-1;for(let a=0;a<n.length;a++)if(!o[a]&&Cc(i,n[a],r)){s=a;break}if(s<0)return!1;o[s]=1}return!0}function qy(t,e,r){let n=Yo(t),o=Yo(e);if(n||o||(n=td(t),o=td(e),n||o))return n&&o?Vp(t,e,r):!1;const i=Object.keys(t).length,s=Object.keys(e).length;if(i!==s)return!1;for(const a in t){const l=t.hasOwnProperty(a),c=e.hasOwnProperty(a);if(l&&!c||!l&&c||!Cc(t[a],e[a],r))return!1}return String(t)===String(e)}function Wp(t,e,r,n){r||(r=[new Map,new Map]);const[o,i]=r;if(o.has(t)||i.has(e))return o.get(t)===e&&i.get(e)===t;o.set(t,e),i.set(e,t);const s=n(t,e,r);return o.delete(t),i.delete(e),s}function Cc(t,e,r){if(t===e)return!0;let n=qp(t),o=qp(e);return n||o?n&&o?t.getTime()===e.getTime():!1:(n=go(t),o=go(e),n||o?t===e:(n=ve(t),o=ve(e),n||o?n&&o?Wp(t,e,r,$y):!1:(n=Ze(t),o=Ze(e),n||o?!n||!o?!1:Wp(t,e,r,qy):String(t)===String(e))))}let It;class Fy{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&It&&(It.active?(this.parent=It,this.index=(It.scopes||(It.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes){const n=this.scopes.slice();for(e=0,r=n.length;e<r;e++)n[e].pause()}for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes){const o=this.scopes.slice();for(e=0,r=o.length;e<r;e++)o[e].resume()}const n=this.effects.slice();for(e=0,r=n.length;e<r;e++)n[e].resume()}}run(e){if(this._active){const r=It;try{return It=this,e()}finally{It=r}}}on(){++this._on===1&&(this.prevScope=It,It=this)}off(){if(this._on>0&&--this._on===0){if(It===this)It=this.prevScope;else{let e=It;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(r=0,n=o.length;r<n;r++)o[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function Vy(){return It}let Ge;const fu=new WeakSet;class _5{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,It&&(It.active?It.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fu.has(this)&&(fu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||A5(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,jp(this),T5(this);const e=Ge,r=Hr;Ge=this,Hr=!0;try{return this.fn()}finally{M5(this),Ge=e,Hr=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)q1(e);this.deps=this.depsTail=void 0,jp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){rd(this)&&this.run()}get dirty(){return rd(this)}}let S5=0,ia,sa;function A5(t,e=!1){if(t.flags|=8,e){t.next=sa,sa=t;return}t.next=ia,ia=t}function H1(){S5++}function $1(){if(--S5>0)return;if(sa){let e=sa;for(sa=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;ia;){let e=ia;for(ia=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function T5(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function M5(t){let e,r=t.depsTail,n=r;for(;n;){const o=n.prevDep;n.version===-1?(n===r&&(r=o),q1(n),Wy(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=o}t.deps=e,t.depsTail=r}function rd(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(E5(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function E5(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===ga)||(t.globalVersion=ga,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!rd(t))))return;t.flags|=2;const e=t.dep,r=Ge,n=Hr;Ge=t,Hr=!0;try{T5(t);const o=t.fn(t._value);(e.version===0||nn(o,t._value))&&(t.flags|=128,t._value=o,e.version++)}catch(o){throw e.version++,o}finally{Ge=r,Hr=n,M5(t),t.flags&=-3}}function q1(t,e=!1){const{dep:r,prevSub:n,nextSub:o}=t;if(n&&(n.nextSub=o,t.prevSub=void 0),o&&(o.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)q1(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Wy(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let Hr=!0;const I5=[];function hn(){I5.push(Hr),Hr=!1}function fn(){const t=I5.pop();Hr=t===void 0?!0:t}function jp(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=Ge;Ge=void 0;try{e()}finally{Ge=r}}}let ga=0;class jy{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class F1{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ge||!Hr||Ge===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==Ge)r=this.activeLink=new jy(Ge,this),Ge.deps?(r.prevDep=Ge.depsTail,Ge.depsTail.nextDep=r,Ge.depsTail=r):Ge.deps=Ge.depsTail=r,L5(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=Ge.depsTail,r.nextDep=void 0,Ge.depsTail.nextDep=r,Ge.depsTail=r,Ge.deps===r&&(Ge.deps=n)}return r}trigger(e){this.version++,ga++,this.notify(e)}notify(e){H1();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{$1()}}}function L5(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)L5(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const nd=new WeakMap,Qo=Symbol(""),od=Symbol(""),va=Symbol("");function Pt(t,e,r){if(Hr&&Ge){let n=nd.get(t);n||nd.set(t,n=new Map);let o=n.get(r);o||(n.set(r,o=new F1),o.map=n,o.key=r),o.track()}}function Ln(t,e,r,n,o,i){const s=nd.get(t);if(!s){ga++;return}const a=l=>{l&&l.trigger()};if(H1(),e==="clear")s.forEach(a);else{const l=ve(t),c=l&&B1(r);if(l&&r==="length"){const u=Number(n);s.forEach((d,h)=>{(h==="length"||h===va||!go(h)&&h>=u)&&a(d)})}else switch((r!==void 0||s.has(void 0))&&a(s.get(r)),c&&a(s.get(va)),e){case"add":l?c&&a(s.get("length")):(a(s.get(Qo)),Yo(t)&&a(s.get(od)));break;case"delete":l||(a(s.get(Qo)),Yo(t)&&a(s.get(od)));break;case"set":Yo(t)&&a(s.get(Qo));break}}$1()}function mi(t){const e=Ne(t);return e===t||(Pt(e,"iterate",va),$r(t))?e:Nn(t)?ei(t)?e.map(r=>ii(pn(r))):e.map(ii):e.map(pn)}function V1(t){return Pt(t=Ne(t),"iterate",va),t}function Qr(t,e){return Nn(t)?ii(ei(t)?pn(e):e):pn(e)}const Uy={__proto__:null,[Symbol.iterator](){return pu(this,Symbol.iterator,t=>Qr(this,t))},concat(...t){return mi(this).concat(...t.map(e=>ve(e)?mi(e):e))},entries(){return pu(this,"entries",t=>(t[1]=Qr(this,t[1]),t))},every(t,e){return xn(this,"every",t,e,void 0,arguments)},filter(t,e){return xn(this,"filter",t,e,r=>r.map(n=>Qr(this,n)),arguments)},find(t,e){return xn(this,"find",t,e,r=>Qr(this,r),arguments)},findIndex(t,e){return xn(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return xn(this,"findLast",t,e,r=>Qr(this,r),arguments)},findLastIndex(t,e){return xn(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return xn(this,"forEach",t,e,void 0,arguments)},includes(...t){return mu(this,"includes",t)},indexOf(...t){return mu(this,"indexOf",t)},join(t){return mi(this).join(t)},lastIndexOf(...t){return mu(this,"lastIndexOf",t)},map(t,e){return xn(this,"map",t,e,void 0,arguments)},pop(){return Ss(this,"pop")},push(...t){return Ss(this,"push",t)},reduce(t,...e){return Gp(this,"reduce",t,e)},reduceRight(t,...e){return Gp(this,"reduceRight",t,e)},shift(){return Ss(this,"shift")},some(t,e){return xn(this,"some",t,e,void 0,arguments)},splice(...t){return Ss(this,"splice",t)},toReversed(){return mi(this).toReversed()},toSorted(t){return mi(this).toSorted(t)},toSpliced(...t){return mi(this).toSpliced(...t)},unshift(...t){return Ss(this,"unshift",t)},values(){return pu(this,"values",t=>Qr(this,t))}};function pu(t,e,r){const n=V1(t),o=n[e],i=o.call(n);if(n!==t&&!$r(t)){if(i[Symbol.toStringTag]==="Array Iterator"){const s=Object.create(Object.getPrototypeOf(i));return s.next=()=>Up(i.next(),r),o!==R5[e]&&Object.defineProperties(s,{return:{get(){const a=i.return;return typeof a=="function"?a.bind(i):a}},throw:{get(){const a=i.throw;return typeof a=="function"?a.bind(i):a}}}),s}i._next=i.next,i.next=()=>Up(i._next(),r)}return i}function Up(t,e){return t.done||(t.value=e(t.value)),t}const R5=Array.prototype;function xn(t,e,r,n,o,i){const s=V1(t),a=s!==t&&!$r(t),l=s[e];if(l!==R5[e]){const d=l.apply(t,i);return a?pn(d):d}let c=r;s!==t&&(a?c=function(d,h){return r.call(this,Qr(t,d),h,t)}:r.length>2&&(c=function(d,h){return r.call(this,d,h,t)}));const u=l.call(s,c,n);return a&&o?o(u):u}function Gp(t,e,r,n){const o=V1(t),i=o!==t&&!$r(t);let s=r,a=!1;o!==t&&(i?(a=n.length===0,s=function(c,u,d){return a&&(a=!1,c=Qr(t,c)),r.call(this,c,Qr(t,u),d,t)}):r.length>3&&(s=function(c,u,d){return r.call(this,c,u,d,t)}));const l=o[e](s,...n);return a?Qr(t,l):l}function mu(t,e,r){const n=Ne(t);Pt(n,"iterate",va);const o=n[e](...r);return(o===-1||o===!1)&&G1(r[0])?(r[0]=Ne(r[0]),n[e](...r)):o}function Ss(t,e,r=[]){hn(),H1();const n=Ne(t)[e].apply(t,r);return $1(),fn(),n}const Gy=P1("__proto__,__v_isRef,__isVue"),O5=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(go));function Ky(t){go(t)||(t=String(t));const e=Ne(this);return Pt(e,"has",t),e.hasOwnProperty(t)}class P5{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const o=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!o;if(r==="__v_isReadonly")return o;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(o?i?ob:N5:i?z5:B5).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=ve(e);if(!o){let l;if(s&&(l=Uy[r]))return l;if(r==="hasOwnProperty")return Ky}const a=Reflect.get(e,r,zt(e)?e:n);if((go(r)?O5.has(r):Gy(r))||(o||Pt(e,"get",r),i))return a;if(zt(a)){const l=s&&B1(r)?a:a.value;return o&&Ze(l)?sd(l):l}return Ze(a)?o?sd(a):j1(a):a}}class D5 extends P5{constructor(e=!1){super(!1,e)}set(e,r,n,o){let i=e[r];const s=ve(e)&&B1(r);if(!this._isShallow){const c=Nn(i);if(!$r(n)&&!Nn(n)&&(i=Ne(i),n=Ne(n)),!s&&zt(i)&&!zt(n))return c||(i.value=n),!0}const a=s?Number(r)<e.length:De(e,r),l=Reflect.set(e,r,n,zt(e)?e:o);return e===Ne(o)&&l&&(a?nn(n,i)&&Ln(e,"set",r,n):Ln(e,"add",r,n)),l}deleteProperty(e,r){const n=De(e,r);e[r];const o=Reflect.deleteProperty(e,r);return o&&n&&Ln(e,"delete",r,void 0),o}has(e,r){const n=Reflect.has(e,r);return(!go(r)||!O5.has(r))&&Pt(e,"has",r),n}ownKeys(e){return Pt(e,"iterate",ve(e)?"length":Qo),Reflect.ownKeys(e)}}class Zy extends P5{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Xy=new D5,Yy=new Zy,Jy=new D5(!0);const id=t=>t,nl=t=>Reflect.getPrototypeOf(t);function Qy(t,e,r){return function(...n){const o=this.__v_raw,i=Ne(o),s=Yo(i),a=t==="entries"||t===Symbol.iterator&&s,l=t==="keys"&&s,c=o[t](...n),u=r?id:e?ii:pn;return!e&&Pt(i,"iterate",l?od:Qo),Lt(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:a?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function ol(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function eb(t,e){const r={get(o){const i=this.__v_raw,s=Ne(i),a=Ne(o);t||(nn(o,a)&&Pt(s,"get",o),Pt(s,"get",a));const{has:l}=nl(s),c=e?id:t?ii:pn;if(l.call(s,o))return c(i.get(o));if(l.call(s,a))return c(i.get(a));i!==s&&i.get(o)},get size(){const o=this.__v_raw;return!t&&Pt(Ne(o),"iterate",Qo),o.size},has(o){const i=this.__v_raw,s=Ne(i),a=Ne(o);return t||(nn(o,a)&&Pt(s,"has",o),Pt(s,"has",a)),o===a?i.has(o):i.has(o)||i.has(a)},forEach(o,i){const s=this,a=s.__v_raw,l=Ne(a),c=e?id:t?ii:pn;return!t&&Pt(l,"iterate",Qo),a.forEach((u,d)=>o.call(i,c(u),c(d),s))}};return Lt(r,t?{add:ol("add"),set:ol("set"),delete:ol("delete"),clear:ol("clear")}:{add(o){const i=Ne(this),s=nl(i),a=Ne(o),l=!e&&!$r(o)&&!Nn(o)?a:o;return s.has.call(i,l)||nn(o,l)&&s.has.call(i,o)||nn(a,l)&&s.has.call(i,a)||(i.add(l),Ln(i,"add",l,l)),this},set(o,i){!e&&!$r(i)&&!Nn(i)&&(i=Ne(i));const s=Ne(this),{has:a,get:l}=nl(s);let c=a.call(s,o);c||(o=Ne(o),c=a.call(s,o));const u=l.call(s,o);return s.set(o,i),c?nn(i,u)&&Ln(s,"set",o,i):Ln(s,"add",o,i),this},delete(o){const i=Ne(this),{has:s,get:a}=nl(i);let l=s.call(i,o);l||(o=Ne(o),l=s.call(i,o)),a&&a.call(i,o);const c=i.delete(o);return l&&Ln(i,"delete",o,void 0),c},clear(){const o=Ne(this),i=o.size!==0,s=o.clear();return i&&Ln(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{r[o]=Qy(o,t,e)}),r}function W1(t,e){const r=eb(t,e);return(n,o,i)=>o==="__v_isReactive"?!t:o==="__v_isReadonly"?t:o==="__v_isShallow"?e:o==="__v_raw"?n:Reflect.get(De(r,o)&&o in n?r:n,o,i)}const tb={get:W1(!1,!1)},rb={get:W1(!1,!0)},nb={get:W1(!0,!1)};const B5=new WeakMap,z5=new WeakMap,N5=new WeakMap,ob=new WeakMap;function ib(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function j1(t){return Nn(t)?t:U1(t,!1,Xy,tb,B5)}function sb(t){return U1(t,!1,Jy,rb,z5)}function sd(t){return U1(t,!0,Yy,nb,N5)}function U1(t,e,r,n,o){if(!Ze(t)||t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=o.get(t);if(i)return i;const s=ib(Ey(t));if(s===0)return t;const a=new Proxy(t,s===2?n:r);return o.set(t,a),a}function ei(t){return Nn(t)?ei(t.__v_raw):!!(t&&t.__v_isReactive)}function Nn(t){return!!(t&&t.__v_isReadonly)}function $r(t){return!!(t&&t.__v_isShallow)}function G1(t){return t?!!t.__v_raw:!1}function Ne(t){const e=t&&t.__v_raw;return e?Ne(e):t}function ab(t){return!De(t,"__v_skip")&&Object.isExtensible(t)&&O0(t,"__v_skip",!0),t}const pn=t=>Ze(t)?j1(t):t,ii=t=>Ze(t)?sd(t):t;function zt(t){return t?t.__v_isRef===!0:!1}function re(t){return H5(t,!1)}function P0(t){return H5(t,!0)}function H5(t,e){return zt(t)?t:new lb(t,e)}class lb{constructor(e,r){this.dep=new F1,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:Ne(e),this._value=r?e:pn(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||$r(e)||Nn(e);e=n?e:Ne(e),nn(e,r)&&(this._rawValue=e,this._value=n?e:pn(e),this.dep.trigger())}}function cb(t){return zt(t)?t.value:t}const ub={get:(t,e,r)=>e==="__v_raw"?t:cb(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const o=t[e];return zt(o)&&!zt(r)?(o.value=r,!0):Reflect.set(t,e,r,n)}};function $5(t){return ei(t)?t:new Proxy(t,ub)}class db{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new F1(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ga-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ge!==this)return A5(this,!0),!0}get value(){const e=this.dep.track();return E5(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function hb(t,e,r=!1){let n,o;return xe(t)?n=t:(n=t.get,o=t.set),new db(n,o,r)}const il={},D0=new WeakMap;let Ho;function fb(t,e=!1,r=Ho){if(r){let n=D0.get(r);n||D0.set(r,n=[]),n.push(t)}}function pb(t,e,r=Ke){const{immediate:n,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=r,c=A=>o?A:$r(A)||o===!1||o===0?so(A,1):so(A);let u,d,h,p,g=!1,y=!1;if(zt(t)?(d=()=>t.value,g=$r(t)):ei(t)?(d=()=>c(t),g=!0):ve(t)?(y=!0,g=t.some(A=>ei(A)||$r(A)),d=()=>t.map(A=>{if(zt(A))return A.value;if(ei(A))return c(A);if(xe(A))return l?l(A,2):A()})):xe(t)?e?d=l?()=>l(t,2):t:d=()=>{if(h){hn();try{h()}finally{fn()}}const A=Ho;Ho=u;try{return l?l(t,3,[p]):t(p)}finally{Ho=A}}:d=zr,e&&o){const A=d,I=o===!0?1/0:o;d=()=>so(A(),I)}const v=Vy(),w=()=>{u.stop(),v&&v.active&&D1(v.effects,u)};if(i&&e){const A=e;e=(...I)=>{try{return A(...I)}finally{w()}}}let C=y?new Array(t.length).fill(il):il;const k=A=>{if(!(!(u.flags&1)||!u.dirty&&!A))if(e){const I=u.run();if(A||o||g||(y?I.some((R,H)=>nn(R,C[H])):nn(I,C))){const R=Ho;hn();try{h&&h(),Ho=u;const H=[I,C===il?void 0:y&&C[0]===il?[]:C,p];C=I,l?l(e,3,H):e(...H)}finally{Ho=R,fn()}}}else u.run()};return a&&a(k),u=new _5(d),u.scheduler=s?()=>s(k,!1):k,p=A=>fb(A,!1,u),h=u.onStop=()=>{const A=D0.get(u);if(A){if(l)l(A,4);else for(const I of A)I();D0.delete(u)}},e?n?k(!0):C=u.run():s?s(k.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function so(t,e=1/0,r){if(e<=0||!Ze(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,zt(t))so(t.value,e,r);else if(ve(t))for(let n=0;n<t.length;n++)so(t[n],e,r);else if(td(t)||Yo(t))t.forEach(n=>{so(n,e,r)});else if(Iy(t)){for(const n in t)so(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&so(t[n],e,r)}return t}function Ha(t,e,r,n){try{return n?t(...n):t()}catch(o){kc(o,e,r)}}function Vr(t,e,r,n){if(xe(t)){const o=Ha(t,e,r,n);return o&&x5(o)&&o.catch(i=>{kc(i,e,r)}),o}if(ve(t)){const o=[];for(let i=0;i<t.length;i++)o.push(Vr(t[i],e,r,n));return o}}function kc(t,e,r,n=!0){const o=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=e&&e.appContext.config||Ke;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,l,c)===!1)return}a=a.parent}if(i){hn(),Ha(i,null,10,[t,l,c]),fn();return}}mb(t,r,o,n,s)}function mb(t,e,r,n=!0,o=!1){if(o)throw t;console.error(t)}const Wt=[];let Pr=-1;const en=[];let io=null,xi=0;const q5=Promise.resolve();let B0=null;function ad(t){const e=B0||q5;return t?e.then(this?t.bind(this):t):e}function gb(t){let e=Pr+1,r=Wt.length;for(;e<r;){const n=e+r>>>1,o=Wt[n],i=ya(o);i<t||i===t&&o.flags&2?e=n+1:r=n}return e}function K1(t){if(!(t.flags&1)){const e=ya(t),r=Wt[Wt.length-1];!r||!(t.flags&2)&&e>=ya(r)?Wt.push(t):Wt.splice(gb(e),0,t),t.flags|=1,F5()}}function F5(){B0||(B0=q5.then(j5))}function vb(t){if(!ve(t))io&&t.id===-1?io.splice(xi+1,0,t):t.flags&1||(en.push(t),t.flags|=1);else for(let e=0;e<t.length;e++)en.push(t[e]);F5()}function V5(t,e,r,n=Pr+1){for(;n<Wt.length;n++){const o=Wt[n];if(o&&o.flags&2){if(t&&o.id!==t.uid||e!==void 0&&!(o.id>=e))continue;Wt.splice(n,1),n=t?n-1:Pr,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function W5(t,e,r=0){if(en.length){let n=en,o=0;if(e){n=[];for(let s=0;s<en.length;s++){const a=en[s];(a.i!==void 0?!a.i||a.i.uid<r:e.has(a))?en[o++]=a:n.push(a)}}const i=[...new Set(n)].sort((s,a)=>ya(s)-ya(a));if(en.length=o,io){for(let s=0;s<i.length;s++)io.push(i[s]);return}for(io=i,xi=0;xi<io.length;xi++){const s=io[xi];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}io=null,xi=0}}let gu=!1;function yb(t,e){if(gu){t();return}const r=e===void 0?void 0:new Set(en);t(),gu=!0;try{V5(void 0,e),W5(void 0,r,e)}finally{gu=!1}}const ya=t=>t.id==null?t.flags&2?-1:1/0:t.id;function j5(t){try{for(Pr=0;Pr<Wt.length;Pr++){const e=Wt[Pr];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ha(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Pr<Wt.length;Pr++){const e=Wt[Pr];e&&(e.flags&=-2)}Pr=-1,Wt.length=0,W5(),B0=null,(Wt.length||en.length)&&j5()}}let on,Os=[],ld=!1;function _c(t,...e){on?on.emit(t,...e):ld||Os.push({event:t,args:e})}function U5(t,e){var r,n;on=t,on?(on.enabled=!0,Os.forEach(({event:o,args:i})=>on.emit(o,...i)),Os=[]):typeof window<"u"&&window.HTMLElement&&!((n=(r=window.navigator)==null?void 0:r.userAgent)!=null&&n.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{U5(i,e)}),setTimeout(()=>{on||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ld=!0,Os=[])},3e3)):(ld=!0,Os=[])}function bb(t,e){_c("app:init",t,e,{Fragment:Ie,Text:$a,Comment:mn,Static:Pl})}function wb(t){_c("app:unmount",t)}const xb=Z1("component:added"),G5=Z1("component:updated"),Cb=Z1("component:removed"),kb=t=>{on&&typeof on.cleanupBuffer=="function"&&!on.cleanupBuffer(t)&&Cb(t)};function Z1(t){return e=>{_c(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}function _b(t,e,r){_c("component:emit",t.appContext.app,t,e,r)}let sn=null,K5=null;function z0(t){const e=sn;return sn=t,K5=t&&t.type.__scopeId||null,e}function Sb(t,e=sn,r){if(!e||t._n)return t;const n=(...o)=>{n._d&&q0(-1);const i=z0(e),s=Ni.length;let a;try{a=t(...o)}finally{for(let l=Ni.length;l>s;l--)vw();z0(i),n._d&&q0(1)}return __VUE_PROD_DEVTOOLS__&&G5(e),a};return n._n=!0,n._c=!0,n._d=!0,n}function Io(t,e,r,n){const o=t.dirs,i=e&&e.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[n];l&&(hn(),Vr(l,r,8,[t.el,a,t,e]),fn())}}function Ab(t,e){if(Ut){let r=Ut.provides;const n=Ut.parent&&Ut.parent.provides;n===r&&(r=Ut.provides=Object.create(n)),r[t]=e}}function Ol(t,e,r=!1){const n=Aw();if(n||zi){let o=zi?zi._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(o&&t in o)return o[t];if(arguments.length>1)return r&&xe(e)?e.call(n&&n.proxy):e}}const Tb=Symbol.for("v-scx"),Mb=()=>Ol(Tb);function cs(t,e){return X1(t,null,e)}function Bn(t,e,r){return X1(t,e,r)}function X1(t,e,r=Ke){const{immediate:n,deep:o,flush:i,once:s}=r,a=Lt({},r),l=e&&n||!e&&i!=="post";let c;if(xa){if(i==="sync"){const p=Mb();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=zr,p.resume=zr,p.pause=zr,p}}const u=Ut;a.call=(p,g,y)=>Vr(p,u,g,y);let d=!1;i==="post"?a.scheduler=p=>{p.i=u,Yt(p,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(p,g)=>{g?p():K1(p)}),a.augmentJob=p=>{e&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const h=pb(t,e,a);return xa&&(c?c.push(h):l&&h()),h}function Eb(t,e,r){const n=this.proxy,o=mt(t)?t.includes(".")?Z5(n,t):()=>n[t]:t.bind(n,n);let i;xe(e)?i=e:(i=e.handler,r=e);const s=qa(this),a=X1(o,i.bind(n),r);return s(),a}function Z5(t,e){const r=e.split(".");return()=>{let n=t;for(let o=0;o<r.length&&n;o++)n=n[r[o]];return n}}const Ib=Symbol("_vte"),Sc=t=>t.__isTeleport,vu=Symbol("_leaveCb");function Lb(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==mn){e=r;break}}return e}function X5(t){if(!Y1(t))return Sc(t.type)&&t.children?Lb(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&xe(r.default))return r.default()}}function N0(t,e){if(t.shapeFlag&6&&t.component){t.transition=e;const r=t.component.subTree;N0(Sc(r.type)&&X5(r)||r,e)}else if(t.shapeFlag&128)t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback);else if(t.transition=e,t.type===Ie&&ve(t.children)){const r=n3(t.children,!1);r&&N0(r,e)}}function cd(t){if(t.component)return cd(t.component.subTree);if(t.type===Ie){const e=ve(t.children)&&n3(t.children,!1);return e?cd(e):void 0}if(t.type!==mn)return t}function Ct(t,e){return xe(t)?Lt({name:t.name},e,{setup:t}):t}function Y5(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Kp(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const H0=new WeakMap;function aa(t,e,r,n,o=!1){if(ve(t)){t.forEach((y,v)=>aa(y,e&&(ve(e)?e[v]:e),r,n,o));return}if(la(n)&&!o){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&aa(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?th(n.component):n.el,s=o?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===Ke?a.refs={}:a.refs,d=a.setupState,h=Ne(d),p=d===Ke?w5:y=>Kp(u,y)?!1:De(h,y),g=(y,v)=>!(v&&Kp(u,v));if(c!=null&&c!==l){if(Zp(e),mt(c))u[c]=null,p(c)&&(d[c]=null);else if(zt(c)){const y=e;g(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(xe(l))Ha(l,a,12,[s,u]);else{const y=mt(l),v=zt(l);if(y||v){const w=()=>{if(t.f){const C=y?p(l)?d[l]:u[l]:g()||!t.k?l.value:u[t.k];if(o)ve(C)&&D1(C,i);else if(ve(C))C.includes(i)||C.push(i);else if(y)u[l]=[i],p(l)&&(d[l]=u[l]);else{const k=[i];g(l,t.k)&&(l.value=k),t.k&&(u[t.k]=k)}}else y?(u[l]=s,p(l)&&(d[l]=s)):v&&(g(l,t.k)&&(l.value=s),t.k&&(u[t.k]=s))};if(s){const C=()=>{w(),H0.delete(t)};C.id=-1,H0.set(t,C),Yt(C,r)}else Zp(t),w()}}}function Zp(t){const e=H0.get(t);e&&(e.flags|=8,H0.delete(t))}Jo().requestIdleCallback;Jo().cancelIdleCallback;const la=t=>!!t.type.__asyncLoader,Y1=t=>t.type.__isKeepAlive;function Rb(t,e){J5(t,"a",e)}function Ob(t,e){J5(t,"da",e)}function J5(t,e,r=Ut){const n=t.__wdc||(t.__wdc=()=>{let o=r;for(;o;){if(o.isDeactivated)return;o=o.parent}return t()});if(Ac(e,n,r),r){let o=r.parent;for(;o&&o.parent;)Y1(o.parent.vnode)&&Pb(n,e,r,o),o=o.parent}}function Pb(t,e,r,n){const o=Ac(e,t,n,!0);ds(()=>{D1(n[e],o)},r)}function Ac(t,e,r=Ut,n=!1){if(r){const o=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...s)=>{hn();const a=qa(r),l=Vr(e,r,t,s);return a(),fn(),l});return n?o.unshift(i):o.push(i),i}}const qn=t=>(e,r=Ut)=>{(!xa||t==="sp")&&Ac(t,(...n)=>e(...n),r)},Db=qn("bm"),us=qn("m"),Bb=qn("bu"),zb=qn("u"),Nb=qn("bum"),ds=qn("um"),Hb=qn("sp"),$b=qn("rtg"),qb=qn("rtc");function Fb(t,e=Ut){Ac("ec",t,e)}const Vb=Symbol.for("v-ndc"),ud=t=>t?y3(t)?th(t):ud(t.parent):null,ca=Lt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>ud(t.parent),$root:t=>ud(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?e3(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>{K1(t.update)}),$nextTick:t=>t.n||(t.n=ad.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?Eb.bind(t):zr}),yu=(t,e)=>t!==Ke&&!t.__isScriptSetup&&De(t,e),Wb={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:o,props:i,accessCache:s,type:a,appContext:l}=t;if(e[0]!=="$"){const h=s[e];if(h!==void 0)switch(h){case 1:return n[e];case 2:return o[e];case 4:return r[e];case 3:return i[e]}else{if(yu(n,e))return s[e]=1,n[e];if(__VUE_OPTIONS_API__&&o!==Ke&&De(o,e))return s[e]=2,o[e];if(De(i,e))return s[e]=3,i[e];if(r!==Ke&&De(r,e))return s[e]=4,r[e];(!__VUE_OPTIONS_API__||dd)&&(s[e]=0)}}const c=ca[e];let u,d;if(c)return e==="$attrs"&&Pt(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==Ke&&De(r,e))return s[e]=4,r[e];if(d=l.config.globalProperties,De(d,e))return d[e]},set({_:t},e,r){const{data:n,setupState:o,ctx:i}=t;return yu(o,e)?(o[e]=r,!0):__VUE_OPTIONS_API__&&n!==Ke&&De(n,e)?(n[e]=r,!0):De(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:o,props:i,type:s}},a){let l;return!!(r[a]||__VUE_OPTIONS_API__&&t!==Ke&&a[0]!=="$"&&De(t,a)||yu(e,a)||De(i,a)||De(n,a)||De(ca,a)||De(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:De(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function Xp(t){return ve(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let dd=!0;function jb(t){const e=e3(t),r=t.proxy,n=t.ctx;dd=!1,e.beforeCreate&&Yp(e.beforeCreate,t,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:p,updated:g,activated:y,deactivated:v,beforeDestroy:w,beforeUnmount:C,destroyed:k,unmounted:A,render:I,renderTracked:R,renderTriggered:H,errorCaptured:O,serverPrefetch:P,expose:$,inheritAttrs:ie,components:N,directives:ye,filters:be}=e;if(c&&Ub(c,n,null),s)for(const we in s){const fe=s[we];xe(fe)&&(n[we]=fe.bind(r))}if(o){const we=o.call(r,r);Ze(we)&&(t.data=j1(we))}if(dd=!0,i)for(const we in i){const fe=i[we],rt=xe(fe)?fe.bind(r,r):xe(fe.get)?fe.get.bind(r,r):zr,kt=!xe(fe)&&xe(fe.set)?fe.set.bind(r):zr,vt=dr({get:rt,set:kt});Object.defineProperty(n,we,{enumerable:!0,configurable:!0,get:()=>vt.value,set:ut=>vt.value=ut})}if(a)for(const we in a)Q5(a[we],n,r,we);if(l){const we=xe(l)?l.call(r):l;Reflect.ownKeys(we).forEach(fe=>{Ab(fe,we[fe])})}u&&Yp(u,t,"c");function ke(we,fe){ve(fe)?fe.forEach(rt=>we(rt.bind(r))):fe&&we(fe.bind(r))}if(ke(Db,d),ke(us,h),ke(Bb,p),ke(zb,g),ke(Rb,y),ke(Ob,v),ke(Fb,O),ke(qb,R),ke($b,H),ke(Nb,C),ke(ds,A),ke(Hb,P),ve($))if($.length){const we=t.exposed||(t.exposed={});$.forEach(fe=>{Object.defineProperty(we,fe,{get:()=>r[fe],set:rt=>r[fe]=rt,enumerable:!0})})}else t.exposed||(t.exposed={});I&&t.render===zr&&(t.render=I),ie!=null&&(t.inheritAttrs=ie),N&&(t.components=N),ye&&(t.directives=ye),P&&Y5(t)}function Ub(t,e,r=zr){ve(t)&&(t=hd(t));for(const n in t){const o=t[n];let i;Ze(o)?"default"in o?i=Ol(o.from||n,o.default,!0):i=Ol(o.from||n):i=Ol(o),zt(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):e[n]=i}}function Yp(t,e,r){Vr(ve(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function Q5(t,e,r,n){let o=n.includes(".")?Z5(r,n):()=>r[n];if(mt(t)){const i=e[t];xe(i)&&Bn(o,i)}else if(xe(t))Bn(o,t.bind(r));else if(Ze(t))if(ve(t))t.forEach(i=>Q5(i,e,r,n));else{const i=xe(t.handler)?t.handler.bind(r):e[t.handler];xe(i)&&Bn(o,i,t)}}function e3(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=t.appContext,a=i.get(e);let l;return a?l=a:!o.length&&!r&&!n?l=e:(l={},o.length&&o.forEach(c=>$0(l,c,s,!0)),$0(l,e,s)),Ze(e)&&i.set(e,l),l}function $0(t,e,r,n=!1){const{mixins:o,extends:i}=e;i&&$0(t,i,r,!0),o&&o.forEach(s=>$0(t,s,r,!0));for(const s in e)if(!(n&&s==="expose")){const a=Gb[s]||r&&r[s];t[s]=a?a(t[s],e[s]):e[s]}return t}const Gb={data:Jp,props:Qp,emits:Qp,methods:Ps,computed:Ps,beforeCreate:qt,created:qt,beforeMount:qt,mounted:qt,beforeUpdate:qt,updated:qt,beforeDestroy:qt,beforeUnmount:qt,destroyed:qt,unmounted:qt,activated:qt,deactivated:qt,errorCaptured:qt,serverPrefetch:qt,components:Ps,directives:Ps,watch:Zb,provide:Jp,inject:Kb};function Jp(t,e){return e?t?function(){return Lt(xe(t)?t.call(this,this):t,xe(e)?e.call(this,this):e)}:e:t}function Kb(t,e){return Ps(hd(t),hd(e))}function hd(t){if(ve(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function qt(t,e){return t?[...new Set([].concat(t,e))]:e}function Ps(t,e){return t?Lt(Object.create(null),t,e):e}function Qp(t,e){return t?ve(t)&&ve(e)?[...new Set([...t,...e])]:Lt(Object.create(null),Xp(t),Xp(e??{})):e}function Zb(t,e){if(!t)return e;if(!e)return t;const r=Lt(Object.create(null),t);for(const n in e)r[n]=qt(t[n],e[n]);return r}function t3(){return{app:null,config:{isNativeTag:w5,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Xb=0;function Yb(t,e){return function(n,o=null){xe(n)||(n=Lt({},n)),o!=null&&!Ze(o)&&(o=null);const i=t3(),s=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Xb++,_component:n,_props:o,_container:null,_context:i,_instance:null,version:sm,get config(){return i.config},set config(u){},use(u,...d){return s.has(u)||(u&&xe(u.install)?(s.add(u),u.install(c,...d)):xe(u)&&(s.add(u),u(c,...d))),c},mixin(u){return __VUE_OPTIONS_API__&&(i.mixins.includes(u)||i.mixins.push(u)),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!l){const p=c._ceVNode||Br(n,o);return p.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),t(p,u,h),l=!0,c._container=u,u.__vue_app__=c,__VUE_PROD_DEVTOOLS__&&(c._instance=p.component,bb(c,sm)),th(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Vr(a,c._instance,16),t(null,c._container),__VUE_PROD_DEVTOOLS__&&(c._instance=null,wb(c)),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=zi;zi=c;try{return u()}finally{zi=d}}};return c}}let zi=null;const Jb=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Nr(e)}Modifiers`]||t[`${ci(e)}Modifiers`];function Qb(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||Ke;let o=r;const i=e.startsWith("update:"),s=i&&Jb(n,e.slice(7));s&&(s.trim&&(o=r.map(u=>mt(u)?u.trim():u)),s.number&&(o=o.map(Oy))),__VUE_PROD_DEVTOOLS__&&_b(t,e,o);let a,l=n[a=du(e)]||n[a=du(Nr(e))];!l&&i&&(l=n[a=du(ci(e))]),l&&Vr(l,t,6,o);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Vr(c,t,6,o)}}const ew=new WeakMap;function r3(t,e,r=!1){const n=__VUE_OPTIONS_API__&&r?ew:e.emitsCache,o=n.get(t);if(o!==void 0)return o;const i=t.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!xe(t)){const l=c=>{const u=r3(c,e,!0);u&&(a=!0,Lt(s,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(Ze(t)&&n.set(t,null),null):(ve(i)?i.forEach(l=>s[l]=null):Lt(s,i),Ze(t)&&n.set(t,s),s)}function Tc(t,e){return!t||!bc(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),De(t,e[0].toLowerCase()+e.slice(1))||De(t,ci(e))||De(t,e))}function em(t){const{type:e,vnode:r,proxy:n,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:c,renderCache:u,props:d,data:h,setupState:p,ctx:g,inheritAttrs:y}=t,v=z0(t);let w,C;try{if(r.shapeFlag&4){const A=o||n,I=A;w=tn(c.call(I,A,u,d,p,h,g)),C=a}else{const A=e;w=tn(A.length>1?A(d,{attrs:a,slots:s,emit:l}):A(d,null)),C=e.props?a:tw(a)}}catch(A){Ni.length=0,kc(A,t,1),w=Br(mn)}let k=w;if(C&&y!==!1){const A=Object.keys(C),{shapeFlag:I}=k;A.length&&I&7&&(i&&A.some(wc)&&(C=rw(C,i)),k=Ui(k,C,!1,!0))}if(r.dirs&&(k=Ui(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(r.dirs):r.dirs),r.transition){const A=Sc(k.type)&&X5(k)||k;N0(A,r.transition)}return w=k,z0(v),w}function n3(t,e=!0){let r;for(let n=0;n<t.length;n++){const o=t[n];if(ba(o)){if(o.type!==mn||o.children==="v-if"){if(r)return;r=o}}else return}return r}const tw=t=>{let e;for(const r in t)(r==="class"||r==="style"||bc(r))&&((e||(e={}))[r]=t[r]);return e},rw=(t,e)=>{const r={};for(const n in t)(!wc(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function nw(t,e,r){const{props:n,children:o,component:i}=t,{props:s,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?tm(n,s,c):!!s;if(l&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(o3(s,n,h)&&!Tc(c,h))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:n===s?!1:n?s?tm(n,s,c):!0:!!s;return!1}function tm(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let o=0;o<n.length;o++){const i=n[o];if(!De(t,i)||o3(e,t,i)&&!Tc(r,i))return!0}return!1}function o3(t,e,r){const n=t[r],o=e[r];return r==="style"&&Ze(n)&&Ze(o)?!Cc(n,o):n!==o}function ow({vnode:t,parent:e,suspense:r},n){for(;e;){const o=e.subTree;if(o.suspense&&o.suspense.activeBranch===t&&(o.suspense.vnode.el=o.el=n,t=o),o===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const i3={},s3=()=>Object.create(i3),a3=t=>Object.getPrototypeOf(t)===i3;function iw(t,e,r,n=!1){const o={},i=s3();t.propsDefaults=Object.create(null),l3(t,e,o,i);for(const s in t.propsOptions[0])s in o||(o[s]=void 0);r?t.props=n?o:sb(o):t.type.props?t.props=o:t.props=i,t.attrs=i}function sw(t,e,r,n){const{props:o,attrs:i,vnode:{patchFlag:s}}=t,a=Ne(o),[l]=t.propsOptions;let c=!1;if((n||s>0)&&!(s&16)){if(s&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(Tc(t.emitsOptions,h))continue;const p=e[h];if(l)if(De(i,h))p!==i[h]&&(i[h]=p,c=!0);else{const g=Nr(h);o[g]=fd(l,a,g,p,t,!1)}else p!==i[h]&&(i[h]=p,c=!0)}}}else{l3(t,e,o,i)&&(c=!0);let u;for(const d in a)(!e||!De(e,d)&&((u=ci(d))===d||!De(e,u)))&&(l?r&&(r[d]!==void 0||r[u]!==void 0)&&(o[d]=fd(l,a,d,void 0,t,!0)):delete o[d]);if(i!==a)for(const d in i)(!e||!De(e,d))&&(delete i[d],c=!0)}c&&Ln(t.attrs,"set","")}function l3(t,e,r,n){const[o,i]=t.propsOptions;let s=!1,a;if(e)for(let l in e){if(oa(l))continue;const c=e[l];let u;o&&De(o,u=Nr(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Tc(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,s=!0)}if(i){const l=Ne(r),c=a||Ke;for(let u=0;u<i.length;u++){const d=i[u];r[d]=fd(o,l,d,c[d],t,!De(c,d))}}return s}function fd(t,e,r,n,o,i){const s=t[r];if(s!=null){const a=De(s,"default");if(a&&n===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&xe(l)){const{propsDefaults:c}=o;if(r in c)n=c[r];else{const u=qa(o);n=c[r]=l.call(null,e),u()}}else n=l;o.ce&&o.ce._setProp(r,n)}s[0]&&(i&&!a?n=!1:s[1]&&(n===""||n===ci(r))&&(n=!0))}return n}const aw=new WeakMap;function c3(t,e,r=!1){const n=__VUE_OPTIONS_API__&&r?aw:e.propsCache,o=n.get(t);if(o)return o;const i=t.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!xe(t)){const u=d=>{l=!0;const[h,p]=c3(d,e,!0);Lt(s,h),p&&a.push(...p)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return Ze(t)&&n.set(t,Oi),Oi;if(ve(i))for(let u=0;u<i.length;u++){const d=Nr(i[u]);rm(d)&&(s[d]=Ke)}else if(i)for(const u in i){const d=Nr(u);if(rm(d)){const h=i[u],p=s[d]=ve(h)||xe(h)?{type:h}:Lt({},h),g=p.type;let y=!1,v=!0;if(ve(g))for(let w=0;w<g.length;++w){const C=g[w],k=xe(C)&&C.name;if(k==="Boolean"){y=!0;break}else k==="String"&&(v=!1)}else y=xe(g)&&g.name==="Boolean";p[0]=y,p[1]=v,(y||De(p,"default"))&&a.push(d)}}const c=[s,a];return Ze(t)&&n.set(t,c),c}function rm(t){return t[0]!=="$"&&!oa(t)}const J1=t=>t==="_"||t==="_ctx"||t==="$stable",Q1=t=>ve(t)?t.map(tn):[tn(t)],lw=(t,e,r)=>{if(e._n)return e;const n=Sb((...o)=>Q1(e(...o)),r);return n._c=!1,n},u3=(t,e,r)=>{const n=t._ctx;for(const o in t){if(J1(o))continue;const i=t[o];if(xe(i))e[o]=lw(o,i,n);else if(i!=null){const s=Q1(i);e[o]=()=>s}}},d3=(t,e)=>{const r=Q1(e);t.slots.default=()=>r},h3=(t,e,r)=>{for(const n in e)(r||!J1(n))&&(t[n]=e[n])},cw=(t,e,r)=>{const n=t.slots=s3();if(t.vnode.shapeFlag&32){const o=e._;o?(h3(n,e,r),r&&O0(n,"_",o,!0)):u3(e,n)}else e&&d3(t,e)},uw=(t,e,r)=>{const{vnode:n,slots:o}=t;let i=!0,s=Ke;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:h3(o,e,r):(i=!e.$stable,u3(e,o)),s=e}else e&&(d3(t,e),s={default:1});if(i)for(const a in o)!J1(a)&&s[a]==null&&delete o[a]};function dw(){typeof __VUE_OPTIONS_API__!="boolean"&&(Jo().__VUE_OPTIONS_API__=!0),typeof __VUE_PROD_DEVTOOLS__!="boolean"&&(Jo().__VUE_PROD_DEVTOOLS__=!1),typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__!="boolean"&&(Jo().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1)}const Yt=gw;function hw(t){return fw(t)}function fw(t,e){dw();const r=Jo();r.__VUE__=!0,__VUE_PROD_DEVTOOLS__&&U5(r.__VUE_DEVTOOLS_GLOBAL_HOOK__,r);const{insert:n,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:p=zr,insertStaticContent:g}=t,y=(_,E,B,j=null,F=null,W=null,Q=void 0,Y=null,X=!!E.dynamicChildren)=>{if(_===E)return;_&&!As(_,E)&&(j=Zt(_),ut(_,F,W,!0),_=null),E.patchFlag===-2&&(X=!1,E.dynamicChildren=null),E.dynamicChildren&&_&&_.dynamicChildren&&_.dynamicChildren.hasOnce&&(E.dynamicChildren===Oi&&(E.dynamicChildren=[]),E.dynamicChildren.hasOnce=!0);const{type:q,ref:ae,shapeFlag:ee}=E;switch(q){case $a:v(_,E,B,j);break;case mn:w(_,E,B,j);break;case Pl:_==null&&C(E,B,j,Q);break;case Ie:N(_,E,B,j,F,W,Q,Y,X);break;default:ee&1?I(_,E,B,j,F,W,Q,Y,X):ee&6?ye(_,E,B,j,F,W,Q,Y,X):(ee&64||ee&128)&&q.process(_,E,B,j,F,W,Q,Y,X,Ht)}ae!=null&&F?aa(ae,_&&_.ref,W,E||_,!E):ae==null&&_&&_.ref!=null&&aa(_.ref,null,W,_,!0)},v=(_,E,B,j)=>{if(_==null)n(E.el=a(E.children),B,j);else{const F=E.el=_.el;E.children!==_.children&&c(F,E.children)}},w=(_,E,B,j)=>{_==null?n(E.el=l(E.children||""),B,j):E.el=_.el},C=(_,E,B,j)=>{[_.el,_.anchor]=g(_.children,E,B,j,_.el,_.anchor)},k=({el:_,anchor:E},B,j)=>{let F;for(;_&&_!==E;)F=h(_),n(_,B,j),_=F;n(E,B,j)},A=({el:_,anchor:E})=>{let B;for(;_&&_!==E;)B=h(_),o(_),_=B;o(E)},I=(_,E,B,j,F,W,Q,Y,X)=>{if(E.type==="svg"?Q="svg":E.type==="math"&&(Q="mathml"),_==null)R(E,B,j,F,W,Q,Y,X);else{const q=_.el&&_.el._isVueCE?_.el:null;try{q&&q._beginPatch(),P(_,E,F,W,Q,Y,X)}finally{q&&q._endPatch()}}},R=(_,E,B,j,F,W,Q,Y)=>{let X,q;const{props:ae,shapeFlag:ee,transition:se,dirs:ue}=_;if(X=_.el=s(_.type,W,ae&&ae.is,ae),ee&8?u(X,_.children):ee&16&&O(_.children,X,null,j,F,bu(_,W),Q,Y),ue&&Io(_,null,j,"created"),H(X,_,_.scopeId,Q,j),ae){for(const Le in ae)Le!=="value"&&!oa(Le)&&i(X,Le,null,ae[Le],W,j);"value"in ae&&i(X,"value",null,ae.value,W),(q=ae.onVnodeBeforeMount)&&Gr(q,j,_)}__VUE_PROD_DEVTOOLS__&&(O0(X,"__vnode",_,!0),O0(X,"__vueParentComponent",j,!0)),ue&&Io(_,null,j,"beforeMount");const _e=pw(F,se);_e&&se.beforeEnter(X),n(X,E,B),((q=ae&&ae.onVnodeMounted)||_e||ue)&&Yt(()=>{q&&Gr(q,j,_),_e&&se.enter(X),ue&&Io(_,null,j,"mounted")},F)},H=(_,E,B,j,F)=>{if(B&&p(_,B),j)for(let W=0;W<j.length;W++)p(_,j[W]);if(F){let W=F.subTree;if(E===W||m3(W.type)&&(W.ssContent===E||W.ssFallback===E)){const Q=F.vnode;H(_,Q,Q.scopeId,Q.slotScopeIds,F.parent)}}},O=(_,E,B,j,F,W,Q,Y,X=0)=>{for(let q=X;q<_.length;q++){const ae=_[q]=Y?En(_[q]):tn(_[q]);y(null,ae,E,B,j,F,W,Q,Y)}},P=(_,E,B,j,F,W,Q)=>{const Y=E.el=_.el;__VUE_PROD_DEVTOOLS__&&(Y.__vnode=E);let{patchFlag:X,dynamicChildren:q,dirs:ae}=E;X|=_.patchFlag&16;const ee=_.props||Ke,se=E.props||Ke;let ue;if(B&&Lo(B,!1),(ue=se.onVnodeBeforeUpdate)&&Gr(ue,B,E,_),ae&&Io(E,_,B,"beforeUpdate"),B&&Lo(B,!0),q&&(!_.dynamicChildren||_.dynamicChildren.length!==q.length)&&(X=0,Q=!1,q=null),(ee.innerHTML&&se.innerHTML==null||ee.textContent&&se.textContent==null)&&u(Y,""),q?$(_.dynamicChildren,q,Y,B,j,bu(E,F),W):Q||fe(_,E,Y,null,B,j,bu(E,F),W,!1),X>0){if(X&16)ie(Y,ee,se,B,F);else if(X&2&&ee.class!==se.class&&i(Y,"class",null,se.class,F),X&4&&i(Y,"style",ee.style,se.style,F),X&8){const _e=E.dynamicProps;for(let Le=0;Le<_e.length;Le++){const Ee=_e[Le],We=ee[Ee],Ye=se[Ee];(Ye!==We||Ee==="value")&&i(Y,Ee,We,Ye,F,B)}}X&1&&_.children!==E.children&&u(Y,E.children)}else!Q&&q==null&&ie(Y,ee,se,B,F);((ue=se.onVnodeUpdated)||ae)&&Yt(()=>{ue&&Gr(ue,B,E,_),ae&&Io(E,_,B,"updated")},j)},$=(_,E,B,j,F,W,Q)=>{for(let Y=0;Y<E.length;Y++){const X=_[Y],q=E[Y],ae=X.el||pd(X),ee=ae&&(X.type===Ie||!As(X,q)||X.shapeFlag&198)?d(ae):B;y(X,q,ee,null,j,F,W,Q,!0)}},ie=(_,E,B,j,F)=>{if(E!==B){if(E!==Ke)for(const W in E)!oa(W)&&!(W in B)&&i(_,W,E[W],null,F,j);for(const W in B){if(oa(W))continue;const Q=B[W],Y=E[W];Q!==Y&&W!=="value"&&i(_,W,Y,Q,F,j)}"value"in B&&i(_,"value",E.value,B.value,F)}},N=(_,E,B,j,F,W,Q,Y,X)=>{const q=E.el=_?_.el:a(""),ae=E.anchor=_?_.anchor:a("");let{patchFlag:ee,dynamicChildren:se,slotScopeIds:ue}=E;ue&&(Y=Y?Y.concat(ue):ue),_==null?(n(q,B,j),n(ae,B,j),O(E.children||[],B,ae,F,W,Q,Y,X)):ee>0&&ee&64&&se&&_.dynamicChildren&&_.dynamicChildren.length===se.length?($(_.dynamicChildren,se,B,F,W,Q,Y),(E.key!=null||F&&E===F.subTree)&&f3(_,E,!0)):fe(_,E,B,ae,F,W,Q,Y,X)},ye=(_,E,B,j,F,W,Q,Y,X)=>{E.slotScopeIds=Y,_==null?E.shapeFlag&512?F.ctx.activate(E,B,j,Q,X):be(E,B,j,F,W,Q,X):Fe(_,E,X)},be=(_,E,B,j,F,W,Q)=>{const Y=_.component=Sw(_,j,F);if(Y1(_)&&(Y.ctx.renderer=Ht),Tw(Y,!1,Q),Y.asyncDep){if(F&&F.registerDep(Y,ke,Q,W),!_.el){const X=Y.subTree=Br(mn);w(null,X,E,B),_.placeholder=X.el}}else ke(Y,_,E,B,F,W,Q)},Fe=(_,E,B)=>{const j=E.component=_.component;if(nw(_,E,B))if(j.asyncDep&&!j.asyncResolved){E.el=_.el,E.placeholder=_.placeholder,we(j,E,B);return}else j.next=E,j.update();else E.el=_.el,E.placeholder=_.placeholder,j.vnode=E},ke=(_,E,B,j,F,W,Q)=>{const Y=()=>{if(_.isMounted){let{next:ee,bu:se,u:ue,parent:_e,vnode:Le}=_;{const nr=p3(_);if(nr){ee&&(ee.el=Le.el,we(_,ee,Q)),nr.asyncDep.then(()=>{Yt(()=>{_.isUnmounted||q()},F)});return}}let Ee=ee,We;Lo(_,!1),ee?(ee.el=Le.el,we(_,ee,Q)):ee=Le,se&&hu(se),(We=ee.props&&ee.props.onVnodeBeforeUpdate)&&Gr(We,_e,ee,Le),Lo(_,!0);const Ye=em(_),rr=_.subTree;_.subTree=Ye,y(rr,Ye,d(rr.el),Zt(rr),_,F,W),ee.el=Ye.el,Ee===null&&ow(_,Ye.el),ue&&Yt(ue,F),(We=ee.props&&ee.props.onVnodeUpdated)&&Yt(()=>Gr(We,_e,ee,Le),F),__VUE_PROD_DEVTOOLS__&&G5(_)}else{let ee;const{el:se,props:ue}=E,{bm:_e,m:Le,parent:Ee,root:We,type:Ye}=_,rr=la(E);Lo(_,!1),_e&&hu(_e),!rr&&(ee=ue&&ue.onVnodeBeforeMount)&&Gr(ee,Ee,E),Lo(_,!0);{We.ce&&We.ce._hasShadowRoot()&&We.ce._injectChildStyle(Ye,_.parent?_.parent.type:void 0);const nr=_.subTree=em(_);y(null,nr,B,j,_,F,W),E.el=nr.el}if(Le&&Yt(Le,F),!rr&&(ee=ue&&ue.onVnodeMounted)){const nr=E;Yt(()=>Gr(ee,Ee,nr),F)}(E.shapeFlag&256||Ee&&la(Ee.vnode)&&Ee.vnode.shapeFlag&256)&&_.a&&Yt(_.a,F),_.isMounted=!0,__VUE_PROD_DEVTOOLS__&&xb(_),E=B=j=null}};_.scope.on();const X=_.effect=new _5(Y);_.scope.off();const q=_.update=X.run.bind(X),ae=_.job=X.runIfDirty.bind(X);ae.i=_,ae.id=_.uid,X.scheduler=()=>K1(ae),Lo(_,!0),q()},we=(_,E,B)=>{E.component=_;const j=_.vnode.props;_.vnode=E,_.next=null,sw(_,E.props,j,B),uw(_,E.children,B),hn(),V5(_),fn()},fe=(_,E,B,j,F,W,Q,Y,X=!1)=>{const q=_&&_.children,ae=_?_.shapeFlag:0,ee=E.children,{patchFlag:se,shapeFlag:ue}=E;if(se>0){if(se&128){kt(q,ee,B,j,F,W,Q,Y,X);return}else if(se&256){rt(q,ee,B,j,F,W,Q,Y,X);return}}ue&8?(ae&16&&Ur(q,F,W),ee!==q&&u(B,ee)):ae&16?ue&16?kt(q,ee,B,j,F,W,Q,Y,X):Ur(q,F,W,!0):(ae&8&&u(B,""),ue&16&&O(ee,B,j,F,W,Q,Y,X))},rt=(_,E,B,j,F,W,Q,Y,X)=>{_=_||Oi,E=E||Oi;const q=_.length,ae=E.length,ee=Math.min(q,ae);let se;for(se=0;se<ee;se++){const ue=E[se]=X?En(E[se]):tn(E[se]);y(_[se],ue,B,null,F,W,Q,Y,X)}q>ae?Ur(_,F,W,!0,!1,ee):O(E,B,j,F,W,Q,Y,X,ee)},kt=(_,E,B,j,F,W,Q,Y,X)=>{let q=0;const ae=E.length;let ee=_.length-1,se=ae-1;for(;q<=ee&&q<=se;){const ue=_[q],_e=E[q]=X?En(E[q]):tn(E[q]);if(As(ue,_e))y(ue,_e,B,null,F,W,Q,Y,X);else break;q++}for(;q<=ee&&q<=se;){const ue=_[ee],_e=E[se]=X?En(E[se]):tn(E[se]);if(As(ue,_e))y(ue,_e,B,null,F,W,Q,Y,X);else break;ee--,se--}if(q>ee){if(q<=se){const ue=se+1,_e=ue<ae?E[ue].el:j;for(;q<=se;)y(null,E[q]=X?En(E[q]):tn(E[q]),B,_e,F,W,Q,Y,X),q++}}else if(q>se)for(;q<=ee;)ut(_[q],F,W,!0),q++;else{const ue=q,_e=q,Le=new Map;for(q=_e;q<=se;q++){const Rt=E[q]=X?En(E[q]):tn(E[q]);Rt.key!=null&&Le.set(Rt.key,q)}let Ee,We=0;const Ye=se-_e+1;let rr=!1,nr=0;const Un=new Array(Ye);for(q=0;q<Ye;q++)Un[q]=0;for(q=ue;q<=ee;q++){const Rt=_[q];if(We>=Ye){ut(Rt,F,W,!0);continue}let or;if(Rt.key!=null)or=Le.get(Rt.key);else for(Ee=_e;Ee<=se;Ee++)if(Un[Ee-_e]===0&&As(Rt,E[Ee])){or=Ee;break}or===void 0?ut(Rt,F,W,!0):(Un[or-_e]=q+1,or>=nr?nr=or:rr=!0,y(Rt,E[or],B,null,F,W,Q,Y,X),We++)}const ws=rr?mw(Un):Oi;for(Ee=ws.length-1,q=Ye-1;q>=0;q--){const Rt=_e+q,or=E[Rt],xs=E[Rt+1],Cs=Rt+1<ae?xs.el||pd(xs):j;Un[q]===0?y(null,or,B,Cs,F,W,Q,Y,X):rr&&(Ee<0||q!==ws[Ee]?vt(or,B,Cs,2):Ee--)}}},vt=(_,E,B,j,F=null)=>{const{el:W,type:Q,transition:Y,children:X,shapeFlag:q}=_;if(q&6){vt(_.component.subTree,E,B,j);return}if(q&128){_.suspense.move(E,B,j);return}if(q&64){Q.move(_,E,B,Ht);return}if(Q===Ie){n(W,E,B);for(let ee=0;ee<X.length;ee++)vt(X[ee],E,B,j);n(_.anchor,E,B);return}if(Q===Pl){k(_,E,B);return}if(j!==2&&q&1&&Y)if(j===0)Y.persisted&&!W[vu]?n(W,E,B):(Y.beforeEnter(W),n(W,E,B),Yt(()=>Y.enter(W),F));else{const{leave:ee,delayLeave:se,afterLeave:ue}=Y,_e=()=>{_.ctx.isUnmounted?o(W):n(W,E,B)},Le=()=>{const Ee=W._isLeaving||!!W[vu];W._isLeaving&&W[vu](!0),Y.persisted&&!Ee?_e():ee(W,()=>{_e(),ue&&ue()})};se?se(W,_e,Le):Le()}else n(W,E,B)},ut=(_,E,B,j=!1,F=!1)=>{const{type:W,props:Q,ref:Y,children:X,dynamicChildren:q,shapeFlag:ae,patchFlag:ee,dirs:se,cacheIndex:ue,memo:_e}=_;if((ee===-2||q&&q.hasOnce)&&(F=!1),Y!=null&&(hn(),aa(Y,null,B,_,!0),fn()),ue!=null&&(!_.ctx||_.ctx===E)&&(E.renderCache[ue]=void 0),ae&256){E.ctx.deactivate(_);return}const Le=ae&1&&se,Ee=!la(_);let We;if(Ee&&(We=Q&&Q.onVnodeBeforeUnmount)&&Gr(We,E,_),ae&6)Mo(_.component,B,j);else{if(ae&128){_.suspense.unmount(B,j);return}Le&&Io(_,null,E,"beforeUnmount"),ae&64?_.type.remove(_,E,B,Ht,j):q&&!q.hasOnce&&(W!==Ie||ee>0&&ee&64)?Ur(q,E,B,!1,!0):(W===Ie&&ee&384||!F&&ae&16)&&Ur(X,E,B),j&&Et(_)}const Ye=_e!=null&&ue==null;(Ee&&(We=Q&&Q.onVnodeUnmounted)||Le||Ye)&&Yt(()=>{We&&Gr(We,E,_),Le&&Io(_,null,E,"unmounted"),Ye&&(_.el=null)},B)},Et=_=>{const{type:E,el:B,anchor:j,transition:F}=_,W=E===Ie;if(W&&!F){jr(B,j);return}if(E===Pl){A(_),F&&!F.persisted&&F.afterLeave&&F.afterLeave();return}const Q=W?cd(_):_,Y=()=>{W?d(B)&&jr(B,j):o(B),F&&!F.persisted&&F.afterLeave&&F.afterLeave()};if(Q&&Q.shapeFlag&1&&F&&!F.persisted){const{leave:X,delayLeave:q}=F,ae=Q.el,ee=()=>X(ae,Y);q?q(ae,Y,ee):ee()}else Y()},jr=(_,E)=>{let B;for(;_!==E;)B=h(_),o(_),_=B;o(E)},Mo=(_,E,B)=>{const{bum:j,scope:F,job:W,subTree:Q,um:Y,m:X,a:q}=_;nm(X),nm(q),j&&hu(j),F.stop(),W?(W.flags|=8,ut(Q,_,E,B)):_.vnode.el&&Q&&(Q.transition=_.vnode.transition,ut(Q,_,E,B)),Y&&Yt(Y,E),Yt(()=>{_.isUnmounted=!0},E),__VUE_PROD_DEVTOOLS__&&kb(_)},Ur=(_,E,B,j=!1,F=!1,W=0)=>{for(let Q=W;Q<_.length;Q++)ut(_[Q],E,B,j,F)},Zt=_=>{if(_.shapeFlag&6)return Zt(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const E=h(_.anchor||_.el),B=E&&E[Ib];return B?h(B):E},jn=(_,E,B)=>{const j=_&&E._vnode?void 0:_&&_.component?_.component.uid:_w();yb(()=>{_==null?E._vnode&&ut(E._vnode,null,null,!0):y(E._vnode||null,_,E,null,null,null,B),E._vnode=_},j)},Ht={p:y,um:ut,m:vt,r:Et,mt:be,mc:O,pc:fe,pbc:$,n:Zt,o:t};return{render:jn,hydrate:void 0,createApp:Yb(jn)}}function bu({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function Lo({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function pw(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function f3(t,e,r=!1){const n=t.children,o=e.children;if(ve(n)&&ve(o))for(let i=0;i<n.length;i++){const s=n[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=En(o[i]),a.el=s.el),!r&&a.patchFlag!==-2&&f3(s,a)),a.type===$a&&(a.patchFlag===-1&&(a=o[i]=En(a)),a.el=s.el),a.type===mn&&!a.el&&(a.el=s.el)}}function mw(t){const e=t.slice(),r=[0];let n,o,i,s,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(o=r[r.length-1],t[o]<c){e[n]=o,r.push(n);continue}for(i=0,s=r.length-1;i<s;)a=i+s>>1,t[r[a]]<c?i=a+1:s=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,s=r[i-1];i-- >0;)r[i]=s,s=e[s];return r}function p3(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:p3(e)}function nm(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function pd(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?pd(e.subTree):null}const m3=t=>t.__isSuspense;function gw(t,e){e&&e.pendingBranch?ve(t)?e.effects.push(...t):e.effects.push(t):vb(t)}const Ie=Symbol.for("v-fgt"),$a=Symbol.for("v-txt"),mn=Symbol.for("v-cmt"),Pl=Symbol.for("v-stc"),Ni=[];let On=null;function vw(){Ni.pop(),On=Ni[Ni.length-1]||null}let eh=1;function q0(t,e=!1){eh+=t,t<0&&On&&e&&(On.hasOnce=!0)}function ba(t){return t?t.__v_isVNode===!0:!1}function As(t,e){return t.type===e.type&&t.key===e.key}const g3=({key:t})=>t??null,Dl=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?mt(t)||zt(t)||xe(t)?{i:sn,r:t,k:e,f:!!r}:t:null);function yw(t,e=null,r=null,n=0,o=null,i=t===Ie?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&g3(e),ref:e&&Dl(e),scopeId:K5,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:sn};return a?(F0(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=mt(r)?8:16),eh>0&&!s&&On&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&On.push(l),l}const Br=bw;function bw(t,e=null,r=null,n=0,o=null,i=!1){if((!t||t===Vb)&&(t=mn),ba(t)){const a=Ui(t,e,!0);return r&&F0(a,r),eh>0&&!i&&On&&(a.shapeFlag&6?On[On.indexOf(t)]=a:On.push(a)),a.patchFlag=-2,a}if(Lw(t)&&(t=t.__vccOpts),e){e=ww(e);let{class:a,style:l}=e;a&&!mt(a)&&(e.class=N1(a)),Ze(l)&&(G1(l)&&!ve(l)&&(l=Lt({},l)),e.style=z1(l))}const s=mt(t)?1:m3(t)?128:Sc(t)?64:Ze(t)?4:xe(t)?2:0;return yw(t,e,r,n,o,s,i,!0)}function ww(t){return t?G1(t)||a3(t)?Lt({},t):t:null}function Ui(t,e,r=!1,n=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=t,c=e?Cw(o||{},e):o,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&g3(c),ref:e&&e.ref?r&&i?ve(i)?i.concat(Dl(e)):[i,Dl(e)]:Dl(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ie?s===-1?16:s|16:s,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ui(t.ssContent),ssFallback:t.ssFallback&&Ui(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce,cacheIndex:t.cacheIndex};return l&&n&&N0(u,l.clone(u)),u}function xw(t=" ",e=0){return Br($a,null,t,e)}function tn(t){return t==null||typeof t=="boolean"?Br(mn):ve(t)?Br(Ie,null,t.slice()):ba(t)?En(t):Br($a,null,String(t))}function En(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ui(t)}function F0(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(ve(e))r=16;else if(typeof e=="object")if(n&65){const o=e.default;o&&(o._c&&(o._d=!1),F0(t,o()),o._c&&(o._d=!0));return}else{r=32;const o=e._;!o&&!a3(e)?e._ctx=sn:o===3&&sn&&(sn.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else if(xe(e)){if(n&65){F0(t,{default:e});return}e={default:e,_ctx:sn},r=32}else e=String(e),n&64?(r=16,e=[xw(e)]):r=8;t.children=e,t.shapeFlag|=r}function Cw(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const o in n)if(o==="class")e.class!==n.class&&(e.class=N1([e.class,n.class]));else if(o==="style")e.style=z1([e.style,n.style]);else if(bc(o)){const i=e[o],s=n[o];s&&i!==s&&!(ve(i)&&i.includes(s))?e[o]=i?[].concat(i,s):s:s==null&&i==null&&!wc(o)&&(e[o]=s)}else o!==""&&(e[o]=n[o])}return e}function Gr(t,e,r,n=null){Vr(t,e,7,[r,n])}const kw=t3();let v3=0;function _w(){return v3}function Sw(t,e,r){const n=t.type,o=(e?e.appContext:t.appContext)||kw,i={uid:v3++,vnode:t,type:n,parent:e,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Fy(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(o.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:c3(n,o),emitsOptions:r3(n,o),emit:null,emitted:null,propsDefaults:Ke,inheritAttrs:n.inheritAttrs,ctx:Ke,data:Ke,props:Ke,attrs:Ke,slots:Ke,refs:Ke,setupState:Ke,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Qb.bind(null,i),t.ce&&t.ce(i),i}let Ut=null;const Aw=()=>Ut||sn;let V0,wa;{const t=Jo(),e=(r,n)=>{let o;return(o=t[r])||(o=t[r]=[]),o.push(n),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};V0=e("__VUE_INSTANCE_SETTERS__",r=>Ut=r),wa=e("__VUE_SSR_SETTERS__",r=>xa=r)}const qa=t=>{const e=Ut;return V0(t),t.scope.on(),()=>{t.scope.off(),V0(e)}},om=()=>{Ut&&Ut.scope.off(),V0(null)};function y3(t){return t.vnode.shapeFlag&4}let xa=!1;function Tw(t,e=!1,r=!1){e&&wa(e);const{props:n,children:o}=t.vnode,i=y3(t);iw(t,n,i,e),cw(t,o,r||e);const s=i?Mw(t,e):void 0;return e&&wa(!1),s}function Mw(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Wb);const{setup:n}=r;if(n){hn();const o=t.setupContext=n.length>1?Iw(t):null,i=qa(t),s=Ha(n,t,0,[t.props,o]),a=x5(s);if(fn(),i(),(a||t.sp)&&!la(t)&&Y5(t),a){if(s.then(om,om),e)return s.then(l=>{wa(!0);try{im(t,l,e)}finally{wa(!1)}}).catch(l=>{kc(l,t,0)});t.asyncDep=s}else im(t,s)}else b3(t)}function im(t,e,r){xe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ze(e)&&(__VUE_PROD_DEVTOOLS__&&(t.devtoolsRawSetupState=e),t.setupState=$5(e)),b3(t)}function b3(t,e,r){const n=t.type;if(t.render||(t.render=n.render||zr),__VUE_OPTIONS_API__){const o=qa(t);hn();try{jb(t)}finally{fn(),o()}}}const Ew={get(t,e){return Pt(t,"get",""),t[e]}};function Iw(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Ew),slots:t.slots,emit:t.emit,expose:e}}function th(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy($5(ab(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in ca)return ca[r](t)},has(e,r){return r in e||r in ca}})):t.proxy}function Lw(t){return xe(t)&&"__vccOpts"in t}const dr=(t,e)=>hb(t,e,xa);function M(t,e,r){try{q0(-1);const n=arguments.length;return n===2?Ze(e)&&!ve(e)?ba(e)?Br(t,null,[e]):Br(t,e):Br(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&ba(r)&&(r=[r]),Br(t,e,r))}finally{q0(1)}}const sm="3.5.44";let md;const am=typeof window<"u"&&window.trustedTypes;if(am)try{md=am.createPolicy("vue",{createHTML:t=>t})}catch{}const w3=md?t=>md.createHTML(t):t=>t,Rw="http://www.w3.org/2000/svg",Ow="http://www.w3.org/1998/Math/MathML",Mn=typeof document<"u"?document:null,lm=Mn&&Mn.createElement("template"),Pw={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const o=e==="svg"?Mn.createElementNS(Rw,t):e==="mathml"?Mn.createElementNS(Ow,t):r?Mn.createElement(t,{is:r}):Mn.createElement(t);return t==="select"&&n&&n.multiple!=null&&o.setAttribute("multiple",n.multiple),o},createText:t=>Mn.createTextNode(t),createComment:t=>Mn.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Mn.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,o,i){const s=r?r.previousSibling:e.lastChild;if(o&&(o===i||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),r),!(o===i||!(o=o.nextSibling)););else{lm.innerHTML=w3(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=lm.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[s?s.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},Dw=Symbol("_vtc");function Bw(t,e,r){const n=t[Dw];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const cm=Symbol("_vod"),zw=Symbol("_vsh"),Nw=Symbol(""),Hw=/(?:^|;)\s*display\s*:/;function $w(t,e,r){const n=t.style,o=mt(r);let i=!1;if(r&&!o){if(e)if(mt(e))for(const s of e.split(";")){const a=s.slice(0,s.indexOf(":")).trim();r[a]==null&&Ds(n,a,"")}else for(const s in e)r[s]==null&&Ds(n,s,"");for(const s in r){s==="display"&&(i=!0);const a=r[s];a!=null?Fw(t,s,!mt(e)&&e?e[s]:void 0,a)||Ds(n,s,a):Ds(n,s,"")}}else if(o){if(e!==r){const s=n[Nw];s&&(r+=";"+s),n.cssText=r,i=Hw.test(r)}}else e&&t.removeAttribute("style");cm in t&&((!o||e!==r)&&(t[cm]=i?n.display:""),t[zw]&&(n.display="none"))}const sl=/\s*!important$/;function Ds(t,e,r){if(ve(r))r.forEach(n=>Ds(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))sl.test(r)?t.setProperty(e,r.replace(sl,""),"important"):t.setProperty(e,r);else{const n=qw(t,e);sl.test(r)?t.setProperty(ci(n),r.replace(sl,""),"important"):t[n]=r}}const um=["Webkit","Moz","ms"],wu={};function qw(t,e){const r=wu[e];if(r)return r;let n=Nr(e);if(n!=="filter"&&n in t)return wu[e]=n;n=C5(n);for(let o=0;o<um.length;o++){const i=um[o]+n;if(i in t)return wu[e]=i}return e}function Fw(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&mt(n)&&r===n}const dm="http://www.w3.org/1999/xlink";function hm(t,e,r,n,o,i=Hy(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(dm,e.slice(6,e.length)):t.setAttributeNS(dm,e,r):r==null||i&&!k5(r)?t.removeAttribute(e):t.setAttribute(e,i?"":go(r)?String(r):r)}function fm(t,e,r,n,o){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?w3(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let s=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=k5(r):r==null&&a==="string"?(r="",s=!0):a==="number"&&(r=0,s=!0)}try{t[e]=r}catch{}s&&t.removeAttribute(o||e)}function Vw(t,e,r,n){t.addEventListener(e,r,n)}function Ww(t,e,r,n){t.removeEventListener(e,r,n)}const pm=Symbol("_vei");function jw(t,e,r,n,o=null){const i=t[pm]||(t[pm]={}),s=i[e];if(n&&s)s.value=n;else{const[a,l]=Kw(e);if(n){const c=i[e]=Yw(n,o);Vw(t,a,c,l)}else s&&(Ww(t,a,s,l),i[e]=void 0)}}const Uw=/(Once|Passive|Capture)$/,Gw=/^on:?(?:Once|Passive|Capture)$/;function Kw(t){let e,r;for(;(r=t.match(Uw))&&!Gw.test(t);)e||(e={}),t=t.slice(0,t.length-r[1].length),e[r[1].toLowerCase()]=!0;return[t[2]===":"?t.slice(3):ci(t.slice(2)),e]}let xu=0;const Zw=Promise.resolve(),Xw=()=>xu||(Zw.then(()=>xu=0),xu=Date.now());function Yw(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;const o=r.value;if(ve(o)){const i=n.stopImmediatePropagation;n.stopImmediatePropagation=()=>{i.call(n),n._stopped=!0};const s=o.slice(),a=[n];for(let l=0;l<s.length&&!n._stopped;l++){const c=s[l];c&&Vr(c,e,5,a)}}else Vr(o,e,5,[n])};return r.value=t,r.attached=Xw(),r}const mm=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Jw=(t,e,r,n,o,i)=>{const s=o==="svg";e==="class"?Bw(t,n,s):e==="style"?$w(t,r,n):bc(e)?wc(e)||jw(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Qw(t,e,n,s))?(fm(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&hm(t,e,n,s,i,e!=="value")):t._isVueCE&&(ex(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!mt(n)))?fm(t,Nr(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),hm(t,e,n,s))};function Qw(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&mm(e)&&xe(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const o=t.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return mm(e)&&mt(r)?!1:e in t}function ex(t,e){const r=t._def.props;if(!r)return!1;const n=Nr(e);return Array.isArray(r)?r.some(o=>Nr(o)===n):Object.keys(r).some(o=>Nr(o)===n)}const tx=Lt({patchProp:Jw},Pw);let gm;function rx(){return gm||(gm=hw(tx))}const gr=((...t)=>{const e=rx().createApp(...t),{mount:r}=e;return e.mount=n=>{const o=ox(n);if(!o)return;const i=e._component;!xe(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=r(o,!1,nx(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},e});function nx(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function ox(t){return mt(t)?document.querySelector(t):t}function x3(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=x3(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Mt(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=x3(t))&&(n&&(n+=" "),n+=e);return n}function ix(...t){}ix(M);function Ft({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Ft.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Fa(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-block",...e}}),t}var sx=t=>!Pn(e=>e.type.name==="table")(t),Mc=Ve({filterNodes:sx},"blockConfig");Fa(Mc,{displayName:"Ctx<blockConfig>"});function ax(t,e,r){if(!t.dom.parentElement)return null;try{const n=t.posAtCoords({left:e.x,top:e.y})?.inside;if(n==null||n<0)return null;let o=t.state.doc.resolve(n),i=t.state.doc.nodeAt(n),s=t.nodeDOM(n);const a=l=>{const c=o.depth>=1&&o.index(o.depth)===0;if(!(l||c))return;const u=o.before(o.depth);i=t.state.doc.nodeAt(u),s=t.nodeDOM(u),o=t.state.doc.resolve(u),r(o,i)||a(!0)};return a(!r(o,i)),!s||!i?null:{node:i,$pos:o,el:s}}catch{return null}}var vm=Ls.ie&&Ls.ie_version<15||Ls.ios&&Ls.webkit_version<604,ym=20,lx=class{constructor(){this.#o=()=>{if(!this.#r)return null;const t=this.#r,e=this.#s;if(this.#n=null,e&&qr.isSelectable(t.node)){const r=qr.create(e.state.doc,t.$pos.pos);return e.dispatch(e.state.tr.setSelection(r)),e.focus(),this.#n=r,r}return null},this.#n=null,this.#r=null,this.#c=void 0,this.#t=!1,this.#l=()=>{this.#a?.({type:"hide"}),this.#r=null},this.#u=t=>{this.#r=t,this.#a?.({type:"show",active:t})},this.bind=(t,e)=>{this.#e=t,this.#a=e},this.addEvent=t=>{t.addEventListener("mousedown",this.#d),t.addEventListener("mouseup",this.#h),t.addEventListener("dragstart",this.#f),t.addEventListener("dragend",this.#p)},this.removeEvent=t=>{t.removeEventListener("mousedown",this.#d),t.removeEventListener("mouseup",this.#h),t.removeEventListener("dragstart",this.#f),t.removeEventListener("dragend",this.#p)},this.unBind=()=>{this.#a=void 0},this.#d=()=>{this.#c=this.#r?.el.getBoundingClientRect(),this.#o()},this.#h=()=>{if(!this.#t){requestAnimationFrame(()=>{this.#c&&this.#s?.focus()});return}this.#t=!1,this.#n=null},this.#f=t=>{this.#t=!0;const e=this.#s;if(!e)return;e.dom.dataset.dragging="true";const r=this.#n;if(t.dataTransfer&&r){const n=r.content();t.dataTransfer.effectAllowed="copyMove";const{dom:o,text:i}=e.serializeForClipboard(n);t.dataTransfer.clearData(),t.dataTransfer.setData(vm?"Text":"text/html",o.innerHTML),vm||t.dataTransfer.setData("text/plain",i);const s=this.#r?.el;s&&t.dataTransfer.setDragImage(s,0,0),e.dragging={slice:n,move:!0,node:r}}},this.#p=()=>{const t=this.#s;if(!t)return;this.#m(t);const e=t.dragging;window.setTimeout(()=>{t.dragging===e&&(t.dragging=null)},50)},this.keydownCallback=t=>(this.#l(),this.#t=!1,t.dom.dataset.dragging="false",!1),this.#g=ac((t,e)=>{if(!t.editable)return;const r=t.dom.getBoundingClientRect(),n=r.left+r.width/2;if(!(t.root.elementFromPoint(n,e.clientY)instanceof Element)){this.#l();return}const o=this.#i;if(!o)return;const i=ax(t,{x:n,y:e.clientY},o);if(!i){this.#l();return}this.#u(i)},200),this.mousemoveCallback=(t,e)=>(t.composing||!t.editable||this.#g(t,e),!1),this.dragoverCallback=(t,e)=>{if(this.#t){const r=this.#s?.dom.parentElement;if(!r)return!1;const n=r.scrollHeight>r.clientHeight,o=r.getBoundingClientRect();if(n){if(r.scrollTop>0&&Math.abs(e.y-o.y)<ym)return r.scrollTop=r.scrollTop>10?r.scrollTop-10:0,!1;const i=Math.round(t.dom.getBoundingClientRect().height);if(Math.round(r.scrollTop+o.height)<i&&Math.abs(e.y-(o.height+o.y))<ym)return r.scrollTop=r.scrollTop+10,!1}}return!1},this.dragenterCallback=t=>{t.dragging&&(this.#t=!0,t.dom.dataset.dragging="true")},this.dragleaveCallback=(t,e)=>{const r=e.clientX,n=e.clientY;(r<0||n<0||r>window.innerWidth||n>window.innerHeight)&&(this.#r=null,this.#m(t))},this.dropCallback=t=>(this.#m(t),!1),this.dragendCallback=t=>{this.#m(t)},this.#m=t=>{this.#t=!1,t.dom.dataset.dragging="false"}}#e;#o;#n;#r;#c;#t;get#i(){try{return this.#e?.get(Mc.key).filterNodes}catch{return}}get#s(){return this.#e?.get($e)}#a;#l;#u;#d;#h;#f;#p;#g;#m},rh=Ve(()=>new lx,"blockService"),Ec=Ve({},"blockServiceInstance");Fa(rh,{displayName:"Ctx<blockService>"});Fa(Ec,{displayName:"Ctx<blockServiceInstance>"});var Ic=Ve({},"blockSpec");Fa(Ic,{displayName:"Ctx<blockSpec>"});var nh=Je(t=>{const e=new et("MILKDOWN_BLOCK"),r=t.get(rh.key)();t.set(Ec.key,r);const n=t.get(Ic.key);return new Xe({key:e,...n,props:{...n.props,handleDOMEvents:{drop:o=>r.dropCallback(o),pointermove:(o,i)=>r.mousemoveCallback(o,i),keydown:o=>r.keydownCallback(o),dragover:(o,i)=>r.dragoverCallback(o,i),dragleave:(o,i)=>r.dragleaveCallback(o,i),dragenter:o=>r.dragenterCallback(o),dragend:o=>r.dragendCallback(o)}}})});Fa(nh,{displayName:"Prose<block>"});var cx=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;#l;#u;get active(){return this.#r}constructor(t){this.#r=null,this.#t=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#t)try{this.#d(),this.#t=!0}catch{}})},this.destroy=()=>{this.#n?.unBind(),this.#n?.removeEvent(this.#e),this.#e.remove()},this.show=e=>{const r=e.el,n=this.#o.get($e).dom,o={ctx:this.#o,active:e,editorDom:n,blockDom:this.#e},i={contextElement:r,getBoundingClientRect:()=>this.#l?this.#l(o):r.getBoundingClientRect()},s=[O1()];if(this.#a){const a=this.#a(o),l=oi(a);s.push(l)}dn(i,this.#e,{placement:this.#u?this.#u(o):"left",middleware:[...s,...this.#i],...this.#s}).then(({x:a,y:l})=>{Object.assign(this.#e.style,{left:`${a}px`,top:`${l}px`}),this.#e.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#e.dataset.show="false"},this.#o=t.ctx,this.#e=t.content,this.#a=t.getOffset,this.#l=t.getPosition,this.#u=t.getPlacement,this.#i=t.middleware??[],this.#s=t.floatingUIOptions??{},this.#c=t.root,this.hide()}#d(){const t=this.#o.get($e);(this.#c??t.dom.parentElement??document.body).appendChild(this.#e);const e=this.#o.get(Ec.key);e.bind(this.#o,r=>{r.type==="hide"?(this.hide(),this.#r=null):r.type==="show"&&(this.show(r.active),this.#r=r.active)}),this.#n=e,this.#n.addEvent(this.#e),this.#e.draggable=!0}},Lc=[Ic,Mc,rh,Ec,nh];Lc.key=Ic.key;Lc.pluginKey=nh.key;function ux(t){const e=Ve({},`${t}_SLASH_SPEC`),r=Je(o=>{const i=o.get(e.key);return new Xe({key:new et(`${t}_SLASH`),...i})}),n=[e,r];return n.key=e.key,n.pluginKey=r.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${t}`},r.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${t}`},n}var dx=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;constructor(t){this.#e=!1,this.onShow=()=>{},this.onHide=()=>{},this.#l=(e,r)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map(d=>d.$from.pos)),c=Math.max(...a.map(d=>d.$to.pos)),u=r&&r.doc.eq(s)&&r.selection.eq(i);if(this.#e||((this.#r??e.dom.parentElement??document.body).appendChild(this.element),this.#e=!0),!(o||u)){if(!this.#i(e,r)){this.hide();return}dn({getBoundingClientRect:()=>Oa(e,l,c)},this.element,{placement:"bottom-start",middleware:[O1(),oi(this.#a),...this.#o],...this.#n}).then(({x:d,y:h})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${h}px`})}).catch(console.error),this.show()}},this.#u=e=>{const r=this.getContent(e);if(!r)return!1;const n=r.at(-1);return n?Array.isArray(this.#t)?this.#t.includes(n):this.#t===n:!1},this.update=(e,r)=>{this.#s(e,r)},this.getContent=(e,r=n=>n.type.name==="paragraph")=>{const{selection:n}=e.state,{empty:o,$from:i}=n,s=e.state.selection instanceof Ce;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable,u=!Hg(r)(e.state.selection);if(!(l||c||!o||!s||u))return i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,"")},this.destroy=()=>{this.#s.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=t.content,this.#c=t.debounce??200,this.#i=t.shouldShow??this.#u,this.#t=t.trigger??"/",this.#a=t.offset,this.#o=t.middleware??[],this.#n=t.floatingUIOptions??{},this.#r=t.root,this.#s=sc(this.#l,this.#c)}#l;#u};let hx=t=>crypto.getRandomValues(new Uint8Array(t)),fx=(t,e,r)=>{let n=256-256%t.length;if(n===256){let o=t.length-1;return(i=e)=>{if(!i)return"";let s="";for(;;){let a=r(i),l=i|=0;for(;l--;)if(s+=t[a[l]&o],s.length>=i)return s}}}return(o=e)=>{if(!o)return"";let i="",s=Math.ceil(1.6*256*o/n);for(;;){let a=r(s),l=s;for(;l--;)if(a[l]<n&&(i+=t[a[l]%t.length],i.length>=o))return i}}},Rc=(t,e=21)=>fx(t,e|0,hx);var px=Object.defineProperty,bm=Object.getOwnPropertySymbols,mx=Object.prototype.hasOwnProperty,gx=Object.prototype.propertyIsEnumerable,wm=(t,e,r)=>e in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vx=(t,e)=>{for(var r in e||(e={}))mx.call(e,r)&&wm(t,r,e[r]);if(bm)for(var r of bm(e))gx.call(e,r)&&wm(t,r,e[r]);return t};function Va(t,e){return Object.assign(t,{meta:vx({package:"@milkdown/components"},e)}),t}const yx={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},Wa=Ve(yx,"imageBlockConfigCtx");Va(Wa,{displayName:"Config<image-block>",group:"ImageBlock"});function bx(t){return w1(t,"paragraph",(e,r,n)=>{var o,i;if(((o=e.children)==null?void 0:o.length)!==1)return;const s=(i=e.children)==null?void 0:i[0];if(!s||s.type!=="image")return;const{url:a,alt:l,title:c}=s,u={type:"image-block",url:a,alt:l,title:c};n.children.splice(r,1,u)})}const oh=os("remark-image-block",()=>()=>bx);Va(oh.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});Va(oh.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var wx=Object.defineProperty,xm=Object.getOwnPropertySymbols,xx=Object.prototype.hasOwnProperty,Cx=Object.prototype.propertyIsEnumerable,Cm=(t,e,r)=>e in t?wx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kx=(t,e)=>{for(var r in e||(e={}))xx.call(e,r)&&Cm(t,r,e[r]);if(xm)for(var r of xm(e))Cx.call(e,r)&&Cm(t,r,e[r]);return t};const gd="image-block",ja=Wr("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${gd}"]`,getAttrs:t=>{var e;if(!(t instanceof HTMLElement))throw nc(t);return{src:t.getAttribute("src")||"",caption:t.getAttribute("caption")||"",ratio:Number((e=t.getAttribute("ratio"))!=null?e:1)}}}],toDOM:t=>["img",kx({"data-type":gd},t.attrs)],parseMarkdown:{match:({type:t})=>t==="image-block",runner:(t,e,r)=>{var n;const o=e.url,i=(n=e.title)!=null?n:"";let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),t.addNode(r,{src:o,caption:i,ratio:s})}},toMarkdown:{match:t=>t.type.name==="image-block",runner:(t,e)=>{t.openNode("paragraph"),t.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),t.closeNode()}}}));Va(ja.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function Oc(...t){}const _x=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function vd(t){return`${t}-${_x()}`}Oc(M);function ua({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}ua.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};Oc(M,Ie);const Sx=Ct({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:r,onUpload:n,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=re(!1),p=re(),g=re((u=e.value)!=null?u:""),y=vd("milkdown-image-link"),v=vd("milkdown-image-upload"),w=re(((d=e.value)==null?void 0:d.length)!==0),C=R=>{const O=R.target.value;w.value=O.length!==0,g.value=O},k=R=>{var H,O;R.key==="Enter"&&r((O=(H=p.value)==null?void 0:H.value)!=null?O:"")},A=()=>{var R,H;r((H=(R=p.value)==null?void 0:R.value)!=null?H:"")},I=R=>{var H;const O=(H=R.target.files)==null?void 0:H[0];O&&n(O).then(P=>{P&&(r(P),w.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>M("div",{class:Mt("image-edit",l)},M(ua,{icon:o,class:"image-icon"}),M("div",{class:Mt("link-importer",h.value&&"focus")},M("input",{id:y,ref:p,draggable:"true",onDragstart:R=>{R.preventDefault(),R.stopPropagation()},disabled:t.value,class:"link-input-area",value:g.value,onInput:C,onKeydown:k,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!w.value&&M("div",{class:"placeholder"},M("input",{disabled:t.value,class:"hidden",id:v,type:"file",accept:"image/*",onChange:I}),M("label",{class:"uploader",for:v},M(ua,{icon:i})),M("span",{class:"text",onClick:()=>{var R;return(R=p.value)==null?void 0:R.focus()}},a))),g.value&&M(Ie,null,M("div",{class:"image-preview"},M("img",{src:g.value,alt:"",onError:R=>Promise.resolve(c?.(R)).catch(()=>{})})),M("div",{class:"confirm",onClick:()=>A()},M(ua,{icon:s}))))}});Oc(M,Ie);const Ax=Ct({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:t,caption:e,ratio:r,readonly:n,setAttr:o,config:i}){var s;const a=re(),l=re(),c=re(!!((s=e.value)!=null&&s.length)),u=vd("milkdown-image-caption"),d=re(0),h=()=>{var k;const A=a.value;if(!A)return;const I=A.closest(".milkdown-image-block");if(!I)return;let R=I.getBoundingClientRect().width;if(!R)return;i.maxWidth&&i.maxWidth<R&&(R=i.maxWidth);const H=A.naturalHeight,O=A.naturalWidth;let P=O<R?H:R*(H/O);i.maxHeight&&P>i.maxHeight&&(P=i.maxHeight);const $=(P*((k=r.value)!=null?k:1)).toFixed(2);A.dataset.origin=P.toFixed(2),A.dataset.height=$,A.style.height=`${$}px`,i.maxWidth&&(A.style.maxWidth=`${i.maxWidth}px`)},p=k=>{k.preventDefault(),k.stopPropagation(),!n.value&&(c.value=!c.value)},g=k=>{const I=k.target.value;d.value&&window.clearTimeout(d.value),d.value=window.setTimeout(()=>{o("caption",I)},1e3)},y=k=>{const I=k.target.value;d.value&&(window.clearTimeout(d.value),d.value=0),o("caption",I)},v=k=>{k.preventDefault();const A=a.value;if(!A)return;const I=A.getBoundingClientRect().top;let R=k.clientY-I;R<100&&(R=100),i.maxHeight&&R>i.maxHeight&&(R=i.maxHeight);const H=Number(R).toFixed(2);A.dataset.height=H,A.style.height=`${H}px`},w=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w);const k=a.value;if(!k)return;const A=Number(k.dataset.origin),I=Number(k.dataset.height),R=Number.parseFloat(Number(I/A).toFixed(2));Number.isNaN(R)||o("ratio",R)},C=k=>{n.value||(k.preventDefault(),k.stopPropagation(),window.addEventListener("pointermove",v),window.addEventListener("pointerup",w))};return()=>M(Ie,null,M("div",{class:"image-wrapper"},M("div",{class:"operation"},M("div",{class:"operation-item",onPointerdown:p},M(ua,{icon:i.captionIcon}))),M("img",{ref:a,"data-type":gd,onLoad:h,src:t.value,alt:e.value,onError:k=>{var A;return Promise.resolve((A=i.onImageLoadError)==null?void 0:A.call(i,k)).catch(()=>{})}}),M("div",{ref:l,class:"image-resize-handle",onPointerdown:C})),c.value&&M("input",{id:u,draggable:"true",onDragstart:k=>{k.preventDefault(),k.stopPropagation()},class:"caption-input",placeholder:i?.captionPlaceholderText,onInput:g,onBlur:y,value:e.value}))}});var Tx=Object.defineProperty,km=Object.getOwnPropertySymbols,Mx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable,_m=(t,e,r)=>e in t?Tx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ix=(t,e)=>{for(var r in e||(e={}))Mx.call(e,r)&&_m(t,r,e[r]);if(km)for(var r of km(e))Ex.call(e,r)&&_m(t,r,e[r]);return t};Oc(M,Ie);const Lx=Ct({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e}=t;return()=>{var r;return(r=e.value)!=null&&r.length?M(Ax,Ix({},t)):M(Sx,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:n=>t.setAttr("src",n),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,onImageLoadError:t.config.onImageLoadError})}}}),C3=ko(ja.node,t=>(e,r,n)=>{const o=re(e.attrs.src),i=re(e.attrs.caption),s=re(e.attrs.ratio),a=re(!1),l=re(!r.editable),c=(v,w)=>{if(!r.editable)return;const C=n();C!=null&&r.dispatch(r.state.tr.setNodeAttribute(C,v,v==="src"?Tr.sanitize(w):w))},u=t.get(Wa.key),d=gr(Lx,{src:o,caption:i,ratio:s,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("div");h.className="milkdown-image-block";const p=cs(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),g=u.proxyDomURL,y=v=>{if(!g)o.value=v.attrs.src;else{const w=g(v.attrs.src);typeof w=="string"?o.value=w:w.then(C=>{o.value=C}).catch(console.error)}s.value=v.attrs.ratio,i.value=v.attrs.caption,l.value=!r.editable};return y(e),d.mount(h),{dom:h,update:v=>v.type!==e.type?!1:(y(v),!0),stopEvent:v=>v.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),h.remove()}}});Va(C3,{displayName:"NodeView<image-block>",group:"ImageBlock"});const Rx=[oh,ja,C3,Wa].flat();let yd,bd;if(typeof WeakMap<"u"){let t=new WeakMap;yd=e=>t.get(e),bd=(e,r)=>(t.set(e,r),r)}else{const t=[];let r=0;yd=n=>{for(let o=0;o<t.length;o+=2)if(t[o]==n)return t[o+1]},bd=(n,o)=>(r==10&&(r=0),t[r++]=n,t[r++]=o)}var qe=class{constructor(t,e,r,n){this.width=t,this.height=e,this.map=r,this.problems=n}findCell(t){for(let e=0;e<this.map.length;e++){const r=this.map[e];if(r!=t)continue;const n=e%this.width,o=e/this.width|0;let i=n+1,s=o+1;for(let a=1;i<this.width&&this.map[e+a]==r;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==r;a++)s++;return{left:n,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,r){const{left:n,right:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(r<0?n==0:o==this.width)?null:this.map[i*this.width+(r<0?n-1:o)]:(r<0?i==0:s==this.height)?null:this.map[n+this.width*(r<0?i-1:s)]}rectBetween(t,e){const{left:r,right:n,top:o,bottom:i}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(r,s),top:Math.min(o,l),right:Math.max(n,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],r={};for(let n=t.top;n<t.bottom;n++)for(let o=t.left;o<t.right;o++){const i=n*this.width+o,s=this.map[i];r[s]||(r[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||n==t.top&&n&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,r){for(let n=0,o=0;;n++){const i=o+r.child(n).nodeSize;if(n==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}}static get(t){return yd(t)||bd(t,Ox(t))}};function Ox(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Px(t),r=t.childCount,n=[];let o=0,i=null;const s=[];for(let c=0,u=e*r;c<u;c++)n[c]=0;for(let c=0,u=0;c<r;c++){const d=t.child(c);u++;for(let g=0;;g++){for(;o<n.length&&n[o]!=0;)o++;if(g==d.childCount)break;const y=d.child(g),{colspan:v,rowspan:w,colwidth:C}=y.attrs;for(let k=0;k<w;k++){if(k+c>=r){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:w-k});break}const A=o+k*e;for(let I=0;I<v;I++){n[A+I]==0?n[A+I]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:v-I});const R=C&&C[I];if(R){const H=(A+I)%e*2,O=s[H];O==null||O!=R&&s[H+1]==1?(s[H]=R,s[H+1]=1):O==R&&s[H+1]++}}}o+=v,u+=y.nodeSize}const h=(c+1)*e;let p=0;for(;o<h;)n[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||r===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new qe(e,r,n,i);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<r&&(l=!0);return l&&Dx(a,s,t),a}function Px(t){let e=-1,r=!1;for(let n=0;n<t.childCount;n++){const o=t.child(n);let i=0;if(r)for(let s=0;s<n;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>n&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(r=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Dx(t,e,r){t.problems||(t.problems=[]);const n={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(n[i])continue;n[i]=!0;const s=r.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const u=e[(o+c)%t.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Bx(l)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function Bx(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let r=0;r<t.colspan;r++)e.push(0);return e}function Sm(t,e){if(typeof t=="string")return{};const r=t.getAttribute("data-colwidth"),n=r&&/^\d+(,\d+)*$/.test(r)?r.split(",").map(s=>Number(s)):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:n&&n.length==o?n:null};for(const s in e){const a=e[s].getFromDOM,l=a&&a(t);l!=null&&(i[s]=l)}return i}function Am(t,e){const r={};t.attrs.colspan!=1&&(r.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(r.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(r["data-colwidth"]=t.attrs.colwidth.join(","));for(const n in e){const o=e[n].setDOMAttr;o&&o(t.attrs[n],r)}return r}function zx(t){if(t!==null){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function Nx(t){const e=t.cellAttributes||{},r={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:zx}};for(const n in e)r[n]={default:e[n].default,validate:e[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:r,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>Sm(n,e)}],toDOM(n){return["td",Am(n,e),0]}},table_header:{content:t.cellContent,attrs:r,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>Sm(n,e)}],toDOM(n){return["th",Am(n,e),0]}}}}function Sr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const r in t.nodes){const n=t.nodes[r],o=n.spec.tableRole;o&&(e[o]=n)}}return e}const ao=new et("selectingCells");function Gi(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Mr(t){const e=t.selection.$head;for(let r=e.depth;r>0;r--)if(e.node(r).type.spec.tableRole=="row")return!0;return!1}function Pc(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const r=Gi(e.$head)||Hx(e.$head);if(r)return r;throw new RangeError(`No cell found around position ${e.head}`)}function Hx(t){for(let e=t.nodeAfter,r=t.pos;e;e=e.firstChild,r++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(r)}for(let e=t.nodeBefore,r=t.pos;e;e=e.lastChild,r--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(r-e.nodeSize)}}function wd(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function $x(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ih(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function k3(t,e,r){const n=t.node(-1),o=qe.get(n),i=t.start(-1),s=o.nextCell(t.pos-i,e,r);return s==null?null:t.node(0).resolve(i+s)}function si(t,e,r=1){const n={...t,colspan:t.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,r),n.colwidth.some(o=>o>0)||(n.colwidth=null)),n}function qx(t,e,r=1){const n={...t,colspan:t.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let o=0;o<r;o++)n.colwidth.splice(e,0,0)}return n}function Fx(t,e,r){const n=Sr(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[r+o*t.width]).type!=n)return!1;return!0}var Ue=class Sn extends jt{constructor(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.rectBetween(e.pos-i,r.pos-i),a=e.node(0),l=o.cellsInRect(s).filter(u=>u!=r.pos-i);l.unshift(r.pos-i);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=i+u+1;return new $g(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=r}map(e,r){const n=e.resolve(r.map(this.$anchorCell.pos)),o=e.resolve(r.map(this.$headCell.pos));if(wd(n)&&wd(o)&&ih(n,o)){const i=this.$anchorCell.node(-1)!=n.node(-1);return i&&this.isRowSelection()?Sn.rowSelection(n,o):i&&this.isColSelection()?Sn.colSelection(n,o):new Sn(n,o)}return Ce.between(n,o)}content(){const e=this.$anchorCell.node(-1),r=qe.get(e),n=this.$anchorCell.start(-1),o=r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},s=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*r.width+o.left,d=o.left;d<o.right;d++,u++){const h=r.map[u];if(i[h])continue;i[h]=!0;const p=r.findCell(h);let g=e.nodeAt(h);if(!g)throw new RangeError(`No cell with offset ${h} found`);const y=o.left-p.left,v=p.right-o.right;if(y>0||v>0){let w=g.attrs;if(y>0&&(w=si(w,0,y)),v>0&&(w=si(w,w.colspan-v,v)),p.left<o.left){if(g=g.type.createAndFill(w),!g)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else g=g.type.create(w,g.content)}if(p.top<o.top||p.bottom>o.bottom){const w={...g.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?g=g.type.createAndFill(w):g=g.type.create(w,g.content)}c.push(g)}s.push(e.child(l).copy(He.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new dt(He.from(a),1,1)}replace(e,r=dt.empty){const n=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:a,$to:l}=o[s],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),s?dt.empty:r)}const i=jt.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,r){this.replace(e,new dt(He.from(r),0,0))}forEachCell(e){const r=this.$anchorCell.node(-1),n=qe.get(r),o=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(r.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),r=this.$headCell.index(-1);if(Math.min(e,r)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=r+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount}static colSelection(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(r.pos-i),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(r=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(r=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Sn(e,r)}isRowSelection(){const e=this.$anchorCell.node(-1),r=qe.get(e),n=this.$anchorCell.start(-1),o=r.colCount(this.$anchorCell.pos-n),i=r.colCount(this.$headCell.pos-n);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==r.width}eq(e){return e instanceof Sn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(r.pos-i),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(r=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(r=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(e=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new Sn(e,r)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,r){return new Sn(e.resolve(r.anchor),e.resolve(r.head))}static create(e,r,n=r){return new Sn(e.resolve(r),e.resolve(n))}getBookmark(){return new Vx(this.$anchorCell.pos,this.$headCell.pos)}};Ue.prototype.visible=!1;jt.jsonID("cell",Ue);var Vx=class _3{constructor(e,r){this.anchor=e,this.head=r}map(e){return new _3(e.map(this.anchor),e.map(this.head))}resolve(e){const r=e.resolve(this.anchor),n=e.resolve(this.head);return r.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&r.index()<r.parent.childCount&&n.index()<n.parent.childCount&&ih(r,n)?new Ue(r,n):jt.near(n,1)}};function Wx(t){if(!(t.selection instanceof Ue))return null;const e=[];return t.selection.forEachCell((r,n)=>{e.push(Bt.node(n,n+r.nodeSize,{class:"selectedCell"}))}),Dt.create(t.doc,e)}function jx({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let r=t.pos,n=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,r++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,n--);return r==n&&/row|table/.test(t.node(o).type.spec.tableRole)}function Ux({$from:t,$to:e}){let r,n;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}return r!==n&&e.parentOffset===0}function Gx(t,e,r){const n=(e||t).selection,o=(e||t).doc;let i,s;if(n instanceof qr&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ue.create(o,n.from);else if(s=="row"){const a=o.resolve(n.from+1);i=Ue.rowSelection(a,a)}else if(!r){const a=qe.get(n.node),l=n.from+1,c=l+a.map[a.width*a.height-1];i=Ue.create(o,l+1,c)}}else n instanceof Ce&&jx(n)?i=Ce.create(o,n.from):n instanceof Ce&&Ux(n)&&(i=Ce.create(o,n.$from.start(),n.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const Kx=new et("fix-tables");function S3(t,e,r,n){const o=t.childCount,i=e.childCount;e:for(let s=0,a=0;s<i;s++){const l=e.child(s);for(let c=a,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==l){a=c+1,r+=l.nodeSize;continue e}n(l,r),a<o&&t.child(a).sameMarkup(l)?S3(t.child(a),l,r+1,n):l.nodesBetween(0,l.content.size,n,r+1),r+=l.nodeSize}}function Zx(t,e){let r;const n=(o,i)=>{o.type.spec.tableRole=="table"&&(r=Xx(t,o,i,r))};return e?e.doc!=t.doc&&S3(e.doc,t.doc,0,n):t.doc.descendants(n),r}function Xx(t,e,r,n){const o=qe.get(e);if(!o.problems)return n;n||(n=t.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)i[c.row+h]+=c.n;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,si(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=n.mapping.map(r);n.delete(u,u+e.nodeSize)}}let s,a;for(let l=0;l<i.length;l++)i[l]&&(s==null&&(s=l),a=l);for(let l=0,c=r+1;l<o.height;l++){const u=e.child(l),d=c+u.nodeSize,h=i[l];if(h>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const g=[];for(let v=0;v<h;v++){const w=Sr(t.schema)[p].createAndFill();w&&g.push(w)}const y=(l==0||s==l-1)&&a==l?c+1:d-1;n.insert(n.mapping.map(y),g)}c=d}return n.setMeta(Kx,{fixTables:!0})}function A3(t){const e=qe.get(t),r=[],n=e.height,o=e.width;for(let i=0;i<n;i++){const s=[];for(let a=0;a<o;a++){const l=i*o+a,c=e.map[l];if(i>0){const u=l-o;if(c===e.map[u]){s.push(null);continue}}if(a>0){const u=l-1;if(c===e.map[u]){s.push(null);continue}}s.push(t.nodeAt(c))}r.push(s)}return r}function T3(t,e){const r=[],n=qe.get(t),o=n.height,i=n.width;for(let s=0;s<o;s++){const a=t.child(s),l=[];for(let u=0;u<i;u++){const d=e[s][u];if(!d)continue;const h=n.map[s*n.width+u],p=t.nodeAt(h);if(!p)continue;const g=p.type.createChecked(d.attrs,d.content,d.marks);l.push(g)}const c=a.type.createChecked(a.attrs,l,a.marks);r.push(c)}return t.type.createChecked(t.attrs,r,t.marks)}function M3(t,e,r,n){const o=e[0]>r[0]?-1:1,i=t.splice(e[0],e.length),s=i.length%2===0?1:0;let a;return a=o===-1?r[0]:r[r.length-1]-s,t.splice(a,0,...i),t}function hs(t){return Yx(e=>e.type.spec.tableRole==="table",t)}function Yx(t,e){for(let r=e.depth;r>=0;r-=1){const n=e.node(r);if(t(n))return{node:n,pos:r===0?0:e.before(r),start:e.start(r),depth:r}}return null}function Ci(t,e){const r=hs(e.$from);if(!r)return;const n=qe.get(r.node);if(!(t<0||t>n.width-1))return n.cellsInRect({left:t,right:t+1,top:0,bottom:n.height}).map(o=>{const i=r.node.nodeAt(o),s=o+r.start;return{pos:s,start:s+1,node:i,depth:r.depth+2}})}function ki(t,e){const r=hs(e.$from);if(!r)return;const n=qe.get(r.node);if(!(t<0||t>n.height-1))return n.cellsInRect({left:0,right:n.width,top:t,bottom:t+1}).map(o=>{const i=r.node.nodeAt(o),s=o+r.start;return{pos:s,start:s+1,node:i,depth:r.depth+2}})}function Tm(t,e,r=e){let n=e,o=r;for(let u=e;u>=0;u--){const d=Ci(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.colspan+u-1;p>=n&&(n=u),p>o&&(o=p)})}for(let u=e;u<=o;u++){const d=Ci(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.colspan+u-1;h.node.attrs.colspan>1&&p>o&&(o=p)})}const i=[];for(let u=n;u<=o;u++){const d=Ci(u,t.selection);d&&d.length>0&&i.push(u)}n=i[0],o=i[i.length-1];const s=Ci(n,t.selection),a=ki(0,t.selection);if(!s||!a)return;const l=t.doc.resolve(s[s.length-1].pos);let c;for(let u=o;u>=n;u--){const d=Ci(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:i}}function Mm(t,e,r=e){let n=e,o=r;for(let u=e;u>=0;u--){const d=ki(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.rowspan+u-1;p>=n&&(n=u),p>o&&(o=p)})}for(let u=e;u<=o;u++){const d=ki(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.rowspan+u-1;h.node.attrs.rowspan>1&&p>o&&(o=p)})}const i=[];for(let u=n;u<=o;u++){const d=ki(u,t.selection);d&&d.length>0&&i.push(u)}n=i[0],o=i[i.length-1];const s=ki(n,t.selection),a=Ci(0,t.selection);if(!s||!a)return;const l=t.doc.resolve(s[s.length-1].pos);let c;for(let u=o;u>=n;u--){const d=ki(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:i}}function Em(t){return t[0].map((e,r)=>t.map(n=>n[r]))}function Jx(t){var e,r;const{tr:n,originIndex:o,targetIndex:i,select:s,pos:a}=t,l=hs(n.doc.resolve(a));if(!l)return!1;const c=(e=Tm(n,o))===null||e===void 0?void 0:e.indexes,u=(r=Tm(n,i))===null||r===void 0?void 0:r.indexes;if(!c||!u||c.includes(i))return!1;const d=Qx(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!s)return!0;const h=qe.get(d),p=l.start,g=i,y=h.positionAt(h.height-1,g,d),v=n.doc.resolve(p+y),w=h.positionAt(0,g,d),C=n.doc.resolve(p+w);return n.setSelection(Ue.colSelection(v,C)),!0}function Qx(t,e,r,n){let o=Em(A3(t));return o=M3(o,e,r),o=Em(o),T3(t,o)}function eC(t){var e,r;const{tr:n,originIndex:o,targetIndex:i,select:s,pos:a}=t,l=hs(n.doc.resolve(a));if(!l)return!1;const c=(e=Mm(n,o))===null||e===void 0?void 0:e.indexes,u=(r=Mm(n,i))===null||r===void 0?void 0:r.indexes;if(!c||!u||c.includes(i))return!1;const d=tC(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!s)return!0;const h=qe.get(d),p=l.start,g=i,y=h.positionAt(g,h.width-1,d),v=n.doc.resolve(p+y),w=h.positionAt(g,0,d),C=n.doc.resolve(p+w);return n.setSelection(Ue.rowSelection(v,C)),!0}function tC(t,e,r,n){let o=A3(t);return o=M3(o,e,r),T3(t,o)}function So(t){const e=t.selection,r=Pc(t),n=r.node(-1),o=r.start(-1),i=qe.get(n);return{...e instanceof Ue?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(r.pos-o),tableStart:o,map:i,table:n}}function E3(t,{map:e,tableStart:r,table:n},o){let i=o>0?-1:0;Fx(e,n,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=n.nodeAt(l);t.setNodeMarkup(t.mapping.map(r+l),null,qx(c.attrs,o-e.colCount(l))),s+=c.attrs.rowspan-1}else{const l=i==null?Sr(n.type.schema).cell:n.nodeAt(e.map[a+i]).type,c=e.positionAt(s,o,n);t.insert(t.mapping.map(r+c),l.createAndFill())}}return t}function rC(t,e){if(!Mr(t))return!1;if(e){const r=So(t);e(E3(t.tr,r,r.left))}return!0}function nC(t,e){if(!Mr(t))return!1;if(e){const r=So(t);e(E3(t.tr,r,r.right))}return!0}function oC(t,{map:e,table:r,tableStart:n},o){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+o,l=e.map[a],c=r.nodeAt(l),u=c.attrs;if(o>0&&e.map[a-1]==l||o<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(n+l),null,si(u,o-e.colCount(l)));else{const d=t.mapping.slice(i).map(n+l);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function iC(t,e){if(!Mr(t))return!1;if(e){const r=So(t),n=t.tr;if(r.left==0&&r.right==r.map.width)return!1;for(let o=r.right-1;oC(n,r,o),o!=r.left;o--){const i=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!i)throw new RangeError("No table found");r.table=i,r.map=qe.get(i)}e(n)}return!0}function sC(t,{map:e,table:r,tableStart:n},o){let i=0;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const s=i+r.child(o).nodeSize,a=t.mapping.maps.length;t.delete(i+n,s+n);const l=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==e.map[u-e.width]){const h=r.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+n),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const h=r.nodeAt(d),p=h.attrs,g=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),y=e.positionAt(o+1,c,r);t.insert(t.mapping.slice(a).map(n+y),g),c+=p.colspan-1}}}}function aC(t,e){if(!Mr(t))return!1;if(e){const r=So(t),n=t.tr;if(r.top==0&&r.bottom==r.map.height)return!1;for(let o=r.bottom-1;sC(n,r,o),o!=r.top;o--){const i=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!i)throw new RangeError("No table found");r.table=i,r.map=qe.get(r.table)}e(n)}return!0}function lC(t,e){return function(r,n){if(!Mr(r))return!1;const o=Pc(r);if(o.nodeAfter.attrs[t]===e)return!1;if(n){const i=r.tr;r.selection instanceof Ue?r.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&i.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),n(i)}return!0}}function cC(t){return function(e,r){if(!Mr(e))return!1;if(r){const n=Sr(e.schema),o=So(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(l=>o.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==n.header_cell&&i.setNodeMarkup(o.tableStart+s[l],n.cell,a[l].attrs);if(i.steps.length===0)for(let l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],n.header_cell,a[l].attrs);r(i)}return!0}}function Im(t,e,r){const n=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<n.length;o++){const i=e.table.nodeAt(n[o]);if(i&&i.type!==r.header_cell)return!1}return!0}function sh(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cC(t):function(r,n){if(!Mr(r))return!1;if(n){const o=Sr(r.schema),i=So(r),s=r.tr,a=Im("row",i,o),l=Im("column",i,o),c=(t==="column"?a:t==="row"&&l)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?l?o.cell:o.header_cell:t=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(h=>{const p=h+i.tableStart,g=s.doc.nodeAt(p);g&&s.setNodeMarkup(p,d,g.attrs)}),n(s)}return!0}}sh("row",{useDeprecatedLogic:!0});sh("column",{useDeprecatedLogic:!0});sh("cell",{useDeprecatedLogic:!0});function uC(t,e){if(e<0){const r=t.nodeBefore;if(r)return t.pos-r.nodeSize;for(let n=t.index(-1)-1,o=t.before();n>=0;n--){const i=t.node(-1).child(n),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const r=t.node(-1);for(let n=t.indexAfter(-1),o=t.after();n<r.childCount;n++){const i=r.child(n);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function I3(t){return function(e,r){if(!Mr(e))return!1;const n=uC(Pc(e),t);if(n==null)return!1;if(r){const o=e.doc.resolve(n);r(e.tr.setSelection(Ce.between(o,$x(o))).scrollIntoView())}return!0}}function dC(t,e){const r=t.selection.$anchor;for(let n=r.depth;n>0;n--)if(r.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(r.before(n),r.after(n)).scrollIntoView()),!0;return!1}function al(t,e){const r=t.selection;if(!(r instanceof Ue))return!1;if(e){const n=t.tr,o=Sr(t.schema).cell.createAndFill().content;r.forEachCell((i,s)=>{i.content.eq(o)||n.replace(n.mapping.map(s+1),n.mapping.map(s+i.nodeSize-1),new dt(o,0,0))}),n.docChanged&&e(n)}return!0}function hC(t){return(e,r)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=t,a=e.tr;return eC({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})?(r?.(a),!0):!1}}function fC(t){return(e,r)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=t,a=e.tr;return Jx({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})?(r?.(a),!0):!1}}function pC(t){if(t.size===0)return null;let{content:e,openStart:r,openEnd:n}=t;for(;e.childCount==1&&(r>0&&n>0||e.child(0).type.spec.tableRole=="table");)r--,n--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,r-1),d=l<e.childCount-1?0:Math.max(0,n-1);(u||d)&&(c=xd(Sr(s).row,new dt(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(r||n?xd(Sr(s).row,new dt(e,r,n)).content:e);else return null;return mC(s,a)}function mC(t,e){const r=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=i.child(s).attrs;for(let c=o;c<o+a;c++)r[c]=(r[c]||0)+l}}let n=0;for(let o=0;o<r.length;o++)n=Math.max(n,r[o]);for(let o=0;o<r.length;o++)if(o>=e.length&&e.push(He.empty),r[o]<n){const i=Sr(t).cell.createAndFill(),s=[];for(let a=r[o];a<n;a++)s.push(i);e[o]=e[o].append(He.from(s))}return{height:e.length,width:n,rows:e}}function xd(t,e){const r=t.createAndFill();return new qg(r).replace(0,r.content.size,e).doc}function gC({width:t,height:e,rows:r},n,o){if(t!=n){const i=[],s=[];for(let a=0;a<r.length;a++){const l=r[a],c=[];for(let u=i[a]||0,d=0;u<n;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>n&&(h=h.type.createChecked(si(h.attrs,h.attrs.colspan,u+h.attrs.colspan-n),h.content)),c.push(h),u+=h.attrs.colspan;for(let p=1;p<h.attrs.rowspan;p++)i[a+p]=(i[a+p]||0)+h.attrs.colspan}s.push(He.from(c))}r=s,t=n}if(e!=o){const i=[];for(let s=0,a=0;s<o;s++,a++){const l=[],c=r[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(He.from(l))}r=i,e=o}return{width:t,height:e,rows:r}}function vC(t,e,r,n,o,i,s){const a=t.doc.type.schema,l=Sr(a);let c,u;if(o>e.width)for(let d=0,h=0;d<e.height;d++){const p=r.child(d);h+=p.nodeSize;const g=[];let y;p.lastChild==null||p.lastChild.type==l.cell?y=c||(c=l.cell.createAndFill()):y=u||(u=l.header_cell.createAndFill());for(let v=e.width;v<o;v++)g.push(y);t.insert(t.mapping.slice(s).map(h-1+n),g)}if(i>e.height){const d=[];for(let g=0,y=(e.height-1)*e.width;g<Math.max(e.width,o);g++){const v=g>=e.width?!1:r.nodeAt(e.map[y+g]).type==l.header_cell;d.push(v?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,He.from(d)),p=[];for(let g=e.height;g<i;g++)p.push(h);t.insert(t.mapping.slice(s).map(n+r.nodeSize-2),p)}return!!(c||u)}function Lm(t,e,r,n,o,i,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=r.nodeAt(d),{top:p,left:g}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+n),null,{...h.attrs,rowspan:s-p}),t.insert(t.mapping.slice(a).map(e.positionAt(s,g,r)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return l}function Rm(t,e,r,n,o,i,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=r.nodeAt(d),p=e.colCount(d),g=t.mapping.slice(a).map(d+n);t.setNodeMarkup(g,null,si(h.attrs,s-p,h.attrs.colspan-(s-p))),t.insert(g+h.nodeSize,h.type.createAndFill(si(h.attrs,0,s-p))),c+=h.attrs.rowspan-1}}return l}function Om(t,e,r,n,o){let i=r?t.doc.nodeAt(r-1):t.doc;if(!i)throw new Error("No table found");let s=qe.get(i);const{top:a,left:l}=n,c=l+o.width,u=a+o.height,d=t.tr;let h=0;function p(){if(i=r?d.doc.nodeAt(r-1):d.doc,!i)throw new Error("No table found");s=qe.get(i),h=d.mapping.maps.length}vC(d,s,i,r,c,u,h)&&p(),Lm(d,s,i,r,l,c,a,h)&&p(),Lm(d,s,i,r,l,c,u,h)&&p(),Rm(d,s,i,r,a,u,l,h)&&p(),Rm(d,s,i,r,a,u,c,h)&&p();for(let g=a;g<u;g++){const y=s.positionAt(g,l,i),v=s.positionAt(g,c,i);d.replace(d.mapping.slice(h).map(y+r),d.mapping.slice(h).map(v+r),new dt(o.rows[g-a],0,0))}p(),d.setSelection(new Ue(d.doc.resolve(r+s.positionAt(a,l,i)),d.doc.resolve(r+s.positionAt(u-1,c-1,i)))),e(d)}const yC=y2({ArrowLeft:ll("horiz",-1),ArrowRight:ll("horiz",1),ArrowUp:ll("vert",-1),ArrowDown:ll("vert",1),"Shift-ArrowLeft":cl("horiz",-1),"Shift-ArrowRight":cl("horiz",1),"Shift-ArrowUp":cl("vert",-1),"Shift-ArrowDown":cl("vert",1),Backspace:al,"Mod-Backspace":al,Delete:al,"Mod-Delete":al});function Bl(t,e,r){return r.eq(t.selection)?!1:(e&&e(t.tr.setSelection(r).scrollIntoView()),!0)}function ll(t,e){return(r,n,o)=>{if(!o)return!1;const i=r.selection;if(i instanceof Ue)return Bl(r,n,jt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=L3(o,t,e);if(s==null)return!1;if(t=="horiz")return Bl(r,n,jt.near(r.doc.resolve(i.head+e),e));{const a=r.doc.resolve(s),l=k3(a,t,e);let c;return l?c=jt.near(l,1):e<0?c=jt.near(r.doc.resolve(a.before(-1)),-1):c=jt.near(r.doc.resolve(a.after(-1)),1),Bl(r,n,c)}}}function cl(t,e){return(r,n,o)=>{if(!o)return!1;const i=r.selection;let s;if(i instanceof Ue)s=i;else{const l=L3(o,t,e);if(l==null)return!1;s=new Ue(r.doc.resolve(l))}const a=k3(s.$headCell,t,e);return a?Bl(r,n,new Ue(s.$anchorCell,a)):!1}}function bC(t,e){const r=t.state.doc,n=Gi(r.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new Ue(n))),!0):!1}function wC(t,e,r){if(!Mr(t.state))return!1;let n=pC(r);const o=t.state.selection;if(o instanceof Ue){n||(n={width:1,height:1,rows:[He.from(xd(Sr(t.state.schema).cell,r))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=qe.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return n=gC(n,a.right-a.left,a.bottom-a.top),Om(t.state,t.dispatch,s,a,n),!0}else if(n){const i=Pc(t.state),s=i.start(-1);return Om(t.state,t.dispatch,s,qe.get(i.node(-1)).findCell(i.pos-s),n),!0}else return!1}function xC(t,e){var r;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=Pm(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof Ue)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(o=Gi(t.state.selection.$anchor))!=null&&((r=Cu(t,e))===null||r===void 0?void 0:r.pos)!=o.pos)i(o,e),e.preventDefault();else if(!n)return;function i(l,c){let u=Cu(t,c);const d=ao.getState(t.state)==null;if(!u||!ih(l,u))if(d)u=l;else return;const h=new Ue(l,u);if(d||!t.state.selection.eq(h)){const p=t.state.tr.setSelection(h);d&&p.setMeta(ao,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ao,-1))}function a(l){const c=l,u=ao.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(Pm(t,c.target)!=n&&(d=Cu(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function L3(t,e,r){if(!(t.state.selection instanceof Ce))return null;const{$head:n}=t.state.selection;for(let o=n.depth-1;o>=0;o--){const i=n.node(o);if((r<0?n.index(o):n.indexAfter(o))!=(r<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=n.before(o),a=e=="vert"?r>0?"down":"up":r>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Pm(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Cu(t,e){const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return null;let{inside:n,pos:o}=r;return n>=0&&Gi(t.state.doc.resolve(n))||Gi(t.state.doc.resolve(o))}var CC=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cd(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Cd(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Cd(t,e,r,n,o,i){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:p,colwidth:g}=c.child(d).attrs;for(let y=0;y<p;y++,h++){const v=o==h?i:g&&g[y],w=v?v+"px":"";if(s+=v||n,v||(a=!1),l)l.style.width!=w&&(l.style.width=w),l=l.nextSibling;else{const C=document.createElement("col");C.style.width=w,e.appendChild(C)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(r.style.width=s+"px",r.style.minWidth=""):(r.style.width="",r.style.minWidth=s+"px")}}const hr=new et("tableColumnResizing");function kC({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:r=100,View:n=CC,lastColumnResizable:o=!0}={}){const i=new Xe({key:hr,state:{init(s,a){var l;const c=(l=i.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=Sr(a.schema).table.name;return n&&c&&(c[u]=(d,h)=>new n(d,r,h)),new _C(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=hr.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{SC(s,a,t,o)},mouseleave:s=>{AC(s)},mousedown:(s,a)=>{TC(s,a,e,r)}},decorations:s=>{const a=hr.getState(s);if(a&&a.activeHandle>-1)return RC(s,a.activeHandle)},nodeViews:{}}});return i}var _C=class zl{constructor(e,r){this.activeHandle=e,this.dragging=r}apply(e){const r=this,n=e.getMeta(hr);if(n&&n.setHandle!=null)return new zl(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new zl(r.activeHandle,n.setDragging);if(r.activeHandle>-1&&e.docChanged){let o=e.mapping.map(r.activeHandle,-1);return wd(e.doc.resolve(o))||(o=-1),new zl(o,r.dragging)}return r}};function SC(t,e,r,n){if(!t.editable)return;const o=hr.getState(t.state);if(o&&!o.dragging){const i=EC(e.target);let s=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=r?s=Dm(t,e,"left",r):l-e.clientX<=r&&(s=Dm(t,e,"right",r))}if(s!=o.activeHandle){if(!n&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=qe.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}R3(t,s)}}}function AC(t){if(!t.editable)return;const e=hr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&R3(t,-1)}function TC(t,e,r,n){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=hr.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=MC(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(hr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const h=hr.getState(t.state);h?.dragging&&(IC(t,h.activeHandle,Bm(h.dragging,d,r)),t.dispatch(t.state.tr.setMeta(hr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=hr.getState(t.state);if(h&&h.dragging){const p=Bm(h.dragging,d,r);zm(t,h.activeHandle,p,n)}}return zm(t,s.activeHandle,l,n),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function MC(t,e,{colspan:r,colwidth:n}){const o=n&&n[n.length-1];if(o)return o;const i=t.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,a=r;if(n)for(let l=0;l<r;l++)n[l]&&(s-=n[l],a--);return s/a}function EC(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Dm(t,e,r,n){const o=r=="right"?-n:n,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,a=Gi(t.state.doc.resolve(s));if(!a)return-1;if(r=="right")return a.pos;const l=qe.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Bm(t,e,r){const n=e.clientX-t.startX;return Math.max(r,t.startWidth+n)}function R3(t,e){t.dispatch(t.state.tr.setMeta(hr,{setHandle:e}))}function IC(t,e,r){const n=t.state.doc.resolve(e),o=n.node(-1),i=qe.get(o),s=n.start(-1),a=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],h=o.nodeAt(d).attrs,p=h.colspan==1?0:a-i.colCount(d);if(h.colwidth&&h.colwidth[p]==r)continue;const g=h.colwidth?h.colwidth.slice():LC(h.colspan);g[p]=r,l.setNodeMarkup(s+d,null,{...h,colwidth:g})}l.docChanged&&t.dispatch(l)}function zm(t,e,r,n){const o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=qe.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Cd(i,l.firstChild,l,n,a,r)}function LC(t){return Array(t).fill(0)}function RC(t,e){const r=[],n=t.doc.resolve(e),o=n.node(-1);if(!o)return Dt.empty;const i=qe.get(o),s=n.start(-1),a=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=a+c*i.width;if((a==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var l;const d=i.map[u],h=s+d+o.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((l=hr.getState(t))===null||l===void 0)&&l.dragging&&r.push(Bt.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Bt.widget(h,p))}}return Dt.create(t.doc,r)}function OC({allowTableNodeSelection:t=!1}={}){return new Xe({key:ao,state:{init(){return null},apply(e,r){const n=e.getMeta(ao);if(n!=null)return n==-1?null:n;if(r==null||!e.docChanged)return r;const{deleted:o,pos:i}=e.mapping.mapResult(r);return o?null:i}},props:{decorations:Wx,handleDOMEvents:{mousedown:xC},createSelectionBetween(e){return ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:bC,handleKeyDown:yC,handlePaste:wC},appendTransaction(e,r,n){return Gx(n,Zx(n,r),t)}})}var W0=typeof navigator<"u"?navigator:null,ah=W0&&W0.userAgent||"",PC=/Edge\/(\d+)/.exec(ah),DC=/MSIE \d/.exec(ah),BC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ah),zC=!!(DC||BC||PC),NC=!zC&&!!W0&&/Apple Computer/.test(W0.vendor),O3=new et("safari-ime-span"),kd=!1,HC={key:O3,props:{decorations:$C,handleDOMEvents:{compositionstart:()=>{kd=!0},compositionend:()=>{kd=!1}}}};function $C(t){const{$from:e,$to:r,to:n}=t.selection;if(kd&&e.sameParent(r)){const o=Bt.widget(n,qC,{ignoreSelection:!0,key:"safari-ime-span"});return Dt.create(t.doc,[o])}}function qC(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var FC=new Xe(NC?HC:{key:O3});function he(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var lh=Wg("strike_through");he(lh,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var ui=jg("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(lh.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,r,n)=>{e.openMark(n),e.next(r.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,r)=>{e.withMark(r,"delete")}}}));he(ui.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});he(ui.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Ua=Me("ToggleStrikeThrough",t=>()=>Ug(ui.type(t)));he(Ua,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var P3=is(t=>Vg(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)$"),ui.type(t)));he(P3,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var Dc=f1("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(ne);return()=>e.call(Ua.key)}}});he(Dc.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});he(Dc.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});function D3(t,e){const r=e.content.firstChild;if(e.childCount!==1||r?.type.name!=="paragraph"){t.next(e.content);return}const n=r.lastChild,o=n?.type.name==="hardbreak"?r.content.cut(0,r.content.size-n.nodeSize):r.content;t.next(o)}var Ga=Nx({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),ln=Wr("table",()=>({...Ga.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n,isHeader:s===0}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const r=e.content.firstChild?.content;if(!r)return;const n=[];r.forEach(o=>{n.push(o.attrs.alignment)}),t.openNode("table",void 0,{align:n}),t.next(e.content),t.closeNode()}}}));he(ln.node,{displayName:"NodeSchema<table>",group:"Table"});he(ln.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var Ka=Wr("table_header_row",()=>({...Ga.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n[s],isHeader:e.isHeader}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));he(Ka.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});he(Ka.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var fs=Wr("table_row",()=>({...Ga.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n[s]}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));he(fs.node,{displayName:"NodeSchema<tableRow>",group:"Table"});he(fs.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var Za=Wr("table_cell",()=>({...Ga.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,r)=>{const n=e.align;t.openNode(r,{alignment:n}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell"),D3(t,e),t.closeNode()}}}));he(Za.node,{displayName:"NodeSchema<tableCell>",group:"Table"});he(Za.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Ki=Wr("table_header",()=>({...Ga.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,r)=>{const n=e.align;t.openNode(r,{alignment:n}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),D3(t,e),t.closeNode()}}}));he(Ki.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});he(Ki.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function Bc(t,e=3,r=3){const n=Array(r).fill(0).map(()=>Za.type(t).createAndFill()),o=Array(r).fill(0).map(()=>Ki.type(t).createAndFill()),i=Array(e).fill(0).map((s,a)=>a===0?Ka.type(t).create(null,o):fs.type(t).create(null,n));return ln.type(t).create(null,i)}function B3(t){return(e,r)=>n=>{r=r??n.selection.from;const o=n.doc.resolve(r),i=Kg(l=>l.type.name==="table")(o),s=i?{node:i.node,from:i.start}:void 0,a=t==="row";if(s){const l=qe.get(s.node);if(e>=0&&e<(a?l.height:l.width)){const c=l.positionAt(a?e:l.height-1,a?l.width-1:e,s.node),u=n.doc.resolve(s.from+c),d=a?Ue.rowSelection:Ue.colSelection,h=l.positionAt(a?e:0,a?0:e,s.node),p=n.doc.resolve(s.from+h);return b2(n.setSelection(d(u,p)))}}return n}}var VC=B3("row"),WC=B3("col");function z3(t,e,{map:r,tableStart:n,table:o},i){const s=Array(i).fill(0).reduce((l,c,u)=>l+o.child(u).nodeSize,n),a=Array(r.width).fill(0).map((l,c)=>{const u=o.nodeAt(r.map[c]);return Za.type(t).createAndFill({alignment:u?.attrs.alignment})});return e.insert(s,fs.type(t).create(null,a)),e}function jC(t){const e=hs(t.$from);if(!e)return;const r=qe.get(e.node);return r.cellsInRect({left:0,right:r.width,top:0,bottom:r.height}).map(n=>{const o=e.node.nodeAt(n),i=n+e.start;return{pos:i,start:i+1,node:o}})}function UC(t){const e=jC(t.selection);if(e&&e[0]){const r=t.doc.resolve(e[0].pos),n=e[e.length-1];if(n){const o=t.doc.resolve(n.pos);return b2(t.setSelection(new Ue(o,r)))}}return t}var ch=Me("GoToPrevTableCell",()=>()=>I3(-1));he(ch,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var uh=Me("GoToNextTableCell",()=>()=>I3(1));he(uh,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var dh=Me("ExitTable",t=>()=>(e,r)=>{if(!Mr(e))return!1;const{$head:n}=e.selection,o=Gg(n,ln.type(t));if(!o)return!1;const{to:i}=o,s=e.tr.replaceWith(i,i,Vi.type(t).createAndFill());return s.setSelection(jt.near(s.doc.resolve(i),1)).scrollIntoView(),r?.(s),!0});he(dh,{displayName:"Command<breakTableCommand>",group:"Table"});var N3=Me("InsertTable",t=>({row:e,col:r}={})=>(n,o)=>{const{selection:i,tr:s}=n,{from:a}=i,l=Bc(t,e,r),c=s.replaceSelectionWith(l),u=jt.findFrom(c.doc.resolve(a),1,!0);return u&&c.setSelection(u),o?.(c),!0});he(N3,{displayName:"Command<insertTableCommand>",group:"Table"});var hh=Me("MoveRow",()=>({from:t,to:e,pos:r}={})=>hC({from:t??0,to:e??0,pos:r}));he(hh,{displayName:"Command<moveRowCommand>",group:"Table"});var fh=Me("MoveCol",()=>({from:t,to:e,pos:r}={})=>fC({from:t??0,to:e??0,pos:r}));he(fh,{displayName:"Command<moveColCommand>",group:"Table"});var Uo=Me("SelectRow",()=>(t={index:0})=>(e,r)=>{const{tr:n}=e;return!!r?.(VC(t.index,t.pos)(n))});he(Uo,{displayName:"Command<selectRowCommand>",group:"Table"});var Go=Me("SelectCol",()=>(t={index:0})=>(e,r)=>{const{tr:n}=e;return!!r?.(WC(t.index,t.pos)(n))});he(Go,{displayName:"Command<selectColCommand>",group:"Table"});var H3=Me("SelectTable",()=>()=>(t,e)=>{const{tr:r}=t;return!!e?.(UC(r))});he(H3,{displayName:"Command<selectTableCommand>",group:"Table"});var ph=Me("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:r}=t;if(!(r instanceof Ue))return!1;const n=r.isRowSelection(),o=r.isColSelection();return n&&o?dC(t,e):o?iC(t,e):aC(t,e)});he(ph,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var mh=Me("AddColBefore",()=>()=>rC);he(mh,{displayName:"Command<addColBeforeCommand>",group:"Table"});var gh=Me("AddColAfter",()=>()=>nC);he(gh,{displayName:"Command<addColAfterCommand>",group:"Table"});var vh=Me("AddRowBefore",t=>()=>(e,r)=>{if(!Mr(e))return!1;if(r){const n=So(e);r(z3(t,e.tr,n,n.top))}return!0});he(vh,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var yh=Me("AddRowAfter",t=>()=>(e,r)=>{if(!Mr(e))return!1;if(r){const n=So(e);r(z3(t,e.tr,n,n.bottom))}return!0});he(yh,{displayName:"Command<addRowAfterCommand>",group:"Table"});var bh=Me("SetAlign",()=>(t="left")=>lC("alignment",t));he(bh,{displayName:"Command<setAlignCommand>",group:"Table"});var $3=is(t=>new h1(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,r,n,o)=>{const i=e.doc.resolve(n);if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),ln.type(t)))return null;const s=Bc(t,Math.max(Number(r.groups?.row??0),2),Number(r.groups?.col)),a=e.tr.replaceRangeWith(n,o,s);return a.setSelection(Ce.create(a.doc,n+3)).scrollIntoView()}));he($3,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var q3=Fg(t=>({run:(e,r,n)=>{if(n)return e;function o(c){const u=c.childCount,d=c.lastChild?.childCount??0;if(u===0||d===0)return Vi.type(t).create();const h=c.firstChild;if(!(d>0&&h&&h.childCount===0))return c;if(u>=3){const v=c.child(1),w=[];for(let A=0;A<v.childCount;A++){const I=v.child(A);w.push(Ki.type(t).create(I.attrs,I.content,I.marks))}const C=h.type.create(h.attrs,w),k=[];for(let A=2;A<u;A++)k.push(c.child(A));return c.type.create(c.attrs,[C,...k])}const p=Array(d).fill(0).map(()=>Ki.type(t).createAndFill()),g=new dt(He.from(p),0,0),y=h.replace(0,0,g);return c.replace(0,h.nodeSize,new dt(He.from(y),0,0))}function i(c){const u=fs.type(t),d=[];let h=[],p=!1;function g(){if(h.length===0)return;const y=Ka.type(t).createAndFill(),v=ln.type(t).create(null,[y,...h]);d.push(o(v)),h=[]}return c.forEach(y=>{y.type===u?(p=!0,h.push(y)):(g(),d.push(y))}),g(),p?He.from(d):c}function s(c){let u=i(c),d=u!==c;const h=[];return u.forEach(p=>{if(p.type===ln.type(t)){const g=o(p);g!==p&&(d=!0),h.push(g)}else if(p.childCount>0){const g=s(p.content);g!==p.content?(d=!0,h.push(p.copy(g))):h.push(p)}else h.push(p)}),d?He.from(h):c}function a(c){const u=[],d=[];c.forEach(h=>d.push(h));for(let h=0;h<d.length;h++){const p=d[h],g=d[h+1];p.type===Vi.type(t)&&p.content.size===0&&g&&g.type===ln.type(t)||u.push(p)}return u.length<d.length?He.from(u):c}let l=s(e.content);return l=a(l),new dt(He.from(l),e.openStart,e.openEnd)}}));he(q3,{displayName:"PasteRule<table>",group:"Table"});var wh=f1("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(ne);return()=>e.call(uh.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(ne);return()=>e.call(ch.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(ne);return()=>e.call(dh.key)}}});he(wh.ctx,{displayName:"KeymapCtx<table>",group:"Table"});he(wh.shortcuts,{displayName:"Keymap<table>",group:"Table"});var ku="footnote_definition",Nm="footnoteDefinition",xh=Wr("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${ku}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nc(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":ku},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===Nm,runner:(t,e,r)=>{t.openNode(r,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===ku,runner:(t,e)=>{t.openNode(Nm,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));he(xh.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});he(xh.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var _u="footnote_reference",Ch=Wr("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${_u}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nc(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":_u},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,r)=>{t.addNode(r,{label:e.label})}},toMarkdown:{match:t=>t.type.name===_u,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));he(Ch.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});he(Ch.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var kh=Pa.extendSchema(t=>e=>{const r=t(e);return{...r,attrs:{...r.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:n=>{if(!(n instanceof HTMLElement))throw nc(n);return{label:n.dataset.label,listType:n.dataset.listType,spread:n.dataset.spread==="true",checked:n.dataset.checked?n.dataset.checked==="true":null}}},...r?.parseDOM||[]],toDOM:n=>r.toDOM&&n.attrs.checked==null?r.toDOM(n):["li",{"data-item-type":"task","data-label":n.attrs.label,"data-list-type":n.attrs.listType,"data-spread":n.attrs.spread,"data-checked":n.attrs.checked},0],parseMarkdown:{match:({type:n})=>n==="listItem",runner:(n,o,i)=>{if(o.checked==null){r.parseMarkdown.runner(n,o,i);return}const s=o.label!=null?`${o.label}.`:"•",a=o.checked!=null?!!o.checked:null,l=o.label!=null?"ordered":"bullet",c=o.spread??!0;n.openNode(i,{label:s,listType:l,spread:c,checked:a}),n.next(o.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="list_item",runner:(n,o)=>{if(o.attrs.checked==null){r.toMarkdown.runner(n,o);return}const i=o.attrs.label,s=o.attrs.listType,a=o.attrs.spread,l=o.attrs.checked;n.openNode("listItem",void 0,{label:i,listType:s,spread:a,checked:l}),n.next(o.content),n.closeNode()}}}});he(kh.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});he(kh.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var F3=is(()=>new h1(/^\[(?<checked>\s|x)\]\s$/,(t,e,r,n)=>{const o=t.doc.resolve(r);let i=0,s=o.node(i);for(;s&&s.type.name!=="list_item";)i--,s=o.node(i);if(!s||s.attrs.checked!=null)return null;const a=e.groups?.checked==="x",l=o.before(i),c=t.tr;return c.deleteRange(r,n).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));he(F3,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var GC=[Dc,wh].flat(),KC=[$3,F3],ZC=[P3],XC=[q3],V3=Je(()=>FC);he(V3,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var YC=Je(()=>kC({}));he(YC,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var W3=Je(()=>OC({allowTableNodeSelection:!0}));he(W3,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var _h=os("remarkGFM",()=>l8);he(_h.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});he(_h.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var JC=new et("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function QC(t,e){let r=0;return e.forEach((n,o,i)=>{n===t&&(r=i)}),r}function ek(t,e){const r=t.content.findDiffStart(e.content);if(r==null)return null;const n=t.content.findDiffEnd(e.content);return n?{from:r,to:Math.max(n.b,r)}:null}var j3=Je(()=>new Xe({key:JC,appendTransaction:(t,e,r)=>{if(e.doc===r.doc)return;const n=ek(e.doc,r.doc);if(!n)return;let o;const i=(s,a)=>{if(s.type.name!=="table_cell")return;const l=r.doc.resolve(a),c=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const d=QC(s,c),h=u.maybeChild(d);if(!h)return;const p=h.attrs.alignment;p!==s.attrs.alignment&&(o||(o=r.tr),o.setNodeMarkup(a,void 0,{...s.attrs,alignment:p}))};return r.doc.nodesBetween(n.from,n.to,(s,a)=>s.type.name!=="table"?!0:(r.doc.nodesBetween(a,a+s.nodeSize,i),!1)),o}}));he(j3,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var tk=[j3,V3,_h,W3].flat(),rk=[kh,ln,Ka,fs,Ki,Za,xh,Ch,lh,ui].flat(),nk=[uh,ch,dh,N3,hh,fh,Uo,Go,H3,ph,vh,yh,mh,gh,bh,Ua],ok=[rk,KC,XC,ZC,GC,nk,tk].flat(),ik=Object.defineProperty,Hm=Object.getOwnPropertySymbols,sk=Object.prototype.hasOwnProperty,ak=Object.prototype.propertyIsEnumerable,$m=(t,e,r)=>e in t?ik(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lk=(t,e)=>{for(var r in e||(e={}))sk.call(e,r)&&$m(t,r,e[r]);if(Hm)for(var r of Hm(e))ak.call(e,r)&&$m(t,r,e[r]);return t};function U3(t,e){return Object.assign(t,{meta:lk({package:"@milkdown/components"},e)}),t}const ck={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:t=>t,renderPreview:()=>null,previewToggleButton:t=>t?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},Zi=Ve(ck,"codeBlockConfigCtx");U3(Zi,{displayName:"Config<code-block>",group:"CodeBlock"});class uk{constructor(e){this.languages=e,this.map={},e.forEach(r=>{r.alias.forEach(n=>{this.map[n]=r})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const n=this.map[e.toLowerCase()];return n?n.support?Promise.resolve(n.support):n.load():Promise.resolve(void 0)}}function Xa(...t){}Xa(M);function Hi({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Hi.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var dk=(t,e,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(t,e)).next())});Xa(M,Ie);function hk(t){return dk(this,null,function*(){try{return navigator.clipboard.writeText(t)}catch{const r=document.createElement("textarea"),n=document.activeElement;r.value=t,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const o=document.getSelection(),i=o?o.rangeCount>0&&o.getRangeAt(0):null;document.body.appendChild(r),r.select(),r.selectionStart=0,r.selectionEnd=t.length,document.execCommand("copy"),document.body.removeChild(r),i&&(o.removeAllRanges(),o.addRange(i)),n&&n.focus()}})}const fk=Ct({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(t){const e=()=>{hk(t.text).then(()=>t.onCopy(t.text)).catch(console.error)};return()=>M(Ie,null,M("button",{type:"button",class:"copy-button",onClick:e},M(Hi,{icon:t.copyIcon}),t.copyText))}}),pk=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function mk(t){return`${t}-${pk()}`}Xa(M,Ie);const gk=Ct({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:t,config:e,setLanguage:r,getAllLanguages:n,getReadOnly:o}){const i=re(),s=re(!1),a=re(),l=mk("milkdown-code-language-search"),c=re(),u=re("");Bn([s,i,c],()=>{u.value="";const v=i.value,w=c.value;!v||!w||dn(v,w,{placement:"bottom-start"}).then(({x:C,y:k})=>{Object.assign(w.style,{left:`${C}px`,top:`${k}px`})}).catch(console.error)});const d=v=>{if(v.preventDefault(),v.stopPropagation(),o())return;const w=!s.value;s.value=w,w&&setTimeout(()=>{var C;return(C=a.value)==null?void 0:C.focus()},0)},h=v=>{const w=v.target;u.value=w.value},p=v=>{v.key==="Escape"&&(u.value="")},g=dr(()=>{var v;if(!s.value)return[];const w=(v=n())!=null?v:[],C=w.find(A=>A.name.toLowerCase()===t.value.toLowerCase()),k=w.filter(A=>{const I=u.value.toLowerCase();return(A.name.toLowerCase().includes(I)||A.alias.some(R=>R.toLowerCase().includes(I)))&&A!==C});return k.length===0?[]:C?[C,...k]:k}),y=v=>{const w=v.target;if(i.value&&i.value.contains(w))return;const C=c.value,k=i.value;!k||!C||k.dataset.expanded==="true"&&(C.contains(w)||(s.value=!1))};return us(()=>{window.addEventListener("click",y)}),ds(()=>{window.removeEventListener("click",y)}),()=>M(Ie,null,M("button",{type:"button",ref:i,class:"language-button",onClick:d,"data-expanded":String(s.value)},t.value||"Text",M("div",{class:"expand-icon"},M(Hi,{icon:e.expandIcon}))),M("div",{ref:c,class:"language-picker"},s.value?M("div",{class:"list-wrapper"},M("div",{class:"search-box"},M("div",{class:"search-icon"},M(Hi,{icon:e.searchIcon})),M("input",{id:l,ref:a,class:"search-input",placeholder:e.searchPlaceholder,value:u.value,onInput:h,onKeydown:p}),M("div",{class:Mt("clear-icon",u.value.length===0&&"hidden"),onMousedown:v=>{v.preventDefault(),u.value=""}},M(Hi,{icon:e.clearSearchIcon}))),M("ul",{class:"language-list",role:"listbox",onKeydown:v=>{if(v.key==="Enter"){const w=document.activeElement;w instanceof HTMLElement&&w.dataset.language&&r(w.dataset.language)}}},g.value.length?g.value.map(v=>M("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":v.name.toLowerCase()===t.value.toLowerCase(),"data-language":v.name,onClick:()=>{r(v.name),s.value=!1}},e.renderLanguage(v.name,v.name.toLowerCase()===t.value.toLowerCase()))):M("li",{class:"language-list-item no-result"},e.noResultText))):null))}});Xa(M,Ie);const vk="http://www.w3.org/2000/svg";function yk(){const t=Tr(),e={ADD_TAGS:["foreignObject"],ADD_ATTR:["xmlns"],HTML_INTEGRATION_POINTS:{foreignobject:!0}};return t.addHook("uponSanitizeElement",(r,n)=>{var o;if(n.tagName==="foreignobject"){const i=r.parentElement;(!i||i.namespaceURI!==vk)&&((o=r.parentNode)==null||o.removeChild(r))}}),r=>t.sanitize(r,e)}let ul;function bk(t){return ul??(ul=yk()),ul(t)}const wk=Ct({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(t){const{previewOnlyMode:e,config:r,preview:n}=t,o=re();return cs(()=>{const i=o.value;if(!i)return;for(;i.firstChild;)i.removeChild(i.firstChild);const s=n.value;(typeof s=="string"||s instanceof Element)&&(i.innerHTML=bk(s))}),()=>n.value?M("div",{class:"preview-panel"},!e.value&&M(Ie,null,M("div",{class:"preview-divider"}),M("div",{class:"preview-label"},r.previewLabel)),M("div",{ref:o,class:"preview"})):null}});Xa(M,Ie);const xk=Ct({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){var e;const r=(e=t.config.previewOnlyByDefault)!=null?e:t.getReadOnly(),n=re(r),o=re(),i=re(null);us(()=>{for(var a;(a=o.value)!=null&&a.firstChild;)o.value.removeChild(o.value.firstChild);o.value&&o.value.appendChild(t.codemirror.dom)}),Bn(()=>[t.text.value,t.language.value],()=>{const a=t.config.renderPreview(t.language.value,t.text.value,c=>i.value=c);a&&(i.value=a),a===void 0&&!i.value&&(i.value=Tr.sanitize(t.config.previewLoading)),a===null&&(i.value=null)},{immediate:!0});const s=()=>{};return()=>{var a;return M(Ie,null,M("div",{class:"tools"},M(gk,{language:t.language,config:t.config,setLanguage:t.setLanguage,getAllLanguages:t.getAllLanguages,getReadOnly:t.getReadOnly}),M("div",{class:"tools-button-group"},M(fk,{copyIcon:t.config.copyIcon,copyText:t.config.copyText,onCopy:(a=t.config.onCopy)!=null?a:s,text:t.text.value}),i.value?M("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},M(Hi,{icon:t.config.previewToggleButton(n.value)})):null)),M("div",{ref:o,class:Mt("codemirror-host",i.value&&n.value&&"hidden")}),M(wk,{text:t.text,language:t.language,config:t.config,previewOnlyMode:n,preview:i}))}}}),_d=new WeakMap;let Su=null;function qm(){return Su||(Su=new IntersectionObserver(t=>{for(const e of t){const r=_d.get(e.target);r?.(e.isIntersecting)}},{rootMargin:"200px"})),Su}const G3=class K3{constructor(e,r,n,o,i,s){this.node=e,this.view=r,this.getPos=n,this.loader=o,this.config=i,this.selected=re(!1),this.language=re(""),this.text=re(""),this.initialized=!1,this.updating=!1,this.languageName="",this.teardownTimer=null,this.onConfigChange=({extensions:l})=>{l!==this.extensions&&(this.extensions=l,this.initialized&&this.cm.dispatch({effects:this.extensionsConf.reconfigure(l)}))},this.forwardUpdate=l=>{var c;if(this.updating||!this.cm.hasFocus)return;let u=((c=this.getPos())!=null?c:0)+1;const{main:d}=l.state.selection,h=u+d.from,p=u+d.to,g=this.view.state.selection;if(l.docChanged||g.from!==h||g.to!==p){const y=this.view.state.tr;l.changes.iterChanges((v,w,C,k,A)=>{A.length?y.replaceWith(u+v,u+w,this.view.state.schema.text(A.toString())):y.delete(u+v,u+w),u+=k-C-(w-v)}),y.setSelection(Ce.create(y.doc,h,p)),this.view.dispatch(y)}},this.createApp=()=>gr(xk,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const l=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>Zg(l.state,l.dispatch)?(l.focus(),!0):!1},{key:"Mod-z",run:()=>ic(l.state,l.dispatch)},{key:"Shift-Mod-z",run:()=>Wi(l.state,l.dispatch)},{key:"Mod-y",run:()=>Wi(l.state,l.dispatch)},{key:"Backspace",run:()=>{var c;const u=this.cm.state.selection.ranges;if(u.length>1)return!1;const d=u[0];if(d&&(!d.empty||d.anchor>0)||this.cm.state.doc.lines>=2)return!1;const h=this.view.state,p=(c=this.getPos())!=null?c:0,g=h.tr.replaceWith(p,p+this.node.nodeSize,h.schema.nodes.paragraph.createChecked({},this.node.content));return g.setSelection(Ce.near(g.doc.resolve(p))),this.view.dispatch(g),this.view.focus(),!0}}]},this.maybeEscape=(l,c)=>{var u;const{state:d}=this.cm;let h=d.selection.main;if(!h.empty||(l==="line"&&(h=d.doc.lineAt(h.head)),c<0?h.from>0:h.to<d.doc.length))return!1;const p=((u=this.getPos())!=null?u:0)+(c<0?0:this.node.nodeSize),g=Ce.near(this.view.state.doc.resolve(p),c),y=this.view.state.tr.setSelection(g).scrollIntoView();return this.view.dispatch(y),this.view.focus(),!0},this.setLanguage=l=>{var c;this.view.dispatch(this.view.state.tr.setNodeAttribute((c=this.getPos())!=null?c:0,"language",l))},this.getAllLanguages=()=>this.loader.getAll();var a;this.languageConf=new ru,this.readOnlyConf=new ru,this.extensionsConf=new ru,this.extensions=i.extensions,this.disposeConfigWatcher=s?.(this.onConfigChange),this.text.value=this.node.textContent,this.language.value=(a=this.node.attrs.language)!=null?a:"",this.dom=document.createElement("div"),this.dom.className="milkdown-code-block",this.disposeSelectedWatcher=cs(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.renderPlaceholder(),_d.set(this.dom,l=>{l?(this.cancelTeardown(),this.initializeCodeMirror()):this.initialized&&this.scheduleTeardown()}),qm().observe(this.dom)}renderPlaceholder(){const e=document.createElement("pre");e.className="milkdown-code-block-placeholder";const r=document.createElement("code");r.textContent=this.node.textContent,e.appendChild(r),this.dom.appendChild(e)}initializeCodeMirror(){if(this.initialized)return;this.initialized=!0,this.cm=new tr({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(na.readOnly.of(!this.view.editable)),w2(),p1.of(this.codeMirrorKeymap()),this.languageConf.of([]),na.changeFilter.of(()=>this.view.editable||this.updating),this.extensionsConf.of(this.extensions),tr.updateListener.of(this.forwardUpdate)]});const e=this.dom.querySelector(".milkdown-code-block-placeholder");e&&this.dom.removeChild(e),this.app=this.createApp(),this.app.mount(this.dom),this.updateLanguage()}teardownCodeMirror(){if(this.initialized&&!(this.cm.hasFocus||this.selected.value)){for(this.app.unmount(),this.cm.destroy(),this.initialized=!1,this.languageName="";this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);this.renderPlaceholder()}}scheduleTeardown(){this.cancelTeardown(),this.teardownTimer=setTimeout(()=>this.teardownCodeMirror(),K3.TEARDOWN_DELAY)}cancelTeardown(){this.teardownTimer!=null&&(clearTimeout(this.teardownTimer),this.teardownTimer=null)}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(n=>{n&&(this.cm.dispatch({effects:this.languageConf.reconfigure(n)}),this.languageName=e)}).catch(console.error)}setSelection(e,r){if(this.initialized||this.initializeCodeMirror(),!!this.cm.dom.isConnected){this.cm.focus(),this.updating=!0;try{this.cm.dispatch({selection:{anchor:e,head:r}})}finally{this.updating=!1}}}update(e){var r;if(e.type!==this.node.type)return!1;if(this.updating)return!0;if(this.node=e,this.text.value=e.textContent,this.language.value=(r=e.attrs.language)!=null?r:"",!this.initialized){const o=this.dom.querySelector(".milkdown-code-block-placeholder code");return o&&(o.textContent=e.textContent),!0}this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(na.readOnly.of(!this.view.editable))});const n=kk(this.cm.state.doc.toString(),e.textContent);if(n){this.updating=!0;try{this.cm.dispatch({changes:{from:n.from,to:n.to,insert:n.text},scrollIntoView:this.view.editable})}finally{this.updating=!1}}return!0}selectNode(){this.initialized||this.initializeCodeMirror(),this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){var e;(e=this.disposeConfigWatcher)==null||e.call(this),this.cancelTeardown(),qm().unobserve(this.dom),_d.delete(this.dom),this.initialized&&(this.app.unmount(),this.cm.destroy()),this.disposeSelectedWatcher()}};G3.TEARDOWN_DELAY=5e3;let Ck=G3;function kk(t,e){if(t===e)return null;let r=0,n=t.length,o=e.length;for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)++r;for(;n>r&&o>r&&t.charCodeAt(n-1)===e.charCodeAt(o-1);)n--,o--;return{from:r,to:n,text:e.slice(r,o)}}const Z3=ko(ti.node,t=>{const e=t.use(Zi.key),r=new uk(e.get().languages);return(n,o,i)=>new Ck(n,o,i,r,e.get(),s=>e.on(s))});U3(Z3,{displayName:"NodeView<code-block>",group:"CodeBlock"});const _k=[Z3,Zi],Fm=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Xi{constructor(e,r,n=0,o=e.length,i,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,o),this.bufferStart=n,this.normalize=i?a=>i(Fm(a)):Fm,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Qg(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=tv(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ev(e);let o=this.normalize(r);if(o.length)for(let i=0,s=n,a=!0;;i++){let l=o.charCodeAt(i),c=this.match(l,s,a,this.bufferPos+this.bufferStart,i==o.length-1);if(c)return this.value=c,this;if(i==o.length-1)break;a&&i<r.length&&r.charCodeAt(i)==l?s++:a=!1}}}match(e,r,n,o,i){let s=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?s={from:l.from,to:o,precise:i&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:r,to:o,precise:n&&i}:this.matches.push({from:r,index:1,precise:n})),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Xi.prototype[Symbol.iterator]=function(){return this});const X3={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Sh="gm"+(/x/.unicode==null?"":"u");class Y3{constructor(e,r,n,o=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=X3,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new J3(e,r,n,o,i);this.re=new RegExp(r,Sh+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let s=e.lineAt(o);this.curLineStart=s.from,this.matchPos=j0(e,o),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=j0(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Au=new WeakMap;class $i{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let o=Au.get(e);if(!o||o.from>=n||o.to<=r){let a=new $i(r,e.sliceString(r,n));return Au.set(e,a),a}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=e.sliceString(r,s)+i,s=r),o.to<n&&(i+=e.sliceString(o.to,n)),Au.set(e,new $i(s,i)),new $i(r,i.slice(r-s,n-s))}}class J3{constructor(e,r,n,o,i){this.text=e,this.to=i,this.done=!1,this.value=X3,this.matchPos=j0(e,o),this.re=new RegExp(r,Sh+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=$i.get(e,o,this.chunkEnd(o+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,precise:!0,match:r},this.matchPos=j0(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$i.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Y3.prototype[Symbol.iterator]=J3.prototype[Symbol.iterator]=function(){return this});function Sk(t){try{return new RegExp(t,Sh),!0}catch{return!1}}function j0(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const Ak=t=>{let e=Xg(t,"cm-goto-line");if(e){let s=e.dom.querySelector("input[type=text]");return s&&s.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:o,result:i}=Yg(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return i.then(s=>{let a=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!a){t.dispatch({effects:o});return}let l=r.doc.lineAt(r.selection.main.head),[,c,u,d,h]=a,p=d?+d.slice(1):0,g=u?+u:l.number;if(u&&h){let w=g/100;c&&(w=w*(c=="-"?-1:1)+l.number/r.doc.lines),g=Math.round(r.doc.lines*w)}else u&&c&&(g=g*(c=="-"?-1:1)+l.number);let y=r.doc.line(Math.max(1,Math.min(r.doc.lines,g))),v=Fr.cursor(y.from+Math.max(0,Math.min(p,y.length)));t.dispatch({effects:[o,tr.scrollIntoView(v.from,{y:"center"})],selection:v})}),!0},Tk={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Mk=g1.define({combine(t){return v1(t,Tk,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Ek(t){return[Pk,Ok]}const Ik=bt.mark({class:"cm-selectionMatch"}),Lk=bt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Vm(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=Cr.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=Cr.Word)}function Rk(t,e,r,n){return t(e.sliceDoc(r,r+1))==Cr.Word&&t(e.sliceDoc(n-1,n))==Cr.Word}const Ok=x2.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Mk),{state:r}=t,n=r.selection;if(n.ranges.length>1)return bt.none;let o=n.main,i,s=null;if(o.empty){if(!e.highlightWordAroundCursor)return bt.none;let l=r.wordAt(o.head);if(!l)return bt.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<e.minSelectionLength||l>200)return bt.none;if(e.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Vm(s,r,o.from,o.to)&&Rk(s,r,o.from,o.to)))return bt.none}else if(i=r.sliceDoc(o.from,o.to),!i)return bt.none}let a=[];for(let l of t.visibleRanges){let c=new Xi(r.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:d}=c.value;if((!s||Vm(s,r,u,d))&&(o.empty&&u<=o.from&&d>=o.to?a.push(Lk.range(u,d)):(u>=o.to||d<=o.from)&&a.push(Ik.range(u,d)),a.length>e.maxMatches))return bt.none}}return bt.set(a)}},{decorations:t=>t.decorations}),Pk=tr.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Dk=({state:t,dispatch:e})=>{let{selection:r}=t,n=Fr.create(r.ranges.map(o=>t.wordAt(o.head)||Fr.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function Bk(t,e){let{main:r,ranges:n}=t.selection,o=t.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,a=new Xi(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new Xi(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const zk=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(i=>i.from===i.to))return Dk({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=n))return!1;let o=Bk(t,n);return o?(e(t.update({selection:t.selection.addRange(Fr.range(o.from,o.to),!1),effects:tr.scrollIntoView(o.to)})),!0):!1},ps=g1.define({combine(t){return v1(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Yk(e),scrollToMatch:e=>tr.scrollIntoView(e)})}});class Q3{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Sk(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
9
- `:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Vk(this):new $k(this)}getCursor(e,r=0,n){let o=e.doc?e:na.create({doc:e});return n==null&&(n=o.doc.length),this.regexp?Si(this,o,r,n):_i(this,o,r,n)}}class e7{constructor(e){this.spec=e}}function Nk(t,e,r){return(n,o,i,s)=>{if(r&&!r(n,o,i,s))return!1;let a=n>=s&&o<=s+i.length?i.slice(n-s,o-s):e.doc.sliceString(n,o);return t(a,e,n,o)}}function _i(t,e,r,n){let o;return t.wholeWord&&(o=Hk(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(o=Nk(t.test,e,o)),new Xi(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),o)}function Hk(t,e){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=t.sliceString(i,Math.min(t.length,n+2))),(e(U0(o,r-i))!=Cr.Word||e(G0(o,r-i))!=Cr.Word)&&(e(G0(o,n-i))!=Cr.Word||e(U0(o,n-i))!=Cr.Word))}class $k extends e7{constructor(e){super(e)}nextMatch(e,r,n){let o=_i(this.spec,e,n,e.doc.length).nextOverlapping();if(o.done){let i=Math.min(e.doc.length,r+this.spec.unquoted.length);o=_i(this.spec,e,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(e,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=_i(this.spec,e,i,o),a=null;for(;!s.nextOverlapping().done;)a=s.value;if(a)return a;if(i==r)return null;o-=1e4}}prevMatch(e,r,n){let o=this.prevMatchInRange(e,0,r);return o||(o=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=_i(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=_i(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function qk(t,e,r){return(n,o,i)=>(!r||r(n,o,i))&&t(i[0],e,n,o)}function Si(t,e,r,n){let o;return t.wholeWord&&(o=Fk(e.charCategorizer(e.selection.main.head))),t.test&&(o=qk(t.test,e,o)),new Y3(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:o},r,n)}function U0(t,e){return t.slice(S2(t,e,!1),e)}function G0(t,e){return t.slice(e,S2(t,e))}function Fk(t){return(e,r,n)=>!n[0].length||(t(U0(n.input,n.index))!=Cr.Word||t(G0(n.input,n.index))!=Cr.Word)&&(t(G0(n.input,n.index+n[0].length))!=Cr.Word||t(U0(n.input,n.index+n[0].length))!=Cr.Word)}class Vk extends e7{nextMatch(e,r,n){let o=Si(this.spec,e,n,e.doc.length).next();return o.done&&(o=Si(this.spec,e,0,r).next()),o.done?null:o.value}prevMatchInRange(e,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Si(this.spec,e,i,n),a=null;for(;!s.next().done;)a=s.value;if(a&&(i==r||a.from>i+10))return a;if(i==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<e.match.length)return e.match[i]+n.slice(o)}return r})}matchAll(e,r){let n=Si(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=Si(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Ca=ai.define(),Ah=ai.define(),po=C2.define({create(t){return new Tu(Sd(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Ca)?t=new Tu(r.value.create(),t.panel):r.is(Ah)&&(t=new Tu(t.query,r.value?Th:null));return t},provide:t=>k2.from(t,e=>e.panel)});class Tu{constructor(e,r){this.query=e,this.panel=r}}const Wk=bt.mark({class:"cm-searchMatch"}),jk=bt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Uk=x2.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(po))}update(t){let e=t.state.field(po);(e!=t.startState.field(po)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return bt.none;let{view:r}=this,n=new _2;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:a,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-500;)l=i[++o].to;t.highlight(r.state,a,l,(c,u)=>{let d=r.state.selection.ranges.some(h=>h.from==c&&h.to==u);n.add(c,u,d?jk:Wk)})}return n.finish()}},{decorations:t=>t.decorations});function Ya(t){return e=>{let r=e.state.field(po,!1);return r&&r.query.spec.valid?t(e,r):n7(e)}}const K0=Ya((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let o=Fr.single(n.from,n.to),i=t.state.facet(ps);return t.dispatch({selection:o,effects:[Mh(t,n),i.scrollToMatch(o.main,t)],userEvent:"select.search"}),r7(t),!0}),Z0=Ya((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,o=e.prevMatch(r,n,n);if(!o)return!1;let i=Fr.single(o.from,o.to),s=t.state.facet(ps);return t.dispatch({selection:i,effects:[Mh(t,o),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),r7(t),!0}),Gk=Ya((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Fr.create(r.map(n=>Fr.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Kk=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let a=new Xi(t.doc,t.sliceDoc(n,o));!a.next().done;){if(i.length>1e3)return!1;a.value.from==n&&(s=i.length),i.push(Fr.range(a.value.from,a.value.to))}return e(t.update({selection:Fr.create(i,s),userEvent:"select.search.matches"})),!0},Wm=Ya((t,{query:e})=>{let{state:r}=t,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=e.nextMatch(r,n,n);if(!i)return!1;let s=i,a=[],l,c,u=[];s.precise?s.from==n&&s.to==o&&(c=r.toText(e.getReplacement(s)),a.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(r,s.from,s.to),u.push(tr.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):s=e.nextMatch(r,s.from,s.to);let d=t.state.changes(a);return s&&(l=Fr.single(s.from,s.to).map(d),u.push(Mh(t,s)),u.push(r.facet(ps).scrollToMatch(l.main,t))),t.dispatch({changes:d,selection:l,effects:u,userEvent:"input.replace"}),!0}),Zk=Ya((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let o of e.matchAll(t.state,1e9)){let{from:i,to:s,precise:a}=o;a&&r.push({from:i,to:s,insert:e.getReplacement(o)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:tr.announce.of(n),userEvent:"input.replace.all"}),!0});function Th(t){return t.state.facet(ps).createPanel(t)}function Sd(t,e){var r,n,o,i,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(ps);return new Q3({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(o=e?.literal)!==null&&o!==void 0?o:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(s=e?.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function t7(t){let e=m1(t,Th);return e&&e.dom.querySelector("[main-field]")}function r7(t){let e=t7(t);e&&e==t.root.activeElement&&e.select()}const n7=t=>{let e=t.state.field(po,!1);if(e&&e.panel){let r=t7(t);if(r&&r!=t.root.activeElement){let n=Sd(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ca.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[Ah.of(!0),e?Ca.of(Sd(t.state,e.query.spec)):ai.appendConfig.of(Qk)]});return!0},o7=t=>{let e=t.state.field(po,!1);if(!e||!e.panel)return!1;let r=m1(t,Th);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ah.of(!1)}),!0},Xk=[{key:"Mod-f",run:n7,scope:"editor search-panel"},{key:"F3",run:K0,shift:Z0,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:K0,shift:Z0,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:o7,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Kk},{key:"Mod-Alt-g",run:Ak},{key:"Mod-d",run:zk,preventDefault:!0}];class Yk{constructor(e){this.view=e;let r=this.query=e.state.field(po).query.spec;this.commit=this.commit.bind(this),this.searchField=at("input",{value:r.search,placeholder:ir(e,"Find"),"aria-label":ir(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=at("input",{value:r.replace,placeholder:ir(e,"Replace"),"aria-label":ir(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=at("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=at("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=at("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return at("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=at("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>K0(e),[ir(e,"next")]),n("prev",()=>Z0(e),[ir(e,"previous")]),n("select",()=>Gk(e),[ir(e,"all")]),at("label",null,[this.caseField,ir(e,"match case")]),at("label",null,[this.reField,ir(e,"regexp")]),at("label",null,[this.wordField,ir(e,"by word")]),...e.state.readOnly?[]:[at("br"),this.replaceField,n("replace",()=>Wm(e),[ir(e,"replace")]),n("replaceAll",()=>Zk(e),[ir(e,"replace all")])],at("button",{name:"close",onclick:()=>o7(e),"aria-label":ir(e,"close"),type:"button"},["×"])])}commit(){let e=new Q3({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ca.of(e)}))}keydown(e){rv(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Z0:K0)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wm(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Ca)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ps).top}}function ir(t,e){return t.state.phrase(e)}const dl=30,hl=/[\s\.,:;?!]/;function Mh(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),o=t.state.doc.lineAt(r).to,i=Math.max(n.from,e-dl),s=Math.min(o,r+dl),a=t.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<dl;l++)if(!hl.test(a[l+1])&&hl.test(a[l])){a=a.slice(l);break}}if(s!=o){for(let l=a.length-1;l>a.length-dl;l--)if(!hl.test(a[l-1])&&hl.test(a[l])){a=a.slice(0,l);break}}return tr.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Jk=tr.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Qk=[po,Jg.low(Uk),Jk];class jm{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class Wo{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let o=n.facet(ka).markerFilter;o&&(e=o(e,n));let i=e.slice().sort((p,g)=>p.from-g.from||p.to-g.to),s=new _2,a=[],l=0,c=n.doc.iter(),u=0,d=n.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let y,v;if(a.length)y=l,v=a.reduce((k,A)=>Math.min(k,A.to),g&&g.from>y?g.from:1e8);else{if(y=g.from,y>d)break;v=g.to,a.push(g),p++}for(;p<i.length;){let k=i[p];if(k.from==y&&(k.to>k.from||k.to==y))a.push(k),p++,v=Math.min(k.to,v);else{v=Math.min(k.from,v);break}}v=Math.min(v,d);let w=!1;if(a.some(k=>k.from==y&&(k.to==v||v==d))&&(w=y==v,!w&&v-y<10)){let k=y-(u+c.value.length);k>0&&(c.next(k),u=y);for(let A=y;;){if(A>=v){w=!0;break}if(!c.lineBreak&&u+c.value.length>A)break;A=u+c.value.length,u+=c.value.length,c.next()}}let C=h_(a);if(w)s.add(y,y,bt.widget({widget:new l_(C),diagnostics:a.slice()}));else{let k=a.reduce((A,I)=>I.markClass?A+" "+I.markClass:A,"");s.add(y,v,bt.mark({class:"cm-lintRange cm-lintRange-"+C+k,diagnostics:a.slice(),inclusiveEnd:a.some(A=>A.to>v)}))}if(l=v,l==d)break;for(let k=0;k<a.length;k++)a[k].to<=l&&a.splice(k--,1)}let h=s.finish();return new Wo(h,r,vo(h))}}function vo(t,e=null,r=0){let n=null;return t.between(r,1e9,(o,i,{spec:s})=>{if(!(e&&s.diagnostics.indexOf(e)<0))if(!n)n=new jm(o,i,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new jm(n.from,i,n.diagnostic)}}),n}function e_(t,e){let r=e.pos,n=e.end||r,o=t.state.facet(ka).hideOn(t,r,n);if(o!=null)return o;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(i7))||t.changes.touchesRange(i.from,Math.max(i.to,n)))}function t_(t,e){return t.field(fr,!1)?e:e.concat(ai.appendConfig.of(f_))}const i7=ai.define(),Eh=ai.define(),s7=ai.define(),fr=C2.define({create(){return new Wo(bt.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let r=t.diagnostics.map(e.changes),n=null,o=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);n=vo(r,t.selected.diagnostic,i)||vo(r,null,i)}!r.size&&o&&e.state.facet(ka).autoPanel&&(o=null),t=new Wo(r,o,n)}for(let r of e.effects)if(r.is(i7)){let n=e.state.facet(ka).autoPanel?r.value.length?_a.open:null:t.panel;t=Wo.init(r.value,n,e.state)}else r.is(Eh)?t=new Wo(t.diagnostics,r.value?_a.open:null,t.selected):r.is(s7)&&(t=new Wo(t.diagnostics,t.panel,r.value));return t},provide:t=>[k2.from(t,e=>e.panel),tr.decorations.from(t,e=>e.diagnostics)]}),r_=bt.mark({class:"cm-lintRange cm-lintRange-active"});function n_(t,e,r){let{diagnostics:n}=t.state.field(fr),o,i=-1,s=-1;n.between(e-(r<0?1:0),e+(r>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||r>0)&&(e<c||r<0)))return o=u.diagnostics,i=l,s=c,!1});let a=t.state.facet(ka).tooltipFilter;return o&&a&&(o=a(o,t.state)),o?{pos:i,end:s,above:!0,create(){return{dom:o_(t,o)}}}:null}function o_(t,e){return at("ul",{class:"cm-tooltip-lint"},e.map(r=>l7(t,r,!1)))}const i_=t=>{let e=t.state.field(fr,!1);(!e||!e.panel)&&t.dispatch({effects:t_(t.state,[Eh.of(!0)])});let r=m1(t,_a.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Um=t=>{let e=t.state.field(fr,!1);return!e||!e.panel?!1:(t.dispatch({effects:Eh.of(!1)}),!0)},s_=t=>{let e=t.state.field(fr,!1);if(!e)return!1;let r=t.state.selection.main,n=vo(e.diagnostics,null,r.to+1);return!n&&(n=vo(e.diagnostics,null,0),!n||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),nv(t,n.from,1,{tooltip:c7,until:o=>o.docChanged||o.newSelection.main.head<n.from||o.newSelection.main.head>n.to}),!0)},a_=[{key:"Mod-Shift-m",run:i_,preventDefault:!0},{key:"F8",run:s_}],ka=g1.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...v1(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Gm,tooltipFilter:Gm,needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r,hideOn:(e,r)=>e?r?(n,o,i)=>e(n,o,i)||r(n,o,i):e:r,autoPanel:(e,r)=>e||r})}}});function Gm(t,e){return t?e?(r,n)=>e(t(r,n),n):t:e}function a7(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let o=r[n];if(/[a-zA-Z]/.test(o)&&!e.some(i=>i.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function l7(t,e,r){var n;let o=r?a7(e.actions):[];return at("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},at("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((i,s)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=vo(t.state.field(fr).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:c}=i,u=o[s]?c.indexOf(o[s]):-1,d=u<0?c:[c.slice(0,u),at("u",c.slice(u,u+1)),c.slice(u+1)],h=i.markClass?" "+i.markClass:"";return at("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${o[s]})"`}.`},d)}),e.source&&at("div",{class:"cm-diagnosticSource"},e.source))}class l_ extends iv{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return at("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Km{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=l7(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _a{constructor(e){this.view=e,this.items=[];let r=o=>{if(!(o.ctrlKey||o.altKey||o.metaKey)){if(o.keyCode==27)Um(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],s=a7(i.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==o.keyCode){let l=vo(this.view.state.field(fr).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;o.preventDefault()}},n=o=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(o.target)&&this.moveSelection(i)};this.list=at("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=at("div",{class:"cm-panel-lint"},this.list,at("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Um(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(fr).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(fr),n=0,o=!1,i=null,s=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(s.has(u))continue;s.add(u);let d=-1,h;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==u){d=p;break}d<0?(h=new Km(this.view,u),this.items.splice(n,0,h),o=!0):(h=this.items[d],d>n&&(this.items.splice(n,d-n),o=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),i=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new Km(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(fr),n=vo(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:s7.of(n)})}static open(e){return new _a(e)}}function c_(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function fl(t){return c_(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const u_=tr.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:fl("#f11")},".cm-lintRange-warning":{backgroundImage:fl("orange")},".cm-lintRange-info":{backgroundImage:fl("#999")},".cm-lintRange-hint":{backgroundImage:fl("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function d_(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function h_(t){let e="hint",r=1;for(let n of t){let o=d_(n.severity);o>r&&(r=o,e=n.severity)}return e}const c7=ov(n_,{hideOn:e_}),f_=[fr,tr.decorations.compute([fr],t=>{let{selected:e,panel:r}=t.field(fr);return!e||!r||e.from==e.to?bt.none:bt.set([r_.range(e.from,e.to)])}),c7,u_],p_=[sv(),av(),lv(),cv(),uv(),w2(),dv(),na.allowMultipleSelections.of(!0),hv(),d1(fv,{fallback:!0}),pv(),mv(),gv(),vv(),yv(),bv(),Ek(),p1.of([...wv,...A2,...Xk,...xv,...Cv,...kv,...a_])];function m_(t){return t.nodeType===1}function g_(t){return m_(t)&&t.namespaceURI==="http://www.w3.org/1999/xhtml"}function v_(t){const e=[[-1,t.state.doc]],r=[];for(;e.length>0;){const[n,o]=e.pop();if(n>=0){const i=t.nodeDOM(n);if(i&&g_(i)){const{top:s,bottom:a,left:l,right:c}=i.getBoundingClientRect();r.push([n,[l,s,c,s]],[n+o.nodeSize,[l,a,c,a]])}}if(o.isBlock&&!o.isTextblock){let i=n+1;for(const s of o.children)e.push([i,s]),i+=s.nodeSize}}return r}function y_(t,e){let r=[],n,o;const i=()=>{const u=t.dom.getBoundingClientRect(),d=t.state.doc;return r&&n&&o&&u.width===o.width&&u.height===o.height&&u.x===o.x&&u.y===o.y&&n.eq(d)||(o=u,n=d,r=v_(t)),r},s=(u,d)=>{if(!t.editable||t.isDestroyed)return;const h=(y,v)=>{const[w,C]=y,[k,A]=v;return Xm(u,C)-Xm(u,A)||w-k};let p=i();p.sort(h),p=p.slice(0,8);const g=p.find(y=>e?.({view:t,pos:y[0],event:d})!==!1);if(!(g&&w_(t,g[0])))return g};let a,l;return(u,d)=>(a&&b_(a,u)||(a=u,l=s(u,d)),l)}function b_(t,e){return t[0]===e[0]&&t[1]===e[1]}function Zm(t,e){return Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1])}function Xm(t,e){return Math.min(Zm(t,[e[0],e[1]]),Zm(t,[e[2],e[3]]))}function w_(t,e){const r=t.dragging;if(!r)return;const{move:n}=r;if(!n)return;const o=t.state.selection;if(!(o instanceof qr))return;const{from:i,to:s}=o;return i<=e&&e<=s}function x_(t){let e;return new Xe({key:new et("prosemirror-drop-indicator"),view:r=>(e=y_(r,t.onDrag),k_(r,e,t)),props:{handleDrop(r,n,o,i){if(!e)return!1;const s=e([n.clientX,n.clientY],n);if(!s)return!1;n.preventDefault();const a=s[0],l=r.state.tr;if(i){const{node:p}=r.dragging||{};p?p.replace(l):l.deleteSelection()}const c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return!0;const h=l.doc.resolve(c);if(u&&qr.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new qr(h));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,y,v,w)=>p=w),l.setSelection(C_(r,h,l.doc.resolve(p)))}return r.focus(),r.dispatch(l.setMeta("uiEvent","drop")),!0}}})}function C_(t,e,r,n){return t.someProp("createSelectionBetween",o=>o(t,e,r))||Ce.between(e,r,n)}function k_(t,e,r){const n=t.dom;let o,i,s,a=!1;const l=()=>{o&&clearTimeout(o),a=!1,o=setTimeout(()=>{a||r.onHide?.()},30)},c=d=>{a=!0;const{clientX:h,clientY:p}=d;if(i===h&&s===p)return;i=h,s=p;const g=e([h,p],d);if(g){const[y,[v,w,C,k]]=g,A={p1:{x:v,y:w},p2:{x:C,y:k}};r.onShow?.({view:t,pos:y,line:A})}else{l();return}};return n.addEventListener("dragover",c),n.addEventListener("dragend",l),n.addEventListener("drop",l),n.addEventListener("dragleave",l),{destroy:()=>{n.removeEventListener("dragover",c),n.removeEventListener("dragend",l),n.removeEventListener("drop",l),n.removeEventListener("dragleave",l)}}}class lt extends jt{constructor(e){super(e,e)}map(e,r){let n=e.resolve(r.map(this.head));return lt.valid(n)?new lt(n):jt.near(n)}content(){return dt.empty}eq(e){return e instanceof lt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new lt(e.resolve(r.pos))}getBookmark(){return new Ih(this.anchor)}static valid(e){let r=e.parent;if(r.inlineContent||!__(e)||!S_(e))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let o=r.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,r,n=!1){e:for(;;){if(!n&&lt.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(r>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(r>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=r;let l=e.doc.resolve(o);if(lt.valid(l))return l}for(;;){let s=r>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!qr.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*r),n=!1;continue e}break}i=s,o+=r;let a=e.doc.resolve(o);if(lt.valid(a))return a}return null}}}lt.prototype.visible=!1;lt.findFrom=lt.findGapCursorFrom;jt.jsonID("gapcursor",lt);class Ih{constructor(e){this.pos=e}map(e){return new Ih(e.map(this.pos))}resolve(e){let r=e.resolve(this.pos);return lt.valid(r)?new lt(r):jt.near(r)}}function u7(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function __(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(r-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||u7(o.type))return!0;if(o.inlineContent)return!1}}return!0}function S_(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(r);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||u7(o.type))return!0;if(o.inlineContent)return!1}}return!0}function A_(){return new Xe({props:{decorations:I_,createSelectionBetween(t,e,r){return e.pos==r.pos&&lt.valid(r)?new lt(r):null},handleClick:M_,handleKeyDown:T_,handleDOMEvents:{beforeinput:E_}}})}const T_=y2({ArrowLeft:pl("horiz",-1),ArrowRight:pl("horiz",1),ArrowUp:pl("vert",-1),ArrowDown:pl("vert",1)});function pl(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,o,i){let s=n.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Ce){if(!i.endOfTextblock(r)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=lt.findGapCursorFrom(a,e,l);return c?(o&&o(n.tr.setSelection(new lt(c))),!0):!1}}function M_(t,e,r){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!lt.valid(n))return!1;let o=t.posAtCoords({left:r.clientX,top:r.clientY});return o&&o.inside>-1&&qr.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new lt(n))),!0)}function E_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof lt))return!1;let{$from:r}=t.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let o=He.empty;for(let s=n.length-1;s>=0;s--)o=He.from(n[s].createAndFill(null,o));let i=t.state.tr.replace(r.pos,r.pos,new dt(o,0,0));return i.setSelection(Ce.near(i.doc.resolve(r.pos+1))),t.dispatch(i),!1}function I_(t){if(!(t.selection instanceof lt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Dt.create(t.doc,[Bt.widget(t.selection.head,e,{key:"gapcursor"})])}function Ja(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-cursor",...e}}),t}var Sa=Ve(null,"dropIndicatorState");Ja(Sa,{displayName:"Ctx<dropIndicatorState>"});var zc=Ve({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");Ja(zc,{displayName:"Ctx<dropIndicatorConfig>"});var L_=new et("MILKDOWN_DROP_INDICATOR_DOM"),d7=Je(t=>new Xe({key:L_,view:e=>{const r=t.get(zc.key),n=document.createElement("div");Object.assign(n.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:r.color,top:"0",left:"0"}),n.classList.add(r.class),n.classList.add("milkdown-drop-indicator"),e.dom.parentNode?.appendChild(n);const o=t.use(Sa.key),i=s=>{R_(n,s,r)};return o.on(i),{destroy:()=>{o.off(i),n.remove()}}}}));Ja(d7,{displayName:"Prose<dropIndicatorDOM>"});function R_(t,e,r){if(!e){Object.assign(t.style,{display:"none"});return}const{line:n}=e,{width:o}=r,{p1:{x:i,y:s},p2:{x:a,y:l}}=n,c=s===l;let u,d,h=s,p=i;c?(u=a-i,d=o,h-=o/2):(u=o,d=l-s,p-=o/2),h=Math.round(h),p=Math.round(p),Object.assign(t.style,{display:"block",width:`${u}px`,height:`${d}px`,transform:`translate(${p}px, ${h}px)`})}var h7=Je(t=>x_({onShow:n=>{t.set(Sa.key,n)},onHide:()=>{t.set(Sa.key,null)},onDrag:()=>!0}));Ja(h7,{displayName:"Prose<dropIndicator>"});var f7=Je(()=>A_());Ja(f7,{displayName:"Prose<gapCursor>"});var O_=[f7,zc,Sa,d7,h7].flat();function P_(t){var e;const r=(e=t?.skipWarning)!=null?e:!1;let n=typeof document>"u"?null:document.createElement("div");return new Xe({key:D_,view:o=>{r!==!0&&H_(o.state.schema,r||[]);const i=o.dom.ownerDocument;n=n||document.createElement("div");const s=n,a=()=>{z_(o,s)};let l;return window.ResizeObserver&&(l=new window.ResizeObserver(()=>a()),l.observe(o.dom)),i.addEventListener("selectionchange",a),{update:()=>{a()},destroy:()=>{i.removeEventListener("selectionchange",a),l&&l.unobserve(o.dom)}}},props:{handleKeyDown:(o,i)=>{var s;const{selection:a}=o.state;if(i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||i.isComposing||!["ArrowLeft","ArrowRight"].includes(i.key)||!Ad(a)||!a.empty)return!1;const l=a.$head,[c,u]=p7(l),d=o.state.storedMarks||l.marks();if(c&&u&&!Di.sameSet(c,u)){if(i.key==="ArrowLeft"&&!Di.sameSet(c,d))return o.dispatch(o.state.tr.setStoredMarks(c)),!0;if(i.key==="ArrowRight"&&!Di.sameSet(u,d))return o.dispatch(o.state.tr.setStoredMarks(u)),!0}return i.key==="ArrowLeft"&&l.textOffset===1?(o.dispatch(o.state.tr.setSelection(Ce.create(o.state.doc,l.pos-1)).setStoredMarks(l.marks())),!0):i.key==="ArrowRight"&&l.textOffset+1===((s=l.parent.maybeChild(l.index()))==null?void 0:s.nodeSize)?(o.dispatch(o.state.tr.setSelection(Ce.create(o.state.doc,l.pos+1)).setStoredMarks(l.marks())),!0):!1},decorations:o=>{if(!(!n||!Ad(o.selection)||!o.selection.empty))return Dt.create(o.doc,[Bt.widget(0,n,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var D_=new et("prosemirror-virtual-cursor");function B_(t,e){var r;const n=window.getSelection();if(!n||!n.rangeCount)return null;const o=(r=n?.getRangeAt(0))==null?void 0:r.cloneRange();if(!o)return null;o.collapse(e);const i=o.getClientRects(),s=i?.length?i[i.length-1]:null;return s?.height?s:t.coordsAtPos(t.state.selection.head)}function p7(t){const e=t.index(),r=t.parent.maybeChild(e);let n=t.textOffset?r:null;return!n&&e>0&&(n=t.parent.maybeChild(e-1)),[n?.marks,r?.marks]}function Ad(t){return t&&typeof t=="object"&&"$cursor"in t}function z_(t,e){if(!t||!t.dom||t.isDestroyed||!e)return;const{state:r,dom:n}=t,{selection:o}=r;if(!Ad(o))return;const i=B_(t,o.$head===o.$from);if(!i)return e;const s=n.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=r.selection.$head,[c,u]=p7(l),d=r.storedMarks||l.marks();o.$cursor&&c&&u&&d&&!Di.sameSet(c,u)&&(Di.sameSet(c,d)?a+=" prosemirror-virtual-cursor-left":Di.sameSet(u,d)&&(a+=" prosemirror-virtual-cursor-right")),e.className=a,N_(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${i.bottom-i.top}px`,e.style.left=`${i.left-s.left}px`,e.style.top=`${i.top-s.top}px`}function N_(t,e){t.classList.remove(e),t.offsetWidth,t.classList.add(e)}function H_(t,e){for(const[r,n]of Object.entries(t.marks))n.spec.inclusive===!1&&!e.includes(r)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${r}" mark or adding it to the "skipWarning" option.`)}var $_=Object.defineProperty,Ym=Object.getOwnPropertySymbols,q_=Object.prototype.hasOwnProperty,F_=Object.prototype.propertyIsEnumerable,Jm=(t,e,r)=>e in t?$_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V_=(t,e)=>{for(var r in e||(e={}))q_.call(e,r)&&Jm(t,r,e[r]);if(Ym)for(var r of Ym(e))F_.call(e,r)&&Jm(t,r,e[r]);return t};function m7(t,e){return Object.assign(t,{meta:V_({package:"@milkdown/components"},e)}),t}const W_={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},Nc=Ve(W_,"inlineImageConfigCtx");m7(Nc,{displayName:"Config<image-inline>",group:"ImageInline"});function Lh(...t){}const j_=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function Qm(t){return`${t}-${j_()}`}Lh(M);function Nl({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Nl.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};Lh(M,Ie);const U_=Ct({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:r,onUpload:n,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=re(!1),p=re(),g=re((u=e.value)!=null?u:""),y=Qm("milkdown-image-link"),v=Qm("milkdown-image-upload"),w=re(((d=e.value)==null?void 0:d.length)!==0),C=R=>{const O=R.target.value;w.value=O.length!==0,g.value=O},k=R=>{var H,O;R.key==="Enter"&&r((O=(H=p.value)==null?void 0:H.value)!=null?O:"")},A=()=>{var R,H;r((H=(R=p.value)==null?void 0:R.value)!=null?H:"")},I=R=>{var H;const O=(H=R.target.files)==null?void 0:H[0];O&&n(O).then(P=>{P&&(r(P),w.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>M("div",{class:Mt("image-edit",l)},M(Nl,{icon:o,class:"image-icon"}),M("div",{class:Mt("link-importer",h.value&&"focus")},M("input",{id:y,ref:p,draggable:"true",onDragstart:R=>{R.preventDefault(),R.stopPropagation()},disabled:t.value,class:"link-input-area",value:g.value,onInput:C,onKeydown:k,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!w.value&&M("div",{class:"placeholder"},M("input",{disabled:t.value,class:"hidden",id:v,type:"file",accept:"image/*",onChange:I}),M("label",{class:"uploader",for:v},M(Nl,{icon:i})),M("span",{class:"text",onClick:()=>{var R;return(R=p.value)==null?void 0:R.focus()}},a))),g.value&&M(Ie,null,M("div",{class:"image-preview"},M("img",{src:g.value,alt:"",onError:R=>Promise.resolve(c?.(R)).catch(()=>{})})),M("div",{class:"confirm",onClick:()=>A()},M(Nl,{icon:s}))))}});Lh(M,Ie);const G_=Ct({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e,alt:r,title:n}=t;return()=>{var o;return(o=e.value)!=null&&o.length?M("img",{class:"image-inline",src:e.value,alt:r.value,title:n.value}):M(U_,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:i=>t.setAttr("src",i),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,className:"empty-image-inline"})}}}),g7=ko(_v.node,t=>(e,r,n)=>{const o=re(e.attrs.src),i=re(e.attrs.alt),s=re(e.attrs.title),a=re(!1),l=re(!r.editable),c=(v,w)=>{if(!r.editable)return;const C=n();C!=null&&r.dispatch(r.state.tr.setNodeAttribute(C,v,v==="src"?Tr.sanitize(w):w))},u=t.get(Nc.key),d=gr(G_,{src:o,alt:i,title:s,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("span");h.className="milkdown-image-inline";const p=cs(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),g=u.proxyDomURL,y=v=>{if(!g)o.value=v.attrs.src;else{const w=g(v.attrs.src);typeof w=="string"?o.value=w:w.then(C=>{o.value=C}).catch(console.error)}i.value=v.attrs.alt,s.value=v.attrs.title};return y(e),d.mount(h),{dom:h,update:v=>v.type!==e.type?!1:(y(v),!0),stopEvent:v=>v.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),h.remove()}}});m7(g7,{displayName:"NodeView<image-inline>",group:"ImageInline"});const K_=[Nc,g7];class K extends Error{constructor(e,r){var n="KaTeX parse error: "+e,o,i,s=r&&r.loc;if(s&&s.start<=s.end){var a=s.lexer.input;o=s.start,i=s.end,o===a.length?n+=" at end of input: ":n+=" at position "+(o+1)+": ";var l=a.slice(o,i).replace(/[^]/g,"$&̲"),c;o>15?c="…"+a.slice(o-15,o):c=a.slice(0,o);var u;i+15<a.length?u=a.slice(i,i+15)+"…":u=a.slice(i),n+=c+l+u}super(n),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,K.prototype),this.position=o,o!=null&&i!=null&&(this.length=i-o),this.rawMessage=e}}var Z_=/([A-Z])/g,X_=t=>t.replace(Z_,"-$1").toLowerCase(),Y_={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},J_=/[&><"']/g,Nt=t=>String(t).replace(J_,e=>Y_[e]),Hl=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?Hl(t.body[0]):t:t.type==="font"?Hl(t.body):t,Q_=new Set(["mathord","textord","atom"]),Fn=t=>Q_.has(Hl(t).type),eS=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Td={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function tS(t){if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function rS(t){if(Object.prototype.hasOwnProperty.call(t,"default")&&t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return tS(e)}function nS(t,e,r,n){var o=Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0,i=Object.prototype.hasOwnProperty.call(n,"processor")?n.processor:void 0;t[e]=o!==void 0?i?i(o):o:rS(n)}class Rh{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r of Object.keys(Td)){var n=Td[r];n&&nS(this,r,e,n)}}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var r=eS(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Kn{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return rn[oS[this.id]]}sub(){return rn[iS[this.id]]}fracNum(){return rn[sS[this.id]]}fracDen(){return rn[aS[this.id]]}cramp(){return rn[lS[this.id]]}text(){return rn[cS[this.id]]}isTight(){return this.size>=2}}var Oh=0,X0=1,qi=2,zn=3,Aa=4,_r=5,Yi=6,Gt=7,rn=[new Kn(Oh,0,!1),new Kn(X0,0,!0),new Kn(qi,1,!1),new Kn(zn,1,!0),new Kn(Aa,2,!1),new Kn(_r,2,!0),new Kn(Yi,3,!1),new Kn(Gt,3,!0)],oS=[Aa,_r,Aa,_r,Yi,Gt,Yi,Gt],iS=[_r,_r,_r,_r,Gt,Gt,Gt,Gt],sS=[qi,zn,Aa,_r,Yi,Gt,Yi,Gt],aS=[zn,zn,_r,_r,Gt,Gt,Gt,Gt],lS=[X0,X0,zn,zn,_r,_r,Gt,Gt],cS=[Oh,X0,qi,zn,qi,zn,qi,zn],ge={DISPLAY:rn[Oh],TEXT:rn[qi],SCRIPT:rn[Aa],SCRIPTSCRIPT:rn[Yi]},Md=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function uS(t){for(var e=0;e<Md.length;e++)for(var r=Md[e],n=0;n<r.blocks.length;n++){var o=r.blocks[n];if(t>=o[0]&&t<=o[1])return r.name}return null}var $l=[];Md.forEach(t=>t.blocks.forEach(e=>$l.push(...e)));function v7(t){for(var e=0;e<$l.length;e+=2)if(t>=$l[e]&&t<=$l[e+1])return!0;return!1}var yt=t=>t+" "+t,gi=80,dS=function(e,r){return"M95,"+(622+e+r)+`
6
+ `);l.trim()&&(o.textContent=l)}return o}function a5({commands:t,isBlockLevel:e,change:r,acceptLabel:n,rejectLabel:o}){const i=document.createElement(e?"div":"span");i.className=`${Rn}-controls`,i.contentEditable="false",e&&i.classList.add(`${Rn}-controls-block`);const s=c=>u=>{u.preventDefault(),u.stopPropagation();const d={fromA:r.fromA,toA:r.toA,fromB:r.fromB,toB:r.toB},h=c==="accept"?k1.key:_1.key;t.call(h,d)},a=document.createElement("button");a.className=`${Rn}-accept`,a.textContent=n,a.addEventListener("click",s("accept"));const l=document.createElement("button");return l.className=`${Rn}-reject`,l.textContent=o,l.addEventListener("click",s("reject")),i.appendChild(a),i.appendChild(l),i}const A9=[uc,i5];function ss(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-streaming",...e}}),t}var li=Ve({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:["id"]}},"streamingConfig");ss(li,{displayName:"Ctx<streamingConfig>",group:"Streaming"});function T9(t,e,r){const n=dc(t.get(gn),r);if(!n)return{tr:e,newDoc:null};const o=t.get(li.key).ignoreAttrs,i=A0(e.doc,n,o?{ignoreAttrs:o}:void 0);for(let s=i.length-1;s>=0;s--){const a=i[s],l=n.slice(a.fromB,a.toB);e=e.replace(a.fromA,a.toA,l)}return{tr:e,newDoc:n}}function M9(t){if(t.parent.type.spec.code)return{type:"plain-text",preserveNewlines:!0};for(let e=t.depth;e>0;e--)if(t.node(e).type.name==="table")return{type:"plain-text",preserveNewlines:!1};return t.depth>=1?{type:"split-block"}:{type:"block"}}function l5(t){if(t.childCount===0)return t;const e=t.lastChild;return e.type.name==="paragraph"&&e.content.size===0?t.cut(0,t.size-e.nodeSize):t}function E9(t,e,r){const{insertPos:n,currentEndPos:o}=r,i=r.buffer.replace(/\r\n?/g,`
7
+ `);if(!i)return{tr:e,applied:!1,insertEndPos:o};const s=e.doc.content.size,a=Math.max(0,Math.min(n,s)),l=Math.max(a,Math.min(o,s)),c=e.doc.resolve(a),u=(t.get(li.key).insertStrategy??M9)(c),d={ctx:t,tr:e,buffer:i,from:a,to:l,resolved:c};switch(u.type){case"plain-text":return I9(d,u.preserveNewlines??!1);case"split-block":return D9(d);case"block":return B9(d)}}function I9({tr:t,buffer:e,from:r,to:n},o){const i=o?e:e.replace(/\n/g," "),s=t.doc.type.schema.text(i);return t=t.replaceWith(r,n,s),{tr:t,applied:!0,insertEndPos:r+i.length}}var L9=/[*_~`[\\<]|https?:\/\/|www\.|[\w.+-]@\w|&[a-zA-Z#]/,R9=/\$(?!\s)(?:[^$\n]*[^\s$])?\$(?!\d)/,O9=/:[\w+-]+:/;function P9(t,e){return!!(L9.test(e)||t.nodes.math_inline&&R9.test(e)||t.nodes.emoji&&O9.test(e))}function dc(t,e){try{return t(e)??null}catch{return null}}function lu(t,e,r){if(!r)return He.empty;if(!P9(e,r))return He.from(e.text(r));const n=dc(t.get(gn),r)?.firstChild;if(n?.type.name!=="paragraph"||n.content.size===0)return He.from(e.text(r));let o=n.content;const i=/^[ \t]+/.exec(r)?.[0];i&&(o=He.from(e.text(i)).append(o));const s=/[ \t]+$/.exec(r)?.[0];return s&&(o=o.append(He.from(e.text(s)))),o}function D9({ctx:t,tr:e,buffer:r,from:n,to:o,resolved:i}){const s=e.doc.type.schema,a=r.indexOf(`
8
+ `);if(a<0){const E=lu(t,s,r);return e=e.replaceWith(n,o,E),{tr:e,applied:!0,insertEndPos:n+E.size}}const l=r.substring(0,a),c=r.substring(a+1),u=t.get(gn),d=c.trim()?dc(u,c):null,h=d?l5(d.content):He.empty;if(h.childCount===0){const E=lu(t,s,r.replace(/\n/g," "));return e=e.replaceWith(n,o,E),{tr:e,applied:!0,insertEndPos:n+E.size}}const p=i.depth;let g=lu(t,s,l);for(let E=p;E>0;E--)g=He.from(i.node(E).copy(g));const y=g.append(h),v=new dt(y,p,0),w=e.doc.content.size,C=e.doc.resolve(Math.min(o,w));let k=o;p>0&&C.depth===p&&C.parentOffset===C.parent.content.size&&(k=C.after(p)),e=e.replace(n,k,v);const S=y.size-p;return{tr:e,applied:!0,insertEndPos:n+S}}function B9({ctx:t,tr:e,buffer:r,from:n,to:o}){const i=dc(t.get(gn),r);if(!i)return{tr:e,applied:!1,insertEndPos:o};const s=l5(i.content);return s.size===0?{tr:e,applied:!1,insertEndPos:o}:(e=e.replace(n,o,new dt(s,0,0)),{tr:e,applied:!0,insertEndPos:n+s.size})}function A1(t,e,r){if(r.insertPos!=null){const n=r.insertPos,o=E9(t,e,{buffer:r.buffer,insertPos:n,currentEndPos:r.insertEndPos??n});return{tr:o.tr,newDoc:o.applied?o.tr.doc:null,insertEndPos:o.insertEndPos}}return T9(t,e,r.buffer)}var ht=new et("MILKDOWN_STREAMING");function z9(t,e){if(!t&&e?.type!=="start")return null;if(!e)return t;switch(e.type){case"start":return{buffer:"",originalDoc:e.originalDoc,active:!0,lastApplyTime:e.lastApplyTime,insertPos:e.insertPos??null,insertEndPos:e.insertEndPos??e.insertPos??null};case"push":return t?{...t,buffer:t.buffer+e.token}:null;case"apply":return t?{...t,lastApplyTime:e.lastApplyTime,insertEndPos:e.insertEndPos??t.insertEndPos}:null;case"end":case"abort":return null;default:return t}}var c5=Je(t=>{const e=t.get(li.key);return new Xe({key:ht,state:{init:()=>null,apply(r,n){return z9(n,r.getMeta(ht))}},filterTransaction(r,n){return!ht.getState(n)?.active||r.getMeta(ht)?!0:!r.docChanged},view(){return N9(t,e)}})});ss(c5,{displayName:"Prose<streaming>",group:"Streaming"});function N9(t,e){let r=null,n=-1,o=null;function i(){if(!o)return;const a=ht.getState(o.state);if(!a?.active||a.buffer.length===n)return;n=a.buffer.length;const l=A1(t,o.state.tr,a);if(!l.newDoc)return;let c=l.tr;!c.docChanged&&l.insertEndPos==null||(c=c.setMeta(ht,{type:"apply",lastApplyTime:Date.now(),insertEndPos:l.insertEndPos}),e.scrollFollow&&(c=c.scrollIntoView()),o.dispatch(c))}function s(){r!=null&&clearTimeout(r),r=setTimeout(i,e.throttleMs)}return{update(a){o=a;const l=ht.getState(a.state);if(!l?.active){r!=null&&(clearTimeout(r),r=null),n=-1;return}l.buffer.length!==n&&(Date.now()-l.lastApplyTime>=e.throttleMs?i():s())},destroy(){r!=null&&(clearTimeout(r),r=null),o=null}}}var T1=Me("StartStreaming",()=>t=>(e,r)=>{if(ht.getState(e)?.active)return!1;if(r){let n,o;if(t?.insertAt!=null)if(t.insertAt==="selection"){if(n=e.selection.from,o=e.selection.to,e.selection.empty){const i=e.doc.resolve(n);i.parent.isTextblock&&!i.parent.type.spec.code&&i.parent.content.size===0&&i.depth===1&&(n=i.before(i.depth),o=i.after(i.depth))}}else{const i=t.insertAt==="cursor"?e.selection.head:t.insertAt;if(!Number.isFinite(i))return!1;n=Math.max(0,Math.min(Math.round(i),e.doc.content.size));const s=e.doc.resolve(n);s.parent.isTextblock&&!s.parent.type.spec.code&&s.parent.content.size===0&&s.depth===1&&(n=s.before(s.depth),o=s.after(s.depth))}r(e.tr.setMeta(ht,{type:"start",originalDoc:e.doc,insertPos:n,insertEndPos:o,lastApplyTime:Date.now()}))}return!0});ss(T1,{displayName:"Command<startStreaming>",group:"Streaming"});var M1=Me("PushChunk",()=>t=>(e,r)=>t==null||!ht.getState(e)?.active?!1:(r&&r(e.tr.setMeta(ht,{type:"push",token:t})),!0));ss(M1,{displayName:"Command<pushChunk>",group:"Streaming"});var E1=Me("EndStreaming",t=>e=>(r,n)=>{const o=ht.getState(r);if(!o?.active)return!1;if(n){const i=t.get(li.key),s=e?.diffReview??i.diffReviewOnEnd,a=A1(t,r.tr,o);let l=a.tr;if(l=l.setMeta(ht,{type:"end"}),s&&a.newDoc){const c=l.doc;l=l.replace(0,l.doc.content.size,new dt(o.originalDoc.content,0,0)),n(l);try{t.get(ne).call(C1.key,c)}catch(u){console.warn("[milkdown/streaming] diff review handoff skipped:",u)}return!0}n(l)}return!0});ss(E1,{displayName:"Command<endStreaming>",group:"Streaming"});var as=Me("AbortStreaming",t=>e=>(r,n)=>{const o=ht.getState(r);if(!o?.active)return!1;if(n){const i=e?.keep??!1;let s=r.tr;i?s=A1(t,s,o).tr:s=s.replace(0,r.doc.content.size,new dt(o.originalDoc.content,0,0)),s=s.setMeta(ht,{type:"abort"}),n(s)}return!0});ss(as,{displayName:"Command<abortStreaming>",group:"Streaming"});var H9=[li,c5,T1,M1,E1,as];const E0=Math.min,Xo=Math.max,I0=Math.round,rl=Math.floor,Dn=t=>({x:t,y:t}),$9={left:"right",right:"left",bottom:"top",top:"bottom"};function q9(t,e,r){return Xo(t,E0(e,r))}function hc(t,e){return typeof t=="function"?t(e):t}function ji(t){return t.split("-")[0]}function fc(t){return t.split("-")[1]}function u5(t){return t==="x"?"y":"x"}function d5(t){return t==="y"?"height":"width"}function ho(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function h5(t){return u5(ho(t))}function F9(t,e,r){r===void 0&&(r=!1);const n=fc(t),o=h5(t),i=d5(o);let s=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=L0(s)),[s,L0(s)]}function V9(t){const e=L0(t);return[Qu(t),e,Qu(e)]}function Qu(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Dp=["left","right"],Bp=["right","left"],W9=["top","bottom"],j9=["bottom","top"];function U9(t,e,r){switch(t){case"top":case"bottom":return r?e?Bp:Dp:e?Dp:Bp;case"left":case"right":return e?W9:j9;default:return[]}}function G9(t,e,r,n){const o=fc(t);let i=U9(ji(t),r==="start",n);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(Qu)))),i}function L0(t){const e=ji(t);return $9[e]+t.slice(e.length)}function K9(t){var e,r,n,o;return{top:(e=t.top)!=null?e:0,right:(r=t.right)!=null?r:0,bottom:(n=t.bottom)!=null?n:0,left:(o=t.left)!=null?o:0}}function Z9(t){return typeof t!="number"?K9(t):{top:t,right:t,bottom:t,left:t}}function R0(t){const{x:e,y:r,width:n,height:o}=t;return{width:n,height:o,top:r,left:e,right:e+n,bottom:r+o,x:e,y:r}}function zp(t,e,r){let{reference:n,floating:o}=t;const i=ho(e),s=h5(e),a=d5(s),l=ji(e),c=i==="y",u=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,h=n[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:n.y-o.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-o.width,y:d};break;default:p={x:n.x,y:n.y}}const g=fc(e);return g&&(p[s]+=h*(g==="end"?1:-1)*(r&&c?-1:1)),p}async function X9(t,e){var r;e===void 0&&(e={});const{x:n,y:o,platform:i,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=hc(e,t),g=Z9(p),v=a[h?d==="floating"?"reference":"floating":d],w=R0(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),C=d==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(k))&&await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1},E=R0(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:k,strategy:l}):C);return{top:(w.top-E.top+g.top)/S.y,bottom:(E.bottom-w.bottom+g.bottom)/S.y,left:(w.left-E.left+g.left)/S.x,right:(E.right-w.right+g.right)/S.x}}const Y9=50,J9=async(t,e,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:s}=r,a=s.detectOverflow?s:{...s,detectOverflow:X9},l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=zp(c,n,l),h=n,p=0;const g={};for(let y=0;y<i.length;y++){const v=i[y];if(!v)continue;const{name:w,fn:C}=v,{x:k,y:S,data:E,reset:R}=await C({x:u,y:d,initialPlacement:n,placement:h,strategy:o,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});u=k??u,d=S??d,g[w]={...g[w],...E},R&&p<Y9&&(p++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):R.rects),{x:u,y:d}=zp(c,h,l)),y=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:g}},Q9=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...v}=hc(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const w=ji(o),C=ho(a),k=ji(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(k||!y?[L0(a)]:V9(a)),R=g!=="none";!h&&R&&E.push(...G9(a,y,g,S));const H=[a,...E],O=await l.detectOverflow(e,v),P=[];let $=((n=i.flip)==null?void 0:n.overflows)||[];if(u&&P.push(O[w]),d){const be=F9(o,s,S);P.push(O[be[0]],O[be[1]])}if($=[...$,{placement:o,overflows:P}],!P.every(be=>be<=0)){var ie,N;const be=(((ie=i.flip)==null?void 0:ie.index)||0)+1,Fe=H[be];if(Fe&&(!(d==="alignment"?C!==ho(Fe):!1)||$.every(fe=>ho(fe.placement)===C?fe.overflows[0]>0:!0)))return{data:{index:be,overflows:$},reset:{placement:Fe}};let ke=(N=$.filter(we=>we.overflows[0]<=0).sort((we,fe)=>we.overflows[1]-fe.overflows[1])[0])==null?void 0:N.placement;if(!ke)switch(p){case"bestFit":{var ye;const we=(ye=$.filter(fe=>{if(R){const rt=ho(fe.placement);return rt===C||rt==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(rt=>rt>0).reduce((rt,kt)=>rt+kt,0)]).sort((fe,rt)=>fe[1]-rt[1])[0])==null?void 0:ye[0];we&&(ke=we);break}case"initialPlacement":ke=a;break}if(o!==ke)return{reset:{placement:ke}}}return{}}}},ey=new Set(["left","top"]);async function ty(t,e){const{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=ji(r),a=fc(r),l=ho(r)==="y",c=ey.has(s)?-1:1,u=i&&l?-1:1,d=hc(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const ry=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:o,y:i,placement:s,middlewareData:a}=e,l=await ty(e,t);return s===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},ny=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:C=>{let{x:k,y:S}=C;return{x:k,y:S}}},...c}=hc(t,e),u={x:r,y:n},d=await i.detectOverflow(e,c),h=ho(o),p=u5(h);let g=u[p],y=u[h];const v=(C,k)=>q9(k+d[C==="y"?"top":"left"],k,k-d[C==="y"?"bottom":"right"]);s&&(g=v(p,g)),a&&(y=v(h,y));const w=l.fn({...e,[p]:g,[h]:y});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[p]:s,[h]:a}}}}}};function pc(){return typeof window<"u"}function ls(t){return f5(t)?(t.nodeName||"").toLowerCase():"#document"}function er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $n(t){var e;return(e=(f5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function f5(t){return pc()?t instanceof Node||t instanceof er(t).Node:!1}function cn(t){return pc()?t instanceof Element||t instanceof er(t).Element:!1}function _o(t){return pc()?t instanceof HTMLElement||t instanceof er(t).HTMLElement:!1}function Np(t){return!pc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof er(t).ShadowRoot}function mc(t){const{overflow:e,overflowX:r,overflowY:n,display:o}=un(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&o!=="inline"&&o!=="contents"}function oy(t){return/^(table|td|th)$/.test(ls(t))}function gc(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const iy=/transform|translate|scale|rotate|perspective|filter/,sy=/paint|layout|strict|content/,Eo=t=>!!t&&t!=="none";let cu;function I1(t){const e=cn(t)?un(t):t;return Eo(e.transform)||Eo(e.translate)||Eo(e.scale)||Eo(e.rotate)||Eo(e.perspective)||!L1()&&(Eo(e.backdropFilter)||Eo(e.filter))||iy.test(e.willChange||"")||sy.test(e.contain||"")}function ay(t){let e=ri(t);for(;_o(e)&&!pa(e);){if(I1(e))return e;if(gc(e))return null;e=ri(e)}return null}function L1(){return cu==null&&(cu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),cu}function pa(t){return/^(html|body|#document)$/.test(ls(t))}function un(t){return er(t).getComputedStyle(t)}function vc(t){return cn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ri(t){if(ls(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Np(t)&&t.host||$n(t);return Np(e)?e.host:e}function p5(t){const e=ri(t);return pa(e)?(t.ownerDocument||t).body:_o(e)&&mc(e)?e:p5(e)}function ma(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const o=p5(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),s=er(o);if(i){const a=ed(s);return e.concat(s,s.visualViewport||[],mc(o)?o:[],a&&r?ma(a):[])}else return e.concat(o,ma(o,[],r))}function ed(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function m5(t){const e=un(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=_o(t),i=o?t.offsetWidth:r,s=o?t.offsetHeight:n,a=I0(r)!==i||I0(n)!==s;return a&&(r=i,n=s),{width:r,height:n,$:a}}function R1(t){return cn(t)?t:t.contextElement}function Bi(t){const e=R1(t);if(!_o(e))return Dn(1);const r=e.getBoundingClientRect(),{width:n,height:o,$:i}=m5(e);let s=(i?I0(r.width):r.width)/n,a=(i?I0(r.height):r.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ly=Dn(0);function g5(t){const e=er(t);return!L1()||!e.visualViewport?ly:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function cy(t,e,r){return e===void 0&&(e=!1),!!r&&e&&r===er(t)}function ni(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const o=t.getBoundingClientRect(),i=R1(t);let s=Dn(1);e&&(n?cn(n)&&(s=Bi(n)):s=Bi(t));const a=cy(i,r,n)?g5(i):Dn(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i&&n){const h=er(i),p=cn(n)?er(n):n;let g=h,y=ed(g);for(;y&&p!==g;){const v=Bi(y),w=y.getBoundingClientRect(),C=un(y),k=w.left+(y.clientLeft+parseFloat(C.paddingLeft))*v.x,S=w.top+(y.clientTop+parseFloat(C.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=k,c+=S,g=er(y),y=ed(g)}}return R0({width:u,height:d,x:l,y:c})}function yc(t,e){const r=vc(t).scrollLeft;return e?e.left+r:ni($n(t)).left+r}function v5(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-yc(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function uy(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t;const i=o==="fixed",s=$n(n),a=e?gc(e.floating):!1;if(n===s||a&&i)return r;let l={scrollLeft:0,scrollTop:0},c=Dn(1);const u=Dn(0),d=_o(n);if((d||!i)&&((ls(n)!=="body"||mc(s))&&(l=vc(n)),d)){const p=ni(n);c=Bi(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const h=s&&!d&&!i?v5(s,l):Dn(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:r.y*c.y-l.scrollTop*c.y+u.y+h.y}}function dy(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function hy(t){const e=vc(t),r=t.ownerDocument.body,n=Xo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Xo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-e.scrollLeft+yc(t);const s=-e.scrollTop;return un(r).direction==="rtl"&&(i+=Xo(t.clientWidth,r.clientWidth)-n),{width:n,height:o,x:i,y:s}}const fy=25;function py(t,e,r){r===void 0&&(r="viewport");const n=r==="layoutViewport",o=er(t),i=$n(t),s=o.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(s){const h=!L1()||e==="fixed";n?h||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,h&&(c=s.offsetLeft,u=s.offsetTop))}if(yc(i)<=0){const h=i.ownerDocument,p=h.body,g=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(i.clientWidth-p.clientWidth-y),w=getComputedStyle(i).scrollbarGutter==="stable both-edges"?v/2:v;w<=fy&&(a-=w)}return{width:a,height:l,x:c,y:u}}function my(t,e){const r=ni(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Bi(t),s=t.clientWidth*i.x,a=t.clientHeight*i.y,l=o*i.x,c=n*i.y;return{width:s,height:a,x:l,y:c}}function Hp(t,e,r){let n;if(e==="viewport"||e==="layoutViewport")n=py(t,r,e);else if(e==="document")n=hy($n(t));else if(cn(e))n=my(e,r);else{const o=g5(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return R0(n)}function gy(t,e){const r=e.get(t);if(r)return r;let n=ma(t,[],!1).filter(a=>cn(a)&&ls(a)!=="body"),o=null;const i=un(t).position==="fixed";let s=i?ri(t):t;for(;cn(s)&&!pa(s);){const a=un(s),l=I1(s),c=o?o.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?n=n.filter(d=>d!==s):o=a,s=ri(s)}return e.set(t,n),n}function vy(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t;const s=[...r==="clippingAncestors"?gc(e)?[]:gy(e,this._c):[].concat(r),n],a=Hp(e,s[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<s.length;h++){const p=Hp(e,s[h],o);l=Xo(p.top,l),c=E0(p.right,c),u=E0(p.bottom,u),d=Xo(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function yy(t){const{width:e,height:r}=m5(t);return{width:e,height:r}}function by(t,e,r){const n=_o(e),o=$n(e),i=r==="fixed",s=ni(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Dn(0);if((n||!i)&&((ls(e)!=="body"||mc(o))&&(a=vc(e)),n)){const h=ni(e,!0,i,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!n&&o&&(l.x=yc(o));const c=o&&!n&&!i?v5(o,a):Dn(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function uu(t){return un(t).position==="static"}function $p(t,e){if(!_o(t)||un(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return $n(t)===r&&(r=r.ownerDocument.body),r}function y5(t,e){const r=er(t);if(gc(t))return r;if(!_o(t)){let o=ri(t);for(;o&&!pa(o);){if(cn(o)&&!uu(o))return o;o=ri(o)}return r}let n=$p(t,e);for(;n&&oy(n)&&uu(n);)n=$p(n,e);return n&&pa(n)&&uu(n)&&!I1(n)?r:n||ay(t)||r}const wy=async function(t){const e=this.getOffsetParent||y5,r=this.getDimensions,n=await r(t.floating);return{reference:by(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function xy(t){return un(t).direction==="rtl"}const Cy={convertOffsetParentRelativeRectToViewportRelativeRect:uy,getDocumentElement:$n,getClippingRect:vy,getOffsetParent:y5,getElementRects:wy,getClientRects:dy,getDimensions:yy,getScale:Bi,isElement:cn,isRTL:xy};function b5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ky(t,e,r){let n=null,o;const i=$n(t);function s(){var u;clearTimeout(o),(u=n)==null||u.disconnect(),n=null}function a(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();const h=t.getBoundingClientRect(),{left:p,top:g,width:y,height:v}=h;if(u||e(),!y||!v)return;const w=rl(g),C=rl(i.clientWidth-(p+y)),k=rl(i.clientHeight-(g+v)),S=rl(p),R={rootMargin:-w+"px "+-C+"px "+-k+"px "+-S+"px",threshold:Xo(0,E0(1,d))||1};let H=!0;function O(P){const $=P[0].intersectionRatio;if(!b5(h,t.getBoundingClientRect()))return a();if($!==d){if(!H)return a();$?a(!1,$):o=setTimeout(()=>{a(!1,1e-7)},1e3)}H=!1}try{n=new IntersectionObserver(O,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(O,R)}n.observe(t)}const l=er(t),c=()=>a(r);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),s()}}function qp(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=R1(t),u=o||i?[...c?ma(c):[],...e?ma(e):[]]:[];u.forEach(w=>{o&&w.addEventListener("scroll",r),i&&w.addEventListener("resize",r)});const d=c&&a?ky(c,r,i):null;let h=-1,p=null;s&&(p=new ResizeObserver(w=>{let[C]=w;C&&C.target===c&&p&&e&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),r()}),c&&!l&&p.observe(c),e&&p.observe(e));let g,y=l?ni(t):null;l&&v();function v(){const w=ni(t);y&&!b5(y,w)&&r(),y=w,g=requestAnimationFrame(v)}return r(),()=>{var w;u.forEach(C=>{o&&C.removeEventListener("scroll",r),i&&C.removeEventListener("resize",r)}),d?.(),(w=p)==null||w.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const oi=ry,_y=ny,O1=Q9,dn=(t,e,r)=>{const n=new Map,o=r??{},i={...Cy,...o.platform,_c:n};return J9(t,e,{...o,platform:i})};var Ba=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;#l;#u;constructor(t){this.#t=!1,this.onShow=()=>{},this.onHide=()=>{},this.#d=e=>{dn(e,this.element,{placement:this.#r.placement??"top",middleware:[O1(),oi(this.#a),_y(this.#l),...this.#n],...this.#r}).then(({x:r,y:n})=>{Object.assign(this.element.style,{left:`${r}px`,top:`${n}px`})}).catch(console.error)},this.#h=e=>this.#c!==e.dom.parentElement,this.#f=(e,r)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map(p=>p.$from.pos)),c=Math.max(...a.map(p=>p.$to.pos)),u=p=>!!p&&p.doc.eq(s)&&p.selection.eq(i),d=u(r)&&u(this.#s);if(this.#t||((this.#c??e.dom.parentElement??document.body).appendChild(this.element),this.#t=!0),o||d)return;if(this.#s=n,this.#i?.(),this.#i=void 0,!this.#o(e,r)){this.hide();return}const h={getBoundingClientRect:()=>Oa(e,l,c),contextElement:e.dom};this.#h(e)?this.#i=qp(h,this.element,()=>this.#d(h)):this.#d(h),this.show()},this.update=(e,r)=>{this.#u(e,r)},this.#p=e=>{const{doc:r,selection:n}=e.state,{empty:o,from:i,to:s}=n,a=!r.textBetween(i,s).length&&e.state.selection instanceof Ce,l=this.element.contains(document.activeElement),c=!e.hasFocus()&&!l,u=!e.editable;return!(c||o||a||u)},this.destroy=()=>{this.#i?.(),this.#u.cancel()},this.show=(e,r)=>{if(this.element.dataset.show="true",e){this.#i?.(),this.#i=void 0;const n={...e,contextElement:r?.dom};r&&this.#h(r)?this.#i=qp(n,this.element,()=>this.#d(n)):this.#d(n)}this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=t.content,this.#e=t.debounce??200,this.#o=t.shouldShow??this.#p,this.#a=t.offset,this.#l=t.shift,this.#n=t.middleware??[],this.#r=t.floatingUIOptions??{},this.#c=t.root,this.element.dataset.show="false",this.#u=ac(this.#f,this.#e)}#d;#h;#f;#p};function za(t){const e=Ve({},`${t}_TOOLTIP_SPEC`),r=Je(o=>{const i=o.get(e.key);return new Xe({key:new et(`${t}_TOOLTIP`),...i})}),n=[e,r];return n.key=e.key,n.pluginKey=r.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${t}`},r.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${t}`},n}function P1(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const Ke={},Oi=[],zr=()=>{},w5=()=>!1,bc=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),wc=t=>t.startsWith("onUpdate:"),Lt=Object.assign,D1=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},Sy=Object.prototype.hasOwnProperty,De=(t,e)=>Sy.call(t,e),ve=Array.isArray,Yo=t=>Na(t)==="[object Map]",td=t=>Na(t)==="[object Set]",Fp=t=>Na(t)==="[object Date]",xe=t=>typeof t=="function",mt=t=>typeof t=="string",go=t=>typeof t=="symbol",Ze=t=>t!==null&&typeof t=="object",x5=t=>(Ze(t)||xe(t))&&xe(t.then)&&xe(t.catch),Ay=Object.prototype.toString,Na=t=>Ay.call(t),Ty=t=>Na(t).slice(8,-1),My=t=>Na(t)==="[object Object]",B1=t=>mt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,oa=P1(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xc=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},Ey=/-\w/g,Nr=xc(t=>t.replace(Ey,e=>e.slice(1).toUpperCase())),Iy=/\B([A-Z])/g,ci=xc(t=>t.replace(Iy,"-$1").toLowerCase()),C5=xc(t=>t.charAt(0).toUpperCase()+t.slice(1)),du=xc(t=>t?`on${C5(t)}`:""),nn=(t,e)=>!Object.is(t,e),hu=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},O0=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},Ly=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Vp;const Jo=()=>Vp||(Vp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function z1(t){if(ve(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],o=mt(n)?Dy(n):z1(n);if(o)for(const i in o)e[i]=o[i]}return e}else if(mt(t)||Ze(t))return t}const Ry=/;(?![^(]*\))/g,Oy=/:([^]+)/,Py=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Dy(t){const e={};return t.replace(Py,r=>r.startsWith("/*")?"":r).split(Ry).forEach(r=>{if(r){const n=r.split(Oy);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function N1(t){let e="";if(mt(t))e=t;else if(ve(t))for(let r=0;r<t.length;r++){const n=N1(t[r]);n&&(e+=n+" ")}else if(Ze(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const By="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly",zy=P1(By);function k5(t){return!!t||t===""}function Ny(t,e,r){if(t.length!==e.length)return!1;let n=!0;for(let o=0;n&&o<t.length;o++)n=Cc(t[o],e[o],r);return n}function Wp(t,e,r){if(t.size!==e.size)return!1;const n=Array.from(e),o=new Uint8Array(n.length);for(const i of t){let s=-1;for(let a=0;a<n.length;a++)if(!o[a]&&Cc(i,n[a],r)){s=a;break}if(s<0)return!1;o[s]=1}return!0}function Hy(t,e,r){let n=Yo(t),o=Yo(e);if(n||o||(n=td(t),o=td(e),n||o))return n&&o?Wp(t,e,r):!1;const i=Object.keys(t).length,s=Object.keys(e).length;if(i!==s)return!1;for(const a in t){const l=t.hasOwnProperty(a),c=e.hasOwnProperty(a);if(l&&!c||!l&&c||!Cc(t[a],e[a],r))return!1}return String(t)===String(e)}function jp(t,e,r,n){r||(r=[new Map,new Map]);const[o,i]=r;if(o.has(t)||i.has(e))return o.get(t)===e&&i.get(e)===t;o.set(t,e),i.set(e,t);const s=n(t,e,r);return o.delete(t),i.delete(e),s}function Cc(t,e,r){if(t===e)return!0;let n=Fp(t),o=Fp(e);return n||o?n&&o?t.getTime()===e.getTime():!1:(n=go(t),o=go(e),n||o?t===e:(n=ve(t),o=ve(e),n||o?n&&o?jp(t,e,r,Ny):!1:(n=Ze(t),o=Ze(e),n||o?!n||!o?!1:jp(t,e,r,Hy):String(t)===String(e))))}let It;class $y{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&It&&(It.active?(this.parent=It,this.index=(It.scopes||(It.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes){const n=this.scopes.slice();for(e=0,r=n.length;e<r;e++)n[e].pause()}for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes){const o=this.scopes.slice();for(e=0,r=o.length;e<r;e++)o[e].resume()}const n=this.effects.slice();for(e=0,r=n.length;e<r;e++)n[e].resume()}}run(e){if(this._active){const r=It;try{return It=this,e()}finally{It=r}}}on(){++this._on===1&&(this.prevScope=It,It=this)}off(){if(this._on>0&&--this._on===0){if(It===this)It=this.prevScope;else{let e=It;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(r=0,n=o.length;r<n;r++)o[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function qy(){return It}let Ge;const fu=new WeakSet;class _5{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,It&&(It.active?It.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fu.has(this)&&(fu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||A5(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Up(this),T5(this);const e=Ge,r=Hr;Ge=this,Hr=!0;try{return this.fn()}finally{M5(this),Ge=e,Hr=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)q1(e);this.deps=this.depsTail=void 0,Up(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){rd(this)&&this.run()}get dirty(){return rd(this)}}let S5=0,ia,sa;function A5(t,e=!1){if(t.flags|=8,e){t.next=sa,sa=t;return}t.next=ia,ia=t}function H1(){S5++}function $1(){if(--S5>0)return;if(sa){let e=sa;for(sa=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;ia;){let e=ia;for(ia=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function T5(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function M5(t){let e,r=t.depsTail,n=r;for(;n;){const o=n.prevDep;n.version===-1?(n===r&&(r=o),q1(n),Fy(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=o}t.deps=e,t.depsTail=r}function rd(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(E5(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function E5(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===ga)||(t.globalVersion=ga,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!rd(t))))return;t.flags|=2;const e=t.dep,r=Ge,n=Hr;Ge=t,Hr=!0;try{T5(t);const o=t.fn(t._value);(e.version===0||nn(o,t._value))&&(t.flags|=128,t._value=o,e.version++)}catch(o){throw e.version++,o}finally{Ge=r,Hr=n,M5(t),t.flags&=-3}}function q1(t,e=!1){const{dep:r,prevSub:n,nextSub:o}=t;if(n&&(n.nextSub=o,t.prevSub=void 0),o&&(o.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)q1(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Fy(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let Hr=!0;const I5=[];function hn(){I5.push(Hr),Hr=!1}function fn(){const t=I5.pop();Hr=t===void 0?!0:t}function Up(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=Ge;Ge=void 0;try{e()}finally{Ge=r}}}let ga=0;class Vy{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class F1{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ge||!Hr||Ge===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==Ge)r=this.activeLink=new Vy(Ge,this),Ge.deps?(r.prevDep=Ge.depsTail,Ge.depsTail.nextDep=r,Ge.depsTail=r):Ge.deps=Ge.depsTail=r,L5(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=Ge.depsTail,r.nextDep=void 0,Ge.depsTail.nextDep=r,Ge.depsTail=r,Ge.deps===r&&(Ge.deps=n)}return r}trigger(e){this.version++,ga++,this.notify(e)}notify(e){H1();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{$1()}}}function L5(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)L5(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const nd=new WeakMap,Qo=Symbol(""),od=Symbol(""),va=Symbol("");function Pt(t,e,r){if(Hr&&Ge){let n=nd.get(t);n||nd.set(t,n=new Map);let o=n.get(r);o||(n.set(r,o=new F1),o.map=n,o.key=r),o.track()}}function Ln(t,e,r,n,o,i){const s=nd.get(t);if(!s){ga++;return}const a=l=>{l&&l.trigger()};if(H1(),e==="clear")s.forEach(a);else{const l=ve(t),c=l&&B1(r);if(l&&r==="length"){const u=Number(n);s.forEach((d,h)=>{(h==="length"||h===va||!go(h)&&h>=u)&&a(d)})}else switch((r!==void 0||s.has(void 0))&&a(s.get(r)),c&&a(s.get(va)),e){case"add":l?c&&a(s.get("length")):(a(s.get(Qo)),Yo(t)&&a(s.get(od)));break;case"delete":l||(a(s.get(Qo)),Yo(t)&&a(s.get(od)));break;case"set":Yo(t)&&a(s.get(Qo));break}}$1()}function mi(t){const e=Ne(t);return e===t||(Pt(e,"iterate",va),$r(t))?e:Nn(t)?ei(t)?e.map(r=>ii(pn(r))):e.map(ii):e.map(pn)}function V1(t){return Pt(t=Ne(t),"iterate",va),t}function Qr(t,e){return Nn(t)?ii(ei(t)?pn(e):e):pn(e)}const Wy={__proto__:null,[Symbol.iterator](){return pu(this,Symbol.iterator,t=>Qr(this,t))},concat(...t){return mi(this).concat(...t.map(e=>ve(e)?mi(e):e))},entries(){return pu(this,"entries",t=>(t[1]=Qr(this,t[1]),t))},every(t,e){return xn(this,"every",t,e,void 0,arguments)},filter(t,e){return xn(this,"filter",t,e,r=>r.map(n=>Qr(this,n)),arguments)},find(t,e){return xn(this,"find",t,e,r=>Qr(this,r),arguments)},findIndex(t,e){return xn(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return xn(this,"findLast",t,e,r=>Qr(this,r),arguments)},findLastIndex(t,e){return xn(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return xn(this,"forEach",t,e,void 0,arguments)},includes(...t){return mu(this,"includes",t)},indexOf(...t){return mu(this,"indexOf",t)},join(t){return mi(this).join(t)},lastIndexOf(...t){return mu(this,"lastIndexOf",t)},map(t,e){return xn(this,"map",t,e,void 0,arguments)},pop(){return Ss(this,"pop")},push(...t){return Ss(this,"push",t)},reduce(t,...e){return Kp(this,"reduce",t,e)},reduceRight(t,...e){return Kp(this,"reduceRight",t,e)},shift(){return Ss(this,"shift")},some(t,e){return xn(this,"some",t,e,void 0,arguments)},splice(...t){return Ss(this,"splice",t)},toReversed(){return mi(this).toReversed()},toSorted(t){return mi(this).toSorted(t)},toSpliced(...t){return mi(this).toSpliced(...t)},unshift(...t){return Ss(this,"unshift",t)},values(){return pu(this,"values",t=>Qr(this,t))}};function pu(t,e,r){const n=V1(t),o=n[e],i=o.call(n);if(n!==t&&!$r(t)){if(i[Symbol.toStringTag]==="Array Iterator"){const s=Object.create(Object.getPrototypeOf(i));return s.next=()=>Gp(i.next(),r),o!==R5[e]&&Object.defineProperties(s,{return:{get(){const a=i.return;return typeof a=="function"?a.bind(i):a}},throw:{get(){const a=i.throw;return typeof a=="function"?a.bind(i):a}}}),s}i._next=i.next,i.next=()=>Gp(i._next(),r)}return i}function Gp(t,e){return t.done||(t.value=e(t.value)),t}const R5=Array.prototype;function xn(t,e,r,n,o,i){const s=V1(t),a=s!==t&&!$r(t),l=s[e];if(l!==R5[e]){const d=l.apply(t,i);return a?pn(d):d}let c=r;s!==t&&(a?c=function(d,h){return r.call(this,Qr(t,d),h,t)}:r.length>2&&(c=function(d,h){return r.call(this,d,h,t)}));const u=l.call(s,c,n);return a&&o?o(u):u}function Kp(t,e,r,n){const o=V1(t),i=o!==t&&!$r(t);let s=r,a=!1;o!==t&&(i?(a=n.length===0,s=function(c,u,d){return a&&(a=!1,c=Qr(t,c)),r.call(this,c,Qr(t,u),d,t)}):r.length>3&&(s=function(c,u,d){return r.call(this,c,u,d,t)}));const l=o[e](s,...n);return a?Qr(t,l):l}function mu(t,e,r){const n=Ne(t);Pt(n,"iterate",va);const o=n[e](...r);return(o===-1||o===!1)&&G1(r[0])?(r[0]=Ne(r[0]),n[e](...r)):o}function Ss(t,e,r=[]){hn(),H1();const n=Ne(t)[e].apply(t,r);return $1(),fn(),n}const jy=P1("__proto__,__v_isRef,__isVue"),O5=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(go));function Uy(t){go(t)||(t=String(t));const e=Ne(this);return Pt(e,"has",t),e.hasOwnProperty(t)}class P5{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const o=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!o;if(r==="__v_isReadonly")return o;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(o?i?rb:N5:i?z5:B5).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=ve(e);if(!o){let l;if(s&&(l=Wy[r]))return l;if(r==="hasOwnProperty")return Uy}const a=Reflect.get(e,r,zt(e)?e:n);if((go(r)?O5.has(r):jy(r))||(o||Pt(e,"get",r),i))return a;if(zt(a)){const l=s&&B1(r)?a:a.value;return o&&Ze(l)?sd(l):l}return Ze(a)?o?sd(a):j1(a):a}}class D5 extends P5{constructor(e=!1){super(!1,e)}set(e,r,n,o){let i=e[r];const s=ve(e)&&B1(r);if(!this._isShallow){const c=Nn(i);if(!$r(n)&&!Nn(n)&&(i=Ne(i),n=Ne(n)),!s&&zt(i)&&!zt(n))return c||(i.value=n),!0}const a=s?Number(r)<e.length:De(e,r),l=Reflect.set(e,r,n,zt(e)?e:o);return e===Ne(o)&&l&&(a?nn(n,i)&&Ln(e,"set",r,n):Ln(e,"add",r,n)),l}deleteProperty(e,r){const n=De(e,r);e[r];const o=Reflect.deleteProperty(e,r);return o&&n&&Ln(e,"delete",r,void 0),o}has(e,r){const n=Reflect.has(e,r);return(!go(r)||!O5.has(r))&&Pt(e,"has",r),n}ownKeys(e){return Pt(e,"iterate",ve(e)?"length":Qo),Reflect.ownKeys(e)}}class Gy extends P5{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Ky=new D5,Zy=new Gy,Xy=new D5(!0);const id=t=>t,nl=t=>Reflect.getPrototypeOf(t);function Yy(t,e,r){return function(...n){const o=this.__v_raw,i=Ne(o),s=Yo(i),a=t==="entries"||t===Symbol.iterator&&s,l=t==="keys"&&s,c=o[t](...n),u=r?id:e?ii:pn;return!e&&Pt(i,"iterate",l?od:Qo),Lt(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:a?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function ol(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Jy(t,e){const r={get(o){const i=this.__v_raw,s=Ne(i),a=Ne(o);t||(nn(o,a)&&Pt(s,"get",o),Pt(s,"get",a));const{has:l}=nl(s),c=e?id:t?ii:pn;if(l.call(s,o))return c(i.get(o));if(l.call(s,a))return c(i.get(a));i!==s&&i.get(o)},get size(){const o=this.__v_raw;return!t&&Pt(Ne(o),"iterate",Qo),o.size},has(o){const i=this.__v_raw,s=Ne(i),a=Ne(o);return t||(nn(o,a)&&Pt(s,"has",o),Pt(s,"has",a)),o===a?i.has(o):i.has(o)||i.has(a)},forEach(o,i){const s=this,a=s.__v_raw,l=Ne(a),c=e?id:t?ii:pn;return!t&&Pt(l,"iterate",Qo),a.forEach((u,d)=>o.call(i,c(u),c(d),s))}};return Lt(r,t?{add:ol("add"),set:ol("set"),delete:ol("delete"),clear:ol("clear")}:{add(o){const i=Ne(this),s=nl(i),a=Ne(o),l=!e&&!$r(o)&&!Nn(o)?a:o;return s.has.call(i,l)||nn(o,l)&&s.has.call(i,o)||nn(a,l)&&s.has.call(i,a)||(i.add(l),Ln(i,"add",l,l)),this},set(o,i){!e&&!$r(i)&&!Nn(i)&&(i=Ne(i));const s=Ne(this),{has:a,get:l}=nl(s);let c=a.call(s,o);c||(o=Ne(o),c=a.call(s,o));const u=l.call(s,o);return s.set(o,i),c?nn(i,u)&&Ln(s,"set",o,i):Ln(s,"add",o,i),this},delete(o){const i=Ne(this),{has:s,get:a}=nl(i);let l=s.call(i,o);l||(o=Ne(o),l=s.call(i,o)),a&&a.call(i,o);const c=i.delete(o);return l&&Ln(i,"delete",o,void 0),c},clear(){const o=Ne(this),i=o.size!==0,s=o.clear();return i&&Ln(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{r[o]=Yy(o,t,e)}),r}function W1(t,e){const r=Jy(t,e);return(n,o,i)=>o==="__v_isReactive"?!t:o==="__v_isReadonly"?t:o==="__v_isShallow"?e:o==="__v_raw"?n:Reflect.get(De(r,o)&&o in n?r:n,o,i)}const Qy={get:W1(!1,!1)},eb={get:W1(!1,!0)},tb={get:W1(!0,!1)};const B5=new WeakMap,z5=new WeakMap,N5=new WeakMap,rb=new WeakMap;function nb(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function j1(t){return Nn(t)?t:U1(t,!1,Ky,Qy,B5)}function ob(t){return U1(t,!1,Xy,eb,z5)}function sd(t){return U1(t,!0,Zy,tb,N5)}function U1(t,e,r,n,o){if(!Ze(t)||t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=o.get(t);if(i)return i;const s=nb(Ty(t));if(s===0)return t;const a=new Proxy(t,s===2?n:r);return o.set(t,a),a}function ei(t){return Nn(t)?ei(t.__v_raw):!!(t&&t.__v_isReactive)}function Nn(t){return!!(t&&t.__v_isReadonly)}function $r(t){return!!(t&&t.__v_isShallow)}function G1(t){return t?!!t.__v_raw:!1}function Ne(t){const e=t&&t.__v_raw;return e?Ne(e):t}function ib(t){return!De(t,"__v_skip")&&Object.isExtensible(t)&&O0(t,"__v_skip",!0),t}const pn=t=>Ze(t)?j1(t):t,ii=t=>Ze(t)?sd(t):t;function zt(t){return t?t.__v_isRef===!0:!1}function re(t){return H5(t,!1)}function P0(t){return H5(t,!0)}function H5(t,e){return zt(t)?t:new sb(t,e)}class sb{constructor(e,r){this.dep=new F1,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:Ne(e),this._value=r?e:pn(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||$r(e)||Nn(e);e=n?e:Ne(e),nn(e,r)&&(this._rawValue=e,this._value=n?e:pn(e),this.dep.trigger())}}function ab(t){return zt(t)?t.value:t}const lb={get:(t,e,r)=>e==="__v_raw"?t:ab(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const o=t[e];return zt(o)&&!zt(r)?(o.value=r,!0):Reflect.set(t,e,r,n)}};function $5(t){return ei(t)?t:new Proxy(t,lb)}class cb{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new F1(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ga-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ge!==this)return A5(this,!0),!0}get value(){const e=this.dep.track();return E5(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function ub(t,e,r=!1){let n,o;return xe(t)?n=t:(n=t.get,o=t.set),new cb(n,o,r)}const il={},D0=new WeakMap;let Ho;function db(t,e=!1,r=Ho){if(r){let n=D0.get(r);n||D0.set(r,n=[]),n.push(t)}}function hb(t,e,r=Ke){const{immediate:n,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=r,c=S=>o?S:$r(S)||o===!1||o===0?so(S,1):so(S);let u,d,h,p,g=!1,y=!1;if(zt(t)?(d=()=>t.value,g=$r(t)):ei(t)?(d=()=>c(t),g=!0):ve(t)?(y=!0,g=t.some(S=>ei(S)||$r(S)),d=()=>t.map(S=>{if(zt(S))return S.value;if(ei(S))return c(S);if(xe(S))return l?l(S,2):S()})):xe(t)?e?d=l?()=>l(t,2):t:d=()=>{if(h){hn();try{h()}finally{fn()}}const S=Ho;Ho=u;try{return l?l(t,3,[p]):t(p)}finally{Ho=S}}:d=zr,e&&o){const S=d,E=o===!0?1/0:o;d=()=>so(S(),E)}const v=qy(),w=()=>{u.stop(),v&&v.active&&D1(v.effects,u)};if(i&&e){const S=e;e=(...E)=>{try{return S(...E)}finally{w()}}}let C=y?new Array(t.length).fill(il):il;const k=S=>{if(!(!(u.flags&1)||!u.dirty&&!S))if(e){const E=u.run();if(S||o||g||(y?E.some((R,H)=>nn(R,C[H])):nn(E,C))){const R=Ho;hn();try{h&&h(),Ho=u;const H=[E,C===il?void 0:y&&C[0]===il?[]:C,p];C=E,l?l(e,3,H):e(...H)}finally{Ho=R,fn()}}}else u.run()};return a&&a(k),u=new _5(d),u.scheduler=s?()=>s(k,!1):k,p=S=>db(S,!1,u),h=u.onStop=()=>{const S=D0.get(u);if(S){if(l)l(S,4);else for(const E of S)E();D0.delete(u)}},e?n?k(!0):C=u.run():s?s(k.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function so(t,e=1/0,r){if(e<=0||!Ze(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,zt(t))so(t.value,e,r);else if(ve(t))for(let n=0;n<t.length;n++)so(t[n],e,r);else if(td(t)||Yo(t))t.forEach(n=>{so(n,e,r)});else if(My(t)){for(const n in t)so(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&so(t[n],e,r)}return t}function Ha(t,e,r,n){try{return n?t(...n):t()}catch(o){kc(o,e,r)}}function Vr(t,e,r,n){if(xe(t)){const o=Ha(t,e,r,n);return o&&x5(o)&&o.catch(i=>{kc(i,e,r)}),o}if(ve(t)){const o=[];for(let i=0;i<t.length;i++)o.push(Vr(t[i],e,r,n));return o}}function kc(t,e,r,n=!0){const o=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=e&&e.appContext.config||Ke;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,l,c)===!1)return}a=a.parent}if(i){hn(),Ha(i,null,10,[t,l,c]),fn();return}}fb(t,r,o,n,s)}function fb(t,e,r,n=!0,o=!1){if(o)throw t;console.error(t)}const Wt=[];let Pr=-1;const en=[];let io=null,xi=0;const q5=Promise.resolve();let B0=null;function ad(t){const e=B0||q5;return t?e.then(this?t.bind(this):t):e}function pb(t){let e=Pr+1,r=Wt.length;for(;e<r;){const n=e+r>>>1,o=Wt[n],i=ya(o);i<t||i===t&&o.flags&2?e=n+1:r=n}return e}function K1(t){if(!(t.flags&1)){const e=ya(t),r=Wt[Wt.length-1];!r||!(t.flags&2)&&e>=ya(r)?Wt.push(t):Wt.splice(pb(e),0,t),t.flags|=1,F5()}}function F5(){B0||(B0=q5.then(j5))}function mb(t){if(!ve(t))io&&t.id===-1?io.splice(xi+1,0,t):t.flags&1||(en.push(t),t.flags|=1);else for(let e=0;e<t.length;e++)en.push(t[e]);F5()}function V5(t,e,r,n=Pr+1){for(;n<Wt.length;n++){const o=Wt[n];if(o&&o.flags&2){if(t&&o.id!==t.uid||e!==void 0&&!(o.id>=e))continue;Wt.splice(n,1),n=t?n-1:Pr,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function W5(t,e,r=0){if(en.length){let n=en,o=0;if(e){n=[];for(let s=0;s<en.length;s++){const a=en[s];(a.i!==void 0?!a.i||a.i.uid<r:e.has(a))?en[o++]=a:n.push(a)}}const i=[...new Set(n)].sort((s,a)=>ya(s)-ya(a));if(en.length=o,io){for(let s=0;s<i.length;s++)io.push(i[s]);return}for(io=i,xi=0;xi<io.length;xi++){const s=io[xi];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}io=null,xi=0}}let gu=!1;function gb(t,e){if(gu){t();return}const r=e===void 0?void 0:new Set(en);t(),gu=!0;try{V5(void 0,e),W5(void 0,r,e)}finally{gu=!1}}const ya=t=>t.id==null?t.flags&2?-1:1/0:t.id;function j5(t){try{for(Pr=0;Pr<Wt.length;Pr++){const e=Wt[Pr];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ha(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Pr<Wt.length;Pr++){const e=Wt[Pr];e&&(e.flags&=-2)}Pr=-1,Wt.length=0,W5(),B0=null,(Wt.length||en.length)&&j5()}}let on,Os=[],ld=!1;function _c(t,...e){on?on.emit(t,...e):ld||Os.push({event:t,args:e})}function U5(t,e){var r,n;on=t,on?(on.enabled=!0,Os.forEach(({event:o,args:i})=>on.emit(o,...i)),Os=[]):typeof window<"u"&&window.HTMLElement&&!((n=(r=window.navigator)==null?void 0:r.userAgent)!=null&&n.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{U5(i,e)}),setTimeout(()=>{on||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ld=!0,Os=[])},3e3)):(ld=!0,Os=[])}function vb(t,e){_c("app:init",t,e,{Fragment:Ie,Text:$a,Comment:mn,Static:Pl})}function yb(t){_c("app:unmount",t)}const bb=Z1("component:added"),G5=Z1("component:updated"),wb=Z1("component:removed"),xb=t=>{on&&typeof on.cleanupBuffer=="function"&&!on.cleanupBuffer(t)&&wb(t)};function Z1(t){return e=>{_c(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}function Cb(t,e,r){_c("component:emit",t.appContext.app,t,e,r)}let sn=null,K5=null;function z0(t){const e=sn;return sn=t,K5=t&&t.type.__scopeId||null,e}function kb(t,e=sn,r){if(!e||t._n)return t;const n=(...o)=>{n._d&&q0(-1);const i=z0(e),s=Ni.length;let a;try{a=t(...o)}finally{for(let l=Ni.length;l>s;l--)mw();z0(i),n._d&&q0(1)}return __VUE_PROD_DEVTOOLS__&&G5(e),a};return n._n=!0,n._c=!0,n._d=!0,n}function Io(t,e,r,n){const o=t.dirs,i=e&&e.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[n];l&&(hn(),Vr(l,r,8,[t.el,a,t,e]),fn())}}function _b(t,e){if(Ut){let r=Ut.provides;const n=Ut.parent&&Ut.parent.provides;n===r&&(r=Ut.provides=Object.create(n)),r[t]=e}}function Ol(t,e,r=!1){const n=_w();if(n||zi){let o=zi?zi._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(o&&t in o)return o[t];if(arguments.length>1)return r&&xe(e)?e.call(n&&n.proxy):e}}const Sb=Symbol.for("v-scx"),Ab=()=>Ol(Sb);function cs(t,e){return X1(t,null,e)}function Bn(t,e,r){return X1(t,e,r)}function X1(t,e,r=Ke){const{immediate:n,deep:o,flush:i,once:s}=r,a=Lt({},r),l=e&&n||!e&&i!=="post";let c;if(xa){if(i==="sync"){const p=Ab();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=zr,p.resume=zr,p.pause=zr,p}}const u=Ut;a.call=(p,g,y)=>Vr(p,u,g,y);let d=!1;i==="post"?a.scheduler=p=>{p.i=u,Yt(p,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(p,g)=>{g?p():K1(p)}),a.augmentJob=p=>{e&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const h=hb(t,e,a);return xa&&(c?c.push(h):l&&h()),h}function Tb(t,e,r){const n=this.proxy,o=mt(t)?t.includes(".")?Z5(n,t):()=>n[t]:t.bind(n,n);let i;xe(e)?i=e:(i=e.handler,r=e);const s=qa(this),a=X1(o,i.bind(n),r);return s(),a}function Z5(t,e){const r=e.split(".");return()=>{let n=t;for(let o=0;o<r.length&&n;o++)n=n[r[o]];return n}}const Mb=Symbol("_vte"),Sc=t=>t.__isTeleport,vu=Symbol("_leaveCb");function Eb(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==mn){e=r;break}}return e}function X5(t){if(!Y1(t))return Sc(t.type)&&t.children?Eb(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&xe(r.default))return r.default()}}function N0(t,e){if(t.shapeFlag&6&&t.component){t.transition=e;const r=t.component.subTree;N0(Sc(r.type)&&X5(r)||r,e)}else if(t.shapeFlag&128)t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback);else if(t.transition=e,t.type===Ie&&ve(t.children)){const r=n3(t.children,!1);r&&N0(r,e)}}function cd(t){if(t.component)return cd(t.component.subTree);if(t.type===Ie){const e=ve(t.children)&&n3(t.children,!1);return e?cd(e):void 0}if(t.type!==mn)return t}function Ct(t,e){return xe(t)?Lt({name:t.name},e,{setup:t}):t}function Y5(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Zp(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const H0=new WeakMap;function aa(t,e,r,n,o=!1){if(ve(t)){t.forEach((y,v)=>aa(y,e&&(ve(e)?e[v]:e),r,n,o));return}if(la(n)&&!o){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&aa(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?th(n.component):n.el,s=o?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===Ke?a.refs={}:a.refs,d=a.setupState,h=Ne(d),p=d===Ke?w5:y=>Zp(u,y)?!1:De(h,y),g=(y,v)=>!(v&&Zp(u,v));if(c!=null&&c!==l){if(Xp(e),mt(c))u[c]=null,p(c)&&(d[c]=null);else if(zt(c)){const y=e;g(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(xe(l))Ha(l,a,12,[s,u]);else{const y=mt(l),v=zt(l);if(y||v){const w=()=>{if(t.f){const C=y?p(l)?d[l]:u[l]:g()||!t.k?l.value:u[t.k];if(o)ve(C)&&D1(C,i);else if(ve(C))C.includes(i)||C.push(i);else if(y)u[l]=[i],p(l)&&(d[l]=u[l]);else{const k=[i];g(l,t.k)&&(l.value=k),t.k&&(u[t.k]=k)}}else y?(u[l]=s,p(l)&&(d[l]=s)):v&&(g(l,t.k)&&(l.value=s),t.k&&(u[t.k]=s))};if(s){const C=()=>{w(),H0.delete(t)};C.id=-1,H0.set(t,C),Yt(C,r)}else Xp(t),w()}}}function Xp(t){const e=H0.get(t);e&&(e.flags|=8,H0.delete(t))}Jo().requestIdleCallback;Jo().cancelIdleCallback;const la=t=>!!t.type.__asyncLoader,Y1=t=>t.type.__isKeepAlive;function Ib(t,e){J5(t,"a",e)}function Lb(t,e){J5(t,"da",e)}function J5(t,e,r=Ut){const n=t.__wdc||(t.__wdc=()=>{let o=r;for(;o;){if(o.isDeactivated)return;o=o.parent}return t()});if(Ac(e,n,r),r){let o=r.parent;for(;o&&o.parent;)Y1(o.parent.vnode)&&Rb(n,e,r,o),o=o.parent}}function Rb(t,e,r,n){const o=Ac(e,t,n,!0);ds(()=>{D1(n[e],o)},r)}function Ac(t,e,r=Ut,n=!1){if(r){const o=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...s)=>{hn();const a=qa(r),l=Vr(e,r,t,s);return a(),fn(),l});return n?o.unshift(i):o.push(i),i}}const qn=t=>(e,r=Ut)=>{(!xa||t==="sp")&&Ac(t,(...n)=>e(...n),r)},Ob=qn("bm"),us=qn("m"),Pb=qn("bu"),Db=qn("u"),Bb=qn("bum"),ds=qn("um"),zb=qn("sp"),Nb=qn("rtg"),Hb=qn("rtc");function $b(t,e=Ut){Ac("ec",t,e)}const qb=Symbol.for("v-ndc"),ud=t=>t?y3(t)?th(t):ud(t.parent):null,ca=Lt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>ud(t.parent),$root:t=>ud(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?e3(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>{K1(t.update)}),$nextTick:t=>t.n||(t.n=ad.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?Tb.bind(t):zr}),yu=(t,e)=>t!==Ke&&!t.__isScriptSetup&&De(t,e),Fb={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:o,props:i,accessCache:s,type:a,appContext:l}=t;if(e[0]!=="$"){const h=s[e];if(h!==void 0)switch(h){case 1:return n[e];case 2:return o[e];case 4:return r[e];case 3:return i[e]}else{if(yu(n,e))return s[e]=1,n[e];if(__VUE_OPTIONS_API__&&o!==Ke&&De(o,e))return s[e]=2,o[e];if(De(i,e))return s[e]=3,i[e];if(r!==Ke&&De(r,e))return s[e]=4,r[e];(!__VUE_OPTIONS_API__||dd)&&(s[e]=0)}}const c=ca[e];let u,d;if(c)return e==="$attrs"&&Pt(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==Ke&&De(r,e))return s[e]=4,r[e];if(d=l.config.globalProperties,De(d,e))return d[e]},set({_:t},e,r){const{data:n,setupState:o,ctx:i}=t;return yu(o,e)?(o[e]=r,!0):__VUE_OPTIONS_API__&&n!==Ke&&De(n,e)?(n[e]=r,!0):De(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:o,props:i,type:s}},a){let l;return!!(r[a]||__VUE_OPTIONS_API__&&t!==Ke&&a[0]!=="$"&&De(t,a)||yu(e,a)||De(i,a)||De(n,a)||De(ca,a)||De(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:De(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function Yp(t){return ve(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let dd=!0;function Vb(t){const e=e3(t),r=t.proxy,n=t.ctx;dd=!1,e.beforeCreate&&Jp(e.beforeCreate,t,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:p,updated:g,activated:y,deactivated:v,beforeDestroy:w,beforeUnmount:C,destroyed:k,unmounted:S,render:E,renderTracked:R,renderTriggered:H,errorCaptured:O,serverPrefetch:P,expose:$,inheritAttrs:ie,components:N,directives:ye,filters:be}=e;if(c&&Wb(c,n,null),s)for(const we in s){const fe=s[we];xe(fe)&&(n[we]=fe.bind(r))}if(o){const we=o.call(r,r);Ze(we)&&(t.data=j1(we))}if(dd=!0,i)for(const we in i){const fe=i[we],rt=xe(fe)?fe.bind(r,r):xe(fe.get)?fe.get.bind(r,r):zr,kt=!xe(fe)&&xe(fe.set)?fe.set.bind(r):zr,vt=dr({get:rt,set:kt});Object.defineProperty(n,we,{enumerable:!0,configurable:!0,get:()=>vt.value,set:ut=>vt.value=ut})}if(a)for(const we in a)Q5(a[we],n,r,we);if(l){const we=xe(l)?l.call(r):l;Reflect.ownKeys(we).forEach(fe=>{_b(fe,we[fe])})}u&&Jp(u,t,"c");function ke(we,fe){ve(fe)?fe.forEach(rt=>we(rt.bind(r))):fe&&we(fe.bind(r))}if(ke(Ob,d),ke(us,h),ke(Pb,p),ke(Db,g),ke(Ib,y),ke(Lb,v),ke($b,O),ke(Hb,R),ke(Nb,H),ke(Bb,C),ke(ds,S),ke(zb,P),ve($))if($.length){const we=t.exposed||(t.exposed={});$.forEach(fe=>{Object.defineProperty(we,fe,{get:()=>r[fe],set:rt=>r[fe]=rt,enumerable:!0})})}else t.exposed||(t.exposed={});E&&t.render===zr&&(t.render=E),ie!=null&&(t.inheritAttrs=ie),N&&(t.components=N),ye&&(t.directives=ye),P&&Y5(t)}function Wb(t,e,r=zr){ve(t)&&(t=hd(t));for(const n in t){const o=t[n];let i;Ze(o)?"default"in o?i=Ol(o.from||n,o.default,!0):i=Ol(o.from||n):i=Ol(o),zt(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):e[n]=i}}function Jp(t,e,r){Vr(ve(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function Q5(t,e,r,n){let o=n.includes(".")?Z5(r,n):()=>r[n];if(mt(t)){const i=e[t];xe(i)&&Bn(o,i)}else if(xe(t))Bn(o,t.bind(r));else if(Ze(t))if(ve(t))t.forEach(i=>Q5(i,e,r,n));else{const i=xe(t.handler)?t.handler.bind(r):e[t.handler];xe(i)&&Bn(o,i,t)}}function e3(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=t.appContext,a=i.get(e);let l;return a?l=a:!o.length&&!r&&!n?l=e:(l={},o.length&&o.forEach(c=>$0(l,c,s,!0)),$0(l,e,s)),Ze(e)&&i.set(e,l),l}function $0(t,e,r,n=!1){const{mixins:o,extends:i}=e;i&&$0(t,i,r,!0),o&&o.forEach(s=>$0(t,s,r,!0));for(const s in e)if(!(n&&s==="expose")){const a=jb[s]||r&&r[s];t[s]=a?a(t[s],e[s]):e[s]}return t}const jb={data:Qp,props:em,emits:em,methods:Ps,computed:Ps,beforeCreate:qt,created:qt,beforeMount:qt,mounted:qt,beforeUpdate:qt,updated:qt,beforeDestroy:qt,beforeUnmount:qt,destroyed:qt,unmounted:qt,activated:qt,deactivated:qt,errorCaptured:qt,serverPrefetch:qt,components:Ps,directives:Ps,watch:Gb,provide:Qp,inject:Ub};function Qp(t,e){return e?t?function(){return Lt(xe(t)?t.call(this,this):t,xe(e)?e.call(this,this):e)}:e:t}function Ub(t,e){return Ps(hd(t),hd(e))}function hd(t){if(ve(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function qt(t,e){return t?[...new Set([].concat(t,e))]:e}function Ps(t,e){return t?Lt(Object.create(null),t,e):e}function em(t,e){return t?ve(t)&&ve(e)?[...new Set([...t,...e])]:Lt(Object.create(null),Yp(t),Yp(e??{})):e}function Gb(t,e){if(!t)return e;if(!e)return t;const r=Lt(Object.create(null),t);for(const n in e)r[n]=qt(t[n],e[n]);return r}function t3(){return{app:null,config:{isNativeTag:w5,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Kb=0;function Zb(t,e){return function(n,o=null){xe(n)||(n=Lt({},n)),o!=null&&!Ze(o)&&(o=null);const i=t3(),s=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Kb++,_component:n,_props:o,_container:null,_context:i,_instance:null,version:am,get config(){return i.config},set config(u){},use(u,...d){return s.has(u)||(u&&xe(u.install)?(s.add(u),u.install(c,...d)):xe(u)&&(s.add(u),u(c,...d))),c},mixin(u){return __VUE_OPTIONS_API__&&(i.mixins.includes(u)||i.mixins.push(u)),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!l){const p=c._ceVNode||Br(n,o);return p.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),t(p,u,h),l=!0,c._container=u,u.__vue_app__=c,__VUE_PROD_DEVTOOLS__&&(c._instance=p.component,vb(c,am)),th(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Vr(a,c._instance,16),t(null,c._container),__VUE_PROD_DEVTOOLS__&&(c._instance=null,yb(c)),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=zi;zi=c;try{return u()}finally{zi=d}}};return c}}let zi=null;const Xb=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Nr(e)}Modifiers`]||t[`${ci(e)}Modifiers`];function Yb(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||Ke;let o=r;const i=e.startsWith("update:"),s=i&&Xb(n,e.slice(7));s&&(s.trim&&(o=r.map(u=>mt(u)?u.trim():u)),s.number&&(o=o.map(Ly))),__VUE_PROD_DEVTOOLS__&&Cb(t,e,o);let a,l=n[a=du(e)]||n[a=du(Nr(e))];!l&&i&&(l=n[a=du(ci(e))]),l&&Vr(l,t,6,o);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Vr(c,t,6,o)}}const Jb=new WeakMap;function r3(t,e,r=!1){const n=__VUE_OPTIONS_API__&&r?Jb:e.emitsCache,o=n.get(t);if(o!==void 0)return o;const i=t.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!xe(t)){const l=c=>{const u=r3(c,e,!0);u&&(a=!0,Lt(s,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(Ze(t)&&n.set(t,null),null):(ve(i)?i.forEach(l=>s[l]=null):Lt(s,i),Ze(t)&&n.set(t,s),s)}function Tc(t,e){return!t||!bc(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),De(t,e[0].toLowerCase()+e.slice(1))||De(t,ci(e))||De(t,e))}function tm(t){const{type:e,vnode:r,proxy:n,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:c,renderCache:u,props:d,data:h,setupState:p,ctx:g,inheritAttrs:y}=t,v=z0(t);let w,C;try{if(r.shapeFlag&4){const S=o||n,E=S;w=tn(c.call(E,S,u,d,p,h,g)),C=a}else{const S=e;w=tn(S.length>1?S(d,{attrs:a,slots:s,emit:l}):S(d,null)),C=e.props?a:Qb(a)}}catch(S){Ni.length=0,kc(S,t,1),w=Br(mn)}let k=w;if(C&&y!==!1){const S=Object.keys(C),{shapeFlag:E}=k;S.length&&E&7&&(i&&S.some(wc)&&(C=ew(C,i)),k=Ui(k,C,!1,!0))}if(r.dirs&&(k=Ui(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(r.dirs):r.dirs),r.transition){const S=Sc(k.type)&&X5(k)||k;N0(S,r.transition)}return w=k,z0(v),w}function n3(t,e=!0){let r;for(let n=0;n<t.length;n++){const o=t[n];if(ba(o)){if(o.type!==mn||o.children==="v-if"){if(r)return;r=o}}else return}return r}const Qb=t=>{let e;for(const r in t)(r==="class"||r==="style"||bc(r))&&((e||(e={}))[r]=t[r]);return e},ew=(t,e)=>{const r={};for(const n in t)(!wc(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function tw(t,e,r){const{props:n,children:o,component:i}=t,{props:s,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?rm(n,s,c):!!s;if(l&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(o3(s,n,h)&&!Tc(c,h))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:n===s?!1:n?s?rm(n,s,c):!0:!!s;return!1}function rm(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let o=0;o<n.length;o++){const i=n[o];if(!De(t,i)||o3(e,t,i)&&!Tc(r,i))return!0}return!1}function o3(t,e,r){const n=t[r],o=e[r];return r==="style"&&Ze(n)&&Ze(o)?!Cc(n,o):n!==o}function rw({vnode:t,parent:e,suspense:r},n){for(;e;){const o=e.subTree;if(o.suspense&&o.suspense.activeBranch===t&&(o.suspense.vnode.el=o.el=n,t=o),o===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const i3={},s3=()=>Object.create(i3),a3=t=>Object.getPrototypeOf(t)===i3;function nw(t,e,r,n=!1){const o={},i=s3();t.propsDefaults=Object.create(null),l3(t,e,o,i);for(const s in t.propsOptions[0])s in o||(o[s]=void 0);r?t.props=n?o:ob(o):t.type.props?t.props=o:t.props=i,t.attrs=i}function ow(t,e,r,n){const{props:o,attrs:i,vnode:{patchFlag:s}}=t,a=Ne(o),[l]=t.propsOptions;let c=!1;if((n||s>0)&&!(s&16)){if(s&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(Tc(t.emitsOptions,h))continue;const p=e[h];if(l)if(De(i,h))p!==i[h]&&(i[h]=p,c=!0);else{const g=Nr(h);o[g]=fd(l,a,g,p,t,!1)}else p!==i[h]&&(i[h]=p,c=!0)}}}else{l3(t,e,o,i)&&(c=!0);let u;for(const d in a)(!e||!De(e,d)&&((u=ci(d))===d||!De(e,u)))&&(l?r&&(r[d]!==void 0||r[u]!==void 0)&&(o[d]=fd(l,a,d,void 0,t,!0)):delete o[d]);if(i!==a)for(const d in i)(!e||!De(e,d))&&(delete i[d],c=!0)}c&&Ln(t.attrs,"set","")}function l3(t,e,r,n){const[o,i]=t.propsOptions;let s=!1,a;if(e)for(let l in e){if(oa(l))continue;const c=e[l];let u;o&&De(o,u=Nr(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Tc(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,s=!0)}if(i){const l=Ne(r),c=a||Ke;for(let u=0;u<i.length;u++){const d=i[u];r[d]=fd(o,l,d,c[d],t,!De(c,d))}}return s}function fd(t,e,r,n,o,i){const s=t[r];if(s!=null){const a=De(s,"default");if(a&&n===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&xe(l)){const{propsDefaults:c}=o;if(r in c)n=c[r];else{const u=qa(o);n=c[r]=l.call(null,e),u()}}else n=l;o.ce&&o.ce._setProp(r,n)}s[0]&&(i&&!a?n=!1:s[1]&&(n===""||n===ci(r))&&(n=!0))}return n}const iw=new WeakMap;function c3(t,e,r=!1){const n=__VUE_OPTIONS_API__&&r?iw:e.propsCache,o=n.get(t);if(o)return o;const i=t.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!xe(t)){const u=d=>{l=!0;const[h,p]=c3(d,e,!0);Lt(s,h),p&&a.push(...p)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return Ze(t)&&n.set(t,Oi),Oi;if(ve(i))for(let u=0;u<i.length;u++){const d=Nr(i[u]);nm(d)&&(s[d]=Ke)}else if(i)for(const u in i){const d=Nr(u);if(nm(d)){const h=i[u],p=s[d]=ve(h)||xe(h)?{type:h}:Lt({},h),g=p.type;let y=!1,v=!0;if(ve(g))for(let w=0;w<g.length;++w){const C=g[w],k=xe(C)&&C.name;if(k==="Boolean"){y=!0;break}else k==="String"&&(v=!1)}else y=xe(g)&&g.name==="Boolean";p[0]=y,p[1]=v,(y||De(p,"default"))&&a.push(d)}}const c=[s,a];return Ze(t)&&n.set(t,c),c}function nm(t){return t[0]!=="$"&&!oa(t)}const J1=t=>t==="_"||t==="_ctx"||t==="$stable",Q1=t=>ve(t)?t.map(tn):[tn(t)],sw=(t,e,r)=>{if(e._n)return e;const n=kb((...o)=>Q1(e(...o)),r);return n._c=!1,n},u3=(t,e,r)=>{const n=t._ctx;for(const o in t){if(J1(o))continue;const i=t[o];if(xe(i))e[o]=sw(o,i,n);else if(i!=null){const s=Q1(i);e[o]=()=>s}}},d3=(t,e)=>{const r=Q1(e);t.slots.default=()=>r},h3=(t,e,r)=>{for(const n in e)(r||!J1(n))&&(t[n]=e[n])},aw=(t,e,r)=>{const n=t.slots=s3();if(t.vnode.shapeFlag&32){const o=e._;o?(h3(n,e,r),r&&O0(n,"_",o,!0)):u3(e,n)}else e&&d3(t,e)},lw=(t,e,r)=>{const{vnode:n,slots:o}=t;let i=!0,s=Ke;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:h3(o,e,r):(i=!e.$stable,u3(e,o)),s=e}else e&&(d3(t,e),s={default:1});if(i)for(const a in o)!J1(a)&&s[a]==null&&delete o[a]};function cw(){typeof __VUE_OPTIONS_API__!="boolean"&&(Jo().__VUE_OPTIONS_API__=!0),typeof __VUE_PROD_DEVTOOLS__!="boolean"&&(Jo().__VUE_PROD_DEVTOOLS__=!1),typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__!="boolean"&&(Jo().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1)}const Yt=pw;function uw(t){return dw(t)}function dw(t,e){cw();const r=Jo();r.__VUE__=!0,__VUE_PROD_DEVTOOLS__&&U5(r.__VUE_DEVTOOLS_GLOBAL_HOOK__,r);const{insert:n,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:p=zr,insertStaticContent:g}=t,y=(_,I,B,j=null,F=null,W=null,Q=void 0,Y=null,X=!!I.dynamicChildren)=>{if(_===I)return;_&&!As(_,I)&&(j=Zt(_),ut(_,F,W,!0),_=null),I.patchFlag===-2&&(X=!1,I.dynamicChildren=null),I.dynamicChildren&&_&&_.dynamicChildren&&_.dynamicChildren.hasOnce&&(I.dynamicChildren===Oi&&(I.dynamicChildren=[]),I.dynamicChildren.hasOnce=!0);const{type:q,ref:ae,shapeFlag:ee}=I;switch(q){case $a:v(_,I,B,j);break;case mn:w(_,I,B,j);break;case Pl:_==null&&C(I,B,j,Q);break;case Ie:N(_,I,B,j,F,W,Q,Y,X);break;default:ee&1?E(_,I,B,j,F,W,Q,Y,X):ee&6?ye(_,I,B,j,F,W,Q,Y,X):(ee&64||ee&128)&&q.process(_,I,B,j,F,W,Q,Y,X,Ht)}ae!=null&&F?aa(ae,_&&_.ref,W,I||_,!I):ae==null&&_&&_.ref!=null&&aa(_.ref,null,W,_,!0)},v=(_,I,B,j)=>{if(_==null)n(I.el=a(I.children),B,j);else{const F=I.el=_.el;I.children!==_.children&&c(F,I.children)}},w=(_,I,B,j)=>{_==null?n(I.el=l(I.children||""),B,j):I.el=_.el},C=(_,I,B,j)=>{[_.el,_.anchor]=g(_.children,I,B,j,_.el,_.anchor)},k=({el:_,anchor:I},B,j)=>{let F;for(;_&&_!==I;)F=h(_),n(_,B,j),_=F;n(I,B,j)},S=({el:_,anchor:I})=>{let B;for(;_&&_!==I;)B=h(_),o(_),_=B;o(I)},E=(_,I,B,j,F,W,Q,Y,X)=>{if(I.type==="svg"?Q="svg":I.type==="math"&&(Q="mathml"),_==null)R(I,B,j,F,W,Q,Y,X);else{const q=_.el&&_.el._isVueCE?_.el:null;try{q&&q._beginPatch(),P(_,I,F,W,Q,Y,X)}finally{q&&q._endPatch()}}},R=(_,I,B,j,F,W,Q,Y)=>{let X,q;const{props:ae,shapeFlag:ee,transition:se,dirs:ue}=_;if(X=_.el=s(_.type,W,ae&&ae.is,ae),ee&8?u(X,_.children):ee&16&&O(_.children,X,null,j,F,bu(_,W),Q,Y),ue&&Io(_,null,j,"created"),H(X,_,_.scopeId,Q,j),ae){for(const Le in ae)Le!=="value"&&!oa(Le)&&i(X,Le,null,ae[Le],W,j);"value"in ae&&i(X,"value",null,ae.value,W),(q=ae.onVnodeBeforeMount)&&Gr(q,j,_)}__VUE_PROD_DEVTOOLS__&&(O0(X,"__vnode",_,!0),O0(X,"__vueParentComponent",j,!0)),ue&&Io(_,null,j,"beforeMount");const _e=hw(F,se);_e&&se.beforeEnter(X),n(X,I,B),((q=ae&&ae.onVnodeMounted)||_e||ue)&&Yt(()=>{q&&Gr(q,j,_),_e&&se.enter(X),ue&&Io(_,null,j,"mounted")},F)},H=(_,I,B,j,F)=>{if(B&&p(_,B),j)for(let W=0;W<j.length;W++)p(_,j[W]);if(F){let W=F.subTree;if(I===W||m3(W.type)&&(W.ssContent===I||W.ssFallback===I)){const Q=F.vnode;H(_,Q,Q.scopeId,Q.slotScopeIds,F.parent)}}},O=(_,I,B,j,F,W,Q,Y,X=0)=>{for(let q=X;q<_.length;q++){const ae=_[q]=Y?En(_[q]):tn(_[q]);y(null,ae,I,B,j,F,W,Q,Y)}},P=(_,I,B,j,F,W,Q)=>{const Y=I.el=_.el;__VUE_PROD_DEVTOOLS__&&(Y.__vnode=I);let{patchFlag:X,dynamicChildren:q,dirs:ae}=I;X|=_.patchFlag&16;const ee=_.props||Ke,se=I.props||Ke;let ue;if(B&&Lo(B,!1),(ue=se.onVnodeBeforeUpdate)&&Gr(ue,B,I,_),ae&&Io(I,_,B,"beforeUpdate"),B&&Lo(B,!0),q&&(!_.dynamicChildren||_.dynamicChildren.length!==q.length)&&(X=0,Q=!1,q=null),(ee.innerHTML&&se.innerHTML==null||ee.textContent&&se.textContent==null)&&u(Y,""),q?$(_.dynamicChildren,q,Y,B,j,bu(I,F),W):Q||fe(_,I,Y,null,B,j,bu(I,F),W,!1),X>0){if(X&16)ie(Y,ee,se,B,F);else if(X&2&&ee.class!==se.class&&i(Y,"class",null,se.class,F),X&4&&i(Y,"style",ee.style,se.style,F),X&8){const _e=I.dynamicProps;for(let Le=0;Le<_e.length;Le++){const Ee=_e[Le],We=ee[Ee],Ye=se[Ee];(Ye!==We||Ee==="value")&&i(Y,Ee,We,Ye,F,B)}}X&1&&_.children!==I.children&&u(Y,I.children)}else!Q&&q==null&&ie(Y,ee,se,B,F);((ue=se.onVnodeUpdated)||ae)&&Yt(()=>{ue&&Gr(ue,B,I,_),ae&&Io(I,_,B,"updated")},j)},$=(_,I,B,j,F,W,Q)=>{for(let Y=0;Y<I.length;Y++){const X=_[Y],q=I[Y],ae=X.el||pd(X),ee=ae&&(X.type===Ie||!As(X,q)||X.shapeFlag&198)?d(ae):B;y(X,q,ee,null,j,F,W,Q,!0)}},ie=(_,I,B,j,F)=>{if(I!==B){if(I!==Ke)for(const W in I)!oa(W)&&!(W in B)&&i(_,W,I[W],null,F,j);for(const W in B){if(oa(W))continue;const Q=B[W],Y=I[W];Q!==Y&&W!=="value"&&i(_,W,Y,Q,F,j)}"value"in B&&i(_,"value",I.value,B.value,F)}},N=(_,I,B,j,F,W,Q,Y,X)=>{const q=I.el=_?_.el:a(""),ae=I.anchor=_?_.anchor:a("");let{patchFlag:ee,dynamicChildren:se,slotScopeIds:ue}=I;ue&&(Y=Y?Y.concat(ue):ue),_==null?(n(q,B,j),n(ae,B,j),O(I.children||[],B,ae,F,W,Q,Y,X)):ee>0&&ee&64&&se&&_.dynamicChildren&&_.dynamicChildren.length===se.length?($(_.dynamicChildren,se,B,F,W,Q,Y),(I.key!=null||F&&I===F.subTree)&&f3(_,I,!0)):fe(_,I,B,ae,F,W,Q,Y,X)},ye=(_,I,B,j,F,W,Q,Y,X)=>{I.slotScopeIds=Y,_==null?I.shapeFlag&512?F.ctx.activate(I,B,j,Q,X):be(I,B,j,F,W,Q,X):Fe(_,I,X)},be=(_,I,B,j,F,W,Q)=>{const Y=_.component=kw(_,j,F);if(Y1(_)&&(Y.ctx.renderer=Ht),Sw(Y,!1,Q),Y.asyncDep){if(F&&F.registerDep(Y,ke,Q,W),!_.el){const X=Y.subTree=Br(mn);w(null,X,I,B),_.placeholder=X.el}}else ke(Y,_,I,B,F,W,Q)},Fe=(_,I,B)=>{const j=I.component=_.component;if(tw(_,I,B))if(j.asyncDep&&!j.asyncResolved){I.el=_.el,I.placeholder=_.placeholder,we(j,I,B);return}else j.next=I,j.update();else I.el=_.el,I.placeholder=_.placeholder,j.vnode=I},ke=(_,I,B,j,F,W,Q)=>{const Y=()=>{if(_.isMounted){let{next:ee,bu:se,u:ue,parent:_e,vnode:Le}=_;{const nr=p3(_);if(nr){ee&&(ee.el=Le.el,we(_,ee,Q)),nr.asyncDep.then(()=>{Yt(()=>{_.isUnmounted||q()},F)});return}}let Ee=ee,We;Lo(_,!1),ee?(ee.el=Le.el,we(_,ee,Q)):ee=Le,se&&hu(se),(We=ee.props&&ee.props.onVnodeBeforeUpdate)&&Gr(We,_e,ee,Le),Lo(_,!0);const Ye=tm(_),rr=_.subTree;_.subTree=Ye,y(rr,Ye,d(rr.el),Zt(rr),_,F,W),ee.el=Ye.el,Ee===null&&rw(_,Ye.el),ue&&Yt(ue,F),(We=ee.props&&ee.props.onVnodeUpdated)&&Yt(()=>Gr(We,_e,ee,Le),F),__VUE_PROD_DEVTOOLS__&&G5(_)}else{let ee;const{el:se,props:ue}=I,{bm:_e,m:Le,parent:Ee,root:We,type:Ye}=_,rr=la(I);Lo(_,!1),_e&&hu(_e),!rr&&(ee=ue&&ue.onVnodeBeforeMount)&&Gr(ee,Ee,I),Lo(_,!0);{We.ce&&We.ce._hasShadowRoot()&&We.ce._injectChildStyle(Ye,_.parent?_.parent.type:void 0);const nr=_.subTree=tm(_);y(null,nr,B,j,_,F,W),I.el=nr.el}if(Le&&Yt(Le,F),!rr&&(ee=ue&&ue.onVnodeMounted)){const nr=I;Yt(()=>Gr(ee,Ee,nr),F)}(I.shapeFlag&256||Ee&&la(Ee.vnode)&&Ee.vnode.shapeFlag&256)&&_.a&&Yt(_.a,F),_.isMounted=!0,__VUE_PROD_DEVTOOLS__&&bb(_),I=B=j=null}};_.scope.on();const X=_.effect=new _5(Y);_.scope.off();const q=_.update=X.run.bind(X),ae=_.job=X.runIfDirty.bind(X);ae.i=_,ae.id=_.uid,X.scheduler=()=>K1(ae),Lo(_,!0),q()},we=(_,I,B)=>{I.component=_;const j=_.vnode.props;_.vnode=I,_.next=null,ow(_,I.props,j,B),lw(_,I.children,B),hn(),V5(_),fn()},fe=(_,I,B,j,F,W,Q,Y,X=!1)=>{const q=_&&_.children,ae=_?_.shapeFlag:0,ee=I.children,{patchFlag:se,shapeFlag:ue}=I;if(se>0){if(se&128){kt(q,ee,B,j,F,W,Q,Y,X);return}else if(se&256){rt(q,ee,B,j,F,W,Q,Y,X);return}}ue&8?(ae&16&&Ur(q,F,W),ee!==q&&u(B,ee)):ae&16?ue&16?kt(q,ee,B,j,F,W,Q,Y,X):Ur(q,F,W,!0):(ae&8&&u(B,""),ue&16&&O(ee,B,j,F,W,Q,Y,X))},rt=(_,I,B,j,F,W,Q,Y,X)=>{_=_||Oi,I=I||Oi;const q=_.length,ae=I.length,ee=Math.min(q,ae);let se;for(se=0;se<ee;se++){const ue=I[se]=X?En(I[se]):tn(I[se]);y(_[se],ue,B,null,F,W,Q,Y,X)}q>ae?Ur(_,F,W,!0,!1,ee):O(I,B,j,F,W,Q,Y,X,ee)},kt=(_,I,B,j,F,W,Q,Y,X)=>{let q=0;const ae=I.length;let ee=_.length-1,se=ae-1;for(;q<=ee&&q<=se;){const ue=_[q],_e=I[q]=X?En(I[q]):tn(I[q]);if(As(ue,_e))y(ue,_e,B,null,F,W,Q,Y,X);else break;q++}for(;q<=ee&&q<=se;){const ue=_[ee],_e=I[se]=X?En(I[se]):tn(I[se]);if(As(ue,_e))y(ue,_e,B,null,F,W,Q,Y,X);else break;ee--,se--}if(q>ee){if(q<=se){const ue=se+1,_e=ue<ae?I[ue].el:j;for(;q<=se;)y(null,I[q]=X?En(I[q]):tn(I[q]),B,_e,F,W,Q,Y,X),q++}}else if(q>se)for(;q<=ee;)ut(_[q],F,W,!0),q++;else{const ue=q,_e=q,Le=new Map;for(q=_e;q<=se;q++){const Rt=I[q]=X?En(I[q]):tn(I[q]);Rt.key!=null&&Le.set(Rt.key,q)}let Ee,We=0;const Ye=se-_e+1;let rr=!1,nr=0;const Un=new Array(Ye);for(q=0;q<Ye;q++)Un[q]=0;for(q=ue;q<=ee;q++){const Rt=_[q];if(We>=Ye){ut(Rt,F,W,!0);continue}let or;if(Rt.key!=null)or=Le.get(Rt.key);else for(Ee=_e;Ee<=se;Ee++)if(Un[Ee-_e]===0&&As(Rt,I[Ee])){or=Ee;break}or===void 0?ut(Rt,F,W,!0):(Un[or-_e]=q+1,or>=nr?nr=or:rr=!0,y(Rt,I[or],B,null,F,W,Q,Y,X),We++)}const ws=rr?fw(Un):Oi;for(Ee=ws.length-1,q=Ye-1;q>=0;q--){const Rt=_e+q,or=I[Rt],xs=I[Rt+1],Cs=Rt+1<ae?xs.el||pd(xs):j;Un[q]===0?y(null,or,B,Cs,F,W,Q,Y,X):rr&&(Ee<0||q!==ws[Ee]?vt(or,B,Cs,2):Ee--)}}},vt=(_,I,B,j,F=null)=>{const{el:W,type:Q,transition:Y,children:X,shapeFlag:q}=_;if(q&6){vt(_.component.subTree,I,B,j);return}if(q&128){_.suspense.move(I,B,j);return}if(q&64){Q.move(_,I,B,Ht);return}if(Q===Ie){n(W,I,B);for(let ee=0;ee<X.length;ee++)vt(X[ee],I,B,j);n(_.anchor,I,B);return}if(Q===Pl){k(_,I,B);return}if(j!==2&&q&1&&Y)if(j===0)Y.persisted&&!W[vu]?n(W,I,B):(Y.beforeEnter(W),n(W,I,B),Yt(()=>Y.enter(W),F));else{const{leave:ee,delayLeave:se,afterLeave:ue}=Y,_e=()=>{_.ctx.isUnmounted?o(W):n(W,I,B)},Le=()=>{const Ee=W._isLeaving||!!W[vu];W._isLeaving&&W[vu](!0),Y.persisted&&!Ee?_e():ee(W,()=>{_e(),ue&&ue()})};se?se(W,_e,Le):Le()}else n(W,I,B)},ut=(_,I,B,j=!1,F=!1)=>{const{type:W,props:Q,ref:Y,children:X,dynamicChildren:q,shapeFlag:ae,patchFlag:ee,dirs:se,cacheIndex:ue,memo:_e}=_;if((ee===-2||q&&q.hasOnce)&&(F=!1),Y!=null&&(hn(),aa(Y,null,B,_,!0),fn()),ue!=null&&(!_.ctx||_.ctx===I)&&(I.renderCache[ue]=void 0),ae&256){I.ctx.deactivate(_);return}const Le=ae&1&&se,Ee=!la(_);let We;if(Ee&&(We=Q&&Q.onVnodeBeforeUnmount)&&Gr(We,I,_),ae&6)Mo(_.component,B,j);else{if(ae&128){_.suspense.unmount(B,j);return}Le&&Io(_,null,I,"beforeUnmount"),ae&64?_.type.remove(_,I,B,Ht,j):q&&!q.hasOnce&&(W!==Ie||ee>0&&ee&64)?Ur(q,I,B,!1,!0):(W===Ie&&ee&384||!F&&ae&16)&&Ur(X,I,B),j&&Et(_)}const Ye=_e!=null&&ue==null;(Ee&&(We=Q&&Q.onVnodeUnmounted)||Le||Ye)&&Yt(()=>{We&&Gr(We,I,_),Le&&Io(_,null,I,"unmounted"),Ye&&(_.el=null)},B)},Et=_=>{const{type:I,el:B,anchor:j,transition:F}=_,W=I===Ie;if(W&&!F){jr(B,j);return}if(I===Pl){S(_),F&&!F.persisted&&F.afterLeave&&F.afterLeave();return}const Q=W?cd(_):_,Y=()=>{W?d(B)&&jr(B,j):o(B),F&&!F.persisted&&F.afterLeave&&F.afterLeave()};if(Q&&Q.shapeFlag&1&&F&&!F.persisted){const{leave:X,delayLeave:q}=F,ae=Q.el,ee=()=>X(ae,Y);q?q(ae,Y,ee):ee()}else Y()},jr=(_,I)=>{let B;for(;_!==I;)B=h(_),o(_),_=B;o(I)},Mo=(_,I,B)=>{const{bum:j,scope:F,job:W,subTree:Q,um:Y,m:X,a:q}=_;om(X),om(q),j&&hu(j),F.stop(),W?(W.flags|=8,ut(Q,_,I,B)):_.vnode.el&&Q&&(Q.transition=_.vnode.transition,ut(Q,_,I,B)),Y&&Yt(Y,I),Yt(()=>{_.isUnmounted=!0},I),__VUE_PROD_DEVTOOLS__&&xb(_)},Ur=(_,I,B,j=!1,F=!1,W=0)=>{for(let Q=W;Q<_.length;Q++)ut(_[Q],I,B,j,F)},Zt=_=>{if(_.shapeFlag&6)return Zt(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const I=h(_.anchor||_.el),B=I&&I[Mb];return B?h(B):I},jn=(_,I,B)=>{const j=_&&I._vnode?void 0:_&&_.component?_.component.uid:Cw();gb(()=>{_==null?I._vnode&&ut(I._vnode,null,null,!0):y(I._vnode||null,_,I,null,null,null,B),I._vnode=_},j)},Ht={p:y,um:ut,m:vt,r:Et,mt:be,mc:O,pc:fe,pbc:$,n:Zt,o:t};return{render:jn,hydrate:void 0,createApp:Zb(jn)}}function bu({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function Lo({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function hw(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function f3(t,e,r=!1){const n=t.children,o=e.children;if(ve(n)&&ve(o))for(let i=0;i<n.length;i++){const s=n[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=En(o[i]),a.el=s.el),!r&&a.patchFlag!==-2&&f3(s,a)),a.type===$a&&(a.patchFlag===-1&&(a=o[i]=En(a)),a.el=s.el),a.type===mn&&!a.el&&(a.el=s.el)}}function fw(t){const e=t.slice(),r=[0];let n,o,i,s,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(o=r[r.length-1],t[o]<c){e[n]=o,r.push(n);continue}for(i=0,s=r.length-1;i<s;)a=i+s>>1,t[r[a]]<c?i=a+1:s=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,s=r[i-1];i-- >0;)r[i]=s,s=e[s];return r}function p3(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:p3(e)}function om(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function pd(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?pd(e.subTree):null}const m3=t=>t.__isSuspense;function pw(t,e){e&&e.pendingBranch?ve(t)?e.effects.push(...t):e.effects.push(t):mb(t)}const Ie=Symbol.for("v-fgt"),$a=Symbol.for("v-txt"),mn=Symbol.for("v-cmt"),Pl=Symbol.for("v-stc"),Ni=[];let On=null;function mw(){Ni.pop(),On=Ni[Ni.length-1]||null}let eh=1;function q0(t,e=!1){eh+=t,t<0&&On&&e&&(On.hasOnce=!0)}function ba(t){return t?t.__v_isVNode===!0:!1}function As(t,e){return t.type===e.type&&t.key===e.key}const g3=({key:t})=>t??null,Dl=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?mt(t)||zt(t)||xe(t)?{i:sn,r:t,k:e,f:!!r}:t:null);function gw(t,e=null,r=null,n=0,o=null,i=t===Ie?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&g3(e),ref:e&&Dl(e),scopeId:K5,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:sn};return a?(F0(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=mt(r)?8:16),eh>0&&!s&&On&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&On.push(l),l}const Br=vw;function vw(t,e=null,r=null,n=0,o=null,i=!1){if((!t||t===qb)&&(t=mn),ba(t)){const a=Ui(t,e,!0);return r&&F0(a,r),eh>0&&!i&&On&&(a.shapeFlag&6?On[On.indexOf(t)]=a:On.push(a)),a.patchFlag=-2,a}if(Ew(t)&&(t=t.__vccOpts),e){e=yw(e);let{class:a,style:l}=e;a&&!mt(a)&&(e.class=N1(a)),Ze(l)&&(G1(l)&&!ve(l)&&(l=Lt({},l)),e.style=z1(l))}const s=mt(t)?1:m3(t)?128:Sc(t)?64:Ze(t)?4:xe(t)?2:0;return gw(t,e,r,n,o,s,i,!0)}function yw(t){return t?G1(t)||a3(t)?Lt({},t):t:null}function Ui(t,e,r=!1,n=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=t,c=e?ww(o||{},e):o,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&g3(c),ref:e&&e.ref?r&&i?ve(i)?i.concat(Dl(e)):[i,Dl(e)]:Dl(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ie?s===-1?16:s|16:s,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ui(t.ssContent),ssFallback:t.ssFallback&&Ui(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce,cacheIndex:t.cacheIndex};return l&&n&&N0(u,l.clone(u)),u}function bw(t=" ",e=0){return Br($a,null,t,e)}function tn(t){return t==null||typeof t=="boolean"?Br(mn):ve(t)?Br(Ie,null,t.slice()):ba(t)?En(t):Br($a,null,String(t))}function En(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ui(t)}function F0(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(ve(e))r=16;else if(typeof e=="object")if(n&65){const o=e.default;o&&(o._c&&(o._d=!1),F0(t,o()),o._c&&(o._d=!0));return}else{r=32;const o=e._;!o&&!a3(e)?e._ctx=sn:o===3&&sn&&(sn.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else if(xe(e)){if(n&65){F0(t,{default:e});return}e={default:e,_ctx:sn},r=32}else e=String(e),n&64?(r=16,e=[bw(e)]):r=8;t.children=e,t.shapeFlag|=r}function ww(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const o in n)if(o==="class")e.class!==n.class&&(e.class=N1([e.class,n.class]));else if(o==="style")e.style=z1([e.style,n.style]);else if(bc(o)){const i=e[o],s=n[o];s&&i!==s&&!(ve(i)&&i.includes(s))?e[o]=i?[].concat(i,s):s:s==null&&i==null&&!wc(o)&&(e[o]=s)}else o!==""&&(e[o]=n[o])}return e}function Gr(t,e,r,n=null){Vr(t,e,7,[r,n])}const xw=t3();let v3=0;function Cw(){return v3}function kw(t,e,r){const n=t.type,o=(e?e.appContext:t.appContext)||xw,i={uid:v3++,vnode:t,type:n,parent:e,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new $y(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(o.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:c3(n,o),emitsOptions:r3(n,o),emit:null,emitted:null,propsDefaults:Ke,inheritAttrs:n.inheritAttrs,ctx:Ke,data:Ke,props:Ke,attrs:Ke,slots:Ke,refs:Ke,setupState:Ke,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Yb.bind(null,i),t.ce&&t.ce(i),i}let Ut=null;const _w=()=>Ut||sn;let V0,wa;{const t=Jo(),e=(r,n)=>{let o;return(o=t[r])||(o=t[r]=[]),o.push(n),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};V0=e("__VUE_INSTANCE_SETTERS__",r=>Ut=r),wa=e("__VUE_SSR_SETTERS__",r=>xa=r)}const qa=t=>{const e=Ut;return V0(t),t.scope.on(),()=>{t.scope.off(),V0(e)}},im=()=>{Ut&&Ut.scope.off(),V0(null)};function y3(t){return t.vnode.shapeFlag&4}let xa=!1;function Sw(t,e=!1,r=!1){e&&wa(e);const{props:n,children:o}=t.vnode,i=y3(t);nw(t,n,i,e),aw(t,o,r||e);const s=i?Aw(t,e):void 0;return e&&wa(!1),s}function Aw(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Fb);const{setup:n}=r;if(n){hn();const o=t.setupContext=n.length>1?Mw(t):null,i=qa(t),s=Ha(n,t,0,[t.props,o]),a=x5(s);if(fn(),i(),(a||t.sp)&&!la(t)&&Y5(t),a){if(s.then(im,im),e)return s.then(l=>{wa(!0);try{sm(t,l,e)}finally{wa(!1)}}).catch(l=>{kc(l,t,0)});t.asyncDep=s}else sm(t,s)}else b3(t)}function sm(t,e,r){xe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ze(e)&&(__VUE_PROD_DEVTOOLS__&&(t.devtoolsRawSetupState=e),t.setupState=$5(e)),b3(t)}function b3(t,e,r){const n=t.type;if(t.render||(t.render=n.render||zr),__VUE_OPTIONS_API__){const o=qa(t);hn();try{Vb(t)}finally{fn(),o()}}}const Tw={get(t,e){return Pt(t,"get",""),t[e]}};function Mw(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Tw),slots:t.slots,emit:t.emit,expose:e}}function th(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy($5(ib(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in ca)return ca[r](t)},has(e,r){return r in e||r in ca}})):t.proxy}function Ew(t){return xe(t)&&"__vccOpts"in t}const dr=(t,e)=>ub(t,e,xa);function M(t,e,r){try{q0(-1);const n=arguments.length;return n===2?Ze(e)&&!ve(e)?ba(e)?Br(t,null,[e]):Br(t,e):Br(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&ba(r)&&(r=[r]),Br(t,e,r))}finally{q0(1)}}const am="3.5.44";let md;const lm=typeof window<"u"&&window.trustedTypes;if(lm)try{md=lm.createPolicy("vue",{createHTML:t=>t})}catch{}const w3=md?t=>md.createHTML(t):t=>t,Iw="http://www.w3.org/2000/svg",Lw="http://www.w3.org/1998/Math/MathML",Mn=typeof document<"u"?document:null,cm=Mn&&Mn.createElement("template"),Rw={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const o=e==="svg"?Mn.createElementNS(Iw,t):e==="mathml"?Mn.createElementNS(Lw,t):r?Mn.createElement(t,{is:r}):Mn.createElement(t);return t==="select"&&n&&n.multiple!=null&&o.setAttribute("multiple",n.multiple),o},createText:t=>Mn.createTextNode(t),createComment:t=>Mn.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Mn.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,o,i){const s=r?r.previousSibling:e.lastChild;if(o&&(o===i||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),r),!(o===i||!(o=o.nextSibling)););else{cm.innerHTML=w3(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=cm.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[s?s.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},Ow=Symbol("_vtc");function Pw(t,e,r){const n=t[Ow];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const um=Symbol("_vod"),Dw=Symbol("_vsh"),Bw=Symbol(""),zw=/(?:^|;)\s*display\s*:/;function Nw(t,e,r){const n=t.style,o=mt(r);let i=!1;if(r&&!o){if(e)if(mt(e))for(const s of e.split(";")){const a=s.slice(0,s.indexOf(":")).trim();r[a]==null&&Ds(n,a,"")}else for(const s in e)r[s]==null&&Ds(n,s,"");for(const s in r){s==="display"&&(i=!0);const a=r[s];a!=null?$w(t,s,!mt(e)&&e?e[s]:void 0,a)||Ds(n,s,a):Ds(n,s,"")}}else if(o){if(e!==r){const s=n[Bw];s&&(r+=";"+s),n.cssText=r,i=zw.test(r)}}else e&&t.removeAttribute("style");um in t&&((!o||e!==r)&&(t[um]=i?n.display:""),t[Dw]&&(n.display="none"))}const sl=/\s*!important$/;function Ds(t,e,r){if(ve(r))r.forEach(n=>Ds(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))sl.test(r)?t.setProperty(e,r.replace(sl,""),"important"):t.setProperty(e,r);else{const n=Hw(t,e);sl.test(r)?t.setProperty(ci(n),r.replace(sl,""),"important"):t[n]=r}}const dm=["Webkit","Moz","ms"],wu={};function Hw(t,e){const r=wu[e];if(r)return r;let n=Nr(e);if(n!=="filter"&&n in t)return wu[e]=n;n=C5(n);for(let o=0;o<dm.length;o++){const i=dm[o]+n;if(i in t)return wu[e]=i}return e}function $w(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&mt(n)&&r===n}const hm="http://www.w3.org/1999/xlink";function fm(t,e,r,n,o,i=zy(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(hm,e.slice(6,e.length)):t.setAttributeNS(hm,e,r):r==null||i&&!k5(r)?t.removeAttribute(e):t.setAttribute(e,i?"":go(r)?String(r):r)}function pm(t,e,r,n,o){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?w3(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let s=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=k5(r):r==null&&a==="string"?(r="",s=!0):a==="number"&&(r=0,s=!0)}try{t[e]=r}catch{}s&&t.removeAttribute(o||e)}function qw(t,e,r,n){t.addEventListener(e,r,n)}function Fw(t,e,r,n){t.removeEventListener(e,r,n)}const mm=Symbol("_vei");function Vw(t,e,r,n,o=null){const i=t[mm]||(t[mm]={}),s=i[e];if(n&&s)s.value=n;else{const[a,l]=Uw(e);if(n){const c=i[e]=Zw(n,o);qw(t,a,c,l)}else s&&(Fw(t,a,s,l),i[e]=void 0)}}const Ww=/(Once|Passive|Capture)$/,jw=/^on:?(?:Once|Passive|Capture)$/;function Uw(t){let e,r;for(;(r=t.match(Ww))&&!jw.test(t);)e||(e={}),t=t.slice(0,t.length-r[1].length),e[r[1].toLowerCase()]=!0;return[t[2]===":"?t.slice(3):ci(t.slice(2)),e]}let xu=0;const Gw=Promise.resolve(),Kw=()=>xu||(Gw.then(()=>xu=0),xu=Date.now());function Zw(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;const o=r.value;if(ve(o)){const i=n.stopImmediatePropagation;n.stopImmediatePropagation=()=>{i.call(n),n._stopped=!0};const s=o.slice(),a=[n];for(let l=0;l<s.length&&!n._stopped;l++){const c=s[l];c&&Vr(c,e,5,a)}}else Vr(o,e,5,[n])};return r.value=t,r.attached=Kw(),r}const gm=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Xw=(t,e,r,n,o,i)=>{const s=o==="svg";e==="class"?Pw(t,n,s):e==="style"?Nw(t,r,n):bc(e)?wc(e)||Vw(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Yw(t,e,n,s))?(pm(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&fm(t,e,n,s,i,e!=="value")):t._isVueCE&&(Jw(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!mt(n)))?pm(t,Nr(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),fm(t,e,n,s))};function Yw(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&gm(e)&&xe(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const o=t.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return gm(e)&&mt(r)?!1:e in t}function Jw(t,e){const r=t._def.props;if(!r)return!1;const n=Nr(e);return Array.isArray(r)?r.some(o=>Nr(o)===n):Object.keys(r).some(o=>Nr(o)===n)}const Qw=Lt({patchProp:Xw},Rw);let vm;function ex(){return vm||(vm=uw(Qw))}const gr=((...t)=>{const e=ex().createApp(...t),{mount:r}=e;return e.mount=n=>{const o=rx(n);if(!o)return;const i=e._component;!xe(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=r(o,!1,tx(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},e});function tx(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function rx(t){return mt(t)?document.querySelector(t):t}function x3(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=x3(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Mt(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=x3(t))&&(n&&(n+=" "),n+=e);return n}function nx(...t){}nx(M);function Ft({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Ft.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Fa(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-block",...e}}),t}var ox=t=>!Pn(e=>e.type.name==="table")(t),Mc=Ve({filterNodes:ox},"blockConfig");Fa(Mc,{displayName:"Ctx<blockConfig>"});function ix(t,e,r){if(!t.dom.parentElement)return null;try{const n=t.posAtCoords({left:e.x,top:e.y})?.inside;if(n==null||n<0)return null;let o=t.state.doc.resolve(n),i=t.state.doc.nodeAt(n),s=t.nodeDOM(n);const a=l=>{const c=o.depth>=1&&o.index(o.depth)===0;if(!(l||c))return;const u=o.before(o.depth);i=t.state.doc.nodeAt(u),s=t.nodeDOM(u),o=t.state.doc.resolve(u),r(o,i)||a(!0)};return a(!r(o,i)),!s||!i?null:{node:i,$pos:o,el:s}}catch{return null}}var ym=Ls.ie&&Ls.ie_version<15||Ls.ios&&Ls.webkit_version<604,bm=20,sx=class{constructor(){this.#o=()=>{if(!this.#r)return null;const t=this.#r,e=this.#s;if(this.#n=null,e&&qr.isSelectable(t.node)){const r=qr.create(e.state.doc,t.$pos.pos);return e.dispatch(e.state.tr.setSelection(r)),e.focus(),this.#n=r,r}return null},this.#n=null,this.#r=null,this.#c=void 0,this.#t=!1,this.#l=()=>{this.#a?.({type:"hide"}),this.#r=null},this.#u=t=>{this.#r=t,this.#a?.({type:"show",active:t})},this.bind=(t,e)=>{this.#e=t,this.#a=e},this.addEvent=t=>{t.addEventListener("mousedown",this.#d),t.addEventListener("mouseup",this.#h),t.addEventListener("dragstart",this.#f),t.addEventListener("dragend",this.#p)},this.removeEvent=t=>{t.removeEventListener("mousedown",this.#d),t.removeEventListener("mouseup",this.#h),t.removeEventListener("dragstart",this.#f),t.removeEventListener("dragend",this.#p)},this.unBind=()=>{this.#a=void 0},this.#d=()=>{this.#c=this.#r?.el.getBoundingClientRect(),this.#o()},this.#h=()=>{if(!this.#t){requestAnimationFrame(()=>{this.#c&&this.#s?.focus()});return}this.#t=!1,this.#n=null},this.#f=t=>{this.#t=!0;const e=this.#s;if(!e)return;e.dom.dataset.dragging="true";const r=this.#n;if(t.dataTransfer&&r){const n=r.content();t.dataTransfer.effectAllowed="copyMove";const{dom:o,text:i}=e.serializeForClipboard(n);t.dataTransfer.clearData(),t.dataTransfer.setData(ym?"Text":"text/html",o.innerHTML),ym||t.dataTransfer.setData("text/plain",i);const s=this.#r?.el;s&&t.dataTransfer.setDragImage(s,0,0),e.dragging={slice:n,move:!0,node:r}}},this.#p=()=>{const t=this.#s;if(!t)return;this.#m(t);const e=t.dragging;window.setTimeout(()=>{t.dragging===e&&(t.dragging=null)},50)},this.keydownCallback=t=>(this.#l(),this.#t=!1,t.dom.dataset.dragging="false",!1),this.#g=ac((t,e)=>{if(!t.editable)return;const r=t.dom.getBoundingClientRect(),n=r.left+r.width/2;if(!(t.root.elementFromPoint(n,e.clientY)instanceof Element)){this.#l();return}const o=this.#i;if(!o)return;const i=ix(t,{x:n,y:e.clientY},o);if(!i){this.#l();return}this.#u(i)},200),this.mousemoveCallback=(t,e)=>(t.composing||!t.editable||this.#g(t,e),!1),this.dragoverCallback=(t,e)=>{if(this.#t){const r=this.#s?.dom.parentElement;if(!r)return!1;const n=r.scrollHeight>r.clientHeight,o=r.getBoundingClientRect();if(n){if(r.scrollTop>0&&Math.abs(e.y-o.y)<bm)return r.scrollTop=r.scrollTop>10?r.scrollTop-10:0,!1;const i=Math.round(t.dom.getBoundingClientRect().height);if(Math.round(r.scrollTop+o.height)<i&&Math.abs(e.y-(o.height+o.y))<bm)return r.scrollTop=r.scrollTop+10,!1}}return!1},this.dragenterCallback=t=>{t.dragging&&(this.#t=!0,t.dom.dataset.dragging="true")},this.dragleaveCallback=(t,e)=>{const r=e.clientX,n=e.clientY;(r<0||n<0||r>window.innerWidth||n>window.innerHeight)&&(this.#r=null,this.#m(t))},this.dropCallback=t=>(this.#m(t),!1),this.dragendCallback=t=>{this.#m(t)},this.#m=t=>{this.#t=!1,t.dom.dataset.dragging="false"}}#e;#o;#n;#r;#c;#t;get#i(){try{return this.#e?.get(Mc.key).filterNodes}catch{return}}get#s(){return this.#e?.get($e)}#a;#l;#u;#d;#h;#f;#p;#g;#m},rh=Ve(()=>new sx,"blockService"),Ec=Ve({},"blockServiceInstance");Fa(rh,{displayName:"Ctx<blockService>"});Fa(Ec,{displayName:"Ctx<blockServiceInstance>"});var Ic=Ve({},"blockSpec");Fa(Ic,{displayName:"Ctx<blockSpec>"});var nh=Je(t=>{const e=new et("MILKDOWN_BLOCK"),r=t.get(rh.key)();t.set(Ec.key,r);const n=t.get(Ic.key);return new Xe({key:e,...n,props:{...n.props,handleDOMEvents:{drop:o=>r.dropCallback(o),pointermove:(o,i)=>r.mousemoveCallback(o,i),keydown:o=>r.keydownCallback(o),dragover:(o,i)=>r.dragoverCallback(o,i),dragleave:(o,i)=>r.dragleaveCallback(o,i),dragenter:o=>r.dragenterCallback(o),dragend:o=>r.dragendCallback(o)}}})});Fa(nh,{displayName:"Prose<block>"});var ax=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;#l;#u;get active(){return this.#r}constructor(t){this.#r=null,this.#t=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#t)try{this.#d(),this.#t=!0}catch{}})},this.destroy=()=>{this.#n?.unBind(),this.#n?.removeEvent(this.#e),this.#e.remove()},this.show=e=>{const r=e.el,n=this.#o.get($e).dom,o={ctx:this.#o,active:e,editorDom:n,blockDom:this.#e},i={contextElement:r,getBoundingClientRect:()=>this.#l?this.#l(o):r.getBoundingClientRect()},s=[O1()];if(this.#a){const a=this.#a(o),l=oi(a);s.push(l)}dn(i,this.#e,{placement:this.#u?this.#u(o):"left",middleware:[...s,...this.#i],...this.#s}).then(({x:a,y:l})=>{Object.assign(this.#e.style,{left:`${a}px`,top:`${l}px`}),this.#e.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#e.dataset.show="false"},this.#o=t.ctx,this.#e=t.content,this.#a=t.getOffset,this.#l=t.getPosition,this.#u=t.getPlacement,this.#i=t.middleware??[],this.#s=t.floatingUIOptions??{},this.#c=t.root,this.hide()}#d(){const t=this.#o.get($e);(this.#c??t.dom.parentElement??document.body).appendChild(this.#e);const e=this.#o.get(Ec.key);e.bind(this.#o,r=>{r.type==="hide"?(this.hide(),this.#r=null):r.type==="show"&&(this.show(r.active),this.#r=r.active)}),this.#n=e,this.#n.addEvent(this.#e),this.#e.draggable=!0}},Lc=[Ic,Mc,rh,Ec,nh];Lc.key=Ic.key;Lc.pluginKey=nh.key;function lx(t){const e=Ve({},`${t}_SLASH_SPEC`),r=Je(o=>{const i=o.get(e.key);return new Xe({key:new et(`${t}_SLASH`),...i})}),n=[e,r];return n.key=e.key,n.pluginKey=r.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${t}`},r.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${t}`},n}var cx=class{#e;#o;#n;#r;#c;#t;#i;#s;#a;constructor(t){this.#e=!1,this.onShow=()=>{},this.onHide=()=>{},this.#l=(e,r)=>{const{state:n,composing:o}=e,{selection:i,doc:s}=n,{ranges:a}=i,l=Math.min(...a.map(d=>d.$from.pos)),c=Math.max(...a.map(d=>d.$to.pos)),u=r&&r.doc.eq(s)&&r.selection.eq(i);if(this.#e||((this.#r??e.dom.parentElement??document.body).appendChild(this.element),this.#e=!0),!(o||u)){if(!this.#i(e,r)){this.hide();return}dn({getBoundingClientRect:()=>Oa(e,l,c)},this.element,{placement:"bottom-start",middleware:[O1(),oi(this.#a),...this.#o],...this.#n}).then(({x:d,y:h})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${h}px`})}).catch(console.error),this.show()}},this.#u=e=>{const r=this.getContent(e);if(!r)return!1;const n=r.at(-1);return n?Array.isArray(this.#t)?this.#t.includes(n):this.#t===n:!1},this.update=(e,r)=>{this.#s(e,r)},this.getContent=(e,r=n=>n.type.name==="paragraph")=>{const{selection:n}=e.state,{empty:o,$from:i}=n,s=e.state.selection instanceof Ce;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable,u=!Hg(r)(e.state.selection);if(!(l||c||!o||!s||u))return i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,"")},this.destroy=()=>{this.#s.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=t.content,this.#c=t.debounce??200,this.#i=t.shouldShow??this.#u,this.#t=t.trigger??"/",this.#a=t.offset,this.#o=t.middleware??[],this.#n=t.floatingUIOptions??{},this.#r=t.root,this.#s=sc(this.#l,this.#c)}#l;#u};let ux=t=>crypto.getRandomValues(new Uint8Array(t)),dx=(t,e,r)=>{let n=256-256%t.length;if(n===256){let o=t.length-1;return(i=e)=>{if(!i)return"";let s="";for(;;){let a=r(i),l=i|=0;for(;l--;)if(s+=t[a[l]&o],s.length>=i)return s}}}return(o=e)=>{if(!o)return"";let i="",s=Math.ceil(1.6*256*o/n);for(;;){let a=r(s),l=s;for(;l--;)if(a[l]<n&&(i+=t[a[l]%t.length],i.length>=o))return i}}},Rc=(t,e=21)=>dx(t,e|0,ux);var hx=Object.defineProperty,wm=Object.getOwnPropertySymbols,fx=Object.prototype.hasOwnProperty,px=Object.prototype.propertyIsEnumerable,xm=(t,e,r)=>e in t?hx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mx=(t,e)=>{for(var r in e||(e={}))fx.call(e,r)&&xm(t,r,e[r]);if(wm)for(var r of wm(e))px.call(e,r)&&xm(t,r,e[r]);return t};function Va(t,e){return Object.assign(t,{meta:mx({package:"@milkdown/components"},e)}),t}const gx={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},Wa=Ve(gx,"imageBlockConfigCtx");Va(Wa,{displayName:"Config<image-block>",group:"ImageBlock"});function vx(t){return w1(t,"paragraph",(e,r,n)=>{var o,i;if(((o=e.children)==null?void 0:o.length)!==1)return;const s=(i=e.children)==null?void 0:i[0];if(!s||s.type!=="image")return;const{url:a,alt:l,title:c}=s,u={type:"image-block",url:a,alt:l,title:c};n.children.splice(r,1,u)})}const oh=os("remark-image-block",()=>()=>vx);Va(oh.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});Va(oh.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var yx=Object.defineProperty,Cm=Object.getOwnPropertySymbols,bx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,km=(t,e,r)=>e in t?yx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xx=(t,e)=>{for(var r in e||(e={}))bx.call(e,r)&&km(t,r,e[r]);if(Cm)for(var r of Cm(e))wx.call(e,r)&&km(t,r,e[r]);return t};const gd="image-block",ja=Wr("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${gd}"]`,getAttrs:t=>{var e;if(!(t instanceof HTMLElement))throw nc(t);return{src:t.getAttribute("src")||"",caption:t.getAttribute("caption")||"",ratio:Number((e=t.getAttribute("ratio"))!=null?e:1)}}}],toDOM:t=>["img",xx({"data-type":gd},t.attrs)],parseMarkdown:{match:({type:t})=>t==="image-block",runner:(t,e,r)=>{var n;const o=e.url,i=(n=e.title)!=null?n:"";let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),t.addNode(r,{src:o,caption:i,ratio:s})}},toMarkdown:{match:t=>t.type.name==="image-block",runner:(t,e)=>{t.openNode("paragraph"),t.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),t.closeNode()}}}));Va(ja.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function Oc(...t){}const Cx=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function vd(t){return`${t}-${Cx()}`}Oc(M);function ua({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}ua.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};Oc(M,Ie);const kx=Ct({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:r,onUpload:n,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=re(!1),p=re(),g=re((u=e.value)!=null?u:""),y=vd("milkdown-image-link"),v=vd("milkdown-image-upload"),w=re(((d=e.value)==null?void 0:d.length)!==0),C=R=>{const O=R.target.value;w.value=O.length!==0,g.value=O},k=R=>{var H,O;R.key==="Enter"&&r((O=(H=p.value)==null?void 0:H.value)!=null?O:"")},S=()=>{var R,H;r((H=(R=p.value)==null?void 0:R.value)!=null?H:"")},E=R=>{var H;const O=(H=R.target.files)==null?void 0:H[0];O&&n(O).then(P=>{P&&(r(P),w.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>M("div",{class:Mt("image-edit",l)},M(ua,{icon:o,class:"image-icon"}),M("div",{class:Mt("link-importer",h.value&&"focus")},M("input",{id:y,ref:p,draggable:"true",onDragstart:R=>{R.preventDefault(),R.stopPropagation()},disabled:t.value,class:"link-input-area",value:g.value,onInput:C,onKeydown:k,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!w.value&&M("div",{class:"placeholder"},M("input",{disabled:t.value,class:"hidden",id:v,type:"file",accept:"image/*",onChange:E}),M("label",{class:"uploader",for:v},M(ua,{icon:i})),M("span",{class:"text",onClick:()=>{var R;return(R=p.value)==null?void 0:R.focus()}},a))),g.value&&M(Ie,null,M("div",{class:"image-preview"},M("img",{src:g.value,alt:"",onError:R=>Promise.resolve(c?.(R)).catch(()=>{})})),M("div",{class:"confirm",onClick:()=>S()},M(ua,{icon:s}))))}});Oc(M,Ie);const _x=Ct({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:t,caption:e,ratio:r,readonly:n,setAttr:o,config:i}){var s;const a=re(),l=re(),c=re(!!((s=e.value)!=null&&s.length)),u=vd("milkdown-image-caption"),d=re(0),h=()=>{var k;const S=a.value;if(!S)return;const E=S.closest(".milkdown-image-block");if(!E)return;let R=E.getBoundingClientRect().width;if(!R)return;i.maxWidth&&i.maxWidth<R&&(R=i.maxWidth);const H=S.naturalHeight,O=S.naturalWidth;let P=O<R?H:R*(H/O);i.maxHeight&&P>i.maxHeight&&(P=i.maxHeight);const $=(P*((k=r.value)!=null?k:1)).toFixed(2);S.dataset.origin=P.toFixed(2),S.dataset.height=$,S.style.height=`${$}px`,i.maxWidth&&(S.style.maxWidth=`${i.maxWidth}px`)},p=k=>{k.preventDefault(),k.stopPropagation(),!n.value&&(c.value=!c.value)},g=k=>{const E=k.target.value;d.value&&window.clearTimeout(d.value),d.value=window.setTimeout(()=>{o("caption",E)},1e3)},y=k=>{const E=k.target.value;d.value&&(window.clearTimeout(d.value),d.value=0),o("caption",E)},v=k=>{k.preventDefault();const S=a.value;if(!S)return;const E=S.getBoundingClientRect().top;let R=k.clientY-E;R<100&&(R=100),i.maxHeight&&R>i.maxHeight&&(R=i.maxHeight);const H=Number(R).toFixed(2);S.dataset.height=H,S.style.height=`${H}px`},w=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w);const k=a.value;if(!k)return;const S=Number(k.dataset.origin),E=Number(k.dataset.height),R=Number.parseFloat(Number(E/S).toFixed(2));Number.isNaN(R)||o("ratio",R)},C=k=>{n.value||(k.preventDefault(),k.stopPropagation(),window.addEventListener("pointermove",v),window.addEventListener("pointerup",w))};return()=>M(Ie,null,M("div",{class:"image-wrapper"},M("div",{class:"operation"},M("div",{class:"operation-item",onPointerdown:p},M(ua,{icon:i.captionIcon}))),M("img",{ref:a,"data-type":gd,onLoad:h,src:t.value,alt:e.value,onError:k=>{var S;return Promise.resolve((S=i.onImageLoadError)==null?void 0:S.call(i,k)).catch(()=>{})}}),M("div",{ref:l,class:"image-resize-handle",onPointerdown:C})),c.value&&M("input",{id:u,draggable:"true",onDragstart:k=>{k.preventDefault(),k.stopPropagation()},class:"caption-input",placeholder:i?.captionPlaceholderText,onInput:g,onBlur:y,value:e.value}))}});var Sx=Object.defineProperty,_m=Object.getOwnPropertySymbols,Ax=Object.prototype.hasOwnProperty,Tx=Object.prototype.propertyIsEnumerable,Sm=(t,e,r)=>e in t?Sx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mx=(t,e)=>{for(var r in e||(e={}))Ax.call(e,r)&&Sm(t,r,e[r]);if(_m)for(var r of _m(e))Tx.call(e,r)&&Sm(t,r,e[r]);return t};Oc(M,Ie);const Ex=Ct({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e}=t;return()=>{var r;return(r=e.value)!=null&&r.length?M(_x,Mx({},t)):M(kx,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:n=>t.setAttr("src",n),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,onImageLoadError:t.config.onImageLoadError})}}}),C3=ko(ja.node,t=>(e,r,n)=>{const o=re(e.attrs.src),i=re(e.attrs.caption),s=re(e.attrs.ratio),a=re(!1),l=re(!r.editable),c=(v,w)=>{if(!r.editable)return;const C=n();C!=null&&r.dispatch(r.state.tr.setNodeAttribute(C,v,v==="src"?Tr.sanitize(w):w))},u=t.get(Wa.key),d=gr(Ex,{src:o,caption:i,ratio:s,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("div");h.className="milkdown-image-block";const p=cs(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),g=u.proxyDomURL,y=v=>{if(!g)o.value=v.attrs.src;else{const w=g(v.attrs.src);typeof w=="string"?o.value=w:w.then(C=>{o.value=C}).catch(console.error)}s.value=v.attrs.ratio,i.value=v.attrs.caption,l.value=!r.editable};return y(e),d.mount(h),{dom:h,update:v=>v.type!==e.type?!1:(y(v),!0),stopEvent:v=>v.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),h.remove()}}});Va(C3,{displayName:"NodeView<image-block>",group:"ImageBlock"});const Ix=[oh,ja,C3,Wa].flat();let yd,bd;if(typeof WeakMap<"u"){let t=new WeakMap;yd=e=>t.get(e),bd=(e,r)=>(t.set(e,r),r)}else{const t=[];let r=0;yd=n=>{for(let o=0;o<t.length;o+=2)if(t[o]==n)return t[o+1]},bd=(n,o)=>(r==10&&(r=0),t[r++]=n,t[r++]=o)}var qe=class{constructor(t,e,r,n){this.width=t,this.height=e,this.map=r,this.problems=n}findCell(t){for(let e=0;e<this.map.length;e++){const r=this.map[e];if(r!=t)continue;const n=e%this.width,o=e/this.width|0;let i=n+1,s=o+1;for(let a=1;i<this.width&&this.map[e+a]==r;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==r;a++)s++;return{left:n,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,r){const{left:n,right:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(r<0?n==0:o==this.width)?null:this.map[i*this.width+(r<0?n-1:o)]:(r<0?i==0:s==this.height)?null:this.map[n+this.width*(r<0?i-1:s)]}rectBetween(t,e){const{left:r,right:n,top:o,bottom:i}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(r,s),top:Math.min(o,l),right:Math.max(n,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],r={};for(let n=t.top;n<t.bottom;n++)for(let o=t.left;o<t.right;o++){const i=n*this.width+o,s=this.map[i];r[s]||(r[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||n==t.top&&n&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,r){for(let n=0,o=0;;n++){const i=o+r.child(n).nodeSize;if(n==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}}static get(t){return yd(t)||bd(t,Lx(t))}};function Lx(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Rx(t),r=t.childCount,n=[];let o=0,i=null;const s=[];for(let c=0,u=e*r;c<u;c++)n[c]=0;for(let c=0,u=0;c<r;c++){const d=t.child(c);u++;for(let g=0;;g++){for(;o<n.length&&n[o]!=0;)o++;if(g==d.childCount)break;const y=d.child(g),{colspan:v,rowspan:w,colwidth:C}=y.attrs;for(let k=0;k<w;k++){if(k+c>=r){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:w-k});break}const S=o+k*e;for(let E=0;E<v;E++){n[S+E]==0?n[S+E]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:v-E});const R=C&&C[E];if(R){const H=(S+E)%e*2,O=s[H];O==null||O!=R&&s[H+1]==1?(s[H]=R,s[H+1]=1):O==R&&s[H+1]++}}}o+=v,u+=y.nodeSize}const h=(c+1)*e;let p=0;for(;o<h;)n[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||r===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new qe(e,r,n,i);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<r&&(l=!0);return l&&Ox(a,s,t),a}function Rx(t){let e=-1,r=!1;for(let n=0;n<t.childCount;n++){const o=t.child(n);let i=0;if(r)for(let s=0;s<n;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>n&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(r=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Ox(t,e,r){t.problems||(t.problems=[]);const n={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(n[i])continue;n[i]=!0;const s=r.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const u=e[(o+c)%t.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Px(l)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function Px(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let r=0;r<t.colspan;r++)e.push(0);return e}function Am(t,e){if(typeof t=="string")return{};const r=t.getAttribute("data-colwidth"),n=r&&/^\d+(,\d+)*$/.test(r)?r.split(",").map(s=>Number(s)):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:n&&n.length==o?n:null};for(const s in e){const a=e[s].getFromDOM,l=a&&a(t);l!=null&&(i[s]=l)}return i}function Tm(t,e){const r={};t.attrs.colspan!=1&&(r.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(r.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(r["data-colwidth"]=t.attrs.colwidth.join(","));for(const n in e){const o=e[n].setDOMAttr;o&&o(t.attrs[n],r)}return r}function Dx(t){if(t!==null){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function Bx(t){const e=t.cellAttributes||{},r={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Dx}};for(const n in e)r[n]={default:e[n].default,validate:e[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:r,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>Am(n,e)}],toDOM(n){return["td",Tm(n,e),0]}},table_header:{content:t.cellContent,attrs:r,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>Am(n,e)}],toDOM(n){return["th",Tm(n,e),0]}}}}function Sr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const r in t.nodes){const n=t.nodes[r],o=n.spec.tableRole;o&&(e[o]=n)}}return e}const ao=new et("selectingCells");function Gi(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Mr(t){const e=t.selection.$head;for(let r=e.depth;r>0;r--)if(e.node(r).type.spec.tableRole=="row")return!0;return!1}function Pc(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const r=Gi(e.$head)||zx(e.$head);if(r)return r;throw new RangeError(`No cell found around position ${e.head}`)}function zx(t){for(let e=t.nodeAfter,r=t.pos;e;e=e.firstChild,r++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(r)}for(let e=t.nodeBefore,r=t.pos;e;e=e.lastChild,r--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(r-e.nodeSize)}}function wd(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Nx(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ih(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function k3(t,e,r){const n=t.node(-1),o=qe.get(n),i=t.start(-1),s=o.nextCell(t.pos-i,e,r);return s==null?null:t.node(0).resolve(i+s)}function si(t,e,r=1){const n={...t,colspan:t.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,r),n.colwidth.some(o=>o>0)||(n.colwidth=null)),n}function Hx(t,e,r=1){const n={...t,colspan:t.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let o=0;o<r;o++)n.colwidth.splice(e,0,0)}return n}function $x(t,e,r){const n=Sr(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[r+o*t.width]).type!=n)return!1;return!0}var Ue=class Sn extends jt{constructor(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.rectBetween(e.pos-i,r.pos-i),a=e.node(0),l=o.cellsInRect(s).filter(u=>u!=r.pos-i);l.unshift(r.pos-i);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=i+u+1;return new $g(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=r}map(e,r){const n=e.resolve(r.map(this.$anchorCell.pos)),o=e.resolve(r.map(this.$headCell.pos));if(wd(n)&&wd(o)&&ih(n,o)){const i=this.$anchorCell.node(-1)!=n.node(-1);return i&&this.isRowSelection()?Sn.rowSelection(n,o):i&&this.isColSelection()?Sn.colSelection(n,o):new Sn(n,o)}return Ce.between(n,o)}content(){const e=this.$anchorCell.node(-1),r=qe.get(e),n=this.$anchorCell.start(-1),o=r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},s=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*r.width+o.left,d=o.left;d<o.right;d++,u++){const h=r.map[u];if(i[h])continue;i[h]=!0;const p=r.findCell(h);let g=e.nodeAt(h);if(!g)throw new RangeError(`No cell with offset ${h} found`);const y=o.left-p.left,v=p.right-o.right;if(y>0||v>0){let w=g.attrs;if(y>0&&(w=si(w,0,y)),v>0&&(w=si(w,w.colspan-v,v)),p.left<o.left){if(g=g.type.createAndFill(w),!g)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else g=g.type.create(w,g.content)}if(p.top<o.top||p.bottom>o.bottom){const w={...g.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?g=g.type.createAndFill(w):g=g.type.create(w,g.content)}c.push(g)}s.push(e.child(l).copy(He.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new dt(He.from(a),1,1)}replace(e,r=dt.empty){const n=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:a,$to:l}=o[s],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),s?dt.empty:r)}const i=jt.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,r){this.replace(e,new dt(He.from(r),0,0))}forEachCell(e){const r=this.$anchorCell.node(-1),n=qe.get(r),o=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(r.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),r=this.$headCell.index(-1);if(Math.min(e,r)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=r+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount}static colSelection(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(r.pos-i),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(r=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(r=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Sn(e,r)}isRowSelection(){const e=this.$anchorCell.node(-1),r=qe.get(e),n=this.$anchorCell.start(-1),o=r.colCount(this.$anchorCell.pos-n),i=r.colCount(this.$headCell.pos-n);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==r.width}eq(e){return e instanceof Sn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,r=e){const n=e.node(-1),o=qe.get(n),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(r.pos-i),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(r=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(r=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(e=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new Sn(e,r)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,r){return new Sn(e.resolve(r.anchor),e.resolve(r.head))}static create(e,r,n=r){return new Sn(e.resolve(r),e.resolve(n))}getBookmark(){return new qx(this.$anchorCell.pos,this.$headCell.pos)}};Ue.prototype.visible=!1;jt.jsonID("cell",Ue);var qx=class _3{constructor(e,r){this.anchor=e,this.head=r}map(e){return new _3(e.map(this.anchor),e.map(this.head))}resolve(e){const r=e.resolve(this.anchor),n=e.resolve(this.head);return r.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&r.index()<r.parent.childCount&&n.index()<n.parent.childCount&&ih(r,n)?new Ue(r,n):jt.near(n,1)}};function Fx(t){if(!(t.selection instanceof Ue))return null;const e=[];return t.selection.forEachCell((r,n)=>{e.push(Bt.node(n,n+r.nodeSize,{class:"selectedCell"}))}),Dt.create(t.doc,e)}function Vx({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let r=t.pos,n=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,r++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,n--);return r==n&&/row|table/.test(t.node(o).type.spec.tableRole)}function Wx({$from:t,$to:e}){let r,n;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}return r!==n&&e.parentOffset===0}function jx(t,e,r){const n=(e||t).selection,o=(e||t).doc;let i,s;if(n instanceof qr&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ue.create(o,n.from);else if(s=="row"){const a=o.resolve(n.from+1);i=Ue.rowSelection(a,a)}else if(!r){const a=qe.get(n.node),l=n.from+1,c=l+a.map[a.width*a.height-1];i=Ue.create(o,l+1,c)}}else n instanceof Ce&&Vx(n)?i=Ce.create(o,n.from):n instanceof Ce&&Wx(n)&&(i=Ce.create(o,n.$from.start(),n.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const Ux=new et("fix-tables");function S3(t,e,r,n){const o=t.childCount,i=e.childCount;e:for(let s=0,a=0;s<i;s++){const l=e.child(s);for(let c=a,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==l){a=c+1,r+=l.nodeSize;continue e}n(l,r),a<o&&t.child(a).sameMarkup(l)?S3(t.child(a),l,r+1,n):l.nodesBetween(0,l.content.size,n,r+1),r+=l.nodeSize}}function Gx(t,e){let r;const n=(o,i)=>{o.type.spec.tableRole=="table"&&(r=Kx(t,o,i,r))};return e?e.doc!=t.doc&&S3(e.doc,t.doc,0,n):t.doc.descendants(n),r}function Kx(t,e,r,n){const o=qe.get(e);if(!o.problems)return n;n||(n=t.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)i[c.row+h]+=c.n;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,si(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(r+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=n.mapping.map(r);n.delete(u,u+e.nodeSize)}}let s,a;for(let l=0;l<i.length;l++)i[l]&&(s==null&&(s=l),a=l);for(let l=0,c=r+1;l<o.height;l++){const u=e.child(l),d=c+u.nodeSize,h=i[l];if(h>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const g=[];for(let v=0;v<h;v++){const w=Sr(t.schema)[p].createAndFill();w&&g.push(w)}const y=(l==0||s==l-1)&&a==l?c+1:d-1;n.insert(n.mapping.map(y),g)}c=d}return n.setMeta(Ux,{fixTables:!0})}function A3(t){const e=qe.get(t),r=[],n=e.height,o=e.width;for(let i=0;i<n;i++){const s=[];for(let a=0;a<o;a++){const l=i*o+a,c=e.map[l];if(i>0){const u=l-o;if(c===e.map[u]){s.push(null);continue}}if(a>0){const u=l-1;if(c===e.map[u]){s.push(null);continue}}s.push(t.nodeAt(c))}r.push(s)}return r}function T3(t,e){const r=[],n=qe.get(t),o=n.height,i=n.width;for(let s=0;s<o;s++){const a=t.child(s),l=[];for(let u=0;u<i;u++){const d=e[s][u];if(!d)continue;const h=n.map[s*n.width+u],p=t.nodeAt(h);if(!p)continue;const g=p.type.createChecked(d.attrs,d.content,d.marks);l.push(g)}const c=a.type.createChecked(a.attrs,l,a.marks);r.push(c)}return t.type.createChecked(t.attrs,r,t.marks)}function M3(t,e,r,n){const o=e[0]>r[0]?-1:1,i=t.splice(e[0],e.length),s=i.length%2===0?1:0;let a;return a=o===-1?r[0]:r[r.length-1]-s,t.splice(a,0,...i),t}function hs(t){return Zx(e=>e.type.spec.tableRole==="table",t)}function Zx(t,e){for(let r=e.depth;r>=0;r-=1){const n=e.node(r);if(t(n))return{node:n,pos:r===0?0:e.before(r),start:e.start(r),depth:r}}return null}function Ci(t,e){const r=hs(e.$from);if(!r)return;const n=qe.get(r.node);if(!(t<0||t>n.width-1))return n.cellsInRect({left:t,right:t+1,top:0,bottom:n.height}).map(o=>{const i=r.node.nodeAt(o),s=o+r.start;return{pos:s,start:s+1,node:i,depth:r.depth+2}})}function ki(t,e){const r=hs(e.$from);if(!r)return;const n=qe.get(r.node);if(!(t<0||t>n.height-1))return n.cellsInRect({left:0,right:n.width,top:t,bottom:t+1}).map(o=>{const i=r.node.nodeAt(o),s=o+r.start;return{pos:s,start:s+1,node:i,depth:r.depth+2}})}function Mm(t,e,r=e){let n=e,o=r;for(let u=e;u>=0;u--){const d=Ci(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.colspan+u-1;p>=n&&(n=u),p>o&&(o=p)})}for(let u=e;u<=o;u++){const d=Ci(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.colspan+u-1;h.node.attrs.colspan>1&&p>o&&(o=p)})}const i=[];for(let u=n;u<=o;u++){const d=Ci(u,t.selection);d&&d.length>0&&i.push(u)}n=i[0],o=i[i.length-1];const s=Ci(n,t.selection),a=ki(0,t.selection);if(!s||!a)return;const l=t.doc.resolve(s[s.length-1].pos);let c;for(let u=o;u>=n;u--){const d=Ci(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:i}}function Em(t,e,r=e){let n=e,o=r;for(let u=e;u>=0;u--){const d=ki(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.rowspan+u-1;p>=n&&(n=u),p>o&&(o=p)})}for(let u=e;u<=o;u++){const d=ki(u,t.selection);d&&d.forEach(h=>{const p=h.node.attrs.rowspan+u-1;h.node.attrs.rowspan>1&&p>o&&(o=p)})}const i=[];for(let u=n;u<=o;u++){const d=ki(u,t.selection);d&&d.length>0&&i.push(u)}n=i[0],o=i[i.length-1];const s=ki(n,t.selection),a=Ci(0,t.selection);if(!s||!a)return;const l=t.doc.resolve(s[s.length-1].pos);let c;for(let u=o;u>=n;u--){const d=ki(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:i}}function Im(t){return t[0].map((e,r)=>t.map(n=>n[r]))}function Xx(t){var e,r;const{tr:n,originIndex:o,targetIndex:i,select:s,pos:a}=t,l=hs(n.doc.resolve(a));if(!l)return!1;const c=(e=Mm(n,o))===null||e===void 0?void 0:e.indexes,u=(r=Mm(n,i))===null||r===void 0?void 0:r.indexes;if(!c||!u||c.includes(i))return!1;const d=Yx(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!s)return!0;const h=qe.get(d),p=l.start,g=i,y=h.positionAt(h.height-1,g,d),v=n.doc.resolve(p+y),w=h.positionAt(0,g,d),C=n.doc.resolve(p+w);return n.setSelection(Ue.colSelection(v,C)),!0}function Yx(t,e,r,n){let o=Im(A3(t));return o=M3(o,e,r),o=Im(o),T3(t,o)}function Jx(t){var e,r;const{tr:n,originIndex:o,targetIndex:i,select:s,pos:a}=t,l=hs(n.doc.resolve(a));if(!l)return!1;const c=(e=Em(n,o))===null||e===void 0?void 0:e.indexes,u=(r=Em(n,i))===null||r===void 0?void 0:r.indexes;if(!c||!u||c.includes(i))return!1;const d=Qx(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!s)return!0;const h=qe.get(d),p=l.start,g=i,y=h.positionAt(g,h.width-1,d),v=n.doc.resolve(p+y),w=h.positionAt(g,0,d),C=n.doc.resolve(p+w);return n.setSelection(Ue.rowSelection(v,C)),!0}function Qx(t,e,r,n){let o=A3(t);return o=M3(o,e,r),T3(t,o)}function So(t){const e=t.selection,r=Pc(t),n=r.node(-1),o=r.start(-1),i=qe.get(n);return{...e instanceof Ue?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(r.pos-o),tableStart:o,map:i,table:n}}function E3(t,{map:e,tableStart:r,table:n},o){let i=o>0?-1:0;$x(e,n,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=n.nodeAt(l);t.setNodeMarkup(t.mapping.map(r+l),null,Hx(c.attrs,o-e.colCount(l))),s+=c.attrs.rowspan-1}else{const l=i==null?Sr(n.type.schema).cell:n.nodeAt(e.map[a+i]).type,c=e.positionAt(s,o,n);t.insert(t.mapping.map(r+c),l.createAndFill())}}return t}function eC(t,e){if(!Mr(t))return!1;if(e){const r=So(t);e(E3(t.tr,r,r.left))}return!0}function tC(t,e){if(!Mr(t))return!1;if(e){const r=So(t);e(E3(t.tr,r,r.right))}return!0}function rC(t,{map:e,table:r,tableStart:n},o){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+o,l=e.map[a],c=r.nodeAt(l),u=c.attrs;if(o>0&&e.map[a-1]==l||o<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(n+l),null,si(u,o-e.colCount(l)));else{const d=t.mapping.slice(i).map(n+l);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function nC(t,e){if(!Mr(t))return!1;if(e){const r=So(t),n=t.tr;if(r.left==0&&r.right==r.map.width)return!1;for(let o=r.right-1;rC(n,r,o),o!=r.left;o--){const i=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!i)throw new RangeError("No table found");r.table=i,r.map=qe.get(i)}e(n)}return!0}function oC(t,{map:e,table:r,tableStart:n},o){let i=0;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const s=i+r.child(o).nodeSize,a=t.mapping.maps.length;t.delete(i+n,s+n);const l=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==e.map[u-e.width]){const h=r.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+n),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const h=r.nodeAt(d),p=h.attrs,g=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),y=e.positionAt(o+1,c,r);t.insert(t.mapping.slice(a).map(n+y),g),c+=p.colspan-1}}}}function iC(t,e){if(!Mr(t))return!1;if(e){const r=So(t),n=t.tr;if(r.top==0&&r.bottom==r.map.height)return!1;for(let o=r.bottom-1;oC(n,r,o),o!=r.top;o--){const i=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!i)throw new RangeError("No table found");r.table=i,r.map=qe.get(r.table)}e(n)}return!0}function sC(t,e){return function(r,n){if(!Mr(r))return!1;const o=Pc(r);if(o.nodeAfter.attrs[t]===e)return!1;if(n){const i=r.tr;r.selection instanceof Ue?r.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&i.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),n(i)}return!0}}function aC(t){return function(e,r){if(!Mr(e))return!1;if(r){const n=Sr(e.schema),o=So(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(l=>o.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==n.header_cell&&i.setNodeMarkup(o.tableStart+s[l],n.cell,a[l].attrs);if(i.steps.length===0)for(let l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],n.header_cell,a[l].attrs);r(i)}return!0}}function Lm(t,e,r){const n=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<n.length;o++){const i=e.table.nodeAt(n[o]);if(i&&i.type!==r.header_cell)return!1}return!0}function sh(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?aC(t):function(r,n){if(!Mr(r))return!1;if(n){const o=Sr(r.schema),i=So(r),s=r.tr,a=Lm("row",i,o),l=Lm("column",i,o),c=(t==="column"?a:t==="row"&&l)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?l?o.cell:o.header_cell:t=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(h=>{const p=h+i.tableStart,g=s.doc.nodeAt(p);g&&s.setNodeMarkup(p,d,g.attrs)}),n(s)}return!0}}sh("row",{useDeprecatedLogic:!0});sh("column",{useDeprecatedLogic:!0});sh("cell",{useDeprecatedLogic:!0});function lC(t,e){if(e<0){const r=t.nodeBefore;if(r)return t.pos-r.nodeSize;for(let n=t.index(-1)-1,o=t.before();n>=0;n--){const i=t.node(-1).child(n),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const r=t.node(-1);for(let n=t.indexAfter(-1),o=t.after();n<r.childCount;n++){const i=r.child(n);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function I3(t){return function(e,r){if(!Mr(e))return!1;const n=lC(Pc(e),t);if(n==null)return!1;if(r){const o=e.doc.resolve(n);r(e.tr.setSelection(Ce.between(o,Nx(o))).scrollIntoView())}return!0}}function cC(t,e){const r=t.selection.$anchor;for(let n=r.depth;n>0;n--)if(r.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(r.before(n),r.after(n)).scrollIntoView()),!0;return!1}function al(t,e){const r=t.selection;if(!(r instanceof Ue))return!1;if(e){const n=t.tr,o=Sr(t.schema).cell.createAndFill().content;r.forEachCell((i,s)=>{i.content.eq(o)||n.replace(n.mapping.map(s+1),n.mapping.map(s+i.nodeSize-1),new dt(o,0,0))}),n.docChanged&&e(n)}return!0}function uC(t){return(e,r)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=t,a=e.tr;return Jx({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})?(r?.(a),!0):!1}}function dC(t){return(e,r)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=t,a=e.tr;return Xx({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})?(r?.(a),!0):!1}}function hC(t){if(t.size===0)return null;let{content:e,openStart:r,openEnd:n}=t;for(;e.childCount==1&&(r>0&&n>0||e.child(0).type.spec.tableRole=="table");)r--,n--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,r-1),d=l<e.childCount-1?0:Math.max(0,n-1);(u||d)&&(c=xd(Sr(s).row,new dt(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(r||n?xd(Sr(s).row,new dt(e,r,n)).content:e);else return null;return fC(s,a)}function fC(t,e){const r=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=i.child(s).attrs;for(let c=o;c<o+a;c++)r[c]=(r[c]||0)+l}}let n=0;for(let o=0;o<r.length;o++)n=Math.max(n,r[o]);for(let o=0;o<r.length;o++)if(o>=e.length&&e.push(He.empty),r[o]<n){const i=Sr(t).cell.createAndFill(),s=[];for(let a=r[o];a<n;a++)s.push(i);e[o]=e[o].append(He.from(s))}return{height:e.length,width:n,rows:e}}function xd(t,e){const r=t.createAndFill();return new qg(r).replace(0,r.content.size,e).doc}function pC({width:t,height:e,rows:r},n,o){if(t!=n){const i=[],s=[];for(let a=0;a<r.length;a++){const l=r[a],c=[];for(let u=i[a]||0,d=0;u<n;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>n&&(h=h.type.createChecked(si(h.attrs,h.attrs.colspan,u+h.attrs.colspan-n),h.content)),c.push(h),u+=h.attrs.colspan;for(let p=1;p<h.attrs.rowspan;p++)i[a+p]=(i[a+p]||0)+h.attrs.colspan}s.push(He.from(c))}r=s,t=n}if(e!=o){const i=[];for(let s=0,a=0;s<o;s++,a++){const l=[],c=r[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(He.from(l))}r=i,e=o}return{width:t,height:e,rows:r}}function mC(t,e,r,n,o,i,s){const a=t.doc.type.schema,l=Sr(a);let c,u;if(o>e.width)for(let d=0,h=0;d<e.height;d++){const p=r.child(d);h+=p.nodeSize;const g=[];let y;p.lastChild==null||p.lastChild.type==l.cell?y=c||(c=l.cell.createAndFill()):y=u||(u=l.header_cell.createAndFill());for(let v=e.width;v<o;v++)g.push(y);t.insert(t.mapping.slice(s).map(h-1+n),g)}if(i>e.height){const d=[];for(let g=0,y=(e.height-1)*e.width;g<Math.max(e.width,o);g++){const v=g>=e.width?!1:r.nodeAt(e.map[y+g]).type==l.header_cell;d.push(v?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,He.from(d)),p=[];for(let g=e.height;g<i;g++)p.push(h);t.insert(t.mapping.slice(s).map(n+r.nodeSize-2),p)}return!!(c||u)}function Rm(t,e,r,n,o,i,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=r.nodeAt(d),{top:p,left:g}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+n),null,{...h.attrs,rowspan:s-p}),t.insert(t.mapping.slice(a).map(e.positionAt(s,g,r)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return l}function Om(t,e,r,n,o,i,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=r.nodeAt(d),p=e.colCount(d),g=t.mapping.slice(a).map(d+n);t.setNodeMarkup(g,null,si(h.attrs,s-p,h.attrs.colspan-(s-p))),t.insert(g+h.nodeSize,h.type.createAndFill(si(h.attrs,0,s-p))),c+=h.attrs.rowspan-1}}return l}function Pm(t,e,r,n,o){let i=r?t.doc.nodeAt(r-1):t.doc;if(!i)throw new Error("No table found");let s=qe.get(i);const{top:a,left:l}=n,c=l+o.width,u=a+o.height,d=t.tr;let h=0;function p(){if(i=r?d.doc.nodeAt(r-1):d.doc,!i)throw new Error("No table found");s=qe.get(i),h=d.mapping.maps.length}mC(d,s,i,r,c,u,h)&&p(),Rm(d,s,i,r,l,c,a,h)&&p(),Rm(d,s,i,r,l,c,u,h)&&p(),Om(d,s,i,r,a,u,l,h)&&p(),Om(d,s,i,r,a,u,c,h)&&p();for(let g=a;g<u;g++){const y=s.positionAt(g,l,i),v=s.positionAt(g,c,i);d.replace(d.mapping.slice(h).map(y+r),d.mapping.slice(h).map(v+r),new dt(o.rows[g-a],0,0))}p(),d.setSelection(new Ue(d.doc.resolve(r+s.positionAt(a,l,i)),d.doc.resolve(r+s.positionAt(u-1,c-1,i)))),e(d)}const gC=b2({ArrowLeft:ll("horiz",-1),ArrowRight:ll("horiz",1),ArrowUp:ll("vert",-1),ArrowDown:ll("vert",1),"Shift-ArrowLeft":cl("horiz",-1),"Shift-ArrowRight":cl("horiz",1),"Shift-ArrowUp":cl("vert",-1),"Shift-ArrowDown":cl("vert",1),Backspace:al,"Mod-Backspace":al,Delete:al,"Mod-Delete":al});function Bl(t,e,r){return r.eq(t.selection)?!1:(e&&e(t.tr.setSelection(r).scrollIntoView()),!0)}function ll(t,e){return(r,n,o)=>{if(!o)return!1;const i=r.selection;if(i instanceof Ue)return Bl(r,n,jt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=L3(o,t,e);if(s==null)return!1;if(t=="horiz")return Bl(r,n,jt.near(r.doc.resolve(i.head+e),e));{const a=r.doc.resolve(s),l=k3(a,t,e);let c;return l?c=jt.near(l,1):e<0?c=jt.near(r.doc.resolve(a.before(-1)),-1):c=jt.near(r.doc.resolve(a.after(-1)),1),Bl(r,n,c)}}}function cl(t,e){return(r,n,o)=>{if(!o)return!1;const i=r.selection;let s;if(i instanceof Ue)s=i;else{const l=L3(o,t,e);if(l==null)return!1;s=new Ue(r.doc.resolve(l))}const a=k3(s.$headCell,t,e);return a?Bl(r,n,new Ue(s.$anchorCell,a)):!1}}function vC(t,e){const r=t.state.doc,n=Gi(r.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new Ue(n))),!0):!1}function yC(t,e,r){if(!Mr(t.state))return!1;let n=hC(r);const o=t.state.selection;if(o instanceof Ue){n||(n={width:1,height:1,rows:[He.from(xd(Sr(t.state.schema).cell,r))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=qe.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return n=pC(n,a.right-a.left,a.bottom-a.top),Pm(t.state,t.dispatch,s,a,n),!0}else if(n){const i=Pc(t.state),s=i.start(-1);return Pm(t.state,t.dispatch,s,qe.get(i.node(-1)).findCell(i.pos-s),n),!0}else return!1}function bC(t,e){var r;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=Dm(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof Ue)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(o=Gi(t.state.selection.$anchor))!=null&&((r=Cu(t,e))===null||r===void 0?void 0:r.pos)!=o.pos)i(o,e),e.preventDefault();else if(!n)return;function i(l,c){let u=Cu(t,c);const d=ao.getState(t.state)==null;if(!u||!ih(l,u))if(d)u=l;else return;const h=new Ue(l,u);if(d||!t.state.selection.eq(h)){const p=t.state.tr.setSelection(h);d&&p.setMeta(ao,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ao,-1))}function a(l){const c=l,u=ao.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(Dm(t,c.target)!=n&&(d=Cu(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function L3(t,e,r){if(!(t.state.selection instanceof Ce))return null;const{$head:n}=t.state.selection;for(let o=n.depth-1;o>=0;o--){const i=n.node(o);if((r<0?n.index(o):n.indexAfter(o))!=(r<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=n.before(o),a=e=="vert"?r>0?"down":"up":r>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Dm(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Cu(t,e){const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return null;let{inside:n,pos:o}=r;return n>=0&&Gi(t.state.doc.resolve(n))||Gi(t.state.doc.resolve(o))}var wC=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cd(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Cd(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Cd(t,e,r,n,o,i){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:p,colwidth:g}=c.child(d).attrs;for(let y=0;y<p;y++,h++){const v=o==h?i:g&&g[y],w=v?v+"px":"";if(s+=v||n,v||(a=!1),l)l.style.width!=w&&(l.style.width=w),l=l.nextSibling;else{const C=document.createElement("col");C.style.width=w,e.appendChild(C)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(r.style.width=s+"px",r.style.minWidth=""):(r.style.width="",r.style.minWidth=s+"px")}}const hr=new et("tableColumnResizing");function xC({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:r=100,View:n=wC,lastColumnResizable:o=!0}={}){const i=new Xe({key:hr,state:{init(s,a){var l;const c=(l=i.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=Sr(a.schema).table.name;return n&&c&&(c[u]=(d,h)=>new n(d,r,h)),new CC(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=hr.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{kC(s,a,t,o)},mouseleave:s=>{_C(s)},mousedown:(s,a)=>{SC(s,a,e,r)}},decorations:s=>{const a=hr.getState(s);if(a&&a.activeHandle>-1)return IC(s,a.activeHandle)},nodeViews:{}}});return i}var CC=class zl{constructor(e,r){this.activeHandle=e,this.dragging=r}apply(e){const r=this,n=e.getMeta(hr);if(n&&n.setHandle!=null)return new zl(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new zl(r.activeHandle,n.setDragging);if(r.activeHandle>-1&&e.docChanged){let o=e.mapping.map(r.activeHandle,-1);return wd(e.doc.resolve(o))||(o=-1),new zl(o,r.dragging)}return r}};function kC(t,e,r,n){if(!t.editable)return;const o=hr.getState(t.state);if(o&&!o.dragging){const i=TC(e.target);let s=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=r?s=Bm(t,e,"left",r):l-e.clientX<=r&&(s=Bm(t,e,"right",r))}if(s!=o.activeHandle){if(!n&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=qe.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}R3(t,s)}}}function _C(t){if(!t.editable)return;const e=hr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&R3(t,-1)}function SC(t,e,r,n){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=hr.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=AC(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(hr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const h=hr.getState(t.state);h?.dragging&&(MC(t,h.activeHandle,zm(h.dragging,d,r)),t.dispatch(t.state.tr.setMeta(hr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=hr.getState(t.state);if(h&&h.dragging){const p=zm(h.dragging,d,r);Nm(t,h.activeHandle,p,n)}}return Nm(t,s.activeHandle,l,n),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function AC(t,e,{colspan:r,colwidth:n}){const o=n&&n[n.length-1];if(o)return o;const i=t.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,a=r;if(n)for(let l=0;l<r;l++)n[l]&&(s-=n[l],a--);return s/a}function TC(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Bm(t,e,r,n){const o=r=="right"?-n:n,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,a=Gi(t.state.doc.resolve(s));if(!a)return-1;if(r=="right")return a.pos;const l=qe.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function zm(t,e,r){const n=e.clientX-t.startX;return Math.max(r,t.startWidth+n)}function R3(t,e){t.dispatch(t.state.tr.setMeta(hr,{setHandle:e}))}function MC(t,e,r){const n=t.state.doc.resolve(e),o=n.node(-1),i=qe.get(o),s=n.start(-1),a=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],h=o.nodeAt(d).attrs,p=h.colspan==1?0:a-i.colCount(d);if(h.colwidth&&h.colwidth[p]==r)continue;const g=h.colwidth?h.colwidth.slice():EC(h.colspan);g[p]=r,l.setNodeMarkup(s+d,null,{...h,colwidth:g})}l.docChanged&&t.dispatch(l)}function Nm(t,e,r,n){const o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=qe.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Cd(i,l.firstChild,l,n,a,r)}function EC(t){return Array(t).fill(0)}function IC(t,e){const r=[],n=t.doc.resolve(e),o=n.node(-1);if(!o)return Dt.empty;const i=qe.get(o),s=n.start(-1),a=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=a+c*i.width;if((a==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var l;const d=i.map[u],h=s+d+o.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((l=hr.getState(t))===null||l===void 0)&&l.dragging&&r.push(Bt.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Bt.widget(h,p))}}return Dt.create(t.doc,r)}function LC({allowTableNodeSelection:t=!1}={}){return new Xe({key:ao,state:{init(){return null},apply(e,r){const n=e.getMeta(ao);if(n!=null)return n==-1?null:n;if(r==null||!e.docChanged)return r;const{deleted:o,pos:i}=e.mapping.mapResult(r);return o?null:i}},props:{decorations:Fx,handleDOMEvents:{mousedown:bC},createSelectionBetween(e){return ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:vC,handleKeyDown:gC,handlePaste:yC},appendTransaction(e,r,n){return jx(n,Gx(n,r),t)}})}var W0=typeof navigator<"u"?navigator:null,ah=W0&&W0.userAgent||"",RC=/Edge\/(\d+)/.exec(ah),OC=/MSIE \d/.exec(ah),PC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ah),DC=!!(OC||PC||RC),BC=!DC&&!!W0&&/Apple Computer/.test(W0.vendor),O3=new et("safari-ime-span"),kd=!1,zC={key:O3,props:{decorations:NC,handleDOMEvents:{compositionstart:()=>{kd=!0},compositionend:()=>{kd=!1}}}};function NC(t){const{$from:e,$to:r,to:n}=t.selection;if(kd&&e.sameParent(r)){const o=Bt.widget(n,HC,{ignoreSelection:!0,key:"safari-ime-span"});return Dt.create(t.doc,[o])}}function HC(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var $C=new Xe(BC?zC:{key:O3});function he(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var lh=Wg("strike_through");he(lh,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var ui=jg("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(lh.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,r,n)=>{e.openMark(n),e.next(r.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,r)=>{e.withMark(r,"delete")}}}));he(ui.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});he(ui.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Ua=Me("ToggleStrikeThrough",t=>()=>Ug(ui.type(t)));he(Ua,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var P3=is(t=>Vg(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)$"),ui.type(t)));he(P3,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var Dc=f1("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(ne);return()=>e.call(Ua.key)}}});he(Dc.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});he(Dc.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});function D3(t,e){const r=e.content.firstChild;if(e.childCount!==1||r?.type.name!=="paragraph"){t.next(e.content);return}const n=r.lastChild,o=n?.type.name==="hardbreak"?r.content.cut(0,r.content.size-n.nodeSize):r.content;t.next(o)}var Ga=Bx({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),ln=Wr("table",()=>({...Ga.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n,isHeader:s===0}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const r=e.content.firstChild?.content;if(!r)return;const n=[];r.forEach(o=>{n.push(o.attrs.alignment)}),t.openNode("table",void 0,{align:n}),t.next(e.content),t.closeNode()}}}));he(ln.node,{displayName:"NodeSchema<table>",group:"Table"});he(ln.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var Ka=Wr("table_header_row",()=>({...Ga.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n[s],isHeader:e.isHeader}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));he(Ka.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});he(Ka.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var fs=Wr("table_row",()=>({...Ga.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,r)=>{const n=e.align,o=e.children.map((i,s)=>({...i,align:n[s]}));t.openNode(r),t.next(o),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));he(fs.node,{displayName:"NodeSchema<tableRow>",group:"Table"});he(fs.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var Za=Wr("table_cell",()=>({...Ga.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,r)=>{const n=e.align;t.openNode(r,{alignment:n}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell"),D3(t,e),t.closeNode()}}}));he(Za.node,{displayName:"NodeSchema<tableCell>",group:"Table"});he(Za.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Ki=Wr("table_header",()=>({...Ga.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,r)=>{const n=e.align;t.openNode(r,{alignment:n}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),D3(t,e),t.closeNode()}}}));he(Ki.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});he(Ki.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function Bc(t,e=3,r=3){const n=Array(r).fill(0).map(()=>Za.type(t).createAndFill()),o=Array(r).fill(0).map(()=>Ki.type(t).createAndFill()),i=Array(e).fill(0).map((s,a)=>a===0?Ka.type(t).create(null,o):fs.type(t).create(null,n));return ln.type(t).create(null,i)}function B3(t){return(e,r)=>n=>{r=r??n.selection.from;const o=n.doc.resolve(r),i=Kg(l=>l.type.name==="table")(o),s=i?{node:i.node,from:i.start}:void 0,a=t==="row";if(s){const l=qe.get(s.node);if(e>=0&&e<(a?l.height:l.width)){const c=l.positionAt(a?e:l.height-1,a?l.width-1:e,s.node),u=n.doc.resolve(s.from+c),d=a?Ue.rowSelection:Ue.colSelection,h=l.positionAt(a?e:0,a?0:e,s.node),p=n.doc.resolve(s.from+h);return w2(n.setSelection(d(u,p)))}}return n}}var qC=B3("row"),FC=B3("col");function z3(t,e,{map:r,tableStart:n,table:o},i){const s=Array(i).fill(0).reduce((l,c,u)=>l+o.child(u).nodeSize,n),a=Array(r.width).fill(0).map((l,c)=>{const u=o.nodeAt(r.map[c]);return Za.type(t).createAndFill({alignment:u?.attrs.alignment})});return e.insert(s,fs.type(t).create(null,a)),e}function VC(t){const e=hs(t.$from);if(!e)return;const r=qe.get(e.node);return r.cellsInRect({left:0,right:r.width,top:0,bottom:r.height}).map(n=>{const o=e.node.nodeAt(n),i=n+e.start;return{pos:i,start:i+1,node:o}})}function WC(t){const e=VC(t.selection);if(e&&e[0]){const r=t.doc.resolve(e[0].pos),n=e[e.length-1];if(n){const o=t.doc.resolve(n.pos);return w2(t.setSelection(new Ue(o,r)))}}return t}var ch=Me("GoToPrevTableCell",()=>()=>I3(-1));he(ch,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var uh=Me("GoToNextTableCell",()=>()=>I3(1));he(uh,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var dh=Me("ExitTable",t=>()=>(e,r)=>{if(!Mr(e))return!1;const{$head:n}=e.selection,o=Gg(n,ln.type(t));if(!o)return!1;const{to:i}=o,s=e.tr.replaceWith(i,i,Vi.type(t).createAndFill());return s.setSelection(jt.near(s.doc.resolve(i),1)).scrollIntoView(),r?.(s),!0});he(dh,{displayName:"Command<breakTableCommand>",group:"Table"});var N3=Me("InsertTable",t=>({row:e,col:r}={})=>(n,o)=>{const{selection:i,tr:s}=n,{from:a}=i,l=Bc(t,e,r),c=s.replaceSelectionWith(l),u=jt.findFrom(c.doc.resolve(a),1,!0);return u&&c.setSelection(u),o?.(c),!0});he(N3,{displayName:"Command<insertTableCommand>",group:"Table"});var hh=Me("MoveRow",()=>({from:t,to:e,pos:r}={})=>uC({from:t??0,to:e??0,pos:r}));he(hh,{displayName:"Command<moveRowCommand>",group:"Table"});var fh=Me("MoveCol",()=>({from:t,to:e,pos:r}={})=>dC({from:t??0,to:e??0,pos:r}));he(fh,{displayName:"Command<moveColCommand>",group:"Table"});var Uo=Me("SelectRow",()=>(t={index:0})=>(e,r)=>{const{tr:n}=e;return!!r?.(qC(t.index,t.pos)(n))});he(Uo,{displayName:"Command<selectRowCommand>",group:"Table"});var Go=Me("SelectCol",()=>(t={index:0})=>(e,r)=>{const{tr:n}=e;return!!r?.(FC(t.index,t.pos)(n))});he(Go,{displayName:"Command<selectColCommand>",group:"Table"});var H3=Me("SelectTable",()=>()=>(t,e)=>{const{tr:r}=t;return!!e?.(WC(r))});he(H3,{displayName:"Command<selectTableCommand>",group:"Table"});var ph=Me("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:r}=t;if(!(r instanceof Ue))return!1;const n=r.isRowSelection(),o=r.isColSelection();return n&&o?cC(t,e):o?nC(t,e):iC(t,e)});he(ph,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var mh=Me("AddColBefore",()=>()=>eC);he(mh,{displayName:"Command<addColBeforeCommand>",group:"Table"});var gh=Me("AddColAfter",()=>()=>tC);he(gh,{displayName:"Command<addColAfterCommand>",group:"Table"});var vh=Me("AddRowBefore",t=>()=>(e,r)=>{if(!Mr(e))return!1;if(r){const n=So(e);r(z3(t,e.tr,n,n.top))}return!0});he(vh,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var yh=Me("AddRowAfter",t=>()=>(e,r)=>{if(!Mr(e))return!1;if(r){const n=So(e);r(z3(t,e.tr,n,n.bottom))}return!0});he(yh,{displayName:"Command<addRowAfterCommand>",group:"Table"});var bh=Me("SetAlign",()=>(t="left")=>sC("alignment",t));he(bh,{displayName:"Command<setAlignCommand>",group:"Table"});var $3=is(t=>new h1(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,r,n,o)=>{const i=e.doc.resolve(n);if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),ln.type(t)))return null;const s=Bc(t,Math.max(Number(r.groups?.row??0),2),Number(r.groups?.col)),a=e.tr.replaceRangeWith(n,o,s);return a.setSelection(Ce.create(a.doc,n+3)).scrollIntoView()}));he($3,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var q3=Fg(t=>({run:(e,r,n)=>{if(n)return e;function o(c){const u=c.childCount,d=c.lastChild?.childCount??0;if(u===0||d===0)return Vi.type(t).create();const h=c.firstChild;if(!(d>0&&h&&h.childCount===0))return c;if(u>=3){const v=c.child(1),w=[];for(let S=0;S<v.childCount;S++){const E=v.child(S);w.push(Ki.type(t).create(E.attrs,E.content,E.marks))}const C=h.type.create(h.attrs,w),k=[];for(let S=2;S<u;S++)k.push(c.child(S));return c.type.create(c.attrs,[C,...k])}const p=Array(d).fill(0).map(()=>Ki.type(t).createAndFill()),g=new dt(He.from(p),0,0),y=h.replace(0,0,g);return c.replace(0,h.nodeSize,new dt(He.from(y),0,0))}function i(c){const u=fs.type(t),d=[];let h=[],p=!1;function g(){if(h.length===0)return;const y=Ka.type(t).createAndFill(),v=ln.type(t).create(null,[y,...h]);d.push(o(v)),h=[]}return c.forEach(y=>{y.type===u?(p=!0,h.push(y)):(g(),d.push(y))}),g(),p?He.from(d):c}function s(c){let u=i(c),d=u!==c;const h=[];return u.forEach(p=>{if(p.type===ln.type(t)){const g=o(p);g!==p&&(d=!0),h.push(g)}else if(p.childCount>0){const g=s(p.content);g!==p.content?(d=!0,h.push(p.copy(g))):h.push(p)}else h.push(p)}),d?He.from(h):c}function a(c){const u=[],d=[];c.forEach(h=>d.push(h));for(let h=0;h<d.length;h++){const p=d[h],g=d[h+1];p.type===Vi.type(t)&&p.content.size===0&&g&&g.type===ln.type(t)||u.push(p)}return u.length<d.length?He.from(u):c}let l=s(e.content);return l=a(l),new dt(He.from(l),e.openStart,e.openEnd)}}));he(q3,{displayName:"PasteRule<table>",group:"Table"});var wh=f1("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(ne);return()=>e.call(uh.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(ne);return()=>e.call(ch.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(ne);return()=>e.call(dh.key)}}});he(wh.ctx,{displayName:"KeymapCtx<table>",group:"Table"});he(wh.shortcuts,{displayName:"Keymap<table>",group:"Table"});var ku="footnote_definition",Hm="footnoteDefinition",xh=Wr("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${ku}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nc(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":ku},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===Hm,runner:(t,e,r)=>{t.openNode(r,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===ku,runner:(t,e)=>{t.openNode(Hm,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));he(xh.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});he(xh.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var _u="footnote_reference",Ch=Wr("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${_u}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nc(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":_u},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,r)=>{t.addNode(r,{label:e.label})}},toMarkdown:{match:t=>t.type.name===_u,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));he(Ch.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});he(Ch.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var kh=Pa.extendSchema(t=>e=>{const r=t(e);return{...r,attrs:{...r.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:n=>{if(!(n instanceof HTMLElement))throw nc(n);return{label:n.dataset.label,listType:n.dataset.listType,spread:n.dataset.spread==="true",checked:n.dataset.checked?n.dataset.checked==="true":null}}},...r?.parseDOM||[]],toDOM:n=>r.toDOM&&n.attrs.checked==null?r.toDOM(n):["li",{"data-item-type":"task","data-label":n.attrs.label,"data-list-type":n.attrs.listType,"data-spread":n.attrs.spread,"data-checked":n.attrs.checked},0],parseMarkdown:{match:({type:n})=>n==="listItem",runner:(n,o,i)=>{if(o.checked==null){r.parseMarkdown.runner(n,o,i);return}const s=o.label!=null?`${o.label}.`:"•",a=o.checked!=null?!!o.checked:null,l=o.label!=null?"ordered":"bullet",c=o.spread??!0;n.openNode(i,{label:s,listType:l,spread:c,checked:a}),n.next(o.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="list_item",runner:(n,o)=>{if(o.attrs.checked==null){r.toMarkdown.runner(n,o);return}const i=o.attrs.label,s=o.attrs.listType,a=o.attrs.spread,l=o.attrs.checked;n.openNode("listItem",void 0,{label:i,listType:s,spread:a,checked:l}),n.next(o.content),n.closeNode()}}}});he(kh.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});he(kh.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var F3=is(()=>new h1(/^\[(?<checked>\s|x)\]\s$/,(t,e,r,n)=>{const o=t.doc.resolve(r);let i=0,s=o.node(i);for(;s&&s.type.name!=="list_item";)i--,s=o.node(i);if(!s||s.attrs.checked!=null)return null;const a=e.groups?.checked==="x",l=o.before(i),c=t.tr;return c.deleteRange(r,n).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));he(F3,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var jC=[Dc,wh].flat(),UC=[$3,F3],GC=[P3],KC=[q3],V3=Je(()=>$C);he(V3,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var ZC=Je(()=>xC({}));he(ZC,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var W3=Je(()=>LC({allowTableNodeSelection:!0}));he(W3,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var _h=os("remarkGFM",()=>a8);he(_h.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});he(_h.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var XC=new et("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function YC(t,e){let r=0;return e.forEach((n,o,i)=>{n===t&&(r=i)}),r}function JC(t,e){const r=t.content.findDiffStart(e.content);if(r==null)return null;const n=t.content.findDiffEnd(e.content);return n?{from:r,to:Math.max(n.b,r)}:null}var j3=Je(()=>new Xe({key:XC,appendTransaction:(t,e,r)=>{if(e.doc===r.doc)return;const n=JC(e.doc,r.doc);if(!n)return;let o;const i=(s,a)=>{if(s.type.name!=="table_cell")return;const l=r.doc.resolve(a),c=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const d=YC(s,c),h=u.maybeChild(d);if(!h)return;const p=h.attrs.alignment;p!==s.attrs.alignment&&(o||(o=r.tr),o.setNodeMarkup(a,void 0,{...s.attrs,alignment:p}))};return r.doc.nodesBetween(n.from,n.to,(s,a)=>s.type.name!=="table"?!0:(r.doc.nodesBetween(a,a+s.nodeSize,i),!1)),o}}));he(j3,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var QC=[j3,V3,_h,W3].flat(),ek=[kh,ln,Ka,fs,Ki,Za,xh,Ch,lh,ui].flat(),tk=[uh,ch,dh,N3,hh,fh,Uo,Go,H3,ph,vh,yh,mh,gh,bh,Ua],rk=[ek,UC,KC,GC,jC,tk,QC].flat(),nk=Object.defineProperty,$m=Object.getOwnPropertySymbols,ok=Object.prototype.hasOwnProperty,ik=Object.prototype.propertyIsEnumerable,qm=(t,e,r)=>e in t?nk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sk=(t,e)=>{for(var r in e||(e={}))ok.call(e,r)&&qm(t,r,e[r]);if($m)for(var r of $m(e))ik.call(e,r)&&qm(t,r,e[r]);return t};function U3(t,e){return Object.assign(t,{meta:sk({package:"@milkdown/components"},e)}),t}const ak={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:t=>t,renderPreview:()=>null,previewToggleButton:t=>t?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},Zi=Ve(ak,"codeBlockConfigCtx");U3(Zi,{displayName:"Config<code-block>",group:"CodeBlock"});class lk{constructor(e){this.languages=e,this.map={},e.forEach(r=>{r.alias.forEach(n=>{this.map[n]=r})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const n=this.map[e.toLowerCase()];return n?n.support?Promise.resolve(n.support):n.load():Promise.resolve(void 0)}}function Xa(...t){}Xa(M);function Hi({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Hi.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var ck=(t,e,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(t,e)).next())});Xa(M,Ie);function uk(t){return ck(this,null,function*(){try{return navigator.clipboard.writeText(t)}catch{const r=document.createElement("textarea"),n=document.activeElement;r.value=t,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const o=document.getSelection(),i=o?o.rangeCount>0&&o.getRangeAt(0):null;document.body.appendChild(r),r.select(),r.selectionStart=0,r.selectionEnd=t.length,document.execCommand("copy"),document.body.removeChild(r),i&&(o.removeAllRanges(),o.addRange(i)),n&&n.focus()}})}const dk=Ct({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(t){const e=()=>{uk(t.text).then(()=>t.onCopy(t.text)).catch(console.error)};return()=>M(Ie,null,M("button",{type:"button",class:"copy-button",onClick:e},M(Hi,{icon:t.copyIcon}),t.copyText))}}),hk=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function fk(t){return`${t}-${hk()}`}Xa(M,Ie);const pk=Ct({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:t,config:e,setLanguage:r,getAllLanguages:n,getReadOnly:o}){const i=re(),s=re(!1),a=re(),l=fk("milkdown-code-language-search"),c=re(),u=re("");Bn([s,i,c],()=>{u.value="";const v=i.value,w=c.value;!v||!w||dn(v,w,{placement:"bottom-start"}).then(({x:C,y:k})=>{Object.assign(w.style,{left:`${C}px`,top:`${k}px`})}).catch(console.error)});const d=v=>{if(v.preventDefault(),v.stopPropagation(),o())return;const w=!s.value;s.value=w,w&&setTimeout(()=>{var C;return(C=a.value)==null?void 0:C.focus()},0)},h=v=>{const w=v.target;u.value=w.value},p=v=>{v.key==="Escape"&&(u.value="")},g=dr(()=>{var v;if(!s.value)return[];const w=(v=n())!=null?v:[],C=w.find(S=>S.name.toLowerCase()===t.value.toLowerCase()),k=w.filter(S=>{const E=u.value.toLowerCase();return(S.name.toLowerCase().includes(E)||S.alias.some(R=>R.toLowerCase().includes(E)))&&S!==C});return k.length===0?[]:C?[C,...k]:k}),y=v=>{const w=v.target;if(i.value&&i.value.contains(w))return;const C=c.value,k=i.value;!k||!C||k.dataset.expanded==="true"&&(C.contains(w)||(s.value=!1))};return us(()=>{window.addEventListener("click",y)}),ds(()=>{window.removeEventListener("click",y)}),()=>M(Ie,null,M("button",{type:"button",ref:i,class:"language-button",onClick:d,"data-expanded":String(s.value)},t.value||"Text",M("div",{class:"expand-icon"},M(Hi,{icon:e.expandIcon}))),M("div",{ref:c,class:"language-picker"},s.value?M("div",{class:"list-wrapper"},M("div",{class:"search-box"},M("div",{class:"search-icon"},M(Hi,{icon:e.searchIcon})),M("input",{id:l,ref:a,class:"search-input",placeholder:e.searchPlaceholder,value:u.value,onInput:h,onKeydown:p}),M("div",{class:Mt("clear-icon",u.value.length===0&&"hidden"),onMousedown:v=>{v.preventDefault(),u.value=""}},M(Hi,{icon:e.clearSearchIcon}))),M("ul",{class:"language-list",role:"listbox",onKeydown:v=>{if(v.key==="Enter"){const w=document.activeElement;w instanceof HTMLElement&&w.dataset.language&&r(w.dataset.language)}}},g.value.length?g.value.map(v=>M("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":v.name.toLowerCase()===t.value.toLowerCase(),"data-language":v.name,onClick:()=>{r(v.name),s.value=!1}},e.renderLanguage(v.name,v.name.toLowerCase()===t.value.toLowerCase()))):M("li",{class:"language-list-item no-result"},e.noResultText))):null))}});Xa(M,Ie);const mk="http://www.w3.org/2000/svg";function gk(){const t=Tr(),e={ADD_TAGS:["foreignObject"],ADD_ATTR:["xmlns"],HTML_INTEGRATION_POINTS:{foreignobject:!0}};return t.addHook("uponSanitizeElement",(r,n)=>{var o;if(n.tagName==="foreignobject"){const i=r.parentElement;(!i||i.namespaceURI!==mk)&&((o=r.parentNode)==null||o.removeChild(r))}}),r=>t.sanitize(r,e)}let ul;function vk(t){return ul??(ul=gk()),ul(t)}const yk=Ct({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(t){const{previewOnlyMode:e,config:r,preview:n}=t,o=re();return cs(()=>{const i=o.value;if(!i)return;for(;i.firstChild;)i.removeChild(i.firstChild);const s=n.value;(typeof s=="string"||s instanceof Element)&&(i.innerHTML=vk(s))}),()=>n.value?M("div",{class:"preview-panel"},!e.value&&M(Ie,null,M("div",{class:"preview-divider"}),M("div",{class:"preview-label"},r.previewLabel)),M("div",{ref:o,class:"preview"})):null}});Xa(M,Ie);const bk=Ct({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){var e;const r=(e=t.config.previewOnlyByDefault)!=null?e:t.getReadOnly(),n=re(r),o=re(),i=re(null);us(()=>{for(var a;(a=o.value)!=null&&a.firstChild;)o.value.removeChild(o.value.firstChild);o.value&&o.value.appendChild(t.codemirror.dom)}),Bn(()=>[t.text.value,t.language.value],()=>{const a=t.config.renderPreview(t.language.value,t.text.value,c=>i.value=c);a&&(i.value=a),a===void 0&&!i.value&&(i.value=Tr.sanitize(t.config.previewLoading)),a===null&&(i.value=null)},{immediate:!0});const s=()=>{};return()=>{var a;return M(Ie,null,M("div",{class:"tools"},M(pk,{language:t.language,config:t.config,setLanguage:t.setLanguage,getAllLanguages:t.getAllLanguages,getReadOnly:t.getReadOnly}),M("div",{class:"tools-button-group"},M(dk,{copyIcon:t.config.copyIcon,copyText:t.config.copyText,onCopy:(a=t.config.onCopy)!=null?a:s,text:t.text.value}),i.value?M("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},M(Hi,{icon:t.config.previewToggleButton(n.value)})):null)),M("div",{ref:o,class:Mt("codemirror-host",i.value&&n.value&&"hidden")}),M(yk,{text:t.text,language:t.language,config:t.config,previewOnlyMode:n,preview:i}))}}}),_d=new WeakMap;let Su=null;function Fm(){return Su||(Su=new IntersectionObserver(t=>{for(const e of t){const r=_d.get(e.target);r?.(e.isIntersecting)}},{rootMargin:"200px"})),Su}const G3=class K3{constructor(e,r,n,o,i,s){this.node=e,this.view=r,this.getPos=n,this.loader=o,this.config=i,this.selected=re(!1),this.language=re(""),this.text=re(""),this.initialized=!1,this.updating=!1,this.languageName="",this.teardownTimer=null,this.onConfigChange=({extensions:l})=>{l!==this.extensions&&(this.extensions=l,this.initialized&&this.cm.dispatch({effects:this.extensionsConf.reconfigure(l)}))},this.forwardUpdate=l=>{var c;if(this.updating||!this.cm.hasFocus)return;let u=((c=this.getPos())!=null?c:0)+1;const{main:d}=l.state.selection,h=u+d.from,p=u+d.to,g=this.view.state.selection;if(l.docChanged||g.from!==h||g.to!==p){const y=this.view.state.tr;l.changes.iterChanges((v,w,C,k,S)=>{S.length?y.replaceWith(u+v,u+w,this.view.state.schema.text(S.toString())):y.delete(u+v,u+w),u+=k-C-(w-v)}),y.setSelection(Ce.create(y.doc,h,p)),this.view.dispatch(y)}},this.createApp=()=>gr(bk,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const l=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>Zg(l.state,l.dispatch)?(l.focus(),!0):!1},{key:"Mod-z",run:()=>ic(l.state,l.dispatch)},{key:"Shift-Mod-z",run:()=>Wi(l.state,l.dispatch)},{key:"Mod-y",run:()=>Wi(l.state,l.dispatch)},{key:"Backspace",run:()=>{var c;const u=this.cm.state.selection.ranges;if(u.length>1)return!1;const d=u[0];if(d&&(!d.empty||d.anchor>0)||this.cm.state.doc.lines>=2)return!1;const h=this.view.state,p=(c=this.getPos())!=null?c:0,g=h.tr.replaceWith(p,p+this.node.nodeSize,h.schema.nodes.paragraph.createChecked({},this.node.content));return g.setSelection(Ce.near(g.doc.resolve(p))),this.view.dispatch(g),this.view.focus(),!0}}]},this.maybeEscape=(l,c)=>{var u;const{state:d}=this.cm;let h=d.selection.main;if(!h.empty||(l==="line"&&(h=d.doc.lineAt(h.head)),c<0?h.from>0:h.to<d.doc.length))return!1;const p=((u=this.getPos())!=null?u:0)+(c<0?0:this.node.nodeSize),g=Ce.near(this.view.state.doc.resolve(p),c),y=this.view.state.tr.setSelection(g).scrollIntoView();return this.view.dispatch(y),this.view.focus(),!0},this.setLanguage=l=>{var c;this.view.dispatch(this.view.state.tr.setNodeAttribute((c=this.getPos())!=null?c:0,"language",l))},this.getAllLanguages=()=>this.loader.getAll();var a;this.languageConf=new ru,this.readOnlyConf=new ru,this.extensionsConf=new ru,this.extensions=i.extensions,this.disposeConfigWatcher=s?.(this.onConfigChange),this.text.value=this.node.textContent,this.language.value=(a=this.node.attrs.language)!=null?a:"",this.dom=document.createElement("div"),this.dom.className="milkdown-code-block",this.disposeSelectedWatcher=cs(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.renderPlaceholder(),_d.set(this.dom,l=>{l?(this.cancelTeardown(),this.initializeCodeMirror()):this.initialized&&this.scheduleTeardown()}),Fm().observe(this.dom)}renderPlaceholder(){const e=document.createElement("pre");e.className="milkdown-code-block-placeholder";const r=document.createElement("code");r.textContent=this.node.textContent,e.appendChild(r),this.dom.appendChild(e)}initializeCodeMirror(){if(this.initialized)return;this.initialized=!0,this.cm=new tr({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(na.readOnly.of(!this.view.editable)),x2(),p1.of(this.codeMirrorKeymap()),this.languageConf.of([]),na.changeFilter.of(()=>this.view.editable||this.updating),this.extensionsConf.of(this.extensions),tr.updateListener.of(this.forwardUpdate)]});const e=this.dom.querySelector(".milkdown-code-block-placeholder");e&&this.dom.removeChild(e),this.app=this.createApp(),this.app.mount(this.dom),this.updateLanguage()}teardownCodeMirror(){if(this.initialized&&!(this.cm.hasFocus||this.selected.value)){for(this.app.unmount(),this.cm.destroy(),this.initialized=!1,this.languageName="";this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);this.renderPlaceholder()}}scheduleTeardown(){this.cancelTeardown(),this.teardownTimer=setTimeout(()=>this.teardownCodeMirror(),K3.TEARDOWN_DELAY)}cancelTeardown(){this.teardownTimer!=null&&(clearTimeout(this.teardownTimer),this.teardownTimer=null)}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(n=>{n&&(this.cm.dispatch({effects:this.languageConf.reconfigure(n)}),this.languageName=e)}).catch(console.error)}setSelection(e,r){if(this.initialized||this.initializeCodeMirror(),!!this.cm.dom.isConnected){this.cm.focus(),this.updating=!0;try{this.cm.dispatch({selection:{anchor:e,head:r}})}finally{this.updating=!1}}}update(e){var r;if(e.type!==this.node.type)return!1;if(this.updating)return!0;if(this.node=e,this.text.value=e.textContent,this.language.value=(r=e.attrs.language)!=null?r:"",!this.initialized){const o=this.dom.querySelector(".milkdown-code-block-placeholder code");return o&&(o.textContent=e.textContent),!0}this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(na.readOnly.of(!this.view.editable))});const n=xk(this.cm.state.doc.toString(),e.textContent);if(n){this.updating=!0;try{this.cm.dispatch({changes:{from:n.from,to:n.to,insert:n.text},scrollIntoView:this.view.editable})}finally{this.updating=!1}}return!0}selectNode(){this.initialized||this.initializeCodeMirror(),this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){var e;(e=this.disposeConfigWatcher)==null||e.call(this),this.cancelTeardown(),Fm().unobserve(this.dom),_d.delete(this.dom),this.initialized&&(this.app.unmount(),this.cm.destroy()),this.disposeSelectedWatcher()}};G3.TEARDOWN_DELAY=5e3;let wk=G3;function xk(t,e){if(t===e)return null;let r=0,n=t.length,o=e.length;for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)++r;for(;n>r&&o>r&&t.charCodeAt(n-1)===e.charCodeAt(o-1);)n--,o--;return{from:r,to:n,text:e.slice(r,o)}}const Z3=ko(ti.node,t=>{const e=t.use(Zi.key),r=new lk(e.get().languages);return(n,o,i)=>new wk(n,o,i,r,e.get(),s=>e.on(s))});U3(Z3,{displayName:"NodeView<code-block>",group:"CodeBlock"});const Ck=[Z3,Zi],Vm=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Xi{constructor(e,r,n=0,o=e.length,i,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,o),this.bufferStart=n,this.normalize=i?a=>i(Vm(a)):Vm,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Qg(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=tv(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ev(e);let o=this.normalize(r);if(o.length)for(let i=0,s=n,a=!0;;i++){let l=o.charCodeAt(i),c=this.match(l,s,a,this.bufferPos+this.bufferStart,i==o.length-1);if(c)return this.value=c,this;if(i==o.length-1)break;a&&i<r.length&&r.charCodeAt(i)==l?s++:a=!1}}}match(e,r,n,o,i){let s=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?s={from:l.from,to:o,precise:i&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:r,to:o,precise:n&&i}:this.matches.push({from:r,index:1,precise:n})),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Xi.prototype[Symbol.iterator]=function(){return this});const X3={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Sh="gm"+(/x/.unicode==null?"":"u");class Y3{constructor(e,r,n,o=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=X3,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new J3(e,r,n,o,i);this.re=new RegExp(r,Sh+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let s=e.lineAt(o);this.curLineStart=s.from,this.matchPos=j0(e,o),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=j0(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Au=new WeakMap;class $i{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let o=Au.get(e);if(!o||o.from>=n||o.to<=r){let a=new $i(r,e.sliceString(r,n));return Au.set(e,a),a}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=e.sliceString(r,s)+i,s=r),o.to<n&&(i+=e.sliceString(o.to,n)),Au.set(e,new $i(s,i)),new $i(r,i.slice(r-s,n-s))}}class J3{constructor(e,r,n,o,i){this.text=e,this.to=i,this.done=!1,this.value=X3,this.matchPos=j0(e,o),this.re=new RegExp(r,Sh+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=$i.get(e,o,this.chunkEnd(o+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,precise:!0,match:r},this.matchPos=j0(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$i.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Y3.prototype[Symbol.iterator]=J3.prototype[Symbol.iterator]=function(){return this});function kk(t){try{return new RegExp(t,Sh),!0}catch{return!1}}function j0(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const _k=t=>{let e=Xg(t,"cm-goto-line");if(e){let s=e.dom.querySelector("input[type=text]");return s&&s.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:o,result:i}=Yg(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return i.then(s=>{let a=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!a){t.dispatch({effects:o});return}let l=r.doc.lineAt(r.selection.main.head),[,c,u,d,h]=a,p=d?+d.slice(1):0,g=u?+u:l.number;if(u&&h){let w=g/100;c&&(w=w*(c=="-"?-1:1)+l.number/r.doc.lines),g=Math.round(r.doc.lines*w)}else u&&c&&(g=g*(c=="-"?-1:1)+l.number);let y=r.doc.line(Math.max(1,Math.min(r.doc.lines,g))),v=Fr.cursor(y.from+Math.max(0,Math.min(p,y.length)));t.dispatch({effects:[o,tr.scrollIntoView(v.from,{y:"center"})],selection:v})}),!0},Sk={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ak=g1.define({combine(t){return v1(t,Sk,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Tk(t){return[Rk,Lk]}const Mk=bt.mark({class:"cm-selectionMatch"}),Ek=bt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wm(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=Cr.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=Cr.Word)}function Ik(t,e,r,n){return t(e.sliceDoc(r,r+1))==Cr.Word&&t(e.sliceDoc(n-1,n))==Cr.Word}const Lk=C2.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Ak),{state:r}=t,n=r.selection;if(n.ranges.length>1)return bt.none;let o=n.main,i,s=null;if(o.empty){if(!e.highlightWordAroundCursor)return bt.none;let l=r.wordAt(o.head);if(!l)return bt.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<e.minSelectionLength||l>200)return bt.none;if(e.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Wm(s,r,o.from,o.to)&&Ik(s,r,o.from,o.to)))return bt.none}else if(i=r.sliceDoc(o.from,o.to),!i)return bt.none}let a=[];for(let l of t.visibleRanges){let c=new Xi(r.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:d}=c.value;if((!s||Wm(s,r,u,d))&&(o.empty&&u<=o.from&&d>=o.to?a.push(Ek.range(u,d)):(u>=o.to||d<=o.from)&&a.push(Mk.range(u,d)),a.length>e.maxMatches))return bt.none}}return bt.set(a)}},{decorations:t=>t.decorations}),Rk=tr.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Ok=({state:t,dispatch:e})=>{let{selection:r}=t,n=Fr.create(r.ranges.map(o=>t.wordAt(o.head)||Fr.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function Pk(t,e){let{main:r,ranges:n}=t.selection,o=t.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,a=new Xi(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new Xi(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Dk=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(i=>i.from===i.to))return Ok({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=n))return!1;let o=Pk(t,n);return o?(e(t.update({selection:t.selection.addRange(Fr.range(o.from,o.to),!1),effects:tr.scrollIntoView(o.to)})),!0):!1},ps=g1.define({combine(t){return v1(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Zk(e),scrollToMatch:e=>tr.scrollIntoView(e)})}});class Q3{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||kk(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
9
+ `:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new qk(this):new Nk(this)}getCursor(e,r=0,n){let o=e.doc?e:na.create({doc:e});return n==null&&(n=o.doc.length),this.regexp?Si(this,o,r,n):_i(this,o,r,n)}}class e7{constructor(e){this.spec=e}}function Bk(t,e,r){return(n,o,i,s)=>{if(r&&!r(n,o,i,s))return!1;let a=n>=s&&o<=s+i.length?i.slice(n-s,o-s):e.doc.sliceString(n,o);return t(a,e,n,o)}}function _i(t,e,r,n){let o;return t.wholeWord&&(o=zk(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(o=Bk(t.test,e,o)),new Xi(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),o)}function zk(t,e){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=t.sliceString(i,Math.min(t.length,n+2))),(e(U0(o,r-i))!=Cr.Word||e(G0(o,r-i))!=Cr.Word)&&(e(G0(o,n-i))!=Cr.Word||e(U0(o,n-i))!=Cr.Word))}class Nk extends e7{constructor(e){super(e)}nextMatch(e,r,n){let o=_i(this.spec,e,n,e.doc.length).nextOverlapping();if(o.done){let i=Math.min(e.doc.length,r+this.spec.unquoted.length);o=_i(this.spec,e,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(e,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=_i(this.spec,e,i,o),a=null;for(;!s.nextOverlapping().done;)a=s.value;if(a)return a;if(i==r)return null;o-=1e4}}prevMatch(e,r,n){let o=this.prevMatchInRange(e,0,r);return o||(o=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=_i(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=_i(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function Hk(t,e,r){return(n,o,i)=>(!r||r(n,o,i))&&t(i[0],e,n,o)}function Si(t,e,r,n){let o;return t.wholeWord&&(o=$k(e.charCategorizer(e.selection.main.head))),t.test&&(o=Hk(t.test,e,o)),new Y3(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:o},r,n)}function U0(t,e){return t.slice(A2(t,e,!1),e)}function G0(t,e){return t.slice(e,A2(t,e))}function $k(t){return(e,r,n)=>!n[0].length||(t(U0(n.input,n.index))!=Cr.Word||t(G0(n.input,n.index))!=Cr.Word)&&(t(G0(n.input,n.index+n[0].length))!=Cr.Word||t(U0(n.input,n.index+n[0].length))!=Cr.Word)}class qk extends e7{nextMatch(e,r,n){let o=Si(this.spec,e,n,e.doc.length).next();return o.done&&(o=Si(this.spec,e,0,r).next()),o.done?null:o.value}prevMatchInRange(e,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Si(this.spec,e,i,n),a=null;for(;!s.next().done;)a=s.value;if(a&&(i==r||a.from>i+10))return a;if(i==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<e.match.length)return e.match[i]+n.slice(o)}return r})}matchAll(e,r){let n=Si(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=Si(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Ca=ai.define(),Ah=ai.define(),po=k2.define({create(t){return new Tu(Sd(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Ca)?t=new Tu(r.value.create(),t.panel):r.is(Ah)&&(t=new Tu(t.query,r.value?Th:null));return t},provide:t=>_2.from(t,e=>e.panel)});class Tu{constructor(e,r){this.query=e,this.panel=r}}const Fk=bt.mark({class:"cm-searchMatch"}),Vk=bt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wk=C2.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(po))}update(t){let e=t.state.field(po);(e!=t.startState.field(po)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return bt.none;let{view:r}=this,n=new S2;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:a,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-500;)l=i[++o].to;t.highlight(r.state,a,l,(c,u)=>{let d=r.state.selection.ranges.some(h=>h.from==c&&h.to==u);n.add(c,u,d?Vk:Fk)})}return n.finish()}},{decorations:t=>t.decorations});function Ya(t){return e=>{let r=e.state.field(po,!1);return r&&r.query.spec.valid?t(e,r):n7(e)}}const K0=Ya((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let o=Fr.single(n.from,n.to),i=t.state.facet(ps);return t.dispatch({selection:o,effects:[Mh(t,n),i.scrollToMatch(o.main,t)],userEvent:"select.search"}),r7(t),!0}),Z0=Ya((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,o=e.prevMatch(r,n,n);if(!o)return!1;let i=Fr.single(o.from,o.to),s=t.state.facet(ps);return t.dispatch({selection:i,effects:[Mh(t,o),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),r7(t),!0}),jk=Ya((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Fr.create(r.map(n=>Fr.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Uk=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let a=new Xi(t.doc,t.sliceDoc(n,o));!a.next().done;){if(i.length>1e3)return!1;a.value.from==n&&(s=i.length),i.push(Fr.range(a.value.from,a.value.to))}return e(t.update({selection:Fr.create(i,s),userEvent:"select.search.matches"})),!0},jm=Ya((t,{query:e})=>{let{state:r}=t,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=e.nextMatch(r,n,n);if(!i)return!1;let s=i,a=[],l,c,u=[];s.precise?s.from==n&&s.to==o&&(c=r.toText(e.getReplacement(s)),a.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(r,s.from,s.to),u.push(tr.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):s=e.nextMatch(r,s.from,s.to);let d=t.state.changes(a);return s&&(l=Fr.single(s.from,s.to).map(d),u.push(Mh(t,s)),u.push(r.facet(ps).scrollToMatch(l.main,t))),t.dispatch({changes:d,selection:l,effects:u,userEvent:"input.replace"}),!0}),Gk=Ya((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let o of e.matchAll(t.state,1e9)){let{from:i,to:s,precise:a}=o;a&&r.push({from:i,to:s,insert:e.getReplacement(o)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:tr.announce.of(n),userEvent:"input.replace.all"}),!0});function Th(t){return t.state.facet(ps).createPanel(t)}function Sd(t,e){var r,n,o,i,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(ps);return new Q3({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(o=e?.literal)!==null&&o!==void 0?o:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(s=e?.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function t7(t){let e=m1(t,Th);return e&&e.dom.querySelector("[main-field]")}function r7(t){let e=t7(t);e&&e==t.root.activeElement&&e.select()}const n7=t=>{let e=t.state.field(po,!1);if(e&&e.panel){let r=t7(t);if(r&&r!=t.root.activeElement){let n=Sd(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ca.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[Ah.of(!0),e?Ca.of(Sd(t.state,e.query.spec)):ai.appendConfig.of(Yk)]});return!0},o7=t=>{let e=t.state.field(po,!1);if(!e||!e.panel)return!1;let r=m1(t,Th);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ah.of(!1)}),!0},Kk=[{key:"Mod-f",run:n7,scope:"editor search-panel"},{key:"F3",run:K0,shift:Z0,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:K0,shift:Z0,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:o7,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Uk},{key:"Mod-Alt-g",run:_k},{key:"Mod-d",run:Dk,preventDefault:!0}];class Zk{constructor(e){this.view=e;let r=this.query=e.state.field(po).query.spec;this.commit=this.commit.bind(this),this.searchField=at("input",{value:r.search,placeholder:ir(e,"Find"),"aria-label":ir(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=at("input",{value:r.replace,placeholder:ir(e,"Replace"),"aria-label":ir(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=at("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=at("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=at("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return at("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=at("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>K0(e),[ir(e,"next")]),n("prev",()=>Z0(e),[ir(e,"previous")]),n("select",()=>jk(e),[ir(e,"all")]),at("label",null,[this.caseField,ir(e,"match case")]),at("label",null,[this.reField,ir(e,"regexp")]),at("label",null,[this.wordField,ir(e,"by word")]),...e.state.readOnly?[]:[at("br"),this.replaceField,n("replace",()=>jm(e),[ir(e,"replace")]),n("replaceAll",()=>Gk(e),[ir(e,"replace all")])],at("button",{name:"close",onclick:()=>o7(e),"aria-label":ir(e,"close"),type:"button"},["×"])])}commit(){let e=new Q3({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ca.of(e)}))}keydown(e){rv(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Z0:K0)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),jm(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Ca)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ps).top}}function ir(t,e){return t.state.phrase(e)}const dl=30,hl=/[\s\.,:;?!]/;function Mh(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),o=t.state.doc.lineAt(r).to,i=Math.max(n.from,e-dl),s=Math.min(o,r+dl),a=t.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<dl;l++)if(!hl.test(a[l+1])&&hl.test(a[l])){a=a.slice(l);break}}if(s!=o){for(let l=a.length-1;l>a.length-dl;l--)if(!hl.test(a[l-1])&&hl.test(a[l])){a=a.slice(0,l);break}}return tr.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Xk=tr.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Yk=[po,Jg.low(Wk),Xk];class Um{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class Wo{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let o=n.facet(ka).markerFilter;o&&(e=o(e,n));let i=e.slice().sort((p,g)=>p.from-g.from||p.to-g.to),s=new S2,a=[],l=0,c=n.doc.iter(),u=0,d=n.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let y,v;if(a.length)y=l,v=a.reduce((k,S)=>Math.min(k,S.to),g&&g.from>y?g.from:1e8);else{if(y=g.from,y>d)break;v=g.to,a.push(g),p++}for(;p<i.length;){let k=i[p];if(k.from==y&&(k.to>k.from||k.to==y))a.push(k),p++,v=Math.min(k.to,v);else{v=Math.min(k.from,v);break}}v=Math.min(v,d);let w=!1;if(a.some(k=>k.from==y&&(k.to==v||v==d))&&(w=y==v,!w&&v-y<10)){let k=y-(u+c.value.length);k>0&&(c.next(k),u=y);for(let S=y;;){if(S>=v){w=!0;break}if(!c.lineBreak&&u+c.value.length>S)break;S=u+c.value.length,u+=c.value.length,c.next()}}let C=u_(a);if(w)s.add(y,y,bt.widget({widget:new s_(C),diagnostics:a.slice()}));else{let k=a.reduce((S,E)=>E.markClass?S+" "+E.markClass:S,"");s.add(y,v,bt.mark({class:"cm-lintRange cm-lintRange-"+C+k,diagnostics:a.slice(),inclusiveEnd:a.some(S=>S.to>v)}))}if(l=v,l==d)break;for(let k=0;k<a.length;k++)a[k].to<=l&&a.splice(k--,1)}let h=s.finish();return new Wo(h,r,vo(h))}}function vo(t,e=null,r=0){let n=null;return t.between(r,1e9,(o,i,{spec:s})=>{if(!(e&&s.diagnostics.indexOf(e)<0))if(!n)n=new Um(o,i,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Um(n.from,i,n.diagnostic)}}),n}function Jk(t,e){let r=e.pos,n=e.end||r,o=t.state.facet(ka).hideOn(t,r,n);if(o!=null)return o;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(i7))||t.changes.touchesRange(i.from,Math.max(i.to,n)))}function Qk(t,e){return t.field(fr,!1)?e:e.concat(ai.appendConfig.of(d_))}const i7=ai.define(),Eh=ai.define(),s7=ai.define(),fr=k2.define({create(){return new Wo(bt.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let r=t.diagnostics.map(e.changes),n=null,o=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);n=vo(r,t.selected.diagnostic,i)||vo(r,null,i)}!r.size&&o&&e.state.facet(ka).autoPanel&&(o=null),t=new Wo(r,o,n)}for(let r of e.effects)if(r.is(i7)){let n=e.state.facet(ka).autoPanel?r.value.length?_a.open:null:t.panel;t=Wo.init(r.value,n,e.state)}else r.is(Eh)?t=new Wo(t.diagnostics,r.value?_a.open:null,t.selected):r.is(s7)&&(t=new Wo(t.diagnostics,t.panel,r.value));return t},provide:t=>[_2.from(t,e=>e.panel),tr.decorations.from(t,e=>e.diagnostics)]}),e_=bt.mark({class:"cm-lintRange cm-lintRange-active"});function t_(t,e,r){let{diagnostics:n}=t.state.field(fr),o,i=-1,s=-1;n.between(e-(r<0?1:0),e+(r>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||r>0)&&(e<c||r<0)))return o=u.diagnostics,i=l,s=c,!1});let a=t.state.facet(ka).tooltipFilter;return o&&a&&(o=a(o,t.state)),o?{pos:i,end:s,above:!0,create(){return{dom:r_(t,o)}}}:null}function r_(t,e){return at("ul",{class:"cm-tooltip-lint"},e.map(r=>l7(t,r,!1)))}const n_=t=>{let e=t.state.field(fr,!1);(!e||!e.panel)&&t.dispatch({effects:Qk(t.state,[Eh.of(!0)])});let r=m1(t,_a.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Gm=t=>{let e=t.state.field(fr,!1);return!e||!e.panel?!1:(t.dispatch({effects:Eh.of(!1)}),!0)},o_=t=>{let e=t.state.field(fr,!1);if(!e)return!1;let r=t.state.selection.main,n=vo(e.diagnostics,null,r.to+1);return!n&&(n=vo(e.diagnostics,null,0),!n||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),nv(t,n.from,1,{tooltip:c7,until:o=>o.docChanged||o.newSelection.main.head<n.from||o.newSelection.main.head>n.to}),!0)},i_=[{key:"Mod-Shift-m",run:n_,preventDefault:!0},{key:"F8",run:o_}],ka=g1.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...v1(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Km,tooltipFilter:Km,needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r,hideOn:(e,r)=>e?r?(n,o,i)=>e(n,o,i)||r(n,o,i):e:r,autoPanel:(e,r)=>e||r})}}});function Km(t,e){return t?e?(r,n)=>e(t(r,n),n):t:e}function a7(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let o=r[n];if(/[a-zA-Z]/.test(o)&&!e.some(i=>i.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function l7(t,e,r){var n;let o=r?a7(e.actions):[];return at("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},at("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((i,s)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=vo(t.state.field(fr).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:c}=i,u=o[s]?c.indexOf(o[s]):-1,d=u<0?c:[c.slice(0,u),at("u",c.slice(u,u+1)),c.slice(u+1)],h=i.markClass?" "+i.markClass:"";return at("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${o[s]})"`}.`},d)}),e.source&&at("div",{class:"cm-diagnosticSource"},e.source))}class s_ extends iv{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return at("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Zm{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=l7(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _a{constructor(e){this.view=e,this.items=[];let r=o=>{if(!(o.ctrlKey||o.altKey||o.metaKey)){if(o.keyCode==27)Gm(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],s=a7(i.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==o.keyCode){let l=vo(this.view.state.field(fr).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;o.preventDefault()}},n=o=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(o.target)&&this.moveSelection(i)};this.list=at("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=at("div",{class:"cm-panel-lint"},this.list,at("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Gm(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(fr).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(fr),n=0,o=!1,i=null,s=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(s.has(u))continue;s.add(u);let d=-1,h;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==u){d=p;break}d<0?(h=new Zm(this.view,u),this.items.splice(n,0,h),o=!0):(h=this.items[d],d>n&&(this.items.splice(n,d-n),o=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),i=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new Zm(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(fr),n=vo(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:s7.of(n)})}static open(e){return new _a(e)}}function a_(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function fl(t){return a_(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const l_=tr.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:fl("#f11")},".cm-lintRange-warning":{backgroundImage:fl("orange")},".cm-lintRange-info":{backgroundImage:fl("#999")},".cm-lintRange-hint":{backgroundImage:fl("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function c_(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function u_(t){let e="hint",r=1;for(let n of t){let o=c_(n.severity);o>r&&(r=o,e=n.severity)}return e}const c7=ov(t_,{hideOn:Jk}),d_=[fr,tr.decorations.compute([fr],t=>{let{selected:e,panel:r}=t.field(fr);return!e||!r||e.from==e.to?bt.none:bt.set([e_.range(e.from,e.to)])}),c7,l_],h_=[sv(),av(),lv(),cv(),uv(),x2(),dv(),na.allowMultipleSelections.of(!0),hv(),d1(fv,{fallback:!0}),pv(),mv(),gv(),vv(),yv(),bv(),Tk(),p1.of([...wv,...T2,...Kk,...xv,...Cv,...kv,...i_])];function f_(t){return t.nodeType===1}function p_(t){return f_(t)&&t.namespaceURI==="http://www.w3.org/1999/xhtml"}function m_(t){const e=[[-1,t.state.doc]],r=[];for(;e.length>0;){const[n,o]=e.pop();if(n>=0){const i=t.nodeDOM(n);if(i&&p_(i)){const{top:s,bottom:a,left:l,right:c}=i.getBoundingClientRect();r.push([n,[l,s,c,s]],[n+o.nodeSize,[l,a,c,a]])}}if(o.isBlock&&!o.isTextblock){let i=n+1;for(const s of o.children)e.push([i,s]),i+=s.nodeSize}}return r}function g_(t,e){let r=[],n,o;const i=()=>{const u=t.dom.getBoundingClientRect(),d=t.state.doc;return r&&n&&o&&u.width===o.width&&u.height===o.height&&u.x===o.x&&u.y===o.y&&n.eq(d)||(o=u,n=d,r=m_(t)),r},s=(u,d)=>{if(!t.editable||t.isDestroyed)return;const h=(y,v)=>{const[w,C]=y,[k,S]=v;return Ym(u,C)-Ym(u,S)||w-k};let p=i();p.sort(h),p=p.slice(0,8);const g=p.find(y=>e?.({view:t,pos:y[0],event:d})!==!1);if(!(g&&y_(t,g[0])))return g};let a,l;return(u,d)=>(a&&v_(a,u)||(a=u,l=s(u,d)),l)}function v_(t,e){return t[0]===e[0]&&t[1]===e[1]}function Xm(t,e){return Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1])}function Ym(t,e){return Math.min(Xm(t,[e[0],e[1]]),Xm(t,[e[2],e[3]]))}function y_(t,e){const r=t.dragging;if(!r)return;const{move:n}=r;if(!n)return;const o=t.state.selection;if(!(o instanceof qr))return;const{from:i,to:s}=o;return i<=e&&e<=s}function b_(t){let e;return new Xe({key:new et("prosemirror-drop-indicator"),view:r=>(e=g_(r,t.onDrag),x_(r,e,t)),props:{handleDrop(r,n,o,i){if(!e)return!1;const s=e([n.clientX,n.clientY],n);if(!s)return!1;n.preventDefault();const a=s[0],l=r.state.tr;if(i){const{node:p}=r.dragging||{};p?p.replace(l):l.deleteSelection()}const c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return!0;const h=l.doc.resolve(c);if(u&&qr.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new qr(h));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,y,v,w)=>p=w),l.setSelection(w_(r,h,l.doc.resolve(p)))}return r.focus(),r.dispatch(l.setMeta("uiEvent","drop")),!0}}})}function w_(t,e,r,n){return t.someProp("createSelectionBetween",o=>o(t,e,r))||Ce.between(e,r,n)}function x_(t,e,r){const n=t.dom;let o,i,s,a=!1;const l=()=>{o&&clearTimeout(o),a=!1,o=setTimeout(()=>{a||r.onHide?.()},30)},c=d=>{a=!0;const{clientX:h,clientY:p}=d;if(i===h&&s===p)return;i=h,s=p;const g=e([h,p],d);if(g){const[y,[v,w,C,k]]=g,S={p1:{x:v,y:w},p2:{x:C,y:k}};r.onShow?.({view:t,pos:y,line:S})}else{l();return}};return n.addEventListener("dragover",c),n.addEventListener("dragend",l),n.addEventListener("drop",l),n.addEventListener("dragleave",l),{destroy:()=>{n.removeEventListener("dragover",c),n.removeEventListener("dragend",l),n.removeEventListener("drop",l),n.removeEventListener("dragleave",l)}}}class lt extends jt{constructor(e){super(e,e)}map(e,r){let n=e.resolve(r.map(this.head));return lt.valid(n)?new lt(n):jt.near(n)}content(){return dt.empty}eq(e){return e instanceof lt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new lt(e.resolve(r.pos))}getBookmark(){return new Ih(this.anchor)}static valid(e){let r=e.parent;if(r.inlineContent||!C_(e)||!k_(e))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let o=r.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,r,n=!1){e:for(;;){if(!n&&lt.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(r>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(r>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=r;let l=e.doc.resolve(o);if(lt.valid(l))return l}for(;;){let s=r>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!qr.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*r),n=!1;continue e}break}i=s,o+=r;let a=e.doc.resolve(o);if(lt.valid(a))return a}return null}}}lt.prototype.visible=!1;lt.findFrom=lt.findGapCursorFrom;jt.jsonID("gapcursor",lt);class Ih{constructor(e){this.pos=e}map(e){return new Ih(e.map(this.pos))}resolve(e){let r=e.resolve(this.pos);return lt.valid(r)?new lt(r):jt.near(r)}}function u7(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function C_(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(r-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||u7(o.type))return!0;if(o.inlineContent)return!1}}return!0}function k_(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(r);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||u7(o.type))return!0;if(o.inlineContent)return!1}}return!0}function __(){return new Xe({props:{decorations:M_,createSelectionBetween(t,e,r){return e.pos==r.pos&&lt.valid(r)?new lt(r):null},handleClick:A_,handleKeyDown:S_,handleDOMEvents:{beforeinput:T_}}})}const S_=b2({ArrowLeft:pl("horiz",-1),ArrowRight:pl("horiz",1),ArrowUp:pl("vert",-1),ArrowDown:pl("vert",1)});function pl(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,o,i){let s=n.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Ce){if(!i.endOfTextblock(r)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=lt.findGapCursorFrom(a,e,l);return c?(o&&o(n.tr.setSelection(new lt(c))),!0):!1}}function A_(t,e,r){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!lt.valid(n))return!1;let o=t.posAtCoords({left:r.clientX,top:r.clientY});return o&&o.inside>-1&&qr.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new lt(n))),!0)}function T_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof lt))return!1;let{$from:r}=t.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let o=He.empty;for(let s=n.length-1;s>=0;s--)o=He.from(n[s].createAndFill(null,o));let i=t.state.tr.replace(r.pos,r.pos,new dt(o,0,0));return i.setSelection(Ce.near(i.doc.resolve(r.pos+1))),t.dispatch(i),!1}function M_(t){if(!(t.selection instanceof lt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Dt.create(t.doc,[Bt.widget(t.selection.head,e,{key:"gapcursor"})])}function Ja(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-cursor",...e}}),t}var Sa=Ve(null,"dropIndicatorState");Ja(Sa,{displayName:"Ctx<dropIndicatorState>"});var zc=Ve({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");Ja(zc,{displayName:"Ctx<dropIndicatorConfig>"});var E_=new et("MILKDOWN_DROP_INDICATOR_DOM"),d7=Je(t=>new Xe({key:E_,view:e=>{const r=t.get(zc.key),n=document.createElement("div");Object.assign(n.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:r.color,top:"0",left:"0"}),n.classList.add(r.class),n.classList.add("milkdown-drop-indicator"),e.dom.parentNode?.appendChild(n);const o=t.use(Sa.key),i=s=>{I_(n,s,r)};return o.on(i),{destroy:()=>{o.off(i),n.remove()}}}}));Ja(d7,{displayName:"Prose<dropIndicatorDOM>"});function I_(t,e,r){if(!e){Object.assign(t.style,{display:"none"});return}const{line:n}=e,{width:o}=r,{p1:{x:i,y:s},p2:{x:a,y:l}}=n,c=s===l;let u,d,h=s,p=i;c?(u=a-i,d=o,h-=o/2):(u=o,d=l-s,p-=o/2),h=Math.round(h),p=Math.round(p),Object.assign(t.style,{display:"block",width:`${u}px`,height:`${d}px`,transform:`translate(${p}px, ${h}px)`})}var h7=Je(t=>b_({onShow:n=>{t.set(Sa.key,n)},onHide:()=>{t.set(Sa.key,null)},onDrag:()=>!0}));Ja(h7,{displayName:"Prose<dropIndicator>"});var f7=Je(()=>__());Ja(f7,{displayName:"Prose<gapCursor>"});var L_=[f7,zc,Sa,d7,h7].flat();function R_(t){var e;const r=(e=t?.skipWarning)!=null?e:!1;let n=typeof document>"u"?null:document.createElement("div");return new Xe({key:O_,view:o=>{r!==!0&&z_(o.state.schema,r||[]);const i=o.dom.ownerDocument;n=n||document.createElement("div");const s=n,a=()=>{D_(o,s)};let l;return window.ResizeObserver&&(l=new window.ResizeObserver(()=>a()),l.observe(o.dom)),i.addEventListener("selectionchange",a),{update:()=>{a()},destroy:()=>{i.removeEventListener("selectionchange",a),l&&l.unobserve(o.dom)}}},props:{handleKeyDown:(o,i)=>{var s;const{selection:a}=o.state;if(i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||i.isComposing||!["ArrowLeft","ArrowRight"].includes(i.key)||!Ad(a)||!a.empty)return!1;const l=a.$head,[c,u]=p7(l),d=o.state.storedMarks||l.marks();if(c&&u&&!Di.sameSet(c,u)){if(i.key==="ArrowLeft"&&!Di.sameSet(c,d))return o.dispatch(o.state.tr.setStoredMarks(c)),!0;if(i.key==="ArrowRight"&&!Di.sameSet(u,d))return o.dispatch(o.state.tr.setStoredMarks(u)),!0}return i.key==="ArrowLeft"&&l.textOffset===1?(o.dispatch(o.state.tr.setSelection(Ce.create(o.state.doc,l.pos-1)).setStoredMarks(l.marks())),!0):i.key==="ArrowRight"&&l.textOffset+1===((s=l.parent.maybeChild(l.index()))==null?void 0:s.nodeSize)?(o.dispatch(o.state.tr.setSelection(Ce.create(o.state.doc,l.pos+1)).setStoredMarks(l.marks())),!0):!1},decorations:o=>{if(!(!n||!Ad(o.selection)||!o.selection.empty))return Dt.create(o.doc,[Bt.widget(0,n,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var O_=new et("prosemirror-virtual-cursor");function P_(t,e){var r;const n=window.getSelection();if(!n||!n.rangeCount)return null;const o=(r=n?.getRangeAt(0))==null?void 0:r.cloneRange();if(!o)return null;o.collapse(e);const i=o.getClientRects(),s=i?.length?i[i.length-1]:null;return s?.height?s:t.coordsAtPos(t.state.selection.head)}function p7(t){const e=t.index(),r=t.parent.maybeChild(e);let n=t.textOffset?r:null;return!n&&e>0&&(n=t.parent.maybeChild(e-1)),[n?.marks,r?.marks]}function Ad(t){return t&&typeof t=="object"&&"$cursor"in t}function D_(t,e){if(!t||!t.dom||t.isDestroyed||!e)return;const{state:r,dom:n}=t,{selection:o}=r;if(!Ad(o))return;const i=P_(t,o.$head===o.$from);if(!i)return e;const s=n.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=r.selection.$head,[c,u]=p7(l),d=r.storedMarks||l.marks();o.$cursor&&c&&u&&d&&!Di.sameSet(c,u)&&(Di.sameSet(c,d)?a+=" prosemirror-virtual-cursor-left":Di.sameSet(u,d)&&(a+=" prosemirror-virtual-cursor-right")),e.className=a,B_(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${i.bottom-i.top}px`,e.style.left=`${i.left-s.left}px`,e.style.top=`${i.top-s.top}px`}function B_(t,e){t.classList.remove(e),t.offsetWidth,t.classList.add(e)}function z_(t,e){for(const[r,n]of Object.entries(t.marks))n.spec.inclusive===!1&&!e.includes(r)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${r}" mark or adding it to the "skipWarning" option.`)}var N_=Object.defineProperty,Jm=Object.getOwnPropertySymbols,H_=Object.prototype.hasOwnProperty,$_=Object.prototype.propertyIsEnumerable,Qm=(t,e,r)=>e in t?N_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q_=(t,e)=>{for(var r in e||(e={}))H_.call(e,r)&&Qm(t,r,e[r]);if(Jm)for(var r of Jm(e))$_.call(e,r)&&Qm(t,r,e[r]);return t};function m7(t,e){return Object.assign(t,{meta:q_({package:"@milkdown/components"},e)}),t}const F_={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},Nc=Ve(F_,"inlineImageConfigCtx");m7(Nc,{displayName:"Config<image-inline>",group:"ImageInline"});function Lh(...t){}const V_=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function e4(t){return`${t}-${V_()}`}Lh(M);function Nl({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Nl.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};Lh(M,Ie);const W_=Ct({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:r,onUpload:n,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=re(!1),p=re(),g=re((u=e.value)!=null?u:""),y=e4("milkdown-image-link"),v=e4("milkdown-image-upload"),w=re(((d=e.value)==null?void 0:d.length)!==0),C=R=>{const O=R.target.value;w.value=O.length!==0,g.value=O},k=R=>{var H,O;R.key==="Enter"&&r((O=(H=p.value)==null?void 0:H.value)!=null?O:"")},S=()=>{var R,H;r((H=(R=p.value)==null?void 0:R.value)!=null?H:"")},E=R=>{var H;const O=(H=R.target.files)==null?void 0:H[0];O&&n(O).then(P=>{P&&(r(P),w.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>M("div",{class:Mt("image-edit",l)},M(Nl,{icon:o,class:"image-icon"}),M("div",{class:Mt("link-importer",h.value&&"focus")},M("input",{id:y,ref:p,draggable:"true",onDragstart:R=>{R.preventDefault(),R.stopPropagation()},disabled:t.value,class:"link-input-area",value:g.value,onInput:C,onKeydown:k,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!w.value&&M("div",{class:"placeholder"},M("input",{disabled:t.value,class:"hidden",id:v,type:"file",accept:"image/*",onChange:E}),M("label",{class:"uploader",for:v},M(Nl,{icon:i})),M("span",{class:"text",onClick:()=>{var R;return(R=p.value)==null?void 0:R.focus()}},a))),g.value&&M(Ie,null,M("div",{class:"image-preview"},M("img",{src:g.value,alt:"",onError:R=>Promise.resolve(c?.(R)).catch(()=>{})})),M("div",{class:"confirm",onClick:()=>S()},M(Nl,{icon:s}))))}});Lh(M,Ie);const j_=Ct({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e,alt:r,title:n}=t;return()=>{var o;return(o=e.value)!=null&&o.length?M("img",{class:"image-inline",src:e.value,alt:r.value,title:n.value}):M(W_,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:i=>t.setAttr("src",i),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,className:"empty-image-inline"})}}}),g7=ko(_v.node,t=>(e,r,n)=>{const o=re(e.attrs.src),i=re(e.attrs.alt),s=re(e.attrs.title),a=re(!1),l=re(!r.editable),c=(v,w)=>{if(!r.editable)return;const C=n();C!=null&&r.dispatch(r.state.tr.setNodeAttribute(C,v,v==="src"?Tr.sanitize(w):w))},u=t.get(Nc.key),d=gr(j_,{src:o,alt:i,title:s,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("span");h.className="milkdown-image-inline";const p=cs(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),g=u.proxyDomURL,y=v=>{if(!g)o.value=v.attrs.src;else{const w=g(v.attrs.src);typeof w=="string"?o.value=w:w.then(C=>{o.value=C}).catch(console.error)}i.value=v.attrs.alt,s.value=v.attrs.title};return y(e),d.mount(h),{dom:h,update:v=>v.type!==e.type?!1:(y(v),!0),stopEvent:v=>v.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),h.remove()}}});m7(g7,{displayName:"NodeView<image-inline>",group:"ImageInline"});const U_=[Nc,g7];class K extends Error{constructor(e,r){var n="KaTeX parse error: "+e,o,i,s=r&&r.loc;if(s&&s.start<=s.end){var a=s.lexer.input;o=s.start,i=s.end,o===a.length?n+=" at end of input: ":n+=" at position "+(o+1)+": ";var l=a.slice(o,i).replace(/[^]/g,"$&̲"),c;o>15?c="…"+a.slice(o-15,o):c=a.slice(0,o);var u;i+15<a.length?u=a.slice(i,i+15)+"…":u=a.slice(i),n+=c+l+u}super(n),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,K.prototype),this.position=o,o!=null&&i!=null&&(this.length=i-o),this.rawMessage=e}}var G_=/([A-Z])/g,K_=t=>t.replace(G_,"-$1").toLowerCase(),Z_={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},X_=/[&><"']/g,Nt=t=>String(t).replace(X_,e=>Z_[e]),Hl=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?Hl(t.body[0]):t:t.type==="font"?Hl(t.body):t,Y_=new Set(["mathord","textord","atom"]),Fn=t=>Y_.has(Hl(t).type),J_=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Td={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Q_(t){if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function eS(t){if(Object.prototype.hasOwnProperty.call(t,"default")&&t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return Q_(e)}function tS(t,e,r,n){var o=Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0,i=Object.prototype.hasOwnProperty.call(n,"processor")?n.processor:void 0;t[e]=o!==void 0?i?i(o):o:eS(n)}class Rh{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r of Object.keys(Td)){var n=Td[r];n&&tS(this,r,e,n)}}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var r=J_(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Kn{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return rn[rS[this.id]]}sub(){return rn[nS[this.id]]}fracNum(){return rn[oS[this.id]]}fracDen(){return rn[iS[this.id]]}cramp(){return rn[sS[this.id]]}text(){return rn[aS[this.id]]}isTight(){return this.size>=2}}var Oh=0,X0=1,qi=2,zn=3,Aa=4,_r=5,Yi=6,Gt=7,rn=[new Kn(Oh,0,!1),new Kn(X0,0,!0),new Kn(qi,1,!1),new Kn(zn,1,!0),new Kn(Aa,2,!1),new Kn(_r,2,!0),new Kn(Yi,3,!1),new Kn(Gt,3,!0)],rS=[Aa,_r,Aa,_r,Yi,Gt,Yi,Gt],nS=[_r,_r,_r,_r,Gt,Gt,Gt,Gt],oS=[qi,zn,Aa,_r,Yi,Gt,Yi,Gt],iS=[zn,zn,_r,_r,Gt,Gt,Gt,Gt],sS=[X0,X0,zn,zn,_r,_r,Gt,Gt],aS=[Oh,X0,qi,zn,qi,zn,qi,zn],ge={DISPLAY:rn[Oh],TEXT:rn[qi],SCRIPT:rn[Aa],SCRIPTSCRIPT:rn[Yi]},Md=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function lS(t){for(var e=0;e<Md.length;e++)for(var r=Md[e],n=0;n<r.blocks.length;n++){var o=r.blocks[n];if(t>=o[0]&&t<=o[1])return r.name}return null}var $l=[];Md.forEach(t=>t.blocks.forEach(e=>$l.push(...e)));function v7(t){for(var e=0;e<$l.length;e+=2)if(t>=$l[e]&&t<=$l[e+1])return!0;return!1}var yt=t=>t+" "+t,gi=80,cS=function(e,r){return"M95,"+(622+e+r)+`
10
10
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
11
11
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
12
12
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -17,7 +17,7 @@ c5.3,-9.3,12,-14,20,-14
17
17
  H400000v`+(40+e)+`H845.2724
18
18
  s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
19
19
  c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
20
- M`+(834+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},hS=function(e,r){return"M263,"+(601+e+r)+`c0.7,0,18,39.7,52,119
20
+ M`+(834+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},uS=function(e,r){return"M263,"+(601+e+r)+`c0.7,0,18,39.7,52,119
21
21
  c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
22
22
  c340,-704.7,510.7,-1060.3,512,-1067
23
23
  l`+e/2.084+" -"+e+`
@@ -27,7 +27,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,
27
27
  c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
28
28
  s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
29
29
  c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
30
- M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},fS=function(e,r){return"M983 "+(10+e+r)+`
30
+ M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},dS=function(e,r){return"M983 "+(10+e+r)+`
31
31
  l`+e/3.13+" -"+e+`
32
32
  c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
33
33
  H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
@@ -36,7 +36,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
36
36
  c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
37
37
  c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
38
38
  c53.7,-170.3,84.5,-266.8,92.5,-289.5z
39
- M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},pS=function(e,r){return"M424,"+(2398+e+r)+`
39
+ M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},hS=function(e,r){return"M424,"+(2398+e+r)+`
40
40
  c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
41
41
  c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
42
42
  s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
@@ -46,18 +46,18 @@ v`+(40+e)+`H1014.6
46
46
  s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
47
47
  c-2,6,-10,9,-24,9
48
48
  c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+r+`
49
- h400000v`+(40+e)+"h-400000z"},mS=function(e,r){return"M473,"+(2713+e+r)+`
49
+ h400000v`+(40+e)+"h-400000z"},fS=function(e,r){return"M473,"+(2713+e+r)+`
50
50
  c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
51
51
  c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
52
52
  s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
53
53
  c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
54
54
  c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
55
55
  s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
56
- 606zM`+(1001+e)+" "+r+"h400000v"+(40+e)+"H1017.7z"},gS=function(e){var r=e/2;return"M400000 "+e+" H0 L"+r+" 0 l65 45 L145 "+(e-80)+" H400000z"},vS=function(e,r,n){var o=n-54-r-e;return"M702 "+(e+r)+"H400000"+(40+e)+`
56
+ 606zM`+(1001+e)+" "+r+"h400000v"+(40+e)+"H1017.7z"},pS=function(e){var r=e/2;return"M400000 "+e+" H0 L"+r+" 0 l65 45 L145 "+(e-80)+" H400000z"},mS=function(e,r,n){var o=n-54-r-e;return"M702 "+(e+r)+"H400000"+(40+e)+`
57
57
  H742v`+o+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
58
58
  h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
59
59
  c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
60
- 219 661 l218 661zM702 `+r+"H400000v"+(40+e)+"H742z"},yS=function(e,r,n){r=1e3*r;var o="";switch(e){case"sqrtMain":o=dS(r,gi);break;case"sqrtSize1":o=hS(r,gi);break;case"sqrtSize2":o=fS(r,gi);break;case"sqrtSize3":o=pS(r,gi);break;case"sqrtSize4":o=mS(r,gi);break;case"sqrtTall":o=vS(r,gi,n)}return o},bS=function(e,r){switch(e){case"⎜":return yt("M291 0 H417 V"+r+" H291z");case"∣":return yt("M145 0 H188 V"+r+" H145z");case"∥":return yt("M145 0 H188 V"+r+" H145z")+yt("M367 0 H410 V"+r+" H367z");case"⎟":return yt("M457 0 H583 V"+r+" H457z");case"⎢":return yt("M319 0 H403 V"+r+" H319z");case"⎥":return yt("M263 0 H347 V"+r+" H263z");case"⎪":return yt("M384 0 H504 V"+r+" H384z");case"⏐":return yt("M312 0 H355 V"+r+" H312z");case"‖":return yt("M257 0 H300 V"+r+" H257z")+yt("M478 0 H521 V"+r+" H478z");default:return""}},e4={doubleleftarrow:`M262 157
60
+ 219 661 l218 661zM702 `+r+"H400000v"+(40+e)+"H742z"},gS=function(e,r,n){r=1e3*r;var o="";switch(e){case"sqrtMain":o=cS(r,gi);break;case"sqrtSize1":o=uS(r,gi);break;case"sqrtSize2":o=dS(r,gi);break;case"sqrtSize3":o=hS(r,gi);break;case"sqrtSize4":o=fS(r,gi);break;case"sqrtTall":o=mS(r,gi,n)}return o},vS=function(e,r){switch(e){case"⎜":return yt("M291 0 H417 V"+r+" H291z");case"∣":return yt("M145 0 H188 V"+r+" H145z");case"∥":return yt("M145 0 H188 V"+r+" H145z")+yt("M367 0 H410 V"+r+" H367z");case"⎟":return yt("M457 0 H583 V"+r+" H457z");case"⎢":return yt("M319 0 H403 V"+r+" H319z");case"⎥":return yt("M263 0 H347 V"+r+" H263z");case"⎪":return yt("M384 0 H504 V"+r+" H384z");case"⏐":return yt("M312 0 H355 V"+r+" H312z");case"‖":return yt("M257 0 H300 V"+r+" H257z")+yt("M478 0 H521 V"+r+" H478z");default:return""}},t4={doubleleftarrow:`M262 157
61
61
  l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
62
62
  0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
63
63
  14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
@@ -228,7 +228,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`
228
228
  c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
229
229
  -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
230
230
  c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
231
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},wS=function(e,r){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84
231
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},yS=function(e,r){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84
232
232
  H403z M403 1759 V0 H319 V1759 v`+r+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z
233
233
  M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15
234
234
  c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
@@ -256,16 +256,16 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6
256
256
  c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
257
257
  c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
258
258
  l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
259
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function xS(t){return"toText"in t}class ms{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e}toMarkup(){for(var e="",r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e}toText(){return this.children.map(e=>{if(xS(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var Ed={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},CS={ex:!0,em:!0,mu:!0},y7=function(e){return typeof e!="string"&&(e=e.unit),e in Ed||e in CS||e==="ex"},ot=function(e,r){var n;if(e.unit in Ed)n=Ed[e.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(e.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var o;if(r.style.isTight()?o=r.havingStyle(r.style.text()):o=r,e.unit==="ex")n=o.fontMetrics().xHeight;else if(e.unit==="em")n=o.fontMetrics().quad;else throw new K("Invalid unit: '"+e.unit+"'");o!==r&&(n*=o.sizeMultiplier/r.sizeMultiplier)}return Math.min(e.number*n,r.maxSize)},J=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(r=>r).join(" ")},Ph=function(e){var r="";for(var n of Object.keys(e)){var o=e[n];o!==void 0&&(r+=X_(n)+":"+o+";")}return r},b7=function(e,r,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var o=r.getColor();o&&(this.style.color=o)}},w7=function(e){var r=document.createElement(e);r.className=yo(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)r.appendChild(this.children[o].toNode());return r},kS=/[\s"'>/=\x00-\x1f]/,x7=function(e){var r="<"+e;this.classes.length&&(r+=' class="'+Nt(yo(this.classes))+'"');var n=Ph(this.style);n&&(r+=' style="'+Nt(n)+'"');for(var o of Object.keys(this.attributes)){if(kS.test(o))throw new K("Invalid attribute name '"+o+"'");r+=" "+o+'="'+Nt(this.attributes[o])+'"'}r+=">";for(var i=0;i<this.children.length;i++)r+=this.children[i].toMarkup();return r+="</"+e+">",r};class gs{constructor(e,r,n,o){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,b7.call(this,e,n,o),this.children=r||[]}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return w7.call(this,"span")}toMarkup(){return x7.call(this,"span")}}class Hc{constructor(e,r,n,o){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,b7.call(this,r,o),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return w7.call(this,"a")}toMarkup(){return x7.call(this,"a")}}class _S{constructor(e,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+Nt(this.src)+'"'+(' alt="'+Nt(this.alt)+'"'),r=Ph(this.style);return r&&(e+=' style="'+Nt(r)+'"'),e+="'/>",e}}var SS={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class mr{constructor(e,r,n,o,i,s,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=r||0,this.depth=n||0,this.italic=o||0,this.skew=i||0,this.width=s||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=uS(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=SS[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),r=null;return this.italic>0&&(r=document.createElement("span"),r.style.marginRight=J(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=yo(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(e),r):e}toMarkup(){var e=!1,r="<span";this.classes.length&&(e=!0,r+=' class="',r+=Nt(yo(this.classes)),r+='"');var n="";this.italic>0&&(n+="margin-right:"+J(this.italic)+";"),n+=Ph(this.style),n&&(e=!0,r+=' style="'+Nt(n)+'"');var o=Nt(this.text);return e?(r+=">",r+=o,r+="</span>",r):o}}class Hn{constructor(e,r){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=r||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)r.appendChild(this.children[o].toNode());return r}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Nt(this.attributes[r])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class bo{constructor(e,r){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=r}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",e4[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Nt(this.alternate)+'"/>':'<path d="'+Nt(e4[this.pathName])+'"/>'}}class Id{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var e="<line";for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Nt(this.attributes[r])+'"';return e+="/>",e}}function AS(t){if(t instanceof mr)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function TS(t){if(t instanceof gs)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var MS=t=>t instanceof gs||t instanceof Hc||t instanceof ms,an={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Mu={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},t4={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function ES(t,e){an[t]=e}function Dh(t,e,r){if(!an[e])throw new Error("Font metrics not found for font: "+e+".");var n=t.charCodeAt(0),o=an[e][n];if(!o&&t[0]in t4&&(n=t4[t[0]].charCodeAt(0),o=an[e][n]),!o&&r==="text"&&v7(n)&&(o=an[e][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var Eu={};function IS(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Eu[e]){var r=Eu[e]={cssEmPerMu:Mu.quad[e]/18};for(var n of Object.keys(Mu))r[n]=Mu[n][e]}return Eu[e]}var Qe={math:{},text:{}};function f(t,e,r,n,o,i){Qe[t][o]={font:e,group:r,replace:n},i&&n&&(Qe[t][n]=Qe[t][o])}var m="math",U="text",b="main",S="ams",tt="accent-token",oe="bin",Kt="close",vs="inner",de="mathord",gt="op-token",vr="open",Qa="punct",T="rel",Vn="spacing",L="textord";f(m,b,T,"≡","\\equiv",!0);f(m,b,T,"≺","\\prec",!0);f(m,b,T,"≻","\\succ",!0);f(m,b,T,"∼","\\sim",!0);f(m,b,T,"⊥","\\perp");f(m,b,T,"⪯","\\preceq",!0);f(m,b,T,"⪰","\\succeq",!0);f(m,b,T,"≃","\\simeq",!0);f(m,b,T,"∣","\\mid",!0);f(m,b,T,"≪","\\ll",!0);f(m,b,T,"≫","\\gg",!0);f(m,b,T,"≍","\\asymp",!0);f(m,b,T,"∥","\\parallel");f(m,b,T,"⋈","\\bowtie",!0);f(m,b,T,"⌣","\\smile",!0);f(m,b,T,"⊑","\\sqsubseteq",!0);f(m,b,T,"⊒","\\sqsupseteq",!0);f(m,b,T,"≐","\\doteq",!0);f(m,b,T,"⌢","\\frown",!0);f(m,b,T,"∋","\\ni",!0);f(m,b,T,"∝","\\propto",!0);f(m,b,T,"⊢","\\vdash",!0);f(m,b,T,"⊣","\\dashv",!0);f(m,b,T,"∋","\\owns");f(m,b,Qa,".","\\ldotp");f(m,b,Qa,"⋅","\\cdotp");f(m,b,Qa,"⋅","·");f(U,b,L,"⋅","·");f(m,b,L,"#","\\#");f(U,b,L,"#","\\#");f(m,b,L,"&","\\&");f(U,b,L,"&","\\&");f(m,b,L,"ℵ","\\aleph",!0);f(m,b,L,"∀","\\forall",!0);f(m,b,L,"ℏ","\\hbar",!0);f(m,b,L,"∃","\\exists",!0);f(m,b,L,"∇","\\nabla",!0);f(m,b,L,"♭","\\flat",!0);f(m,b,L,"ℓ","\\ell",!0);f(m,b,L,"♮","\\natural",!0);f(m,b,L,"♣","\\clubsuit",!0);f(m,b,L,"℘","\\wp",!0);f(m,b,L,"♯","\\sharp",!0);f(m,b,L,"♢","\\diamondsuit",!0);f(m,b,L,"ℜ","\\Re",!0);f(m,b,L,"♡","\\heartsuit",!0);f(m,b,L,"ℑ","\\Im",!0);f(m,b,L,"♠","\\spadesuit",!0);f(m,b,L,"§","\\S",!0);f(U,b,L,"§","\\S");f(m,b,L,"¶","\\P",!0);f(U,b,L,"¶","\\P");f(m,b,L,"†","\\dag");f(U,b,L,"†","\\dag");f(U,b,L,"†","\\textdagger");f(m,b,L,"‡","\\ddag");f(U,b,L,"‡","\\ddag");f(U,b,L,"‡","\\textdaggerdbl");f(m,b,Kt,"⎱","\\rmoustache",!0);f(m,b,vr,"⎰","\\lmoustache",!0);f(m,b,Kt,"⟯","\\rgroup",!0);f(m,b,vr,"⟮","\\lgroup",!0);f(m,b,oe,"∓","\\mp",!0);f(m,b,oe,"⊖","\\ominus",!0);f(m,b,oe,"⊎","\\uplus",!0);f(m,b,oe,"⊓","\\sqcap",!0);f(m,b,oe,"∗","\\ast");f(m,b,oe,"⊔","\\sqcup",!0);f(m,b,oe,"◯","\\bigcirc",!0);f(m,b,oe,"∙","\\bullet",!0);f(m,b,oe,"‡","\\ddagger");f(m,b,oe,"≀","\\wr",!0);f(m,b,oe,"⨿","\\amalg");f(m,b,oe,"&","\\And");f(m,b,T,"⟵","\\longleftarrow",!0);f(m,b,T,"⇐","\\Leftarrow",!0);f(m,b,T,"⟸","\\Longleftarrow",!0);f(m,b,T,"⟶","\\longrightarrow",!0);f(m,b,T,"⇒","\\Rightarrow",!0);f(m,b,T,"⟹","\\Longrightarrow",!0);f(m,b,T,"↔","\\leftrightarrow",!0);f(m,b,T,"⟷","\\longleftrightarrow",!0);f(m,b,T,"⇔","\\Leftrightarrow",!0);f(m,b,T,"⟺","\\Longleftrightarrow",!0);f(m,b,T,"↦","\\mapsto",!0);f(m,b,T,"⟼","\\longmapsto",!0);f(m,b,T,"↗","\\nearrow",!0);f(m,b,T,"↩","\\hookleftarrow",!0);f(m,b,T,"↪","\\hookrightarrow",!0);f(m,b,T,"↘","\\searrow",!0);f(m,b,T,"↼","\\leftharpoonup",!0);f(m,b,T,"⇀","\\rightharpoonup",!0);f(m,b,T,"↙","\\swarrow",!0);f(m,b,T,"↽","\\leftharpoondown",!0);f(m,b,T,"⇁","\\rightharpoondown",!0);f(m,b,T,"↖","\\nwarrow",!0);f(m,b,T,"⇌","\\rightleftharpoons",!0);f(m,S,T,"≮","\\nless",!0);f(m,S,T,"","\\@nleqslant");f(m,S,T,"","\\@nleqq");f(m,S,T,"⪇","\\lneq",!0);f(m,S,T,"≨","\\lneqq",!0);f(m,S,T,"","\\@lvertneqq");f(m,S,T,"⋦","\\lnsim",!0);f(m,S,T,"⪉","\\lnapprox",!0);f(m,S,T,"⊀","\\nprec",!0);f(m,S,T,"⋠","\\npreceq",!0);f(m,S,T,"⋨","\\precnsim",!0);f(m,S,T,"⪹","\\precnapprox",!0);f(m,S,T,"≁","\\nsim",!0);f(m,S,T,"","\\@nshortmid");f(m,S,T,"∤","\\nmid",!0);f(m,S,T,"⊬","\\nvdash",!0);f(m,S,T,"⊭","\\nvDash",!0);f(m,S,T,"⋪","\\ntriangleleft");f(m,S,T,"⋬","\\ntrianglelefteq",!0);f(m,S,T,"⊊","\\subsetneq",!0);f(m,S,T,"","\\@varsubsetneq");f(m,S,T,"⫋","\\subsetneqq",!0);f(m,S,T,"","\\@varsubsetneqq");f(m,S,T,"≯","\\ngtr",!0);f(m,S,T,"","\\@ngeqslant");f(m,S,T,"","\\@ngeqq");f(m,S,T,"⪈","\\gneq",!0);f(m,S,T,"≩","\\gneqq",!0);f(m,S,T,"","\\@gvertneqq");f(m,S,T,"⋧","\\gnsim",!0);f(m,S,T,"⪊","\\gnapprox",!0);f(m,S,T,"⊁","\\nsucc",!0);f(m,S,T,"⋡","\\nsucceq",!0);f(m,S,T,"⋩","\\succnsim",!0);f(m,S,T,"⪺","\\succnapprox",!0);f(m,S,T,"≆","\\ncong",!0);f(m,S,T,"","\\@nshortparallel");f(m,S,T,"∦","\\nparallel",!0);f(m,S,T,"⊯","\\nVDash",!0);f(m,S,T,"⋫","\\ntriangleright");f(m,S,T,"⋭","\\ntrianglerighteq",!0);f(m,S,T,"","\\@nsupseteqq");f(m,S,T,"⊋","\\supsetneq",!0);f(m,S,T,"","\\@varsupsetneq");f(m,S,T,"⫌","\\supsetneqq",!0);f(m,S,T,"","\\@varsupsetneqq");f(m,S,T,"⊮","\\nVdash",!0);f(m,S,T,"⪵","\\precneqq",!0);f(m,S,T,"⪶","\\succneqq",!0);f(m,S,T,"","\\@nsubseteqq");f(m,S,oe,"⊴","\\unlhd");f(m,S,oe,"⊵","\\unrhd");f(m,S,T,"↚","\\nleftarrow",!0);f(m,S,T,"↛","\\nrightarrow",!0);f(m,S,T,"⇍","\\nLeftarrow",!0);f(m,S,T,"⇏","\\nRightarrow",!0);f(m,S,T,"↮","\\nleftrightarrow",!0);f(m,S,T,"⇎","\\nLeftrightarrow",!0);f(m,S,T,"△","\\vartriangle");f(m,S,L,"ℏ","\\hslash");f(m,S,L,"▽","\\triangledown");f(m,S,L,"◊","\\lozenge");f(m,S,L,"Ⓢ","\\circledS");f(m,S,L,"®","\\circledR");f(U,S,L,"®","\\circledR");f(m,S,L,"∡","\\measuredangle",!0);f(m,S,L,"∄","\\nexists");f(m,S,L,"℧","\\mho");f(m,S,L,"Ⅎ","\\Finv",!0);f(m,S,L,"⅁","\\Game",!0);f(m,S,L,"‵","\\backprime");f(m,S,L,"▲","\\blacktriangle");f(m,S,L,"▼","\\blacktriangledown");f(m,S,L,"■","\\blacksquare");f(m,S,L,"⧫","\\blacklozenge");f(m,S,L,"★","\\bigstar");f(m,S,L,"∢","\\sphericalangle",!0);f(m,S,L,"∁","\\complement",!0);f(m,S,L,"ð","\\eth",!0);f(U,b,L,"ð","ð");f(m,S,L,"╱","\\diagup");f(m,S,L,"╲","\\diagdown");f(m,S,L,"□","\\square");f(m,S,L,"□","\\Box");f(m,S,L,"◊","\\Diamond");f(m,S,L,"¥","\\yen",!0);f(U,S,L,"¥","\\yen",!0);f(m,S,L,"✓","\\checkmark",!0);f(U,S,L,"✓","\\checkmark");f(m,S,L,"ℶ","\\beth",!0);f(m,S,L,"ℸ","\\daleth",!0);f(m,S,L,"ℷ","\\gimel",!0);f(m,S,L,"ϝ","\\digamma",!0);f(m,S,L,"ϰ","\\varkappa");f(m,S,vr,"┌","\\@ulcorner",!0);f(m,S,Kt,"┐","\\@urcorner",!0);f(m,S,vr,"└","\\@llcorner",!0);f(m,S,Kt,"┘","\\@lrcorner",!0);f(m,S,T,"≦","\\leqq",!0);f(m,S,T,"⩽","\\leqslant",!0);f(m,S,T,"⪕","\\eqslantless",!0);f(m,S,T,"≲","\\lesssim",!0);f(m,S,T,"⪅","\\lessapprox",!0);f(m,S,T,"≊","\\approxeq",!0);f(m,S,oe,"⋖","\\lessdot");f(m,S,T,"⋘","\\lll",!0);f(m,S,T,"≶","\\lessgtr",!0);f(m,S,T,"⋚","\\lesseqgtr",!0);f(m,S,T,"⪋","\\lesseqqgtr",!0);f(m,S,T,"≑","\\doteqdot");f(m,S,T,"≓","\\risingdotseq",!0);f(m,S,T,"≒","\\fallingdotseq",!0);f(m,S,T,"∽","\\backsim",!0);f(m,S,T,"⋍","\\backsimeq",!0);f(m,S,T,"⫅","\\subseteqq",!0);f(m,S,T,"⋐","\\Subset",!0);f(m,S,T,"⊏","\\sqsubset",!0);f(m,S,T,"≼","\\preccurlyeq",!0);f(m,S,T,"⋞","\\curlyeqprec",!0);f(m,S,T,"≾","\\precsim",!0);f(m,S,T,"⪷","\\precapprox",!0);f(m,S,T,"⊲","\\vartriangleleft");f(m,S,T,"⊴","\\trianglelefteq");f(m,S,T,"⊨","\\vDash",!0);f(m,S,T,"⊪","\\Vvdash",!0);f(m,S,T,"⌣","\\smallsmile");f(m,S,T,"⌢","\\smallfrown");f(m,S,T,"≏","\\bumpeq",!0);f(m,S,T,"≎","\\Bumpeq",!0);f(m,S,T,"≧","\\geqq",!0);f(m,S,T,"⩾","\\geqslant",!0);f(m,S,T,"⪖","\\eqslantgtr",!0);f(m,S,T,"≳","\\gtrsim",!0);f(m,S,T,"⪆","\\gtrapprox",!0);f(m,S,oe,"⋗","\\gtrdot");f(m,S,T,"⋙","\\ggg",!0);f(m,S,T,"≷","\\gtrless",!0);f(m,S,T,"⋛","\\gtreqless",!0);f(m,S,T,"⪌","\\gtreqqless",!0);f(m,S,T,"≖","\\eqcirc",!0);f(m,S,T,"≗","\\circeq",!0);f(m,S,T,"≜","\\triangleq",!0);f(m,S,T,"∼","\\thicksim");f(m,S,T,"≈","\\thickapprox");f(m,S,T,"⫆","\\supseteqq",!0);f(m,S,T,"⋑","\\Supset",!0);f(m,S,T,"⊐","\\sqsupset",!0);f(m,S,T,"≽","\\succcurlyeq",!0);f(m,S,T,"⋟","\\curlyeqsucc",!0);f(m,S,T,"≿","\\succsim",!0);f(m,S,T,"⪸","\\succapprox",!0);f(m,S,T,"⊳","\\vartriangleright");f(m,S,T,"⊵","\\trianglerighteq");f(m,S,T,"⊩","\\Vdash",!0);f(m,S,T,"∣","\\shortmid");f(m,S,T,"∥","\\shortparallel");f(m,S,T,"≬","\\between",!0);f(m,S,T,"⋔","\\pitchfork",!0);f(m,S,T,"∝","\\varpropto");f(m,S,T,"◀","\\blacktriangleleft");f(m,S,T,"∴","\\therefore",!0);f(m,S,T,"∍","\\backepsilon");f(m,S,T,"▶","\\blacktriangleright");f(m,S,T,"∵","\\because",!0);f(m,S,T,"⋘","\\llless");f(m,S,T,"⋙","\\gggtr");f(m,S,oe,"⊲","\\lhd");f(m,S,oe,"⊳","\\rhd");f(m,S,T,"≂","\\eqsim",!0);f(m,b,T,"⋈","\\Join");f(m,S,T,"≑","\\Doteq",!0);f(m,S,oe,"∔","\\dotplus",!0);f(m,S,oe,"∖","\\smallsetminus");f(m,S,oe,"⋒","\\Cap",!0);f(m,S,oe,"⋓","\\Cup",!0);f(m,S,oe,"⩞","\\doublebarwedge",!0);f(m,S,oe,"⊟","\\boxminus",!0);f(m,S,oe,"⊞","\\boxplus",!0);f(m,S,oe,"⋇","\\divideontimes",!0);f(m,S,oe,"⋉","\\ltimes",!0);f(m,S,oe,"⋊","\\rtimes",!0);f(m,S,oe,"⋋","\\leftthreetimes",!0);f(m,S,oe,"⋌","\\rightthreetimes",!0);f(m,S,oe,"⋏","\\curlywedge",!0);f(m,S,oe,"⋎","\\curlyvee",!0);f(m,S,oe,"⊝","\\circleddash",!0);f(m,S,oe,"⊛","\\circledast",!0);f(m,S,oe,"⋅","\\centerdot");f(m,S,oe,"⊺","\\intercal",!0);f(m,S,oe,"⋒","\\doublecap");f(m,S,oe,"⋓","\\doublecup");f(m,S,oe,"⊠","\\boxtimes",!0);f(m,S,T,"⇢","\\dashrightarrow",!0);f(m,S,T,"⇠","\\dashleftarrow",!0);f(m,S,T,"⇇","\\leftleftarrows",!0);f(m,S,T,"⇆","\\leftrightarrows",!0);f(m,S,T,"⇚","\\Lleftarrow",!0);f(m,S,T,"↞","\\twoheadleftarrow",!0);f(m,S,T,"↢","\\leftarrowtail",!0);f(m,S,T,"↫","\\looparrowleft",!0);f(m,S,T,"⇋","\\leftrightharpoons",!0);f(m,S,T,"↶","\\curvearrowleft",!0);f(m,S,T,"↺","\\circlearrowleft",!0);f(m,S,T,"↰","\\Lsh",!0);f(m,S,T,"⇈","\\upuparrows",!0);f(m,S,T,"↿","\\upharpoonleft",!0);f(m,S,T,"⇃","\\downharpoonleft",!0);f(m,b,T,"⊶","\\origof",!0);f(m,b,T,"⊷","\\imageof",!0);f(m,S,T,"⊸","\\multimap",!0);f(m,S,T,"↭","\\leftrightsquigarrow",!0);f(m,S,T,"⇉","\\rightrightarrows",!0);f(m,S,T,"⇄","\\rightleftarrows",!0);f(m,S,T,"↠","\\twoheadrightarrow",!0);f(m,S,T,"↣","\\rightarrowtail",!0);f(m,S,T,"↬","\\looparrowright",!0);f(m,S,T,"↷","\\curvearrowright",!0);f(m,S,T,"↻","\\circlearrowright",!0);f(m,S,T,"↱","\\Rsh",!0);f(m,S,T,"⇊","\\downdownarrows",!0);f(m,S,T,"↾","\\upharpoonright",!0);f(m,S,T,"⇂","\\downharpoonright",!0);f(m,S,T,"⇝","\\rightsquigarrow",!0);f(m,S,T,"⇝","\\leadsto");f(m,S,T,"⇛","\\Rrightarrow",!0);f(m,S,T,"↾","\\restriction");f(m,b,L,"‘","`");f(m,b,L,"$","\\$");f(U,b,L,"$","\\$");f(U,b,L,"$","\\textdollar");f(m,b,L,"%","\\%");f(U,b,L,"%","\\%");f(m,b,L,"_","\\_");f(U,b,L,"_","\\_");f(U,b,L,"_","\\textunderscore");f(m,b,L,"∠","\\angle",!0);f(m,b,L,"∞","\\infty",!0);f(m,b,L,"′","\\prime");f(m,b,L,"△","\\triangle");f(m,b,L,"Γ","\\Gamma",!0);f(m,b,L,"Δ","\\Delta",!0);f(m,b,L,"Θ","\\Theta",!0);f(m,b,L,"Λ","\\Lambda",!0);f(m,b,L,"Ξ","\\Xi",!0);f(m,b,L,"Π","\\Pi",!0);f(m,b,L,"Σ","\\Sigma",!0);f(m,b,L,"Υ","\\Upsilon",!0);f(m,b,L,"Φ","\\Phi",!0);f(m,b,L,"Ψ","\\Psi",!0);f(m,b,L,"Ω","\\Omega",!0);f(m,b,L,"A","Α");f(m,b,L,"B","Β");f(m,b,L,"E","Ε");f(m,b,L,"Z","Ζ");f(m,b,L,"H","Η");f(m,b,L,"I","Ι");f(m,b,L,"K","Κ");f(m,b,L,"M","Μ");f(m,b,L,"N","Ν");f(m,b,L,"O","Ο");f(m,b,L,"P","Ρ");f(m,b,L,"T","Τ");f(m,b,L,"X","Χ");f(m,b,L,"¬","\\neg",!0);f(m,b,L,"¬","\\lnot");f(m,b,L,"⊤","\\top");f(m,b,L,"⊥","\\bot");f(m,b,L,"∅","\\emptyset");f(m,S,L,"∅","\\varnothing");f(m,b,de,"α","\\alpha",!0);f(m,b,de,"β","\\beta",!0);f(m,b,de,"γ","\\gamma",!0);f(m,b,de,"δ","\\delta",!0);f(m,b,de,"ϵ","\\epsilon",!0);f(m,b,de,"ζ","\\zeta",!0);f(m,b,de,"η","\\eta",!0);f(m,b,de,"θ","\\theta",!0);f(m,b,de,"ι","\\iota",!0);f(m,b,de,"κ","\\kappa",!0);f(m,b,de,"λ","\\lambda",!0);f(m,b,de,"μ","\\mu",!0);f(m,b,de,"ν","\\nu",!0);f(m,b,de,"ξ","\\xi",!0);f(m,b,de,"ο","\\omicron",!0);f(m,b,de,"π","\\pi",!0);f(m,b,de,"ρ","\\rho",!0);f(m,b,de,"σ","\\sigma",!0);f(m,b,de,"τ","\\tau",!0);f(m,b,de,"υ","\\upsilon",!0);f(m,b,de,"ϕ","\\phi",!0);f(m,b,de,"χ","\\chi",!0);f(m,b,de,"ψ","\\psi",!0);f(m,b,de,"ω","\\omega",!0);f(m,b,de,"ε","\\varepsilon",!0);f(m,b,de,"ϑ","\\vartheta",!0);f(m,b,de,"ϖ","\\varpi",!0);f(m,b,de,"ϱ","\\varrho",!0);f(m,b,de,"ς","\\varsigma",!0);f(m,b,de,"φ","\\varphi",!0);f(m,b,oe,"∗","*",!0);f(m,b,oe,"+","+");f(m,b,oe,"−","-",!0);f(m,b,oe,"⋅","\\cdot",!0);f(m,b,oe,"∘","\\circ",!0);f(m,b,oe,"÷","\\div",!0);f(m,b,oe,"±","\\pm",!0);f(m,b,oe,"×","\\times",!0);f(m,b,oe,"∩","\\cap",!0);f(m,b,oe,"∪","\\cup",!0);f(m,b,oe,"∖","\\setminus",!0);f(m,b,oe,"∧","\\land");f(m,b,oe,"∨","\\lor");f(m,b,oe,"∧","\\wedge",!0);f(m,b,oe,"∨","\\vee",!0);f(m,b,L,"√","\\surd");f(m,b,vr,"⟨","\\langle",!0);f(m,b,vr,"∣","\\lvert");f(m,b,vr,"∥","\\lVert");f(m,b,Kt,"?","?");f(m,b,Kt,"!","!");f(m,b,Kt,"⟩","\\rangle",!0);f(m,b,Kt,"∣","\\rvert");f(m,b,Kt,"∥","\\rVert");f(m,b,T,"=","=");f(m,b,T,":",":");f(m,b,T,"≈","\\approx",!0);f(m,b,T,"≅","\\cong",!0);f(m,b,T,"≥","\\ge");f(m,b,T,"≥","\\geq",!0);f(m,b,T,"←","\\gets");f(m,b,T,">","\\gt",!0);f(m,b,T,"∈","\\in",!0);f(m,b,T,"","\\@not");f(m,b,T,"⊂","\\subset",!0);f(m,b,T,"⊃","\\supset",!0);f(m,b,T,"⊆","\\subseteq",!0);f(m,b,T,"⊇","\\supseteq",!0);f(m,S,T,"⊈","\\nsubseteq",!0);f(m,S,T,"⊉","\\nsupseteq",!0);f(m,b,T,"⊨","\\models");f(m,b,T,"←","\\leftarrow",!0);f(m,b,T,"≤","\\le");f(m,b,T,"≤","\\leq",!0);f(m,b,T,"<","\\lt",!0);f(m,b,T,"→","\\rightarrow",!0);f(m,b,T,"→","\\to");f(m,S,T,"≱","\\ngeq",!0);f(m,S,T,"≰","\\nleq",!0);f(m,b,Vn," ","\\ ");f(m,b,Vn," ","\\space");f(m,b,Vn," ","\\nobreakspace");f(U,b,Vn," ","\\ ");f(U,b,Vn," "," ");f(U,b,Vn," ","\\space");f(U,b,Vn," ","\\nobreakspace");f(m,b,Vn,"","\\nobreak");f(m,b,Vn,"","\\allowbreak");f(m,b,Qa,",",",");f(m,b,Qa,";",";");f(m,S,oe,"⊼","\\barwedge",!0);f(m,S,oe,"⊻","\\veebar",!0);f(m,b,oe,"⊙","\\odot",!0);f(m,b,oe,"⊕","\\oplus",!0);f(m,b,oe,"⊗","\\otimes",!0);f(m,b,L,"∂","\\partial",!0);f(m,b,oe,"⊘","\\oslash",!0);f(m,S,oe,"⊚","\\circledcirc",!0);f(m,S,oe,"⊡","\\boxdot",!0);f(m,b,oe,"△","\\bigtriangleup");f(m,b,oe,"▽","\\bigtriangledown");f(m,b,oe,"†","\\dagger");f(m,b,oe,"⋄","\\diamond");f(m,b,oe,"⋆","\\star");f(m,b,oe,"◃","\\triangleleft");f(m,b,oe,"▹","\\triangleright");f(m,b,vr,"{","\\{");f(U,b,L,"{","\\{");f(U,b,L,"{","\\textbraceleft");f(m,b,Kt,"}","\\}");f(U,b,L,"}","\\}");f(U,b,L,"}","\\textbraceright");f(m,b,vr,"{","\\lbrace");f(m,b,Kt,"}","\\rbrace");f(m,b,vr,"[","\\lbrack",!0);f(U,b,L,"[","\\lbrack",!0);f(m,b,Kt,"]","\\rbrack",!0);f(U,b,L,"]","\\rbrack",!0);f(m,b,vr,"(","\\lparen",!0);f(m,b,Kt,")","\\rparen",!0);f(U,b,L,"<","\\textless",!0);f(U,b,L,">","\\textgreater",!0);f(m,b,vr,"⌊","\\lfloor",!0);f(m,b,Kt,"⌋","\\rfloor",!0);f(m,b,vr,"⌈","\\lceil",!0);f(m,b,Kt,"⌉","\\rceil",!0);f(m,b,L,"\\","\\backslash");f(m,b,L,"∣","|");f(m,b,L,"∣","\\vert");f(U,b,L,"|","\\textbar",!0);f(m,b,L,"∥","\\|");f(m,b,L,"∥","\\Vert");f(U,b,L,"∥","\\textbardbl");f(U,b,L,"~","\\textasciitilde");f(U,b,L,"\\","\\textbackslash");f(U,b,L,"^","\\textasciicircum");f(m,b,T,"↑","\\uparrow",!0);f(m,b,T,"⇑","\\Uparrow",!0);f(m,b,T,"↓","\\downarrow",!0);f(m,b,T,"⇓","\\Downarrow",!0);f(m,b,T,"↕","\\updownarrow",!0);f(m,b,T,"⇕","\\Updownarrow",!0);f(m,b,gt,"∐","\\coprod");f(m,b,gt,"⋁","\\bigvee");f(m,b,gt,"⋀","\\bigwedge");f(m,b,gt,"⨄","\\biguplus");f(m,b,gt,"⋂","\\bigcap");f(m,b,gt,"⋃","\\bigcup");f(m,b,gt,"∫","\\int");f(m,b,gt,"∫","\\intop");f(m,b,gt,"∬","\\iint");f(m,b,gt,"∭","\\iiint");f(m,b,gt,"∏","\\prod");f(m,b,gt,"∑","\\sum");f(m,b,gt,"⨂","\\bigotimes");f(m,b,gt,"⨁","\\bigoplus");f(m,b,gt,"⨀","\\bigodot");f(m,b,gt,"∮","\\oint");f(m,b,gt,"∯","\\oiint");f(m,b,gt,"∰","\\oiiint");f(m,b,gt,"⨆","\\bigsqcup");f(m,b,gt,"∫","\\smallint");f(U,b,vs,"…","\\textellipsis");f(m,b,vs,"…","\\mathellipsis");f(U,b,vs,"…","\\ldots",!0);f(m,b,vs,"…","\\ldots",!0);f(m,b,vs,"⋯","\\@cdots",!0);f(m,b,vs,"⋱","\\ddots",!0);f(m,b,L,"⋮","\\varvdots");f(U,b,L,"⋮","\\varvdots");f(m,b,tt,"ˊ","\\acute");f(m,b,tt,"ˋ","\\grave");f(m,b,tt,"¨","\\ddot");f(m,b,tt,"~","\\tilde");f(m,b,tt,"ˉ","\\bar");f(m,b,tt,"˘","\\breve");f(m,b,tt,"ˇ","\\check");f(m,b,tt,"^","\\hat");f(m,b,tt,"⃗","\\vec");f(m,b,tt,"˙","\\dot");f(m,b,tt,"˚","\\mathring");f(m,b,de,"","\\@imath");f(m,b,de,"","\\@jmath");f(m,b,L,"ı","ı");f(m,b,L,"ȷ","ȷ");f(U,b,L,"ı","\\i",!0);f(U,b,L,"ȷ","\\j",!0);f(U,b,L,"ß","\\ss",!0);f(U,b,L,"æ","\\ae",!0);f(U,b,L,"œ","\\oe",!0);f(U,b,L,"ø","\\o",!0);f(U,b,L,"Æ","\\AE",!0);f(U,b,L,"Œ","\\OE",!0);f(U,b,L,"Ø","\\O",!0);f(U,b,tt,"ˊ","\\'");f(U,b,tt,"ˋ","\\`");f(U,b,tt,"ˆ","\\^");f(U,b,tt,"˜","\\~");f(U,b,tt,"ˉ","\\=");f(U,b,tt,"˘","\\u");f(U,b,tt,"˙","\\.");f(U,b,tt,"¸","\\c");f(U,b,tt,"˚","\\r");f(U,b,tt,"ˇ","\\v");f(U,b,tt,"¨",'\\"');f(U,b,tt,"˝","\\H");f(U,b,tt,"◯","\\textcircled");var C7={"--":!0,"---":!0,"``":!0,"''":!0};f(U,b,L,"–","--",!0);f(U,b,L,"–","\\textendash");f(U,b,L,"—","---",!0);f(U,b,L,"—","\\textemdash");f(U,b,L,"‘","`",!0);f(U,b,L,"‘","\\textquoteleft");f(U,b,L,"’","'",!0);f(U,b,L,"’","\\textquoteright");f(U,b,L,"“","``",!0);f(U,b,L,"“","\\textquotedblleft");f(U,b,L,"”","''",!0);f(U,b,L,"”","\\textquotedblright");f(m,b,L,"°","\\degree",!0);f(U,b,L,"°","\\degree");f(U,b,L,"°","\\textdegree",!0);f(m,b,L,"£","\\pounds");f(m,b,L,"£","\\mathsterling",!0);f(U,b,L,"£","\\pounds");f(U,b,L,"£","\\textsterling",!0);f(m,S,L,"✠","\\maltese");f(U,S,L,"✠","\\maltese");var r4='0123456789/@."';for(var Iu=0;Iu<r4.length;Iu++){var n4=r4.charAt(Iu);f(m,b,L,n4,n4)}var o4='0123456789!@*()-=+";:?/.,';for(var Lu=0;Lu<o4.length;Lu++){var i4=o4.charAt(Lu);f(U,b,L,i4,i4)}var Y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Ru=0;Ru<Y0.length;Ru++){var ml=Y0.charAt(Ru);f(m,b,de,ml,ml),f(U,b,L,ml,ml)}f(m,S,L,"C","ℂ");f(U,S,L,"C","ℂ");f(m,S,L,"H","ℍ");f(U,S,L,"H","ℍ");f(m,S,L,"N","ℕ");f(U,S,L,"N","ℕ");f(m,S,L,"P","ℙ");f(U,S,L,"P","ℙ");f(m,S,L,"Q","ℚ");f(U,S,L,"Q","ℚ");f(m,S,L,"R","ℝ");f(U,S,L,"R","ℝ");f(m,S,L,"Z","ℤ");f(U,S,L,"Z","ℤ");f(m,b,de,"h","ℎ");f(U,b,de,"h","ℎ");var me;for(var $t=0;$t<Y0.length;$t++){var st=Y0.charAt($t);me=String.fromCharCode(55349,56320+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56372+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56424+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56580+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56684+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56736+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56788+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56840+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56944+$t),f(m,b,de,st,me),f(U,b,L,st,me),$t<26&&(me=String.fromCharCode(55349,56632+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56476+$t),f(m,b,de,st,me),f(U,b,L,st,me))}me="𝕜";f(m,b,de,"k",me);f(U,b,L,"k",me);for(var Ro=0;Ro<10;Ro++){var Zn=Ro.toString();me=String.fromCharCode(55349,57294+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57314+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57324+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57334+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me)}var Ld="ÐÞþ";for(var Ou=0;Ou<Ld.length;Ou++){var gl=Ld.charAt(Ou);f(m,b,de,gl,gl),f(U,b,L,gl,gl)}var Rd={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},s4={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},a4={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},LS={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},jo={mathClass:"",textClass:"",font:""},l4={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},c4={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},u4={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Od={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Pd={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},d4={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Dd={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},h4=[Rd,Rd,s4,s4,a4,a4,LS,jo,jo,jo,l4,l4,c4,c4,u4,u4,Od,Od,Pd,Pd,d4,d4,jo,jo,Dd,Dd],RS=[Rd,jo,Od,Pd,Dd],OS=t=>{var e=t.charCodeAt(0),r=t.charCodeAt(1),n=(e-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var o=Math.floor((n-119808)/26);return h4[o]}else if(120782<=n&&n<=120831){var i=Math.floor((n-120782)/10);return RS[i]}else{if(n===120485||n===120486)return h4[0];if(120486<n&&n<120782)return jo;throw new K("Unsupported character: "+t)}};function Qt(t){var e=t.strict,r=t.errorCode,n=t.errorMsg,o=t.token,i=t.report,s=e;if(typeof e=="function")if(i)s=e(r,n,o);else try{s=e(r,n,o)}catch{s="error"}switch(s){case!0:case"error":if(i)throw new K("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+r+"]"),o);return!0;case!1:case"ignore":if(!i)return!1;break;default:if(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+r+"]")),!i)return!1;break}}var $c=function(e,r,n){if(Qe[n][e]){var o=Qe[n][e].replace;o&&(e=o)}return{value:e,metrics:Dh(e,r,n)}},Vt=function(e,r,n,o,i){var s=$c(e,r,n),a=s.metrics;e=s.value;var l;if(a){var c=a.italic;(n==="text"||o&&o.font==="mathit")&&(c=0),l=new mr(e,a.height,a.depth,c,a.skew,a.width,i)}else Qt({strict:o.strict,errorCode:"symbolNotInFont",errorMsg:"No character metrics for '"+e+"' in style '"+r+"' and mode '"+n+"'",report:!0}),l=new mr(e,0,0,0,0,0,i);l.maxFontSize=o.sizeMultiplier,o.style.isTight()&&l.classes.push("mtight");var u=o.getColor();return u&&(l.style.color=u),l},Bh=function(e,r,n,o){return o===void 0&&(o=[]),n.font==="boldsymbol"&&$c(e,"Main-Bold",r).metrics?Vt(e,"Main-Bold",r,n,o.concat(["mathbf"])):e==="\\"||Qe[r][e].font==="main"?Vt(e,"Main-Regular",r,n,o):Vt(e,"AMS-Regular",r,n,o.concat(["amsrm"]))},PS=function(e,r,n){return n!=="textord"&&$c(e,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},qc=function(e,r){var n=e.type==="mathord"?"mathord":"textord",o=e.mode,i=e.text,s=["mord"],a=r.font,l=r.fontFamily,c=r.fontWeight,u=r.fontShape,d=o==="math"||o==="text"&&!!a,h=d?a:l,p="",g="";if(i.charCodeAt(0)===55349){var y=OS(i);p=y.font,g=y[o+"Class"]}if(p)return Vt(i,p,o,r,s.concat(g));if(h){var v,w;if(h==="boldsymbol"){var C=PS(i,o,n);v=C.fontName,w=[C.fontClass]}else d?(v=Bd[a].fontName,w=[a]):(v=vl(l,c,u),w=[l,c,u]);if($c(i,v,o).metrics)return Vt(i,v,o,r,s.concat(w));if(Object.prototype.hasOwnProperty.call(C7,i)&&v.slice(0,10)==="Typewriter"){for(var k=[],A=0;A<i.length;A++)k.push(Vt(i[A],v,o,r,s.concat(w)));return Wn(k)}}if(n==="mathord")return Vt(i,"Math-Italic",o,r,s.concat(["mathnormal"]));if(n==="textord"){var I=Qe[o][i]&&Qe[o][i].font;if(I==="ams"){var R=vl("amsrm",c,u);return Vt(i,R,o,r,s.concat("amsrm",c,u))}else if(I==="main"||!I){var H=vl("textrm",c,u);return Vt(i,H,o,r,s.concat(c,u))}else{var O=vl(I,c,u);return Vt(i,O,o,r,s.concat(O,c,u))}}else throw new Error("unexpected type: "+n+" in makeOrd")},DS=(t,e)=>{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var r=t.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(t.style))if(t.style[n]!==e.style[n])return!1;for(var o of Object.keys(e.style))if(t.style[o]!==e.style[o])return!1;return!0},k7=t=>{for(var e=0;e<t.length-1;e++){var r=t[e],n=t[e+1];r instanceof mr&&n instanceof mr&&DS(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,t.splice(e+1,1),e--)}return t},zh=function(e){for(var r=0,n=0,o=0,i=0;i<e.children.length;i++){var s=e.children[i];s.height>r&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>o&&(o=s.maxFontSize)}e.height=r,e.depth=n,e.maxFontSize=o},G=function(e,r,n,o){var i=new gs(e,r,n,o);return zh(i),i},wo=(t,e,r,n)=>new gs(t,e,r,n),Ji=function(e,r,n){var o=G([e],[],r);return o.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),o.style.borderBottomWidth=J(o.height),o.maxFontSize=1,o},BS=function(e,r,n,o){var i=new Hc(e,r,n,o);return zh(i),i},Wn=function(e){var r=new ms(e);return zh(r),r},Qi=function(e,r){return e instanceof ms?G([],[e],r):e},zS=function(e){if(e.positionType==="individualShift"){for(var r=e.children,n=[r[0]],o=-r[0].shift-r[0].elem.depth,i=o,s=1;s<r.length;s++){var a=-r[s].shift-i-r[s].elem.depth,l=a-(r[s-1].elem.height+r[s-1].elem.depth);i=i+a,n.push({type:"kern",size:l}),n.push(r[s])}return{children:n,depth:o}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var p=e.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-p.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-p.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Be=function(e,r){for(var n=zS(e),o=n.children,i=n.depth,s=0,a=0;a<o.length;a++){var l=o[a];if(l.type==="elem"){var c=l.elem;s=Math.max(s,c.maxFontSize,c.height)}}s+=2;var u=G(["pstrut"],[]);u.style.height=J(s);for(var d=[],h=i,p=i,g=i,y=0;y<o.length;y++){var v=o[y];if(v.type==="kern")g+=v.size;else{var w=v.elem,C=v.wrapperClasses||[],k=v.wrapperStyle||{},A=G(C,[u,w],void 0,k);A.style.top=J(-s-g-w.depth),v.marginLeft&&(A.style.marginLeft=v.marginLeft),v.marginRight&&(A.style.marginRight=v.marginRight),d.push(A),g+=w.height+w.depth}h=Math.min(h,g),p=Math.max(p,g)}var I=G(["vlist"],d);I.style.height=J(p);var R;if(h<0){var H=G([],[]),O=G(["vlist"],[H]);O.style.height=J(-h);var P=G(["vlist-s"],[new mr("​")]);R=[G(["vlist-r"],[I,P]),G(["vlist-r"],[O])]}else R=[G(["vlist-r"],[I])];var $=G(["vlist-t"],R);return R.length===2&&$.classes.push("vlist-t2"),$.height=p,$.depth=-h,$},_7=(t,e)=>{var r=G(["mspace"],[],e),n=ot(t,e);return r.style.marginRight=J(n),r},vl=(t,e,r)=>{var n,o;switch(t){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=t}return e==="textbf"&&r==="textit"?o="BoldItalic":e==="textbf"?o="Bold":r==="textit"?o="Italic":o="Regular",n+"-"+o},Bd={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},S7={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},A7=function(e,r){var n=S7[e],o=n[0],i=n[1],s=n[2],a=new bo(o),l=new Hn([a],{width:J(i),height:J(s),style:"width:"+J(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),c=wo(["katex-overlay"],[l],r);return c.height=s,c.style.height=J(s),c.style.width=J(i),c},nt={number:3,unit:"mu"},Oo={number:4,unit:"mu"},Cn={number:5,unit:"mu"},NS={mord:{mop:nt,mbin:Oo,mrel:Cn,minner:nt},mop:{mord:nt,mop:nt,mrel:Cn,minner:nt},mbin:{mord:Oo,mop:Oo,mopen:Oo,minner:Oo},mrel:{mord:Cn,mop:Cn,mopen:Cn,minner:Cn},mopen:{},mclose:{mop:nt,mbin:Oo,mrel:Cn,minner:nt},mpunct:{mord:nt,mop:nt,mrel:Cn,mopen:nt,mclose:nt,mpunct:nt,minner:nt},minner:{mord:nt,mop:nt,mbin:Oo,mrel:Cn,mopen:nt,mpunct:nt,minner:nt}},HS={mord:{mop:nt},mop:{mord:nt,mop:nt},mbin:{},mrel:{},mopen:{},mclose:{mop:nt},mpunct:{},minner:{mop:nt}},T7={},Ta={},Ma={};function te(t){for(var e=t.type,r=t.names,n=t.htmlBuilder,o=t.mathmlBuilder,i=0;i<r.length;++i)T7[r[i]]=t;e&&(n&&(Ta[e]=n),o&&(Ma[e]=o))}function di(t){var e=t.type,r=t.htmlBuilder,n=t.mathmlBuilder;r&&(Ta[e]=r),n&&(Ma[e]=n)}var Ea=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ft=function(e){return e.type==="ordgroup"?e.body:[e]},$S=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),qS=new Set(["rightmost","mrel","mclose","mpunct"]),FS={display:ge.DISPLAY,text:ge.TEXT,script:ge.SCRIPT,scriptscript:ge.SCRIPTSCRIPT},VS={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},xt=function(e,r,n,o){o===void 0&&(o=[null,null]);for(var i=[],s=0;s<e.length;s++){var a=Re(e[s],r);if(a instanceof ms){var l=a.children;i.push(...l)}else i.push(a)}if(k7(i),!n)return i;var c=r;if(e.length===1){var u=e[0];u.type==="sizing"?c=r.havingSize(u.size):u.type==="styling"&&(c=r.havingStyle(FS[u.style]))}var d=G([o[0]||"leftmost"],[],r),h=G([o[1]||"rightmost"],[],r),p=n==="root";return zd(i,(g,y)=>{var v=y.classes[0],w=g.classes[0];v==="mbin"&&qS.has(w)?y.classes[0]="mord":w==="mbin"&&$S.has(v)&&(g.classes[0]="mord")},{node:d},h,p),zd(i,(g,y)=>{var v,w,C=Hd(y),k=Hd(g),A=C&&k?g.hasClass("mtight")?(v=HS[C])==null?void 0:v[k]:(w=NS[C])==null?void 0:w[k]:null;if(A)return _7(A,c)},{node:d},h,p),i},zd=function(e,r,n,o,i){o&&e.push(o);for(var s=0;s<e.length;s++){var a=e[s],l=M7(a);if(l){zd(l.children,r,n,null,i);continue}var c=!a.hasClass("mspace");if(c){var u=r(a,n.node);u&&(n.insertAfter?n.insertAfter(u):(e.unshift(u),s++))}c?n.node=a:i&&a.hasClass("katex-newline")&&(n.node=G(["leftmost"])),n.insertAfter=(d=>h=>{e.splice(d+1,0,h),s++})(s)}o&&e.pop()},M7=function(e){return e instanceof ms||e instanceof Hc||e instanceof gs&&e.hasClass("enclosing")?e:null},Nd=function(e,r){var n=M7(e);if(n){var o=n.children;if(o.length){if(r==="right")return Nd(o[o.length-1],"right");if(r==="left")return Nd(o[0],"left")}}return e},Hd=function(e,r){if(!e)return null;r&&(e=Nd(e,r));var n=e.classes[0];return VS[n]||null},Ia=function(e,r){var n=["nulldelimiter"].concat(e.baseSizingClasses());return G(r.concat(n))},Re=function(e,r,n){if(!e)return G();if(Ta[e.type]){var o=Ta[e.type](e,r);if(n&&r.size!==n.size){o=G(r.sizingClasses(n),[o],r);var i=r.sizeMultiplier/n.sizeMultiplier;o.height*=i,o.depth*=i}return o}else throw new K("Got group of unknown type: '"+e.type+"'")};function yl(t,e){var r=G(["katex-base"],t,e),n=G(["katex-strut"]);return n.style.height=J(r.height+r.depth),r.depth&&(n.style.verticalAlign=J(-r.depth)),r.children.unshift(n),r}function $d(t,e){var r=null;t.length===1&&t[0].type==="tag"&&(r=t[0].tag,t=t[0].body);var n=xt(t,e,"root"),o;n.length===2&&n[1].hasClass("katex-tag")&&(o=n.pop());for(var i=[],s=[],a=0;a<n.length;a++)if(s.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("katex-newline");)a++,s.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(i.push(yl(s,e)),s=[])}else n[a].hasClass("katex-newline")&&(s.pop(),s.length>0&&(i.push(yl(s,e)),s=[]),i.push(n[a]));s.length>0&&i.push(yl(s,e));var c;r?(c=yl(xt(r,e,!0),e),c.classes=["katex-tag"],i.push(c)):o&&i.push(o);var u=G(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=J(u.height+u.depth),u.depth&&(d.style.verticalAlign=J(-u.depth))}return u}function E7(t){return new ms(t)}class Z{constructor(e,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(e,r){this.attributes[e]=r}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r of Object.entries(this.attributes)){var n=r[0],o=r[1];e.setAttribute(n,o)}this.classes.length>0&&(e.className=yo(this.classes));for(var i=0;i<this.children.length;i++)if(this.children[i]instanceof pt&&this.children[i+1]instanceof pt){for(var s=this.children[i].toText()+this.children[++i].toText();this.children[i+1]instanceof pt;)s+=this.children[++i].toText();e.appendChild(new pt(s).toNode())}else e.appendChild(this.children[i].toNode());return e}toMarkup(){var e="<"+this.type;for(var r of Object.entries(this.attributes)){var n=r[0],o=r[1];e+=" "+n+'="',e+=Nt(o),e+='"'}this.classes.length>0&&(e+=' class ="'+Nt(yo(this.classes))+'"'),e+=">";for(var i=0;i<this.children.length;i++)e+=this.children[i].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class pt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Nt(this.toText())}toText(){return this.text}}class I7{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",J(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+J(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var WS=new Set(["\\imath","\\jmath"]),jS=new Set(["mrow","mtable"]),Ar=function(e,r,n){var o,i;return Qe[r][e]&&Qe[r][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(C7,e)&&((n==null||(o=n.fontFamily)==null?void 0:o.slice(4,6))==="tt"||(n==null||(i=n.font)==null?void 0:i.slice(4,6))==="tt"))&&(e=Qe[r][e].replace),new pt(e)},Nh=function(e){return e.length===1?e[0]:new Z("mrow",e)},US={mathit:"italic",boldsymbol:t=>t.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},Hh=(t,e)=>{if(t.mode==="text"){if(e.fontFamily==="texttt")return"monospace";if(e.fontFamily==="textsf")return e.fontShape==="textit"&&e.fontWeight==="textbf"?"sans-serif-bold-italic":e.fontShape==="textit"?"sans-serif-italic":e.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(e.fontShape==="textit"&&e.fontWeight==="textbf")return"bold-italic";if(e.fontShape==="textit")return"italic";if(e.fontWeight==="textbf")return"bold"}var r=e.font;if(!r||r==="mathnormal")return null;var n=t.mode,o=US[r];if(o)return typeof o=="function"?o(t):o;var i=t.text;if(WS.has(i))return null;if(Qe[n][i]){var s=Qe[n][i].replace;s&&(i=s)}var a=Bd[r].fontName;return Dh(i,a,n)?Bd[r].variant:null};function Pu(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof pt&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var r=t.children[0];return r instanceof pt&&r.text===","}else return!1}var yr=function(e,r,n){if(e.length===1){var o=je(e[0],r);return n&&o instanceof Z&&o.type==="mo"&&(o.setAttribute("lspace","0em"),o.setAttribute("rspace","0em")),[o]}for(var i=[],s,a=0;a<e.length;a++){var l=je(e[a],r);if(l instanceof Z&&s instanceof Z){if(l.type==="mtext"&&s.type==="mtext"&&l.getAttribute("mathvariant")===s.getAttribute("mathvariant")){s.children.push(...l.children);continue}else if(l.type==="mn"&&s.type==="mn"){s.children.push(...l.children);continue}else if(Pu(l)&&s.type==="mn"){s.children.push(...l.children);continue}else if(l.type==="mn"&&Pu(s))l.children=[...s.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(s.type==="mn"||Pu(s))){var c=l.children[0];c instanceof Z&&c.type==="mn"&&(c.children=[...s.children,...c.children],i.pop())}else if(s.type==="mi"&&s.children.length===1){var u=s.children[0];if(u instanceof pt&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof pt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),s=l}return i},xo=function(e,r,n){return Nh(yr(e,r,n))},je=function(e,r){if(!e)return new Z("mrow");if(Ma[e.type])return Ma[e.type](e,r);throw new K("Got group of unknown type: '"+e.type+"'")};function f4(t,e,r,n,o){var i=yr(t,r),s;i.length===1&&i[0]instanceof Z&&jS.has(i[0].type)?s=i[0]:s=new Z("mrow",i);var a=new Z("annotation",[new pt(e)]);a.setAttribute("encoding","application/x-tex");var l=new Z("semantics",[s,a]),c=new Z("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block");var u=o?"katex":"katex-mathml";return G([u],[c])}var GS=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],p4=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],m4=function(e,r){return r.size<2?e:GS[e-1][r.size-1]};class In{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.strict=void 0,this.style=e.style,this.color=e.color,this.size=e.size||In.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=p4[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this.strict=e.strict,this._fontMetrics=void 0}extend(e){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness,strict:this.strict};return Object.assign(r,e),new In(r)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:m4(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:p4[e-1]})}havingBaseStyle(e){e=e||this.style.text();var r=m4(In.BASESIZE,e);return this.size===r&&this.textSize===In.BASESIZE&&this.style===e?this:this.extend({style:e,size:r})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["katex-sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==In.BASESIZE?["katex-sizing","reset-size"+this.size,"size"+In.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=IS(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}In.BASESIZE=6;var L7=t=>new In({style:t.displayMode?ge.DISPLAY:ge.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness,strict:t.strict}),R7=function(e,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),e=G(n,[e])}return e},KS=function(e,r,n){var o=L7(n),i;if(n.output==="mathml")return f4(e,r,o,n.displayMode,!0);if(n.output==="html"){var s=$d(e,o);i=G(["katex"],[s])}else{var a=f4(e,r,o,n.displayMode,!1),l=$d(e,o);i=G(["katex"],[a,l])}return R7(i,n)},ZS=function(e,r){var n=L7(r),o=$d(e,n),i=G(["katex"],[o]);return R7(i,r)},XS={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Fc=function(e){var r=new Z("mo",[new pt(XS[e.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},YS={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},JS=new Set(["widehat","widecheck","widetilde","utilde"]),Vc=function(e,r){function n(){var l=4e5,c=e.label.slice(1);if(JS.has(c)&&"base"in e){var u=e.base.type==="ordgroup"?e.base.body.length:1,d,h,p;if(u>5)c==="widehat"||c==="widecheck"?(d=420,l=2364,p=.42,h=c+"4"):(d=312,l=2340,p=.34,h="tilde4");else{var g=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][g],d=[0,239,300,360,420][g],p=[0,.24,.3,.3,.36,.42][g],h=c+g):(l=[0,600,1033,2339,2340][g],d=[0,260,286,306,312][g],p=[0,.26,.286,.3,.306,.34][g],h="tilde"+g)}var y=new bo(h),v=new Hn([y],{width:"100%",height:J(p),viewBox:"0 0 "+l+" "+d,preserveAspectRatio:"none"});return{span:wo([],[v],r),minWidth:0,height:p}}else{var w=[],C=YS[c];if(!C)throw new Error('No SVG data for "'+c+'".');var k=C[0],A=C[1],I=C[2],R=I/1e3,H=k.length,O,P;if(H===1){if(C.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');O=["hide-tail"],P=[C[3]]}else if(H===2)O=["halfarrow-left","halfarrow-right"],P=["xMinYMin","xMaxYMin"];else if(H===3)O=["brace-left","brace-center","brace-right"],P=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
260
- `+H+" children.");for(var $=0;$<H;$++){var ie=new bo(k[$]),N=new Hn([ie],{width:"400em",height:J(R),viewBox:"0 0 "+l+" "+I,preserveAspectRatio:P[$]+" slice"}),ye=wo([O[$]],[N],r);if(H===1)return{span:ye,minWidth:A,height:R};ye.style.height=J(R),w.push(ye)}return{span:G(["katex-stretchy"],w,r),minWidth:A,height:R}}}var o=n(),i=o.span,s=o.minWidth,a=o.height;return i.height=a,i.style.height=J(a),s>0&&(i.style.minWidth=J(s)),i},QS=function(e,r,n,o,i){var s,a=e.height+e.depth+n+o;if(/fbox|color|angl/.test(r)){if(s=G(["katex-stretchy",r],[],i),r==="fbox"){var l=i.color&&i.getColor();l&&(s.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(r)&&c.push(new Id({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&c.push(new Id({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Hn(c,{width:"100%",height:J(a)});s=wo([],[u],i)}return s.height=a,s.style.height=J(a),s},eA=["bin","close","inner","open","punct","rel"],tA=["accent-token","mathord","op-token","spacing","textord"],rA=new Set(eA),nA=new Set(tA);function oA(t){return rA.has(t)}function Se(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Wc(t){var e=jc(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function jc(t){return t.type==="atom"||nA.has(t.type)?t:null}function $h(t,e,r){var n="";for(var o of t.body)if(o.type==="textord")n+=o.text;else if(r&&o.type==="spacing"&&o.text===" ")n+=" ";else throw new K(e,t);return n}var O7=t=>{if(t instanceof mr)return t;if(MS(t)&&t.children.length===1)return O7(t.children[0])},P7=(t,e)=>{var r,n,o;t&&t.type==="supsub"?(n=Se(t.base,"accent"),r=n.base,t.base=r,o=TS(Re(t,e)),t.base=n):(n=Se(t,"accent"),r=n.base);var i=Re(r,e.havingCrampedStyle()),s=n.isShifty&&Fn(r),a=0;if(s){var l,c;a=(l=(c=O7(i))==null?void 0:c.skew)!=null?l:0}var u=n.label==="\\c",d=u?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),h;if(n.isStretchy)h=Vc(n,e),h=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+J(2*a)+")",marginLeft:J(2*a)}:void 0}]});else{var p,g;n.label==="\\vec"?(p=A7("vec",e),g=S7.vec[1]):(p=qc({type:"textord",mode:n.mode,text:n.label},e),p=AS(p),p.italic=0,g=p.width,u&&(d+=p.depth)),h=G(["accent-body"],[p]);var y=n.label==="\\textcircled";y&&(h.classes.push("accent-full"),d=i.height);var v=a;y||(v-=g/2),h.style.left=J(v),n.label==="\\textcircled"&&(h.style.top=".2em"),h=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:h}]})}var w=G(["mord","katex-accent"],[h],e);return o?(o.children[0]=w,o.height=Math.max(w.height,o.height),o.classes[0]="mord",o):w},iA=(t,e)=>{var r=t.isStretchy?Fc(t.label):new Z("mo",[Ar(t.label,t.mode)]),n=new Z("mover",[je(t.base,e),r]);return n.setAttribute("accent","true"),n},sA=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));te({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(t,e)=>{var r=Ea(e[0]),n=!sA.test(t.funcName),o=!n||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:n,isShifty:o,base:r}},htmlBuilder:P7,mathmlBuilder:iA});te({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(t,e)=>{var r=e[0],n=t.parser.mode;return n==="math"&&(Qt({strict:t.parser.settings.strict,errorCode:"mathVsTextAccents",errorMsg:"LaTeX's accent "+t.funcName+" works only in text mode",report:!0}),n="text"),{type:"accent",mode:n,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}}});te({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"accentUnder",mode:r.mode,label:n,base:o}},htmlBuilder:(t,e)=>{var r=Re(t.base,e),n=Vc(t,e),o=t.label==="\\utilde"?.12:0,i=Be({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:r}]});return G(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var r=Fc(t.label),n=new Z("munder",[je(t.base,e),r]);return n.setAttribute("accentunder","true"),n}});var bl=t=>{var e=new Z("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};te({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(t,e,r){var n=t.parser,o=t.funcName;return{type:"xArrow",mode:n.mode,label:o,body:e[0],below:r[0]}},htmlBuilder(t,e){var r=e.style,n=e.havingStyle(r.sup()),o=Qi(Re(t.body,n,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";o.classes.push(i+"-arrow-pad");var s;t.below&&(n=e.havingStyle(r.sub()),s=Qi(Re(t.below,n,e),e),s.classes.push(i+"-arrow-pad"));var a=Vc(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(o.depth>.25||t.label==="\\xleftequilibrium")&&(c-=o.depth);var u;if(s){var d=-e.fontMetrics().axisHeight+s.height+.5*a.height+.111;u=Be({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:d}]})}else u=Be({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return G(["mrel","x-arrow"],[u],e)},mathmlBuilder(t,e){var r=Fc(t.label);r.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(t.body){var o=bl(je(t.body,e));if(t.below){var i=bl(je(t.below,e));n=new Z("munderover",[r,i,o])}else n=new Z("mover",[r,o])}else if(t.below){var s=bl(je(t.below,e));n=new Z("munder",[r,s])}else n=bl(),n=new Z("mover",[r,n]);return n}});function aA(t,e){var r=xt(t.body,e,!0);return G([t.mclass],r,e)}function lA(t,e){var r,n=yr(t.body,e);return t.mclass==="minner"?r=new Z("mpadded",n):t.mclass==="mord"?t.isCharacterBox?(r=n[0],r.type="mi"):r=new Z("mi",n):(t.isCharacterBox?(r=n[0],r.type="mo"):r=new Z("mo",n),t.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):t.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):(t.mclass==="mopen"||t.mclass==="mclose")&&(r.attributes.lspace="0em",r.attributes.rspace="0em")),r}te({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:ft(o),isCharacterBox:Fn(o)}},htmlBuilder:aA,mathmlBuilder:lA});var Uc=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};te({type:"mclass",names:["\\@binrel"],numArgs:2,handler(t,e){var r=t.parser;return{type:"mclass",mode:r.mode,mclass:Uc(e[0]),body:ft(e[1]),isCharacterBox:Fn(e[1])}}});te({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(t,e){var r=t.parser,n=t.funcName,o=e[1],i=e[0],s;n!=="\\stackrel"?s=Uc(o):s="mrel";var a={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:ft(o)},l=n==="\\underset"?{type:"supsub",mode:i.mode,base:a,sub:i}:{type:"supsub",mode:i.mode,base:a,sup:i};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:Fn(l)}}});te({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser;return{type:"pmb",mode:r.mode,mclass:Uc(e[0]),body:ft(e[0])}},htmlBuilder(t,e){var r=xt(t.body,e,!0),n=G([t.mclass],r,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(t,e){var r=yr(t.body,e),n=new Z("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var cA={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},g4=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),v4=t=>t.type==="textord"&&t.text==="@",uA=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function dA(t,e,r){var n=cA[t];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var o=r.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[i],[]),a=r.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[o,s,a]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function hA(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var r=t.fetch().text;if(r==="&"||r==="\\\\")t.consume();else if(r==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new K("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var n=[],o=[n],i=0;i<e.length;i++){for(var s=e[i],a=g4(),l=0;l<s.length;l++)if(!v4(s[l]))a.body.push(s[l]);else{n.push(a),l+=1;var c=Wc(s[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var h=!0,p=l+1;p<s.length;p++){if(uA(s[p],c)){h=!1,l=p;break}if(v4(s[p]))throw new K("Missing a "+c+" character to complete a CD arrow.",s[p]);u[d].body.push(s[p])}if(h)throw new K("Missing a "+c+" character to complete a CD arrow.",s[l])}else throw new K('Expected one of "<>AV=|." after @',s[l]);var g=dA(c,u,t),y={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};n.push(y),a=g4()}i%2===0?n.push(a):n.shift(),n=[],o.push(n)}t.gullet.endGroup(),t.gullet.endGroup();var v=new Array(o[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:o,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(o.length+1).fill([])}}te({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:e[0]}},htmlBuilder(t,e){var r=e.havingStyle(e.style.sup()),n=Qi(Re(t.label,r,e),e);return n.classes.push("cd-label-"+t.side),n.style.bottom=J(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(t,e){var r=new Z("mrow",[je(t.label,e)]);return r=new Z("mpadded",[r]),r.setAttribute("width","0"),t.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Z("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});te({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler(t,e){var r=t.parser;return{type:"cdlabelparent",mode:r.mode,fragment:e[0]}},htmlBuilder(t,e){var r=Qi(Re(t.fragment,e),e);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(t,e){return new Z("mrow",[je(t.fragment,e)])}});te({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser,n=Se(e[0],"ordgroup"),o=$h(n,"\\@char has non-numeric argument"),i=parseInt(o),s;if(isNaN(i))throw new K("\\@char has non-numeric argument "+o);if(i<0||i>1114111)throw new K("\\@char with invalid code point "+o);return i<=65535?s=String.fromCharCode(i):(i-=65536,s=String.fromCharCode((i>>10)+55296,(i&1023)+56320)),{type:"textord",mode:r.mode,text:s}}});var fA=(t,e)=>{var r=xt(t.body,e.withColor(t.color),!1);return Wn(r)},pA=(t,e)=>{var r=yr(t.body,e.withColor(t.color)),n=new Z("mstyle",r);return n.setAttribute("mathcolor",t.color),n};te({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(t,e){var r=t.parser,n=Se(e[0],"color-token").color,o=e[1];return{type:"color",mode:r.mode,color:n,body:ft(o)}},htmlBuilder:fA,mathmlBuilder:pA});te({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(t,e){var r=t.parser,n=t.breakOnTokenText,o=Se(e[0],"color-token").color;r.gullet.macros.set("\\current@color",o);var i=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:o,body:i}}});te({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(t){var e=t.parser,r=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,n=!e.settings.displayMode||!Qt({strict:e.settings.strict,errorCode:"newLineInDisplayMode",errorMsg:"In LaTeX, \\\\ or \\newline does nothing in display mode",report:!1});return{type:"cr",mode:e.mode,newLine:n,size:r&&Se(r,"size").value}},htmlBuilder(t,e){var r=G(["mspace"],[],e);return t.newLine&&(r.classes.push("katex-newline"),t.size&&(r.style.marginTop=J(ot(t.size,e)))),r},mathmlBuilder(t,e){var r=new Z("mspace");return t.newLine&&(r.setAttribute("linebreak","newline"),t.size&&r.setAttribute("height",J(ot(t.size,e)))),r}});var qd={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},D7=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new K("Expected a control sequence",t);return e},mA=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},B7=(t,e,r,n)=>{var o=t.gullet.macros.get(r.text);o==null&&(r.noexpand=!0,o={tokens:[r],numArgs:0,unexpandable:!t.gullet.isExpandable(r.text)}),t.gullet.macros.set(e,o,n)};te({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(t){var e=t.parser,r=t.funcName;e.consumeSpaces();var n=e.fetch();if(qd[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=qd[n.text]),Se(e.parseFunction(),"internal");throw new K("Invalid token after macro prefix",n)}});te({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=e.gullet.popToken(),o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new K("Expected a control sequence",n);for(var i=0,s,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){s=e.gullet.future(),a[i].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new K('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==i+1)throw new K('Argument number "'+n.text+'" out of order');i++,a.push([])}else{if(n.text==="EOF")throw new K("Expected a macro definition");a[i].push(n.text)}var l=e.gullet.consumeArg(),c=l.tokens;return s&&c.unshift(s),(r==="\\edef"||r==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(o,{tokens:c,numArgs:i,delimiters:a},r===qd[r]),{type:"internal",mode:e.mode}}});te({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=D7(e.gullet.popToken());e.gullet.consumeSpaces();var o=mA(e);return B7(e,n,o,r==="\\\\globallet"),{type:"internal",mode:e.mode}}});te({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=D7(e.gullet.popToken()),o=e.gullet.popToken(),i=e.gullet.popToken();return B7(e,n,i,r==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(o),{type:"internal",mode:e.mode}}});var Bs=function(e,r,n){var o=Qe.math[e]&&Qe.math[e].replace,i=Dh(o||e,r,n);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+r+".");return i},qh=function(e,r,n,o){var i=n.havingBaseStyle(r),s=G(o.concat(i.sizingClasses(n)),[e],n),a=i.sizeMultiplier/n.sizeMultiplier;return s.height*=a,s.depth*=a,s.maxFontSize=i.sizeMultiplier,s},z7=function(e,r,n){var o=r.havingBaseStyle(n),i=(1-r.sizeMultiplier/o.sizeMultiplier)*r.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=J(i),e.height-=i,e.depth+=i},gA=function(e,r,n,o,i,s){var a=Vt(e,"Main-Regular",i,o),l=qh(a,r,o,s);return z7(l,o,r),l},vA=function(e,r,n,o){return Vt(e,"Size"+r+"-Regular",n,o)},N7=function(e,r,n,o,i,s){var a=vA(e,r,i,o),l=qh(G(["delimsizing","size"+r],[a],o),ge.TEXT,o,s);return n&&z7(l,o,ge.TEXT),l},Du=function(e,r,n,o){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=G(["delimsizinginner",i],[G([],[Vt(e,r,n,o)])]);return{type:"elem",elem:s}},Bu=function(e,r,n){var o=an["Size4-Regular"][e.charCodeAt(0)]?an["Size4-Regular"][e.charCodeAt(0)][4]:an["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",bS(e,Math.round(1e3*r))),s=new Hn([i],{width:J(o),height:J(r),style:"width:"+J(o),viewBox:"0 0 "+1e3*o+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),a=wo([],[s],n);return a.height=r,a.style.height=J(r),a.style.width=J(o),{type:"elem",elem:a}},Fd=.008,wl={type:"kern",size:-1*Fd},yA=new Set(["|","\\lvert","\\rvert","\\vert"]),bA=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),H7=function(e,r,n,o,i,s){var a,l,c,u,d="",h=0;a=c=u=e,l=null;var p="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):yA.has(e)?(c="∣",d="vert",h=333):bA.has(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",u="⎣",p="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",u="⎦",p="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",u="⎣",p="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=u="⎢",p="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",u="⎦",p="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=u="⎥",p="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",u="⎝",p="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",u="⎠",p="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",p="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",p="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",u="⎩",c="⎪",p="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",u="⎭",c="⎪",p="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",u="⎭",c="⎪",p="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",u="⎩",c="⎪",p="Size4-Regular");var g=Bs(a,p,i),y=g.height+g.depth,v=Bs(c,p,i),w=v.height+v.depth,C=Bs(u,p,i),k=C.height+C.depth,A=0,I=1;if(l!==null){var R=Bs(l,p,i);A=R.height+R.depth,I=2}var H=y+k+A,O=Math.max(0,Math.ceil((r-H)/(I*w))),P=H+O*I*w,$=o.fontMetrics().axisHeight;n&&($*=o.sizeMultiplier);var ie=P/2-$,N=[];if(d.length>0){var ye=P-y-k,be=Math.round(P*1e3),Fe=wS(d,Math.round(ye*1e3)),ke=new bo(d,Fe),we=J(h/1e3),fe=J(be/1e3),rt=new Hn([ke],{width:we,height:fe,viewBox:"0 0 "+h+" "+be}),kt=wo([],[rt],o);kt.height=be/1e3,kt.style.width=we,kt.style.height=fe,N.push({type:"elem",elem:kt})}else{if(N.push(Du(u,p,i,o)),N.push(wl),l===null){var vt=P-y-k+2*Fd;N.push(Bu(c,vt,o))}else{var ut=(P-y-k-A)/2+2*Fd;N.push(Bu(c,ut,o)),N.push(wl),N.push(Du(l,p,i,o)),N.push(wl),N.push(Bu(c,ut,o))}N.push(wl),N.push(Du(a,p,i,o))}var Et=o.havingBaseStyle(ge.TEXT),jr=Be({positionType:"bottom",positionData:ie,children:N});return qh(G(["delimsizing","mult"],[jr],Et),ge.TEXT,o,s)},zu=80,Nu=.08,Hu=function(e,r,n,o,i){var s=yS(e,o,n),a=new bo(e,s),l=new Hn([a],{width:"400em",height:J(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return wo(["hide-tail"],[l],i)},wA=function(e,r){var n=r.havingBaseSizing(),o=W7("\\surd",e*n.sizeMultiplier,V7,n),i=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return o.type==="small"?(u=1e3+1e3*s+zu,e<1?i=1:e<1.4&&(i=.7),l=(1+s+Nu)/i,c=(1+s)/i,a=Hu("sqrtMain",l,u,s,r),a.style.minWidth="0.853em",d=.833/i):o.type==="large"?(u=(1e3+zu)*da[o.size],c=(da[o.size]+s)/i,l=(da[o.size]+s+Nu)/i,a=Hu("sqrtSize"+o.size,l,u,s,r),a.style.minWidth="1.02em",d=1/i):(l=e+s+Nu,c=e+s,u=Math.floor(1e3*e+s)+zu,a=Hu("sqrtTall",l,u,s,r),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=J(l),{span:a,advanceWidth:d,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*i}},$7=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),xA=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),q7=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),da=[0,1.2,1.8,2.4,3],F7=function(e,r,n,o,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),$7.has(e)||q7.has(e))return N7(e,r,!1,n,o,i);if(xA.has(e))return H7(e,da[r],!1,n,o,i);throw new K("Illegal delimiter: '"+e+"'")},CA=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],kA=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"stack"}],V7=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],_A=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var r=e.type;throw new Error("Add support for delim type '"+r+"' here.")},W7=function(e,r,n,o){for(var i=Math.min(2,3-o.style.size),s=i;s<n.length;s++){var a=n[s];if(a.type==="stack")break;var l=Bs(e,_A(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=o.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>r)return a}return n[n.length-1]},Vd=function(e,r,n,o,i,s){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;q7.has(e)?a=CA:$7.has(e)?a=V7:a=kA;var l=W7(e,r,a,o);return l.type==="small"?gA(e,l.style,n,o,i,s):l.type==="large"?N7(e,l.size,n,o,i,s):H7(e,r,n,o,i,s)},$u=function(e,r,n,o,i,s){var a=o.fontMetrics().axisHeight*o.sizeMultiplier,l=901,c=5/o.fontMetrics().ptPerEm,u=Math.max(r-a,n+a),d=Math.max(u/500*l,2*u-c);return Vd(e,d,!0,o,i,s)},y4={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},SA=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function b4(t){return"isMiddle"in t}function Gc(t,e){var r=jc(t);if(r&&SA.has(r.text))return r;throw r?new K("Invalid delimiter '"+r.text+"' after '"+e.funcName+"'",t):new K("Invalid delimiter type '"+t.type+"'",t)}te({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(t,e)=>{var r=Gc(Ea(e[0]),t);return{type:"delimsizing",mode:t.parser.mode,size:y4[t.funcName].size,mclass:y4[t.funcName].mclass,delim:r.text}},htmlBuilder:(t,e)=>t.delim==="."?G([t.mclass]):F7(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ar(t.delim,t.mode));var r=new Z("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=J(da[t.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function w4(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}te({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=t.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new K("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Gc(e[0],t).text,color:r}}});te({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=Gc(e[0],t),n=t.parser;++n.leftrightDepth;var o=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Se(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:o,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{w4(t);for(var r=xt(t.body,e,!0,["mopen","mclose"]),n=0,o=0,i=!1,s=0;s<r.length;s++){var a=r[s];b4(a)?i=!0:(n=Math.max(r[s].height,n),o=Math.max(r[s].depth,o))}n*=e.sizeMultiplier,o*=e.sizeMultiplier;var l;if(t.left==="."?l=Ia(e,["mopen"]):l=$u(t.left,n,o,e,t.mode,["mopen"]),r.unshift(l),i)for(var c=1;c<r.length;c++){var u=r[c];if(b4(u)){var d=u.isMiddle;r[c]=$u(d.delim,n,o,d.options,t.mode,[])}}var h;if(t.right===".")h=Ia(e,["mclose"]);else{var p=t.rightColor?e.withColor(t.rightColor):e;h=$u(t.right,n,o,p,t.mode,["mclose"])}return r.push(h),G(["minner"],r,e)},mathmlBuilder:(t,e)=>{w4(t);var r=yr(t.body,e);if(t.left!=="."){var n=new Z("mo",[Ar(t.left,t.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(t.right!=="."){var o=new Z("mo",[Ar(t.right,t.mode)]);o.setAttribute("fence","true"),t.rightColor&&o.setAttribute("mathcolor",t.rightColor),r.push(o)}return Nh(r)}});te({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=Gc(e[0],t);if(!t.parser.leftrightDepth)throw new K("\\middle without preceding \\left",r);return{type:"middle",mode:t.parser.mode,delim:r.text}},htmlBuilder:(t,e)=>{var r;return t.delim==="."?r=Ia(e,[]):(r=F7(t.delim,1,e,t.mode,[]),r.isMiddle={delim:t.delim,options:e}),r},mathmlBuilder:(t,e)=>{var r=t.delim==="\\vert"||t.delim==="|"?Ar("|","text"):Ar(t.delim,t.mode),n=new Z("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var AA=(t,e)=>{var r=Qi(Re(t.body,e),e),n=t.label.slice(1),o=e.sizeMultiplier,i,s,a=Fn(t.body);if(n==="sout")i=G(["katex-stretchy","katex-sout"]),i.height=e.fontMetrics().defaultRuleThickness/o,s=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=ot({number:.6,unit:"pt"},e),c=ot({number:.35,unit:"ex"},e),u=e.havingBaseSizing();o=o/u.sizeMultiplier;var d=r.height+r.depth+l+c;r.style.paddingLeft=J(d/2+l);var h=Math.floor(1e3*d*o),p=gS(h),g=new Hn([new bo("phase",p)],{width:"400em",height:J(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});i=wo(["hide-tail"],[g],e),i.style.height=J(d),s=r.depth+l+c}else{/cancel/.test(n)?a||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var y,v,w=0;/box/.test(n)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),y=e.fontMetrics().fboxsep+(n==="colorbox"?0:w),v=y):n==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),y=4*w,v=Math.max(0,.25-r.depth)):(y=a?.2:0,v=y),i=QS(r,n,y,v,e),/fbox|boxed|fcolorbox/.test(n)?(i.style.borderStyle="solid",i.style.borderWidth=J(w)):n==="angl"&&w!==.049&&(i.style.borderTopWidth=J(w),i.style.borderRightWidth=J(w)),s=r.depth+v,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var C;if(t.backgroundColor)C=Be({positionType:"individualShift",children:[{type:"elem",elem:i,shift:s},{type:"elem",elem:r,shift:0}]});else{var k=/cancel|phase/.test(n)?["svg-align"]:[];C=Be({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:i,shift:s,wrapperClasses:k}]})}return/cancel/.test(n)&&(C.height=r.height,C.depth=r.depth),/cancel/.test(n)&&!a?G(["mord","cancel-lap"],[C],e):G(["mord"],[C],e)},TA=(t,e)=>{var r,n=new Z(t.label.includes("colorbox")?"mpadded":"menclose",[je(t.body,e)]);switch(t.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),t.label==="\\fcolorbox"){var o=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+J(o)+" solid "+t.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&n.setAttribute("mathbackground",t.backgroundColor),n};te({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(t,e,r){var n=t.parser,o=t.funcName,i=Se(e[0],"color-token").color,s=e[1];return{type:"enclose",mode:n.mode,label:o,backgroundColor:i,body:s}},htmlBuilder:AA,mathmlBuilder:TA});te({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(t,e,r){var n=t.parser,o=t.funcName,i=Se(e[0],"color-token").color,s=Se(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:o,backgroundColor:s,borderColor:i,body:a}}});te({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler(t,e){var r=t.parser;return{type:"enclose",mode:r.mode,label:"\\fbox",body:e[0]}}});te({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}}});te({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName;r.mode==="math"&&Qt({strict:r.settings.strict,errorCode:"mathVsSout",errorMsg:"LaTeX's \\sout works only in text mode",report:!0});var o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}}});te({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler(t,e){var r=t.parser;return{type:"enclose",mode:r.mode,label:"\\angl",body:e[0]}}});var j7={};function yn(t){for(var e=t.type,r=t.names,n=t.props,o=t.handler,i=t.htmlBuilder,s=t.mathmlBuilder,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o},l=0;l<r.length;++l)j7[r[l]]=a;i&&(Ta[e]=i),s&&(Ma[e]=s)}var U7={};function x(t,e){U7[t]=e}class Jt{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Jt(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class pr{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new pr(r,Jt.range(this,e))}}function x4(t){var e=[];t.consumeSpaces();var r=t.fetch().text;for(r==="\\relax"&&(t.consume(),t.consumeSpaces(),r=t.fetch().text);r==="\\hline"||r==="\\hdashline";)t.consume(),e.push(r==="\\hdashline"),t.consumeSpaces(),r=t.fetch().text;return e}var Kc=t=>{var e=t.parser.settings;if(!e.displayMode)throw new K("{"+t.envName+"} can be used only in display mode.")},MA=new Set(["gather","gather*"]);function Fh(t){if(!t.includes("ed"))return!t.includes("*")}function Ao(t,e,r){var n=e.hskipBeforeAndAfter,o=e.addJot,i=e.cols,s=e.arraystretch,a=e.colSeparationType,l=e.autoTag,c=e.singleRow,u=e.emptySingleRow,d=e.maxNumCols,h=e.leqno;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=t.gullet.expandMacroAsText("\\arraystretch");if(p==null)s=1;else if(s=parseFloat(p),!s||s<0)throw new K("Invalid \\arraystretch: "+p)}t.gullet.beginGroup();var g=[],y=[g],v=[],w=[],C=l!=null?[]:void 0;function k(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function A(){C&&(t.gullet.macros.get("\\df@tag")?(C.push(t.subparse([new pr("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(k(),w.push(x4(t));;){var I=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var R={type:"ordgroup",mode:t.mode,body:I};r&&(R={type:"styling",mode:t.mode,style:r,resetFont:!0,body:[R]}),g.push(R);var H=t.fetch().text;if(H==="&"){if(d&&g.length===d){if(c||a)throw new K("Too many tab characters: &",t.nextToken);Qt({strict:t.settings.strict,errorCode:"textEnv",errorMsg:"Too few columns specified in the {array} column argument.",report:!0})}t.consume()}else if(H==="\\end"){A(),g.length===1&&R.type==="styling"&&R.body.length===1&&R.body[0].type==="ordgroup"&&R.body[0].body.length===0&&(y.length>1||!u)&&!Array.isArray(C?.[C.length-1])&&!(l&&C?.[C.length-1]===!0)&&y.pop(),w.length<y.length+1&&w.push([]);break}else if(H==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),v.push(O?O.value:null),A(),w.push(x4(t)),g=[],y.push(g),k()}else throw new K("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:o,arraystretch:s,body:y,cols:i,rowGaps:v,hskipBeforeAndAfter:n,hLinesBeforeRow:w,colSeparationType:a,tags:C,leqno:h}}function Vh(t){return t.slice(0,1)==="d"?"display":"text"}var bn=function(e,r){var n,o,i=e.body.length,s=e.hLinesBeforeRow,a=0,l=new Array(i),c=[],u=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),d=1/r.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var p=r.havingStyle(ge.SCRIPT).sizeMultiplier;h=.2778*(p/r.sizeMultiplier)}var g=e.colSeparationType==="CD"?ot({number:3,unit:"ex"},r):12*d,y=3*d,v=e.arraystretch*g,w=.7*v,C=.3*v,k=0;function A(We){for(var Ye=0;Ye<We.length;++Ye)Ye>0&&(k+=.25),c.push({pos:k,isDashed:We[Ye]})}for(A(s[0]),n=0;n<e.body.length;++n){var I=e.body[n],R=w,H=C;a<I.length&&(a=I.length);var O={cells:new Array(I.length),height:0,depth:0,pos:0};for(o=0;o<I.length;++o){var P=Re(I[o],r);H<P.depth&&(H=P.depth),R<P.height&&(R=P.height),O.cells[o]=P}var $=e.rowGaps[n],ie=0;$&&(ie=ot($,r),ie>0&&(ie+=C,H<ie&&(H=ie),ie=0)),e.addJot&&n<e.body.length-1&&(H+=y),O.height=R,O.depth=H,k+=R,O.pos=k,k+=H+ie,l[n]=O,A(s[n+1])}var N=k/2+r.fontMetrics().axisHeight,ye=e.cols||[],be=[],Fe,ke,we=[];if(e.tags&&e.tags.some(We=>We))for(n=0;n<i;++n){var fe=l[n],rt=fe.pos-N,kt=e.tags[n],vt=void 0;kt===!0?vt=G(["eqn-num"],[],r):kt===!1?vt=G([],[],r):vt=G([],xt(kt,r,!0),r),vt.depth=fe.depth,vt.height=fe.height,we.push({type:"elem",elem:vt,shift:rt})}for(o=0,ke=0;o<a||ke<ye.length;++o,++ke){for(var ut,Et=ye[ke],jr=!0;((Mo=Et)==null?void 0:Mo.type)==="separator";){var Mo;if(jr||(Fe=G(["arraycolsep"],[]),Fe.style.width=J(r.fontMetrics().doubleRuleSep),be.push(Fe)),Et.separator==="|"||Et.separator===":"){var Ur=Et.separator==="|"?"solid":"dashed",Zt=G(["vertical-separator"],[],r);Zt.style.height=J(k),Zt.style.borderRightWidth=J(u),Zt.style.borderRightStyle=Ur,Zt.style.margin="0 "+J(-u/2);var jn=k-N;jn&&(Zt.style.verticalAlign=J(-jn)),be.push(Zt)}else throw new K("Invalid separator type: "+Et.separator);ke++,Et=ye[ke],jr=!1}if(!(o>=a)){var Ht=void 0;if(o>0||e.hskipBeforeAndAfter){var fi,_;Ht=(fi=(_=Et)==null?void 0:_.pregap)!=null?fi:h,Ht!==0&&(Fe=G(["arraycolsep"],[]),Fe.style.width=J(Ht),be.push(Fe))}var E=[];for(n=0;n<i;++n){var B=l[n],j=B.cells[o];if(j){var F=B.pos-N;j.depth=B.depth,j.height=B.height,E.push({type:"elem",elem:j,shift:F})}}var W=Be({positionType:"individualShift",children:E}),Q=G(["col-align-"+(((ut=Et)==null?void 0:ut.align)||"c")],[W]);if(be.push(Q),o<a-1||e.hskipBeforeAndAfter){var Y,X;Ht=(Y=(X=Et)==null?void 0:X.postgap)!=null?Y:h,Ht!==0&&(Fe=G(["arraycolsep"],[]),Fe.style.width=J(Ht),be.push(Fe))}}}var q=G(["mtable"],be);if(c.length>0){for(var ae=Ji("katex-hline",r,u),ee=Ji("katex-hdashline",r,u),se=[{type:"elem",elem:q,shift:0}];c.length>0;){var ue=c.pop(),_e=ue.pos-N;ue.isDashed?se.push({type:"elem",elem:ee,shift:_e}):se.push({type:"elem",elem:ae,shift:_e})}q=Be({positionType:"individualShift",children:se})}if(we.length===0)return G(["mord"],[q],r);var Le=Be({positionType:"individualShift",children:we}),Ee=G(["katex-tag"],[Le],r);return Wn([q,Ee])},EA={c:"center ",l:"left ",r:"right "},wn=function(e,r){for(var n=[],o=new Z("mtd",[],["mtr-glue"]),i=new Z("mtd",[],["mml-eqn-num"]),s=0;s<e.body.length;s++){for(var a=e.body[s],l=[],c=0;c<a.length;c++)l.push(new Z("mtd",[je(a[c],r)]));e.tags&&e.tags[s]&&(l.unshift(o),l.push(o),e.leqno?l.unshift(i):l.push(i)),n.push(new Z("mtr",l))}var u=new Z("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",J(d));var h="",p="";if(e.cols&&e.cols.length>0){var g=e.cols,y="",v=!1,w=0,C=g.length;g[0].type==="separator"&&(h+="top ",w=1),g[g.length-1].type==="separator"&&(h+="bottom ",C-=1);for(var k=w;k<C;k++){var A=g[k];A.type==="align"?(p+=EA[A.align],v&&(y+="none "),v=!0):A.type==="separator"&&v&&(y+=A.separator==="|"?"solid ":"dashed ",v=!1)}u.setAttribute("columnalign",p.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(e.colSeparationType==="align"){for(var I=e.cols||[],R="",H=1;H<I.length;H++)R+=H%2?"0em ":"1em ";u.setAttribute("columnspacing",R.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var O="",P=e.hLinesBeforeRow;h+=P[0].length>0?"left ":"",h+=P[P.length-1].length>0?"right ":"";for(var $=1;$<P.length-1;$++)O+=P[$].length===0?"none ":P[$][0]?"dashed ":"solid ";return/[sd]/.test(O)&&u.setAttribute("rowlines",O.trim()),h!==""&&(u=new Z("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new Z("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},G7=function(e,r){e.envName.includes("ed")||Kc(e);var n=[],o=e.envName==="split",i=Ao(e.parser,{cols:n,addJot:!0,autoTag:o?void 0:Fh(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,a=0,l={type:"ordgroup",mode:e.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){var c="Number of columns should be a positive integer",u=$h(r[0],c);if(!/^[0-9]+$/.test(u)||Number(u)<1)throw new K(c,r[0]);s=Number(u),a=s*2}var d=!a;i.body.forEach(function(y){for(var v=1;v<y.length;v+=2){var w=Se(y[v],"styling"),C=Se(w.body[0],"ordgroup");C.body.unshift(l)}if(d)a<y.length&&(a=y.length);else{var k=y.length/2;if(s<k)throw new K("Too many math in a row: "+("expected "+s+", but got "+k),y[0])}});for(var h=0;h<a;++h){var p="r",g=0;h%2===1?p="l":h>0&&d&&(g=1),n[h]={type:"align",align:p,pregap:g,postgap:0}}return i.colSeparationType=d?"align":"alignat",i};yn({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var r=jc(e[0]),n=r?[e[0]]:Se(e[0],"ordgroup").body,o=n.map(function(s){var a=Wc(s),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new K("Unknown column alignment: "+l,s)}),i={cols:o,hskipBeforeAndAfter:!0,maxNumCols:o.length};return Ao(t.parser,i,Vh(t.envName))},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(t.envName.charAt(t.envName.length-1)==="*"){var o=t.parser;if(o.consumeSpaces(),o.fetch().text==="["){if(o.consume(),o.consumeSpaces(),r=o.fetch().text,!"lcr".includes(r))throw new K("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),n.cols=[{type:"align",align:r}]}}var i=Ao(t.parser,n,Vh(t.envName)),s=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(s).fill({type:"align",align:r}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},r=Ao(t.parser,e,"script");return r.colSeparationType="small",r},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var r=jc(e[0]),n=r?[e[0]]:Se(e[0],"ordgroup").body,o=n.map(function(a){var l=Wc(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new K("Unknown column alignment: "+c,a)});if(o.length>1)throw new K("{subarray} can contain only one column");var i={cols:o,hskipBeforeAndAfter:!1,arraystretch:.5},s=Ao(t.parser,i,"script");if(s.body.length>0&&s.body[0].length>1)throw new K("{subarray} can contain only one column");return s},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Ao(t.parser,e,Vh(t.envName));return{type:"leftright",mode:t.mode,body:[r],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:G7,htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){MA.has(t.envName)&&Kc(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Fh(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Ao(t.parser,e,"display")},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:G7,htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Kc(t);var e={autoTag:Fh(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Ao(t.parser,e,"display")},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Kc(t),hA(t.parser)},htmlBuilder:bn,mathmlBuilder:wn});x("\\nonumber","\\gdef\\@eqnsw{0}");x("\\notag","\\nonumber");te({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(t,e){throw new K(t.funcName+" valid only within array environment")}});var C4=j7;te({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(t,e){var r=t.parser,n=t.funcName,o=e[0];if(o.type!=="ordgroup")throw new K("Invalid environment name",o);var i=$h(o,"Environment name should contain only text characters and spaces",!0);if(n==="\\begin"){if(!Object.prototype.hasOwnProperty.call(C4,i))throw new K("No such environment: "+i,o);var s=C4[i],a=r.parseArguments("\\begin{"+i+"}",s),l=a.args,c=a.optArgs,u={mode:r.mode,envName:i,parser:r},d=s.handler(u,l,c);r.expect("\\end",!1);var h=r.nextToken,p=Se(r.parseFunction(),"environment");if(p.name!==i)throw new K("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",h);return d}return{type:"environment",mode:r.mode,name:i,nameGroup:o}}});var IA=(t,e)=>{var r=t.font,n=e.withFont(r);return Re(t.body,n)},LA=(t,e)=>{var r=t.font,n=e.withFont(r);return je(t.body,n)},k4={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};te({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=Ea(e[0]),i=n in k4?k4[n]:n;return{type:"font",mode:r.mode,font:i.slice(1),body:o}},htmlBuilder:IA,mathmlBuilder:LA});te({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"mclass",mode:r.mode,mclass:Uc(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:Fn(n)}}});te({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=t.breakOnTokenText,i=r.mode,s=r.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}}});var RA=(t,e)=>{var r=e.style,n=r.fracNum(),o=r.fracDen(),i;i=e.havingStyle(n);var s=Re(t.numer,i,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;s.height=s.height<a?a:s.height,s.depth=s.depth<l?l:s.depth}i=e.havingStyle(o);var c=Re(t.denom,i,e),u,d,h;t.hasBarLine?(t.barSize?(d=ot(t.barSize,e),u=Ji("frac-line",e,d)):u=Ji("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var p,g,y;r.size===ge.DISPLAY.size?(p=e.fontMetrics().num1,d>0?g=3*h:g=7*h,y=e.fontMetrics().denom1):(d>0?(p=e.fontMetrics().num2,g=h):(p=e.fontMetrics().num3,g=3*h),y=e.fontMetrics().denom2);var v;if(u){var C=e.fontMetrics().axisHeight;p-s.depth-(C+.5*d)<g&&(p+=g-(p-s.depth-(C+.5*d))),C-.5*d-(c.height-y)<g&&(y+=g-(C-.5*d-(c.height-y)));var k=-(C-.5*d);v=Be({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:k},{type:"elem",elem:s,shift:-p}]})}else{var w=p-s.depth-(c.height-y);w<g&&(p+=.5*(g-w),y+=.5*(g-w)),v=Be({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:s,shift:-p}]})}i=e.havingStyle(r),v.height*=i.sizeMultiplier/e.sizeMultiplier,v.depth*=i.sizeMultiplier/e.sizeMultiplier;var A;r.size===ge.DISPLAY.size?A=e.fontMetrics().delim1:r.size===ge.SCRIPTSCRIPT.size?A=e.havingStyle(ge.SCRIPT).fontMetrics().delim2:A=e.fontMetrics().delim2;var I,R;return t.leftDelim==null?I=Ia(e,["mopen"]):I=Vd(t.leftDelim,A,!0,e.havingStyle(r),t.mode,["mopen"]),t.continued?R=G([]):t.rightDelim==null?R=Ia(e,["mclose"]):R=Vd(t.rightDelim,A,!0,e.havingStyle(r),t.mode,["mclose"]),G(["mord"].concat(i.sizingClasses(e)),[I,G(["mfrac"],[v]),R],e)},OA=(t,e)=>{var r=new Z("mfrac",[je(t.numer,e),je(t.denom,e)]);if(!t.hasBarLine)r.setAttribute("linethickness","0px");else if(t.barSize){var n=ot(t.barSize,e);r.setAttribute("linethickness",J(n))}if(t.leftDelim!=null||t.rightDelim!=null){var o=[];if(t.leftDelim!=null){var i=new Z("mo",[new pt(t.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),o.push(i)}if(o.push(r),t.rightDelim!=null){var s=new Z("mo",[new pt(t.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),o.push(s)}return Nh(o)}return r},K7=(t,e)=>{if(!e)return t;var r={type:"styling",mode:t.mode,style:e,body:[t]};return r};te({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0],i=e[1],s,a=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,a="(",l=")";break;case"\\\\bracefrac":s=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=n==="\\cfrac",u=null;return c||n.startsWith("\\d")?u="display":n.startsWith("\\t")&&(u="text"),K7({type:"genfrac",mode:r.mode,numer:o,denom:i,continued:c,hasBarLine:s,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:RA,mathmlBuilder:OA});te({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(t){var e=t.parser,r=t.funcName,n=t.token,o;switch(r){case"\\over":o="\\frac";break;case"\\choose":o="\\binom";break;case"\\atop":o="\\\\atopfrac";break;case"\\brace":o="\\\\bracefrac";break;case"\\brack":o="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:o,token:n}}});var _4=["display","text","script","scriptscript"],S4=function(e){var r=null;return e.length>0&&(r=e,r=r==="."?null:r),r};te({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(t,e){var r=t.parser,n=e[4],o=e[5],i=Ea(e[0]),s=i.type==="atom"&&i.family==="open"?S4(i.text):null,a=Ea(e[1]),l=a.type==="atom"&&a.family==="close"?S4(a.text):null,c=Se(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h=null,p=e[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Se(p.body[0],"textord");h=_4[Number(g.text)]}}else p=Se(p,"textord"),h=_4[Number(p.text)];return K7({type:"genfrac",mode:r.mode,numer:n,denom:o,continued:!1,hasBarLine:u,barSize:d,leftDelim:s,rightDelim:l},h)}});te({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(t,e){var r=t.parser;t.funcName;var n=t.token;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Se(e[0],"size").value,token:n}}});te({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(t,e)=>{var r=t.parser;t.funcName;var n=e[0],o=Se(e[1],"infix").size;if(!o)throw new Error("\\\\abovefrac expected size, but got "+String(o));var i=e[2],s=o.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:s,barSize:o,leftDelim:null,rightDelim:null}}});var Z7=(t,e)=>{var r=e.style,n,o;t.type==="supsub"?(n=t.sup?Re(t.sup,e.havingStyle(r.sup()),e):Re(t.sub,e.havingStyle(r.sub()),e),o=Se(t.base,"horizBrace")):o=Se(t,"horizBrace");var i=Re(o.base,e.havingBaseStyle(ge.DISPLAY)),s=Vc(o,e),a;if(o.isOver?a=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):a=Be({positionType:"bottom",positionData:i.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),n){var l=G(["minner",o.isOver?"mover":"munder"],[a],e);o.isOver?a=Be({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):a=Be({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return G(["minner",o.isOver?"mover":"munder"],[a],e)},PA=(t,e)=>{var r=Fc(t.label);return new Z(t.isOver?"mover":"munder",[je(t.base,e),r])};te({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:Z7,mathmlBuilder:PA});te({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[1],o=Se(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:r.mode,href:o,body:ft(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var r=xt(t.body,e,!1);return BS(t.href,[],r,e)},mathmlBuilder:(t,e)=>{var r=xo(t.body,e);return r instanceof Z||(r=new Z("mrow",[r])),r.setAttribute("href",t.href),r}});te({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=Se(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var o=[],i=0;i<n.length;i++){var s=n[i];s==="~"&&(s="\\textasciitilde"),o.push({type:"textord",mode:"text",text:s})}var a={type:"text",mode:r.mode,font:"\\texttt",body:o};return{type:"href",mode:r.mode,href:n,body:ft(a)}}});te({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler(t,e){var r=t.parser;return{type:"hbox",mode:r.mode,body:ft(e[0])}},htmlBuilder(t,e){var r=xt(t.body,e.withFont(""),!1);return Wn(r)},mathmlBuilder(t,e){return new Z("mrow",yr(t.body,e.withFont("")))}});te({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName;t.token;var o=Se(e[0],"raw").string,i=e[1];r.settings.strict&&Qt({strict:r.settings.strict,errorCode:"htmlExtension",errorMsg:"HTML extension is disabled on strict mode",report:!0});var s,a={};switch(n){case"\\htmlClass":a.class=o,s={command:"\\htmlClass",class:o};break;case"\\htmlId":a.id=o,s={command:"\\htmlId",id:o};break;case"\\htmlStyle":a.style=o,s={command:"\\htmlStyle",style:o};break;case"\\htmlData":{for(var l="{,}",c=[],u="",d=0;d<o.length;d++)o.startsWith(l,d)?(u+=",",d+=l.length-1):o[d]===","?(c.push(u),u=""):u+=o[d];c.push(u);for(var h=0;h<c.length;h++){var p=c[h],g=p.indexOf("=");if(g<0)throw new K("\\htmlData key/value '"+p+"' missing equals sign");var y=p.slice(0,g),v=p.slice(g+1);a["data-"+y.trim()]=v}s={command:"\\htmlData",attributes:a};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(s)?{type:"html",mode:r.mode,attributes:a,body:ft(i)}:r.formatUnsupportedCmd(n)},htmlBuilder:(t,e)=>{var r=xt(t.body,e,!1),n=["enclosing"];t.attributes.class&&n.push(...t.attributes.class.trim().split(/\s+/));var o=G(n,r,e);for(var i of Object.entries(t.attributes)){var s=i[0],a=i[1];s!=="class"&&o.setAttribute(s,a)}return o},mathmlBuilder:(t,e)=>xo(t.body,e)});te({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(t,e)=>{var r=t.parser;return{type:"htmlmathml",mode:r.mode,html:ft(e[0]),mathml:ft(e[1])}},htmlBuilder:(t,e)=>{var r=xt(t.html,e,!1);return Wn(r)},mathmlBuilder:(t,e)=>xo(t.mathml,e)});var qu=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!r)throw new K("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!y7(n))throw new K("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};te({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(t,e,r)=>{var n=t.parser,o={number:0,unit:"em"},i={number:.9,unit:"em"},s={number:0,unit:"em"},a="";if(r[0])for(var l=Se(r[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":a=h;break;case"width":o=qu(h);break;case"height":i=qu(h);break;case"totalheight":s=qu(h);break;default:throw new K("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var p=Se(e[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:n.mode,alt:a,width:o,height:i,totalheight:s,src:p}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var r=ot(t.height,e),n=0;t.totalheight.number>0&&(n=ot(t.totalheight,e)-r);var o=0;t.width.number>0&&(o=ot(t.width,e));var i={height:J(r+n)};o>0&&(i.width=J(o)),n>0&&(i.verticalAlign=J(-n));var s=new _S(t.src,t.alt,i);return s.height=r,s.depth=n,s},mathmlBuilder:(t,e)=>{var r=new Z("mglyph",[]);r.setAttribute("alt",t.alt);var n=ot(t.height,e),o=0;if(t.totalheight.number>0&&(o=ot(t.totalheight,e)-n,r.setAttribute("valign",J(-o))),r.setAttribute("height",J(n+o)),t.width.number>0){var i=ot(t.width,e);r.setAttribute("width",J(i))}return r.setAttribute("src",t.src),r}});te({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName,o=Se(e[0],"size");if(r.settings.strict){var i=n[1]==="m",s=o.value.unit==="mu";i?(s||Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" supports only mu units, "+("not "+o.value.unit+" units"),report:!0}),r.mode!=="math"&&Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" works only in math mode",report:!0})):s&&Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" doesn't support mu units",report:!0})}return{type:"kern",mode:r.mode,dimension:o.value}},htmlBuilder(t,e){return _7(t.dimension,e)},mathmlBuilder(t,e){var r=ot(t.dimension,e);return new I7(r)}});te({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:o}},htmlBuilder:(t,e)=>{var r;t.alignment==="clap"?(r=G([],[Re(t.body,e)]),r=G(["katex-inner"],[r],e)):r=G(["katex-inner"],[Re(t.body,e)]);var n=G(["katex-fix"],[]),o=G([t.alignment],[r,n],e),i=G(["katex-strut"]);return i.style.height=J(o.height+o.depth),o.depth&&(i.style.verticalAlign=J(-o.depth)),o.children.unshift(i),o=G(["katex-thinbox"],[o],e),G(["mord","katex-vbox"],[o],e)},mathmlBuilder:(t,e)=>{var r=new Z("mpadded",[je(t.body,e)]);if(t.alignment!=="rlap"){var n=t.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});te({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){var r=t.funcName,n=t.parser,o=n.mode;n.switchMode("math");var i=r==="\\("?"\\)":"$",s=n.parseExpression(!1,i);return n.expect(i),n.switchMode(o),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});te({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){throw new K("Mismatched "+t.funcName)}});var A4=(t,e)=>{switch(e.style.size){case ge.DISPLAY.size:return t.display;case ge.TEXT.size:return t.text;case ge.SCRIPT.size:return t.script;case ge.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};te({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(t,e)=>{var r=t.parser;return{type:"mathchoice",mode:r.mode,display:ft(e[0]),text:ft(e[1]),script:ft(e[2]),scriptscript:ft(e[3])}},htmlBuilder:(t,e)=>{var r=A4(t,e),n=xt(r,e,!1);return Wn(n)},mathmlBuilder:(t,e)=>{var r=A4(t,e);return xo(r,e)}});var X7=(t,e,r,n,o,i,s)=>{t=G([],[t]);var a=r&&Fn(r),l,c;if(e){var u=Re(e,n.havingStyle(o.sup()),n);c={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var d=Re(r,n.havingStyle(o.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+s;h=Be({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:J(-i)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:J(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var g=t.height-s;h=Be({positionType:"top",positionData:g,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:J(-i)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var y=t.depth+s;h=Be({positionType:"bottom",positionData:y,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:J(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return t;var v=[h];if(l&&i!==0&&!a){var w=G(["mspace"],[],n);w.style.marginRight=J(i),v.unshift(w)}return G(["mop","op-limits"],v,n)},Y7=new Set(["\\smallint"]),J7=(t,e)=>{var r,n,o=!1,i;t.type==="supsub"?(r=t.sup,n=t.sub,i=Se(t.base,"op"),o=!0):i=Se(t,"op");var s=e.style,a=!1;s.size===ge.DISPLAY.size&&i.symbol&&!Y7.has(i.name)&&(a=!0);var l,c;if(i.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Vt(i.name,u,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var h=A7(d+"Size"+(a?"2":"1"),e);l=Be({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:a?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var p=xt(i.body,e,!0);p.length===1&&p[0]instanceof mr?(l=p[0],l.classes[0]="mop"):l=G(["mop"],p,e)}else{for(var g=[],y=1;y<i.name.length;y++)g.push(Bh(i.name[y],i.mode,e));l=G(["mop"],g,e)}var v=0,w=0;if((l instanceof mr||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var C;v=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=(C=l.italic)!=null?C:0}return o?X7(l,r,n,e,s,w,v):(v&&(l.style.position="relative",l.style.top=J(v)),l)},DA=(t,e)=>{var r;if(t.symbol)r=new Z("mo",[Ar(t.name,t.mode)]),Y7.has(t.name)&&r.setAttribute("largeop","false");else if(t.body)r=new Z("mo",yr(t.body,e));else{r=new Z("mi",[new pt(t.name.slice(1))]);var n=new Z("mo",[Ar("⁡","text")]);t.parentIsSupSub?r=new Z("mrow",[r,n]):r=E7([r,n])}return r},BA={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};te({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=n;return o.length===1&&(o=BA[o]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:J7,mathmlBuilder:DA});te({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ft(n)}}});var zA={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};te({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(t){var e=t.parser,r=t.funcName;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}}});te({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(t){var e=t.parser,r=t.funcName;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}}});te({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(t){var e=t.parser,r=t.funcName,n=r;return n.length===1&&(n=zA[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}}});var Q7=(t,e)=>{var r,n,o=!1,i;t.type==="supsub"?(r=t.sup,n=t.sub,i=Se(t.base,"operatorname"),o=!0):i=Se(t,"operatorname");var s;if(i.body.length>0){for(var a=i.body.map(d=>{var h="text"in d?d.text:void 0;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=xt(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof mr&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=G(["mop"],l,e)}else s=G(["mop"],[],e);return o?X7(s,r,n,e,e.style,0,0):s},NA=(t,e)=>{for(var r=yr(t.body,e.withFont("mathrm")),n=!0,o=0;o<r.length;o++){var i=r[o];if(!(i instanceof I7))if(i instanceof Z)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var s=i.children[0];i.children.length===1&&s instanceof pt?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=r.map(u=>u.toText()).join("");r=[new pt(a)]}var l=new Z("mi",r);l.setAttribute("mathvariant","normal");var c=new Z("mo",[Ar("⁡","text")]);return t.parentIsSupSub?new Z("mrow",[l,c]):E7([l,c])};te({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"operatorname",mode:r.mode,body:ft(o),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Q7,mathmlBuilder:NA});x("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");di({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Wn(xt(t.body,e,!1)):G(["mord"],xt(t.body,e,!0),e)},mathmlBuilder(t,e){return xo(t.body,e,!0)}});te({type:"overline",names:["\\overline"],numArgs:1,handler(t,e){var r=t.parser,n=e[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(t,e){var r=Re(t.body,e.havingCrampedStyle()),n=Ji("overline-line",e),o=e.fontMetrics().defaultRuleThickness,i=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n},{type:"kern",size:o}]});return G(["mord","katex-overline"],[i],e)},mathmlBuilder(t,e){var r=new Z("mo",[new pt("‾")]);r.setAttribute("stretchy","true");var n=new Z("mover",[je(t.body,e),r]);return n.setAttribute("accent","true"),n}});te({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"phantom",mode:r.mode,body:ft(n)}},htmlBuilder:(t,e)=>{var r=xt(t.body,e.withPhantom(),!1);return Wn(r)},mathmlBuilder:(t,e)=>{var r=yr(t.body,e);return new Z("mphantom",r)}});x("\\hphantom","\\smash{\\phantom{#1}}");te({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(t,e)=>{var r=G(["katex-inner"],[Re(t.body,e.withPhantom())]),n=G(["katex-fix"],[]);return G(["mord","rlap"],[r,n],e)},mathmlBuilder:(t,e)=>{var r=yr(ft(t.body),e),n=new Z("mphantom",r),o=new Z("mpadded",[n]);return o.setAttribute("width","0px"),o}});te({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(t,e){var r=t.parser,n=Se(e[0],"size").value,o=e[1];return{type:"raisebox",mode:r.mode,dy:n,body:o}},htmlBuilder(t,e){var r=Re(t.body,e),n=ot(t.dy,e);return Be({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new Z("mpadded",[je(t.body,e)]),n=t.dy.number+t.dy.unit;return r.setAttribute("voffset",n),r}});var e6=(t,e)=>{var r=t.parser;return{type:"reflectbox",mode:r.mode,body:e[0]}};te({type:"reflectbox",names:["\\reflectbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:e6,htmlBuilder(t,e){return G(["mord","reflectbox"],[Re(t.body,e)],e)},mathmlBuilder(t,e){return je(t.body,e)}});te({type:"reflectbox",names:["\\mathreflectbox"],numArgs:1,argTypes:["math"],handler:e6});te({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(t){var e=t.parser;return{type:"internal",mode:e.mode}}});te({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(t,e,r){var n=t.parser,o=r[0],i=Se(e[0],"size"),s=Se(e[1],"size");return{type:"rule",mode:n.mode,shift:o&&Se(o,"size").value,width:i.value,height:s.value}},htmlBuilder(t,e){var r=G(["mord","katex-rule"],[],e),n=ot(t.width,e),o=ot(t.height,e),i=t.shift?ot(t.shift,e):0;return r.style.borderRightWidth=J(n),r.style.borderTopWidth=J(o),r.style.bottom=J(i),r.width=n,r.height=o+i,r.depth=-i,r.maxFontSize=o*1.125*e.sizeMultiplier,r},mathmlBuilder(t,e){var r=ot(t.width,e),n=ot(t.height,e),o=t.shift?ot(t.shift,e):0,i=e.color&&e.getColor()||"black",s=new Z("mspace");s.setAttribute("mathbackground",i),s.setAttribute("width",J(r)),s.setAttribute("height",J(n));var a=new Z("mpadded",[s]);return o>=0?a.setAttribute("height",J(o)):(a.setAttribute("height",J(o)),a.setAttribute("depth",J(-o))),a.setAttribute("voffset",J(o)),a}});function t6(t,e,r){for(var n=xt(t,e,!1),o=e.sizeMultiplier/r.sizeMultiplier,i=0;i<n.length;i++){var s=n[i].classes.indexOf("katex-sizing");s<0?Array.prototype.push.apply(n[i].classes,e.sizingClasses(r)):n[i].classes[s+1]==="reset-size"+e.size&&(n[i].classes[s+1]="reset-size"+r.size),n[i].height*=o,n[i].depth*=o}return Wn(n)}var T4=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],HA=(t,e)=>{var r=e.havingSize(t.size);return t6(t.body,r,e)};te({type:"sizing",names:T4,numArgs:0,allowedInText:!0,handler:(t,e)=>{var r=t.breakOnTokenText,n=t.funcName,o=t.parser,i=o.parseExpression(!1,r);return{type:"sizing",mode:o.mode,size:T4.indexOf(n)+1,body:i}},htmlBuilder:HA,mathmlBuilder:(t,e)=>{var r=e.havingSize(t.size),n=yr(t.body,r),o=new Z("mstyle",n);return o.setAttribute("mathsize",J(r.sizeMultiplier)),o}});te({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(t,e,r)=>{var n=t.parser,o=!1,i=!1,s=r[0]&&Se(r[0],"ordgroup");if(s)for(var a,l=0;l<s.body.length;++l){var c=s.body[l];if(a=Wc(c).text,a==="t")o=!0;else if(a==="b")i=!0;else{o=!1,i=!1;break}}else o=!0,i=!0;var u=e[0];return{type:"smash",mode:n.mode,body:u,smashHeight:o,smashDepth:i}},htmlBuilder:(t,e)=>{var r=G([],[Re(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return r;if(t.smashHeight&&(r.height=0),t.smashDepth&&(r.depth=0),t.smashHeight&&t.smashDepth)return G(["mord","katex-smash"],[r],e);if(r.children)for(var n=0;n<r.children.length;n++)t.smashHeight&&(r.children[n].height=0),t.smashDepth&&(r.children[n].depth=0);var o=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r}]});return G(["mord"],[o],e)},mathmlBuilder:(t,e)=>{var r=new Z("mpadded",[je(t.body,e)]);return t.smashHeight&&r.setAttribute("height","0px"),t.smashDepth&&r.setAttribute("depth","0px"),r}});te({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(t,e,r){var n=t.parser,o=r[0],i=e[0];return{type:"sqrt",mode:n.mode,body:i,index:o}},htmlBuilder(t,e){var r=Re(t.body,e.havingCrampedStyle());r.height===0&&(r.height=e.fontMetrics().xHeight),r=Qi(r,e);var n=e.fontMetrics(),o=n.defaultRuleThickness,i=o;e.style.id<ge.TEXT.id&&(i=e.fontMetrics().xHeight);var s=o+i/4,a=r.height+r.depth+s+o,l=wA(a,e),c=l.span,u=l.ruleWidth,d=l.advanceWidth,h=c.height-u;h>r.height+r.depth+s&&(s=(s+h-r.height-r.depth)/2);var p=c.height-r.height-s-u;r.style.paddingLeft=J(d);var g=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+p)},{type:"elem",elem:c},{type:"kern",size:u}]});if(t.index){var y=e.havingStyle(ge.SCRIPTSCRIPT),v=Re(t.index,y,e),w=.6*(g.height-g.depth),C=Be({positionType:"shift",positionData:-w,children:[{type:"elem",elem:v}]}),k=G(["katex-root"],[C]);return G(["mord","sqrt"],[k,g],e)}else return G(["mord","sqrt"],[g],e)},mathmlBuilder(t,e){var r=t.body,n=t.index;return n?new Z("mroot",[je(r,e),je(n,e)]):new Z("msqrt",[je(r,e)])}});var Wd={display:ge.DISPLAY,text:ge.TEXT,script:ge.SCRIPT,scriptscript:ge.SCRIPTSCRIPT};function $A(t){return t in Wd}te({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(t,e){var r=t.breakOnTokenText,n=t.funcName,o=t.parser,i=o.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!$A(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:o.mode,style:s,body:i}},htmlBuilder(t,e){var r=Wd[t.style],n=e.havingStyle(r);return t.resetFont&&(n=n.withFont("")),t6(t.body,n,e)},mathmlBuilder(t,e){var r=Wd[t.style],n=e.havingStyle(r);t.resetFont&&(n=n.withFont(""));var o=yr(t.body,n),i=new Z("mstyle",o),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=s[t.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var qA=function(e,r){var n=e.base;if(n)if(n.type==="op"){var o=n.limits&&(r.style.size===ge.DISPLAY.size||n.alwaysHandleSupSub);return o?J7:null}else if(n.type==="operatorname"){var i=n.alwaysHandleSupSub&&(r.style.size===ge.DISPLAY.size||n.limits);return i?Q7:null}else{if(n.type==="accent")return Fn(n.base)?P7:null;if(n.type==="horizBrace"){var s=!e.sub;return s===n.isOver?Z7:null}else return null}else return null};di({type:"supsub",htmlBuilder(t,e){var r=qA(t,e);if(r)return r(t,e);var n=t.base,o=t.sup,i=t.sub,s=Re(n,e),a,l,c=e.fontMetrics(),u=0,d=0,h=n&&Fn(n);if(o){var p=e.havingStyle(e.style.sup());a=Re(o,p,e),h||(u=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/e.sizeMultiplier)}if(i){var g=e.havingStyle(e.style.sub());l=Re(i,g,e),h||(d=s.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}var y;e.style===ge.DISPLAY?y=c.sup1:e.style.cramped?y=c.sup3:y=c.sup2;var v=e.sizeMultiplier,w=J(.5/c.ptPerEm/v),C=null;if(l){var k=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(s instanceof mr||k){var A;C=J(-((A=s.italic)!=null?A:0))}}var I;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var R=c.defaultRuleThickness,H=4*R;if(u-a.depth-(l.height-d)<H){d=H-(u-a.depth)+l.height;var O=.8*c.xHeight-(u-a.depth);O>0&&(u+=O,d-=O)}var P=[{type:"elem",elem:l,shift:d,marginRight:w,marginLeft:C},{type:"elem",elem:a,shift:-u,marginRight:w}];I=Be({positionType:"individualShift",children:P})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var $=[{type:"elem",elem:l,marginLeft:C,marginRight:w}];I=Be({positionType:"shift",positionData:d,children:$})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),I=Be({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:w}]});else throw new Error("supsub must have either sup or sub.");var ie=Hd(s,"right")||"mord";return G([ie],[s,G(["msupsub"],[I])],e)},mathmlBuilder(t,e){var r=!1,n,o;t.base&&t.base.type==="horizBrace"&&(o=!!t.sup,o===t.base.isOver&&(r=!0,n=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[je(t.base,e)];t.sub&&i.push(je(t.sub,e)),t.sup&&i.push(je(t.sup,e));var s;if(r)s=n?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===ge.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===ge.DISPLAY||c.limits)?s="munderover":s="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===ge.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===ge.DISPLAY)?s="munder":s="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===ge.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===ge.DISPLAY)?s="mover":s="msup"}return new Z(s,i)}});di({type:"atom",htmlBuilder(t,e){return Bh(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var r=new Z("mo",[Ar(t.text,t.mode)]);if(t.family==="bin"){var n=Hh(t,e);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else t.family==="punct"?r.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&r.setAttribute("stretchy","false");return r}});var r6={mi:"italic",mn:"normal",mtext:"normal"};di({type:"mathord",htmlBuilder(t,e){return qc(t,e)},mathmlBuilder(t,e){var r=new Z("mi",[Ar(t.text,t.mode,e)]),n=Hh(t,e)||"italic";return n!==r6[r.type]&&r.setAttribute("mathvariant",n),r}});di({type:"textord",htmlBuilder(t,e){return qc(t,e)},mathmlBuilder(t,e){var r=Ar(t.text,t.mode,e),n=Hh(t,e)||"normal",o;return t.mode==="text"?o=new Z("mtext",[r]):/[0-9]/.test(t.text)?o=new Z("mn",[r]):t.text==="\\prime"?o=new Z("mo",[r]):o=new Z("mi",[r]),n!==r6[o.type]&&o.setAttribute("mathvariant",n),o}});var M4=new Map([["\\nobreak","nobreak"],["\\allowbreak","allowbreak"]]),E4=new Map([[" ",{}],["\\ ",{}],["~",{className:"nobreak"}],["\\space",{}],["\\nobreakspace",{className:"nobreak"}]]);di({type:"spacing",htmlBuilder(t,e){var r=E4.get(t.text),n=M4.get(t.text);if(r){var o=r.className||"";if(t.mode==="text"){var i=qc(t,e);return i.classes.push(o),i}else return G(["mspace",o],[Bh(t.text,t.mode,e)],e)}else{if(n)return G(["mspace",n],[],e);throw new K('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var r;if(E4.has(t.text))r=new Z("mtext",[new pt(" ")]);else{if(M4.has(t.text))return new Z("mspace");throw new K('Unknown type of space "'+t.text+'"')}return r}});var I4=()=>{var t=new Z("mtd",[]);return t.setAttribute("width","50%"),t};di({type:"tag",mathmlBuilder(t,e){var r=new Z("mtable",[new Z("mtr",[I4(),new Z("mtd",[xo(t.body,e)]),I4(),new Z("mtd",[xo(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});var L4={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},R4={"\\textbf":"textbf","\\textmd":"textmd"},FA={"\\textit":"textit","\\textup":"textup"},O4=(t,e)=>{var r=t.font;if(r){if(L4[r])return e.withTextFontFamily(L4[r]);if(R4[r])return e.withTextFontWeight(R4[r]);if(r==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(FA[r])};te({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"text",mode:r.mode,body:ft(o),font:n}},htmlBuilder(t,e){var r=O4(t,e),n=xt(t.body,r,!0);return G(["mord","text"],n,r)},mathmlBuilder(t,e){var r=O4(t,e);return xo(t.body,r)}});te({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser;return{type:"underline",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Re(t.body,e),n=Ji("underline-line",e),o=e.fontMetrics().defaultRuleThickness,i=Be({positionType:"top",positionData:r.height,children:[{type:"kern",size:o},{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r}]});return G(["mord","katex-underline"],[i],e)},mathmlBuilder(t,e){var r=new Z("mo",[new pt("‾")]);r.setAttribute("stretchy","true");var n=new Z("munder",[je(t.body,e),r]);return n.setAttribute("accentunder","true"),n}});te({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler(t,e){var r=t.parser;return{type:"vcenter",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Re(t.body,e),n=e.fontMetrics().axisHeight,o=.5*(r.height-n-(r.depth+n));return Be({positionType:"shift",positionData:o,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new Z("mpadded",[je(t.body,e)],["vcenter"]);return new Z("mrow",[r])}});te({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(t,e,r){throw new K("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var r=P4(t),n=[],o=e.havingStyle(e.style.text()),i=0;i<r.length;i++){var s=r[i];s==="~"&&(s="\\textasciitilde"),n.push(Vt(s,"Typewriter-Regular",t.mode,o,["mord","texttt"]))}return G(["mord","text"].concat(o.sizingClasses(e)),k7(n),o)},mathmlBuilder(t,e){var r=new pt(P4(t)),n=new Z("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var P4=t=>t.body.replace(/ /g,t.star?"␣":" "),fo=T7,n6=`[ \r
261
- ]`,VA="\\\\[a-zA-Z@]+",WA="\\\\[^\uD800-\uDFFF]",jA="("+VA+")"+n6+"*",UA=`\\\\(
259
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function bS(t){return"toText"in t}class ms{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e}toMarkup(){for(var e="",r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e}toText(){return this.children.map(e=>{if(bS(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var Ed={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},wS={ex:!0,em:!0,mu:!0},y7=function(e){return typeof e!="string"&&(e=e.unit),e in Ed||e in wS||e==="ex"},ot=function(e,r){var n;if(e.unit in Ed)n=Ed[e.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(e.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var o;if(r.style.isTight()?o=r.havingStyle(r.style.text()):o=r,e.unit==="ex")n=o.fontMetrics().xHeight;else if(e.unit==="em")n=o.fontMetrics().quad;else throw new K("Invalid unit: '"+e.unit+"'");o!==r&&(n*=o.sizeMultiplier/r.sizeMultiplier)}return Math.min(e.number*n,r.maxSize)},J=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(r=>r).join(" ")},Ph=function(e){var r="";for(var n of Object.keys(e)){var o=e[n];o!==void 0&&(r+=K_(n)+":"+o+";")}return r},b7=function(e,r,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var o=r.getColor();o&&(this.style.color=o)}},w7=function(e){var r=document.createElement(e);r.className=yo(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)r.appendChild(this.children[o].toNode());return r},xS=/[\s"'>/=\x00-\x1f]/,x7=function(e){var r="<"+e;this.classes.length&&(r+=' class="'+Nt(yo(this.classes))+'"');var n=Ph(this.style);n&&(r+=' style="'+Nt(n)+'"');for(var o of Object.keys(this.attributes)){if(xS.test(o))throw new K("Invalid attribute name '"+o+"'");r+=" "+o+'="'+Nt(this.attributes[o])+'"'}r+=">";for(var i=0;i<this.children.length;i++)r+=this.children[i].toMarkup();return r+="</"+e+">",r};class gs{constructor(e,r,n,o){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,b7.call(this,e,n,o),this.children=r||[]}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return w7.call(this,"span")}toMarkup(){return x7.call(this,"span")}}class Hc{constructor(e,r,n,o){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,b7.call(this,r,o),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return w7.call(this,"a")}toMarkup(){return x7.call(this,"a")}}class CS{constructor(e,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+Nt(this.src)+'"'+(' alt="'+Nt(this.alt)+'"'),r=Ph(this.style);return r&&(e+=' style="'+Nt(r)+'"'),e+="'/>",e}}var kS={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class mr{constructor(e,r,n,o,i,s,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=r||0,this.depth=n||0,this.italic=o||0,this.skew=i||0,this.width=s||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=lS(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=kS[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),r=null;return this.italic>0&&(r=document.createElement("span"),r.style.marginRight=J(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=yo(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(e),r):e}toMarkup(){var e=!1,r="<span";this.classes.length&&(e=!0,r+=' class="',r+=Nt(yo(this.classes)),r+='"');var n="";this.italic>0&&(n+="margin-right:"+J(this.italic)+";"),n+=Ph(this.style),n&&(e=!0,r+=' style="'+Nt(n)+'"');var o=Nt(this.text);return e?(r+=">",r+=o,r+="</span>",r):o}}class Hn{constructor(e,r){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=r||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)r.appendChild(this.children[o].toNode());return r}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Nt(this.attributes[r])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class bo{constructor(e,r){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=r}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",t4[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Nt(this.alternate)+'"/>':'<path d="'+Nt(t4[this.pathName])+'"/>'}}class Id{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var e="<line";for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Nt(this.attributes[r])+'"';return e+="/>",e}}function _S(t){if(t instanceof mr)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function SS(t){if(t instanceof gs)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var AS=t=>t instanceof gs||t instanceof Hc||t instanceof ms,an={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Mu={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},r4={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function TS(t,e){an[t]=e}function Dh(t,e,r){if(!an[e])throw new Error("Font metrics not found for font: "+e+".");var n=t.charCodeAt(0),o=an[e][n];if(!o&&t[0]in r4&&(n=r4[t[0]].charCodeAt(0),o=an[e][n]),!o&&r==="text"&&v7(n)&&(o=an[e][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var Eu={};function MS(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Eu[e]){var r=Eu[e]={cssEmPerMu:Mu.quad[e]/18};for(var n of Object.keys(Mu))r[n]=Mu[n][e]}return Eu[e]}var Qe={math:{},text:{}};function f(t,e,r,n,o,i){Qe[t][o]={font:e,group:r,replace:n},i&&n&&(Qe[t][n]=Qe[t][o])}var m="math",U="text",b="main",A="ams",tt="accent-token",oe="bin",Kt="close",vs="inner",de="mathord",gt="op-token",vr="open",Qa="punct",T="rel",Vn="spacing",L="textord";f(m,b,T,"≡","\\equiv",!0);f(m,b,T,"≺","\\prec",!0);f(m,b,T,"≻","\\succ",!0);f(m,b,T,"∼","\\sim",!0);f(m,b,T,"⊥","\\perp");f(m,b,T,"⪯","\\preceq",!0);f(m,b,T,"⪰","\\succeq",!0);f(m,b,T,"≃","\\simeq",!0);f(m,b,T,"∣","\\mid",!0);f(m,b,T,"≪","\\ll",!0);f(m,b,T,"≫","\\gg",!0);f(m,b,T,"≍","\\asymp",!0);f(m,b,T,"∥","\\parallel");f(m,b,T,"⋈","\\bowtie",!0);f(m,b,T,"⌣","\\smile",!0);f(m,b,T,"⊑","\\sqsubseteq",!0);f(m,b,T,"⊒","\\sqsupseteq",!0);f(m,b,T,"≐","\\doteq",!0);f(m,b,T,"⌢","\\frown",!0);f(m,b,T,"∋","\\ni",!0);f(m,b,T,"∝","\\propto",!0);f(m,b,T,"⊢","\\vdash",!0);f(m,b,T,"⊣","\\dashv",!0);f(m,b,T,"∋","\\owns");f(m,b,Qa,".","\\ldotp");f(m,b,Qa,"⋅","\\cdotp");f(m,b,Qa,"⋅","·");f(U,b,L,"⋅","·");f(m,b,L,"#","\\#");f(U,b,L,"#","\\#");f(m,b,L,"&","\\&");f(U,b,L,"&","\\&");f(m,b,L,"ℵ","\\aleph",!0);f(m,b,L,"∀","\\forall",!0);f(m,b,L,"ℏ","\\hbar",!0);f(m,b,L,"∃","\\exists",!0);f(m,b,L,"∇","\\nabla",!0);f(m,b,L,"♭","\\flat",!0);f(m,b,L,"ℓ","\\ell",!0);f(m,b,L,"♮","\\natural",!0);f(m,b,L,"♣","\\clubsuit",!0);f(m,b,L,"℘","\\wp",!0);f(m,b,L,"♯","\\sharp",!0);f(m,b,L,"♢","\\diamondsuit",!0);f(m,b,L,"ℜ","\\Re",!0);f(m,b,L,"♡","\\heartsuit",!0);f(m,b,L,"ℑ","\\Im",!0);f(m,b,L,"♠","\\spadesuit",!0);f(m,b,L,"§","\\S",!0);f(U,b,L,"§","\\S");f(m,b,L,"¶","\\P",!0);f(U,b,L,"¶","\\P");f(m,b,L,"†","\\dag");f(U,b,L,"†","\\dag");f(U,b,L,"†","\\textdagger");f(m,b,L,"‡","\\ddag");f(U,b,L,"‡","\\ddag");f(U,b,L,"‡","\\textdaggerdbl");f(m,b,Kt,"⎱","\\rmoustache",!0);f(m,b,vr,"⎰","\\lmoustache",!0);f(m,b,Kt,"⟯","\\rgroup",!0);f(m,b,vr,"⟮","\\lgroup",!0);f(m,b,oe,"∓","\\mp",!0);f(m,b,oe,"⊖","\\ominus",!0);f(m,b,oe,"⊎","\\uplus",!0);f(m,b,oe,"⊓","\\sqcap",!0);f(m,b,oe,"∗","\\ast");f(m,b,oe,"⊔","\\sqcup",!0);f(m,b,oe,"◯","\\bigcirc",!0);f(m,b,oe,"∙","\\bullet",!0);f(m,b,oe,"‡","\\ddagger");f(m,b,oe,"≀","\\wr",!0);f(m,b,oe,"⨿","\\amalg");f(m,b,oe,"&","\\And");f(m,b,T,"⟵","\\longleftarrow",!0);f(m,b,T,"⇐","\\Leftarrow",!0);f(m,b,T,"⟸","\\Longleftarrow",!0);f(m,b,T,"⟶","\\longrightarrow",!0);f(m,b,T,"⇒","\\Rightarrow",!0);f(m,b,T,"⟹","\\Longrightarrow",!0);f(m,b,T,"↔","\\leftrightarrow",!0);f(m,b,T,"⟷","\\longleftrightarrow",!0);f(m,b,T,"⇔","\\Leftrightarrow",!0);f(m,b,T,"⟺","\\Longleftrightarrow",!0);f(m,b,T,"↦","\\mapsto",!0);f(m,b,T,"⟼","\\longmapsto",!0);f(m,b,T,"↗","\\nearrow",!0);f(m,b,T,"↩","\\hookleftarrow",!0);f(m,b,T,"↪","\\hookrightarrow",!0);f(m,b,T,"↘","\\searrow",!0);f(m,b,T,"↼","\\leftharpoonup",!0);f(m,b,T,"⇀","\\rightharpoonup",!0);f(m,b,T,"↙","\\swarrow",!0);f(m,b,T,"↽","\\leftharpoondown",!0);f(m,b,T,"⇁","\\rightharpoondown",!0);f(m,b,T,"↖","\\nwarrow",!0);f(m,b,T,"⇌","\\rightleftharpoons",!0);f(m,A,T,"≮","\\nless",!0);f(m,A,T,"","\\@nleqslant");f(m,A,T,"","\\@nleqq");f(m,A,T,"⪇","\\lneq",!0);f(m,A,T,"≨","\\lneqq",!0);f(m,A,T,"","\\@lvertneqq");f(m,A,T,"⋦","\\lnsim",!0);f(m,A,T,"⪉","\\lnapprox",!0);f(m,A,T,"⊀","\\nprec",!0);f(m,A,T,"⋠","\\npreceq",!0);f(m,A,T,"⋨","\\precnsim",!0);f(m,A,T,"⪹","\\precnapprox",!0);f(m,A,T,"≁","\\nsim",!0);f(m,A,T,"","\\@nshortmid");f(m,A,T,"∤","\\nmid",!0);f(m,A,T,"⊬","\\nvdash",!0);f(m,A,T,"⊭","\\nvDash",!0);f(m,A,T,"⋪","\\ntriangleleft");f(m,A,T,"⋬","\\ntrianglelefteq",!0);f(m,A,T,"⊊","\\subsetneq",!0);f(m,A,T,"","\\@varsubsetneq");f(m,A,T,"⫋","\\subsetneqq",!0);f(m,A,T,"","\\@varsubsetneqq");f(m,A,T,"≯","\\ngtr",!0);f(m,A,T,"","\\@ngeqslant");f(m,A,T,"","\\@ngeqq");f(m,A,T,"⪈","\\gneq",!0);f(m,A,T,"≩","\\gneqq",!0);f(m,A,T,"","\\@gvertneqq");f(m,A,T,"⋧","\\gnsim",!0);f(m,A,T,"⪊","\\gnapprox",!0);f(m,A,T,"⊁","\\nsucc",!0);f(m,A,T,"⋡","\\nsucceq",!0);f(m,A,T,"⋩","\\succnsim",!0);f(m,A,T,"⪺","\\succnapprox",!0);f(m,A,T,"≆","\\ncong",!0);f(m,A,T,"","\\@nshortparallel");f(m,A,T,"∦","\\nparallel",!0);f(m,A,T,"⊯","\\nVDash",!0);f(m,A,T,"⋫","\\ntriangleright");f(m,A,T,"⋭","\\ntrianglerighteq",!0);f(m,A,T,"","\\@nsupseteqq");f(m,A,T,"⊋","\\supsetneq",!0);f(m,A,T,"","\\@varsupsetneq");f(m,A,T,"⫌","\\supsetneqq",!0);f(m,A,T,"","\\@varsupsetneqq");f(m,A,T,"⊮","\\nVdash",!0);f(m,A,T,"⪵","\\precneqq",!0);f(m,A,T,"⪶","\\succneqq",!0);f(m,A,T,"","\\@nsubseteqq");f(m,A,oe,"⊴","\\unlhd");f(m,A,oe,"⊵","\\unrhd");f(m,A,T,"↚","\\nleftarrow",!0);f(m,A,T,"↛","\\nrightarrow",!0);f(m,A,T,"⇍","\\nLeftarrow",!0);f(m,A,T,"⇏","\\nRightarrow",!0);f(m,A,T,"↮","\\nleftrightarrow",!0);f(m,A,T,"⇎","\\nLeftrightarrow",!0);f(m,A,T,"△","\\vartriangle");f(m,A,L,"ℏ","\\hslash");f(m,A,L,"▽","\\triangledown");f(m,A,L,"◊","\\lozenge");f(m,A,L,"Ⓢ","\\circledS");f(m,A,L,"®","\\circledR");f(U,A,L,"®","\\circledR");f(m,A,L,"∡","\\measuredangle",!0);f(m,A,L,"∄","\\nexists");f(m,A,L,"℧","\\mho");f(m,A,L,"Ⅎ","\\Finv",!0);f(m,A,L,"⅁","\\Game",!0);f(m,A,L,"‵","\\backprime");f(m,A,L,"▲","\\blacktriangle");f(m,A,L,"▼","\\blacktriangledown");f(m,A,L,"■","\\blacksquare");f(m,A,L,"⧫","\\blacklozenge");f(m,A,L,"★","\\bigstar");f(m,A,L,"∢","\\sphericalangle",!0);f(m,A,L,"∁","\\complement",!0);f(m,A,L,"ð","\\eth",!0);f(U,b,L,"ð","ð");f(m,A,L,"╱","\\diagup");f(m,A,L,"╲","\\diagdown");f(m,A,L,"□","\\square");f(m,A,L,"□","\\Box");f(m,A,L,"◊","\\Diamond");f(m,A,L,"¥","\\yen",!0);f(U,A,L,"¥","\\yen",!0);f(m,A,L,"✓","\\checkmark",!0);f(U,A,L,"✓","\\checkmark");f(m,A,L,"ℶ","\\beth",!0);f(m,A,L,"ℸ","\\daleth",!0);f(m,A,L,"ℷ","\\gimel",!0);f(m,A,L,"ϝ","\\digamma",!0);f(m,A,L,"ϰ","\\varkappa");f(m,A,vr,"┌","\\@ulcorner",!0);f(m,A,Kt,"┐","\\@urcorner",!0);f(m,A,vr,"└","\\@llcorner",!0);f(m,A,Kt,"┘","\\@lrcorner",!0);f(m,A,T,"≦","\\leqq",!0);f(m,A,T,"⩽","\\leqslant",!0);f(m,A,T,"⪕","\\eqslantless",!0);f(m,A,T,"≲","\\lesssim",!0);f(m,A,T,"⪅","\\lessapprox",!0);f(m,A,T,"≊","\\approxeq",!0);f(m,A,oe,"⋖","\\lessdot");f(m,A,T,"⋘","\\lll",!0);f(m,A,T,"≶","\\lessgtr",!0);f(m,A,T,"⋚","\\lesseqgtr",!0);f(m,A,T,"⪋","\\lesseqqgtr",!0);f(m,A,T,"≑","\\doteqdot");f(m,A,T,"≓","\\risingdotseq",!0);f(m,A,T,"≒","\\fallingdotseq",!0);f(m,A,T,"∽","\\backsim",!0);f(m,A,T,"⋍","\\backsimeq",!0);f(m,A,T,"⫅","\\subseteqq",!0);f(m,A,T,"⋐","\\Subset",!0);f(m,A,T,"⊏","\\sqsubset",!0);f(m,A,T,"≼","\\preccurlyeq",!0);f(m,A,T,"⋞","\\curlyeqprec",!0);f(m,A,T,"≾","\\precsim",!0);f(m,A,T,"⪷","\\precapprox",!0);f(m,A,T,"⊲","\\vartriangleleft");f(m,A,T,"⊴","\\trianglelefteq");f(m,A,T,"⊨","\\vDash",!0);f(m,A,T,"⊪","\\Vvdash",!0);f(m,A,T,"⌣","\\smallsmile");f(m,A,T,"⌢","\\smallfrown");f(m,A,T,"≏","\\bumpeq",!0);f(m,A,T,"≎","\\Bumpeq",!0);f(m,A,T,"≧","\\geqq",!0);f(m,A,T,"⩾","\\geqslant",!0);f(m,A,T,"⪖","\\eqslantgtr",!0);f(m,A,T,"≳","\\gtrsim",!0);f(m,A,T,"⪆","\\gtrapprox",!0);f(m,A,oe,"⋗","\\gtrdot");f(m,A,T,"⋙","\\ggg",!0);f(m,A,T,"≷","\\gtrless",!0);f(m,A,T,"⋛","\\gtreqless",!0);f(m,A,T,"⪌","\\gtreqqless",!0);f(m,A,T,"≖","\\eqcirc",!0);f(m,A,T,"≗","\\circeq",!0);f(m,A,T,"≜","\\triangleq",!0);f(m,A,T,"∼","\\thicksim");f(m,A,T,"≈","\\thickapprox");f(m,A,T,"⫆","\\supseteqq",!0);f(m,A,T,"⋑","\\Supset",!0);f(m,A,T,"⊐","\\sqsupset",!0);f(m,A,T,"≽","\\succcurlyeq",!0);f(m,A,T,"⋟","\\curlyeqsucc",!0);f(m,A,T,"≿","\\succsim",!0);f(m,A,T,"⪸","\\succapprox",!0);f(m,A,T,"⊳","\\vartriangleright");f(m,A,T,"⊵","\\trianglerighteq");f(m,A,T,"⊩","\\Vdash",!0);f(m,A,T,"∣","\\shortmid");f(m,A,T,"∥","\\shortparallel");f(m,A,T,"≬","\\between",!0);f(m,A,T,"⋔","\\pitchfork",!0);f(m,A,T,"∝","\\varpropto");f(m,A,T,"◀","\\blacktriangleleft");f(m,A,T,"∴","\\therefore",!0);f(m,A,T,"∍","\\backepsilon");f(m,A,T,"▶","\\blacktriangleright");f(m,A,T,"∵","\\because",!0);f(m,A,T,"⋘","\\llless");f(m,A,T,"⋙","\\gggtr");f(m,A,oe,"⊲","\\lhd");f(m,A,oe,"⊳","\\rhd");f(m,A,T,"≂","\\eqsim",!0);f(m,b,T,"⋈","\\Join");f(m,A,T,"≑","\\Doteq",!0);f(m,A,oe,"∔","\\dotplus",!0);f(m,A,oe,"∖","\\smallsetminus");f(m,A,oe,"⋒","\\Cap",!0);f(m,A,oe,"⋓","\\Cup",!0);f(m,A,oe,"⩞","\\doublebarwedge",!0);f(m,A,oe,"⊟","\\boxminus",!0);f(m,A,oe,"⊞","\\boxplus",!0);f(m,A,oe,"⋇","\\divideontimes",!0);f(m,A,oe,"⋉","\\ltimes",!0);f(m,A,oe,"⋊","\\rtimes",!0);f(m,A,oe,"⋋","\\leftthreetimes",!0);f(m,A,oe,"⋌","\\rightthreetimes",!0);f(m,A,oe,"⋏","\\curlywedge",!0);f(m,A,oe,"⋎","\\curlyvee",!0);f(m,A,oe,"⊝","\\circleddash",!0);f(m,A,oe,"⊛","\\circledast",!0);f(m,A,oe,"⋅","\\centerdot");f(m,A,oe,"⊺","\\intercal",!0);f(m,A,oe,"⋒","\\doublecap");f(m,A,oe,"⋓","\\doublecup");f(m,A,oe,"⊠","\\boxtimes",!0);f(m,A,T,"⇢","\\dashrightarrow",!0);f(m,A,T,"⇠","\\dashleftarrow",!0);f(m,A,T,"⇇","\\leftleftarrows",!0);f(m,A,T,"⇆","\\leftrightarrows",!0);f(m,A,T,"⇚","\\Lleftarrow",!0);f(m,A,T,"↞","\\twoheadleftarrow",!0);f(m,A,T,"↢","\\leftarrowtail",!0);f(m,A,T,"↫","\\looparrowleft",!0);f(m,A,T,"⇋","\\leftrightharpoons",!0);f(m,A,T,"↶","\\curvearrowleft",!0);f(m,A,T,"↺","\\circlearrowleft",!0);f(m,A,T,"↰","\\Lsh",!0);f(m,A,T,"⇈","\\upuparrows",!0);f(m,A,T,"↿","\\upharpoonleft",!0);f(m,A,T,"⇃","\\downharpoonleft",!0);f(m,b,T,"⊶","\\origof",!0);f(m,b,T,"⊷","\\imageof",!0);f(m,A,T,"⊸","\\multimap",!0);f(m,A,T,"↭","\\leftrightsquigarrow",!0);f(m,A,T,"⇉","\\rightrightarrows",!0);f(m,A,T,"⇄","\\rightleftarrows",!0);f(m,A,T,"↠","\\twoheadrightarrow",!0);f(m,A,T,"↣","\\rightarrowtail",!0);f(m,A,T,"↬","\\looparrowright",!0);f(m,A,T,"↷","\\curvearrowright",!0);f(m,A,T,"↻","\\circlearrowright",!0);f(m,A,T,"↱","\\Rsh",!0);f(m,A,T,"⇊","\\downdownarrows",!0);f(m,A,T,"↾","\\upharpoonright",!0);f(m,A,T,"⇂","\\downharpoonright",!0);f(m,A,T,"⇝","\\rightsquigarrow",!0);f(m,A,T,"⇝","\\leadsto");f(m,A,T,"⇛","\\Rrightarrow",!0);f(m,A,T,"↾","\\restriction");f(m,b,L,"‘","`");f(m,b,L,"$","\\$");f(U,b,L,"$","\\$");f(U,b,L,"$","\\textdollar");f(m,b,L,"%","\\%");f(U,b,L,"%","\\%");f(m,b,L,"_","\\_");f(U,b,L,"_","\\_");f(U,b,L,"_","\\textunderscore");f(m,b,L,"∠","\\angle",!0);f(m,b,L,"∞","\\infty",!0);f(m,b,L,"′","\\prime");f(m,b,L,"△","\\triangle");f(m,b,L,"Γ","\\Gamma",!0);f(m,b,L,"Δ","\\Delta",!0);f(m,b,L,"Θ","\\Theta",!0);f(m,b,L,"Λ","\\Lambda",!0);f(m,b,L,"Ξ","\\Xi",!0);f(m,b,L,"Π","\\Pi",!0);f(m,b,L,"Σ","\\Sigma",!0);f(m,b,L,"Υ","\\Upsilon",!0);f(m,b,L,"Φ","\\Phi",!0);f(m,b,L,"Ψ","\\Psi",!0);f(m,b,L,"Ω","\\Omega",!0);f(m,b,L,"A","Α");f(m,b,L,"B","Β");f(m,b,L,"E","Ε");f(m,b,L,"Z","Ζ");f(m,b,L,"H","Η");f(m,b,L,"I","Ι");f(m,b,L,"K","Κ");f(m,b,L,"M","Μ");f(m,b,L,"N","Ν");f(m,b,L,"O","Ο");f(m,b,L,"P","Ρ");f(m,b,L,"T","Τ");f(m,b,L,"X","Χ");f(m,b,L,"¬","\\neg",!0);f(m,b,L,"¬","\\lnot");f(m,b,L,"⊤","\\top");f(m,b,L,"⊥","\\bot");f(m,b,L,"∅","\\emptyset");f(m,A,L,"∅","\\varnothing");f(m,b,de,"α","\\alpha",!0);f(m,b,de,"β","\\beta",!0);f(m,b,de,"γ","\\gamma",!0);f(m,b,de,"δ","\\delta",!0);f(m,b,de,"ϵ","\\epsilon",!0);f(m,b,de,"ζ","\\zeta",!0);f(m,b,de,"η","\\eta",!0);f(m,b,de,"θ","\\theta",!0);f(m,b,de,"ι","\\iota",!0);f(m,b,de,"κ","\\kappa",!0);f(m,b,de,"λ","\\lambda",!0);f(m,b,de,"μ","\\mu",!0);f(m,b,de,"ν","\\nu",!0);f(m,b,de,"ξ","\\xi",!0);f(m,b,de,"ο","\\omicron",!0);f(m,b,de,"π","\\pi",!0);f(m,b,de,"ρ","\\rho",!0);f(m,b,de,"σ","\\sigma",!0);f(m,b,de,"τ","\\tau",!0);f(m,b,de,"υ","\\upsilon",!0);f(m,b,de,"ϕ","\\phi",!0);f(m,b,de,"χ","\\chi",!0);f(m,b,de,"ψ","\\psi",!0);f(m,b,de,"ω","\\omega",!0);f(m,b,de,"ε","\\varepsilon",!0);f(m,b,de,"ϑ","\\vartheta",!0);f(m,b,de,"ϖ","\\varpi",!0);f(m,b,de,"ϱ","\\varrho",!0);f(m,b,de,"ς","\\varsigma",!0);f(m,b,de,"φ","\\varphi",!0);f(m,b,oe,"∗","*",!0);f(m,b,oe,"+","+");f(m,b,oe,"−","-",!0);f(m,b,oe,"⋅","\\cdot",!0);f(m,b,oe,"∘","\\circ",!0);f(m,b,oe,"÷","\\div",!0);f(m,b,oe,"±","\\pm",!0);f(m,b,oe,"×","\\times",!0);f(m,b,oe,"∩","\\cap",!0);f(m,b,oe,"∪","\\cup",!0);f(m,b,oe,"∖","\\setminus",!0);f(m,b,oe,"∧","\\land");f(m,b,oe,"∨","\\lor");f(m,b,oe,"∧","\\wedge",!0);f(m,b,oe,"∨","\\vee",!0);f(m,b,L,"√","\\surd");f(m,b,vr,"⟨","\\langle",!0);f(m,b,vr,"∣","\\lvert");f(m,b,vr,"∥","\\lVert");f(m,b,Kt,"?","?");f(m,b,Kt,"!","!");f(m,b,Kt,"⟩","\\rangle",!0);f(m,b,Kt,"∣","\\rvert");f(m,b,Kt,"∥","\\rVert");f(m,b,T,"=","=");f(m,b,T,":",":");f(m,b,T,"≈","\\approx",!0);f(m,b,T,"≅","\\cong",!0);f(m,b,T,"≥","\\ge");f(m,b,T,"≥","\\geq",!0);f(m,b,T,"←","\\gets");f(m,b,T,">","\\gt",!0);f(m,b,T,"∈","\\in",!0);f(m,b,T,"","\\@not");f(m,b,T,"⊂","\\subset",!0);f(m,b,T,"⊃","\\supset",!0);f(m,b,T,"⊆","\\subseteq",!0);f(m,b,T,"⊇","\\supseteq",!0);f(m,A,T,"⊈","\\nsubseteq",!0);f(m,A,T,"⊉","\\nsupseteq",!0);f(m,b,T,"⊨","\\models");f(m,b,T,"←","\\leftarrow",!0);f(m,b,T,"≤","\\le");f(m,b,T,"≤","\\leq",!0);f(m,b,T,"<","\\lt",!0);f(m,b,T,"→","\\rightarrow",!0);f(m,b,T,"→","\\to");f(m,A,T,"≱","\\ngeq",!0);f(m,A,T,"≰","\\nleq",!0);f(m,b,Vn," ","\\ ");f(m,b,Vn," ","\\space");f(m,b,Vn," ","\\nobreakspace");f(U,b,Vn," ","\\ ");f(U,b,Vn," "," ");f(U,b,Vn," ","\\space");f(U,b,Vn," ","\\nobreakspace");f(m,b,Vn,"","\\nobreak");f(m,b,Vn,"","\\allowbreak");f(m,b,Qa,",",",");f(m,b,Qa,";",";");f(m,A,oe,"⊼","\\barwedge",!0);f(m,A,oe,"⊻","\\veebar",!0);f(m,b,oe,"⊙","\\odot",!0);f(m,b,oe,"⊕","\\oplus",!0);f(m,b,oe,"⊗","\\otimes",!0);f(m,b,L,"∂","\\partial",!0);f(m,b,oe,"⊘","\\oslash",!0);f(m,A,oe,"⊚","\\circledcirc",!0);f(m,A,oe,"⊡","\\boxdot",!0);f(m,b,oe,"△","\\bigtriangleup");f(m,b,oe,"▽","\\bigtriangledown");f(m,b,oe,"†","\\dagger");f(m,b,oe,"⋄","\\diamond");f(m,b,oe,"⋆","\\star");f(m,b,oe,"◃","\\triangleleft");f(m,b,oe,"▹","\\triangleright");f(m,b,vr,"{","\\{");f(U,b,L,"{","\\{");f(U,b,L,"{","\\textbraceleft");f(m,b,Kt,"}","\\}");f(U,b,L,"}","\\}");f(U,b,L,"}","\\textbraceright");f(m,b,vr,"{","\\lbrace");f(m,b,Kt,"}","\\rbrace");f(m,b,vr,"[","\\lbrack",!0);f(U,b,L,"[","\\lbrack",!0);f(m,b,Kt,"]","\\rbrack",!0);f(U,b,L,"]","\\rbrack",!0);f(m,b,vr,"(","\\lparen",!0);f(m,b,Kt,")","\\rparen",!0);f(U,b,L,"<","\\textless",!0);f(U,b,L,">","\\textgreater",!0);f(m,b,vr,"⌊","\\lfloor",!0);f(m,b,Kt,"⌋","\\rfloor",!0);f(m,b,vr,"⌈","\\lceil",!0);f(m,b,Kt,"⌉","\\rceil",!0);f(m,b,L,"\\","\\backslash");f(m,b,L,"∣","|");f(m,b,L,"∣","\\vert");f(U,b,L,"|","\\textbar",!0);f(m,b,L,"∥","\\|");f(m,b,L,"∥","\\Vert");f(U,b,L,"∥","\\textbardbl");f(U,b,L,"~","\\textasciitilde");f(U,b,L,"\\","\\textbackslash");f(U,b,L,"^","\\textasciicircum");f(m,b,T,"↑","\\uparrow",!0);f(m,b,T,"⇑","\\Uparrow",!0);f(m,b,T,"↓","\\downarrow",!0);f(m,b,T,"⇓","\\Downarrow",!0);f(m,b,T,"↕","\\updownarrow",!0);f(m,b,T,"⇕","\\Updownarrow",!0);f(m,b,gt,"∐","\\coprod");f(m,b,gt,"⋁","\\bigvee");f(m,b,gt,"⋀","\\bigwedge");f(m,b,gt,"⨄","\\biguplus");f(m,b,gt,"⋂","\\bigcap");f(m,b,gt,"⋃","\\bigcup");f(m,b,gt,"∫","\\int");f(m,b,gt,"∫","\\intop");f(m,b,gt,"∬","\\iint");f(m,b,gt,"∭","\\iiint");f(m,b,gt,"∏","\\prod");f(m,b,gt,"∑","\\sum");f(m,b,gt,"⨂","\\bigotimes");f(m,b,gt,"⨁","\\bigoplus");f(m,b,gt,"⨀","\\bigodot");f(m,b,gt,"∮","\\oint");f(m,b,gt,"∯","\\oiint");f(m,b,gt,"∰","\\oiiint");f(m,b,gt,"⨆","\\bigsqcup");f(m,b,gt,"∫","\\smallint");f(U,b,vs,"…","\\textellipsis");f(m,b,vs,"…","\\mathellipsis");f(U,b,vs,"…","\\ldots",!0);f(m,b,vs,"…","\\ldots",!0);f(m,b,vs,"⋯","\\@cdots",!0);f(m,b,vs,"⋱","\\ddots",!0);f(m,b,L,"⋮","\\varvdots");f(U,b,L,"⋮","\\varvdots");f(m,b,tt,"ˊ","\\acute");f(m,b,tt,"ˋ","\\grave");f(m,b,tt,"¨","\\ddot");f(m,b,tt,"~","\\tilde");f(m,b,tt,"ˉ","\\bar");f(m,b,tt,"˘","\\breve");f(m,b,tt,"ˇ","\\check");f(m,b,tt,"^","\\hat");f(m,b,tt,"⃗","\\vec");f(m,b,tt,"˙","\\dot");f(m,b,tt,"˚","\\mathring");f(m,b,de,"","\\@imath");f(m,b,de,"","\\@jmath");f(m,b,L,"ı","ı");f(m,b,L,"ȷ","ȷ");f(U,b,L,"ı","\\i",!0);f(U,b,L,"ȷ","\\j",!0);f(U,b,L,"ß","\\ss",!0);f(U,b,L,"æ","\\ae",!0);f(U,b,L,"œ","\\oe",!0);f(U,b,L,"ø","\\o",!0);f(U,b,L,"Æ","\\AE",!0);f(U,b,L,"Œ","\\OE",!0);f(U,b,L,"Ø","\\O",!0);f(U,b,tt,"ˊ","\\'");f(U,b,tt,"ˋ","\\`");f(U,b,tt,"ˆ","\\^");f(U,b,tt,"˜","\\~");f(U,b,tt,"ˉ","\\=");f(U,b,tt,"˘","\\u");f(U,b,tt,"˙","\\.");f(U,b,tt,"¸","\\c");f(U,b,tt,"˚","\\r");f(U,b,tt,"ˇ","\\v");f(U,b,tt,"¨",'\\"');f(U,b,tt,"˝","\\H");f(U,b,tt,"◯","\\textcircled");var C7={"--":!0,"---":!0,"``":!0,"''":!0};f(U,b,L,"–","--",!0);f(U,b,L,"–","\\textendash");f(U,b,L,"—","---",!0);f(U,b,L,"—","\\textemdash");f(U,b,L,"‘","`",!0);f(U,b,L,"‘","\\textquoteleft");f(U,b,L,"’","'",!0);f(U,b,L,"’","\\textquoteright");f(U,b,L,"“","``",!0);f(U,b,L,"“","\\textquotedblleft");f(U,b,L,"”","''",!0);f(U,b,L,"”","\\textquotedblright");f(m,b,L,"°","\\degree",!0);f(U,b,L,"°","\\degree");f(U,b,L,"°","\\textdegree",!0);f(m,b,L,"£","\\pounds");f(m,b,L,"£","\\mathsterling",!0);f(U,b,L,"£","\\pounds");f(U,b,L,"£","\\textsterling",!0);f(m,A,L,"✠","\\maltese");f(U,A,L,"✠","\\maltese");var n4='0123456789/@."';for(var Iu=0;Iu<n4.length;Iu++){var o4=n4.charAt(Iu);f(m,b,L,o4,o4)}var i4='0123456789!@*()-=+";:?/.,';for(var Lu=0;Lu<i4.length;Lu++){var s4=i4.charAt(Lu);f(U,b,L,s4,s4)}var Y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Ru=0;Ru<Y0.length;Ru++){var ml=Y0.charAt(Ru);f(m,b,de,ml,ml),f(U,b,L,ml,ml)}f(m,A,L,"C","ℂ");f(U,A,L,"C","ℂ");f(m,A,L,"H","ℍ");f(U,A,L,"H","ℍ");f(m,A,L,"N","ℕ");f(U,A,L,"N","ℕ");f(m,A,L,"P","ℙ");f(U,A,L,"P","ℙ");f(m,A,L,"Q","ℚ");f(U,A,L,"Q","ℚ");f(m,A,L,"R","ℝ");f(U,A,L,"R","ℝ");f(m,A,L,"Z","ℤ");f(U,A,L,"Z","ℤ");f(m,b,de,"h","ℎ");f(U,b,de,"h","ℎ");var me;for(var $t=0;$t<Y0.length;$t++){var st=Y0.charAt($t);me=String.fromCharCode(55349,56320+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56372+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56424+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56580+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56684+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56736+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56788+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56840+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56944+$t),f(m,b,de,st,me),f(U,b,L,st,me),$t<26&&(me=String.fromCharCode(55349,56632+$t),f(m,b,de,st,me),f(U,b,L,st,me),me=String.fromCharCode(55349,56476+$t),f(m,b,de,st,me),f(U,b,L,st,me))}me="𝕜";f(m,b,de,"k",me);f(U,b,L,"k",me);for(var Ro=0;Ro<10;Ro++){var Zn=Ro.toString();me=String.fromCharCode(55349,57294+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57314+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57324+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me),me=String.fromCharCode(55349,57334+Ro),f(m,b,de,Zn,me),f(U,b,L,Zn,me)}var Ld="ÐÞþ";for(var Ou=0;Ou<Ld.length;Ou++){var gl=Ld.charAt(Ou);f(m,b,de,gl,gl),f(U,b,L,gl,gl)}var Rd={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},a4={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},l4={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},ES={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},jo={mathClass:"",textClass:"",font:""},c4={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},u4={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},d4={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Od={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Pd={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},h4={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Dd={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},f4=[Rd,Rd,a4,a4,l4,l4,ES,jo,jo,jo,c4,c4,u4,u4,d4,d4,Od,Od,Pd,Pd,h4,h4,jo,jo,Dd,Dd],IS=[Rd,jo,Od,Pd,Dd],LS=t=>{var e=t.charCodeAt(0),r=t.charCodeAt(1),n=(e-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var o=Math.floor((n-119808)/26);return f4[o]}else if(120782<=n&&n<=120831){var i=Math.floor((n-120782)/10);return IS[i]}else{if(n===120485||n===120486)return f4[0];if(120486<n&&n<120782)return jo;throw new K("Unsupported character: "+t)}};function Qt(t){var e=t.strict,r=t.errorCode,n=t.errorMsg,o=t.token,i=t.report,s=e;if(typeof e=="function")if(i)s=e(r,n,o);else try{s=e(r,n,o)}catch{s="error"}switch(s){case!0:case"error":if(i)throw new K("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+r+"]"),o);return!0;case!1:case"ignore":if(!i)return!1;break;default:if(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+r+"]")),!i)return!1;break}}var $c=function(e,r,n){if(Qe[n][e]){var o=Qe[n][e].replace;o&&(e=o)}return{value:e,metrics:Dh(e,r,n)}},Vt=function(e,r,n,o,i){var s=$c(e,r,n),a=s.metrics;e=s.value;var l;if(a){var c=a.italic;(n==="text"||o&&o.font==="mathit")&&(c=0),l=new mr(e,a.height,a.depth,c,a.skew,a.width,i)}else Qt({strict:o.strict,errorCode:"symbolNotInFont",errorMsg:"No character metrics for '"+e+"' in style '"+r+"' and mode '"+n+"'",report:!0}),l=new mr(e,0,0,0,0,0,i);l.maxFontSize=o.sizeMultiplier,o.style.isTight()&&l.classes.push("mtight");var u=o.getColor();return u&&(l.style.color=u),l},Bh=function(e,r,n,o){return o===void 0&&(o=[]),n.font==="boldsymbol"&&$c(e,"Main-Bold",r).metrics?Vt(e,"Main-Bold",r,n,o.concat(["mathbf"])):e==="\\"||Qe[r][e].font==="main"?Vt(e,"Main-Regular",r,n,o):Vt(e,"AMS-Regular",r,n,o.concat(["amsrm"]))},RS=function(e,r,n){return n!=="textord"&&$c(e,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},qc=function(e,r){var n=e.type==="mathord"?"mathord":"textord",o=e.mode,i=e.text,s=["mord"],a=r.font,l=r.fontFamily,c=r.fontWeight,u=r.fontShape,d=o==="math"||o==="text"&&!!a,h=d?a:l,p="",g="";if(i.charCodeAt(0)===55349){var y=LS(i);p=y.font,g=y[o+"Class"]}if(p)return Vt(i,p,o,r,s.concat(g));if(h){var v,w;if(h==="boldsymbol"){var C=RS(i,o,n);v=C.fontName,w=[C.fontClass]}else d?(v=Bd[a].fontName,w=[a]):(v=vl(l,c,u),w=[l,c,u]);if($c(i,v,o).metrics)return Vt(i,v,o,r,s.concat(w));if(Object.prototype.hasOwnProperty.call(C7,i)&&v.slice(0,10)==="Typewriter"){for(var k=[],S=0;S<i.length;S++)k.push(Vt(i[S],v,o,r,s.concat(w)));return Wn(k)}}if(n==="mathord")return Vt(i,"Math-Italic",o,r,s.concat(["mathnormal"]));if(n==="textord"){var E=Qe[o][i]&&Qe[o][i].font;if(E==="ams"){var R=vl("amsrm",c,u);return Vt(i,R,o,r,s.concat("amsrm",c,u))}else if(E==="main"||!E){var H=vl("textrm",c,u);return Vt(i,H,o,r,s.concat(c,u))}else{var O=vl(E,c,u);return Vt(i,O,o,r,s.concat(O,c,u))}}else throw new Error("unexpected type: "+n+" in makeOrd")},OS=(t,e)=>{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var r=t.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(t.style))if(t.style[n]!==e.style[n])return!1;for(var o of Object.keys(e.style))if(t.style[o]!==e.style[o])return!1;return!0},k7=t=>{for(var e=0;e<t.length-1;e++){var r=t[e],n=t[e+1];r instanceof mr&&n instanceof mr&&OS(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,t.splice(e+1,1),e--)}return t},zh=function(e){for(var r=0,n=0,o=0,i=0;i<e.children.length;i++){var s=e.children[i];s.height>r&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>o&&(o=s.maxFontSize)}e.height=r,e.depth=n,e.maxFontSize=o},G=function(e,r,n,o){var i=new gs(e,r,n,o);return zh(i),i},wo=(t,e,r,n)=>new gs(t,e,r,n),Ji=function(e,r,n){var o=G([e],[],r);return o.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),o.style.borderBottomWidth=J(o.height),o.maxFontSize=1,o},PS=function(e,r,n,o){var i=new Hc(e,r,n,o);return zh(i),i},Wn=function(e){var r=new ms(e);return zh(r),r},Qi=function(e,r){return e instanceof ms?G([],[e],r):e},DS=function(e){if(e.positionType==="individualShift"){for(var r=e.children,n=[r[0]],o=-r[0].shift-r[0].elem.depth,i=o,s=1;s<r.length;s++){var a=-r[s].shift-i-r[s].elem.depth,l=a-(r[s-1].elem.height+r[s-1].elem.depth);i=i+a,n.push({type:"kern",size:l}),n.push(r[s])}return{children:n,depth:o}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var p=e.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-p.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-p.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Be=function(e,r){for(var n=DS(e),o=n.children,i=n.depth,s=0,a=0;a<o.length;a++){var l=o[a];if(l.type==="elem"){var c=l.elem;s=Math.max(s,c.maxFontSize,c.height)}}s+=2;var u=G(["pstrut"],[]);u.style.height=J(s);for(var d=[],h=i,p=i,g=i,y=0;y<o.length;y++){var v=o[y];if(v.type==="kern")g+=v.size;else{var w=v.elem,C=v.wrapperClasses||[],k=v.wrapperStyle||{},S=G(C,[u,w],void 0,k);S.style.top=J(-s-g-w.depth),v.marginLeft&&(S.style.marginLeft=v.marginLeft),v.marginRight&&(S.style.marginRight=v.marginRight),d.push(S),g+=w.height+w.depth}h=Math.min(h,g),p=Math.max(p,g)}var E=G(["vlist"],d);E.style.height=J(p);var R;if(h<0){var H=G([],[]),O=G(["vlist"],[H]);O.style.height=J(-h);var P=G(["vlist-s"],[new mr("​")]);R=[G(["vlist-r"],[E,P]),G(["vlist-r"],[O])]}else R=[G(["vlist-r"],[E])];var $=G(["vlist-t"],R);return R.length===2&&$.classes.push("vlist-t2"),$.height=p,$.depth=-h,$},_7=(t,e)=>{var r=G(["mspace"],[],e),n=ot(t,e);return r.style.marginRight=J(n),r},vl=(t,e,r)=>{var n,o;switch(t){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=t}return e==="textbf"&&r==="textit"?o="BoldItalic":e==="textbf"?o="Bold":r==="textit"?o="Italic":o="Regular",n+"-"+o},Bd={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},S7={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},A7=function(e,r){var n=S7[e],o=n[0],i=n[1],s=n[2],a=new bo(o),l=new Hn([a],{width:J(i),height:J(s),style:"width:"+J(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),c=wo(["katex-overlay"],[l],r);return c.height=s,c.style.height=J(s),c.style.width=J(i),c},nt={number:3,unit:"mu"},Oo={number:4,unit:"mu"},Cn={number:5,unit:"mu"},BS={mord:{mop:nt,mbin:Oo,mrel:Cn,minner:nt},mop:{mord:nt,mop:nt,mrel:Cn,minner:nt},mbin:{mord:Oo,mop:Oo,mopen:Oo,minner:Oo},mrel:{mord:Cn,mop:Cn,mopen:Cn,minner:Cn},mopen:{},mclose:{mop:nt,mbin:Oo,mrel:Cn,minner:nt},mpunct:{mord:nt,mop:nt,mrel:Cn,mopen:nt,mclose:nt,mpunct:nt,minner:nt},minner:{mord:nt,mop:nt,mbin:Oo,mrel:Cn,mopen:nt,mpunct:nt,minner:nt}},zS={mord:{mop:nt},mop:{mord:nt,mop:nt},mbin:{},mrel:{},mopen:{},mclose:{mop:nt},mpunct:{},minner:{mop:nt}},T7={},Ta={},Ma={};function te(t){for(var e=t.type,r=t.names,n=t.htmlBuilder,o=t.mathmlBuilder,i=0;i<r.length;++i)T7[r[i]]=t;e&&(n&&(Ta[e]=n),o&&(Ma[e]=o))}function di(t){var e=t.type,r=t.htmlBuilder,n=t.mathmlBuilder;r&&(Ta[e]=r),n&&(Ma[e]=n)}var Ea=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ft=function(e){return e.type==="ordgroup"?e.body:[e]},NS=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),HS=new Set(["rightmost","mrel","mclose","mpunct"]),$S={display:ge.DISPLAY,text:ge.TEXT,script:ge.SCRIPT,scriptscript:ge.SCRIPTSCRIPT},qS={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},xt=function(e,r,n,o){o===void 0&&(o=[null,null]);for(var i=[],s=0;s<e.length;s++){var a=Re(e[s],r);if(a instanceof ms){var l=a.children;i.push(...l)}else i.push(a)}if(k7(i),!n)return i;var c=r;if(e.length===1){var u=e[0];u.type==="sizing"?c=r.havingSize(u.size):u.type==="styling"&&(c=r.havingStyle($S[u.style]))}var d=G([o[0]||"leftmost"],[],r),h=G([o[1]||"rightmost"],[],r),p=n==="root";return zd(i,(g,y)=>{var v=y.classes[0],w=g.classes[0];v==="mbin"&&HS.has(w)?y.classes[0]="mord":w==="mbin"&&NS.has(v)&&(g.classes[0]="mord")},{node:d},h,p),zd(i,(g,y)=>{var v,w,C=Hd(y),k=Hd(g),S=C&&k?g.hasClass("mtight")?(v=zS[C])==null?void 0:v[k]:(w=BS[C])==null?void 0:w[k]:null;if(S)return _7(S,c)},{node:d},h,p),i},zd=function(e,r,n,o,i){o&&e.push(o);for(var s=0;s<e.length;s++){var a=e[s],l=M7(a);if(l){zd(l.children,r,n,null,i);continue}var c=!a.hasClass("mspace");if(c){var u=r(a,n.node);u&&(n.insertAfter?n.insertAfter(u):(e.unshift(u),s++))}c?n.node=a:i&&a.hasClass("katex-newline")&&(n.node=G(["leftmost"])),n.insertAfter=(d=>h=>{e.splice(d+1,0,h),s++})(s)}o&&e.pop()},M7=function(e){return e instanceof ms||e instanceof Hc||e instanceof gs&&e.hasClass("enclosing")?e:null},Nd=function(e,r){var n=M7(e);if(n){var o=n.children;if(o.length){if(r==="right")return Nd(o[o.length-1],"right");if(r==="left")return Nd(o[0],"left")}}return e},Hd=function(e,r){if(!e)return null;r&&(e=Nd(e,r));var n=e.classes[0];return qS[n]||null},Ia=function(e,r){var n=["nulldelimiter"].concat(e.baseSizingClasses());return G(r.concat(n))},Re=function(e,r,n){if(!e)return G();if(Ta[e.type]){var o=Ta[e.type](e,r);if(n&&r.size!==n.size){o=G(r.sizingClasses(n),[o],r);var i=r.sizeMultiplier/n.sizeMultiplier;o.height*=i,o.depth*=i}return o}else throw new K("Got group of unknown type: '"+e.type+"'")};function yl(t,e){var r=G(["katex-base"],t,e),n=G(["katex-strut"]);return n.style.height=J(r.height+r.depth),r.depth&&(n.style.verticalAlign=J(-r.depth)),r.children.unshift(n),r}function $d(t,e){var r=null;t.length===1&&t[0].type==="tag"&&(r=t[0].tag,t=t[0].body);var n=xt(t,e,"root"),o;n.length===2&&n[1].hasClass("katex-tag")&&(o=n.pop());for(var i=[],s=[],a=0;a<n.length;a++)if(s.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("katex-newline");)a++,s.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(i.push(yl(s,e)),s=[])}else n[a].hasClass("katex-newline")&&(s.pop(),s.length>0&&(i.push(yl(s,e)),s=[]),i.push(n[a]));s.length>0&&i.push(yl(s,e));var c;r?(c=yl(xt(r,e,!0),e),c.classes=["katex-tag"],i.push(c)):o&&i.push(o);var u=G(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=J(u.height+u.depth),u.depth&&(d.style.verticalAlign=J(-u.depth))}return u}function E7(t){return new ms(t)}class Z{constructor(e,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(e,r){this.attributes[e]=r}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r of Object.entries(this.attributes)){var n=r[0],o=r[1];e.setAttribute(n,o)}this.classes.length>0&&(e.className=yo(this.classes));for(var i=0;i<this.children.length;i++)if(this.children[i]instanceof pt&&this.children[i+1]instanceof pt){for(var s=this.children[i].toText()+this.children[++i].toText();this.children[i+1]instanceof pt;)s+=this.children[++i].toText();e.appendChild(new pt(s).toNode())}else e.appendChild(this.children[i].toNode());return e}toMarkup(){var e="<"+this.type;for(var r of Object.entries(this.attributes)){var n=r[0],o=r[1];e+=" "+n+'="',e+=Nt(o),e+='"'}this.classes.length>0&&(e+=' class ="'+Nt(yo(this.classes))+'"'),e+=">";for(var i=0;i<this.children.length;i++)e+=this.children[i].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class pt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Nt(this.toText())}toText(){return this.text}}class I7{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",J(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+J(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var FS=new Set(["\\imath","\\jmath"]),VS=new Set(["mrow","mtable"]),Ar=function(e,r,n){var o,i;return Qe[r][e]&&Qe[r][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(C7,e)&&((n==null||(o=n.fontFamily)==null?void 0:o.slice(4,6))==="tt"||(n==null||(i=n.font)==null?void 0:i.slice(4,6))==="tt"))&&(e=Qe[r][e].replace),new pt(e)},Nh=function(e){return e.length===1?e[0]:new Z("mrow",e)},WS={mathit:"italic",boldsymbol:t=>t.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},Hh=(t,e)=>{if(t.mode==="text"){if(e.fontFamily==="texttt")return"monospace";if(e.fontFamily==="textsf")return e.fontShape==="textit"&&e.fontWeight==="textbf"?"sans-serif-bold-italic":e.fontShape==="textit"?"sans-serif-italic":e.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(e.fontShape==="textit"&&e.fontWeight==="textbf")return"bold-italic";if(e.fontShape==="textit")return"italic";if(e.fontWeight==="textbf")return"bold"}var r=e.font;if(!r||r==="mathnormal")return null;var n=t.mode,o=WS[r];if(o)return typeof o=="function"?o(t):o;var i=t.text;if(FS.has(i))return null;if(Qe[n][i]){var s=Qe[n][i].replace;s&&(i=s)}var a=Bd[r].fontName;return Dh(i,a,n)?Bd[r].variant:null};function Pu(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof pt&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var r=t.children[0];return r instanceof pt&&r.text===","}else return!1}var yr=function(e,r,n){if(e.length===1){var o=je(e[0],r);return n&&o instanceof Z&&o.type==="mo"&&(o.setAttribute("lspace","0em"),o.setAttribute("rspace","0em")),[o]}for(var i=[],s,a=0;a<e.length;a++){var l=je(e[a],r);if(l instanceof Z&&s instanceof Z){if(l.type==="mtext"&&s.type==="mtext"&&l.getAttribute("mathvariant")===s.getAttribute("mathvariant")){s.children.push(...l.children);continue}else if(l.type==="mn"&&s.type==="mn"){s.children.push(...l.children);continue}else if(Pu(l)&&s.type==="mn"){s.children.push(...l.children);continue}else if(l.type==="mn"&&Pu(s))l.children=[...s.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(s.type==="mn"||Pu(s))){var c=l.children[0];c instanceof Z&&c.type==="mn"&&(c.children=[...s.children,...c.children],i.pop())}else if(s.type==="mi"&&s.children.length===1){var u=s.children[0];if(u instanceof pt&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof pt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),s=l}return i},xo=function(e,r,n){return Nh(yr(e,r,n))},je=function(e,r){if(!e)return new Z("mrow");if(Ma[e.type])return Ma[e.type](e,r);throw new K("Got group of unknown type: '"+e.type+"'")};function p4(t,e,r,n,o){var i=yr(t,r),s;i.length===1&&i[0]instanceof Z&&VS.has(i[0].type)?s=i[0]:s=new Z("mrow",i);var a=new Z("annotation",[new pt(e)]);a.setAttribute("encoding","application/x-tex");var l=new Z("semantics",[s,a]),c=new Z("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block");var u=o?"katex":"katex-mathml";return G([u],[c])}var jS=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],m4=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],g4=function(e,r){return r.size<2?e:jS[e-1][r.size-1]};class In{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.strict=void 0,this.style=e.style,this.color=e.color,this.size=e.size||In.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=m4[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this.strict=e.strict,this._fontMetrics=void 0}extend(e){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness,strict:this.strict};return Object.assign(r,e),new In(r)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:g4(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:m4[e-1]})}havingBaseStyle(e){e=e||this.style.text();var r=g4(In.BASESIZE,e);return this.size===r&&this.textSize===In.BASESIZE&&this.style===e?this:this.extend({style:e,size:r})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["katex-sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==In.BASESIZE?["katex-sizing","reset-size"+this.size,"size"+In.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=MS(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}In.BASESIZE=6;var L7=t=>new In({style:t.displayMode?ge.DISPLAY:ge.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness,strict:t.strict}),R7=function(e,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),e=G(n,[e])}return e},US=function(e,r,n){var o=L7(n),i;if(n.output==="mathml")return p4(e,r,o,n.displayMode,!0);if(n.output==="html"){var s=$d(e,o);i=G(["katex"],[s])}else{var a=p4(e,r,o,n.displayMode,!1),l=$d(e,o);i=G(["katex"],[a,l])}return R7(i,n)},GS=function(e,r){var n=L7(r),o=$d(e,n),i=G(["katex"],[o]);return R7(i,r)},KS={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Fc=function(e){var r=new Z("mo",[new pt(KS[e.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},ZS={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},XS=new Set(["widehat","widecheck","widetilde","utilde"]),Vc=function(e,r){function n(){var l=4e5,c=e.label.slice(1);if(XS.has(c)&&"base"in e){var u=e.base.type==="ordgroup"?e.base.body.length:1,d,h,p;if(u>5)c==="widehat"||c==="widecheck"?(d=420,l=2364,p=.42,h=c+"4"):(d=312,l=2340,p=.34,h="tilde4");else{var g=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][g],d=[0,239,300,360,420][g],p=[0,.24,.3,.3,.36,.42][g],h=c+g):(l=[0,600,1033,2339,2340][g],d=[0,260,286,306,312][g],p=[0,.26,.286,.3,.306,.34][g],h="tilde"+g)}var y=new bo(h),v=new Hn([y],{width:"100%",height:J(p),viewBox:"0 0 "+l+" "+d,preserveAspectRatio:"none"});return{span:wo([],[v],r),minWidth:0,height:p}}else{var w=[],C=ZS[c];if(!C)throw new Error('No SVG data for "'+c+'".');var k=C[0],S=C[1],E=C[2],R=E/1e3,H=k.length,O,P;if(H===1){if(C.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');O=["hide-tail"],P=[C[3]]}else if(H===2)O=["halfarrow-left","halfarrow-right"],P=["xMinYMin","xMaxYMin"];else if(H===3)O=["brace-left","brace-center","brace-right"],P=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
260
+ `+H+" children.");for(var $=0;$<H;$++){var ie=new bo(k[$]),N=new Hn([ie],{width:"400em",height:J(R),viewBox:"0 0 "+l+" "+E,preserveAspectRatio:P[$]+" slice"}),ye=wo([O[$]],[N],r);if(H===1)return{span:ye,minWidth:S,height:R};ye.style.height=J(R),w.push(ye)}return{span:G(["katex-stretchy"],w,r),minWidth:S,height:R}}}var o=n(),i=o.span,s=o.minWidth,a=o.height;return i.height=a,i.style.height=J(a),s>0&&(i.style.minWidth=J(s)),i},YS=function(e,r,n,o,i){var s,a=e.height+e.depth+n+o;if(/fbox|color|angl/.test(r)){if(s=G(["katex-stretchy",r],[],i),r==="fbox"){var l=i.color&&i.getColor();l&&(s.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(r)&&c.push(new Id({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&c.push(new Id({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Hn(c,{width:"100%",height:J(a)});s=wo([],[u],i)}return s.height=a,s.style.height=J(a),s},JS=["bin","close","inner","open","punct","rel"],QS=["accent-token","mathord","op-token","spacing","textord"],eA=new Set(JS),tA=new Set(QS);function rA(t){return eA.has(t)}function Se(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Wc(t){var e=jc(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function jc(t){return t.type==="atom"||tA.has(t.type)?t:null}function $h(t,e,r){var n="";for(var o of t.body)if(o.type==="textord")n+=o.text;else if(r&&o.type==="spacing"&&o.text===" ")n+=" ";else throw new K(e,t);return n}var O7=t=>{if(t instanceof mr)return t;if(AS(t)&&t.children.length===1)return O7(t.children[0])},P7=(t,e)=>{var r,n,o;t&&t.type==="supsub"?(n=Se(t.base,"accent"),r=n.base,t.base=r,o=SS(Re(t,e)),t.base=n):(n=Se(t,"accent"),r=n.base);var i=Re(r,e.havingCrampedStyle()),s=n.isShifty&&Fn(r),a=0;if(s){var l,c;a=(l=(c=O7(i))==null?void 0:c.skew)!=null?l:0}var u=n.label==="\\c",d=u?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),h;if(n.isStretchy)h=Vc(n,e),h=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+J(2*a)+")",marginLeft:J(2*a)}:void 0}]});else{var p,g;n.label==="\\vec"?(p=A7("vec",e),g=S7.vec[1]):(p=qc({type:"textord",mode:n.mode,text:n.label},e),p=_S(p),p.italic=0,g=p.width,u&&(d+=p.depth)),h=G(["accent-body"],[p]);var y=n.label==="\\textcircled";y&&(h.classes.push("accent-full"),d=i.height);var v=a;y||(v-=g/2),h.style.left=J(v),n.label==="\\textcircled"&&(h.style.top=".2em"),h=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:h}]})}var w=G(["mord","katex-accent"],[h],e);return o?(o.children[0]=w,o.height=Math.max(w.height,o.height),o.classes[0]="mord",o):w},nA=(t,e)=>{var r=t.isStretchy?Fc(t.label):new Z("mo",[Ar(t.label,t.mode)]),n=new Z("mover",[je(t.base,e),r]);return n.setAttribute("accent","true"),n},oA=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));te({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(t,e)=>{var r=Ea(e[0]),n=!oA.test(t.funcName),o=!n||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:n,isShifty:o,base:r}},htmlBuilder:P7,mathmlBuilder:nA});te({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(t,e)=>{var r=e[0],n=t.parser.mode;return n==="math"&&(Qt({strict:t.parser.settings.strict,errorCode:"mathVsTextAccents",errorMsg:"LaTeX's accent "+t.funcName+" works only in text mode",report:!0}),n="text"),{type:"accent",mode:n,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}}});te({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"accentUnder",mode:r.mode,label:n,base:o}},htmlBuilder:(t,e)=>{var r=Re(t.base,e),n=Vc(t,e),o=t.label==="\\utilde"?.12:0,i=Be({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:r}]});return G(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var r=Fc(t.label),n=new Z("munder",[je(t.base,e),r]);return n.setAttribute("accentunder","true"),n}});var bl=t=>{var e=new Z("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};te({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(t,e,r){var n=t.parser,o=t.funcName;return{type:"xArrow",mode:n.mode,label:o,body:e[0],below:r[0]}},htmlBuilder(t,e){var r=e.style,n=e.havingStyle(r.sup()),o=Qi(Re(t.body,n,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";o.classes.push(i+"-arrow-pad");var s;t.below&&(n=e.havingStyle(r.sub()),s=Qi(Re(t.below,n,e),e),s.classes.push(i+"-arrow-pad"));var a=Vc(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(o.depth>.25||t.label==="\\xleftequilibrium")&&(c-=o.depth);var u;if(s){var d=-e.fontMetrics().axisHeight+s.height+.5*a.height+.111;u=Be({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:d}]})}else u=Be({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return G(["mrel","x-arrow"],[u],e)},mathmlBuilder(t,e){var r=Fc(t.label);r.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(t.body){var o=bl(je(t.body,e));if(t.below){var i=bl(je(t.below,e));n=new Z("munderover",[r,i,o])}else n=new Z("mover",[r,o])}else if(t.below){var s=bl(je(t.below,e));n=new Z("munder",[r,s])}else n=bl(),n=new Z("mover",[r,n]);return n}});function iA(t,e){var r=xt(t.body,e,!0);return G([t.mclass],r,e)}function sA(t,e){var r,n=yr(t.body,e);return t.mclass==="minner"?r=new Z("mpadded",n):t.mclass==="mord"?t.isCharacterBox?(r=n[0],r.type="mi"):r=new Z("mi",n):(t.isCharacterBox?(r=n[0],r.type="mo"):r=new Z("mo",n),t.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):t.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):(t.mclass==="mopen"||t.mclass==="mclose")&&(r.attributes.lspace="0em",r.attributes.rspace="0em")),r}te({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:ft(o),isCharacterBox:Fn(o)}},htmlBuilder:iA,mathmlBuilder:sA});var Uc=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};te({type:"mclass",names:["\\@binrel"],numArgs:2,handler(t,e){var r=t.parser;return{type:"mclass",mode:r.mode,mclass:Uc(e[0]),body:ft(e[1]),isCharacterBox:Fn(e[1])}}});te({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(t,e){var r=t.parser,n=t.funcName,o=e[1],i=e[0],s;n!=="\\stackrel"?s=Uc(o):s="mrel";var a={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:ft(o)},l=n==="\\underset"?{type:"supsub",mode:i.mode,base:a,sub:i}:{type:"supsub",mode:i.mode,base:a,sup:i};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:Fn(l)}}});te({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser;return{type:"pmb",mode:r.mode,mclass:Uc(e[0]),body:ft(e[0])}},htmlBuilder(t,e){var r=xt(t.body,e,!0),n=G([t.mclass],r,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(t,e){var r=yr(t.body,e),n=new Z("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var aA={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},v4=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),y4=t=>t.type==="textord"&&t.text==="@",lA=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function cA(t,e,r){var n=aA[t];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var o=r.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[i],[]),a=r.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[o,s,a]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function uA(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var r=t.fetch().text;if(r==="&"||r==="\\\\")t.consume();else if(r==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new K("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var n=[],o=[n],i=0;i<e.length;i++){for(var s=e[i],a=v4(),l=0;l<s.length;l++)if(!y4(s[l]))a.body.push(s[l]);else{n.push(a),l+=1;var c=Wc(s[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var h=!0,p=l+1;p<s.length;p++){if(lA(s[p],c)){h=!1,l=p;break}if(y4(s[p]))throw new K("Missing a "+c+" character to complete a CD arrow.",s[p]);u[d].body.push(s[p])}if(h)throw new K("Missing a "+c+" character to complete a CD arrow.",s[l])}else throw new K('Expected one of "<>AV=|." after @',s[l]);var g=cA(c,u,t),y={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};n.push(y),a=v4()}i%2===0?n.push(a):n.shift(),n=[],o.push(n)}t.gullet.endGroup(),t.gullet.endGroup();var v=new Array(o[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:o,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(o.length+1).fill([])}}te({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:e[0]}},htmlBuilder(t,e){var r=e.havingStyle(e.style.sup()),n=Qi(Re(t.label,r,e),e);return n.classes.push("cd-label-"+t.side),n.style.bottom=J(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(t,e){var r=new Z("mrow",[je(t.label,e)]);return r=new Z("mpadded",[r]),r.setAttribute("width","0"),t.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Z("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});te({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler(t,e){var r=t.parser;return{type:"cdlabelparent",mode:r.mode,fragment:e[0]}},htmlBuilder(t,e){var r=Qi(Re(t.fragment,e),e);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(t,e){return new Z("mrow",[je(t.fragment,e)])}});te({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser,n=Se(e[0],"ordgroup"),o=$h(n,"\\@char has non-numeric argument"),i=parseInt(o),s;if(isNaN(i))throw new K("\\@char has non-numeric argument "+o);if(i<0||i>1114111)throw new K("\\@char with invalid code point "+o);return i<=65535?s=String.fromCharCode(i):(i-=65536,s=String.fromCharCode((i>>10)+55296,(i&1023)+56320)),{type:"textord",mode:r.mode,text:s}}});var dA=(t,e)=>{var r=xt(t.body,e.withColor(t.color),!1);return Wn(r)},hA=(t,e)=>{var r=yr(t.body,e.withColor(t.color)),n=new Z("mstyle",r);return n.setAttribute("mathcolor",t.color),n};te({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(t,e){var r=t.parser,n=Se(e[0],"color-token").color,o=e[1];return{type:"color",mode:r.mode,color:n,body:ft(o)}},htmlBuilder:dA,mathmlBuilder:hA});te({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(t,e){var r=t.parser,n=t.breakOnTokenText,o=Se(e[0],"color-token").color;r.gullet.macros.set("\\current@color",o);var i=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:o,body:i}}});te({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(t){var e=t.parser,r=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,n=!e.settings.displayMode||!Qt({strict:e.settings.strict,errorCode:"newLineInDisplayMode",errorMsg:"In LaTeX, \\\\ or \\newline does nothing in display mode",report:!1});return{type:"cr",mode:e.mode,newLine:n,size:r&&Se(r,"size").value}},htmlBuilder(t,e){var r=G(["mspace"],[],e);return t.newLine&&(r.classes.push("katex-newline"),t.size&&(r.style.marginTop=J(ot(t.size,e)))),r},mathmlBuilder(t,e){var r=new Z("mspace");return t.newLine&&(r.setAttribute("linebreak","newline"),t.size&&r.setAttribute("height",J(ot(t.size,e)))),r}});var qd={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},D7=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new K("Expected a control sequence",t);return e},fA=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},B7=(t,e,r,n)=>{var o=t.gullet.macros.get(r.text);o==null&&(r.noexpand=!0,o={tokens:[r],numArgs:0,unexpandable:!t.gullet.isExpandable(r.text)}),t.gullet.macros.set(e,o,n)};te({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(t){var e=t.parser,r=t.funcName;e.consumeSpaces();var n=e.fetch();if(qd[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=qd[n.text]),Se(e.parseFunction(),"internal");throw new K("Invalid token after macro prefix",n)}});te({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=e.gullet.popToken(),o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new K("Expected a control sequence",n);for(var i=0,s,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){s=e.gullet.future(),a[i].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new K('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==i+1)throw new K('Argument number "'+n.text+'" out of order');i++,a.push([])}else{if(n.text==="EOF")throw new K("Expected a macro definition");a[i].push(n.text)}var l=e.gullet.consumeArg(),c=l.tokens;return s&&c.unshift(s),(r==="\\edef"||r==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(o,{tokens:c,numArgs:i,delimiters:a},r===qd[r]),{type:"internal",mode:e.mode}}});te({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=D7(e.gullet.popToken());e.gullet.consumeSpaces();var o=fA(e);return B7(e,n,o,r==="\\\\globallet"),{type:"internal",mode:e.mode}}});te({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var e=t.parser,r=t.funcName,n=D7(e.gullet.popToken()),o=e.gullet.popToken(),i=e.gullet.popToken();return B7(e,n,i,r==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(o),{type:"internal",mode:e.mode}}});var Bs=function(e,r,n){var o=Qe.math[e]&&Qe.math[e].replace,i=Dh(o||e,r,n);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+r+".");return i},qh=function(e,r,n,o){var i=n.havingBaseStyle(r),s=G(o.concat(i.sizingClasses(n)),[e],n),a=i.sizeMultiplier/n.sizeMultiplier;return s.height*=a,s.depth*=a,s.maxFontSize=i.sizeMultiplier,s},z7=function(e,r,n){var o=r.havingBaseStyle(n),i=(1-r.sizeMultiplier/o.sizeMultiplier)*r.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=J(i),e.height-=i,e.depth+=i},pA=function(e,r,n,o,i,s){var a=Vt(e,"Main-Regular",i,o),l=qh(a,r,o,s);return z7(l,o,r),l},mA=function(e,r,n,o){return Vt(e,"Size"+r+"-Regular",n,o)},N7=function(e,r,n,o,i,s){var a=mA(e,r,i,o),l=qh(G(["delimsizing","size"+r],[a],o),ge.TEXT,o,s);return n&&z7(l,o,ge.TEXT),l},Du=function(e,r,n,o){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=G(["delimsizinginner",i],[G([],[Vt(e,r,n,o)])]);return{type:"elem",elem:s}},Bu=function(e,r,n){var o=an["Size4-Regular"][e.charCodeAt(0)]?an["Size4-Regular"][e.charCodeAt(0)][4]:an["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",vS(e,Math.round(1e3*r))),s=new Hn([i],{width:J(o),height:J(r),style:"width:"+J(o),viewBox:"0 0 "+1e3*o+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),a=wo([],[s],n);return a.height=r,a.style.height=J(r),a.style.width=J(o),{type:"elem",elem:a}},Fd=.008,wl={type:"kern",size:-1*Fd},gA=new Set(["|","\\lvert","\\rvert","\\vert"]),vA=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),H7=function(e,r,n,o,i,s){var a,l,c,u,d="",h=0;a=c=u=e,l=null;var p="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):gA.has(e)?(c="∣",d="vert",h=333):vA.has(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",u="⎣",p="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",u="⎦",p="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",u="⎣",p="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=u="⎢",p="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",u="⎦",p="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=u="⎥",p="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",u="⎝",p="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",u="⎠",p="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",p="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",p="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",u="⎩",c="⎪",p="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",u="⎭",c="⎪",p="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",u="⎭",c="⎪",p="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",u="⎩",c="⎪",p="Size4-Regular");var g=Bs(a,p,i),y=g.height+g.depth,v=Bs(c,p,i),w=v.height+v.depth,C=Bs(u,p,i),k=C.height+C.depth,S=0,E=1;if(l!==null){var R=Bs(l,p,i);S=R.height+R.depth,E=2}var H=y+k+S,O=Math.max(0,Math.ceil((r-H)/(E*w))),P=H+O*E*w,$=o.fontMetrics().axisHeight;n&&($*=o.sizeMultiplier);var ie=P/2-$,N=[];if(d.length>0){var ye=P-y-k,be=Math.round(P*1e3),Fe=yS(d,Math.round(ye*1e3)),ke=new bo(d,Fe),we=J(h/1e3),fe=J(be/1e3),rt=new Hn([ke],{width:we,height:fe,viewBox:"0 0 "+h+" "+be}),kt=wo([],[rt],o);kt.height=be/1e3,kt.style.width=we,kt.style.height=fe,N.push({type:"elem",elem:kt})}else{if(N.push(Du(u,p,i,o)),N.push(wl),l===null){var vt=P-y-k+2*Fd;N.push(Bu(c,vt,o))}else{var ut=(P-y-k-S)/2+2*Fd;N.push(Bu(c,ut,o)),N.push(wl),N.push(Du(l,p,i,o)),N.push(wl),N.push(Bu(c,ut,o))}N.push(wl),N.push(Du(a,p,i,o))}var Et=o.havingBaseStyle(ge.TEXT),jr=Be({positionType:"bottom",positionData:ie,children:N});return qh(G(["delimsizing","mult"],[jr],Et),ge.TEXT,o,s)},zu=80,Nu=.08,Hu=function(e,r,n,o,i){var s=gS(e,o,n),a=new bo(e,s),l=new Hn([a],{width:"400em",height:J(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return wo(["hide-tail"],[l],i)},yA=function(e,r){var n=r.havingBaseSizing(),o=W7("\\surd",e*n.sizeMultiplier,V7,n),i=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return o.type==="small"?(u=1e3+1e3*s+zu,e<1?i=1:e<1.4&&(i=.7),l=(1+s+Nu)/i,c=(1+s)/i,a=Hu("sqrtMain",l,u,s,r),a.style.minWidth="0.853em",d=.833/i):o.type==="large"?(u=(1e3+zu)*da[o.size],c=(da[o.size]+s)/i,l=(da[o.size]+s+Nu)/i,a=Hu("sqrtSize"+o.size,l,u,s,r),a.style.minWidth="1.02em",d=1/i):(l=e+s+Nu,c=e+s,u=Math.floor(1e3*e+s)+zu,a=Hu("sqrtTall",l,u,s,r),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=J(l),{span:a,advanceWidth:d,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*i}},$7=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),bA=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),q7=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),da=[0,1.2,1.8,2.4,3],F7=function(e,r,n,o,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),$7.has(e)||q7.has(e))return N7(e,r,!1,n,o,i);if(bA.has(e))return H7(e,da[r],!1,n,o,i);throw new K("Illegal delimiter: '"+e+"'")},wA=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],xA=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"stack"}],V7=[{type:"small",style:ge.SCRIPTSCRIPT},{type:"small",style:ge.SCRIPT},{type:"small",style:ge.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],CA=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var r=e.type;throw new Error("Add support for delim type '"+r+"' here.")},W7=function(e,r,n,o){for(var i=Math.min(2,3-o.style.size),s=i;s<n.length;s++){var a=n[s];if(a.type==="stack")break;var l=Bs(e,CA(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=o.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>r)return a}return n[n.length-1]},Vd=function(e,r,n,o,i,s){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;q7.has(e)?a=wA:$7.has(e)?a=V7:a=xA;var l=W7(e,r,a,o);return l.type==="small"?pA(e,l.style,n,o,i,s):l.type==="large"?N7(e,l.size,n,o,i,s):H7(e,r,n,o,i,s)},$u=function(e,r,n,o,i,s){var a=o.fontMetrics().axisHeight*o.sizeMultiplier,l=901,c=5/o.fontMetrics().ptPerEm,u=Math.max(r-a,n+a),d=Math.max(u/500*l,2*u-c);return Vd(e,d,!0,o,i,s)},b4={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},kA=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function w4(t){return"isMiddle"in t}function Gc(t,e){var r=jc(t);if(r&&kA.has(r.text))return r;throw r?new K("Invalid delimiter '"+r.text+"' after '"+e.funcName+"'",t):new K("Invalid delimiter type '"+t.type+"'",t)}te({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(t,e)=>{var r=Gc(Ea(e[0]),t);return{type:"delimsizing",mode:t.parser.mode,size:b4[t.funcName].size,mclass:b4[t.funcName].mclass,delim:r.text}},htmlBuilder:(t,e)=>t.delim==="."?G([t.mclass]):F7(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ar(t.delim,t.mode));var r=new Z("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=J(da[t.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function x4(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}te({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=t.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new K("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Gc(e[0],t).text,color:r}}});te({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=Gc(e[0],t),n=t.parser;++n.leftrightDepth;var o=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Se(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:o,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{x4(t);for(var r=xt(t.body,e,!0,["mopen","mclose"]),n=0,o=0,i=!1,s=0;s<r.length;s++){var a=r[s];w4(a)?i=!0:(n=Math.max(r[s].height,n),o=Math.max(r[s].depth,o))}n*=e.sizeMultiplier,o*=e.sizeMultiplier;var l;if(t.left==="."?l=Ia(e,["mopen"]):l=$u(t.left,n,o,e,t.mode,["mopen"]),r.unshift(l),i)for(var c=1;c<r.length;c++){var u=r[c];if(w4(u)){var d=u.isMiddle;r[c]=$u(d.delim,n,o,d.options,t.mode,[])}}var h;if(t.right===".")h=Ia(e,["mclose"]);else{var p=t.rightColor?e.withColor(t.rightColor):e;h=$u(t.right,n,o,p,t.mode,["mclose"])}return r.push(h),G(["minner"],r,e)},mathmlBuilder:(t,e)=>{x4(t);var r=yr(t.body,e);if(t.left!=="."){var n=new Z("mo",[Ar(t.left,t.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(t.right!=="."){var o=new Z("mo",[Ar(t.right,t.mode)]);o.setAttribute("fence","true"),t.rightColor&&o.setAttribute("mathcolor",t.rightColor),r.push(o)}return Nh(r)}});te({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=Gc(e[0],t);if(!t.parser.leftrightDepth)throw new K("\\middle without preceding \\left",r);return{type:"middle",mode:t.parser.mode,delim:r.text}},htmlBuilder:(t,e)=>{var r;return t.delim==="."?r=Ia(e,[]):(r=F7(t.delim,1,e,t.mode,[]),r.isMiddle={delim:t.delim,options:e}),r},mathmlBuilder:(t,e)=>{var r=t.delim==="\\vert"||t.delim==="|"?Ar("|","text"):Ar(t.delim,t.mode),n=new Z("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var _A=(t,e)=>{var r=Qi(Re(t.body,e),e),n=t.label.slice(1),o=e.sizeMultiplier,i,s,a=Fn(t.body);if(n==="sout")i=G(["katex-stretchy","katex-sout"]),i.height=e.fontMetrics().defaultRuleThickness/o,s=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=ot({number:.6,unit:"pt"},e),c=ot({number:.35,unit:"ex"},e),u=e.havingBaseSizing();o=o/u.sizeMultiplier;var d=r.height+r.depth+l+c;r.style.paddingLeft=J(d/2+l);var h=Math.floor(1e3*d*o),p=pS(h),g=new Hn([new bo("phase",p)],{width:"400em",height:J(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});i=wo(["hide-tail"],[g],e),i.style.height=J(d),s=r.depth+l+c}else{/cancel/.test(n)?a||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var y,v,w=0;/box/.test(n)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),y=e.fontMetrics().fboxsep+(n==="colorbox"?0:w),v=y):n==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),y=4*w,v=Math.max(0,.25-r.depth)):(y=a?.2:0,v=y),i=YS(r,n,y,v,e),/fbox|boxed|fcolorbox/.test(n)?(i.style.borderStyle="solid",i.style.borderWidth=J(w)):n==="angl"&&w!==.049&&(i.style.borderTopWidth=J(w),i.style.borderRightWidth=J(w)),s=r.depth+v,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var C;if(t.backgroundColor)C=Be({positionType:"individualShift",children:[{type:"elem",elem:i,shift:s},{type:"elem",elem:r,shift:0}]});else{var k=/cancel|phase/.test(n)?["svg-align"]:[];C=Be({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:i,shift:s,wrapperClasses:k}]})}return/cancel/.test(n)&&(C.height=r.height,C.depth=r.depth),/cancel/.test(n)&&!a?G(["mord","cancel-lap"],[C],e):G(["mord"],[C],e)},SA=(t,e)=>{var r,n=new Z(t.label.includes("colorbox")?"mpadded":"menclose",[je(t.body,e)]);switch(t.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),t.label==="\\fcolorbox"){var o=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+J(o)+" solid "+t.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&n.setAttribute("mathbackground",t.backgroundColor),n};te({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(t,e,r){var n=t.parser,o=t.funcName,i=Se(e[0],"color-token").color,s=e[1];return{type:"enclose",mode:n.mode,label:o,backgroundColor:i,body:s}},htmlBuilder:_A,mathmlBuilder:SA});te({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(t,e,r){var n=t.parser,o=t.funcName,i=Se(e[0],"color-token").color,s=Se(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:o,backgroundColor:s,borderColor:i,body:a}}});te({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler(t,e){var r=t.parser;return{type:"enclose",mode:r.mode,label:"\\fbox",body:e[0]}}});te({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}}});te({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName;r.mode==="math"&&Qt({strict:r.settings.strict,errorCode:"mathVsSout",errorMsg:"LaTeX's \\sout works only in text mode",report:!0});var o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}}});te({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler(t,e){var r=t.parser;return{type:"enclose",mode:r.mode,label:"\\angl",body:e[0]}}});var j7={};function yn(t){for(var e=t.type,r=t.names,n=t.props,o=t.handler,i=t.htmlBuilder,s=t.mathmlBuilder,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o},l=0;l<r.length;++l)j7[r[l]]=a;i&&(Ta[e]=i),s&&(Ma[e]=s)}var U7={};function x(t,e){U7[t]=e}class Jt{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Jt(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class pr{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new pr(r,Jt.range(this,e))}}function C4(t){var e=[];t.consumeSpaces();var r=t.fetch().text;for(r==="\\relax"&&(t.consume(),t.consumeSpaces(),r=t.fetch().text);r==="\\hline"||r==="\\hdashline";)t.consume(),e.push(r==="\\hdashline"),t.consumeSpaces(),r=t.fetch().text;return e}var Kc=t=>{var e=t.parser.settings;if(!e.displayMode)throw new K("{"+t.envName+"} can be used only in display mode.")},AA=new Set(["gather","gather*"]);function Fh(t){if(!t.includes("ed"))return!t.includes("*")}function Ao(t,e,r){var n=e.hskipBeforeAndAfter,o=e.addJot,i=e.cols,s=e.arraystretch,a=e.colSeparationType,l=e.autoTag,c=e.singleRow,u=e.emptySingleRow,d=e.maxNumCols,h=e.leqno;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=t.gullet.expandMacroAsText("\\arraystretch");if(p==null)s=1;else if(s=parseFloat(p),!s||s<0)throw new K("Invalid \\arraystretch: "+p)}t.gullet.beginGroup();var g=[],y=[g],v=[],w=[],C=l!=null?[]:void 0;function k(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function S(){C&&(t.gullet.macros.get("\\df@tag")?(C.push(t.subparse([new pr("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(k(),w.push(C4(t));;){var E=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var R={type:"ordgroup",mode:t.mode,body:E};r&&(R={type:"styling",mode:t.mode,style:r,resetFont:!0,body:[R]}),g.push(R);var H=t.fetch().text;if(H==="&"){if(d&&g.length===d){if(c||a)throw new K("Too many tab characters: &",t.nextToken);Qt({strict:t.settings.strict,errorCode:"textEnv",errorMsg:"Too few columns specified in the {array} column argument.",report:!0})}t.consume()}else if(H==="\\end"){S(),g.length===1&&R.type==="styling"&&R.body.length===1&&R.body[0].type==="ordgroup"&&R.body[0].body.length===0&&(y.length>1||!u)&&!Array.isArray(C?.[C.length-1])&&!(l&&C?.[C.length-1]===!0)&&y.pop(),w.length<y.length+1&&w.push([]);break}else if(H==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),v.push(O?O.value:null),S(),w.push(C4(t)),g=[],y.push(g),k()}else throw new K("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:o,arraystretch:s,body:y,cols:i,rowGaps:v,hskipBeforeAndAfter:n,hLinesBeforeRow:w,colSeparationType:a,tags:C,leqno:h}}function Vh(t){return t.slice(0,1)==="d"?"display":"text"}var bn=function(e,r){var n,o,i=e.body.length,s=e.hLinesBeforeRow,a=0,l=new Array(i),c=[],u=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),d=1/r.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var p=r.havingStyle(ge.SCRIPT).sizeMultiplier;h=.2778*(p/r.sizeMultiplier)}var g=e.colSeparationType==="CD"?ot({number:3,unit:"ex"},r):12*d,y=3*d,v=e.arraystretch*g,w=.7*v,C=.3*v,k=0;function S(We){for(var Ye=0;Ye<We.length;++Ye)Ye>0&&(k+=.25),c.push({pos:k,isDashed:We[Ye]})}for(S(s[0]),n=0;n<e.body.length;++n){var E=e.body[n],R=w,H=C;a<E.length&&(a=E.length);var O={cells:new Array(E.length),height:0,depth:0,pos:0};for(o=0;o<E.length;++o){var P=Re(E[o],r);H<P.depth&&(H=P.depth),R<P.height&&(R=P.height),O.cells[o]=P}var $=e.rowGaps[n],ie=0;$&&(ie=ot($,r),ie>0&&(ie+=C,H<ie&&(H=ie),ie=0)),e.addJot&&n<e.body.length-1&&(H+=y),O.height=R,O.depth=H,k+=R,O.pos=k,k+=H+ie,l[n]=O,S(s[n+1])}var N=k/2+r.fontMetrics().axisHeight,ye=e.cols||[],be=[],Fe,ke,we=[];if(e.tags&&e.tags.some(We=>We))for(n=0;n<i;++n){var fe=l[n],rt=fe.pos-N,kt=e.tags[n],vt=void 0;kt===!0?vt=G(["eqn-num"],[],r):kt===!1?vt=G([],[],r):vt=G([],xt(kt,r,!0),r),vt.depth=fe.depth,vt.height=fe.height,we.push({type:"elem",elem:vt,shift:rt})}for(o=0,ke=0;o<a||ke<ye.length;++o,++ke){for(var ut,Et=ye[ke],jr=!0;((Mo=Et)==null?void 0:Mo.type)==="separator";){var Mo;if(jr||(Fe=G(["arraycolsep"],[]),Fe.style.width=J(r.fontMetrics().doubleRuleSep),be.push(Fe)),Et.separator==="|"||Et.separator===":"){var Ur=Et.separator==="|"?"solid":"dashed",Zt=G(["vertical-separator"],[],r);Zt.style.height=J(k),Zt.style.borderRightWidth=J(u),Zt.style.borderRightStyle=Ur,Zt.style.margin="0 "+J(-u/2);var jn=k-N;jn&&(Zt.style.verticalAlign=J(-jn)),be.push(Zt)}else throw new K("Invalid separator type: "+Et.separator);ke++,Et=ye[ke],jr=!1}if(!(o>=a)){var Ht=void 0;if(o>0||e.hskipBeforeAndAfter){var fi,_;Ht=(fi=(_=Et)==null?void 0:_.pregap)!=null?fi:h,Ht!==0&&(Fe=G(["arraycolsep"],[]),Fe.style.width=J(Ht),be.push(Fe))}var I=[];for(n=0;n<i;++n){var B=l[n],j=B.cells[o];if(j){var F=B.pos-N;j.depth=B.depth,j.height=B.height,I.push({type:"elem",elem:j,shift:F})}}var W=Be({positionType:"individualShift",children:I}),Q=G(["col-align-"+(((ut=Et)==null?void 0:ut.align)||"c")],[W]);if(be.push(Q),o<a-1||e.hskipBeforeAndAfter){var Y,X;Ht=(Y=(X=Et)==null?void 0:X.postgap)!=null?Y:h,Ht!==0&&(Fe=G(["arraycolsep"],[]),Fe.style.width=J(Ht),be.push(Fe))}}}var q=G(["mtable"],be);if(c.length>0){for(var ae=Ji("katex-hline",r,u),ee=Ji("katex-hdashline",r,u),se=[{type:"elem",elem:q,shift:0}];c.length>0;){var ue=c.pop(),_e=ue.pos-N;ue.isDashed?se.push({type:"elem",elem:ee,shift:_e}):se.push({type:"elem",elem:ae,shift:_e})}q=Be({positionType:"individualShift",children:se})}if(we.length===0)return G(["mord"],[q],r);var Le=Be({positionType:"individualShift",children:we}),Ee=G(["katex-tag"],[Le],r);return Wn([q,Ee])},TA={c:"center ",l:"left ",r:"right "},wn=function(e,r){for(var n=[],o=new Z("mtd",[],["mtr-glue"]),i=new Z("mtd",[],["mml-eqn-num"]),s=0;s<e.body.length;s++){for(var a=e.body[s],l=[],c=0;c<a.length;c++)l.push(new Z("mtd",[je(a[c],r)]));e.tags&&e.tags[s]&&(l.unshift(o),l.push(o),e.leqno?l.unshift(i):l.push(i)),n.push(new Z("mtr",l))}var u=new Z("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",J(d));var h="",p="";if(e.cols&&e.cols.length>0){var g=e.cols,y="",v=!1,w=0,C=g.length;g[0].type==="separator"&&(h+="top ",w=1),g[g.length-1].type==="separator"&&(h+="bottom ",C-=1);for(var k=w;k<C;k++){var S=g[k];S.type==="align"?(p+=TA[S.align],v&&(y+="none "),v=!0):S.type==="separator"&&v&&(y+=S.separator==="|"?"solid ":"dashed ",v=!1)}u.setAttribute("columnalign",p.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(e.colSeparationType==="align"){for(var E=e.cols||[],R="",H=1;H<E.length;H++)R+=H%2?"0em ":"1em ";u.setAttribute("columnspacing",R.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var O="",P=e.hLinesBeforeRow;h+=P[0].length>0?"left ":"",h+=P[P.length-1].length>0?"right ":"";for(var $=1;$<P.length-1;$++)O+=P[$].length===0?"none ":P[$][0]?"dashed ":"solid ";return/[sd]/.test(O)&&u.setAttribute("rowlines",O.trim()),h!==""&&(u=new Z("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new Z("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},G7=function(e,r){e.envName.includes("ed")||Kc(e);var n=[],o=e.envName==="split",i=Ao(e.parser,{cols:n,addJot:!0,autoTag:o?void 0:Fh(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,a=0,l={type:"ordgroup",mode:e.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){var c="Number of columns should be a positive integer",u=$h(r[0],c);if(!/^[0-9]+$/.test(u)||Number(u)<1)throw new K(c,r[0]);s=Number(u),a=s*2}var d=!a;i.body.forEach(function(y){for(var v=1;v<y.length;v+=2){var w=Se(y[v],"styling"),C=Se(w.body[0],"ordgroup");C.body.unshift(l)}if(d)a<y.length&&(a=y.length);else{var k=y.length/2;if(s<k)throw new K("Too many math in a row: "+("expected "+s+", but got "+k),y[0])}});for(var h=0;h<a;++h){var p="r",g=0;h%2===1?p="l":h>0&&d&&(g=1),n[h]={type:"align",align:p,pregap:g,postgap:0}}return i.colSeparationType=d?"align":"alignat",i};yn({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var r=jc(e[0]),n=r?[e[0]]:Se(e[0],"ordgroup").body,o=n.map(function(s){var a=Wc(s),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new K("Unknown column alignment: "+l,s)}),i={cols:o,hskipBeforeAndAfter:!0,maxNumCols:o.length};return Ao(t.parser,i,Vh(t.envName))},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(t.envName.charAt(t.envName.length-1)==="*"){var o=t.parser;if(o.consumeSpaces(),o.fetch().text==="["){if(o.consume(),o.consumeSpaces(),r=o.fetch().text,!"lcr".includes(r))throw new K("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),n.cols=[{type:"align",align:r}]}}var i=Ao(t.parser,n,Vh(t.envName)),s=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(s).fill({type:"align",align:r}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},r=Ao(t.parser,e,"script");return r.colSeparationType="small",r},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var r=jc(e[0]),n=r?[e[0]]:Se(e[0],"ordgroup").body,o=n.map(function(a){var l=Wc(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new K("Unknown column alignment: "+c,a)});if(o.length>1)throw new K("{subarray} can contain only one column");var i={cols:o,hskipBeforeAndAfter:!1,arraystretch:.5},s=Ao(t.parser,i,"script");if(s.body.length>0&&s.body[0].length>1)throw new K("{subarray} can contain only one column");return s},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Ao(t.parser,e,Vh(t.envName));return{type:"leftright",mode:t.mode,body:[r],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:G7,htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){AA.has(t.envName)&&Kc(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Fh(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Ao(t.parser,e,"display")},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:G7,htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Kc(t);var e={autoTag:Fh(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Ao(t.parser,e,"display")},htmlBuilder:bn,mathmlBuilder:wn});yn({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Kc(t),uA(t.parser)},htmlBuilder:bn,mathmlBuilder:wn});x("\\nonumber","\\gdef\\@eqnsw{0}");x("\\notag","\\nonumber");te({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(t,e){throw new K(t.funcName+" valid only within array environment")}});var k4=j7;te({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(t,e){var r=t.parser,n=t.funcName,o=e[0];if(o.type!=="ordgroup")throw new K("Invalid environment name",o);var i=$h(o,"Environment name should contain only text characters and spaces",!0);if(n==="\\begin"){if(!Object.prototype.hasOwnProperty.call(k4,i))throw new K("No such environment: "+i,o);var s=k4[i],a=r.parseArguments("\\begin{"+i+"}",s),l=a.args,c=a.optArgs,u={mode:r.mode,envName:i,parser:r},d=s.handler(u,l,c);r.expect("\\end",!1);var h=r.nextToken,p=Se(r.parseFunction(),"environment");if(p.name!==i)throw new K("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",h);return d}return{type:"environment",mode:r.mode,name:i,nameGroup:o}}});var MA=(t,e)=>{var r=t.font,n=e.withFont(r);return Re(t.body,n)},EA=(t,e)=>{var r=t.font,n=e.withFont(r);return je(t.body,n)},_4={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};te({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=Ea(e[0]),i=n in _4?_4[n]:n;return{type:"font",mode:r.mode,font:i.slice(1),body:o}},htmlBuilder:MA,mathmlBuilder:EA});te({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"mclass",mode:r.mode,mclass:Uc(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:Fn(n)}}});te({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=t.breakOnTokenText,i=r.mode,s=r.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}}});var IA=(t,e)=>{var r=e.style,n=r.fracNum(),o=r.fracDen(),i;i=e.havingStyle(n);var s=Re(t.numer,i,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;s.height=s.height<a?a:s.height,s.depth=s.depth<l?l:s.depth}i=e.havingStyle(o);var c=Re(t.denom,i,e),u,d,h;t.hasBarLine?(t.barSize?(d=ot(t.barSize,e),u=Ji("frac-line",e,d)):u=Ji("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var p,g,y;r.size===ge.DISPLAY.size?(p=e.fontMetrics().num1,d>0?g=3*h:g=7*h,y=e.fontMetrics().denom1):(d>0?(p=e.fontMetrics().num2,g=h):(p=e.fontMetrics().num3,g=3*h),y=e.fontMetrics().denom2);var v;if(u){var C=e.fontMetrics().axisHeight;p-s.depth-(C+.5*d)<g&&(p+=g-(p-s.depth-(C+.5*d))),C-.5*d-(c.height-y)<g&&(y+=g-(C-.5*d-(c.height-y)));var k=-(C-.5*d);v=Be({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:k},{type:"elem",elem:s,shift:-p}]})}else{var w=p-s.depth-(c.height-y);w<g&&(p+=.5*(g-w),y+=.5*(g-w)),v=Be({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:s,shift:-p}]})}i=e.havingStyle(r),v.height*=i.sizeMultiplier/e.sizeMultiplier,v.depth*=i.sizeMultiplier/e.sizeMultiplier;var S;r.size===ge.DISPLAY.size?S=e.fontMetrics().delim1:r.size===ge.SCRIPTSCRIPT.size?S=e.havingStyle(ge.SCRIPT).fontMetrics().delim2:S=e.fontMetrics().delim2;var E,R;return t.leftDelim==null?E=Ia(e,["mopen"]):E=Vd(t.leftDelim,S,!0,e.havingStyle(r),t.mode,["mopen"]),t.continued?R=G([]):t.rightDelim==null?R=Ia(e,["mclose"]):R=Vd(t.rightDelim,S,!0,e.havingStyle(r),t.mode,["mclose"]),G(["mord"].concat(i.sizingClasses(e)),[E,G(["mfrac"],[v]),R],e)},LA=(t,e)=>{var r=new Z("mfrac",[je(t.numer,e),je(t.denom,e)]);if(!t.hasBarLine)r.setAttribute("linethickness","0px");else if(t.barSize){var n=ot(t.barSize,e);r.setAttribute("linethickness",J(n))}if(t.leftDelim!=null||t.rightDelim!=null){var o=[];if(t.leftDelim!=null){var i=new Z("mo",[new pt(t.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),o.push(i)}if(o.push(r),t.rightDelim!=null){var s=new Z("mo",[new pt(t.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),o.push(s)}return Nh(o)}return r},K7=(t,e)=>{if(!e)return t;var r={type:"styling",mode:t.mode,style:e,body:[t]};return r};te({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0],i=e[1],s,a=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,a="(",l=")";break;case"\\\\bracefrac":s=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=n==="\\cfrac",u=null;return c||n.startsWith("\\d")?u="display":n.startsWith("\\t")&&(u="text"),K7({type:"genfrac",mode:r.mode,numer:o,denom:i,continued:c,hasBarLine:s,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:IA,mathmlBuilder:LA});te({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(t){var e=t.parser,r=t.funcName,n=t.token,o;switch(r){case"\\over":o="\\frac";break;case"\\choose":o="\\binom";break;case"\\atop":o="\\\\atopfrac";break;case"\\brace":o="\\\\bracefrac";break;case"\\brack":o="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:o,token:n}}});var S4=["display","text","script","scriptscript"],A4=function(e){var r=null;return e.length>0&&(r=e,r=r==="."?null:r),r};te({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(t,e){var r=t.parser,n=e[4],o=e[5],i=Ea(e[0]),s=i.type==="atom"&&i.family==="open"?A4(i.text):null,a=Ea(e[1]),l=a.type==="atom"&&a.family==="close"?A4(a.text):null,c=Se(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h=null,p=e[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Se(p.body[0],"textord");h=S4[Number(g.text)]}}else p=Se(p,"textord"),h=S4[Number(p.text)];return K7({type:"genfrac",mode:r.mode,numer:n,denom:o,continued:!1,hasBarLine:u,barSize:d,leftDelim:s,rightDelim:l},h)}});te({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(t,e){var r=t.parser;t.funcName;var n=t.token;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Se(e[0],"size").value,token:n}}});te({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(t,e)=>{var r=t.parser;t.funcName;var n=e[0],o=Se(e[1],"infix").size;if(!o)throw new Error("\\\\abovefrac expected size, but got "+String(o));var i=e[2],s=o.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:s,barSize:o,leftDelim:null,rightDelim:null}}});var Z7=(t,e)=>{var r=e.style,n,o;t.type==="supsub"?(n=t.sup?Re(t.sup,e.havingStyle(r.sup()),e):Re(t.sub,e.havingStyle(r.sub()),e),o=Se(t.base,"horizBrace")):o=Se(t,"horizBrace");var i=Re(o.base,e.havingBaseStyle(ge.DISPLAY)),s=Vc(o,e),a;if(o.isOver?a=Be({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):a=Be({positionType:"bottom",positionData:i.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),n){var l=G(["minner",o.isOver?"mover":"munder"],[a],e);o.isOver?a=Be({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):a=Be({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return G(["minner",o.isOver?"mover":"munder"],[a],e)},RA=(t,e)=>{var r=Fc(t.label);return new Z(t.isOver?"mover":"munder",[je(t.base,e),r])};te({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(t,e){var r=t.parser,n=t.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:Z7,mathmlBuilder:RA});te({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[1],o=Se(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:r.mode,href:o,body:ft(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var r=xt(t.body,e,!1);return PS(t.href,[],r,e)},mathmlBuilder:(t,e)=>{var r=xo(t.body,e);return r instanceof Z||(r=new Z("mrow",[r])),r.setAttribute("href",t.href),r}});te({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=Se(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var o=[],i=0;i<n.length;i++){var s=n[i];s==="~"&&(s="\\textasciitilde"),o.push({type:"textord",mode:"text",text:s})}var a={type:"text",mode:r.mode,font:"\\texttt",body:o};return{type:"href",mode:r.mode,href:n,body:ft(a)}}});te({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler(t,e){var r=t.parser;return{type:"hbox",mode:r.mode,body:ft(e[0])}},htmlBuilder(t,e){var r=xt(t.body,e.withFont(""),!1);return Wn(r)},mathmlBuilder(t,e){return new Z("mrow",yr(t.body,e.withFont("")))}});te({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName;t.token;var o=Se(e[0],"raw").string,i=e[1];r.settings.strict&&Qt({strict:r.settings.strict,errorCode:"htmlExtension",errorMsg:"HTML extension is disabled on strict mode",report:!0});var s,a={};switch(n){case"\\htmlClass":a.class=o,s={command:"\\htmlClass",class:o};break;case"\\htmlId":a.id=o,s={command:"\\htmlId",id:o};break;case"\\htmlStyle":a.style=o,s={command:"\\htmlStyle",style:o};break;case"\\htmlData":{for(var l="{,}",c=[],u="",d=0;d<o.length;d++)o.startsWith(l,d)?(u+=",",d+=l.length-1):o[d]===","?(c.push(u),u=""):u+=o[d];c.push(u);for(var h=0;h<c.length;h++){var p=c[h],g=p.indexOf("=");if(g<0)throw new K("\\htmlData key/value '"+p+"' missing equals sign");var y=p.slice(0,g),v=p.slice(g+1);a["data-"+y.trim()]=v}s={command:"\\htmlData",attributes:a};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(s)?{type:"html",mode:r.mode,attributes:a,body:ft(i)}:r.formatUnsupportedCmd(n)},htmlBuilder:(t,e)=>{var r=xt(t.body,e,!1),n=["enclosing"];t.attributes.class&&n.push(...t.attributes.class.trim().split(/\s+/));var o=G(n,r,e);for(var i of Object.entries(t.attributes)){var s=i[0],a=i[1];s!=="class"&&o.setAttribute(s,a)}return o},mathmlBuilder:(t,e)=>xo(t.body,e)});te({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(t,e)=>{var r=t.parser;return{type:"htmlmathml",mode:r.mode,html:ft(e[0]),mathml:ft(e[1])}},htmlBuilder:(t,e)=>{var r=xt(t.html,e,!1);return Wn(r)},mathmlBuilder:(t,e)=>xo(t.mathml,e)});var qu=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!r)throw new K("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!y7(n))throw new K("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};te({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(t,e,r)=>{var n=t.parser,o={number:0,unit:"em"},i={number:.9,unit:"em"},s={number:0,unit:"em"},a="";if(r[0])for(var l=Se(r[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":a=h;break;case"width":o=qu(h);break;case"height":i=qu(h);break;case"totalheight":s=qu(h);break;default:throw new K("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var p=Se(e[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:n.mode,alt:a,width:o,height:i,totalheight:s,src:p}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var r=ot(t.height,e),n=0;t.totalheight.number>0&&(n=ot(t.totalheight,e)-r);var o=0;t.width.number>0&&(o=ot(t.width,e));var i={height:J(r+n)};o>0&&(i.width=J(o)),n>0&&(i.verticalAlign=J(-n));var s=new CS(t.src,t.alt,i);return s.height=r,s.depth=n,s},mathmlBuilder:(t,e)=>{var r=new Z("mglyph",[]);r.setAttribute("alt",t.alt);var n=ot(t.height,e),o=0;if(t.totalheight.number>0&&(o=ot(t.totalheight,e)-n,r.setAttribute("valign",J(-o))),r.setAttribute("height",J(n+o)),t.width.number>0){var i=ot(t.width,e);r.setAttribute("width",J(i))}return r.setAttribute("src",t.src),r}});te({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName,o=Se(e[0],"size");if(r.settings.strict){var i=n[1]==="m",s=o.value.unit==="mu";i?(s||Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" supports only mu units, "+("not "+o.value.unit+" units"),report:!0}),r.mode!=="math"&&Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" works only in math mode",report:!0})):s&&Qt({strict:r.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+n+" doesn't support mu units",report:!0})}return{type:"kern",mode:r.mode,dimension:o.value}},htmlBuilder(t,e){return _7(t.dimension,e)},mathmlBuilder(t,e){var r=ot(t.dimension,e);return new I7(r)}});te({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:o}},htmlBuilder:(t,e)=>{var r;t.alignment==="clap"?(r=G([],[Re(t.body,e)]),r=G(["katex-inner"],[r],e)):r=G(["katex-inner"],[Re(t.body,e)]);var n=G(["katex-fix"],[]),o=G([t.alignment],[r,n],e),i=G(["katex-strut"]);return i.style.height=J(o.height+o.depth),o.depth&&(i.style.verticalAlign=J(-o.depth)),o.children.unshift(i),o=G(["katex-thinbox"],[o],e),G(["mord","katex-vbox"],[o],e)},mathmlBuilder:(t,e)=>{var r=new Z("mpadded",[je(t.body,e)]);if(t.alignment!=="rlap"){var n=t.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});te({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){var r=t.funcName,n=t.parser,o=n.mode;n.switchMode("math");var i=r==="\\("?"\\)":"$",s=n.parseExpression(!1,i);return n.expect(i),n.switchMode(o),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});te({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){throw new K("Mismatched "+t.funcName)}});var T4=(t,e)=>{switch(e.style.size){case ge.DISPLAY.size:return t.display;case ge.TEXT.size:return t.text;case ge.SCRIPT.size:return t.script;case ge.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};te({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(t,e)=>{var r=t.parser;return{type:"mathchoice",mode:r.mode,display:ft(e[0]),text:ft(e[1]),script:ft(e[2]),scriptscript:ft(e[3])}},htmlBuilder:(t,e)=>{var r=T4(t,e),n=xt(r,e,!1);return Wn(n)},mathmlBuilder:(t,e)=>{var r=T4(t,e);return xo(r,e)}});var X7=(t,e,r,n,o,i,s)=>{t=G([],[t]);var a=r&&Fn(r),l,c;if(e){var u=Re(e,n.havingStyle(o.sup()),n);c={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var d=Re(r,n.havingStyle(o.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+s;h=Be({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:J(-i)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:J(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var g=t.height-s;h=Be({positionType:"top",positionData:g,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:J(-i)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var y=t.depth+s;h=Be({positionType:"bottom",positionData:y,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:J(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return t;var v=[h];if(l&&i!==0&&!a){var w=G(["mspace"],[],n);w.style.marginRight=J(i),v.unshift(w)}return G(["mop","op-limits"],v,n)},Y7=new Set(["\\smallint"]),J7=(t,e)=>{var r,n,o=!1,i;t.type==="supsub"?(r=t.sup,n=t.sub,i=Se(t.base,"op"),o=!0):i=Se(t,"op");var s=e.style,a=!1;s.size===ge.DISPLAY.size&&i.symbol&&!Y7.has(i.name)&&(a=!0);var l,c;if(i.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Vt(i.name,u,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var h=A7(d+"Size"+(a?"2":"1"),e);l=Be({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:a?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var p=xt(i.body,e,!0);p.length===1&&p[0]instanceof mr?(l=p[0],l.classes[0]="mop"):l=G(["mop"],p,e)}else{for(var g=[],y=1;y<i.name.length;y++)g.push(Bh(i.name[y],i.mode,e));l=G(["mop"],g,e)}var v=0,w=0;if((l instanceof mr||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var C;v=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=(C=l.italic)!=null?C:0}return o?X7(l,r,n,e,s,w,v):(v&&(l.style.position="relative",l.style.top=J(v)),l)},OA=(t,e)=>{var r;if(t.symbol)r=new Z("mo",[Ar(t.name,t.mode)]),Y7.has(t.name)&&r.setAttribute("largeop","false");else if(t.body)r=new Z("mo",yr(t.body,e));else{r=new Z("mi",[new pt(t.name.slice(1))]);var n=new Z("mo",[Ar("⁡","text")]);t.parentIsSupSub?r=new Z("mrow",[r,n]):r=E7([r,n])}return r},PA={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};te({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=n;return o.length===1&&(o=PA[o]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:J7,mathmlBuilder:OA});te({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ft(n)}}});var DA={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};te({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(t){var e=t.parser,r=t.funcName;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}}});te({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(t){var e=t.parser,r=t.funcName;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}}});te({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(t){var e=t.parser,r=t.funcName,n=r;return n.length===1&&(n=DA[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}}});var Q7=(t,e)=>{var r,n,o=!1,i;t.type==="supsub"?(r=t.sup,n=t.sub,i=Se(t.base,"operatorname"),o=!0):i=Se(t,"operatorname");var s;if(i.body.length>0){for(var a=i.body.map(d=>{var h="text"in d?d.text:void 0;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=xt(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof mr&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=G(["mop"],l,e)}else s=G(["mop"],[],e);return o?X7(s,r,n,e,e.style,0,0):s},BA=(t,e)=>{for(var r=yr(t.body,e.withFont("mathrm")),n=!0,o=0;o<r.length;o++){var i=r[o];if(!(i instanceof I7))if(i instanceof Z)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var s=i.children[0];i.children.length===1&&s instanceof pt?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=r.map(u=>u.toText()).join("");r=[new pt(a)]}var l=new Z("mi",r);l.setAttribute("mathvariant","normal");var c=new Z("mo",[Ar("⁡","text")]);return t.parentIsSupSub?new Z("mrow",[l,c]):E7([l,c])};te({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(t,e)=>{var r=t.parser,n=t.funcName,o=e[0];return{type:"operatorname",mode:r.mode,body:ft(o),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Q7,mathmlBuilder:BA});x("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");di({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Wn(xt(t.body,e,!1)):G(["mord"],xt(t.body,e,!0),e)},mathmlBuilder(t,e){return xo(t.body,e,!0)}});te({type:"overline",names:["\\overline"],numArgs:1,handler(t,e){var r=t.parser,n=e[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(t,e){var r=Re(t.body,e.havingCrampedStyle()),n=Ji("overline-line",e),o=e.fontMetrics().defaultRuleThickness,i=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n},{type:"kern",size:o}]});return G(["mord","katex-overline"],[i],e)},mathmlBuilder(t,e){var r=new Z("mo",[new pt("‾")]);r.setAttribute("stretchy","true");var n=new Z("mover",[je(t.body,e),r]);return n.setAttribute("accent","true"),n}});te({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"phantom",mode:r.mode,body:ft(n)}},htmlBuilder:(t,e)=>{var r=xt(t.body,e.withPhantom(),!1);return Wn(r)},mathmlBuilder:(t,e)=>{var r=yr(t.body,e);return new Z("mphantom",r)}});x("\\hphantom","\\smash{\\phantom{#1}}");te({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var r=t.parser,n=e[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(t,e)=>{var r=G(["katex-inner"],[Re(t.body,e.withPhantom())]),n=G(["katex-fix"],[]);return G(["mord","rlap"],[r,n],e)},mathmlBuilder:(t,e)=>{var r=yr(ft(t.body),e),n=new Z("mphantom",r),o=new Z("mpadded",[n]);return o.setAttribute("width","0px"),o}});te({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(t,e){var r=t.parser,n=Se(e[0],"size").value,o=e[1];return{type:"raisebox",mode:r.mode,dy:n,body:o}},htmlBuilder(t,e){var r=Re(t.body,e),n=ot(t.dy,e);return Be({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new Z("mpadded",[je(t.body,e)]),n=t.dy.number+t.dy.unit;return r.setAttribute("voffset",n),r}});var e6=(t,e)=>{var r=t.parser;return{type:"reflectbox",mode:r.mode,body:e[0]}};te({type:"reflectbox",names:["\\reflectbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:e6,htmlBuilder(t,e){return G(["mord","reflectbox"],[Re(t.body,e)],e)},mathmlBuilder(t,e){return je(t.body,e)}});te({type:"reflectbox",names:["\\mathreflectbox"],numArgs:1,argTypes:["math"],handler:e6});te({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(t){var e=t.parser;return{type:"internal",mode:e.mode}}});te({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(t,e,r){var n=t.parser,o=r[0],i=Se(e[0],"size"),s=Se(e[1],"size");return{type:"rule",mode:n.mode,shift:o&&Se(o,"size").value,width:i.value,height:s.value}},htmlBuilder(t,e){var r=G(["mord","katex-rule"],[],e),n=ot(t.width,e),o=ot(t.height,e),i=t.shift?ot(t.shift,e):0;return r.style.borderRightWidth=J(n),r.style.borderTopWidth=J(o),r.style.bottom=J(i),r.width=n,r.height=o+i,r.depth=-i,r.maxFontSize=o*1.125*e.sizeMultiplier,r},mathmlBuilder(t,e){var r=ot(t.width,e),n=ot(t.height,e),o=t.shift?ot(t.shift,e):0,i=e.color&&e.getColor()||"black",s=new Z("mspace");s.setAttribute("mathbackground",i),s.setAttribute("width",J(r)),s.setAttribute("height",J(n));var a=new Z("mpadded",[s]);return o>=0?a.setAttribute("height",J(o)):(a.setAttribute("height",J(o)),a.setAttribute("depth",J(-o))),a.setAttribute("voffset",J(o)),a}});function t6(t,e,r){for(var n=xt(t,e,!1),o=e.sizeMultiplier/r.sizeMultiplier,i=0;i<n.length;i++){var s=n[i].classes.indexOf("katex-sizing");s<0?Array.prototype.push.apply(n[i].classes,e.sizingClasses(r)):n[i].classes[s+1]==="reset-size"+e.size&&(n[i].classes[s+1]="reset-size"+r.size),n[i].height*=o,n[i].depth*=o}return Wn(n)}var M4=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],zA=(t,e)=>{var r=e.havingSize(t.size);return t6(t.body,r,e)};te({type:"sizing",names:M4,numArgs:0,allowedInText:!0,handler:(t,e)=>{var r=t.breakOnTokenText,n=t.funcName,o=t.parser,i=o.parseExpression(!1,r);return{type:"sizing",mode:o.mode,size:M4.indexOf(n)+1,body:i}},htmlBuilder:zA,mathmlBuilder:(t,e)=>{var r=e.havingSize(t.size),n=yr(t.body,r),o=new Z("mstyle",n);return o.setAttribute("mathsize",J(r.sizeMultiplier)),o}});te({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(t,e,r)=>{var n=t.parser,o=!1,i=!1,s=r[0]&&Se(r[0],"ordgroup");if(s)for(var a,l=0;l<s.body.length;++l){var c=s.body[l];if(a=Wc(c).text,a==="t")o=!0;else if(a==="b")i=!0;else{o=!1,i=!1;break}}else o=!0,i=!0;var u=e[0];return{type:"smash",mode:n.mode,body:u,smashHeight:o,smashDepth:i}},htmlBuilder:(t,e)=>{var r=G([],[Re(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return r;if(t.smashHeight&&(r.height=0),t.smashDepth&&(r.depth=0),t.smashHeight&&t.smashDepth)return G(["mord","katex-smash"],[r],e);if(r.children)for(var n=0;n<r.children.length;n++)t.smashHeight&&(r.children[n].height=0),t.smashDepth&&(r.children[n].depth=0);var o=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r}]});return G(["mord"],[o],e)},mathmlBuilder:(t,e)=>{var r=new Z("mpadded",[je(t.body,e)]);return t.smashHeight&&r.setAttribute("height","0px"),t.smashDepth&&r.setAttribute("depth","0px"),r}});te({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(t,e,r){var n=t.parser,o=r[0],i=e[0];return{type:"sqrt",mode:n.mode,body:i,index:o}},htmlBuilder(t,e){var r=Re(t.body,e.havingCrampedStyle());r.height===0&&(r.height=e.fontMetrics().xHeight),r=Qi(r,e);var n=e.fontMetrics(),o=n.defaultRuleThickness,i=o;e.style.id<ge.TEXT.id&&(i=e.fontMetrics().xHeight);var s=o+i/4,a=r.height+r.depth+s+o,l=yA(a,e),c=l.span,u=l.ruleWidth,d=l.advanceWidth,h=c.height-u;h>r.height+r.depth+s&&(s=(s+h-r.height-r.depth)/2);var p=c.height-r.height-s-u;r.style.paddingLeft=J(d);var g=Be({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+p)},{type:"elem",elem:c},{type:"kern",size:u}]});if(t.index){var y=e.havingStyle(ge.SCRIPTSCRIPT),v=Re(t.index,y,e),w=.6*(g.height-g.depth),C=Be({positionType:"shift",positionData:-w,children:[{type:"elem",elem:v}]}),k=G(["katex-root"],[C]);return G(["mord","sqrt"],[k,g],e)}else return G(["mord","sqrt"],[g],e)},mathmlBuilder(t,e){var r=t.body,n=t.index;return n?new Z("mroot",[je(r,e),je(n,e)]):new Z("msqrt",[je(r,e)])}});var Wd={display:ge.DISPLAY,text:ge.TEXT,script:ge.SCRIPT,scriptscript:ge.SCRIPTSCRIPT};function NA(t){return t in Wd}te({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(t,e){var r=t.breakOnTokenText,n=t.funcName,o=t.parser,i=o.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!NA(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:o.mode,style:s,body:i}},htmlBuilder(t,e){var r=Wd[t.style],n=e.havingStyle(r);return t.resetFont&&(n=n.withFont("")),t6(t.body,n,e)},mathmlBuilder(t,e){var r=Wd[t.style],n=e.havingStyle(r);t.resetFont&&(n=n.withFont(""));var o=yr(t.body,n),i=new Z("mstyle",o),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=s[t.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var HA=function(e,r){var n=e.base;if(n)if(n.type==="op"){var o=n.limits&&(r.style.size===ge.DISPLAY.size||n.alwaysHandleSupSub);return o?J7:null}else if(n.type==="operatorname"){var i=n.alwaysHandleSupSub&&(r.style.size===ge.DISPLAY.size||n.limits);return i?Q7:null}else{if(n.type==="accent")return Fn(n.base)?P7:null;if(n.type==="horizBrace"){var s=!e.sub;return s===n.isOver?Z7:null}else return null}else return null};di({type:"supsub",htmlBuilder(t,e){var r=HA(t,e);if(r)return r(t,e);var n=t.base,o=t.sup,i=t.sub,s=Re(n,e),a,l,c=e.fontMetrics(),u=0,d=0,h=n&&Fn(n);if(o){var p=e.havingStyle(e.style.sup());a=Re(o,p,e),h||(u=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/e.sizeMultiplier)}if(i){var g=e.havingStyle(e.style.sub());l=Re(i,g,e),h||(d=s.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}var y;e.style===ge.DISPLAY?y=c.sup1:e.style.cramped?y=c.sup3:y=c.sup2;var v=e.sizeMultiplier,w=J(.5/c.ptPerEm/v),C=null;if(l){var k=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(s instanceof mr||k){var S;C=J(-((S=s.italic)!=null?S:0))}}var E;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var R=c.defaultRuleThickness,H=4*R;if(u-a.depth-(l.height-d)<H){d=H-(u-a.depth)+l.height;var O=.8*c.xHeight-(u-a.depth);O>0&&(u+=O,d-=O)}var P=[{type:"elem",elem:l,shift:d,marginRight:w,marginLeft:C},{type:"elem",elem:a,shift:-u,marginRight:w}];E=Be({positionType:"individualShift",children:P})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var $=[{type:"elem",elem:l,marginLeft:C,marginRight:w}];E=Be({positionType:"shift",positionData:d,children:$})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),E=Be({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:w}]});else throw new Error("supsub must have either sup or sub.");var ie=Hd(s,"right")||"mord";return G([ie],[s,G(["msupsub"],[E])],e)},mathmlBuilder(t,e){var r=!1,n,o;t.base&&t.base.type==="horizBrace"&&(o=!!t.sup,o===t.base.isOver&&(r=!0,n=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[je(t.base,e)];t.sub&&i.push(je(t.sub,e)),t.sup&&i.push(je(t.sup,e));var s;if(r)s=n?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===ge.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===ge.DISPLAY||c.limits)?s="munderover":s="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===ge.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===ge.DISPLAY)?s="munder":s="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===ge.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===ge.DISPLAY)?s="mover":s="msup"}return new Z(s,i)}});di({type:"atom",htmlBuilder(t,e){return Bh(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var r=new Z("mo",[Ar(t.text,t.mode)]);if(t.family==="bin"){var n=Hh(t,e);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else t.family==="punct"?r.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&r.setAttribute("stretchy","false");return r}});var r6={mi:"italic",mn:"normal",mtext:"normal"};di({type:"mathord",htmlBuilder(t,e){return qc(t,e)},mathmlBuilder(t,e){var r=new Z("mi",[Ar(t.text,t.mode,e)]),n=Hh(t,e)||"italic";return n!==r6[r.type]&&r.setAttribute("mathvariant",n),r}});di({type:"textord",htmlBuilder(t,e){return qc(t,e)},mathmlBuilder(t,e){var r=Ar(t.text,t.mode,e),n=Hh(t,e)||"normal",o;return t.mode==="text"?o=new Z("mtext",[r]):/[0-9]/.test(t.text)?o=new Z("mn",[r]):t.text==="\\prime"?o=new Z("mo",[r]):o=new Z("mi",[r]),n!==r6[o.type]&&o.setAttribute("mathvariant",n),o}});var E4=new Map([["\\nobreak","nobreak"],["\\allowbreak","allowbreak"]]),I4=new Map([[" ",{}],["\\ ",{}],["~",{className:"nobreak"}],["\\space",{}],["\\nobreakspace",{className:"nobreak"}]]);di({type:"spacing",htmlBuilder(t,e){var r=I4.get(t.text),n=E4.get(t.text);if(r){var o=r.className||"";if(t.mode==="text"){var i=qc(t,e);return i.classes.push(o),i}else return G(["mspace",o],[Bh(t.text,t.mode,e)],e)}else{if(n)return G(["mspace",n],[],e);throw new K('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var r;if(I4.has(t.text))r=new Z("mtext",[new pt(" ")]);else{if(E4.has(t.text))return new Z("mspace");throw new K('Unknown type of space "'+t.text+'"')}return r}});var L4=()=>{var t=new Z("mtd",[]);return t.setAttribute("width","50%"),t};di({type:"tag",mathmlBuilder(t,e){var r=new Z("mtable",[new Z("mtr",[L4(),new Z("mtd",[xo(t.body,e)]),L4(),new Z("mtd",[xo(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});var R4={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},O4={"\\textbf":"textbf","\\textmd":"textmd"},$A={"\\textit":"textit","\\textup":"textup"},P4=(t,e)=>{var r=t.font;if(r){if(R4[r])return e.withTextFontFamily(R4[r]);if(O4[r])return e.withTextFontWeight(O4[r]);if(r==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape($A[r])};te({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(t,e){var r=t.parser,n=t.funcName,o=e[0];return{type:"text",mode:r.mode,body:ft(o),font:n}},htmlBuilder(t,e){var r=P4(t,e),n=xt(t.body,r,!0);return G(["mord","text"],n,r)},mathmlBuilder(t,e){var r=P4(t,e);return xo(t.body,r)}});te({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler(t,e){var r=t.parser;return{type:"underline",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Re(t.body,e),n=Ji("underline-line",e),o=e.fontMetrics().defaultRuleThickness,i=Be({positionType:"top",positionData:r.height,children:[{type:"kern",size:o},{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r}]});return G(["mord","katex-underline"],[i],e)},mathmlBuilder(t,e){var r=new Z("mo",[new pt("‾")]);r.setAttribute("stretchy","true");var n=new Z("munder",[je(t.body,e),r]);return n.setAttribute("accentunder","true"),n}});te({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler(t,e){var r=t.parser;return{type:"vcenter",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Re(t.body,e),n=e.fontMetrics().axisHeight,o=.5*(r.height-n-(r.depth+n));return Be({positionType:"shift",positionData:o,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new Z("mpadded",[je(t.body,e)],["vcenter"]);return new Z("mrow",[r])}});te({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(t,e,r){throw new K("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var r=D4(t),n=[],o=e.havingStyle(e.style.text()),i=0;i<r.length;i++){var s=r[i];s==="~"&&(s="\\textasciitilde"),n.push(Vt(s,"Typewriter-Regular",t.mode,o,["mord","texttt"]))}return G(["mord","text"].concat(o.sizingClasses(e)),k7(n),o)},mathmlBuilder(t,e){var r=new pt(D4(t)),n=new Z("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var D4=t=>t.body.replace(/ /g,t.star?"␣":" "),fo=T7,n6=`[ \r
261
+ ]`,qA="\\\\[a-zA-Z@]+",FA="\\\\[^\uD800-\uDFFF]",VA="("+qA+")"+n6+"*",WA=`\\\\(
262
262
  |[ \r ]+
263
- ?)[ \r ]*`,jd="[̀-ͯ]",GA=new RegExp(jd+"+$"),KA="("+n6+"+)|"+(UA+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(jd+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(jd+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+jA)+("|"+WA+")");class D4{constructor(e,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=r,this.tokenRegex=new RegExp(KA,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,r){this.catcodes[e]=r}lex(){var e=this.input,r=this.tokenRegex.lastIndex;if(r===e.length)return new pr("EOF",new Jt(this,r,r));var n=this.tokenRegex.exec(e);if(n===null||n.index!==r)throw new K("Unexpected character: '"+e[r]+"'",new pr(e[r],new Jt(this,r,r+1)));var o=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[o]===14){var i=e.indexOf(`
264
- `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,Qt({strict:this.settings.strict,errorCode:"commentAtEnd",errorMsg:"% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)",report:!0})):this.tokenRegex.lastIndex=i+1,this.lex()}return new pr(o,new Jt(this,r,this.tokenRegex.lastIndex))}}class ZA{constructor(e,r){e===void 0&&(e={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new K("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var r of Object.keys(e))e[r]===void 0?delete this.current[r]:this.current[r]=e[r]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:Object.prototype.hasOwnProperty.call(this.builtins,e)?this.builtins[e]:void 0}set(e,r,n){if(n===void 0&&(n=!1),n){for(var o=0;o<this.undefStack.length;o++)delete this.undefStack[o][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=r)}else{var i=this.undefStack[this.undefStack.length-1];i&&!Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}r==null?delete this.current[e]:this.current[e]=r}}var XA=U7;x("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});x("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});x("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});x("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});x("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var r=t.future();return e[0].length===1&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});x("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");x("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var B4={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};x("\\char",function(t){var e=t.popToken(),r,n=0;if(e.text==="'")r=8,e=t.popToken();else if(e.text==='"')r=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new K("\\char` missing argument");n=e.text.charCodeAt(0)}else r=10;if(r){if(n=B4[e.text],n==null||n>=r)throw new K("Invalid base-"+r+" digit "+e.text);for(var o;(o=B4[t.future().text])!=null&&o<r;)n*=r,n+=o,t.popToken()}return"\\@char{"+n+"}"});var Wh=(t,e,r,n)=>{var o=t.consumeArg().tokens;if(o.length!==1)throw new K("\\newcommand's first argument must be a macro name");var i=o[0].text,s=t.isDefined(i);if(s&&!e)throw new K("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!s&&!r)throw new K("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(o=t.consumeArg().tokens,o.length===1&&o[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new K("Invalid number of arguments: "+l);a=parseInt(l),o=t.consumeArg().tokens}return s&&n||t.macros.set(i,{tokens:o,numArgs:a}),""};x("\\newcommand",t=>Wh(t,!1,!0,!1));x("\\renewcommand",t=>Wh(t,!0,!1,!1));x("\\providecommand",t=>Wh(t,!0,!0,!0));x("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(r=>r.text).join("")),""});x("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(r=>r.text).join("")),""});x("\\show",t=>{var e=t.popToken(),r=e.text;return console.log(e,t.macros.get(r),fo[r],Qe.math[r],Qe.text[r]),""});x("\\bgroup","{");x("\\egroup","}");x("~","\\nobreakspace");x("\\lq","`");x("\\rq","'");x("\\aa","\\r a");x("\\AA","\\r A");x("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");x("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");x("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");x("ℬ","\\mathscr{B}");x("ℰ","\\mathscr{E}");x("ℱ","\\mathscr{F}");x("ℋ","\\mathscr{H}");x("ℐ","\\mathscr{I}");x("ℒ","\\mathscr{L}");x("ℳ","\\mathscr{M}");x("ℛ","\\mathscr{R}");x("ℭ","\\mathfrak{C}");x("ℌ","\\mathfrak{H}");x("ℨ","\\mathfrak{Z}");x("\\Bbbk","\\Bbb{k}");x("\\llap","\\mathllap{\\textrm{#1}}");x("\\rlap","\\mathrlap{\\textrm{#1}}");x("\\clap","\\mathclap{\\textrm{#1}}");x("\\mathstrut","\\vphantom{(}");x("\\underbar","\\underline{\\text{#1}}");x("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');x("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");x("\\ne","\\neq");x("≠","\\neq");x("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");x("∉","\\notin");x("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");x("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");x("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");x("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");x("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");x("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");x("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");x("⟂","\\perp");x("‼","\\mathclose{!\\mkern-0.8mu!}");x("∌","\\notni");x("⌜","\\ulcorner");x("⌝","\\urcorner");x("⌞","\\llcorner");x("⌟","\\lrcorner");x("©","\\copyright");x("®","\\textregistered");x("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');x("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');x("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');x("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');x("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");x("⋮","\\vdots");x("\\varGamma","\\mathit{\\Gamma}");x("\\varDelta","\\mathit{\\Delta}");x("\\varTheta","\\mathit{\\Theta}");x("\\varLambda","\\mathit{\\Lambda}");x("\\varXi","\\mathit{\\Xi}");x("\\varPi","\\mathit{\\Pi}");x("\\varSigma","\\mathit{\\Sigma}");x("\\varUpsilon","\\mathit{\\Upsilon}");x("\\varPhi","\\mathit{\\Phi}");x("\\varPsi","\\mathit{\\Psi}");x("\\varOmega","\\mathit{\\Omega}");x("\\substack","\\begin{subarray}{c}#1\\end{subarray}");x("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");x("\\boxed","\\fbox{$\\displaystyle{#1}$}");x("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");x("\\implies","\\DOTSB\\;\\Longrightarrow\\;");x("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");x("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");x("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var z4={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},YA=new Set(["bin","rel"]);x("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in z4?e=z4[r]:(r.slice(0,4)==="\\not"||r in Qe.math&&YA.has(Qe.math[r].group))&&(e="\\dotsb"),e});var jh={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};x("\\dotso",function(t){var e=t.future().text;return e in jh?"\\ldots\\,":"\\ldots"});x("\\dotsc",function(t){var e=t.future().text;return e in jh&&e!==","?"\\ldots\\,":"\\ldots"});x("\\cdots",function(t){var e=t.future().text;return e in jh?"\\@cdots\\,":"\\@cdots"});x("\\dotsb","\\cdots");x("\\dotsm","\\cdots");x("\\dotsi","\\!\\cdots");x("\\dotsx","\\ldots\\,");x("\\DOTSI","\\relax");x("\\DOTSB","\\relax");x("\\DOTSX","\\relax");x("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");x("\\,","\\tmspace+{3mu}{.1667em}");x("\\thinspace","\\,");x("\\>","\\mskip{4mu}");x("\\:","\\tmspace+{4mu}{.2222em}");x("\\medspace","\\:");x("\\;","\\tmspace+{5mu}{.2777em}");x("\\thickspace","\\;");x("\\!","\\tmspace-{3mu}{.1667em}");x("\\negthinspace","\\!");x("\\negmedspace","\\tmspace-{4mu}{.2222em}");x("\\negthickspace","\\tmspace-{5mu}{.277em}");x("\\enspace","\\kern.5em ");x("\\enskip","\\hskip.5em\\relax");x("\\quad","\\hskip1em\\relax");x("\\qquad","\\hskip2em\\relax");x("\\tag","\\@ifstar\\tag@literal\\tag@paren");x("\\tag@paren","\\tag@literal{({#1})}");x("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new K("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});x("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");x("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");x("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");x("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");x("\\newline","\\\\\\relax");x("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var o6=J(an["Main-Regular"][84][1]-.7*an["Main-Regular"][65][1]);x("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+o6+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");x("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+o6+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");x("\\hspace","\\@ifstar\\@hspacer\\@hspace");x("\\@hspace","\\hskip #1\\relax");x("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");x("\\ordinarycolon",":");x("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");x("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');x("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');x("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');x("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');x("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');x("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');x("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');x("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');x("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');x("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');x("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');x("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');x("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');x("∷","\\dblcolon");x("∹","\\eqcolon");x("≔","\\coloneqq");x("≕","\\eqqcolon");x("⩴","\\Coloneqq");x("\\ratio","\\vcentcolon");x("\\coloncolon","\\dblcolon");x("\\colonequals","\\coloneqq");x("\\coloncolonequals","\\Coloneqq");x("\\equalscolon","\\eqqcolon");x("\\equalscoloncolon","\\Eqqcolon");x("\\colonminus","\\coloneq");x("\\coloncolonminus","\\Coloneq");x("\\minuscolon","\\eqcolon");x("\\minuscoloncolon","\\Eqcolon");x("\\coloncolonapprox","\\Colonapprox");x("\\coloncolonsim","\\Colonsim");x("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");x("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");x("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");x("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");x("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");x("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");x("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");x("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");x("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");x("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");x("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");x("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");x("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");x("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");x("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");x("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");x("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");x("\\nleqq","\\html@mathml{\\@nleqq}{≰}");x("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");x("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");x("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");x("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");x("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");x("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");x("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");x("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");x("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");x("\\imath","\\html@mathml{\\@imath}{ı}");x("\\jmath","\\html@mathml{\\@jmath}{ȷ}");x("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");x("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");x("⟦","\\llbracket");x("⟧","\\rrbracket");x("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");x("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");x("↤","\\mapsfrom");x("\\mapsfrom","\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}");x("⦃","\\lBrace");x("⦄","\\rBrace");x("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");x("⦵","\\minuso");x("\\darr","\\downarrow");x("\\dArr","\\Downarrow");x("\\Darr","\\Downarrow");x("\\lang","\\langle");x("\\rang","\\rangle");x("\\uarr","\\uparrow");x("\\uArr","\\Uparrow");x("\\Uarr","\\Uparrow");x("\\N","\\mathbb{N}");x("\\R","\\mathbb{R}");x("\\Z","\\mathbb{Z}");x("\\alef","\\aleph");x("\\alefsym","\\aleph");x("\\Alpha","\\mathrm{A}");x("\\Beta","\\mathrm{B}");x("\\bull","\\bullet");x("\\Chi","\\mathrm{X}");x("\\clubs","\\clubsuit");x("\\cnums","\\mathbb{C}");x("\\Complex","\\mathbb{C}");x("\\Dagger","\\ddagger");x("\\diamonds","\\diamondsuit");x("\\empty","\\emptyset");x("\\Epsilon","\\mathrm{E}");x("\\Eta","\\mathrm{H}");x("\\exist","\\exists");x("\\harr","\\leftrightarrow");x("\\hArr","\\Leftrightarrow");x("\\Harr","\\Leftrightarrow");x("\\hearts","\\heartsuit");x("\\image","\\Im");x("\\infin","\\infty");x("\\Iota","\\mathrm{I}");x("\\isin","\\in");x("\\Kappa","\\mathrm{K}");x("\\larr","\\leftarrow");x("\\lArr","\\Leftarrow");x("\\Larr","\\Leftarrow");x("\\lrarr","\\leftrightarrow");x("\\lrArr","\\Leftrightarrow");x("\\Lrarr","\\Leftrightarrow");x("\\Mu","\\mathrm{M}");x("\\natnums","\\mathbb{N}");x("\\Nu","\\mathrm{N}");x("\\Omicron","\\mathrm{O}");x("\\plusmn","\\pm");x("\\rarr","\\rightarrow");x("\\rArr","\\Rightarrow");x("\\Rarr","\\Rightarrow");x("\\real","\\Re");x("\\reals","\\mathbb{R}");x("\\Reals","\\mathbb{R}");x("\\Rho","\\mathrm{P}");x("\\sdot","\\cdot");x("\\sect","\\S");x("\\spades","\\spadesuit");x("\\sub","\\subset");x("\\sube","\\subseteq");x("\\supe","\\supseteq");x("\\Tau","\\mathrm{T}");x("\\thetasym","\\vartheta");x("\\weierp","\\wp");x("\\Zeta","\\mathrm{Z}");x("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");x("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");x("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");x("\\bra","\\mathinner{\\langle{#1}|}");x("\\ket","\\mathinner{|{#1}\\rangle}");x("\\braket","\\mathinner{\\langle{#1}\\rangle}");x("\\Bra","\\left\\langle#1\\right|");x("\\Ket","\\left|#1\\right\\rangle");var i6=t=>e=>{var r=e.consumeArg().tokens,n=e.consumeArg().tokens,o=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{t&&(h.macros.set("|",s),o.length&&h.macros.set("\\|",a));var p=d;if(!d&&o.length){var g=h.future();g.text==="|"&&(h.popToken(),p=!0)}return{tokens:p?o:n,numArgs:0}};e.macros.set("|",l(!1)),o.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...i,...c,...r]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};x("\\bra@ket",i6(!1));x("\\bra@set",i6(!0));x("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");x("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");x("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");x("\\angln","{\\angl n}");x("\\blue","\\textcolor{##6495ed}{#1}");x("\\orange","\\textcolor{##ffa500}{#1}");x("\\pink","\\textcolor{##ff00af}{#1}");x("\\red","\\textcolor{##df0030}{#1}");x("\\green","\\textcolor{##28ae7b}{#1}");x("\\gray","\\textcolor{gray}{#1}");x("\\purple","\\textcolor{##9d38bd}{#1}");x("\\blueA","\\textcolor{##ccfaff}{#1}");x("\\blueB","\\textcolor{##80f6ff}{#1}");x("\\blueC","\\textcolor{##63d9ea}{#1}");x("\\blueD","\\textcolor{##11accd}{#1}");x("\\blueE","\\textcolor{##0c7f99}{#1}");x("\\tealA","\\textcolor{##94fff5}{#1}");x("\\tealB","\\textcolor{##26edd5}{#1}");x("\\tealC","\\textcolor{##01d1c1}{#1}");x("\\tealD","\\textcolor{##01a995}{#1}");x("\\tealE","\\textcolor{##208170}{#1}");x("\\greenA","\\textcolor{##b6ffb0}{#1}");x("\\greenB","\\textcolor{##8af281}{#1}");x("\\greenC","\\textcolor{##74cf70}{#1}");x("\\greenD","\\textcolor{##1fab54}{#1}");x("\\greenE","\\textcolor{##0d923f}{#1}");x("\\goldA","\\textcolor{##ffd0a9}{#1}");x("\\goldB","\\textcolor{##ffbb71}{#1}");x("\\goldC","\\textcolor{##ff9c39}{#1}");x("\\goldD","\\textcolor{##e07d10}{#1}");x("\\goldE","\\textcolor{##a75a05}{#1}");x("\\redA","\\textcolor{##fca9a9}{#1}");x("\\redB","\\textcolor{##ff8482}{#1}");x("\\redC","\\textcolor{##f9685d}{#1}");x("\\redD","\\textcolor{##e84d39}{#1}");x("\\redE","\\textcolor{##bc2612}{#1}");x("\\maroonA","\\textcolor{##ffbde0}{#1}");x("\\maroonB","\\textcolor{##ff92c6}{#1}");x("\\maroonC","\\textcolor{##ed5fa6}{#1}");x("\\maroonD","\\textcolor{##ca337c}{#1}");x("\\maroonE","\\textcolor{##9e034e}{#1}");x("\\purpleA","\\textcolor{##ddd7ff}{#1}");x("\\purpleB","\\textcolor{##c6b9fc}{#1}");x("\\purpleC","\\textcolor{##aa87ff}{#1}");x("\\purpleD","\\textcolor{##7854ab}{#1}");x("\\purpleE","\\textcolor{##543b78}{#1}");x("\\mintA","\\textcolor{##f5f9e8}{#1}");x("\\mintB","\\textcolor{##edf2df}{#1}");x("\\mintC","\\textcolor{##e0e5cc}{#1}");x("\\grayA","\\textcolor{##f6f7f7}{#1}");x("\\grayB","\\textcolor{##f0f1f2}{#1}");x("\\grayC","\\textcolor{##e3e5e6}{#1}");x("\\grayD","\\textcolor{##d6d8da}{#1}");x("\\grayE","\\textcolor{##babec2}{#1}");x("\\grayF","\\textcolor{##888d93}{#1}");x("\\grayG","\\textcolor{##626569}{#1}");x("\\grayH","\\textcolor{##3b3e40}{#1}");x("\\grayI","\\textcolor{##21242c}{#1}");x("\\kaBlue","\\textcolor{##314453}{#1}");x("\\kaGreen","\\textcolor{##71B307}{#1}");var s6={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class JA{constructor(e,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(e),this.macros=new ZA(XA,r.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new D4(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var r,n,o;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken();var i=this.consumeArg(["]"]);o=i.tokens,n=i.end}else{var s=this.consumeArg();o=s.tokens,r=s.start,n=s.end}return this.pushToken(new pr("EOF",n.loc)),this.pushTokens(o),new pr("",Jt.range(r,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var r=[],n=e&&e.length>0;n||this.consumeSpaces();var o=this.future(),i,s=0,a=0;do{if(i=this.popToken(),r.push(i),i.text==="{")++s;else if(i.text==="}"){if(--s,s===-1)throw new K("Extra }",i)}else if(i.text==="EOF")throw new K("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",i);if(e&&n)if((s===0||s===1&&e[a]==="{")&&i.text===e[a]){if(++a,a===e.length){r.splice(-a,a);break}}else a=0}while(s!==0||n);return o.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:o,end:i}}consumeArgs(e,r){if(r){if(r.length!==e+1)throw new K("The length of delimiters doesn't match the number of args!");for(var n=r[0],o=0;o<n.length;o++){var i=this.popToken();if(n[o]!==i.text)throw new K("Use of the macro doesn't match its definition",i)}}for(var s=[],a=0;a<e;a++)s.push(this.consumeArg(r&&r[a+1]).tokens);return s}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new K("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var r=this.popToken(),n=r.text,o=r.noexpand?null:this._getExpansion(n);if(o==null||e&&o.unexpandable){if(e&&o==null&&n[0]==="\\"&&!this.isDefined(n))throw new K("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var i=o.tokens,s=this.consumeArgs(o.numArgs,o.delimiters);if(o.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new K("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...s[+l.text-1]);else throw new K("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new pr(e)]):void 0}expandTokens(e){var r=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var o=this.stack.pop();o.treatAsRelax&&(o.noexpand=!1,o.treatAsRelax=!1),r.push(o)}return this.countExpansion(r.length),r}expandMacroAsText(e){var r=this.expandMacro(e);return r&&r.map(n=>n.text).join("")}_getExpansion(e){var r=this.macros.get(e);if(r==null)return r;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var o=typeof r=="function"?r(this):r;if(typeof o=="string"){var i=0;if(o.includes("#"))for(var s=o.replace(/##/g,"");s.includes("#"+(i+1));)++i;for(var a=new D4(o,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return o}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(fo,e)||Object.prototype.hasOwnProperty.call(Qe.math,e)||Object.prototype.hasOwnProperty.call(Qe.text,e)||Object.prototype.hasOwnProperty.call(s6,e)}isExpandable(e){var r=this.macros.get(e);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Object.prototype.hasOwnProperty.call(fo,e)&&!fo[e].primitive}}var N4=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,xl=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Fu={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},H4={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Zc{constructor(e,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new JA(e,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(e,r){if(r===void 0&&(r=!0),this.fetch().text!==e)throw new K("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var r=this.nextToken;this.consume(),this.gullet.pushToken(new pr("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(e,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var o=this.fetch();if(Zc.endOfExpression.has(o.text)||r&&o.text===r||e&&fo[o.text]&&fo[o.text].infix)break;var i=this.parseAtom(r);if(i){if(i.type==="internal")continue}else break;n.push(i)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var r=-1,n,o=0;o<e.length;o++){var i=e[o];if(i.type==="infix"){if(r!==-1)throw new K("only one infix operator per group",i.token);r=o,n=i.replaceWith}}if(r!==-1&&n){var s,a,l=e.slice(0,r),c=e.slice(r+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[s,e[r],a],[]):u=this.callFunction(n,[s,a],[]),[u]}else return e}handleSupSubscript(e){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var o;do{var i;o=this.parseGroup(e)}while(((i=o)==null?void 0:i.type)==="internal");if(!o)throw new K("Expected group after '"+n+"'",r);return o}formatUnsupportedCmd(e){for(var r=[],n=0;n<e.length;n++)r.push({type:"textord",mode:"text",text:e[n]});var o={type:"text",mode:this.mode,body:r},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[o]};return i}parseAtom(e){var r=this.parseGroup("atom",e);if(r?.type==="internal"||this.mode==="text")return r;for(var n,o;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(r&&r.type==="op")r.limits=i.text==="\\limits",r.alwaysHandleSupSub=!0;else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=i.text==="\\limits");else throw new K("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(n)throw new K("Double superscript",i);n=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(o)throw new K("Double subscript",i);o=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(n)throw new K("Double superscript",i);var s={type:"textord",mode:this.mode,text:"\\prime"},a=[s];for(this.consume();this.fetch().text==="'";)a.push(s),this.consume();this.fetch().text==="^"&&a.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:a}}else if(xl[i.text]){var l=N4.test(i.text),c=[];for(c.push(new pr(xl[i.text])),this.consume();;){var u=this.fetch().text;if(!xl[u]||N4.test(u)!==l)break;c.unshift(new pr(xl[u])),this.consume()}var d=this.subparse(c);l?o={type:"ordgroup",mode:"math",body:d}:n={type:"ordgroup",mode:"math",body:d}}else break}return n&&o?{type:"supsub",mode:this.mode,base:r,sup:n,sub:o}:n?{type:"supsub",mode:this.mode,base:r,sup:n}:o?{type:"supsub",mode:this.mode,base:r,sub:o}:r}parseFunction(e,r){var n=this.fetch(),o=n.text,i=fo[o];if(!i)return null;if(this.consume(),r&&r!=="atom"&&!i.allowedInArgument)throw new K("Got function '"+o+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!i.allowedInText)throw new K("Can't use function '"+o+"' in text mode",n);if(this.mode==="math"&&i.allowedInMath===!1)throw new K("Can't use function '"+o+"' in math mode",n);var s=this.parseArguments(o,i),a=s.args,l=s.optArgs;return this.callFunction(o,a,l,n,e)}callFunction(e,r,n,o,i){var s={funcName:e,parser:this,token:o,breakOnTokenText:i},a=fo[e];if(a&&a.handler)return a.handler(s,r,n);throw new K("No function handler for "+e)}parseArguments(e,r){var n,o=(n=r.numOptionalArgs)!=null?n:0,i=r.numArgs+o;if(i===0)return{args:[],optArgs:[]};for(var s=[],a=[],l=0;l<i;l++){var c,u=(c=r.argTypes)==null?void 0:c[l],d=l<o;("primitive"in r&&r.primitive&&u==null||r.type==="sqrt"&&l===1&&a[0]==null)&&(u="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",u,d);if(d)a.push(h);else if(h!=null)s.push(h);else throw new K("Null argument, please report this as a bug")}return{args:s,optArgs:a}}parseGroupOfType(e,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var o=this.parseArgumentGroup(n,"text");return o!=null?{type:"styling",mode:o.mode,body:[o],style:"text",resetFont:!0}:null}case"raw":{this.gullet.consumeSpaces();var i=this.gullet.lexer.catcodes["%"];this.gullet.lexer.setCatcode("%",12);var s=this.parseStringGroup(n);return this.gullet.lexer.setCatcode("%",i),s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new K("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new K("Expected group as "+e,this.fetch());return a}case"original":case void 0:return this.parseArgumentGroup(n);default:throw new K("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e){var r=this.gullet.scanArgument(e);if(r==null)return null;for(var n="",o;(o=this.fetch()).text!=="EOF";)n+=o.text,this.consume();return this.consume(),r.text=n,r}parseRegexGroup(e,r){for(var n=this.fetch(),o=n,i="",s;(s=this.fetch()).text!=="EOF"&&e.test(i+s.text);)o=s,i+=o.text,this.consume();if(i==="")throw new K("Invalid "+r+": '"+n.text+"'",n);return n.range(o,i)}parseColorGroup(e){var r=this.parseStringGroup(e);if(r==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new K("Invalid color: '"+r.text+"'",r);var o=n[0];return/^[0-9a-f]{6}$/i.test(o)&&(o="#"+o),{type:"color-token",mode:this.mode,color:o}}parseSizeGroup(e){var r,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup(e),!r)return null;!e&&r.text.length===0&&(r.text="0pt",n=!0);var o=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!o)throw new K("Invalid size: '"+r.text+"'",r);var i={number:+(o[1]+o[2]),unit:o[3]};if(!y7(i))throw new K("Invalid unit: '"+i.unit+"'",r);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){var r=this.gullet.lexer.catcodes["%"],n=this.gullet.lexer.catcodes["~"];this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var o=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",r),this.gullet.lexer.setCatcode("~",n),o==null)return null;var i=o.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:i}}parseArgumentGroup(e,r){var n=this.gullet.scanArgument(e);if(n==null)return null;var o=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return r&&this.switchMode(o),s}parseGroup(e,r){var n=this.fetch(),o=n.text,i;if(o==="{"||o==="\\begingroup"){this.consume();var s=o==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,s),l=this.fetch();this.expect(s),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Jt.range(n,l),body:a,semisimple:o==="\\begingroup"||void 0}}else if(i=this.parseFunction(r,e)||this.parseSymbol(),i==null&&o[0]==="\\"&&!Object.prototype.hasOwnProperty.call(s6,o)){if(this.settings.throwOnError)throw new K("Undefined control sequence: "+o,n);i=this.formatUnsupportedCmd(o),this.consume()}return i}formLigatures(e){for(var r=e.length-1,n=0;n<r;++n){var o=e[n];if(o.type==="textord"){var i=o.text,s=e[n+1];if(!(!s||s.type!=="textord")){if(i==="-"&&s.text==="-"){var a=e[n+2];n+1<r&&a&&a.type==="textord"&&a.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:Jt.range(o,a),text:"---"}),r-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Jt.range(o,s),text:"--"}),r-=1)}(i==="'"||i==="`")&&s.text===i&&(e.splice(n,2,{type:"textord",mode:"text",loc:Jt.range(o,s),text:i+i}),r-=1)}}}}parseSymbol(){var e=this.fetch(),r=e.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),o=n.charAt(0)==="*";if(o&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new K(`\\verb assertion failed --
265
- please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:o}}Object.prototype.hasOwnProperty.call(H4,r[0])&&!Qe[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Accented Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e}),r=H4[r[0]]+r.slice(1));var i=GA.exec(r);i&&(r=r.substring(0,i.index),r==="i"?r="ı":r==="j"&&(r="ȷ"));var s;if(Qe[this.mode][r]){this.settings.strict&&this.mode==="math"&&Ld.includes(r)&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Latin-1/Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e});var a=Qe[this.mode][r].group,l=Jt.range(e),c;oA(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:r}:c={type:a,mode:this.mode,loc:l,text:r},s=c}else if(r.charCodeAt(0)>=128)this.settings.strict&&(v7(r.charCodeAt(0))?this.mode==="math"&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e}):Qt({strict:this.settings.strict,errorCode:"unknownSymbol",errorMsg:'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),report:!0,token:e})),s={type:"textord",mode:"text",loc:Jt.range(e),text:r};else return null;if(this.consume(),i)for(var u=0;u<i[0].length;u++){var d=i[0][u];if(!Fu[d])throw new K("Unknown accent ' "+d+"'",e);var h=Fu[d][this.mode]||Fu[d].text;if(!h)throw new K("Accent "+d+" unsupported in "+this.mode+" mode",e);s={type:"accent",mode:this.mode,loc:Jt.range(e),label:h,isStretchy:!1,isShifty:!0,base:s}}return s}}Zc.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Uh=function(e,r){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Zc(e,r);delete n.gullet.macros.current["\\df@tag"];var o=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new K("\\tag works only in display equations");o=[{type:"tag",mode:"text",body:o,tag:n.subparse([new pr("\\df@tag")])}]}return o},a6=function(e,r,n){r.textContent="";var o=Gh(e,n).toNode();r.appendChild(o)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),a6=function(){throw new K("KaTeX doesn't work in quirks mode.")});var QA=function(e,r){var n=Gh(e,r).toMarkup();return n},eT=function(e,r){var n=new Rh(r);return Uh(e,n)},l6=function(e,r,n){if(n.throwOnError||!(e instanceof K))throw e;var o=G(["katex-error"],[new mr(r)]);return o.setAttribute("title",e.toString()),o.setAttribute("style","color:"+n.errorColor),o},Gh=function(e,r){var n=new Rh(r);try{var o=Uh(e,n);return KS(o,e,n)}catch(i){return l6(i,e,n)}},tT=function(e,r){var n=new Rh(r);try{var o=Uh(e,n);return ZS(o,n)}catch(i){return l6(i,e,n)}},rT="0.19.1",nT={Span:gs,Anchor:Hc,SymbolNode:mr,SvgNode:Hn,PathNode:bo,LineNode:Id},c6={version:rT,render:a6,renderToString:QA,ParseError:K,SETTINGS_SCHEMA:Td,__parse:eT,__renderToDomTree:Gh,__renderToHTMLTree:tT,__setFontMetrics:ES,__defineSymbol:f,__defineFunction:te,__defineMacro:x,__domTree:nT},oT=Object.defineProperty,$4=Object.getOwnPropertySymbols,iT=Object.prototype.hasOwnProperty,sT=Object.prototype.propertyIsEnumerable,q4=(t,e,r)=>e in t?oT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aT=(t,e)=>{for(var r in e||(e={}))iT.call(e,r)&&q4(t,r,e[r]);if($4)for(var r of $4(e))sT.call(e,r)&&q4(t,r,e[r]);return t};function hi(t,e){return Object.assign(t,{meta:aT({package:"@milkdown/components"},e)}),t}var lT=Object.defineProperty,F4=Object.getOwnPropertySymbols,cT=Object.prototype.hasOwnProperty,uT=Object.prototype.propertyIsEnumerable,V4=(t,e,r)=>e in t?lT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kh=(t,e)=>{for(var r in e||(e={}))cT.call(e,r)&&V4(t,r,e[r]);if(F4)for(var r of F4(e))uT.call(e,r)&&V4(t,r,e[r]);return t};const dT={mode:"preview"},Co=Ve(Kh({},dT),"linkTooltipStateCtx");hi(Co,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const hT={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},es=Ve(Kh({},hT),"linkTooltipAPICtx");hi(Co,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const fT={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},ts=Ve(Kh({},fT),"linkTooltipConfigCtx");hi(Co,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const Zh=Me("ToggleLink",t=>()=>e=>{const{doc:r,selection:n}=e,o=mo.type(t);return r.rangeHasMark(n.from,n.to,o)?(t.get(es.key).removeLink(n.from,n.to),!0):(t.get(es.key).addLink(n.from,n.to),!0)}),el=za("LINK_PREVIEW");hi(el[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});hi(el[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const Xc=za("LINK_EDIT");hi(Xc[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});hi(Xc[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function Xh(...t){}Xh(M);function ha({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}ha.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const pT=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function mT(t){return`${t}-${pT()}`}Xh(M);const gT=Ct({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:t,src:e,onConfirm:r,onCancel:n}){const o=re(e),i=mT("milkdown-link-edit");Bn(e,l=>{o.value=l});const s=()=>{r(o.value)},a=l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),s()),l.key==="Escape"&&(l.preventDefault(),n())};return()=>M("div",{class:"link-edit"},M("input",{id:i,class:"input-area",placeholder:t.value.inputPlaceholder,onKeydown:a,onInput:l=>{o.value=l.target.value},value:o.value}),o.value?M(ha,{class:"button confirm",icon:t.value.confirmButton,onClick:s}):null)}});var vT=Object.defineProperty,yT=Object.defineProperties,bT=Object.getOwnPropertyDescriptors,W4=Object.getOwnPropertySymbols,wT=Object.prototype.hasOwnProperty,xT=Object.prototype.propertyIsEnumerable,u6=t=>{throw TypeError(t)},j4=(t,e,r)=>e in t?vT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cl=(t,e)=>{for(var r in e||(e={}))wT.call(e,r)&&j4(t,r,e[r]);if(W4)for(var r of W4(e))xT.call(e,r)&&j4(t,r,e[r]);return t},U4=(t,e)=>yT(t,bT(e)),d6=(t,e,r)=>e.has(t)||u6("Cannot "+r),Pe=(t,e,r)=>(d6(t,e,"read from private field"),r?r.call(t):e.get(t)),br=(t,e,r)=>e.has(t)?u6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Po=(t,e,r,n)=>(d6(t,e,"write to private field"),e.set(t,r),r),Ai,Jn,Qn,ql,zs,Fl,An,Vl,Ud,Wl,Gd,jl;const G4={from:-1,to:-1,mark:null};class CT{constructor(e,r){this.ctx=e,br(this,Ai),br(this,Jn),br(this,Qn,Cl({},G4)),br(this,ql),br(this,zs),br(this,Fl,re("")),br(this,An,()=>{Pe(this,Wl).call(this),Pe(this,Jn).hide(),this.ctx.update(Co.key,i=>U4(Cl({},i),{mode:"preview"})),Po(this,Qn,Cl({},G4))}),br(this,Vl,i=>{const s=i.target;s&&(Pe(this,Ai).contains(s)||Pe(this,An).call(this))}),br(this,Ud,()=>{document.addEventListener("pointerdown",Pe(this,Vl),!0)}),br(this,Wl,()=>{document.removeEventListener("pointerdown",Pe(this,Vl),!0)}),br(this,Gd,i=>{const s=this.ctx.get($e),{from:a,to:l,mark:c}=Pe(this,Qn),u=mo.type(this.ctx),d=T2(i);if(c&&c.attrs.href===d){Pe(this,An).call(this);return}const h=s.state.tr;if(c&&h.removeMark(a,l,c),a===l){if(!d){Pe(this,An).call(this);return}const p=u.create({href:d});h.insertText(d,a),h.addMark(a,a+d.length,p)}else h.addMark(a,l,u.create({href:d}));s.dispatch(h),Pe(this,An).call(this)}),br(this,jl,(i,s,a)=>{const l=this.ctx.get(ts.key);Pe(this,zs).value=l,Pe(this,Fl).value=i,this.ctx.update(Co.key,u=>U4(Cl({},u),{mode:"edit"}));const c=this.ctx.get($e);c.dispatch(c.state.tr.setSelection(Ce.create(c.state.doc,s,a))),Pe(this,Jn).show({getBoundingClientRect:()=>Oa(c,s,a)},c),Pe(this,Ud).call(this),requestAnimationFrame(()=>{var u;(u=Pe(this,Ai).querySelector("input"))==null||u.focus()})}),this.update=i=>{const{state:s}=i,{selection:a}=s;if(!(a instanceof Ce))return;const{from:l,to:c}=a;l===Pe(this,Qn).from&&c===Pe(this,Qn).to||Pe(this,An).call(this)},this.destroy=()=>{Pe(this,Wl).call(this),Pe(this,ql).unmount(),Pe(this,Jn).destroy(),Pe(this,Ai).remove()},this.addLink=(i,s)=>{Po(this,Qn,{from:i,to:s,mark:null}),Pe(this,jl).call(this,"",i,s)},this.editLink=(i,s,a)=>{Po(this,Qn,{from:s,to:a,mark:i}),Pe(this,jl).call(this,i.attrs.href,s,a)},this.removeLink=(i,s)=>{const a=this.ctx.get($e),l=a.state.tr;l.removeMark(i,s,mo.type(this.ctx)),a.dispatch(l),Pe(this,An).call(this)},Po(this,zs,re(this.ctx.get(ts.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const o=gr(gT,{config:Pe(this,zs),src:Pe(this,Fl),onConfirm:Pe(this,Gd),onCancel:Pe(this,An)});o.mount(n),Po(this,ql,o),Po(this,Ai,n),Po(this,Jn,new Ba({content:n,debounce:0,shouldShow:()=>!1})),Pe(this,Jn).onHide=()=>{requestAnimationFrame(()=>{r.dom.focus({preventScroll:!0})})},Pe(this,Jn).update(r)}}Ai=new WeakMap;Jn=new WeakMap;Qn=new WeakMap;ql=new WeakMap;zs=new WeakMap;Fl=new WeakMap;An=new WeakMap;Vl=new WeakMap;Ud=new WeakMap;Wl=new WeakMap;Gd=new WeakMap;jl=new WeakMap;var kT=Object.defineProperty,_T=Object.defineProperties,ST=Object.getOwnPropertyDescriptors,K4=Object.getOwnPropertySymbols,AT=Object.prototype.hasOwnProperty,TT=Object.prototype.propertyIsEnumerable,Z4=(t,e,r)=>e in t?kT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,MT=(t,e)=>{for(var r in e||(e={}))AT.call(e,r)&&Z4(t,r,e[r]);if(K4)for(var r of K4(e))TT.call(e,r)&&Z4(t,r,e[r]);return t},ET=(t,e)=>_T(t,ST(e));function IT(t){let e;t.update(es.key,r=>ET(MT({},r),{addLink:(n,o)=>{e?.addLink(n,o)},editLink:(n,o,i)=>{e?.editLink(n,o,i)},removeLink:(n,o)=>{e?.removeLink(n,o)}})),t.set(Xc.key,{view:r=>(e=new CT(t,r),e)})}function LT(t,e,r,n,o){let i={start:-1,end:-1};return r.nodesBetween(n,o,(s,a)=>{if(i.start>-1)return!1;i.start===-1&&t.isInSet(s.marks)&&e===s&&(i={start:a,end:a+Math.max(s.textContent.length,1)})}),i}function RT(t,e,r){const n=e.posAtCoords({left:r.clientX,top:r.clientY});if(!n)return;const{pos:o}=n,i=e.state.doc.nodeAt(o);if(!i)return;const s=i.marks.find(l=>l.type===mo.mark.type(t));if(!(!s||!el.pluginKey()))return{show:!0,pos:o,node:i,mark:s}}Xh(M);const OT=Ct({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:t,src:e,onEdit:r,onRemove:n}){const o=dr(()=>T2(e.value)),i=l=>{l.preventDefault(),l.stopPropagation(),r.value()},s=l=>{l.preventDefault(),l.stopPropagation(),n.value()},a=l=>{l.preventDefault();const c=e.value;navigator.clipboard&&c&&navigator.clipboard.writeText(c).then(()=>{t.value.onCopyLink(c)}).catch(u=>console.error(u))};return()=>M("div",{class:"link-preview"},M(ha,{class:"button link-icon",icon:t.value.linkIcon,onClick:a}),M("a",{href:o.value,target:"_blank",rel:"noopener noreferrer",class:"link-display"},e.value),M(ha,{class:"button link-edit-button",icon:t.value.editButton,onClick:i}),M(ha,{class:"button link-remove-button",icon:t.value.removeButton,onClick:s}))}});var h6=t=>{throw TypeError(t)},f6=(t,e,r)=>e.has(t)||h6("Cannot "+r),Te=(t,e,r)=>(f6(t,e,"read from private field"),r?r.call(t):e.get(t)),Xt=(t,e,r)=>e.has(t)?h6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xn=(t,e,r,n)=>(f6(t,e,"write to private field"),e.set(t,r),r),$o,Lr,Ns,Hs,Ul,Gl,Kl,$s,Zl,qs,Xl,Yl,Jl,Fs;class PT{constructor(e,r){this.ctx=e,Xt(this,$o),Xt(this,Lr),Xt(this,Ns),Xt(this,Hs),Xt(this,Ul,re("")),Xt(this,Gl,re(()=>{})),Xt(this,Kl,re(()=>{})),Xt(this,$s),Xt(this,Zl),Xt(this,qs,!1),Xt(this,Xl,({mode:n})=>{n==="edit"&&Te(this,Fs).call(this)}),Xt(this,Yl,()=>{Xn(this,qs,!0)}),Xt(this,Jl,()=>{Xn(this,qs,!1)}),Xt(this,Fs,()=>{Te(this,Lr).hide(),Te(this,Lr).element.removeEventListener("mouseenter",Te(this,Yl)),Te(this,Lr).element.removeEventListener("mouseleave",Te(this,Jl))}),this.show=(n,o,i,s)=>{Te(this,Hs).value=this.ctx.get(ts.key),Te(this,Ul).value=n.attrs.href,Te(this,Gl).value=()=>{this.ctx.get(es.key).editLink(n,o,i)},Te(this,Kl).value=()=>{this.ctx.get(es.key).removeLink(o,i),Te(this,Fs).call(this)},Te(this,Lr).show({getBoundingClientRect:()=>s},Te(this,Zl)),Te(this,Lr).element.addEventListener("mouseenter",Te(this,Yl)),Te(this,Lr).element.addEventListener("mouseleave",Te(this,Jl))},this.hide=()=>{Te(this,qs)||Te(this,Fs).call(this)},this.update=()=>{},this.destroy=()=>{Te(this,$s).unmount(),Te(this,Ns).off(Te(this,Xl)),Te(this,Lr).destroy(),Te(this,$o).remove()},Xn(this,Zl,r),Xn(this,Hs,re(this.ctx.get(ts.key))),Xn(this,$s,gr(OT,{config:Te(this,Hs),src:Te(this,Ul),onEdit:Te(this,Gl),onRemove:Te(this,Kl)})),Xn(this,$o,document.createElement("div")),Te(this,$o).className="milkdown-link-preview",Te(this,$s).mount(Te(this,$o)),Xn(this,Lr,new Ba({debounce:0,content:Te(this,$o),shouldShow:()=>!1})),Te(this,Lr).update(r),Xn(this,Ns,e.use(Co.key)),Te(this,Ns).on(Te(this,Xl))}}$o=new WeakMap;Lr=new WeakMap;Ns=new WeakMap;Hs=new WeakMap;Ul=new WeakMap;Gl=new WeakMap;Kl=new WeakMap;$s=new WeakMap;Zl=new WeakMap;qs=new WeakMap;Xl=new WeakMap;Yl=new WeakMap;Jl=new WeakMap;Fs=new WeakMap;function DT(t){let e;const n=sc((i,s)=>{if(!e||!i.hasFocus()||t.get(Co.key).mode==="edit")return;const l=RT(t,i,s);if(l){const c=i.state.doc.resolve(l.pos),u=LT(l.mark,l.node,i.state.doc,c.before(),c.after()),d=u.start,h=u.end;e.show(l.mark,d,h,Oa(i,d,h));return}e.hide()},50),o=()=>{setTimeout(()=>{e?.hide()},50)};t.set(el.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:o}},view:i=>(e=new PT(t,i),e)})}function BT(t){DT(t),IT(t)}const zT=[Co,es,ts,el,Xc,Zh].flat();var NT=Object.defineProperty,X4=Object.getOwnPropertySymbols,HT=Object.prototype.hasOwnProperty,$T=Object.prototype.propertyIsEnumerable,Y4=(t,e,r)=>e in t?NT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qT=(t,e)=>{for(var r in e||(e={}))HT.call(e,r)&&Y4(t,r,e[r]);if(X4)for(var r of X4(e))$T.call(e,r)&&Y4(t,r,e[r]);return t};function p6(t,e){return Object.assign(t,{meta:qT({package:"@milkdown/components"},e)}),t}const FT={renderLabel:({label:t,listType:e,checked:r})=>r==null?e==="bullet"?"⦿":t:r?"☑":"□"},Yc=Ve(FT,"listItemBlockConfigCtx");p6(Yc,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function m6(...t){}m6(M);function g6({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}g6.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};m6(M);const VT=Ct({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:t,checked:e,listType:r,config:n,readonly:o,setAttr:i,onMount:s,selected:a}){const l=h=>{h!=null&&h instanceof Element&&s(h)},c=h=>{e.value!=null&&(h.stopPropagation(),h.preventDefault(),i("checked",!e.value))},u=dr(()=>n.renderLabel({label:t.value,listType:r.value,checked:e.value,readonly:o.value})),d=dr(()=>e.value==null?r.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>M("li",{class:Mt("list-item",a.value&&"ProseMirror-selectednode")},M("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},M(g6,{class:Mt("label",o.value&&"readonly",d.value),icon:u.value})),M("div",{class:"children",ref:l}))}}),Ql=new WeakMap;function WT(t,e,r){let n=Ql.get(t);if(!n){const o=new Map;n=o,Ql.set(t,o),requestAnimationFrame(()=>{if(Ql.delete(t),t.isDestroyed)return;const{state:i}=t,s=i.doc.content.size;let a;for(const d of o.values())d.anchor<=s&&d.head<=s&&(a=d);if(!a)return;const l=i.doc.resolve(a.anchor),c=i.doc.resolve(a.head),u=Ce.between(l,c);t.dispatch(i.tr.setSelection(u))})}n.delete(e),n.set(e,r)}const v6=ko(Pa.node,t=>(e,r,n)=>{const o=document.createElement("div");o.className="milkdown-list-item-block";const i=document.createElement("div");i.setAttribute("data-content-dom","true"),i.classList.add("content-dom");const s=re(e.attrs.label),a=re(e.attrs.checked),l=re(e.attrs.listType),c=re(!r.editable),u=t.get(Yc.key),d=re(!1),h=(k,A)=>{if(!r.editable)return;const I=n();I!=null&&(r.hasFocus()||r.focus(),r.dispatch(r.state.tr.setNodeAttribute(I,k,A)))},p=cs(()=>{d.value?o.classList.add("selected"):o.classList.remove("selected")});let g=null;const v=gr(VT,{label:s,checked:a,listType:l,readonly:c,config:u,selected:d,setAttr:h,onMount:k=>{if(k===g)return;g=k;const{anchor:A,head:I}=r.state.selection;k.appendChild(i),WT(r,o,{anchor:A,head:I})}});v.mount(o);const w=k=>{l.value=k.attrs.listType,s.value=k.attrs.label,a.value=k.attrs.checked,c.value=!r.editable};w(e);let C=e;return{dom:o,contentDOM:i,update:k=>k.type!==e.type?!1:(k.sameMarkup(C)&&k.content.eq(C.content)||(C=k,w(k)),!0),ignoreMutation:k=>!o||!i?!0:k.type==="selection"?!1:i===k.target&&k.type==="attributes"?!0:!i.contains(k.target),selectNode:()=>{d.value=!0},deselectNode:()=>{d.value=!1},destroy:()=>{var k;(k=Ql.get(r))==null||k.delete(o),p(),v.unmount(),o.remove(),i.remove()}}});p6(v6,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const jT=[Yc,v6];var UT=Object.defineProperty,J4=Object.getOwnPropertySymbols,GT=Object.prototype.hasOwnProperty,KT=Object.prototype.propertyIsEnumerable,Q4=(t,e,r)=>e in t?UT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZT=(t,e)=>{for(var r in e||(e={}))GT.call(e,r)&&Q4(t,r,e[r]);if(J4)for(var r of J4(e))KT.call(e,r)&&Q4(t,r,e[r]);return t};function y6(t,e){return Object.assign(t,{meta:ZT({package:"@milkdown/components"},e)}),t}var XT=Object.defineProperty,e2=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,JT=Object.prototype.propertyIsEnumerable,t2=(t,e,r)=>e in t?XT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QT=(t,e)=>{for(var r in e||(e={}))YT.call(e,r)&&t2(t,r,e[r]);if(e2)for(var r of e2(e))JT.call(e,r)&&t2(t,r,e[r]);return t};const eM={renderButton:t=>{switch(t){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},Jc=Ve(QT({},eM),"tableBlockConfigCtx");y6(Jc,{displayName:"Config<table-block>",group:"TableBlock"});function b6(...t){}b6(M);function Xr({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Xr.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function w6(t){const{dragPreviewRef:e,tableWrapperRef:r,contentWrapperRef:n,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a}=t,l=e.value;if(!l)return;const c=r.value;if(!c)return;const u=n.value;if(!u)return;const d=u.querySelector("tbody");if(!d)return;const h=l.querySelector("tbody");if(!h)return;const p=o.value;if(!p)return;const g=i.value;if(!g)return;const y=s.value;if(!y)return;const v=a.value;return v?{preview:l,wrapper:c,content:u,contentRoot:d,previewRoot:h,yHandle:p,xHandle:g,colHandle:y,rowHandle:v}:void 0}function x6(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function C6(t,e,r,n,o){const{width:i,height:s}=n.querySelector("tbody").getBoundingClientRect();if(t==="y"){const l=n.querySelectorAll("tr")[o];if(!l)return;r.appendChild(l.cloneNode(!0));const c=l.getBoundingClientRect().height;Object.assign(e.style,{width:`${i}px`,height:`${c}px`}),e.dataset.show="true";return}if(t==="x"){const a=n.querySelectorAll("tr");let l;Array.from(a).forEach(c=>{const u=c.children[o];if(!u)return;l===void 0&&(l=u.getBoundingClientRect().width);const d=u.parentElement.cloneNode(!1),h=u.cloneNode(!0);d.appendChild(h),r.appendChild(d)}),Object.assign(e.style,{width:`${l}px`,height:`${s}px`}),e.dataset.show="true";return}}function tM(t,e){return r=>{_6(t,r,e,n=>{k6("y",r,n,t);const{preview:o,content:i,previewRoot:s}=n;x6(s);const{hoverIndex:a}=t,[l]=a.value;C6("y",o,s,i,l)})}}function rM(t,e){return r=>{_6(t,r,e,n=>{k6("x",r,n,t);const{preview:o,content:i,previewRoot:s}=n,{hoverIndex:a}=t,[l,c]=a.value;x6(s),C6("x",o,s,i,c)})}}function k6(t,e,r,n){const{xHandle:o,yHandle:i,colHandle:s,rowHandle:a,preview:l}=r;o.dataset.displayType=t==="y"?"indicator":"none",i.dataset.displayType=t==="x"?"indicator":"none",t==="y"?(s.dataset.show="false",r2(a)):(a.dataset.show="false",r2(s));const{hoverIndex:c,dragInfo:u}=n,[d,h]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:t==="y"?d:h,endIndex:t==="y"?d:h,type:t==="y"?"row":"col"},l.dataset.direction=t==="y"?"vertical":"horizontal"}function _6(t,e,r,n){const o=r?.get($e);if(!o?.editable)return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const i=w6(t);i&&requestAnimationFrame(()=>{n(i)})}function r2(t){var e;(e=t.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function Kd(t,e){for(let r=0;r<t.childCount;r++)if(t.child(r)===e)return r;return-1}function nM(t,e){var r,n,o;if(e)try{const i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return;const s=i?.inside;if(s==null||s<0)return;const a=e.state.doc.resolve(s),l=e.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],d=c.includes(l.type.name)?l:(r=Pn(v=>c.includes(v.type.name))(a))==null?void 0:r.node,h=(n=Pn(v=>u.includes(v.type.name))(a))==null?void 0:n.node,p=(o=Pn(v=>v.type.name==="table")(a))==null?void 0:o.node;if(!d||!h||!p)return;const g=Kd(h,d);return[Kd(p,h),g]}catch{return}}function Qc(t,[e,r]){const n=t.value;if(!n)return;const o=n.querySelectorAll("tr"),i=o[e];if(!i)return;const s=o[0];if(!s)return;const a=s.children[r];if(!a)return;const l=i.children[r];if(l)return{row:i,col:l,headerCol:a}}function oM(t,e,r){if(!r||!e)return;const{selection:n}=e.state;if(!(n instanceof Ue))return;const{$from:o}=n,i=hs(o);if(!(!i||i.node!==r)){if(n.isColSelection()){const{$head:s}=n,a=s.index(s.depth-1);Yh({refs:t,index:[0,a],before:l=>{var c;(c=l.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(n.isRowSelection()){const{$head:s}=n,a=Pn(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(s);if(!a)return;const l=Kd(i.node,a.node);Jh({refs:t,index:[l,0],before:c=>{var u;l>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function Yh({refs:t,index:e,before:r,after:n}){const{contentWrapperRef:o,colHandleRef:i,hoverIndex:s}=t,a=i.value;if(!a)return;s.value=e;const l=Qc(o,e);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",r&&r(a),dn(c,a,{placement:"top"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),n&&n(a)}).catch(console.error)}function Jh({refs:t,index:e,before:r,after:n}){const{contentWrapperRef:o,rowHandleRef:i,hoverIndex:s}=t,a=i.value;if(!a)return;s.value=e;const l=Qc(o,e);if(!l)return;const{row:c}=l;a.dataset.show="true",r&&r(a),dn(c,a,{placement:"left"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),n&&n(a)}).catch(console.error)}function S6(t,e,r){const n=r==="x"?"left":"top",o=r==="x"?"right":"bottom",i=t.length-1,s=t.findIndex((l,c)=>{const u=l.getBoundingClientRect(),d=u[n],h=u[o];return d<=e&&e<=h||c===i&&e>h||c===0&&e<d}),a=t[s];return a?[a,s]:void 0}function iM(t,e){const r=t.querySelector("tr");if(!r)return;const n=Array.from(r.children);return S6(n,e,"x")}function sM(t,e){const r=Array.from(t.querySelectorAll("tr"));return S6(r,e,"y")}function aM(t){return ac(e=>{const r=w6(t);if(!r)return;const{preview:n,content:o,contentRoot:i,xHandle:s,yHandle:a}=r,{dragInfo:l,hoverIndex:c}=t;if(n.dataset.show==="false")return;const u=Qc(t.contentWrapperRef,c.value);if(!u||!i.querySelector("tr"))return;const h=l.value;if(!h||!i.offsetParent)return;const p=i.offsetParent.offsetTop,g=i.offsetParent.offsetLeft;if(h.type==="col"){const y=u.col.getBoundingClientRect().width,{left:v,width:w}=i.getBoundingClientRect(),C=g-v,k=e.clientX+C-y/2,[A]=h.startCoords,I=A<e.clientX?"right":"left";n.style.top=`${p}px`;const R=k<v+C-20?v+C-20:k>v+w+C-y+20?v+w+C-y+20:k;n.style.left=`${R}px`;const H=iM(i,e.clientX);if(H){const[O,P]=H,$=a.getBoundingClientRect().width,ie=o.getBoundingClientRect();h.endIndex=P,dn(O,a,{placement:I==="left"?"left":"right",middleware:[oi(I==="left"?-1*$:0)]}).then(({x:N})=>{a.dataset.show="true",Object.assign(a.style,{height:`${ie.height}px`,left:`${N}px`,top:`${p}px`})}).catch(console.error)}}else if(h.type==="row"){const y=u.row.getBoundingClientRect().height,{top:v,height:w}=i.getBoundingClientRect(),C=p-v,k=e.clientY+C-y/2,[A,I]=h.startCoords,R=I<e.clientY?"down":"up",H=k<v+C-20?v+C-20:k>v+w+C-y+20?v+w+C-y+20:k;n.style.top=`${H}px`,n.style.left=`${g}px`;const O=sM(i,e.clientY);if(O){const[P,$]=O,ie=s.getBoundingClientRect().height,N=o.getBoundingClientRect();h.endIndex=$,dn(P,s,{placement:R==="up"?"top":"bottom",middleware:[oi(R==="up"?-1*ie:0)]}).then(({y:ye})=>{s.dataset.show="true",Object.assign(s.style,{width:`${N.width}px`,top:`${ye}px`})}).catch(console.error)}}},20)}function lM(t,e,r){const{dragPreviewRef:n,yLineHandleRef:o,xLineHandleRef:i,dragInfo:s}=t,a=tM(t,e),l=rM(t,e),c=()=>{const h=n.value;if(!h||h.dataset.show==="false")return;const p=h?.querySelector("tbody");for(;p?.firstChild;)p?.removeChild(p.firstChild);h&&(h.dataset.show="false")},u=()=>{var h;const p=n.value;if(!p)return;const g=o.value;if(!g)return;const y=i.value;if(!y)return;const v=s.value;if(!v||!e||p.dataset.show==="false"||!t.colHandleRef.value||!t.rowHandleRef.value||(g.dataset.show="false",y.dataset.show="false",v.startIndex===v.endIndex))return;const k=e.get(ne),A={from:v.startIndex,to:v.endIndex,pos:((h=r?.())!=null?h:0)+1};if(v.type==="col"){k.call(Go.key,{pos:A.pos,index:v.startIndex}),k.call(fh.key,A);const I=[0,v.endIndex];Yh({refs:t,index:I})}else{k.call(Uo.key,{pos:A.pos,index:v.startIndex}),k.call(hh.key,A);const I=[v.endIndex,0];Jh({refs:t,index:I})}requestAnimationFrame(()=>{e.get($e).focus()})},d=aM(t);return us(()=>{window.addEventListener("dragover",d),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),ds(()=>{window.removeEventListener("dragover",d),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:a,dragCol:l}}function cM(t,e,r){const{xLineHandleRef:n,contentWrapperRef:o,colHandleRef:i,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=t;return{onAddRow:()=>{var y,v,w;if(!e)return;const C=n.value;if(!C)return;const[k]=l.value;if(k<0||!e.get($e).editable)return;const A=Array.from((v=(y=o.value)==null?void 0:y.querySelectorAll("tr"))!=null?v:[]),I=e.get(ne),R=((w=r?.())!=null?w:0)+1;A.length===k?(I.call(Uo.key,{pos:R,index:k-1}),I.call(yh.key)):(I.call(Uo.key,{pos:R,index:k}),I.call(vh.key)),I.call(Uo.key,{pos:R,index:k}),C.dataset.show="false"},onAddCol:()=>{var y,v,w,C;if(!e||!n.value)return;const[A,I]=l.value;if(I<0||!e.get($e).editable)return;const R=Array.from((w=(v=(y=o.value)==null?void 0:y.querySelector("tr"))==null?void 0:v.children)!=null?w:[]),H=e.get(ne),O=((C=r?.())!=null?C:0)+1;R.length===I?(H.call(Go.key,{pos:O,index:I-1}),H.call(gh.key)):(H.call(Go.key,{pos:O,index:I}),H.call(mh.key)),H.call(Go.key,{pos:O,index:I})},selectCol:()=>{var y,v;if(!e)return;const[w,C]=a.value,k=e.get(ne),A=((y=r?.())!=null?y:0)+1;k.call(Go.key,{pos:A,index:C});const I=(v=i.value)==null?void 0:v.querySelector(".button-group");I&&(I.dataset.show=I.dataset.show==="true"?"false":"true")},selectRow:()=>{var y,v;if(!e)return;const[w,C]=a.value,k=e.get(ne),A=((y=r?.())!=null?y:0)+1;k.call(Uo.key,{pos:A,index:w});const I=(v=s.value)==null?void 0:v.querySelector(".button-group");I&&w>0&&(I.dataset.show=I.dataset.show==="true"?"false":"true")},deleteSelected:y=>{if(!e||!e.get($e).editable)return;y.preventDefault(),y.stopPropagation(),e.get(ne).call(ph.key),requestAnimationFrame(()=>{e.get($e).focus()})},onAlign:y=>v=>{if(!e||!e.get($e).editable)return;v.preventDefault(),v.stopPropagation(),e.get(ne).call(bh.key,y),requestAnimationFrame(()=>{e.get($e).focus()})}}}function uM(t,e){return ac(r=>{if(!e?.editable)return;const{contentWrapperRef:n,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=t,u=o.value;if(!u)return;const d=i.value;if(!d)return;const h=n.value;if(!h)return;const p=a.value;if(!p)return;const g=s.value;if(!g)return;const y=nM(r,e);if(!y)return;const v=Qc(n,y);if(!v)return;const[w,C]=y,k=v.col.getBoundingClientRect(),A=Math.abs(r.clientX-k.left)<8,I=Math.abs(k.right-r.clientX)<8,R=Math.abs(r.clientY-k.top)<8,H=Math.abs(k.bottom-r.clientY)<8,O=A||I||R||H,P=p.querySelector(".button-group"),$=g.querySelector(".button-group");if(P&&(P.dataset.show="false"),$&&($.dataset.show="false"),O){const ie=h.getBoundingClientRect();p.dataset.show="false",g.dataset.show="false",d.dataset.displayType="tool",u.dataset.displayType="tool";const N=u.getBoundingClientRect().width,ye=d.getBoundingClientRect().height;A||I?(c.value[1]=A?C:C+1,dn(v.col,u,{placement:A?"left":"right",middleware:[oi(A?-1*N:0)]}).then(({x:be})=>{u.dataset.show="true",Object.assign(u.style,{height:`${ie.height}px`,left:`${be}px`})}).catch(console.error)):u.dataset.show="false",y[0]!==0&&(R||H)?(c.value[0]=R?w:w+1,dn(v.row,d,{placement:R?"top":"bottom",middleware:[oi(R?-1*ye:0)]}).then(({y:be})=>{d.dataset.show="true",Object.assign(d.style,{width:`${ie.width}px`,top:`${be}px`})}).catch(console.error)):d.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",d.dataset.show="false",p.dataset.show="true",g.dataset.show="true",Jh({refs:t,index:y}),Yh({refs:t,index:y}),l.value=y},20)}function dM(t){return()=>{const{rowHandleRef:e,colHandleRef:r,yLineHandleRef:n,xLineHandleRef:o}=t;setTimeout(()=>{const i=e.value;if(!i)return;const s=r.value;if(!s)return;const a=n.value;if(!a)return;const l=o.value;l&&(i.dataset.show="false",s.dataset.show="false",a.dataset.show="false",l.dataset.show="false")},200)}}function hM(t,e){const r=uM(t,e),n=dM(t);return{pointerMove:r,pointerLeave:n}}b6(M);const fM=Ct({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:t,node:e,ctx:r,getPos:n,config:o,onMount:i}){const s=re(),a=N=>{N!=null&&(N instanceof HTMLElement?(s.value=N,i(N)):s.value=void 0)},l=re(),c=re(),u=re(),d=re(),h=re(),p=re(),w={dragPreviewRef:p,tableWrapperRef:h,contentWrapperRef:s,yLineHandleRef:d,xLineHandleRef:u,colHandleRef:l,rowHandleRef:c,hoverIndex:re([0,0]),lineHoverIndex:re([-1,-1]),dragInfo:re()},{pointerLeave:C,pointerMove:k}=hM(w,t),{dragRow:A,dragCol:I}=lM(w,r,n),{onAddRow:R,onAddCol:H,selectCol:O,selectRow:P,deleteSelected:$,onAlign:ie}=cM(w,r,n);return us(()=>{requestAnimationFrame(()=>{t.editable&&oM(w,t,e.value)})}),()=>M("div",{onDragstart:N=>N.preventDefault(),onDragover:N=>N.preventDefault(),onDragleave:N=>N.preventDefault(),onPointermove:k,onPointerleave:C},M("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:I,onClick:O,onPointerdown:N=>N.stopPropagation(),onPointermove:N=>N.stopPropagation(),ref:l},M(Xr,{icon:o.renderButton("col_drag_handle")}),M("div",{"data-show":"false",class:"button-group",onPointermove:N=>N.stopPropagation()},M("button",{type:"button",onPointerdown:ie("left")},M(Xr,{icon:o.renderButton("align_col_left")})),M("button",{type:"button",onPointerdown:ie("center")},M(Xr,{icon:o.renderButton("align_col_center")})),M("button",{type:"button",onPointerdown:ie("right")},M(Xr,{icon:o.renderButton("align_col_right")})),M("button",{type:"button",onPointerdown:$},M(Xr,{icon:o.renderButton("delete_col")})))),M("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:A,onClick:P,onPointerdown:N=>N.stopPropagation(),onPointermove:N=>N.stopPropagation(),ref:c},M(Xr,{icon:o.renderButton("row_drag_handle")}),M("div",{"data-show":"false",class:"button-group",onPointermove:N=>N.stopPropagation()},M("button",{type:"button",onPointerdown:$},M(Xr,{icon:o.renderButton("delete_row")})))),M("div",{class:"table-wrapper",ref:h},M("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},M("table",null,M("tbody",null))),M("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:N=>N.stopPropagation(),ref:u},M("button",{type:"button",onClick:R,class:"add-button"},M(Xr,{icon:o.renderButton("add_row")}))),M("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:N=>N.stopPropagation(),ref:d},M("button",{type:"button",onClick:H,class:"add-button"},M(Xr,{icon:o.renderButton("add_col")}))),M("table",{ref:a,class:"children"})))}});var A6=t=>{throw TypeError(t)},pM=(t,e,r)=>e.has(t)||A6("Cannot "+r),mM=(t,e,r)=>e.has(t)?A6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),gM=(t,e,r)=>(pM(t,e,"access private method"),r),Zd,T6;class vM{constructor(e,r,n,o){this.ctx=e,this.node=r,this.view=n,this.getPos=o,mM(this,Zd);const i=document.createElement("div");i.className="milkdown-table-block";const s=document.createElement("tbody");this.contentDOM=s,s.setAttribute("data-content-dom","true"),s.classList.add("content-dom"),this.nodeRef=P0(r);const a=gr(fM,{view:n,ctx:e,getPos:o,config:e.get(Jc.key),onMount:l=>{l.appendChild(s)},node:this.nodeRef});a.mount(i),this.app=a,this.dom=i}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const r=e.target;if(r instanceof HTMLElement&&(r.closest("th")||r.closest("td"))){const n=e;return gM(this,Zd,T6).call(this,n)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}Zd=new WeakSet;T6=function(t){const e=this.view;if(!e.editable)return!1;const{state:r,dispatch:n}=e,o=e.posAtCoords({left:t.clientX,top:t.clientY});if(!o)return!1;const i=r.doc.resolve(o.inside),s=Pn(c=>c.type.name==="table_cell"||c.type.name==="table_header")(i);if(!s)return!1;if(r.selection instanceof Ce){const c=Pn(u=>u.type.name==="table_cell"||u.type.name==="table_header")(r.selection.$from);if(c?.node===s.node)return!1}const{from:a}=s,l=qr.create(r.doc,a+1);return r.selection.eq(l)?!1:(r.selection instanceof Ue?setTimeout(()=>{n(r.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{n(r.tr.setSelection(l).scrollIntoView())}),!0)};const M6=ko(ln.node,t=>(e,r,n)=>new vM(t,e,r,n));y6(M6,{displayName:"NodeView<table-block>",group:"TableBlock"});const yM=[Jc,M6];function Xd(t){if(!t)return!1;if(Array.isArray(t))return t.length>1?!1:Xd(t[0]);const e=t.content;return e?Xd(e):t.type==="text"}function bM(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-clipboard",...e}}),t}function n2(t,e){const r=Tv(e);if(r)return t.dispatch(t.state.tr.replaceSelectionWith(r,!0)),!0;try{return t.dispatch(t.state.tr.replaceSelection(e)),!0}catch{return!1}}var E6=Je(t=>{const e=t.get(y1);t.update(b1,n=>({...n,editable:n.editable??(()=>!0),transformPastedHTML:(o,i)=>{const s=n.transformPastedHTML;return s&&(o=s(o,i)),o.includes("docs-internal-guid")&&(o=o.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1"),o=o.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),o}}));const r=new et("MILKDOWN_CLIPBOARD");return new Xe({key:r,props:{handlePaste:(n,o,i)=>{const s=t.get(gn),a=n.props.editable?.(n.state),{clipboardData:l}=o;if(!a||!l||n.state.selection.$from.node().type.spec.code)return!1;const c=l.getData("text/plain"),u=l.getData("vscode-editor-data");if(u){const g=JSON.parse(u)?.mode;if(c&&g){const{tr:y}=n.state,v=Sv("code_block",e);return y.replaceSelectionWith(v.create({language:g})).setSelection(Ce.near(y.doc.resolve(Math.max(0,y.selection.from-2)))).insertText(c.replace(/\r\n?/g,`
266
- `)),n.dispatch(y),!0}}const d=l.getData("text/html");if(d.length===0&&c.length===0)return!1;if(d.length>0&&i)return n2(n,i);const h=Av.fromSchema(e);let p;if(d.length===0){const g=s(c);if(!g||typeof g=="string")return!1;p=v2.fromSchema(e).serializeFragment(g.content)}else{const g=document.createElement("template");g.innerHTML=d,p=g.content.cloneNode(!0),g.remove()}return n2(n,h.parseSlice(p))},clipboardTextSerializer:n=>{const o=t.get(fa);if(Xd(n.content.toJSON()))return n.content.textBetween(0,n.content.size,`
263
+ ?)[ \r ]*`,jd="[̀-ͯ]",jA=new RegExp(jd+"+$"),UA="("+n6+"+)|"+(WA+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(jd+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(jd+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+VA)+("|"+FA+")");class B4{constructor(e,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=r,this.tokenRegex=new RegExp(UA,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,r){this.catcodes[e]=r}lex(){var e=this.input,r=this.tokenRegex.lastIndex;if(r===e.length)return new pr("EOF",new Jt(this,r,r));var n=this.tokenRegex.exec(e);if(n===null||n.index!==r)throw new K("Unexpected character: '"+e[r]+"'",new pr(e[r],new Jt(this,r,r+1)));var o=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[o]===14){var i=e.indexOf(`
264
+ `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,Qt({strict:this.settings.strict,errorCode:"commentAtEnd",errorMsg:"% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)",report:!0})):this.tokenRegex.lastIndex=i+1,this.lex()}return new pr(o,new Jt(this,r,this.tokenRegex.lastIndex))}}class GA{constructor(e,r){e===void 0&&(e={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new K("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var r of Object.keys(e))e[r]===void 0?delete this.current[r]:this.current[r]=e[r]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:Object.prototype.hasOwnProperty.call(this.builtins,e)?this.builtins[e]:void 0}set(e,r,n){if(n===void 0&&(n=!1),n){for(var o=0;o<this.undefStack.length;o++)delete this.undefStack[o][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=r)}else{var i=this.undefStack[this.undefStack.length-1];i&&!Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}r==null?delete this.current[e]:this.current[e]=r}}var KA=U7;x("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});x("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});x("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});x("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});x("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var r=t.future();return e[0].length===1&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});x("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");x("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var z4={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};x("\\char",function(t){var e=t.popToken(),r,n=0;if(e.text==="'")r=8,e=t.popToken();else if(e.text==='"')r=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new K("\\char` missing argument");n=e.text.charCodeAt(0)}else r=10;if(r){if(n=z4[e.text],n==null||n>=r)throw new K("Invalid base-"+r+" digit "+e.text);for(var o;(o=z4[t.future().text])!=null&&o<r;)n*=r,n+=o,t.popToken()}return"\\@char{"+n+"}"});var Wh=(t,e,r,n)=>{var o=t.consumeArg().tokens;if(o.length!==1)throw new K("\\newcommand's first argument must be a macro name");var i=o[0].text,s=t.isDefined(i);if(s&&!e)throw new K("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!s&&!r)throw new K("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(o=t.consumeArg().tokens,o.length===1&&o[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new K("Invalid number of arguments: "+l);a=parseInt(l),o=t.consumeArg().tokens}return s&&n||t.macros.set(i,{tokens:o,numArgs:a}),""};x("\\newcommand",t=>Wh(t,!1,!0,!1));x("\\renewcommand",t=>Wh(t,!0,!1,!1));x("\\providecommand",t=>Wh(t,!0,!0,!0));x("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(r=>r.text).join("")),""});x("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(r=>r.text).join("")),""});x("\\show",t=>{var e=t.popToken(),r=e.text;return console.log(e,t.macros.get(r),fo[r],Qe.math[r],Qe.text[r]),""});x("\\bgroup","{");x("\\egroup","}");x("~","\\nobreakspace");x("\\lq","`");x("\\rq","'");x("\\aa","\\r a");x("\\AA","\\r A");x("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");x("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");x("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");x("ℬ","\\mathscr{B}");x("ℰ","\\mathscr{E}");x("ℱ","\\mathscr{F}");x("ℋ","\\mathscr{H}");x("ℐ","\\mathscr{I}");x("ℒ","\\mathscr{L}");x("ℳ","\\mathscr{M}");x("ℛ","\\mathscr{R}");x("ℭ","\\mathfrak{C}");x("ℌ","\\mathfrak{H}");x("ℨ","\\mathfrak{Z}");x("\\Bbbk","\\Bbb{k}");x("\\llap","\\mathllap{\\textrm{#1}}");x("\\rlap","\\mathrlap{\\textrm{#1}}");x("\\clap","\\mathclap{\\textrm{#1}}");x("\\mathstrut","\\vphantom{(}");x("\\underbar","\\underline{\\text{#1}}");x("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');x("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");x("\\ne","\\neq");x("≠","\\neq");x("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");x("∉","\\notin");x("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");x("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");x("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");x("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");x("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");x("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");x("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");x("⟂","\\perp");x("‼","\\mathclose{!\\mkern-0.8mu!}");x("∌","\\notni");x("⌜","\\ulcorner");x("⌝","\\urcorner");x("⌞","\\llcorner");x("⌟","\\lrcorner");x("©","\\copyright");x("®","\\textregistered");x("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');x("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');x("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');x("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');x("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");x("⋮","\\vdots");x("\\varGamma","\\mathit{\\Gamma}");x("\\varDelta","\\mathit{\\Delta}");x("\\varTheta","\\mathit{\\Theta}");x("\\varLambda","\\mathit{\\Lambda}");x("\\varXi","\\mathit{\\Xi}");x("\\varPi","\\mathit{\\Pi}");x("\\varSigma","\\mathit{\\Sigma}");x("\\varUpsilon","\\mathit{\\Upsilon}");x("\\varPhi","\\mathit{\\Phi}");x("\\varPsi","\\mathit{\\Psi}");x("\\varOmega","\\mathit{\\Omega}");x("\\substack","\\begin{subarray}{c}#1\\end{subarray}");x("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");x("\\boxed","\\fbox{$\\displaystyle{#1}$}");x("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");x("\\implies","\\DOTSB\\;\\Longrightarrow\\;");x("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");x("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");x("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var N4={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},ZA=new Set(["bin","rel"]);x("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in N4?e=N4[r]:(r.slice(0,4)==="\\not"||r in Qe.math&&ZA.has(Qe.math[r].group))&&(e="\\dotsb"),e});var jh={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};x("\\dotso",function(t){var e=t.future().text;return e in jh?"\\ldots\\,":"\\ldots"});x("\\dotsc",function(t){var e=t.future().text;return e in jh&&e!==","?"\\ldots\\,":"\\ldots"});x("\\cdots",function(t){var e=t.future().text;return e in jh?"\\@cdots\\,":"\\@cdots"});x("\\dotsb","\\cdots");x("\\dotsm","\\cdots");x("\\dotsi","\\!\\cdots");x("\\dotsx","\\ldots\\,");x("\\DOTSI","\\relax");x("\\DOTSB","\\relax");x("\\DOTSX","\\relax");x("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");x("\\,","\\tmspace+{3mu}{.1667em}");x("\\thinspace","\\,");x("\\>","\\mskip{4mu}");x("\\:","\\tmspace+{4mu}{.2222em}");x("\\medspace","\\:");x("\\;","\\tmspace+{5mu}{.2777em}");x("\\thickspace","\\;");x("\\!","\\tmspace-{3mu}{.1667em}");x("\\negthinspace","\\!");x("\\negmedspace","\\tmspace-{4mu}{.2222em}");x("\\negthickspace","\\tmspace-{5mu}{.277em}");x("\\enspace","\\kern.5em ");x("\\enskip","\\hskip.5em\\relax");x("\\quad","\\hskip1em\\relax");x("\\qquad","\\hskip2em\\relax");x("\\tag","\\@ifstar\\tag@literal\\tag@paren");x("\\tag@paren","\\tag@literal{({#1})}");x("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new K("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});x("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");x("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");x("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");x("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");x("\\newline","\\\\\\relax");x("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var o6=J(an["Main-Regular"][84][1]-.7*an["Main-Regular"][65][1]);x("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+o6+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");x("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+o6+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");x("\\hspace","\\@ifstar\\@hspacer\\@hspace");x("\\@hspace","\\hskip #1\\relax");x("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");x("\\ordinarycolon",":");x("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");x("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');x("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');x("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');x("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');x("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');x("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');x("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');x("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');x("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');x("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');x("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');x("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');x("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');x("∷","\\dblcolon");x("∹","\\eqcolon");x("≔","\\coloneqq");x("≕","\\eqqcolon");x("⩴","\\Coloneqq");x("\\ratio","\\vcentcolon");x("\\coloncolon","\\dblcolon");x("\\colonequals","\\coloneqq");x("\\coloncolonequals","\\Coloneqq");x("\\equalscolon","\\eqqcolon");x("\\equalscoloncolon","\\Eqqcolon");x("\\colonminus","\\coloneq");x("\\coloncolonminus","\\Coloneq");x("\\minuscolon","\\eqcolon");x("\\minuscoloncolon","\\Eqcolon");x("\\coloncolonapprox","\\Colonapprox");x("\\coloncolonsim","\\Colonsim");x("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");x("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");x("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");x("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");x("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");x("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");x("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");x("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");x("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");x("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");x("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");x("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");x("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");x("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");x("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");x("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");x("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");x("\\nleqq","\\html@mathml{\\@nleqq}{≰}");x("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");x("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");x("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");x("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");x("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");x("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");x("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");x("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");x("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");x("\\imath","\\html@mathml{\\@imath}{ı}");x("\\jmath","\\html@mathml{\\@jmath}{ȷ}");x("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");x("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");x("⟦","\\llbracket");x("⟧","\\rrbracket");x("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");x("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");x("↤","\\mapsfrom");x("\\mapsfrom","\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}");x("⦃","\\lBrace");x("⦄","\\rBrace");x("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");x("⦵","\\minuso");x("\\darr","\\downarrow");x("\\dArr","\\Downarrow");x("\\Darr","\\Downarrow");x("\\lang","\\langle");x("\\rang","\\rangle");x("\\uarr","\\uparrow");x("\\uArr","\\Uparrow");x("\\Uarr","\\Uparrow");x("\\N","\\mathbb{N}");x("\\R","\\mathbb{R}");x("\\Z","\\mathbb{Z}");x("\\alef","\\aleph");x("\\alefsym","\\aleph");x("\\Alpha","\\mathrm{A}");x("\\Beta","\\mathrm{B}");x("\\bull","\\bullet");x("\\Chi","\\mathrm{X}");x("\\clubs","\\clubsuit");x("\\cnums","\\mathbb{C}");x("\\Complex","\\mathbb{C}");x("\\Dagger","\\ddagger");x("\\diamonds","\\diamondsuit");x("\\empty","\\emptyset");x("\\Epsilon","\\mathrm{E}");x("\\Eta","\\mathrm{H}");x("\\exist","\\exists");x("\\harr","\\leftrightarrow");x("\\hArr","\\Leftrightarrow");x("\\Harr","\\Leftrightarrow");x("\\hearts","\\heartsuit");x("\\image","\\Im");x("\\infin","\\infty");x("\\Iota","\\mathrm{I}");x("\\isin","\\in");x("\\Kappa","\\mathrm{K}");x("\\larr","\\leftarrow");x("\\lArr","\\Leftarrow");x("\\Larr","\\Leftarrow");x("\\lrarr","\\leftrightarrow");x("\\lrArr","\\Leftrightarrow");x("\\Lrarr","\\Leftrightarrow");x("\\Mu","\\mathrm{M}");x("\\natnums","\\mathbb{N}");x("\\Nu","\\mathrm{N}");x("\\Omicron","\\mathrm{O}");x("\\plusmn","\\pm");x("\\rarr","\\rightarrow");x("\\rArr","\\Rightarrow");x("\\Rarr","\\Rightarrow");x("\\real","\\Re");x("\\reals","\\mathbb{R}");x("\\Reals","\\mathbb{R}");x("\\Rho","\\mathrm{P}");x("\\sdot","\\cdot");x("\\sect","\\S");x("\\spades","\\spadesuit");x("\\sub","\\subset");x("\\sube","\\subseteq");x("\\supe","\\supseteq");x("\\Tau","\\mathrm{T}");x("\\thetasym","\\vartheta");x("\\weierp","\\wp");x("\\Zeta","\\mathrm{Z}");x("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");x("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");x("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");x("\\bra","\\mathinner{\\langle{#1}|}");x("\\ket","\\mathinner{|{#1}\\rangle}");x("\\braket","\\mathinner{\\langle{#1}\\rangle}");x("\\Bra","\\left\\langle#1\\right|");x("\\Ket","\\left|#1\\right\\rangle");var i6=t=>e=>{var r=e.consumeArg().tokens,n=e.consumeArg().tokens,o=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{t&&(h.macros.set("|",s),o.length&&h.macros.set("\\|",a));var p=d;if(!d&&o.length){var g=h.future();g.text==="|"&&(h.popToken(),p=!0)}return{tokens:p?o:n,numArgs:0}};e.macros.set("|",l(!1)),o.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...i,...c,...r]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};x("\\bra@ket",i6(!1));x("\\bra@set",i6(!0));x("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");x("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");x("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");x("\\angln","{\\angl n}");x("\\blue","\\textcolor{##6495ed}{#1}");x("\\orange","\\textcolor{##ffa500}{#1}");x("\\pink","\\textcolor{##ff00af}{#1}");x("\\red","\\textcolor{##df0030}{#1}");x("\\green","\\textcolor{##28ae7b}{#1}");x("\\gray","\\textcolor{gray}{#1}");x("\\purple","\\textcolor{##9d38bd}{#1}");x("\\blueA","\\textcolor{##ccfaff}{#1}");x("\\blueB","\\textcolor{##80f6ff}{#1}");x("\\blueC","\\textcolor{##63d9ea}{#1}");x("\\blueD","\\textcolor{##11accd}{#1}");x("\\blueE","\\textcolor{##0c7f99}{#1}");x("\\tealA","\\textcolor{##94fff5}{#1}");x("\\tealB","\\textcolor{##26edd5}{#1}");x("\\tealC","\\textcolor{##01d1c1}{#1}");x("\\tealD","\\textcolor{##01a995}{#1}");x("\\tealE","\\textcolor{##208170}{#1}");x("\\greenA","\\textcolor{##b6ffb0}{#1}");x("\\greenB","\\textcolor{##8af281}{#1}");x("\\greenC","\\textcolor{##74cf70}{#1}");x("\\greenD","\\textcolor{##1fab54}{#1}");x("\\greenE","\\textcolor{##0d923f}{#1}");x("\\goldA","\\textcolor{##ffd0a9}{#1}");x("\\goldB","\\textcolor{##ffbb71}{#1}");x("\\goldC","\\textcolor{##ff9c39}{#1}");x("\\goldD","\\textcolor{##e07d10}{#1}");x("\\goldE","\\textcolor{##a75a05}{#1}");x("\\redA","\\textcolor{##fca9a9}{#1}");x("\\redB","\\textcolor{##ff8482}{#1}");x("\\redC","\\textcolor{##f9685d}{#1}");x("\\redD","\\textcolor{##e84d39}{#1}");x("\\redE","\\textcolor{##bc2612}{#1}");x("\\maroonA","\\textcolor{##ffbde0}{#1}");x("\\maroonB","\\textcolor{##ff92c6}{#1}");x("\\maroonC","\\textcolor{##ed5fa6}{#1}");x("\\maroonD","\\textcolor{##ca337c}{#1}");x("\\maroonE","\\textcolor{##9e034e}{#1}");x("\\purpleA","\\textcolor{##ddd7ff}{#1}");x("\\purpleB","\\textcolor{##c6b9fc}{#1}");x("\\purpleC","\\textcolor{##aa87ff}{#1}");x("\\purpleD","\\textcolor{##7854ab}{#1}");x("\\purpleE","\\textcolor{##543b78}{#1}");x("\\mintA","\\textcolor{##f5f9e8}{#1}");x("\\mintB","\\textcolor{##edf2df}{#1}");x("\\mintC","\\textcolor{##e0e5cc}{#1}");x("\\grayA","\\textcolor{##f6f7f7}{#1}");x("\\grayB","\\textcolor{##f0f1f2}{#1}");x("\\grayC","\\textcolor{##e3e5e6}{#1}");x("\\grayD","\\textcolor{##d6d8da}{#1}");x("\\grayE","\\textcolor{##babec2}{#1}");x("\\grayF","\\textcolor{##888d93}{#1}");x("\\grayG","\\textcolor{##626569}{#1}");x("\\grayH","\\textcolor{##3b3e40}{#1}");x("\\grayI","\\textcolor{##21242c}{#1}");x("\\kaBlue","\\textcolor{##314453}{#1}");x("\\kaGreen","\\textcolor{##71B307}{#1}");var s6={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class XA{constructor(e,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(e),this.macros=new GA(KA,r.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new B4(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var r,n,o;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken();var i=this.consumeArg(["]"]);o=i.tokens,n=i.end}else{var s=this.consumeArg();o=s.tokens,r=s.start,n=s.end}return this.pushToken(new pr("EOF",n.loc)),this.pushTokens(o),new pr("",Jt.range(r,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var r=[],n=e&&e.length>0;n||this.consumeSpaces();var o=this.future(),i,s=0,a=0;do{if(i=this.popToken(),r.push(i),i.text==="{")++s;else if(i.text==="}"){if(--s,s===-1)throw new K("Extra }",i)}else if(i.text==="EOF")throw new K("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",i);if(e&&n)if((s===0||s===1&&e[a]==="{")&&i.text===e[a]){if(++a,a===e.length){r.splice(-a,a);break}}else a=0}while(s!==0||n);return o.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:o,end:i}}consumeArgs(e,r){if(r){if(r.length!==e+1)throw new K("The length of delimiters doesn't match the number of args!");for(var n=r[0],o=0;o<n.length;o++){var i=this.popToken();if(n[o]!==i.text)throw new K("Use of the macro doesn't match its definition",i)}}for(var s=[],a=0;a<e;a++)s.push(this.consumeArg(r&&r[a+1]).tokens);return s}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new K("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var r=this.popToken(),n=r.text,o=r.noexpand?null:this._getExpansion(n);if(o==null||e&&o.unexpandable){if(e&&o==null&&n[0]==="\\"&&!this.isDefined(n))throw new K("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var i=o.tokens,s=this.consumeArgs(o.numArgs,o.delimiters);if(o.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new K("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...s[+l.text-1]);else throw new K("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new pr(e)]):void 0}expandTokens(e){var r=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var o=this.stack.pop();o.treatAsRelax&&(o.noexpand=!1,o.treatAsRelax=!1),r.push(o)}return this.countExpansion(r.length),r}expandMacroAsText(e){var r=this.expandMacro(e);return r&&r.map(n=>n.text).join("")}_getExpansion(e){var r=this.macros.get(e);if(r==null)return r;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var o=typeof r=="function"?r(this):r;if(typeof o=="string"){var i=0;if(o.includes("#"))for(var s=o.replace(/##/g,"");s.includes("#"+(i+1));)++i;for(var a=new B4(o,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return o}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(fo,e)||Object.prototype.hasOwnProperty.call(Qe.math,e)||Object.prototype.hasOwnProperty.call(Qe.text,e)||Object.prototype.hasOwnProperty.call(s6,e)}isExpandable(e){var r=this.macros.get(e);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Object.prototype.hasOwnProperty.call(fo,e)&&!fo[e].primitive}}var H4=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,xl=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Fu={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},$4={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Zc{constructor(e,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new XA(e,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(e,r){if(r===void 0&&(r=!0),this.fetch().text!==e)throw new K("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var r=this.nextToken;this.consume(),this.gullet.pushToken(new pr("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(e,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var o=this.fetch();if(Zc.endOfExpression.has(o.text)||r&&o.text===r||e&&fo[o.text]&&fo[o.text].infix)break;var i=this.parseAtom(r);if(i){if(i.type==="internal")continue}else break;n.push(i)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var r=-1,n,o=0;o<e.length;o++){var i=e[o];if(i.type==="infix"){if(r!==-1)throw new K("only one infix operator per group",i.token);r=o,n=i.replaceWith}}if(r!==-1&&n){var s,a,l=e.slice(0,r),c=e.slice(r+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[s,e[r],a],[]):u=this.callFunction(n,[s,a],[]),[u]}else return e}handleSupSubscript(e){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var o;do{var i;o=this.parseGroup(e)}while(((i=o)==null?void 0:i.type)==="internal");if(!o)throw new K("Expected group after '"+n+"'",r);return o}formatUnsupportedCmd(e){for(var r=[],n=0;n<e.length;n++)r.push({type:"textord",mode:"text",text:e[n]});var o={type:"text",mode:this.mode,body:r},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[o]};return i}parseAtom(e){var r=this.parseGroup("atom",e);if(r?.type==="internal"||this.mode==="text")return r;for(var n,o;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(r&&r.type==="op")r.limits=i.text==="\\limits",r.alwaysHandleSupSub=!0;else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=i.text==="\\limits");else throw new K("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(n)throw new K("Double superscript",i);n=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(o)throw new K("Double subscript",i);o=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(n)throw new K("Double superscript",i);var s={type:"textord",mode:this.mode,text:"\\prime"},a=[s];for(this.consume();this.fetch().text==="'";)a.push(s),this.consume();this.fetch().text==="^"&&a.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:a}}else if(xl[i.text]){var l=H4.test(i.text),c=[];for(c.push(new pr(xl[i.text])),this.consume();;){var u=this.fetch().text;if(!xl[u]||H4.test(u)!==l)break;c.unshift(new pr(xl[u])),this.consume()}var d=this.subparse(c);l?o={type:"ordgroup",mode:"math",body:d}:n={type:"ordgroup",mode:"math",body:d}}else break}return n&&o?{type:"supsub",mode:this.mode,base:r,sup:n,sub:o}:n?{type:"supsub",mode:this.mode,base:r,sup:n}:o?{type:"supsub",mode:this.mode,base:r,sub:o}:r}parseFunction(e,r){var n=this.fetch(),o=n.text,i=fo[o];if(!i)return null;if(this.consume(),r&&r!=="atom"&&!i.allowedInArgument)throw new K("Got function '"+o+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!i.allowedInText)throw new K("Can't use function '"+o+"' in text mode",n);if(this.mode==="math"&&i.allowedInMath===!1)throw new K("Can't use function '"+o+"' in math mode",n);var s=this.parseArguments(o,i),a=s.args,l=s.optArgs;return this.callFunction(o,a,l,n,e)}callFunction(e,r,n,o,i){var s={funcName:e,parser:this,token:o,breakOnTokenText:i},a=fo[e];if(a&&a.handler)return a.handler(s,r,n);throw new K("No function handler for "+e)}parseArguments(e,r){var n,o=(n=r.numOptionalArgs)!=null?n:0,i=r.numArgs+o;if(i===0)return{args:[],optArgs:[]};for(var s=[],a=[],l=0;l<i;l++){var c,u=(c=r.argTypes)==null?void 0:c[l],d=l<o;("primitive"in r&&r.primitive&&u==null||r.type==="sqrt"&&l===1&&a[0]==null)&&(u="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",u,d);if(d)a.push(h);else if(h!=null)s.push(h);else throw new K("Null argument, please report this as a bug")}return{args:s,optArgs:a}}parseGroupOfType(e,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var o=this.parseArgumentGroup(n,"text");return o!=null?{type:"styling",mode:o.mode,body:[o],style:"text",resetFont:!0}:null}case"raw":{this.gullet.consumeSpaces();var i=this.gullet.lexer.catcodes["%"];this.gullet.lexer.setCatcode("%",12);var s=this.parseStringGroup(n);return this.gullet.lexer.setCatcode("%",i),s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new K("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new K("Expected group as "+e,this.fetch());return a}case"original":case void 0:return this.parseArgumentGroup(n);default:throw new K("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e){var r=this.gullet.scanArgument(e);if(r==null)return null;for(var n="",o;(o=this.fetch()).text!=="EOF";)n+=o.text,this.consume();return this.consume(),r.text=n,r}parseRegexGroup(e,r){for(var n=this.fetch(),o=n,i="",s;(s=this.fetch()).text!=="EOF"&&e.test(i+s.text);)o=s,i+=o.text,this.consume();if(i==="")throw new K("Invalid "+r+": '"+n.text+"'",n);return n.range(o,i)}parseColorGroup(e){var r=this.parseStringGroup(e);if(r==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new K("Invalid color: '"+r.text+"'",r);var o=n[0];return/^[0-9a-f]{6}$/i.test(o)&&(o="#"+o),{type:"color-token",mode:this.mode,color:o}}parseSizeGroup(e){var r,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup(e),!r)return null;!e&&r.text.length===0&&(r.text="0pt",n=!0);var o=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!o)throw new K("Invalid size: '"+r.text+"'",r);var i={number:+(o[1]+o[2]),unit:o[3]};if(!y7(i))throw new K("Invalid unit: '"+i.unit+"'",r);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){var r=this.gullet.lexer.catcodes["%"],n=this.gullet.lexer.catcodes["~"];this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var o=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",r),this.gullet.lexer.setCatcode("~",n),o==null)return null;var i=o.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:i}}parseArgumentGroup(e,r){var n=this.gullet.scanArgument(e);if(n==null)return null;var o=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return r&&this.switchMode(o),s}parseGroup(e,r){var n=this.fetch(),o=n.text,i;if(o==="{"||o==="\\begingroup"){this.consume();var s=o==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,s),l=this.fetch();this.expect(s),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Jt.range(n,l),body:a,semisimple:o==="\\begingroup"||void 0}}else if(i=this.parseFunction(r,e)||this.parseSymbol(),i==null&&o[0]==="\\"&&!Object.prototype.hasOwnProperty.call(s6,o)){if(this.settings.throwOnError)throw new K("Undefined control sequence: "+o,n);i=this.formatUnsupportedCmd(o),this.consume()}return i}formLigatures(e){for(var r=e.length-1,n=0;n<r;++n){var o=e[n];if(o.type==="textord"){var i=o.text,s=e[n+1];if(!(!s||s.type!=="textord")){if(i==="-"&&s.text==="-"){var a=e[n+2];n+1<r&&a&&a.type==="textord"&&a.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:Jt.range(o,a),text:"---"}),r-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Jt.range(o,s),text:"--"}),r-=1)}(i==="'"||i==="`")&&s.text===i&&(e.splice(n,2,{type:"textord",mode:"text",loc:Jt.range(o,s),text:i+i}),r-=1)}}}}parseSymbol(){var e=this.fetch(),r=e.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),o=n.charAt(0)==="*";if(o&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new K(`\\verb assertion failed --
265
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:o}}Object.prototype.hasOwnProperty.call($4,r[0])&&!Qe[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Accented Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e}),r=$4[r[0]]+r.slice(1));var i=jA.exec(r);i&&(r=r.substring(0,i.index),r==="i"?r="ı":r==="j"&&(r="ȷ"));var s;if(Qe[this.mode][r]){this.settings.strict&&this.mode==="math"&&Ld.includes(r)&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Latin-1/Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e});var a=Qe[this.mode][r].group,l=Jt.range(e),c;rA(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:r}:c={type:a,mode:this.mode,loc:l,text:r},s=c}else if(r.charCodeAt(0)>=128)this.settings.strict&&(v7(r.charCodeAt(0))?this.mode==="math"&&Qt({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Unicode text character "'+r[0]+'" used in math mode',report:!0,token:e}):Qt({strict:this.settings.strict,errorCode:"unknownSymbol",errorMsg:'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),report:!0,token:e})),s={type:"textord",mode:"text",loc:Jt.range(e),text:r};else return null;if(this.consume(),i)for(var u=0;u<i[0].length;u++){var d=i[0][u];if(!Fu[d])throw new K("Unknown accent ' "+d+"'",e);var h=Fu[d][this.mode]||Fu[d].text;if(!h)throw new K("Accent "+d+" unsupported in "+this.mode+" mode",e);s={type:"accent",mode:this.mode,loc:Jt.range(e),label:h,isStretchy:!1,isShifty:!0,base:s}}return s}}Zc.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Uh=function(e,r){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Zc(e,r);delete n.gullet.macros.current["\\df@tag"];var o=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new K("\\tag works only in display equations");o=[{type:"tag",mode:"text",body:o,tag:n.subparse([new pr("\\df@tag")])}]}return o},a6=function(e,r,n){r.textContent="";var o=Gh(e,n).toNode();r.appendChild(o)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),a6=function(){throw new K("KaTeX doesn't work in quirks mode.")});var YA=function(e,r){var n=Gh(e,r).toMarkup();return n},JA=function(e,r){var n=new Rh(r);return Uh(e,n)},l6=function(e,r,n){if(n.throwOnError||!(e instanceof K))throw e;var o=G(["katex-error"],[new mr(r)]);return o.setAttribute("title",e.toString()),o.setAttribute("style","color:"+n.errorColor),o},Gh=function(e,r){var n=new Rh(r);try{var o=Uh(e,n);return US(o,e,n)}catch(i){return l6(i,e,n)}},QA=function(e,r){var n=new Rh(r);try{var o=Uh(e,n);return GS(o,n)}catch(i){return l6(i,e,n)}},eT="0.19.1",tT={Span:gs,Anchor:Hc,SymbolNode:mr,SvgNode:Hn,PathNode:bo,LineNode:Id},c6={version:eT,render:a6,renderToString:YA,ParseError:K,SETTINGS_SCHEMA:Td,__parse:JA,__renderToDomTree:Gh,__renderToHTMLTree:QA,__setFontMetrics:TS,__defineSymbol:f,__defineFunction:te,__defineMacro:x,__domTree:tT},rT=Object.defineProperty,q4=Object.getOwnPropertySymbols,nT=Object.prototype.hasOwnProperty,oT=Object.prototype.propertyIsEnumerable,F4=(t,e,r)=>e in t?rT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,iT=(t,e)=>{for(var r in e||(e={}))nT.call(e,r)&&F4(t,r,e[r]);if(q4)for(var r of q4(e))oT.call(e,r)&&F4(t,r,e[r]);return t};function hi(t,e){return Object.assign(t,{meta:iT({package:"@milkdown/components"},e)}),t}var sT=Object.defineProperty,V4=Object.getOwnPropertySymbols,aT=Object.prototype.hasOwnProperty,lT=Object.prototype.propertyIsEnumerable,W4=(t,e,r)=>e in t?sT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kh=(t,e)=>{for(var r in e||(e={}))aT.call(e,r)&&W4(t,r,e[r]);if(V4)for(var r of V4(e))lT.call(e,r)&&W4(t,r,e[r]);return t};const cT={mode:"preview"},Co=Ve(Kh({},cT),"linkTooltipStateCtx");hi(Co,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const uT={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},es=Ve(Kh({},uT),"linkTooltipAPICtx");hi(Co,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const dT={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},ts=Ve(Kh({},dT),"linkTooltipConfigCtx");hi(Co,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const Zh=Me("ToggleLink",t=>()=>e=>{const{doc:r,selection:n}=e,o=mo.type(t);return r.rangeHasMark(n.from,n.to,o)?(t.get(es.key).removeLink(n.from,n.to),!0):(t.get(es.key).addLink(n.from,n.to),!0)}),el=za("LINK_PREVIEW");hi(el[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});hi(el[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const Xc=za("LINK_EDIT");hi(Xc[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});hi(Xc[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function Xh(...t){}Xh(M);function ha({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}ha.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const hT=Rc("abcdefghijklmnopqrstuvwxyz0123456789",8);function fT(t){return`${t}-${hT()}`}Xh(M);const pT=Ct({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:t,src:e,onConfirm:r,onCancel:n}){const o=re(e),i=fT("milkdown-link-edit");Bn(e,l=>{o.value=l});const s=()=>{r(o.value)},a=l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),s()),l.key==="Escape"&&(l.preventDefault(),n())};return()=>M("div",{class:"link-edit"},M("input",{id:i,class:"input-area",placeholder:t.value.inputPlaceholder,onKeydown:a,onInput:l=>{o.value=l.target.value},value:o.value}),o.value?M(ha,{class:"button confirm",icon:t.value.confirmButton,onClick:s}):null)}});var mT=Object.defineProperty,gT=Object.defineProperties,vT=Object.getOwnPropertyDescriptors,j4=Object.getOwnPropertySymbols,yT=Object.prototype.hasOwnProperty,bT=Object.prototype.propertyIsEnumerable,u6=t=>{throw TypeError(t)},U4=(t,e,r)=>e in t?mT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cl=(t,e)=>{for(var r in e||(e={}))yT.call(e,r)&&U4(t,r,e[r]);if(j4)for(var r of j4(e))bT.call(e,r)&&U4(t,r,e[r]);return t},G4=(t,e)=>gT(t,vT(e)),d6=(t,e,r)=>e.has(t)||u6("Cannot "+r),Pe=(t,e,r)=>(d6(t,e,"read from private field"),r?r.call(t):e.get(t)),br=(t,e,r)=>e.has(t)?u6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Po=(t,e,r,n)=>(d6(t,e,"write to private field"),e.set(t,r),r),Ai,Jn,Qn,ql,zs,Fl,An,Vl,Ud,Wl,Gd,jl;const K4={from:-1,to:-1,mark:null};class wT{constructor(e,r){this.ctx=e,br(this,Ai),br(this,Jn),br(this,Qn,Cl({},K4)),br(this,ql),br(this,zs),br(this,Fl,re("")),br(this,An,()=>{Pe(this,Wl).call(this),Pe(this,Jn).hide(),this.ctx.update(Co.key,i=>G4(Cl({},i),{mode:"preview"})),Po(this,Qn,Cl({},K4))}),br(this,Vl,i=>{const s=i.target;s&&(Pe(this,Ai).contains(s)||Pe(this,An).call(this))}),br(this,Ud,()=>{document.addEventListener("pointerdown",Pe(this,Vl),!0)}),br(this,Wl,()=>{document.removeEventListener("pointerdown",Pe(this,Vl),!0)}),br(this,Gd,i=>{const s=this.ctx.get($e),{from:a,to:l,mark:c}=Pe(this,Qn),u=mo.type(this.ctx),d=M2(i);if(c&&c.attrs.href===d){Pe(this,An).call(this);return}const h=s.state.tr;if(c&&h.removeMark(a,l,c),a===l){if(!d){Pe(this,An).call(this);return}const p=u.create({href:d});h.insertText(d,a),h.addMark(a,a+d.length,p)}else h.addMark(a,l,u.create({href:d}));s.dispatch(h),Pe(this,An).call(this)}),br(this,jl,(i,s,a)=>{const l=this.ctx.get(ts.key);Pe(this,zs).value=l,Pe(this,Fl).value=i,this.ctx.update(Co.key,u=>G4(Cl({},u),{mode:"edit"}));const c=this.ctx.get($e);c.dispatch(c.state.tr.setSelection(Ce.create(c.state.doc,s,a))),Pe(this,Jn).show({getBoundingClientRect:()=>Oa(c,s,a)},c),Pe(this,Ud).call(this),requestAnimationFrame(()=>{var u;(u=Pe(this,Ai).querySelector("input"))==null||u.focus()})}),this.update=i=>{const{state:s}=i,{selection:a}=s;if(!(a instanceof Ce))return;const{from:l,to:c}=a;l===Pe(this,Qn).from&&c===Pe(this,Qn).to||Pe(this,An).call(this)},this.destroy=()=>{Pe(this,Wl).call(this),Pe(this,ql).unmount(),Pe(this,Jn).destroy(),Pe(this,Ai).remove()},this.addLink=(i,s)=>{Po(this,Qn,{from:i,to:s,mark:null}),Pe(this,jl).call(this,"",i,s)},this.editLink=(i,s,a)=>{Po(this,Qn,{from:s,to:a,mark:i}),Pe(this,jl).call(this,i.attrs.href,s,a)},this.removeLink=(i,s)=>{const a=this.ctx.get($e),l=a.state.tr;l.removeMark(i,s,mo.type(this.ctx)),a.dispatch(l),Pe(this,An).call(this)},Po(this,zs,re(this.ctx.get(ts.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const o=gr(pT,{config:Pe(this,zs),src:Pe(this,Fl),onConfirm:Pe(this,Gd),onCancel:Pe(this,An)});o.mount(n),Po(this,ql,o),Po(this,Ai,n),Po(this,Jn,new Ba({content:n,debounce:0,shouldShow:()=>!1})),Pe(this,Jn).onHide=()=>{requestAnimationFrame(()=>{r.dom.focus({preventScroll:!0})})},Pe(this,Jn).update(r)}}Ai=new WeakMap;Jn=new WeakMap;Qn=new WeakMap;ql=new WeakMap;zs=new WeakMap;Fl=new WeakMap;An=new WeakMap;Vl=new WeakMap;Ud=new WeakMap;Wl=new WeakMap;Gd=new WeakMap;jl=new WeakMap;var xT=Object.defineProperty,CT=Object.defineProperties,kT=Object.getOwnPropertyDescriptors,Z4=Object.getOwnPropertySymbols,_T=Object.prototype.hasOwnProperty,ST=Object.prototype.propertyIsEnumerable,X4=(t,e,r)=>e in t?xT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AT=(t,e)=>{for(var r in e||(e={}))_T.call(e,r)&&X4(t,r,e[r]);if(Z4)for(var r of Z4(e))ST.call(e,r)&&X4(t,r,e[r]);return t},TT=(t,e)=>CT(t,kT(e));function MT(t){let e;t.update(es.key,r=>TT(AT({},r),{addLink:(n,o)=>{e?.addLink(n,o)},editLink:(n,o,i)=>{e?.editLink(n,o,i)},removeLink:(n,o)=>{e?.removeLink(n,o)}})),t.set(Xc.key,{view:r=>(e=new wT(t,r),e)})}function ET(t,e,r,n,o){let i={start:-1,end:-1};return r.nodesBetween(n,o,(s,a)=>{if(i.start>-1)return!1;i.start===-1&&t.isInSet(s.marks)&&e===s&&(i={start:a,end:a+Math.max(s.textContent.length,1)})}),i}function IT(t,e,r){const n=e.posAtCoords({left:r.clientX,top:r.clientY});if(!n)return;const{pos:o}=n,i=e.state.doc.nodeAt(o);if(!i)return;const s=i.marks.find(l=>l.type===mo.mark.type(t));if(!(!s||!el.pluginKey()))return{show:!0,pos:o,node:i,mark:s}}Xh(M);const LT=Ct({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:t,src:e,onEdit:r,onRemove:n}){const o=dr(()=>M2(e.value)),i=l=>{l.preventDefault(),l.stopPropagation(),r.value()},s=l=>{l.preventDefault(),l.stopPropagation(),n.value()},a=l=>{l.preventDefault();const c=e.value;navigator.clipboard&&c&&navigator.clipboard.writeText(c).then(()=>{t.value.onCopyLink(c)}).catch(u=>console.error(u))};return()=>M("div",{class:"link-preview"},M(ha,{class:"button link-icon",icon:t.value.linkIcon,onClick:a}),M("a",{href:o.value,target:"_blank",rel:"noopener noreferrer",class:"link-display"},e.value),M(ha,{class:"button link-edit-button",icon:t.value.editButton,onClick:i}),M(ha,{class:"button link-remove-button",icon:t.value.removeButton,onClick:s}))}});var h6=t=>{throw TypeError(t)},f6=(t,e,r)=>e.has(t)||h6("Cannot "+r),Te=(t,e,r)=>(f6(t,e,"read from private field"),r?r.call(t):e.get(t)),Xt=(t,e,r)=>e.has(t)?h6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xn=(t,e,r,n)=>(f6(t,e,"write to private field"),e.set(t,r),r),$o,Lr,Ns,Hs,Ul,Gl,Kl,$s,Zl,qs,Xl,Yl,Jl,Fs;class RT{constructor(e,r){this.ctx=e,Xt(this,$o),Xt(this,Lr),Xt(this,Ns),Xt(this,Hs),Xt(this,Ul,re("")),Xt(this,Gl,re(()=>{})),Xt(this,Kl,re(()=>{})),Xt(this,$s),Xt(this,Zl),Xt(this,qs,!1),Xt(this,Xl,({mode:n})=>{n==="edit"&&Te(this,Fs).call(this)}),Xt(this,Yl,()=>{Xn(this,qs,!0)}),Xt(this,Jl,()=>{Xn(this,qs,!1)}),Xt(this,Fs,()=>{Te(this,Lr).hide(),Te(this,Lr).element.removeEventListener("mouseenter",Te(this,Yl)),Te(this,Lr).element.removeEventListener("mouseleave",Te(this,Jl))}),this.show=(n,o,i,s)=>{Te(this,Hs).value=this.ctx.get(ts.key),Te(this,Ul).value=n.attrs.href,Te(this,Gl).value=()=>{this.ctx.get(es.key).editLink(n,o,i)},Te(this,Kl).value=()=>{this.ctx.get(es.key).removeLink(o,i),Te(this,Fs).call(this)},Te(this,Lr).show({getBoundingClientRect:()=>s},Te(this,Zl)),Te(this,Lr).element.addEventListener("mouseenter",Te(this,Yl)),Te(this,Lr).element.addEventListener("mouseleave",Te(this,Jl))},this.hide=()=>{Te(this,qs)||Te(this,Fs).call(this)},this.update=()=>{},this.destroy=()=>{Te(this,$s).unmount(),Te(this,Ns).off(Te(this,Xl)),Te(this,Lr).destroy(),Te(this,$o).remove()},Xn(this,Zl,r),Xn(this,Hs,re(this.ctx.get(ts.key))),Xn(this,$s,gr(LT,{config:Te(this,Hs),src:Te(this,Ul),onEdit:Te(this,Gl),onRemove:Te(this,Kl)})),Xn(this,$o,document.createElement("div")),Te(this,$o).className="milkdown-link-preview",Te(this,$s).mount(Te(this,$o)),Xn(this,Lr,new Ba({debounce:0,content:Te(this,$o),shouldShow:()=>!1})),Te(this,Lr).update(r),Xn(this,Ns,e.use(Co.key)),Te(this,Ns).on(Te(this,Xl))}}$o=new WeakMap;Lr=new WeakMap;Ns=new WeakMap;Hs=new WeakMap;Ul=new WeakMap;Gl=new WeakMap;Kl=new WeakMap;$s=new WeakMap;Zl=new WeakMap;qs=new WeakMap;Xl=new WeakMap;Yl=new WeakMap;Jl=new WeakMap;Fs=new WeakMap;function OT(t){let e;const n=sc((i,s)=>{if(!e||!i.hasFocus()||t.get(Co.key).mode==="edit")return;const l=IT(t,i,s);if(l){const c=i.state.doc.resolve(l.pos),u=ET(l.mark,l.node,i.state.doc,c.before(),c.after()),d=u.start,h=u.end;e.show(l.mark,d,h,Oa(i,d,h));return}e.hide()},50),o=()=>{setTimeout(()=>{e?.hide()},50)};t.set(el.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:o}},view:i=>(e=new RT(t,i),e)})}function PT(t){OT(t),MT(t)}const DT=[Co,es,ts,el,Xc,Zh].flat();var BT=Object.defineProperty,Y4=Object.getOwnPropertySymbols,zT=Object.prototype.hasOwnProperty,NT=Object.prototype.propertyIsEnumerable,J4=(t,e,r)=>e in t?BT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HT=(t,e)=>{for(var r in e||(e={}))zT.call(e,r)&&J4(t,r,e[r]);if(Y4)for(var r of Y4(e))NT.call(e,r)&&J4(t,r,e[r]);return t};function p6(t,e){return Object.assign(t,{meta:HT({package:"@milkdown/components"},e)}),t}const $T={renderLabel:({label:t,listType:e,checked:r})=>r==null?e==="bullet"?"⦿":t:r?"☑":"□"},Yc=Ve($T,"listItemBlockConfigCtx");p6(Yc,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function m6(...t){}m6(M);function g6({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}g6.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};m6(M);const qT=Ct({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:t,checked:e,listType:r,config:n,readonly:o,setAttr:i,onMount:s,selected:a}){const l=h=>{h!=null&&h instanceof Element&&s(h)},c=h=>{e.value!=null&&(h.stopPropagation(),h.preventDefault(),i("checked",!e.value))},u=dr(()=>n.renderLabel({label:t.value,listType:r.value,checked:e.value,readonly:o.value})),d=dr(()=>e.value==null?r.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>M("li",{class:Mt("list-item",a.value&&"ProseMirror-selectednode")},M("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},M(g6,{class:Mt("label",o.value&&"readonly",d.value),icon:u.value})),M("div",{class:"children",ref:l}))}}),Ql=new WeakMap;function FT(t,e,r){let n=Ql.get(t);if(!n){const o=new Map;n=o,Ql.set(t,o),requestAnimationFrame(()=>{if(Ql.delete(t),t.isDestroyed)return;const{state:i}=t,s=i.doc.content.size;let a;for(const d of o.values())d.anchor<=s&&d.head<=s&&(a=d);if(!a)return;const l=i.doc.resolve(a.anchor),c=i.doc.resolve(a.head),u=Ce.between(l,c);t.dispatch(i.tr.setSelection(u))})}n.delete(e),n.set(e,r)}const v6=ko(Pa.node,t=>(e,r,n)=>{const o=document.createElement("div");o.className="milkdown-list-item-block";const i=document.createElement("div");i.setAttribute("data-content-dom","true"),i.classList.add("content-dom");const s=re(e.attrs.label),a=re(e.attrs.checked),l=re(e.attrs.listType),c=re(!r.editable),u=t.get(Yc.key),d=re(!1),h=(k,S)=>{if(!r.editable)return;const E=n();E!=null&&(r.hasFocus()||r.focus(),r.dispatch(r.state.tr.setNodeAttribute(E,k,S)))},p=cs(()=>{d.value?o.classList.add("selected"):o.classList.remove("selected")});let g=null;const v=gr(qT,{label:s,checked:a,listType:l,readonly:c,config:u,selected:d,setAttr:h,onMount:k=>{if(k===g)return;g=k;const{anchor:S,head:E}=r.state.selection;k.appendChild(i),FT(r,o,{anchor:S,head:E})}});v.mount(o);const w=k=>{l.value=k.attrs.listType,s.value=k.attrs.label,a.value=k.attrs.checked,c.value=!r.editable};w(e);let C=e;return{dom:o,contentDOM:i,update:k=>k.type!==e.type?!1:(k.sameMarkup(C)&&k.content.eq(C.content)||(C=k,w(k)),!0),ignoreMutation:k=>!o||!i?!0:k.type==="selection"?!1:i===k.target&&k.type==="attributes"?!0:!i.contains(k.target),selectNode:()=>{d.value=!0},deselectNode:()=>{d.value=!1},destroy:()=>{var k;(k=Ql.get(r))==null||k.delete(o),p(),v.unmount(),o.remove(),i.remove()}}});p6(v6,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const VT=[Yc,v6];var WT=Object.defineProperty,Q4=Object.getOwnPropertySymbols,jT=Object.prototype.hasOwnProperty,UT=Object.prototype.propertyIsEnumerable,e2=(t,e,r)=>e in t?WT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,GT=(t,e)=>{for(var r in e||(e={}))jT.call(e,r)&&e2(t,r,e[r]);if(Q4)for(var r of Q4(e))UT.call(e,r)&&e2(t,r,e[r]);return t};function y6(t,e){return Object.assign(t,{meta:GT({package:"@milkdown/components"},e)}),t}var KT=Object.defineProperty,t2=Object.getOwnPropertySymbols,ZT=Object.prototype.hasOwnProperty,XT=Object.prototype.propertyIsEnumerable,r2=(t,e,r)=>e in t?KT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,YT=(t,e)=>{for(var r in e||(e={}))ZT.call(e,r)&&r2(t,r,e[r]);if(t2)for(var r of t2(e))XT.call(e,r)&&r2(t,r,e[r]);return t};const JT={renderButton:t=>{switch(t){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},Jc=Ve(YT({},JT),"tableBlockConfigCtx");y6(Jc,{displayName:"Config<table-block>",group:"TableBlock"});function b6(...t){}b6(M);function Xr({icon:t,class:e,onClick:r}){return M("span",{class:Mt("milkdown-icon",e),onPointerdown:r,innerHTML:t?Tr.sanitize(t.trim()):void 0})}Xr.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function w6(t){const{dragPreviewRef:e,tableWrapperRef:r,contentWrapperRef:n,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a}=t,l=e.value;if(!l)return;const c=r.value;if(!c)return;const u=n.value;if(!u)return;const d=u.querySelector("tbody");if(!d)return;const h=l.querySelector("tbody");if(!h)return;const p=o.value;if(!p)return;const g=i.value;if(!g)return;const y=s.value;if(!y)return;const v=a.value;return v?{preview:l,wrapper:c,content:u,contentRoot:d,previewRoot:h,yHandle:p,xHandle:g,colHandle:y,rowHandle:v}:void 0}function x6(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function C6(t,e,r,n,o){const{width:i,height:s}=n.querySelector("tbody").getBoundingClientRect();if(t==="y"){const l=n.querySelectorAll("tr")[o];if(!l)return;r.appendChild(l.cloneNode(!0));const c=l.getBoundingClientRect().height;Object.assign(e.style,{width:`${i}px`,height:`${c}px`}),e.dataset.show="true";return}if(t==="x"){const a=n.querySelectorAll("tr");let l;Array.from(a).forEach(c=>{const u=c.children[o];if(!u)return;l===void 0&&(l=u.getBoundingClientRect().width);const d=u.parentElement.cloneNode(!1),h=u.cloneNode(!0);d.appendChild(h),r.appendChild(d)}),Object.assign(e.style,{width:`${l}px`,height:`${s}px`}),e.dataset.show="true";return}}function QT(t,e){return r=>{_6(t,r,e,n=>{k6("y",r,n,t);const{preview:o,content:i,previewRoot:s}=n;x6(s);const{hoverIndex:a}=t,[l]=a.value;C6("y",o,s,i,l)})}}function eM(t,e){return r=>{_6(t,r,e,n=>{k6("x",r,n,t);const{preview:o,content:i,previewRoot:s}=n,{hoverIndex:a}=t,[l,c]=a.value;x6(s),C6("x",o,s,i,c)})}}function k6(t,e,r,n){const{xHandle:o,yHandle:i,colHandle:s,rowHandle:a,preview:l}=r;o.dataset.displayType=t==="y"?"indicator":"none",i.dataset.displayType=t==="x"?"indicator":"none",t==="y"?(s.dataset.show="false",n2(a)):(a.dataset.show="false",n2(s));const{hoverIndex:c,dragInfo:u}=n,[d,h]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:t==="y"?d:h,endIndex:t==="y"?d:h,type:t==="y"?"row":"col"},l.dataset.direction=t==="y"?"vertical":"horizontal"}function _6(t,e,r,n){const o=r?.get($e);if(!o?.editable)return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const i=w6(t);i&&requestAnimationFrame(()=>{n(i)})}function n2(t){var e;(e=t.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function Kd(t,e){for(let r=0;r<t.childCount;r++)if(t.child(r)===e)return r;return-1}function tM(t,e){var r,n,o;if(e)try{const i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return;const s=i?.inside;if(s==null||s<0)return;const a=e.state.doc.resolve(s),l=e.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],d=c.includes(l.type.name)?l:(r=Pn(v=>c.includes(v.type.name))(a))==null?void 0:r.node,h=(n=Pn(v=>u.includes(v.type.name))(a))==null?void 0:n.node,p=(o=Pn(v=>v.type.name==="table")(a))==null?void 0:o.node;if(!d||!h||!p)return;const g=Kd(h,d);return[Kd(p,h),g]}catch{return}}function Qc(t,[e,r]){const n=t.value;if(!n)return;const o=n.querySelectorAll("tr"),i=o[e];if(!i)return;const s=o[0];if(!s)return;const a=s.children[r];if(!a)return;const l=i.children[r];if(l)return{row:i,col:l,headerCol:a}}function rM(t,e,r){if(!r||!e)return;const{selection:n}=e.state;if(!(n instanceof Ue))return;const{$from:o}=n,i=hs(o);if(!(!i||i.node!==r)){if(n.isColSelection()){const{$head:s}=n,a=s.index(s.depth-1);Yh({refs:t,index:[0,a],before:l=>{var c;(c=l.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(n.isRowSelection()){const{$head:s}=n,a=Pn(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(s);if(!a)return;const l=Kd(i.node,a.node);Jh({refs:t,index:[l,0],before:c=>{var u;l>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function Yh({refs:t,index:e,before:r,after:n}){const{contentWrapperRef:o,colHandleRef:i,hoverIndex:s}=t,a=i.value;if(!a)return;s.value=e;const l=Qc(o,e);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",r&&r(a),dn(c,a,{placement:"top"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),n&&n(a)}).catch(console.error)}function Jh({refs:t,index:e,before:r,after:n}){const{contentWrapperRef:o,rowHandleRef:i,hoverIndex:s}=t,a=i.value;if(!a)return;s.value=e;const l=Qc(o,e);if(!l)return;const{row:c}=l;a.dataset.show="true",r&&r(a),dn(c,a,{placement:"left"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),n&&n(a)}).catch(console.error)}function S6(t,e,r){const n=r==="x"?"left":"top",o=r==="x"?"right":"bottom",i=t.length-1,s=t.findIndex((l,c)=>{const u=l.getBoundingClientRect(),d=u[n],h=u[o];return d<=e&&e<=h||c===i&&e>h||c===0&&e<d}),a=t[s];return a?[a,s]:void 0}function nM(t,e){const r=t.querySelector("tr");if(!r)return;const n=Array.from(r.children);return S6(n,e,"x")}function oM(t,e){const r=Array.from(t.querySelectorAll("tr"));return S6(r,e,"y")}function iM(t){return ac(e=>{const r=w6(t);if(!r)return;const{preview:n,content:o,contentRoot:i,xHandle:s,yHandle:a}=r,{dragInfo:l,hoverIndex:c}=t;if(n.dataset.show==="false")return;const u=Qc(t.contentWrapperRef,c.value);if(!u||!i.querySelector("tr"))return;const h=l.value;if(!h||!i.offsetParent)return;const p=i.offsetParent.offsetTop,g=i.offsetParent.offsetLeft;if(h.type==="col"){const y=u.col.getBoundingClientRect().width,{left:v,width:w}=i.getBoundingClientRect(),C=g-v,k=e.clientX+C-y/2,[S]=h.startCoords,E=S<e.clientX?"right":"left";n.style.top=`${p}px`;const R=k<v+C-20?v+C-20:k>v+w+C-y+20?v+w+C-y+20:k;n.style.left=`${R}px`;const H=nM(i,e.clientX);if(H){const[O,P]=H,$=a.getBoundingClientRect().width,ie=o.getBoundingClientRect();h.endIndex=P,dn(O,a,{placement:E==="left"?"left":"right",middleware:[oi(E==="left"?-1*$:0)]}).then(({x:N})=>{a.dataset.show="true",Object.assign(a.style,{height:`${ie.height}px`,left:`${N}px`,top:`${p}px`})}).catch(console.error)}}else if(h.type==="row"){const y=u.row.getBoundingClientRect().height,{top:v,height:w}=i.getBoundingClientRect(),C=p-v,k=e.clientY+C-y/2,[S,E]=h.startCoords,R=E<e.clientY?"down":"up",H=k<v+C-20?v+C-20:k>v+w+C-y+20?v+w+C-y+20:k;n.style.top=`${H}px`,n.style.left=`${g}px`;const O=oM(i,e.clientY);if(O){const[P,$]=O,ie=s.getBoundingClientRect().height,N=o.getBoundingClientRect();h.endIndex=$,dn(P,s,{placement:R==="up"?"top":"bottom",middleware:[oi(R==="up"?-1*ie:0)]}).then(({y:ye})=>{s.dataset.show="true",Object.assign(s.style,{width:`${N.width}px`,top:`${ye}px`})}).catch(console.error)}}},20)}function sM(t,e,r){const{dragPreviewRef:n,yLineHandleRef:o,xLineHandleRef:i,dragInfo:s}=t,a=QT(t,e),l=eM(t,e),c=()=>{const h=n.value;if(!h||h.dataset.show==="false")return;const p=h?.querySelector("tbody");for(;p?.firstChild;)p?.removeChild(p.firstChild);h&&(h.dataset.show="false")},u=()=>{var h;const p=n.value;if(!p)return;const g=o.value;if(!g)return;const y=i.value;if(!y)return;const v=s.value;if(!v||!e||p.dataset.show==="false"||!t.colHandleRef.value||!t.rowHandleRef.value||(g.dataset.show="false",y.dataset.show="false",v.startIndex===v.endIndex))return;const k=e.get(ne),S={from:v.startIndex,to:v.endIndex,pos:((h=r?.())!=null?h:0)+1};if(v.type==="col"){k.call(Go.key,{pos:S.pos,index:v.startIndex}),k.call(fh.key,S);const E=[0,v.endIndex];Yh({refs:t,index:E})}else{k.call(Uo.key,{pos:S.pos,index:v.startIndex}),k.call(hh.key,S);const E=[v.endIndex,0];Jh({refs:t,index:E})}requestAnimationFrame(()=>{e.get($e).focus()})},d=iM(t);return us(()=>{window.addEventListener("dragover",d),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),ds(()=>{window.removeEventListener("dragover",d),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:a,dragCol:l}}function aM(t,e,r){const{xLineHandleRef:n,contentWrapperRef:o,colHandleRef:i,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=t;return{onAddRow:()=>{var y,v,w;if(!e)return;const C=n.value;if(!C)return;const[k]=l.value;if(k<0||!e.get($e).editable)return;const S=Array.from((v=(y=o.value)==null?void 0:y.querySelectorAll("tr"))!=null?v:[]),E=e.get(ne),R=((w=r?.())!=null?w:0)+1;S.length===k?(E.call(Uo.key,{pos:R,index:k-1}),E.call(yh.key)):(E.call(Uo.key,{pos:R,index:k}),E.call(vh.key)),E.call(Uo.key,{pos:R,index:k}),C.dataset.show="false"},onAddCol:()=>{var y,v,w,C;if(!e||!n.value)return;const[S,E]=l.value;if(E<0||!e.get($e).editable)return;const R=Array.from((w=(v=(y=o.value)==null?void 0:y.querySelector("tr"))==null?void 0:v.children)!=null?w:[]),H=e.get(ne),O=((C=r?.())!=null?C:0)+1;R.length===E?(H.call(Go.key,{pos:O,index:E-1}),H.call(gh.key)):(H.call(Go.key,{pos:O,index:E}),H.call(mh.key)),H.call(Go.key,{pos:O,index:E})},selectCol:()=>{var y,v;if(!e)return;const[w,C]=a.value,k=e.get(ne),S=((y=r?.())!=null?y:0)+1;k.call(Go.key,{pos:S,index:C});const E=(v=i.value)==null?void 0:v.querySelector(".button-group");E&&(E.dataset.show=E.dataset.show==="true"?"false":"true")},selectRow:()=>{var y,v;if(!e)return;const[w,C]=a.value,k=e.get(ne),S=((y=r?.())!=null?y:0)+1;k.call(Uo.key,{pos:S,index:w});const E=(v=s.value)==null?void 0:v.querySelector(".button-group");E&&w>0&&(E.dataset.show=E.dataset.show==="true"?"false":"true")},deleteSelected:y=>{if(!e||!e.get($e).editable)return;y.preventDefault(),y.stopPropagation(),e.get(ne).call(ph.key),requestAnimationFrame(()=>{e.get($e).focus()})},onAlign:y=>v=>{if(!e||!e.get($e).editable)return;v.preventDefault(),v.stopPropagation(),e.get(ne).call(bh.key,y),requestAnimationFrame(()=>{e.get($e).focus()})}}}function lM(t,e){return ac(r=>{if(!e?.editable)return;const{contentWrapperRef:n,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=t,u=o.value;if(!u)return;const d=i.value;if(!d)return;const h=n.value;if(!h)return;const p=a.value;if(!p)return;const g=s.value;if(!g)return;const y=tM(r,e);if(!y)return;const v=Qc(n,y);if(!v)return;const[w,C]=y,k=v.col.getBoundingClientRect(),S=Math.abs(r.clientX-k.left)<8,E=Math.abs(k.right-r.clientX)<8,R=Math.abs(r.clientY-k.top)<8,H=Math.abs(k.bottom-r.clientY)<8,O=S||E||R||H,P=p.querySelector(".button-group"),$=g.querySelector(".button-group");if(P&&(P.dataset.show="false"),$&&($.dataset.show="false"),O){const ie=h.getBoundingClientRect();p.dataset.show="false",g.dataset.show="false",d.dataset.displayType="tool",u.dataset.displayType="tool";const N=u.getBoundingClientRect().width,ye=d.getBoundingClientRect().height;S||E?(c.value[1]=S?C:C+1,dn(v.col,u,{placement:S?"left":"right",middleware:[oi(S?-1*N:0)]}).then(({x:be})=>{u.dataset.show="true",Object.assign(u.style,{height:`${ie.height}px`,left:`${be}px`})}).catch(console.error)):u.dataset.show="false",y[0]!==0&&(R||H)?(c.value[0]=R?w:w+1,dn(v.row,d,{placement:R?"top":"bottom",middleware:[oi(R?-1*ye:0)]}).then(({y:be})=>{d.dataset.show="true",Object.assign(d.style,{width:`${ie.width}px`,top:`${be}px`})}).catch(console.error)):d.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",d.dataset.show="false",p.dataset.show="true",g.dataset.show="true",Jh({refs:t,index:y}),Yh({refs:t,index:y}),l.value=y},20)}function cM(t){return()=>{const{rowHandleRef:e,colHandleRef:r,yLineHandleRef:n,xLineHandleRef:o}=t;setTimeout(()=>{const i=e.value;if(!i)return;const s=r.value;if(!s)return;const a=n.value;if(!a)return;const l=o.value;l&&(i.dataset.show="false",s.dataset.show="false",a.dataset.show="false",l.dataset.show="false")},200)}}function uM(t,e){const r=lM(t,e),n=cM(t);return{pointerMove:r,pointerLeave:n}}b6(M);const dM=Ct({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:t,node:e,ctx:r,getPos:n,config:o,onMount:i}){const s=re(),a=N=>{N!=null&&(N instanceof HTMLElement?(s.value=N,i(N)):s.value=void 0)},l=re(),c=re(),u=re(),d=re(),h=re(),p=re(),w={dragPreviewRef:p,tableWrapperRef:h,contentWrapperRef:s,yLineHandleRef:d,xLineHandleRef:u,colHandleRef:l,rowHandleRef:c,hoverIndex:re([0,0]),lineHoverIndex:re([-1,-1]),dragInfo:re()},{pointerLeave:C,pointerMove:k}=uM(w,t),{dragRow:S,dragCol:E}=sM(w,r,n),{onAddRow:R,onAddCol:H,selectCol:O,selectRow:P,deleteSelected:$,onAlign:ie}=aM(w,r,n);return us(()=>{requestAnimationFrame(()=>{t.editable&&rM(w,t,e.value)})}),()=>M("div",{onDragstart:N=>N.preventDefault(),onDragover:N=>N.preventDefault(),onDragleave:N=>N.preventDefault(),onPointermove:k,onPointerleave:C},M("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:E,onClick:O,onPointerdown:N=>N.stopPropagation(),onPointermove:N=>N.stopPropagation(),ref:l},M(Xr,{icon:o.renderButton("col_drag_handle")}),M("div",{"data-show":"false",class:"button-group",onPointermove:N=>N.stopPropagation()},M("button",{type:"button",onPointerdown:ie("left")},M(Xr,{icon:o.renderButton("align_col_left")})),M("button",{type:"button",onPointerdown:ie("center")},M(Xr,{icon:o.renderButton("align_col_center")})),M("button",{type:"button",onPointerdown:ie("right")},M(Xr,{icon:o.renderButton("align_col_right")})),M("button",{type:"button",onPointerdown:$},M(Xr,{icon:o.renderButton("delete_col")})))),M("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:S,onClick:P,onPointerdown:N=>N.stopPropagation(),onPointermove:N=>N.stopPropagation(),ref:c},M(Xr,{icon:o.renderButton("row_drag_handle")}),M("div",{"data-show":"false",class:"button-group",onPointermove:N=>N.stopPropagation()},M("button",{type:"button",onPointerdown:$},M(Xr,{icon:o.renderButton("delete_row")})))),M("div",{class:"table-wrapper",ref:h},M("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},M("table",null,M("tbody",null))),M("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:N=>N.stopPropagation(),ref:u},M("button",{type:"button",onClick:R,class:"add-button"},M(Xr,{icon:o.renderButton("add_row")}))),M("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:N=>N.stopPropagation(),ref:d},M("button",{type:"button",onClick:H,class:"add-button"},M(Xr,{icon:o.renderButton("add_col")}))),M("table",{ref:a,class:"children"})))}});var A6=t=>{throw TypeError(t)},hM=(t,e,r)=>e.has(t)||A6("Cannot "+r),fM=(t,e,r)=>e.has(t)?A6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),pM=(t,e,r)=>(hM(t,e,"access private method"),r),Zd,T6;class mM{constructor(e,r,n,o){this.ctx=e,this.node=r,this.view=n,this.getPos=o,fM(this,Zd);const i=document.createElement("div");i.className="milkdown-table-block";const s=document.createElement("tbody");this.contentDOM=s,s.setAttribute("data-content-dom","true"),s.classList.add("content-dom"),this.nodeRef=P0(r);const a=gr(dM,{view:n,ctx:e,getPos:o,config:e.get(Jc.key),onMount:l=>{l.appendChild(s)},node:this.nodeRef});a.mount(i),this.app=a,this.dom=i}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const r=e.target;if(r instanceof HTMLElement&&(r.closest("th")||r.closest("td"))){const n=e;return pM(this,Zd,T6).call(this,n)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}Zd=new WeakSet;T6=function(t){const e=this.view;if(!e.editable)return!1;const{state:r,dispatch:n}=e,o=e.posAtCoords({left:t.clientX,top:t.clientY});if(!o)return!1;const i=r.doc.resolve(o.inside),s=Pn(c=>c.type.name==="table_cell"||c.type.name==="table_header")(i);if(!s)return!1;if(r.selection instanceof Ce){const c=Pn(u=>u.type.name==="table_cell"||u.type.name==="table_header")(r.selection.$from);if(c?.node===s.node)return!1}const{from:a}=s,l=qr.create(r.doc,a+1);return r.selection.eq(l)?!1:(r.selection instanceof Ue?setTimeout(()=>{n(r.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{n(r.tr.setSelection(l).scrollIntoView())}),!0)};const M6=ko(ln.node,t=>(e,r,n)=>new mM(t,e,r,n));y6(M6,{displayName:"NodeView<table-block>",group:"TableBlock"});const gM=[Jc,M6];function Xd(t){if(!t)return!1;if(Array.isArray(t))return t.length>1?!1:Xd(t[0]);const e=t.content;return e?Xd(e):t.type==="text"}function vM(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-clipboard",...e}}),t}function o2(t,e){const r=Tv(e);if(r)return t.dispatch(t.state.tr.replaceSelectionWith(r,!0)),!0;try{return t.dispatch(t.state.tr.replaceSelection(e)),!0}catch{return!1}}var E6=Je(t=>{const e=t.get(y1);t.update(b1,n=>({...n,editable:n.editable??(()=>!0),transformPastedHTML:(o,i)=>{const s=n.transformPastedHTML;return s&&(o=s(o,i)),o.includes("docs-internal-guid")&&(o=o.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1"),o=o.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),o}}));const r=new et("MILKDOWN_CLIPBOARD");return new Xe({key:r,props:{handlePaste:(n,o,i)=>{const s=t.get(gn),a=n.props.editable?.(n.state),{clipboardData:l}=o;if(!a||!l||n.state.selection.$from.node().type.spec.code)return!1;const c=l.getData("text/plain"),u=l.getData("vscode-editor-data");if(u){const g=JSON.parse(u)?.mode;if(c&&g){const{tr:y}=n.state,v=Sv("code_block",e);return y.replaceSelectionWith(v.create({language:g})).setSelection(Ce.near(y.doc.resolve(Math.max(0,y.selection.from-2)))).insertText(c.replace(/\r\n?/g,`
266
+ `)),n.dispatch(y),!0}}const d=l.getData("text/html");if(d.length===0&&c.length===0)return!1;if(d.length>0&&i)return o2(n,i);const h=Av.fromSchema(e);let p;if(d.length===0){const g=s(c);if(!g||typeof g=="string")return!1;p=y2.fromSchema(e).serializeFragment(g.content)}else{const g=document.createElement("template");g.innerHTML=d,p=g.content.cloneNode(!0),g.remove()}return o2(n,h.parseSlice(p))},clipboardTextSerializer:n=>{const o=t.get(fa);if(Xd(n.content.toJSON()))return n.content.textBetween(0,n.content.size,`
267
267
 
268
- `);const i=e.topNodeType.createAndFill(void 0,n.content);return i?o(i):""}}})});bM(E6,{displayName:"Prose<clipboard>"});function ys(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-history",...e}}),t}var Qh=Me("Undo",()=>()=>ic);ys(Qh,{displayName:"Command<undo>"});var ef=Me("Redo",()=>()=>Wi);ys(ef,{displayName:"Command<redo>"});var tf=Ve({},"historyProviderConfig");ys(tf,{displayName:"Ctx<historyProviderConfig>"});var I6=Je(t=>x8(t.get(tf.key)));ys(I6,{displayName:"Ctx<historyProviderPlugin>"});var rf=f1("historyKeymap",{Undo:{shortcuts:"Mod-z",command:t=>{const e=t.get(ne);return()=>e.call(Qh.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:t=>{const e=t.get(ne);return()=>e.call(ef.key)}}});ys(rf.ctx,{displayName:"KeymapCtx<history>"});ys(rf.shortcuts,{displayName:"Keymap<history>"});var wM=[tf,I6,rf,Qh,ef].flat();function xM(t,e){const{doc:r,selection:n}=t;if(!r||!n||!(n instanceof Ce||n instanceof Ev))return t;const{to:o}=n,i=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return t.insertText(i,o)}var eu=Ve({type:"space",size:2},"indentConfig");eu.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var L6=Mv(t=>({Tab:(e,r)=>{const n=t.get(eu.key),{tr:o}=e,i=xM(o,n);return i.docChanged?(r?.(i),!0):!1}}));L6.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var CM=[eu,L6],R6=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}},J0=oc(new R6,"listener"),kM=new et("MILKDOWN_LISTENER"),O6=t=>(t.inject(J0,new R6),async()=>{await t.wait(Iv);const{listeners:e}=t.get(J0);e.beforeMount.forEach(c=>c(t)),await t.wait(Lv);const r=t.get(fa);let n=null,o=null,i=null,s=null;const a=sc(()=>{if(!s)return;const{doc:c}=s;if(e.updated.length>0&&n&&!n.eq(c)&&e.updated.forEach(u=>{u(t,c,n)}),e.markdownUpdated.length>0&&n&&!n.eq(c)){const u=r(c);e.markdownUpdated.forEach(d=>{d(t,u,o)}),o=u}n=c,s=null},200),l=new Xe({key:kM,view:()=>({destroy:()=>{a.cancel(),e.destroy.forEach(c=>c(t))}}),props:{handleDOMEvents:{focus:()=>(e.focus.forEach(c=>c(t)),!1),blur:()=>(e.blur.forEach(c=>c(t)),!1)}},state:{init:(c,u)=>{n=u.doc,o=r(u.doc)},apply:c=>{const u=c.selection;(!i&&u||i&&!u.eq(i))&&(e.selectionUpdated.forEach(d=>{d(t,u,i)}),i=u),!(!(c.docChanged||c.storedMarksSet)||c.getMeta("addToHistory")===!1)&&(s=c,a())}}});t.update(Rv,c=>c.concat(l)),await t.wait(Ov),e.mounted.forEach(c=>c(t))});O6.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var nf=Ve({shouldAppend:t=>!(!t||["heading","paragraph"].includes(t.type.name)),getNode:t=>t.schema.nodes.paragraph.create()},"trailingConfig");nf.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var P6=Je(t=>{const e=new et("MILKDOWN_TRAILING"),{shouldAppend:r,getNode:n}=t.get(nf.key),o=new Xe({key:e,state:{init:(i,s)=>{const a=s.tr.doc.lastChild;return r(a,s)},apply:(i,s,a,l)=>{if(!i.docChanged)return s;const c=i.doc.lastChild;return r(c,l)}},appendTransaction:(i,s,a)=>{const{doc:l,tr:c}=a,u=n?.(a),d=o.getState(a),h=l.content.size;if(!(!d||!u))return c.insert(h,u)}});return o});P6.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var _M=[nf,P6];function SM(t){return new Promise(e=>{const r=new FileReader;r.addEventListener("load",()=>{e({alt:t.name,src:r.result})},!1),r.readAsDataURL(t)})}var AM=async(t,e)=>{const r=[];for(let o=0;o<t.length;o++){const i=t.item(o);i&&i.type.includes("image")&&r.push(i)}const{image:n}=e.nodes;if(!n)throw Pv("image");return(await Promise.all(r.map(o=>SM(o)))).map(({alt:o,src:i})=>n.createAndFill({src:i,alt:o}))},Fi=Ve({uploader:AM,enableHtmlFileUploader:!1,uploadWidgetFactory:(t,e)=>{const r=document.createElement("span");return r.textContent="Upload in progress...",Bt.widget(t,r,e)}},"uploadConfig");Fi.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var D6=Je(t=>{const e=new et("MILKDOWN_UPLOAD"),r=(o,i)=>{const s=e.getState(o);if(!s)return-1;const a=s.find(void 0,void 0,l=>l.id===i);return a.length?a[0]?.from??-1:-1},n=(o,i,s)=>{if(!s||s.length<=0)return!1;const a=Symbol("upload symbol"),l=t.get(y1),{uploader:c,getInsertPos:u}=t.get(Fi.key),{tr:d}=o.state,h=i instanceof DragEvent?o.posAtCoords({left:i.clientX,top:i.clientY})?.pos??d.selection.from:d.selection.from,p=typeof u=="function"?u(i,t,h):h;return o.dispatch(d.setMeta(e,{add:{id:a,pos:p}})),c(s,l,t,p).then(g=>{const y=r(o.state,a);y<0||o.dispatch(o.state.tr.replaceWith(y,y,g).setMeta(e,{remove:{id:a}}))}).catch(g=>{console.error(g)}),!0};return new Xe({key:e,state:{init(){return Dt.empty},apply(o,i){const s=i.map(o.mapping,o.doc),a=o.getMeta(this);if(!a)return s;if(a.add){const{uploadWidgetFactory:l}=t.get(Fi.key),c=l(a.add.pos,{id:a.add.id});return s.add(o.doc,[c])}if(a.remove){const l=s.find(void 0,void 0,c=>c.id===a.remove.id);return s.remove(l)}return s}},props:{decorations(o){return this.getState(o)},handlePaste:(o,i)=>{const{enableHtmlFileUploader:s}=t.get(Fi.key);return!(i instanceof ClipboardEvent)||!s&&i.clipboardData?.getData("text/html")?!1:n(o,i,i.clipboardData?.files)},handleDrop:(o,i)=>i instanceof DragEvent?n(o,i,i.dataTransfer?.files):!1}})});D6.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var TM=[Fi,D6],Ae=(t=>(t.CodeMirror="code-mirror",t.ListItem="list-item",t.LinkTooltip="link-tooltip",t.Cursor="cursor",t.ImageBlock="image-block",t.BlockEdit="block-edit",t.Toolbar="toolbar",t.Placeholder="placeholder",t.Table="table",t.Latex="latex",t.TopBar="top-bar",t.AI="ai",t))(Ae||{});const MM={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1,ai:!1},of=`
268
+ `);const i=e.topNodeType.createAndFill(void 0,n.content);return i?o(i):""}}})});vM(E6,{displayName:"Prose<clipboard>"});function ys(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-history",...e}}),t}var Qh=Me("Undo",()=>()=>ic);ys(Qh,{displayName:"Command<undo>"});var ef=Me("Redo",()=>()=>Wi);ys(ef,{displayName:"Command<redo>"});var tf=Ve({},"historyProviderConfig");ys(tf,{displayName:"Ctx<historyProviderConfig>"});var I6=Je(t=>w8(t.get(tf.key)));ys(I6,{displayName:"Ctx<historyProviderPlugin>"});var rf=f1("historyKeymap",{Undo:{shortcuts:"Mod-z",command:t=>{const e=t.get(ne);return()=>e.call(Qh.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:t=>{const e=t.get(ne);return()=>e.call(ef.key)}}});ys(rf.ctx,{displayName:"KeymapCtx<history>"});ys(rf.shortcuts,{displayName:"Keymap<history>"});var yM=[tf,I6,rf,Qh,ef].flat();function bM(t,e){const{doc:r,selection:n}=t;if(!r||!n||!(n instanceof Ce||n instanceof Ev))return t;const{to:o}=n,i=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return t.insertText(i,o)}var eu=Ve({type:"space",size:2},"indentConfig");eu.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var L6=Mv(t=>({Tab:(e,r)=>{const n=t.get(eu.key),{tr:o}=e,i=bM(o,n);return i.docChanged?(r?.(i),!0):!1}}));L6.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var wM=[eu,L6],R6=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}},J0=oc(new R6,"listener"),xM=new et("MILKDOWN_LISTENER"),O6=t=>(t.inject(J0,new R6),async()=>{await t.wait(Iv);const{listeners:e}=t.get(J0);e.beforeMount.forEach(c=>c(t)),await t.wait(Lv);const r=t.get(fa);let n=null,o=null,i=null,s=null;const a=sc(()=>{if(!s)return;const{doc:c}=s;if(e.updated.length>0&&n&&!n.eq(c)&&e.updated.forEach(u=>{u(t,c,n)}),e.markdownUpdated.length>0&&n&&!n.eq(c)){const u=r(c);e.markdownUpdated.forEach(d=>{d(t,u,o)}),o=u}n=c,s=null},200),l=new Xe({key:xM,view:()=>({destroy:()=>{a.cancel(),e.destroy.forEach(c=>c(t))}}),props:{handleDOMEvents:{focus:()=>(e.focus.forEach(c=>c(t)),!1),blur:()=>(e.blur.forEach(c=>c(t)),!1)}},state:{init:(c,u)=>{n=u.doc,o=r(u.doc)},apply:c=>{const u=c.selection;(!i&&u||i&&!u.eq(i))&&(e.selectionUpdated.forEach(d=>{d(t,u,i)}),i=u),!(!(c.docChanged||c.storedMarksSet)||c.getMeta("addToHistory")===!1)&&(s=c,a())}}});t.update(Rv,c=>c.concat(l)),await t.wait(Ov),e.mounted.forEach(c=>c(t))});O6.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var nf=Ve({shouldAppend:t=>!(!t||["heading","paragraph"].includes(t.type.name)),getNode:t=>t.schema.nodes.paragraph.create()},"trailingConfig");nf.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var P6=Je(t=>{const e=new et("MILKDOWN_TRAILING"),{shouldAppend:r,getNode:n}=t.get(nf.key),o=new Xe({key:e,state:{init:(i,s)=>{const a=s.tr.doc.lastChild;return r(a,s)},apply:(i,s,a,l)=>{if(!i.docChanged)return s;const c=i.doc.lastChild;return r(c,l)}},appendTransaction:(i,s,a)=>{const{doc:l,tr:c}=a,u=n?.(a),d=o.getState(a),h=l.content.size;if(!(!d||!u))return c.insert(h,u)}});return o});P6.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var CM=[nf,P6];function kM(t){return new Promise(e=>{const r=new FileReader;r.addEventListener("load",()=>{e({alt:t.name,src:r.result})},!1),r.readAsDataURL(t)})}var _M=async(t,e)=>{const r=[];for(let o=0;o<t.length;o++){const i=t.item(o);i&&i.type.includes("image")&&r.push(i)}const{image:n}=e.nodes;if(!n)throw Pv("image");return(await Promise.all(r.map(o=>kM(o)))).map(({alt:o,src:i})=>n.createAndFill({src:i,alt:o}))},Fi=Ve({uploader:_M,enableHtmlFileUploader:!1,uploadWidgetFactory:(t,e)=>{const r=document.createElement("span");return r.textContent="Upload in progress...",Bt.widget(t,r,e)}},"uploadConfig");Fi.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var D6=Je(t=>{const e=new et("MILKDOWN_UPLOAD"),r=(o,i)=>{const s=e.getState(o);if(!s)return-1;const a=s.find(void 0,void 0,l=>l.id===i);return a.length?a[0]?.from??-1:-1},n=(o,i,s)=>{if(!s||s.length<=0)return!1;const a=Symbol("upload symbol"),l=t.get(y1),{uploader:c,getInsertPos:u}=t.get(Fi.key),{tr:d}=o.state,h=i instanceof DragEvent?o.posAtCoords({left:i.clientX,top:i.clientY})?.pos??d.selection.from:d.selection.from,p=typeof u=="function"?u(i,t,h):h;return o.dispatch(d.setMeta(e,{add:{id:a,pos:p}})),c(s,l,t,p).then(g=>{const y=r(o.state,a);y<0||o.dispatch(o.state.tr.replaceWith(y,y,g).setMeta(e,{remove:{id:a}}))}).catch(g=>{console.error(g)}),!0};return new Xe({key:e,state:{init(){return Dt.empty},apply(o,i){const s=i.map(o.mapping,o.doc),a=o.getMeta(this);if(!a)return s;if(a.add){const{uploadWidgetFactory:l}=t.get(Fi.key),c=l(a.add.pos,{id:a.add.id});return s.add(o.doc,[c])}if(a.remove){const l=s.find(void 0,void 0,c=>c.id===a.remove.id);return s.remove(l)}return s}},props:{decorations(o){return this.getState(o)},handlePaste:(o,i)=>{const{enableHtmlFileUploader:s}=t.get(Fi.key);return!(i instanceof ClipboardEvent)||!s&&i.clipboardData?.getData("text/html")?!1:n(o,i,i.clipboardData?.files)},handleDrop:(o,i)=>i instanceof DragEvent?n(o,i,i.dataTransfer?.files):!1}})});D6.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var SM=[Fi,D6],Ae=(t=>(t.CodeMirror="code-mirror",t.ListItem="list-item",t.LinkTooltip="link-tooltip",t.Cursor="cursor",t.ImageBlock="image-block",t.BlockEdit="block-edit",t.Toolbar="toolbar",t.Placeholder="placeholder",t.Table="table",t.Latex="latex",t.TopBar="top-bar",t.AI="ai",t))(Ae||{});const AM={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1,ai:!1},of=`
269
269
  <svg
270
270
  xmlns="http://www.w3.org/2000/svg"
271
271
  width="24"
@@ -278,7 +278,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
278
278
  transform="translate(3 3) scale(0.75)"
279
279
  />
280
280
  </svg>
281
- `,EM=`
281
+ `,TM=`
282
282
  <svg
283
283
  xmlns="http://www.w3.org/2000/svg"
284
284
  width="24"
@@ -289,7 +289,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
289
289
  d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
290
290
  />
291
291
  </svg>
292
- `,IM=`
292
+ `,MM=`
293
293
  <svg
294
294
  xmlns="http://www.w3.org/2000/svg"
295
295
  width="24"
@@ -300,7 +300,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
300
300
  d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
301
301
  />
302
302
  </svg>
303
- `,LM=`
303
+ `,EM=`
304
304
  <svg
305
305
  xmlns="http://www.w3.org/2000/svg"
306
306
  width="24"
@@ -322,7 +322,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
322
322
  d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
323
323
  />
324
324
  </svg>
325
- `,RM=`
325
+ `,IM=`
326
326
  <svg
327
327
  xmlns="http://www.w3.org/2000/svg"
328
328
  width="24"
@@ -356,7 +356,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
356
356
  </clipPath>
357
357
  </defs>
358
358
  </svg>
359
- `,OM=`
359
+ `,LM=`
360
360
  <svg
361
361
  xmlns="http://www.w3.org/2000/svg"
362
362
  width="32"
@@ -368,7 +368,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
368
368
  d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
369
369
  />
370
370
  </svg>
371
- `,PM=`
371
+ `,RM=`
372
372
  <svg
373
373
  xmlns="http://www.w3.org/2000/svg"
374
374
  width="24"
@@ -386,7 +386,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
386
386
  </clipPath>
387
387
  </defs>
388
388
  </svg>
389
- `,DM=`
389
+ `,OM=`
390
390
  <svg
391
391
  xmlns="http://www.w3.org/2000/svg"
392
392
  width="24"
@@ -419,7 +419,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
419
419
  d="M19.5 8.25l-7.5 7.5-7.5-7.5"
420
420
  />
421
421
  </svg>
422
- `,BM=`
422
+ `,PM=`
423
423
  <svg
424
424
  xmlns="http://www.w3.org/2000/svg"
425
425
  fill="none"
@@ -433,7 +433,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
433
433
  d="M15.75 19.5L8.25 12l7.5-7.5"
434
434
  />
435
435
  </svg>
436
- `,zM=`
436
+ `,DM=`
437
437
  <svg
438
438
  xmlns="http://www.w3.org/2000/svg"
439
439
  fill="none"
@@ -483,7 +483,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
483
483
  </clipPath>
484
484
  </defs>
485
485
  </svg>
486
- `,NM=`
486
+ `,BM=`
487
487
  <svg
488
488
  xmlns="http://www.w3.org/2000/svg"
489
489
  width="24"
@@ -546,7 +546,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
546
546
  </clipPath>
547
547
  </defs>
548
548
  </svg>
549
- `,o2=`
549
+ `,i2=`
550
550
  <svg
551
551
  xmlns="http://www.w3.org/2000/svg"
552
552
  width="16"
@@ -587,7 +587,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
587
587
  d="M9 16l-5-5l5-5l1.4 1.4L7.825 10H18V6h2v6H7.825l2.575 2.6z"
588
588
  />
589
589
  </svg>
590
- `,HM=`
590
+ `,zM=`
591
591
  <svg
592
592
  xmlns="http://www.w3.org/2000/svg"
593
593
  width="24"
@@ -599,7 +599,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
599
599
  d="M9.55 17.575L4.225 12.25l1.4-1.425L9.55 14.75l8.825-8.825l1.4 1.425z"
600
600
  />
601
601
  </svg>
602
- `,$M=`
602
+ `,NM=`
603
603
  <svg
604
604
  xmlns="http://www.w3.org/2000/svg"
605
605
  width="24"
@@ -617,7 +617,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
617
617
  </clipPath>
618
618
  </defs>
619
619
  </svg>
620
- `,qM=`
620
+ `,HM=`
621
621
  <svg
622
622
  xmlns="http://www.w3.org/2000/svg"
623
623
  width="24"
@@ -635,7 +635,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
635
635
  </clipPath>
636
636
  </defs>
637
637
  </svg>
638
- `,FM=`
638
+ `,$M=`
639
639
  <svg
640
640
  xmlns="http://www.w3.org/2000/svg"
641
641
  width="24"
@@ -653,7 +653,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
653
653
  </clipPath>
654
654
  </defs>
655
655
  </svg>
656
- `,VM=`
656
+ `,qM=`
657
657
  <svg
658
658
  xmlns="http://www.w3.org/2000/svg"
659
659
  width="24"
@@ -671,7 +671,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
671
671
  </clipPath>
672
672
  </defs>
673
673
  </svg>
674
- `,WM=`
674
+ `,FM=`
675
675
  <svg
676
676
  xmlns="http://www.w3.org/2000/svg"
677
677
  width="24"
@@ -689,7 +689,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
689
689
  </clipPath>
690
690
  </defs>
691
691
  </svg>
692
- `,jM=`
692
+ `,VM=`
693
693
  <svg
694
694
  xmlns="http://www.w3.org/2000/svg"
695
695
  width="24"
@@ -747,7 +747,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
747
747
  d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
748
748
  />
749
749
  </svg>
750
- `,UM=`
750
+ `,WM=`
751
751
  <svg
752
752
  xmlns="http://www.w3.org/2000/svg"
753
753
  width="24"
@@ -759,7 +759,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
759
759
  d="M3 18v-2h13v2zm0-5v-2h18v2zm0-5V6h18v2zm15 13v-3h-3v-2h3v-3h2v3h3v2h-3v3z"
760
760
  />
761
761
  </svg>
762
- `,GM=`
762
+ `,jM=`
763
763
  <svg
764
764
  xmlns="http://www.w3.org/2000/svg"
765
765
  width="24"
@@ -842,7 +842,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
842
842
  d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
843
843
  />
844
844
  </svg>
845
- `,KM=`
845
+ `,UM=`
846
846
  <svg
847
847
  xmlns="http://www.w3.org/2000/svg"
848
848
  width="24"
@@ -869,7 +869,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
869
869
  d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
870
870
  />
871
871
  </svg>
872
- `,ZM=`
872
+ `,GM=`
873
873
  <svg
874
874
  xmlns="http://www.w3.org/2000/svg"
875
875
  width="24"
@@ -881,7 +881,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
881
881
  d="M11 20V7.825l-5.6 5.6L4 12l8-8l8 8l-1.4 1.425l-5.6-5.6V20z"
882
882
  />
883
883
  </svg>
884
- `,XM=`
884
+ `,KM=`
885
885
  <svg
886
886
  xmlns="http://www.w3.org/2000/svg"
887
887
  width="24"
@@ -893,7 +893,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
893
893
  d="M3 20v-6l8-2l-8-2V4l19 8z"
894
894
  />
895
895
  </svg>
896
- `,YM=`
896
+ `,ZM=`
897
897
  <svg
898
898
  xmlns="http://www.w3.org/2000/svg"
899
899
  width="24"
@@ -934,7 +934,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
934
934
  </clipPath>
935
935
  </defs>
936
936
  </svg>
937
- `,JM=`
937
+ `,XM=`
938
938
  <svg
939
939
  xmlns="http://www.w3.org/2000/svg"
940
940
  width="24"
@@ -963,7 +963,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
963
963
  d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
964
964
  />
965
965
  </svg>
966
- `,i2=`
966
+ `,s2=`
967
967
  <svg
968
968
  xmlns="http://www.w3.org/2000/svg"
969
969
  width="24"
@@ -998,11 +998,12 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
998
998
  d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
999
999
  />
1000
1000
  </svg>
1001
- `,QM={[Ae.CodeMirror]:{theme:U8,languages:D8,expandIcon:sf,searchIcon:j6,clearSearchIcon:af,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:t=>t?La:Z6}},eE=oc([],"FeaturesCtx"),tE=oc({},"CrepeCtx");function rE(t){return t.get("CrepeCtx")}function bs(t){return t.use("FeaturesCtx")}function Er(t){return e=>{bs(e).update(r=>r.includes(t)?r:[...r,t])}}function nE(t,e){var r;const n=t.get($e),o=t.get(fa),{state:i}=n,s=o(i.doc);let a="";if(!i.selection.empty){const{from:l,to:c}=i.selection,u=i.doc.slice(l,c),{schema:d}=i.doc.type;let h=d.topNodeType.createAndFill(null,u.content);if(!h){const p=(r=d.nodes.paragraph)==null?void 0:r.createAndFill(null,u.content);p&&(h=d.topNodeType.createAndFill(null,p))}a=h?o(h):i.doc.textBetween(l,c)}return{document:s,selection:a,instruction:e}}const rs=Ve({provider:void 0,buildContext:void 0,diffReviewOnEnd:!0,onError:t=>{console.error(`[milkdown/ai] [${t.code}]`,t)},aiIcon:void 0},"aiProviderConfig"),wt=Ve({abortController:null,label:"",lastInstruction:"",lastLabel:void 0,lastFrom:-1,lastTo:-1,diffOwnedByAI:!1},"aiSession");function X6(t,e){const r=t.get(rs.key);try{r.onError(e)}catch(n){console.error("[milkdown/ai] onError handler failed:",n)}}function ec(t){const e=t.get(wt.key);t.set(wt.key,{...e,abortController:null,label:""})}async function oE(t,e,r,n){try{const o=e(r,n.signal),i=t.get(ne);for await(const l of o){if(n.signal.aborted)break;i.call(M1.key,l)}if(n.signal.aborted)return;const s=t.get(rs.key);if(s.diffReviewOnEnd){const l=t.get(wt.key);t.set(wt.key,{...l,diffOwnedByAI:!0})}const a=i.call(E1.key,{diffReview:s.diffReviewOnEnd});if(s.diffReviewOnEnd&&!a){const l=t.get(wt.key);t.set(wt.key,{...l,diffOwnedByAI:!1})}}catch(o){if(n.signal.aborted)return;const i=Zv(o);X6(t,i),t.get(ne).call(as.key,{keep:!1})}finally{t.get(wt.key).abortController===n&&ec(t)}}const uf=Me("RunAI",t=>e=>(r,n)=>{var o,i,s,a;if(!e?.instruction)return!1;const l=t.get(rs.key);if(!l.provider||t.get(wt.key).abortController||(o=ht.getState(r))!=null&&o.active||(i=it.getState(r))!=null&&i.active)return!1;if(!n)return!0;const u=new AbortController,{from:d,to:h}=r.selection;t.set(wt.key,{abortController:u,label:(s=e.label)!=null?s:"",lastInstruction:e.instruction,lastLabel:e.label,lastFrom:d,lastTo:h,diffOwnedByAI:!1});const p=t.get(ne),g=r.selection.empty?"cursor":"selection";if(!p.call(T1.key,{insertAt:g}))return ec(t),!1;let y;try{y=((a=l.buildContext)!=null?a:nE)(t,e.instruction)}catch(v){const w=Vv(v);return X6(t,w),p.call(as.key,{keep:!1}),ec(t),!1}return oE(t,l.provider,y,u),!0}),Y6=Me("AbortAI",t=>e=>(r,n)=>{var o;const i=t.get(wt.key);return n?i.abortController?(i.abortController.abort(),ec(t),(o=ht.getState(r))!=null&&o.active&&t.get(ne).call(as.key,e),!0):!1:!!i.abortController});var J6=t=>{throw TypeError(t)},df=(t,e,r)=>e.has(t)||J6("Cannot "+r),St=(t,e,r)=>(df(t,e,"read from private field"),r?r.call(t):e.get(t)),wr=(t,e,r)=>e.has(t)?J6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Kr=(t,e,r,n)=>(df(t,e,"write to private field"),e.set(t,r),r),vi=(t,e,r)=>(df(t,e,"access private method"),r),Vs,e0,Ws,Ra,t0,r0,lo,Ti,eo,Q6,n0,eg,Qd,tg,e1,t1;const ns="milkdown-ai-diff-actions";function rg(t,e){t.innerHTML=Tr.sanitize(e.trim())}function iE(t){const e=document.createElement("span");return e.className=`${ns}-icon`,rg(e,t),e}class sE{constructor(e,r,n){this.ctx=e,wr(this,eo),wr(this,Vs),wr(this,e0),wr(this,Ws),wr(this,Ra),wr(this,t0,!1),wr(this,r0,!1),wr(this,lo,null),wr(this,Ti,!1),wr(this,Qd,()=>{const s=this.ctx.get(wt.key);if(!s.lastInstruction||!St(this,Ti)||!vi(this,eo,tg).call(this))return;const a=this.ctx.get(ne);a.call(T0.key);const l=this.ctx.get($e),{doc:c}=l.state,u=Math.min(Math.max(s.lastFrom,0),c.content.size),d=Math.min(Math.max(s.lastTo,0),c.content.size);l.dispatch(l.state.tr.setSelection(Ce.create(l.state.doc,u,d))),a.call(uf.key,{instruction:s.lastInstruction,label:s.lastLabel})}),wr(this,e1,()=>{this.ctx.get(ne).call(T0.key)}),wr(this,t1,()=>{this.ctx.get(ne).call(cc.key)}),Kr(this,Ra,n),Kr(this,e0,vi(this,eo,Q6).call(this,r));const o=document.createElement("div");o.className=ns,o.dataset.show="false",Kr(this,Ws,vi(this,eo,n0).call(this,"retry",n.retryIcon,n.retryLabel,St(this,Qd))),o.appendChild(St(this,Ws)),o.appendChild(vi(this,eo,n0).call(this,"reject",n.rejectIcon,n.rejectAllLabel,St(this,e1)));const i=vi(this,eo,n0).call(this,"accept",n.acceptIcon,n.acceptAllLabel,St(this,t1));i.appendChild(vi(this,eo,eg).call(this)),o.appendChild(i),Kr(this,Vs,o),St(this,e0).appendChild(o),this.update(r)}update(e){var r;const n=!!((r=it.getState(e.state))!=null&&r.active);if(n!==St(this,r0))if(Kr(this,r0,n),n){const i=this.ctx.get(wt.key);Kr(this,Ti,i.diffOwnedByAI),Kr(this,lo,e.state.doc)}else{Kr(this,Ti,!1),Kr(this,lo,null);const i=this.ctx.get(wt.key);i.diffOwnedByAI&&this.ctx.set(wt.key,{...i,diffOwnedByAI:!1})}const o=n&&St(this,Ti);if(o!==St(this,t0)&&(Kr(this,t0,o),St(this,Vs).dataset.show=o?"true":"false"),o){const i=this.ctx.get(wt.key),s=!!St(this,lo)&&e.state.doc.eq(St(this,lo));St(this,Ws).disabled=!i.lastInstruction||!s}}destroy(){St(this,Vs).remove()}}Vs=new WeakMap;e0=new WeakMap;Ws=new WeakMap;Ra=new WeakMap;t0=new WeakMap;r0=new WeakMap;lo=new WeakMap;Ti=new WeakMap;eo=new WeakSet;Q6=function(t){var e;return(e=t.dom.closest(".milkdown"))!=null?e:document.body};n0=function(t,e,r,n){const o=document.createElement("button");o.type="button",o.className=`${ns}-btn ${ns}-btn-${t}`,o.appendChild(iE(e));const i=document.createElement("span");return i.textContent=r,o.appendChild(i),o.addEventListener("mousedown",s=>s.preventDefault()),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),n()}),o};eg=function(){const t=document.createElement("span");t.className=`${ns}-shortcut`;const e=document.createElement("span");e.textContent=St(this,Ra).modSymbol;const r=document.createElement("span");return r.className=`${ns}-shortcut-icon`,rg(r,St(this,Ra).enterKeyIcon),t.append(e,r),t};Qd=new WeakMap;tg=function(){return St(this,lo)?this.ctx.get($e).state.doc.eq(St(this,lo)):!1};e1=new WeakMap;t1=new WeakMap;const aE=new et("CREPE_AI_DIFF_ACTIONS_PANEL"),lE="Retry",cE="Reject all",uE="Accept all";function dE(){var t,e,r,n;if(typeof navigator>"u")return"⌘";const o=navigator,i=(n=(r=(e=(t=o.userAgentData)==null?void 0:t.platform)!=null?e:o.platform)!=null?r:o.userAgent)!=null?n:"";return/mac|iphone|ipad|ipod/i.test(i)?"⌘":"Ctrl"}const hE=dE();function fE(t){var e,r,n,o,i,s,a;const{config:l,enterKeyIcon:c}=t;return{retryLabel:(e=l?.retryLabel)!=null?e:lE,rejectAllLabel:(r=l?.rejectAllLabel)!=null?r:cE,acceptAllLabel:(n=l?.acceptAllLabel)!=null?n:uE,retryIcon:(o=l?.retryIcon)!=null?o:KM,rejectIcon:(i=l?.rejectIcon)!=null?i:af,acceptIcon:(s=l?.acceptIcon)!=null?s:tu,enterKeyIcon:c??$6,modSymbol:(a=l?.modSymbol)!=null?a:hE}}function pE(t={}){const e=fE(t);return Je(r=>new Xe({key:aE,view(n){return new sE(r,n,e)},props:{handleKeyDown(n,o){var i;return o.key!=="Enter"||!(o.metaKey||o.ctrlKey)||!((i=it.getState(n.state))!=null&&i.active)||!r.get(wt.key).diffOwnedByAI?!1:(o.preventDefault(),r.get(ne).call(cc.key),!0)}}}))}var ng=t=>{throw TypeError(t)},og=(t,e,r)=>e.has(t)||ng("Cannot "+r),kn=(t,e,r)=>(og(t,e,"read from private field"),r?r.call(t):e.get(t)),s2=(t,e,r)=>e.has(t)?ng("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),a2=(t,e,r,n)=>(og(t,e,"write to private field"),e.set(t,r),r),Yr,js;function l2(t){const e={addItem:(r,n)=>(t.items.set(r,n),e),removeItem:r=>(t.items.delete(r),e),getItem:r=>t.items.get(r),clear:()=>(t.items.clear(),e)};return e}class mE{constructor(){s2(this,Yr,[]),this.addItem=(e,r)=>(kn(this,js).call(this,e),kn(this,Yr).push({kind:"item",id:e,item:r}),this),this.addSubmenu=(e,r,n)=>{kn(this,js).call(this,e);const o={def:r,items:new Map};return n&&n(l2(o)),kn(this,Yr).push({kind:"submenu",id:e,node:o}),this},this.removeItem=e=>(kn(this,js).call(this,e),this),this.getItem=e=>{const r=kn(this,Yr).find(n=>n.kind==="item"&&n.id===e);return r?.kind==="item"?r.item:void 0},this.getSubmenu=e=>{const r=kn(this,Yr).find(n=>n.kind==="submenu"&&n.id===e);return r?.kind==="submenu"?l2(r.node):void 0},this.clear=()=>(a2(this,Yr,[]),this),this.build=()=>{const e=[],r={};for(const n of kn(this,Yr))n.kind==="item"?e.push({kind:"item",id:n.id,item:n.item}):(e.push({kind:"submenu",id:n.id,def:n.node.def}),r[n.id]={def:n.node.def,items:Array.from(n.node.items.entries()).map(([o,i])=>({id:o,item:i}))});return{main:e,submenus:r}},s2(this,js,e=>{a2(this,Yr,kn(this,Yr).filter(r=>r.id!==e))})}}Yr=new WeakMap;js=new WeakMap;function gE(t){t.addItem("improve",{icon:of,label:"Improve writing",streamingLabel:"Improving writing",prompt:"Improve the writing while preserving the original meaning."}).addItem("grammar",{icon:HM,label:"Fix grammar & spelling",streamingLabel:"Fixing grammar & spelling",prompt:"Fix any grammar and spelling errors without changing the meaning."}).addItem("shorter",{icon:YM,label:"Make shorter",streamingLabel:"Making shorter",prompt:"Make this shorter while preserving the key information."}).addItem("longer",{icon:UM,label:"Make longer",streamingLabel:"Expanding",prompt:"Expand this with more detail and examples."}),t.addSubmenu("tone",{icon:La,label:"Change tone…",title:"Change tone",searchPlaceholder:"Search tones…"},e=>{const r=[["professional","Professional"],["casual","Casual"],["confident","Confident"],["friendly","Friendly"],["direct","Direct"],["formal","Formal"]];for(const[n,o]of r)e.addItem(n,{icon:La,label:o,streamingLabel:"Adjusting tone",prompt:`Rewrite this in a ${o.toLowerCase()} tone.`})}),t.addSubmenu("translate",{icon:i2,label:"Translate…",title:"Translate",searchPlaceholder:"Search languages…"},e=>{const r=[["english","English","English"],["chinese","Chinese","Chinese (Simplified)"],["japanese","Japanese","Japanese"],["korean","Korean","Korean"],["spanish","Spanish","Spanish"],["french","French","French"],["german","German","German"]];for(const[n,o,i]of r)e.addItem(n,{icon:i2,label:o,streamingLabel:`Translating to ${o}`,prompt:`Translate this to ${i}.`})})}function To(...t){}To(M);function vE(t,e){const r=e.trim();if(!r)return[t];const n=t.toLowerCase(),o=r.toLowerCase(),i=n.indexOf(o);return i===-1?[t]:[t.slice(0,i),M("mark",null,t.slice(i,i+r.length)),t.slice(i+r.length)]}const yE=Ct({props:{placeholder:{type:Object,required:!0},resetSignal:{type:Object,required:!0},suggestions:{type:Object,required:!0},chrome:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({placeholder:t,resetSignal:e,suggestions:r,chrome:n,onConfirm:o,onCancel:i}){const s=re(""),a=re({kind:"main"}),l=re(0),c=re(null),u=re(null),d=`ai-instruction-list-${Math.random().toString(36).slice(2,9)}`,h=N=>`${d}-opt-${N}`,p=`ai-instruction-input-${Math.random().toString(36).slice(2,9)}`;Bn(e,()=>{s.value="",a.value={kind:"main"},l.value=0});const g=dr(()=>{if(a.value.kind==="submenu"){const N=r.submenus[a.value.id];return N?N.items.map(({id:ye,item:be})=>({id:ye,icon:be.icon,label:be.label,hasSubmenu:!1,prompt:{text:be.prompt,streamingLabel:be.streamingLabel}})):[]}return r.main.map(N=>N.kind==="item"?{id:N.id,icon:N.item.icon,label:N.item.label,hasSubmenu:!1,prompt:{text:N.item.prompt,streamingLabel:N.item.streamingLabel}}:{id:N.id,icon:N.def.icon,label:N.def.label,hasSubmenu:!0})}),y=dr(()=>{var N,ye;return a.value.kind!=="submenu"?null:(ye=(N=r.submenus[a.value.id])==null?void 0:N.def)!=null?ye:null}),v=dr(()=>{const N=s.value.trim().toLowerCase();return N?g.value.filter(ye=>ye.label.toLowerCase().includes(N)):g.value}),w=dr(()=>s.value.trim().length>0),C=dr(()=>v.value.length+(w.value?1:0));Bn([v,a,w],()=>{l.value=w.value?v.value.length:0});const k=()=>{ad(()=>{var N;return(N=c.value)==null?void 0:N.focus()})},A=N=>{a.value={kind:"submenu",id:N},s.value="",l.value=0,k()},I=()=>{a.value={kind:"main"},s.value="",l.value=0,k()},R=N=>{N.hasSubmenu?A(N.id):N.prompt&&(o(N.prompt.text,N.prompt.streamingLabel),s.value="")},H=()=>{const N=s.value.trim();N&&(o(N),s.value="")},O=()=>{const N=l.value,ye=v.value;N<ye.length?R(ye[N]):w.value&&H()},P=()=>{ad(()=>{const N=u.value;if(!N)return;const ye=N.querySelector(`[data-index="${l.value}"]`);ye?.scrollIntoView({block:"nearest"})})},$=N=>{if(N.stopPropagation(),N.key==="ArrowDown"){if(N.preventDefault(),C.value===0)return;l.value=(l.value+1)%C.value,P();return}if(N.key==="ArrowUp"){if(N.preventDefault(),C.value===0)return;l.value=(l.value-1+C.value)%C.value,P();return}if(N.key==="Enter"){N.preventDefault(),O();return}if(N.key==="Escape"){N.preventDefault(),a.value.kind==="submenu"?I():i();return}N.key==="Backspace"&&s.value===""&&a.value.kind==="submenu"&&(N.preventDefault(),I())},ie=N=>{N.preventDefault()};return()=>{const N=v.value,ye=w.value,be=y.value;return M("div",{class:"ai-instruction"},M("div",{class:"ai-instruction-input"},M("span",{class:"ai-instruction-input-prefix"},M(Ft,{icon:n.aiIcon})),M("input",{ref:c,id:p,class:"ai-instruction-input-field",role:"combobox","aria-expanded":"true","aria-autocomplete":"list","aria-controls":d,"aria-activedescendant":C.value>0?h(l.value):void 0,placeholder:be?be.searchPlaceholder:t.value,value:s.value,onInput:Fe=>{s.value=Fe.target.value},onKeydown:$}),M("button",{type:"button",class:"ai-instruction-submit","aria-label":n.submitButtonLabel,disabled:!ye,onMousedown:ie,onClick:H},M(Ft,{icon:n.sendIcon}))),M("div",{class:"ai-instruction-list",ref:u,id:d,role:"listbox","aria-label":n.listboxLabel},be&&M("button",{type:"button",class:"ai-instruction-back",onMousedown:ie,onClick:I},M("span",{class:"ai-instruction-back-icon","aria-hidden":"true"},M(Ft,{icon:n.chevronLeftIcon})),M("span",null,be.title)),N.length>0&&M("div",{class:"ai-instruction-section"},M("div",{class:"ai-instruction-section-header"},n.suggestionsHeaderLabel),N.map((Fe,ke)=>M("div",{key:Fe.id,id:h(ke),"data-index":ke,role:"option","aria-selected":ke===l.value,class:["ai-instruction-item",ke===l.value?"active":""],onMousedown:ie,onClick:()=>R(Fe),onPointerenter:()=>{l.value=ke}},M("span",{class:"ai-instruction-item-icon"},M(Ft,{icon:Fe.icon})),M("span",{class:"ai-instruction-item-label"},vE(Fe.label,s.value)),Fe.hasSubmenu&&M("span",{class:"ai-instruction-item-arrow"},M(Ft,{icon:n.chevronRightIcon}))))),ye&&M("div",{class:"ai-instruction-section"},M("div",{class:"ai-instruction-section-header"},n.sendAsPromptHeaderLabel),M("div",{id:h(N.length),"data-index":N.length,role:"option","aria-selected":l.value===N.length,class:["ai-instruction-item","ai-instruction-item-prompt",l.value===N.length?"active":""],onMousedown:ie,onClick:H,onPointerenter:()=>{l.value=N.length}},M("span",{class:"ai-instruction-item-icon"},M(Ft,{icon:n.sendPromptIcon})),M("span",{class:"ai-instruction-item-label"},n.sendAsPromptLabel," ",M("span",{class:"ai-instruction-item-quote"},'"',s.value,'"')),M("span",{class:"ai-instruction-item-shortcut"},M(Ft,{icon:n.enterKeyIcon}))))))}}});var ig=t=>{throw TypeError(t)},sg=(t,e,r)=>e.has(t)||ig("Cannot "+r),ct=(t,e,r)=>(sg(t,e,"read from private field"),r?r.call(t):e.get(t)),Zr=(t,e,r)=>e.has(t)?ig("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),xr=(t,e,r,n)=>(sg(t,e,"write to private field"),e.set(t,r),r),qo,Rr,o0,i0,Us,s0,a0,to,r1,n1;class bE{constructor(e,r,n){this.ctx=e,Zr(this,qo),Zr(this,Rr),Zr(this,o0),Zr(this,i0),Zr(this,Us),Zr(this,s0,-1),Zr(this,a0,-1),Zr(this,to,!1),Zr(this,r1,(s,a)=>{!s.trim()||!this.ctx.get(ne).call(uf.key,{instruction:s,label:a})||(xr(this,to,!1),ct(this,Rr).hide())}),Zr(this,n1,()=>{xr(this,to,!1),ct(this,Rr).hide()}),this.show=(s,a)=>{xr(this,s0,s),xr(this,a0,a),ct(this,Us).value++,xr(this,to,!0);const l=this.ctx.get($e);ct(this,Rr).show({getBoundingClientRect:()=>Oa(l,s,a)},l),requestAnimationFrame(()=>{var c;(c=ct(this,qo).querySelector("input"))==null||c.focus()})},this.update=(s,a)=>{const{selection:l}=s.state,c=l instanceof Ce,u=l.from!==ct(this,s0)||l.to!==ct(this,a0);if(!c||u){xr(this,to,!1),ct(this,Rr).hide();return}ct(this,Rr).update(s,a)},this.destroy=()=>{ct(this,o0).unmount(),ct(this,Rr).destroy(),ct(this,qo).remove()},xr(this,i0,re(n.placeholder)),xr(this,Us,re(0));const o=document.createElement("div");o.className="milkdown-ai-instruction";const i=gr(yE,{placeholder:ct(this,i0),resetSignal:ct(this,Us),suggestions:n.suggestions,chrome:n.chrome,onConfirm:ct(this,r1),onCancel:ct(this,n1)});i.mount(o),xr(this,o0,i),xr(this,qo,o),xr(this,Rr,new Ba({content:o,debounce:0,offset:10,shouldShow:()=>ct(this,to),floatingUIOptions:{placement:"bottom"}})),ct(this,Rr).onHide=()=>{xr(this,to,!1),requestAnimationFrame(()=>{try{const a=ct(this,qo).getRootNode().activeElement;if(!a||!ct(this,qo).contains(a))return;this.ctx.get($e).dom.focus({preventScroll:!0})}catch{}})},ct(this,Rr).update(r)}}qo=new WeakMap;Rr=new WeakMap;o0=new WeakMap;i0=new WeakMap;Us=new WeakMap;s0=new WeakMap;a0=new WeakMap;to=new WeakMap;r1=new WeakMap;n1=new WeakMap;const wE={show:()=>{}},hf=Ve({...wE},"aiInstructionTooltipAPI"),ag=za("CREPE_AI_INSTRUCTION"),xE="SUGGESTIONS",CE="SEND AS PROMPT",kE="Ask AI:",_E="Send prompt",SE="AI suggestions",AE="Tell AI what to do with the selection…";function TE(t){var e,r,n,o,i,s,a,l,c,u,d;return{aiIcon:(e=t?.aiIcon)!=null?e:of,sendIcon:(r=t?.sendIcon)!=null?r:ZM,sendPromptIcon:(n=t?.sendPromptIcon)!=null?n:XM,enterKeyIcon:(o=t?.enterKeyIcon)!=null?o:$6,chevronLeftIcon:(i=t?.chevronLeftIcon)!=null?i:BM,chevronRightIcon:(s=t?.chevronRightIcon)!=null?s:zM,suggestionsHeaderLabel:(a=t?.suggestionsHeaderLabel)!=null?a:xE,sendAsPromptHeaderLabel:(l=t?.sendAsPromptHeaderLabel)!=null?l:CE,sendAsPromptLabel:(c=t?.sendAsPromptLabel)!=null?c:kE,submitButtonLabel:(u=t?.submitButtonLabel)!=null?u:_E,listboxLabel:(d=t?.listboxLabel)!=null?d:SE}}function ME(t){var e,r;const n=new mE;return gE(n),(e=t?.buildAISuggestions)==null||e.call(t,n),{placeholder:(r=t?.instructionPlaceholder)!=null?r:AE,chrome:TE(t),suggestions:n.build()}}function EE(t){return e=>{const r=ME(t);let n=null;e.update(hf.key,o=>({...o,show:(i,s)=>{n?.show(i,s)}})),e.set(ag.key,{view:o=>(n=new bE(e,o,r),n)})}}var lg=t=>{throw TypeError(t)},cg=(t,e,r)=>e.has(t)||lg("Cannot "+r),_n=(t,e,r)=>(cg(t,e,"read from private field"),r?r.call(t):e.get(t)),Do=(t,e,r)=>e.has(t)?lg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),yi=(t,e,r,n)=>(cg(t,e,"write to private field"),e.set(t,r),r),l0,c0,u0,o1,d0,Mi,h0;const kl="milkdown-ai-streaming",IE=800,LE="Generating",RE="Esc to cancel",c2=new et("CREPE_AI_STREAMING_INDICATOR");class OE{constructor(e,r,n){Do(this,l0),Do(this,c0),Do(this,u0),Do(this,o1,performance.now()),Do(this,d0,""),Do(this,Mi,0),Do(this,h0,()=>{const c=(performance.now()-_n(this,o1))/IE*360;_n(this,l0).style.transform=`rotate(${c}deg)`,yi(this,Mi,requestAnimationFrame(_n(this,h0)))}),yi(this,u0,r);const o=document.createElement("span");o.className=`${kl}-indicator`,o.contentEditable="false",o.setAttribute("role","status"),o.setAttribute("aria-live","polite");const i=document.createElement("span");i.className=`${kl}-spinner`,i.setAttribute("aria-hidden","true"),o.appendChild(i);const s=document.createElement("span");s.className=`${kl}-label`,o.appendChild(s);const a=document.createElement("span");a.className=`${kl}-esc`,a.textContent=n,o.appendChild(a),this.dom=o,yi(this,l0,i),yi(this,c0,s),this.setLabel(e),_n(this,h0).call(this)}setLabel(e){const n=`${e.get(wt.key).label||_n(this,u0)}…`;n!==_n(this,d0)&&(yi(this,d0,n),_n(this,c0).textContent=n)}destroy(){_n(this,Mi)&&cancelAnimationFrame(_n(this,Mi)),yi(this,Mi,0)}}l0=new WeakMap;c0=new WeakMap;u0=new WeakMap;o1=new WeakMap;d0=new WeakMap;Mi=new WeakMap;h0=new WeakMap;function PE(t={}){var e,r;const{config:n}=t,o=(e=n?.fallbackLabel)!=null?e:LE,i=(r=n?.cancelHint)!=null?r:RE;return Je(s=>{let a=null;function l(){return a?a.setLabel(s):a=new OE(s,o,i),a}function c(){a&&(a.destroy(),a=null)}function u(d,h){const p=Math.min(h,d.content.size),g=Bt.widget(p,l().dom,{side:1,key:"ai-streaming-indicator"});return Dt.create(d,[g])}return new Xe({key:c2,state:{init:()=>Dt.empty,apply(d,h,p,g){const y=ht.getState(g);return!y?.active||y.insertEndPos==null?(c(),Dt.empty):d.getMeta(ht)||d.docChanged?u(g.doc,y.insertEndPos):h.map(d.mapping,d.doc)}},view(){return{destroy(){c()}}},props:{decorations(d){var h;return(h=c2.getState(d))!=null?h:Dt.empty},handleKeyDown(d,h){var p;if(h.key!=="Escape")return!1;const g=s.get(ne);return s.get(wt.key).abortController?(h.preventDefault(),g.call(Y6.key,{keep:!0}),!0):(p=ht.getState(d.state))!=null&&p.active?(h.preventDefault(),g.call(as.key,{keep:!0}),!0):!1}}})})}const DE=["table","image-block","code_block"],u2={heading:["id"]},BE=(t,e)=>{var r,n;const o=(r=e?.diff)!=null?r:{},i=(n=e?.streaming)!=null?n:{};t.config(Er(Ae.AI)).config(s=>{s.update(lc.key,c=>{var u;return{...c,ignoreAttrs:(u=o.ignoreAttrs)!=null?u:u2}});const{ignoreAttrs:a,...l}=o;s.update(uc.key,c=>{var u;return{...c,customBlockTypes:(u=l.customBlockTypes)!=null?u:DE,...l}})}).use(h9).use(M9).config(s=>{s.update(li.key,a=>{var l;return{...a,...i,ignoreAttrs:(l=i.ignoreAttrs)!=null?l:u2,...e?.diffReviewOnEnd!==void 0?{diffReviewOnEnd:e.diffReviewOnEnd}:{}}})}).use(q9).config(s=>{s.update(rs.key,a=>{var l;return{...a,...e?.provider!==void 0?{provider:e.provider}:{},...e?.buildContext!==void 0?{buildContext:e.buildContext}:{},diffReviewOnEnd:(l=e?.diffReviewOnEnd)!=null?l:a.diffReviewOnEnd,...e?.onError!==void 0?{onError:e.onError}:{},...e?.aiIcon!==void 0?{aiIcon:e.aiIcon}:{}}})}).use(rs).use(wt).use(uf).use(Y6).config(EE(e)).use(hf).use(ag).use(PE({config:e?.streamingIndicator})).use(pE({config:e?.diffActions,enterKeyIcon:e?.enterKeyIcon}))};function ug(t){return t.$from.parent.type.name==="code_block"}function dg(t){var e;const r=(e=t.$from.node(t.$from.depth-1))==null?void 0:e.type;return r?.name==="list_item"}var hg=t=>{throw TypeError(t)},fg=(t,e,r)=>e.has(t)||hg("Cannot "+r),Ts=(t,e,r)=>(fg(t,e,"read from private field"),r?r.call(t):e.get(t)),d2=(t,e,r)=>e.has(t)?hg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),zE=(t,e,r,n)=>(fg(t,e,"write to private field"),e.set(t,r),r),Ei,f0;class ff{constructor(){d2(this,Ei,[]),this.clear=()=>(zE(this,Ei,[]),this),d2(this,f0,e=>{const r={group:e,addItem:(n,o)=>{const i={...o,key:n};return e.items.push(i),r},clear:()=>(e.items=[],r)};return r}),this.addGroup=(e,r)=>{const o={key:e,label:r,items:[]};return Ts(this,Ei).push(o),Ts(this,f0).call(this,o)},this.getGroup=e=>{const r=Ts(this,Ei).find(n=>n.key===e);if(!r)throw new Error(`Group with key ${e} not found`);return Ts(this,f0).call(this,r)},this.build=()=>Ts(this,Ei)}}Ei=new WeakMap;f0=new WeakMap;function NE(t,e,r){var n,o,i,s,a,l,c,u,d,h,p,g,y,v,w,C,k,A,I,R,H,O,P,$,ie,N,ye,be,Fe,ke,we,fe,rt,kt,vt,ut,Et,jr,Mo,Ur,Zt,jn,Ht,fi,_,E,B,j,F,W,Q,Y,X,q,ae,ee,se,ue,_e,Le,Ee,We,Ye,rr,nr,Un,ws,Rt,or,xs,Cs,mf,gf,vf,yf,bf,wf,xf,Cf,kf,_f,Sf,Af,Tf,Mf,Ef,If,Lf,Rf,Of,Pf,Df,Bf,zf,Nf,Hf,$f,qf,Ff,Vf,Wf,jf,Uf,Gf,Kf,Zf,Xf,Yf,Jf,Qf,ep,tp,rp,np,op,ip,sp,ap,lp;const pi=r&&bs(r).get(),Lg=pi?.includes(Ae.Latex),Rg=pi?.includes(Ae.ImageBlock),Og=pi?.includes(Ae.Table),ks=new ff;if(e?.textGroup!==null){const ze=ks.addGroup("text",(o=(n=e?.textGroup)==null?void 0:n.label)!=null?o:"Text");((i=e?.textGroup)==null?void 0:i.text)!==null&&ze.addItem("text",{label:(l=(a=(s=e?.textGroup)==null?void 0:s.text)==null?void 0:a.label)!=null?l:"Text",icon:(d=(u=(c=e?.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?d:JM,onRun:le=>{const ce=le.get(ne),Oe=Vi.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe})}}),((h=e?.textGroup)==null?void 0:h.h1)!==null&&ze.addItem("h1",{label:(y=(g=(p=e?.textGroup)==null?void 0:p.h1)==null?void 0:g.label)!=null?y:"Heading 1",icon:(C=(w=(v=e?.textGroup)==null?void 0:v.h1)==null?void 0:w.icon)!=null?C:$M,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:1}})}}),((k=e?.textGroup)==null?void 0:k.h2)!==null&&ze.addItem("h2",{label:(R=(I=(A=e?.textGroup)==null?void 0:A.h2)==null?void 0:I.label)!=null?R:"Heading 2",icon:(P=(O=(H=e?.textGroup)==null?void 0:H.h2)==null?void 0:O.icon)!=null?P:qM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:2}})}}),(($=e?.textGroup)==null?void 0:$.h3)!==null&&ze.addItem("h3",{label:(ye=(N=(ie=e?.textGroup)==null?void 0:ie.h3)==null?void 0:N.label)!=null?ye:"Heading 3",icon:(ke=(Fe=(be=e?.textGroup)==null?void 0:be.h3)==null?void 0:Fe.icon)!=null?ke:FM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:3}})}}),((we=e?.textGroup)==null?void 0:we.h4)!==null&&ze.addItem("h4",{label:(kt=(rt=(fe=e?.textGroup)==null?void 0:fe.h4)==null?void 0:rt.label)!=null?kt:"Heading 4",icon:(Et=(ut=(vt=e?.textGroup)==null?void 0:vt.h4)==null?void 0:ut.icon)!=null?Et:VM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:4}})}}),((jr=e?.textGroup)==null?void 0:jr.h5)!==null&&ze.addItem("h5",{label:(Zt=(Ur=(Mo=e?.textGroup)==null?void 0:Mo.h5)==null?void 0:Ur.label)!=null?Zt:"Heading 5",icon:(fi=(Ht=(jn=e?.textGroup)==null?void 0:jn.h5)==null?void 0:Ht.icon)!=null?fi:WM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:5}})}}),((_=e?.textGroup)==null?void 0:_.h6)!==null&&ze.addItem("h6",{label:(j=(B=(E=e?.textGroup)==null?void 0:E.h6)==null?void 0:B.label)!=null?j:"Heading 6",icon:(Q=(W=(F=e?.textGroup)==null?void 0:F.h6)==null?void 0:W.icon)!=null?Q:jM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:6}})}}),((Y=e?.textGroup)==null?void 0:Y.quote)!==null&&ze.addItem("quote",{label:(ae=(q=(X=e?.textGroup)==null?void 0:X.quote)==null?void 0:q.label)!=null?ae:"Quote",icon:(ue=(se=(ee=e?.textGroup)==null?void 0:ee.quote)==null?void 0:se.icon)!=null?ue:W6,onRun:le=>{const ce=le.get(ne),Oe=E2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((_e=e?.textGroup)==null?void 0:_e.divider)!==null&&ze.addItem("divider",{label:(We=(Ee=(Le=e?.textGroup)==null?void 0:Le.divider)==null?void 0:Ee.label)!=null?We:"Divider",icon:(nr=(rr=(Ye=e?.textGroup)==null?void 0:Ye.divider)==null?void 0:rr.icon)!=null?nr:H6,onRun:le=>{const ce=le.get(ne),Oe=I2.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe})}})}if(e?.listGroup!==null){const ze=ks.addGroup("list",(ws=(Un=e?.listGroup)==null?void 0:Un.label)!=null?ws:"List");((Rt=e?.listGroup)==null?void 0:Rt.bulletList)!==null&&ze.addItem("bullet-list",{label:(Cs=(xs=(or=e?.listGroup)==null?void 0:or.bulletList)==null?void 0:xs.label)!=null?Cs:"Bullet List",icon:(vf=(gf=(mf=e?.listGroup)==null?void 0:mf.bulletList)==null?void 0:gf.icon)!=null?vf:z6,onRun:le=>{const ce=le.get(ne),Oe=L2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((yf=e?.listGroup)==null?void 0:yf.orderedList)!==null&&ze.addItem("ordered-list",{label:(xf=(wf=(bf=e?.listGroup)==null?void 0:bf.orderedList)==null?void 0:wf.label)!=null?xf:"Ordered List",icon:(_f=(kf=(Cf=e?.listGroup)==null?void 0:Cf.orderedList)==null?void 0:kf.icon)!=null?_f:V6,onRun:le=>{const ce=le.get(ne),Oe=R2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((Sf=e?.listGroup)==null?void 0:Sf.taskList)!==null&&ze.addItem("task-list",{label:(Mf=(Tf=(Af=e?.listGroup)==null?void 0:Af.taskList)==null?void 0:Tf.label)!=null?Mf:"Task List",icon:(Lf=(If=(Ef=e?.listGroup)==null?void 0:Ef.taskList)==null?void 0:If.icon)!=null?Lf:K6,onRun:le=>{const ce=le.get(ne),Oe=Pa.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe,attrs:{checked:!1}})}})}if(e?.advancedGroup!==null){const ze=ks.addGroup("advanced",(Of=(Rf=e?.advancedGroup)==null?void 0:Rf.label)!=null?Of:"Advanced");((Pf=e?.advancedGroup)==null?void 0:Pf.image)!==null&&Rg&&ze.addItem("image",{label:(zf=(Bf=(Df=e?.advancedGroup)==null?void 0:Df.image)==null?void 0:Bf.label)!=null?zf:"Image",icon:($f=(Hf=(Nf=e?.advancedGroup)==null?void 0:Nf.image)==null?void 0:Hf.icon)!=null?$f:Q0,onRun:le=>{const ce=le.get(ne),Oe=ja.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe})}}),((qf=e?.advancedGroup)==null?void 0:qf.codeBlock)!==null&&ze.addItem("code",{label:(Wf=(Vf=(Ff=e?.advancedGroup)==null?void 0:Ff.codeBlock)==null?void 0:Vf.label)!=null?Wf:"Code",icon:(Gf=(Uf=(jf=e?.advancedGroup)==null?void 0:jf.codeBlock)==null?void 0:Uf.icon)!=null?Gf:lf,onRun:le=>{const ce=le.get(ne),Oe=ti.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe})}}),((Kf=e?.advancedGroup)==null?void 0:Kf.table)!==null&&Og&&ze.addItem("table",{label:(Yf=(Xf=(Zf=e?.advancedGroup)==null?void 0:Zf.table)==null?void 0:Xf.label)!=null?Yf:"Table",icon:(ep=(Qf=(Jf=e?.advancedGroup)==null?void 0:Jf.table)==null?void 0:Qf.icon)!=null?ep:G6,onRun:le=>{const ce=le.get(ne),Oe=le.get($e);ce.call(Ot.key);const{from:Pg}=Oe.state.selection;ce.call(uo.key,{nodeType:Bc(le,3,3)}),ce.call(O2.key,{pos:Pg})}}),((tp=e?.advancedGroup)==null?void 0:tp.math)!==null&&Lg&&ze.addItem("math",{label:(op=(np=(rp=e?.advancedGroup)==null?void 0:rp.math)==null?void 0:np.label)!=null?op:"Math",icon:(ap=(sp=(ip=e?.advancedGroup)==null?void 0:ip.math)==null?void 0:sp.icon)!=null?ap:cf,onRun:le=>{const ce=le.get(ne),Oe=ti.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe,attrs:{language:"LaTeX"}})}})}(lp=e?.buildMenu)==null||lp.call(e,ks);let _s=ks.build();t&&(_s=_s.map(ze=>{const le=ze.items.filter(ce=>ce.label.toLowerCase().includes(t.toLowerCase()));return{...ze,items:le}}).filter(ze=>ze.items.length>0));const cp=_s.flatMap(ze=>ze.items);return cp.forEach((ze,le)=>{Object.assign(ze,{index:le})}),_s.reduce((ze,le)=>{const ce=ze+le.items.length;return Object.assign(le,{range:[ze,ce]}),ce},0),{groups:_s,size:cp.length}}To(M);const HE=Ct({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:t,show:e,filter:r,hide:n,config:o}){const i=re(),s=dr(()=>NE(r.value,o,t)),a=re(0),l=re({x:-999,y:-999}),c=y=>{const{x:v,y:w}=y;l.value={x:v,y:w}};Bn([s,e],()=>{const{size:y}=s.value;y===0&&e.value?n():a.value>=y&&(a.value=0)});const u=(y,v)=>{const w=a.value,C=typeof y=="function"?y(w):y;v?.(C),a.value=C},d=y=>{var v,w;const C=(v=i.value)==null?void 0:v.querySelector(`[data-index="${y}"]`),k=(w=i.value)==null?void 0:w.querySelector(".menu-groups");!C||!k||(k.scrollTop=C.offsetTop-k.offsetTop)},h=y=>{const v=s.value.groups.flatMap(w=>w.items).at(y);v?.onRun&&t&&v.onRun(t),n()},p=y=>{const{size:v,groups:w}=s.value;if(y.key==="Escape"){y.preventDefault(),n?.();return}if(y.key==="ArrowDown")return y.preventDefault(),u(C=>C<v-1?C+1:C,d);if(y.key==="ArrowUp")return y.preventDefault(),u(C=>C<=0?C:C-1,d);if(y.key==="ArrowLeft")return y.preventDefault(),u(C=>{const k=w.find(I=>I.range[0]<=C&&I.range[1]>C);if(!k)return C;const A=w[w.indexOf(k)-1];return A?A.range[1]-1:C},d);if(y.key==="ArrowRight")return y.preventDefault(),u(C=>{const k=w.find(I=>I.range[0]<=C&&I.range[1]>C);if(!k)return C;const A=w[w.indexOf(k)+1];return A?A.range[0]:C},d);y.key==="Enter"&&(y.preventDefault(),h(a.value))},g=y=>v=>{const w=l.value;if(!w)return;const{x:C,y:k}=v;C===w.x&&k===w.y||u(y)};return cs(()=>{e.value?window.addEventListener("keydown",p,{capture:!0}):window.removeEventListener("keydown",p,{capture:!0})}),ds(()=>{window.removeEventListener("keydown",p,{capture:!0})}),()=>M("div",{ref:i,onPointerdown:y=>y.preventDefault()},M("nav",{class:"tab-group"},M("ul",null,s.value.groups.map(y=>M("li",{key:y.key,onPointerdown:()=>u(y.range[0],d),class:a.value>=y.range[0]&&a.value<y.range[1]?"selected":""},y.label)))),M("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(y=>M("div",{key:y.key,class:"menu-group"},M("h6",null,y.label),M("ul",null,y.items.map(v=>M("li",{key:v.key,"data-index":v.index,class:a.value===v.index?"hover":"",onPointerenter:g(v.index),onPointerdown:()=>{var w,C;(C=(w=i.value)==null?void 0:w.querySelector(`[data-index="${v.index}"]`))==null||C.classList.add("active")},onPointerup:()=>{var w,C;(C=(w=i.value)==null?void 0:w.querySelector(`[data-index="${v.index}"]`))==null||C.classList.remove("active"),h(v.index)}},M(Ft,{icon:v.icon}),M("span",null,v.label))))))))}});var pg=t=>{throw TypeError(t)},mg=(t,e,r)=>e.has(t)||pg("Cannot "+r),Ir=(t,e,r)=>(mg(t,e,"read from private field"),r?r.call(t):e.get(t)),Ms=(t,e,r)=>e.has(t)?pg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bo=(t,e,r,n)=>(mg(t,e,"write to private field"),e.set(t,r),r),Gs,p0,m0,Tn,Ii;const gg=ux("CREPE_MENU"),pf=Ve({show:()=>{},hide:()=>{}},"menuAPICtx");function $E(t,e){t.set(gg.key,{view:r=>new qE(t,r,e)})}class qE{constructor(e,r,n){Ms(this,Gs),Ms(this,p0),Ms(this,m0),Ms(this,Tn),Ms(this,Ii,null),this.update=p=>{Ir(this,Tn).update(p)},this.show=p=>{Bo(this,Ii,p),Ir(this,m0).value="",Ir(this,Tn).show()},this.hide=()=>{Bo(this,Ii,null),Ir(this,Tn).hide()},this.destroy=()=>{Ir(this,Tn).destroy(),Ir(this,p0).unmount(),Ir(this,Gs).remove()};var o,i;const s=document.createElement("div");s.classList.add("milkdown-slash-menu");const a=re(!1),l=re("");Bo(this,m0,l);const c=this.hide,u=gr(HE,{ctx:e,config:n,show:a,filter:l,hide:c});Bo(this,p0,u),u.mount(s),Bo(this,Gs,s);const d=this,h=(o=n?.slashMenu)!=null?o:{};Bo(this,Tn,new dx({content:Ir(this,Gs),debounce:20,shouldShow(p){if(ug(p.state.selection)||dg(p.state.selection))return!1;const g=this.getContent(p,v=>["paragraph","heading"].includes(v.type.name));if(g==null||!FE(p.state.selection))return!1;const y=Ir(d,Ii);if(l.value=g.startsWith("/")?g.slice(1):g,typeof y=="number"){const v=p.state.doc.nodeSize-2,w=Math.min(y,v);return p.state.doc.resolve(w).node()!==p.state.doc.resolve(p.state.selection.from).node()?(Bo(d,Ii,null),!1):!0}return!!g.startsWith("/")},offset:(i=h.offset)!=null?i:10,middleware:h.middleware,floatingUIOptions:h.floatingUIOptions,root:h.root})),Ir(this,Tn).onShow=()=>{a.value=!0},Ir(this,Tn).onHide=()=>{a.value=!1},this.update(r),e.set(pf.key,{show:p=>this.show(p),hide:()=>this.hide()})}}Gs=new WeakMap;p0=new WeakMap;m0=new WeakMap;Tn=new WeakMap;Ii=new WeakMap;function FE(t){if(!(t instanceof Ce))return!1;const{$head:e}=t,r=e.parent;return e.parentOffset===r.content.size}To(M,Ie);const VE=Ct({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(t){const e=re();return()=>M(Ie,null,M("div",{ref:e,class:"operation-item",onPointerdown:r=>{var n;r.preventDefault(),r.stopPropagation(),(n=e.value)==null||n.classList.add("active")},onPointerup:r=>{var n;r.preventDefault(),r.stopPropagation(),(n=e.value)==null||n.classList.remove("active"),t.onAdd()}},M(Ft,{icon:t.addIcon})),M("div",{class:"operation-item"},M(Ft,{icon:t.handleIcon})))}});var vg=t=>{throw TypeError(t)},yg=(t,e,r)=>e.has(t)||vg("Cannot "+r),zo=(t,e,r)=>(yg(t,e,"read from private field"),r?r.call(t):e.get(t)),_l=(t,e,r)=>e.has(t)?vg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Sl=(t,e,r,n)=>(yg(t,e,"write to private field"),e.set(t,r),r),g0,Fo,v0,y0;class WE{constructor(e,r){_l(this,g0),_l(this,Fo),_l(this,v0),_l(this,y0),this.update=()=>{zo(this,Fo).update()},this.destroy=()=>{zo(this,Fo).destroy(),zo(this,g0).remove(),zo(this,v0).unmount()},this.onAdd=()=>{const d=zo(this,y0),h=d.get($e);h.hasFocus()||h.focus();const{state:p,dispatch:g}=h,y=zo(this,Fo).active;if(!y)return;const w=y.$pos.pos+y.node.nodeSize;let C=p.tr.insert(w,Vi.type(d).create());C=C.setSelection(Ce.near(C.doc.resolve(w))),g(C.scrollIntoView()),zo(this,Fo).hide(),d.get(pf.key).show(C.selection.from)};var n,o,i,s,a;Sl(this,y0,e);const l=document.createElement("div");l.classList.add("milkdown-block-handle");const c=gr(VE,{onAdd:this.onAdd,addIcon:(n=r?.handleAddIcon)!=null?n:Yd,handleIcon:(o=r?.handleDragIcon)!=null?o:GM});c.mount(l),Sl(this,v0,c),Sl(this,g0,l);const u=(i=r?.blockHandle)!=null?i:{};Sl(this,Fo,new cx({ctx:e,content:l,getOffset:(s=u.getOffset)!=null?s:(()=>16),getPlacement:(a=u.getPlacement)!=null?a:(({active:d,blockDom:h})=>{if(d.node.type.name==="heading")return"left";let p=0;d.node.descendants(R=>{p+=R.childCount});const g=d.el,y=g.getBoundingClientRect(),v=h.getBoundingClientRect(),w=window.getComputedStyle(g),C=Number.parseInt(w.paddingTop,10)||0,k=Number.parseInt(w.paddingBottom,10)||0,A=y.height-C-k,I=v.height;return p>2||I<A?"left-start":"left"}),shouldShow:u.shouldShow,getPosition:u.getPosition,middleware:u.middleware,floatingUIOptions:u.floatingUIOptions,root:u.root})),this.update()}}g0=new WeakMap;Fo=new WeakMap;v0=new WeakMap;y0=new WeakMap;function jE(t,e){t.set(Mc.key,{filterNodes:r=>!Pn(o=>["table","blockquote","math_inline"].includes(o.type.name))(r)}),t.set(Lc.key,{view:()=>new WE(t,e)})}const UE=(t,e)=>{t.config(Er(Ae.BlockEdit)).config(r=>jE(r,e)).config(r=>$E(r,e)).use(pf).use(Lc).use(gg)},h2=oc([],"CodeMirrorThemeCtx"),GE=(t,e={})=>{t.config(Er(Ae.CodeMirror)).config(r=>{const{languages:n=[],theme:o=[]}=e,i=p1.of(A2.concat($v)),s=a=>{var l;return[i,p_,a,...(l=e.extensions)!=null?l:[]]};r.inject(h2,o),r.use(h2).on(a=>{r.update(Zi.key,l=>({...l,extensions:s(a)}))}),r.update(Zi.key,a=>{var l;return{extensions:s(o),languages:n,expandIcon:e.expandIcon||sf,searchIcon:e.searchIcon||j6,clearSearchIcon:e.clearSearchIcon||af,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||N6,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||a.renderLanguage,renderPreview:e.renderPreview||a.renderPreview,previewToggleButton:c=>{var u,d;const h=((u=e.previewToggleIcon)==null?void 0:u.call(e,c))||(c?La:Z6),p=((d=e.previewToggleText)==null?void 0:d.call(e,c))||(c?"Edit":"Hide");return[h,p].map(g=>g.trim()).join(" ")},previewLabel:e.previewLabel||a.previewLabel,previewLoading:e.previewLoading||a.previewLoading,previewOnlyByDefault:(l=e.previewOnlyByDefault)!=null?l:a.previewOnlyByDefault}})}).use(_k)},KE=(t,e)=>{if(t.config(Er(Ae.Cursor)).config(n=>{n.update(zc.key,()=>{var o,i;return{class:"crepe-drop-cursor",width:(o=e?.width)!=null?o:4,color:(i=e?.color)!=null?i:!1}})}).use(O_),e?.virtual===!1)return;const r=P_({skipWarning:["inlineCode"]});t.use(Je(()=>r))},ZE=(t,e)=>{t.config(Er(Ae.ImageBlock)).config(r=>{r.update(Nc.key,n=>{var o,i,s,a,l,c;return{uploadButton:(o=e?.inlineUploadButton)!=null?o:"Upload",imageIcon:(i=e?.inlineImageIcon)!=null?i:Q0,confirmButton:(s=e?.inlineConfirmButton)!=null?s:tu,uploadPlaceholderText:(a=e?.inlineUploadPlaceholderText)!=null?a:"or paste link",onUpload:(c=(l=e?.inlineOnUpload)!=null?l:e?.onUpload)!=null?c:n.onUpload,proxyDomURL:e?.proxyDomURL}}),r.update(Wa.key,n=>{var o,i,s,a,l,c,u,d,h;return{uploadButton:(o=e?.blockUploadButton)!=null?o:"Upload file",imageIcon:(i=e?.blockImageIcon)!=null?i:Q0,captionIcon:(s=e?.blockCaptionIcon)!=null?s:OM,confirmButton:(a=e?.blockConfirmButton)!=null?a:"Confirm",captionPlaceholderText:(l=e?.blockCaptionPlaceholderText)!=null?l:"Write Image Caption",uploadPlaceholderText:(c=e?.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(d=(u=e?.blockOnUpload)!=null?u:e?.onUpload)!=null?d:n.onUpload,proxyDomURL:e?.proxyDomURL,onImageLoadError:(h=e?.onImageLoadError)!=null?h:n.onImageLoadError,maxWidth:e?.maxWidth,maxHeight:e?.maxHeight}})}).use(Rx).use(K_)},XE=ti.extendSchema(t=>e=>{const r=t(e);return{...r,toMarkdown:{match:r.toMarkdown.match,runner:(n,o)=>{var i,s;if(((i=o.attrs.language)!=null?i:"").toLowerCase()==="latex")n.addNode("math",void 0,((s=o.content.firstChild)==null?void 0:s.text)||"");else return r.toMarkdown.runner(n,o)}}}}),Pi="math_inline",YE="ToggleLatex",tc=Wr(Pi,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${Pi}"]`,getAttrs:t=>{var e;return{value:(e=t.dataset.value)!=null?e:""}}}],toDOM:t=>{const e=t.attrs.value,r=document.createElement("span");return r.dataset.type=Pi,r.dataset.value=e,c6.render(e,r,{throwOnError:!1}),r},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,r)=>{t.addNode(r,{value:e.value})}},toMarkdown:{match:t=>t.type.name===Pi,runner:(t,e)=>{t.addNode("inlineMath",void 0,e.attrs.value)}}})),JE=Me("ToggleLatex",t=>()=>(e,r)=>{const{hasNode:n,pos:o,target:i}=Wv(e,tc.type(t)),{selection:s,doc:a,tr:l}=e;if(!n){const p=a.textBetween(s.from,s.to);let g=l.replaceSelectionWith(tc.type(t).create({value:p}));return r&&r(g.setSelection(qr.create(g.doc,s.from))),!0}const{from:c,to:u}=s;if(!i||o<0)return!1;let d=l.delete(o,o+1);const h=i.attrs.value;return d=d.insertText(h,o),r&&r(d.setSelection(Ce.create(d.doc,c,u+h.length-1))),!0}),f2=za("INLINE_LATEX");To(M);const QE=Ct({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(t){const e=n=>{if(!(!n||!(n instanceof HTMLElement))){for(;n.firstChild;)n.removeChild(n.firstChild);t.innerView.value&&n.appendChild(t.innerView.value.dom)}},r=n=>{n.preventDefault(),t.updateValue.value()};return()=>M("div",{class:"container"},t.innerView.value&&M("div",{ref:e}),M("button",{type:"button",onPointerdown:r},M(Ft,{icon:t.config.inlineEditConfirm})))}});var bg=t=>{throw TypeError(t)},wg=(t,e,r)=>e.has(t)||bg("Cannot "+r),_t=(t,e,r)=>(wg(t,e,"read from private field"),r?r.call(t):e.get(t)),Yn=(t,e,r)=>e.has(t)?bg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Al=(t,e,r,n)=>(wg(t,e,"write to private field"),e.set(t,r),r),Ks,Li,b0,Vo,Zs,Xs,i1,s1;class eI{constructor(e,r,n){this.ctx=e,Yn(this,Ks),Yn(this,Li),Yn(this,b0),Yn(this,Vo,P0(null)),Yn(this,Zs,P0(()=>{})),Yn(this,Xs),Yn(this,i1,()=>{_t(this,Vo).value&&(_t(this,Vo).value.destroy(),_t(this,Vo).value=null)}),Yn(this,s1,i=>{const a=(()=>{if(!i.editable)return!1;const{selection:l,schema:c}=i.state;if(l.empty||!(l instanceof qr))return!1;const u=l.node;if(u.type.name!==Pi)return!1;const d=l.from,h=c.nodes.paragraph.create(null,c.text(u.attrs.value)),p=new jv(_t(this,b0),{state:Uv.create({doc:h,schema:new Gv({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[Kv({"Mod-z":ic,"Mod-Z":Wi,"Mod-y":Wi,Enter:()=>(_t(this,Zs).value(),!0)})]})});return _t(this,Vo).value=p,_t(this,Zs).value=()=>{const{tr:g}=i.state;g.setNodeAttribute(d,"value",p.state.doc.textContent),i.dispatch(g),requestAnimationFrame(()=>{i.focus()})},!0})();return a||_t(this,i1).call(this),a}),this.update=(i,s)=>{_t(this,Li).update(i,s)},this.destroy=()=>{_t(this,Xs).unmount(),_t(this,Li).destroy(),_t(this,Ks).remove()};const o=document.createElement("div");o.className="milkdown-latex-inline-edit",Al(this,Ks,o),Al(this,Xs,gr(QE,{config:n,innerView:_t(this,Vo),updateValue:_t(this,Zs)})),_t(this,Xs).mount(o),Al(this,Li,new Ba({debounce:0,content:_t(this,Ks),shouldShow:_t(this,s1),offset:10,floatingUIOptions:{placement:"bottom"}})),_t(this,Li).update(r),Al(this,b0,document.createElement("div"))}}Ks=new WeakMap;Li=new WeakMap;b0=new WeakMap;Vo=new WeakMap;Zs=new WeakMap;Xs=new WeakMap;i1=new WeakMap;s1=new WeakMap;const tI=/\$([^\s$](?:[^$]*[^\s$])?)\$$/,rI=is(t=>qv(tI,tc.type(t),{getAttr:e=>{var r;return{value:(r=e[1])!=null?r:""}}})),nI=is(t=>Fv(/^\$\$[\s\n]$/,ti.type(t),()=>({language:"LaTeX"}))),oI=os("remarkMath",()=>q2);function iI(t){return w1(t,"math",(e,r,n)=>{const{value:o}=e,i={type:"code",lang:"LaTeX",value:o};n.children.splice(r,1,i)})}const sI=os("remarkMathBlock",()=>()=>iI);function aI(t,e){const r=typeof e.value=="string"?e.value:void 0;r&&w1(t,"inlineMath",(n,o,i)=>{var s,a,l;const c=(s=n.position)==null?void 0:s.start.offset,u=(a=n.position)==null?void 0:a.end.offset;if(c==null||u==null||r[c+1]==="$")return;const d=r.slice(c,u);!/^\$\s/.test(d)&&!/\s\$$/.test(d)&&!/\d/.test((l=r[u])!=null?l:"")||i.children.splice(o,1,{type:"text",value:d})})}const lI=os("remarkInlineMathGuard",()=>()=>aI),cI=(t,e)=>{t.config(Er(Ae.Latex)).config(r=>{if(!bs(r).get().includes(Ae.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");r.update(Zi.key,i=>({...i,renderPreview:(s,a,l)=>{if(s.toLowerCase()==="latex"&&a.length>0)return uI(a,e?.katexOptions);const c=i.renderPreview;return c(s,a,l)}})),r.set(f2.key,{view:i=>{var s;return new eI(r,i,{inlineEditConfirm:(s=e?.inlineEditConfirm)!=null?s:tu,...e})}})}).use(oI).use(sI).use(lI).use(tc).use(f2).use(rI).use(nI).use(XE).use(JE)};function uI(t,e){return c6.renderToString(t,{...e,throwOnError:!1,displayMode:!0})}const dI=(t,e)=>{t.config(Er(Ae.LinkTooltip)).config(BT).config(r=>{r.update(ts.key,n=>{var o,i,s,a,l,c;return{...n,linkIcon:(o=e?.linkIcon)!=null?o:N6,editButton:(i=e?.editButton)!=null?i:La,removeButton:(s=e?.removeButton)!=null?s:Jd,confirmButton:(a=e?.confirmButton)!=null?a:tu,inputPlaceholder:(l=e?.inputPlaceholder)!=null?l:"Paste link...",onCopyLink:(c=e?.onCopyLink)!=null?c:(()=>{})}})}).use(zT)};function hI(t,e){t.set(Yc.key,{renderLabel:({label:r,listType:n,checked:o})=>{var i,s,a;return o==null?n==="bullet"?(i=e?.bulletIcon)!=null?i:RM:r:o?(s=e?.checkBoxCheckedIcon)!=null?s:PM:(a=e?.checkBoxUncheckedIcon)!=null?a:DM}})}const fI=(t,e)=>{t.config(Er(Ae.ListItem)).config(r=>hI(r,e)).use(jT)};function pI(t){var e;return t.childCount<=1&&!((e=t.firstChild)!=null&&e.content.size)}function mI(t,e){const{selection:r}=t;if(!r.empty)return null;const n=r.$anchor,o=n.parent;if(o.content.size>0||Pn(a=>a.type.name==="table")(n))return null;const s=n.before();return Bt.node(s,s+o.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const a1=Ve({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),gI=Je(t=>new Xe({key:new et("CREPE_PLACEHOLDER"),props:{decorations:e=>{var r;if(rE(t).readonly)return null;const o=t.get(a1.key);if(o.mode==="doc"&&!pI(e.doc)||ug(e.selection)||dg(e.selection))return null;const i=(r=o.text)!=null?r:"Please enter...",s=mI(e,i);return s?Dt.create(e.doc,[s]):null}}})),vI=(t,e)=>{t.config(Er(Ae.Placeholder)).config(r=>{e&&r.update(a1.key,n=>({...n,...e}))}).use(gI).use(a1)},yI=(t,e)=>{t.config(Er(Ae.Table)).config(r=>{r.update(Jc.key,n=>({...n,renderButton:o=>{var i,s,a,l,c,u,d,h,p;switch(o){case"add_row":return(i=e?.addRowIcon)!=null?i:Yd;case"add_col":return(s=e?.addColIcon)!=null?s:Yd;case"delete_row":return(a=e?.deleteRowIcon)!=null?a:Jd;case"delete_col":return(l=e?.deleteColIcon)!=null?l:Jd;case"align_col_left":return(c=e?.alignLeftIcon)!=null?c:IM;case"align_col_center":return(u=e?.alignCenterIcon)!=null?u:EM;case"align_col_right":return(d=e?.alignRightIcon)!=null?d:LM;case"col_drag_handle":return(h=e?.colDragHandleIcon)!=null?h:o2;case"row_drag_handle":return(p=e?.rowDragHandleIcon)!=null?p:o2}}}))}).use(yM)};function Tl(t,e){return{slice:t,entry:e}}function bI(t){if(t===" "||t.toLowerCase()==="space")return{display:"Space",aria:" "};if(t.length===1){const e=t.toUpperCase();return{display:e,aria:e}}return{display:t,aria:t}}function wI(t,e){var r;const n=t.split(/-(?!$)/),o=(r=n[n.length-1])!=null?r:"",i=n.slice(0,-1);let s=!1,a=!1,l=!1,c=!1;for(const p of i)switch(p.toLowerCase()){case"mod":e?s=!0:a=!0;break;case"meta":case"cmd":case"m":s=!0;break;case"ctrl":case"control":case"c":a=!0;break;case"alt":case"option":case"a":l=!0;break;case"shift":case"s":c=!0;break}const u=bI(o),d=e?[a&&"⌃",l&&"⌥",c&&"⇧",s&&"⌘",u.display].filter(Boolean).join(""):[a&&"Ctrl",l&&"Alt",c&&"Shift",s&&"Meta",u.display].filter(Boolean).join("+"),h=[s&&"Meta",a&&"Control",l&&"Alt",c&&"Shift",u.aria].filter(Boolean).join("+");return{display:d,aria:h}}function xI(t,e){if(!t.isInjected(e.slice))return;const r=t.get(e.slice)[e.entry],n=r?[r.shortcuts].flat()[0]:void 0;if(n)return wI(n,Ls.mac)}function CI(t,e){var r,n,o,i,s,a,l,c,u,d,h,p,g,y,v,w,C,k;const A=new ff;A.addGroup("formatting","Formatting").addItem("bold",{icon:(r=t?.boldIcon)!=null?r:B6,label:(n=t?.boldLabel)!=null?n:"Bold",keymap:Tl(Xv.key,"ToggleBold"),active:P=>P.get(ne).call(bi.key,D2.type(P)),onRun:P=>{P.get(ne).call(P2.key)}}).addItem("italic",{icon:(o=t?.italicIcon)!=null?o:q6,label:(i=t?.italicLabel)!=null?i:"Italic",keymap:Tl(Yv.key,"ToggleEmphasis"),active:P=>P.get(ne).call(bi.key,z2.type(P)),onRun:P=>{P.get(ne).call(B2.key)}}).addItem("strikethrough",{icon:(s=t?.strikethroughIcon)!=null?s:U6,label:(a=t?.strikethroughLabel)!=null?a:"Strikethrough",keymap:Tl(Dc.key,"ToggleStrikethrough"),active:P=>P.get(ne).call(bi.key,ui.type(P)),onRun:P=>{P.get(ne).call(Ua.key)}});const I=A.addGroup("function","Function");I.addItem("code",{icon:(l=t?.codeIcon)!=null?l:lf,label:(c=t?.codeLabel)!=null?c:"Inline code",keymap:Tl(Jv.key,"ToggleInlineCode"),active:P=>P.get(ne).call(bi.key,Gu.type(P)),onRun:P=>{P.get(ne).call(N2.key)}});const R=e&&bs(e).get();if(R?.includes(Ae.Latex)&&I.addItem("latex",{icon:(u=t?.latexIcon)!=null?u:cf,label:(d=t?.latexLabel)!=null?d:"Inline math",active:P=>{const $=P.get(ne),ie=P.get(y1).nodes[Pi];return $.call(Qv.key,ie)},onRun:P=>{P.get(ne).call(YE)}}),I.addItem("link",{icon:(h=t?.linkIcon)!=null?h:F6,label:(p=t?.linkLabel)!=null?p:"Link",active:P=>P.get(ne).call(bi.key,mo.type(P)),onRun:P=>{P.get(ne).call(Zh.key)}}),e&&R?.includes(Ae.AI)){const P=e.get(rs.key);P.provider&&I.addItem("ai",{icon:(y=(g=t?.aiIcon)!=null?g:P.aiIcon)!=null?y:of,label:(v=t?.aiLabel)!=null?v:"Ask AI",active:()=>!1,onRun:$=>{const ie=$.get(hf.key),N=$.get($e),{from:ye,to:be}=N.state.selection;ie.show(ye,be)}})}(w=t?.buildToolbar)==null||w.call(t,A);const O=A.build();if(e)for(const P of O)for(const $ of P.items){if(!$.keymap)continue;const ie=xI(e,$.keymap);ie&&((C=$.shortcut)!=null||($.shortcut=ie.display),(k=$.ariaKeyshortcuts)!=null||($.ariaKeyshortcuts=ie.aria))}return O}To(M,Ie);const kI=Ct({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:r}=t,n=a=>l=>{l.preventDefault(),e&&a?.(e)};function o(a){return To(t.selection.value),e.get(M2).status!==k0.Created?!1:a(e)}const i=dr(()=>CI(r,e));function s(a){if(a.label)return a.shortcut?`${a.label} (${a.shortcut})`:a.label}return()=>M(Ie,null,i.value.map(a=>a.items.map(l=>M("button",{type:"button",class:Mt("toolbar-item",e&&o(l.active)&&"active"),"data-toolbar-item":l.key,title:s(l),"aria-label":l.label,"aria-keyshortcuts":l.ariaKeyshortcuts,onPointerdown:n(l.onRun)},M(Ft,{icon:l.icon})))).reduce((a,l,c)=>(c===0?a.push(...l):a.push(M("div",{class:"divider"}),...l),a),[]))}});var xg=t=>{throw TypeError(t)},Cg=(t,e,r)=>e.has(t)||xg("Cannot "+r),sr=(t,e,r)=>(Cg(t,e,"read from private field"),r?r.call(t):e.get(t)),Es=(t,e,r)=>e.has(t)?xg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ml=(t,e,r,n)=>(Cg(t,e,"write to private field"),e.set(t,r),r),ro,Ys,w0,Js,Qs;const p2=za("CREPE_TOOLBAR");class _I{constructor(e,r,n){Es(this,ro),Es(this,Ys),Es(this,w0),Es(this,Js),Es(this,Qs,re(!1)),this.update=(s,a)=>{sr(this,ro).update(s,a),sr(this,Js).value=s.state.selection},this.destroy=()=>{sr(this,ro).destroy(),sr(this,w0).unmount(),sr(this,Ys).remove()},this.hide=()=>{sr(this,ro).hide()};const o=document.createElement("div");o.className="milkdown-toolbar",Ml(this,Js,P0(r.state.selection));const i=gr(kI,{ctx:e,hide:this.hide,config:n,selection:sr(this,Js),show:sr(this,Qs)});i.mount(o),Ml(this,Ys,o),Ml(this,w0,i),Ml(this,ro,new Ba({content:sr(this,Ys),debounce:20,offset:10,shouldShow(s){const{doc:a,selection:l}=s.state,{empty:c,from:u,to:d}=l,h=!a.textBetween(u,d).length&&l instanceof Ce,p=!(l instanceof Ce),g=s.dom.getRootNode().activeElement,y=o.contains(g),v=!s.hasFocus()&&!y,w=!s.editable;return!(v||p||c||h||w)}})),sr(this,ro).onShow=()=>{sr(this,Qs).value=!0},sr(this,ro).onHide=()=>{sr(this,Qs).value=!1},this.update(r)}}ro=new WeakMap;Ys=new WeakMap;w0=new WeakMap;Js=new WeakMap;Qs=new WeakMap;const SI=(t,e)=>{t.config(Er(Ae.Toolbar)).config(r=>{r.set(p2.key,{view:n=>new _I(r,n,e)})}).use(p2)},kg=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function AI(t,e){var r,n;const o=e??kg,i=t.get($e),{$from:s}=i.state.selection,a=s.parent,l=(r=o.find(c=>c.level===null))!=null?r:o[0];if(a.type===no.type(t)){const c=a.attrs.level;return(n=o.find(u=>u.level===c))!=null?n:l}return l}function TI(t,e){const r=t.get(ne);if(e==null){const n=Vi.type(t);r.call(Or.key,{nodeType:n})}else{const n=no.type(t);r.call(Or.key,{nodeType:n,attrs:{level:e}})}}function No(t,e){if(t.get(ne).call(bi.key,e))return!0;const o=t.get($e),{state:i}=o;if(i.storedMarks)return i.storedMarks.some(s=>s.type===e);if(i.selection instanceof Ce){const{$cursor:s}=i.selection;if(s)return s.marks().some(a=>a.type===e)}return!1}function MI(t,e){const r=t??kg;return{icon:"",active:()=>!1,selector:{chevronIcon:e??sf,activeLabel:n=>AI(n,r).label,options:r.map(n=>({label:n.label,onSelect:o=>TI(o,n.level)}))}}}function EI(t,e){var r,n,o,i,s,a,l,c,u,d,h,p,g,y,v;const w=e&&bs(e).get(),C=w?.includes(Ae.Latex),k=w?.includes(Ae.ImageBlock),A=w?.includes(Ae.Table),I=new ff;I.addGroup("heading","Heading").addItem("heading-selector",{...MI(t?.headingOptions,t?.chevronDownIcon)}),I.addGroup("formatting","Formatting").addItem("bold",{icon:(r=t?.boldIcon)!=null?r:B6,active:O=>No(O,D2.type(O)),onRun:O=>{O.get(ne).call(P2.key)}}).addItem("italic",{icon:(n=t?.italicIcon)!=null?n:q6,active:O=>No(O,z2.type(O)),onRun:O=>{O.get(ne).call(B2.key)}}).addItem("strikethrough",{icon:(o=t?.strikethroughIcon)!=null?o:U6,active:O=>No(O,ui.type(O)),onRun:O=>{O.get(ne).call(Ua.key)}}).addItem("code",{icon:(i=t?.codeIcon)!=null?i:lf,active:O=>No(O,Gu.type(O)),onRun:O=>{const P=O.get($e),{state:$}=P;if($.selection.empty){const ie=Gu.type(O);No(O,ie)?P.dispatch($.tr.removeStoredMark(ie)):P.dispatch($.tr.addStoredMark(ie.create()))}else O.get(ne).call(N2.key)}}),I.addGroup("list","List").addItem("bullet-list",{icon:(s=t?.bulletListIcon)!=null?s:z6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=L2.type(O);P.call(co.key,{nodeType:$})}}).addItem("ordered-list",{icon:(a=t?.orderedListIcon)!=null?a:V6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=R2.type(O);P.call(co.key,{nodeType:$})}}).addItem("task-list",{icon:(l=t?.taskListIcon)!=null?l:K6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=Pa.type(O);P.call(co.key,{nodeType:$,attrs:{checked:!1}})}});const R=I.addGroup("insert","Insert");R.addItem("link",{icon:(c=t?.linkIcon)!=null?c:F6,active:O=>No(O,mo.type(O)),onRun:O=>{const P=O.get($e),{state:$}=P,ie=mo.type(O);if($.selection.empty&&No(O,ie)){P.dispatch($.tr.removeStoredMark(ie));return}O.get(ne).call(Zh.key)}}),k&&R.addItem("image",{icon:(u=t?.imageIcon)!=null?u:Q0,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ja.type(O);P.call(uo.key,{nodeType:$})}}),A&&R.addItem("table",{icon:(d=t?.tableIcon)!=null?d:G6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=O.get($e),{from:ie}=$.state.selection;P.call(uo.key,{nodeType:Bc(O,3,3)}),P.call(O2.key,{pos:ie})}});const H=I.addGroup("block","Block");return H.addItem("code-block",{icon:(h=t?.codeBlockIcon)!=null?h:NM,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ti.type(O);P.call(Or.key,{nodeType:$})}}),C&&H.addItem("math",{icon:(p=t?.mathIcon)!=null?p:cf,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ti.type(O);P.call(uo.key,{nodeType:$,attrs:{language:"LaTeX"}})}}),I.addGroup("more","More").addItem("quote",{icon:(g=t?.quoteIcon)!=null?g:W6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=E2.type(O);P.call(co.key,{nodeType:$})}}).addItem("hr",{icon:(y=t?.hrIcon)!=null?y:H6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=I2.type(O);P.call(uo.key,{nodeType:$})}}),(v=t?.buildTopBar)==null||v.call(t,I),I.build()}To(M,Ie);const II=Ct({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:r}=t,n=re(null),o=g=>y=>{y.preventDefault(),e&&g(e)};function i(){return e.get(M2).status===k0.Created}function s(){To(t.version.value)}function a(g){return s(),i()?g(e):!1}function l(g){var y,v;return s(),i()?g.activeLabel(e):(v=(y=g.options[0])==null?void 0:y.label)!=null?v:""}function c(g,y){y.preventDefault(),y.stopPropagation(),n.value=n.value===g?null:g}const u=g=>{g.target.closest(".top-bar-heading-selector")||(n.value=null)};us(()=>{window.addEventListener("pointerdown",u)}),ds(()=>{window.removeEventListener("pointerdown",u)});const d=dr(()=>EI(r,e));function h(g,y){const v=n.value===g,w=l(y);return M("div",{key:g,class:"top-bar-heading-selector"},M("button",{type:"button",class:"top-bar-heading-button",onPointerdown:C=>c(g,C)},M("span",{class:"top-bar-heading-label"},w),y.chevronIcon&&M("span",{class:"top-bar-chevron"},M(Ft,{icon:y.chevronIcon}))),v&&M("div",{class:"top-bar-heading-dropdown"},y.options.map((C,k)=>M("button",{key:`${g}-${k}`,type:"button",class:Mt("top-bar-heading-option",w===C.label&&"active"),onPointerdown:A=>{A.preventDefault(),A.stopPropagation(),n.value=null,C.onSelect(e)}},C.label))))}function p(g){return M("button",{key:g.key,type:"button",class:Mt("top-bar-item",a(g.active)&&"active"),onPointerdown:o(g.onRun)},M(Ft,{icon:g.icon}))}return()=>{s();const g=i()?e.get($e):null;return(g?!g.editable:!1)?null:M("div",{class:"top-bar-inner"},d.value.map(v=>v.items.map(w=>w.selector?h(w.key,w.selector):w.onRun?p(w):null)).reduce((v,w,C)=>{var k,A;if(C===0)v.push(...w);else{const I=(A=(k=d.value[C])==null?void 0:k.key)!=null?A:C;v.push(M("div",{key:`divider-${I}`,class:"top-bar-divider"}),...w)}return v},[]))}}});var _g=t=>{throw TypeError(t)},Sg=(t,e,r)=>e.has(t)||_g("Cannot "+r),Is=(t,e,r)=>(Sg(t,e,"read from private field"),r?r.call(t):e.get(t)),Vu=(t,e,r)=>e.has(t)?_g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Wu=(t,e,r,n)=>(Sg(t,e,"write to private field"),e.set(t,r),r),ea,x0,ta;const LI=new et("CREPE_TOP_BAR");class RI{constructor(e,r,n){Vu(this,ea),Vu(this,x0),Vu(this,ta),this.update=(a,l)=>{Is(this,ea).style.display=a.editable?"":"none",Is(this,ta).value++},this.destroy=()=>{Is(this,x0).unmount(),Is(this,ea).remove()},Wu(this,ta,re(0));const o=document.createElement("div");o.className="milkdown-top-bar";const i=gr(II,{ctx:e,config:n,version:Is(this,ta)});i.mount(o),Wu(this,ea,o),Wu(this,x0,i);const s=r.dom.parentElement;s&&s.insertBefore(o,s.firstChild),this.update(r)}}ea=new WeakMap;x0=new WeakMap;ta=new WeakMap;const l1=Ve({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),OI=Je(t=>{const e=t.get(l1.key);return new Xe({key:LI,view:e.view})}),PI=(t,e)=>{t.config(Er(Ae.TopBar)).config(r=>{r.set(l1.key,{view:n=>new RI(r,n,e)})}).use(l1).use(OI)};function DI(t,e,r){switch(t){case Ae.CodeMirror:return GE(e,r);case Ae.ListItem:return fI(e,r);case Ae.LinkTooltip:return dI(e,r);case Ae.ImageBlock:return ZE(e,r);case Ae.Cursor:return KE(e,r);case Ae.BlockEdit:return UE(e,r);case Ae.Placeholder:return vI(e,r);case Ae.Toolbar:return SI(e,r);case Ae.Table:return yI(e,r);case Ae.Latex:return cI(e,r);case Ae.TopBar:return PI(e,r);case Ae.AI:return BE(e,r)}}var Ag=t=>{throw TypeError(t)},Tg=(t,e,r)=>e.has(t)||Ag("Cannot "+r),ar=(t,e,r)=>(Tg(t,e,"read from private field"),r?r.call(t):e.get(t)),ju=(t,e,r)=>e.has(t)?Ag("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Uu=(t,e,r,n)=>(Tg(t,e,"write to private field"),e.set(t,r),r),lr,C0,ra;class BI{constructor({root:e,defaultValue:r=""}={}){ju(this,lr),ju(this,C0),ju(this,ra,!0),this.addFeature=(o,i)=>(o(ar(this,lr),i),this),this.create=()=>ar(this,lr).create(),this.destroy=()=>ar(this,lr).destroy(),this.setReadonly=o=>(Uu(this,ra,!o),ar(this,lr).action(i=>{ar(this,lr).status===k0.Created&&i.get($e).setProps({editable:()=>!o})}),this),this.getMarkdown=()=>ar(this,lr).action(Dv()),this.on=o=>ar(this,lr).status!==k0.Created?(ar(this,lr).config(i=>{const s=i.get(J0);o(s)}),this):(ar(this,lr).action(i=>{const s=i.get(J0);o(s)}),this);var n;Uu(this,C0,(n=typeof e=="string"?document.querySelector(e):e)!=null?n:document.body),Uu(this,lr,Bv.make().config(o=>{o.inject(tE,this),o.inject(eE,[])}).config(o=>{o.set(zv,ar(this,C0)),o.set(Nv,r),o.set(b1,{editable:()=>ar(this,ra)}),o.update(eu.key,i=>({...i,size:4})),o.update(Fi.key,i=>({...i,uploader:async(s,a,l)=>{const u=bs(l).get().includes(Ae.ImageBlock),d=u?a.nodes["image-block"]:a.nodes.image;if(!d)return[];const h=u?l.get(Wa.key).onUpload:void 0,p=[];for(let y=0;y<s.length;y++){const v=s.item(y);v&&v.type.includes("image")&&p.push(v)}return await Promise.all(p.map(async y=>{const v=h?await h(y):URL.createObjectURL(y);return d.createAndFill({src:v})}))}}))}).use(Hv).use(O6).use(wM).use(CM).use(_M).use(E6).use(TM).use(ok))}get editor(){return ar(this,lr)}get readonly(){return!ar(this,ra)}}lr=new WeakMap;C0=new WeakMap;ra=new WeakMap;class cr extends BI{constructor({features:e={},featureConfigs:r={},...n}={}){super(n);const o=O8(r,QM);Object.entries({...MM,...e}).filter(([,s])=>s).map(([s])=>s).forEach(s=>{const a=o[s];DI(s,this.editor,a)})}}cr.Feature=Ae;function zI(t,e){const{state:r}=e,{$from:n}=r.selection,o=n.index(-1);if(!o||!/^\s*\|?\s*:?-{3,}/.test(n.parent.textContent))return!1;const i=n.node(-1).child(o-1);if(i.type.name!=="paragraph"||!i.textContent.includes("|"))return!1;const a=t.get(gn)(i.textContent+`
1002
- `+n.parent.textContent)?.firstChild;if(a?.type.name!=="table")return!1;const l=a.firstChild,c=[];l.forEach(p=>c.push(r.schema.nodes.table_cell.createAndFill({alignment:p.attrs.alignment})));const u=a.type.create(a.attrs,[l,r.schema.nodes.table_row.create(null,c)]),d=n.before()-i.nodeSize,h=r.tr.replaceWith(d,n.after(),u);return e.dispatch(h.setSelection(Ce.create(h.doc,d+u.firstChild.nodeSize+4)).scrollIntoView()),!0}function c1(t,e,r){const n=t.state.schema.nodes.paragraph,o=r.match(/^[ \t]+/)?.[0]||"",i=r.match(/[ \t]+$/)?.[0]||"",s=[];e.forEach((u,d,h)=>{if(u.type===n){let p=u.content;!h&&o&&!u.textContent.startsWith(o)&&(p=He.from(t.state.schema.text(o)).append(p)),h===e.childCount-1&&i&&!u.textContent.endsWith(i)&&(p=p.append(He.from(t.state.schema.text(i)))),u=u.copy(p)}s.push(u)});let a=He.fromArray(s);e.lastChild?.type!==n&&(a=a.append(He.from(n.create())));const l=new dt(a,e.firstChild?.type===n&&!/^\s*\n/.test(r)?1:0,1),c=kr(t.state.tr).replaceSelection(l);return t.dispatch(c.setMeta("paste",!0).setMeta("uiEvent","paste").scrollIntoView()),t.dispatch(kr(t.state.tr)),!0}function NI(t,e){return(r,n,o)=>{const i=n.clipboardData;if(!i||!r.editable)return!1;x1(r);const s=i.getData("text/plain").replace(/\r\n?/g,`
1003
- `);if(!s&&!i.getData("text/html"))return!1;const{$from:a}=r.state.selection;if(a.parent.type.spec.code||a.marks().some(d=>d.type.spec.code)||/^[ \t]+$/.test(s))return r.dispatch(kr(r.state.tr).insertText(s).scrollIntoView()),r.dispatch(kr(r.state.tr)),!0;if(e?.(r,n))return!0;const l=i.getData("vscode-editor-data");let c;try{c=l?JSON.parse(l).mode:null}catch{}if(s&&typeof c=="string"&&c){const{schema:d}=r.state,h=d.nodes.code_block.create({language:c},d.text(s));return c1(r,d.topNodeType.create(null,h),s)}if(i.getData("text/html")&&o?.size)return r.dispatch(kr(r.state.tr).replaceSelection(o).scrollIntoView()),r.dispatch(kr(r.state.tr)),!0;if(!s)return!1;const u=t.get(gn)(s);return u?c1(r,u,s):!1}}const HI=Je(t=>new Xe({props:{handleTextInput(e,r,n,o){if(e.composing||o.length<2||!e.state.selection.$from.parent.isTextblock||e.state.selection.$from.parent.type.spec.code||(e.state.storedMarks??e.state.selection.$from.marks()).some(s=>s.type.spec.code)||e.state.selection.$from.parent.content.size&&!o.includes(`
1004
- `)||!/[\n#*>`$~\[\]-]/.test(o))return!1;const i=t.get(gn)(o);return i?c1(e,i,o):!1},handleKeyDown(e,r){if(r.key!=="Enter"||r.ctrlKey||r.metaKey||r.shiftKey||e.composing)return!1;const{state:n}=e,{$from:o,empty:i}=n.selection;if(!i||!o.parent.isTextblock||o.parent.type.spec.code||o.parentOffset!==o.parent.content.size)return!1;if(zI(t,e))return!0;const s=o.parent.textContent,a=/^(?:`{3,}|~{3,})([\w+-]*)$/.exec(s);if(!a)return!1;const l=o.start(),c=n.tr.delete(l,o.end()).setBlockType(l,l,n.schema.nodes.code_block,{language:a[1]});return e.dispatch(c.scrollIntoView()),!0}},appendTransaction(e,r,n){if(!e.some(d=>d.docChanged)||!n.selection.empty)return null;const{$from:o}=n.selection;if(o.parent.type.name!=="code_block")return null;const i=o.parent.textContent,s=/\n(?:`{3,}|~{3,})$/.exec(i);if(!s||o.parentOffset!==i.length)return null;const a=o.before(),l=o.parent.type.create(o.parent.attrs,i.slice(0,s.index)?n.schema.text(i.slice(0,s.index)):null),c=n.schema.nodes.paragraph.create(),u=n.tr.replaceWith(a,a+o.parent.nodeSize,[l,c]);return u.setSelection(Ce.create(u.doc,a+l.nodeSize+1)).scrollIntoView()}})),$I=is(t=>new h1(/!?\[([^\]]+)\]\(([^()\s]+)\)$/,(e,r,n,o)=>{const i=t.get(gn)(r[0]);return i?.firstChild?e.tr.replaceWith(n,o,i.firstChild.content):null})),qI=ko(Pa.node,()=>(t,e,r)=>{const n=document.createElement("li"),o=document.createElement("div"),i=document.createElement("input");i.type="checkbox",i.contentEditable="false",i.setAttribute("aria-label","完成任务"),n.append(o);let s=t;function a(l){if(l.type!==s.type)return!1;s=l;const c=l.attrs.checked!=null;return n.classList.toggle("document-task",c),c?(n.prepend(i),i.checked=l.attrs.checked,i.disabled=!e.editable):i.remove(),!0}return i.onmousedown=l=>l.preventDefault(),i.onchange=()=>{const l=r();l===void 0||!e.editable||e.dispatch(e.state.tr.setNodeAttribute(l,"checked",i.checked))},a(t),{dom:n,contentDOM:o,update:a,stopEvent:l=>l.target===i,ignoreMutation:l=>l.type!=="selection"&&!o.contains(l.target)}});function u1(t){return t.parent.textBetween(0,t.parent.content.size,`
1001
+ `,YM={[Ae.CodeMirror]:{theme:W8,languages:O8,expandIcon:sf,searchIcon:j6,clearSearchIcon:af,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:t=>t?La:Z6}},JM=oc([],"FeaturesCtx"),QM=oc({},"CrepeCtx");function eE(t){return t.get("CrepeCtx")}function bs(t){return t.use("FeaturesCtx")}function Er(t){return e=>{bs(e).update(r=>r.includes(t)?r:[...r,t])}}function tE(t,e){var r;const n=t.get($e),o=t.get(fa),{state:i}=n,s=o(i.doc);let a="";if(!i.selection.empty){const{from:l,to:c}=i.selection,u=i.doc.slice(l,c),{schema:d}=i.doc.type;let h=d.topNodeType.createAndFill(null,u.content);if(!h){const p=(r=d.nodes.paragraph)==null?void 0:r.createAndFill(null,u.content);p&&(h=d.topNodeType.createAndFill(null,p))}a=h?o(h):i.doc.textBetween(l,c)}return{document:s,selection:a,instruction:e}}const rs=Ve({provider:void 0,buildContext:void 0,diffReviewOnEnd:!0,onError:t=>{console.error(`[milkdown/ai] [${t.code}]`,t)},aiIcon:void 0},"aiProviderConfig"),wt=Ve({abortController:null,label:"",lastInstruction:"",lastLabel:void 0,lastFrom:-1,lastTo:-1,diffOwnedByAI:!1},"aiSession");function X6(t,e){const r=t.get(rs.key);try{r.onError(e)}catch(n){console.error("[milkdown/ai] onError handler failed:",n)}}function ec(t){const e=t.get(wt.key);t.set(wt.key,{...e,abortController:null,label:""})}async function rE(t,e,r,n){try{const o=e(r,n.signal),i=t.get(ne);for await(const l of o){if(n.signal.aborted)break;i.call(M1.key,l)}if(n.signal.aborted)return;const s=t.get(rs.key);if(s.diffReviewOnEnd){const l=t.get(wt.key);t.set(wt.key,{...l,diffOwnedByAI:!0})}const a=i.call(E1.key,{diffReview:s.diffReviewOnEnd});if(s.diffReviewOnEnd&&!a){const l=t.get(wt.key);t.set(wt.key,{...l,diffOwnedByAI:!1})}}catch(o){if(n.signal.aborted)return;const i=Zv(o);X6(t,i),t.get(ne).call(as.key,{keep:!1})}finally{t.get(wt.key).abortController===n&&ec(t)}}const uf=Me("RunAI",t=>e=>(r,n)=>{var o,i,s,a;if(!e?.instruction)return!1;const l=t.get(rs.key);if(!l.provider||t.get(wt.key).abortController||(o=ht.getState(r))!=null&&o.active||(i=it.getState(r))!=null&&i.active)return!1;if(!n)return!0;const u=new AbortController,{from:d,to:h}=r.selection;t.set(wt.key,{abortController:u,label:(s=e.label)!=null?s:"",lastInstruction:e.instruction,lastLabel:e.label,lastFrom:d,lastTo:h,diffOwnedByAI:!1});const p=t.get(ne),g=r.selection.empty?"cursor":"selection";if(!p.call(T1.key,{insertAt:g}))return ec(t),!1;let y;try{y=((a=l.buildContext)!=null?a:tE)(t,e.instruction)}catch(v){const w=Vv(v);return X6(t,w),p.call(as.key,{keep:!1}),ec(t),!1}return rE(t,l.provider,y,u),!0}),Y6=Me("AbortAI",t=>e=>(r,n)=>{var o;const i=t.get(wt.key);return n?i.abortController?(i.abortController.abort(),ec(t),(o=ht.getState(r))!=null&&o.active&&t.get(ne).call(as.key,e),!0):!1:!!i.abortController});var J6=t=>{throw TypeError(t)},df=(t,e,r)=>e.has(t)||J6("Cannot "+r),St=(t,e,r)=>(df(t,e,"read from private field"),r?r.call(t):e.get(t)),wr=(t,e,r)=>e.has(t)?J6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Kr=(t,e,r,n)=>(df(t,e,"write to private field"),e.set(t,r),r),vi=(t,e,r)=>(df(t,e,"access private method"),r),Vs,e0,Ws,Ra,t0,r0,lo,Ti,eo,Q6,n0,eg,Qd,tg,e1,t1;const ns="milkdown-ai-diff-actions";function rg(t,e){t.innerHTML=Tr.sanitize(e.trim())}function nE(t){const e=document.createElement("span");return e.className=`${ns}-icon`,rg(e,t),e}class oE{constructor(e,r,n){this.ctx=e,wr(this,eo),wr(this,Vs),wr(this,e0),wr(this,Ws),wr(this,Ra),wr(this,t0,!1),wr(this,r0,!1),wr(this,lo,null),wr(this,Ti,!1),wr(this,Qd,()=>{const s=this.ctx.get(wt.key);if(!s.lastInstruction||!St(this,Ti)||!vi(this,eo,tg).call(this))return;const a=this.ctx.get(ne);a.call(T0.key);const l=this.ctx.get($e),{doc:c}=l.state,u=Math.min(Math.max(s.lastFrom,0),c.content.size),d=Math.min(Math.max(s.lastTo,0),c.content.size);l.dispatch(l.state.tr.setSelection(Ce.create(l.state.doc,u,d))),a.call(uf.key,{instruction:s.lastInstruction,label:s.lastLabel})}),wr(this,e1,()=>{this.ctx.get(ne).call(T0.key)}),wr(this,t1,()=>{this.ctx.get(ne).call(cc.key)}),Kr(this,Ra,n),Kr(this,e0,vi(this,eo,Q6).call(this,r));const o=document.createElement("div");o.className=ns,o.dataset.show="false",Kr(this,Ws,vi(this,eo,n0).call(this,"retry",n.retryIcon,n.retryLabel,St(this,Qd))),o.appendChild(St(this,Ws)),o.appendChild(vi(this,eo,n0).call(this,"reject",n.rejectIcon,n.rejectAllLabel,St(this,e1)));const i=vi(this,eo,n0).call(this,"accept",n.acceptIcon,n.acceptAllLabel,St(this,t1));i.appendChild(vi(this,eo,eg).call(this)),o.appendChild(i),Kr(this,Vs,o),St(this,e0).appendChild(o),this.update(r)}update(e){var r;const n=!!((r=it.getState(e.state))!=null&&r.active);if(n!==St(this,r0))if(Kr(this,r0,n),n){const i=this.ctx.get(wt.key);Kr(this,Ti,i.diffOwnedByAI),Kr(this,lo,e.state.doc)}else{Kr(this,Ti,!1),Kr(this,lo,null);const i=this.ctx.get(wt.key);i.diffOwnedByAI&&this.ctx.set(wt.key,{...i,diffOwnedByAI:!1})}const o=n&&St(this,Ti);if(o!==St(this,t0)&&(Kr(this,t0,o),St(this,Vs).dataset.show=o?"true":"false"),o){const i=this.ctx.get(wt.key),s=!!St(this,lo)&&e.state.doc.eq(St(this,lo));St(this,Ws).disabled=!i.lastInstruction||!s}}destroy(){St(this,Vs).remove()}}Vs=new WeakMap;e0=new WeakMap;Ws=new WeakMap;Ra=new WeakMap;t0=new WeakMap;r0=new WeakMap;lo=new WeakMap;Ti=new WeakMap;eo=new WeakSet;Q6=function(t){var e;return(e=t.dom.closest(".milkdown"))!=null?e:document.body};n0=function(t,e,r,n){const o=document.createElement("button");o.type="button",o.className=`${ns}-btn ${ns}-btn-${t}`,o.appendChild(nE(e));const i=document.createElement("span");return i.textContent=r,o.appendChild(i),o.addEventListener("mousedown",s=>s.preventDefault()),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),n()}),o};eg=function(){const t=document.createElement("span");t.className=`${ns}-shortcut`;const e=document.createElement("span");e.textContent=St(this,Ra).modSymbol;const r=document.createElement("span");return r.className=`${ns}-shortcut-icon`,rg(r,St(this,Ra).enterKeyIcon),t.append(e,r),t};Qd=new WeakMap;tg=function(){return St(this,lo)?this.ctx.get($e).state.doc.eq(St(this,lo)):!1};e1=new WeakMap;t1=new WeakMap;const iE=new et("CREPE_AI_DIFF_ACTIONS_PANEL"),sE="Retry",aE="Reject all",lE="Accept all";function cE(){var t,e,r,n;if(typeof navigator>"u")return"⌘";const o=navigator,i=(n=(r=(e=(t=o.userAgentData)==null?void 0:t.platform)!=null?e:o.platform)!=null?r:o.userAgent)!=null?n:"";return/mac|iphone|ipad|ipod/i.test(i)?"⌘":"Ctrl"}const uE=cE();function dE(t){var e,r,n,o,i,s,a;const{config:l,enterKeyIcon:c}=t;return{retryLabel:(e=l?.retryLabel)!=null?e:sE,rejectAllLabel:(r=l?.rejectAllLabel)!=null?r:aE,acceptAllLabel:(n=l?.acceptAllLabel)!=null?n:lE,retryIcon:(o=l?.retryIcon)!=null?o:UM,rejectIcon:(i=l?.rejectIcon)!=null?i:af,acceptIcon:(s=l?.acceptIcon)!=null?s:tu,enterKeyIcon:c??$6,modSymbol:(a=l?.modSymbol)!=null?a:uE}}function hE(t={}){const e=dE(t);return Je(r=>new Xe({key:iE,view(n){return new oE(r,n,e)},props:{handleKeyDown(n,o){var i;return o.key!=="Enter"||!(o.metaKey||o.ctrlKey)||!((i=it.getState(n.state))!=null&&i.active)||!r.get(wt.key).diffOwnedByAI?!1:(o.preventDefault(),r.get(ne).call(cc.key),!0)}}}))}var ng=t=>{throw TypeError(t)},og=(t,e,r)=>e.has(t)||ng("Cannot "+r),kn=(t,e,r)=>(og(t,e,"read from private field"),r?r.call(t):e.get(t)),a2=(t,e,r)=>e.has(t)?ng("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),l2=(t,e,r,n)=>(og(t,e,"write to private field"),e.set(t,r),r),Yr,js;function c2(t){const e={addItem:(r,n)=>(t.items.set(r,n),e),removeItem:r=>(t.items.delete(r),e),getItem:r=>t.items.get(r),clear:()=>(t.items.clear(),e)};return e}class fE{constructor(){a2(this,Yr,[]),this.addItem=(e,r)=>(kn(this,js).call(this,e),kn(this,Yr).push({kind:"item",id:e,item:r}),this),this.addSubmenu=(e,r,n)=>{kn(this,js).call(this,e);const o={def:r,items:new Map};return n&&n(c2(o)),kn(this,Yr).push({kind:"submenu",id:e,node:o}),this},this.removeItem=e=>(kn(this,js).call(this,e),this),this.getItem=e=>{const r=kn(this,Yr).find(n=>n.kind==="item"&&n.id===e);return r?.kind==="item"?r.item:void 0},this.getSubmenu=e=>{const r=kn(this,Yr).find(n=>n.kind==="submenu"&&n.id===e);return r?.kind==="submenu"?c2(r.node):void 0},this.clear=()=>(l2(this,Yr,[]),this),this.build=()=>{const e=[],r={};for(const n of kn(this,Yr))n.kind==="item"?e.push({kind:"item",id:n.id,item:n.item}):(e.push({kind:"submenu",id:n.id,def:n.node.def}),r[n.id]={def:n.node.def,items:Array.from(n.node.items.entries()).map(([o,i])=>({id:o,item:i}))});return{main:e,submenus:r}},a2(this,js,e=>{l2(this,Yr,kn(this,Yr).filter(r=>r.id!==e))})}}Yr=new WeakMap;js=new WeakMap;function pE(t){t.addItem("improve",{icon:of,label:"Improve writing",streamingLabel:"Improving writing",prompt:"Improve the writing while preserving the original meaning."}).addItem("grammar",{icon:zM,label:"Fix grammar & spelling",streamingLabel:"Fixing grammar & spelling",prompt:"Fix any grammar and spelling errors without changing the meaning."}).addItem("shorter",{icon:ZM,label:"Make shorter",streamingLabel:"Making shorter",prompt:"Make this shorter while preserving the key information."}).addItem("longer",{icon:WM,label:"Make longer",streamingLabel:"Expanding",prompt:"Expand this with more detail and examples."}),t.addSubmenu("tone",{icon:La,label:"Change tone…",title:"Change tone",searchPlaceholder:"Search tones…"},e=>{const r=[["professional","Professional"],["casual","Casual"],["confident","Confident"],["friendly","Friendly"],["direct","Direct"],["formal","Formal"]];for(const[n,o]of r)e.addItem(n,{icon:La,label:o,streamingLabel:"Adjusting tone",prompt:`Rewrite this in a ${o.toLowerCase()} tone.`})}),t.addSubmenu("translate",{icon:s2,label:"Translate…",title:"Translate",searchPlaceholder:"Search languages…"},e=>{const r=[["english","English","English"],["chinese","Chinese","Chinese (Simplified)"],["japanese","Japanese","Japanese"],["korean","Korean","Korean"],["spanish","Spanish","Spanish"],["french","French","French"],["german","German","German"]];for(const[n,o,i]of r)e.addItem(n,{icon:s2,label:o,streamingLabel:`Translating to ${o}`,prompt:`Translate this to ${i}.`})})}function To(...t){}To(M);function mE(t,e){const r=e.trim();if(!r)return[t];const n=t.toLowerCase(),o=r.toLowerCase(),i=n.indexOf(o);return i===-1?[t]:[t.slice(0,i),M("mark",null,t.slice(i,i+r.length)),t.slice(i+r.length)]}const gE=Ct({props:{placeholder:{type:Object,required:!0},resetSignal:{type:Object,required:!0},suggestions:{type:Object,required:!0},chrome:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({placeholder:t,resetSignal:e,suggestions:r,chrome:n,onConfirm:o,onCancel:i}){const s=re(""),a=re({kind:"main"}),l=re(0),c=re(null),u=re(null),d=`ai-instruction-list-${Math.random().toString(36).slice(2,9)}`,h=N=>`${d}-opt-${N}`,p=`ai-instruction-input-${Math.random().toString(36).slice(2,9)}`;Bn(e,()=>{s.value="",a.value={kind:"main"},l.value=0});const g=dr(()=>{if(a.value.kind==="submenu"){const N=r.submenus[a.value.id];return N?N.items.map(({id:ye,item:be})=>({id:ye,icon:be.icon,label:be.label,hasSubmenu:!1,prompt:{text:be.prompt,streamingLabel:be.streamingLabel}})):[]}return r.main.map(N=>N.kind==="item"?{id:N.id,icon:N.item.icon,label:N.item.label,hasSubmenu:!1,prompt:{text:N.item.prompt,streamingLabel:N.item.streamingLabel}}:{id:N.id,icon:N.def.icon,label:N.def.label,hasSubmenu:!0})}),y=dr(()=>{var N,ye;return a.value.kind!=="submenu"?null:(ye=(N=r.submenus[a.value.id])==null?void 0:N.def)!=null?ye:null}),v=dr(()=>{const N=s.value.trim().toLowerCase();return N?g.value.filter(ye=>ye.label.toLowerCase().includes(N)):g.value}),w=dr(()=>s.value.trim().length>0),C=dr(()=>v.value.length+(w.value?1:0));Bn([v,a,w],()=>{l.value=w.value?v.value.length:0});const k=()=>{ad(()=>{var N;return(N=c.value)==null?void 0:N.focus()})},S=N=>{a.value={kind:"submenu",id:N},s.value="",l.value=0,k()},E=()=>{a.value={kind:"main"},s.value="",l.value=0,k()},R=N=>{N.hasSubmenu?S(N.id):N.prompt&&(o(N.prompt.text,N.prompt.streamingLabel),s.value="")},H=()=>{const N=s.value.trim();N&&(o(N),s.value="")},O=()=>{const N=l.value,ye=v.value;N<ye.length?R(ye[N]):w.value&&H()},P=()=>{ad(()=>{const N=u.value;if(!N)return;const ye=N.querySelector(`[data-index="${l.value}"]`);ye?.scrollIntoView({block:"nearest"})})},$=N=>{if(N.stopPropagation(),N.key==="ArrowDown"){if(N.preventDefault(),C.value===0)return;l.value=(l.value+1)%C.value,P();return}if(N.key==="ArrowUp"){if(N.preventDefault(),C.value===0)return;l.value=(l.value-1+C.value)%C.value,P();return}if(N.key==="Enter"){N.preventDefault(),O();return}if(N.key==="Escape"){N.preventDefault(),a.value.kind==="submenu"?E():i();return}N.key==="Backspace"&&s.value===""&&a.value.kind==="submenu"&&(N.preventDefault(),E())},ie=N=>{N.preventDefault()};return()=>{const N=v.value,ye=w.value,be=y.value;return M("div",{class:"ai-instruction"},M("div",{class:"ai-instruction-input"},M("span",{class:"ai-instruction-input-prefix"},M(Ft,{icon:n.aiIcon})),M("input",{ref:c,id:p,class:"ai-instruction-input-field",role:"combobox","aria-expanded":"true","aria-autocomplete":"list","aria-controls":d,"aria-activedescendant":C.value>0?h(l.value):void 0,placeholder:be?be.searchPlaceholder:t.value,value:s.value,onInput:Fe=>{s.value=Fe.target.value},onKeydown:$}),M("button",{type:"button",class:"ai-instruction-submit","aria-label":n.submitButtonLabel,disabled:!ye,onMousedown:ie,onClick:H},M(Ft,{icon:n.sendIcon}))),M("div",{class:"ai-instruction-list",ref:u,id:d,role:"listbox","aria-label":n.listboxLabel},be&&M("button",{type:"button",class:"ai-instruction-back",onMousedown:ie,onClick:E},M("span",{class:"ai-instruction-back-icon","aria-hidden":"true"},M(Ft,{icon:n.chevronLeftIcon})),M("span",null,be.title)),N.length>0&&M("div",{class:"ai-instruction-section"},M("div",{class:"ai-instruction-section-header"},n.suggestionsHeaderLabel),N.map((Fe,ke)=>M("div",{key:Fe.id,id:h(ke),"data-index":ke,role:"option","aria-selected":ke===l.value,class:["ai-instruction-item",ke===l.value?"active":""],onMousedown:ie,onClick:()=>R(Fe),onPointerenter:()=>{l.value=ke}},M("span",{class:"ai-instruction-item-icon"},M(Ft,{icon:Fe.icon})),M("span",{class:"ai-instruction-item-label"},mE(Fe.label,s.value)),Fe.hasSubmenu&&M("span",{class:"ai-instruction-item-arrow"},M(Ft,{icon:n.chevronRightIcon}))))),ye&&M("div",{class:"ai-instruction-section"},M("div",{class:"ai-instruction-section-header"},n.sendAsPromptHeaderLabel),M("div",{id:h(N.length),"data-index":N.length,role:"option","aria-selected":l.value===N.length,class:["ai-instruction-item","ai-instruction-item-prompt",l.value===N.length?"active":""],onMousedown:ie,onClick:H,onPointerenter:()=>{l.value=N.length}},M("span",{class:"ai-instruction-item-icon"},M(Ft,{icon:n.sendPromptIcon})),M("span",{class:"ai-instruction-item-label"},n.sendAsPromptLabel," ",M("span",{class:"ai-instruction-item-quote"},'"',s.value,'"')),M("span",{class:"ai-instruction-item-shortcut"},M(Ft,{icon:n.enterKeyIcon}))))))}}});var ig=t=>{throw TypeError(t)},sg=(t,e,r)=>e.has(t)||ig("Cannot "+r),ct=(t,e,r)=>(sg(t,e,"read from private field"),r?r.call(t):e.get(t)),Zr=(t,e,r)=>e.has(t)?ig("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),xr=(t,e,r,n)=>(sg(t,e,"write to private field"),e.set(t,r),r),qo,Rr,o0,i0,Us,s0,a0,to,r1,n1;class vE{constructor(e,r,n){this.ctx=e,Zr(this,qo),Zr(this,Rr),Zr(this,o0),Zr(this,i0),Zr(this,Us),Zr(this,s0,-1),Zr(this,a0,-1),Zr(this,to,!1),Zr(this,r1,(s,a)=>{!s.trim()||!this.ctx.get(ne).call(uf.key,{instruction:s,label:a})||(xr(this,to,!1),ct(this,Rr).hide())}),Zr(this,n1,()=>{xr(this,to,!1),ct(this,Rr).hide()}),this.show=(s,a)=>{xr(this,s0,s),xr(this,a0,a),ct(this,Us).value++,xr(this,to,!0);const l=this.ctx.get($e);ct(this,Rr).show({getBoundingClientRect:()=>Oa(l,s,a)},l),requestAnimationFrame(()=>{var c;(c=ct(this,qo).querySelector("input"))==null||c.focus()})},this.update=(s,a)=>{const{selection:l}=s.state,c=l instanceof Ce,u=l.from!==ct(this,s0)||l.to!==ct(this,a0);if(!c||u){xr(this,to,!1),ct(this,Rr).hide();return}ct(this,Rr).update(s,a)},this.destroy=()=>{ct(this,o0).unmount(),ct(this,Rr).destroy(),ct(this,qo).remove()},xr(this,i0,re(n.placeholder)),xr(this,Us,re(0));const o=document.createElement("div");o.className="milkdown-ai-instruction";const i=gr(gE,{placeholder:ct(this,i0),resetSignal:ct(this,Us),suggestions:n.suggestions,chrome:n.chrome,onConfirm:ct(this,r1),onCancel:ct(this,n1)});i.mount(o),xr(this,o0,i),xr(this,qo,o),xr(this,Rr,new Ba({content:o,debounce:0,offset:10,shouldShow:()=>ct(this,to),floatingUIOptions:{placement:"bottom"}})),ct(this,Rr).onHide=()=>{xr(this,to,!1),requestAnimationFrame(()=>{try{const a=ct(this,qo).getRootNode().activeElement;if(!a||!ct(this,qo).contains(a))return;this.ctx.get($e).dom.focus({preventScroll:!0})}catch{}})},ct(this,Rr).update(r)}}qo=new WeakMap;Rr=new WeakMap;o0=new WeakMap;i0=new WeakMap;Us=new WeakMap;s0=new WeakMap;a0=new WeakMap;to=new WeakMap;r1=new WeakMap;n1=new WeakMap;const yE={show:()=>{}},hf=Ve({...yE},"aiInstructionTooltipAPI"),ag=za("CREPE_AI_INSTRUCTION"),bE="SUGGESTIONS",wE="SEND AS PROMPT",xE="Ask AI:",CE="Send prompt",kE="AI suggestions",_E="Tell AI what to do with the selection…";function SE(t){var e,r,n,o,i,s,a,l,c,u,d;return{aiIcon:(e=t?.aiIcon)!=null?e:of,sendIcon:(r=t?.sendIcon)!=null?r:GM,sendPromptIcon:(n=t?.sendPromptIcon)!=null?n:KM,enterKeyIcon:(o=t?.enterKeyIcon)!=null?o:$6,chevronLeftIcon:(i=t?.chevronLeftIcon)!=null?i:PM,chevronRightIcon:(s=t?.chevronRightIcon)!=null?s:DM,suggestionsHeaderLabel:(a=t?.suggestionsHeaderLabel)!=null?a:bE,sendAsPromptHeaderLabel:(l=t?.sendAsPromptHeaderLabel)!=null?l:wE,sendAsPromptLabel:(c=t?.sendAsPromptLabel)!=null?c:xE,submitButtonLabel:(u=t?.submitButtonLabel)!=null?u:CE,listboxLabel:(d=t?.listboxLabel)!=null?d:kE}}function AE(t){var e,r;const n=new fE;return pE(n),(e=t?.buildAISuggestions)==null||e.call(t,n),{placeholder:(r=t?.instructionPlaceholder)!=null?r:_E,chrome:SE(t),suggestions:n.build()}}function TE(t){return e=>{const r=AE(t);let n=null;e.update(hf.key,o=>({...o,show:(i,s)=>{n?.show(i,s)}})),e.set(ag.key,{view:o=>(n=new vE(e,o,r),n)})}}var lg=t=>{throw TypeError(t)},cg=(t,e,r)=>e.has(t)||lg("Cannot "+r),_n=(t,e,r)=>(cg(t,e,"read from private field"),r?r.call(t):e.get(t)),Do=(t,e,r)=>e.has(t)?lg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),yi=(t,e,r,n)=>(cg(t,e,"write to private field"),e.set(t,r),r),l0,c0,u0,o1,d0,Mi,h0;const kl="milkdown-ai-streaming",ME=800,EE="Generating",IE="Esc to cancel",u2=new et("CREPE_AI_STREAMING_INDICATOR");class LE{constructor(e,r,n){Do(this,l0),Do(this,c0),Do(this,u0),Do(this,o1,performance.now()),Do(this,d0,""),Do(this,Mi,0),Do(this,h0,()=>{const c=(performance.now()-_n(this,o1))/ME*360;_n(this,l0).style.transform=`rotate(${c}deg)`,yi(this,Mi,requestAnimationFrame(_n(this,h0)))}),yi(this,u0,r);const o=document.createElement("span");o.className=`${kl}-indicator`,o.contentEditable="false",o.setAttribute("role","status"),o.setAttribute("aria-live","polite");const i=document.createElement("span");i.className=`${kl}-spinner`,i.setAttribute("aria-hidden","true"),o.appendChild(i);const s=document.createElement("span");s.className=`${kl}-label`,o.appendChild(s);const a=document.createElement("span");a.className=`${kl}-esc`,a.textContent=n,o.appendChild(a),this.dom=o,yi(this,l0,i),yi(this,c0,s),this.setLabel(e),_n(this,h0).call(this)}setLabel(e){const n=`${e.get(wt.key).label||_n(this,u0)}…`;n!==_n(this,d0)&&(yi(this,d0,n),_n(this,c0).textContent=n)}destroy(){_n(this,Mi)&&cancelAnimationFrame(_n(this,Mi)),yi(this,Mi,0)}}l0=new WeakMap;c0=new WeakMap;u0=new WeakMap;o1=new WeakMap;d0=new WeakMap;Mi=new WeakMap;h0=new WeakMap;function RE(t={}){var e,r;const{config:n}=t,o=(e=n?.fallbackLabel)!=null?e:EE,i=(r=n?.cancelHint)!=null?r:IE;return Je(s=>{let a=null;function l(){return a?a.setLabel(s):a=new LE(s,o,i),a}function c(){a&&(a.destroy(),a=null)}function u(d,h){const p=Math.min(h,d.content.size),g=Bt.widget(p,l().dom,{side:1,key:"ai-streaming-indicator"});return Dt.create(d,[g])}return new Xe({key:u2,state:{init:()=>Dt.empty,apply(d,h,p,g){const y=ht.getState(g);return!y?.active||y.insertEndPos==null?(c(),Dt.empty):d.getMeta(ht)||d.docChanged?u(g.doc,y.insertEndPos):h.map(d.mapping,d.doc)}},view(){return{destroy(){c()}}},props:{decorations(d){var h;return(h=u2.getState(d))!=null?h:Dt.empty},handleKeyDown(d,h){var p;if(h.key!=="Escape")return!1;const g=s.get(ne);return s.get(wt.key).abortController?(h.preventDefault(),g.call(Y6.key,{keep:!0}),!0):(p=ht.getState(d.state))!=null&&p.active?(h.preventDefault(),g.call(as.key,{keep:!0}),!0):!1}}})})}const OE=["table","image-block","code_block"],d2={heading:["id"]},PE=(t,e)=>{var r,n;const o=(r=e?.diff)!=null?r:{},i=(n=e?.streaming)!=null?n:{};t.config(Er(Ae.AI)).config(s=>{s.update(lc.key,c=>{var u;return{...c,ignoreAttrs:(u=o.ignoreAttrs)!=null?u:d2}});const{ignoreAttrs:a,...l}=o;s.update(uc.key,c=>{var u;return{...c,customBlockTypes:(u=l.customBlockTypes)!=null?u:OE,...l}})}).use(u9).use(A9).config(s=>{s.update(li.key,a=>{var l;return{...a,...i,ignoreAttrs:(l=i.ignoreAttrs)!=null?l:d2,...e?.diffReviewOnEnd!==void 0?{diffReviewOnEnd:e.diffReviewOnEnd}:{}}})}).use(H9).config(s=>{s.update(rs.key,a=>{var l;return{...a,...e?.provider!==void 0?{provider:e.provider}:{},...e?.buildContext!==void 0?{buildContext:e.buildContext}:{},diffReviewOnEnd:(l=e?.diffReviewOnEnd)!=null?l:a.diffReviewOnEnd,...e?.onError!==void 0?{onError:e.onError}:{},...e?.aiIcon!==void 0?{aiIcon:e.aiIcon}:{}}})}).use(rs).use(wt).use(uf).use(Y6).config(TE(e)).use(hf).use(ag).use(RE({config:e?.streamingIndicator})).use(hE({config:e?.diffActions,enterKeyIcon:e?.enterKeyIcon}))};function ug(t){return t.$from.parent.type.name==="code_block"}function dg(t){var e;const r=(e=t.$from.node(t.$from.depth-1))==null?void 0:e.type;return r?.name==="list_item"}var hg=t=>{throw TypeError(t)},fg=(t,e,r)=>e.has(t)||hg("Cannot "+r),Ts=(t,e,r)=>(fg(t,e,"read from private field"),r?r.call(t):e.get(t)),h2=(t,e,r)=>e.has(t)?hg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),DE=(t,e,r,n)=>(fg(t,e,"write to private field"),e.set(t,r),r),Ei,f0;class ff{constructor(){h2(this,Ei,[]),this.clear=()=>(DE(this,Ei,[]),this),h2(this,f0,e=>{const r={group:e,addItem:(n,o)=>{const i={...o,key:n};return e.items.push(i),r},clear:()=>(e.items=[],r)};return r}),this.addGroup=(e,r)=>{const o={key:e,label:r,items:[]};return Ts(this,Ei).push(o),Ts(this,f0).call(this,o)},this.getGroup=e=>{const r=Ts(this,Ei).find(n=>n.key===e);if(!r)throw new Error(`Group with key ${e} not found`);return Ts(this,f0).call(this,r)},this.build=()=>Ts(this,Ei)}}Ei=new WeakMap;f0=new WeakMap;function BE(t,e,r){var n,o,i,s,a,l,c,u,d,h,p,g,y,v,w,C,k,S,E,R,H,O,P,$,ie,N,ye,be,Fe,ke,we,fe,rt,kt,vt,ut,Et,jr,Mo,Ur,Zt,jn,Ht,fi,_,I,B,j,F,W,Q,Y,X,q,ae,ee,se,ue,_e,Le,Ee,We,Ye,rr,nr,Un,ws,Rt,or,xs,Cs,mf,gf,vf,yf,bf,wf,xf,Cf,kf,_f,Sf,Af,Tf,Mf,Ef,If,Lf,Rf,Of,Pf,Df,Bf,zf,Nf,Hf,$f,qf,Ff,Vf,Wf,jf,Uf,Gf,Kf,Zf,Xf,Yf,Jf,Qf,ep,tp,rp,np,op,ip,sp,ap,lp;const pi=r&&bs(r).get(),Lg=pi?.includes(Ae.Latex),Rg=pi?.includes(Ae.ImageBlock),Og=pi?.includes(Ae.Table),ks=new ff;if(e?.textGroup!==null){const ze=ks.addGroup("text",(o=(n=e?.textGroup)==null?void 0:n.label)!=null?o:"Text");((i=e?.textGroup)==null?void 0:i.text)!==null&&ze.addItem("text",{label:(l=(a=(s=e?.textGroup)==null?void 0:s.text)==null?void 0:a.label)!=null?l:"Text",icon:(d=(u=(c=e?.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?d:XM,onRun:le=>{const ce=le.get(ne),Oe=Vi.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe})}}),((h=e?.textGroup)==null?void 0:h.h1)!==null&&ze.addItem("h1",{label:(y=(g=(p=e?.textGroup)==null?void 0:p.h1)==null?void 0:g.label)!=null?y:"Heading 1",icon:(C=(w=(v=e?.textGroup)==null?void 0:v.h1)==null?void 0:w.icon)!=null?C:NM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:1}})}}),((k=e?.textGroup)==null?void 0:k.h2)!==null&&ze.addItem("h2",{label:(R=(E=(S=e?.textGroup)==null?void 0:S.h2)==null?void 0:E.label)!=null?R:"Heading 2",icon:(P=(O=(H=e?.textGroup)==null?void 0:H.h2)==null?void 0:O.icon)!=null?P:HM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:2}})}}),(($=e?.textGroup)==null?void 0:$.h3)!==null&&ze.addItem("h3",{label:(ye=(N=(ie=e?.textGroup)==null?void 0:ie.h3)==null?void 0:N.label)!=null?ye:"Heading 3",icon:(ke=(Fe=(be=e?.textGroup)==null?void 0:be.h3)==null?void 0:Fe.icon)!=null?ke:$M,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:3}})}}),((we=e?.textGroup)==null?void 0:we.h4)!==null&&ze.addItem("h4",{label:(kt=(rt=(fe=e?.textGroup)==null?void 0:fe.h4)==null?void 0:rt.label)!=null?kt:"Heading 4",icon:(Et=(ut=(vt=e?.textGroup)==null?void 0:vt.h4)==null?void 0:ut.icon)!=null?Et:qM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:4}})}}),((jr=e?.textGroup)==null?void 0:jr.h5)!==null&&ze.addItem("h5",{label:(Zt=(Ur=(Mo=e?.textGroup)==null?void 0:Mo.h5)==null?void 0:Ur.label)!=null?Zt:"Heading 5",icon:(fi=(Ht=(jn=e?.textGroup)==null?void 0:jn.h5)==null?void 0:Ht.icon)!=null?fi:FM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:5}})}}),((_=e?.textGroup)==null?void 0:_.h6)!==null&&ze.addItem("h6",{label:(j=(B=(I=e?.textGroup)==null?void 0:I.h6)==null?void 0:B.label)!=null?j:"Heading 6",icon:(Q=(W=(F=e?.textGroup)==null?void 0:F.h6)==null?void 0:W.icon)!=null?Q:VM,onRun:le=>{const ce=le.get(ne),Oe=no.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe,attrs:{level:6}})}}),((Y=e?.textGroup)==null?void 0:Y.quote)!==null&&ze.addItem("quote",{label:(ae=(q=(X=e?.textGroup)==null?void 0:X.quote)==null?void 0:q.label)!=null?ae:"Quote",icon:(ue=(se=(ee=e?.textGroup)==null?void 0:ee.quote)==null?void 0:se.icon)!=null?ue:W6,onRun:le=>{const ce=le.get(ne),Oe=I2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((_e=e?.textGroup)==null?void 0:_e.divider)!==null&&ze.addItem("divider",{label:(We=(Ee=(Le=e?.textGroup)==null?void 0:Le.divider)==null?void 0:Ee.label)!=null?We:"Divider",icon:(nr=(rr=(Ye=e?.textGroup)==null?void 0:Ye.divider)==null?void 0:rr.icon)!=null?nr:H6,onRun:le=>{const ce=le.get(ne),Oe=L2.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe})}})}if(e?.listGroup!==null){const ze=ks.addGroup("list",(ws=(Un=e?.listGroup)==null?void 0:Un.label)!=null?ws:"List");((Rt=e?.listGroup)==null?void 0:Rt.bulletList)!==null&&ze.addItem("bullet-list",{label:(Cs=(xs=(or=e?.listGroup)==null?void 0:or.bulletList)==null?void 0:xs.label)!=null?Cs:"Bullet List",icon:(vf=(gf=(mf=e?.listGroup)==null?void 0:mf.bulletList)==null?void 0:gf.icon)!=null?vf:z6,onRun:le=>{const ce=le.get(ne),Oe=R2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((yf=e?.listGroup)==null?void 0:yf.orderedList)!==null&&ze.addItem("ordered-list",{label:(xf=(wf=(bf=e?.listGroup)==null?void 0:bf.orderedList)==null?void 0:wf.label)!=null?xf:"Ordered List",icon:(_f=(kf=(Cf=e?.listGroup)==null?void 0:Cf.orderedList)==null?void 0:kf.icon)!=null?_f:V6,onRun:le=>{const ce=le.get(ne),Oe=O2.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe})}}),((Sf=e?.listGroup)==null?void 0:Sf.taskList)!==null&&ze.addItem("task-list",{label:(Mf=(Tf=(Af=e?.listGroup)==null?void 0:Af.taskList)==null?void 0:Tf.label)!=null?Mf:"Task List",icon:(Lf=(If=(Ef=e?.listGroup)==null?void 0:Ef.taskList)==null?void 0:If.icon)!=null?Lf:K6,onRun:le=>{const ce=le.get(ne),Oe=Pa.type(le);ce.call(Ot.key),ce.call(co.key,{nodeType:Oe,attrs:{checked:!1}})}})}if(e?.advancedGroup!==null){const ze=ks.addGroup("advanced",(Of=(Rf=e?.advancedGroup)==null?void 0:Rf.label)!=null?Of:"Advanced");((Pf=e?.advancedGroup)==null?void 0:Pf.image)!==null&&Rg&&ze.addItem("image",{label:(zf=(Bf=(Df=e?.advancedGroup)==null?void 0:Df.image)==null?void 0:Bf.label)!=null?zf:"Image",icon:($f=(Hf=(Nf=e?.advancedGroup)==null?void 0:Nf.image)==null?void 0:Hf.icon)!=null?$f:Q0,onRun:le=>{const ce=le.get(ne),Oe=ja.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe})}}),((qf=e?.advancedGroup)==null?void 0:qf.codeBlock)!==null&&ze.addItem("code",{label:(Wf=(Vf=(Ff=e?.advancedGroup)==null?void 0:Ff.codeBlock)==null?void 0:Vf.label)!=null?Wf:"Code",icon:(Gf=(Uf=(jf=e?.advancedGroup)==null?void 0:jf.codeBlock)==null?void 0:Uf.icon)!=null?Gf:lf,onRun:le=>{const ce=le.get(ne),Oe=ti.type(le);ce.call(Ot.key),ce.call(Or.key,{nodeType:Oe})}}),((Kf=e?.advancedGroup)==null?void 0:Kf.table)!==null&&Og&&ze.addItem("table",{label:(Yf=(Xf=(Zf=e?.advancedGroup)==null?void 0:Zf.table)==null?void 0:Xf.label)!=null?Yf:"Table",icon:(ep=(Qf=(Jf=e?.advancedGroup)==null?void 0:Jf.table)==null?void 0:Qf.icon)!=null?ep:G6,onRun:le=>{const ce=le.get(ne),Oe=le.get($e);ce.call(Ot.key);const{from:Pg}=Oe.state.selection;ce.call(uo.key,{nodeType:Bc(le,3,3)}),ce.call(P2.key,{pos:Pg})}}),((tp=e?.advancedGroup)==null?void 0:tp.math)!==null&&Lg&&ze.addItem("math",{label:(op=(np=(rp=e?.advancedGroup)==null?void 0:rp.math)==null?void 0:np.label)!=null?op:"Math",icon:(ap=(sp=(ip=e?.advancedGroup)==null?void 0:ip.math)==null?void 0:sp.icon)!=null?ap:cf,onRun:le=>{const ce=le.get(ne),Oe=ti.type(le);ce.call(Ot.key),ce.call(uo.key,{nodeType:Oe,attrs:{language:"LaTeX"}})}})}(lp=e?.buildMenu)==null||lp.call(e,ks);let _s=ks.build();t&&(_s=_s.map(ze=>{const le=ze.items.filter(ce=>ce.label.toLowerCase().includes(t.toLowerCase()));return{...ze,items:le}}).filter(ze=>ze.items.length>0));const cp=_s.flatMap(ze=>ze.items);return cp.forEach((ze,le)=>{Object.assign(ze,{index:le})}),_s.reduce((ze,le)=>{const ce=ze+le.items.length;return Object.assign(le,{range:[ze,ce]}),ce},0),{groups:_s,size:cp.length}}To(M);const zE=Ct({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:t,show:e,filter:r,hide:n,config:o}){const i=re(),s=dr(()=>BE(r.value,o,t)),a=re(0),l=re({x:-999,y:-999}),c=y=>{const{x:v,y:w}=y;l.value={x:v,y:w}};Bn([s,e],()=>{const{size:y}=s.value;y===0&&e.value?n():a.value>=y&&(a.value=0)});const u=(y,v)=>{const w=a.value,C=typeof y=="function"?y(w):y;v?.(C),a.value=C},d=y=>{var v,w;const C=(v=i.value)==null?void 0:v.querySelector(`[data-index="${y}"]`),k=(w=i.value)==null?void 0:w.querySelector(".menu-groups");!C||!k||(k.scrollTop=C.offsetTop-k.offsetTop)},h=y=>{const v=s.value.groups.flatMap(w=>w.items).at(y);v?.onRun&&t&&v.onRun(t),n()},p=y=>{const{size:v,groups:w}=s.value;if(y.key==="Escape"){y.preventDefault(),n?.();return}if(y.key==="ArrowDown")return y.preventDefault(),u(C=>C<v-1?C+1:C,d);if(y.key==="ArrowUp")return y.preventDefault(),u(C=>C<=0?C:C-1,d);if(y.key==="ArrowLeft")return y.preventDefault(),u(C=>{const k=w.find(E=>E.range[0]<=C&&E.range[1]>C);if(!k)return C;const S=w[w.indexOf(k)-1];return S?S.range[1]-1:C},d);if(y.key==="ArrowRight")return y.preventDefault(),u(C=>{const k=w.find(E=>E.range[0]<=C&&E.range[1]>C);if(!k)return C;const S=w[w.indexOf(k)+1];return S?S.range[0]:C},d);y.key==="Enter"&&(y.preventDefault(),h(a.value))},g=y=>v=>{const w=l.value;if(!w)return;const{x:C,y:k}=v;C===w.x&&k===w.y||u(y)};return cs(()=>{e.value?window.addEventListener("keydown",p,{capture:!0}):window.removeEventListener("keydown",p,{capture:!0})}),ds(()=>{window.removeEventListener("keydown",p,{capture:!0})}),()=>M("div",{ref:i,onPointerdown:y=>y.preventDefault()},M("nav",{class:"tab-group"},M("ul",null,s.value.groups.map(y=>M("li",{key:y.key,onPointerdown:()=>u(y.range[0],d),class:a.value>=y.range[0]&&a.value<y.range[1]?"selected":""},y.label)))),M("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(y=>M("div",{key:y.key,class:"menu-group"},M("h6",null,y.label),M("ul",null,y.items.map(v=>M("li",{key:v.key,"data-index":v.index,class:a.value===v.index?"hover":"",onPointerenter:g(v.index),onPointerdown:()=>{var w,C;(C=(w=i.value)==null?void 0:w.querySelector(`[data-index="${v.index}"]`))==null||C.classList.add("active")},onPointerup:()=>{var w,C;(C=(w=i.value)==null?void 0:w.querySelector(`[data-index="${v.index}"]`))==null||C.classList.remove("active"),h(v.index)}},M(Ft,{icon:v.icon}),M("span",null,v.label))))))))}});var pg=t=>{throw TypeError(t)},mg=(t,e,r)=>e.has(t)||pg("Cannot "+r),Ir=(t,e,r)=>(mg(t,e,"read from private field"),r?r.call(t):e.get(t)),Ms=(t,e,r)=>e.has(t)?pg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bo=(t,e,r,n)=>(mg(t,e,"write to private field"),e.set(t,r),r),Gs,p0,m0,Tn,Ii;const gg=lx("CREPE_MENU"),pf=Ve({show:()=>{},hide:()=>{}},"menuAPICtx");function NE(t,e){t.set(gg.key,{view:r=>new HE(t,r,e)})}class HE{constructor(e,r,n){Ms(this,Gs),Ms(this,p0),Ms(this,m0),Ms(this,Tn),Ms(this,Ii,null),this.update=p=>{Ir(this,Tn).update(p)},this.show=p=>{Bo(this,Ii,p),Ir(this,m0).value="",Ir(this,Tn).show()},this.hide=()=>{Bo(this,Ii,null),Ir(this,Tn).hide()},this.destroy=()=>{Ir(this,Tn).destroy(),Ir(this,p0).unmount(),Ir(this,Gs).remove()};var o,i;const s=document.createElement("div");s.classList.add("milkdown-slash-menu");const a=re(!1),l=re("");Bo(this,m0,l);const c=this.hide,u=gr(zE,{ctx:e,config:n,show:a,filter:l,hide:c});Bo(this,p0,u),u.mount(s),Bo(this,Gs,s);const d=this,h=(o=n?.slashMenu)!=null?o:{};Bo(this,Tn,new cx({content:Ir(this,Gs),debounce:20,shouldShow(p){if(ug(p.state.selection)||dg(p.state.selection))return!1;const g=this.getContent(p,v=>["paragraph","heading"].includes(v.type.name));if(g==null||!$E(p.state.selection))return!1;const y=Ir(d,Ii);if(l.value=g.startsWith("/")?g.slice(1):g,typeof y=="number"){const v=p.state.doc.nodeSize-2,w=Math.min(y,v);return p.state.doc.resolve(w).node()!==p.state.doc.resolve(p.state.selection.from).node()?(Bo(d,Ii,null),!1):!0}return!!g.startsWith("/")},offset:(i=h.offset)!=null?i:10,middleware:h.middleware,floatingUIOptions:h.floatingUIOptions,root:h.root})),Ir(this,Tn).onShow=()=>{a.value=!0},Ir(this,Tn).onHide=()=>{a.value=!1},this.update(r),e.set(pf.key,{show:p=>this.show(p),hide:()=>this.hide()})}}Gs=new WeakMap;p0=new WeakMap;m0=new WeakMap;Tn=new WeakMap;Ii=new WeakMap;function $E(t){if(!(t instanceof Ce))return!1;const{$head:e}=t,r=e.parent;return e.parentOffset===r.content.size}To(M,Ie);const qE=Ct({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(t){const e=re();return()=>M(Ie,null,M("div",{ref:e,class:"operation-item",onPointerdown:r=>{var n;r.preventDefault(),r.stopPropagation(),(n=e.value)==null||n.classList.add("active")},onPointerup:r=>{var n;r.preventDefault(),r.stopPropagation(),(n=e.value)==null||n.classList.remove("active"),t.onAdd()}},M(Ft,{icon:t.addIcon})),M("div",{class:"operation-item"},M(Ft,{icon:t.handleIcon})))}});var vg=t=>{throw TypeError(t)},yg=(t,e,r)=>e.has(t)||vg("Cannot "+r),zo=(t,e,r)=>(yg(t,e,"read from private field"),r?r.call(t):e.get(t)),_l=(t,e,r)=>e.has(t)?vg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Sl=(t,e,r,n)=>(yg(t,e,"write to private field"),e.set(t,r),r),g0,Fo,v0,y0;class FE{constructor(e,r){_l(this,g0),_l(this,Fo),_l(this,v0),_l(this,y0),this.update=()=>{zo(this,Fo).update()},this.destroy=()=>{zo(this,Fo).destroy(),zo(this,g0).remove(),zo(this,v0).unmount()},this.onAdd=()=>{const d=zo(this,y0),h=d.get($e);h.hasFocus()||h.focus();const{state:p,dispatch:g}=h,y=zo(this,Fo).active;if(!y)return;const w=y.$pos.pos+y.node.nodeSize;let C=p.tr.insert(w,Vi.type(d).create());C=C.setSelection(Ce.near(C.doc.resolve(w))),g(C.scrollIntoView()),zo(this,Fo).hide(),d.get(pf.key).show(C.selection.from)};var n,o,i,s,a;Sl(this,y0,e);const l=document.createElement("div");l.classList.add("milkdown-block-handle");const c=gr(qE,{onAdd:this.onAdd,addIcon:(n=r?.handleAddIcon)!=null?n:Yd,handleIcon:(o=r?.handleDragIcon)!=null?o:jM});c.mount(l),Sl(this,v0,c),Sl(this,g0,l);const u=(i=r?.blockHandle)!=null?i:{};Sl(this,Fo,new ax({ctx:e,content:l,getOffset:(s=u.getOffset)!=null?s:(()=>16),getPlacement:(a=u.getPlacement)!=null?a:(({active:d,blockDom:h})=>{if(d.node.type.name==="heading")return"left";let p=0;d.node.descendants(R=>{p+=R.childCount});const g=d.el,y=g.getBoundingClientRect(),v=h.getBoundingClientRect(),w=window.getComputedStyle(g),C=Number.parseInt(w.paddingTop,10)||0,k=Number.parseInt(w.paddingBottom,10)||0,S=y.height-C-k,E=v.height;return p>2||E<S?"left-start":"left"}),shouldShow:u.shouldShow,getPosition:u.getPosition,middleware:u.middleware,floatingUIOptions:u.floatingUIOptions,root:u.root})),this.update()}}g0=new WeakMap;Fo=new WeakMap;v0=new WeakMap;y0=new WeakMap;function VE(t,e){t.set(Mc.key,{filterNodes:r=>!Pn(o=>["table","blockquote","math_inline"].includes(o.type.name))(r)}),t.set(Lc.key,{view:()=>new FE(t,e)})}const WE=(t,e)=>{t.config(Er(Ae.BlockEdit)).config(r=>VE(r,e)).config(r=>NE(r,e)).use(pf).use(Lc).use(gg)},f2=oc([],"CodeMirrorThemeCtx"),jE=(t,e={})=>{t.config(Er(Ae.CodeMirror)).config(r=>{const{languages:n=[],theme:o=[]}=e,i=p1.of(T2.concat($v)),s=a=>{var l;return[i,h_,a,...(l=e.extensions)!=null?l:[]]};r.inject(f2,o),r.use(f2).on(a=>{r.update(Zi.key,l=>({...l,extensions:s(a)}))}),r.update(Zi.key,a=>{var l;return{extensions:s(o),languages:n,expandIcon:e.expandIcon||sf,searchIcon:e.searchIcon||j6,clearSearchIcon:e.clearSearchIcon||af,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||N6,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||a.renderLanguage,renderPreview:e.renderPreview||a.renderPreview,previewToggleButton:c=>{var u,d;const h=((u=e.previewToggleIcon)==null?void 0:u.call(e,c))||(c?La:Z6),p=((d=e.previewToggleText)==null?void 0:d.call(e,c))||(c?"Edit":"Hide");return[h,p].map(g=>g.trim()).join(" ")},previewLabel:e.previewLabel||a.previewLabel,previewLoading:e.previewLoading||a.previewLoading,previewOnlyByDefault:(l=e.previewOnlyByDefault)!=null?l:a.previewOnlyByDefault}})}).use(Ck)},UE=(t,e)=>{if(t.config(Er(Ae.Cursor)).config(n=>{n.update(zc.key,()=>{var o,i;return{class:"crepe-drop-cursor",width:(o=e?.width)!=null?o:4,color:(i=e?.color)!=null?i:!1}})}).use(L_),e?.virtual===!1)return;const r=R_({skipWarning:["inlineCode"]});t.use(Je(()=>r))},GE=(t,e)=>{t.config(Er(Ae.ImageBlock)).config(r=>{r.update(Nc.key,n=>{var o,i,s,a,l,c;return{uploadButton:(o=e?.inlineUploadButton)!=null?o:"Upload",imageIcon:(i=e?.inlineImageIcon)!=null?i:Q0,confirmButton:(s=e?.inlineConfirmButton)!=null?s:tu,uploadPlaceholderText:(a=e?.inlineUploadPlaceholderText)!=null?a:"or paste link",onUpload:(c=(l=e?.inlineOnUpload)!=null?l:e?.onUpload)!=null?c:n.onUpload,proxyDomURL:e?.proxyDomURL}}),r.update(Wa.key,n=>{var o,i,s,a,l,c,u,d,h;return{uploadButton:(o=e?.blockUploadButton)!=null?o:"Upload file",imageIcon:(i=e?.blockImageIcon)!=null?i:Q0,captionIcon:(s=e?.blockCaptionIcon)!=null?s:LM,confirmButton:(a=e?.blockConfirmButton)!=null?a:"Confirm",captionPlaceholderText:(l=e?.blockCaptionPlaceholderText)!=null?l:"Write Image Caption",uploadPlaceholderText:(c=e?.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(d=(u=e?.blockOnUpload)!=null?u:e?.onUpload)!=null?d:n.onUpload,proxyDomURL:e?.proxyDomURL,onImageLoadError:(h=e?.onImageLoadError)!=null?h:n.onImageLoadError,maxWidth:e?.maxWidth,maxHeight:e?.maxHeight}})}).use(Ix).use(U_)},KE=ti.extendSchema(t=>e=>{const r=t(e);return{...r,toMarkdown:{match:r.toMarkdown.match,runner:(n,o)=>{var i,s;if(((i=o.attrs.language)!=null?i:"").toLowerCase()==="latex")n.addNode("math",void 0,((s=o.content.firstChild)==null?void 0:s.text)||"");else return r.toMarkdown.runner(n,o)}}}}),Pi="math_inline",ZE="ToggleLatex",tc=Wr(Pi,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${Pi}"]`,getAttrs:t=>{var e;return{value:(e=t.dataset.value)!=null?e:""}}}],toDOM:t=>{const e=t.attrs.value,r=document.createElement("span");return r.dataset.type=Pi,r.dataset.value=e,c6.render(e,r,{throwOnError:!1}),r},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,r)=>{t.addNode(r,{value:e.value})}},toMarkdown:{match:t=>t.type.name===Pi,runner:(t,e)=>{t.addNode("inlineMath",void 0,e.attrs.value)}}})),XE=Me("ToggleLatex",t=>()=>(e,r)=>{const{hasNode:n,pos:o,target:i}=Wv(e,tc.type(t)),{selection:s,doc:a,tr:l}=e;if(!n){const p=a.textBetween(s.from,s.to);let g=l.replaceSelectionWith(tc.type(t).create({value:p}));return r&&r(g.setSelection(qr.create(g.doc,s.from))),!0}const{from:c,to:u}=s;if(!i||o<0)return!1;let d=l.delete(o,o+1);const h=i.attrs.value;return d=d.insertText(h,o),r&&r(d.setSelection(Ce.create(d.doc,c,u+h.length-1))),!0}),p2=za("INLINE_LATEX");To(M);const YE=Ct({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(t){const e=n=>{if(!(!n||!(n instanceof HTMLElement))){for(;n.firstChild;)n.removeChild(n.firstChild);t.innerView.value&&n.appendChild(t.innerView.value.dom)}},r=n=>{n.preventDefault(),t.updateValue.value()};return()=>M("div",{class:"container"},t.innerView.value&&M("div",{ref:e}),M("button",{type:"button",onPointerdown:r},M(Ft,{icon:t.config.inlineEditConfirm})))}});var bg=t=>{throw TypeError(t)},wg=(t,e,r)=>e.has(t)||bg("Cannot "+r),_t=(t,e,r)=>(wg(t,e,"read from private field"),r?r.call(t):e.get(t)),Yn=(t,e,r)=>e.has(t)?bg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Al=(t,e,r,n)=>(wg(t,e,"write to private field"),e.set(t,r),r),Ks,Li,b0,Vo,Zs,Xs,i1,s1;class JE{constructor(e,r,n){this.ctx=e,Yn(this,Ks),Yn(this,Li),Yn(this,b0),Yn(this,Vo,P0(null)),Yn(this,Zs,P0(()=>{})),Yn(this,Xs),Yn(this,i1,()=>{_t(this,Vo).value&&(_t(this,Vo).value.destroy(),_t(this,Vo).value=null)}),Yn(this,s1,i=>{const a=(()=>{if(!i.editable)return!1;const{selection:l,schema:c}=i.state;if(l.empty||!(l instanceof qr))return!1;const u=l.node;if(u.type.name!==Pi)return!1;const d=l.from,h=c.nodes.paragraph.create(null,c.text(u.attrs.value)),p=new jv(_t(this,b0),{state:Uv.create({doc:h,schema:new Gv({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[Kv({"Mod-z":ic,"Mod-Z":Wi,"Mod-y":Wi,Enter:()=>(_t(this,Zs).value(),!0)})]})});return _t(this,Vo).value=p,_t(this,Zs).value=()=>{const{tr:g}=i.state;g.setNodeAttribute(d,"value",p.state.doc.textContent),i.dispatch(g),requestAnimationFrame(()=>{i.focus()})},!0})();return a||_t(this,i1).call(this),a}),this.update=(i,s)=>{_t(this,Li).update(i,s)},this.destroy=()=>{_t(this,Xs).unmount(),_t(this,Li).destroy(),_t(this,Ks).remove()};const o=document.createElement("div");o.className="milkdown-latex-inline-edit",Al(this,Ks,o),Al(this,Xs,gr(YE,{config:n,innerView:_t(this,Vo),updateValue:_t(this,Zs)})),_t(this,Xs).mount(o),Al(this,Li,new Ba({debounce:0,content:_t(this,Ks),shouldShow:_t(this,s1),offset:10,floatingUIOptions:{placement:"bottom"}})),_t(this,Li).update(r),Al(this,b0,document.createElement("div"))}}Ks=new WeakMap;Li=new WeakMap;b0=new WeakMap;Vo=new WeakMap;Zs=new WeakMap;Xs=new WeakMap;i1=new WeakMap;s1=new WeakMap;const QE=/\$([^\s$](?:[^$]*[^\s$])?)\$$/,eI=is(t=>qv(QE,tc.type(t),{getAttr:e=>{var r;return{value:(r=e[1])!=null?r:""}}})),tI=is(t=>Fv(/^\$\$[\s\n]$/,ti.type(t),()=>({language:"LaTeX"}))),rI=os("remarkMath",()=>q2);function nI(t){return w1(t,"math",(e,r,n)=>{const{value:o}=e,i={type:"code",lang:"LaTeX",value:o};n.children.splice(r,1,i)})}const oI=os("remarkMathBlock",()=>()=>nI);function iI(t,e){const r=typeof e.value=="string"?e.value:void 0;r&&w1(t,"inlineMath",(n,o,i)=>{var s,a,l;const c=(s=n.position)==null?void 0:s.start.offset,u=(a=n.position)==null?void 0:a.end.offset;if(c==null||u==null||r[c+1]==="$")return;const d=r.slice(c,u);!/^\$\s/.test(d)&&!/\s\$$/.test(d)&&!/\d/.test((l=r[u])!=null?l:"")||i.children.splice(o,1,{type:"text",value:d})})}const sI=os("remarkInlineMathGuard",()=>()=>iI),aI=(t,e)=>{t.config(Er(Ae.Latex)).config(r=>{if(!bs(r).get().includes(Ae.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");r.update(Zi.key,i=>({...i,renderPreview:(s,a,l)=>{if(s.toLowerCase()==="latex"&&a.length>0)return lI(a,e?.katexOptions);const c=i.renderPreview;return c(s,a,l)}})),r.set(p2.key,{view:i=>{var s;return new JE(r,i,{inlineEditConfirm:(s=e?.inlineEditConfirm)!=null?s:tu,...e})}})}).use(rI).use(oI).use(sI).use(tc).use(p2).use(eI).use(tI).use(KE).use(XE)};function lI(t,e){return c6.renderToString(t,{...e,throwOnError:!1,displayMode:!0})}const cI=(t,e)=>{t.config(Er(Ae.LinkTooltip)).config(PT).config(r=>{r.update(ts.key,n=>{var o,i,s,a,l,c;return{...n,linkIcon:(o=e?.linkIcon)!=null?o:N6,editButton:(i=e?.editButton)!=null?i:La,removeButton:(s=e?.removeButton)!=null?s:Jd,confirmButton:(a=e?.confirmButton)!=null?a:tu,inputPlaceholder:(l=e?.inputPlaceholder)!=null?l:"Paste link...",onCopyLink:(c=e?.onCopyLink)!=null?c:(()=>{})}})}).use(DT)};function uI(t,e){t.set(Yc.key,{renderLabel:({label:r,listType:n,checked:o})=>{var i,s,a;return o==null?n==="bullet"?(i=e?.bulletIcon)!=null?i:IM:r:o?(s=e?.checkBoxCheckedIcon)!=null?s:RM:(a=e?.checkBoxUncheckedIcon)!=null?a:OM}})}const dI=(t,e)=>{t.config(Er(Ae.ListItem)).config(r=>uI(r,e)).use(VT)};function hI(t){var e;return t.childCount<=1&&!((e=t.firstChild)!=null&&e.content.size)}function fI(t,e){const{selection:r}=t;if(!r.empty)return null;const n=r.$anchor,o=n.parent;if(o.content.size>0||Pn(a=>a.type.name==="table")(n))return null;const s=n.before();return Bt.node(s,s+o.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const a1=Ve({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),pI=Je(t=>new Xe({key:new et("CREPE_PLACEHOLDER"),props:{decorations:e=>{var r;if(eE(t).readonly)return null;const o=t.get(a1.key);if(o.mode==="doc"&&!hI(e.doc)||ug(e.selection)||dg(e.selection))return null;const i=(r=o.text)!=null?r:"Please enter...",s=fI(e,i);return s?Dt.create(e.doc,[s]):null}}})),mI=(t,e)=>{t.config(Er(Ae.Placeholder)).config(r=>{e&&r.update(a1.key,n=>({...n,...e}))}).use(pI).use(a1)},gI=(t,e)=>{t.config(Er(Ae.Table)).config(r=>{r.update(Jc.key,n=>({...n,renderButton:o=>{var i,s,a,l,c,u,d,h,p;switch(o){case"add_row":return(i=e?.addRowIcon)!=null?i:Yd;case"add_col":return(s=e?.addColIcon)!=null?s:Yd;case"delete_row":return(a=e?.deleteRowIcon)!=null?a:Jd;case"delete_col":return(l=e?.deleteColIcon)!=null?l:Jd;case"align_col_left":return(c=e?.alignLeftIcon)!=null?c:MM;case"align_col_center":return(u=e?.alignCenterIcon)!=null?u:TM;case"align_col_right":return(d=e?.alignRightIcon)!=null?d:EM;case"col_drag_handle":return(h=e?.colDragHandleIcon)!=null?h:i2;case"row_drag_handle":return(p=e?.rowDragHandleIcon)!=null?p:i2}}}))}).use(gM)};function Tl(t,e){return{slice:t,entry:e}}function vI(t){if(t===" "||t.toLowerCase()==="space")return{display:"Space",aria:" "};if(t.length===1){const e=t.toUpperCase();return{display:e,aria:e}}return{display:t,aria:t}}function yI(t,e){var r;const n=t.split(/-(?!$)/),o=(r=n[n.length-1])!=null?r:"",i=n.slice(0,-1);let s=!1,a=!1,l=!1,c=!1;for(const p of i)switch(p.toLowerCase()){case"mod":e?s=!0:a=!0;break;case"meta":case"cmd":case"m":s=!0;break;case"ctrl":case"control":case"c":a=!0;break;case"alt":case"option":case"a":l=!0;break;case"shift":case"s":c=!0;break}const u=vI(o),d=e?[a&&"⌃",l&&"⌥",c&&"⇧",s&&"⌘",u.display].filter(Boolean).join(""):[a&&"Ctrl",l&&"Alt",c&&"Shift",s&&"Meta",u.display].filter(Boolean).join("+"),h=[s&&"Meta",a&&"Control",l&&"Alt",c&&"Shift",u.aria].filter(Boolean).join("+");return{display:d,aria:h}}function bI(t,e){if(!t.isInjected(e.slice))return;const r=t.get(e.slice)[e.entry],n=r?[r.shortcuts].flat()[0]:void 0;if(n)return yI(n,Ls.mac)}function wI(t,e){var r,n,o,i,s,a,l,c,u,d,h,p,g,y,v,w,C,k;const S=new ff;S.addGroup("formatting","Formatting").addItem("bold",{icon:(r=t?.boldIcon)!=null?r:B6,label:(n=t?.boldLabel)!=null?n:"Bold",keymap:Tl(Xv.key,"ToggleBold"),active:P=>P.get(ne).call(bi.key,B2.type(P)),onRun:P=>{P.get(ne).call(D2.key)}}).addItem("italic",{icon:(o=t?.italicIcon)!=null?o:q6,label:(i=t?.italicLabel)!=null?i:"Italic",keymap:Tl(Yv.key,"ToggleEmphasis"),active:P=>P.get(ne).call(bi.key,N2.type(P)),onRun:P=>{P.get(ne).call(z2.key)}}).addItem("strikethrough",{icon:(s=t?.strikethroughIcon)!=null?s:U6,label:(a=t?.strikethroughLabel)!=null?a:"Strikethrough",keymap:Tl(Dc.key,"ToggleStrikethrough"),active:P=>P.get(ne).call(bi.key,ui.type(P)),onRun:P=>{P.get(ne).call(Ua.key)}});const E=S.addGroup("function","Function");E.addItem("code",{icon:(l=t?.codeIcon)!=null?l:lf,label:(c=t?.codeLabel)!=null?c:"Inline code",keymap:Tl(Jv.key,"ToggleInlineCode"),active:P=>P.get(ne).call(bi.key,Gu.type(P)),onRun:P=>{P.get(ne).call(H2.key)}});const R=e&&bs(e).get();if(R?.includes(Ae.Latex)&&E.addItem("latex",{icon:(u=t?.latexIcon)!=null?u:cf,label:(d=t?.latexLabel)!=null?d:"Inline math",active:P=>{const $=P.get(ne),ie=P.get(y1).nodes[Pi];return $.call(Qv.key,ie)},onRun:P=>{P.get(ne).call(ZE)}}),E.addItem("link",{icon:(h=t?.linkIcon)!=null?h:F6,label:(p=t?.linkLabel)!=null?p:"Link",active:P=>P.get(ne).call(bi.key,mo.type(P)),onRun:P=>{P.get(ne).call(Zh.key)}}),e&&R?.includes(Ae.AI)){const P=e.get(rs.key);P.provider&&E.addItem("ai",{icon:(y=(g=t?.aiIcon)!=null?g:P.aiIcon)!=null?y:of,label:(v=t?.aiLabel)!=null?v:"Ask AI",active:()=>!1,onRun:$=>{const ie=$.get(hf.key),N=$.get($e),{from:ye,to:be}=N.state.selection;ie.show(ye,be)}})}(w=t?.buildToolbar)==null||w.call(t,S);const O=S.build();if(e)for(const P of O)for(const $ of P.items){if(!$.keymap)continue;const ie=bI(e,$.keymap);ie&&((C=$.shortcut)!=null||($.shortcut=ie.display),(k=$.ariaKeyshortcuts)!=null||($.ariaKeyshortcuts=ie.aria))}return O}To(M,Ie);const xI=Ct({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:r}=t,n=a=>l=>{l.preventDefault(),e&&a?.(e)};function o(a){return To(t.selection.value),e.get(E2).status!==k0.Created?!1:a(e)}const i=dr(()=>wI(r,e));function s(a){if(a.label)return a.shortcut?`${a.label} (${a.shortcut})`:a.label}return()=>M(Ie,null,i.value.map(a=>a.items.map(l=>M("button",{type:"button",class:Mt("toolbar-item",e&&o(l.active)&&"active"),"data-toolbar-item":l.key,title:s(l),"aria-label":l.label,"aria-keyshortcuts":l.ariaKeyshortcuts,onPointerdown:n(l.onRun)},M(Ft,{icon:l.icon})))).reduce((a,l,c)=>(c===0?a.push(...l):a.push(M("div",{class:"divider"}),...l),a),[]))}});var xg=t=>{throw TypeError(t)},Cg=(t,e,r)=>e.has(t)||xg("Cannot "+r),sr=(t,e,r)=>(Cg(t,e,"read from private field"),r?r.call(t):e.get(t)),Es=(t,e,r)=>e.has(t)?xg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ml=(t,e,r,n)=>(Cg(t,e,"write to private field"),e.set(t,r),r),ro,Ys,w0,Js,Qs;const m2=za("CREPE_TOOLBAR");class CI{constructor(e,r,n){Es(this,ro),Es(this,Ys),Es(this,w0),Es(this,Js),Es(this,Qs,re(!1)),this.update=(s,a)=>{sr(this,ro).update(s,a),sr(this,Js).value=s.state.selection},this.destroy=()=>{sr(this,ro).destroy(),sr(this,w0).unmount(),sr(this,Ys).remove()},this.hide=()=>{sr(this,ro).hide()};const o=document.createElement("div");o.className="milkdown-toolbar",Ml(this,Js,P0(r.state.selection));const i=gr(xI,{ctx:e,hide:this.hide,config:n,selection:sr(this,Js),show:sr(this,Qs)});i.mount(o),Ml(this,Ys,o),Ml(this,w0,i),Ml(this,ro,new Ba({content:sr(this,Ys),debounce:20,offset:10,shouldShow(s){const{doc:a,selection:l}=s.state,{empty:c,from:u,to:d}=l,h=!a.textBetween(u,d).length&&l instanceof Ce,p=!(l instanceof Ce),g=s.dom.getRootNode().activeElement,y=o.contains(g),v=!s.hasFocus()&&!y,w=!s.editable;return!(v||p||c||h||w)}})),sr(this,ro).onShow=()=>{sr(this,Qs).value=!0},sr(this,ro).onHide=()=>{sr(this,Qs).value=!1},this.update(r)}}ro=new WeakMap;Ys=new WeakMap;w0=new WeakMap;Js=new WeakMap;Qs=new WeakMap;const kI=(t,e)=>{t.config(Er(Ae.Toolbar)).config(r=>{r.set(m2.key,{view:n=>new CI(r,n,e)})}).use(m2)},kg=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function _I(t,e){var r,n;const o=e??kg,i=t.get($e),{$from:s}=i.state.selection,a=s.parent,l=(r=o.find(c=>c.level===null))!=null?r:o[0];if(a.type===no.type(t)){const c=a.attrs.level;return(n=o.find(u=>u.level===c))!=null?n:l}return l}function SI(t,e){const r=t.get(ne);if(e==null){const n=Vi.type(t);r.call(Or.key,{nodeType:n})}else{const n=no.type(t);r.call(Or.key,{nodeType:n,attrs:{level:e}})}}function No(t,e){if(t.get(ne).call(bi.key,e))return!0;const o=t.get($e),{state:i}=o;if(i.storedMarks)return i.storedMarks.some(s=>s.type===e);if(i.selection instanceof Ce){const{$cursor:s}=i.selection;if(s)return s.marks().some(a=>a.type===e)}return!1}function AI(t,e){const r=t??kg;return{icon:"",active:()=>!1,selector:{chevronIcon:e??sf,activeLabel:n=>_I(n,r).label,options:r.map(n=>({label:n.label,onSelect:o=>SI(o,n.level)}))}}}function TI(t,e){var r,n,o,i,s,a,l,c,u,d,h,p,g,y,v;const w=e&&bs(e).get(),C=w?.includes(Ae.Latex),k=w?.includes(Ae.ImageBlock),S=w?.includes(Ae.Table),E=new ff;E.addGroup("heading","Heading").addItem("heading-selector",{...AI(t?.headingOptions,t?.chevronDownIcon)}),E.addGroup("formatting","Formatting").addItem("bold",{icon:(r=t?.boldIcon)!=null?r:B6,active:O=>No(O,B2.type(O)),onRun:O=>{O.get(ne).call(D2.key)}}).addItem("italic",{icon:(n=t?.italicIcon)!=null?n:q6,active:O=>No(O,N2.type(O)),onRun:O=>{O.get(ne).call(z2.key)}}).addItem("strikethrough",{icon:(o=t?.strikethroughIcon)!=null?o:U6,active:O=>No(O,ui.type(O)),onRun:O=>{O.get(ne).call(Ua.key)}}).addItem("code",{icon:(i=t?.codeIcon)!=null?i:lf,active:O=>No(O,Gu.type(O)),onRun:O=>{const P=O.get($e),{state:$}=P;if($.selection.empty){const ie=Gu.type(O);No(O,ie)?P.dispatch($.tr.removeStoredMark(ie)):P.dispatch($.tr.addStoredMark(ie.create()))}else O.get(ne).call(H2.key)}}),E.addGroup("list","List").addItem("bullet-list",{icon:(s=t?.bulletListIcon)!=null?s:z6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=R2.type(O);P.call(co.key,{nodeType:$})}}).addItem("ordered-list",{icon:(a=t?.orderedListIcon)!=null?a:V6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=O2.type(O);P.call(co.key,{nodeType:$})}}).addItem("task-list",{icon:(l=t?.taskListIcon)!=null?l:K6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=Pa.type(O);P.call(co.key,{nodeType:$,attrs:{checked:!1}})}});const R=E.addGroup("insert","Insert");R.addItem("link",{icon:(c=t?.linkIcon)!=null?c:F6,active:O=>No(O,mo.type(O)),onRun:O=>{const P=O.get($e),{state:$}=P,ie=mo.type(O);if($.selection.empty&&No(O,ie)){P.dispatch($.tr.removeStoredMark(ie));return}O.get(ne).call(Zh.key)}}),k&&R.addItem("image",{icon:(u=t?.imageIcon)!=null?u:Q0,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ja.type(O);P.call(uo.key,{nodeType:$})}}),S&&R.addItem("table",{icon:(d=t?.tableIcon)!=null?d:G6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=O.get($e),{from:ie}=$.state.selection;P.call(uo.key,{nodeType:Bc(O,3,3)}),P.call(P2.key,{pos:ie})}});const H=E.addGroup("block","Block");return H.addItem("code-block",{icon:(h=t?.codeBlockIcon)!=null?h:BM,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ti.type(O);P.call(Or.key,{nodeType:$})}}),C&&H.addItem("math",{icon:(p=t?.mathIcon)!=null?p:cf,active:()=>!1,onRun:O=>{const P=O.get(ne),$=ti.type(O);P.call(uo.key,{nodeType:$,attrs:{language:"LaTeX"}})}}),E.addGroup("more","More").addItem("quote",{icon:(g=t?.quoteIcon)!=null?g:W6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=I2.type(O);P.call(co.key,{nodeType:$})}}).addItem("hr",{icon:(y=t?.hrIcon)!=null?y:H6,active:()=>!1,onRun:O=>{const P=O.get(ne),$=L2.type(O);P.call(uo.key,{nodeType:$})}}),(v=t?.buildTopBar)==null||v.call(t,E),E.build()}To(M,Ie);const MI=Ct({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:r}=t,n=re(null),o=g=>y=>{y.preventDefault(),e&&g(e)};function i(){return e.get(E2).status===k0.Created}function s(){To(t.version.value)}function a(g){return s(),i()?g(e):!1}function l(g){var y,v;return s(),i()?g.activeLabel(e):(v=(y=g.options[0])==null?void 0:y.label)!=null?v:""}function c(g,y){y.preventDefault(),y.stopPropagation(),n.value=n.value===g?null:g}const u=g=>{g.target.closest(".top-bar-heading-selector")||(n.value=null)};us(()=>{window.addEventListener("pointerdown",u)}),ds(()=>{window.removeEventListener("pointerdown",u)});const d=dr(()=>TI(r,e));function h(g,y){const v=n.value===g,w=l(y);return M("div",{key:g,class:"top-bar-heading-selector"},M("button",{type:"button",class:"top-bar-heading-button",onPointerdown:C=>c(g,C)},M("span",{class:"top-bar-heading-label"},w),y.chevronIcon&&M("span",{class:"top-bar-chevron"},M(Ft,{icon:y.chevronIcon}))),v&&M("div",{class:"top-bar-heading-dropdown"},y.options.map((C,k)=>M("button",{key:`${g}-${k}`,type:"button",class:Mt("top-bar-heading-option",w===C.label&&"active"),onPointerdown:S=>{S.preventDefault(),S.stopPropagation(),n.value=null,C.onSelect(e)}},C.label))))}function p(g){return M("button",{key:g.key,type:"button",class:Mt("top-bar-item",a(g.active)&&"active"),onPointerdown:o(g.onRun)},M(Ft,{icon:g.icon}))}return()=>{s();const g=i()?e.get($e):null;return(g?!g.editable:!1)?null:M("div",{class:"top-bar-inner"},d.value.map(v=>v.items.map(w=>w.selector?h(w.key,w.selector):w.onRun?p(w):null)).reduce((v,w,C)=>{var k,S;if(C===0)v.push(...w);else{const E=(S=(k=d.value[C])==null?void 0:k.key)!=null?S:C;v.push(M("div",{key:`divider-${E}`,class:"top-bar-divider"}),...w)}return v},[]))}}});var _g=t=>{throw TypeError(t)},Sg=(t,e,r)=>e.has(t)||_g("Cannot "+r),Is=(t,e,r)=>(Sg(t,e,"read from private field"),r?r.call(t):e.get(t)),Vu=(t,e,r)=>e.has(t)?_g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Wu=(t,e,r,n)=>(Sg(t,e,"write to private field"),e.set(t,r),r),ea,x0,ta;const EI=new et("CREPE_TOP_BAR");class II{constructor(e,r,n){Vu(this,ea),Vu(this,x0),Vu(this,ta),this.update=(a,l)=>{Is(this,ea).style.display=a.editable?"":"none",Is(this,ta).value++},this.destroy=()=>{Is(this,x0).unmount(),Is(this,ea).remove()},Wu(this,ta,re(0));const o=document.createElement("div");o.className="milkdown-top-bar";const i=gr(MI,{ctx:e,config:n,version:Is(this,ta)});i.mount(o),Wu(this,ea,o),Wu(this,x0,i);const s=r.dom.parentElement;s&&s.insertBefore(o,s.firstChild),this.update(r)}}ea=new WeakMap;x0=new WeakMap;ta=new WeakMap;const l1=Ve({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),LI=Je(t=>{const e=t.get(l1.key);return new Xe({key:EI,view:e.view})}),RI=(t,e)=>{t.config(Er(Ae.TopBar)).config(r=>{r.set(l1.key,{view:n=>new II(r,n,e)})}).use(l1).use(LI)};function OI(t,e,r){switch(t){case Ae.CodeMirror:return jE(e,r);case Ae.ListItem:return dI(e,r);case Ae.LinkTooltip:return cI(e,r);case Ae.ImageBlock:return GE(e,r);case Ae.Cursor:return UE(e,r);case Ae.BlockEdit:return WE(e,r);case Ae.Placeholder:return mI(e,r);case Ae.Toolbar:return kI(e,r);case Ae.Table:return gI(e,r);case Ae.Latex:return aI(e,r);case Ae.TopBar:return RI(e,r);case Ae.AI:return PE(e,r)}}var Ag=t=>{throw TypeError(t)},Tg=(t,e,r)=>e.has(t)||Ag("Cannot "+r),ar=(t,e,r)=>(Tg(t,e,"read from private field"),r?r.call(t):e.get(t)),ju=(t,e,r)=>e.has(t)?Ag("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Uu=(t,e,r,n)=>(Tg(t,e,"write to private field"),e.set(t,r),r),lr,C0,ra;class PI{constructor({root:e,defaultValue:r=""}={}){ju(this,lr),ju(this,C0),ju(this,ra,!0),this.addFeature=(o,i)=>(o(ar(this,lr),i),this),this.create=()=>ar(this,lr).create(),this.destroy=()=>ar(this,lr).destroy(),this.setReadonly=o=>(Uu(this,ra,!o),ar(this,lr).action(i=>{ar(this,lr).status===k0.Created&&i.get($e).setProps({editable:()=>!o})}),this),this.getMarkdown=()=>ar(this,lr).action(Dv()),this.on=o=>ar(this,lr).status!==k0.Created?(ar(this,lr).config(i=>{const s=i.get(J0);o(s)}),this):(ar(this,lr).action(i=>{const s=i.get(J0);o(s)}),this);var n;Uu(this,C0,(n=typeof e=="string"?document.querySelector(e):e)!=null?n:document.body),Uu(this,lr,Bv.make().config(o=>{o.inject(QM,this),o.inject(JM,[])}).config(o=>{o.set(zv,ar(this,C0)),o.set(Nv,r),o.set(b1,{editable:()=>ar(this,ra)}),o.update(eu.key,i=>({...i,size:4})),o.update(Fi.key,i=>({...i,uploader:async(s,a,l)=>{const u=bs(l).get().includes(Ae.ImageBlock),d=u?a.nodes["image-block"]:a.nodes.image;if(!d)return[];const h=u?l.get(Wa.key).onUpload:void 0,p=[];for(let y=0;y<s.length;y++){const v=s.item(y);v&&v.type.includes("image")&&p.push(v)}return await Promise.all(p.map(async y=>{const v=h?await h(y):URL.createObjectURL(y);return d.createAndFill({src:v})}))}}))}).use(Hv).use(O6).use(yM).use(wM).use(CM).use(E6).use(SM).use(rk))}get editor(){return ar(this,lr)}get readonly(){return!ar(this,ra)}}lr=new WeakMap;C0=new WeakMap;ra=new WeakMap;class cr extends PI{constructor({features:e={},featureConfigs:r={},...n}={}){super(n);const o=L8(r,YM);Object.entries({...AM,...e}).filter(([,s])=>s).map(([s])=>s).forEach(s=>{const a=o[s];OI(s,this.editor,a)})}}cr.Feature=Ae;function DI(t,e){const{state:r}=e,{$from:n}=r.selection,o=n.index(-1);if(!o||!/^\s*\|?\s*:?-{3,}/.test(n.parent.textContent))return!1;const i=n.node(-1).child(o-1);if(i.type.name!=="paragraph"||!i.textContent.includes("|"))return!1;const a=t.get(gn)(i.textContent+`
1002
+ `+n.parent.textContent)?.firstChild;if(a?.type.name!=="table")return!1;const l=a.firstChild,c=[];l.forEach(p=>c.push(r.schema.nodes.table_cell.createAndFill({alignment:p.attrs.alignment})));const u=a.type.create(a.attrs,[l,r.schema.nodes.table_row.create(null,c)]),d=n.before()-i.nodeSize,h=r.tr.replaceWith(d,n.after(),u);return e.dispatch(h.setSelection(Ce.create(h.doc,d+u.firstChild.nodeSize+4)).scrollIntoView()),!0}function c1(t,e,r){const n=t.state.schema.nodes.paragraph,o=r.match(/^[ \t]+/)?.[0]||"",i=r.match(/[ \t]+$/)?.[0]||"",s=[];e.forEach((u,d,h)=>{if(u.type===n){let p=u.content;!h&&o&&!u.textContent.startsWith(o)&&(p=He.from(t.state.schema.text(o)).append(p)),h===e.childCount-1&&i&&!u.textContent.endsWith(i)&&(p=p.append(He.from(t.state.schema.text(i)))),u=u.copy(p)}s.push(u)});let a=He.fromArray(s);e.lastChild?.type!==n&&(a=a.append(He.from(n.create())));const l=new dt(a,e.firstChild?.type===n&&!/^\s*\n/.test(r)?1:0,1),c=kr(t.state.tr).replaceSelection(l);return t.dispatch(c.setMeta("paste",!0).setMeta("uiEvent","paste").scrollIntoView()),t.dispatch(kr(t.state.tr)),!0}function BI(t,{mathPaste:e,inlineCode:r}){return(n,o,i)=>{const s=o.clipboardData;if(!s||!n.editable)return!1;x1(n);const a=s.getData("text/plain").replace(/\r\n?/g,`
1003
+ `);if(!a&&!s.getData("text/html"))return!1;const{$from:l}=n.state.selection;if(l.parent.type.spec.code||l.marks().some(h=>h.type.spec.code)||/^[ \t]+$/.test(a))return n.dispatch(kr(n.state.tr).insertText(a).scrollIntoView()),n.dispatch(kr(n.state.tr)),!0;if(e?.(n,o))return!0;const c=s.getData("vscode-editor-data");let u;try{u=c?JSON.parse(c).mode:null}catch{}if(a&&typeof u=="string"&&u){const{schema:h}=n.state,p=a.replace(/\n$/,""),g=r&&p.trim()&&!p.includes(`
1004
+ `)?h.nodes.paragraph.create(null,h.text(p,[h.marks.inlineCode.create()])):h.nodes.code_block.create({language:u},h.text(a));return c1(n,h.topNodeType.create(null,g),a)}if(s.getData("text/html")&&i?.size)return n.dispatch(kr(n.state.tr).replaceSelection(i).scrollIntoView()),n.dispatch(kr(n.state.tr)),!0;if(!a)return!1;const d=t.get(gn)(a);return d?c1(n,d,a):!1}}const zI=Je(t=>new Xe({props:{handleTextInput(e,r,n,o){if(e.composing||o.length<2||!e.state.selection.$from.parent.isTextblock||e.state.selection.$from.parent.type.spec.code||(e.state.storedMarks??e.state.selection.$from.marks()).some(s=>s.type.spec.code)||e.state.selection.$from.parent.content.size&&!o.includes(`
1005
+ `)||!/[\n#*>`$~\[\]-]/.test(o))return!1;const i=t.get(gn)(o);return i?c1(e,i,o):!1},handleKeyDown(e,r){if(r.key!=="Enter"||r.ctrlKey||r.metaKey||r.shiftKey||e.composing)return!1;const{state:n}=e,{$from:o,empty:i}=n.selection;if(!i||!o.parent.isTextblock||o.parent.type.spec.code||o.parentOffset!==o.parent.content.size)return!1;if(DI(t,e))return!0;const s=o.parent.textContent,a=/^(?:`{3,}|~{3,})([\w+-]*)$/.exec(s);if(!a)return!1;const l=o.start(),c=n.tr.delete(l,o.end()).setBlockType(l,l,n.schema.nodes.code_block,{language:a[1]});return e.dispatch(c.scrollIntoView()),!0}},appendTransaction(e,r,n){if(!e.some(d=>d.docChanged)||!n.selection.empty)return null;const{$from:o}=n.selection;if(o.parent.type.name!=="code_block")return null;const i=o.parent.textContent,s=/\n(?:`{3,}|~{3,})$/.exec(i);if(!s||o.parentOffset!==i.length)return null;const a=o.before(),l=o.parent.type.create(o.parent.attrs,i.slice(0,s.index)?n.schema.text(i.slice(0,s.index)):null),c=n.schema.nodes.paragraph.create(),u=n.tr.replaceWith(a,a+o.parent.nodeSize,[l,c]);return u.setSelection(Ce.create(u.doc,a+l.nodeSize+1)).scrollIntoView()}})),NI=is(t=>new h1(/!?\[([^\]]+)\]\(([^()\s]+)\)$/,(e,r,n,o)=>{const i=t.get(gn)(r[0]);return i?.firstChild?e.tr.replaceWith(n,o,i.firstChild.content):null})),HI=ko(Pa.node,()=>(t,e,r)=>{const n=document.createElement("li"),o=document.createElement("div"),i=document.createElement("input");i.type="checkbox",i.contentEditable="false",i.setAttribute("aria-label","完成任务"),n.append(o);let s=t;function a(l){if(l.type!==s.type)return!1;s=l;const c=l.attrs.checked!=null;return n.classList.toggle("document-task",c),c?(n.prepend(i),i.checked=l.attrs.checked,i.disabled=!e.editable):i.remove(),!0}return i.onmousedown=l=>l.preventDefault(),i.onchange=()=>{const l=r();l===void 0||!e.editable||e.dispatch(e.state.tr.setNodeAttribute(l,"checked",i.checked))},a(t),{dom:n,contentDOM:o,update:a,stopEvent:l=>l.target===i,ignoreMutation:l=>l.type!=="selection"&&!o.contains(l.target)}});function u1(t){return t.parent.textBetween(0,t.parent.content.size,`
1005
1006
  `,"")}function rc(t,e){const r=[...t.slice(0,e).matchAll(new RegExp("(?<![\\\\$])\\$\\$(?!\\$)","g"))],n=r.length%2?r.at(-1).index:-1;return n>=0&&!Mg(t,n)?n:-1}function Mg(t,e){let r="";for(const n of t.slice(0,e).matchAll(new RegExp("(?<!\\\\)`+","g")))r?r===n[0]&&(r=""):r=n[0];return!!r}function El(t,e,r,n){const{state:o}=t,i=o.doc.resolve(e),s=o.doc.resolve(r);if(!i.sameParent(s)||!i.parent.isTextblock||i.parent.type.spec.code||(o.storedMarks??i.marks()).some(p=>p.type.spec.code))return!1;const a=u1(i);if(n.includes(`
1006
- `)&&rc(a,i.parentOffset)<0||!a&&n.length>1)return!1;const l=a.slice(0,i.parentOffset)+n+a.slice(s.parentOffset),c=i.parentOffset+n.length,u=[...l.slice(0,c).matchAll(new RegExp("(?<![\\\\$])\\$\\$((?:\\\\[\\s\\S]|(?!\\$\\$)[^\\\\])+?)\\$\\$(?!\\$)","g"))].filter(p=>p[1].trim()&&!Mg(l,p.index)&&(p.index+p[0].length>i.parentOffset||!n&&p.index+p[0].length===c));if(!u.length)return rc(a,i.parentOffset)<0?!1:(t.dispatch(o.tr.insertText(n,e,r).scrollIntoView()),!0);const d=kr(o.tr).insertText(n,e,r);let h=0;for(const p of u.reverse()){const g=p[1].trim().replace(/\s*\n\s*/g," "),y=i.start()+p.index,v=o.schema.nodes.math_inline.create({value:g});d.replaceWith(y,y+p[0].length,v),h+=p[0].length-v.nodeSize}return d.setSelection(Ce.create(d.doc,i.start()+c-h)),t.dispatch(d.scrollIntoView()),!0}function FI(){return{handleDOMEvents:{compositionend(t){return requestAnimationFrame(()=>{t.isDestroyed||!t.dom.isConnected||El(t,t.state.selection.from,t.state.selection.to,"")}),!1}},handleTextInput(t,e,r,n){return t.composing?!1:El(t,e,r,n)},handleKeyDown(t,e){const{$from:r,$to:n,from:o,to:i}=t.state.selection;return e.key!=="Enter"||e.ctrlKey||e.metaKey||t.composing||!r.sameParent(n)||!r.parent.isTextblock||r.parent.type.spec.code||rc(u1(r),r.parentOffset)<0?!1:(e.preventDefault(),El(t,o,i,`
1007
- `))},handlePaste(t,e){const r=e.clipboardData?.getData("text/plain");if(!r)return!1;const{$from:n}=t.state.selection;return!n.parent.isTextblock||rc(u1(n),n.parentOffset)<0?!1:El(t,t.state.selection.from,t.state.selection.to,r)}}}function Eg(t,e){t.children&&(t.children=t.children.map(r=>{if(r.type==="math"){const n=String(e.value).slice(r.position.start.offset,r.position.end.offset);return/\n\s*\$\$\s*$/.test(n)?{type:"paragraph",children:[{type:"inlineMath",value:r.value.trim().replace(/\s*\n\s*/g," ")}]}:{type:"paragraph",children:[{type:"text",value:n}]}}return Eg(r,e),r}))}const VI=os("documentMathParser",()=>function(){return q2.call(this,{singleDollarTextMath:!1}),this.data().toMarkdownExtensions.push({handlers:{inlineMath:t=>"$$"+t.value+"$$"}}),Eg}),Ig=Wr("math_inline",()=>({group:"inline",inline:!0,atom:!0,selectable:!0,attrs:{value:{default:""}},parseDOM:[{tag:'span[data-type="math_inline"]',getAttrs:t=>({value:t.dataset.value})}],toDOM:t=>["span",{"data-type":"math_inline","data-value":t.attrs.value}],parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,r)=>t.addNode(r,{value:e.value})},toMarkdown:{match:t=>t.type.name==="math_inline",runner:(t,e)=>t.addNode("inlineMath",void 0,e.attrs.value)}})),WI=ko(Ig.node,()=>(t,e,r)=>{const n=document.createElement("span");n.className="document-math-inline",n.dataset.type="math_inline",n.contentEditable="false",n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-label","编辑公式"),n.title="双击或按 Enter 编辑公式";let o=t;function i(){n.dataset.value=o.attrs.value,c8.render(o.attrs.value,n,{displayMode:!1,throwOnError:!1,trust:!1})}function s(){const a=r();if(a===void 0||!e.editable)return;const l="$$"+o.attrs.value,c=kr(e.state.tr).insertText(l,a,a+o.nodeSize);e.dispatch(c.setSelection(Ce.create(c.doc,a+l.length)).scrollIntoView()),e.focus()}return n.ondblclick=s,n.onkeydown=a=>{a.key==="Enter"&&!a.ctrlKey&&!a.metaKey&&(a.preventDefault(),s())},i(),{dom:n,update(a){return a.type!==o.type?!1:(o=a,i(),!0)},ignoreMutation:()=>!0,stopEvent:a=>a.type==="dblclick"||a.type==="keydown"&&a.key==="Enter"&&!a.ctrlKey&&!a.metaKey}});function jI(t,e){let r=t.content.size,n=0;for(let o=t.childCount-1;o>=0;o--){const i=t.child(o);if(i.type.name!=="paragraph"||i.content.size)break;r-=i.nodeSize,n++}return r?e(t.copy(t.content.cut(0,r))).replace(/\s+$/,"")+(t.child(t.childCount-n-1).textContent.match(/[ \t]+$/)?.[0]||"")+`
1008
- `.repeat(n):""}function m2(t,e){const r=e.match(/[ \t]+$/)?.[0]||"",n=t.state.doc.lastChild?.textContent.match(/[ \t]+$/)?.[0]||"";r.length>n.length&&t.dispatch(t.state.tr.insertText(r.slice(n.length),t.state.doc.content.size-1))}async function YI(t,{value:e,onChange:r,placeholder:n,file:o=!1,configure:i}){let s=!1,a=!1;const l=new cr({root:t,defaultValue:e,features:{[cr.Feature.BlockEdit]:!1,[cr.Feature.TopBar]:!1,[cr.Feature.Table]:!1,[cr.Feature.ListItem]:!1,[cr.Feature.ImageBlock]:!1,[cr.Feature.Latex]:o},featureConfigs:{[cr.Feature.Cursor]:{virtual:!1},[cr.Feature.Placeholder]:{text:n,mode:"doc"},[cr.Feature.Toolbar]:{boldLabel:"加粗",italicLabel:"斜体",codeLabel:"行内代码",linkLabel:"链接",strikethroughLabel:"删除线",latexLabel:"公式"},[cr.Feature.LinkTooltip]:{inputPlaceholder:"输入链接"},[cr.Feature.CodeMirror]:{theme:[],copyText:"复制",searchPlaceholder:"搜索语言",noResultText:"没有匹配语言",previewLabel:"预览",previewLoading:"正在绘制…",previewToggleText:d=>d?"编辑":"收起预览"}}});l.editor.config(d=>{d.update(mo.key,p=>g=>({...p(g),inclusive:!1}));const h=o?{}:FI();d.update(b1,p=>({...p,...h,handlePaste:NI(d,h.handlePaste),...!o&&{clipboardTextSerializer:M8}})),d.set("CodeMirrorThemeCtx",[d1(e8)]),d.update(t8,p=>({...p,bullet:"-",emphasis:"*",strong:"*",fences:!0}))}).use(HI).use($I).use(qI),o||l.editor.use(VI).use(U2).use(A8).use(T8).use(Ig).use(WI),i?.(l.editor),l.editor.use(Je(d=>new Xe({view:()=>({update(h,p){!s&&!a&&!h.state.doc.eq(p.doc)&&r(jI(h.state.doc,d.get(fa)))}})})));try{await l.create()}catch(d){throw await l.destroy(),d}const c=l.editor.action(d=>d.get($e));m2(c,e);const u=l.editor.action(d=>d.get(fa));return{dom:c.dom,focus(){c.focus()},getCursor(d=!1){return C8(c,u,d)},setCursor(d,h=d){k8(c,u,d,h)},replaceText(d,h,p){const g=Ri(c,u,h),y=Ri(c,u,p),v=kr(c.state.tr).insertText(d,g,y);v.setSelection(Ce.create(v.doc,g+d.length)),c.dispatch(v.scrollIntoView()),c.dispatch(kr(c.state.tr)),c.focus()},insertReference(d,h,p){const g=Ri(c,u,h),y=Ri(c,u,p),v=c.state.schema.nodes.reference_inline.create({reference:d});let w=kr(c.state.tr).replaceWith(g,y,v);const C=g+v.nodeSize,k=w.doc.resolve(C).nodeAfter;let A=C;(!k?.isText||!/^\s/.test(k.text))&&(w.insertText(" ",C),A++),w.setSelection(Ce.create(w.doc,A)),c.dispatch(w.scrollIntoView()),c.dispatch(kr(c.state.tr)),c.focus()},setText(d){s=!0;try{l.editor.action(r8(d,!d)),m2(c,d)}finally{s=!1}},setAttributes(d){c.setProps({attributes:d}),l.editor.action(h=>h.update("placeholderConfigCtx",p=>({...p,text:d["data-placeholder"]})))},destroy(){return a=!0,l.destroy()}}}export{YI as createDocumentEditor};
1007
+ `)&&rc(a,i.parentOffset)<0||!a&&n.length>1)return!1;const l=a.slice(0,i.parentOffset)+n+a.slice(s.parentOffset),c=i.parentOffset+n.length,u=[...l.slice(0,c).matchAll(new RegExp("(?<![\\\\$])\\$\\$((?:\\\\[\\s\\S]|(?!\\$\\$)[^\\\\])+?)\\$\\$(?!\\$)","g"))].filter(p=>p[1].trim()&&!Mg(l,p.index)&&(p.index+p[0].length>i.parentOffset||!n&&p.index+p[0].length===c));if(!u.length)return rc(a,i.parentOffset)<0?!1:(t.dispatch(o.tr.insertText(n,e,r).scrollIntoView()),!0);const d=kr(o.tr).insertText(n,e,r);let h=0;for(const p of u.reverse()){const g=p[1].trim().replace(/\s*\n\s*/g," "),y=i.start()+p.index,v=o.schema.nodes.math_inline.create({value:g});d.replaceWith(y,y+p[0].length,v),h+=p[0].length-v.nodeSize}return d.setSelection(Ce.create(d.doc,i.start()+c-h)),t.dispatch(d.scrollIntoView()),!0}function $I(){return{handleDOMEvents:{compositionend(t){return requestAnimationFrame(()=>{t.isDestroyed||!t.dom.isConnected||El(t,t.state.selection.from,t.state.selection.to,"")}),!1}},handleTextInput(t,e,r,n){return t.composing?!1:El(t,e,r,n)},handleKeyDown(t,e){const{$from:r,$to:n,from:o,to:i}=t.state.selection;return e.key!=="Enter"||e.ctrlKey||e.metaKey||t.composing||!r.sameParent(n)||!r.parent.isTextblock||r.parent.type.spec.code||rc(u1(r),r.parentOffset)<0?!1:(e.preventDefault(),El(t,o,i,`
1008
+ `))},handlePaste(t,e){const r=e.clipboardData?.getData("text/plain");if(!r)return!1;const{$from:n}=t.state.selection;return!n.parent.isTextblock||rc(u1(n),n.parentOffset)<0?!1:El(t,t.state.selection.from,t.state.selection.to,r)}}}function Eg(t,e){t.children&&(t.children=t.children.map(r=>{if(r.type==="math"){const n=String(e.value).slice(r.position.start.offset,r.position.end.offset);return/\n\s*\$\$\s*$/.test(n)?{type:"paragraph",children:[{type:"inlineMath",value:r.value.trim().replace(/\s*\n\s*/g," ")}]}:{type:"paragraph",children:[{type:"text",value:n}]}}return Eg(r,e),r}))}const qI=os("documentMathParser",()=>function(){return q2.call(this,{singleDollarTextMath:!1}),this.data().toMarkdownExtensions.push({handlers:{inlineMath:t=>"$$"+t.value+"$$"}}),Eg}),Ig=Wr("math_inline",()=>({group:"inline",inline:!0,atom:!0,selectable:!0,attrs:{value:{default:""}},parseDOM:[{tag:'span[data-type="math_inline"]',getAttrs:t=>({value:t.dataset.value})}],toDOM:t=>["span",{"data-type":"math_inline","data-value":t.attrs.value}],parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,r)=>t.addNode(r,{value:e.value})},toMarkdown:{match:t=>t.type.name==="math_inline",runner:(t,e)=>t.addNode("inlineMath",void 0,e.attrs.value)}})),FI=ko(Ig.node,()=>(t,e,r)=>{const n=document.createElement("span");n.className="document-math-inline",n.dataset.type="math_inline",n.contentEditable="false",n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-label","编辑公式"),n.title="双击或按 Enter 编辑公式";let o=t;function i(){n.dataset.value=o.attrs.value,l8.render(o.attrs.value,n,{displayMode:!1,throwOnError:!1,trust:!1})}function s(){const a=r();if(a===void 0||!e.editable)return;const l="$$"+o.attrs.value,c=kr(e.state.tr).insertText(l,a,a+o.nodeSize);e.dispatch(c.setSelection(Ce.create(c.doc,a+l.length)).scrollIntoView()),e.focus()}return n.ondblclick=s,n.onkeydown=a=>{a.key==="Enter"&&!a.ctrlKey&&!a.metaKey&&(a.preventDefault(),s())},i(),{dom:n,update(a){return a.type!==o.type?!1:(o=a,i(),!0)},ignoreMutation:()=>!0,stopEvent:a=>a.type==="dblclick"||a.type==="keydown"&&a.key==="Enter"&&!a.ctrlKey&&!a.metaKey}});function VI(t,e){let r=t.content.size,n=0;for(let o=t.childCount-1;o>=0;o--){const i=t.child(o);if(i.type.name!=="paragraph"||i.content.size)break;r-=i.nodeSize,n++}return r?e(t.copy(t.content.cut(0,r))).replace(/\s+$/,"")+(t.child(t.childCount-n-1).textContent.match(/[ \t]+$/)?.[0]||"")+`
1009
+ `.repeat(n):""}function g2(t,e){const r=e.match(/[ \t]+$/)?.[0]||"",n=t.state.doc.lastChild?.textContent.match(/[ \t]+$/)?.[0]||"";r.length>n.length&&t.dispatch(t.state.tr.insertText(r.slice(n.length),t.state.doc.content.size-1))}async function ZI(t,{value:e,onChange:r,placeholder:n,file:o=!1,configure:i,referenceSkills:s,onOpenReference:a}){let l=!1,c=!1;const u=new cr({root:t,defaultValue:e,features:{[cr.Feature.BlockEdit]:!1,[cr.Feature.TopBar]:!1,[cr.Feature.Table]:!1,[cr.Feature.ListItem]:!1,[cr.Feature.ImageBlock]:!1,[cr.Feature.Latex]:o},featureConfigs:{[cr.Feature.Cursor]:{virtual:!1},[cr.Feature.Placeholder]:{text:n,mode:"doc"},[cr.Feature.Toolbar]:{boldLabel:"加粗",italicLabel:"斜体",codeLabel:"行内代码",linkLabel:"链接",strikethroughLabel:"删除线",latexLabel:"公式"},[cr.Feature.LinkTooltip]:{inputPlaceholder:"输入链接"},[cr.Feature.CodeMirror]:{theme:[],copyText:"复制",searchPlaceholder:"搜索语言",noResultText:"没有匹配语言",previewLabel:"预览",previewLoading:"正在绘制…",previewToggleText:g=>g?"编辑":"收起预览"}}});u.editor.config(g=>{g.update(mo.key,v=>w=>({...v(w),inclusive:!1}));const y=o?{}:$I();g.update(b1,v=>({...v,...y,handlePaste:BI(g,{mathPaste:y.handlePaste,inlineCode:!o}),...!o&&{clipboardTextSerializer:A8}})),g.set("CodeMirrorThemeCtx",[d1(e8)]),g.update(t8,v=>({...v,bullet:"-",emphasis:"*",strong:"*",fences:!0}))}).use(zI).use(NI).use(HI);const d=o?null:_8(s,a);d&&u.editor.use(qI).use(U2).use(d.plugin).use(S8).use(Ig).use(FI),i?.(u.editor),u.editor.use(Je(g=>new Xe({view:()=>({update(y,v){!l&&!c&&!y.state.doc.eq(v.doc)&&r(VI(y.state.doc,g.get(fa)))}})})));try{await u.create()}catch(g){throw await u.destroy(),g}const h=u.editor.action(g=>g.get($e));g2(h,e);const p=u.editor.action(g=>g.get(fa));return{dom:h.dom,focus(){h.focus()},getCursor(g=!1){return x8(h,p,g)},setCursor(g,y=g){C8(h,p,g,y)},replaceText(g,y,v){const w=Ri(h,p,y),C=Ri(h,p,v),k=kr(h.state.tr).insertText(g,w,C);k.setSelection(Ce.create(k.doc,w+g.length)),h.dispatch(k.scrollIntoView()),h.dispatch(kr(h.state.tr)),h.focus()},insertReference(g,y,v){const w=Ri(h,p,y),C=Ri(h,p,v),k=h.state.schema.nodes.reference_inline.create({reference:g});let S=kr(h.state.tr).replaceWith(w,C,k);const E=w+k.nodeSize,R=S.doc.resolve(E).nodeAfter;let H=E;(!R?.isText||!/^\s/.test(R.text))&&(S.insertText(" ",E),H++),S.setSelection(Ce.create(S.doc,H)),h.dispatch(S.scrollIntoView()),h.dispatch(kr(h.state.tr)),h.focus()},setText(g){l=!0;try{u.editor.action(r8(g,!g)),g2(h,g)}finally{l=!1}},setReferenceSkills(g){d?.setSkills(g)},setAttributes(g){h.setProps({attributes:g}),u.editor.action(y=>y.update("placeholderConfigCtx",v=>({...v,text:g["data-placeholder"]})))},destroy(){return c=!0,u.destroy()}}}export{ZI as createDocumentEditor};