@moontra/moonui-pro 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.js +17 -17
- package/dist/index.mjs +5 -5
- package/package.json +8 -5
package/dist/index.mjs
CHANGED
|
@@ -12,10 +12,10 @@ import cC from 'react-dom';
|
|
|
12
12
|
* (c) 2025 MoonUI. All rights reserved.
|
|
13
13
|
* @license Commercial - https://moonui.dev/license
|
|
14
14
|
*/
|
|
15
|
-
var ny=Object.create;var Ad=Object.defineProperty;var ry=Object.getOwnPropertyDescriptor;var iy=Object.getOwnPropertyNames;var oy=Object.getPrototypeOf,sy=Object.prototype.hasOwnProperty;var lo=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var _n=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ay=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of iy(e))!sy.call(t,i)&&i!==n&&Ad(t,i,{get:()=>e[i],enumerable:!(r=ry(e,i))||r.enumerable});return t};var ai=(t,e,n)=>(n=t!=null?ny(oy(t)):{},ay(e||!t||!t.__esModule?Ad(n,"default",{value:t,enumerable:!0}):n,t));var eu=_n(Qd=>{var _r=lo("react");function OE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var RE=typeof Object.is=="function"?Object.is:OE,DE=_r.useState,IE=_r.useEffect,LE=_r.useLayoutEffect,PE=_r.useDebugValue;function BE(t,e){var n=e(),r=DE({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return LE(function(){i.value=n,i.getSnapshot=e,Oa(i)&&o({inst:i});},[t,n,e]),IE(function(){return Oa(i)&&o({inst:i}),t(function(){Oa(i)&&o({inst:i});})},[t]),PE(n),n}function Oa(t){var e=t.getSnapshot;t=t.value;try{var n=e();return !RE(t,n)}catch{return !0}}function zE(t,e){return e()}var FE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zE:BE;Qd.useSyncExternalStore=_r.useSyncExternalStore!==void 0?_r.useSyncExternalStore:FE;});var nu=_n(tu=>{process.env.NODE_ENV!=="production"&&function(){function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}function e(p,h){d||i.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=h();if(!u){var g=h();o(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0);}g=s({inst:{value:m,getSnapshot:h}});var b=g[0].inst,v=g[1];return l(function(){b.value=m,b.getSnapshot=h,n(b)&&v({inst:b});},[p,m,h]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b});})},[p]),c(m),m}function n(p){var h=p.getSnapshot;p=p.value;try{var m=h();return !o(p,m)}catch{return !0}}function r(p,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=lo("react"),o=typeof Object.is=="function"?Object.is:t,s=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,d=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;tu.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var fi=_n((J1,Ra)=>{process.env.NODE_ENV==="production"?Ra.exports=eu():Ra.exports=nu();});var uh=_n((QR,dh)=>{dh.exports=function t(e,n){if(e===n)return !0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return !1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return !1;return !0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return !1;return !0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;return !0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(e[i]!==n[i])return !1;return !0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return !1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return !1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return !1}return !0}return e!==e&&n!==n};});var ph=_n(fh=>{var es=lo("react"),QS=fi();function eC(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var tC=typeof Object.is=="function"?Object.is:eC,nC=QS.useSyncExternalStore,rC=es.useRef,iC=es.useEffect,oC=es.useMemo,sC=es.useDebugValue;fh.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=rC(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s;}else s=o.current;o=oC(function(){function l(p){if(!c){if(c=!0,d=p,p=r(p),i!==void 0&&s.hasValue){var h=s.value;if(i(h,p))return u=h}return u=p}if(h=u,tC(d,p))return h;var m=r(p);return i!==void 0&&i(h,m)?(d=p,h):(d=p,u=m)}var c=!1,d,u,f=n===void 0?null:n;return [function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,i]);var a=nC(t,o[0],o[1]);return iC(function(){s.hasValue=!0,s.value=a;},[a]),sC(a),a};});var mh=_n(hh=>{process.env.NODE_ENV!=="production"&&function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=lo("react"),n=fi(),r=typeof Object.is=="function"?Object.is:t,i=n.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;hh.useSyncExternalStoreWithSelector=function(c,d,u,f,p){var h=o(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m;}else m=h.current;h=a(function(){function b(I){if(!v){if(v=!0,S=I,I=f(I),p!==void 0&&m.hasValue){var k=m.value;if(p(k,I))return T=k}return T=I}if(k=T,r(S,I))return k;var y=f(I);return p!==void 0&&p(k,y)?(S=I,k):(S=I,T=y)}var v=!1,S,T,_=u===void 0?null:u;return [function(){return b(d())},_===null?void 0:function(){return b(_())}]},[d,u,f,p]);var g=i(c,h[0],h[1]);return s(function(){m.hasValue=!0,m.value=g;},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var gh=_n((nD,sc)=>{process.env.NODE_ENV==="production"?sc.exports=ph():sc.exports=mh();});var _g=_n((EB,Tg)=>{function mg(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&mg(n);}),t}var Qs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1;}ignoreMatch(){this.isMatchIgnored=!0;}};function gg(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Vn(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i];}),n}var hT="</span>",cg=t=>!!t.scope,mT=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return [`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return `${e}${t}`},ud=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this);}addText(e){this.buffer+=gg(e);}openNode(e){if(!cg(e))return;let n=mT(e.scope,{prefix:this.classPrefix});this.span(n);}closeNode(e){cg(e)&&(this.buffer+=hT);}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`;}},dg=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Xi=class{constructor(){this.rootNode=dg(),this.stack=[this.rootNode];}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e);}openNode(e){let n=dg({scope:e});this.add(n),this.stack.push(n);}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{Xi._collapse(n);}));}},fd=class extends Xi{constructor(e){super(),this.options=e;}addText(e){e!==""&&this.add(e);}startScope(e){this.openNode(e);}endScope(){this.closeNode();}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r);}toHTML(){return new ud(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qi(t){return t?typeof t=="string"?t:t.source:null}function bg(t){return Er("(?=",t,")")}function gT(t){return Er("(?:",t,")*")}function bT(t){return Er("(?:",t,")?")}function Er(...t){return t.map(n=>Qi(n)).join("")}function yT(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function hd(...t){return "("+(yT(t).capture?"":"?:")+t.map(r=>Qi(r)).join("|")+")"}function yg(t){return new RegExp(t.toString()+"|").exec("").length-1}function ET(t,e){let n=t&&t.exec(e);return n&&n.index===0}var vT=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function md(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Qi(r),s="";for(;o.length>0;){let a=vT.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++);}return s}).map(r=>`(${r})`).join(e)}var wT=/\b\B/,Eg="[a-zA-Z]\\w*",gd="[a-zA-Z_]\\w*",vg="\\b\\d+(\\.\\d+)?",wg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xg="\\b(0b[01]+)",xT="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ST=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Er(e,/.*\b/,t.binary,/\b.*/)),Vn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch();}},t)},eo={begin:"\\\\[\\s\\S]",relevance:0},CT={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[eo]},kT={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[eo]},NT={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ta=function(t,e,n={}){let r=Vn({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=hd("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Er(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},TT=ta("//","$"),_T=ta("/\\*","\\*/"),MT=ta("#","$"),AT={scope:"number",begin:vg,relevance:0},OT={scope:"number",begin:wg,relevance:0},RT={scope:"number",begin:xg,relevance:0},DT={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[eo,{begin:/\[/,end:/\]/,relevance:0,contains:[eo]}]},IT={scope:"title",begin:Eg,relevance:0},LT={scope:"title",begin:gd,relevance:0},PT={begin:"\\.\\s*"+gd,relevance:0},BT=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1];},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch();}})},Xs=Object.freeze({__proto__:null,APOS_STRING_MODE:CT,BACKSLASH_ESCAPE:eo,BINARY_NUMBER_MODE:RT,BINARY_NUMBER_RE:xg,COMMENT:ta,C_BLOCK_COMMENT_MODE:_T,C_LINE_COMMENT_MODE:TT,C_NUMBER_MODE:OT,C_NUMBER_RE:wg,END_SAME_AS_BEGIN:BT,HASH_COMMENT_MODE:MT,IDENT_RE:Eg,MATCH_NOTHING_RE:wT,METHOD_GUARD:PT,NUMBER_MODE:AT,NUMBER_RE:vg,PHRASAL_WORDS_MODE:NT,QUOTE_STRING_MODE:kT,REGEXP_MODE:DT,RE_STARTERS_RE:xT,SHEBANG:ST,TITLE_MODE:IT,UNDERSCORE_IDENT_RE:gd,UNDERSCORE_TITLE_MODE:LT});function zT(t,e){t.input[t.index-1]==="."&&e.ignoreMatch();}function FT(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className);}function UT(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=zT,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0));}function HT(t,e){Array.isArray(t.illegal)&&(t.illegal=hd(...t.illegal));}function $T(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match;}}function KT(t,e){t.relevance===void 0&&(t.relevance=1);}var VT=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r];}),t.keywords=n.keywords,t.begin=Er(n.beforeMatch,bg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch;},WT=["of","and","for","in","not","or","if","then","parent","list","value"],GT="keyword";function Sg(t,e,n=GT){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,Sg(t[o],e,o));}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[o,qT(l[0],l[1])];});}}function qT(t,e){return e?Number(e):jT(t)?0:1}function jT(t){return WT.includes(t.toLowerCase())}var ug={},yr=t=>{console.error(t);},fg=(t,...e)=>{console.log(`WARN: ${t}`,...e);},Qr=(t,e)=>{ug[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),ug[`${t}/${e}`]=!0);},ea=new Error;function Cg(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=yg(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0;}function JT(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw yr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ea;if(typeof t.beginScope!="object"||t.beginScope===null)throw yr("beginScope must be object"),ea;Cg(t,t.begin,{key:"beginScope"}),t.begin=md(t.begin,{joinWith:""});}}function YT(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw yr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ea;if(typeof t.endScope!="object"||t.endScope===null)throw yr("endScope must be object"),ea;Cg(t,t.end,{key:"endScope"}),t.end=md(t.end,{joinWith:""});}}function ZT(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope);}function XT(t){ZT(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),JT(t),YT(t);}function QT(t){function e(s,a){return new RegExp(Qi(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0;}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=yg(a)+1;}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(md(a,{joinWith:"|"}),!0),this.lastIndex=0;}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((u,f)=>f>0&&u!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0;}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,d])=>l.addRule(c,d)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0;}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++;}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.exec(a);}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){let a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){let l=s;if(s.isCompiled)return l;[FT,$T,XT,VT].forEach(d=>d(s,a)),t.compilerExtensions.forEach(d=>d(s,a)),s.__beforeBegin=null,[UT,HT,KT].forEach(d=>d(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=Sg(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=Qi(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(d){return e_(d==="self"?s:d)})),s.contains.forEach(function(d){o(d,l);}),s.starts&&o(s.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Vn(t.classNameAliases||{}),o(t)}function kg(t){return t?t.endsWithParent||kg(t.starts):!1}function e_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Vn(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:kg(t)?Vn(t,{starts:t.starts?Vn(t.starts):null}):Object.isFrozen(t)?Vn(t):t}var t_="11.11.1",pd=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n;}},dd=gg,pg=Vn,hg=Symbol("nomatch"),n_=7,Ng=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:fd};function l(x){return a.noHighlightRe.test(x)}function c(x){let C=x.className+" ";C+=x.parentNode?x.parentNode.className:"";let M=a.languageDetectRe.exec(C);if(M){let U=y(M[1]);return U||(fg(o.replace("{}",M[1])),fg("Falling back to no-highlight mode for this block.",x)),U?M[1]:"no-highlight"}return C.split(/\s+/).find(U=>l(U)||y(U))}function d(x,C,M){let U="",z="";typeof C=="object"?(U=x,M=C.ignoreIllegals,z=C.language):(Qr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Qr("10.7.0",`Please use highlight(code, options) instead.
|
|
15
|
+
var ny=Object.create;var Ad=Object.defineProperty;var ry=Object.getOwnPropertyDescriptor;var iy=Object.getOwnPropertyNames;var oy=Object.getPrototypeOf,sy=Object.prototype.hasOwnProperty;var lo=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var _n=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ay=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of iy(e))!sy.call(t,i)&&i!==n&&Ad(t,i,{get:()=>e[i],enumerable:!(r=ry(e,i))||r.enumerable});return t};var ai=(t,e,n)=>(n=t!=null?ny(oy(t)):{},ay(e||!t||!t.__esModule?Ad(n,"default",{value:t,enumerable:!0}):n,t));var eu=_n(Qd=>{var _r=lo("react");function OE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var RE=typeof Object.is=="function"?Object.is:OE,DE=_r.useState,IE=_r.useEffect,LE=_r.useLayoutEffect,PE=_r.useDebugValue;function BE(t,e){var n=e(),r=DE({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return LE(function(){i.value=n,i.getSnapshot=e,Oa(i)&&o({inst:i});},[t,n,e]),IE(function(){return Oa(i)&&o({inst:i}),t(function(){Oa(i)&&o({inst:i});})},[t]),PE(n),n}function Oa(t){var e=t.getSnapshot;t=t.value;try{var n=e();return !RE(t,n)}catch{return !0}}function zE(t,e){return e()}var FE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zE:BE;Qd.useSyncExternalStore=_r.useSyncExternalStore!==void 0?_r.useSyncExternalStore:FE;});var nu=_n(tu=>{process.env.NODE_ENV!=="production"&&function(){function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}function e(p,h){d||i.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=h();if(!u){var g=h();o(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0);}g=s({inst:{value:m,getSnapshot:h}});var b=g[0].inst,v=g[1];return l(function(){b.value=m,b.getSnapshot=h,n(b)&&v({inst:b});},[p,m,h]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b});})},[p]),c(m),m}function n(p){var h=p.getSnapshot;p=p.value;try{var m=h();return !o(p,m)}catch{return !0}}function r(p,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=lo("react"),o=typeof Object.is=="function"?Object.is:t,s=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,d=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;tu.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var fi=_n((Z1,Ra)=>{process.env.NODE_ENV==="production"?Ra.exports=eu():Ra.exports=nu();});var uh=_n((tD,dh)=>{dh.exports=function t(e,n){if(e===n)return !0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return !1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return !1;return !0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return !1;return !0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;return !0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(e[i]!==n[i])return !1;return !0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return !1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return !1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return !1}return !0}return e!==e&&n!==n};});var ph=_n(fh=>{var es=lo("react"),QS=fi();function eC(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var tC=typeof Object.is=="function"?Object.is:eC,nC=QS.useSyncExternalStore,rC=es.useRef,iC=es.useEffect,oC=es.useMemo,sC=es.useDebugValue;fh.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=rC(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s;}else s=o.current;o=oC(function(){function l(p){if(!c){if(c=!0,d=p,p=r(p),i!==void 0&&s.hasValue){var h=s.value;if(i(h,p))return u=h}return u=p}if(h=u,tC(d,p))return h;var m=r(p);return i!==void 0&&i(h,m)?(d=p,h):(d=p,u=m)}var c=!1,d,u,f=n===void 0?null:n;return [function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,i]);var a=nC(t,o[0],o[1]);return iC(function(){s.hasValue=!0,s.value=a;},[a]),sC(a),a};});var mh=_n(hh=>{process.env.NODE_ENV!=="production"&&function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=lo("react"),n=fi(),r=typeof Object.is=="function"?Object.is:t,i=n.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;hh.useSyncExternalStoreWithSelector=function(c,d,u,f,p){var h=o(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m;}else m=h.current;h=a(function(){function b(I){if(!v){if(v=!0,S=I,I=f(I),p!==void 0&&m.hasValue){var k=m.value;if(p(k,I))return T=k}return T=I}if(k=T,r(S,I))return k;var y=f(I);return p!==void 0&&p(k,y)?(S=I,k):(S=I,T=y)}var v=!1,S,T,_=u===void 0?null:u;return [function(){return b(d())},_===null?void 0:function(){return b(_())}]},[d,u,f,p]);var g=i(c,h[0],h[1]);return s(function(){m.hasValue=!0,m.value=g;},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var gh=_n((iD,sc)=>{process.env.NODE_ENV==="production"?sc.exports=ph():sc.exports=mh();});var _g=_n((wB,Tg)=>{function mg(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&mg(n);}),t}var Qs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1;}ignoreMatch(){this.isMatchIgnored=!0;}};function gg(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Vn(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i];}),n}var hT="</span>",cg=t=>!!t.scope,mT=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return [`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return `${e}${t}`},ud=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this);}addText(e){this.buffer+=gg(e);}openNode(e){if(!cg(e))return;let n=mT(e.scope,{prefix:this.classPrefix});this.span(n);}closeNode(e){cg(e)&&(this.buffer+=hT);}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`;}},dg=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Xi=class{constructor(){this.rootNode=dg(),this.stack=[this.rootNode];}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e);}openNode(e){let n=dg({scope:e});this.add(n),this.stack.push(n);}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{Xi._collapse(n);}));}},fd=class extends Xi{constructor(e){super(),this.options=e;}addText(e){e!==""&&this.add(e);}startScope(e){this.openNode(e);}endScope(){this.closeNode();}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r);}toHTML(){return new ud(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qi(t){return t?typeof t=="string"?t:t.source:null}function bg(t){return Er("(?=",t,")")}function gT(t){return Er("(?:",t,")*")}function bT(t){return Er("(?:",t,")?")}function Er(...t){return t.map(n=>Qi(n)).join("")}function yT(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function hd(...t){return "("+(yT(t).capture?"":"?:")+t.map(r=>Qi(r)).join("|")+")"}function yg(t){return new RegExp(t.toString()+"|").exec("").length-1}function ET(t,e){let n=t&&t.exec(e);return n&&n.index===0}var vT=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function md(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Qi(r),s="";for(;o.length>0;){let a=vT.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++);}return s}).map(r=>`(${r})`).join(e)}var wT=/\b\B/,Eg="[a-zA-Z]\\w*",gd="[a-zA-Z_]\\w*",vg="\\b\\d+(\\.\\d+)?",wg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xg="\\b(0b[01]+)",xT="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ST=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Er(e,/.*\b/,t.binary,/\b.*/)),Vn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch();}},t)},eo={begin:"\\\\[\\s\\S]",relevance:0},CT={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[eo]},kT={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[eo]},NT={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ta=function(t,e,n={}){let r=Vn({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=hd("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Er(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},TT=ta("//","$"),_T=ta("/\\*","\\*/"),MT=ta("#","$"),AT={scope:"number",begin:vg,relevance:0},OT={scope:"number",begin:wg,relevance:0},RT={scope:"number",begin:xg,relevance:0},DT={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[eo,{begin:/\[/,end:/\]/,relevance:0,contains:[eo]}]},IT={scope:"title",begin:Eg,relevance:0},LT={scope:"title",begin:gd,relevance:0},PT={begin:"\\.\\s*"+gd,relevance:0},BT=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1];},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch();}})},Xs=Object.freeze({__proto__:null,APOS_STRING_MODE:CT,BACKSLASH_ESCAPE:eo,BINARY_NUMBER_MODE:RT,BINARY_NUMBER_RE:xg,COMMENT:ta,C_BLOCK_COMMENT_MODE:_T,C_LINE_COMMENT_MODE:TT,C_NUMBER_MODE:OT,C_NUMBER_RE:wg,END_SAME_AS_BEGIN:BT,HASH_COMMENT_MODE:MT,IDENT_RE:Eg,MATCH_NOTHING_RE:wT,METHOD_GUARD:PT,NUMBER_MODE:AT,NUMBER_RE:vg,PHRASAL_WORDS_MODE:NT,QUOTE_STRING_MODE:kT,REGEXP_MODE:DT,RE_STARTERS_RE:xT,SHEBANG:ST,TITLE_MODE:IT,UNDERSCORE_IDENT_RE:gd,UNDERSCORE_TITLE_MODE:LT});function zT(t,e){t.input[t.index-1]==="."&&e.ignoreMatch();}function FT(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className);}function UT(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=zT,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0));}function HT(t,e){Array.isArray(t.illegal)&&(t.illegal=hd(...t.illegal));}function $T(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match;}}function KT(t,e){t.relevance===void 0&&(t.relevance=1);}var VT=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r];}),t.keywords=n.keywords,t.begin=Er(n.beforeMatch,bg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch;},WT=["of","and","for","in","not","or","if","then","parent","list","value"],GT="keyword";function Sg(t,e,n=GT){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,Sg(t[o],e,o));}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[o,qT(l[0],l[1])];});}}function qT(t,e){return e?Number(e):jT(t)?0:1}function jT(t){return WT.includes(t.toLowerCase())}var ug={},yr=t=>{console.error(t);},fg=(t,...e)=>{console.log(`WARN: ${t}`,...e);},Qr=(t,e)=>{ug[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),ug[`${t}/${e}`]=!0);},ea=new Error;function Cg(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=yg(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0;}function JT(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw yr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ea;if(typeof t.beginScope!="object"||t.beginScope===null)throw yr("beginScope must be object"),ea;Cg(t,t.begin,{key:"beginScope"}),t.begin=md(t.begin,{joinWith:""});}}function YT(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw yr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ea;if(typeof t.endScope!="object"||t.endScope===null)throw yr("endScope must be object"),ea;Cg(t,t.end,{key:"endScope"}),t.end=md(t.end,{joinWith:""});}}function ZT(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope);}function XT(t){ZT(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),JT(t),YT(t);}function QT(t){function e(s,a){return new RegExp(Qi(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0;}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=yg(a)+1;}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(md(a,{joinWith:"|"}),!0),this.lastIndex=0;}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((u,f)=>f>0&&u!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0;}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,d])=>l.addRule(c,d)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0;}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++;}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.exec(a);}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){let a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){let l=s;if(s.isCompiled)return l;[FT,$T,XT,VT].forEach(d=>d(s,a)),t.compilerExtensions.forEach(d=>d(s,a)),s.__beforeBegin=null,[UT,HT,KT].forEach(d=>d(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=Sg(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=Qi(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(d){return e_(d==="self"?s:d)})),s.contains.forEach(function(d){o(d,l);}),s.starts&&o(s.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Vn(t.classNameAliases||{}),o(t)}function kg(t){return t?t.endsWithParent||kg(t.starts):!1}function e_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Vn(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:kg(t)?Vn(t,{starts:t.starts?Vn(t.starts):null}):Object.isFrozen(t)?Vn(t):t}var t_="11.11.1",pd=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n;}},dd=gg,pg=Vn,hg=Symbol("nomatch"),n_=7,Ng=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:fd};function l(x){return a.noHighlightRe.test(x)}function c(x){let C=x.className+" ";C+=x.parentNode?x.parentNode.className:"";let M=a.languageDetectRe.exec(C);if(M){let U=y(M[1]);return U||(fg(o.replace("{}",M[1])),fg("Falling back to no-highlight mode for this block.",x)),U?M[1]:"no-highlight"}return C.split(/\s+/).find(U=>l(U)||y(U))}function d(x,C,M){let U="",z="";typeof C=="object"?(U=x,M=C.ignoreIllegals,z=C.language):(Qr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Qr("10.7.0",`Please use highlight(code, options) instead.
|
|
16
16
|
https://github.com/highlightjs/highlight.js/issues/2277`),z=x,U=C),M===void 0&&(M=!0);let J={code:U,language:z};Q("before:highlight",J);let ie=J.result?J.result:u(J.language,J.code,M);return ie.code=J.code,Q("after:highlight",ie),ie}function u(x,C,M,U){let z=Object.create(null);function J(D,K){return D.keywords[K]}function ie(){if(!A.keywords){de.addText(Y);return}let D=0;A.keywordPatternRe.lastIndex=0;let K=A.keywordPatternRe.exec(Y),ue="";for(;K;){ue+=Y.substring(D,K.index);let we=ot.case_insensitive?K[0].toLowerCase():K[0],Je=J(A,we);if(Je){let[Ht,Qe]=Je;if(de.addText(ue),ue="",z[we]=(z[we]||0)+1,z[we]<=n_&&(st+=Qe),Ht.startsWith("_"))ue+=K[0];else {let dn=ot.classNameAliases[Ht]||Ht;_e(K[0],dn);}}else ue+=K[0];D=A.keywordPatternRe.lastIndex,K=A.keywordPatternRe.exec(Y);}ue+=Y.substring(D),de.addText(ue);}function $(){if(Y==="")return;let D=null;if(typeof A.subLanguage=="string"){if(!e[A.subLanguage]){de.addText(Y);return}D=u(A.subLanguage,Y,!0,ee[A.subLanguage]),ee[A.subLanguage]=D._top;}else D=p(Y,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(st+=D.relevance),de.__addSublanguage(D._emitter,D.language);}function ae(){A.subLanguage!=null?$():ie(),Y="";}function _e(D,K){D!==""&&(de.startScope(K),de.addText(D),de.endScope());}function $e(D,K){let ue=1,we=K.length-1;for(;ue<=we;){if(!D._emit[ue]){ue++;continue}let Je=ot.classNameAliases[D[ue]]||D[ue],Ht=K[ue];Je?_e(Ht,Je):(Y=Ht,ie(),Y=""),ue++;}}function it(D,K){return D.scope&&typeof D.scope=="string"&&de.openNode(ot.classNameAliases[D.scope]||D.scope),D.beginScope&&(D.beginScope._wrap?(_e(Y,ot.classNameAliases[D.beginScope._wrap]||D.beginScope._wrap),Y=""):D.beginScope._multi&&($e(D.beginScope,K),Y="")),A=Object.create(D,{parent:{value:A}}),A}function ln(D,K,ue){let we=ET(D.endRe,ue);if(we){if(D["on:end"]){let Je=new Qs(D);D["on:end"](K,Je),Je.isMatchIgnored&&(we=!1);}if(we){for(;D.endsParent&&D.parent;)D=D.parent;return D}}if(D.endsWithParent)return ln(D.parent,K,ue)}function ht(D){return A.matcher.regexIndex===0?(Y+=D[0],1):(F=!0,0)}function Wt(D){let K=D[0],ue=D.rule,we=new Qs(ue),Je=[ue.__beforeBegin,ue["on:begin"]];for(let Ht of Je)if(Ht&&(Ht(D,we),we.isMatchIgnored))return ht(K);return ue.skip?Y+=K:(ue.excludeBegin&&(Y+=K),ae(),!ue.returnBegin&&!ue.excludeBegin&&(Y=K)),it(ue,D),ue.returnBegin?0:K.length}function mt(D){let K=D[0],ue=C.substring(D.index),we=ln(A,D,ue);if(!we)return hg;let Je=A;A.endScope&&A.endScope._wrap?(ae(),_e(K,A.endScope._wrap)):A.endScope&&A.endScope._multi?(ae(),$e(A.endScope,D)):Je.skip?Y+=K:(Je.returnEnd||Je.excludeEnd||(Y+=K),ae(),Je.excludeEnd&&(Y=K));do A.scope&&de.closeNode(),!A.skip&&!A.subLanguage&&(st+=A.relevance),A=A.parent;while(A!==we.parent);return we.starts&&it(we.starts,D),Je.returnEnd?0:K.length}function jn(){let D=[];for(let K=A;K!==ot;K=K.parent)K.scope&&D.unshift(K.scope);D.forEach(K=>de.openNode(K));}let Ut={};function cn(D,K){let ue=K&&K[0];if(Y+=D,ue==null)return ae(),0;if(Ut.type==="begin"&&K.type==="end"&&Ut.index===K.index&&ue===""){if(Y+=C.slice(K.index,K.index+1),!i){let we=new Error(`0 width match regex (${x})`);throw we.languageName=x,we.badRule=Ut.rule,we}return 1}if(Ut=K,K.type==="begin")return Wt(K);if(K.type==="illegal"&&!M){let we=new Error('Illegal lexeme "'+ue+'" for mode "'+(A.scope||"<unnamed>")+'"');throw we.mode=A,we}else if(K.type==="end"){let we=mt(K);if(we!==hg)return we}if(K.type==="illegal"&&ue==="")return Y+=`
|
|
17
|
-
`,1;if(si>1e5&&si>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Y+=ue,ue.length}let ot=y(x);if(!ot)throw yr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let ve=QT(ot),Nt="",A=U||ve,ee={},de=new a.__emitter(a);jn();let Y="",st=0,Tt=0,si=0,F=!1;try{if(ot.__emitTokens)ot.__emitTokens(C,de);else {for(A.matcher.considerAll();;){si++,F?F=!1:A.matcher.considerAll(),A.matcher.lastIndex=Tt;let D=A.matcher.exec(C);if(!D)break;let K=C.substring(Tt,D.index),ue=cn(K,D);Tt=D.index+ue;}cn(C.substring(Tt));}return de.finalize(),Nt=de.toHTML(),{language:x,value:Nt,relevance:st,illegal:!1,_emitter:de,_top:A}}catch(D){if(D.message&&D.message.includes("Illegal"))return {language:x,value:dd(C),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:Tt,context:C.slice(Tt-100,Tt+100),mode:D.mode,resultSoFar:Nt},_emitter:de};if(i)return {language:x,value:dd(C),illegal:!1,relevance:0,errorRaised:D,_emitter:de,_top:A};throw D}}function f(x){let C={value:dd(x),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return C._emitter.addText(x),C}function p(x,C){C=C||a.languages||Object.keys(e);let M=f(x),U=C.filter(y).filter(O).map(ae=>u(ae,x,!1));U.unshift(M);let z=U.sort((ae,_e)=>{if(ae.relevance!==_e.relevance)return _e.relevance-ae.relevance;if(ae.language&&_e.language){if(y(ae.language).supersetOf===_e.language)return 1;if(y(_e.language).supersetOf===ae.language)return -1}return 0}),[J,ie]=z,$=J;return $.secondBest=ie,$}function h(x,C,M){let U=C&&n[C]||M;x.classList.add("hljs"),x.classList.add(`language-${U}`);}function m(x){let C=null,M=c(x);if(l(M))return;if(Q("before:highlightElement",{el:x,language:M}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new pd("One of your code blocks includes unescaped HTML.",x.innerHTML);C=x;let U=C.textContent,z=M?d(U,{language:M,ignoreIllegals:!0}):p(U);x.innerHTML=z.value,x.dataset.highlighted="yes",h(x,M,z.language),x.result={language:z.language,re:z.relevance,relevance:z.relevance},z.secondBest&&(x.secondBest={language:z.secondBest.language,relevance:z.secondBest.relevance}),Q("after:highlightElement",{el:x,result:z,text:U});}function g(x){a=pg(a,x);}let b=()=>{T(),Qr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.");};function v(){T(),Qr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.");}let S=!1;function T(){function x(){T();}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",x,!1),S=!0;return}document.querySelectorAll(a.cssSelector).forEach(m);}function _(x,C){let M=null;try{M=C(t);}catch(U){if(yr("Language definition for '{}' could not be registered.".replace("{}",x)),i)yr(U);else throw U;M=s;}M.name||(M.name=x),e[x]=M,M.rawDefinition=C.bind(null,t),M.aliases&&w(M.aliases,{languageName:x});}function I(x){delete e[x];for(let C of Object.keys(n))n[C]===x&&delete n[C];}function k(){return Object.keys(e)}function y(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function w(x,{languageName:C}){typeof x=="string"&&(x=[x]),x.forEach(M=>{n[M.toLowerCase()]=C;});}function O(x){let C=y(x);return C&&!C.disableAutodetect}function X(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=C=>{x["before:highlightBlock"](Object.assign({block:C.el},C));}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=C=>{x["after:highlightBlock"](Object.assign({block:C.el},C));});}function R(x){X(x),r.push(x);}function ce(x){let C=r.indexOf(x);C!==-1&&r.splice(C,1);}function Q(x,C){let M=x;r.forEach(function(U){U[M]&&U[M](C);});}function G(x){return Qr("10.7.0","highlightBlock will be removed entirely in v12.0"),Qr("10.7.0","Please use highlightElement now."),m(x)}Object.assign(t,{highlight:d,highlightAuto:p,highlightAll:T,highlightElement:m,highlightBlock:G,configure:g,initHighlighting:b,initHighlightingOnLoad:v,registerLanguage:_,unregisterLanguage:I,listLanguages:k,getLanguage:y,registerAliases:w,autoDetection:O,inherit:pg,addPlugin:R,removePlugin:ce}),t.debugMode=function(){i=!1;},t.safeMode=function(){i=!0;},t.versionString=t_,t.regex={concat:Er,lookahead:bg,either:hd,optional:bT,anyNumberOfTimes:gT};for(let x in Xs)typeof Xs[x]=="object"&&mg(Xs[x]);return Object.assign(t,Xs),t},ei=Ng({});ei.newInstance=()=>Ng({});Tg.exports=ei;ei.HighlightJS=ei;ei.default=ei;});function lt(){return {isLoading:!1,isAuthenticated:!0,isAdmin:!1,hasProAccess:!0,subscriptionPlan:"pro",subscription:{status:"active",plan:"pro"}}}var Oy=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#f97316","#84cc16","#ec4899","#6366f1"];function uA({data:t,type:e,series:n,title:r,subtitle:i,height:o=400,width:s="100%",xAxisKey:a="name",yAxisKey:l,showGrid:c=!0,showTooltip:d=!0,showLegend:u=!0,showBrush:f=!1,showReference:p=!1,referenceLines:h=[],referenceAreas:m=[],colors:g=Oy,className:b,onDataPointClick:v,onExport:S,onRefresh:T,customTooltip:_,customLegend:I,loading:k=!1,error:y=null,animated:w=!0,responsive:O=!0}){let {hasProAccess:R,isLoading:ce}=lt();if(!ce&&!R)return jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Chart is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[G,x]=Mn.useState(!1),C=Mn.useRef(null),M=Mn.useMemo(()=>{if(!t.length||!n.length)return null;let J=n[0],ie=t.map($e=>Number($e[J.dataKey])).filter($e=>!isNaN($e));if(ie.length<2)return null;let $=ie[0],_e=(ie[ie.length-1]-$)/$*100;return {direction:_e>0?"up":_e<0?"down":"neutral",percentage:Math.abs(_e).toFixed(1)}},[t,n]),U=J=>{S&&S(J);},z=()=>{let J={data:t,width:typeof s=="string"?void 0:s,height:o,margin:{top:20,right:30,left:20,bottom:20}},ie=n.filter($=>!$.hide);switch(e){case"line":return jsxs(LineChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Line,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],strokeWidth:$.strokeWidth||2,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),p&&m.map(($,ae)=>jsx(ReferenceArea,{x1:$.x1,x2:$.x2,fill:$.color||"#f0f0f0",fillOpacity:.3,label:$.label},ae)),f&&jsx(Brush,{})]});case"bar":return jsxs(BarChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Bar,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"area":return jsxs(AreaChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Area,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],fill:$.color||g[ae%g.length],fillOpacity:$.fillOpacity||.3,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"pie":return jsxs(PieChart,{...J,children:[d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),jsx(Pie,{data:t,dataKey:n[0]?.dataKey||"value",nameKey:a,cx:"50%",cy:"50%",outerRadius:Math.min(o,typeof s=="number"?s:400)/3,animationDuration:w?1e3:0,children:t.map(($,ae)=>jsx(Cell,{fill:g[ae%g.length]},`cell-${ae}`))})]});case"scatter":return jsxs(ScatterChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{dataKey:l}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Scatter,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey))]});default:return jsx("div",{children:"Unsupported chart type"})}};return k?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"flex items-center space-x-2",children:[jsx(RefreshCw,{className:"h-4 w-4 animate-spin"}),jsx("span",{children:"Loading chart..."})]})})}):y?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-destructive mb-2",children:y}),T&&jsxs(Button,{variant:"outline",onClick:T,children:[jsx(RefreshCw,{className:"mr-2 h-4 w-4"}),"Retry"]})]})})}):jsxs(Card,{className:cn("w-full",b),ref:C,children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxs("div",{className:"space-y-1",children:[jsxs(CardTitle,{className:"text-base font-medium",children:[r,M&&jsxs("span",{className:"ml-2 inline-flex items-center",children:[M.direction==="up"&&jsx(TrendingUp,{className:"h-4 w-4 text-green-500"}),M.direction==="down"&&jsx(TrendingDown,{className:"h-4 w-4 text-red-500"}),M.direction==="neutral"&&jsx(Minus,{className:"h-4 w-4 text-gray-500"}),jsxs("span",{className:cn("ml-1 text-sm",M.direction==="up"&&"text-green-500",M.direction==="down"&&"text-red-500",M.direction==="neutral"&&"text-gray-500"),children:[M.percentage,"%"]})]})]}),i&&jsx("p",{className:"text-xs text-muted-foreground",children:i})]}),jsxs("div",{className:"flex items-center space-x-1",children:[T&&jsx(Button,{variant:"ghost",size:"sm",onClick:T,children:jsx(RefreshCw,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(Settings,{className:"h-4 w-4"})}),S&&jsx(Button,{variant:"ghost",size:"sm",onClick:()=>U("png"),children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>x(!G),children:jsx(Maximize2,{className:"h-4 w-4"})})]})]}),jsx(CardContent,{children:O?jsx(ResponsiveContainer,{width:"100%",height:o,children:z()}):jsx("div",{style:{width:"100%",height:`${o}px`},children:z()})})]})}var Od=[{value:"meeting",label:"Meeting",color:"#3b82f6"},{value:"task",label:"Task",color:"#10b981"},{value:"reminder",label:"Reminder",color:"#f59e0b"},{value:"event",label:"Event",color:"#8b5cf6"}],Yy=["#3b82f6","#10b981","#f59e0b","#8b5cf6","#ef4444","#06b6d4","#84cc16","#f97316","#ec4899","#6366f1","#14b8a6","#eab308","#f43f5e","#a855f7","#22c55e"];function Rd({open:t,onOpenChange:e,event:n,selectedDate:r,onSave:i,onDelete:o,mode:s="create"}){let[a,l]=useState({title:"",description:"",date:"",startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""}),[c,d]=useState({}),[u,f]=useState(!1);useEffect(()=>{if(s==="edit"&&n)l({title:n.title||"",description:n.description||"",date:n.date.toISOString().split("T")[0],startTime:n.startTime||"",endTime:n.endTime||"",location:n.location||"",type:n.type||"meeting",color:n.color||"#3b82f6",attendees:n.attendees?.join(", ")||""});else if(s==="create"){let b=r?r.toISOString().split("T")[0]:new Date().toISOString().split("T")[0];l({title:"",description:"",date:b,startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""});}d({});},[n,r,s,t]);let p=()=>{let b={};return a.title.trim()||(b.title="Title is required"),a.date||(b.date="Date is required"),a.startTime&&a.endTime&&a.startTime>=a.endTime&&(b.endTime="End time must be after start time"),d(b),Object.keys(b).length===0},h=async b=>{if(b.preventDefault(),!!p()){f(!0);try{let v={...s==="edit"&&n?{id:n.id}:{},title:a.title.trim(),description:a.description.trim(),date:new Date(a.date+"T00:00:00"),startTime:a.startTime||void 0,endTime:a.endTime||void 0,location:a.location.trim()||void 0,type:a.type,color:a.color,attendees:a.attendees?a.attendees.split(",").map(S=>S.trim()).filter(Boolean):void 0};await i(v),e(!1);}catch(v){console.error("Error saving event:",v);}finally{f(!1);}}},m=()=>{n&&o&&(o(n.id),e(!1));},g=b=>{let v=Od.find(S=>S.value===b);l(S=>({...S,type:b,color:v?.color||S.color}));};return jsx(Dialog,{open:t,onOpenChange:e,children:jsxs(DialogContent,{className:"sm:max-w-[500px]",children:[jsxs(DialogHeader,{children:[jsxs(DialogTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"w-5 h-5"}),s==="create"?"Create Event":"Edit Event"]}),jsx(DialogDescription,{children:s==="create"?"Add a new event to your calendar.":"Edit the event details."})]}),jsxs("form",{onSubmit:h,className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"title",children:"Title *"}),jsx(Input,{id:"title",value:a.title,onChange:b=>l(v=>({...v,title:b.target.value})),placeholder:"Event title",className:cn(c.title&&"border-red-500")}),c.title&&jsx("p",{className:"text-sm text-red-500",children:c.title})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"description",children:"Description"}),jsx(Textarea,{id:"description",value:a.description,onChange:b=>l(v=>({...v,description:b.target.value})),placeholder:"Event description (optional)",rows:3})]}),jsxs("div",{className:"grid grid-cols-3 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"date",children:"Date *"}),jsx(Input,{id:"date",type:"date",value:a.date,onChange:b=>l(v=>({...v,date:b.target.value})),className:cn(c.date&&"border-red-500")}),c.date&&jsx("p",{className:"text-sm text-red-500",children:c.date})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"startTime",children:"Start Time"}),jsx(Input,{id:"startTime",type:"time",value:a.startTime,onChange:b=>l(v=>({...v,startTime:b.target.value})),placeholder:"09:00"})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"endTime",children:"End Time"}),jsx(Input,{id:"endTime",type:"time",value:a.endTime,onChange:b=>l(v=>({...v,endTime:b.target.value})),placeholder:"10:00",className:cn(c.endTime&&"border-red-500")}),c.endTime&&jsx("p",{className:"text-sm text-red-500",children:c.endTime})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{htmlFor:"location",className:"flex items-center gap-2",children:[jsx(MapPin,{className:"w-4 h-4"}),"Location"]}),jsx(Input,{id:"location",value:a.location,onChange:b=>l(v=>({...v,location:b.target.value})),placeholder:"Meeting room, address, or link"})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Type,{className:"w-4 h-4"}),"Type"]}),jsxs(Select,{value:a.type,onValueChange:g,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsx(SelectContent,{children:Od.map(b=>jsx(SelectItem,{value:b.value,children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.color}}),b.label]})},b.value))})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Palette,{className:"w-4 h-4"}),"Color"]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:a.color,onChange:b=>l(v=>({...v,color:b})),presets:Yy,showInput:!1,size:"sm"}),jsx("div",{className:"w-6 h-6 rounded border",style:{backgroundColor:a.color}})]})]})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"attendees",children:"Attendees"}),jsx(Input,{id:"attendees",value:a.attendees,onChange:b=>l(v=>({...v,attendees:b.target.value})),placeholder:"John Doe, Jane Smith (comma-separated)"})]}),jsxs(DialogFooter,{className:"gap-2",children:[s==="edit"&&o&&jsx(Button,{type:"button",variant:"destructive",onClick:m,className:"mr-auto",children:"Delete Event"}),jsx(Button,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:u,children:"Cancel"}),jsx(Button,{type:"submit",disabled:u,children:u?s==="create"?"Creating...":"Saving...":s==="create"?"Create Event":"Save Changes"})]})]})]})})}var zd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c0=["January","February","March","April","May","June","July","August","September","October","November","December"],Fd={meeting:"bg-blue-500",task:"bg-green-500",reminder:"bg-yellow-500",event:"bg-purple-500"};function BA({events:t=[],onEventClick:e,onEventAdd:n,onEventEdit:r,onEventDelete:i,className:o,showWeekends:s=!0,showEventDetails:a=!0,disabled:l=!1,minDate:c,maxDate:d,highlightToday:u=!0,height:f}){let {hasProAccess:h,isLoading:m}=lt();if(!m&&!h)return jsx(Card,{className:cn("w-full",o),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Calendar is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let [b,v]=Mn.useState(new Date),[S,T]=Mn.useState(null);Mn.useState("month");let [k,y]=Mn.useState(!1),[w,O]=Mn.useState("create"),[X,R]=Mn.useState(null),[ce,Q]=Mn.useState(null),[G,x]=Mn.useState(null),C=new Date,M=b.getMonth(),U=b.getFullYear(),z=new Date(U,M,1),J=new Date(U,M+1,0),ie=new Date(z);ie.setDate(ie.getDate()-ie.getDay());let $=new Date(J);$.setDate($.getDate()+(6-$.getDay()));let ae=[],_e=new Date(ie);for(;_e<=$;)ae.push(new Date(_e)),_e.setDate(_e.getDate()+1);let $e=F=>t.filter(D=>new Date(D.date).toDateString()===F.toDateString()),it=F=>F.toDateString()===C.toDateString(),ln=F=>F.getMonth()===M,ht=F=>S&&F.toDateString()===S.toDateString(),Wt=F=>!!(l||c&&F<c||d&&F>d),mt=F=>{let D=new Date(b);F==="prev"?D.setMonth(M-1):D.setMonth(M+1),v(D);},jn=F=>{if(Wt(F))return;T(F);let D=$e(F);D.length===0?(O("create"),R(null),y(!0)):D.length===1&&e?.(D[0]);},Ut=(F,D)=>{D.stopPropagation(),e?.(F);},cn$1=(F,D)=>{Q(F),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",F.id);let K=D.target;K.style.opacity="0.5";},ot=F=>{Q(null),x(null);let D=F.target;D.style.opacity="1";},ve=(F,D)=>{Wt(F)||!ce||(D.preventDefault(),D.dataTransfer.dropEffect="move",x(F));},Nt=(F,D)=>{if(D.preventDefault(),!(!ce||Wt(F))){if(ce.date.toDateString()!==F.toDateString()){let K={...ce,date:F};r?.(K);}Q(null),x(null);}},A=(F,D)=>{D.stopPropagation(),O("edit"),R(F),y(!0);},ee=(F,D)=>{D.stopPropagation(),i?.(F.id);},de=F=>{w==="create"?n?.(F):w==="edit"&&F.id&&r?.(F);},Y=F=>{i?.(F);},st=()=>{v(new Date),T(new Date);},Tt=s?ae:ae.filter(F=>{let D=F.getDay();return D!==0&&D!==6}),si=s?zd:zd.slice(1,6);return jsxs(Fragment,{children:[jsxs(Card,{className:cn("w-full max-w-full overflow-hidden",o),style:{height:f?`${f}px`:void 0},children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"h-5 w-5"}),"Calendar"]}),jsxs(CardDescription,{children:[c0[M]," ",U]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Button,{variant:"outline",size:"sm",onClick:st,children:"Today"}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("prev"),disabled:l,children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("next"),disabled:l,children:jsx(ChevronRight,{className:"h-4 w-4"})})]})]})}),jsx(CardContent,{className:"overflow-x-auto",children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"grid grid-cols-7 gap-1 w-full",style:{minWidth:"500px"},children:[si.map(F=>jsx("div",{className:"p-1 text-center text-xs font-medium text-muted-foreground min-w-[70px]",children:F},F)),Tt.map((F,D)=>{let K=$e(F),ue=ln(F),we=it(F),Je=ht(F),Ht=Wt(F);return jsxs("div",{className:cn("min-h-[80px] min-w-[70px] p-1 border border-border/50 cursor-pointer hover:bg-muted/50 transition-colors text-xs flex flex-col",!ue&&"text-muted-foreground bg-muted/20",we&&u&&"bg-primary/10 border-primary/50",Je&&"bg-primary/20 border-primary",Ht&&"cursor-not-allowed opacity-50",G&&G.toDateString()===F.toDateString()&&"bg-primary/30 border-primary"),onClick:()=>jn(F),onDragOver:Qe=>ve(F,Qe),onDrop:Qe=>Nt(F,Qe),children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:cn("text-sm font-medium",we&&"text-primary font-bold"),children:F.getDate()}),K.length>0&&jsx(Badge,{variant:"secondary",className:"text-xs px-1",children:K.length})]}),jsxs("div",{className:"flex-1 space-y-1 overflow-hidden",children:[K.slice(0,3).map(Qe=>jsxs("div",{className:cn("text-xs p-1 mb-1 rounded text-white cursor-move group relative select-none block w-full truncate",Qe.color||Fd[Qe.type||"event"]),draggable:!l,onClick:dn=>Ut(Qe,dn),onDragStart:dn=>cn$1(Qe,dn),onDragEnd:ot,style:{backgroundColor:Qe.color||void 0},children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"truncate flex-1",children:Qe.title}),a&&jsxs("div",{className:"hidden group-hover:flex items-center gap-1 ml-1",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>A(Qe,dn),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>ee(Qe,dn),children:jsx(Trash2,{className:"h-3 w-3"})})]})]}),Qe.startTime&&jsxs("div",{className:"flex items-center gap-1 mt-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:Qe.startTime})]})]},Qe.id)),K.length>3&&jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",K.length-3," more"]})]})]},D)})]}),S&&jsxs("div",{className:"border rounded-lg p-4 bg-muted/50",children:[jsx("h4",{className:"font-medium mb-2",children:S.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxs("div",{className:"space-y-2",children:[$e(S).map(F=>jsxs("div",{className:"flex items-start gap-3 p-2 border rounded",children:[jsx("div",{className:cn("w-3 h-3 rounded-full mt-1 flex-shrink-0",F.color||Fd[F.type||"event"])}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h5",{className:"font-medium",children:F.title}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(Button,{variant:"ghost",size:"sm",onClick:D=>A(F,D),children:jsx(Edit,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:D=>ee(F,D),children:jsx(Trash2,{className:"h-4 w-4"})})]})]}),F.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.description}),jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-2",children:[F.startTime&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsxs("span",{children:[F.startTime," - ",F.endTime]})]}),F.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MapPin,{className:"h-3 w-3"}),jsx("span",{children:F.location})]}),F.attendees&&F.attendees.length>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(User,{className:"h-3 w-3"}),jsxs("span",{children:[F.attendees.length," attendees"]})]})]})]})]},F.id)),$e(S).length===0&&jsxs("div",{className:"text-center py-4",children:[jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"No events scheduled for this date"}),jsxs(Button,{variant:"outline",size:"sm",onClick:()=>{O("create"),R(null),y(!0);},children:[jsx(Plus,{className:"h-4 w-4 mr-1"}),"Add Event"]})]})]})]})]})})]}),jsx(Rd,{open:k,onOpenChange:y,event:X,selectedDate:S,onSave:de,onDelete:Y,mode:w})]})}var k0={primary:"text-blue-600",success:"text-green-600",warning:"text-yellow-600",danger:"text-red-600",info:"text-purple-600"},N0={sm:"col-span-1",md:"col-span-2",lg:"col-span-3",xl:"col-span-4"};function YA({metrics:t=[],widgets:e=[],onMetricClick:n,onWidgetAction:r,className:i,showHeader:o=!0,title:s="Dashboard",description:a="Overview of your key metrics and performance",refreshable:l=!0,onRefresh:c,loading:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",i),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Dashboard is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(!1),b=async()=>{if(c){g(!0);try{await c();}finally{g(!1);}}},v=w=>typeof w=="number"?w>=1e6?(w/1e6).toFixed(1)+"M":w>=1e3?(w/1e3).toFixed(1)+"K":w.toLocaleString():w.toString(),S=w=>{switch(w){case"increase":return jsx(ArrowUpRight,{className:"h-4 w-4"});case"decrease":return jsx(ArrowDownRight,{className:"h-4 w-4"});case"neutral":return jsx(Minus,{className:"h-4 w-4"})}},T=w=>{switch(w){case"increase":return "text-green-600";case"decrease":return "text-red-600";case"neutral":return "text-gray-600"}},_=w=>{let O=w.color?k0[w.color]:"text-foreground";return jsxs(Card,{className:cn("cursor-pointer hover:shadow-md transition-shadow",n&&"hover:bg-muted/50"),onClick:()=>n?.(w),children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsx(CardTitle,{className:"text-sm font-medium",children:w.title}),jsx("div",{className:cn("h-4 w-4",O),children:w.icon})]}),jsxs(CardContent,{children:[jsx("div",{className:"text-2xl font-bold",children:v(w.value)}),w.change&&jsxs("div",{className:cn("flex items-center text-xs mt-1",T(w.change.type)),children:[S(w.change.type),jsxs("span",{className:"ml-1",children:[Math.abs(w.change.value),"% from ",w.change.period]})]}),w.description&&jsx("p",{className:"text-xs text-muted-foreground mt-1",children:w.description})]})]},w.id)},I=w=>{let O=N0[w.size||"md"];return jsxs(Card,{className:cn("h-fit",O),children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx(CardTitle,{className:"text-base",children:w.title}),w.description&&jsx(CardDescription,{className:"mt-1",children:w.description})]}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>r?.(w.id,"menu"),children:jsx(BarChart3,{className:"h-4 w-4"})})]})}),jsx(CardContent,{children:w.loading?jsx("div",{className:"flex items-center justify-center h-32",children:jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.error?jsx("div",{className:"flex items-center justify-center h-32 text-destructive",children:jsx("p",{className:"text-sm",children:w.error})}):w.content})]},w.id)},k=[{id:"total-users",title:"Total Users",value:2543,change:{value:12,type:"increase",period:"last month"},icon:jsx(Users,{className:"h-4 w-4"}),color:"primary"},{id:"revenue",title:"Revenue",value:"$12,345",change:{value:8,type:"increase",period:"last month"},icon:jsx(DollarSign,{className:"h-4 w-4"}),color:"success"},{id:"active-sessions",title:"Active Sessions",value:1234,change:{value:2,type:"decrease",period:"last hour"},icon:jsx(Activity,{className:"h-4 w-4"}),color:"warning"},{id:"conversion-rate",title:"Conversion Rate",value:"3.2%",change:{value:.3,type:"increase",period:"last week"},icon:jsx(TrendingUp,{className:"h-4 w-4"}),color:"info"}],y=t.length>0?t:k;return d?jsx("div",{className:cn("w-full",i),children:jsxs("div",{className:"animate-pulse space-y-4",children:[jsx("div",{className:"h-8 bg-muted rounded w-1/4"}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[...Array(4)].map((w,O)=>jsx("div",{className:"h-32 bg-muted rounded"},O))})]})}):jsxs("div",{className:cn("w-full space-y-6",i),children:[o&&jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s}),jsx("p",{className:"text-muted-foreground",children:a})]}),l&&jsxs(Button,{variant:"outline",onClick:b,disabled:m,children:[m?jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary mr-2"}):jsx(Activity,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:y.map(_)}),e.length>0&&jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:e.map(I)}),jsxs("div",{className:"flex items-center gap-2 pt-4 border-t",children:[jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Download,{className:"h-4 w-4 mr-2"}),"Export Data"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Calendar,{className:"h-4 w-4 mr-2"}),"Schedule Report"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Star,{className:"h-4 w-4 mr-2"}),"Save View"]})]})]})}function f1({columns:t,data:e,searchable:n=!0,filterable:r=!0,exportable:i=!0,selectable:o=!1,pagination:s=!0,pageSize:a=10,className:l,onRowSelect:c,onExport:d,features:u={},theme:f={},texts:p={}}){let {hasProAccess:m,isLoading:g}=lt();if(!g&&!m)return jsx(Card,{className:cn("w-full",l),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Data Table is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[v,S]=Mn.useState([]),[T,_]=Mn.useState([]),[I,k]=Mn.useState({}),[y,w]=Mn.useState({}),[O,X]=Mn.useState(""),R=useReactTable({data:e,columns:t,onSortingChange:S,onColumnFiltersChange:_,getCoreRowModel:getCoreRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getFilteredRowModel:getFilteredRowModel(),onColumnVisibilityChange:k,onRowSelectionChange:w,onGlobalFilterChange:X,globalFilterFn:"includesString",state:{sorting:v,columnFilters:T,columnVisibility:I,rowSelection:y,globalFilter:O},initialState:{pagination:{pageSize:a}}});Mn.useEffect(()=>{if(c&&o){let G=R.getFilteredSelectedRowModel().rows.map(x=>x.original);c(G);}},[y,c,o,R]);({sorting:u.sorting!==!1,filtering:u.filtering!==!1||r,pagination:u.pagination!==!1||s,search:u.search!==!1||n,columnVisibility:u.columnVisibility!==!1,rowSelection:u.rowSelection!==!1||o,export:u.export!==!1||i});let Q=()=>{if(d){let G=R.getFilteredSelectedRowModel().rows,x=G.length>0?G.map(C=>C.original):R.getFilteredRowModel().rows.map(C=>C.original);d(x);}};return jsxs("div",{className:cn("space-y-4",l),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center space-x-2",children:[n&&jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),jsx(Input,{placeholder:"Search all columns...",value:O,onChange:G=>X(G.target.value),className:"pl-8 w-64"})]}),r&&jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Filter,{className:"mr-2 h-4 w-4"}),"Filters"]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[i&&jsxs(Button,{variant:"outline",size:"sm",onClick:Q,children:[jsx(Download,{className:"mr-2 h-4 w-4"}),"Export"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Settings,{className:"mr-2 h-4 w-4"}),"Columns"]})]})]}),jsx("div",{className:"rounded-md border",children:jsxs("table",{className:"w-full",children:[jsx("thead",{children:R.getHeaderGroups().map(G=>jsx("tr",{className:"border-b",children:G.headers.map(x=>jsx("th",{className:"h-12 px-4 text-left align-middle font-medium text-muted-foreground",children:x.isPlaceholder?null:jsxs("div",{className:cn("flex items-center space-x-2",x.column.getCanSort()&&"cursor-pointer select-none"),onClick:x.column.getToggleSortingHandler(),children:[flexRender(x.column.columnDef.header,x.getContext()),x.column.getCanSort()&&jsx("div",{className:"ml-2",children:x.column.getIsSorted()==="asc"?jsx(ArrowUp,{className:"h-4 w-4"}):x.column.getIsSorted()==="desc"?jsx(ArrowDown,{className:"h-4 w-4"}):jsx(ArrowUpDown,{className:"h-4 w-4"})})]})},x.id))},G.id))}),jsx("tbody",{children:R.getRowModel().rows?.length?R.getRowModel().rows.map(G=>jsx("tr",{className:cn("border-b transition-colors hover:bg-muted/50",G.getIsSelected()&&"bg-muted"),children:G.getVisibleCells().map(x=>jsx("td",{className:"p-4 align-middle",children:flexRender(x.column.columnDef.cell,x.getContext())},x.id))},G.id)):jsx("tr",{children:jsx("td",{colSpan:t.length,className:"h-24 text-center",children:"No results found."})})})]})}),s&&jsxs("div",{className:"flex items-center justify-between px-2",children:[jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:o&&R.getFilteredSelectedRowModel().rows.length>0&&jsxs("span",{children:[R.getFilteredSelectedRowModel().rows.length," of"," ",R.getFilteredRowModel().rows.length," row(s) selected."]})}),jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsx("select",{value:R.getState().pagination.pageSize,onChange:G=>R.setPageSize(Number(G.target.value)),className:"h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",children:[10,20,30,40,50].map(G=>jsx("option",{value:G,children:G},G))})]}),jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",R.getState().pagination.pageIndex+1," of"," ",R.getPageCount()]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:jsx(ChevronsLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:jsx(ChevronRight,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:jsx(ChevronsRight,{className:"h-4 w-4"})})]})]})]})]})}var uE=t=>t.startsWith("image/")?jsx(Image,{className:"h-4 w-4"}):t.startsWith("video/")?jsx(Video,{className:"h-4 w-4"}):t.startsWith("audio/")?jsx(Music,{className:"h-4 w-4"}):t.includes("pdf")?jsx(FileText,{className:"h-4 w-4"}):t.includes("zip")||t.includes("rar")?jsx(Archive,{className:"h-4 w-4"}):jsx(File,{className:"h-4 w-4"}),fE=t=>{if(t===0)return "0 Bytes";let e=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+n[r]};function C1({accept:t="*",multiple:e=!1,maxSize:n=10,maxFiles:r=5,onUpload:i,onRemove:o,className:s,disabled:a=!1,showPreview:l=!0,allowedTypes:c=[]}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",s),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"File Upload is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[h,m]=Mn.useState([]),[g,b]=Mn.useState(!1),[v,S]=Mn.useState(!1),T=Mn.useRef(null),_=R=>R.size>n*1024*1024?`File size must be less than ${n}MB`:c.length>0&&!c.includes(R.type)?`File type ${R.type} is not allowed`:null,I=async R=>{if(!R||a)return;let ce=Array.from(R);if(h.length+ce.length>r){alert(`Maximum ${r} files allowed`);return}let Q=[],G=[];if(ce.forEach(x=>{let C=_(x);C?G.push(`${x.name}: ${C}`):Q.push({file:x,id:Math.random().toString(36).substr(2,9),status:"uploading",progress:0});}),G.length>0&&alert(G.join(`
|
|
18
|
-
`)),Q.length!==0){if(m(x=>[...x,...Q]),S(!0),i)try{await i(Q.map(x=>x.file)),m(x=>x.map(C=>Q.find(M=>M.id===C.id)?{...C,status:"success",progress:100}:C));}catch{m(C=>C.map(M=>Q.find(U=>U.id===M.id)?{...M,status:"error",error:"Upload failed"}:M));}else for(let x of Q){let C=setInterval(()=>{m(M=>M.map(U=>U.id===x.id&&U.progress<100?{...U,progress:U.progress+10}:U));},100);setTimeout(()=>{clearInterval(C),m(M=>M.map(U=>U.id===x.id?{...U,status:"success",progress:100}:U));},1e3);}S(!1);}},k=R=>{m(ce=>ce.filter(Q=>Q.id!==R.id)),o&&o(R.file);},y=R=>{R.preventDefault(),b(!1),I(R.dataTransfer.files);},w=R=>{R.preventDefault(),b(!0);},O=R=>{R.preventDefault(),b(!1);},X$1=()=>{a||T.current?.click();};return jsxs(Card,{className:cn("w-full",s),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Upload,{className:"h-5 w-5"}),"File Upload"]}),jsxs(CardDescription,{children:[e?`Upload up to ${r} files`:"Upload a file"," (max ",n,"MB each)"]})]}),jsxs(CardContent,{className:"space-y-4",children:[jsxs("div",{className:cn("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors",g?"border-primary bg-primary/5":"border-muted-foreground/25",a&&"cursor-not-allowed opacity-50"),onDrop:y,onDragOver:w,onDragLeave:O,onClick:X$1,children:[jsx(Upload,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Drag and drop files here, or click to select"}),jsx("p",{className:"text-xs text-muted-foreground",children:t==="*"?"Any file type":`Accepted types: ${t}`})]}),jsx("input",{ref:T,type:"file",accept:t,multiple:e,onChange:R=>I(R.target.files),className:"hidden",disabled:a}),h.length>0&&jsxs("div",{className:"space-y-2",children:[jsxs("h4",{className:"text-sm font-medium",children:["Uploaded Files (",h.length,")"]}),h.map(R=>jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[jsx("div",{className:"flex-shrink-0",children:uE(R.file.type)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("p",{className:"text-sm font-medium truncate",children:R.file.name}),jsxs(Badge,{variant:R.status==="success"?"success":R.status==="error"?"destructive":"secondary",children:[R.status==="uploading"&&jsx(Loader2,{className:"h-3 w-3 mr-1 animate-spin"}),R.status==="success"&&jsx(CheckCircle2,{className:"h-3 w-3 mr-1"}),R.status==="error"&&jsx(AlertCircle,{className:"h-3 w-3 mr-1"}),R.status]})]}),jsxs("div",{className:"flex items-center justify-between mt-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:fE(R.file.size)}),R.status==="uploading"&&jsxs("span",{className:"text-xs text-muted-foreground",children:[R.progress,"%"]})]}),R.status==="uploading"&&jsx(Progress,{value:R.progress,className:"mt-2"}),R.error&&jsx("p",{className:"text-xs text-destructive mt-1",children:R.error})]}),jsxs("div",{className:"flex items-center gap-1",children:[R.status==="success"&&l&&R.file.type.startsWith("image/")&&jsx(Button,{variant:"ghost",size:"sm",children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>k(R),disabled:R.status==="uploading",children:jsx(X,{className:"h-4 w-4"})})]})]},R.id))]}),v&&jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsx(Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading files..."]})]})]})}var _E={low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"};function B1({columns:t,onCardMove:e,onCardClick:n,onCardEdit:r,onCardDelete:i,onAddCard:o,onAddColumn:s,className:a,showAddColumn:l=!0,showCardDetails:c=!0,disabled:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",a),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Kanban Board is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(null),[b,v]=Mn.useState(null),[S,T]=Mn.useState(null),_=(C,M)=>{if(d)return;let U=t.find(z=>z.cards.some(J=>J.id===M));g(M),T(U?.id||null),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",M),C.currentTarget.classList.add("opacity-50");},I=C=>{d||(g(null),v(null),T(null),C.currentTarget.classList.remove("opacity-50"));},k=(C,M)=>{d||(C.preventDefault(),C.dataTransfer.dropEffect="move",v(M));},y=(C,M)=>{d||(C.preventDefault(),v(M));},w=(C,M)=>{if(d)return;C.preventDefault();let U=C.currentTarget.getBoundingClientRect();(C.clientX<U.left||C.clientX>U.right||C.clientY<U.top||C.clientY>U.bottom)&&v(null);},O=(C,M)=>{if(d)return;C.preventDefault();let U=C.dataTransfer.getData("text/plain")||m;if(U&&e&&S&&S!==M){let J=t.find(ie=>ie.id===M)?.cards.length||0;e(U,S,M,J);}g(null),v(null),T(null);},X=C=>{d||n?.(C);},R=(C,M)=>{d||(M.stopPropagation(),r?.(C));},ce=(C,M)=>{d||(M.stopPropagation(),i?.(C));},Q=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric"}),G=C=>C<new Date,x=C=>C.split(" ").map(M=>M[0]).join("").toUpperCase();return jsx("div",{className:cn("w-full",a),children:jsxs("div",{className:"flex gap-6 overflow-x-auto pb-4",children:[t.map(C=>{let M=C.limit&&C.cards.length>C.limit,U=b===C.id;return jsx("div",{className:cn("flex-shrink-0 w-80 transition-colors duration-200",U&&"bg-primary/5 rounded-lg border-2 border-primary/20"),onDragOver:z=>k(z,C.id),onDragEnter:z=>y(z,C.id),onDragLeave:z=>w(z,C.id),onDrop:z=>O(z,C.id),children:jsxs(Card,{className:"h-full",children:[jsxs(CardHeader,{className:"pb-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[C.color&&jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx(CardTitle,{className:"text-sm font-medium",children:C.title}),jsx(Badge,{variant:"secondary",className:"text-xs",children:C.cards.length})]}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(MoreHorizontal,{className:"h-4 w-4"})})]}),C.limit&&jsx(CardDescription,{className:cn("text-xs",M&&"text-destructive"),children:M?"Over limit":`${C.cards.length}/${C.limit} cards`})]}),jsxs(CardContent,{className:"space-y-3",children:[C.cards.map(z=>jsxs("div",{draggable:!d,onDragStart:J=>_(J,z.id),onDragEnd:I,onClick:()=>X(z),className:cn("p-3 bg-background border rounded-lg cursor-pointer hover:shadow-md transition-all duration-200","group relative select-none",m===z.id&&"opacity-50 scale-95",d&&"cursor-not-allowed"),children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:"font-medium text-sm mb-1",children:z.title}),z.description&&jsx("p",{className:"text-xs text-muted-foreground mb-2 line-clamp-2",children:z.description})]}),jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>R(z,J),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>ce(z,J),children:jsx(Trash2,{className:"h-3 w-3"})}),jsx("div",{className:"cursor-move",children:jsx(GripVertical,{className:"h-3 w-3 text-muted-foreground"})})]})]}),z.tags&&z.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:z.tags.map((J,ie)=>jsx(Badge,{variant:"outline",className:"text-xs px-1 py-0",children:J},ie))}),c&&jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[jsxs("div",{className:"flex items-center gap-2",children:[z.priority&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:cn("w-2 h-2 rounded-full",_E[z.priority])}),jsx("span",{className:"capitalize",children:z.priority})]}),z.dueDate&&jsxs("div",{className:cn("flex items-center gap-1",G(z.dueDate)&&"text-destructive"),children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:Q(z.dueDate)})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[z.comments&&z.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:z.comments})]}),z.attachments&&z.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:z.attachments})]}),z.assignee&&jsxs(Avatar,{className:"h-5 w-5",children:[jsx(AvatarImage,{src:z.assignee.avatar}),jsx(AvatarFallback,{className:"text-xs",children:x(z.assignee.name)})]})]})]})]},z.id)),o&&jsxs(Button,{variant:"ghost",size:"sm",onClick:()=>o(C.id),className:"w-full justify-start text-muted-foreground hover:text-foreground",disabled:d,children:[jsx(Plus,{className:"h-4 w-4 mr-2"}),"Add card"]})]})]})},C.id)}),l&&s&&jsx("div",{className:"flex-shrink-0 w-80",children:jsxs(Button,{variant:"outline",onClick:s,className:"w-full h-full min-h-[200px] border-dashed justify-center items-center",disabled:d,children:[jsx(Plus,{className:"h-6 w-6 mr-2"}),"Add column"]})})]})})}var Aa=class{constructor(e,n="lru"){this.cache=new Map;this.maxSize=e,this.strategy=n;}set(e,n,r=!1){this.cache.size>=this.maxSize&&this.evict(),this.cache.set(e,{data:n,timestamp:Date.now(),accessCount:0,compressed:r});}get(e){let n=this.cache.get(e);return n?(n.accessCount++,n.timestamp=Date.now(),n.data):null}evict(){if(this.cache.size===0)return;let e=null;switch(this.strategy){case"lru":let n=1/0;for(let[i,o]of this.cache)o.timestamp<n&&(n=o.timestamp,e=i);break;case"lfu":let r=1/0;for(let[i,o]of this.cache)o.accessCount<r&&(r=o.accessCount,e=i);break;case"fifo":e=this.cache.keys().next().value;break}e&&this.cache.delete(e);}clear(){this.cache.clear();}getStats(){return {size:this.cache.size,hitRate:.95}}};function $1({data:t,config:e={},renderItem:n,height:r=400,onMemoryUpdate:i,className:o}){let{chunkSize:s=1e3,maxMemoryItems:a=1e4,cacheStrategy:l="lru",compression:c=!1,autoCleanup:d=!0,cleanupThreshold:u=.8,streamingMode:f=!1,enableAnalytics:p=!1,analyticsCallback:h}=e,[m,g]=useState({start:0,end:Math.min(s,t.length)}),[b,v]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95}),S=useRef(null),T=useRef(new Aa(Math.floor(a/s),l)),_=useRef(),I=useMemo(()=>{let y=m.start,w=Math.min(m.end,t.length),O=`${y}-${w}`,X=T.current.get(O);if(X&&X.length===w-y)return X;let R=t.slice(y,w);return T.current.set(O,R,c),R},[t,m,c]),k=useCallback(y=>{let w=y.currentTarget.scrollTop,O=y.currentTarget.clientHeight,X=60,R=Math.floor(w/X),ce=Math.ceil(O/X),Q=Math.floor(ce*.5),G=Math.max(0,R-Q),x=Math.min(t.length,R+ce+Q);_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{g({start:G,end:x});},16);},[t.length]);return useEffect(()=>{let y=T.current.getStats(),w={memoryUsage:I.length*1024,itemCount:I.length,cacheHitRate:y.hitRate,compressionRatio:c?.7:1,lastCleanup:Date.now()};v(w),p&&h&&h(w),i&&i(w);},[I,p,h,i,c]),useEffect(()=>{if(!d)return;let y=setInterval(()=>{I.length/a>u&&T.current.clear();},5e3);return ()=>clearInterval(y)},[d,u,a,I.length]),jsx("div",{ref:S,className:cn("overflow-auto border rounded-lg bg-background",o),style:{height:r},onScroll:k,children:jsx("div",{style:{height:t.length*60,position:"relative"},children:jsx("div",{style:{transform:`translateY(${m.start*60}px)`,position:"absolute",width:"100%"},children:I.map((y,w)=>jsx(Mn.Fragment,{children:n(y,m.start+w)},m.start+w))})})})}function K1({onStatsUpdate:t,showRealTime:e=!1,className:n}){let[r,i]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95});return useEffect(()=>{if(!e)return;let o=setInterval(()=>{let s={memoryUsage:Math.random()*50*1024*1024,itemCount:Math.floor(Math.random()*5e4),cacheHitRate:.9+Math.random()*.1,lastCleanup:Date.now()};i(s),t&&t(s);},1e3);return ()=>clearInterval(o)},[e,t]),e?jsx("div",{className:cn("text-xs text-muted-foreground",n),children:"Memory Analytics Active - Updates every second"}):null}function V1(t=[],e){let[n,r]=useState(t),{interval:i=1e3,maxItems:o=1e4}=e||{},s=useCallback(l=>{r(c=>{let d=[...c,l];return d.length>o?d.slice(-o):d});},[o]),a=useCallback(()=>{r([]);},[]);return {data:n,addItem:s,clearData:a}}var yh=ai(fi(),1);function ct(t){this.content=t;}ct.prototype={constructor:ct,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return -1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ct(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ct(n)},addToStart:function(t,e){return new ct([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ct(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new ct(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1]);},prepend:function(t){return t=ct.from(t),t.size?new ct(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ct.from(t),t.size?new ct(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ct.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n;}),t},get size(){return this.content.length>>1}};ct.from=function(t){if(t instanceof ct)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ct(e)};var Da=ct;function fu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=fu(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize;}}function pu(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return {a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return {a:n,b:r}}if(s.content.size||a.content.size){let c=pu(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l;}}var N=class{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize;}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,i+d);}a=c;}}descendants(e){this.nodesBetween(0,this.size,e);}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c;},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new N(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l;}return new N(r,i)}cutByIndex(e,n){return e==n?N.empty:e==0&&n==this.content.length?this:new N(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new N(i,o)}addToStart(e){return new N([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new N(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return !1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return !1;return !0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize;}}findDiffStart(e,n=0){return fu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return pu(this,e,n,r)}findIndex(e){if(e==0)return yo(0,e);if(e==this.size)return yo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?yo(n+1,o):yo(n,r);r=o;}}toString(){return "<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return N.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new N(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return N.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o);}return new N(n||e,r)}static from(e){if(!e)return N.empty;if(e instanceof N)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new N([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};N.empty=new N([],0);var Ia={index:0,offset:0};function yo(t,e){return Ia.index=t,Ia.offset=e,Ia}function vo(t,e){if(t===e)return !0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return !1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return !1;if(n){if(t.length!=e.length)return !1;for(let r=0;r<t.length;r++)if(!vo(t[r],e[r]))return !1}else {for(let r in t)if(!(r in e)||!vo(t[r],e[r]))return !1;for(let r in e)if(!(r in t))return !1}return !0}var be=class{constructor(e,n){this.type=e,this.attrs=n;}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else {if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o);}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return !0;return !1}eq(e){return this==e||this.type==e.type&&vo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return !0;if(e.length!=n.length)return !1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return !1;return !0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return be.none;if(e instanceof be)return [e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};be.none=[];var Qn=class extends Error{},B=class{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r;}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=mu(this.content,e+this.openStart,n);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,n){return new B(hu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return B.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(N.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new B(e,r,i)}};B.empty=new B(N.empty,0,0);function hu(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(hu(o.content,e-i-1,n-i-1)))}function mu(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=mu(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function UE(t,e,n){if(n.openStart>t.depth)throw new Qn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qn("Inconsistent open depths");return gu(t,e,n,0)}function gu(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=gu(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else {let{start:s,end:a}=HE(n,t);return Xn(o,yu(t,s,a,e,r))}else return Xn(o,wo(t,e,r))}function bu(t,e){if(!e.type.compatibleContent(t.type))throw new Qn("Cannot join "+e.type.name+" onto "+t.type.name)}function Pa(t,e,n){let r=t.node(n);return bu(r,e.node(n)),r}function Zn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t);}function pi(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Zn(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Zn(i.child(a),r);e&&e.depth==n&&e.textOffset&&Zn(e.nodeBefore,r);}function Xn(t,e){return t.type.checkContent(e),t.copy(e)}function yu(t,e,n,r,i){let o=t.depth>i&&Pa(t,e,i+1),s=r.depth>i&&Pa(n,r,i+1),a=[];return pi(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(bu(o,s),Zn(Xn(o,yu(t,e,n,r,i+1)),a)):(o&&Zn(Xn(o,wo(t,e,i+1)),a),pi(e,n,i,a),s&&Zn(Xn(s,wo(n,r,i+1)),a)),pi(r,null,i,a),new N(a)}function wo(t,e,n){let r=[];if(pi(null,t,n,r),t.depth>n){let i=Pa(t,e,n+1);Zn(Xn(i,wo(t,e,n+1)),r);}return pi(e,null,n,r),new N(r)}function HE(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(N.from(i));return {start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var er=class{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1;}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return be.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a;}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1;}return new er(n,r,o)}static resolveCached(e,n){let r=ru.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else ru.set(e,r=new Ba);let i=r.elts[r.i]=er.resolve(e,n);return r.i=(r.i+1)%$E,i}},Ba=class{constructor(){this.elts=[],this.i=0;}},$E=12,ru=new WeakMap,tr=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r;}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},KE=Object.create(null),et=class{constructor(e,n,r,i=be.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||N.empty;}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e);}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this);}descendants(e){this.nodesBetween(0,this.content.size,e);}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&vo(this.attrs,n||e.defaultAttrs||KE)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return B.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new B(c,i.depth-s,o.depth-s)}replace(e,n,r){return UE(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1;}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return {node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return {node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return {node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return {node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Eu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=N.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return !1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return !1;return !0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return !1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=be.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e);}if(!be.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check());}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON);}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=N.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};et.prototype.text=void 0;var Ar=class extends et{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r;}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Eu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ar(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ar(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Eu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var pn=class{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[];}static parse(e,n){let r=new za(e,n);if(r.next==null)return pn.empty;let i=vu(r);r.next&&r.err("Unexpected trailing text");let o=YE(JE(i));return ZE(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return !0;return !1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return N.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=o(u,a.concat(d));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0);}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next);}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
17
|
+
`,1;if(si>1e5&&si>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Y+=ue,ue.length}let ot=y(x);if(!ot)throw yr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let ve=QT(ot),Nt="",A=U||ve,ee={},de=new a.__emitter(a);jn();let Y="",st=0,Tt=0,si=0,F=!1;try{if(ot.__emitTokens)ot.__emitTokens(C,de);else {for(A.matcher.considerAll();;){si++,F?F=!1:A.matcher.considerAll(),A.matcher.lastIndex=Tt;let D=A.matcher.exec(C);if(!D)break;let K=C.substring(Tt,D.index),ue=cn(K,D);Tt=D.index+ue;}cn(C.substring(Tt));}return de.finalize(),Nt=de.toHTML(),{language:x,value:Nt,relevance:st,illegal:!1,_emitter:de,_top:A}}catch(D){if(D.message&&D.message.includes("Illegal"))return {language:x,value:dd(C),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:Tt,context:C.slice(Tt-100,Tt+100),mode:D.mode,resultSoFar:Nt},_emitter:de};if(i)return {language:x,value:dd(C),illegal:!1,relevance:0,errorRaised:D,_emitter:de,_top:A};throw D}}function f(x){let C={value:dd(x),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return C._emitter.addText(x),C}function p(x,C){C=C||a.languages||Object.keys(e);let M=f(x),U=C.filter(y).filter(O).map(ae=>u(ae,x,!1));U.unshift(M);let z=U.sort((ae,_e)=>{if(ae.relevance!==_e.relevance)return _e.relevance-ae.relevance;if(ae.language&&_e.language){if(y(ae.language).supersetOf===_e.language)return 1;if(y(_e.language).supersetOf===ae.language)return -1}return 0}),[J,ie]=z,$=J;return $.secondBest=ie,$}function h(x,C,M){let U=C&&n[C]||M;x.classList.add("hljs"),x.classList.add(`language-${U}`);}function m(x){let C=null,M=c(x);if(l(M))return;if(Q("before:highlightElement",{el:x,language:M}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new pd("One of your code blocks includes unescaped HTML.",x.innerHTML);C=x;let U=C.textContent,z=M?d(U,{language:M,ignoreIllegals:!0}):p(U);x.innerHTML=z.value,x.dataset.highlighted="yes",h(x,M,z.language),x.result={language:z.language,re:z.relevance,relevance:z.relevance},z.secondBest&&(x.secondBest={language:z.secondBest.language,relevance:z.secondBest.relevance}),Q("after:highlightElement",{el:x,result:z,text:U});}function g(x){a=pg(a,x);}let b=()=>{T(),Qr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.");};function v(){T(),Qr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.");}let S=!1;function T(){function x(){T();}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",x,!1),S=!0;return}document.querySelectorAll(a.cssSelector).forEach(m);}function _(x,C){let M=null;try{M=C(t);}catch(U){if(yr("Language definition for '{}' could not be registered.".replace("{}",x)),i)yr(U);else throw U;M=s;}M.name||(M.name=x),e[x]=M,M.rawDefinition=C.bind(null,t),M.aliases&&w(M.aliases,{languageName:x});}function I(x){delete e[x];for(let C of Object.keys(n))n[C]===x&&delete n[C];}function k(){return Object.keys(e)}function y(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function w(x,{languageName:C}){typeof x=="string"&&(x=[x]),x.forEach(M=>{n[M.toLowerCase()]=C;});}function O(x){let C=y(x);return C&&!C.disableAutodetect}function X(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=C=>{x["before:highlightBlock"](Object.assign({block:C.el},C));}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=C=>{x["after:highlightBlock"](Object.assign({block:C.el},C));});}function R(x){X(x),r.push(x);}function ce(x){let C=r.indexOf(x);C!==-1&&r.splice(C,1);}function Q(x,C){let M=x;r.forEach(function(U){U[M]&&U[M](C);});}function G(x){return Qr("10.7.0","highlightBlock will be removed entirely in v12.0"),Qr("10.7.0","Please use highlightElement now."),m(x)}Object.assign(t,{highlight:d,highlightAuto:p,highlightAll:T,highlightElement:m,highlightBlock:G,configure:g,initHighlighting:b,initHighlightingOnLoad:v,registerLanguage:_,unregisterLanguage:I,listLanguages:k,getLanguage:y,registerAliases:w,autoDetection:O,inherit:pg,addPlugin:R,removePlugin:ce}),t.debugMode=function(){i=!1;},t.safeMode=function(){i=!0;},t.versionString=t_,t.regex={concat:Er,lookahead:bg,either:hd,optional:bT,anyNumberOfTimes:gT};for(let x in Xs)typeof Xs[x]=="object"&&mg(Xs[x]);return Object.assign(t,Xs),t},ei=Ng({});ei.newInstance=()=>Ng({});Tg.exports=ei;ei.HighlightJS=ei;ei.default=ei;});function lt(){return {isLoading:!1,isAuthenticated:!0,isAdmin:!1,hasProAccess:!0,subscriptionPlan:"pro",subscription:{status:"active",plan:"pro"}}}var Oy=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#f97316","#84cc16","#ec4899","#6366f1"];function pA({data:t,type:e,series:n,title:r,subtitle:i,height:o=400,width:s="100%",xAxisKey:a="name",yAxisKey:l,showGrid:c=!0,showTooltip:d=!0,showLegend:u=!0,showBrush:f=!1,showReference:p=!1,referenceLines:h=[],referenceAreas:m=[],colors:g=Oy,className:b,onDataPointClick:v,onExport:S,onRefresh:T,customTooltip:_,customLegend:I,loading:k=!1,error:y=null,animated:w=!0,responsive:O=!0}){let {hasProAccess:R,isLoading:ce}=lt();if(!ce&&!R)return jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Chart is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[G,x]=Mn.useState(!1),C=Mn.useRef(null),M=Mn.useMemo(()=>{if(!t.length||!n.length)return null;let J=n[0],ie=t.map($e=>Number($e[J.dataKey])).filter($e=>!isNaN($e));if(ie.length<2)return null;let $=ie[0],_e=(ie[ie.length-1]-$)/$*100;return {direction:_e>0?"up":_e<0?"down":"neutral",percentage:Math.abs(_e).toFixed(1)}},[t,n]),U=J=>{S&&S(J);},z=()=>{let J={data:t,width:typeof s=="string"?void 0:s,height:o,margin:{top:20,right:30,left:20,bottom:20}},ie=n.filter($=>!$.hide);switch(e){case"line":return jsxs(LineChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Line,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],strokeWidth:$.strokeWidth||2,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),p&&m.map(($,ae)=>jsx(ReferenceArea,{x1:$.x1,x2:$.x2,fill:$.color||"#f0f0f0",fillOpacity:.3,label:$.label},ae)),f&&jsx(Brush,{})]});case"bar":return jsxs(BarChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Bar,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"area":return jsxs(AreaChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Area,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],fill:$.color||g[ae%g.length],fillOpacity:$.fillOpacity||.3,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"pie":return jsxs(PieChart,{...J,children:[d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),jsx(Pie,{data:t,dataKey:n[0]?.dataKey||"value",nameKey:a,cx:"50%",cy:"50%",outerRadius:Math.min(o,typeof s=="number"?s:400)/3,animationDuration:w?1e3:0,children:t.map(($,ae)=>jsx(Cell,{fill:g[ae%g.length]},`cell-${ae}`))})]});case"scatter":return jsxs(ScatterChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{dataKey:l}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Scatter,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey))]});default:return jsx("div",{children:"Unsupported chart type"})}};return k?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"flex items-center space-x-2",children:[jsx(RefreshCw,{className:"h-4 w-4 animate-spin"}),jsx("span",{children:"Loading chart..."})]})})}):y?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-destructive mb-2",children:y}),T&&jsxs(Button,{variant:"outline",onClick:T,children:[jsx(RefreshCw,{className:"mr-2 h-4 w-4"}),"Retry"]})]})})}):jsxs(Card,{className:cn("w-full",b),ref:C,children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxs("div",{className:"space-y-1",children:[jsxs(CardTitle,{className:"text-base font-medium",children:[r,M&&jsxs("span",{className:"ml-2 inline-flex items-center",children:[M.direction==="up"&&jsx(TrendingUp,{className:"h-4 w-4 text-green-500"}),M.direction==="down"&&jsx(TrendingDown,{className:"h-4 w-4 text-red-500"}),M.direction==="neutral"&&jsx(Minus,{className:"h-4 w-4 text-gray-500"}),jsxs("span",{className:cn("ml-1 text-sm",M.direction==="up"&&"text-green-500",M.direction==="down"&&"text-red-500",M.direction==="neutral"&&"text-gray-500"),children:[M.percentage,"%"]})]})]}),i&&jsx("p",{className:"text-xs text-muted-foreground",children:i})]}),jsxs("div",{className:"flex items-center space-x-1",children:[T&&jsx(Button,{variant:"ghost",size:"sm",onClick:T,children:jsx(RefreshCw,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(Settings,{className:"h-4 w-4"})}),S&&jsx(Button,{variant:"ghost",size:"sm",onClick:()=>U("png"),children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>x(!G),children:jsx(Maximize2,{className:"h-4 w-4"})})]})]}),jsx(CardContent,{children:O?jsx(ResponsiveContainer,{width:"100%",height:o,children:z()}):jsx("div",{style:{width:"100%",height:`${o}px`},children:z()})})]})}var Od=[{value:"meeting",label:"Meeting",color:"#3b82f6"},{value:"task",label:"Task",color:"#10b981"},{value:"reminder",label:"Reminder",color:"#f59e0b"},{value:"event",label:"Event",color:"#8b5cf6"}],Yy=["#3b82f6","#10b981","#f59e0b","#8b5cf6","#ef4444","#06b6d4","#84cc16","#f97316","#ec4899","#6366f1","#14b8a6","#eab308","#f43f5e","#a855f7","#22c55e"];function Rd({open:t,onOpenChange:e,event:n,selectedDate:r,onSave:i,onDelete:o,mode:s="create"}){let[a,l]=useState({title:"",description:"",date:"",startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""}),[c,d]=useState({}),[u,f]=useState(!1);useEffect(()=>{if(s==="edit"&&n)l({title:n.title||"",description:n.description||"",date:n.date.toISOString().split("T")[0],startTime:n.startTime||"",endTime:n.endTime||"",location:n.location||"",type:n.type||"meeting",color:n.color||"#3b82f6",attendees:n.attendees?.join(", ")||""});else if(s==="create"){let b=r?r.toISOString().split("T")[0]:new Date().toISOString().split("T")[0];l({title:"",description:"",date:b,startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""});}d({});},[n,r,s,t]);let p=()=>{let b={};return a.title.trim()||(b.title="Title is required"),a.date||(b.date="Date is required"),a.startTime&&a.endTime&&a.startTime>=a.endTime&&(b.endTime="End time must be after start time"),d(b),Object.keys(b).length===0},h=async b=>{if(b.preventDefault(),!!p()){f(!0);try{let v={...s==="edit"&&n?{id:n.id}:{},title:a.title.trim(),description:a.description.trim(),date:new Date(a.date+"T00:00:00"),startTime:a.startTime||void 0,endTime:a.endTime||void 0,location:a.location.trim()||void 0,type:a.type,color:a.color,attendees:a.attendees?a.attendees.split(",").map(S=>S.trim()).filter(Boolean):void 0};await i(v),e(!1);}catch(v){console.error("Error saving event:",v);}finally{f(!1);}}},m=()=>{n&&o&&(o(n.id),e(!1));},g=b=>{let v=Od.find(S=>S.value===b);l(S=>({...S,type:b,color:v?.color||S.color}));};return jsx(Dialog,{open:t,onOpenChange:e,children:jsxs(DialogContent,{className:"sm:max-w-[500px]",children:[jsxs(DialogHeader,{children:[jsxs(DialogTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"w-5 h-5"}),s==="create"?"Create Event":"Edit Event"]}),jsx(DialogDescription,{children:s==="create"?"Add a new event to your calendar.":"Edit the event details."})]}),jsxs("form",{onSubmit:h,className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"title",children:"Title *"}),jsx(Input,{id:"title",value:a.title,onChange:b=>l(v=>({...v,title:b.target.value})),placeholder:"Event title",className:cn(c.title&&"border-red-500")}),c.title&&jsx("p",{className:"text-sm text-red-500",children:c.title})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"description",children:"Description"}),jsx(Textarea,{id:"description",value:a.description,onChange:b=>l(v=>({...v,description:b.target.value})),placeholder:"Event description (optional)",rows:3})]}),jsxs("div",{className:"grid grid-cols-3 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"date",children:"Date *"}),jsx(Input,{id:"date",type:"date",value:a.date,onChange:b=>l(v=>({...v,date:b.target.value})),className:cn(c.date&&"border-red-500")}),c.date&&jsx("p",{className:"text-sm text-red-500",children:c.date})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"startTime",children:"Start Time"}),jsx(Input,{id:"startTime",type:"time",value:a.startTime,onChange:b=>l(v=>({...v,startTime:b.target.value})),placeholder:"09:00"})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"endTime",children:"End Time"}),jsx(Input,{id:"endTime",type:"time",value:a.endTime,onChange:b=>l(v=>({...v,endTime:b.target.value})),placeholder:"10:00",className:cn(c.endTime&&"border-red-500")}),c.endTime&&jsx("p",{className:"text-sm text-red-500",children:c.endTime})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{htmlFor:"location",className:"flex items-center gap-2",children:[jsx(MapPin,{className:"w-4 h-4"}),"Location"]}),jsx(Input,{id:"location",value:a.location,onChange:b=>l(v=>({...v,location:b.target.value})),placeholder:"Meeting room, address, or link"})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Type,{className:"w-4 h-4"}),"Type"]}),jsxs(Select,{value:a.type,onValueChange:g,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsx(SelectContent,{children:Od.map(b=>jsx(SelectItem,{value:b.value,children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.color}}),b.label]})},b.value))})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Palette,{className:"w-4 h-4"}),"Color"]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:a.color,onChange:b=>l(v=>({...v,color:b})),presets:Yy,showInput:!1,size:"sm"}),jsx("div",{className:"w-6 h-6 rounded border",style:{backgroundColor:a.color}})]})]})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"attendees",children:"Attendees"}),jsx(Input,{id:"attendees",value:a.attendees,onChange:b=>l(v=>({...v,attendees:b.target.value})),placeholder:"John Doe, Jane Smith (comma-separated)"})]}),jsxs(DialogFooter,{className:"gap-2",children:[s==="edit"&&o&&jsx(Button,{type:"button",variant:"destructive",onClick:m,className:"mr-auto",children:"Delete Event"}),jsx(Button,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:u,children:"Cancel"}),jsx(Button,{type:"submit",disabled:u,children:u?s==="create"?"Creating...":"Saving...":s==="create"?"Create Event":"Save Changes"})]})]})]})})}var zd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c0=["January","February","March","April","May","June","July","August","September","October","November","December"],Fd={meeting:"bg-blue-500",task:"bg-green-500",reminder:"bg-yellow-500",event:"bg-purple-500"};function FA({events:t=[],onEventClick:e,onEventAdd:n,onEventEdit:r,onEventDelete:i,className:o,showWeekends:s=!0,showEventDetails:a=!0,disabled:l=!1,minDate:c,maxDate:d,highlightToday:u=!0,height:f}){let {hasProAccess:h,isLoading:m}=lt();if(!m&&!h)return jsx(Card,{className:cn("w-full",o),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Calendar is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let [b,v]=Mn.useState(new Date),[S,T]=Mn.useState(null);Mn.useState("month");let [k,y]=Mn.useState(!1),[w,O]=Mn.useState("create"),[X,R]=Mn.useState(null),[ce,Q]=Mn.useState(null),[G,x]=Mn.useState(null),C=new Date,M=b.getMonth(),U=b.getFullYear(),z=new Date(U,M,1),J=new Date(U,M+1,0),ie=new Date(z);ie.setDate(ie.getDate()-ie.getDay());let $=new Date(J);$.setDate($.getDate()+(6-$.getDay()));let ae=[],_e=new Date(ie);for(;_e<=$;)ae.push(new Date(_e)),_e.setDate(_e.getDate()+1);let $e=F=>t.filter(D=>new Date(D.date).toDateString()===F.toDateString()),it=F=>F.toDateString()===C.toDateString(),ln=F=>F.getMonth()===M,ht=F=>S&&F.toDateString()===S.toDateString(),Wt=F=>!!(l||c&&F<c||d&&F>d),mt=F=>{let D=new Date(b);F==="prev"?D.setMonth(M-1):D.setMonth(M+1),v(D);},jn=F=>{if(Wt(F))return;T(F);let D=$e(F);D.length===0?(O("create"),R(null),y(!0)):D.length===1&&e?.(D[0]);},Ut=(F,D)=>{D.stopPropagation(),e?.(F);},cn$1=(F,D)=>{Q(F),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",F.id);let K=D.target;K.style.opacity="0.5";},ot=F=>{Q(null),x(null);let D=F.target;D.style.opacity="1";},ve=(F,D)=>{Wt(F)||!ce||(D.preventDefault(),D.dataTransfer.dropEffect="move",x(F));},Nt=(F,D)=>{if(D.preventDefault(),!(!ce||Wt(F))){if(ce.date.toDateString()!==F.toDateString()){let K={...ce,date:F};r?.(K);}Q(null),x(null);}},A=(F,D)=>{D.stopPropagation(),O("edit"),R(F),y(!0);},ee=(F,D)=>{D.stopPropagation(),i?.(F.id);},de=F=>{w==="create"?n?.(F):w==="edit"&&F.id&&r?.(F);},Y=F=>{i?.(F);},st=()=>{v(new Date),T(new Date);},Tt=s?ae:ae.filter(F=>{let D=F.getDay();return D!==0&&D!==6}),si=s?zd:zd.slice(1,6);return jsxs(Fragment,{children:[jsxs(Card,{className:cn("w-full max-w-full overflow-hidden",o),style:{height:f?`${f}px`:void 0},children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"h-5 w-5"}),"Calendar"]}),jsxs(CardDescription,{children:[c0[M]," ",U]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Button,{variant:"outline",size:"sm",onClick:st,children:"Today"}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("prev"),disabled:l,children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("next"),disabled:l,children:jsx(ChevronRight,{className:"h-4 w-4"})})]})]})}),jsx(CardContent,{className:"overflow-x-auto",children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"grid grid-cols-7 gap-1 w-full",style:{minWidth:"500px"},children:[si.map(F=>jsx("div",{className:"p-1 text-center text-xs font-medium text-muted-foreground min-w-[70px]",children:F},F)),Tt.map((F,D)=>{let K=$e(F),ue=ln(F),we=it(F),Je=ht(F),Ht=Wt(F);return jsxs("div",{className:cn("min-h-[80px] min-w-[70px] p-1 border border-border/50 cursor-pointer hover:bg-muted/50 transition-colors text-xs flex flex-col",!ue&&"text-muted-foreground bg-muted/20",we&&u&&"bg-primary/10 border-primary/50",Je&&"bg-primary/20 border-primary",Ht&&"cursor-not-allowed opacity-50",G&&G.toDateString()===F.toDateString()&&"bg-primary/30 border-primary"),onClick:()=>jn(F),onDragOver:Qe=>ve(F,Qe),onDrop:Qe=>Nt(F,Qe),children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:cn("text-sm font-medium",we&&"text-primary font-bold"),children:F.getDate()}),K.length>0&&jsx(Badge,{variant:"secondary",className:"text-xs px-1",children:K.length})]}),jsxs("div",{className:"flex-1 space-y-1 overflow-hidden",children:[K.slice(0,3).map(Qe=>jsxs("div",{className:cn("text-xs p-1 mb-1 rounded text-white cursor-move group relative select-none block w-full truncate",Qe.color||Fd[Qe.type||"event"]),draggable:!l,onClick:dn=>Ut(Qe,dn),onDragStart:dn=>cn$1(Qe,dn),onDragEnd:ot,style:{backgroundColor:Qe.color||void 0},children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"truncate flex-1",children:Qe.title}),a&&jsxs("div",{className:"hidden group-hover:flex items-center gap-1 ml-1",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>A(Qe,dn),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>ee(Qe,dn),children:jsx(Trash2,{className:"h-3 w-3"})})]})]}),Qe.startTime&&jsxs("div",{className:"flex items-center gap-1 mt-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:Qe.startTime})]})]},Qe.id)),K.length>3&&jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",K.length-3," more"]})]})]},D)})]}),S&&jsxs("div",{className:"border rounded-lg p-4 bg-muted/50",children:[jsx("h4",{className:"font-medium mb-2",children:S.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxs("div",{className:"space-y-2",children:[$e(S).map(F=>jsxs("div",{className:"flex items-start gap-3 p-2 border rounded",children:[jsx("div",{className:cn("w-3 h-3 rounded-full mt-1 flex-shrink-0",F.color||Fd[F.type||"event"])}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h5",{className:"font-medium",children:F.title}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(Button,{variant:"ghost",size:"sm",onClick:D=>A(F,D),children:jsx(Edit,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:D=>ee(F,D),children:jsx(Trash2,{className:"h-4 w-4"})})]})]}),F.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.description}),jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-2",children:[F.startTime&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsxs("span",{children:[F.startTime," - ",F.endTime]})]}),F.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MapPin,{className:"h-3 w-3"}),jsx("span",{children:F.location})]}),F.attendees&&F.attendees.length>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(User,{className:"h-3 w-3"}),jsxs("span",{children:[F.attendees.length," attendees"]})]})]})]})]},F.id)),$e(S).length===0&&jsxs("div",{className:"text-center py-4",children:[jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"No events scheduled for this date"}),jsxs(Button,{variant:"outline",size:"sm",onClick:()=>{O("create"),R(null),y(!0);},children:[jsx(Plus,{className:"h-4 w-4 mr-1"}),"Add Event"]})]})]})]})]})})]}),jsx(Rd,{open:k,onOpenChange:y,event:X,selectedDate:S,onSave:de,onDelete:Y,mode:w})]})}var k0={primary:"text-blue-600",success:"text-green-600",warning:"text-yellow-600",danger:"text-red-600",info:"text-purple-600"},N0={sm:"col-span-1",md:"col-span-2",lg:"col-span-3",xl:"col-span-4"};function XA({metrics:t=[],widgets:e=[],onMetricClick:n,onWidgetAction:r,className:i,showHeader:o=!0,title:s="Dashboard",description:a="Overview of your key metrics and performance",refreshable:l=!0,onRefresh:c,loading:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",i),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Dashboard is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(!1),b=async()=>{if(c){g(!0);try{await c();}finally{g(!1);}}},v=w=>typeof w=="number"?w>=1e6?(w/1e6).toFixed(1)+"M":w>=1e3?(w/1e3).toFixed(1)+"K":w.toLocaleString():w.toString(),S=w=>{switch(w){case"increase":return jsx(ArrowUpRight,{className:"h-4 w-4"});case"decrease":return jsx(ArrowDownRight,{className:"h-4 w-4"});case"neutral":return jsx(Minus,{className:"h-4 w-4"})}},T=w=>{switch(w){case"increase":return "text-green-600";case"decrease":return "text-red-600";case"neutral":return "text-gray-600"}},_=w=>{let O=w.color?k0[w.color]:"text-foreground";return jsxs(Card,{className:cn("cursor-pointer hover:shadow-md transition-shadow",n&&"hover:bg-muted/50"),onClick:()=>n?.(w),children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsx(CardTitle,{className:"text-sm font-medium",children:w.title}),jsx("div",{className:cn("h-4 w-4",O),children:w.icon})]}),jsxs(CardContent,{children:[jsx("div",{className:"text-2xl font-bold",children:v(w.value)}),w.change&&jsxs("div",{className:cn("flex items-center text-xs mt-1",T(w.change.type)),children:[S(w.change.type),jsxs("span",{className:"ml-1",children:[Math.abs(w.change.value),"% from ",w.change.period]})]}),w.description&&jsx("p",{className:"text-xs text-muted-foreground mt-1",children:w.description})]})]},w.id)},I=w=>{let O=N0[w.size||"md"];return jsxs(Card,{className:cn("h-fit",O),children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx(CardTitle,{className:"text-base",children:w.title}),w.description&&jsx(CardDescription,{className:"mt-1",children:w.description})]}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>r?.(w.id,"menu"),children:jsx(BarChart3,{className:"h-4 w-4"})})]})}),jsx(CardContent,{children:w.loading?jsx("div",{className:"flex items-center justify-center h-32",children:jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.error?jsx("div",{className:"flex items-center justify-center h-32 text-destructive",children:jsx("p",{className:"text-sm",children:w.error})}):w.content})]},w.id)},k=[{id:"total-users",title:"Total Users",value:2543,change:{value:12,type:"increase",period:"last month"},icon:jsx(Users,{className:"h-4 w-4"}),color:"primary"},{id:"revenue",title:"Revenue",value:"$12,345",change:{value:8,type:"increase",period:"last month"},icon:jsx(DollarSign,{className:"h-4 w-4"}),color:"success"},{id:"active-sessions",title:"Active Sessions",value:1234,change:{value:2,type:"decrease",period:"last hour"},icon:jsx(Activity,{className:"h-4 w-4"}),color:"warning"},{id:"conversion-rate",title:"Conversion Rate",value:"3.2%",change:{value:.3,type:"increase",period:"last week"},icon:jsx(TrendingUp,{className:"h-4 w-4"}),color:"info"}],y=t.length>0?t:k;return d?jsx("div",{className:cn("w-full",i),children:jsxs("div",{className:"animate-pulse space-y-4",children:[jsx("div",{className:"h-8 bg-muted rounded w-1/4"}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[...Array(4)].map((w,O)=>jsx("div",{className:"h-32 bg-muted rounded"},O))})]})}):jsxs("div",{className:cn("w-full space-y-6",i),children:[o&&jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s}),jsx("p",{className:"text-muted-foreground",children:a})]}),l&&jsxs(Button,{variant:"outline",onClick:b,disabled:m,children:[m?jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary mr-2"}):jsx(Activity,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:y.map(_)}),e.length>0&&jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:e.map(I)}),jsxs("div",{className:"flex items-center gap-2 pt-4 border-t",children:[jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Download,{className:"h-4 w-4 mr-2"}),"Export Data"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Calendar,{className:"h-4 w-4 mr-2"}),"Schedule Report"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Star,{className:"h-4 w-4 mr-2"}),"Save View"]})]})]})}function h1({columns:t,data:e,searchable:n=!0,filterable:r=!0,exportable:i=!0,selectable:o=!1,pagination:s=!0,pageSize:a=10,className:l,onRowSelect:c,onExport:d,features:u={},theme:f={},texts:p={}}){let {hasProAccess:m,isLoading:g}=lt();if(!g&&!m)return jsx(Card,{className:cn("w-full",l),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Data Table is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[v,S]=Mn.useState([]),[T,_]=Mn.useState([]),[I,k]=Mn.useState({}),[y,w]=Mn.useState({}),[O,X]=Mn.useState(""),R=useReactTable({data:e,columns:t,onSortingChange:S,onColumnFiltersChange:_,getCoreRowModel:getCoreRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getFilteredRowModel:getFilteredRowModel(),onColumnVisibilityChange:k,onRowSelectionChange:w,onGlobalFilterChange:X,globalFilterFn:"includesString",state:{sorting:v,columnFilters:T,columnVisibility:I,rowSelection:y,globalFilter:O},initialState:{pagination:{pageSize:a}}});Mn.useEffect(()=>{if(c&&o){let G=R.getFilteredSelectedRowModel().rows.map(x=>x.original);c(G);}},[y,c,o,R]);({sorting:u.sorting!==!1,filtering:u.filtering!==!1||r,pagination:u.pagination!==!1||s,search:u.search!==!1||n,columnVisibility:u.columnVisibility!==!1,rowSelection:u.rowSelection!==!1||o,export:u.export!==!1||i});let Q=()=>{if(d){let G=R.getFilteredSelectedRowModel().rows,x=G.length>0?G.map(C=>C.original):R.getFilteredRowModel().rows.map(C=>C.original);d(x);}};return jsxs("div",{className:cn("space-y-4",l),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center space-x-2",children:[n&&jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),jsx(Input,{placeholder:"Search all columns...",value:O,onChange:G=>X(G.target.value),className:"pl-8 w-64"})]}),r&&jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Filter,{className:"mr-2 h-4 w-4"}),"Filters"]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[i&&jsxs(Button,{variant:"outline",size:"sm",onClick:Q,children:[jsx(Download,{className:"mr-2 h-4 w-4"}),"Export"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Settings,{className:"mr-2 h-4 w-4"}),"Columns"]})]})]}),jsx("div",{className:"rounded-md border",children:jsxs("table",{className:"w-full",children:[jsx("thead",{children:R.getHeaderGroups().map(G=>jsx("tr",{className:"border-b",children:G.headers.map(x=>jsx("th",{className:"h-12 px-4 text-left align-middle font-medium text-muted-foreground",children:x.isPlaceholder?null:jsxs("div",{className:cn("flex items-center space-x-2",x.column.getCanSort()&&"cursor-pointer select-none"),onClick:x.column.getToggleSortingHandler(),children:[flexRender(x.column.columnDef.header,x.getContext()),x.column.getCanSort()&&jsx("div",{className:"ml-2",children:x.column.getIsSorted()==="asc"?jsx(ArrowUp,{className:"h-4 w-4"}):x.column.getIsSorted()==="desc"?jsx(ArrowDown,{className:"h-4 w-4"}):jsx(ArrowUpDown,{className:"h-4 w-4"})})]})},x.id))},G.id))}),jsx("tbody",{children:R.getRowModel().rows?.length?R.getRowModel().rows.map(G=>jsx("tr",{className:cn("border-b transition-colors hover:bg-muted/50",G.getIsSelected()&&"bg-muted"),children:G.getVisibleCells().map(x=>jsx("td",{className:"p-4 align-middle",children:flexRender(x.column.columnDef.cell,x.getContext())},x.id))},G.id)):jsx("tr",{children:jsx("td",{colSpan:t.length,className:"h-24 text-center",children:"No results found."})})})]})}),s&&jsxs("div",{className:"flex items-center justify-between px-2",children:[jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:o&&R.getFilteredSelectedRowModel().rows.length>0&&jsxs("span",{children:[R.getFilteredSelectedRowModel().rows.length," of"," ",R.getFilteredRowModel().rows.length," row(s) selected."]})}),jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsx("select",{value:R.getState().pagination.pageSize,onChange:G=>R.setPageSize(Number(G.target.value)),className:"h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",children:[10,20,30,40,50].map(G=>jsx("option",{value:G,children:G},G))})]}),jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",R.getState().pagination.pageIndex+1," of"," ",R.getPageCount()]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:jsx(ChevronsLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:jsx(ChevronRight,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:jsx(ChevronsRight,{className:"h-4 w-4"})})]})]})]})]})}var uE=t=>t.startsWith("image/")?jsx(Image,{className:"h-4 w-4"}):t.startsWith("video/")?jsx(Video,{className:"h-4 w-4"}):t.startsWith("audio/")?jsx(Music,{className:"h-4 w-4"}):t.includes("pdf")?jsx(FileText,{className:"h-4 w-4"}):t.includes("zip")||t.includes("rar")?jsx(Archive,{className:"h-4 w-4"}):jsx(File,{className:"h-4 w-4"}),fE=t=>{if(t===0)return "0 Bytes";let e=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+n[r]};function N1({accept:t="*",multiple:e=!1,maxSize:n=10,maxFiles:r=5,onUpload:i,onRemove:o,className:s,disabled:a=!1,showPreview:l=!0,allowedTypes:c=[]}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",s),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"File Upload is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[h,m]=Mn.useState([]),[g,b]=Mn.useState(!1),[v,S]=Mn.useState(!1),T=Mn.useRef(null),_=R=>R.size>n*1024*1024?`File size must be less than ${n}MB`:c.length>0&&!c.includes(R.type)?`File type ${R.type} is not allowed`:null,I=async R=>{if(!R||a)return;let ce=Array.from(R);if(h.length+ce.length>r){alert(`Maximum ${r} files allowed`);return}let Q=[],G=[];if(ce.forEach(x=>{let C=_(x);C?G.push(`${x.name}: ${C}`):Q.push({file:x,id:Math.random().toString(36).substr(2,9),status:"uploading",progress:0});}),G.length>0&&alert(G.join(`
|
|
18
|
+
`)),Q.length!==0){if(m(x=>[...x,...Q]),S(!0),i)try{await i(Q.map(x=>x.file)),m(x=>x.map(C=>Q.find(M=>M.id===C.id)?{...C,status:"success",progress:100}:C));}catch{m(C=>C.map(M=>Q.find(U=>U.id===M.id)?{...M,status:"error",error:"Upload failed"}:M));}else for(let x of Q){let C=setInterval(()=>{m(M=>M.map(U=>U.id===x.id&&U.progress<100?{...U,progress:U.progress+10}:U));},100);setTimeout(()=>{clearInterval(C),m(M=>M.map(U=>U.id===x.id?{...U,status:"success",progress:100}:U));},1e3);}S(!1);}},k=R=>{m(ce=>ce.filter(Q=>Q.id!==R.id)),o&&o(R.file);},y=R=>{R.preventDefault(),b(!1),I(R.dataTransfer.files);},w=R=>{R.preventDefault(),b(!0);},O=R=>{R.preventDefault(),b(!1);},X$1=()=>{a||T.current?.click();};return jsxs(Card,{className:cn("w-full",s),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Upload,{className:"h-5 w-5"}),"File Upload"]}),jsxs(CardDescription,{children:[e?`Upload up to ${r} files`:"Upload a file"," (max ",n,"MB each)"]})]}),jsxs(CardContent,{className:"space-y-4",children:[jsxs("div",{className:cn("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors",g?"border-primary bg-primary/5":"border-muted-foreground/25",a&&"cursor-not-allowed opacity-50"),onDrop:y,onDragOver:w,onDragLeave:O,onClick:X$1,children:[jsx(Upload,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Drag and drop files here, or click to select"}),jsx("p",{className:"text-xs text-muted-foreground",children:t==="*"?"Any file type":`Accepted types: ${t}`})]}),jsx("input",{ref:T,type:"file",accept:t,multiple:e,onChange:R=>I(R.target.files),className:"hidden",disabled:a}),h.length>0&&jsxs("div",{className:"space-y-2",children:[jsxs("h4",{className:"text-sm font-medium",children:["Uploaded Files (",h.length,")"]}),h.map(R=>jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[jsx("div",{className:"flex-shrink-0",children:uE(R.file.type)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("p",{className:"text-sm font-medium truncate",children:R.file.name}),jsxs(Badge,{variant:R.status==="success"?"success":R.status==="error"?"destructive":"secondary",children:[R.status==="uploading"&&jsx(Loader2,{className:"h-3 w-3 mr-1 animate-spin"}),R.status==="success"&&jsx(CheckCircle2,{className:"h-3 w-3 mr-1"}),R.status==="error"&&jsx(AlertCircle,{className:"h-3 w-3 mr-1"}),R.status]})]}),jsxs("div",{className:"flex items-center justify-between mt-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:fE(R.file.size)}),R.status==="uploading"&&jsxs("span",{className:"text-xs text-muted-foreground",children:[R.progress,"%"]})]}),R.status==="uploading"&&jsx(Progress,{value:R.progress,className:"mt-2"}),R.error&&jsx("p",{className:"text-xs text-destructive mt-1",children:R.error})]}),jsxs("div",{className:"flex items-center gap-1",children:[R.status==="success"&&l&&R.file.type.startsWith("image/")&&jsx(Button,{variant:"ghost",size:"sm",children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>k(R),disabled:R.status==="uploading",children:jsx(X,{className:"h-4 w-4"})})]})]},R.id))]}),v&&jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsx(Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading files..."]})]})]})}var _E={low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"};function F1({columns:t,onCardMove:e,onCardClick:n,onCardEdit:r,onCardDelete:i,onAddCard:o,onAddColumn:s,className:a,showAddColumn:l=!0,showCardDetails:c=!0,disabled:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",a),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Kanban Board is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(null),[b,v]=Mn.useState(null),[S,T]=Mn.useState(null),_=(C,M)=>{if(d)return;let U=t.find(z=>z.cards.some(J=>J.id===M));g(M),T(U?.id||null),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",M),C.currentTarget.classList.add("opacity-50");},I=C=>{d||(g(null),v(null),T(null),C.currentTarget.classList.remove("opacity-50"));},k=(C,M)=>{d||(C.preventDefault(),C.dataTransfer.dropEffect="move",v(M));},y=(C,M)=>{d||(C.preventDefault(),v(M));},w=(C,M)=>{if(d)return;C.preventDefault();let U=C.currentTarget.getBoundingClientRect();(C.clientX<U.left||C.clientX>U.right||C.clientY<U.top||C.clientY>U.bottom)&&v(null);},O=(C,M)=>{if(d)return;C.preventDefault();let U=C.dataTransfer.getData("text/plain")||m;if(U&&e&&S&&S!==M){let J=t.find(ie=>ie.id===M)?.cards.length||0;e(U,S,M,J);}g(null),v(null),T(null);},X=C=>{d||n?.(C);},R=(C,M)=>{d||(M.stopPropagation(),r?.(C));},ce=(C,M)=>{d||(M.stopPropagation(),i?.(C));},Q=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric"}),G=C=>C<new Date,x=C=>C.split(" ").map(M=>M[0]).join("").toUpperCase();return jsx("div",{className:cn("w-full",a),children:jsxs("div",{className:"flex gap-6 overflow-x-auto pb-4",children:[t.map(C=>{let M=C.limit&&C.cards.length>C.limit,U=b===C.id;return jsx("div",{className:cn("flex-shrink-0 w-80 transition-colors duration-200",U&&"bg-primary/5 rounded-lg border-2 border-primary/20"),onDragOver:z=>k(z,C.id),onDragEnter:z=>y(z,C.id),onDragLeave:z=>w(z,C.id),onDrop:z=>O(z,C.id),children:jsxs(Card,{className:"h-full",children:[jsxs(CardHeader,{className:"pb-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[C.color&&jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx(CardTitle,{className:"text-sm font-medium",children:C.title}),jsx(Badge,{variant:"secondary",className:"text-xs",children:C.cards.length})]}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(MoreHorizontal,{className:"h-4 w-4"})})]}),C.limit&&jsx(CardDescription,{className:cn("text-xs",M&&"text-destructive"),children:M?"Over limit":`${C.cards.length}/${C.limit} cards`})]}),jsxs(CardContent,{className:"space-y-3",children:[C.cards.map(z=>jsxs("div",{draggable:!d,onDragStart:J=>_(J,z.id),onDragEnd:I,onClick:()=>X(z),className:cn("p-3 bg-background border rounded-lg cursor-pointer hover:shadow-md transition-all duration-200","group relative select-none",m===z.id&&"opacity-50 scale-95",d&&"cursor-not-allowed"),children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:"font-medium text-sm mb-1",children:z.title}),z.description&&jsx("p",{className:"text-xs text-muted-foreground mb-2 line-clamp-2",children:z.description})]}),jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>R(z,J),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>ce(z,J),children:jsx(Trash2,{className:"h-3 w-3"})}),jsx("div",{className:"cursor-move",children:jsx(GripVertical,{className:"h-3 w-3 text-muted-foreground"})})]})]}),z.tags&&z.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:z.tags.map((J,ie)=>jsx(Badge,{variant:"outline",className:"text-xs px-1 py-0",children:J},ie))}),c&&jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[jsxs("div",{className:"flex items-center gap-2",children:[z.priority&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:cn("w-2 h-2 rounded-full",_E[z.priority])}),jsx("span",{className:"capitalize",children:z.priority})]}),z.dueDate&&jsxs("div",{className:cn("flex items-center gap-1",G(z.dueDate)&&"text-destructive"),children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:Q(z.dueDate)})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[z.comments&&z.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:z.comments})]}),z.attachments&&z.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:z.attachments})]}),z.assignee&&jsxs(Avatar,{className:"h-5 w-5",children:[jsx(AvatarImage,{src:z.assignee.avatar}),jsx(AvatarFallback,{className:"text-xs",children:x(z.assignee.name)})]})]})]})]},z.id)),o&&jsxs(Button,{variant:"ghost",size:"sm",onClick:()=>o(C.id),className:"w-full justify-start text-muted-foreground hover:text-foreground",disabled:d,children:[jsx(Plus,{className:"h-4 w-4 mr-2"}),"Add card"]})]})]})},C.id)}),l&&s&&jsx("div",{className:"flex-shrink-0 w-80",children:jsxs(Button,{variant:"outline",onClick:s,className:"w-full h-full min-h-[200px] border-dashed justify-center items-center",disabled:d,children:[jsx(Plus,{className:"h-6 w-6 mr-2"}),"Add column"]})})]})})}var Aa=class{constructor(e,n="lru"){this.cache=new Map;this.maxSize=e,this.strategy=n;}set(e,n,r=!1){this.cache.size>=this.maxSize&&this.evict(),this.cache.set(e,{data:n,timestamp:Date.now(),accessCount:0,compressed:r});}get(e){let n=this.cache.get(e);return n?(n.accessCount++,n.timestamp=Date.now(),n.data):null}evict(){if(this.cache.size===0)return;let e=null;switch(this.strategy){case"lru":let n=1/0;for(let[i,o]of this.cache)o.timestamp<n&&(n=o.timestamp,e=i);break;case"lfu":let r=1/0;for(let[i,o]of this.cache)o.accessCount<r&&(r=o.accessCount,e=i);break;case"fifo":e=this.cache.keys().next().value;break}e&&this.cache.delete(e);}clear(){this.cache.clear();}getStats(){return {size:this.cache.size,hitRate:.95}}};function V1({data:t,config:e={},renderItem:n,height:r=400,onMemoryUpdate:i,className:o}){let{chunkSize:s=1e3,maxMemoryItems:a=1e4,cacheStrategy:l="lru",compression:c=!1,autoCleanup:d=!0,cleanupThreshold:u=.8,streamingMode:f=!1,enableAnalytics:p=!1,analyticsCallback:h}=e,[m,g]=useState({start:0,end:Math.min(s,t.length)}),[b,v]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95}),S=useRef(null),T=useRef(new Aa(Math.floor(a/s),l)),_=useRef(),I=useMemo(()=>{let y=m.start,w=Math.min(m.end,t.length),O=`${y}-${w}`,X=T.current.get(O);if(X&&X.length===w-y)return X;let R=t.slice(y,w);return T.current.set(O,R,c),R},[t,m,c]),k=useCallback(y=>{let w=y.currentTarget.scrollTop,O=y.currentTarget.clientHeight,X=60,R=Math.floor(w/X),ce=Math.ceil(O/X),Q=Math.floor(ce*.5),G=Math.max(0,R-Q),x=Math.min(t.length,R+ce+Q);_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{g({start:G,end:x});},16);},[t.length]);return useEffect(()=>{let y=T.current.getStats(),w={memoryUsage:I.length*1024,itemCount:I.length,cacheHitRate:y.hitRate,compressionRatio:c?.7:1,lastCleanup:Date.now()};v(w),p&&h&&h(w),i&&i(w);},[I,p,h,i,c]),useEffect(()=>{if(!d)return;let y=setInterval(()=>{I.length/a>u&&T.current.clear();},5e3);return ()=>clearInterval(y)},[d,u,a,I.length]),jsx("div",{ref:S,className:cn("overflow-auto border rounded-lg bg-background",o),style:{height:r},onScroll:k,children:jsx("div",{style:{height:t.length*60,position:"relative"},children:jsx("div",{style:{transform:`translateY(${m.start*60}px)`,position:"absolute",width:"100%"},children:I.map((y,w)=>jsx(Mn.Fragment,{children:n(y,m.start+w)},m.start+w))})})})}function W1({onStatsUpdate:t,showRealTime:e=!1,className:n}){let[r,i]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95});return useEffect(()=>{if(!e)return;let o=setInterval(()=>{let s={memoryUsage:Math.random()*50*1024*1024,itemCount:Math.floor(Math.random()*5e4),cacheHitRate:.9+Math.random()*.1,lastCleanup:Date.now()};i(s),t&&t(s);},1e3);return ()=>clearInterval(o)},[e,t]),e?jsx("div",{className:cn("text-xs text-muted-foreground",n),children:"Memory Analytics Active - Updates every second"}):null}function G1(t=[],e){let[n,r]=useState(t),{interval:i=1e3,maxItems:o=1e4}=e||{},s=useCallback(l=>{r(c=>{let d=[...c,l];return d.length>o?d.slice(-o):d});},[o]),a=useCallback(()=>{r([]);},[]);return {data:n,addItem:s,clearData:a}}var yh=ai(fi(),1);function ct(t){this.content=t;}ct.prototype={constructor:ct,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return -1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ct(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ct(n)},addToStart:function(t,e){return new ct([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ct(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new ct(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1]);},prepend:function(t){return t=ct.from(t),t.size?new ct(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ct.from(t),t.size?new ct(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ct.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n;}),t},get size(){return this.content.length>>1}};ct.from=function(t){if(t instanceof ct)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ct(e)};var Da=ct;function fu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=fu(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize;}}function pu(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return {a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return {a:n,b:r}}if(s.content.size||a.content.size){let c=pu(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l;}}var N=class{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize;}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,i+d);}a=c;}}descendants(e){this.nodesBetween(0,this.size,e);}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c;},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new N(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l;}return new N(r,i)}cutByIndex(e,n){return e==n?N.empty:e==0&&n==this.content.length?this:new N(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new N(i,o)}addToStart(e){return new N([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new N(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return !1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return !1;return !0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize;}}findDiffStart(e,n=0){return fu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return pu(this,e,n,r)}findIndex(e){if(e==0)return yo(0,e);if(e==this.size)return yo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?yo(n+1,o):yo(n,r);r=o;}}toString(){return "<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return N.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new N(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return N.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o);}return new N(n||e,r)}static from(e){if(!e)return N.empty;if(e instanceof N)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new N([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};N.empty=new N([],0);var Ia={index:0,offset:0};function yo(t,e){return Ia.index=t,Ia.offset=e,Ia}function vo(t,e){if(t===e)return !0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return !1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return !1;if(n){if(t.length!=e.length)return !1;for(let r=0;r<t.length;r++)if(!vo(t[r],e[r]))return !1}else {for(let r in t)if(!(r in e)||!vo(t[r],e[r]))return !1;for(let r in e)if(!(r in t))return !1}return !0}var be=class{constructor(e,n){this.type=e,this.attrs=n;}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else {if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o);}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return !0;return !1}eq(e){return this==e||this.type==e.type&&vo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return !0;if(e.length!=n.length)return !1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return !1;return !0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return be.none;if(e instanceof be)return [e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};be.none=[];var Qn=class extends Error{},B=class{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r;}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=mu(this.content,e+this.openStart,n);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,n){return new B(hu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return B.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(N.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new B(e,r,i)}};B.empty=new B(N.empty,0,0);function hu(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(hu(o.content,e-i-1,n-i-1)))}function mu(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=mu(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function UE(t,e,n){if(n.openStart>t.depth)throw new Qn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qn("Inconsistent open depths");return gu(t,e,n,0)}function gu(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=gu(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else {let{start:s,end:a}=HE(n,t);return Xn(o,yu(t,s,a,e,r))}else return Xn(o,wo(t,e,r))}function bu(t,e){if(!e.type.compatibleContent(t.type))throw new Qn("Cannot join "+e.type.name+" onto "+t.type.name)}function Pa(t,e,n){let r=t.node(n);return bu(r,e.node(n)),r}function Zn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t);}function pi(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Zn(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Zn(i.child(a),r);e&&e.depth==n&&e.textOffset&&Zn(e.nodeBefore,r);}function Xn(t,e){return t.type.checkContent(e),t.copy(e)}function yu(t,e,n,r,i){let o=t.depth>i&&Pa(t,e,i+1),s=r.depth>i&&Pa(n,r,i+1),a=[];return pi(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(bu(o,s),Zn(Xn(o,yu(t,e,n,r,i+1)),a)):(o&&Zn(Xn(o,wo(t,e,i+1)),a),pi(e,n,i,a),s&&Zn(Xn(s,wo(n,r,i+1)),a)),pi(r,null,i,a),new N(a)}function wo(t,e,n){let r=[];if(pi(null,t,n,r),t.depth>n){let i=Pa(t,e,n+1);Zn(Xn(i,wo(t,e,n+1)),r);}return pi(e,null,n,r),new N(r)}function HE(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(N.from(i));return {start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var er=class{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1;}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return be.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a;}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1;}return new er(n,r,o)}static resolveCached(e,n){let r=ru.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else ru.set(e,r=new Ba);let i=r.elts[r.i]=er.resolve(e,n);return r.i=(r.i+1)%$E,i}},Ba=class{constructor(){this.elts=[],this.i=0;}},$E=12,ru=new WeakMap,tr=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r;}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},KE=Object.create(null),et=class{constructor(e,n,r,i=be.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||N.empty;}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e);}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this);}descendants(e){this.nodesBetween(0,this.content.size,e);}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&vo(this.attrs,n||e.defaultAttrs||KE)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return B.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new B(c,i.depth-s,o.depth-s)}replace(e,n,r){return UE(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1;}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return {node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return {node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return {node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return {node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Eu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=N.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return !1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return !1;return !0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return !1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=be.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e);}if(!be.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check());}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON);}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=N.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};et.prototype.text=void 0;var Ar=class extends et{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r;}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Eu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ar(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ar(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Eu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var pn=class{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[];}static parse(e,n){let r=new za(e,n);if(r.next==null)return pn.empty;let i=vu(r);r.next&&r.err("Unexpected trailing text");let o=YE(JE(i));return ZE(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return !0;return !1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return N.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=o(u,a.concat(d));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0);}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next);}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
19
19
|
`)}};pn.empty=new pn(!0);var za=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift();}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function vu(t){let e=[];do e.push(VE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function VE(t){let e=[];do e.push(WE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function WE(t){let e=jE(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=GE(t,e);else break;return e}function iu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function GE(t,e){let n=iu(t),r=n;return t.eat(",")&&(t.next!="}"?r=iu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function qE(t,e){let n=t.nodeTypes,r=n[e];if(r)return [r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s);}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function jE(t){if(t.eat("(")){let e=vu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else {let e=qE(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function JE(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a);}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n());}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else {if(s.type=="opt")return [r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let d=n();i(o(s.expr,l),d),l=d;}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=n();r(l,d),i(o(s.expr,l),d),l=d;}return [r(l)]}else {if(s.type=="name")return [r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function wu(t,e){return e-t}function ou(t,e){let n=[];return r(e),n.sort(wu);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l);}}}function YE(t){let e=Object.create(null);return n(ou(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);ou(t,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d);});});});let o=e[r.join(",")]=new pn(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(wu);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)});}return o}}function ZE(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c);}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)");}}function xu(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default;}return e}function Su(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i;}return n}function Cu(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i]);}}function ku(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Fa(t,r,e[r]);return n}var Or=class{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ku(e,r.attrs),this.defaultAttrs=xu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text";}get isInline(){return !this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==pn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return !0;return !1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return !e&&this.defaultAttrs?this.defaultAttrs:Su(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),N.from(n),be.setFrom(r))}createChecked(e=null,n,r){return n=N.from(n),this.checkContent(n),new et(this,this.computeAttrs(e),n,be.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=N.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n);}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(N.empty,!0);return o?new et(this,e,n.append(o),be.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return !1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return !1;return !0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Cu(this.attrs,e,"node",this.name);}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return !0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return !1;return !0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:be.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Or(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function XE(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}var Fa=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?XE(e,n,r.validate):r.validate;}get isRequired(){return !this.hasDefault}},nr=class{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ku(e,i.attrs),this.excluded=null;let o=xu(this.attrs);this.instance=o?new be(this,o):null;}create(e=null){return !e&&this.instance?this.instance:new be(this,Su(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new nr(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Cu(this.attrs,e,"mark",this.name);}excludes(e){return this.excluded.indexOf(e)>-1}},Rr=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Da.from(e.nodes),n.marks=Da.from(e.marks||{}),this.nodes=Or.compile(this.spec.nodes,this),this.marks=nr.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=pn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o;}o.markSet=a=="_"?null:a?su(this,a.split(" ")):a==""||!o.inlineContent?[]:null;}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:su(this,s.split(" "));}this.nodeFromJSON=i=>et.fromJSON(this,i),this.markFromJSON=i=>be.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null);}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Or){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Ar(r,r.defaultAttrs,e,be.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function su(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l);}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QE(t){return t.tag!=null}function ev(t){return t.style!=null}var _t=class{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QE(i))this.tags.push(i);else if(ev(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i);}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return !1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)});}parse(e,n={}){let r=new xo(this,n,!1);return r.addAll(e,be.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new xo(this,n,!0);return r.addAll(e,be.none,n.from,n.to),B.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(rv(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0;}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0;}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i);}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=lu(s)),s.mark||s.ignore||s.clearMark||(s.mark=i);});}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=lu(s)),s.node||s.ignore||s.mark||(s.node=i);});}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _t(e,_t.schemaRules(e)))}},Nu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},tv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tu={ol:!0,ul:!0},mi=1,Ua=2,hi=4;function au(t,e,n){return e!=null?(e?mi:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?mi|Ua:n&~hi}var Mr=class{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=be.none,this.match=o||(s&hi?null:e.contentMatch);}findWrapping(e){if(!this.match){if(!this.type)return [];let n=this.type.contentMatch.fillBefore(N.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else {let r=this.type.contentMatch,i;return (i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&mi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length));}}let n=N.from(this.content);return !e&&this.match&&(n=n.append(this.match.fillBefore(N.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Nu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},xo=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=au(null,n.preserveWhitespace,0)|(r?hi:0);i?o=new Mr(i.type,i.attrs,be.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Mr(null,null,be.none,!0,null,s):o=new Mr(e.schema.topNodeType,null,be.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1;}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n);}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&Ua?"full":this.localPreserveWS||(i.options&mi)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
20
20
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1));}r&&this.insertNode(this.parser.schema.text(r),n,!/\S/.test(r)),this.findInText(e);}else this.findInside(e);}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Tu.hasOwnProperty(s)&&this.parser.normalizeLists&&nv(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:tv.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Nu.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=l&&l.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(o),this.needsBlock=d;}else {let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0);}this.localPreserveWS=i;}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
21
21
|
`),n);}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0);}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else {let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l);}else {let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs));}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else {let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1);}o&&this.sync(a)&&this.open--;}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o);}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2;}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n));}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=be.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):cu(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return !1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=au(e,o,s.options);s.options&hi&&s.content.length==0&&(a|=hi);let l=be.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):cu(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Mr(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1;}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=mi);}return !1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++;}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos);}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos);}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos);}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset));}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return !0;return !1}else {let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return !1;l--;}}return !0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function nv(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Tu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null);}}function rv(t,e){return (t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lu(t){let e={};for(let n in t)e[n]=t[n];return e}function cu(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||o.indexOf(d)<0&&s(d))return !0}};if(s(i.contentMatch))return !0}}var $t=class{constructor(e,n){this.nodes=e,this.marks=n;}serializeFragment(e,n={},r){r||(r=La(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++;}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,n);d&&(o.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom);}}i.appendChild(this.serializeNodeInner(s,n));}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Eo(La(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i);}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom);}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Eo(La(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Eo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new $t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=du(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return du(e.marks)}};function du(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r);}return e}function La(t){return t.document||window.document}var uu=new WeakMap;function iv(t){let e=uu.get(t);return e===void 0&&uu.set(t,e=ov(t)),e}function ov(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i]);}return n(t),e}function Eo(t,e,n,r){if(typeof e=="string")return {dom:t.createTextNode(e)};if(e.nodeType!=null)return {dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=iv(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u]);}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return {dom:l,contentDOM:l}}else {let{dom:p,contentDOM:h}=Eo(t,f,n,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h;}}}return {dom:l,contentDOM:a}}var Au=65535,Ou=Math.pow(2,16);function sv(t,e){return t+e*Ou}function _u(t){return t&Au}function av(t){return (t-(t&Au))/Ou}var Ru=1,Du=2,So=4,Iu=8,yi=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r;}get deleted(){return (this.delInfo&Iu)>0}get deletedBefore(){return (this.delInfo&(Ru|So))>0}get deletedAfter(){return (this.delInfo&(Du|So))>0}get deletedAcross(){return (this.delInfo&So)>0}},gt=class{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&>.empty)return gt.empty}recover(e){let n=0,r=_u(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+av(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],d=this.ranges[a+s],u=l+c;if(e<=u){let f=c?e==l?-1:e==u?1:n:n,p=l+i+(f<0?0:d);if(r)return p;let h=e==(n<0?l:u)?null:sv(a/3,e-l),m=e==l?Du:e==u?Ru:So;return (n<0?e!=l:e!=u)&&(m|=Iu),new yi(p,m,h)}i+=d-c;}return r?e+i:new yi(e+i,0,null)}touches(e,n){let r=0,i=_u(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],d=l+c;if(e<=d&&a==i*3)return !0;r+=this.ranges[a+s]-c;}return !1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+n],d=this.ranges[i+r];e(a,a+c,l,l+d),o+=d-c;}}invert(){return new gt(this.ranges,!this.inverted)}toString(){return (this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gt.empty:new gt(e<0?[0,-e,0]:[0,0,e])}};gt.empty=new gt([]);var Rn=class{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n);}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Rn(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n);}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0);}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n);}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0);}}invert(){let e=new Rn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos;}return r?e:new yi(e,i,null)}},Ha=Object.create(null),Ze=class{getMap(){return gt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ha[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ha)throw new RangeError("Duplicate use of step JSON ID "+e);return Ha[e]=n,n.prototype.jsonID=e,n}},Be=class{constructor(e,n){this.doc=e,this.failed=n;}static ok(e){return new Be(e,null)}static fail(e){return new Be(null,e)}static fromReplace(e,n,r,i){try{return Be.ok(e.replace(n,r,i))}catch(o){if(o instanceof Qn)return Be.fail(o.message);throw o}}};function Ga(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Ga(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o);}return N.fromArray(r)}var Gt=class extends Ze{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r;}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new B(Ga(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Be.fromReplace(e,this.from,this.to,o)}invert(){return new wt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Gt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return {stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gt(n.from,n.to,e.markFromJSON(n.mark))}};Ze.jsonID("addMark",Gt);var wt=class extends Ze{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r;}apply(e){let n=e.slice(this.from,this.to),r=new B(Ga(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Be.fromReplace(e,this.from,this.to,r)}invert(){return new Gt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new wt(n.pos,r.pos,this.mark)}merge(e){return e instanceof wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return {stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new wt(n.from,n.to,e.markFromJSON(n.mark))}};Ze.jsonID("removeMark",wt);var qt=class extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return Be.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Be.fromReplace(e,this.pos,this.pos+1,new B(N.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new qt(this.pos,n.marks[i]);return new qt(this.pos,this.mark)}}return new hn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.mark)}toJSON(){return {stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qt(n.pos,e.markFromJSON(n.mark))}};Ze.jsonID("addNodeMark",qt);var hn=class extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return Be.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Be.fromReplace(e,this.pos,this.pos+1,new B(N.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return !n||!this.mark.isInSet(n.marks)?this:new qt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hn(n.pos,this.mark)}toJSON(){return {stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new hn(n.pos,e.markFromJSON(n.mark))}};Ze.jsonID("removeNodeMark",hn);var De=class extends Ze{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i;}apply(e){return this.structure&&Va(e,this.from,this.to)?Be.fail("Structure replace would overwrite content"):Be.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gt([this.from,this.to-this.from,this.slice.size])}invert(e){return new De(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new De(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof De)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new De(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new De(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new De(n.from,n.to,B.fromJSON(e,n.slice),!!n.structure)}};Ze.jsonID("replace",De);var Me=class extends Ze{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a;}apply(e){if(this.structure&&(Va(e,this.from,this.gapFrom)||Va(e,this.gapTo,this.to)))return Be.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Be.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Be.fromReplace(e,this.from,this.to,r):Be.fail("Content does not fit in gap")}getMap(){return new gt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Me(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Me(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Me(n.from,n.to,n.gapFrom,n.gapTo,B.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ze.jsonID("replaceAround",Me);function Va(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return !0;s=s.firstChild,i--;}}return !1}function lv(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,n),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(u[m])?s.to=p:i.push(s=new wt(f,p,u[m])));a&&a.to==f?a.to=p:o.push(a=new Gt(f,p,r));}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l));}function cv(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof nr){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c);}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let d=0;d<l.length;d++){let u=l[d],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&u.eq(i[p].style)&&(f=h);}f?(f.to=c,f.step=o):i.push({style:u,from:Math.max(a,e),to:c,step:o});}}}),i.forEach(s=>t.step(new wt(s.from,s.to,s.style)));}function qa(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new De(a,d,B.empty));else {r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new wt(a,d,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new B(N.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new De(a+f.index,a+f.index+f[0].length,h));}}a=d;}if(!r.validEnd){let l=r.fillBefore(N.empty,!0);t.replace(a,a,new B(l,0,0));}for(let l=s.length-1;l>=0;l--)t.step(s[l]);}function dv(t,e,n){return (e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function mn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!dv(i,o,s))break}return null}function uv(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=N.empty,u=0;for(let h=o,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,d=N.from(r.node(h).copy(d)),u++):l--;let f=N.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,f=N.from(i.node(h).copy(f)),p++):c++;t.step(new Me(l,c,s,a,new B(d.append(f),u,p),d.size-u,!0));}function Ir(t,e,n=null,r=t){let i=fv(t,e),o=i&&pv(r,e);return o?i.map(Mu).concat({type:e,attrs:n}).concat(o.map(Mu)):null}function Mu(t){return {type:t,attrs:null}}function fv(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function pv(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return !l||!l.validEnd?null:s}function hv(t,e,n){let r=N.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=N.from(n[s].type.create(n[s].attrs,r));}let i=e.start,o=e.end;t.step(new Me(i,o,i,o,new B(r,0,0),n.length,!0));}function mv(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&gv(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0);}c===!1&&Pu(t,s,a,o),qa(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let d=t.mapping.slice(o),u=d.map(a,1),f=d.map(a+s.nodeSize,1);return t.step(new Me(u,f,u+1,f-1,new B(N.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Lu(t,s,a,o),!1}});}function Lu(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create());}}});}function Pu(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
@@ -109,7 +109,7 @@ img.ProseMirror-separator {
|
|
|
109
109
|
2. Cannot start or end with "-"
|
|
110
110
|
3. "-" cannot repeat`);Te.customSchemes.push([t,e]);}function uk(){Te.scanner=ik(Te.customSchemes);for(let t=0;t<Te.tokenQueue.length;t++)Te.tokenQueue[t][1]({scanner:Te.scanner});Te.parser=ak(Te.scanner.tokens);for(let t=0;t<Te.pluginQueue.length;t++)Te.pluginQueue[t][1]({scanner:Te.scanner,parser:Te.parser});return Te.initialized=!0,Te}function Is(t){return Te.initialized||uk(),lk(Te.parser.start,t,qh(Te.scanner.start,t))}Is.scan=qh;function Ls(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null;}let r=new Ac(n),i=Is(t),o=[];for(let s=0;s<i.length;s++){let a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r));}return o}var Rc="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",fk=new RegExp(Rc),pk=new RegExp(`${Rc}$`),hk=new RegExp(Rc,"g");function mk(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function gk(t){return new Z({key:new re("autolink"),appendTransaction:(e,n,r)=>{let i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,a=Jl(n.doc,[...e]);if(tc(a).forEach(({newRange:c})=>{let d=Dp(r.doc,c,p=>p.isTextblock),u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){let p=r.doc.textBetween(c.from,c.to," "," ");if(!pk.test(p))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ");}if(u&&f){let p=f.split(fk).filter(Boolean);if(p.length<=0)return !1;let h=p[p.length-1],m=u.pos+f.lastIndexOf(h);if(!h)return !1;let g=Is(h).map(b=>b.toObject(t.defaultProtocol));if(!mk(g))return !1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Yo(b.from,b.to,r.doc).some(v=>v.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}));});}}),!!s.steps.length)return s}})}function bk(t){return new Z({key:new re("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return !1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else {let d=r.target,u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;s=u.find(f=>f.nodeName==="A");}if(!s)return !1;let a=ec(e.state,t.type.name),l=(i=s?.href)!=null?i:a.href,c=(o=s?.target)!=null?o:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&l?(window.open(l,c),!0):!1}}})}function yk(t){return new Z({key:new re("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return !1;let a="";r.content.forEach(c=>{a+=c.textContent;});let l=Ls(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return !a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function mr(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&n.push(i);}),!t||t.replace(hk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Dc=nt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Oc(t);return}Oc(t.scheme,t.optionalSlashes);});},onDestroy(){Jh();},inclusive(){return this.options.autolink},addOptions(){return {openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!mr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return {href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return [{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return !e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!mr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!mr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",te(this.options.HTMLAttributes,t),0]:["a",te(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return {setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!mr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{let{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!mr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return [St({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=Ls(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}));}return e},type:this.type,getAttributes:t=>{var e;return {href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(gk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(bk({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(yk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),Yh=Dc;var Ek=Object.defineProperty,vk=(t,e)=>{for(var n in e)Ek(t,n,{get:e[n],enumerable:!0});},wk="listItem",Zh="textStyle",Xh=/^\s*([-+*])\s$/,Pc=ge.create({name:"bulletList",addOptions(){return {itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return `${this.options.itemTypeName}+`},parseHTML(){return [{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return ["ul",te(this.options.HTMLAttributes,t),0]},addCommands(){return {toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(wk,this.editor.getAttributes(Zh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=en({find:Xh,type:this.type});return (this.options.keepMarks||this.options.keepAttributes)&&(t=en({find:Xh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Zh),editor:this.editor})),[t]}}),Bc=ge.create({name:"listItem",addOptions(){return {HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return [{tag:"li"}]},renderHTML({HTMLAttributes:t}){return ["li",te(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return {Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),xk={};vk(xk,{findListItemPos:()=>Ji,getNextListDepth:()=>zc,handleBackspace:()=>Ic,handleDelete:()=>Lc,hasListBefore:()=>tm,hasListItemAfter:()=>Sk,hasListItemBefore:()=>nm,listItemHasSubList:()=>rm,nextListIsDeeper:()=>im,nextListIsHigher:()=>om});var Ji=(t,e)=>{let{$from:n}=e.selection,r=ze(t,e.schema),i=null,o=n.depth,s=n.pos,a=null;for(;o>0&&a===null;)i=n.node(o),i.type===r?a=o:(o-=1,s-=1);return a===null?null:{$pos:e.doc.resolve(s),depth:a}},zc=(t,e)=>{let n=Ji(t,e);if(!n)return !1;let[,r]=Hp(e,t,n.$pos.pos+4);return r},tm=(t,e,n)=>{let{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return !(!o||!n.includes(o.type.name))},nm=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return !(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},rm=(t,e,n)=>{if(!n)return !1;let r=ze(t,e.schema),i=!1;return n.descendants(o=>{o.type===r&&(i=!0);}),i},Ic=(t,e,n)=>{if(t.commands.undoInputRule())return !0;if(t.state.selection.from!==t.state.selection.to)return !1;if(!Qt(t.state,e)&&tm(t.state,e,n)){let{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,p)=>{f.type.name===e&&c.push({node:f,pos:p});});let d=c.at(-1);if(!d)return !1;let u=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Qt(t.state,e)||!Kp(t.state))return !1;let r=Ji(e,t.state);if(!r)return !1;let o=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=rm(e,t.state,o);return nm(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},im=(t,e)=>{let n=zc(t,e),r=Ji(t,e);return !r||!n?!1:n>r.depth},om=(t,e)=>{let n=zc(t,e),r=Ji(t,e);return !r||!n?!1:n<r.depth},Lc=(t,e)=>{if(!Qt(t.state,e)||!$p(t.state,e))return !1;let{selection:n}=t.state,{$from:r,$to:i}=n;return !n.empty&&r.sameParent(i)?!1:im(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():om(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Sk=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return !(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Fc=ne.create({name:"listKeymap",addOptions(){return {listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return {Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Lc(t,n)&&(e=!0);}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Lc(t,n)&&(e=!0);}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ic(t,n,r)&&(e=!0);}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ic(t,n,r)&&(e=!0);}),e}}}}),Ck="listItem",Qh="textStyle",em=/^(\d+)\.\s$/,Uc=ge.create({name:"orderedList",addOptions(){return {itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return `${this.options.itemTypeName}+`},addAttributes(){return {start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return [{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",te(this.options.HTMLAttributes,n),0]:["ol",te(this.options.HTMLAttributes,t),0]},addCommands(){return {toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ck,this.editor.getAttributes(Qh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=en({find:em,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return (this.options.keepMarks||this.options.keepAttributes)&&(t=en({find:em,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Qh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),kk=/^\s*(\[([( |x])?\])\s$/,Ps=ge.create({name:"taskItem",addOptions(){return {nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return {checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return [{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return ["li",te(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return ({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=()=>{var d,u;a.ariaLabel=((u=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:u.call(d,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`;};return c(),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:u}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=n();if(typeof p!="number")return !1;let h=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...h?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(a.checked=!a.checked));}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u);}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u);}),{dom:i,contentDOM:l,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(),!0)}}},addInputRules(){return [en({find:kk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Bs=ge.create({name:"taskList",addOptions(){return {itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return `${this.options.itemTypeName}+`},parseHTML(){return [{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return ["ul",te(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return {toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return {"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ne.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(Pc.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Bc.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Fc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Uc.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Ps.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Bs.configure(this.options.taskList)),t}});var sm=ge.create({name:"paragraph",priority:1e3,addOptions(){return {HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return [{tag:"p"}]},renderHTML({HTMLAttributes:t}){return ["p",te(this.options.HTMLAttributes,t),0]},addCommands(){return {setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return {"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Nk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,am=nt.create({name:"strike",addOptions(){return {HTMLAttributes:{}}},parseHTML(){return [{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return ["s",te(this.options.HTMLAttributes,t),0]},addCommands(){return {setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return {"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return [Pt({find:Nk,type:this.type})]},addPasteRules(){return [St({find:Tk,type:this.type})]}});var lm=ge.create({name:"text",group:"inline"});var Hc=nt.create({name:"underline",addOptions(){return {HTMLAttributes:{}}},parseHTML(){return [{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return ["u",te(this.options.HTMLAttributes,t),0]},addCommands(){return {setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return {"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cm=Hc;function dm(t={}){return new Z({view(e){return new $c(e,t)}})}var $c=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s);};return e.dom.addEventListener(i,o),{name:i,handler:o}});}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n));}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay());}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay());}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=u?h.bottom:h.top;u&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:h.left,right:h.right,top:m-g,bottom:m+g};}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom};}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else {let u=l.getBoundingClientRect(),f=u.width/l.offsetWidth,p=u.height/l.offsetHeight;c=u.left-l.scrollLeft*f,d=u.top-l.scrollTop*p;}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px";}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e);}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Co(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a);}this.setCursor(s),this.scheduleRemoval(5e3);}}dragend(){this.scheduleRemoval(20);}drop(){this.scheduleRemoval(20);}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null);}};var Ae=class extends q{constructor(e){super(e,e);}map(e,n){let r=e.resolve(n.map(this.head));return Ae.valid(r)?new Ae(r):q.near(r)}content(){return B.empty}eq(e){return e instanceof Ae&&e.head==this.head}toJSON(){return {type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ae(e.resolve(n.pos))}getBookmark(){return new Yi(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!_k(e)||!Mk(e))return !1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ae.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Ae.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!W.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(Ae.valid(a))return a}return null}}};Ae.prototype.visible=!1;Ae.findFrom=Ae.findGapCursorFrom;q.jsonID("gapcursor",Ae);var Yi=class{constructor(e){this.pos=e;}map(e){return new Yi(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ae.valid(n)?new Ae(n):q.near(n)}};function _k(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return !0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return !0;if(i.inlineContent)return !1}}return !0}function Mk(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return !0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return !0;if(i.inlineContent)return !1}}return !0}function um(){return new Z({props:{decorations:Dk,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ae.valid(n)?new Ae(n):null},handleClick:Ok,handleKeyDown:Ak,handleDOMEvents:{beforeinput:Rk}}})}var Ak=Ri({ArrowLeft:zs("horiz",-1),ArrowRight:zs("horiz",1),ArrowUp:zs("vert",-1),ArrowDown:zs("vert",1)});function zs(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof H){if(!o.endOfTextblock(n)||a.depth==0)return !1;l=!1,a=r.doc.resolve(e>0?a.after():a.before());}let c=Ae.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Ae(c))),!0):!1}}function Ok(t,e,n){if(!t||!t.editable)return !1;let r=t.state.doc.resolve(e);if(!Ae.valid(r))return !1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&W.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ae(r))),!0)}function Rk(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ae))return !1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return !1;let i=N.empty;for(let s=r.length-1;s>=0;s--)i=N.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new B(i,0,0));return o.setSelection(H.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Dk(t){if(!(t.selection instanceof Ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",me.create(t.doc,[Ce.widget(t.selection.head,e,{key:"gapcursor"})])}var Fs=200,rt=function(){};rt.prototype.append=function(e){return e.length?(e=rt.from(e),!this.length&&e||e.length<Fs&&this.leafAppend(e)||this.length<Fs&&e.leafPrepend(this)||this.appendInner(e)):this};rt.prototype.prepend=function(e){return e.length?rt.from(e).append(this):this};rt.prototype.appendInner=function(e){return new Ik(this,e)};rt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?rt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};rt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};rt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0);};rt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};rt.from=function(e){return e instanceof rt?e:e&&e.length?new fm(e):rt.empty};var fm=function(t){function e(r){t.call(this),this.values=r;}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return !1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return !1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Fs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Fs)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(rt);rt.empty=new fm([]);var Ik=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return !1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return !1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(rt),Kc=rt;var Lk=500,At=class{constructor(e,n){this.items=e,this.eventCount=n;}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,d.push(u);return}if(i){d.push(new Ft(u.map));let p=u.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ft(h,void 0,void 0,c.length+d.length))),o--,h&&i.appendMap(h,o);}else s.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(o)):u.selection,l=new At(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new Ft(e.mapping.maps[d],u,n),p;(p=l&&l.merge(f))&&(f=p,d?o.pop():a=a.slice(0,a.length-1)),o.push(f),n&&(s++,n=void 0),i||(l=f);}let c=s-r.depth;return c>Bk&&(a=Pk(a,c),s-=c),new At(a.append(o),s)}remapping(e,n){let r=new Rn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s);},e,n),r}addMaps(e){return this.eventCount==0?this:new At(this.items.append(e.map(n=>new Ft(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--;},i);let l=n;this.items.forEach(f=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(l+1,p));g&&a++,r.push(new Ft(h,m,g));}else r.push(new Ft(h));},i);let c=[];for(let f=n;f<s;f++)c.push(new Ft(o.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new At(d,a);return u.emptyItemCount()>Lk&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++;}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let d=s.selection&&s.selection.map(n.slice(r));d&&o++;let u=new Ft(c.invert(),l,d),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u);}}else s.map&&r--;},this.items.length,0),new At(Kc.from(i.reverse()),o)}};At.empty=new At(Kc.empty,0);function Pk(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var Ft=class{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i;}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ft(n.getMap().invert(),n,this.selection)}}},rn=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o;}},Bk=20;function zk(t,e,n,r){let i=n.getMeta(gr),o;if(i)return i.historyState;n.getMeta(Hk)&&(t=new rn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(gr))return s.getMeta(gr).redo?new rn(t.done.addTransform(n,void 0,r,Us(e)),t.undone,pm(n.mapping.maps),t.prevTime,t.prevComposition):new rn(t.done,t.undone.addTransform(n,void 0,r,Us(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Fk(n,t.prevRanges)),c=s?Vc(t.prevRanges,n.mapping):pm(n.mapping.maps);return new rn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Us(e)),At.empty,c,n.time,a??t.prevComposition)}else return (o=n.getMeta("rebased"))?new rn(t.done.rebased(n,o),t.undone.rebased(n,o),Vc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new rn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Vc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Fk(t,e){if(!e)return !1;if(!t.docChanged)return !0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0);}),n}function pm(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Vc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o);}return n}function Uk(t,e,n){let r=Us(e),i=gr.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new rn(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(gr,{redo:n,historyState:l})}var Wc=!1,hm=null;function Us(t){let e=t.plugins;if(hm!=e){Wc=!1,hm=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Wc=!0;break}}return Wc}var gr=new re("history"),Hk=new re("closeHistory");function mm(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Z({key:gr,state:{init(){return new rn(At.empty,At.empty,null,0,-1)},apply(e,n,r){return zk(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Gc:r=="historyRedo"?qc:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Hs(t,e){return (n,r)=>{let i=gr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return !1;if(r){let o=Uk(i,n,t);o&&r(e?o.scrollIntoView():o);}return !0}}var Gc=Hs(!1,!0),qc=Hs(!0,!0);ne.create({name:"characterCount",addOptions(){return {limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return {characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)};},addProseMirrorPlugins(){let t=!1;return [new Z({key:new re("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let i=this.options.limit;if(i==null||i===0){t=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let s=o-i,a=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let c=r.tr.deleteRange(a,l);return t=!0,c}t=!0;},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return !0;let i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return !0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return !1;let a=e.selection.$head.pos,l=o-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var bm=ne.create({name:"dropCursor",addOptions(){return {color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return [dm(this.options)]}});ne.create({name:"focus",addOptions(){return {className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return [new Z({key:new re("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return me.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return !1;s+=1;});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return !1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Ce.node(c,c+l.nodeSize,{class:this.options.className}));}),me.create(t,o)}}})]}});var Zi=ne.create({name:"gapCursor",addProseMirrorPlugins(){return [um()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return {allowGapCursor:(e=Se(j(t,"allowGapCursor",n)))!=null?e:null}}}),jc=ne.create({name:"placeholder",addOptions(){return {emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return [new Z({key:new re("placeholder"),props:{decorations:({doc:t,selection:e})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;let o=this.editor.isEmpty;return t.descendants((s,a)=>{let l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Li(s);if((l||!this.options.showOnlyCurrent)&&c){let d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);let u=Ce.node(a,a+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u);}return this.options.includeChildren}),me.create(t,i)}}})]}});ne.create({name:"selection",addOptions(){return {className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return [new Z({key:new re("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Zo(n.selection)||t.view.dragging?null:me.create(n.doc,[Ce.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function gm({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var ym=ne.create({name:"trailingNode",addOptions(){return {node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){let t=new re(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>(this.options.notAfter||[]).concat(this.options.node).includes(n.name));return [new Z({key:t,appendTransaction:(n,r,i)=>{let{doc:o,tr:s,schema:a}=i,l=t.getState(i),c=o.content.size,d=a.nodes[this.options.node];if(l)return s.insert(c,d.create())},state:{init:(n,r)=>{let i=r.tr.doc.lastChild;return !gm({node:i,types:e})},apply:(n,r)=>{if(!n.docChanged)return r;let i=n.doc.lastChild;return !gm({node:i,types:e})}}})]}}),Em=ne.create({name:"undoRedo",addOptions(){return {depth:100,newGroupDelay:500}},addCommands(){return {undo:()=>({state:t,dispatch:e})=>Gc(t,e),redo:()=>({state:t,dispatch:e})=>qc(t,e)}},addProseMirrorPlugins(){return [mm(this.options)]},addKeyboardShortcuts(){return {"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var $k=ne.create({name:"starterKit",addExtensions(){var t,e,n,r;let i=[];return this.options.bold!==!1&&i.push(Th.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Nh.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Pc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(_h.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(cc.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Ah.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(bm.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Zi.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Oh.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Rh.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Em.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Dh.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Ih.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Bc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Fc.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Dc.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Uc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(sm.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(am.configure(this.options.strike)),this.options.text!==!1&&i.push(lm.configure(this.options.text)),this.options.underline!==!1&&i.push(Hc.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(ym.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),vm=$k;var wm=jc;var Kk=ne.create({name:"textAlign",addOptions(){return {types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return [{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return {setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return {"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),xm=Kk;var Vk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Wk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Gk=nt.create({name:"highlight",addOptions(){return {multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return [{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return ["mark",te(this.options.HTMLAttributes,t),0]},addCommands(){return {setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return {"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return [Pt({find:Vk,type:this.type})]},addPasteRules(){return [St({find:Wk,type:this.type})]}}),Sm=Gk;var qk=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,jk=ge.create({name:"image",addOptions(){return {inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return {src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return [{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return ["img",te(this.options.HTMLAttributes,t)]},addCommands(){return {setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return [Qo({find:qk,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return {src:n,alt:e,title:r}}})]}}),Cm=jk;var Yc,Zc;if(typeof WeakMap<"u"){let t=new WeakMap;Yc=e=>t.get(e),Zc=(e,n)=>(t.set(e,n),n);}else {let t=[],n=0;Yc=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Zc=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i);}var Ue=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r;}findCell(t){for(let e=0;e<this.map.length;e++){let n=this.map[e];if(n!=t)continue;let r=e%this.width,i=e/this.width|0,o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return {left:r,top:i,right:o,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,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){let{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return {left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){let o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s));}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o;}}static get(t){return Yc(t)||Zc(t,Jk(t))}};function Jk(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=Yk(t),n=t.childCount,r=[],i=0,o=null,s=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){let u=t.child(c);d++;for(let h=0;;h++){for(;i<r.length&&r[i]!=0;)i++;if(h==u.childCount)break;let m=u.child(h),{colspan:g,rowspan:b,colwidth:v}=m.attrs;for(let S=0;S<b;S++){if(S+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:d,n:b-S});break}let T=i+S*e;for(let _=0;_<g;_++){r[T+_]==0?r[T+_]=d:(o||(o=[])).push({type:"collision",row:c,pos:d,n:g-_});let I=v&&v[_];if(I){let k=(T+_)%e*2,y=s[k];y==null||y!=I&&s[k+1]==1?(s[k]=I,s[k+1]=1):y==I&&s[k+1]++;}}}i+=g,d+=m.nodeSize;}let f=(c+1)*e,p=0;for(;i<f;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),d++;}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});let a=new Ue(e,n,r,o),l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&Zk(a,s,t),a}function Yk(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let i=t.child(r),o=0;if(n)for(let s=0;s<r;s++){let a=t.child(s);for(let l=0;l<a.childCount;l++){let c=a.child(l);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan);}}for(let s=0;s<i.childCount;s++){let a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0);}e==-1?e=o:e!=o&&(e=Math.max(e,o));}return e}function Zk(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i<t.map.length;i++){let o=t.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let c=0;c<l.colspan;c++){let d=(i+c)%t.width,u=e[d*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Xk(l)))[c]=u);}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a});}}function Xk(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function ft(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r);}}return e}var Kn=new re("selectingCells");function Zr(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 Qk(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Vt(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return !0;return !1}function qs(t){let 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;let n=Zr(e.$head)||eN(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function eN(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Xc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function tN(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function td(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Im(t,e,n){let r=t.node(-1),i=Ue.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function br(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Lm(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0);}return r}function nN(t,e,n){let r=ft(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return !1;return !0}var ke=class Tn extends q{constructor(e,n=e){let r=e.node(-1),i=Ue.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(d=>d!=n.pos-o);l.unshift(n.pos-o);let c=l.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=o+d+1;return new Pr(a.resolve(f),a.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n;}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Xc(r)&&Xc(i)&&td(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Tn.rowSelection(r,i):o&&this.isColSelection()?Tn.colSelection(r,i):new Tn(r,i)}return H.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=Ue.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){let c=[];for(let d=l*n.width+i.left,u=i.left;u<i.right;u++,d++){let f=n.map[d];if(o[f])continue;o[f]=!0;let p=n.findCell(f),h=e.nodeAt(f);if(!h)throw RangeError(`No cell with offset ${f} found`);let m=i.left-p.left,g=p.right-i.right;if(m>0||g>0){let b=h.attrs;if(m>0&&(b=br(b,0,m)),g>0&&(b=br(b,b.colspan-g,g)),p.left<i.left){if(h=h.type.createAndFill(b),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else h=h.type.create(b,h.content);}if(p.top<i.top||p.bottom>i.bottom){let b={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?h=h.type.createAndFill(b):h=h.type.create(b,h.content);}c.push(h);}s.push(e.child(l).copy(N.from(c)));}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new B(N.from(a),1,1)}replace(e,n=B.empty){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?B.empty:n);}let o=q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o);}replaceWith(e,n){this.replace(e,new B(N.from(n),0,0));}forEachCell(e){let n=this.$anchorCell.node(-1),r=Ue.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s]);}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return !1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),i=Ue.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Tn(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=Ue.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return !1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Tn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=Ue.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Tn(e,n)}toJSON(){return {type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Tn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Tn(e.resolve(n),e.resolve(r))}getBookmark(){return new rN(this.$anchorCell.pos,this.$headCell.pos)}};ke.prototype.visible=!1;q.jsonID("cell",ke);var rN=class Pm{constructor(e,n){this.anchor=e,this.head=n;}map(e){return new Pm(e.map(this.anchor),e.map(this.head))}resolve(e){let n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&td(n,r)?new ke(n,r):q.near(r,1)}};function iN(t){if(!(t.selection instanceof ke))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(Ce.node(r,r+n.nodeSize,{class:"selectedCell"}));}),me.create(t.doc,e)}function oN({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return !1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function sN({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function aN(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof W&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=ke.create(i,r.from);else if(s=="row"){let a=i.resolve(r.from+1);o=ke.rowSelection(a,a);}else if(!n){let a=Ue.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=ke.create(i,l+1,c);}}else r instanceof H&&oN(r)?o=H.create(i,r.from):r instanceof H&&sN(r)&&(o=H.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var lN=new re("fix-tables");function Bm(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s<o;s++){let l=e.child(s);for(let c=a,d=Math.min(i,s+3);c<d;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?Bm(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize;}}function nd(t,e){let n,r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=cN(t,i,o,n));};return e?e.doc!=t.doc&&Bm(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cN(t,e,n,r){let i=Ue.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){let c=i.problems[l];if(c.type=="collision"){let d=e.nodeAt(c.pos);if(!d)continue;let u=d.attrs;for(let f=0;f<u.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,br(u,u.colspan-c.n,c.n));}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n});}else if(c.type=="colwidth mismatch"){let d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth});}else if(c.type=="zero_sized"){let d=r.mapping.map(n);r.delete(d,d+e.nodeSize);}}let s,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<i.height;l++){let d=e.child(l),u=c+d.nodeSize,f=o[l];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);let h=[];for(let g=0;g<f;g++){let b=ft(t.schema)[p].createAndFill();b&&h.push(b);}let m=(l==0||s==l-1)&&a==l?c+1:u-1;r.insert(r.mapping.map(m),h);}c=u;}return r.setMeta(lN,{fixTables:!0})}function on(t){let e=t.selection,n=qs(t),r=n.node(-1),i=n.start(-1),o=Ue.get(r);return {...e instanceof ke?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function zm(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;nN(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){let a=s*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Lm(c.attrs,i-e.colCount(l))),s+=c.attrs.rowspan-1;}else {let l=o==null?ft(r.type.schema).cell:r.nodeAt(e.map[a+o]).type,c=e.positionAt(s,i,r);t.insert(t.mapping.map(n+c),l.createAndFill());}}return t}function Fm(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e(zm(t.tr,n,n.left));}return !0}function Um(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e(zm(t.tr,n,n.right));}return !0}function dN(t,{map:e,table:n,tableStart:r},i){let o=t.mapping.maps.length;for(let s=0;s<e.height;){let a=s*e.width+i,l=e.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(o).map(r+l),null,br(d,i-e.colCount(l)));else {let u=t.mapping.slice(o).map(r+l);t.delete(u,u+c.nodeSize);}s+=d.rowspan;}}function Hm(t,e){if(!Vt(t))return !1;if(e){let n=on(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return !1;for(let i=n.right-1;dN(r,n,i),i!=n.left;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Ue.get(o);}e(r);}return !0}function uN(t,e,n){var r;let i=ft(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))==null?void 0:r.type)!=i)return !1;return !0}function $m(t,{map:e,tableStart:n,table:r},i){var o;let s=n;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;let a=[],l=i>0?-1:0;uN(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,d=e.width*i;c<e.width;c++,d++)if(i>0&&i<e.height&&e.map[d]==e.map[d-e.width]){let u=e.map[d],f=r.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1;}else {let u=l==null?ft(r.type.schema).cell:(o=r.nodeAt(e.map[d+l*e.width]))==null?void 0:o.type,f=u?.createAndFill();f&&a.push(f);}return t.insert(s,ft(r.type.schema).row.create(null,a)),t}function Km(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e($m(t.tr,n,n.top));}return !0}function Vm(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e($m(t.tr,n,n.bottom));}return !0}function fN(t,{map:e,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;let s=o+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(o+r,s+r);let l=new Set;for(let c=0,d=i*e.width;c<e.width;c++,d++){let u=e.map[d];if(!l.has(u)){if(l.add(u),i>0&&u==e.map[d-e.width]){let f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1;}else if(i<e.height&&u==e.map[d+e.width]){let f=n.nodeAt(u),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(a).map(r+m),h),c+=p.colspan-1;}}}}function Wm(t,e){if(!Vt(t))return !1;if(e){let n=on(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return !1;for(let i=n.bottom-1;fN(r,n,i),i!=n.top;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Ue.get(n.table);}e(r);}return !0}function km(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function pN({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[a]==n[a+1])return !0;o+=t,a+=t;}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return !0;i++,s++;}return !1}function rd(t,e){let n=t.selection;if(!(n instanceof ke)||n.$anchorCell.pos==n.$headCell.pos)return !1;let r=on(t),{map:i}=r;if(pN(i,r))return !1;if(e){let o=t.tr,s={},a=N.empty,l,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){let f=i.map[d*i.width+u],p=r.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,l==null)l=f,c=p;else {km(p)||(a=a.append(p.content));let h=o.mapping.map(f+r.tableStart);o.delete(h,h+p.nodeSize);}}if(l==null||c==null)return !0;if(o.setNodeMarkup(l+r.tableStart,null,{...Lm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){let d=l+1+c.content.size,u=km(c)?l+1:d;o.replaceWith(u+r.tableStart,d+r.tableStart,a);}o.setSelection(new ke(o.doc.resolve(l+r.tableStart))),e(o);}return !0}function id(t,e){let n=ft(t.schema);return hN(({node:r})=>n[r.type.spec.tableRole])(t,e)}function hN(t){return (e,n)=>{var r;let i=e.selection,o,s;if(i instanceof ke){if(i.$anchorCell.pos!=i.$headCell.pos)return !1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos;}else {if(o=Qk(i.$from),!o)return !1;s=(r=Zr(i.$from))==null?void 0:r.pos;}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return !1;if(n){let a=o.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=on(e),u=e.tr;for(let p=0;p<d.right-d.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let f;for(let p=d.top;p<d.bottom;p++){let h=d.map.positionAt(p,d.left,d.table);p==d.top&&(h+=o.nodeSize);for(let m=d.left,g=0;m<d.right;m++,g++)m==d.left&&p==d.top||u.insert(f=u.mapping.map(h+d.tableStart,1),t({node:o,row:p,col:m}).createAndFill(l[g]));}u.setNodeMarkup(s,t({node:o,row:d.top,col:d.left}),l[0]),i instanceof ke&&u.setSelection(new ke(u.doc.resolve(i.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u);}return !0}}function Gm(t,e){return function(n,r){if(!Vt(n))return !1;let i=qs(n);if(i.nodeAfter.attrs[t]===e)return !1;if(r){let o=n.tr;n.selection instanceof ke?n.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&o.setNodeMarkup(a,null,{...s.attrs,[t]:e});}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o);}return !0}}function mN(t){return function(e,n){if(!Vt(e))return !1;if(n){let r=ft(e.schema),i=on(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o);}return !0}}function Nm(t,e,n){let r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){let o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return !1}return !0}function Xr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?mN(t):function(n,r){if(!Vt(n))return !1;if(r){let i=ft(n.schema),o=on(n),s=n.tr,a=Nm("row",o,i),l=Nm("column",o,i),d=(t==="column"?a:t==="row"?l:!1)?1:0,u=t=="column"?{left:0,top:d,right:1,bottom:o.map.height}:t=="row"?{left:d,top:0,right:o.map.width,bottom:1}:o,f=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(p=>{let h=p+o.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs);}),r(s);}return !0}}Xr("row",{useDeprecatedLogic:!0});Xr("column",{useDeprecatedLogic:!0});var qm=Xr("cell",{useDeprecatedLogic:!0});function gN(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize;}}else {if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){let o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize;}}return null}function od(t){return function(e,n){if(!Vt(e))return !1;let r=gN(qs(e),t);if(r==null)return !1;if(n){let i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,tN(i))).scrollIntoView());}return !0}}function jm(t,e){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return !1}function $s(t,e){let n=t.selection;if(!(n instanceof ke))return !1;if(e){let r=t.tr,i=ft(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new B(i,0,0));}),r.docChanged&&e(r);}return !0}function bN(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;let i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,d=l?0:Math.max(0,n-1),u=l<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=Qc(ft(s).row,new B(c,d,u)).content),a.push(c);}else if(o=="cell"||o=="header_cell")a.push(n||r?Qc(ft(s).row,new B(e,n,r)).content:e);else return null;return yN(s,a)}function yN(t,e){let n=[];for(let i=0;i<e.length;i++){let o=e[i];for(let s=o.childCount-1;s>=0;s--){let{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l;}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(N.empty),n[i]<r){let o=ft(t).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);e[i]=e[i].append(N.from(s));}return {height:e.length,width:r,rows:e}}function Qc(t,e){let n=t.createAndFill();return new Dn(n).replace(0,n.content.size,e).doc}function EN({width:t,height:e,rows:n},r,i){if(t!=r){let o=[],s=[];for(let a=0;a<n.length;a++){let l=n[a],c=[];for(let d=o[a]||0,u=0;d<r;u++){let f=l.child(u%l.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(br(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)o[a+p]=(o[a+p]||0)+f.attrs.colspan;}s.push(N.from(c));}n=s,t=r;}if(e!=i){let o=[];for(let s=0,a=0;s<i;s++,a++){let l=[],c=n[a%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),l.push(u);}o.push(N.from(l));}n=o,e=i;}return {width:t,height:e,rows:n}}function vN(t,e,n,r,i,o,s){let a=t.doc.type.schema,l=ft(a),c,d;if(i>e.width)for(let u=0,f=0;u<e.height;u++){let p=n.child(u);f+=p.nodeSize;let h=[],m;p.lastChild==null||p.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=d||(d=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)h.push(m);t.insert(t.mapping.slice(s).map(f-1+r),h);}if(o>e.height){let u=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,i);h++){let g=h>=e.width?!1:n.nodeAt(e.map[m+h]).type==l.header_cell;u.push(g?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()));}let f=l.row.create(null,N.from(u)),p=[];for(let h=e.height;h<o;h++)p.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p);}return !!(c||d)}function Tm(t,e,n,r,i,o,s,a){if(s==0||s==e.height)return !1;let l=!1;for(let c=i;c<o;c++){let d=s*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){l=!0;let f=n.nodeAt(u),{top:p,left:h}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...f.attrs,rowspan:s-p}),t.insert(t.mapping.slice(a).map(e.positionAt(s,h,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1;}}return l}function _m(t,e,n,r,i,o,s,a){if(s==0||s==e.width)return !1;let l=!1;for(let c=i;c<o;c++){let d=c*e.width+s,u=e.map[d];if(e.map[d-1]==u){l=!0;let f=n.nodeAt(u),p=e.colCount(u),h=t.mapping.slice(a).map(u+r);t.setNodeMarkup(h,null,br(f.attrs,s-p,f.attrs.colspan-(s-p))),t.insert(h+f.nodeSize,f.type.createAndFill(br(f.attrs,0,s-p))),c+=f.attrs.rowspan-1;}}return l}function Mm(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=Ue.get(o),{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=t.tr,f=0;function p(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=Ue.get(o),f=u.mapping.maps.length;}vN(u,s,o,n,c,d,f)&&p(),Tm(u,s,o,n,l,c,a,f)&&p(),Tm(u,s,o,n,l,c,d,f)&&p(),_m(u,s,o,n,a,d,l,f)&&p(),_m(u,s,o,n,a,d,c,f)&&p();for(let h=a;h<d;h++){let m=s.positionAt(h,l,o),g=s.positionAt(h,c,o);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(g+n),new B(i.rows[h-a],0,0));}p(),u.setSelection(new ke(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(d-1,c-1,o)))),e(u);}var wN=Ri({ArrowLeft:Ks("horiz",-1),ArrowRight:Ks("horiz",1),ArrowUp:Ks("vert",-1),ArrowDown:Ks("vert",1),"Shift-ArrowLeft":Vs("horiz",-1),"Shift-ArrowRight":Vs("horiz",1),"Shift-ArrowUp":Vs("vert",-1),"Shift-ArrowDown":Vs("vert",1),Backspace:$s,"Mod-Backspace":$s,Delete:$s,"Mod-Delete":$s});function Ws(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ks(t,e){return (n,r,i)=>{if(!i)return !1;let o=n.selection;if(o instanceof ke)return Ws(n,r,q.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return !1;let s=Jm(i,t,e);if(s==null)return !1;if(t=="horiz")return Ws(n,r,q.near(n.doc.resolve(o.head+e),e));{let a=n.doc.resolve(s),l=Im(a,t,e),c;return l?c=q.near(l,1):e<0?c=q.near(n.doc.resolve(a.before(-1)),-1):c=q.near(n.doc.resolve(a.after(-1)),1),Ws(n,r,c)}}}function Vs(t,e){return (n,r,i)=>{if(!i)return !1;let o=n.selection,s;if(o instanceof ke)s=o;else {let l=Jm(i,t,e);if(l==null)return !1;s=new ke(n.doc.resolve(l));}let a=Im(s.$headCell,t,e);return a?Ws(n,r,new ke(s.$anchorCell,a)):!1}}function xN(t,e){let n=t.state.doc,r=Zr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ke(r))),!0):!1}function SN(t,e,n){if(!Vt(t.state))return !1;let r=bN(n),i=t.state.selection;if(i instanceof ke){r||(r={width:1,height:1,rows:[N.from(Qc(ft(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Ue.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=EN(r,a.right-a.left,a.bottom-a.top),Mm(t.state,t.dispatch,s,a,r),!0}else if(r){let o=qs(t.state),s=o.start(-1);return Mm(t.state,t.dispatch,s,Ue.get(o.node(-1)).findCell(o.pos-s),r),!0}else return !1}function CN(t,e){var n;if(e.ctrlKey||e.metaKey)return;let r=Am(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof ke)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Zr(t.state.selection.$anchor))!=null&&((n=Jc(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let d=Jc(t,c),u=Kn.getState(t.state)==null;if(!d||!td(l,d))if(u)d=l;else return;let f=new ke(l,d);if(u||!t.state.selection.eq(f)){let p=t.state.tr.setSelection(f);u&&p.setMeta(Kn,l.pos),t.dispatch(p);}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Kn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Kn,-1));}function a(l){let c=l,d=Kn.getState(t.state),u;if(d!=null)u=t.state.doc.resolve(d);else if(Am(t,c.target)!=r&&(u=Jc(t,e),!u))return s();u&&o(u,c);}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a);}function Jm(t,e,n){if(!(t.state.selection instanceof H))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function Am(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Jc(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Zr(t.state.doc.resolve(n.pos)):null}var kN=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")),ed(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,ed(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ed(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild,d=t.firstChild;if(d){for(let u=0,f=0;u<d.childCount;u++){let{colspan:p,colwidth:h}=d.child(u).attrs;for(let m=0;m<p;m++,f++){let g=i==f?o:h&&h[m],b=g?g+"px":"";if(a+=g||r,g||(l=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else {let v=document.createElement("col");v.style.width=b,e.appendChild(v);}}}for(;c;){let u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u;}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px");}}var Ot=new re("tableColumnResizing");function Ym({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=kN,lastColumnResizable:i=!0}={}){let o=new Z({key:Ot,state:{init(s,a){var l,c;let d=(c=(l=o.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,u=ft(a.schema).table.name;return r&&d&&(d[u]=(f,p)=>new r(f,n,p)),new NN(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=Ot.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{TN(s,a,t,i);},mouseleave:s=>{_N(s);},mousedown:(s,a)=>{MN(s,a,e,n);}},decorations:s=>{let a=Ot.getState(s);if(a&&a.activeHandle>-1)return IN(s,a.activeHandle)},nodeViews:{}}});return o}var NN=class Gs{constructor(e,n){this.activeHandle=e,this.dragging=n;}apply(e){let n=this,r=e.getMeta(Ot);if(r&&r.setHandle!=null)return new Gs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Gs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Xc(e.doc.resolve(i))||(i=-1),new Gs(i,n.dragging)}return n}};function TN(t,e,n,r){if(!t.editable)return;let i=Ot.getState(t.state);if(i&&!i.dragging){let o=ON(e.target),s=-1;if(o){let{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=Om(t,e,"left",n):l-e.clientX<=n&&(s=Om(t,e,"right",n));}if(s!=i.activeHandle){if(!r&&s!==-1){let a=t.state.doc.resolve(s),l=a.node(-1),c=Ue.get(l),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}Zm(t,s);}}}function _N(t){if(!t.editable)return;let e=Ot.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Zm(t,-1);}function MN(t,e,n,r){var i;if(!t.editable)return !1;let o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=Ot.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return !1;let a=t.state.doc.nodeAt(s.activeHandle),l=AN(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ot,{setDragging:{startX:e.clientX,startWidth:l}}));function c(u){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let f=Ot.getState(t.state);f?.dragging&&(RN(t,f.activeHandle,Rm(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(Ot,{setDragging:null})));}function d(u){if(!u.which)return c(u);let f=Ot.getState(t.state);if(f&&f.dragging){let p=Rm(f.dragging,u,n);Dm(t,f.activeHandle,p,r);}}return Dm(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),e.preventDefault(),!0}function AN(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),a=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function ON(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Om(t,e,n,r){let i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return -1;let{pos:s}=o,a=Zr(t.state.doc.resolve(s));if(!a)return -1;if(n=="right")return a.pos;let l=Ue.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function Rm(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Zm(t,e){t.dispatch(t.state.tr.setMeta(Ot,{setHandle:e}));}function RN(t,e,n){let r=t.state.doc.resolve(e),i=r.node(-1),o=Ue.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<o.height;c++){let d=c*o.width+a;if(c&&o.map[d]==o.map[d-o.width])continue;let u=o.map[d],f=i.nodeAt(u).attrs,p=f.colspan==1?0:a-o.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;let h=f.colwidth?f.colwidth.slice():DN(f.colspan);h[p]=n,l.setNodeMarkup(s+u,null,{...f,colwidth:h});}l.docChanged&&t.dispatch(l);}function Dm(t,e,n,r){let i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),a=Ue.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&ed(o,l.firstChild,l,r,a,n);}function DN(t){return Array(t).fill(0)}function IN(t,e){var n;let r=[],i=t.doc.resolve(e),o=i.node(-1);if(!o)return me.empty;let s=Ue.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){let d=l+c*s.width;if((l==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){let u=s.map[d],f=a+u+o.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Ot.getState(t))!=null&&n.dragging&&r.push(Ce.node(a+u,a+u+o.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),r.push(Ce.widget(f,p));}}return me.create(t.doc,r)}function Xm({allowTableNodeSelection:t=!1}={}){return new Z({key:Kn,state:{init(){return null},apply(e,n){let r=e.getMeta(Kn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:iN,handleDOMEvents:{mousedown:CN},createSelectionBetween(e){return Kn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:xN,handleKeyDown:wN,handlePaste:SN},appendTransaction(e,n,r){return aN(r,nd(r,n),t)}})}var Js=ge.create({name:"tableCell",addOptions(){return {HTMLAttributes:{}}},content:"block+",addAttributes(){return {colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return [{tag:"td"}]},renderHTML({HTMLAttributes:t}){return ["td",te(this.options.HTMLAttributes,t),0]}}),Ys=ge.create({name:"tableHeader",addOptions(){return {HTMLAttributes:{}}},content:"block+",addAttributes(){return {colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return [{tag:"th"}]},renderHTML({HTMLAttributes:t}){return ["th",te(this.options.HTMLAttributes,t),0]}}),Zs=ge.create({name:"tableRow",addOptions(){return {HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return [{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return ["tr",te(this.options.HTMLAttributes,t),0]}});function sd(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Qm(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild,d=t.firstChild;if(d!==null)for(let u=0,f=0;u<d.childCount;u+=1){let{colspan:p,colwidth:h}=d.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){let g=i===f?o:h&&h[m],b=g?`${g}px`:"";if(a+=g||r,g||(l=!1),c){if(c.style.width!==b){let[v,S]=sd(r,g);c.style.setProperty(v,S);}c=c.nextSibling;}else {let v=document.createElement("col"),[S,T]=sd(r,g);v.style.setProperty(S,T),e.appendChild(v);}}}for(;c;){let u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u;}l?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`);}var LN=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qm(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,Qm(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}};function PN(t,e,n,r){let i=0,o=!0,s=[],a=t.firstChild;if(!a)return {};for(let u=0,f=0;u<a.childCount;u+=1){let{colspan:p,colwidth:h}=a.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){let g=n===f?r:h&&h[m];i+=g||e,g||(o=!1);let[b,v]=sd(e,g);s.push(["col",{style:`${b}: ${v}`}]);}}let l=o?`${i}px`:"",c=o?"":`${i}px`;return {colgroup:["colgroup",{},...s],tableWidth:l,tableMinWidth:c}}function eg(t,e){return e?t.createChecked(null,e):t.createAndFill()}function BN(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r);}),t.cached.tableNodeTypes=e,e}function zN(t,e,n,r,i){let o=BN(t),s=[],a=[];for(let c=0;c<n;c+=1){let d=eg(o.cell,i);if(d&&a.push(d),r){let u=eg(o.header_cell,i);u&&s.push(u);}}let l=[];for(let c=0;c<e;c+=1)l.push(o.row.createChecked(null,r&&c===0?s:a));return o.table.createChecked(null,l)}function FN(t){return t instanceof ke}var js=({editor:t})=>{let{selection:e}=t.state;if(!FN(e))return !1;let n=0,r=Yl(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return !1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1);}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},ad=ge.create({name:"table",addOptions(){return {HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:LN,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return [{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=PN(t,this.options.cellMinWidth);return ["table",te(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return {insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=zN(o.schema,t,e,n);if(i){let a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(H.near(r.doc.resolve(a)));}return !0},addColumnBefore:()=>({state:t,dispatch:e})=>Fm(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Um(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Hm(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Km(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Vm(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wm(t,e),deleteTable:()=>({state:t,dispatch:e})=>jm(t,e),mergeCells:()=>({state:t,dispatch:e})=>rd(t,e),splitCell:()=>({state:t,dispatch:e})=>id(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Xr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Xr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>qm(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>rd(t,e)?!0:id(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Gm(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>od(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>od(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&nd(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=ke.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r);}return !0}}},addKeyboardShortcuts(){return {Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:js,"Mod-Backspace":js,Delete:js,"Mod-Delete":js}},addProseMirrorPlugins(){return [...this.options.resizable&&this.editor.isEditable?[Ym({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xm({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return {tableRole:Se(j(t,"tableRole",e))}}});ne.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(ad.configure(this.options.table)),this.options.tableCell!==!1&&t.push(Js.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Ys.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(Zs.configure(this.options.tableRow)),t}});var tg=Zs;var ng=Js;var rg=Ys;var UN=t=>{if(!t.children.length)return;let e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,i;let o=n.getAttribute("style"),s=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${s};${o}`);});},ld=nt.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return [{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&UN(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return ["span",te(this.options.HTMLAttributes,t),0]},addCommands(){return {toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{let{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return !0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(r,r+n.nodeSize,this.type);}),!0}}}}),HN=ne.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;return (e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cd=ne.create({name:"color",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return (e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return {setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),$N=ne.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),KN=ne.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),VN=ne.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ne.create({name:"textStyleKit",addExtensions(){let t=[];return this.options.backgroundColor!==!1&&t.push(HN.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cd.configure(this.options.color)),this.options.fontFamily!==!1&&t.push($N.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(KN.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(VN.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(ld.configure(this.options.textStyle)),t}});var ig=cd;var og=Zi;var sg=Bs;var ag=Ps;var WN=t=>Ie({find:/--$/,replace:t??"\u2014"}),GN=t=>Ie({find:/\.\.\.$/,replace:t??"\u2026"}),qN=t=>Ie({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"\u201C"}),jN=t=>Ie({find:/"$/,replace:t??"\u201D"}),JN=t=>Ie({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"\u2018"}),YN=t=>Ie({find:/'$/,replace:t??"\u2019"}),ZN=t=>Ie({find:/<-$/,replace:t??"\u2190"}),XN=t=>Ie({find:/->$/,replace:t??"\u2192"}),QN=t=>Ie({find:/\(c\)$/,replace:t??"\xA9"}),eT=t=>Ie({find:/\(tm\)$/,replace:t??"\u2122"}),tT=t=>Ie({find:/\(sm\)$/,replace:t??"\u2120"}),nT=t=>Ie({find:/\(r\)$/,replace:t??"\xAE"}),rT=t=>Ie({find:/(?:^|\s)(1\/2)\s$/,replace:t??"\xBD"}),iT=t=>Ie({find:/\+\/-$/,replace:t??"\xB1"}),oT=t=>Ie({find:/!=$/,replace:t??"\u2260"}),sT=t=>Ie({find:/<<$/,replace:t??"\xAB"}),aT=t=>Ie({find:/>>$/,replace:t??"\xBB"}),lT=t=>Ie({find:/\d+\s?([*x])\s?\d+$/,replace:t??"\xD7"}),cT=t=>Ie({find:/\^2$/,replace:t??"\xB2"}),dT=t=>Ie({find:/\^3$/,replace:t??"\xB3"}),uT=t=>Ie({find:/(?:^|\s)(1\/4)\s$/,replace:t??"\xBC"}),fT=t=>Ie({find:/(?:^|\s)(3\/4)\s$/,replace:t??"\xBE"}),pT=ne.create({name:"typography",addOptions(){return {closeDoubleQuote:"\u201D",closeSingleQuote:"\u2019",copyright:"\xA9",ellipsis:"\u2026",emDash:"\u2014",laquo:"\xAB",leftArrow:"\u2190",multiplication:"\xD7",notEqual:"\u2260",oneHalf:"\xBD",oneQuarter:"\xBC",openDoubleQuote:"\u201C",openSingleQuote:"\u2018",plusMinus:"\xB1",raquo:"\xBB",registeredTrademark:"\xAE",rightArrow:"\u2192",servicemark:"\u2120",superscriptThree:"\xB3",superscriptTwo:"\xB2",threeQuarters:"\xBE",trademark:"\u2122"}},addInputRules(){let t=[];return this.options.emDash!==!1&&t.push(WN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(GN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(qN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(jN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(JN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(YN(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(ZN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(XN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(QN(this.options.copyright)),this.options.trademark!==!1&&t.push(eT(this.options.trademark)),this.options.servicemark!==!1&&t.push(tT(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(nT(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(rT(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(iT(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(oT(this.options.notEqual)),this.options.laquo!==!1&&t.push(sT(this.options.laquo)),this.options.raquo!==!1&&t.push(aT(this.options.raquo)),this.options.multiplication!==!1&&t.push(lT(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(cT(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(dT(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(uT(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(fT(this.options.threeQuarters)),t}}),lg=pT;var Mg=ai(_g(),1);var na=Mg.default;function Rg(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?Rg(n.children,r):{text:n.value,classes:r}}).flat()}function Ag(t){return t.value||t.children||[]}function r_(t){return !!na.getLanguage(t)}function Og({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return qo(t,o=>o.type.name===e).forEach(o=>{var s;let a=o.pos+1,l=o.node.attrs.language||r,c=n.listLanguages(),d=l&&(c.includes(l)||r_(l)||(s=n.registered)!=null&&s.call(n,l))?Ag(n.highlight(l,o.node.textContent)):Ag(n.highlightAuto(o.node.textContent));Rg(d).forEach(u=>{let f=a+u.text.length;if(u.classes.length){let p=Ce.inline(a,f,{class:u.classes.join(" ")});i.push(p);}a=f;});}),me.create(t,i)}function i_(t){return typeof t=="function"}function o_({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>i_(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new Z({key:new re("lowlight"),state:{init:(i,{doc:o})=>Og({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,a)=>{let l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=qo(s.doc,f=>f.type.name===t),u=qo(a.doc,f=>f.type.name===t);return i.docChanged&&([l,c].includes(t)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Og({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var s_=Mh.extend({addOptions(){var t;return {...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return [...((t=this.parent)==null?void 0:t.call(this))||[],o_({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),Dg=s_;function a_(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},_={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[_,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:I.concat([{begin:/\(/,end:/\)/,keywords:T,contains:I.concat(["self"]),relevance:0}]),relevance:0},y={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,y,_,I,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Ig(t){let e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=a_(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function Lg(t){let e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},o=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);let l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],_=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return {name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...v,...S,"set","shopt",...T,..._]},contains:[p,t.SHEBANG(),h,u,o,s,b,a,l,c,d,n]}}function Pg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},S={begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:p,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(v,S,b,[u,{begin:t.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function Bg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},_={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[_,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:I.concat([{begin:/\(/,end:/\)/,keywords:T,contains:I.concat(["self"]),relevance:0}]),relevance:0},y={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,y,_,I,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function zg(t){let e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=t.inherit(d,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},p=t.inherit(f,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},g=t.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[m,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[g,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let b={variants:[c,m,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},v={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},S=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",T={begin:"@"+t.IDENT_RE,relevance:0};return {name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,v,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,v,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+S+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,v],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},T]}}var l_=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),c_=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],d_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],u_=[...c_,...d_],f_=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),p_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),h_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),m_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Fg(t){let e=t.regex,n=l_(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return {name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+p_.join("|")+")"},{begin:":(:)?("+h_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+m_.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:f_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+u_.join("|")+")\\b"}]}}function Ug(t){let e=t.regex;return {name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Hg(t){let o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return {name:"Go",aliases:["golang"],keywords:o,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:o,illegal:/["']/}]}]}}function $g(t){let e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return {name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Kg(t){let e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,o,i,s,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,d=/'[^']*'/,u=e.either(l,c,d),f=e.concat(u,"(\\s*\\.\\s*",u,")*",e.lookahead(/\s*=\s*[^#\s]/));return {name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,o,i,s,n]}}]}}var ti="[0-9](_*[0-9])*",ra=`\\.(${ti})`,ia="[0-9a-fA-F](_*[0-9a-fA-F])*",Vg={className:"number",variants:[{begin:`(\\b(${ti})((${ra})|\\.)?|(${ra}))[eE][+-]?(${ti})[fFdD]?\\b`},{begin:`\\b(${ti})((${ra})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ra})[fFdD]?\\b`},{begin:`\\b(${ti})[fFdD]\\b`},{begin:`\\b0[xX]((${ia})\\.?|(${ia})?\\.(${ia}))[pP][+-]?(${ti})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ia})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wg(t,e,n){return n===-1?"":t.replace(e,r=>Wg(t,e,n-1))}function Gg(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+Wg("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return {name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Vg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Vg,c]}}var qg="[A-Za-z$_][0-9A-Za-z$_]*",g_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],b_=["true","false","null","undefined","NaN","Infinity"],jg=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Jg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Yg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],y_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],E_=[].concat(Yg,jg,Jg);function Zg(t){let e=t.regex,n=(M,{after:U})=>{let z="</"+M[0].slice(1);return M.input.indexOf(z,U)!==-1},r=qg,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,U)=>{let z=M[0].length+M.index,J=M.input[z];if(J==="<"||J===","){U.ignoreMatch();return}J===">"&&(n(M,{after:z})||U.ignoreMatch());let ie,$=M.input.substring(z);if(ie=$.match(/^\s*=/)){U.ignoreMatch();return}if((ie=$.match(/^\s+extends\s+/))&&ie.index===0){U.ignoreMatch();return}}},a={$pattern:qg,keyword:g_,literal:b_,built_in:E_,"variable.language":y_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});let T=[].concat(v,f.contains),_=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},y={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jg,...Jg]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(M){return e.concat("(?!",M.join("|"),")")}let ce={match:e.concat(/\b/,R([...Yg,"super","import"].map(M=>`${M}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,v,{match:/\$\d+/},u,y,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ce,X,k,G,{match:/\$[(.]/}]}}function Xg(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return {name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var ni="[0-9](_*[0-9])*",oa=`\\.(${ni})`,sa="[0-9a-fA-F](_*[0-9a-fA-F])*",v_={className:"number",variants:[{begin:`(\\b(${ni})((${oa})|\\.)?|(${oa}))[eE][+-]?(${ni})[fFdD]?\\b`},{begin:`\\b(${ni})((${oa})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${oa})[fFdD]?\\b`},{begin:`\\b(${ni})[fFdD]\\b`},{begin:`\\b0[xX]((${sa})\\.?|(${sa})?\\.(${sa}))[pP][+-]?(${ni})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${sa})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Qg(t){let e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},c=v_,d=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),u={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=u;return f.variants[1].contains=[u],u.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,d,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[u,t.C_LINE_COMMENT_MODE,d],relevance:0},t.C_LINE_COMMENT_MODE,d,a,l,s,t.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
111
111
|
`},c]}}var w_=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),x_=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],S_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],C_=[...x_,...S_],k_=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),eb=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),tb=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),N_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),T_=eb.concat(tb).sort().reverse();function nb(t){let e=w_(t),n=T_,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(S){return {className:"string",begin:"~?"+S+".*?"+S}},c=function(S,T,_){return {className:S,begin:T,relevance:_}},d={$pattern:/[a-z-]+/,keyword:r,attribute:k_.join(" ")},u={begin:"\\(",end:"\\)",contains:a,keywords:d,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,u,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);let f=a.concat({begin:/\{/,end:/\}/,contains:s}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+N_.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},m={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:a,relevance:0}},g={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+C_.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",o,0),c("selector-id","#"+o),c("selector-class","\\."+o,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+eb.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+tb.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,v,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function rb(t){let e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return {name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function ib(t){let e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},s={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return {name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,o,s]}}function ob(t){let e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=t.inherit(c,{contains:[]}),f=t.inherit(d,{contains:[]});c.contains.push(f),d.contains.push(u);let p=[n,l];return [c,d,u,f].forEach(b=>{b.contains=b.contains.concat(p);}),p=p.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,o,c,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function sb(t){let e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return {name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function ab(t){let e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},s={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[t.BACKSLASH_ESCAPE,o,l],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(m,g,b="\\1")=>{let v=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,b,r)},p=(m,g,b)=>e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,b,r),h=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...u,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...u,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=h,s.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function lb(t){let e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Q,G)=>{G.data._beginMatch=Q[1]||Q[2];},"on:end":(Q,G)=>{G.data._beginMatch!==Q[1]&&G.ignoreMatch();}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
112
|
-
]`,h={scope:"string",variants:[d,c,u,f]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],v=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],T={keyword:b,literal:(Q=>{let G=[];return Q.forEach(x=>{G.push(x),x.toLowerCase()===x?G.push(x.toUpperCase()):G.push(x.toLowerCase());}),G})(g),built_in:v},_=Q=>Q.map(G=>G.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",_(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=e.concat(r,"\\b(?!\\()"),y={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},w={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:T,contains:[w,s,y,t.C_BLOCK_COMMENT_MODE,h,m,I]},X={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(b).join("\\b|"),"|",_(v).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(X);let R=[w,y,t.C_BLOCK_COMMENT_MODE,h,m,I],ce={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:o}]}]};return {case_insensitive:!1,keywords:T,contains:[ce,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},s,X,y,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},I,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:T,contains:["self",ce,s,y,t.C_BLOCK_COMMENT_MODE,h,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},h,m]}}function cb(t){return {name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function db(t){return {name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function ub(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,u]}]}}function fb(t){return {aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function pb(t){let e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return {name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function hb(t){let e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},u={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,d]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},I=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=I,m.contains=I;let k="[>?]>",y="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",w="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",O=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+k+"|"+y+"|"+w+")(?=[ ])",starts:{end:"$",keywords:s,contains:I}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(O).concat(c).concat(I)}}function mb(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return {name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},o]}}var __=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),M_=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],A_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],O_=[...M_,...A_],R_=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),D_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),I_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),L_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function gb(t){let e=__(t),n=I_,r=D_,i="@[a-z-]+",o="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return {name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+O_.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+L_.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:R_.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function bb(t){return {name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yb(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,h=[...c,...l].filter(_=>!d.includes(_)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(_){return e.concat(/\b/,e.either(..._.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}let S={scope:"keyword",match:v(f),relevance:0};function T(_,{exceptions:I,when:k}={}){let y=k;return I=I||[],_.map(w=>w.match(/\|\d+$/)||I.includes(w)?w:y(w)?`${w}|0`:w)}return {name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:T(h,{when:_=>_.length<3}),literal:o,type:a,built_in:u},contains:[{scope:"type",match:v(s)},S,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function xb(t){return t?typeof t=="string"?t:t.source:null}function to(t){return Ne("(?=",t,")")}function Ne(...t){return t.map(n=>xb(n)).join("")}function P_(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function vt(...t){return "("+(P_(t).capture?"":"?:")+t.map(r=>xb(r)).join("|")+")"}var Ed=t=>Ne(/\b/,t,/\w$/.test(t)?/\b/:/\B/),B_=["Protocol","Type"].map(Ed),Eb=["init","self"].map(Ed),z_=["Any","Self"],bd=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],vb=["false","nil","true"],F_=["assignment","associativity","higherThan","left","lowerThan","none","right"],U_=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],wb=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Sb=vt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Cb=vt(Sb,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),yd=Ne(Sb,Cb,"*"),kb=vt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),la=vt(kb,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),sn=Ne(kb,la,"*"),aa=Ne(/[A-Z]/,la,"*"),H_=["attached","autoclosure",Ne(/convention\(/,vt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ne(/objc\(/,sn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],$_=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Nb(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,vt(...B_,...Eb)],className:{2:"keyword"}},o={match:Ne(/\./,vt(...bd)),relevance:0},s=bd.filter(ve=>typeof ve=="string").concat(["_|0"]),a=bd.filter(ve=>typeof ve!="string").concat(z_).map(Ed),l={variants:[{className:"keyword",match:vt(...a,...Eb)}]},c={$pattern:vt(/\b\w+/,/#\w+/),keyword:s.concat(U_),literal:vb},d=[i,o,l],u={match:Ne(/\./,vt(...wb)),relevance:0},f={className:"built_in",match:Ne(/\b/,vt(...wb),/(?=\()/)},p=[u,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:yd},{match:`\\.(\\.|${Cb})+`}]},g=[h,m],b="([0-9]_*)+",v="([0-9a-fA-F]_*)+",S={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(ve="")=>({className:"subst",variants:[{match:Ne(/\\/,ve,/[0\\tnr"']/)},{match:Ne(/\\/,ve,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(ve="")=>({className:"subst",match:Ne(/\\/,ve,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(ve="")=>({className:"subst",label:"interpol",begin:Ne(/\\/,ve,/\(/),end:/\)/}),k=(ve="")=>({begin:Ne(ve,/"""/),end:Ne(/"""/,ve),contains:[T(ve),_(ve),I(ve)]}),y=(ve="")=>({begin:Ne(ve,/"/),end:Ne(/"/,ve),contains:[T(ve),I(ve)]}),w={className:"string",variants:[k(),k("#"),k("##"),k("###"),y(),y("#"),y("##"),y("###")]},O=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],X={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},R=ve=>{let Nt=Ne(ve,/\//),A=Ne(/\//,ve);return {begin:Nt,end:A,contains:[...O,{scope:"comment",begin:`#(?!.*${A})`,end:/$/}]}},ce={scope:"regexp",variants:[R("###"),R("##"),R("#"),X]},Q={match:Ne(/`/,sn,/`/)},G={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${la}+`},C=[Q,G,x],M={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:$_,contains:[...g,S,w]}]}},U={scope:"keyword",match:Ne(/@/,vt(...H_),to(vt(/\(/,/\s+/)))},z={scope:"meta",match:Ne(/@/,sn)},J=[M,U,z],ie={match:to(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ne(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,la,"+")},{className:"type",match:aa,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ne(/\s+&\s+/,to(aa)),relevance:0}]},$={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...J,h,ie]};ie.contains.push($);let ae={match:Ne(sn,/\s*:/),keywords:"_|0",relevance:0},_e={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ae,...r,ce,...d,...p,...g,S,w,...C,...J,ie]},$e={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ie]},it={begin:vt(to(Ne(sn,/\s*:/)),to(Ne(sn,/\s+/,sn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:sn}]},ln={begin:/\(/,end:/\)/,keywords:c,contains:[it,...r,...d,...g,S,w,...J,ie,_e],endsParent:!0,illegal:/["']/},ht={match:[/(func|macro)/,/\s+/,vt(Q.match,sn,yd)],className:{1:"keyword",3:"title.function"},contains:[$e,ln,e],illegal:[/\[/,/%/]},Wt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[$e,ln,e],illegal:/\[|%/},mt={match:[/operator/,/\s+/,yd],className:{1:"keyword",3:"title"}},jn={begin:[/precedencegroup/,/\s+/,aa],className:{1:"keyword",3:"title"},contains:[ie],keywords:[...F_,...vb],end:/}/},Ut={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},cn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ot={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,sn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[$e,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:aa},...d],relevance:0}]};for(let ve of w.variants){let Nt=ve.contains.find(ee=>ee.label==="interpol");Nt.keywords=c;let A=[...d,...p,...g,S,w,...C];Nt.contains=[...A,{begin:/\(/,end:/\)/,contains:["self",...A]}];}return {name:"Swift",keywords:c,contains:[...r,ht,Wt,Ut,cn,ot,mt,jn,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ce,...d,...p,...g,S,w,...C,...J,ie,_e]}}var ca="[A-Za-z$_][0-9A-Za-z$_]*",Tb=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],_b=["true","false","null","undefined","NaN","Infinity"],Mb=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ab=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ob=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Rb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Db=[].concat(Ob,Mb,Ab);function K_(t){let e=t.regex,n=(M,{after:U})=>{let z="</"+M[0].slice(1);return M.input.indexOf(z,U)!==-1},r=ca,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,U)=>{let z=M[0].length+M.index,J=M.input[z];if(J==="<"||J===","){U.ignoreMatch();return}J===">"&&(n(M,{after:z})||U.ignoreMatch());let ie,$=M.input.substring(z);if(ie=$.match(/^\s*=/)){U.ignoreMatch();return}if((ie=$.match(/^\s+extends\s+/))&&ie.index===0){U.ignoreMatch();return}}},a={$pattern:ca,keyword:Tb,literal:_b,built_in:Db,"variable.language":Rb},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});let T=[].concat(v,f.contains),_=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},y={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Mb,...Ab]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(M){return e.concat("(?!",M.join("|"),")")}let ce={match:e.concat(/\b/,R([...Ob,"super","import"].map(M=>`${M}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,v,{match:/\$\d+/},u,y,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ce,X,k,G,{match:/\$[(.]/}]}}function Ib(t){let e=t.regex,n=K_(t),r=ca,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ca,keyword:Tb.concat(l),literal:_b,built_in:Db.concat(i),"variable.language":Rb},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{let v=m.contains.findIndex(S=>S.label===g);if(v===-1)throw new Error("can not find mode to replace");m.contains.splice(v,1,b);};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);let f=n.contains.find(m=>m.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([d,o,s,p]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);let h=n.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Lb(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},u=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return {name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,d,u,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function Pb(t){t.regex;let e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");let n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return {name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,s,i,t.QUOTE_STRING_MODE,l,c,a]}}function Bb(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return {name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function zb(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l="[0-9]{4}(-[0-9][0-9]){0,2}",c="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",d="(\\.[0-9]*)?",u="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",f={className:"number",begin:"\\b"+l+c+d+u+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,m,o,s],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}var vd={arduino:Ig,bash:Lg,c:Pg,cpp:Bg,csharp:zg,css:Fg,diff:Ug,go:Hg,graphql:$g,ini:Kg,java:Gg,javascript:Zg,json:Xg,kotlin:Qg,less:nb,lua:rb,makefile:ib,markdown:ob,objectivec:sb,perl:ab,php:lb,"php-template":cb,plaintext:db,python:ub,"python-repl":fb,r:pb,ruby:hb,rust:mb,scss:gb,shell:bb,sql:yb,swift:Nb,typescript:Ib,vbnet:Lb,wasm:Pb,xml:Bb,yaml:zb};var Fb={},V_="hljs-";function xd(t){let e=na.newInstance();return t&&o(t),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,d){let u=d||Fb,f=typeof u.prefix=="string"?u.prefix:V_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:wd,classPrefix:f});let p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});let h=p._emitter.root,m=h.data;return m.language=p.language,m.relevance=p.relevance,h}function r(l,c){let u=(c||Fb).subset||i(),f=-1,p=0,h;for(;++f<u.length;){let m=u[f];if(!e.getLanguage(m))continue;let g=n(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>p&&(p=g.data.relevance,h=g);}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else {let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d]);}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else {let d;for(d in l)if(Object.hasOwn(l,d)){let u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d});}}}function a(l){return !!e.getLanguage(l)}}var wd=class{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root];}addText(e){if(e==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e});}startScope(e){this.openNode(String(e));}endScope(){this.closeNode();}__addSublanguage(e,n){let r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i);}openNode(e){let n=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o);}closeNode(){this.stack.pop();}finalize(){}toHTML(){return ""}};var an=new re("slashCommands"),Ub=ne.create({name:"slashCommands",addOptions(){return {commands:[],onSelectCommand:()=>{}}},addCommands(){return {selectSlashCommand:t=>({editor:e})=>{let n=an.getState(e.state);if(n&&n.active&&n.filteredCommands[t]){let r=n.filteredCommands[t],{from:i,to:o}=n.range;return e.chain().deleteRange({from:i,to:o}).focus().run(),this.options.onSelectCommand(r),!0}return !1}}},addKeyboardShortcuts(){return {ArrowUp:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex>0?e.selectedIndex-1:e.filteredCommands.length-1;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},ArrowDown:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex<e.filteredCommands.length-1?e.selectedIndex+1:0;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},Enter:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.commands.selectSlashCommand(e.selectedIndex),!0):!1},Escape:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.view.dispatch(t.state.tr.setMeta(an,{active:!1})),!0):!1}}},addProseMirrorPlugins(){return [new Z({key:an,state:{init(){return {active:!1,range:{from:0,to:0},query:"",filteredCommands:[],selectedIndex:0}},apply(t,e,n,r){let i=t.getMeta(an);if(i)return {...e,...i};let{selection:o}=r,{empty:s,$from:a}=o;if(!s)return {...e,active:!1};let c=a.parent.textBetween(Math.max(0,a.parentOffset-50),a.parentOffset,null,"\uFFFC").match(/\/(\w*)$/);if(c){let d=c[1].toLowerCase(),u=this.options.commands.filter(f=>f.command.toLowerCase().includes(d)||f.description.toLowerCase().includes(d));return {active:!0,range:{from:a.pos-c[0].length,to:a.pos},query:d,filteredCommands:u,selectedIndex:0}}return {...e,active:!1}}},props:{decorations(t){let e=this.getState(t);if(!e.active)return me.empty;let{from:n}=e.range,r=Ce.widget(n,()=>{let i=document.createElement("div");if(i.className="slash-commands-menu",e.filteredCommands.forEach((o,s)=>{let a=document.createElement("div");if(a.className=`slash-command-item ${s===e.selectedIndex?"selected":""}`,o.icon){let u=document.createElement("div");u.innerHTML=o.icon,a.appendChild(u);}let l=document.createElement("div"),c=document.createElement("div");c.className="command-name",c.textContent=`/${o.command}`,l.appendChild(c);let d=document.createElement("div");d.className="command-description",d.textContent=o.description,l.appendChild(d),a.appendChild(l),a.addEventListener("click",()=>{t.editor.commands.selectSlashCommand(s);}),i.appendChild(a);}),e.filteredCommands.length===0){let o=document.createElement("div");o.className="text-gray-500 p-3 text-sm",o.textContent="No commands found",i.appendChild(o);}return i});return me.create(t.doc,[r])}}})]}});var q_=xd(vd),OM={generateText:async()=>"AI feature is not available in standalone package",isAvailable:!1},jb=({onColorSelect:t,currentColor:e="#000000"})=>jsx(ColorPicker,{value:e,onChange:t,showInput:!0,showPresets:!0,size:"sm",presets:["#000000","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff","#88ff00","#0088ff","#ff0088","#00ff88","#888888","#f87171","#fb923c","#fbbf24","#facc15","#a3e635","#4ade80","#34d399","#2dd4bf","#22d3ee","#38bdf8","#60a5fa","#818cf8","#a78bfa","#c084fc","#e879f9","#f472b6","#fb7185","#f43f5e","#ef4444","#dc2626"]}),We=({active:t,disabled:e,onClick:n,children:r,tooltip:i})=>{let o=jsx("button",{type:"button",onClick:n,disabled:e,className:cn("p-2 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",t&&"bg-gray-100 dark:bg-gray-800",e&&"opacity-50 cursor-not-allowed"),children:r});return i?jsxs(Tooltip$1,{children:[jsx(TooltipTrigger,{asChild:!0,children:o}),jsx(TooltipContent,{children:jsx("p",{children:i})})]}):o};function jz({placeholder:t="Start writing...",className:e,height:n=300,features:r={bold:!0,italic:!0,underline:!0,strike:!0,heading:!0,lists:!0,blockquote:!0,code:!0,link:!0,image:!0,table:!0,align:!0,color:!0,ai:!0},aiConfig:i={provider:"openai",apiKey:"",model:"gpt-4",temperature:.7,maxTokens:1e3}}){let {hasProAccess:s,isLoading:a}=lt();if(!a&&!s)return jsx(Card,{className:cn("w-full",e),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Rich Text Editor is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[c,d]=useState({provider:i.provider||"openai",apiKey:i.apiKey||"",model:i.model||"gpt-4",temperature:i.temperature||.7,maxTokens:i.maxTokens||1e3}),[u,f]=useState(!1),[p,h]=useState(!1),[m,g]=useState(!1),[b,v]=useState(""),[S,T]=useState("#000000"),[_,I]=useState("#ffffff"),k=[{id:"rewrite",command:"rewrite",description:"Rewrite selected text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"/></svg>',action:async A=>{let ee=await w("rewrite",A);return {text:ee||"",error:ee?void 0:"Failed to rewrite"}}},{id:"expand",command:"expand",description:"Expand text with more details",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m21 21-6-6m6 6v-4.8m0 4.8h-4.8"/><path d="M3 16.2V21m0 0h4.8M3 21l6-6"/><path d="M21 7.8V3m0 0h-4.8M21 3l-6 6"/><path d="M3 7.8V3m0 0h4.8M3 3l6 6"/></svg>',action:async A=>{let ee=await w("expand",A);return {text:ee||"",error:ee?void 0:"Failed to expand"}}},{id:"summarize",command:"summarize",description:"Summarize text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 11H3"/><path d="M9 7H3"/><path d="M9 15H3"/><path d="M16 10V3"/><path d="M16 10l3-3"/><path d="M13 10l3 3"/><path d="M9 19h12"/></svg>',action:async A=>{let ee=await w("summarize",A);return {text:ee||"",error:ee?void 0:"Failed to summarize"}}},{id:"continue",command:"continue",description:"Continue writing from here",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',action:async A=>{let ee=await w("continue",A);return {text:ee||"",error:ee?void 0:"Failed to continue"}}},{id:"improve",command:"improve",description:"Improve writing quality",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>',action:async A=>{let ee=await w("improve",A);return {text:ee||"",error:ee?void 0:"Failed to improve"}}},{id:"fix",command:"fix",description:"Fix grammar and spelling",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>',action:async A=>{let ee=await w("fix",A);return {text:ee||"",error:ee?void 0:"Failed to fix"}}},{id:"translate",command:"translate",description:"Translate to Turkish",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2v3"/><path d="m22 22-5-10-5 10"/><path d="m14 18 6 0"/></svg>',action:async A=>{let ee=await w("translate",A);return {text:ee||"",error:ee?void 0:"Failed to translate"}}},{id:"ideas",command:"ideas",description:"Generate writing ideas",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>',action:async A=>{let ee=await w("ideas",A);return {text:ee||"",error:ee?void 0:"Failed to generate ideas"}}}],y=kh({extensions:[vm.configure({heading:{levels:[1,2,3]},codeBlock:!1}),wm.configure({placeholder:t}),xm.configure({types:["heading","paragraph"]}),Sm.configure({multicolor:!0}),Yh.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),Cm.configure({inline:!0,allowBase64:!0}),ad.configure({resizable:!0}),tg,rg,ng,ld,ig,cm,og,sg,ag.configure({nested:!0}),lg,Dg.configure({lowlight:q_}),Ub.configure({commands:k,onSelectCommand:async A=>{if(!y)return;let{from:ee,to:de}=y.state.selection,Y=y.state.doc.textBetween(ee,de," ");h(!0);try{let st=await A.action(Y||y.getText());st.text?y.chain().focus().insertContent(st.text).run():st.error&&toast({title:"AI Error",description:st.error,variant:"destructive"});}catch{toast({title:"Error",description:"Failed to execute command",variant:"destructive"});}finally{h(!1);}}})],content:"",editorProps:{attributes:{class:cn("prose prose-sm sm:prose lg:prose-lg xl:prose-xl focus:outline-none min-h-[200px] p-4 max-w-none","[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:mb-4","[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:mb-3","[&_h3]:text-xl [&_h3]:font-bold [&_h3]:mb-2","[&_h4]:text-lg [&_h4]:font-bold [&_h4]:mb-2","[&_h5]:text-base [&_h5]:font-bold [&_h5]:mb-1","[&_h6]:text-sm [&_h6]:font-bold [&_h6]:mb-1","[&_ul]:list-disc [&_ul]:pl-6 [&_ul]:mb-4","[&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:mb-4","[&_li]:mb-1","[&_table]:border-collapse-collapse [&_table]:w-full [&_table]:mb-4","[&_table_td]:border [&_table_td]:border-gray-300 [&_table_td]:p-2","[&_table_th]:border [&_table_th]:border-gray-300 [&_table_th]:p-2 [&_table_th]:bg-gray-50 [&_table_th]:font-semibold","[&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:pl-4 [&_blockquote]:italic","[&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-4 [&_pre]:rounded [&_pre]:overflow-x-auto")}},immediatelyRender:!1}),w=async(A,ee)=>{if(!c.apiKey)return toast({title:"API Key Required",description:"Please configure your AI settings first.",variant:"destructive"}),f(!0),null;h(!0);try{let de=OM,Y;switch(A){case"rewrite":Y=await de.rewrite(ee);break;case"expand":Y=await de.expand(ee);break;case"summarize":Y=await de.summarize(ee);break;case"fix":Y=await de.fixGrammar(ee);break;case"translate":Y=await de.translate(ee,"Turkish");break;case"tone_professional":Y=await de.changeTone(ee,"professional");break;case"tone_casual":Y=await de.changeTone(ee,"casual");break;case"tone_friendly":Y=await de.changeTone(ee,"friendly");break;case"tone_formal":Y=await de.changeTone(ee,"formal");break;case"continue":Y=await de.continueWriting(ee);break;case"improve":Y=await de.improveWriting(ee);break;case"ideas":Y=await de.generateIdeas(ee,5);break;default:Y=await de.complete(A,ee);}return Y.error?(toast({title:"AI Error",description:Y.error,variant:"destructive"}),null):Y.text}catch{return toast({title:"AI Error",description:"Failed to process with AI. Please check your settings.",variant:"destructive"}),null}finally{h(!1);}},O=async A=>{if(!y)return;let ee=y.state.selection,de=y.state.doc.textBetween(ee.from,ee.to," ");if(!de&&A!=="complete"){toast({title:"No text selected",description:"Please select some text first.",variant:"destructive"});return}let Y=await w(A,de||y.getText());Y&&(de?y.chain().focus().deleteSelection().insertContent(Y).run():y.chain().focus().insertContent(Y).run());},[X,R]=useState(""),[ce,Q]=useState(""),[G,x]=useState(!1),[C,M]=useState(!1),[U,z]=useState(!1),[J,ie]=useState(3),[$,ae]=useState(3),[_e,$e]=useState(!1),[it,ln]=useState(1),[ht,Wt]=useState("#000000"),[mt,jn]=useState("solid"),Ut=()=>{ce&&y&&(y.chain().focus().setImage({src:ce}).run(),Q(""),M(!1));},cn$1=()=>{X&&y&&(y.state.selection.empty?y.chain().focus().insertContent(`<a href="${X}">${X}</a>`).run():y.chain().focus().extendMarkRange("link").setLink({href:X}).run(),R(""),x(!1));},ot=()=>{y?.chain().focus().unsetLink().run();},ve=()=>{y&&J>0&&$>0&&(y.chain().focus().insertTable({rows:J,cols:$,withHeaderRow:!0}).run(),setTimeout(()=>{Nt(it,ht,mt);},100),z(!1));},Nt=(A,ee,de)=>{if(!y)return;let Y=`${A}px ${de} ${ee}`;y.view.dom.querySelectorAll(".ProseMirror table").forEach(st=>{st instanceof HTMLElement&&(st.style.borderCollapse="collapse",st.style.border=Y,st.querySelectorAll("td, th").forEach(Tt=>{Tt instanceof HTMLElement&&(Tt.style.border=Y,Tt.style.padding="8px");}));});};return y?jsxs("div",{className:cn("border rounded-lg overflow-hidden bg-white dark:bg-gray-950",e),children:[jsx(TooltipProvider,{children:jsx("div",{className:"border-b bg-gray-50 dark:bg-gray-900 p-3",children:jsxs("div",{className:"flex items-center flex-wrap gap-1",children:[(r.bold||r.italic||r.underline||r.strike||r.code)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.bold&&jsx(We,{active:y.isActive("bold"),onClick:()=>y.chain().focus().toggleBold().run(),tooltip:"Bold (Cmd+B)",disabled:m,children:jsx(Bold,{className:"w-4 h-4"})}),r.italic&&jsx(We,{active:y.isActive("italic"),onClick:()=>y.chain().focus().toggleItalic().run(),tooltip:"Italic (Cmd+I)",disabled:m,children:jsx(Italic,{className:"w-4 h-4"})}),r.underline&&jsx(We,{active:y.isActive("underline"),onClick:()=>y.chain().focus().toggleUnderline().run(),tooltip:"Underline (Cmd+U)",disabled:m,children:jsx(Underline,{className:"w-4 h-4"})}),r.strike&&jsx(We,{active:y.isActive("strike"),onClick:()=>y.chain().focus().toggleStrike().run(),tooltip:"Strikethrough",disabled:m,children:jsx(Strikethrough,{className:"w-4 h-4"})}),r.code&&jsx(We,{active:y.isActive("code"),onClick:()=>y.chain().focus().toggleCode().run(),tooltip:"Inline code",disabled:m,children:jsx(Code,{className:"w-4 h-4"})})]}),(r.bold||r.italic||r.underline||r.strike||r.code)&&(r.heading||r.align)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.heading||r.align)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.heading&&jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,children:[jsx(Type,{className:"w-4 h-4 mr-1"}),jsx(ChevronDown,{className:"w-3 h-3"})]})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().setParagraph().run(),children:"Paragraph"}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),children:[jsx(Heading1,{className:"w-4 h-4 mr-2"})," Heading 1"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),children:[jsx(Heading2,{className:"w-4 h-4 mr-2"})," Heading 2"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:3}).run(),children:[jsx(Heading3,{className:"w-4 h-4 mr-2"})," Heading 3"]})]})]}),r.align&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive({textAlign:"left"}),onClick:()=>y.chain().focus().setTextAlign("left").run(),tooltip:"Align left",disabled:m,children:jsx(AlignLeft,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"center"}),onClick:()=>y.chain().focus().setTextAlign("center").run(),tooltip:"Align center",disabled:m,children:jsx(AlignCenter,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"right"}),onClick:()=>y.chain().focus().setTextAlign("right").run(),tooltip:"Align right",disabled:m,children:jsx(AlignRight,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"justify"}),onClick:()=>y.chain().focus().setTextAlign("justify").run(),tooltip:"Justify",disabled:m,children:jsx(AlignJustify,{className:"w-4 h-4"})})]})]}),(r.heading||r.align)&&(r.lists||r.blockquote)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.lists||r.blockquote)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.lists&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive("bulletList"),onClick:()=>y.chain().focus().toggleBulletList().run(),tooltip:"Bullet list",disabled:m,children:jsx(List,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("orderedList"),onClick:()=>y.chain().focus().toggleOrderedList().run(),tooltip:"Numbered list",disabled:m,children:jsx(ListOrdered,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("taskList"),onClick:()=>y.chain().focus().toggleTaskList().run(),tooltip:"Task list",disabled:m,children:jsx(CheckSquare,{className:"w-4 h-4"})})]}),r.blockquote&&jsx(We,{active:y.isActive("blockquote"),onClick:()=>y.chain().focus().toggleBlockquote().run(),tooltip:"Quote",disabled:m,children:jsx(Quote,{className:"w-4 h-4"})})]}),(r.lists||r.blockquote)&&r.color&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),r.color&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Text Color",children:jsx(Palette,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:S,onColorSelect:A=>{T(A),y.chain().focus().setColor(A).run();}})})]}),jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Background Color",children:jsx(Highlighter,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:_,onColorSelect:A=>{I(A),y.chain().focus().toggleHighlight({color:A}).run();}})})]})]}),r.color&&(r.link||r.image||r.table)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.link||r.image||r.table)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.link&&jsxs(Dialog,{open:G,onOpenChange:x,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{active:y.isActive("link"),tooltip:"Add link",disabled:m,children:jsx(Link2,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Link"}),jsx(DialogDescription,{children:"Enter the URL for the link."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"url",children:"URL"}),jsx(Input,{id:"url",value:X,onChange:A=>R(A.target.value),placeholder:"https://example.com",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),cn$1());}})]})}),jsxs("div",{className:"flex justify-between",children:[y.isActive("link")&&jsx(Button,{variant:"destructive",onClick:()=>{ot(),x(!1);},children:"Remove Link"}),jsxs("div",{className:"ml-auto flex gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),jsx(Button,{onClick:cn$1,children:"Add Link"})]})]})]})]}),r.image&&jsxs(Dialog,{open:C,onOpenChange:M,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Add image",disabled:m,children:jsx(Image,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Image"}),jsx(DialogDescription,{children:"Enter the URL for the image."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"image-url",children:"Image URL"}),jsx(Input,{id:"image-url",value:ce,onChange:A=>Q(A.target.value),placeholder:"https://example.com/image.jpg",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),Ut());}})]})}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),jsx(Button,{onClick:Ut,children:"Add Image"})]})]})]}),r.table&&jsxs(Fragment,{children:[jsxs(Dialog,{open:U,onOpenChange:z,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Create table",disabled:m,children:jsx(Table,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Create Table"}),jsx(DialogDescription,{children:"Choose the size for your new table."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"rows",children:"Rows"}),jsx(Input,{id:"rows",type:"number",min:"1",max:"20",value:J,onChange:A=>ie(parseInt(A.target.value)||3)})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"cols",children:"Columns"}),jsx(Input,{id:"cols",type:"number",min:"1",max:"10",value:$,onChange:A=>ae(parseInt(A.target.value)||3)})]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"headerRow",defaultChecked:!0,className:"rounded border-gray-300"}),jsx(Label,{htmlFor:"headerRow",className:"text-sm font-normal",children:"Include header row"})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),jsx(Button,{onClick:ve,children:"Create Table"})]})]})]}),jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-1",children:jsx(ChevronDown,{className:"w-3 h-3"})})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnBefore().run(),children:"Add column before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnAfter().run(),children:"Add column after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteColumn().run(),children:"Delete column"}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowBefore().run(),children:"Add row before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowAfter().run(),children:"Add row after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteRow().run(),children:"Delete row"}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>$e(!0),children:[jsx(Settings,{className:"w-4 h-4 mr-2"}),"Table Borders"]}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteTable().run(),children:"Delete table"})]})]})]})]}),(r.link||r.image||r.table)&&!0&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsx(We,{onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo()||m,tooltip:"Undo (Cmd+Z)",children:jsx(Undo,{className:"w-4 h-4"})}),jsx(We,{onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo()||m,tooltip:"Redo (Cmd+Shift+Z)",children:jsx(Redo,{className:"w-4 h-4"})}),jsx(We,{active:m,onClick:()=>{m?y.commands.setContent(b):v(y.getHTML()),g(!m);},tooltip:m?"Visual Mode":"Source Code",children:m?jsx(Edit,{className:"w-4 h-4"}):jsx(Eye,{className:"w-4 h-4"})}),r.ai&&jsxs(Fragment,{children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-3 bg-purple-100 hover:bg-purple-200 dark:bg-purple-900 dark:hover:bg-purple-800",disabled:p,children:[p?jsx(RefreshCw,{className:"w-4 h-4 mr-1 animate-spin"}):jsx(Wand2,{className:"w-4 h-4 mr-1"}),"AI Tools"]})}),jsxs(DropdownMenuContent,{className:"w-56",children:[jsxs(DropdownMenuItem,{onClick:()=>O("rewrite"),children:[jsx(RefreshCw,{className:"w-4 h-4 mr-2"}),"Rewrite Selection"]}),jsxs(DropdownMenuItem,{onClick:()=>O("improve"),children:[jsx(Wand2,{className:"w-4 h-4 mr-2"}),"Improve Writing"]}),jsxs(DropdownMenuItem,{onClick:()=>O("expand"),children:[jsx(Maximize,{className:"w-4 h-4 mr-2"}),"Expand Text"]}),jsxs(DropdownMenuItem,{onClick:()=>O("summarize"),children:[jsx(FileText,{className:"w-4 h-4 mr-2"}),"Summarize"]}),jsxs(DropdownMenuItem,{onClick:()=>O("continue"),children:[jsx(Plus,{className:"w-4 h-4 mr-2"}),"Continue Writing"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("fix"),children:[jsx(Check,{className:"w-4 h-4 mr-2"}),"Fix Grammar & Spelling"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_professional"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Professional"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_casual"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Casual"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_friendly"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Friendly"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_formal"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Formal"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("translate"),children:[jsx(Languages,{className:"w-4 h-4 mr-2"}),"Translate to Turkish"]}),jsxs(DropdownMenuItem,{onClick:()=>O("ideas"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Generate Ideas"]})]})]}),jsxs(Dialog,{open:u,onOpenChange:f,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"AI Settings - Configure your API keys here",disabled:m,children:jsx(Settings,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"AI Settings"}),jsx(DialogDescription,{children:"Configure your AI provider and API settings."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"provider",children:"Provider"}),jsxs(Select,{value:c.provider,onValueChange:A=>d({...c,provider:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"openai",children:"OpenAI"}),jsx(SelectItem,{value:"claude",children:"Claude (Anthropic)"}),jsx(SelectItem,{value:"gemini",children:"Gemini (Google)"}),jsx(SelectItem,{value:"cohere",children:"Cohere"})]})]})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"apiKey",children:"API Key"}),jsx(Input,{id:"apiKey",type:"password",value:c.apiKey,onChange:A=>d({...c,apiKey:A.target.value}),placeholder:"sk-..."})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"model",children:"Model"}),jsxs(Select,{value:c.model,onValueChange:A=>d({...c,model:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[c.provider==="openai"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gpt-4",children:"GPT-4"}),jsx(SelectItem,{value:"gpt-3.5-turbo",children:"GPT-3.5 Turbo"})]}),c.provider==="claude"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"claude-3-opus",children:"Claude 3 Opus"}),jsx(SelectItem,{value:"claude-3-sonnet",children:"Claude 3 Sonnet"}),jsx(SelectItem,{value:"claude-3-haiku",children:"Claude 3 Haiku"})]}),c.provider==="gemini"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gemini-pro",children:"Gemini Pro"}),jsx(SelectItem,{value:"gemini-pro-vision",children:"Gemini Pro Vision"})]}),c.provider==="cohere"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"command",children:"Command"}),jsx(SelectItem,{value:"command-light",children:"Command Light"})]})]})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"temperature",children:"Temperature"}),jsx(Input,{id:"temperature",type:"number",min:"0",max:"2",step:"0.1",value:c.temperature,onChange:A=>d({...c,temperature:parseFloat(A.target.value)})})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"maxTokens",children:"Max Tokens"}),jsx(Input,{id:"maxTokens",type:"number",min:"1",max:"4000",value:c.maxTokens,onChange:A=>d({...c,maxTokens:parseInt(A.target.value)})})]})]})]}),jsx("div",{className:"flex justify-end",children:jsx(Button,{onClick:()=>{f(!1),toast({title:"Settings saved",description:"Your AI settings have been updated."});},children:"Save Settings"})})]})]})]})]})]})})}),jsx(Dialog,{open:_e,onOpenChange:$e,children:jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Table Border Settings"}),jsx(DialogDescription,{children:"Customize the appearance of table borders."})]}),jsxs("div",{className:"grid gap-6 py-4",children:[jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-width",children:"Border Width"}),jsxs("div",{className:"flex items-center gap-4",children:[jsx(Slider,{id:"border-width",min:0,max:5,step:1,value:[it],onValueChange:A=>ln(A[0]),className:"flex-1"}),jsxs("span",{className:"text-sm font-medium w-8",children:[it,"px"]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-color",children:"Border Color"}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:ht,onChange:Wt,showInput:!0,showPresets:!1,size:"sm"}),jsx("span",{className:"text-sm text-muted-foreground",children:ht})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-style",children:"Border Style"}),jsxs(Select,{value:mt,onValueChange:jn,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"solid",children:"Solid"}),jsx(SelectItem,{value:"dashed",children:"Dashed"}),jsx(SelectItem,{value:"dotted",children:"Dotted"}),jsx(SelectItem,{value:"double",children:"Double"}),jsx(SelectItem,{value:"groove",children:"Groove"}),jsx(SelectItem,{value:"ridge",children:"Ridge"}),jsx(SelectItem,{value:"inset",children:"Inset"}),jsx(SelectItem,{value:"outset",children:"Outset"})]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{children:"Preview"}),jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg",children:jsxs("table",{className:"w-full text-sm",style:{borderCollapse:"collapse",border:`${it}px ${mt} ${ht}`},children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 1"}),jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 2"})]})}),jsx("tbody",{children:jsxs("tr",{children:[jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 1"}),jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 2"})]})})]})})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>$e(!1),children:"Cancel"}),jsx(Button,{onClick:()=>{Nt(it,ht,mt),$e(!1),toast({title:"Borders applied",description:"Table borders have been updated."});},children:"Apply Borders"})]})]})}),jsx("div",{className:"overflow-auto",style:{height:typeof n=="number"?`${n}px`:n},children:m?jsx("textarea",{value:b,onChange:A=>v(A.target.value),className:"w-full h-full p-4 font-mono text-sm resize-none focus:outline-none bg-gray-50 dark:bg-gray-900",placeholder:"HTML source code..."}):jsx(vh,{editor:y})})]}):null}var JM={success:"bg-green-500 border-green-500",warning:"bg-yellow-500 border-yellow-500",error:"bg-red-500 border-red-500",info:"bg-blue-500 border-blue-500",pending:"bg-gray-400 border-gray-400"},YM={success:jsx(CheckCircle2,{className:"h-4 w-4 text-white"}),warning:jsx(AlertCircle,{className:"h-4 w-4 text-white"}),error:jsx(XCircle,{className:"h-4 w-4 text-white"}),info:jsx(Circle,{className:"h-4 w-4 text-white"}),pending:jsx(Clock,{className:"h-4 w-4 text-white"})},ZM={success:"text-green-700",warning:"text-yellow-700",error:"text-red-700",info:"text-blue-700",pending:"text-gray-700"};function sF({events:t,onEventClick:e,className:n,showUserInfo:r=!0,showMetadata:i=!0,showRelativeTime:o=!0,groupByDate:s=!1,orientation:a="vertical",compact:l=!1,interactive:c=!0}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",n),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Timeline is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let h=[...t].sort((k,y)=>y.date.getTime()-k.date.getTime()),m=k=>k.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),g=k=>k.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),b=k=>{let w=Math.floor((new Date().getTime()-k.getTime())/1e3);if(w<60)return "Just now";if(w<3600){let O=Math.floor(w/60);return `${O} minute${O>1?"s":""} ago`}else if(w<86400){let O=Math.floor(w/3600);return `${O} hour${O>1?"s":""} ago`}else if(w<2592e3){let O=Math.floor(w/86400);return `${O} day${O>1?"s":""} ago`}else return m(k)},v=k=>k.split(" ").map(y=>y[0]).join("").toUpperCase(),S=k=>{let y={};return k.forEach(w=>{let O=m(w.date);y[O]||(y[O]=[]),y[O].push(w);}),y},T=k=>{c&&e&&e(k);},_=(k,y,w)=>{let O=k.color||JM[k.type],X=k.icon||YM[k.type],R=ZM[k.type];return jsxs("div",{className:cn("relative flex gap-4",l?"pb-4":"pb-8",c&&"cursor-pointer hover:bg-muted/50 rounded-lg p-2 -m-2 transition-colors"),onClick:()=>T(k),children:[a==="vertical"&&jsxs("div",{className:"flex flex-col items-center",children:[jsx("div",{className:cn("flex items-center justify-center w-8 h-8 rounded-full border-2 bg-background",O),children:X}),!w&&jsx("div",{className:"w-0.5 h-full bg-border mt-2"})]}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:cn("font-medium text-sm",l?"mb-1":"mb-2"),children:k.title}),k.description&&jsx("p",{className:cn("text-muted-foreground text-sm",l?"mb-1":"mb-2"),children:k.description})]}),jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o?jsx("span",{children:b(k.date)}):jsx("span",{children:g(k.date)}),jsx(Badge,{variant:"outline",className:cn("text-xs",R),children:k.type})]})]}),r&&k.user&&jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs(Avatar,{className:"h-6 w-6",children:[jsx(AvatarImage,{src:k.user.avatar}),jsx(AvatarFallback,{className:"text-xs",children:v(k.user.name)})]}),jsx("span",{className:"text-sm text-muted-foreground",children:k.user.name})]}),i&&k.metadata&&jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[k.metadata.duration&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.duration})]}),k.metadata.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.location})]}),k.metadata.comments&&k.metadata.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.comments})]}),k.metadata.attachments&&k.metadata.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.attachments})]}),k.metadata.externalLink&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(ExternalLink,{className:"h-3 w-3"}),jsx("span",{children:"View details"})]})]}),k.metadata?.tags&&k.metadata.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:k.metadata.tags.map((ce,Q)=>jsx(Badge,{variant:"secondary",className:"text-xs",children:ce},Q))})]})]},k.id)},I=()=>{let k=S(h);return Object.entries(k).map(([y,w],O)=>jsxs("div",{className:"mb-8",children:[jsx("div",{className:"sticky top-0 bg-background/80 backdrop-blur-sm border-b p-2 mb-4",children:jsx("h3",{className:"font-medium text-sm text-muted-foreground",children:y})}),w.map((X,R)=>_(X,R,R===w.length-1))]},y))};return jsxs(Card,{className:cn("w-full",n),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Clock,{className:"h-5 w-5"}),"Timeline"]}),jsxs(CardDescription,{children:[h.length," event",h.length!==1?"s":""," tracked"]})]}),jsx(CardContent,{children:h.length>0?jsx("div",{className:cn("space-y-0",a==="horizontal"&&"flex overflow-x-auto gap-6"),children:s?I():h.map((k,y)=>_(k,y,y===h.length-1))}):jsxs("div",{className:"text-center py-8",children:[jsx(Clock,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-muted-foreground",children:"No events to display"})]})})]})}function XM({items:t,height:e,itemHeight:n=50,estimatedItemHeight:r=50,variableHeight:i=!1,overscan:o=5,renderItem:s,onScroll:a,className:l}){let[c,d]=useState(0),[u,f]=useState(!1),[p,h]=useState(new Map),m=useRef(null),g=useRef(null),b=useRef(),v=useRef(),S=useMemo(()=>{let y=[],w=0;for(let O=0;O<t.length;O++){let X=i?p.get(O)||r:n;y.push({index:O,height:X,top:w}),w+=X;}return y},[t.length,n,r,i,p]),T=useMemo(()=>S.length>0?S[S.length-1].top+S[S.length-1].height:0,[S]),_=useMemo(()=>{let y=S.findIndex(R=>R.top+R.height>=c),w=S.findIndex(R=>R.top>c+e),O=Math.max(0,y-o),X=w===-1?Math.min(t.length-1,y+Math.ceil(e/n)+o):Math.min(t.length-1,w+o);return {start:O,end:X}},[c,e,S,o,t.length,n]),I=useMemo(()=>{let y=[];for(let w=_.start;w<=_.end;w++)if(w>=0&&w<t.length&&S[w]){let O=S[w];y.push({item:t[w],index:w,style:{position:"absolute",top:O.top,left:0,right:0,height:i?"auto":O.height,minHeight:i?O.height:void 0}});}return y},[t,_,S,i]),k=useCallback(y=>{let w=y.currentTarget.scrollTop;d(w),f(!0),a&&a(w),b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{f(!1);},150);},[a]);return useEffect(()=>{if(!i||!m.current)return;let y=new ResizeObserver(O=>{let X=new Map(p),R=!1;O.forEach(ce=>{let G=ce.target.getAttribute("data-index");if(G){let x=parseInt(G,10),C=ce.contentRect.height;X.get(x)!==C&&(X.set(x,C),R=!0);}}),R&&h(X);});return m.current.querySelectorAll("[data-index]").forEach(O=>y.observe(O)),()=>y.disconnect()},[i,p,I]),useEffect(()=>{let y=O=>{if(m.current)switch(O.key){case"ArrowUp":O.preventDefault(),g.current?.scrollBy({top:-n,behavior:"smooth"});break;case"ArrowDown":O.preventDefault(),g.current?.scrollBy({top:n,behavior:"smooth"});break;case"PageUp":O.preventDefault(),g.current?.scrollBy({top:-e,behavior:"smooth"});break;case"PageDown":O.preventDefault(),g.current?.scrollBy({top:e,behavior:"smooth"});break;case"Home":O.preventDefault(),g.current?.scrollTo({top:0,behavior:"smooth"});break;case"End":O.preventDefault(),g.current?.scrollTo({top:T,behavior:"smooth"});break}},w=m.current;if(w)return w.addEventListener("keydown",y),()=>w.removeEventListener("keydown",y)},[n,e,T]),jsxs("div",{ref:m,className:cn("relative overflow-hidden border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-ring",l),style:{height:e},tabIndex:0,role:"listbox","aria-label":`Virtual list with ${t.length} items`,children:[jsx("div",{ref:g,className:"h-full overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",onScroll:k,children:jsx("div",{style:{height:T,position:"relative"},children:I.map(({item:y,index:w,style:O})=>jsx("div",{"data-index":w,style:O,role:"option","aria-selected":"false",className:"outline-none",children:s(y,w)},w))})}),u&&jsx("div",{className:"absolute top-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:"Scrolling..."}),t.length>100&&jsxs("div",{className:"absolute bottom-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:[Math.round(c/Math.max(T-e,1)*100),"%"]})]})}function fF(t,e={}){let[n,r]=useState(e),[i,o]=useState(new Set),s=useCallback(d=>{r(u=>({...u,...d}));},[]),a=useCallback(d=>{o(u=>new Set([...u,d]));},[]),l=useCallback(d=>{o(u=>{let f=new Set(u);return f.delete(d),f});},[]),c=useCallback(()=>{o(new Set);},[]);return {config:n,updateConfig:s,selectedItems:i,selectItem:a,deselectItem:l,clearSelection:c}}function pF({selectable:t=!1,multiSelect:e=!1,selectedItems:n=new Set,onSelectionChange:r,renderItem:i,...o}){let s=useCallback(l=>{if(!t||!r)return;let c=new Set(n);e?c.has(l)?c.delete(l):c.add(l):(c.clear(),c.add(l)),r(c);},[t,e,n,r]),a=useCallback((l,c)=>{let d=n.has(c);return jsx("div",{className:cn("transition-colors",t&&"cursor-pointer hover:bg-muted/50",d&&"bg-primary/10 border-l-4 border-primary"),onClick:()=>t&&s(c),children:i(l,c)})},[i,t,n,s]);return jsx(XM,{...o,renderItem:a})}/*! Bundled license information:
|
|
112
|
+
]`,h={scope:"string",variants:[d,c,u,f]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],v=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],T={keyword:b,literal:(Q=>{let G=[];return Q.forEach(x=>{G.push(x),x.toLowerCase()===x?G.push(x.toUpperCase()):G.push(x.toLowerCase());}),G})(g),built_in:v},_=Q=>Q.map(G=>G.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",_(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=e.concat(r,"\\b(?!\\()"),y={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},w={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:T,contains:[w,s,y,t.C_BLOCK_COMMENT_MODE,h,m,I]},X={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(b).join("\\b|"),"|",_(v).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(X);let R=[w,y,t.C_BLOCK_COMMENT_MODE,h,m,I],ce={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:o}]}]};return {case_insensitive:!1,keywords:T,contains:[ce,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},s,X,y,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},I,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:T,contains:["self",ce,s,y,t.C_BLOCK_COMMENT_MODE,h,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},h,m]}}function cb(t){return {name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function db(t){return {name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function ub(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,u]}]}}function fb(t){return {aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function pb(t){let e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return {name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function hb(t){let e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},u={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,d]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},I=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=I,m.contains=I;let k="[>?]>",y="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",w="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",O=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+k+"|"+y+"|"+w+")(?=[ ])",starts:{end:"$",keywords:s,contains:I}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(O).concat(c).concat(I)}}function mb(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return {name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},o]}}var __=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),M_=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],A_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],O_=[...M_,...A_],R_=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),D_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),I_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),L_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function gb(t){let e=__(t),n=I_,r=D_,i="@[a-z-]+",o="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return {name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+O_.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+L_.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:R_.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function bb(t){return {name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yb(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,h=[...c,...l].filter(_=>!d.includes(_)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(_){return e.concat(/\b/,e.either(..._.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}let S={scope:"keyword",match:v(f),relevance:0};function T(_,{exceptions:I,when:k}={}){let y=k;return I=I||[],_.map(w=>w.match(/\|\d+$/)||I.includes(w)?w:y(w)?`${w}|0`:w)}return {name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:T(h,{when:_=>_.length<3}),literal:o,type:a,built_in:u},contains:[{scope:"type",match:v(s)},S,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function xb(t){return t?typeof t=="string"?t:t.source:null}function to(t){return Ne("(?=",t,")")}function Ne(...t){return t.map(n=>xb(n)).join("")}function P_(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function vt(...t){return "("+(P_(t).capture?"":"?:")+t.map(r=>xb(r)).join("|")+")"}var Ed=t=>Ne(/\b/,t,/\w$/.test(t)?/\b/:/\B/),B_=["Protocol","Type"].map(Ed),Eb=["init","self"].map(Ed),z_=["Any","Self"],bd=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],vb=["false","nil","true"],F_=["assignment","associativity","higherThan","left","lowerThan","none","right"],U_=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],wb=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Sb=vt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Cb=vt(Sb,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),yd=Ne(Sb,Cb,"*"),kb=vt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),la=vt(kb,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),sn=Ne(kb,la,"*"),aa=Ne(/[A-Z]/,la,"*"),H_=["attached","autoclosure",Ne(/convention\(/,vt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ne(/objc\(/,sn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],$_=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Nb(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,vt(...B_,...Eb)],className:{2:"keyword"}},o={match:Ne(/\./,vt(...bd)),relevance:0},s=bd.filter(ve=>typeof ve=="string").concat(["_|0"]),a=bd.filter(ve=>typeof ve!="string").concat(z_).map(Ed),l={variants:[{className:"keyword",match:vt(...a,...Eb)}]},c={$pattern:vt(/\b\w+/,/#\w+/),keyword:s.concat(U_),literal:vb},d=[i,o,l],u={match:Ne(/\./,vt(...wb)),relevance:0},f={className:"built_in",match:Ne(/\b/,vt(...wb),/(?=\()/)},p=[u,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:yd},{match:`\\.(\\.|${Cb})+`}]},g=[h,m],b="([0-9]_*)+",v="([0-9a-fA-F]_*)+",S={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(ve="")=>({className:"subst",variants:[{match:Ne(/\\/,ve,/[0\\tnr"']/)},{match:Ne(/\\/,ve,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(ve="")=>({className:"subst",match:Ne(/\\/,ve,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(ve="")=>({className:"subst",label:"interpol",begin:Ne(/\\/,ve,/\(/),end:/\)/}),k=(ve="")=>({begin:Ne(ve,/"""/),end:Ne(/"""/,ve),contains:[T(ve),_(ve),I(ve)]}),y=(ve="")=>({begin:Ne(ve,/"/),end:Ne(/"/,ve),contains:[T(ve),I(ve)]}),w={className:"string",variants:[k(),k("#"),k("##"),k("###"),y(),y("#"),y("##"),y("###")]},O=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],X={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},R=ve=>{let Nt=Ne(ve,/\//),A=Ne(/\//,ve);return {begin:Nt,end:A,contains:[...O,{scope:"comment",begin:`#(?!.*${A})`,end:/$/}]}},ce={scope:"regexp",variants:[R("###"),R("##"),R("#"),X]},Q={match:Ne(/`/,sn,/`/)},G={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${la}+`},C=[Q,G,x],M={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:$_,contains:[...g,S,w]}]}},U={scope:"keyword",match:Ne(/@/,vt(...H_),to(vt(/\(/,/\s+/)))},z={scope:"meta",match:Ne(/@/,sn)},J=[M,U,z],ie={match:to(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ne(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,la,"+")},{className:"type",match:aa,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ne(/\s+&\s+/,to(aa)),relevance:0}]},$={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...J,h,ie]};ie.contains.push($);let ae={match:Ne(sn,/\s*:/),keywords:"_|0",relevance:0},_e={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ae,...r,ce,...d,...p,...g,S,w,...C,...J,ie]},$e={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ie]},it={begin:vt(to(Ne(sn,/\s*:/)),to(Ne(sn,/\s+/,sn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:sn}]},ln={begin:/\(/,end:/\)/,keywords:c,contains:[it,...r,...d,...g,S,w,...J,ie,_e],endsParent:!0,illegal:/["']/},ht={match:[/(func|macro)/,/\s+/,vt(Q.match,sn,yd)],className:{1:"keyword",3:"title.function"},contains:[$e,ln,e],illegal:[/\[/,/%/]},Wt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[$e,ln,e],illegal:/\[|%/},mt={match:[/operator/,/\s+/,yd],className:{1:"keyword",3:"title"}},jn={begin:[/precedencegroup/,/\s+/,aa],className:{1:"keyword",3:"title"},contains:[ie],keywords:[...F_,...vb],end:/}/},Ut={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},cn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ot={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,sn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[$e,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:aa},...d],relevance:0}]};for(let ve of w.variants){let Nt=ve.contains.find(ee=>ee.label==="interpol");Nt.keywords=c;let A=[...d,...p,...g,S,w,...C];Nt.contains=[...A,{begin:/\(/,end:/\)/,contains:["self",...A]}];}return {name:"Swift",keywords:c,contains:[...r,ht,Wt,Ut,cn,ot,mt,jn,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ce,...d,...p,...g,S,w,...C,...J,ie,_e]}}var ca="[A-Za-z$_][0-9A-Za-z$_]*",Tb=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],_b=["true","false","null","undefined","NaN","Infinity"],Mb=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ab=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ob=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Rb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Db=[].concat(Ob,Mb,Ab);function K_(t){let e=t.regex,n=(M,{after:U})=>{let z="</"+M[0].slice(1);return M.input.indexOf(z,U)!==-1},r=ca,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,U)=>{let z=M[0].length+M.index,J=M.input[z];if(J==="<"||J===","){U.ignoreMatch();return}J===">"&&(n(M,{after:z})||U.ignoreMatch());let ie,$=M.input.substring(z);if(ie=$.match(/^\s*=/)){U.ignoreMatch();return}if((ie=$.match(/^\s+extends\s+/))&&ie.index===0){U.ignoreMatch();return}}},a={$pattern:ca,keyword:Tb,literal:_b,built_in:Db,"variable.language":Rb},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});let T=[].concat(v,f.contains),_=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},y={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Mb,...Ab]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(M){return e.concat("(?!",M.join("|"),")")}let ce={match:e.concat(/\b/,R([...Ob,"super","import"].map(M=>`${M}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,v,{match:/\$\d+/},u,y,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ce,X,k,G,{match:/\$[(.]/}]}}function Ib(t){let e=t.regex,n=K_(t),r=ca,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ca,keyword:Tb.concat(l),literal:_b,built_in:Db.concat(i),"variable.language":Rb},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{let v=m.contains.findIndex(S=>S.label===g);if(v===-1)throw new Error("can not find mode to replace");m.contains.splice(v,1,b);};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);let f=n.contains.find(m=>m.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([d,o,s,p]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);let h=n.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Lb(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},u=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return {name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,d,u,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function Pb(t){t.regex;let e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");let n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return {name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,s,i,t.QUOTE_STRING_MODE,l,c,a]}}function Bb(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return {name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function zb(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l="[0-9]{4}(-[0-9][0-9]){0,2}",c="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",d="(\\.[0-9]*)?",u="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",f={className:"number",begin:"\\b"+l+c+d+u+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,m,o,s],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}var vd={arduino:Ig,bash:Lg,c:Pg,cpp:Bg,csharp:zg,css:Fg,diff:Ug,go:Hg,graphql:$g,ini:Kg,java:Gg,javascript:Zg,json:Xg,kotlin:Qg,less:nb,lua:rb,makefile:ib,markdown:ob,objectivec:sb,perl:ab,php:lb,"php-template":cb,plaintext:db,python:ub,"python-repl":fb,r:pb,ruby:hb,rust:mb,scss:gb,shell:bb,sql:yb,swift:Nb,typescript:Ib,vbnet:Lb,wasm:Pb,xml:Bb,yaml:zb};var Fb={},V_="hljs-";function xd(t){let e=na.newInstance();return t&&o(t),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,d){let u=d||Fb,f=typeof u.prefix=="string"?u.prefix:V_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:wd,classPrefix:f});let p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});let h=p._emitter.root,m=h.data;return m.language=p.language,m.relevance=p.relevance,h}function r(l,c){let u=(c||Fb).subset||i(),f=-1,p=0,h;for(;++f<u.length;){let m=u[f];if(!e.getLanguage(m))continue;let g=n(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>p&&(p=g.data.relevance,h=g);}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else {let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d]);}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else {let d;for(d in l)if(Object.hasOwn(l,d)){let u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d});}}}function a(l){return !!e.getLanguage(l)}}var wd=class{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root];}addText(e){if(e==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e});}startScope(e){this.openNode(String(e));}endScope(){this.closeNode();}__addSublanguage(e,n){let r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i);}openNode(e){let n=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o);}closeNode(){this.stack.pop();}finalize(){}toHTML(){return ""}};var an=new re("slashCommands"),Ub=ne.create({name:"slashCommands",addOptions(){return {commands:[],onSelectCommand:()=>{}}},addCommands(){return {selectSlashCommand:t=>({editor:e})=>{let n=an.getState(e.state);if(n&&n.active&&n.filteredCommands[t]){let r=n.filteredCommands[t],{from:i,to:o}=n.range;return e.chain().deleteRange({from:i,to:o}).focus().run(),this.options.onSelectCommand(r),!0}return !1}}},addKeyboardShortcuts(){return {ArrowUp:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex>0?e.selectedIndex-1:e.filteredCommands.length-1;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},ArrowDown:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex<e.filteredCommands.length-1?e.selectedIndex+1:0;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},Enter:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.commands.selectSlashCommand(e.selectedIndex),!0):!1},Escape:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.view.dispatch(t.state.tr.setMeta(an,{active:!1})),!0):!1}}},addProseMirrorPlugins(){return [new Z({key:an,state:{init(){return {active:!1,range:{from:0,to:0},query:"",filteredCommands:[],selectedIndex:0}},apply(t,e,n,r){let i=t.getMeta(an);if(i)return {...e,...i};let{selection:o}=r,{empty:s,$from:a}=o;if(!s)return {...e,active:!1};let c=a.parent.textBetween(Math.max(0,a.parentOffset-50),a.parentOffset,null,"\uFFFC").match(/\/(\w*)$/);if(c){let d=c[1].toLowerCase(),u=this.options.commands.filter(f=>f.command.toLowerCase().includes(d)||f.description.toLowerCase().includes(d));return {active:!0,range:{from:a.pos-c[0].length,to:a.pos},query:d,filteredCommands:u,selectedIndex:0}}return {...e,active:!1}}},props:{decorations(t){let e=this.getState(t);if(!e.active)return me.empty;let{from:n}=e.range,r=Ce.widget(n,()=>{let i=document.createElement("div");if(i.className="slash-commands-menu",e.filteredCommands.forEach((o,s)=>{let a=document.createElement("div");if(a.className=`slash-command-item ${s===e.selectedIndex?"selected":""}`,o.icon){let u=document.createElement("div");u.innerHTML=o.icon,a.appendChild(u);}let l=document.createElement("div"),c=document.createElement("div");c.className="command-name",c.textContent=`/${o.command}`,l.appendChild(c);let d=document.createElement("div");d.className="command-description",d.textContent=o.description,l.appendChild(d),a.appendChild(l),a.addEventListener("click",()=>{t.editor.commands.selectSlashCommand(s);}),i.appendChild(a);}),e.filteredCommands.length===0){let o=document.createElement("div");o.className="text-gray-500 p-3 text-sm",o.textContent="No commands found",i.appendChild(o);}return i});return me.create(t.doc,[r])}}})]}});var q_=xd(vd),OM={generateText:async()=>"AI feature is not available in standalone package",isAvailable:!1},jb=({onColorSelect:t,currentColor:e="#000000"})=>jsx(ColorPicker,{value:e,onChange:t,showInput:!0,showPresets:!0,size:"sm",presets:["#000000","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff","#88ff00","#0088ff","#ff0088","#00ff88","#888888","#f87171","#fb923c","#fbbf24","#facc15","#a3e635","#4ade80","#34d399","#2dd4bf","#22d3ee","#38bdf8","#60a5fa","#818cf8","#a78bfa","#c084fc","#e879f9","#f472b6","#fb7185","#f43f5e","#ef4444","#dc2626"]}),We=({active:t,disabled:e,onClick:n,children:r,tooltip:i})=>{let o=jsx("button",{type:"button",onClick:n,disabled:e,className:cn("p-2 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",t&&"bg-gray-100 dark:bg-gray-800",e&&"opacity-50 cursor-not-allowed"),children:r});return i?jsxs(Tooltip$1,{children:[jsx(TooltipTrigger,{asChild:!0,children:o}),jsx(TooltipContent,{children:jsx("p",{children:i})})]}):o};function Yz({placeholder:t="Start writing...",className:e,height:n=300,features:r={bold:!0,italic:!0,underline:!0,strike:!0,heading:!0,lists:!0,blockquote:!0,code:!0,link:!0,image:!0,table:!0,align:!0,color:!0,ai:!0},aiConfig:i={provider:"openai",apiKey:"",model:"gpt-4",temperature:.7,maxTokens:1e3}}){let {hasProAccess:s,isLoading:a}=lt();if(!a&&!s)return jsx(Card,{className:cn("w-full",e),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Rich Text Editor is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[c,d]=useState({provider:i.provider||"openai",apiKey:i.apiKey||"",model:i.model||"gpt-4",temperature:i.temperature||.7,maxTokens:i.maxTokens||1e3}),[u,f]=useState(!1),[p,h]=useState(!1),[m,g]=useState(!1),[b,v]=useState(""),[S,T]=useState("#000000"),[_,I]=useState("#ffffff"),k=[{id:"rewrite",command:"rewrite",description:"Rewrite selected text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"/></svg>',action:async A=>{let ee=await w("rewrite",A);return {text:ee||"",error:ee?void 0:"Failed to rewrite"}}},{id:"expand",command:"expand",description:"Expand text with more details",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m21 21-6-6m6 6v-4.8m0 4.8h-4.8"/><path d="M3 16.2V21m0 0h4.8M3 21l6-6"/><path d="M21 7.8V3m0 0h-4.8M21 3l-6 6"/><path d="M3 7.8V3m0 0h4.8M3 3l6 6"/></svg>',action:async A=>{let ee=await w("expand",A);return {text:ee||"",error:ee?void 0:"Failed to expand"}}},{id:"summarize",command:"summarize",description:"Summarize text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 11H3"/><path d="M9 7H3"/><path d="M9 15H3"/><path d="M16 10V3"/><path d="M16 10l3-3"/><path d="M13 10l3 3"/><path d="M9 19h12"/></svg>',action:async A=>{let ee=await w("summarize",A);return {text:ee||"",error:ee?void 0:"Failed to summarize"}}},{id:"continue",command:"continue",description:"Continue writing from here",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',action:async A=>{let ee=await w("continue",A);return {text:ee||"",error:ee?void 0:"Failed to continue"}}},{id:"improve",command:"improve",description:"Improve writing quality",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>',action:async A=>{let ee=await w("improve",A);return {text:ee||"",error:ee?void 0:"Failed to improve"}}},{id:"fix",command:"fix",description:"Fix grammar and spelling",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>',action:async A=>{let ee=await w("fix",A);return {text:ee||"",error:ee?void 0:"Failed to fix"}}},{id:"translate",command:"translate",description:"Translate to Turkish",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2v3"/><path d="m22 22-5-10-5 10"/><path d="m14 18 6 0"/></svg>',action:async A=>{let ee=await w("translate",A);return {text:ee||"",error:ee?void 0:"Failed to translate"}}},{id:"ideas",command:"ideas",description:"Generate writing ideas",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>',action:async A=>{let ee=await w("ideas",A);return {text:ee||"",error:ee?void 0:"Failed to generate ideas"}}}],y=kh({extensions:[vm.configure({heading:{levels:[1,2,3]},codeBlock:!1}),wm.configure({placeholder:t}),xm.configure({types:["heading","paragraph"]}),Sm.configure({multicolor:!0}),Yh.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),Cm.configure({inline:!0,allowBase64:!0}),ad.configure({resizable:!0}),tg,rg,ng,ld,ig,cm,og,sg,ag.configure({nested:!0}),lg,Dg.configure({lowlight:q_}),Ub.configure({commands:k,onSelectCommand:async A=>{if(!y)return;let{from:ee,to:de}=y.state.selection,Y=y.state.doc.textBetween(ee,de," ");h(!0);try{let st=await A.action(Y||y.getText());st.text?y.chain().focus().insertContent(st.text).run():st.error&&toast({title:"AI Error",description:st.error,variant:"destructive"});}catch{toast({title:"Error",description:"Failed to execute command",variant:"destructive"});}finally{h(!1);}}})],content:"",editorProps:{attributes:{class:cn("prose prose-sm sm:prose lg:prose-lg xl:prose-xl focus:outline-none min-h-[200px] p-4 max-w-none","[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:mb-4","[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:mb-3","[&_h3]:text-xl [&_h3]:font-bold [&_h3]:mb-2","[&_h4]:text-lg [&_h4]:font-bold [&_h4]:mb-2","[&_h5]:text-base [&_h5]:font-bold [&_h5]:mb-1","[&_h6]:text-sm [&_h6]:font-bold [&_h6]:mb-1","[&_ul]:list-disc [&_ul]:pl-6 [&_ul]:mb-4","[&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:mb-4","[&_li]:mb-1","[&_table]:border-collapse-collapse [&_table]:w-full [&_table]:mb-4","[&_table_td]:border [&_table_td]:border-gray-300 [&_table_td]:p-2","[&_table_th]:border [&_table_th]:border-gray-300 [&_table_th]:p-2 [&_table_th]:bg-gray-50 [&_table_th]:font-semibold","[&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:pl-4 [&_blockquote]:italic","[&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-4 [&_pre]:rounded [&_pre]:overflow-x-auto")}},immediatelyRender:!1}),w=async(A,ee)=>{if(!c.apiKey)return toast({title:"API Key Required",description:"Please configure your AI settings first.",variant:"destructive"}),f(!0),null;h(!0);try{let de=OM,Y;switch(A){case"rewrite":Y=await de.rewrite(ee);break;case"expand":Y=await de.expand(ee);break;case"summarize":Y=await de.summarize(ee);break;case"fix":Y=await de.fixGrammar(ee);break;case"translate":Y=await de.translate(ee,"Turkish");break;case"tone_professional":Y=await de.changeTone(ee,"professional");break;case"tone_casual":Y=await de.changeTone(ee,"casual");break;case"tone_friendly":Y=await de.changeTone(ee,"friendly");break;case"tone_formal":Y=await de.changeTone(ee,"formal");break;case"continue":Y=await de.continueWriting(ee);break;case"improve":Y=await de.improveWriting(ee);break;case"ideas":Y=await de.generateIdeas(ee,5);break;default:Y=await de.complete(A,ee);}return Y.error?(toast({title:"AI Error",description:Y.error,variant:"destructive"}),null):Y.text}catch{return toast({title:"AI Error",description:"Failed to process with AI. Please check your settings.",variant:"destructive"}),null}finally{h(!1);}},O=async A=>{if(!y)return;let ee=y.state.selection,de=y.state.doc.textBetween(ee.from,ee.to," ");if(!de&&A!=="complete"){toast({title:"No text selected",description:"Please select some text first.",variant:"destructive"});return}let Y=await w(A,de||y.getText());Y&&(de?y.chain().focus().deleteSelection().insertContent(Y).run():y.chain().focus().insertContent(Y).run());},[X,R]=useState(""),[ce,Q]=useState(""),[G,x]=useState(!1),[C,M]=useState(!1),[U,z]=useState(!1),[J,ie]=useState(3),[$,ae]=useState(3),[_e,$e]=useState(!1),[it,ln]=useState(1),[ht,Wt]=useState("#000000"),[mt,jn]=useState("solid"),Ut=()=>{ce&&y&&(y.chain().focus().setImage({src:ce}).run(),Q(""),M(!1));},cn$1=()=>{X&&y&&(y.state.selection.empty?y.chain().focus().insertContent(`<a href="${X}">${X}</a>`).run():y.chain().focus().extendMarkRange("link").setLink({href:X}).run(),R(""),x(!1));},ot=()=>{y?.chain().focus().unsetLink().run();},ve=()=>{y&&J>0&&$>0&&(y.chain().focus().insertTable({rows:J,cols:$,withHeaderRow:!0}).run(),setTimeout(()=>{Nt(it,ht,mt);},100),z(!1));},Nt=(A,ee,de)=>{if(!y)return;let Y=`${A}px ${de} ${ee}`;y.view.dom.querySelectorAll(".ProseMirror table").forEach(st=>{st instanceof HTMLElement&&(st.style.borderCollapse="collapse",st.style.border=Y,st.querySelectorAll("td, th").forEach(Tt=>{Tt instanceof HTMLElement&&(Tt.style.border=Y,Tt.style.padding="8px");}));});};return y?jsxs("div",{className:cn("border rounded-lg overflow-hidden bg-white dark:bg-gray-950",e),children:[jsx(TooltipProvider,{children:jsx("div",{className:"border-b bg-gray-50 dark:bg-gray-900 p-3",children:jsxs("div",{className:"flex items-center flex-wrap gap-1",children:[(r.bold||r.italic||r.underline||r.strike||r.code)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.bold&&jsx(We,{active:y.isActive("bold"),onClick:()=>y.chain().focus().toggleBold().run(),tooltip:"Bold (Cmd+B)",disabled:m,children:jsx(Bold,{className:"w-4 h-4"})}),r.italic&&jsx(We,{active:y.isActive("italic"),onClick:()=>y.chain().focus().toggleItalic().run(),tooltip:"Italic (Cmd+I)",disabled:m,children:jsx(Italic,{className:"w-4 h-4"})}),r.underline&&jsx(We,{active:y.isActive("underline"),onClick:()=>y.chain().focus().toggleUnderline().run(),tooltip:"Underline (Cmd+U)",disabled:m,children:jsx(Underline,{className:"w-4 h-4"})}),r.strike&&jsx(We,{active:y.isActive("strike"),onClick:()=>y.chain().focus().toggleStrike().run(),tooltip:"Strikethrough",disabled:m,children:jsx(Strikethrough,{className:"w-4 h-4"})}),r.code&&jsx(We,{active:y.isActive("code"),onClick:()=>y.chain().focus().toggleCode().run(),tooltip:"Inline code",disabled:m,children:jsx(Code,{className:"w-4 h-4"})})]}),(r.bold||r.italic||r.underline||r.strike||r.code)&&(r.heading||r.align)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.heading||r.align)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.heading&&jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,children:[jsx(Type,{className:"w-4 h-4 mr-1"}),jsx(ChevronDown,{className:"w-3 h-3"})]})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().setParagraph().run(),children:"Paragraph"}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),children:[jsx(Heading1,{className:"w-4 h-4 mr-2"})," Heading 1"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),children:[jsx(Heading2,{className:"w-4 h-4 mr-2"})," Heading 2"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:3}).run(),children:[jsx(Heading3,{className:"w-4 h-4 mr-2"})," Heading 3"]})]})]}),r.align&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive({textAlign:"left"}),onClick:()=>y.chain().focus().setTextAlign("left").run(),tooltip:"Align left",disabled:m,children:jsx(AlignLeft,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"center"}),onClick:()=>y.chain().focus().setTextAlign("center").run(),tooltip:"Align center",disabled:m,children:jsx(AlignCenter,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"right"}),onClick:()=>y.chain().focus().setTextAlign("right").run(),tooltip:"Align right",disabled:m,children:jsx(AlignRight,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"justify"}),onClick:()=>y.chain().focus().setTextAlign("justify").run(),tooltip:"Justify",disabled:m,children:jsx(AlignJustify,{className:"w-4 h-4"})})]})]}),(r.heading||r.align)&&(r.lists||r.blockquote)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.lists||r.blockquote)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.lists&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive("bulletList"),onClick:()=>y.chain().focus().toggleBulletList().run(),tooltip:"Bullet list",disabled:m,children:jsx(List,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("orderedList"),onClick:()=>y.chain().focus().toggleOrderedList().run(),tooltip:"Numbered list",disabled:m,children:jsx(ListOrdered,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("taskList"),onClick:()=>y.chain().focus().toggleTaskList().run(),tooltip:"Task list",disabled:m,children:jsx(CheckSquare,{className:"w-4 h-4"})})]}),r.blockquote&&jsx(We,{active:y.isActive("blockquote"),onClick:()=>y.chain().focus().toggleBlockquote().run(),tooltip:"Quote",disabled:m,children:jsx(Quote,{className:"w-4 h-4"})})]}),(r.lists||r.blockquote)&&r.color&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),r.color&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Text Color",children:jsx(Palette,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:S,onColorSelect:A=>{T(A),y.chain().focus().setColor(A).run();}})})]}),jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Background Color",children:jsx(Highlighter,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:_,onColorSelect:A=>{I(A),y.chain().focus().toggleHighlight({color:A}).run();}})})]})]}),r.color&&(r.link||r.image||r.table)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.link||r.image||r.table)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.link&&jsxs(Dialog,{open:G,onOpenChange:x,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{active:y.isActive("link"),tooltip:"Add link",disabled:m,children:jsx(Link2,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Link"}),jsx(DialogDescription,{children:"Enter the URL for the link."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"url",children:"URL"}),jsx(Input,{id:"url",value:X,onChange:A=>R(A.target.value),placeholder:"https://example.com",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),cn$1());}})]})}),jsxs("div",{className:"flex justify-between",children:[y.isActive("link")&&jsx(Button,{variant:"destructive",onClick:()=>{ot(),x(!1);},children:"Remove Link"}),jsxs("div",{className:"ml-auto flex gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),jsx(Button,{onClick:cn$1,children:"Add Link"})]})]})]})]}),r.image&&jsxs(Dialog,{open:C,onOpenChange:M,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Add image",disabled:m,children:jsx(Image,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Image"}),jsx(DialogDescription,{children:"Enter the URL for the image."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"image-url",children:"Image URL"}),jsx(Input,{id:"image-url",value:ce,onChange:A=>Q(A.target.value),placeholder:"https://example.com/image.jpg",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),Ut());}})]})}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),jsx(Button,{onClick:Ut,children:"Add Image"})]})]})]}),r.table&&jsxs(Fragment,{children:[jsxs(Dialog,{open:U,onOpenChange:z,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Create table",disabled:m,children:jsx(Table,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Create Table"}),jsx(DialogDescription,{children:"Choose the size for your new table."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"rows",children:"Rows"}),jsx(Input,{id:"rows",type:"number",min:"1",max:"20",value:J,onChange:A=>ie(parseInt(A.target.value)||3)})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"cols",children:"Columns"}),jsx(Input,{id:"cols",type:"number",min:"1",max:"10",value:$,onChange:A=>ae(parseInt(A.target.value)||3)})]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"headerRow",defaultChecked:!0,className:"rounded border-gray-300"}),jsx(Label,{htmlFor:"headerRow",className:"text-sm font-normal",children:"Include header row"})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),jsx(Button,{onClick:ve,children:"Create Table"})]})]})]}),jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-1",children:jsx(ChevronDown,{className:"w-3 h-3"})})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnBefore().run(),children:"Add column before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnAfter().run(),children:"Add column after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteColumn().run(),children:"Delete column"}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowBefore().run(),children:"Add row before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowAfter().run(),children:"Add row after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteRow().run(),children:"Delete row"}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>$e(!0),children:[jsx(Settings,{className:"w-4 h-4 mr-2"}),"Table Borders"]}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteTable().run(),children:"Delete table"})]})]})]})]}),(r.link||r.image||r.table)&&!0&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsx(We,{onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo()||m,tooltip:"Undo (Cmd+Z)",children:jsx(Undo,{className:"w-4 h-4"})}),jsx(We,{onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo()||m,tooltip:"Redo (Cmd+Shift+Z)",children:jsx(Redo,{className:"w-4 h-4"})}),jsx(We,{active:m,onClick:()=>{m?y.commands.setContent(b):v(y.getHTML()),g(!m);},tooltip:m?"Visual Mode":"Source Code",children:m?jsx(Edit,{className:"w-4 h-4"}):jsx(Eye,{className:"w-4 h-4"})}),r.ai&&jsxs(Fragment,{children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-3 bg-purple-100 hover:bg-purple-200 dark:bg-purple-900 dark:hover:bg-purple-800",disabled:p,children:[p?jsx(RefreshCw,{className:"w-4 h-4 mr-1 animate-spin"}):jsx(Wand2,{className:"w-4 h-4 mr-1"}),"AI Tools"]})}),jsxs(DropdownMenuContent,{className:"w-56",children:[jsxs(DropdownMenuItem,{onClick:()=>O("rewrite"),children:[jsx(RefreshCw,{className:"w-4 h-4 mr-2"}),"Rewrite Selection"]}),jsxs(DropdownMenuItem,{onClick:()=>O("improve"),children:[jsx(Wand2,{className:"w-4 h-4 mr-2"}),"Improve Writing"]}),jsxs(DropdownMenuItem,{onClick:()=>O("expand"),children:[jsx(Maximize,{className:"w-4 h-4 mr-2"}),"Expand Text"]}),jsxs(DropdownMenuItem,{onClick:()=>O("summarize"),children:[jsx(FileText,{className:"w-4 h-4 mr-2"}),"Summarize"]}),jsxs(DropdownMenuItem,{onClick:()=>O("continue"),children:[jsx(Plus,{className:"w-4 h-4 mr-2"}),"Continue Writing"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("fix"),children:[jsx(Check,{className:"w-4 h-4 mr-2"}),"Fix Grammar & Spelling"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_professional"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Professional"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_casual"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Casual"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_friendly"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Friendly"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_formal"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Formal"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("translate"),children:[jsx(Languages,{className:"w-4 h-4 mr-2"}),"Translate to Turkish"]}),jsxs(DropdownMenuItem,{onClick:()=>O("ideas"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Generate Ideas"]})]})]}),jsxs(Dialog,{open:u,onOpenChange:f,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"AI Settings - Configure your API keys here",disabled:m,children:jsx(Settings,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"AI Settings"}),jsx(DialogDescription,{children:"Configure your AI provider and API settings."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"provider",children:"Provider"}),jsxs(Select,{value:c.provider,onValueChange:A=>d({...c,provider:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"openai",children:"OpenAI"}),jsx(SelectItem,{value:"claude",children:"Claude (Anthropic)"}),jsx(SelectItem,{value:"gemini",children:"Gemini (Google)"}),jsx(SelectItem,{value:"cohere",children:"Cohere"})]})]})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"apiKey",children:"API Key"}),jsx(Input,{id:"apiKey",type:"password",value:c.apiKey,onChange:A=>d({...c,apiKey:A.target.value}),placeholder:"sk-..."})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"model",children:"Model"}),jsxs(Select,{value:c.model,onValueChange:A=>d({...c,model:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[c.provider==="openai"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gpt-4",children:"GPT-4"}),jsx(SelectItem,{value:"gpt-3.5-turbo",children:"GPT-3.5 Turbo"})]}),c.provider==="claude"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"claude-3-opus",children:"Claude 3 Opus"}),jsx(SelectItem,{value:"claude-3-sonnet",children:"Claude 3 Sonnet"}),jsx(SelectItem,{value:"claude-3-haiku",children:"Claude 3 Haiku"})]}),c.provider==="gemini"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gemini-pro",children:"Gemini Pro"}),jsx(SelectItem,{value:"gemini-pro-vision",children:"Gemini Pro Vision"})]}),c.provider==="cohere"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"command",children:"Command"}),jsx(SelectItem,{value:"command-light",children:"Command Light"})]})]})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"temperature",children:"Temperature"}),jsx(Input,{id:"temperature",type:"number",min:"0",max:"2",step:"0.1",value:c.temperature,onChange:A=>d({...c,temperature:parseFloat(A.target.value)})})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"maxTokens",children:"Max Tokens"}),jsx(Input,{id:"maxTokens",type:"number",min:"1",max:"4000",value:c.maxTokens,onChange:A=>d({...c,maxTokens:parseInt(A.target.value)})})]})]})]}),jsx("div",{className:"flex justify-end",children:jsx(Button,{onClick:()=>{f(!1),toast({title:"Settings saved",description:"Your AI settings have been updated."});},children:"Save Settings"})})]})]})]})]})]})})}),jsx(Dialog,{open:_e,onOpenChange:$e,children:jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Table Border Settings"}),jsx(DialogDescription,{children:"Customize the appearance of table borders."})]}),jsxs("div",{className:"grid gap-6 py-4",children:[jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-width",children:"Border Width"}),jsxs("div",{className:"flex items-center gap-4",children:[jsx(Slider,{id:"border-width",min:0,max:5,step:1,value:[it],onValueChange:A=>ln(A[0]),className:"flex-1"}),jsxs("span",{className:"text-sm font-medium w-8",children:[it,"px"]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-color",children:"Border Color"}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:ht,onChange:Wt,showInput:!0,showPresets:!1,size:"sm"}),jsx("span",{className:"text-sm text-muted-foreground",children:ht})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-style",children:"Border Style"}),jsxs(Select,{value:mt,onValueChange:jn,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"solid",children:"Solid"}),jsx(SelectItem,{value:"dashed",children:"Dashed"}),jsx(SelectItem,{value:"dotted",children:"Dotted"}),jsx(SelectItem,{value:"double",children:"Double"}),jsx(SelectItem,{value:"groove",children:"Groove"}),jsx(SelectItem,{value:"ridge",children:"Ridge"}),jsx(SelectItem,{value:"inset",children:"Inset"}),jsx(SelectItem,{value:"outset",children:"Outset"})]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{children:"Preview"}),jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg",children:jsxs("table",{className:"w-full text-sm",style:{borderCollapse:"collapse",border:`${it}px ${mt} ${ht}`},children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 1"}),jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 2"})]})}),jsx("tbody",{children:jsxs("tr",{children:[jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 1"}),jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 2"})]})})]})})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>$e(!1),children:"Cancel"}),jsx(Button,{onClick:()=>{Nt(it,ht,mt),$e(!1),toast({title:"Borders applied",description:"Table borders have been updated."});},children:"Apply Borders"})]})]})}),jsx("div",{className:"overflow-auto",style:{height:typeof n=="number"?`${n}px`:n},children:m?jsx("textarea",{value:b,onChange:A=>v(A.target.value),className:"w-full h-full p-4 font-mono text-sm resize-none focus:outline-none bg-gray-50 dark:bg-gray-900",placeholder:"HTML source code..."}):jsx(vh,{editor:y})})]}):null}var JM={success:"bg-green-500 border-green-500",warning:"bg-yellow-500 border-yellow-500",error:"bg-red-500 border-red-500",info:"bg-blue-500 border-blue-500",pending:"bg-gray-400 border-gray-400"},YM={success:jsx(CheckCircle2,{className:"h-4 w-4 text-white"}),warning:jsx(AlertCircle,{className:"h-4 w-4 text-white"}),error:jsx(XCircle,{className:"h-4 w-4 text-white"}),info:jsx(Circle,{className:"h-4 w-4 text-white"}),pending:jsx(Clock,{className:"h-4 w-4 text-white"})},ZM={success:"text-green-700",warning:"text-yellow-700",error:"text-red-700",info:"text-blue-700",pending:"text-gray-700"};function lF({events:t,onEventClick:e,className:n,showUserInfo:r=!0,showMetadata:i=!0,showRelativeTime:o=!0,groupByDate:s=!1,orientation:a="vertical",compact:l=!1,interactive:c=!0}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",n),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Timeline is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let h=[...t].sort((k,y)=>y.date.getTime()-k.date.getTime()),m=k=>k.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),g=k=>k.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),b=k=>{let w=Math.floor((new Date().getTime()-k.getTime())/1e3);if(w<60)return "Just now";if(w<3600){let O=Math.floor(w/60);return `${O} minute${O>1?"s":""} ago`}else if(w<86400){let O=Math.floor(w/3600);return `${O} hour${O>1?"s":""} ago`}else if(w<2592e3){let O=Math.floor(w/86400);return `${O} day${O>1?"s":""} ago`}else return m(k)},v=k=>k.split(" ").map(y=>y[0]).join("").toUpperCase(),S=k=>{let y={};return k.forEach(w=>{let O=m(w.date);y[O]||(y[O]=[]),y[O].push(w);}),y},T=k=>{c&&e&&e(k);},_=(k,y,w)=>{let O=k.color||JM[k.type],X=k.icon||YM[k.type],R=ZM[k.type];return jsxs("div",{className:cn("relative flex gap-4",l?"pb-4":"pb-8",c&&"cursor-pointer hover:bg-muted/50 rounded-lg p-2 -m-2 transition-colors"),onClick:()=>T(k),children:[a==="vertical"&&jsxs("div",{className:"flex flex-col items-center",children:[jsx("div",{className:cn("flex items-center justify-center w-8 h-8 rounded-full border-2 bg-background",O),children:X}),!w&&jsx("div",{className:"w-0.5 h-full bg-border mt-2"})]}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:cn("font-medium text-sm",l?"mb-1":"mb-2"),children:k.title}),k.description&&jsx("p",{className:cn("text-muted-foreground text-sm",l?"mb-1":"mb-2"),children:k.description})]}),jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o?jsx("span",{children:b(k.date)}):jsx("span",{children:g(k.date)}),jsx(Badge,{variant:"outline",className:cn("text-xs",R),children:k.type})]})]}),r&&k.user&&jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs(Avatar,{className:"h-6 w-6",children:[jsx(AvatarImage,{src:k.user.avatar}),jsx(AvatarFallback,{className:"text-xs",children:v(k.user.name)})]}),jsx("span",{className:"text-sm text-muted-foreground",children:k.user.name})]}),i&&k.metadata&&jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[k.metadata.duration&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.duration})]}),k.metadata.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.location})]}),k.metadata.comments&&k.metadata.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.comments})]}),k.metadata.attachments&&k.metadata.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.attachments})]}),k.metadata.externalLink&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(ExternalLink,{className:"h-3 w-3"}),jsx("span",{children:"View details"})]})]}),k.metadata?.tags&&k.metadata.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:k.metadata.tags.map((ce,Q)=>jsx(Badge,{variant:"secondary",className:"text-xs",children:ce},Q))})]})]},k.id)},I=()=>{let k=S(h);return Object.entries(k).map(([y,w],O)=>jsxs("div",{className:"mb-8",children:[jsx("div",{className:"sticky top-0 bg-background/80 backdrop-blur-sm border-b p-2 mb-4",children:jsx("h3",{className:"font-medium text-sm text-muted-foreground",children:y})}),w.map((X,R)=>_(X,R,R===w.length-1))]},y))};return jsxs(Card,{className:cn("w-full",n),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Clock,{className:"h-5 w-5"}),"Timeline"]}),jsxs(CardDescription,{children:[h.length," event",h.length!==1?"s":""," tracked"]})]}),jsx(CardContent,{children:h.length>0?jsx("div",{className:cn("space-y-0",a==="horizontal"&&"flex overflow-x-auto gap-6"),children:s?I():h.map((k,y)=>_(k,y,y===h.length-1))}):jsxs("div",{className:"text-center py-8",children:[jsx(Clock,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-muted-foreground",children:"No events to display"})]})})]})}function XM({items:t,height:e,itemHeight:n=50,estimatedItemHeight:r=50,variableHeight:i=!1,overscan:o=5,renderItem:s,onScroll:a,className:l}){let[c,d]=useState(0),[u,f]=useState(!1),[p,h]=useState(new Map),m=useRef(null),g=useRef(null),b=useRef(),v=useRef(),S=useMemo(()=>{let y=[],w=0;for(let O=0;O<t.length;O++){let X=i?p.get(O)||r:n;y.push({index:O,height:X,top:w}),w+=X;}return y},[t.length,n,r,i,p]),T=useMemo(()=>S.length>0?S[S.length-1].top+S[S.length-1].height:0,[S]),_=useMemo(()=>{let y=S.findIndex(R=>R.top+R.height>=c),w=S.findIndex(R=>R.top>c+e),O=Math.max(0,y-o),X=w===-1?Math.min(t.length-1,y+Math.ceil(e/n)+o):Math.min(t.length-1,w+o);return {start:O,end:X}},[c,e,S,o,t.length,n]),I=useMemo(()=>{let y=[];for(let w=_.start;w<=_.end;w++)if(w>=0&&w<t.length&&S[w]){let O=S[w];y.push({item:t[w],index:w,style:{position:"absolute",top:O.top,left:0,right:0,height:i?"auto":O.height,minHeight:i?O.height:void 0}});}return y},[t,_,S,i]),k=useCallback(y=>{let w=y.currentTarget.scrollTop;d(w),f(!0),a&&a(w),b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{f(!1);},150);},[a]);return useEffect(()=>{if(!i||!m.current)return;let y=new ResizeObserver(O=>{let X=new Map(p),R=!1;O.forEach(ce=>{let G=ce.target.getAttribute("data-index");if(G){let x=parseInt(G,10),C=ce.contentRect.height;X.get(x)!==C&&(X.set(x,C),R=!0);}}),R&&h(X);});return m.current.querySelectorAll("[data-index]").forEach(O=>y.observe(O)),()=>y.disconnect()},[i,p,I]),useEffect(()=>{let y=O=>{if(m.current)switch(O.key){case"ArrowUp":O.preventDefault(),g.current?.scrollBy({top:-n,behavior:"smooth"});break;case"ArrowDown":O.preventDefault(),g.current?.scrollBy({top:n,behavior:"smooth"});break;case"PageUp":O.preventDefault(),g.current?.scrollBy({top:-e,behavior:"smooth"});break;case"PageDown":O.preventDefault(),g.current?.scrollBy({top:e,behavior:"smooth"});break;case"Home":O.preventDefault(),g.current?.scrollTo({top:0,behavior:"smooth"});break;case"End":O.preventDefault(),g.current?.scrollTo({top:T,behavior:"smooth"});break}},w=m.current;if(w)return w.addEventListener("keydown",y),()=>w.removeEventListener("keydown",y)},[n,e,T]),jsxs("div",{ref:m,className:cn("relative overflow-hidden border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-ring",l),style:{height:e},tabIndex:0,role:"listbox","aria-label":`Virtual list with ${t.length} items`,children:[jsx("div",{ref:g,className:"h-full overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",onScroll:k,children:jsx("div",{style:{height:T,position:"relative"},children:I.map(({item:y,index:w,style:O})=>jsx("div",{"data-index":w,style:O,role:"option","aria-selected":"false",className:"outline-none",children:s(y,w)},w))})}),u&&jsx("div",{className:"absolute top-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:"Scrolling..."}),t.length>100&&jsxs("div",{className:"absolute bottom-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:[Math.round(c/Math.max(T-e,1)*100),"%"]})]})}function hF(t,e={}){let[n,r]=useState(e),[i,o]=useState(new Set),s=useCallback(d=>{r(u=>({...u,...d}));},[]),a=useCallback(d=>{o(u=>new Set([...u,d]));},[]),l=useCallback(d=>{o(u=>{let f=new Set(u);return f.delete(d),f});},[]),c=useCallback(()=>{o(new Set);},[]);return {config:n,updateConfig:s,selectedItems:i,selectItem:a,deselectItem:l,clearSelection:c}}function mF({selectable:t=!1,multiSelect:e=!1,selectedItems:n=new Set,onSelectionChange:r,renderItem:i,...o}){let s=useCallback(l=>{if(!t||!r)return;let c=new Set(n);e?c.has(l)?c.delete(l):c.add(l):(c.clear(),c.add(l)),r(c);},[t,e,n,r]),a=useCallback((l,c)=>{let d=n.has(c);return jsx("div",{className:cn("transition-colors",t&&"cursor-pointer hover:bg-muted/50",d&&"bg-primary/10 border-l-4 border-primary"),onClick:()=>t&&s(c),children:i(l,c)})},[i,t,n,s]);return jsx(XM,{...o,renderItem:a})}/*! Bundled license information:
|
|
113
113
|
|
|
114
114
|
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
|
115
115
|
(**
|
|
@@ -156,4 +156,4 @@ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.developme
|
|
|
156
156
|
*)
|
|
157
157
|
*/
|
|
158
158
|
|
|
159
|
-
export {
|
|
159
|
+
export { pA as AdvancedChart, FA as Calendar, XA as Dashboard, h1 as DataTable, N1 as FileUpload, F1 as Kanban, W1 as MemoryAnalytics, V1 as MemoryEfficientData, Yz as RichTextEditor, mF as SelectableVirtualList, lF as Timeline, XM as VirtualList, G1 as useStreamingData, hF as useVirtualList };
|