act-plus 1.1.86 → 1.1.87
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/act-plus.js +1 -1
- package/act-plus.umd.cjs +9 -9
- package/lib/{dialogAddField-b0c97d68.js → dialogAddField-16c2a9fa.js} +2 -2
- package/lib/{dialogConfigBtn-3e4bd3f3.js → dialogConfigBtn-3b5532ee.js} +2 -2
- package/lib/{dialogSiteComponentsParams-d1974596.js → dialogSiteComponentsParams-8747287e.js} +1 -1
- package/lib/{index-4fad50f3.js → index-46b1de3c.js} +1 -1
- package/lib/{index-c6b82d52.js → index-54128923.js} +6 -6
- package/lib/{index-33b1c47f.js → index-5e6ba58b.js} +1 -1
- package/lib/{index-0e5c905b.js → index-8cd7f040.js} +1 -1
- package/lib/{index-1eed15fa.js → index-c28acc5c.js} +1 -1
- package/lib/{index-cfdbcb8f.js → index-e391f7db.js} +1 -1
- package/lib/{index-2c0f4f19.js → index-e8b347a8.js} +74 -71
- package/lib/{index-7f689f20.js → index-f88ed3ab.js} +1 -1
- package/lib/{index-2b9307b5.js → index-fc05088e.js} +2 -2
- package/package.json +1 -1
- package/style.css +1 -1
package/act-plus.umd.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* (c) 2025 kazuya kawaguchi
|
|
9
9
|
* Released under the MIT License.
|
|
10
10
|
*/function A_(i,e,t){return{line:i,column:e,offset:t}}function ll(i,e,t){const n={start:i,end:e};return t!=null&&(n.source=t),n}const we={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},T_=17,P_={[we.EXPECTED_TOKEN]:"Expected token: '{0}'",[we.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[we.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[we.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[we.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[we.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[we.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[we.EMPTY_PLACEHOLDER]:"Empty placeholder",[we.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[we.INVALID_LINKED_FORMAT]:"Invalid linked format",[we.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[we.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[we.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[we.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[we.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[we.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Qn(i,e,t={}){const{domain:n,messages:s,args:r}=t,o=process.env.NODE_ENV!=="production"?dr((s||P_)[i]||"",...r||[]):i,a=new SyntaxError(String(o));return a.code=i,e&&(a.location=e),a.domain=n,a}function Q_(i){throw i}const E_=/<\/?[\w\s="/.':;#-\/]+>/,$_=i=>E_.test(i),Pi=" ",N_="\r",bt=`
|
|
11
|
-
`,R_=String.fromCharCode(8232),V_=String.fromCharCode(8233);function L_(i){const e=i;let t=0,n=1,s=1,r=0;const o=x=>e[x]===N_&&e[x+1]===bt,a=x=>e[x]===bt,c=x=>e[x]===V_,u=x=>e[x]===R_,h=x=>o(x)||a(x)||c(x)||u(x),f=()=>t,d=()=>n,m=()=>s,O=()=>r,w=x=>o(x)||c(x)||u(x)?bt:e[x],g=()=>w(t),p=()=>w(t+r);function b(){return r=0,h(t)&&(n++,s=0),o(t)&&t++,t++,s++,e[t]}function k(){return o(t+r)&&r++,r++,e[t+r]}function y(){t=0,n=1,s=1,r=0}function C(x=0){r=x}function T(){const x=t+r;for(;x!==t;)b();r=0}return{index:f,line:d,column:m,peekOffset:O,charAt:w,currentChar:g,currentPeek:p,next:b,peek:k,reset:y,resetPeek:C,skipToPeek:T}}const Ii=void 0,M_=".",Au="'",D_="tokenizer";function B_(i,e={}){const t=e.location!==!1,n=L_(i),s=()=>n.index(),r=()=>A_(n.line(),n.column(),n.index()),o=r(),a=s(),c={currentType:13,offset:a,startLoc:o,endLoc:o,lastType:13,lastOffset:a,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},u=()=>c,{onError:h}=e;function f(V,D,L,...ne){const fe=u();if(D.column+=L,D.offset+=L,h){const Le=t?ll(fe.startLoc,D):null,Ae=Qn(V,Le,{domain:D_,args:ne});h(Ae)}}function d(V,D,L){V.endLoc=r(),V.currentType=D;const ne={type:D};return t&&(ne.loc=ll(V.startLoc,V.endLoc)),L!=null&&(ne.value=L),ne}const m=V=>d(V,13);function O(V,D){return V.currentChar()===D?(V.next(),D):(f(we.EXPECTED_TOKEN,r(),0,D),"")}function w(V){let D="";for(;V.currentPeek()===Pi||V.currentPeek()===bt;)D+=V.currentPeek(),V.peek();return D}function g(V){const D=w(V);return V.skipToPeek(),D}function p(V){if(V===Ii)return!1;const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D===95}function b(V){if(V===Ii)return!1;const D=V.charCodeAt(0);return D>=48&&D<=57}function k(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=p(V.currentPeek());return V.resetPeek(),ne}function y(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=V.currentPeek()==="-"?V.peek():V.currentPeek(),fe=b(ne);return V.resetPeek(),fe}function C(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=V.currentPeek()===Au;return V.resetPeek(),ne}function T(V,D){const{currentType:L}=D;if(L!==7)return!1;w(V);const ne=V.currentPeek()===".";return V.resetPeek(),ne}function x(V,D){const{currentType:L}=D;if(L!==8)return!1;w(V);const ne=p(V.currentPeek());return V.resetPeek(),ne}function A(V,D){const{currentType:L}=D;if(!(L===7||L===11))return!1;w(V);const ne=V.currentPeek()===":";return V.resetPeek(),ne}function R(V,D){const{currentType:L}=D;if(L!==9)return!1;const ne=()=>{const Le=V.currentPeek();return Le==="{"?p(V.peek()):Le==="@"||Le==="|"||Le===":"||Le==="."||Le===Pi||!Le?!1:Le===bt?(V.peek(),ne()):S(V,!1)},fe=ne();return V.resetPeek(),fe}function _(V){w(V);const D=V.currentPeek()==="|";return V.resetPeek(),D}function S(V,D=!0){const L=(fe=!1,Le="")=>{const Ae=V.currentPeek();return Ae==="{"||Ae==="@"||!Ae?fe:Ae==="|"?!(Le===Pi||Le===bt):Ae===Pi?(V.peek(),L(!0,Pi)):Ae===bt?(V.peek(),L(!0,bt)):!0},ne=L();return D&&V.resetPeek(),ne}function P(V,D){const L=V.currentChar();return L===Ii?Ii:D(L)?(V.next(),L):null}function Q(V){const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D>=48&&D<=57||D===95||D===36}function E(V){return P(V,Q)}function W(V){const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D>=48&&D<=57||D===95||D===36||D===45}function B(V){return P(V,W)}function I(V){const D=V.charCodeAt(0);return D>=48&&D<=57}function G(V){return P(V,I)}function Z(V){const D=V.charCodeAt(0);return D>=48&&D<=57||D>=65&&D<=70||D>=97&&D<=102}function H(V){return P(V,Z)}function j(V){let D="",L="";for(;D=G(V);)L+=D;return L}function z(V){let D="";for(;;){const L=V.currentChar();if(L==="{"||L==="}"||L==="@"||L==="|"||!L)break;if(L===Pi||L===bt)if(S(V))D+=L,V.next();else{if(_(V))break;D+=L,V.next()}else D+=L,V.next()}return D}function me(V){g(V);let D="",L="";for(;D=B(V);)L+=D;return V.currentChar()===Ii&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L}function de(V){g(V);let D="";return V.currentChar()==="-"?(V.next(),D+=`-${j(V)}`):D+=j(V),V.currentChar()===Ii&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),D}function ce(V){return V!==Au&&V!==bt}function v(V){g(V),O(V,"'");let D="",L="";for(;D=P(V,ce);)D==="\\"?L+=N(V):L+=D;const ne=V.currentChar();return ne===bt||ne===Ii?(f(we.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,r(),0),ne===bt&&(V.next(),O(V,"'")),L):(O(V,"'"),L)}function N(V){const D=V.currentChar();switch(D){case"\\":case"'":return V.next(),`\\${D}`;case"u":return q(V,D,4);case"U":return q(V,D,6);default:return f(we.UNKNOWN_ESCAPE_SEQUENCE,r(),0,D),""}}function q(V,D,L){O(V,D);let ne="";for(let fe=0;fe<L;fe++){const Le=H(V);if(!Le){f(we.INVALID_UNICODE_ESCAPE_SEQUENCE,r(),0,`\\${D}${ne}${V.currentChar()}`);break}ne+=Le}return`\\${D}${ne}`}function J(V){return V!=="{"&&V!=="}"&&V!==Pi&&V!==bt}function Ce(V){g(V);let D="",L="";for(;D=P(V,J);)L+=D;return L}function xi(V){let D="",L="";for(;D=E(V);)L+=D;return L}function Bi(V){const D=L=>{const ne=V.currentChar();return ne==="{"||ne==="@"||ne==="|"||ne==="("||ne===")"||!ne||ne===Pi?L:(L+=ne,V.next(),D(L))};return D("")}function Re(V){g(V);const D=O(V,"|");return g(V),D}function Ge(V,D){let L=null;switch(V.currentChar()){case"{":return D.braceNest>=1&&f(we.NOT_ALLOW_NEST_PLACEHOLDER,r(),0),V.next(),L=d(D,2,"{"),g(V),D.braceNest++,L;case"}":return D.braceNest>0&&D.currentType===2&&f(we.EMPTY_PLACEHOLDER,r(),0),V.next(),L=d(D,3,"}"),D.braceNest--,D.braceNest>0&&g(V),D.inLinked&&D.braceNest===0&&(D.inLinked=!1),L;case"@":return D.braceNest>0&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L=Ct(V,D)||m(D),D.braceNest=0,L;default:{let fe=!0,Le=!0,Ae=!0;if(_(V))return D.braceNest>0&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,L;if(D.braceNest>0&&(D.currentType===4||D.currentType===5||D.currentType===6))return f(we.UNTERMINATED_CLOSING_BRACE,r(),0),D.braceNest=0,zt(V,D);if(fe=k(V,D))return L=d(D,4,me(V)),g(V),L;if(Le=y(V,D))return L=d(D,5,de(V)),g(V),L;if(Ae=C(V,D))return L=d(D,6,v(V)),g(V),L;if(!fe&&!Le&&!Ae)return L=d(D,12,Ce(V)),f(we.INVALID_TOKEN_IN_PLACEHOLDER,r(),0,L.value),g(V),L;break}}return L}function Ct(V,D){const{currentType:L}=D;let ne=null;const fe=V.currentChar();switch((L===7||L===8||L===11||L===9)&&(fe===bt||fe===Pi)&&f(we.INVALID_LINKED_FORMAT,r(),0),fe){case"@":return V.next(),ne=d(D,7,"@"),D.inLinked=!0,ne;case".":return g(V),V.next(),d(D,8,".");case":":return g(V),V.next(),d(D,9,":");default:return _(V)?(ne=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,ne):T(V,D)||A(V,D)?(g(V),Ct(V,D)):x(V,D)?(g(V),d(D,11,xi(V))):R(V,D)?(g(V),fe==="{"?Ge(V,D)||ne:d(D,10,Bi(V))):(L===7&&f(we.INVALID_LINKED_FORMAT,r(),0),D.braceNest=0,D.inLinked=!1,zt(V,D))}}function zt(V,D){let L={type:13};if(D.braceNest>0)return Ge(V,D)||m(D);if(D.inLinked)return Ct(V,D)||m(D);switch(V.currentChar()){case"{":return Ge(V,D)||m(D);case"}":return f(we.UNBALANCED_CLOSING_BRACE,r(),0),V.next(),d(D,3,"}");case"@":return Ct(V,D)||m(D);default:{if(_(V))return L=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,L;if(S(V))return d(D,0,z(V));break}}return L}function Si(){const{currentType:V,offset:D,startLoc:L,endLoc:ne}=c;return c.lastType=V,c.lastOffset=D,c.lastStartLoc=L,c.lastEndLoc=ne,c.offset=s(),c.startLoc=r(),n.currentChar()===Ii?d(c,13):zt(n,c)}return{nextToken:Si,currentOffset:s,currentPosition:r,context:u}}const v_="parser",I_=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Z_(i,e,t){switch(i){case"\\\\":return"\\";case"\\'":return"'";default:{const n=parseInt(e||t,16);return n<=55295||n>=57344?String.fromCodePoint(n):"�"}}}function F_(i={}){const e=i.location!==!1,{onError:t}=i;function n(p,b,k,y,...C){const T=p.currentPosition();if(T.offset+=y,T.column+=y,t){const x=e?ll(k,T):null,A=Qn(b,x,{domain:v_,args:C});t(A)}}function s(p,b,k){const y={type:p};return e&&(y.start=b,y.end=b,y.loc={start:k,end:k}),y}function r(p,b,k,y){e&&(p.end=b,p.loc&&(p.loc.end=k))}function o(p,b){const k=p.context(),y=s(3,k.offset,k.startLoc);return y.value=b,r(y,p.currentOffset(),p.currentPosition()),y}function a(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(5,y,C);return T.index=parseInt(b,10),p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function c(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(4,y,C);return T.key=b,p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function u(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(9,y,C);return T.value=b.replace(I_,Z_),p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function h(p){const b=p.nextToken(),k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(8,y,C);return b.type!==11?(n(p,we.UNEXPECTED_EMPTY_LINKED_MODIFIER,k.lastStartLoc,0),T.value="",r(T,y,C),{nextConsumeToken:b,node:T}):(b.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,li(b)),T.value=b.value||"",r(T,p.currentOffset(),p.currentPosition()),{node:T})}function f(p,b){const k=p.context(),y=s(7,k.offset,k.startLoc);return y.value=b,r(y,p.currentOffset(),p.currentPosition()),y}function d(p){const b=p.context(),k=s(6,b.offset,b.startLoc);let y=p.nextToken();if(y.type===8){const C=h(p);k.modifier=C.node,y=C.nextConsumeToken||p.nextToken()}switch(y.type!==9&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),y=p.nextToken(),y.type===2&&(y=p.nextToken()),y.type){case 10:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=f(p,y.value||"");break;case 4:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=c(p,y.value||"");break;case 5:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=a(p,y.value||"");break;case 6:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=u(p,y.value||"");break;default:{n(p,we.UNEXPECTED_EMPTY_LINKED_KEY,b.lastStartLoc,0);const C=p.context(),T=s(7,C.offset,C.startLoc);return T.value="",r(T,C.offset,C.startLoc),k.key=T,r(k,C.offset,C.startLoc),{nextConsumeToken:y,node:k}}}return r(k,p.currentOffset(),p.currentPosition()),{node:k}}function m(p){const b=p.context(),k=b.currentType===1?p.currentOffset():b.offset,y=b.currentType===1?b.endLoc:b.startLoc,C=s(2,k,y);C.items=[];let T=null;do{const R=T||p.nextToken();switch(T=null,R.type){case 0:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(o(p,R.value||""));break;case 5:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(a(p,R.value||""));break;case 4:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(c(p,R.value||""));break;case 6:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(u(p,R.value||""));break;case 7:{const _=d(p);C.items.push(_.node),T=_.nextConsumeToken||null;break}}}while(b.currentType!==13&&b.currentType!==1);const x=b.currentType===1?b.lastOffset:p.currentOffset(),A=b.currentType===1?b.lastEndLoc:p.currentPosition();return r(C,x,A),C}function O(p,b,k,y){const C=p.context();let T=y.items.length===0;const x=s(1,b,k);x.cases=[],x.cases.push(y);do{const A=m(p);T||(T=A.items.length===0),x.cases.push(A)}while(C.currentType!==13);return T&&n(p,we.MUST_HAVE_MESSAGES_IN_PLURAL,k,0),r(x,p.currentOffset(),p.currentPosition()),x}function w(p){const b=p.context(),{offset:k,startLoc:y}=b,C=m(p);return b.currentType===13?C:O(p,k,y,C)}function g(p){const b=B_(p,tt({},i)),k=b.context(),y=s(0,k.offset,k.startLoc);return e&&y.loc&&(y.loc.source=p),y.body=w(b),i.onCacheKey&&(y.cacheKey=i.onCacheKey(p)),k.currentType!==13&&n(b,we.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,p[k.offset]||""),r(y,b.currentOffset(),b.currentPosition()),y}return{parse:g}}function li(i){if(i.type===13)return"EOF";const e=(i.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function U_(i,e={}){const t={ast:i,helpers:new Set};return{context:()=>t,helper:r=>(t.helpers.add(r),r)}}function Tu(i,e){for(let t=0;t<i.length;t++)al(i[t],e)}function al(i,e){switch(i.type){case 1:Tu(i.cases,e),e.helper("plural");break;case 2:Tu(i.items,e);break;case 6:{al(i.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function X_(i,e={}){const t=U_(i);t.helper("normalize"),i.body&&al(i.body,t);const n=t.context();i.helpers=Array.from(n.helpers)}function W_(i){const e=i.body;return e.type===2?Pu(e):e.cases.forEach(t=>Pu(t)),i}function Pu(i){if(i.items.length===1){const e=i.items[0];(e.type===3||e.type===9)&&(i.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<i.items.length;t++){const n=i.items[t];if(!(n.type===3||n.type===9)||n.value==null)break;e.push(n.value)}if(e.length===i.items.length){i.static=rl(e);for(let t=0;t<i.items.length;t++){const n=i.items[t];(n.type===3||n.type===9)&&delete n.value}}}}const q_="minifier";function En(i){switch(i.t=i.type,i.type){case 0:{const e=i;En(e.body),e.b=e.body,delete e.body;break}case 1:{const e=i,t=e.cases;for(let n=0;n<t.length;n++)En(t[n]);e.c=t,delete e.cases;break}case 2:{const e=i,t=e.items;for(let n=0;n<t.length;n++)En(t[n]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=i;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=i;En(e.key),e.k=e.key,delete e.key,e.modifier&&(En(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=i;e.i=e.index,delete e.index;break}case 4:{const e=i;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Qn(we.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:q_,args:[i.type]})}delete i.type}const j_="parser";function z_(i,e){const{sourceMap:t,filename:n,breakLineCode:s,needIndent:r}=e,o=e.location!==!1,a={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:s,needIndent:r,indentLevel:0};o&&i.loc&&(a.source=i.loc.source);const c=()=>a;function u(g,p){a.code+=g}function h(g,p=!0){const b=p?s:"";u(r?b+" ".repeat(g):b)}function f(g=!0){const p=++a.indentLevel;g&&h(p)}function d(g=!0){const p=--a.indentLevel;g&&h(p)}function m(){h(a.indentLevel)}return{context:c,push:u,indent:f,deindent:d,newline:m,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function Y_(i,e){const{helper:t}=i;i.push(`${t("linked")}(`),$n(i,e.key),e.modifier?(i.push(", "),$n(i,e.modifier),i.push(", _type")):i.push(", undefined, _type"),i.push(")")}function G_(i,e){const{helper:t,needIndent:n}=i;i.push(`${t("normalize")}([`),i.indent(n());const s=e.items.length;for(let r=0;r<s&&($n(i,e.items[r]),r!==s-1);r++)i.push(", ");i.deindent(n()),i.push("])")}function K_(i,e){const{helper:t,needIndent:n}=i;if(e.cases.length>1){i.push(`${t("plural")}([`),i.indent(n());const s=e.cases.length;for(let r=0;r<s&&($n(i,e.cases[r]),r!==s-1);r++)i.push(", ");i.deindent(n()),i.push("])")}}function H_(i,e){e.body?$n(i,e.body):i.push("null")}function $n(i,e){const{helper:t}=i;switch(e.type){case 0:H_(i,e);break;case 1:K_(i,e);break;case 2:G_(i,e);break;case 6:Y_(i,e);break;case 8:i.push(JSON.stringify(e.value),e);break;case 7:i.push(JSON.stringify(e.value),e);break;case 5:i.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:i.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:i.push(JSON.stringify(e.value),e);break;case 3:i.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Qn(we.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:j_,args:[e.type]})}}const J_=(i,e={})=>{const t=ie(e.mode)?e.mode:"normal",n=ie(e.filename)?e.filename:"message.intl",s=!!e.sourceMap,r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
11
|
+
`,R_=String.fromCharCode(8232),V_=String.fromCharCode(8233);function L_(i){const e=i;let t=0,n=1,s=1,r=0;const o=x=>e[x]===N_&&e[x+1]===bt,a=x=>e[x]===bt,c=x=>e[x]===V_,u=x=>e[x]===R_,h=x=>o(x)||a(x)||c(x)||u(x),f=()=>t,d=()=>n,m=()=>s,O=()=>r,w=x=>o(x)||c(x)||u(x)?bt:e[x],g=()=>w(t),p=()=>w(t+r);function b(){return r=0,h(t)&&(n++,s=0),o(t)&&t++,t++,s++,e[t]}function k(){return o(t+r)&&r++,r++,e[t+r]}function y(){t=0,n=1,s=1,r=0}function C(x=0){r=x}function T(){const x=t+r;for(;x!==t;)b();r=0}return{index:f,line:d,column:m,peekOffset:O,charAt:w,currentChar:g,currentPeek:p,next:b,peek:k,reset:y,resetPeek:C,skipToPeek:T}}const Ii=void 0,M_=".",Au="'",D_="tokenizer";function B_(i,e={}){const t=e.location!==!1,n=L_(i),s=()=>n.index(),r=()=>A_(n.line(),n.column(),n.index()),o=r(),a=s(),c={currentType:13,offset:a,startLoc:o,endLoc:o,lastType:13,lastOffset:a,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},u=()=>c,{onError:h}=e;function f(V,D,L,...ne){const fe=u();if(D.column+=L,D.offset+=L,h){const Le=t?ll(fe.startLoc,D):null,Ae=Qn(V,Le,{domain:D_,args:ne});h(Ae)}}function d(V,D,L){V.endLoc=r(),V.currentType=D;const ne={type:D};return t&&(ne.loc=ll(V.startLoc,V.endLoc)),L!=null&&(ne.value=L),ne}const m=V=>d(V,13);function O(V,D){return V.currentChar()===D?(V.next(),D):(f(we.EXPECTED_TOKEN,r(),0,D),"")}function w(V){let D="";for(;V.currentPeek()===Pi||V.currentPeek()===bt;)D+=V.currentPeek(),V.peek();return D}function g(V){const D=w(V);return V.skipToPeek(),D}function p(V){if(V===Ii)return!1;const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D===95}function b(V){if(V===Ii)return!1;const D=V.charCodeAt(0);return D>=48&&D<=57}function k(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=p(V.currentPeek());return V.resetPeek(),ne}function y(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=V.currentPeek()==="-"?V.peek():V.currentPeek(),fe=b(ne);return V.resetPeek(),fe}function C(V,D){const{currentType:L}=D;if(L!==2)return!1;w(V);const ne=V.currentPeek()===Au;return V.resetPeek(),ne}function T(V,D){const{currentType:L}=D;if(L!==7)return!1;w(V);const ne=V.currentPeek()===".";return V.resetPeek(),ne}function x(V,D){const{currentType:L}=D;if(L!==8)return!1;w(V);const ne=p(V.currentPeek());return V.resetPeek(),ne}function A(V,D){const{currentType:L}=D;if(!(L===7||L===11))return!1;w(V);const ne=V.currentPeek()===":";return V.resetPeek(),ne}function R(V,D){const{currentType:L}=D;if(L!==9)return!1;const ne=()=>{const Le=V.currentPeek();return Le==="{"?p(V.peek()):Le==="@"||Le==="|"||Le===":"||Le==="."||Le===Pi||!Le?!1:Le===bt?(V.peek(),ne()):S(V,!1)},fe=ne();return V.resetPeek(),fe}function _(V){w(V);const D=V.currentPeek()==="|";return V.resetPeek(),D}function S(V,D=!0){const L=(fe=!1,Le="")=>{const Ae=V.currentPeek();return Ae==="{"||Ae==="@"||!Ae?fe:Ae==="|"?!(Le===Pi||Le===bt):Ae===Pi?(V.peek(),L(!0,Pi)):Ae===bt?(V.peek(),L(!0,bt)):!0},ne=L();return D&&V.resetPeek(),ne}function P(V,D){const L=V.currentChar();return L===Ii?Ii:D(L)?(V.next(),L):null}function Q(V){const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D>=48&&D<=57||D===95||D===36}function E(V){return P(V,Q)}function W(V){const D=V.charCodeAt(0);return D>=97&&D<=122||D>=65&&D<=90||D>=48&&D<=57||D===95||D===36||D===45}function B(V){return P(V,W)}function I(V){const D=V.charCodeAt(0);return D>=48&&D<=57}function G(V){return P(V,I)}function Z(V){const D=V.charCodeAt(0);return D>=48&&D<=57||D>=65&&D<=70||D>=97&&D<=102}function H(V){return P(V,Z)}function j(V){let D="",L="";for(;D=G(V);)L+=D;return L}function z(V){let D="";for(;;){const L=V.currentChar();if(L==="{"||L==="}"||L==="@"||L==="|"||!L)break;if(L===Pi||L===bt)if(S(V))D+=L,V.next();else{if(_(V))break;D+=L,V.next()}else D+=L,V.next()}return D}function me(V){g(V);let D="",L="";for(;D=B(V);)L+=D;return V.currentChar()===Ii&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L}function de(V){g(V);let D="";return V.currentChar()==="-"?(V.next(),D+=`-${j(V)}`):D+=j(V),V.currentChar()===Ii&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),D}function ae(V){return V!==Au&&V!==bt}function v(V){g(V),O(V,"'");let D="",L="";for(;D=P(V,ae);)D==="\\"?L+=N(V):L+=D;const ne=V.currentChar();return ne===bt||ne===Ii?(f(we.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,r(),0),ne===bt&&(V.next(),O(V,"'")),L):(O(V,"'"),L)}function N(V){const D=V.currentChar();switch(D){case"\\":case"'":return V.next(),`\\${D}`;case"u":return q(V,D,4);case"U":return q(V,D,6);default:return f(we.UNKNOWN_ESCAPE_SEQUENCE,r(),0,D),""}}function q(V,D,L){O(V,D);let ne="";for(let fe=0;fe<L;fe++){const Le=H(V);if(!Le){f(we.INVALID_UNICODE_ESCAPE_SEQUENCE,r(),0,`\\${D}${ne}${V.currentChar()}`);break}ne+=Le}return`\\${D}${ne}`}function J(V){return V!=="{"&&V!=="}"&&V!==Pi&&V!==bt}function Ce(V){g(V);let D="",L="";for(;D=P(V,J);)L+=D;return L}function xi(V){let D="",L="";for(;D=E(V);)L+=D;return L}function Bi(V){const D=L=>{const ne=V.currentChar();return ne==="{"||ne==="@"||ne==="|"||ne==="("||ne===")"||!ne||ne===Pi?L:(L+=ne,V.next(),D(L))};return D("")}function Re(V){g(V);const D=O(V,"|");return g(V),D}function Ge(V,D){let L=null;switch(V.currentChar()){case"{":return D.braceNest>=1&&f(we.NOT_ALLOW_NEST_PLACEHOLDER,r(),0),V.next(),L=d(D,2,"{"),g(V),D.braceNest++,L;case"}":return D.braceNest>0&&D.currentType===2&&f(we.EMPTY_PLACEHOLDER,r(),0),V.next(),L=d(D,3,"}"),D.braceNest--,D.braceNest>0&&g(V),D.inLinked&&D.braceNest===0&&(D.inLinked=!1),L;case"@":return D.braceNest>0&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L=Ct(V,D)||m(D),D.braceNest=0,L;default:{let fe=!0,Le=!0,Ae=!0;if(_(V))return D.braceNest>0&&f(we.UNTERMINATED_CLOSING_BRACE,r(),0),L=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,L;if(D.braceNest>0&&(D.currentType===4||D.currentType===5||D.currentType===6))return f(we.UNTERMINATED_CLOSING_BRACE,r(),0),D.braceNest=0,zt(V,D);if(fe=k(V,D))return L=d(D,4,me(V)),g(V),L;if(Le=y(V,D))return L=d(D,5,de(V)),g(V),L;if(Ae=C(V,D))return L=d(D,6,v(V)),g(V),L;if(!fe&&!Le&&!Ae)return L=d(D,12,Ce(V)),f(we.INVALID_TOKEN_IN_PLACEHOLDER,r(),0,L.value),g(V),L;break}}return L}function Ct(V,D){const{currentType:L}=D;let ne=null;const fe=V.currentChar();switch((L===7||L===8||L===11||L===9)&&(fe===bt||fe===Pi)&&f(we.INVALID_LINKED_FORMAT,r(),0),fe){case"@":return V.next(),ne=d(D,7,"@"),D.inLinked=!0,ne;case".":return g(V),V.next(),d(D,8,".");case":":return g(V),V.next(),d(D,9,":");default:return _(V)?(ne=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,ne):T(V,D)||A(V,D)?(g(V),Ct(V,D)):x(V,D)?(g(V),d(D,11,xi(V))):R(V,D)?(g(V),fe==="{"?Ge(V,D)||ne:d(D,10,Bi(V))):(L===7&&f(we.INVALID_LINKED_FORMAT,r(),0),D.braceNest=0,D.inLinked=!1,zt(V,D))}}function zt(V,D){let L={type:13};if(D.braceNest>0)return Ge(V,D)||m(D);if(D.inLinked)return Ct(V,D)||m(D);switch(V.currentChar()){case"{":return Ge(V,D)||m(D);case"}":return f(we.UNBALANCED_CLOSING_BRACE,r(),0),V.next(),d(D,3,"}");case"@":return Ct(V,D)||m(D);default:{if(_(V))return L=d(D,1,Re(V)),D.braceNest=0,D.inLinked=!1,L;if(S(V))return d(D,0,z(V));break}}return L}function Si(){const{currentType:V,offset:D,startLoc:L,endLoc:ne}=c;return c.lastType=V,c.lastOffset=D,c.lastStartLoc=L,c.lastEndLoc=ne,c.offset=s(),c.startLoc=r(),n.currentChar()===Ii?d(c,13):zt(n,c)}return{nextToken:Si,currentOffset:s,currentPosition:r,context:u}}const v_="parser",I_=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Z_(i,e,t){switch(i){case"\\\\":return"\\";case"\\'":return"'";default:{const n=parseInt(e||t,16);return n<=55295||n>=57344?String.fromCodePoint(n):"�"}}}function F_(i={}){const e=i.location!==!1,{onError:t}=i;function n(p,b,k,y,...C){const T=p.currentPosition();if(T.offset+=y,T.column+=y,t){const x=e?ll(k,T):null,A=Qn(b,x,{domain:v_,args:C});t(A)}}function s(p,b,k){const y={type:p};return e&&(y.start=b,y.end=b,y.loc={start:k,end:k}),y}function r(p,b,k,y){e&&(p.end=b,p.loc&&(p.loc.end=k))}function o(p,b){const k=p.context(),y=s(3,k.offset,k.startLoc);return y.value=b,r(y,p.currentOffset(),p.currentPosition()),y}function a(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(5,y,C);return T.index=parseInt(b,10),p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function c(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(4,y,C);return T.key=b,p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function u(p,b){const k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(9,y,C);return T.value=b.replace(I_,Z_),p.nextToken(),r(T,p.currentOffset(),p.currentPosition()),T}function h(p){const b=p.nextToken(),k=p.context(),{lastOffset:y,lastStartLoc:C}=k,T=s(8,y,C);return b.type!==11?(n(p,we.UNEXPECTED_EMPTY_LINKED_MODIFIER,k.lastStartLoc,0),T.value="",r(T,y,C),{nextConsumeToken:b,node:T}):(b.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,li(b)),T.value=b.value||"",r(T,p.currentOffset(),p.currentPosition()),{node:T})}function f(p,b){const k=p.context(),y=s(7,k.offset,k.startLoc);return y.value=b,r(y,p.currentOffset(),p.currentPosition()),y}function d(p){const b=p.context(),k=s(6,b.offset,b.startLoc);let y=p.nextToken();if(y.type===8){const C=h(p);k.modifier=C.node,y=C.nextConsumeToken||p.nextToken()}switch(y.type!==9&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),y=p.nextToken(),y.type===2&&(y=p.nextToken()),y.type){case 10:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=f(p,y.value||"");break;case 4:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=c(p,y.value||"");break;case 5:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=a(p,y.value||"");break;case 6:y.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(y)),k.key=u(p,y.value||"");break;default:{n(p,we.UNEXPECTED_EMPTY_LINKED_KEY,b.lastStartLoc,0);const C=p.context(),T=s(7,C.offset,C.startLoc);return T.value="",r(T,C.offset,C.startLoc),k.key=T,r(k,C.offset,C.startLoc),{nextConsumeToken:y,node:k}}}return r(k,p.currentOffset(),p.currentPosition()),{node:k}}function m(p){const b=p.context(),k=b.currentType===1?p.currentOffset():b.offset,y=b.currentType===1?b.endLoc:b.startLoc,C=s(2,k,y);C.items=[];let T=null;do{const R=T||p.nextToken();switch(T=null,R.type){case 0:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(o(p,R.value||""));break;case 5:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(a(p,R.value||""));break;case 4:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(c(p,R.value||""));break;case 6:R.value==null&&n(p,we.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,li(R)),C.items.push(u(p,R.value||""));break;case 7:{const _=d(p);C.items.push(_.node),T=_.nextConsumeToken||null;break}}}while(b.currentType!==13&&b.currentType!==1);const x=b.currentType===1?b.lastOffset:p.currentOffset(),A=b.currentType===1?b.lastEndLoc:p.currentPosition();return r(C,x,A),C}function O(p,b,k,y){const C=p.context();let T=y.items.length===0;const x=s(1,b,k);x.cases=[],x.cases.push(y);do{const A=m(p);T||(T=A.items.length===0),x.cases.push(A)}while(C.currentType!==13);return T&&n(p,we.MUST_HAVE_MESSAGES_IN_PLURAL,k,0),r(x,p.currentOffset(),p.currentPosition()),x}function w(p){const b=p.context(),{offset:k,startLoc:y}=b,C=m(p);return b.currentType===13?C:O(p,k,y,C)}function g(p){const b=B_(p,tt({},i)),k=b.context(),y=s(0,k.offset,k.startLoc);return e&&y.loc&&(y.loc.source=p),y.body=w(b),i.onCacheKey&&(y.cacheKey=i.onCacheKey(p)),k.currentType!==13&&n(b,we.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,p[k.offset]||""),r(y,b.currentOffset(),b.currentPosition()),y}return{parse:g}}function li(i){if(i.type===13)return"EOF";const e=(i.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function U_(i,e={}){const t={ast:i,helpers:new Set};return{context:()=>t,helper:r=>(t.helpers.add(r),r)}}function Tu(i,e){for(let t=0;t<i.length;t++)al(i[t],e)}function al(i,e){switch(i.type){case 1:Tu(i.cases,e),e.helper("plural");break;case 2:Tu(i.items,e);break;case 6:{al(i.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function X_(i,e={}){const t=U_(i);t.helper("normalize"),i.body&&al(i.body,t);const n=t.context();i.helpers=Array.from(n.helpers)}function W_(i){const e=i.body;return e.type===2?Pu(e):e.cases.forEach(t=>Pu(t)),i}function Pu(i){if(i.items.length===1){const e=i.items[0];(e.type===3||e.type===9)&&(i.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<i.items.length;t++){const n=i.items[t];if(!(n.type===3||n.type===9)||n.value==null)break;e.push(n.value)}if(e.length===i.items.length){i.static=rl(e);for(let t=0;t<i.items.length;t++){const n=i.items[t];(n.type===3||n.type===9)&&delete n.value}}}}const q_="minifier";function En(i){switch(i.t=i.type,i.type){case 0:{const e=i;En(e.body),e.b=e.body,delete e.body;break}case 1:{const e=i,t=e.cases;for(let n=0;n<t.length;n++)En(t[n]);e.c=t,delete e.cases;break}case 2:{const e=i,t=e.items;for(let n=0;n<t.length;n++)En(t[n]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=i;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=i;En(e.key),e.k=e.key,delete e.key,e.modifier&&(En(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=i;e.i=e.index,delete e.index;break}case 4:{const e=i;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Qn(we.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:q_,args:[i.type]})}delete i.type}const j_="parser";function z_(i,e){const{sourceMap:t,filename:n,breakLineCode:s,needIndent:r}=e,o=e.location!==!1,a={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:s,needIndent:r,indentLevel:0};o&&i.loc&&(a.source=i.loc.source);const c=()=>a;function u(g,p){a.code+=g}function h(g,p=!0){const b=p?s:"";u(r?b+" ".repeat(g):b)}function f(g=!0){const p=++a.indentLevel;g&&h(p)}function d(g=!0){const p=--a.indentLevel;g&&h(p)}function m(){h(a.indentLevel)}return{context:c,push:u,indent:f,deindent:d,newline:m,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function Y_(i,e){const{helper:t}=i;i.push(`${t("linked")}(`),$n(i,e.key),e.modifier?(i.push(", "),$n(i,e.modifier),i.push(", _type")):i.push(", undefined, _type"),i.push(")")}function G_(i,e){const{helper:t,needIndent:n}=i;i.push(`${t("normalize")}([`),i.indent(n());const s=e.items.length;for(let r=0;r<s&&($n(i,e.items[r]),r!==s-1);r++)i.push(", ");i.deindent(n()),i.push("])")}function K_(i,e){const{helper:t,needIndent:n}=i;if(e.cases.length>1){i.push(`${t("plural")}([`),i.indent(n());const s=e.cases.length;for(let r=0;r<s&&($n(i,e.cases[r]),r!==s-1);r++)i.push(", ");i.deindent(n()),i.push("])")}}function H_(i,e){e.body?$n(i,e.body):i.push("null")}function $n(i,e){const{helper:t}=i;switch(e.type){case 0:H_(i,e);break;case 1:K_(i,e);break;case 2:G_(i,e);break;case 6:Y_(i,e);break;case 8:i.push(JSON.stringify(e.value),e);break;case 7:i.push(JSON.stringify(e.value),e);break;case 5:i.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:i.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:i.push(JSON.stringify(e.value),e);break;case 3:i.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Qn(we.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:j_,args:[e.type]})}}const J_=(i,e={})=>{const t=ie(e.mode)?e.mode:"normal",n=ie(e.filename)?e.filename:"message.intl",s=!!e.sourceMap,r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
12
12
|
`,o=e.needIndent?e.needIndent:t!=="arrow",a=i.helpers||[],c=z_(i,{mode:t,filename:n,sourceMap:s,breakLineCode:r,needIndent:o});c.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(o),a.length>0&&(c.push(`const { ${rl(a.map(f=>`${f}: _${f}`),", ")} } = ctx`),c.newline()),c.push("return "),$n(c,i),c.deindent(o),c.push("}"),delete i.helpers;const{code:u,map:h}=c.context();return{ast:i,code:u,map:h?h.toJSON():void 0}};function e0(i,e={}){const t=tt({},e),n=!!t.jit,s=!!t.minify,r=t.optimize==null?!0:t.optimize,a=F_(t).parse(i);return n?(r&&W_(a),s&&En(a),{ast:a,code:""}):(X_(a,t),J_(a,t))}/*!
|
|
13
13
|
* core-base v10.0.8
|
|
14
14
|
* (c) 2025 kazuya kawaguchi
|
|
@@ -18,18 +18,18 @@ ${u}`:c)}else throw o},onCacheKey:o=>O_(e,t,o)}}function eb(i){if(ie(i))return i
|
|
|
18
18
|
* vue-i18n v10.0.8
|
|
19
19
|
* (c) 2025 kazuya kawaguchi
|
|
20
20
|
* Released under the MIT License.
|
|
21
|
-
*/const ub="10.0.8";function hb(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(an().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(an().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(an().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(an().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ui={FALLBACK_TO_ROOT:$0,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},fb={[Ui.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Ui.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Ui.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Ui.DEPRECATE_TC]:"'tc' and '$tc' has been deprecated in v10. Use 't' or '$t' instead. 'tc' and '$tc’ are going to remove in v11."};function kr(i,...e){return dr(fb[i],...e)}const ve={UNEXPECTED_RETURN_TYPE:_0,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function yt(i,...e){return Qn(i,null,process.env.NODE_ENV!=="production"?{messages:db,args:e}:void 0)}const db={[ve.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[ve.INVALID_ARGUMENT]:"Invalid argument",[ve.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[ve.NOT_INSTALLED]:"Need to install with `app.use` function",[ve.UNEXPECTED_ERROR]:"Unexpected error",[ve.REQUIRED_VALUE]:"Required in value: {0}",[ve.INVALID_VALUE]:"Invalid value",[ve.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[ve.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[ve.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[ve.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},yl=oi("__translateVNode"),wl=oi("__datetimeParts"),kl=oi("__numberParts"),un=oi("__enableEmitter"),hs=oi("__disableEmitter"),dh=oi("__setPluralRules"),ph=oi("__injectWithOption"),xl=oi("__dispose");function fs(i){if(!Pe(i)||It(i))return i;for(const e in i)if(Gt(i,e))if(!e.includes("."))Pe(i[e])&&fs(i[e]);else{const t=e.split("."),n=t.length-1;let s=i,r=!1;for(let o=0;o<n;o++){if(t[o]==="__proto__")throw new Error(`unsafe key: ${t[o]}`);if(t[o]in s||(s[t[o]]=Me()),!Pe(s[t[o]])){process.env.NODE_ENV!=="production"&&Ti(kr(Ui.IGNORE_OBJ_FLATTEN,{key:t[o]})),r=!0;break}s=s[t[o]]}if(r||(It(s)?Du.includes(t[n])||delete i[e]:(s[t[n]]=i[e],delete i[e])),!It(s)){const o=s[t[n]];Pe(o)&&fs(o)}}return i}function Sl(i,e){const{messages:t,__i18n:n,messageResolver:s,flatJson:r}=e,o=xe(t)?t:We(n)?Me():{[i]:Me()};if(We(n)&&n.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:u}=a;c?(o[c]=o[c]||Me(),gr(u,o[c])):gr(u,o)}else ie(a)&&gr(JSON.parse(a),o)}),s==null&&r)for(const a in o)Gt(o,a)&&fs(o[a]);return o}function mh(i){return i.type}function gh(i,e,t){let n=Pe(e.messages)?e.messages:Me();"__i18nGlobal"in t&&(n=Sl(i.locale.value,{messages:n,__i18n:t.__i18nGlobal}));const s=Object.keys(n);s.length&&s.forEach(r=>{i.mergeLocaleMessage(r,n[r])});{if(Pe(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{i.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(Pe(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{i.mergeNumberFormat(o,e.numberFormats[o])})}}}function Oh(i){return l.createVNode(l.Text,null,i,0)}const _h="__INTLIFY_META__",bh=()=>[],pb=()=>!1;let yh=0;function wh(i){return(e,t,n,s)=>i(t,n,l.getCurrentInstance()||void 0,s)}const mb=()=>{const i=l.getCurrentInstance();let e=null;return i&&(e=mh(i)[_h])?{[_h]:e}:null};function Cl(i={}){const{__root:e,__injectWithOption:t}=i,n=e===void 0,s=i.flatJson,r=Yt?l.ref:l.shallowRef;let o=$e(i.inheritLocale)?i.inheritLocale:!0;const a=r(e&&o?e.locale.value:ie(i.locale)?i.locale:cs),c=r(e&&o?e.fallbackLocale.value:ie(i.fallbackLocale)||We(i.fallbackLocale)||xe(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:a.value),u=r(Sl(a.value,i)),h=r(xe(i.datetimeFormats)?i.datetimeFormats:{[a.value]:{}}),f=r(xe(i.numberFormats)?i.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:$e(i.missingWarn)||Pn(i.missingWarn)?i.missingWarn:!0,m=e?e.fallbackWarn:$e(i.fallbackWarn)||Pn(i.fallbackWarn)?i.fallbackWarn:!0,O=e?e.fallbackRoot:$e(i.fallbackRoot)?i.fallbackRoot:!0,w=!!i.fallbackFormat,g=Be(i.missing)?i.missing:null,p=Be(i.missing)?wh(i.missing):null,b=Be(i.postTranslation)?i.postTranslation:null,k=e?e.warnHtmlMessage:$e(i.warnHtmlMessage)?i.warnHtmlMessage:!0,y=!!i.escapeParameter;const C=e?e.modifiers:xe(i.modifiers)?i.modifiers:{};let T=i.pluralRules||e&&e.pluralRules,x;x=(()=>{n&&Yu(null);const U={version:ub,locale:a.value,fallbackLocale:c.value,messages:u.value,modifiers:C,pluralRules:T,missing:p===null?void 0:p,missingWarn:d,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:b===null?void 0:b,warnHtmlMessage:k,escapeParameter:y,messageResolver:i.messageResolver,messageCompiler:i.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=h.value,U.numberFormats=f.value,U.__datetimeFormatters=xe(x)?x.__datetimeFormatters:void 0,U.__numberFormatters=xe(x)?x.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(U.__v_emitter=xe(x)?x.__v_emitter:void 0);const Y=Z0(U);return n&&Yu(Y),Y})(),us(x,a.value,c.value);function R(){return[a.value,c.value,u.value,h.value,f.value]}const _=l.computed({get:()=>a.value,set:U=>{a.value=U,x.locale=a.value}}),S=l.computed({get:()=>c.value,set:U=>{c.value=U,x.fallbackLocale=c.value,us(x,a.value,U)}}),P=l.computed(()=>u.value),Q=l.computed(()=>h.value),E=l.computed(()=>f.value);function W(){return Be(b)?b:null}function B(U){b=U,x.postTranslation=U}function I(){return g}function G(U){U!==null&&(p=wh(U)),g=U,x.missing=p}function Z(U,Y){return U!=="translate"||!Y.resolvedMessage}const H=(U,Y,Ee,qe,Ci,sn)=>{R();let rn;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(x.fallbackContext=e?I0():void 0),rn=U(x)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(x.fallbackContext=void 0)}if(Ee!=="translate exists"&&je(rn)&&rn===br||Ee==="translate exists"&&!rn){const[vi,Ou]=Y();if(process.env.NODE_ENV!=="production"&&e&&ie(vi)&&Z(Ee,Ou)&&(O&&(wr(m,vi)||Ku(d,vi))&&Ti(kr(Ui.FALLBACK_TO_ROOT,{key:vi,type:Ee})),process.env.NODE_ENV!=="production")){const{__v_emitter:il}=x;il&&O&&il.emit("fallback",{type:Ee,key:vi,to:"global",groupId:`${Ee}:${vi}`})}return e&&O?qe(e):Ci(vi)}else{if(sn(rn))return rn;throw yt(ve.UNEXPECTED_RETURN_TYPE)}};function j(...U){return H(Y=>Reflect.apply(ch,null,[Y,...U]),()=>_l(...U),"translate",Y=>Reflect.apply(Y.t,Y,[...U]),Y=>Y,Y=>ie(Y))}function z(...U){const[Y,Ee,qe]=U;if(qe&&!Pe(qe))throw yt(ve.INVALID_ARGUMENT);return j(Y,Ee,tt({resolvedMessage:!0},qe||{}))}function me(...U){return H(Y=>Reflect.apply(th,null,[Y,...U]),()=>gl(...U),"datetime format",Y=>Reflect.apply(Y.d,Y,[...U]),()=>yr,Y=>ie(Y))}function de(...U){return H(Y=>Reflect.apply(sh,null,[Y,...U]),()=>Ol(...U),"number format",Y=>Reflect.apply(Y.n,Y,[...U]),()=>yr,Y=>ie(Y))}function ce(U){return U.map(Y=>ie(Y)||je(Y)||$e(Y)?Oh(String(Y)):Y)}const N={normalize:ce,interpolate:U=>U,type:"vnode"};function q(...U){return H(Y=>{let Ee;const qe=Y;try{qe.processor=N,Ee=Reflect.apply(ch,null,[qe,...U])}finally{qe.processor=null}return Ee},()=>_l(...U),"translate",Y=>Y[yl](...U),Y=>[Oh(Y)],Y=>We(Y))}function J(...U){return H(Y=>Reflect.apply(sh,null,[Y,...U]),()=>Ol(...U),"number format",Y=>Y[kl](...U),bh,Y=>ie(Y)||We(Y))}function Ce(...U){return H(Y=>Reflect.apply(th,null,[Y,...U]),()=>gl(...U),"datetime format",Y=>Y[wl](...U),bh,Y=>ie(Y)||We(Y))}function xi(U){T=U,x.pluralRules=T}function Bi(U,Y){return H(()=>{if(!U)return!1;const Ee=ie(Y)?Y:a.value,qe=Ct(Ee),Ci=x.messageResolver(qe,U);return It(Ci)||Zt(Ci)||ie(Ci)},()=>[U],"translate exists",Ee=>Reflect.apply(Ee.te,Ee,[U,Y]),pb,Ee=>$e(Ee))}function Re(U){let Y=null;const Ee=Iu(x,c.value,a.value);for(let qe=0;qe<Ee.length;qe++){const Ci=u.value[Ee[qe]]||{},sn=x.messageResolver(Ci,U);if(sn!=null){Y=sn;break}}return Y}function Ge(U){const Y=Re(U);return Y??(e?e.tm(U)||{}:{})}function Ct(U){return u.value[U]||{}}function zt(U,Y){if(s){const Ee={[U]:Y};for(const qe in Ee)Gt(Ee,qe)&&fs(Ee[qe]);Y=Ee[U]}u.value[U]=Y,x.messages=u.value}function Si(U,Y){u.value[U]=u.value[U]||{};const Ee={[U]:Y};if(s)for(const qe in Ee)Gt(Ee,qe)&&fs(Ee[qe]);Y=Ee[U],gr(Y,u.value[U]),x.messages=u.value}function V(U){return h.value[U]||{}}function D(U,Y){h.value[U]=Y,x.datetimeFormats=h.value,nh(x,U,Y)}function L(U,Y){h.value[U]=tt(h.value[U]||{},Y),x.datetimeFormats=h.value,nh(x,U,Y)}function ne(U){return f.value[U]||{}}function fe(U,Y){f.value[U]=Y,x.numberFormats=f.value,oh(x,U,Y)}function Le(U,Y){f.value[U]=tt(f.value[U]||{},Y),x.numberFormats=f.value,oh(x,U,Y)}yh++,e&&Yt&&(l.watch(e.locale,U=>{o&&(a.value=U,x.locale=U,us(x,a.value,c.value))}),l.watch(e.fallbackLocale,U=>{o&&(c.value=U,x.fallbackLocale=U,us(x,a.value,c.value))}));const Ae={id:yh,locale:_,fallbackLocale:S,get inheritLocale(){return o},set inheritLocale(U){o=U,U&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,us(x,a.value,c.value))},get availableLocales(){return Object.keys(u.value).sort()},messages:P,get modifiers(){return C},get pluralRules(){return T||{}},get isGlobal(){return n},get missingWarn(){return d},set missingWarn(U){d=U,x.missingWarn=d},get fallbackWarn(){return m},set fallbackWarn(U){m=U,x.fallbackWarn=m},get fallbackRoot(){return O},set fallbackRoot(U){O=U},get fallbackFormat(){return w},set fallbackFormat(U){w=U,x.fallbackFormat=w},get warnHtmlMessage(){return k},set warnHtmlMessage(U){k=U,x.warnHtmlMessage=U},get escapeParameter(){return y},set escapeParameter(U){y=U,x.escapeParameter=U},t:j,getLocaleMessage:Ct,setLocaleMessage:zt,mergeLocaleMessage:Si,getPostTranslationHandler:W,setPostTranslationHandler:B,getMissingHandler:I,setMissingHandler:G,[dh]:xi};return Ae.datetimeFormats=Q,Ae.numberFormats=E,Ae.rt=z,Ae.te=Bi,Ae.tm=Ge,Ae.d=me,Ae.n=de,Ae.getDateTimeFormat=V,Ae.setDateTimeFormat=D,Ae.mergeDateTimeFormat=L,Ae.getNumberFormat=ne,Ae.setNumberFormat=fe,Ae.mergeNumberFormat=Le,Ae[ph]=t,Ae[yl]=q,Ae[wl]=Ce,Ae[kl]=J,process.env.NODE_ENV!=="production"&&(Ae[un]=U=>{x.__v_emitter=U},Ae[hs]=()=>{x.__v_emitter=void 0}),Ae}const kh="vue-i18n: composer properties",Al={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},gb={"vue-i18n-resource-inspector":"Search for scopes ..."},Ob={"vue-i18n-timeline":16764185};let Tl;async function _b(i,e){return new Promise((t,n)=>{try{cb({id:"vue-devtools-plugin-vue-i18n",label:Al["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[kh],app:i},s=>{Tl=s,s.on.visitComponentTree(({componentInstance:o,treeNode:a})=>{bb(o,a,e)}),s.on.inspectComponent(({componentInstance:o,instanceData:a})=>{o.vnode.el&&o.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?o.vnode.el.__VUE_I18N__!==e.global.__composer&&Sh(a,o.vnode.el.__VUE_I18N__):Sh(a,o.vnode.el.__VUE_I18N__))}),s.addInspector({id:"vue-i18n-resource-inspector",label:Al["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:gb["vue-i18n-resource-inspector"]}),s.on.getInspectorTree(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Sb(o,e)});const r=new Map;s.on.getInspectorState(async o=>{if(o.app===i&&o.inspectorId==="vue-i18n-resource-inspector")if(s.unhighlightElement(),Ab(o,e),o.nodeId==="global"){if(!r.has(o.app)){const[a]=await s.getComponentInstances(o.app);r.set(o.app,a)}s.highlightElement(r.get(o.app))}else{const a=Cb(o.nodeId,e);a&&s.highlightElement(a)}}),s.on.editInspectorState(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Pb(o,e)}),s.addTimelineLayer({id:"vue-i18n-timeline",label:Al["vue-i18n-timeline"],color:Ob["vue-i18n-timeline"]}),t(!0)})}catch(s){console.error(s),n(!1)}})}function xh(i){return i.type.name||i.type.displayName||i.type.__file||"Anonymous"}function bb(i,e,t){const n=t.mode==="composition"?t.global:t.global.__composer;if(i&&i.vnode.el&&i.vnode.el.__VUE_I18N__&&i.vnode.el.__VUE_I18N__!==n){const s={label:`i18n (${xh(i)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(s)}}function Sh(i,e){const t=kh;i.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),i.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),i.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),i.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),i.state.push({type:t,key:"messages",editable:!1,value:Pl(e.messages.value)}),i.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),i.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function Pl(i){const e={};return Object.keys(i).forEach(t=>{const n=i[t];Be(n)&&"source"in n?e[t]=xb(n):It(n)&&n.loc&&n.loc.source?e[t]=n.loc.source:Pe(n)?e[t]=Pl(n):e[t]=n}),e}const yb={"<":"<",">":">",'"':""","&":"&"};function wb(i){return i.replace(/[<>"&]/g,kb)}function kb(i){return yb[i]||i}function xb(i){return{_custom:{type:"function",display:`<span>ƒ</span> ${i.source?`("${wb(i.source)}")`:"(?)"}`}}}function Sb(i,e){i.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[n,s]of e.__instances){const r=e.mode==="composition"?s:s.__composer;t!==r&&i.rootNodes.push({id:r.id.toString(),label:`${xh(n)} Scope`})}}function Cb(i,e){let t=null;if(i!=="global"){for(const[n,s]of e.__instances.entries())if(s.id.toString()===i){t=n;break}}return t}function Ch(i,e){if(i==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(n=>n.id.toString()===i);return t?e.mode==="composition"?t:t.__composer:null}}function Ab(i,e){const t=Ch(i.nodeId,e);return t&&(i.state=Tb(t)),null}function Tb(i){const e={},t="Locale related info",n=[{type:t,key:"locale",editable:!0,value:i.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:i.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:i.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:i.inheritLocale}];e[t]=n;const s="Locale messages info",r=[{type:s,key:"messages",editable:!1,value:Pl(i.messages.value)}];e[s]=r;{const o="Datetime formats info",a=[{type:o,key:"datetimeFormats",editable:!1,value:i.datetimeFormats.value}];e[o]=a;const c="Datetime formats info",u=[{type:c,key:"numberFormats",editable:!1,value:i.numberFormats.value}];e[c]=u}return e}function ds(i,e){if(Tl){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),Tl.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:i,groupId:t,time:Date.now(),meta:{},data:e||{},logType:i==="compile-error"?"error":i==="fallback"||i==="missing"?"warning":"default"}})}}function Pb(i,e){const t=Ch(i.nodeId,e);if(t){const[n]=i.path;n==="locale"&&ie(i.state.value)?t.locale.value=i.state.value:n==="fallbackLocale"&&(ie(i.state.value)||We(i.state.value)||Pe(i.state.value))?t.fallbackLocale.value=i.state.value:n==="inheritLocale"&&$e(i.state.value)&&(t.inheritLocale=i.state.value)}}function Qb(i){const e=ie(i.locale)?i.locale:cs,t=ie(i.fallbackLocale)||We(i.fallbackLocale)||xe(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:e,n=Be(i.missing)?i.missing:void 0,s=$e(i.silentTranslationWarn)||Pn(i.silentTranslationWarn)?!i.silentTranslationWarn:!0,r=$e(i.silentFallbackWarn)||Pn(i.silentFallbackWarn)?!i.silentFallbackWarn:!0,o=$e(i.fallbackRoot)?i.fallbackRoot:!0,a=!!i.formatFallbackMessages,c=xe(i.modifiers)?i.modifiers:{},u=i.pluralizationRules,h=Be(i.postTranslation)?i.postTranslation:void 0,f=ie(i.warnHtmlInMessage)?i.warnHtmlInMessage!=="off":!0,d=!!i.escapeParameterHtml,m=$e(i.sync)?i.sync:!0;let O=i.messages;if(xe(i.sharedMessages)){const C=i.sharedMessages;O=Object.keys(C).reduce((x,A)=>{const R=x[A]||(x[A]={});return tt(R,C[A]),x},O||{})}const{__i18n:w,__root:g,__injectWithOption:p}=i,b=i.datetimeFormats,k=i.numberFormats,y=i.flatJson;return{locale:e,fallbackLocale:t,messages:O,flatJson:y,datetimeFormats:b,numberFormats:k,missing:n,missingWarn:s,fallbackWarn:r,fallbackRoot:o,fallbackFormat:a,modifiers:c,pluralRules:u,postTranslation:h,warnHtmlMessage:f,escapeParameter:d,messageResolver:i.messageResolver,inheritLocale:m,__i18n:w,__root:g,__injectWithOption:p}}function Ql(i={}){const e=Cl(Qb(i)),{__extender:t}=i,n={id:e.id,get locale(){return e.locale.value},set locale(s){e.locale.value=s},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(s){e.fallbackLocale.value=s},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(s){e.setMissingHandler(s)},get silentTranslationWarn(){return $e(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(s){e.missingWarn=$e(s)?!s:s},get silentFallbackWarn(){return $e(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(s){e.fallbackWarn=$e(s)?!s:s},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(s){e.fallbackFormat=s},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(s){e.setPostTranslationHandler(s)},get sync(){return e.inheritLocale},set sync(s){e.inheritLocale=s},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(s){e.warnHtmlMessage=s!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(s){e.escapeParameter=s},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...s){return Reflect.apply(e.t,e,[...s])},rt(...s){return Reflect.apply(e.rt,e,[...s])},tc(...s){const[r,o,a]=s,c={plural:1};let u=null,h=null;if(process.env.NODE_ENV!=="production"&&yu(kr(Ui.DEPRECATE_TC)),!ie(r))throw yt(ve.INVALID_ARGUMENT);const f=r;return ie(o)?c.locale=o:je(o)?c.plural=o:We(o)?u=o:xe(o)&&(h=o),ie(a)?c.locale=a:We(a)?u=a:xe(a)&&(h=a),Reflect.apply(e.t,e,[f,u||h||{},c])},te(s,r){return e.te(s,r)},tm(s){return e.tm(s)},getLocaleMessage(s){return e.getLocaleMessage(s)},setLocaleMessage(s,r){e.setLocaleMessage(s,r)},mergeLocaleMessage(s,r){e.mergeLocaleMessage(s,r)},d(...s){return Reflect.apply(e.d,e,[...s])},getDateTimeFormat(s){return e.getDateTimeFormat(s)},setDateTimeFormat(s,r){e.setDateTimeFormat(s,r)},mergeDateTimeFormat(s,r){e.mergeDateTimeFormat(s,r)},n(...s){return Reflect.apply(e.n,e,[...s])},getNumberFormat(s){return e.getNumberFormat(s)},setNumberFormat(s,r){e.setNumberFormat(s,r)},mergeNumberFormat(s,r){e.mergeNumberFormat(s,r)}};return n.__extender=t,process.env.NODE_ENV!=="production"&&(n.__enableEmitter=s=>{const r=e;r[un]&&r[un](s)},n.__disableEmitter=()=>{const s=e;s[hs]&&s[hs]()}),n}function Eb(i,e,t){return{beforeCreate(){const n=l.getCurrentInstance();if(!n)throw yt(ve.UNEXPECTED_ERROR);const s=this.$options;if(s.i18n){const r=s.i18n;if(s.__i18n&&(r.__i18n=s.__i18n),r.__root=e,this===this.$root)this.$i18n=Ah(i,r);else{r.__injectWithOption=!0,r.__extender=t.__vueI18nExtend,this.$i18n=Ql(r);const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=Ah(i,s);else{this.$i18n=Ql({__i18n:s.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}else this.$i18n=i;s.__i18nGlobal&&gh(e,s,s),this.$t=(...r)=>this.$i18n.t(...r),this.$rt=(...r)=>this.$i18n.rt(...r),this.$tc=(...r)=>this.$i18n.tc(...r),this.$te=(r,o)=>this.$i18n.te(r,o),this.$d=(...r)=>this.$i18n.d(...r),this.$n=(...r)=>this.$i18n.n(...r),this.$tm=r=>this.$i18n.tm(r),t.__setInstance(n,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const n=this.$i18n;this.$el.__VUE_I18N__=n.__composer;const s=this.__v_emitter=ol();n.__enableEmitter&&n.__enableEmitter(s),s.on("*",ds)}},unmounted(){const n=l.getCurrentInstance();if(!n)throw yt(ve.UNEXPECTED_ERROR);const s=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",ds),delete this.__v_emitter),this.$i18n&&(s.__disableEmitter&&s.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,s.__disposer&&(s.__disposer(),delete s.__disposer,delete s.__extender),t.__deleteInstance(n),delete this.$i18n}}}function Ah(i,e){i.locale=e.locale||i.locale,i.fallbackLocale=e.fallbackLocale||i.fallbackLocale,i.missing=e.missing||i.missing,i.silentTranslationWarn=e.silentTranslationWarn||i.silentFallbackWarn,i.silentFallbackWarn=e.silentFallbackWarn||i.silentFallbackWarn,i.formatFallbackMessages=e.formatFallbackMessages||i.formatFallbackMessages,i.postTranslation=e.postTranslation||i.postTranslation,i.warnHtmlInMessage=e.warnHtmlInMessage||i.warnHtmlInMessage,i.escapeParameterHtml=e.escapeParameterHtml||i.escapeParameterHtml,i.sync=e.sync||i.sync,i.__composer[dh](e.pluralizationRules||i.pluralizationRules);const t=Sl(i.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(n=>i.mergeLocaleMessage(n,t[n])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(n=>i.mergeDateTimeFormat(n,e.datetimeFormats[n])),e.numberFormats&&Object.keys(e.numberFormats).forEach(n=>i.mergeNumberFormat(n,e.numberFormats[n])),i}const El={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:i=>i==="parent"||i==="global",default:"parent"},i18n:{type:Object}};function $b({slots:i},e){return e.length===1&&e[0]==="default"?(i.default?i.default():[]).reduce((n,s)=>[...n,...s.type===l.Fragment?s.children:[s]],[]):e.reduce((t,n)=>{const s=i[n];return s&&(t[n]=s()),t},Me())}function Th(){return l.Fragment}const Ph=l.defineComponent({name:"i18n-t",props:tt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:i=>je(i)||!isNaN(i)}},El),setup(i,e){const{slots:t,attrs:n}=e,s=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Me();i.locale&&(o.locale=i.locale),i.plural!==void 0&&(o.plural=ie(i.plural)?+i.plural:i.plural);const a=$b(e,r),c=s[yl](i.keypath,a,o),u=tt(Me(),n),h=ie(i.tag)||Pe(i.tag)?i.tag:Th();return l.h(h,u,c)}}});function Nb(i){return We(i)&&!ie(i[0])}function Qh(i,e,t,n){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Me();i.locale&&(o.locale=i.locale),ie(i.format)?o.key=i.format:Pe(i.format)&&(ie(i.format.key)&&(o.key=i.format.key),a=Object.keys(i.format).reduce((d,m)=>t.includes(m)?tt(Me(),d,{[m]:i.format[m]}):d,Me()));const c=n(i.value,o,a);let u=[o.key];We(c)?u=c.map((d,m)=>{const O=s[d.type],w=O?O({[d.type]:d.value,index:m,parts:c}):[d.value];return Nb(w)&&(w[0].key=`${d.type}-${m}`),w}):ie(c)&&(u=[c]);const h=tt(Me(),r),f=ie(i.tag)||Pe(i.tag)?i.tag:Th();return l.h(f,h,u)}}const Eh=l.defineComponent({name:"i18n-n",props:tt({value:{type:Number,required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return Qh(i,e,rh,(...n)=>t[kl](...n))}}),$h=l.defineComponent({name:"i18n-d",props:tt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return Qh(i,e,ih,(...n)=>t[wl](...n))}});function Rb(i,e){const t=i;if(i.mode==="composition")return t.__getInstance(e)||i.global;{const n=t.__getInstance(e);return n!=null?n.__composer:i.global.__composer}}function Vb(i){const e=o=>{const{instance:a,value:c}=o;if(!a||!a.$)throw yt(ve.UNEXPECTED_ERROR);const u=Rb(i,a.$),h=Nh(c);return[Reflect.apply(u.t,u,[...Rh(h)]),u]};return{created:(o,a)=>{const[c,u]=e(a);Yt&&i.global===u&&(o.__i18nWatcher=l.watch(u.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=u,o.textContent=c},unmounted:o=>{Yt&&o.__i18nWatcher&&(o.__i18nWatcher(),o.__i18nWatcher=void 0,delete o.__i18nWatcher),o.__composer&&(o.__composer=void 0,delete o.__composer)},beforeUpdate:(o,{value:a})=>{if(o.__composer){const c=o.__composer,u=Nh(a);o.textContent=Reflect.apply(c.t,c,[...Rh(u)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function Nh(i){if(ie(i))return{path:i};if(xe(i)){if(!("path"in i))throw yt(ve.REQUIRED_VALUE,"path");return i}else throw yt(ve.INVALID_VALUE)}function Rh(i){const{path:e,locale:t,args:n,choice:s,plural:r}=i,o={},a=n||{};return ie(t)&&(o.locale=t),je(s)&&(o.plural=s),je(r)&&(o.plural=r),[e,a,o]}function Lb(i,e,...t){const n=xe(t[0])?t[0]:{};($e(n.globalInstall)?n.globalInstall:!0)&&([Ph.name,"I18nT"].forEach(r=>i.component(r,Ph)),[Eh.name,"I18nN"].forEach(r=>i.component(r,Eh)),[$h.name,"I18nD"].forEach(r=>i.component(r,$h))),i.directive("t",Vb(e))}const Mb=oi("global-vue-i18n");function Vh(i={},e){const t=__VUE_I18N_LEGACY_API__&&$e(i.legacy)?i.legacy:__VUE_I18N_LEGACY_API__,n=$e(i.globalInjection)?i.globalInjection:!0,s=new Map,[r,o]=Db(i,t),a=oi(process.env.NODE_ENV!=="production"?"vue-i18n":"");function c(d){return s.get(d)||null}function u(d,m){s.set(d,m)}function h(d){s.delete(d)}const f={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},async install(d,...m){if(process.env.NODE_ENV!=="production"&&(d.__VUE_I18N__=f),d.__VUE_I18N_SYMBOL__=a,d.provide(d.__VUE_I18N_SYMBOL__,f),xe(m[0])){const g=m[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let O=null;!t&&n&&(O=Wb(d,f.global)),__VUE_I18N_FULL_INSTALL__&&Lb(d,f,...m),__VUE_I18N_LEGACY_API__&&t&&d.mixin(Eb(o,o.__composer,f));const w=d.unmount;if(d.unmount=()=>{O&&O(),f.dispose(),w()},process.env.NODE_ENV!=="production"){if(!await _b(d,f))throw yt(ve.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const p=ol();if(t){const b=o;b.__enableEmitter&&b.__enableEmitter(p)}else{const b=o;b[un]&&b[un](p)}p.on("*",ds)}},get global(){return o},dispose(){r.stop()},__instances:s,__getInstance:c,__setInstance:u,__deleteInstance:h};return f}function Kt(i={}){const e=l.getCurrentInstance();if(e==null)throw yt(ve.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw yt(ve.NOT_INSTALLED);const t=Bb(e),n=Ib(t),s=mh(e),r=vb(i,s);if(r==="global")return gh(n,i,s),n;if(r==="parent"){let c=Zb(t,e,i.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&Ti(kr(Ui.NOT_FOUND_PARENT_SCOPE)),c=n),c}const o=t;let a=o.__getInstance(e);if(a==null){const c=tt({},i);"__i18n"in s&&(c.__i18n=s.__i18n),n&&(c.__root=n),a=Cl(c),o.__composerExtend&&(a[xl]=o.__composerExtend(a)),Ub(o,e,a),o.__setInstance(e,a)}return a}function Db(i,e,t){const n=l.effectScope(),s=__VUE_I18N_LEGACY_API__&&e?n.run(()=>Ql(i)):n.run(()=>Cl(i));if(s==null)throw yt(ve.UNEXPECTED_ERROR);return[n,s]}function Bb(i){const e=l.inject(i.isCE?Mb:i.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw yt(i.isCE?ve.NOT_INSTALLED_WITH_PROVIDE:ve.UNEXPECTED_ERROR);return e}function vb(i,e){return pr(i)?"__i18n"in e?"local":"global":i.useScope?i.useScope:"local"}function Ib(i){return i.mode==="composition"?i.global:i.global.__composer}function Zb(i,e,t=!1){let n=null;const s=e.root;let r=Fb(e,t);for(;r!=null;){const o=i;if(i.mode==="composition")n=o.__getInstance(r);else if(__VUE_I18N_LEGACY_API__){const a=o.__getInstance(r);a!=null&&(n=a.__composer,t&&n&&!n[ph]&&(n=null))}if(n!=null||s===r)break;r=r.parent}return n}function Fb(i,e=!1){return i==null?null:e&&i.vnode.ctx||i.parent}function Ub(i,e,t){let n=null;l.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,n=ol();const s=t;s[un]&&s[un](n),n.on("*",ds)}},e),l.onUnmounted(()=>{const s=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(n&&n.off("*",ds),s[hs]&&s[hs](),delete e.vnode.el.__VUE_I18N__),i.__deleteInstance(e);const r=s[xl];r&&(r(),delete s[xl])},e)}const Xb=["locale","fallbackLocale","availableLocales"],Lh=["t","rt","d","n","tm","te"];function Wb(i,e){const t=Object.create(null);return Xb.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw yt(ve.UNEXPECTED_ERROR);const o=l.isRef(r.value)?{get(){return r.value.value},set(a){r.value.value=a}}:{get(){return r.get&&r.get()}};Object.defineProperty(t,s,o)}),i.config.globalProperties.$i18n=t,Lh.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw yt(ve.UNEXPECTED_ERROR);Object.defineProperty(i.config.globalProperties,`$${s}`,r)}),()=>{delete i.config.globalProperties.$i18n,Lh.forEach(s=>{delete i.config.globalProperties[`$${s}`]})}}if(hb(),L0(d0),M0(E0),D0(Iu),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const i=an();i.__INTLIFY__=!0,p0(i.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const Mh="3.7.8",qb=Mh,Rn=typeof Buffer=="function",Dh=typeof TextDecoder=="function"?new TextDecoder:void 0,Bh=typeof TextEncoder=="function"?new TextEncoder:void 0,jb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ps=Array.prototype.slice.call(jb),xr=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(ps),zb=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,at=String.fromCharCode.bind(String),vh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Ih=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Zh=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Fh=i=>{let e,t,n,s,r="";const o=i.length%3;for(let a=0;a<i.length;){if((t=i.charCodeAt(a++))>255||(n=i.charCodeAt(a++))>255||(s=i.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=t<<16|n<<8|s,r+=ps[e>>18&63]+ps[e>>12&63]+ps[e>>6&63]+ps[e&63]}return o?r.slice(0,o-3)+"===".substring(o):r},$l=typeof btoa=="function"?i=>btoa(i):Rn?i=>Buffer.from(i,"binary").toString("base64"):Fh,Nl=Rn?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let n=0,s=i.length;n<s;n+=4096)t.push(at.apply(null,i.subarray(n,n+4096)));return $l(t.join(""))},Sr=(i,e=!1)=>e?Ih(Nl(i)):Nl(i),Yb=i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?at(192|e>>>6)+at(128|e&63):at(224|e>>>12&15)+at(128|e>>>6&63)+at(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return at(240|e>>>18&7)+at(128|e>>>12&63)+at(128|e>>>6&63)+at(128|e&63)}},Gb=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Uh=i=>i.replace(Gb,Yb),Xh=Rn?i=>Buffer.from(i,"utf8").toString("base64"):Bh?i=>Nl(Bh.encode(i)):i=>$l(Uh(i)),Vn=(i,e=!1)=>e?Ih(Xh(i)):Xh(i),Wh=i=>Vn(i,!0),Kb=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Hb=i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return at((t>>>10)+55296)+at((t&1023)+56320);case 3:return at((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return at((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},qh=i=>i.replace(Kb,Hb),jh=i=>{if(i=i.replace(/\s+/g,""),!zb.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t,n,s=[];for(let r=0;r<i.length;)e=xr[i.charAt(r++)]<<18|xr[i.charAt(r++)]<<12|(t=xr[i.charAt(r++)])<<6|(n=xr[i.charAt(r++)]),t===64?s.push(at(e>>16&255)):n===64?s.push(at(e>>16&255,e>>8&255)):s.push(at(e>>16&255,e>>8&255,e&255));return s.join("")},Rl=typeof atob=="function"?i=>atob(Zh(i)):Rn?i=>Buffer.from(i,"base64").toString("binary"):jh,zh=Rn?i=>vh(Buffer.from(i,"base64")):i=>vh(Rl(i).split("").map(e=>e.charCodeAt(0))),Yh=i=>zh(Gh(i)),Jb=Rn?i=>Buffer.from(i,"base64").toString("utf8"):Dh?i=>Dh.decode(zh(i)):i=>qh(Rl(i)),Gh=i=>Zh(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),Vl=i=>Jb(Gh(i)),ey=i=>{if(typeof i!="string")return!1;const e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Kh=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),Hh=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Kh(t));i("fromBase64",function(){return Vl(this)}),i("toBase64",function(e){return Vn(this,e)}),i("toBase64URI",function(){return Vn(this,!0)}),i("toBase64URL",function(){return Vn(this,!0)}),i("toUint8Array",function(){return Yh(this)})},Jh=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Kh(t));i("toBase64",function(e){return Sr(this,e)}),i("toBase64URI",function(){return Sr(this,!0)}),i("toBase64URL",function(){return Sr(this,!0)})},ty={version:Mh,VERSION:qb,atob:Rl,atobPolyfill:jh,btoa:$l,btoaPolyfill:Fh,fromBase64:Vl,toBase64:Vn,encode:Vn,encodeURI:Wh,encodeURL:Wh,utob:Uh,btou:qh,decode:Vl,isValid:ey,fromUint8Array:Sr,toUint8Array:Yh,extendString:Hh,extendUint8Array:Jh,extendBuiltins:()=>{Hh(),Jh()}},iy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACOZJREFUeF7tnUF2ozoQRYGNJT2Nvacke3KYJr0x00f9zYnb346FwKpXpZtJD1qgp1fvusAhqO/4wQEcuOlAjzc4gAO3HQAQ0oEDPzgAIMQDBwCEDOBAmQN0kDLfOKoRBwCkkUKzzDIHAKTMN45qxAEAaaTQLLPMAQAp842jGnFAGpD9fv+c6nA8Hv/+y892DgzD8HU4HL62O2PMM0kBkoBIMPR9/zRNE1DUydz7OI5vdabyN4sMILvd7hMozAIEJDesNwckdY1pml6BwwyOeWIguVICU0BeXl5Sa381jwYCgEStgwCHLJV0krPSmHWQl5eXSTYiCAOSUwZMAOGG3AWBQNJ1XXVAuLRyAQf3JFYdhO7hCpAktulOYtFBuPdwx0i7kFQF5PSb8k9/+UBxq52kKiDcf7gHrbnLLXlAhmH4xUN168HasHs3BUlVQApu0JsqxnoMfj4DkCx3uCogBb8cBJDlNf3xCCBZZiiALPMrxGggyS8jgOR7FWokkOSVE0DyfAo5CkjulxVA7nsUegSQ/FxeAAkd/7zFAcltnwAkL0PhRwHJ9RIDSPjo5y8QSP7vFYDk56eJkUDyb5kBpInYL1skkHz7BSDLstPMaCD5r9QA0kzkly8USABkeWoaO6J1SOggjQW+ZLktQwIgJYlp8JhWIQGQBsNeuuQWIQGQ0rQ0elxrkABIo0Ffs+yWIAGQNUlp+NhWIAGQhkO+duktQAIga1PS+PHRIQGQxgO+xfIjQwIgWySEc3RRIQEQwr2ZAxEhAZDN4sGJkgPRIAEQcr25A5EgAZDN48EJI3USACHPD3MgQicBkIfFgxNH6CQAQo4f7oDnTgIgD48HE2zZSWrvFwMg5LeaA1t0kr7vvz4+Pn7VEg0gtZxmnr8OrIUEQP4NEhvoBARrLSTjOFb7YK82UaozO0wFTHvhktZAAiDfptNBCgPo4bBSSAAEQDzkexONJVuDAwiAbBI+DycBkLMqcQ/iIbJ1NQIIgNRNnLPZAARAnEW2rlwAAZC6iXM2G4AAiLPI1pULIIEBSd/j141T2WyHw+Gr7MjHHwUgwQDZ7XafaUnTNLmAY7Y/PcM0TdPvcRzfHh/7/BkAJBAgCQ5vYFxGtfbDfvdQAZAggESA47yb1Hxk/CdIACQAICVFvPfJaf3/tf/w6NZ6S7zlUZNvNyUeViwpojUA9+ZXudQq8RZA9ACZ7gXO4//XDBodJCMhXp/FKtCd4Yb9EAC5XwP+YOq+RyV/6JVxVvMhbi9fa4INIBk5DdpBACSj9gCSYVI0QFRu0JP13KTH+Jo3zE26EhwAcvHpXPBJrHIZ4B6QBEYqh8ovCOdo0EHa7CDvwzDIPCDIw4oZ19E3hnAPkuGd186XsTTzIXSQRjuI2lOz5iTcEAAgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgbQIilcd585z0Igm1FzgACIBIwdJ1ncSrlGZTAARA1ABJemQgARAAUQSkYwOdvLLwXqwMnwrei5VxVtshKq8gpYPQQWxJuDE7gOSVhQ6S4VPEDpKWXXOfjVs200HoIBkI1h9CB8nznA6S4VPQDiLxTRYdhA6SgWD9IQqXV2nVAAIg9dN/Z0aVr3gB5KJQBZcqKpcB7jfQSaVI9x19378rPW5CB2mwg8zPPqm0jnkzHyUwZm8ApEFAlB7lUIGUr3kzKtHQJZbEpWFGScyH0EHoIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQDSICBqL21IJRjH8c2chisCAKRBQBSDOGtSeidW0gQgACLHixIkAAIgcoAkQSqQAAiASAKi8u4uAAEQSUDY/iCvLGx/kOFTwQvvMs5qP0ThDe90kAAdZLfbfU7T9Gwf6W0VAMh9P+kg9z3qggIi8XpUOkiADrLf75+Px+NnBkuehgBIRrXoIBkmlf5CK/PUFsMk4Cj1tealIYAsiGfJ5cCC09caKgMHgFyUvODbIKlipuWcLree+75/8nLjPu8slfSrbaJT8qFDB/kGSw6QWh/zrcwDIAFu0lsJq8U6AQRALHLnZk4AARA3YbUQCiAAYpE7N3MCCIC4CauFUAABEIvcuZkTQADETVgthAIIgFjkzs2cAAIgbsJqIRRAAMQid27mBBAAcRNWC6EAAiAWuXMzJ4AAiJuwWggFEACxyJ2bOQEEQNyE1UIogACIRe7czAkgAOImrBZCAQRALHLnZk4AARA3YbUQCiAAYpE7N3MCCIC4CauFUAABEIvcuZkTQADETVgthAIIgFjkzs2cAAIgbsJqIRRAAMQid27mBJCzUi3dZ0NlmzA3aXModCkgtTNR9e3uSwE51Zv38zoMfo7kwn1XquahKiCFhuR4zZh2HACQdmrNSpc6UHt/96odJJlRsEfIUg8ZH9iBmnuDJBurA1J4HxK45Cwt14HaN+gmgHAfkhsHxl1xoOr9hwkgaVK6COFf6oBF9zADhC6yNB6Mr33vMTte/R5knhhICP0CB6pfWpkDcvpG663rutcFRjG0PQfM4DC7xDqvMZ2kvcTnrHjeutp622qzS6xLk5Y+k5NjMmN8OmB1Q37NLRlAzi65ur7vn6ZpevZZXlSXOJCgmKbp9zAMX9Zd41y/FCDXjD11lhLPOUbcgQRDkqgExKVl8oCI1xh5wR0AkOAFZnnrHACQdf5xdHAHACR4gVneOgcAZJ1/HB3cAQAJXmCWt84BAFnnH0cHdwBAgheY5a1zAEDW+cfRwR0AkOAFZnnrHPgDE4eAQaFl6p8AAAAASUVORK5CYII=",ny="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACZVJREFUeF7tnUt2IjkQRcncWJen2Huya0/A1O6NoW5RUGAwkAqFPhG6nnTXOalPPL2boRBJMq34QwEUuKvAhDYogAL3FQAQ3IECDxQAEOyBAgCCB1BApgAZRKYbrQZRAEAGWWjClCkAIDLdaDWIAgAyyEITpkwBAJHpRqtBFGgKyNvb26+o836/P/yXv3YKzPP8tdlsvtrNoM+RmwASwQghvIcQAKM/X/ze7XYf/U2rzYyqAxLh2O/3n23CZdSFCgDJUajqgKzX67BwkbisrQJAslqtqgKyXq9j6n5vu+6MnqDA8JAASIJbBr10aEhqA8L2yiBl8zy/jHrCBSAGDdtiyqNCAiAt3GZwzGmavrbb7YvBqWdNGUCy5Bur8YiQAMhYHteIdqiiHUA0LDNeH8NAAiDjmVsr4iEg6R2QIRZBy7Ep/Wg88jPCyRaApLjK2bUaTzZ4hwRAnJk+NZxcSLyfbAFIqqMcXg8k9xcVQBwaXhLS6+vrZ+b3c1zWiwAicZPTNkByu7AA4tTskrA0Trb+/wqFq0wCIBInOW6jAYmnky0AcWx2aWi5RXsc1wskACJ1kfN2uZB4Of4FEOdGzwkPSOp/Jz31G4WuCr4cs7ZqO/rJFhmklfMMjTsyJABiyKitpqpxsmX1+BdAWrnO2LgakFg82QIQY0ZtOd3cot3i8S+AtHScwbFzIbF2/AsgBk3aesojQQIgrd1mdPxRTrYAxKhBe5j2CJAASA9OMzoHjZOt3o9/AcSoOXuZtgYkPR//AkgvTjM8j9yivefjXwAxbMyepp4LSa/HvwDSk8uMz8UjJABi3JS9Td/byRaA9OYwB/PxBAmAODBkbyFonGz1cvwLIL25y8l8NCDp4fgXQJwYsscwcov2Ho5/AaRHZzmaUy4krY9/AcSRGXsNxTIkANKrq5zNy+rJFoA4M2LP4ViEBEB6dpSzuVk82QIQZybsPZxcSGoX7QDSu6Mczi+naAeQ74bgzYoOAYkh5UCy2+2q3dirDXQUhVePOjW8JCwpJAByVpsMInGeoTaSky0AARBDFs+bqiSLAAiA5LnOUGsAuVis9XpNDWLIvDWmCiAAUsNnZscAEAAxa94aEwcQACnqs/jJdNEBjp1vNpuvEuMACICo+ypCEUJ4DyFUgeMigN/x/3e73YdWUAACIFpeOvQjMZTqBP50pvb5lCQejnk55v3R0xIzFYDj1KUKJJKYAARA7gGSekxekI/DViv7USUAYYulYlKJkVQGftCJxltHJHFpgLlUm+w7wNKBjvvn1DugShpPmWOv10qMVDoWjUfPJXEBCFusG29LHuoDkHwFyCD5GlbpAUDOMpNByCBkkAe3HQABEAABkEU7E4r0o0xssdhi/UQMgADIjS/YYrHFyt5ixSPYaZoOz04t/Ut9votj3qXKLryOL0wtFOqHy1K3WBLz1hjjOjQ+B7lQBEAABEAeeABAAARAAEROwYOWNbY/NcYAEAABkAQFqEGoQRLscv/SGnf3GmOQQcggKkBcd1LDvDXGABAAOShwepnCfr/X+t74ewp5HPOmqHX/Wp7m1dHxby9xTz1N0z8NXqjwLRIA0VlYANHR8dCLpOBUHB5ACogJIEqi9gRHDIkMorOwAKKjY8weqV8nVhr5524AREdeAFHQsbfsQQZRWNRjFwCioCWAyEWUaMfj7me9TXwfJPXzA7mdlrdki7Vcq0dXkkEUdAQQuYhkkAvtBIUsGUToPTKIULirZmQQBR3JIHIRySBkELl7MlqSQTLEu2hKBlHQkQwiF5EMQga5cU+vd/dU0CVxXIsBIAACIA8SDIAACIAAyLI9KMe8f3SSbE1qbH9qjMEW6/HdIvWBPpefgwDI2SRssdhiscVii8UWK+UbhGQQMsiPxFCDUINQgxioQeILFRRfphAjdvFCBYr0W/MO9Ul6qgGWbRzTr2KLxRaruy1WL3BwzPvdGpxidXCK1RMcAAIgd/ccLYr0Y73xmb4RKteCLRZbrG62WJIUXg4NTrE4xersFAtAluOeuhWVZEIA6QyQ1EVfbif5lRJjpcbR6xgAAiBPyenVvDUgBBAAAZCnClCkd1Okp94VE9ZWfCkZBEAA5AE+AAIgAAIgizKs5JSRV4+epc3+wlTqFmvku3sNrSjSjRfpABIW/2ScRCsAAZCnWwuJsWrc3WuMASAAAiBPFaBIN1ukj3x3J4Pc2tb9F6ZqLDpjJKSMq0s5xboQpMXj7ph3uXlraEUNQg3y1JEjb+MABEAA5KkCFOkU6XySvggTahBqkBujsMUig5BByCBkkEUKkEHIII/r0o/UF+/xsOJZUB5WPGpR4wi2xhicYnGK9TSxUoNQg1CDUIM8vVHECzjFMliDhBD+XbS654uSX17tZYztdvuSqNW3ywGkISCpe+qchR64bVadCCCNAAGOeshKaqrT7ACkASDAUQ+O00hSSACkMiASwevbyeeI8zy/bDabr5ToJOvF5yAZn4NIBE9ZUK69r4Aki0jWC0AyAGF71Q5hAMnUvsYXpgAkc5EymgNIhnjHD4VCYhfJR4g9/mBOYsyWL09eL7ZYlYt0AGnHF0V6pvY1tljHTJX8hGhmaDRfrZKzh3StKNIzivScD6BwuVgBERwAcqV3rQxyBUn8Z9KzUmKbDNQwFuQx3Gmafqd+9nEpEzVI5RpkII+6CBVAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdA8gBxYQKC0FWAd/Pq6klvzhQAEGcLSji6CgCIrp705kwBAHG2oISjqwCA6OpJb84UcAsIP7DpzKmNwgGQRsIzrAkFxL9mJYlukjSStuEHNqXK0e5CAb+AxCAFP8OGO1DgrwI1t1dx0KoZJA5IFsHtUgUkPzMtHevUrjogJ0hCCO8hhF+5AdDevwLxB0NzfyxUqlITQC4ne3xYTTp/2jlWYJ7nwy/p5vyKbq48zQHJDYD2KFBSAQApqS59m1cAQMwvIQGUVABASqpL3+YVABDzS0gAJRUAkJLq0rd5BQDE/BISQEkFAKSkuvRtXgEAMb+EBFBSAQApqS59m1fgP2rmXn0Q5oqWAAAAAElFTkSuQmCC",sy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACM5JREFUeF7tnUF24joQRWNvLMkUsqd09gRMQ28M/SM+JHRikFWWSyXVzSQDJKvq6V2XhH3Q8MQfCqDAXQUGtEEBFLivAIDgDhR4oACAYA8UABA8gAIyBaggMt3o5UQBAHEy0aQpUwBAZLrRy4kCAOJkoklTpgCAyHSjlxMFTAPy9vb2EufhdDqd//NXToFxHI+73e5Y7op9XskUIBGICMMwDM8hBKDQ8dzH4XD4ozNUe6OYAWS73X4CRTUDAckd6asDEqtGCOEdOKrBcR0YSCamoCogm80mlvb36tYgACCxVkGAwyyVVJKbqalWQTabTTBrEQIDkosHqgDChrwJAoHk6elJHRCWVk3AwZ6kVgWhejQFSAzWdSWpUUHYezTHiF9IVAG5PCn/bM8fROy1kqgCwv6jedDcLbfMAzKO4ysv1S0Hq2D1dgWJKiCCDbqryViOweMrAEm+wqqACB4OAkj+nD7sASR5ggJInl5dtAaS+dMIIPO16qolkMybTgCZp1OXrYAkPa0Aktao6xZA8nh6AaRr+89LDkju6wQg8zzUfSsgmZ5iAOne+vMTBJLfWgHIfP+4aAkk/04zgLiwfV6SQPKtF4DkecdNayD5f6oBxI3l8xMFEgDJd42zHt4hoYI4M7wkXc+QAIjEMQ77eIUEQByaXZqyR0gAROoWp/28QQIgTo2+JG1PkADIEqc47usFEgBxbPKlqXuABECWusR5/94hARDnBi+Rfs+QAEgJh3CNp14hARDMXUyBHiEBkGL24EJRgd4gARB8XVyBniABkOL24II9VRIAwc+rKdBDJQGQ1ezBhXuoJACCj1dXoOVKAiCr24MBSlYS7fNiAAT/qilQopIMw3Dc7/evWkEDiJbSjHNWYCkkAPKvkThAp0OwlkJyOBzUbuxqA8V55oSpDt0uTGkJJADyLToVRGjAFrpJIQEQAGnB30VilBwNDiAAUsR8LVwEQG5miT1IC5bVjRFAAETXcY2NBiAA0phldcMFEADRdVxjowEIgDRmWd1wAaQTQOJ39rrWWW+03W53XO/qeVcGkIYBiVCEEN5jCiGEbgC5mZKPcRyPNYEBkEYBkT7lzbt/2mit/Qr5bdYA0iAgnuC4Tk8tSACkQUAkk2ajFsij0H6N/BqpRGteNfme5yovKwqe+MudaaQngExPBK+7T+jiEZAoQ41lFhWksSWWx/1HzX0IgACIkUVUOgwqyG+NWGL90IQKovsQkQpCBUnfuo20oIJQQZJWpIJQQW5NwhKLJdaXAlQQKshaFeT8TlPy4ooNTqdTfHfs/B7Z3D8AAZCkVyRLrBrGSiXSSh5s0h1s0gEkhev9zwEEQOTuWdCTCrJAvJuubNILbNKpIHIzUkGoIHL3LOhJBVkgHhXkvnitGCs1/a3kQQWhgqS8vMrnAFJGVvYg7EG+FKixl6KCUEHK3Moyr0IFyRTsTnMqCBWECvKAJQABEAABkPnltpWlSSqjVvJgD8IeJOXlVT4HkDKyssRiicUSiyXW/LtJK3feVEat5MESiyVWysurfA4gZWRlicUSiyUWS6z5d5NW7rypjFrJgyUWS6yUl1f5HEDKyMoSiyUWSyyWWPPvJpI77/yr227Jy4q/54cKUqCC2Lb9/OgABECSbqGC8MNxtyahglBB2IOwB0kWjq8GVBAqCBXkAS8AAiAAAiCTCrBJZ5OeXGt5riCah2NeJ4In6Q6epCepa6NBrQNT/+T+yLYmyHyLxbdYVwUAZOJGBiAAEhWoAkccmCUWSyyzC6x4NnoI4e/hcIjLnCp/AOIAkKvRqjhMMOj1sJ/dTvcr3alQAcQBIDW+HhVwYbILgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASCNARLD3Ww2IcdNmudV5MTVQlsAaRCQ7Xb7GUJ4mWOw+MPV+/3+dU5b2vxWAEAaBCTzGLZqZ2v0AByANAjIZZk152gw4FhIKYA0CsgMSIBjIRwzNJ4cQXPPxxFsiUm+LLdehmF4jk3jiUzxABoLh88U8Gf1S1BBGq4g1d3jIAAAARAHNpenCCAAInePg54AAiAObC5PEUAARO4eBz0BBEAc2FyeIoAAiNw9DnoCCIA4sLk8RQABELl7HPQEEABxYHN5igACIHL3OOgJIADiwObyFAEEQOTucdATQADEgc3lKQIIgMjd46AngACIA5vLUwQQAJG7x0FPAAEQBzaXpwggACJ3j4OeAAIgDmwuTxFAAETuHgc9AQRAHNhcniKAAIjcPQ56AgiAOLC5PEUAARC5exz0BBAAcWBzeYoAAiBy9zjoCSA3k5xz7kbsxtkb/ROSC4i2J1R/vDoXkIs9+BX1TjnJPIflqoKqH1QBEQrSqT1IS6gAgAiFo5sDBcZxfNU8ekK1gsT5yz0g08Gck2KGApqH55z3wRmxFWkq3IcUGZuLtK2A9ga9CiDsQ9o2aeXoVfcfVQCJg1JFKtusweFrVI9qgFBFGnRo5ZC19x7XdNX3INeBgaSy49oaXn1pVR2Qyzdac84ib2sqiba0AtXgqLbEulWQSlLaT31cL+45hmH40HzmMaVctSXWz2By38npwwZkMWnKYTju9/tXC+qYAeRmyRVfUnwOIbxYEIgYdBSIFSOE8Hccx2PtqnGbsSlApqbiUll0ZolRVBWIMMQBLQHxUwDzgKjOGIOhwA8FAARLoMADBQAEe6AAgOABFJApQAWR6UYvJwoAiJOJJk2ZAgAi041eThQAECcTTZoyBQBEphu9nCgAIE4mmjRlCvwHktvoUMXJI94AAAAASUVORK5CYII=",ry="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAC95JREFUeF7tnVF22zgMRSNvrM1v0j2l2ZPr37gbs2boSo3qWBYJESBB3v505lQSwcd3CUCyreGJPyiAAqsKDGiDAiiwrgCA4A4UeKAAgGAPFAAQPIACMgXIIDLdOKsTBQCkk4VmmjIFAESmG2d1ogCAdLLQTFOmAIDIdOOsThSoGpAfP358D+twuVyuf/MnnwKHw+F8PB7P+a7Y5pWqAiQAEWAYhuHbOI5AYeO599Pp9NNmKH+jVAPI6+vrB1AUMxCQrEhfHJCQNcZxfAOOYnDMAwPJnSUoCsjLy0tI7W/FrUEAQFJbBgGOaqkkkyyWplgGeXl5Gau1CIEByeSBIoDQkLsgEEienp7MAaG0cgEHPUmpDEL2cAVICLbrTFIig9B7uGOkX0hMAZmelH/48wcR95pJTAGh/3APWnflVvWAHA6HZz5Utx+sjNm7K0hMARE06F0txn4MHl8BSNIVNgVE8HAQQNLX9OEZQJImKICk6dXE0UASv4wAEq9VU0cCSdxyAkicTk0eBSTbywog2xo1fQSQPF5eAGna/nGTA5J1nQAkzkPNHwUk95cYQJq3fvwEgeSrVgAS758ujgSSf5cZQLqwfdokgeRTLwBJ8043RwPJn6UGkG4snz5RIAGQdNd0dkbvkJBBOjO8ZLo9QwIgEsd0eE6vkABIh2aXTrlHSABE6pZOz+sNEgDp1Oh7pt0TJACyxykdn9sLJADSscn3Tr0HSABkr0s6P791SACkc4PnmH7LkABIDodwjadWIQEQzJ1NgRYhAZBs9uBCQYHWIAEQfJ1dgZYgAZDs9uCCLWUSAMHPagq0kEkARM0eXLiFTAIg+FhdAc+ZBEDU7cEAOTOJ9ftiAAT/mimQI5MMw3D+9evXs1XQAGKlNONcFdgLCYD8ayReoNMgWHshOZ1OZhu72UBhnXnDVINuF05pDyQA8ik6GURoQA+nSSEBEADx4O8sMUpeDQ4gAJLFfB4uAiCLVaIH8WBZ2xgBBEBsHedsNAABEGeWtQ0XQADE1nHORgMQAHFmWdtwAQRAbB3nbDQAARBnlrUNF0AAxNZxzkYDEABxZlnbcAEEQGwd52w0AAEQZ5a1DRdAAMTWcc5GAxAAcWZZ23ABBEBsHedsNACpHJDwpZ1xHN9CmOM4/g5/Hw6H8/F4PDvz2q5wgw6TBm/jOIb/fg//fzqdfu668MbJAFIpIBHfZuvm24xbJtX8qZ2tse/xxRemPlVRMWkEHHMEKuNr7sip1441qBYkseMv5wUgyoC8vr5+TGXEpp+0jLE5sNEBsV9i0/q5HQCpsMSKNcXUjzy32o+kmlNjs0iNYeqLzH6Nx2ygMLEUY05cZS9xal8Qo8RxHSYlk2ptFrWvB4BEOFJj54wYVv0QNqxtibsDJKFB/6tei4BIdAi3fnPf9iWDVNaDSIyh1aBu7196R0iMCSB663G9cg0pXRIHgPwxhsbtVQmoGnGsWb+7EkvSnGqZQ3k/enh5wWYFINoLJliU7DWvFJDW+pBa1oIMUlkPEsKR9CEtASIxpUb/MZW74bNe18/Cxf6hxPpUSiWDSABpqQ+RAKK1QUhiARBlQHpv1FMfEGr2YABSYYkl7UMsd67YckNyXGr/oZk9AaRSQCQLo1VmzBKF0k/7c1+S8lKr/6AHudneUncuzYWpxSg3X9i6fmkp7Njhy1u5n1pLDam5DpKNyjKTd/kcZOY2FViNUmMrhtxZS2LI3DEs901JPABi0KTX0IfENMu5oYwZ87av0TQkgFTag0gBybWbphgjJyRbGesWjpxj37uhkKLDfL4msF/mL7kLIj0ndXE0a98wB0kfkgMQiSlyjCuZr/YaSLQAEKMSS2KYHDuqxBSlxgUQaToQnFdbBinxwFACxyz13iwiGVt7t64xpqW1u76LJe1D9phGYoh5wfZmEcEGpfIJXu5irWQXwQKpfBZrGZ7kro50J98DR44sUqP+Ek32bFCphU/3GUTSh5QERJpFJEbU7j+kDy4BxKhJl97JkphUaNC7G54EUMn4knFSd2hJXABiCIhVoy4xwprZJIBKSkkLI0p0sYjrb9+XSvye42usgS0adYkJtnRO3d1TtZdAuBXzvX+XaAMg9hkk+VttKQaVmGDLbCkGlvRZFv0HPcjNKqfuYlaLpGkgDThS72gJY1C/gwggTgDR7EOE5txKINd/j80ikhhSMmRUsOu3/pOzNyWWcYml1YdIjJlqthgj19qgk0EcZRCJibbMaQFITBZJLW1jrpkK8trxEo3IIAUyiKQPeQSIZOGlpnsUh2ReVr0fGcRRBpEY6dFOawmIQhwmDTqAOAIkZ6O+A473YRi+xb79ainvWhaRxGJZwtQeX/efxVqaTNKH3DOTZNGnON7DG3Yvl8tHarm1lkVS+48wLoB8qg8gCydKALnduffAMf+KiSSOMI17WUQAiFl5RYnlrMSS9CEagEjiuPdcRAgrgCx8SwZZiCEx5rK0ERoyRPDFlDmyiCSerVvXqaXf1vGSGC1LQADZmeW0AJHAeptFJJBZmo8Sa6f5LO/Hz6FKTSXZCefGfO0XFCWxLHuR1P7D8gHhrLdEN0uIySBfIU7+bFAoSy6XS/jZ0KT3XGwBsieLDMPwLrgbZtp/kEEcZhCpKbdq7ZV/3zSkNItMv+97/a3fhD+b8SRcK+pQMshCptSUX6LEmna1MWp19x+0aUhLYK0bdDKIwwwSQpbu2om8bMKxpy9KjOV6uGVtTw9yZ4W8ZJDaALHIIiUadDKI0wxiYMjo7GGYRZJjkmSp23PoQRz2IDUCUmNMAJJDAYeAKDfq4p1as/Qr0X9QYjktsZQbdTEgmlkEQO5nAx4UrmRJpd1aDIdyL7I7LmmxQQ/itMRS2q13G7HWuABEqgCAzArshkMri5R4QMhzEMfPQRaLl/OJejZAcmeRUv0HTbrjJj1zo54NjtxZpNQDQjJIGxkk+ZO9K5VodkAyZpHssaVU4zTpTnuQEHYmE6oZMNOdNrX4YkABEMeAZHpgqGbAHACXbNDpQZz3IBn6EDU4cvUiJRt0AAEQdUD2ZJHSDTqANADIDgOqw5Ehi5jFuNaP0IM470E8AOIhRgCJuGXh5QtTt1PxELfkjlbp/oMSq4ESS9iom5cugixiHuO9PZQSy3mJJXgeUsx4iWYrFucSlMSYr6daZj4+7h5RGsaWAjXcFYostaqAI1bX2yUCkE9FqlnIrcWsAY7Iu1puNF3buwCkUkAW5db38KKbOczwK4bH4/EcmYxMDptKl/Am3Guc4zj+Du8eqTTOpF+kBJCKATFxd0eD0IM00KR35FfzqQIIgJibztOAAAIgnvxqHiuAAIi56TwNCCAA4smv5rECCICYm87TgAACIJ78ah4rgACIuek8DQggAOLJr+axAgiAmJvO04AAAiCe/GoeK4AAiLnpPA0IIADiya/msQIIgJibztOAAAIgnvxqHiuAAIi56TwNCCAA4smv5rECCICYm87TgAACIJ78ah4rgACIuek8DQggAOLJr+axAgiAmJvO04AAAiCe/GoeK4AAiLnpPA0IIADiya/msQIIgJibztOAALJYrchfHv97Rk0/CO3JdJ5iTQXE2hOmrz9IBWRa6Kp+jdyT+WqPVfDSnzAlUz+YAiIUpPZ1Jj5bBQDEVm9G86TA4XB4tnyFg2kGCQsheCGmp/UjVmUFLN8NEqZiDoiwD1GWnct7UMC6QS8CCH2IBytWG6Np/1EEkDAoWaRaA1YbWInsUQwQski1Pqw2MOveYxbCvAeZBwaSar1YY2DmpVVxQKY7Wj//fwFr0htOa1w9YlJVoBgcxUqspZxkElVzub146DlqeL12sRLrduVSP5PjduUJfFOBUg35vcCqAWRRcj0Nw/BtHMfvm0pyQDMKBCjGcfx9OBzOlk/KtwSsCpB7wU6ZZWse/LtDBQIMIeyagLiVsXpAHK47ITekAIA0tJhMJb8CAJJfU67YkAIA0tBiMpX8CgBIfk25YkMKAEhDi8lU8isAIPk15YoNKQAgDS0mU8mvAIDk15QrNqQAgDS0mEwlvwL/AfRjWW6yHrZ9AAAAAElFTkSuQmCC",oy={xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.12",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",png:"image/png",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",mp3:"audio/mpeg",aac:"audio/aac",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",htm:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jsonld:"application/ld+json",mid:"audio/midi audio/x-midi",midi:"audio/midi audio/x-midi",mjs:"text/javascript",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",otf:"font/otf",rar:"application/x-rar-compressed",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"text/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip"},ef=()=>{function i(a,c){try{const u=decodeURI(a.headers["content-disposition"]);let h=c||u.split("filename*=utf-8")[1];const f=h.substring(h.lastIndexOf(".")+1),d=new Blob([a.data],{type:oy[f]??"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),O=(window.URL||window.webkitURL).createObjectURL(d),w=document.createElement("a");w.setAttribute("href",O);const g=h.lastIndexOf(".");h=`${h.slice(0,g)}_${Ve.dayjs().format("YYYYMMDD")+h.slice(g)}`,w.setAttribute("download",h),document.body.appendChild(w),w.click(),document.body.removeChild(w),window.URL.revokeObjectURL(O)}catch(u){console.error(u)}}function e({multiple:a=!1,acceptTypes:c=""},u){const h=document.createElement("input");h.style.display="none",h.setAttribute("type","file"),a&&h.setAttribute("multiple",a);const f="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xml";h.setAttribute("accept",c||f),document.body.appendChild(h),h.click(),h.addEventListener("change",d=>{u(d)&&document.body.removeChild(h)})}function t(a){return a?a.substring(a.lastIndexOf("/")+1):""}function n(a){return a?new URL(Object.assign({"../static/images/upload-excel.png":iy,"../static/images/upload-file.png":ny,"../static/images/upload-pdf.png":sy,"../static/images/upload-word.png":ry})[`../static/${a}`],self.location).href:""}function s(a,c,u){if(!c)return;let h=u||t(c);const f=h.lastIndexOf(".");h=`${h.slice(0,f)}_${Date.now()+h.slice(f)}`;const d=h.includes(".")?h.split(".").pop().toLowerCase():"";a({url:c,method:"GET",responseType:"blob"}).then(m=>{let O=m.data;if(O.type==="application/json"&&d!=="json"){const w=new FileReader;w.readAsText(O,"utf-8"),w.onload=function(){try{const g=JSON.parse(w.result);if(g.code&&g.code!==200&&g.code!==0){Ve.ElNotification.error({title:"错误",message:g.msg||"下载失败"});return}}catch(g){console.error("解析 JSON 失败:",g)}r(O,h)};return}r(O,h)})}function r(a,c){const u=URL.createObjectURL(a),h=document.createElement("a");h.style.display="none",h.href=u,h.download=c,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>{window.URL.revokeObjectURL(u)},1e3)}function o(a){if(!a)return;const c=document.createElement("input");c.value=a,document.body.appendChild(c),c.select(),document.execCommand("Copy"),c.remove(),Ve.ElNotification({title:"提示",message:"复制成功",type:"success",duration:2e3})}return{exportFile:i,importFile:e,getAssetsFileName:t,getAssetsFilePath:n,downloadBlob:r,downloadFile:s,copy:o}},tf={label:"name",value:"code",children:"children"},nf={label:"key",value:"value"},Cr={label:"name",value:"code",children:"children"},ly={year:"year",month:"month",date:"day"};/*! Element Plus Icons Vue v2.3.2 */var ay=l.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),cy=ay,uy=l.defineComponent({name:"Delete",__name:"delete",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),hy=uy,fy=l.defineComponent({name:"Download",__name:"download",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),dy=fy,py=l.defineComponent({name:"MoreFilled",__name:"more-filled",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"})]))}}),my=py,gy=l.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),Oy=gy;const MQ="",ct=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},_y={class:"a-loading"},Ar=ct({__name:"index",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("div",_y,[...t[0]||(t[0]=[l.createElementVNode("span",{class:"dot dot-spin"},[l.createElementVNode("i"),l.createElementVNode("i"),l.createElementVNode("i"),l.createElementVNode("i")],-1)])]))}},[["__scopeId","data-v-048c6c03"]]),BQ="",by={key:0,class:"table-link"},yy=["onClick"],wy={class:"no-image"},ky={key:4},sf=ct({__name:"index",props:{pageKey:{type:String,default:""},menuId:{type:String,default:""},defaultParams:{type:Array,default:()=>[]},matchData:{type:Object,default:()=>({})},maxHeight:{type:[String,Number],default:-1},tableConfig:{type:Object,default:()=>({})}},emits:["changeSelection","onClickRow","changeExpansionRow","refresh","load","operate"],setup(i,{expose:e,emit:t}){const n=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>i1),loadingComponent:Ar,delay:20}),s=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>s1),loadingComponent:Ar,delay:20}),r=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>o1),loadingComponent:Ar,delay:20}),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>c1)),a=l.defineAsyncComponent(()=>Promise.resolve().then(()=>f1)),{t:c}=Kt(),u=l.inject("actModules"),h=l.inject("apiPrefix"),f=l.inject("request"),d=l.inject("themeColor"),m=l.inject("cacheTokenType"),O=l.inject("cookieStorage"),w=l.inject("menuAuthButtons"),g=on.useRoute(),p=on.useRouter(),b=t,k=i,y=()=>({pageLoading:!1,tableLoading:!1,tableTotal:0,tableSelection:[],tableQuery:{pageIndex:1,pageSize:10},showFormDialog:!1,showEditorPreDialog:!1,dialogTitle:"",editorDialogTitle:"",dialogData:{}});let C=l.reactive(y()),T=l.ref("loading"),x=l.ref([]),A={},R=[],_=l.ref([]),S=l.ref([]),P=l.ref([]),Q=l.ref([]),E=l.ref([]),W=l.ref({});const B=l.ref(null),I=l.ref(null),G=l.ref(null),Z=l.ref(null),H=l.ref(0);let j=l.ref({});const z=$=>f({url:`${h}/sysOperate/getMenuOfOperateByRole`,method:"post",data:$}),me=$=>f({url:`${h}/pages/getPageDetail?key=${$}`,method:"get"}),de=()=>{C=l.reactive(y()),T.value="loading",x.value=[],A={},R=[],_.value=[],S.value=[],P.value=[],Q.value=[],E.value=[],j.value={}},ce=()=>{l.nextTick(()=>{setTimeout(()=>{var ue,he,le,ee,K,Oe,_e;const $=((he=(ue=B.value)==null?void 0:ue.$el)==null?void 0:he.offsetHeight)||0,F=((ee=(le=I.value)==null?void 0:le.$el)==null?void 0:ee.offsetHeight)||0,oe=((Oe=(K=G.value)==null?void 0:K.$el)==null?void 0:Oe.offsetHeight)||0,ge=$-F-oe-6;H.value=k.maxHeight>0?k.maxHeight:(_e=A==null?void 0:A.tableConfig)!=null&&_e.isPagination?ge-48:ge},500)})},v=()=>[..._u(R)],N=$=>{Z.value.updateSelection($)},q=()=>{Z.value.clearSelection()},J=()=>C.tableSelection,Ce=async()=>{await ni(R),b("refresh")},xi=$=>{if(!$||!$.tableQueryDefaultValue)return;const oe=zt($)["value-format"]||"YYYY-MM-DD HH:mm:ss";if($.fieldType=="date"&&$.tableQueryDefaultValue=="nowYear")return Ve.dayjs().format(oe);if($.fieldType=="date"&&$.tableQueryDefaultValue=="yearAgo")return Ve.dayjs().subtract(1,"year").format(oe);if($.fieldType=="dateRange"&&$.tableQueryDefaultValue.includes("&")){const ge=$.tableQueryDefaultValue.split("&");return[Ve.dayjs(ge[0]).subtract(6,"month").format(oe),Ve.dayjs(ge[1]).format(oe)]}if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="yearAgo")return[Ve.dayjs().subtract(1,"year").format(oe),Ve.dayjs().format(oe)];if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="sixMonthsAgo")return[Ve.dayjs().subtract(6,"month").format(oe),Ve.dayjs().format(oe)]},Bi=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const ge=(F.row[$.fieldKey]??"").split(";"),ue=ge&&ge.length?ge[0]:"",he=ue.substring(ue.lastIndexOf(".")+1);return/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/.test(he)},Re=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const ge=(F.row[$.fieldKey]??"").split(";");return ge&&ge.length?ge[0]:""},Ge=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const oe=F.row[$.fieldKey]??null;return oe?oe.split(";"):[]},Ct=$=>$==="true",zt=$=>new Function("",$.fieldUiProps)()||{},Si=async($,F)=>Reflect.has(u,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent(u[`/src/views${$}.vue`])):null,V=async($,F)=>Reflect.has(u,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent({loader:u[`/src/views${$}.vue`],loadingComponent:Ar,delay:20})):null,D=async()=>{A.buttons=await Promise.all(A.buttons.map(async $=>{if($.isCustomBtn&&$.customType=="component"){const{customComponentUrl:F,customComponentName:oe}=$,ge=await Si(F);$[oe]=ge}return $}))},L=async()=>{const $=A.fields.filter(F=>(F.formCustomComponentes??[]).some(oe=>oe.permissionCode=="tableShow"&&oe.isFieldCustom));E.value=await Promise.all($.map(async F=>{const oe=F.formCustomComponentes.find(le=>le.permissionCode=="tableShow"),{customComponentUrl:ge,customComponentName:ue}=oe,he=await Si(ge);return F.customTableHeaderName=ue,F.customTableHeaderUrl=ge,F[`customTableHeaderInstance_${ue}`]=he,F.headerItem={label:F.fieldName,prop:F.fieldKey,align:F.tableCellAlignType,width:F.tableCellWidthType=="default"?F.tableCellWidth:"",minWidth:F.tableCellWidthType=="min"?F.tableCellWidth:"",showOverflowTooltip:F.isTableCellOverflowTooltip||!1,sort:F.isTableCellSort||!1},F}))},ne=($,F)=>{switch($){case"array":return typeof F=="string"?F.toString().split().sort((oe,ge)=>oe.sort-ge.sort):[F];case"number":return Number(F);case"boolean":return Ct(F);default:return F}},fe=($,F)=>F[$.fieldKey]?F[$.fieldKey].toString().includes("T")?Ve.dayjs(F[$.fieldKey]).format("YYYY-MM-DD HH:mm:ss"):F[$.fieldKey]:"";function Le($,F={}){return $.replace(/\{([^}]+)\}/g,(oe,ge)=>{const ue=ge.trim().split(".");let he=F;for(const le of ue){if(!he||typeof he!="object")break;he=he[le]}return he!==void 0?he:oe})}const Ae=$=>$?Le($,k.matchData):"",U=($,F,oe)=>{switch($){case"LessThanOrEqual":return F<=oe;case"LessThan":return F<oe;case"GreaterThanOrEqual":return F>=oe;case"GreaterThan":return F>oe;case"NotEqual":return F!=oe;case"Equal":return F==oe;default:return F==oe}},Y=($,F)=>{if(!$.matchFields.length)return!0;const oe=le=>le.matchType=="default"?F[le.matchFieldName]:k.matchData[le.matchType][le.matchFieldName];let ue=$.matchFields.reduce((le,ee,K)=>{const Oe=oe(ee),_e=U(ee.matchCondition,Oe,ee.fieldValue==""?null:ee.fieldValue=="true"||ee.fieldValue=="false"?Ct(ee.fieldValue):ee.fieldValue);return le+=_e,K!==$.matchFields.length-1&&(le+=ee.spliceCondition||"&&"),le},"").split("||"),he=ue.reduce((le,ee,K)=>(le+=`(${ee})`,K<ue.length-1&&(le+="||"),le),"");return new Function(`return ${he}`)()},Ee=($,F)=>Object.keys(F).length?x.value.some(oe=>oe.unique==$.permissionCode)&&Y($,F):!1,qe=async $=>{try{C.pageLoading=!0;const F=k.pageKey??g.params.key,{data:{pageConfigs:oe}}=await me(F);return A=oe.pageConfig?JSON.parse(oe.pageConfig):{},C.tableQuery.pageSize=A.tableConfig.pageSize||10,C.pageLoading=!1,Promise.resolve(Object.keys(A).length)}catch(F){C.pageLoading=!1,console.error(F)}},Ci=async($=[],F={},oe=!0,ge=!1)=>{try{const ue=$.filter(ee=>["select","multipleSelect","selectIcon","switch","virtualizedSelect","virtualizedMultipleSelect","fullLoadTreeSelect","provinceCascade"].includes(ee.fieldType)&&(!Reflect.has(ee,"dataList")||!ee.dataList.length||ge)),le=(await Promise.allSettled(ue.map(async ee=>{const K=ee.postRequestParams.filter(lt=>lt.submitType==="default").reduce((lt,si)=>(lt[si.submitName]=ne(si.paramsType,si.submitValue),lt),{}),Oe=ee.postRequestParams.filter(lt=>lt.submitType==="match").reduce((lt,si)=>(lt[si.submitName]=ne(si.paramsType,F[si.submitValue][si.submitName]),lt),{}),_e=ee.postRequestParams.filter(lt=>lt.submitType==="dynamic").map(lt=>({field:lt.submitName,operate:lt.submitMatchType,value:ne(lt.paramsType,lt.submitValue)}));let Ke={};Object.keys(K).length&&(Ke={...Ke,...K}),Object.keys(Oe).length&&(Ke={...Ke,...Oe}),_e.length&&(Ke.dynamicFilters=_e);const{data:Ai}=await f({url:ee.fieldRequestUrl,method:ee.fieldRequestType||"GET",data:Ke});return Promise.resolve({...ee,dataList:Ai||[]})}))).filter(ee=>ee.status==="fulfilled"&&Reflect.has(ee,"value")).map(ee=>ee.value);return oe&&A.fields.forEach(ee=>{const K=le.find(Oe=>ee.fieldName==Oe.fieldName&&ee.fieldKey==Oe.fieldKey);K&&(ee.dataList=(K==null?void 0:K.dataList)??[])}),le}catch(ue){console.error(ue)}},sn=l.computed(()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return!$||$>=S.value.length}),rn=()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return sn.value?S.value:S.value.slice(0,$)},vi=()=>{var F;const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return sn.value?[]:S.value.slice($,(F=S.value)==null?void 0:F.length)},Ou=async $=>{try{const F=($||[]).filter(he=>he.useScenes.some(le=>["tableShow"].includes(le))).sort((he,le)=>he.sort-le.sort),oe=["editor","upload","date"];let ge=F.map(he=>{const le=he.formCustomComponentes.some(ee=>ee.permissionCode=="tableShow"&&ee.isFieldCustom);return{label:he.fieldName,prop:he.fieldKey,align:he.tableCellAlignType,width:he.tableCellWidthType=="default"?he.tableCellWidth:"",minWidth:he.tableCellWidthType=="min"?he.tableCellWidth:"",showOverflowTooltip:he.isTableCellOverflowTooltip||!1,sort:he.isTableCellSort||!1,render:!!he.fieldRequestUrl||he.tableCellContentType=="link"||oe.includes(he.fieldType),isCustomTableHeader:le}});A.tableConfig.isSerialNumber&&ge.unshift({prop:"serialNumber",width:80}),A.tableConfig.isCheckRow&&ge.unshift({prop:"checkbox",width:50});const ue=S.value.filter(he=>x.value.some(le=>le.unique==he.permissionCode));A.tableConfig.isOperateRow&&ue.length&&ge.push({label:c("act.operate"),prop:"operate",width:A.tableConfig.tableOperateCellWidth,render:!0,fixed:"right"}),Q.value=F.filter(he=>!!he.fieldRequestUrl&&he.useScenes.includes("tableShow")||he.tableCellContentType=="link"||oe.includes(he.fieldType)),_.value=ge}catch(F){console.error(F)}},il=()=>{S.value=(A.buttons||[]).filter($=>$.permissionCode!==1001&&$.btnPostion.includes("table")).sort(($,F)=>$.sort-F.sort).map($=>($.loading=!1,$.btnAlias&&($.btnName=$.btnAlias),$))},h_=()=>A.fields.filter($=>$.useScenes.includes("tableSearch")).map($=>(["date","dateRange"].includes($.fieldType)?$.queryValue=$.tableQueryDefaultValue?$.tableQueryDefaultValue:xi($):$.queryValue=($==null?void 0:$.tableQueryDefaultValue)||void 0,k.defaultParams.some(F=>{F.field==$.fieldKey&&F.operate===$.tableQueryCondition&&($.queryValue=F.value)}),$)),_u=($,F="queryValue")=>$?($||[]).filter(ge=>!!ge[F]).reduce((ge,ue)=>{var le;const he=zt(ue);if(ue.fieldType==="date"&&he["value-format"]!=="YYYY"){const ee=he!=null&&he.dayJsType?ly[(le=ue.fieldUiProps)==null?void 0:le.dayJsType]:"day",K=he["value-format"]||"YYYY-MM-DD HH:mm:ss";ge=[...ge,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:Ve.dayjs(ue[F]).startOf(ee).format(K)},{field:ue.fieldKey,operate:"LessThanOrEqual",value:Ve.dayjs(ue[F]).endOf(ee).format(K)}]}else if(ue.fieldType==="dateRange"&&ue[F].length)if(ue.fieldKey.includes("&")){const ee=ue.fieldKey.split("&")||[];ge=[...ge,{field:ee[0],operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:ee[1],operate:"LessThanOrEqual",value:ue.queryValue[1]}]}else ge=[...ge,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:ue.fieldKey,operate:"LessThanOrEqual",value:ue.queryValue[1]}];else if(["provinceCascade"].includes(ue.fieldType)&&ue[F].length){const ee=(ue.fieldKey.split("&")||[]).map((K,Oe)=>({field:K,operate:"Equal",value:ue.queryValue[Oe]}));ge=[...ge,...ee]}else return Array.isArray(ue[F])&&!ue[F].length?[...ge]:[...ge,{field:ue.fieldKey,operate:ue.tableQueryCondition,value:ue.tableQueryCondition==="In"&&ue[F]&&typeof ue[F]=="string"?ue[F].split(";"):ue[F]=="true"||ue[F]=="false"?Ct(ue[F]):ue[F]}];return ge},[]):[],CQ=($,F)=>{if(!$.dataList||!Reflect.has(F,$.fieldKey))return"";const oe=F[$.fieldKey];if(!oe&&oe!==0&&oe!==!1)return"";const ge=zt($),ue=Object.assign({key:"key",value:"value"},ge.props||{});return["virtualizedSelect","virtualizedMultipleSelect"].includes($.fieldType)&&(ue.key=ue.label),["multipleSelect","select","switch","virtualizedSelect","virtualizedMultipleSelect","selectIcon"].includes($.fieldType)?($.dataList||[]).filter(he=>{const le=$.fieldType==="selectIcon"?`btn-${he[ue.value]}`:he[ue.value],ee=le=="true"||le=="false"?Ct(le):le;return Array.isArray(oe)?oe.some(K=>K==le==K):typeof oe=="string"?oe.split(";").includes(ee):oe==ee}).map(he=>he[ue.key]).join(";"):oe},ni=async($=[])=>{var F,oe,ge;try{if(!((F=A==null?void 0:A.tableConfig)!=null&&F.dataUrl))return;C.tableLoading=!0;const ue=k.defaultParams.filter(K=>!(A.fields??[]).some(Oe=>Oe.fieldKey===K.field&&Oe.tableQueryCondition===K.operate&&Oe.useScenes.includes("tableSearch"))),he=(((oe=A==null?void 0:A.tableConfig)==null?void 0:oe.defaultParams)??[]).map(K=>({field:K.submitFieldName,operate:K.matchValue,value:ne(K.submitFieldType,K.defaultValue)})),le=[...ue,...he,..._u($)];(ge=A==null?void 0:A.tableConfig)!=null&&ge.isPagination||(C.tableQuery.pageSize=9999);const{data:ee}=await f({url:A.tableConfig.dataUrl,method:"POST",data:{...C.tableQuery,dynamicFilters:le}});C.tableTotal=ee.totalCount||0,P.value=ee.datas||[],C.tableLoading=!1}catch(ue){C.tableLoading=!1,console.error(ue)}},f_=async()=>{try{T.value="loading";const $=k.pageKey;if(!await qe($)){T.value="end";return}await L(),await D(),await Ci(A.fields.filter(he=>he.useScenes.some(le=>["tableSearch","tableShow"].includes(le)))),T.value="success";let oe="";if(m==="sessionStorage")oe=sessionStorage.getItem("accessToken");else{const he=O.getPrefix();oe=O.getItemValue(`${he}accessToken`)}const ue=JSON.parse(ty.decode(oe.split(".")[1]))["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];if(w||k.menuId){const he=k.menuId;x.value=await w({roleId:ue,menuId:he})||[]}else x.value=(await z({roleId:ue,key:$})).data.datas||[];il(),Ou(A.fields),ce(),R=h_(),(!Reflect.has(A.tableConfig,"isExecuteImmediatelyTableApi")||A.tableConfig.isExecuteImmediatelyTableApi)&&await ni(R),b("load"),console.log(A)}catch($){console.error($),T.value="end"}};l.provide("globalProps",k),l.provide("loadComponents",Si),l.provide("defineAsyncLoadComponents",V),l.provide("stringToBoolean",Ct),l.provide("matchCondition",U),l.provide("menuPermissionBtns",x),l.provide("getTableData",ni),l.provide("refreshTable",Ce),l.provide("tableBtnRefs",W.value),l.provide("formatDataType",ne),l.provide("getFieldUiProps",zt),l.provide("disposeRequestData",Ci),l.provide("disposeDate",xi),l.provide("getDefaultQueryValues",h_),l.watch(()=>k.pageKey,($,F)=>{de(),f_()},{immediate:!0});const d_=async($,F)=>{R=$,await ni($),b("refresh"),F(!0)},AQ=$=>{b("operate",$),ni(R)},nl=($,F)=>{const{exportFile:oe,importFile:ge,downloadFile:ue}=ef();if($.isCustomBtn){if($.customType=="component"&&!Reflect.has($,[$.customComponentName])){Ve.ElNotification({title:"提示",message:`当前自定义按钮未创建vue文件,请在路径【/src/views${$.customComponentUrl}】下创建vue文件`,type:"warning",duration:2500});return}if($.customType=="code"){try{new Function("router","route","data","configItem","cookieStorage",$.codeStr)(p,g,F,$,O)}catch(ee){console.error(ee)}return}const le=`${$.customComponentName}-${$.permissionCode}`;W.value[le]&&W.value[le].onTigger({rowData:F,tableSelection:C.tableSelection});return}if($.submitWay=="associationSubTable"){Ve.ElNotification({title:c("act.tip"),message:c("act.developing"),type:"warning",duration:2500});return}if(["export","exportUrl"].includes($.submitWay)){$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0;let le=[...k.defaultParams,..._u(R)],ee=($.submitFields||[]).reduce((Oe,_e)=>{if(_e.matchType=="default")Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:ne(_e.submitFieldType,_e.matchFieldName)}];else if(_e.matchType=="match"){const Ke=_e.submitFieldMatchOrigin==="rowData"?F:k.matchData[_e.submitFieldMatchOrigin];Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:ne(_e.submitFieldType,Ke[_e.matchFieldName])}]}else if(_e.matchType=="selection"){const Ke=C.tableSelection.map(Ai=>Ai[_e.matchFieldName]);Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:_e.submitFieldType==="string"?Ke.join():Ke}]}return Oe},[]);const K=[...le,...ee];f({url:Ae($.requestUrl),method:"post",data:{dynamicFilters:K},responseType:["exportUrl"].includes($.submitWay)?"json":"blob"}).then(Oe=>{$.submitWay=="exportUrl"?ue(f,Oe.data):oe(Oe),b("operate",$),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1}).catch(Oe=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1});return}if(["import","batchImport"].includes($.submitWay)){ge({multiple:$.submitWay=="batchImport",acceptTypes:$.importAccept||""},le=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0;const ee=new FormData;if(($.submitFields||[]).forEach(K=>{var Oe,_e;if(K.matchType=="default")ee.append(K.submitFieldName,ne(K.submitFieldType,K.matchFieldName));else if(K.matchType=="match")(Oe=Object.keys(F))!=null&&Oe.length&&ee.append(K.submitFieldName,ne(K.submitFieldType,F[K.matchFieldName]));else if(K.matchType=="query"){const Ke=((_e=R.find(Ai=>Ai.fieldKey==K.matchFieldName))==null?void 0:_e.queryValue)??null;ee.append(K.submitFieldName,ne(K.submitFieldType,Ke))}}),$.submitWay=="import")ee.append($.importFileName||"file",le.target.files[0]);else for(let K of le.target.files)ee.append($.importFileName||"files",K);return f({url:Ae($.requestUrl),method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:ee}).then(K=>{Ve.ElNotification({title:c("act.tip"),message:`${K.msg}`,type:"success",duration:2500}),b("operate",$),ni(R),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1}).catch(()=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1})});return}if($.submitWay==="executeApi"){let le=($.submitFields||[]).reduce((ee,K)=>{var Oe;if(K.matchType=="default")ee[K.submitFieldName]=ne(K.submitFieldType,K.matchFieldName);else if(K.matchType=="match"){const _e=K.submitFieldMatchOrigin==="rowData"?F:k.matchData[K.submitFieldMatchOrigin];ee[K.submitFieldName]=ne(K.submitFieldType,_e[K.matchFieldName])}else K.matchType=="query"&&(ee[K.submitFieldName]=((Oe=R.find(_e=>_e.fieldKey==K.matchFieldName))==null?void 0:Oe.queryValue)??null);return ee},{});if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}if($.btnPostion==="header"){const ee=($.submitFields||[]).filter(K=>K.matchType=="selection").reduce((K,Oe)=>(K[Oe.submitFieldName]=C.tableSelection.reduce((_e,Ke)=>(Oe.submitFieldType==="array"?_e=[..._e,...ne(Oe.submitFieldType,Ke[Oe.matchFieldName])]:_e=[..._e,ne(Oe.submitFieldType,Ke[Oe.matchFieldName])],_e),[]),K),{});Object.assign(le,ee)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0,f({url:Ae($.requestUrl),method:"post",data:le}).then(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1,Ve.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),b("operate",$),ni(R)}).catch(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1});return}if($.submitWay==="messageBox"){if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}Ve.ElMessageBox.confirm(`${c("act.isExecuteOperate")}?`,c("act.tip"),{confirmButtonText:c("act.enter"),cancelButtonText:c("act.cancel"),type:"warning"}).then(()=>{let le=($.submitFields||[]).reduce((ee,K)=>{var Oe;if(K.matchType=="default")ee[K.submitFieldName]=ne(K.submitFieldType,K.matchFieldName);else if(K.matchType=="match"){const _e=K.submitFieldMatchOrigin==="rowData"?F:k.matchData[K.submitFieldMatchOrigin];ee[K.submitFieldName]=ne(K.submitFieldType,_e[K.matchFieldName])}else K.matchType=="query"&&(ee[K.submitFieldName]=((Oe=R.find(_e=>_e.fieldKey==K.matchFieldName))==null?void 0:Oe.queryValue)??null);return ee},{});if($.btnPostion==="header"){const ee=($.submitFields||[]).filter(K=>K.matchType=="selection").reduce((K,Oe)=>(K[Oe.submitFieldName]=C.tableSelection.reduce((_e,Ke)=>(Oe.submitFieldType==="array"?_e=[..._e,...ne(Oe.submitFieldType,Ke[Oe.matchFieldName])]:_e=[..._e,ne(Oe.submitFieldType,Ke[Oe.matchFieldName])],_e),[]),K),{});Object.assign(le,ee)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0,f({url:Ae($.requestUrl),method:"post",data:le}).then(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1,Ve.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),b("operate",$),ni(R)}).catch(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1})}).catch(le=>{});return}if($.btnPostion==="header"&&$.submitWay==="dialog"&&($.submitFields||[]).some(le=>le.submitFieldMatchOrigin==="selections")&&!C.tableSelection.length){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}return}let he=(A.fields||[]).filter(le=>le.useScenes.includes($.permissionCode)).map(le=>(le.customFiledsComponentes=le.formCustomComponentes.find(ee=>ee.permissionCode==$.permissionCode)||{},le));if(!he.length){Ve.ElNotification({title:c("act.tip"),message:c("act.buttonBindField"),type:"warning",duration:2500});return}if($.submitWay==="dialog"){C.dialogTitle=$.btnName,C.dialogData={dataItem:{...$},rowData:{...F},selections:C.tableSelection||[],formConfig:A.formConfig,formList:he},C.showFormDialog=!0;return}},TQ=($,F,oe)=>{b("onClickRow",$,F,oe)},PQ=($,F)=>{j.value=$,b("changeExpansionRow",$,F)},QQ=$=>{b("changeSelection",$)},EQ=($,F)=>{C.editorDialogTitle=`${c("act.preview")}${$.fieldName}`,C.dialogData={...F,editorContent:F[$.fieldKey]},C.showEditorPreDialog=!0};return e({loadData:f_,getDynamicFiltersData:v,getTableData:ni,refreshTable:Ce,getTableSelection:J,setTableSelection:N,clearSelection:q}),($,F)=>{const oe=l.resolveComponent("el-table-column"),ge=l.resolveComponent("el-image"),ue=l.resolveComponent("el-link"),he=l.resolveComponent("a-svg-icon"),le=l.resolveComponent("el-button"),ee=l.resolveComponent("el-dropdown-item"),K=l.resolveComponent("el-dropdown-menu"),Oe=l.resolveComponent("el-dropdown"),_e=l.resolveComponent("el-empty"),Ke=l.resolveComponent("el-card"),Ai=l.resolveDirective("debounce"),lt=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createBlock(Ke,{class:"act-module",ref_key:"actModuleRef",ref:B,shadow:"never"},{default:l.withCtx(()=>{var si,p_;return[l.unref(T)==="success"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(n),{ref_key:"queryModuleRef",ref:I,data:l.unref(A),onReset:d_,onSearch:d_},null,8,["data"]),l.createVNode(l.unref(s),{ref_key:"headerButtonsModuleRef",ref:G,data:l.unref(A),onOnOperate:nl},null,8,["data"]),l.createVNode(l.unref(r),{ref_key:"aTableRef",ref:Z,loading:l.unref(C).tableLoading,total:l.unref(C).tableTotal,tableQuery:l.unref(C).tableQuery,"onUpdate:tableQuery":F[0]||(F[0]=ye=>l.unref(C).tableQuery=ye),selection:l.unref(C).tableSelection,"onUpdate:selection":F[1]||(F[1]=ye=>l.unref(C).tableSelection=ye),headers:l.unref(_),data:l.unref(P),showPagination:(p_=(si=l.unref(A))==null?void 0:si.tableConfig)==null?void 0:p_.isPagination,tableConfig:k.tableConfig,maxHeight:H.value,onRefresh:Ce,onOnRowClick:TQ,onChangeExpand:PQ,onChangeSelection:QQ},l.createSlots({operate:l.withCtx(({scope:ye})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(rn(),(be,ri)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ri},[Ee(be,ye.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[be.isCustomBtn&&be.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(be[be.customComponentName]),{key:0,ref_for:!0,ref:Tn=>l.unref(W)[`${be.customComponentName}-${be.permissionCode}`]=Tn,buttonData:be,scope:ye,onRefresh:ni,onRefreshTable:Ce},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(le,{class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`],onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading","onClick"])),[[Ai]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(le,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`],onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading","onClick"])),[[Ai]])],64)):l.createCommentVNode("",!0)],64))),128)),sn.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Oe,{key:0,class:"table-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(K,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(vi(),(be,ri)=>(l.openBlock(),l.createBlock(ee,{key:ri,onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[Ee(be,ye.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[be.isCustomBtn&&be.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(be[be.customComponentName]),{key:0,ref_for:!0,ref:Tn=>l.unref(W)[`${be.customComponentName}-${be.permissionCode}`]=Tn,buttonData:be,scope:ye,onRefresh:ni},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(le,{class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`]},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading"])),[[Ai]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(le,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`]},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading"])),[[Ai]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(le,{class:"table-btn-more",icon:l.unref(my),size:"small",circle:""},null,8,["icon"])]),_:2},1024))]),_:2},[l.renderList(l.unref(E),(ye,be)=>({name:ye.fieldKey,fn:l.withCtx(()=>[ye[`customTableHeaderInstance_${ye.customTableHeaderName}`]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ye[`customTableHeaderInstance_${ye.customTableHeaderName}`]),{key:0,data:ye,configData:l.unref(A),rowData:l.unref(j)},null,8,["data","configData","rowData"])):(l.openBlock(),l.createBlock(oe,{key:1,label:ye.fieldName+l.unref(c)("act.customTableHeader"),width:"260"},null,8,["label"]))])})),l.renderList(l.unref(Q),(ye,be)=>({name:ye.fieldKey,fn:l.withCtx(({scope:ri})=>[ye.tableCellContentType=="link"?(l.openBlock(),l.createElementBlock("span",by,l.toDisplayString(ri.row[ye.fieldKey]),1)):ye.fieldType=="editor"?(l.openBlock(),l.createElementBlock("span",{key:1,class:"table-link",onClick:Tn=>EQ(ye,ri.row)},"点击预览",8,yy)):ye.fieldType=="upload"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[Bi(ye,ri)?(l.openBlock(),l.createBlock(ge,{key:0,class:"file-image",fit:"cover","preview-src-list":Ge(ye,ri),"preview-teleported":"",src:Re(ye,ri)},{error:l.withCtx(()=>[l.createElementVNode("div",wy,l.toDisplayString(ye("act.noImage")),1)]),_:2},1032,["preview-src-list","src"])):(l.openBlock(),l.createBlock(ue,{key:1,type:"primary"}))],64)):ye.fieldType=="date"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:3},[l.createTextVNode(l.toDisplayString(fe(ye,ri.row)),1)],64)):(l.openBlock(),l.createElementBlock("span",ky,l.toDisplayString(CQ(ye,ri.row)),1))])}))]),1032,["loading","total","tableQuery","selection","headers","data","showPagination","tableConfig","maxHeight"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(o),{visible:l.unref(C).showFormDialog,"onUpdate:visible":F[2]||(F[2]=ye=>l.unref(C).showFormDialog=ye),title:l.unref(C).dialogTitle,data:l.unref(C).dialogData,onRefresh:AQ},null,8,["visible","title","data"]),l.createVNode(l.unref(a),{visible:l.unref(C).showEditorPreDialog,"onUpdate:visible":F[3]||(F[3]=ye=>l.unref(C).showEditorPreDialog=ye),title:l.unref(C).editorDialogTitle,data:l.unref(C).dialogData},null,8,["visible","title","data"]),l.unref(T)==="end"?(l.openBlock(),l.createBlock(_e,{key:1,description:l.unref(c)("act.noConfigPage")},{image:l.withCtx(()=>[l.createVNode(he,{name:"config-nodata",width:"200",height:"200"})]),_:1},8,["description"])):l.createCommentVNode("",!0)]}),_:1})),[[lt,l.unref(C).pageLoading]])}}},[["__scopeId","data-v-226b21a1"]]),xy=[{key:"按钮形式",value:"default"},{key:"文字形式",value:"text"}],Sy=[{key:"顶部",value:"header"},{key:"表格",value:"table"}],Cy=[{key:"主题色",value:"primary"},{key:"绿色",value:"success"},{key:"灰色",value:"info"},{key:"橙黄色",value:"warning"},{key:"红色",value:"danger"},{key:"浅蓝",value:"primary-light"}],Ay=[{key:"模态框",value:"dialog"},{key:"提示框",value:"messageBox"},{key:"导入",value:"import"},{key:"多文件导入",value:"batchImport"},{key:"导出(流)",value:"export"},{key:"导出(url)",value:"exportUrl"},{key:"直接执行接口",value:"executeApi"},{key:"关联子表",value:"associationSubTable"}],Ty=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Py=[{key:"且",value:"&&"},{key:"或",value:"||"}],Qy=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"选择列",value:"selection"},{key:"查询条件",value:"query"}],Ey=[{key:"默认匹配",value:"default"},{key:"用户信息变量",value:"userInfo"}],$y=[{key:"组件",value:"component"},{key:"代码",value:"code"}],Ny=[{key:"GET",value:"GET"},{key:"POST",value:"POST"}],rf=[{key:"隐式",value:"implicit"},{key:"输入框",value:"input"},{key:"数字输入框",value:"inputNumber"},{key:"textarea文本框",value:"textarea"},{key:"下拉单选框",value:"select"},{key:"虚拟下拉框",value:"virtualizedSelect"},{key:"下拉多选框",value:"multipleSelect"},{key:"虚拟下拉多选框",value:"virtualizedMultipleSelect"},{key:"树形下拉框",value:"fullLoadTreeSelect"},{key:"树形下拉框(懒加载)",value:"treeSelect"},{key:"级联下拉框",value:"provinceCascade"},{key:"时间框",value:"date"},{key:"时间范围框",value:"dateRange"},{key:"上传",value:"upload"},{key:"富文本",value:"editor"},{key:"switch开关",value:"switch"},{key:"下拉选择图标",value:"selectIcon"}],Ry=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"dynamic",value:"dynamic"}],Vy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"}],Ly=[{key:"居中",value:"center"},{key:"左对齐",value:"left"},{key:"右对齐",value:"right"}],My=[{key:"默认",value:"default"},{key:"链接",value:"link"},{key:"标签",value:"tag"}],Dy=[{key:"默认宽",value:"default"},{key:"最小宽",value:"min"}],of=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],By=[{key:"左侧",value:"right"},{key:"上侧",value:"top"}],vy=[{key:"是",value:"1"},{key:"否",value:"0"}],lf=[{label:"表格配置",options:[{key:"表格查询",value:"tableSearch"},{key:"表格展示",value:"tableShow"}]},{label:"表单配置",options:[]}],Iy={__name:"configForm",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=i,s=()=>({formRow:1,dialogWidth:800,formLabelWidth:120,formLabelPosition:"top"});let r=l.ref(null),o=l.ref(s());return l.watch(()=>n.modelValue,(a,c)=>{a&&(o.value=Object.assign(o.value,{...a}))},{deep:!0,immediate:!0}),e({formRef:r,form:o}),(a,c)=>{const u=l.resolveComponent("el-input-number"),h=l.resolveComponent("el-form-item"),f=l.resolveComponent("el-col"),d=l.resolveComponent("el-option"),m=l.resolveComponent("el-select"),O=l.resolveComponent("el-row"),w=l.resolveComponent("el-form"),g=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(g,{class:"form-card",shadow:"hover",header:"表单配置"},{default:l.withCtx(()=>[l.createVNode(w,{ref_key:"formRef",ref:r,model:l.unref(o),"label-suffix":":","label-width":"110px"},{default:l.withCtx(()=>[l.createVNode(O,null,{default:l.withCtx(()=>[l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"弹窗宽度"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).dialogWidth,"onUpdate:modelValue":c[0]||(c[0]=p=>l.unref(o).dialogWidth=p),min:800},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"排版列数"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).formRow,"onUpdate:modelValue":c[1]||(c[1]=p=>l.unref(o).formRow=p),min:1,max:4},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"label宽度"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).formLabelWidth,"onUpdate:modelValue":c[2]||(c[2]=p=>l.unref(o).formLabelWidth=p),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"label位置",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"formLabelPosition"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:l.unref(o).formLabelPosition,"onUpdate:modelValue":c[3]||(c[3]=p=>l.unref(o).formLabelPosition=p),placeholder:"请选择"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(By),(p,b)=>(l.openBlock(),l.createBlock(d,{key:b+"labelPosition",label:p.key,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},IQ="",Zy=ct({__name:"configTable",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=i,s=()=>({dataUrl:void 0,defaultParams:[],isCheckRow:!1,isOperateRow:!0,isPagination:!0,isSerialNumber:!0,isSort:!0,isExpandQuery:!1,isExecuteImmediatelyTableApi:!0,tableOperateCellWidth:160,pageSize:10,tableQueryLabelWidth:100,tableQueryRowWidth:5,tableMoreBtnSplitNumber:0,headerMoreBtnSplitNumber:0}),r=l.inject("conditionList")();let o=l.ref(null),a=l.ref(s());l.watch(()=>n.modelValue,(f,d)=>{if(f){if(!Object.keys(f).length)return;const m={...f,defaultParams:[...f.defaultParams||[]]};Object.keys(a.value).forEach(O=>{["defaultParams"].includes(O)?a.value[O]=[...m[O]||[]]:O==="tableMoreBtnSplitNumber"?a.value[O]=Reflect.has(m,"tableMoreBtnSplitNumber")?m[O]:0:O==="headerMoreBtnSplitNumber"?a.value[O]=Reflect.has(m,"headerMoreBtnSplitNumber")?m[O]:0:O==="isExecuteImmediatelyTableApi"?a.value[O]=Reflect.has(m,"isExecuteImmediatelyTableApi")?m[O]:!0:a.value[O]=m[O]})}},{deep:!0,immediate:!0});const c=()=>{a.value.defaultParams.push({submitFieldName:"",defaultValue:"",matchValue:"",submitFieldType:""})},u=f=>{a.value.defaultParams.splice(f,1)},h=f=>{f||(a.value.pageSize=10)};return e({formRef:o,form:a}),(f,d)=>{const m=l.resolveComponent("el-input"),O=l.resolveComponent("el-form-item"),w=l.resolveComponent("el-col"),g=l.resolveComponent("el-row"),p=l.resolveComponent("el-button"),b=l.resolveComponent("el-divider"),k=l.resolveComponent("el-option"),y=l.resolveComponent("el-select"),C=l.resolveComponent("el-switch"),T=l.resolveComponent("el-input-number"),x=l.resolveComponent("el-form"),A=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(A,{class:"form-card",shadow:"hover",header:"表格配置"},{default:l.withCtx(()=>[l.createVNode(x,{ref_key:"formRef",ref:o,model:l.unref(a),"label-suffix":":","label-width":"120"},{default:l.withCtx(()=>[l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(w,{span:24},{default:l.withCtx(()=>[l.createVNode(O,{label:"表格数据url",prop:"dataUrl",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:l.unref(a).dataUrl,"onUpdate:modelValue":d[0]||(d[0]=R=>l.unref(a).dataUrl=R),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(b,{"content-position":"left"},{default:l.withCtx(()=>[d[14]||(d[14]=l.createTextVNode(" 表格默认参数配置 ",-1)),l.createVNode(p,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:c})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).defaultParams,(R,_)=>(l.openBlock(),l.createBlock(g,{class:"table-post-params",key:_},{default:l.withCtx(()=>[l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"字段",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:R.submitFieldName,"onUpdate:modelValue":S=>R.submitFieldName=S,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".matchValue"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:R.matchValue,"onUpdate:modelValue":S=>R.matchValue=S,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(r),(S,P)=>(l.openBlock(),l.createBlock(k,{key:P,label:S.key,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"默认值",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".defaultValue"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:R.defaultValue,"onUpdate:modelValue":S=>R.defaultValue=S,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:R.submitFieldType,"onUpdate:modelValue":S=>R.submitFieldType=S,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(of),(S,P)=>(l.openBlock(),l.createBlock(k,{key:P,label:S.key,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(b,{"content-position":"left"}),l.createVNode(w,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(p,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:S=>u(_)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"多选列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isCheckRow,"onUpdate:modelValue":d[1]||(d[1]=R=>l.unref(a).isCheckRow=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"操作列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isOperateRow,"onUpdate:modelValue":d[2]||(d[2]=R=>l.unref(a).isOperateRow=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"分页"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isPagination,"onUpdate:modelValue":d[3]||(d[3]=R=>l.unref(a).isPagination=R),onChange:h},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"序号列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isSerialNumber,"onUpdate:modelValue":d[4]||(d[4]=R=>l.unref(a).isSerialNumber=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"排序"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isSort,"onUpdate:modelValue":d[5]||(d[5]=R=>l.unref(a).isSort=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"展/收查询条件"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isExpandQuery,"onUpdate:modelValue":d[6]||(d[6]=R=>l.unref(a).isExpandQuery=R),onChange:h},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"立即执行接口"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isExecuteImmediatelyTableApi,"onUpdate:modelValue":d[7]||(d[7]=R=>l.unref(a).isExecuteImmediatelyTableApi=R)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(g,null,{default:l.withCtx(()=>[l.unref(a).isOperateRow?(l.openBlock(),l.createBlock(w,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"操作列宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableOperateCellWidth,"onUpdate:modelValue":d[8]||(d[8]=R=>l.unref(a).tableOperateCellWidth=R),min:120},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(a).isPagination?(l.openBlock(),l.createBlock(w,{key:1,span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"分页页数",prop:"pageSize","label-width":"150",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).pageSize,"onUpdate:modelValue":d[9]||(d[9]=R=>l.unref(a).pageSize=R),min:10},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"查询条件label宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableQueryLabelWidth,"onUpdate:modelValue":d[10]||(d[10]=R=>l.unref(a).tableQueryLabelWidth=R),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"查询条件列数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableQueryRowWidth,"onUpdate:modelValue":d[11]||(d[11]=R=>l.unref(a).tableQueryRowWidth=R),min:1},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"表格更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableMoreBtnSplitNumber,"onUpdate:modelValue":d[12]||(d[12]=R=>l.unref(a).tableMoreBtnSplitNumber=R),min:0},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"顶部更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).headerMoreBtnSplitNumber,"onUpdate:modelValue":d[13]||(d[13]=R=>l.unref(a).headerMoreBtnSplitNumber=R),min:0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},[["__scopeId","data-v-3a00699d"]]),FQ="",Fy=ct({__name:"configBtns",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=on.useRoute(),s=l.inject("apiPrefix"),r=l.inject("request"),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>p1)),a=i,c=()=>({sort:0,permissionCode:null,requestUrl:"",btnName:"",btnAlias:"",btnIcon:"",btnPostion:"",btnType:"",btnColor:"",submitWay:"",importFileName:"",isPromptVerificationSelectTable:"1",isCustomBtn:!1,customType:"",codeStr:"",customComponentName:"",customComponentUrl:"",associationMenuId:"",submitFields:[],matchFields:[]}),u=()=>({tableLoading:!1,showConfigBtnDialog:!1,dialogData:{}});let h=l.reactive(u()),f=l.ref(null),d=0,m=l.ref([]),O=l.ref([]),w=[{prop:"checkbox",width:60},{prop:"serialNumber",width:80},{label:"按钮名称",prop:"btnName",minWidth:200},{label:"权限码",prop:"permissionCode",minWidth:200},{label:"按钮别名",prop:"btnAlias",minWidth:120},{label:"按钮图标",prop:"btnIcon",minWidth:120},{label:"是否自定义",prop:"isCustomBtn",width:120,render:!0},{label:"排序",prop:"sort",width:180,render:!0},{label:"操作",prop:"operate",width:120,render:!0,fixed:"right"}],g=l.ref([]);const p=x=>r({url:`${s}/sysMenus/getAllList`,method:"post",data:x}),b=x=>r({url:`${s}/sysMenus/getMenuOfOperate`,method:"get",params:x}),k=(x,A)=>{O.value.includes(x.permissionCode)||O.value.push(x.permissionCode),Object.assign(g.value[d],x),A(!0)},y=async x=>{try{h.tableLoading=!0;const A=a.id?a.id:n.params.id,{data:R}=await b({id:A});O.value=(R||[]).filter(_=>(x||[]).some(S=>S.permissionCode==_.unique)).map(_=>_.unique),g.value=(R||[]).map((_,S)=>{let P=c(),Q=(x||[]).find(E=>E.permissionCode==_.unique)||{};return{...P,btnIcon:_.icon||"",...Q,btnName:_.name,permissionCode:_.unique,sort:Q.sort?Q.sort:(S+1)*10}}).sort((_,S)=>_.sort-S.sort),h.tableLoading=!1}catch(A){h.tableLoading=!1,console.error(A)}},C=()=>f.value.getSelectionRows()||[];l.provide("associationMenuList",m),l.provide("createDefaultButtonItem",c),l.watch(()=>a.modelValue,async(x,A)=>{try{const R=a.id?a.id:n.params.id;m.value=(await p({dynamicFilters:[{field:"parentId",operate:"Equal",value:R}]})).data||[],await y(x)}catch(R){h.tableLoading=!1,console.error(R)}},{deep:!0});const T=x=>{h.dialogData=x.row,d=x.$index,h.showConfigBtnDialog=!0};return e({getTableSelectionRows:C}),(x,A)=>{const R=l.resolveComponent("el-tag"),_=l.resolveComponent("el-input-number"),S=l.resolveComponent("el-button"),P=l.resolveComponent("a-table"),Q=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(Q,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[...A[2]||(A[2]=[l.createElementVNode("div",{class:"card-header"},[l.createElementVNode("div",{class:"card-header-title"},"按钮配置")],-1)])]),default:l.withCtx(()=>[l.createVNode(P,{ref_key:"tableRef",ref:f,loading:l.unref(h).tableLoading,rowKey:"permissionCode",selection:l.unref(O),"onUpdate:selection":A[0]||(A[0]=E=>l.isRef(O)?O.value=E:O=E),headers:l.unref(w),data:l.unref(g),showPagination:!1},{isCustomBtn:l.withCtx(({scope:E})=>[l.createVNode(R,{type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(E.row.isCustomBtn?"是":"否"),1)]),_:2},1024)]),sort:l.withCtx(({scope:E})=>[l.createVNode(_,{modelValue:E.row.sort,"onUpdate:modelValue":W=>E.row.sort=W,min:0},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:E})=>[l.createVNode(S,{type:"primary",text:"",size:"small",icon:"Aim",onClick:W=>T(E)},{default:l.withCtx(()=>[...A[3]||(A[3]=[l.createTextVNode(" 配置 ",-1)])]),_:1},8,["onClick"])]),_:1},8,["loading","selection","headers","data"]),l.createVNode(l.unref(o),{visible:l.unref(h).showConfigBtnDialog,"onUpdate:visible":A[1]||(A[1]=E=>l.unref(h).showConfigBtnDialog=E),title:"配置按钮",data:l.unref(h).dialogData,onRefresh:k},null,8,["visible","data"])]),_:1})}}},[["__scopeId","data-v-05dd44e9"]]),XQ="",Uy={class:"card-header"},Xy=ct({__name:"configFileds",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>O1)),n=e,s=i;l.inject("configData")();const r=()=>({tableLoading:!1,showAddFieldDialog:!1,dialogTitle:"字段配置",dialogData:{}});let o=l.reactive(r()),a=0,c=[{label:"序号",prop:"serialNumber",width:60},{label:"字段",prop:"fieldName",minWidth:160},{label:"字段Key",prop:"fieldKey",minWidth:160},{label:"字段类型",prop:"fieldType",minWidth:160,render:!0},{label:"使用场景",prop:"useScenes",minWidth:340,render:!0},{label:"排序",prop:"sort",width:200,render:!0},{label:"操作",prop:"operate",width:170,render:!0,fixed:"right"}],u=l.ref([]);lf[0].options.map(k=>({btnName:k.key,permissionCode:k.value}));const h=k=>{if(!Reflect.has(k,"fieldType"))return"";const y=rf.find(C=>C.value==k.fieldType);return(y==null?void 0:y.key)||""},f=k=>Reflect.has(k,"useScenes")?(k.formCustomComponentes??[]).filter(y=>k.useScenes.includes(y.permissionCode)):[],d=k=>(k.formCustomComponentes||[]).filter(y=>y.isFieldCustom).map(y=>`${y.btnName}:是`).join(),m=(k,y)=>{if(a==null){const C=u.value.length;u.value.push({...k,sort:(C+1)*10})}else u.value[a]={...k,postRequestParams:[...k.postRequestParams],useScenes:[...k.useScenes],formCustomComponentes:[...k.formCustomComponentes]};n("update:modelValue",u.value),y(!0)},O=async()=>{try{o.tableLoading=!0,u.value=(s.modelValue||[]).map(k=>({...k,sort:k.sort?k.sort:0})).sort((k,y)=>k.sort-y.sort),o.tableLoading=!1}catch(k){o.tableLoading=!1,console.error(k)}};l.watch(()=>s.modelValue,async(k,y)=>{await O()},{deep:!0,immediate:!0});const w=()=>{a=null,o.dialogData={},o.showAddFieldDialog=!0},g=k=>{a=k.$index,o.dialogData=k.row,o.showAddFieldDialog=!0},p=()=>{n("update:modelValue",u.value)},b=k=>{u.value.splice(k.$index,1),n("update:modelValue",u.value)};return(k,y)=>{const C=l.resolveComponent("el-button"),T=l.resolveComponent("el-tag"),x=l.resolveComponent("el-badge"),A=l.resolveComponent("el-input-number"),R=l.resolveComponent("a-table"),_=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(_,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[l.createElementVNode("div",Uy,[y[3]||(y[3]=l.createElementVNode("div",{class:"card-header-title"},"字段配置",-1)),l.createVNode(C,{class:"card-header-operate",type:"primary",icon:"Plus",onClick:y[0]||(y[0]=S=>w())},{default:l.withCtx(()=>[...y[2]||(y[2]=[l.createTextVNode("添加字段",-1)])]),_:1})])]),default:l.withCtx(()=>[l.createVNode(R,{loading:l.unref(o).tableLoading,headers:l.unref(c),data:l.unref(u),showPagination:!1},{fieldType:l.withCtx(({scope:S})=>[l.createTextVNode(l.toDisplayString(h(S.row)),1)]),useScenes:l.withCtx(({scope:S})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f(S.row),(P,Q)=>(l.openBlock(),l.createBlock(x,{key:Q,value:P.isFieldCustom?"C":"",offset:[-5,5]},{default:l.withCtx(()=>[l.createVNode(T,{style:{margin:"0 4px"},type:"success",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(P.btnName),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),formCustomComponentes:l.withCtx(({scope:S})=>[d(S.row)?(l.openBlock(),l.createBlock(T,{key:0,type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d(S.row)),1)]),_:2},1024)):l.createCommentVNode("",!0)]),sort:l.withCtx(({scope:S})=>[l.createVNode(A,{modelValue:S.row.sort,"onUpdate:modelValue":P=>S.row.sort=P,min:0,onChange:p},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:S})=>[l.createVNode(C,{type:"primary",text:"",size:"small",icon:"EditPen",onClick:P=>g(S)},{default:l.withCtx(()=>[...y[4]||(y[4]=[l.createTextVNode("编辑",-1)])]),_:1},8,["onClick"]),l.createVNode(C,{type:"danger",text:"",size:"small",icon:"Delete",onClick:P=>b(S)},{default:l.withCtx(()=>[...y[5]||(y[5]=[l.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]),_:1},8,["loading","headers","data"]),l.createVNode(l.unref(t),{visible:l.unref(o).showAddFieldDialog,"onUpdate:visible":y[1]||(y[1]=S=>l.unref(o).showAddFieldDialog=S),title:l.unref(o).dialogTitle,configData:s.data,data:l.unref(o).dialogData,onRefresh:m},null,8,["visible","title","configData","data"])]),_:1})}}},[["__scopeId","data-v-5ac6753d"]]),qQ="",Wy={class:"dialog-footer"},qy=ct({__name:"dialogInitConfig",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=on.useRoute(),n=l.inject("apiPrefix"),s=l.inject("request"),r=e,o=i;l.computed(()=>t.params.key);const a=()=>({dataBase:"",api:""}),c=()=>({loading:!1,btnLoading:!1});let u=l.reactive(c()),h=l.ref([]),f=l.ref(null),d=l.ref(a());const m=k=>s({url:`${n}/scripts/getAllDatabaseTable`,method:"get",data:k}),O=async()=>{try{u.loading=!0;const{data:k}=await m();h.value=k||[],u.loading=!1}catch(k){console.error(k),u.loading=!1}};l.watch(()=>o.visible,async(k,y)=>{k&&await O()});const w=()=>({sort:0,fieldName:void 0,fieldKey:void 0,fieldType:void 0,fieldUiProps:"",fieldSubmitType:"string",fieldRequestType:"GET",fieldRequestUrl:void 0,postRequestParams:[],useScenes:[],formColumnCol:12,formCustomComponentes:[],customTableHeaderName:"",customTableHeaderUrl:"",isFormFieldRequired:!0,isFormSetValue:!0,isFormDisabled:!1,tableQueryCondition:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),g=k=>{p(),k()},p=()=>{d.value=Object.assign(d.value,a()),f.value.resetFields(),r("update:visible",!1)},b=k=>{k&&k.validate(async y=>{if(y)try{u.btnLoading=!0;const{data:C}=await s({url:`${n}/scripts/getAllColumnsByTableName`,method:"get",params:{tableName:d.value.dataBase}}),T=(C||[]).map(x=>{let A=w();return A.fieldName=x.comment,A.fieldKey=x.name,A.fieldType="string",A});r("refresh",{formList:T},()=>{p()}),u.btnLoading=!1}catch(C){console.error(C),u.btnLoading=!1}})};return(k,y)=>{const C=l.resolveComponent("el-option"),T=l.resolveComponent("el-select"),x=l.resolveComponent("el-form-item"),A=l.resolveComponent("el-input"),R=l.resolveComponent("el-form"),_=l.resolveComponent("el-button"),S=l.resolveComponent("el-dialog"),P=l.resolveDirective("loading"),Q=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(S,{"model-value":o.visible,title:o.title,top:"10vh",width:"600",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":g},{footer:l.withCtx(()=>[l.createElementVNode("span",Wy,[l.createVNode(_,{loading:l.unref(u).btnLoading,onClick:p},{default:l.withCtx(()=>[...y[3]||(y[3]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(_,{type:"primary",loading:l.unref(u).btnLoading,onClick:y[2]||(y[2]=E=>b(l.unref(f)))},{default:l.withCtx(()=>[...y[4]||(y[4]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[Q]])])]),default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(R,{ref_key:"formRef",ref:f,model:l.unref(d),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(x,{label:"数据库","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"dataBase"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(d).dataBase,"onUpdate:modelValue":y[0]||(y[0]=E=>l.unref(d).dataBase=E),placeholder:"请选择数据库",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(h),(E,W)=>(l.openBlock(),l.createBlock(C,{key:E,label:`${E.tableComment}【${E.tableName}】`,value:E.tableName},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l.createVNode(x,{label:"接口地址(关键字)","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"api"},{default:l.withCtx(()=>[l.createVNode(A,{modelValue:l.unref(d).api,"onUpdate:modelValue":y[1]||(y[1]=E=>l.unref(d).api=E),placeholder:"请输入接口地址(关键字)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[P,l.unref(u).loading]])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-5c2c8b66"]]),zQ="",jy={class:"page-container"},zy={class:"submit-box"},Yy={class:"submit-box-r"},af=ct({__name:"index",props:{pageKey:{type:String,default:""},id:{type:String,default:void 0}},setup(i){const e=on.useRoute(),t=on.useRouter(),n=l.inject("apiPrefix"),s=l.inject("request"),r=i;let o=r.id??void 0,a=r.pageKey?r.pageKey:e.params.key,c=l.ref([]),u=l.ref(),h=l.ref([]),f=l.ref({}),d=l.ref(null),m=l.ref(null),O=l.ref(null),w=l.ref({}),g=l.ref({}),p=l.ref([]),b=l.ref([]),k=l.reactive({pageLoading:!1,saveBtnLoading:!1,showDialogInitConfig:!1});const y=B=>s({url:`${n}/pages/getPageDetail?key=${B}`,method:"get"}),C=B=>s({url:`${n}/pageConfigs/createOrEdit`,method:"post",data:B}),T=B=>s({url:`${n}/sysMenus/getAllList`,method:"post",data:B}),x=B=>s({url:`${n}/sysDataDictionaries/getDictionaryByGroup?groupName=${B}`,method:"get"}),A=async()=>{const{data:B}=await T({dynamicFilters:[{field:"url",operate:"Equal",value:"/pages"}]});c.value=B||[]},R=async()=>{try{const{data:{pageConfigs:B}}=await y(a),I=JSON.parse(B.pageConfig)||{};o=B.pageId,console.log("pageConfigData",I),f.value=I,w.value={...I.tableConfig??{}},g.value={...I.formConfig??{}},p.value=[...I.buttons??[]],b.value=[...I.fields??[]]}catch(B){console.error(B)}},_=()=>{w.value={},g.value={},p.value=[],b.value=[],R()};l.provide("conditionList",()=>h),l.provide("pageKey",()=>l.ref(a)),l.provide("configData",()=>f),l.onMounted(async()=>{try{k.pageLoading=!0,await A(),u.value=e.params.id,h.value=(await x("Condition")).data||[],await R(),k.pageLoading=!1}catch(B){k.pageLoading=!1,console.error(B)}});const S=B=>{const I=c.value.find(G=>G.id==B);t.replace({path:`/actConfig/${I.key}/${I.id}`}),u.value=I.id,a=I.key,R()},P=()=>{k.showDialogInitConfig=!0},Q=({formList:B},I)=>{b.value=[...B],I(!0)},E=()=>{let B={id:o,key:a,pageConfig:{tableConfig:d.value.form,formConfig:m.value.form,buttons:O.value.getTableSelectionRows(),fields:b.value}};B.pageConfig=JSON.stringify(B.pageConfig),k.saveBtnLoading=!0,C(B).then(I=>{Ve.ElNotification({title:"提示",message:"保存成功",type:"success",duration:2500}),_(),k.saveBtnLoading=!1}).catch(I=>{k.saveBtnLoading=!1})},W=async()=>{Promise.all([d.value.formRef.validate(),m.value.formRef.validate()]).then(B=>{B.every(I=>I)&&E()}).catch(B=>B)};return(B,I)=>{const G=l.resolveComponent("el-button"),Z=l.resolveComponent("el-option"),H=l.resolveComponent("el-select"),j=l.resolveComponent("el-card"),z=l.resolveComponent("el-col"),me=l.resolveComponent("el-row"),de=l.resolveDirective("debounce"),ce=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createElementBlock("div",jy,[l.createVNode(me,{style:{margin:"0"},gutter:12},{default:l.withCtx(()=>[l.createVNode(z,{class:"header-operate",span:24},{default:l.withCtx(()=>[l.createVNode(j,{class:"form-card",shadow:"hover"},{default:l.withCtx(()=>[l.createElementVNode("div",zy,[I[10]||(I[10]=l.createElementVNode("div",{class:"submit-box-l"},null,-1)),l.createElementVNode("div",Yy,[l.withDirectives((l.openBlock(),l.createBlock(G,{style:{width:"120px"},type:"primary",loading:l.unref(k).initBtnLoading,onClick:I[0]||(I[0]=v=>P())},{default:l.withCtx(()=>[...I[8]||(I[8]=[l.createTextVNode("一键初始化配置",-1)])]),_:1},8,["loading"])),[[de]]),l.createVNode(H,{class:"menu-select",modelValue:l.unref(u),"onUpdate:modelValue":I[1]||(I[1]=v=>l.isRef(u)?u.value=v:u=v),placeholder:"菜单切换",clearable:"",filterable:"",onChange:S},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(c),v=>(l.openBlock(),l.createBlock(Z,{key:v.id,label:v.name,value:v.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l.withDirectives((l.openBlock(),l.createBlock(G,{style:{width:"120px"},type:"success",loading:l.unref(k).saveBtnLoading,onClick:I[2]||(I[2]=v=>W(B.formRef))},{default:l.withCtx(()=>[...I[9]||(I[9]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[de]])])])]),_:1})]),_:1}),l.createVNode(z,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Zy,{ref_key:"configTableRef",ref:d,modelValue:l.unref(w),"onUpdate:modelValue":I[3]||(I[3]=v=>l.isRef(w)?w.value=v:w=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Iy,{ref_key:"configFormRef",ref:m,modelValue:l.unref(g),"onUpdate:modelValue":I[4]||(I[4]=v=>l.isRef(g)?g.value=v:g=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Fy,{ref_key:"configBtnsRef",ref:O,modelValue:l.unref(p),"onUpdate:modelValue":I[5]||(I[5]=v=>l.isRef(p)?p.value=v:p=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Xy,{modelValue:l.unref(b),"onUpdate:modelValue":I[6]||(I[6]=v=>l.isRef(b)?b.value=v:b=v)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(qy,{visible:l.unref(k).showDialogInitConfig,"onUpdate:visible":I[7]||(I[7]=v=>l.unref(k).showDialogInitConfig=v),title:"一键初始化配置",onRefresh:Q},null,8,["visible"])])),[[ce,l.unref(k).pageLoading]])}}},[["__scopeId","data-v-8dfa8a8a"]]),Gy=(i,e)=>{let t=e.value||1e3,n,s=!1;i.addEventListener("click",r=>{n&&clearTimeout(n),s?r&&r.stopImmediatePropagation():s=!0,n=setTimeout(()=>{n=null,s=!1},t)},!0)},Tr={en:{act:{sort:"Serial Number",noData:"No Data",operate:"Operation",inputPlaceholder:"Please Input ",selectPlaceholder:"Please Select ",tip:"Tip",time:"Time",startTime:"Start Time",endTime:"End Time",loading:"ing",reset:"Reset",requiredMessage:"Required",customTableHeader:"Custom",developing:"In the process of feature development Coming soon",fieldCustom:"Custom",cancel:"Cancel",save:"Save",saveSuccessfully:"Save Successfully",configTableRow:"Please configure the table to select multiple columns",pleaseSelcet:"Please Selcet Need",data:"Data",success:"Success",buttonBindField:"The current button is not bound to a field",enter:"Enter",isExecuteOperate:"Are you sure to perform this operation",noConfigPage:"No Config Page",noImage:"No image",preview:"Preview",uploadText:"Drag the file here, or",clickUpload:"Click to upload",uploadLoading:"Upload loading...",uploadErrorTip:"The file type is incorrect. Please upload the file in the correct format again",uploadLimitTip:"Exceeding the file limit, please confirm and upload again.",expand:"Expand",retract:"Retract",formatCode:"FormatCode"}},zhCn:{act:{sort:"序号",noData:"暂无数据",operate:"操作",inputPlaceholder:"请输入",selectPlaceholder:"请选择",tip:"提示",time:"时间",startTime:"开始时间",endTime:"结束时间",loading:"中",reset:"重置",requiredMessage:"必填项",customTableHeader:"自定义表头(暂未创建文件)",developing:"功能开发中...敬请期待",fieldCustom:"当前字段为自定义,请在项目中创建对应组件",cancel:"取消",save:"保存",saveSuccessfully:"保存成功",configTableRow:"请配置表格多选列",pleaseSelcet:"请选择需要",data:"的数据",success:"成功",buttonBindField:"当前按钮未绑定字段",enter:"确定",isExecuteOperate:"是否确认执行此操作",noConfigPage:"暂无页面信息",noImage:"暂无",preview:"预览",uploadText:"将文件拖到此处,或",clickUpload:"点击上传",uploadLoading:"上传中...",uploadErrorTip:"文件类型不正确,请重新上传正确格式的文件。",uploadLimitTip:"超出文件数量限制,请确认后重新上传。",expand:"展开",retract:"收起",formatCode:"一键格式化代码"}}},cf={ActPage:sf,ActConfig:af},Ky={install(i,e){var m;const{modules:t,apiPrefix:n,request:s,themeColor:r,cacheTokenType:o="sessionStorage",cookieStorage:a,language:{messages:c={},en:u="zhCn"},menuAuthButtons:h}=e,f={act:Object.assign(Tr[u].act,((m=c[u])==null?void 0:m.act)??{})},d=Vh({locale:u,fallbackLocale:u,messages:{...Tr,[u]:f}});i.use(d),i.provide("actModules",t),i.provide("themeColor",r),i.provide("apiPrefix",n||"/api/v1"),i.provide("request",s),i.provide("cacheTokenType",o),i.provide("cookieStorage",a),i.provide("menuAuthButtons",h),i.directive("debounce",Gy),Object.keys(cf).forEach(O=>{i.component(O,cf[O])})}},Hy={ActPage:sf,ActConfig:af};function Jy(i){var o;const{modules:e,language:{messages:t={},en:n="zhCn"}}=i,s={act:Object.assign(Tr[n].act,((o=t[n])==null?void 0:o.act)??{})};return Vh({locale:n,fallbackLocale:n,messages:{...Tr,[n]:s}})}const GQ="",e1={key:0,class:"search-module-container"},t1={class:"no-config-field"},i1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{data:{type:Object,default:()=>({})}},emits:["reset","search"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>uf)),{t:n}=Kt(),s=l.inject("request"),r=l.inject("globalProps"),o=l.inject("loadComponents"),a=l.inject("getFieldUiProps"),c=l.inject("formatDataType"),u=l.inject("disposeDate"),h=l.inject("getDefaultQueryValues"),f=e,d=i,m=l.ref({});let O=l.ref([]),w=l.ref([]),g=l.ref(!0);const p=l.ref(0),b=l.ref(0),k=S=>d.data.tableConfig.isExpandQuery&&g.value?d.data.tableConfig.tableQueryRowWidth>S+1:!0,y=async S=>{O.value=await Promise.all(S.filter(P=>P.useScenes.includes("tableSearch")).map(async P=>{P.tableQueryDefaultValue&&(["date","dateRange"].includes(P.fieldType)?P.queryValue=u(P):P.queryValue=P.tableQueryDefaultValue?P.tableQueryDefaultValue:void 0),r.defaultParams.some(E=>{E.field==P.fieldKey&&E.operate===P.tableQueryCondition&&(P.queryValue=E.value)});const Q=(P.formCustomComponentes??[]).find(E=>E.permissionCode==="tableSearch");if(P.isQueryFieldCustom=!1,Q&&Q.isFieldCustom){const{isFieldCustom:E,customComponentName:W,customComponentUrl:B}=Q;if(P.isQueryFieldCustom=!0,b.value++,E&&!P.customQueryComponent){const I=await o(B,W);P.customQueryComponent=I}}return P}))},C=S=>{const P=(S||[]).filter(Q=>Q.permissionCode===1001).map(Q=>({...Q,loading:!1}));w.value=[...P,{btnName:n("act.reset"),permissionCode:"9999",btnColor:"info",btnIcon:"btn-reset",loading:!1}]},T=async({node:S,resolve:P},Q)=>{const E=a(Q),{label:W,value:B,children:I,isLeaf:G}={...Cr,...E.treeProps||{}};if(S[G])return P([]);const Z=Q.postRequestParams.filter(ce=>ce.submitType==="default").reduce((ce,v)=>(ce[v.submitName]=c(v.paramsType,v.submitValue),ce),{}),H=Q.postRequestParams.filter(ce=>ce.submitType==="match").reduce((ce,v)=>(ce[v.submitName]=c(v.paramsType,r.matchData[v.submitValue][v.submitName]),ce),{}),j=Q.postRequestParams.filter(ce=>ce.submitType==="dynamic").map(ce=>({field:ce.submitName,operate:ce.submitMatchType,value:E.loadCode?S==null?void 0:S.data.value:c(ce.paramsType,ce.submitValue)}));let z={};Object.keys(Z).length&&(z={...z,...Z}),Object.keys(H).length&&(z={...z,...H}),j.length&&(z.dynamicFilters=j),E.loadCode&&Reflect.has(z,E.loadCode)&&(z[E.loadCode]=S==null?void 0:S.data.value);const{data:me}=await s({url:Q.fieldRequestUrl,method:Q.fieldRequestType||"GET",data:z}),de=(me||[]).map(ce=>({label:ce[W],value:ce[B],children:[],isLeaf:ce[G]}));P(de)};l.watch(()=>d.data,(S,P)=>{y(S.fields),C(S.buttons)},{immediate:!0,deep:!0});const x=()=>{p.value++,p.value===b.value&&A({permissionCode:1001})},A=S=>{switch(S.loading=!0,S.permissionCode){case"9999":O.value.forEach(E=>{E.tableQueryDefaultValue?E.queryValue=["date","dateRange"].includes(E.fieldType)?u(E):(E==null?void 0:E.tableQueryDefaultValue)||void 0:E.queryValue=E.fieldType.includes("&")?[]:void 0});const P=h();f("reset",P,()=>{S.loading=!1});break;default:const Q=O.value.filter(E=>Array.isArray(E.queryValue)?E.queryValue.length:!!E.queryValue);f("search",Q,()=>{S.loading=!1});break}},R=()=>{g.value=!g.value},_=()=>{A({permissionCode:1001})};return(S,P)=>{var ce;const Q=l.resolveComponent("el-input"),E=l.resolveComponent("el-option"),W=l.resolveComponent("el-select"),B=l.resolveComponent("el-select-v2"),I=l.resolveComponent("el-cascader"),G=l.resolveComponent("el-tree-select"),Z=l.resolveComponent("el-date-picker"),H=l.resolveComponent("el-form-item"),j=l.resolveComponent("a-svg-icon"),z=l.resolveComponent("el-button"),me=l.resolveComponent("el-form"),de=l.resolveDirective("debounce");return l.unref(O)&&l.unref(O).length?(l.openBlock(),l.createElementBlock("div",e1,[l.createVNode(me,{style:l.normalizeStyle({"--table-query-row":d.data.tableConfig.tableQueryRowWidth}),class:"form-content",ref:"elForm","label-suffix":":","label-position":"right"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(O),(v,N)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:N},[k(N)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[v.isQueryFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[v.customQueryComponent?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(v.customQueryComponent),{key:0,class:"custom-btn",ref_for:!0,ref:q=>m.value[`customQueryComponent_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,queryItem:v,data:d.data,onRefresh:P[9]||(P[9]=q=>A({permissionCode:1001})),onLoaded:x},null,40,["modelValue","onUpdate:modelValue","queryItem","data"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:N},[l.createElementVNode("span",t1,"【"+l.toDisplayString(v.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(n)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(H,{key:0,class:"search-form-item","label-width":d.data.tableConfig.tableQueryLabelWidth,label:v.fieldName},{default:l.withCtx(()=>[v.fieldType==="input"||v.fieldType==="editor"?(l.openBlock(),l.createBlock(Q,l.mergeProps({key:0,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${v.fieldName}`,clearable:""},{ref_for:!0},l.unref(a)(v),{onKeyup:P[0]||(P[0]=l.withKeys(l.withModifiers(q=>A({permissionCode:1001}),["prevent"]),["enter","native"])),onClear:_}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):l.createCommentVNode("",!0),v.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${v.fieldName}`,clearable:"",onKeyup:P[1]||(P[1]=l.withKeys(l.withModifiers(q=>A({permissionCode:1001}),["prevent"]),["enter","native"]))},{ref_for:!0},l.unref(a)(v)),null,16,["modelValue","onUpdate:modelValue","placeholder"])):["select","switch","multipleSelect"].includes(v.fieldType)?(l.openBlock(),l.createBlock(W,l.mergeProps({key:2,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{multiple:v.fieldType==="multipleSelect","collapse-tags":v.fieldType==="multipleSelect","collapse-tags-tooltip":v.fieldType==="multipleSelect",onChange:P[2]||(P[2]=q=>A({permissionCode:1001}))}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(v.dataList,(q,J)=>(l.openBlock(),l.createBlock(E,{key:J,label:q.key,value:q.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","collapse-tags","collapse-tags-tooltip"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(v.fieldType)?(l.openBlock(),l.createBlock(B,l.mergeProps({key:3,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,options:v.dataList,props:{...l.unref(nf)},placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{"collapse-tags":v.fieldType==="virtualizedMultipleSelect","collapse-tags-tooltip":v.fieldType==="virtualizedMultipleSelect",multiple:v.fieldType==="virtualizedMultipleSelect",onChange:P[3]||(P[3]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","collapse-tags","collapse-tags-tooltip","multiple"])):v.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(I,l.mergeProps({key:4,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,options:v.dataList,props:{...l.unref(tf)},clearable:"",filterable:"",placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`},{ref_for:!0},l.unref(a)(v),{onChange:P[4]||(P[4]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder"])):v.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(G,l.mergeProps({key:5,ref_for:!0,ref:q=>m.value[`elTreeSelect_fullLoad_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,data:v.dataList,placeholder:`请选择${v.fieldName}`,props:{...l.unref(Cr),...l.unref(a)(v).treeProps||{}},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[5]||(P[5]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","data","placeholder","props"])):v.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(G,l.mergeProps({key:6,ref_for:!0,ref:q=>m.value[`elTreeSelect_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`请选择${v.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(q,J)=>T({node:q,resolve:J},v)},{ref_for:!0},l.unref(a)(v),{onChange:P[6]||(P[6]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):v.fieldType==="date"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:7,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,type:"date",placeholder:`${l.unref(n)("act.selectPlaceholder")}${l.unref(n)("act.time")}`,"value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[7]||(P[7]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):v.fieldType==="dateRange"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:8,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,type:"daterange","start-placeholder":l.unref(n)("act.startTime"),"end-placeholder":l.unref(n)("act.endTime"),"value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[8]||(P[8]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder"])):l.createCommentVNode("",!0)]),_:2},1032,["label-width","label"]))],64)):l.createCommentVNode("",!0)],64))),128)),l.unref(O).length?(l.openBlock(),l.createBlock(H,{key:0,class:"search-form-btn","label-width":"0"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(v,N)=>l.withDirectives((l.openBlock(),l.createBlock(z,{key:N,type:v.btnColor,loading:v.loading,onClick:q=>A(v)},{default:l.withCtx(()=>[v.btnIcon?(l.openBlock(),l.createBlock(j,{key:0,class:"mr6",name:v.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(v.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[de]])),128))]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["style"]),d.data.tableConfig.isExpandQuery&&((ce=l.unref(O))==null?void 0:ce.length)>d.data.tableConfig.tableQueryRowWidth?(l.openBlock(),l.createBlock(z,{key:0,class:"expand",text:"",size:"small",icon:l.unref(g)?"ArrowDown":"ArrowUp",onClick:R},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)?l.unref(n)("act.expand"):l.unref(n)("act.retract")),1)]),_:1},8,["icon"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)}}},[["__scopeId","data-v-cdf7c817"]])},Symbol.toStringTag,{value:"Module"})),JQ="",n1={class:"header-operate-container"},s1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{data:{type:Object,default:()=>({})}},emits:["onOperate"],setup(i,{emit:e}){const t=e,n=i,{t:s}=Kt();let r=l.ref([]);const o=l.inject("globalProps"),a=l.inject("menuPermissionBtns"),c=l.inject("stringToBoolean"),u=l.inject("matchCondition"),h=l.inject("getTableData"),f=l.inject("tableBtnRefs"),d=l.inject("refreshTable"),m=l.computed(()=>{const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return!y||y>=r.value.length}),O=()=>{const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return m.value?r.value:r.value.slice(0,y)},w=()=>{var C;const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return m.value?[]:r.value.slice(y,(C=r.value)==null?void 0:C.length)},g=y=>{if(!y.matchFields.length)return!0;const C=y.matchFields.filter(_=>_.matchType!="default"),T=_=>o.matchData[_.matchType][_.matchFieldName];let A=C.reduce((_,S,P)=>{const Q=T(S);return _+=u(S.matchCondition,Q,S.fieldValue==""?null:S.fieldValue=="true"||S.fieldValue=="false"?c(S.fieldValue):S.fieldValue),P!==C.length-1&&(_+=S.spliceCondition||"&&"),_},"").split("||"),R=A.reduce((_,S,P)=>(_+=`(${S})`,P<A.length-1&&(_+="||"),_),"");return new Function(`return ${R}`)()},p=y=>a.value.some(C=>C.unique==y.permissionCode)&&g(y),b=y=>{r.value=(y||[]).filter(C=>C.permissionCode!==1001&&C.btnPostion.includes("header")).sort((C,T)=>C.sort-T.sort).map(C=>(C.btnAlias&&(C.btnName=C.btnAlias),Reflect.has(C,"isPromptVerificationSelectTable")||(C.isPromptVerificationSelectTable="1"),C))};l.watch(()=>n.data,(y,C)=>{b(y.buttons)},{immediate:!0});const k=y=>{t("onOperate",y,{})};return(y,C)=>{const T=l.resolveComponent("a-svg-icon"),x=l.resolveComponent("el-button"),A=l.resolveComponent("el-icon"),R=l.resolveComponent("el-dropdown-item"),_=l.resolveComponent("el-dropdown-menu"),S=l.resolveComponent("el-dropdown"),P=l.resolveDirective("debounce");return l.openBlock(),l.createElementBlock("div",n1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(O(),(Q,E)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Q.permissionCode},[p(Q)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Q.isCustomBtn&&Q.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q[Q.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:W=>l.unref(f)[`${Q.customComponentName}-${Q.permissionCode}`]=W,buttonData:Q,onRefresh:C[0]||(C[0]=W=>l.unref(h)()),onRefreshTable:C[1]||(C[1]=W=>l.unref(d)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`],onClick:W=>k(Q)},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[P]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`],onClick:W=>k(Q)},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[P]])],64)):l.createCommentVNode("",!0)],64))),128)),m.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(S,{key:0,class:"header-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(_,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(w(),(Q,E)=>(l.openBlock(),l.createBlock(R,{key:Q.permissionCode,onClick:W=>k(Q)},{default:l.withCtx(()=>[p(Q)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Q.isCustomBtn&&Q.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q[Q.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:W=>l.unref(f)[`${Q.customComponentName}-${Q.permissionCode}`]=W,buttonData:Q,onRefresh:C[2]||(C[2]=W=>l.unref(h)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`]},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading"])),[[P]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`]},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading"])),[[P]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:l.withCtx(()=>[l.createVNode(x,{type:"primary"},{default:l.withCtx(()=>[C[3]||(C[3]=l.createTextVNode(" 更多按钮",-1)),l.createVNode(A,{class:"el-icon--right"},{default:l.withCtx(()=>[l.createVNode(l.unref(cy))]),_:1})]),_:1})]),_:1}))])}}},[["__scopeId","data-v-d86fe71c"]])},Symbol.toStringTag,{value:"Module"})),iE="",r1={class:"act-table"},o1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{loading:{type:Boolean,default:!1},maxHeight:{type:Number,default:600},total:{type:Number,default:0},tableQuery:{type:Object,default:()=>({pageIndex:1,pageSize:10})},selection:{type:Array,default:()=>[]},headers:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},showSerialNumber:{type:Boolean,default:!0},showPagination:{type:Boolean,default:!0},rowKey:{type:String,default:"id"},treeProps:{type:Object,default:()=>({children:"children",hasChildren:"hasChildren"})},tableConfig:{type:Object,default:()=>({})}},emits:["update:tableQuery","update:selection","changeSelection","refresh","onRowClick","changeExpand"],setup(i,{expose:e,emit:t}){const{t:n}=Kt(),s=t,r=i;let o=l.ref(null);const a=p=>r.showPagination?p+1+(r.tableQuery.pageIndex-1)*r.tableQuery.pageSize:p+1,c=p=>{l.nextTick(()=>{r.data.forEach(b=>{p.includes(b[r.rowKey])&&o.value.toggleRowSelection(b,!0)})})},u=()=>{o.value.clearSelection()},h=p=>o.value.getSelectionRows();l.watch(()=>r.selection,(p,b)=>{p&&p.length&&c(p)},{deep:!0,immediate:!0});const f=p=>{s("update:selection",p),s("changeSelection",p)},d=(p,b)=>{p&&l.nextTick(()=>{let k=b;r.data.forEach(y=>{r.rowKey&&(k=r.rowKey),r.tableConfig.rowKey&&(k=r.tableConfig.rowKey),p.includes(y[k])&&o.value.toggleRowSelection(y,!0)})})},m=p=>{s("update:tableQuery",{...r.tableQuery,pageSize:p}),s("refresh",[])},O=p=>{s("update:tableQuery",{...r.tableQuery,pageIndex:p}),s("refresh",[])},w=(p,b,k)=>{s("onRowClick",p,b,k)},g=(p,b)=>{s("changeExpand",p,b)};return e({getSelectionRows:h,updateSelection:d,clearSelection:u}),(p,b)=>{const k=l.resolveComponent("el-table-column"),y=l.resolveComponent("el-table"),C=l.resolveComponent("el-pagination"),T=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",r1,[l.withDirectives((l.openBlock(),l.createBlock(y,l.mergeProps({style:{width:"100%"},ref_key:"tableRef",ref:o,data:r.data,stripe:"",border:"","highlight-current-row":"","max-height":r.maxHeight,"row-key":r.rowKey,"default-expand-all":"","tree-props":i.treeProps},r.tableConfig,{onSelectionChange:f,onRowClick:w,onExpandChange:g}),{empty:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.data.length||r.data.length==0?l.unref(n)("act.noData"):""),1)]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.headers,x=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:x.prop},[x.isCustomTableHeader?l.renderSlot(p.$slots,x.prop,{key:0},void 0,!0):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.render?(l.openBlock(),l.createBlock(k,{key:0,label:x.label,align:x.align,width:x.width,minWidth:x.minWidth,sortable:x.sort,"show-overflow-tooltip":x.prop=="operate"?!1:x.showOverflowTooltip,fixed:x.fixed},{default:l.withCtx(A=>[l.renderSlot(p.$slots,x.prop,{scope:A},void 0,!0)]),_:2},1032,["label","align","width","minWidth","sortable","show-overflow-tooltip","fixed"])):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.prop=="checkbox"?(l.openBlock(),l.createBlock(k,{key:0,type:"selection",align:"center",width:x.width,fixed:""},null,8,["width"])):x.prop=="serialNumber"?(l.openBlock(),l.createBlock(k,{key:1,index:a,type:"index",align:"center",width:x.width,label:l.unref(n)("act.sort"),fixed:""},null,8,["width","label"])):(l.openBlock(),l.createBlock(k,{key:2,prop:x.prop,label:x.label,align:x.align,sortable:x.sort,"show-overflow-tooltip":x.showOverflowTooltip,width:x.width,"min-width":x.minWidth,fixed:x.fixed},null,8,["prop","label","align","sortable","show-overflow-tooltip","width","min-width","fixed"]))],64))],64))],64))),128))]),_:3},16,["data","max-height","row-key","tree-props"])),[[T,r.loading]]),r.showPagination?(l.openBlock(),l.createBlock(C,{key:0,class:"table-pagination","current-page":r.tableQuery.pageIndex,"onUpdate:currentPage":b[0]||(b[0]=x=>r.tableQuery.pageIndex=x),"page-size":r.tableQuery.pageSize,"onUpdate:pageSize":b[1]||(b[1]=x=>r.tableQuery.pageSize=x),"page-sizes":[10,20,50,75,100,200,500],background:"",layout:"total, sizes, prev, pager, next, jumper",total:r.total,onSizeChange:m,onCurrentChange:O},null,8,["current-page","page-size","total"])):l.createCommentVNode("",!0)])}}},[["__scopeId","data-v-b5ec4a41"]])},Symbol.toStringTag,{value:"Module"})),rE="",l1={class:"no-config-field"},a1={class:"dialog-footer"},c1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>uf)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>hf)),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>N1)),r=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Y1)),{t:o}=Kt(),a=l.inject("request"),c=l.inject("loadComponents"),u=l.inject("formatDataType"),h=l.inject("globalProps"),f=l.inject("stringToBoolean"),d=l.inject("getFieldUiProps"),m=l.inject("disposeRequestData"),O=e,w=i,g=l.ref(!1),p=l.ref(!1),b=l.ref(null),k=l.ref([]),y=l.ref({}),C=l.ref({}),T=Z=>Z.formColumnCol==null?24:Z.formColumnCol?Z.formColumnCol:24/Z.formRow,x=Z=>["input","textarea"].includes(Z.fieldType)?"blur":(["select","multipleSelect","datetimerange","treeSelect","provinceCascade"].includes(Z.fieldType),"change"),A=async({node:Z,resolve:H},j)=>{const z=d(j),{label:me,value:de,children:ce,isLeaf:v}={...Cr,...z.treeProps||{}};if(Z[v])return H([]);const N=j.postRequestParams.filter(Re=>Re.submitType==="default").reduce((Re,Ge)=>(Re[Ge.submitName]=u(Ge.paramsType,Ge.submitValue),Re),{}),q=j.postRequestParams.filter(Re=>Re.submitType==="match").reduce((Re,Ge)=>(Re[Ge.submitName]=u(Ge.paramsType,h.matchData[Ge.submitValue][Ge.submitName]),Re),{}),J=j.postRequestParams.filter(Re=>Re.submitType==="dynamic").map(Re=>{let Ge={field:Re.submitName,operate:Re.submitMatchType,value:u(Re.paramsType,Re.submitValue)};return z.loadCode===Re.submitName&&(Z!=null&&Z.data.value)&&(Ge.value=Z==null?void 0:Z.data.value),Ge});let Ce={};Object.keys(N).length&&(Ce={...Ce,...N}),Object.keys(q).length&&(Ce={...Ce,...q}),J.length&&(Ce.dynamicFilters=J),z.loadCode&&Reflect.has(Ce,z.loadCode)&&(Ce[z.loadCode]=Z==null?void 0:Z.data.value);const{data:xi}=await a({url:j.fieldRequestUrl,method:j.fieldRequestType||"GET",data:Ce}),Bi=(xi||[]).map(Re=>({label:Re[me],value:Re[de],children:[],isLeaf:Re[v]}));H(Bi)},R=Z=>{if(!["input","textarea"].includes(Z)){if(["multipleSelect","dateRange"].includes(Z))return[];if(["switch"].includes(Z))return!1}},_=(Z,H)=>{if(typeof Z=="string"&&["string"].includes(H))return Z.toString();if(["string"].includes(H))return Z.sort((j,z)=>j.sort-z.sort).join(";");if(["number"].includes(H))return Number(Z);if(["array"].includes(H))return Z.sort((j,z)=>j.sort-z.sort)},S=(Z,H=!1)=>{if(["multipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";").map(z=>H?{value:z}:z):[];if(["virtualizedMultipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";"):[];if(["dateRange","provinceCascade"].includes(Z.fieldType)){const z=Z.fieldKey.split("&");return w.data.rowData[Z.fieldKey]=z.map(me=>w.data.rowData[me]),w.data.rowData[Z.fieldKey]}let j=w.data.rowData[Z.fieldKey];if(["select"].includes(Z.fieldType)){const z=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][z["value-key"]?z["value-key"]:"value"]=="string"&&j!==null&&(j=H?{value:j.toString()}:j.toString())}if(["virtualizedSelect"].includes(Z.fieldType)){const z=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][z["value-key"]?z["value-key"]:"value"]=="string"&&j!==null&&(j=j.toString())}return(j==="true"||j==="false")&&(j=f(j)),j},P=Z=>a({url:w.data.dataItem.requestUrl,method:"post",data:Z});l.watch(()=>w.visible,async(Z,H)=>{var j,z;if(Z)try{g.value=!0;const me=await m(w.data.formList,w.data.rowData,!1,!0);console.log("formList",(j=w.data)==null?void 0:j.formList),k.value=await Promise.all((((z=w.data)==null?void 0:z.formList)??[]).sort((de,ce)=>de.sort-ce.sort).map(async de=>{const ce=me.find(J=>de.fieldName==J.fieldName&&de.fieldKey==J.fieldKey);ce&&(de.dataList=(ce==null?void 0:ce.dataList)??[]),["select","multipleSelect"].includes(de.fieldType)&&(y.value[`${de.fieldKey}ActImplicit`]=Object.keys(w.data.rowData).length&&de.isFormSetValue?S(de,!0):R(de.fieldType)),y.value[de.fieldKey]=Object.keys(w.data.rowData).length&&de.isFormSetValue?S(de):R(de.fieldType),y.value[de.fieldKey]=de.fieldDefaultValue&&!y.value[de.fieldKey]?_(de.fieldDefaultValue,de.fieldSubmitType):y.value[de.fieldKey];const{isFieldCustom:v,customComponentName:N,customComponentUrl:q}=de.customFiledsComponentes;if(v&&!de.customFiledsComponentes[N]){const J=await c(q,N);de.customFiledsComponentes[N]=J}return de})),g.value=!1}catch(me){console.error(me),g.value=!1}});const Q=Z=>{E(),Z()},E=()=>{k.value=[],b.value.resetFields(),O("update:visible",!1)},W=(Z,H)=>{const j=d(H),{fieldKey:z,fieldType:me}=H;if(me==="multipleSelect"){const de=Z.filter(v=>typeof v=="string"),ce=Z.filter(v=>typeof v!="string").map(v=>v.value);y.value[j.createFieldKey]=de.length?_(de,"string"):"",y.value[z]=ce.length?_(ce,"string"):""}else typeof Z=="string"?(y.value[j.createFieldKey]=Z,y.value[z]=""):(y.value[z]=Z.value,delete y.value[j.createFieldKey])},B=(Z,H)=>{const{fieldKey:j,fieldType:z}=H;z==="multipleSelect"?Z===void 0&&(y.value[j]=[]):Z===void 0&&(y.value[j]="")},I=Z=>{Z&&Z.validate(H=>{if(H){const{dataItem:j,rowData:z}=w.data;let me={...l.toRaw(y.value)};p.value=!0,console.log(me),console.log(k.value),Object.keys(me).forEach(v=>{if(v.includes("ActImplicit")){delete me[v];return}const N=k.value.find(q=>q.fieldKey===v);console.log(N),v.includes("&")?v.split("&").forEach((J,Ce)=>{me[J]=me[v]?_(me[v][Ce],N.fieldSubmitType):me[v]}):Array.isArray(me[v])&&(N==null?void 0:N.fieldSubmitType)=="string"&&(me[v]=_(me[v],"string"))});const de=j.submitFields.filter(v=>v.matchType=="default").reduce((v,N)=>(N.submitFieldType==="string"&&(v[N.submitFieldName]=N.matchFieldName.toString()),v),{}),ce=j.submitFields.filter(v=>v.matchType=="match").reduce((v,N)=>(Reflect.has(N,"submitFieldMatchOrigin")&&N.submitFieldMatchOrigin==="selections"?v[N.submitFieldName]=w.data.selections.map(q=>u(N.submitFieldType,q[N.matchFieldName])):Reflect.has(N,"submitFieldMatchOrigin")&&N.submitFieldMatchOrigin!="rowData"?Reflect.has(h.matchData,N.submitFieldMatchOrigin)&&(v[N.submitFieldName]=u(N.submitFieldType,h.matchData[N.submitFieldMatchOrigin][N.matchFieldName])):v[N.submitFieldName]=u(N.submitFieldType,z[N.matchFieldName]),v),{});P({...me,...de,...ce}).then(v=>{try{Ve.ElNotification({title:o("act.tip"),message:o("act.saveSuccessfully"),type:"success",duration:2500}),E(),O("refresh",j)}catch(N){console.error(N)}p.value=!1}).catch(v=>{console.error(v),p.value=!1})}})},G=Z=>{const H=Object.keys(C.value).map(j=>{var z;return(z=C.value[j])==null?void 0:z.updateFormData(y.value)}).filter(j=>j);Promise.all([Z.validate(),...H]).then(j=>{j.every(z=>z)&&I(Z)}).catch(j=>(console.error(j),j))};return(Z,H)=>{var Si;const j=l.resolveComponent("el-input"),z=l.resolveComponent("el-option"),me=l.resolveComponent("el-select"),de=l.resolveComponent("el-select-v2"),ce=l.resolveComponent("el-tree-select"),v=l.resolveComponent("el-date-picker"),N=l.resolveComponent("el-cascader"),q=l.resolveComponent("el-switch"),J=l.resolveComponent("el-form-item"),Ce=l.resolveComponent("el-col"),xi=l.resolveComponent("el-row"),Bi=l.resolveComponent("el-form"),Re=l.resolveComponent("el-button"),Ge=l.resolveComponent("el-dialog"),Ct=l.resolveDirective("loading"),zt=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(Ge,{"model-value":w.visible,title:w.title,top:"5vh",width:(Si=i.data.formConfig)==null?void 0:Si.dialogWidth,draggable:"",overflow:"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!1,"before-close":Q},{footer:l.withCtx(()=>[l.createElementVNode("span",a1,[l.createVNode(Re,{loading:p.value,onClick:E},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.cancel")),1)]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(Re,{type:"primary",loading:p.value,onClick:H[1]||(H[1]=V=>G(b.value))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.save")),1)]),_:1},8,["loading"])),[[zt]])])]),default:l.withCtx(()=>{var V,D;return[l.withDirectives((l.openBlock(),l.createBlock(Bi,{class:"a-form",ref_key:"formRef",ref:b,model:y.value,"label-suffix":":","label-width":(V=i.data.formConfig)==null?void 0:V.formLabelWidth,"label-position":(D=i.data.formConfig)==null?void 0:D.formLabelPosition},{default:l.withCtx(()=>[l.createVNode(xi,{gutter:40},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(k.value,(L,ne)=>(l.openBlock(),l.createBlock(Ce,{span:T(L),key:ne},{default:l.withCtx(()=>[L.customFiledsComponentes.isFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[L.customFiledsComponentes[L.customFiledsComponentes.customComponentName]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(L.customFiledsComponentes[L.customFiledsComponentes.customComponentName]),{key:0,ref_for:!0,ref:fe=>C.value[L.customFiledsComponentes.customComponentName]=fe,formConfig:i.data.formConfig,item:L,rowData:w.data.rowData,visible:w.visible,form:y.value,"onUpdate:form":H[0]||(H[0]=fe=>y.value=fe)},null,40,["formConfig","item","rowData","visible","form"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:ne},[l.createElementVNode("span",l1,"【"+l.toDisplayString(L.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(o)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(J,{key:0,label:L.fieldName,prop:["select","multipleSelect"].includes(L.fieldType)?`${L.fieldKey}ActImplicit`:L.fieldKey,rules:[{required:L.isFormFieldRequired,message:l.unref(o)("act.requiredMessage"),trigger:x(L)}]},{default:l.withCtx(()=>[L.fieldType==="input"?(l.openBlock(),l.createBlock(j,l.mergeProps({key:0,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,clearable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.createCommentVNode("",!0),L.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,clearable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="textarea"?(l.openBlock(),l.createBlock(j,l.mergeProps({key:2,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,rows:4},{ref_for:!0},l.unref(d)(L),{type:"textarea",disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="selectIcon"?(l.openBlock(),l.createBlock(l.unref(n),l.mergeProps({key:3,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,icons:L.dataList,placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(L.dataList,(fe,Le)=>(l.openBlock(),l.createBlock(z,{key:Le,label:fe.key,value:fe.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","icons","placeholder","disabled"])):["select","multipleSelect"].includes(L.fieldType)?(l.openBlock(),l.createBlock(me,l.mergeProps({key:4,modelValue:y.value[`${L.fieldKey}ActImplicit`],"onUpdate:modelValue":fe=>y.value[`${L.fieldKey}ActImplicit`]=fe,placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`,clearable:"",filterable:"","value-key":"value"},{ref_for:!0},l.unref(d)(L),{multiple:L.fieldType==="multipleSelect",disabled:L.isFormDisabled,onChange:fe=>W(fe,L)}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(L.dataList,(fe,Le)=>(l.openBlock(),l.createBlock(z,{key:Le,label:fe.key,value:fe},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","disabled","onChange"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(L.fieldType)?(l.openBlock(),l.createBlock(de,l.mergeProps({key:5,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,options:L.dataList,props:{...l.unref(nf)},placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled,multiple:L.fieldType==="virtualizedMultipleSelect",onChange:fe=>B(fe,L)}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled","multiple","onChange"])):L.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(ce,l.mergeProps({key:6,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,data:L.dataList,"default-expanded-keys":[y.value[L.fieldKey]||null],placeholder:`请选择${L.fieldName}`,props:{...l.unref(Cr),...l.unref(d)(L).treeProps||{}},"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","data","default-expanded-keys","placeholder","props"])):L.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(ce,l.mergeProps({key:7,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`请选择${L.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(fe,Le)=>A({node:fe,resolve:Le},L)},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):L.fieldType==="date"?(l.openBlock(),l.createBlock(v,l.mergeProps({key:8,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,type:"date",placeholder:`${l.unref(o)("act.selectPlaceholder")}${l.unref(o)("act.time")}`,"value-format":"YYYY-MM-DD HH:mm:ss"},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="dateRange"?(l.openBlock(),l.createBlock(v,l.mergeProps({key:9,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,type:"daterange","start-placeholder":l.unref(o)("act.startTime"),"end-placeholder":l.unref(o)("act.endTime"),"value-format":"YYYY-MM-DD HH:mm:ss"},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder","disabled"])):L.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(N,l.mergeProps({key:10,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,options:L.dataList,props:l.unref(tf),clearable:"",filterable:"",placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled"])):L.fieldType==="switch"?(l.openBlock(),l.createBlock(q,l.mergeProps({key:11,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,"active-value":!0,"inactive-value":!1},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue"])):L.fieldType==="upload"?(l.openBlock(),l.createBlock(l.unref(s),l.mergeProps({key:12,class:"form-upload",modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,request:l.unref(a)},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","request"])):L.fieldType==="editor"?(l.openBlock(),l.createBlock(l.unref(r),l.mergeProps({key:13,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,disabled:L.isFormDisabled,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","disabled","placeholder"])):l.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))]),_:2},1032,["span"]))),128))]),_:1})]),_:1},8,["model","label-width","label-position"])),[[Ct,g.value]])]}),_:1},8,["model-value","title","width"])}}},[["__scopeId","data-v-f23c8fd2"]])},Symbol.toStringTag,{value:"Module"})),aE="",u1=["innerHTML"],h1={class:"dialog-footer"},f1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const{t}=Kt(),n=e,s=i,r=()=>({loading:!1});let o=l.reactive(r());l.watch(()=>s.visible,async(u,h)=>{u&&(o.loading=!0,o.loading=!1)});const a=u=>{c(),u()},c=()=>{n("update:visible",!1)};return(u,h)=>{const f=l.resolveComponent("el-button"),d=l.resolveComponent("el-dialog");return l.openBlock(),l.createBlock(d,{"model-value":s.visible,title:s.title,top:"5vh",width:800,"append-to-body":"","destroy-on-close":"",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":a},{footer:l.withCtx(()=>[l.createElementVNode("span",h1,[l.createVNode(f,{onClick:c},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(t)("act.cancel")),1)]),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:i.data.editorContent},null,8,u1)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-95be1288"]])},Symbol.toStringTag,{value:"Module"})),hE="",d1={class:"dialog-footer"},p1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"dialogConfigBtn",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>hf)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>u_)),s=on.useRoute(),r=l.inject("apiPrefix"),o=l.inject("request"),a=e,c=i,u=l.computed(()=>s.params.key),h=()=>({btnLoading:!1});let f=l.reactive(h());const d=l.inject("createDefaultButtonItem"),m=l.inject("associationMenuList"),O=l.inject("conditionList")();let w=l.ref([]),g=l.ref(null),p=l.ref(d());const b=Q=>o({url:`${r}/icons/getAllList`,method:"post",data:Q}),k=async()=>{try{const{data:Q}=await b({dynamicFilters:[{field:"type",operate:"Equal",value:"2"}]});w.value=Q||[]}catch(Q){console.error(Q)}};l.watch(()=>c.visible,async(Q,E)=>{if(Q){await k();const W={...c.data};Object.keys(p.value).forEach(B=>{B=="submitFields"||B=="matchFields"?p.value[B]=[...W[B]||[]]:B=="isPromptVerificationSelectTable"?p.value[B]=W[B]??"1":p.value[B]=W[B]})}});const y=()=>{p.value.submitWay=void 0,p.value.customType=void 0,p.value.codeStr=void 0,p.value.customComponentName=void 0,p.value.customComponentUrl=void 0},C=()=>{p.value.submitFields.push({matchType:"match",submitFieldMatchOrigin:"rowData",submitFieldName:"",matchFieldName:"",submitFieldType:""})},T=Q=>{p.value.submitFields.splice(Q,1)},x=()=>{p.value.matchFields.push({matchType:"default",matchFieldName:"",matchCondition:"",fieldValue:"",spliceCondition:""})},A=Q=>{p.value.matchFields.splice(Q,1),p.value.matchFields.length===1&&(p.value.matchFields[0].spliceCondition="")},R=(Q,E)=>{Q.submitFieldMatchOrigin=E==="match"?"rowData":""},_=Q=>{S(),Q()},S=()=>{p.value=Object.assign(p.value,d()),g.value.resetFields(),a("update:visible",!1)},P=Q=>{Q&&Q.validate(E=>{if(E)try{f.btnLoading=!0,a("refresh",{...p.value,submitFields:[...p.value.submitFields],matchFields:[...p.value.matchFields]},()=>{S()}),f.btnLoading=!1}catch(W){console.error(W),f.btnLoading=!1}})};return(Q,E)=>{const W=l.resolveComponent("el-input"),B=l.resolveComponent("el-form-item"),I=l.resolveComponent("el-col"),G=l.resolveComponent("el-option"),Z=l.resolveComponent("el-select"),H=l.resolveComponent("el-row"),j=l.resolveComponent("el-button"),z=l.resolveComponent("el-divider"),me=l.resolveComponent("el-switch"),de=l.resolveComponent("el-form"),ce=l.resolveComponent("el-dialog"),v=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(ce,{"model-value":c.visible,title:c.title,top:"5vh",width:"1200",draggable:"",overflow:"","append-to-body":"","append-to":"body","close-on-click-modal":!1,"before-close":_},{footer:l.withCtx(()=>[l.createElementVNode("span",d1,[l.createVNode(j,{loading:l.unref(f).btnLoading,onClick:S},{default:l.withCtx(()=>[...E[20]||(E[20]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(j,{type:"primary",loading:l.unref(f).btnLoading,onClick:E[17]||(E[17]=N=>P(l.unref(g)))},{default:l.withCtx(()=>[...E[21]||(E[21]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[v]])])]),default:l.withCtx(()=>[l.createVNode(de,{ref_key:"formRef",ref:g,model:l.unref(p),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(H,{gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮",prop:"btnName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).btnName,"onUpdate:modelValue":E[0]||(E[0]=N=>l.unref(p).btnName=N),disabled:"",placeholder:"请输入按钮名称"},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(p).permissionCode),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮图标",prop:"btnIcon"},{default:l.withCtx(()=>[l.createVNode(l.unref(t),{modelValue:l.unref(p).btnIcon,"onUpdate:modelValue":E[1]||(E[1]=N=>l.unref(p).btnIcon=N),icons:l.unref(w),props:{value:"name",type:"btn"}},null,8,["modelValue","icons"])]),_:1})]),_:1}),l.createVNode(I,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"接口地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"requestUrl"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).requestUrl,"onUpdate:modelValue":E[2]||(E[2]=N=>l.unref(p).requestUrl=N),placeholder:"请输入接口地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮位置",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnPostion"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnPostion,"onUpdate:modelValue":E[3]||(E[3]=N=>l.unref(p).btnPostion=N),placeholder:"请选择按钮位置",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Sy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnType,"onUpdate:modelValue":E[4]||(E[4]=N=>l.unref(p).btnType=N),placeholder:"请选择按钮类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(xy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮别名",prop:"btnAlias"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).btnAlias,"onUpdate:modelValue":E[5]||(E[5]=N=>l.unref(p).btnAlias=N),placeholder:"请输入按钮别名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮颜色",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnColor"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnColor,"onUpdate:modelValue":E[6]||(E[6]=N=>l.unref(p).btnColor=N),placeholder:"请选择按钮颜色",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(I,{key:0,span:12},{default:l.withCtx(()=>[!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(B,{key:0,label:"提交方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitWay"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).submitWay,"onUpdate:modelValue":E[7]||(E[7]=N=>l.unref(p).submitWay=N),placeholder:"请选择提交方式",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ay),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):l.createCommentVNode("",!0)]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["import","batchImport"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:1,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入提交文件字段",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importFileName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).importFileName,"onUpdate:modelValue":E[8]||(E[8]=N=>l.unref(p).importFileName=N),placeholder:"请输入导入提交文件字段",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["import","batchImport"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:2,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入Accept",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importAccept"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).importAccept,"onUpdate:modelValue":E[9]||(E[9]=N=>l.unref(p).importAccept=N),placeholder:"请输入导入Accept",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["messageBox","executeApi"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:3,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"是否提示校验选择表格",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"isPromptVerificationSelectTable"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).isPromptVerificationSelectTable,"onUpdate:modelValue":E[10]||(E[10]=N=>l.unref(p).isPromptVerificationSelectTable=N),placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(vy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(z,{"content-position":"left"},{default:l.withCtx(()=>[E[18]||(E[18]=l.createTextVNode(" 提交字段配置 ",-1)),l.createVNode(j,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:C})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).submitFields,(N,q)=>(l.openBlock(),l.createBlock(H,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.submitFieldName,"onUpdate:modelValue":J=>N.submitFieldName=J,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:8},{default:l.withCtx(()=>[l.createVNode(B,{label:"方式","label-width":"80px",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{placeholder:"请输入",modelValue:N.matchFieldName,"onUpdate:modelValue":J=>N.matchFieldName=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchType,"onUpdate:modelValue":J=>N.matchType=J,placeholder:"请选择",style:{width:"120px"},onChange:J=>R(N,J)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Qy),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),N.matchType==="match"?(l.openBlock(),l.createBlock(I,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配源",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldMatchOrigin"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.submitFieldMatchOrigin,"onUpdate:modelValue":J=>N.submitFieldMatchOrigin=J,placeholder:"请输入匹配源",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(I,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitFields."+q+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.submitFieldType,"onUpdate:modelValue":J=>N.submitFieldType=J,placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ty),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(j,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>T(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(z,{"content-position":"left"},{default:l.withCtx(()=>[E[19]||(E[19]=l.createTextVNode(" 匹配字段配置(表格操作列按钮显示/隐藏) ",-1)),l.createVNode(j,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:x})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).matchFields,(N,q)=>(l.openBlock(),l.createBlock(H,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(I,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"matchFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{placeholder:"请输入",modelValue:N.matchFieldName,"onUpdate:modelValue":J=>N.matchFieldName=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchType,"onUpdate:modelValue":J=>N.matchType=J,placeholder:"请选择",style:{width:"180px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ey),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"matchFields."+q+".matchCondition"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchCondition,"onUpdate:modelValue":J=>N.matchCondition=J,placeholder:"请选择匹配条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(O),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"字段值",prop:"matchFields."+q+".fieldValue"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.fieldValue,"onUpdate:modelValue":J=>N.fieldValue=J,placeholder:"请输入字段值",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(j,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>A(q)},null,8,["onClick"])]),_:2},1024),q+1!==l.unref(p).matchFields.length?(l.openBlock(),l.createBlock(I,{key:0,span:24},{default:l.withCtx(()=>[l.createVNode(B,{class:"condition-box",label:"","label-width":"0",prop:"matchFields."+q+".spliceCondition"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.spliceCondition,"onUpdate:modelValue":J=>N.spliceCondition=J,placeholder:"请选择拼接条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Py),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128)),l.createVNode(H,{gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义按钮",prop:"isCustomBtn"},{default:l.withCtx(()=>[l.createVNode(me,{modelValue:l.unref(p).isCustomBtn,"onUpdate:modelValue":E[11]||(E[11]=N=>l.unref(p).isCustomBtn=N),onChange:y},null,8,["modelValue"])]),_:1})]),_:1}),l.unref(p).isCustomBtn?(l.openBlock(),l.createBlock(I,{key:0,span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"customType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).customType,"onUpdate:modelValue":E[12]||(E[12]=N=>l.unref(p).customType=N),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref($y),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"关联菜单"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).associationMenuId,"onUpdate:modelValue":E[13]||(E[13]=N=>l.unref(p).associationMenuId=N),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.name,value:N.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.unref(p).customType==="code"?(l.openBlock(),l.createBlock(H,{key:0,gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"代码片段",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"codeStr"},{default:l.withCtx(()=>[l.createVNode(l.unref(n),{modelValue:l.unref(p).codeStr,"onUpdate:modelValue":E[14]||(E[14]=N=>l.unref(p).codeStr=N)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(p).customType==="component"?(l.openBlock(),l.createBlock(H,{key:1,gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).customComponentName,"onUpdate:modelValue":E[15]||(E[15]=N=>l.unref(p).customComponentName=N),placeholder:"请输入组件名称",clearable:""},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(u.value),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:14},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentUrl"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).customComponentUrl,"onUpdate:modelValue":E[16]||(E[16]=N=>l.unref(p).customComponentUrl=N),placeholder:"请输入组件地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-2debd2c2"]])},Symbol.toStringTag,{value:"Module"})),pE="",m1={slot:"prepend"},g1={class:"dialog-footer"},O1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"dialogAddField",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>SQ)),n=e,s=i,r=l.inject("pageKey")(),o=l.inject("conditionList")(),a=l.inject("configData")(),c=()=>({btnLoading:!1,showSiteComponentsParamsDialog:!1});let u=l.reactive(c());const h=()=>({sort:0,fieldName:void 0,fieldKey:void 0,fieldType:void 0,fieldUiProps:"",fieldSubmitType:"string",fieldRequestType:"GET",fieldRequestUrl:void 0,postRequestParams:[],useScenes:[],formColumnCol:12,fieldDefaultValue:"",formCustomComponentes:[],customTableHeaderName:"",customTableHeaderUrl:"",isFormFieldRequired:!0,isFormSetValue:!0,isFormDisabled:!1,tableQueryCondition:void 0,tableQueryDefaultValue:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),f=lf,d=l.ref(null),m=l.ref(h()),O=()=>["select","selectIcon","multipleSelect","treeSelect","provinceCascade","switch","virtualizedSelect","virtualizedMultipleSelect"].includes(m.value.fieldType),w=()=>m.value.useScenes.includes("tableSearch")&&m.value.fieldType!=="time",g=()=>m.value.useScenes.includes("tableShow"),p=()=>m.value.fieldType&&m.value.fieldType!=="implicit"&&m.value.useScenes.some(_=>!["tableSearch","tableShow"].some(S=>S==_));l.watch(()=>s.visible,async(_,S)=>{if(_){const P=(a.value.buttons||[]).filter(E=>E.permissionCode!=1001).map(E=>({key:E.btnName,value:E.permissionCode}));f.some(E=>{if(E.label==="表单配置")return E.options=P,!0});const{data:Q}=s;if(!Q.fieldName)return;Object.keys(m.value).forEach(E=>{if(E=="permissionCode")m.value[E]=Q.unique;else if(E=="formCustomComponentes"){const W=Q.useScenes.map(B=>Q[E].find(G=>G.permissionCode==B)||{});m.value[E]=[...W]}else["postRequestParams","useScenes"].includes(E)?m.value[E]=[...Q[E]||[]]:m.value[E]=Q[E]})}});const b=()=>{m.value.postRequestParams.push({submitName:"",submitValue:"",submitType:"default",submitMatchType:"",paramsType:""})},k=_=>{m.value.postRequestParams.splice(_,1)},y=_=>{m.value.postRequestParams=[]},C=_=>{const S=f.find(Q=>Q.label==="表格配置").options,P=f.find(Q=>Q.label==="表单配置").options;m.value.formCustomComponentes=[...S,...P].filter(Q=>_.includes(Q.value)).map(Q=>{const E=m.value.formCustomComponentes.find(W=>W.permissionCode==Q.value);return{btnName:Q.key,permissionCode:Q.value,pageKey:r,customComponentName:(E==null?void 0:E.customComponentName)||void 0,customComponentUrl:(E==null?void 0:E.customComponentUrl)||void 0,isFieldCustom:(E==null?void 0:E.isFieldCustom)||!1}})},T=(_,S)=>{S.customComponentName=void 0,S.customComponentUrl=void 0},x=_=>{A(),_()},A=()=>{m.value=h(),d.value.resetFields(),n("update:visible",!1)},R=_=>{_&&_.validate(S=>{S&&(u.btnLoading=!0,m.value.formCustomComponentes.forEach(P=>{delete P.isFiledCustom}),n("refresh",JSON.parse(JSON.stringify(m.value)),()=>{A()}),u.btnLoading=!1)})};return(_,S)=>{const P=l.resolveComponent("el-input"),Q=l.resolveComponent("el-form-item"),E=l.resolveComponent("el-col"),W=l.resolveComponent("el-option"),B=l.resolveComponent("el-select"),I=l.resolveComponent("el-button"),G=l.resolveComponent("el-row"),Z=l.resolveComponent("el-divider"),H=l.resolveComponent("el-option-group"),j=l.resolveComponent("el-switch"),z=l.resolveComponent("el-input-number"),me=l.resolveComponent("el-form"),de=l.resolveComponent("el-scrollbar"),ce=l.resolveComponent("el-dialog"),v=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(ce,{"model-value":s.visible,title:s.title,top:"5vh",width:"1400",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":x},{footer:l.withCtx(()=>[l.createElementVNode("span",g1,[l.createVNode(I,{onClick:A,loading:l.unref(u).btnLoading},{default:l.withCtx(()=>[...S[30]||(S[30]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(I,{type:"primary",loading:l.unref(u).btnLoading,onClick:S[23]||(S[23]=N=>R(d.value))},{default:l.withCtx(()=>[...S[31]||(S[31]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[v]])])]),default:l.withCtx(()=>[l.createVNode(de,{ref:"configFieldsScroll","max-height":"800px"},{default:l.withCtx(()=>[l.createVNode(me,{ref_key:"formRef",ref:d,model:m.value,"label-suffix":":","label-width":"120px"},{default:l.withCtx(()=>[l.createVNode(G,null,{default:l.withCtx(()=>[l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldName"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldName,"onUpdate:modelValue":S[0]||(S[0]=N=>m.value.fieldName=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段key",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldKey"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldKey,"onUpdate:modelValue":S[1]||(S[1]=N=>m.value.fieldKey=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段类型",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldType,"onUpdate:modelValue":S[2]||(S[2]=N=>m.value.fieldType=N),placeholder:"请选择",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(rf),N=>(l.openBlock(),l.createBlock(W,{key:N.value,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:4},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件参数",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(I,{type:"primary",onClick:S[3]||(S[3]=N=>l.unref(u).showSiteComponentsParamsDialog=!0)},{default:l.withCtx(()=>[...S[24]||(S[24]=[l.createTextVNode("设置props",-1)])]),_:1}),l.createVNode(l.unref(t),{modelValue:m.value.fieldUiProps,"onUpdate:modelValue":S[4]||(S[4]=N=>m.value.fieldUiProps=N),visible:l.unref(u).showSiteComponentsParamsDialog,"onUpdate:visible":S[5]||(S[5]=N=>l.unref(u).showSiteComponentsParamsDialog=N),title:"设置组件参数"},null,8,["modelValue","visible"])]),_:1})]),_:1})]),_:1}),O()?(l.openBlock(),l.createBlock(G,{key:0},{default:l.withCtx(()=>[l.createVNode(E,{span:24},{default:l.withCtx(()=>[l.createVNode(Q,{label:"数据源",prop:"fieldRequestUrl"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入",modelValue:m.value.fieldRequestUrl,"onUpdate:modelValue":S[7]||(S[7]=N=>m.value.fieldRequestUrl=N),clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldRequestType,"onUpdate:modelValue":S[6]||(S[6]=N=>m.value.fieldRequestType=N),placeholder:"请选择",style:{width:"150px"},onChange:y},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ny),N=>(l.openBlock(),l.createBlock(W,{key:N.value,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),m.value.fieldRequestType=="POST"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[S[25]||(S[25]=l.createTextVNode(" POST参数配置 ",-1)),l.createVNode(I,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:b})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.postRequestParams,(N,q)=>(l.openBlock(),l.createBlock(G,{key:q},{default:l.withCtx(()=>[l.createVNode(E,{span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitName"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.submitName,"onUpdate:modelValue":J=>N.submitName=J,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(E,{span:8},{default:l.withCtx(()=>[l.createVNode(Q,{label:"方式",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitValue"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入值",modelValue:N.submitValue,"onUpdate:modelValue":J=>N.submitValue=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:N.submitType,"onUpdate:modelValue":J=>N.submitType=J,placeholder:"请选择方式",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ry),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),N.submitType==="dynamic"?(l.openBlock(),l.createBlock(E,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitMatchType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:N.submitMatchType,"onUpdate:modelValue":J=>N.submitMatchType=J,placeholder:"请选择方式",clearable:"",filterable:"",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(E,{span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"postRequestParams."+q+".paramsType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:N.paramsType,"onUpdate:modelValue":J=>N.paramsType=J,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(of),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(E,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(I,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>k(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128))],64)):l.createCommentVNode("",!0),l.createVNode(G,null,{default:l.withCtx(()=>[l.createVNode(E,{span:24},{default:l.withCtx(()=>[l.createVNode(Q,{label:"使用场景",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"useScenes"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.useScenes,"onUpdate:modelValue":S[8]||(S[8]=N=>m.value.useScenes=N),placeholder:"请选择",multiple:"",clearable:"",filterable:"",onChange:C},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f),N=>(l.openBlock(),l.createBlock(H,{key:N.label,label:N.label},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(N.options,q=>(l.openBlock(),l.createBlock(W,{key:q.key,label:q.key,value:q.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),w()?(l.openBlock(),l.createBlock(G,{key:2},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[26]||(S[26]=[l.createTextVNode("查询模块",-1)])]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"查询条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableQueryCondition"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableQueryCondition,"onUpdate:modelValue":S[9]||(S[9]=N=>m.value.tableQueryCondition=N),placeholder:"请选择查询条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"tableQueryDefaultValue"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.tableQueryDefaultValue,"onUpdate:modelValue":S[10]||(S[10]=N=>m.value.tableQueryDefaultValue=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),g()?(l.openBlock(),l.createBlock(G,{key:3},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[27]||(S[27]=[l.createTextVNode("表格模块",-1)])]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"列宽",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"tableCellWidth"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入",modelValue:m.value.tableCellWidth,"onUpdate:modelValue":S[12]||(S[12]=N=>m.value.tableCellWidth=N)},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellWidthType,"onUpdate:modelValue":S[11]||(S[11]=N=>m.value.tableCellWidthType=N),placeholder:"请选择",style:{width:"100px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Dy),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"对齐方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellAlignType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellAlignType,"onUpdate:modelValue":S[13]||(S[13]=N=>m.value.tableCellAlignType=N),placeholder:"请选择对齐方式",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ly),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"内容类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellContentType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellContentType,"onUpdate:modelValue":S[14]||(S[14]=N=>m.value.tableCellContentType=N),placeholder:"请选择内容类型",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(My),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:"溢出隐藏",prop:"isTableCellOverflowTooltip"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isTableCellOverflowTooltip,"onUpdate:modelValue":S[15]||(S[15]=N=>m.value.isTableCellOverflowTooltip=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:"排序",prop:"isTableCellSort"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isTableCellSort,"onUpdate:modelValue":S[16]||(S[16]=N=>m.value.isTableCellSort=N)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),p()?(l.openBlock(),l.createBlock(G,{key:4},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[28]||(S[28]=[l.createTextVNode("表单模块",-1)])]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否必填",prop:"isFormFieldRequired"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormFieldRequired,"onUpdate:modelValue":S[17]||(S[17]=N=>m.value.isFormFieldRequired=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否回显",prop:"isFormSetValue"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormSetValue,"onUpdate:modelValue":S[18]||(S[18]=N=>m.value.isFormSetValue=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否禁用",prop:"isFormDisabled"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormDisabled,"onUpdate:modelValue":S[19]||(S[19]=N=>m.value.isFormDisabled=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"fieldSubmitType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldSubmitType,"onUpdate:modelValue":S[20]||(S[20]=N=>m.value.fieldSubmitType=N),placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Vy),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"栅格数",prop:"formColumnCol"},{default:l.withCtx(()=>[l.createVNode(z,{modelValue:m.value.formColumnCol,"onUpdate:modelValue":S[21]||(S[21]=N=>m.value.formColumnCol=N),max:24},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"fieldDefaultValue"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldDefaultValue,"onUpdate:modelValue":S[22]||(S[22]=N=>m.value.fieldDefaultValue=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[29]||(S[29]=[l.createTextVNode("不同场景自定义字段组件",-1)])]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.formCustomComponentes,(N,q)=>(l.openBlock(),l.createBlock(G,{key:q},{default:l.withCtx(()=>[l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:`${N.btnName}`,prop:`formCustomComponentes.${q}.isFieldCustom`},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:N.isFieldCustom,"onUpdate:modelValue":J=>N.isFieldCustom=J,onChange:J=>T(J,N)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","prop"])]),_:2},1024),N.isFieldCustom?(l.openBlock(),l.createBlock(E,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件名称","label-width":"220",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentName`},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.customComponentName,"onUpdate:modelValue":J=>N.customComponentName=J,placeholder:"请输入",clearable:""},{default:l.withCtx(()=>[l.createElementVNode("template",m1,[l.createTextVNode(l.toDisplayString(l.unref(r)),1)])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),N.isFieldCustom?(l.openBlock(),l.createBlock(E,{key:1,span:14},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentUrl`},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.customComponentUrl,"onUpdate:modelValue":J=>N.customComponentUrl=J,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["model"])]),_:1},512)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-571cf929"]])},Symbol.toStringTag,{value:"Module"})),uf=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"index",props:{modelValue:{type:String}},emits:["update:modelValue"],setup(i,{emit:e}){const t=e,n=i,s=l.computed({get(){return n.modelValue},set(a){t("update:modelValue",a)}}),r=a=>{let c=a.charAt(0);return a=a.replace(/[^\d.]/g,""),a=a.replace(/^\./g,""),a=a.replace(/\.{2,}/g,"."),a=a.replace(".","$#$").replace(/\./g,"").replace("$#$","."),c=="-"&&(a="-"+a),a},o=a=>{s.value=r(a)};return(a,c)=>{const u=l.resolveComponent("el-input");return l.openBlock(),l.createBlock(u,l.mergeProps({modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=h=>s.value=h),modelModifiers:{number:!0},placeholder:"Please input"},a.$attrs,{onInput:o}),null,16,["modelValue"])}}}},Symbol.toStringTag,{value:"Module"})),_E="",bE="",_1={class:"select-icon-container"},b1={class:"icon-list"},y1=["onClick"],w1={class:"icon-value",slot:"reference"},hf=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{modelValue:{type:String,default:""},icons:{type:Array,default:()=>[]},props:{type:Object,default:()=>({value:"value",type:"btn"})}},emits:["update:modelValue"],setup(i,{emit:e}){const t=e,n=i;let s=l.ref(!1),r=l.ref(-1),o=l.ref([]);const a=()=>r.value==-1?"":o.value[r.value];l.watch(()=>n.icons,(u,h)=>{u&&(o.value=(n.icons||[]).map(f=>{const{props:d}=n;return Reflect.has(f,d.value)?`${d.type}-${f[d.value]}`:`${d.type}-${f}`}))},{deep:!0,immediate:!0}),l.watch(()=>n.modelValue,(u,h)=>{if(!u){r.value=-1,t("update:modelValue","");return}const f=o.value.findIndex(d=>d===u);r.value=f},{deep:!0,immediate:!0});const c=(u,h)=>{r.value=h,t("update:modelValue",a()),s.value=!1};return(u,h)=>{const f=l.resolveComponent("a-svg-icon"),d=l.resolveComponent("el-button"),m=l.resolveComponent("el-popover");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(m,{"popper-class":"select-icon-popover",placement:"bottom-start",visible:l.unref(s),"onUpdate:visible":h[0]||(h[0]=O=>l.isRef(s)?s.value=O:s=O),width:400,trigger:"click"},{reference:l.withCtx(()=>[l.createElementVNode("div",w1,[l.unref(r)>=0?(l.openBlock(),l.createBlock(f,{key:0,name:n.modelValue,width:"24",height:"24",color:"#000"},null,8,["name"])):l.createCommentVNode("",!0),l.createVNode(d,{class:"icon-btn",type:"primary"},{default:l.withCtx(()=>[...h[1]||(h[1]=[l.createTextVNode("选择图标",-1)])]),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("ul",b1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(O,w)=>(l.openBlock(),l.createElementBlock("li",{class:l.normalizeClass(["icon-item",{"icon-item-checked":l.unref(r)==w}]),key:w,onClick:g=>c(O,w)},[l.createVNode(f,{class:"icon-svg",name:O,width:"24",height:"24",color:"#999"},null,8,["name"])],10,y1))),128))])]),_:1},8,["visible"])])}}},[["__scopeId","data-v-308d02d4"]])},Symbol.toStringTag,{value:"Module"}));let Pr;const k1=new Uint8Array(16);function x1(){if(!Pr&&(Pr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pr(k1)}const ut=[];for(let i=0;i<256;++i)ut.push((i+256).toString(16).slice(1));function S1(i,e=0){return ut[i[e+0]]+ut[i[e+1]]+ut[i[e+2]]+ut[i[e+3]]+"-"+ut[i[e+4]]+ut[i[e+5]]+"-"+ut[i[e+6]]+ut[i[e+7]]+"-"+ut[i[e+8]]+ut[i[e+9]]+"-"+ut[i[e+10]]+ut[i[e+11]]+ut[i[e+12]]+ut[i[e+13]]+ut[i[e+14]]+ut[i[e+15]]}const ff={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function C1(i,e,t){if(ff.randomUUID&&!e&&!i)return ff.randomUUID();i=i||{};const n=i.random||(i.rng||x1)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=n[s];return e}return S1(n)}const xE="",A1={class:"upload-container"},T1={class:"el-upload__text"},P1={class:"tip-text"},Q1={class:"file-list-l"},E1=["onMouseenter","onMouseleave"],$1={class:"el-file-operate"},N1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{request:{type:Function,required:!0,default:null},modelValue:{type:[Array,String],default:[]},action:{type:String,default:"/api/v1/utils/uploadFiles"},data:{type:Object,default:()=>({uploadFileType:1})},name:{type:String,default:"files"},multiple:{type:Boolean,default:!0},limit:{type:Number,default:9},accept:{type:String,default:"*"},tipText:{type:String,default:""},fileMaxSize:{type:Number,default:100},autoUpload:{type:Boolean,default:!0}},emits:["update:modelValue","delete"],setup(i,{expose:e,emit:t}){const{getAssetsFileName:n,getAssetsFilePath:s,downloadFile:r}=ef(),{t:o}=Kt(),a=t,c=i,u={image:/^(gif|jpg|jpeg|png|bmp|webp)$/i,word:/^(doc|docx|DOC|DOCX)$/i,pdf:/^(pdf|PDF)$/i,excel:/^(xls|xlsx|XLS|XLSX)$/i};let h=l.ref(!1),f=l.ref({}),d=l.ref(!1),m=l.ref(null),O=null,w=l.computed({get(){return C(c.modelValue)},set(B){a("update:modelValue",B)}});const g=B=>{const I=(w.value||[]).map(H=>H.filePath);if(B==0)return I;let G=I.splice(B),Z=I.splice(0,B);return G.concat(Z)},p=B=>{if(!B||typeof B!="string")return"";const I=B.split("?")[0].split("#")[0],G=I.lastIndexOf(".");return G<0?"":I.slice(G+1).toLowerCase()},b=(...B)=>{for(const I of B){const G=`${I||""}`.trim();if(!G)continue;const Z=G.startsWith(".")?G.slice(1).toLowerCase():G.toLowerCase();if(Z==="image")return"image";if(Object.keys(u).includes(Z))return Z;const H=p(G)||Z;let j=null;if(Object.keys(u).some(z=>{if(u[z].test(H))return j=z,!0}),j)return j}return"file"},k=B=>{var H,j;const I=typeof B=="string"?{filePath:B}:B||{},G=I.filePath||I.url||"",Z=I.name||I.fileName||n(G)||((H=I.raw)==null?void 0:H.name)||"";return{...I,uid:I.uid??C1(),name:Z,filePath:G,fileType:b(I.fileType,Z,G,(j=I.raw)==null?void 0:j.name),status:I.status??"success"}},y=(B=[])=>B.filter(Boolean).map(I=>k(I)),C=B=>{const I=Array.isArray(B)?B:B?B.split(";").filter(Boolean):[];return y(I)},T=({name:B})=>{const I=B.lastIndexOf("."),G=B.slice(I),Z=c.accept.trim().split(",");let H=!1;return Z.includes(G)&&(H=!0),H=Z.some(j=>j=="image/*"?u.image.test(G):j.startsWith(".")?B.endsWith(j):j===G),H||Ve.ElNotification({title:`${o("act.tip")}`,message:`【${B}】${o("act.uploadErrorTip")}`,type:"warning",duration:2500}),H},x=(B,I,G)=>{O&&(clearTimeout(O),O=null),O=setTimeout(()=>{B.call(this,I)},G)},A=B=>c.request({url:c.action,method:"POST",data:B,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),R=async B=>{try{const I=B.filter(z=>z.status=="ready"&&T(z)),G=w.value.length+I.length;if(I.length===0){m.value.clearFiles();return}if(G>c.limit){Ve.ElNotification({title:`${o("act.tip")}`,message:`${o("act.uploadLimitTip")}`,type:"warning",duration:2500}),m.value.clearFiles();return}if(!c.autoUpload){const z=I.map(me=>({...me,filePath:null,status:"success"}));a("update:modelValue",z),m.value.clearFiles();return}h.value=!0;const Z=new FormData;Object.keys(c.data).forEach(z=>{Z.append(z,c.data[z])}),I.forEach(z=>{Z.append(c.name,z.raw)});let{data:H}=await A(Z);const j=c.multiple?[...w.value.map(z=>z.filePath),...H.filePaths||[]].join(";"):[...H.filePaths||[]].join(";");m.value.clearFiles(),a("update:modelValue",j),h.value=!1}catch(I){m.value.clearFiles(),h.value=!1,console.error(I)}},_=(B,I)=>{x(R,I,500)},S=(B,I)=>{const G=f.value[`tooltipRef${I}`];d.value=G.scrollWidth<=Math.round(G.getBoundingClientRect().width)},P=({filePath:B,name:I,uid:G},Z)=>{l.nextTick(()=>{document.querySelector(`.previewImage_${G}`).children[0].click()})},Q=({filePath:B,name:I})=>{r(c.request,B)},E=(B,I)=>{w.value=w.value.filter((G,Z)=>Z!==I),a("delete",{data:B})};return e({clearFiles:()=>{w.value=[],m.value.clearFiles()}}),(B,I)=>{const G=l.resolveComponent("upload-filled"),Z=l.resolveComponent("el-icon"),H=l.resolveComponent("el-upload"),j=l.resolveComponent("el-image"),z=l.resolveComponent("el-tooltip"),me=l.resolveComponent("el-button"),de=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",A1,[l.withDirectives((l.openBlock(),l.createBlock(H,l.mergeProps({ref_key:"uploadRef",ref:m,action:"#",drag:"",accept:c.accept,multiple:c.multiple,"auto-upload":!1,"show-file-list":!1,"on-change":_},B.$attrs,{"element-loading-text":l.unref(o)("act.uploadLoading")}),{tip:l.withCtx(()=>[c.tipText?l.renderSlot(B.$slots,"default",{key:0},()=>[l.createElementVNode("p",P1,l.toDisplayString(c.tipText),1)],!0):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createVNode(Z,{class:"el-icon--upload"},{default:l.withCtx(()=>[l.createVNode(G)]),_:1}),l.createElementVNode("div",T1,[l.createTextVNode(l.toDisplayString(l.unref(o)("act.uploadText")),1),l.createElementVNode("em",null,l.toDisplayString(l.unref(o)("act.clickUpload")),1)])]),_:3},16,["accept","multiple","element-loading-text"])),[[de,l.unref(h)]]),l.renderSlot(B.$slots,"default",{},()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(ce,v)=>(l.openBlock(),l.createElementBlock("div",{class:"file-list",key:ce.uid},[l.createElementVNode("div",Q1,[ce.fileType==="image"?(l.openBlock(),l.createBlock(j,{key:0,class:l.normalizeClass(["file-list-image",{[`previewImage_${ce.uid}`]:!0}]),fit:"cover","preview-src-list":g(v),"preview-teleported":"",src:ce.filePath},null,8,["class","preview-src-list","src"])):(l.openBlock(),l.createBlock(j,{key:1,class:"file-list-icon",src:l.unref(s)(`images/upload-${ce.fileType||"file"}.png`)},null,8,["src"])),l.createVNode(z,{effect:"dark",content:ce.name,placement:"bottom-start",disabled:l.unref(d)},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"el-file-name",ref_for:!0,ref:N=>l.unref(f)[`tooltipRef${v}`]=N,onMouseenter:N=>S(N,v),onMouseleave:N=>S(N,v)},l.toDisplayString(ce.name),41,E1)]),_:2},1032,["content","disabled"])]),l.createElementVNode("div",$1,[ce.fileType==="image"?(l.openBlock(),l.createBlock(me,{key:0,type:"primary",size:"small",icon:l.unref(Oy),circle:"",onClick:N=>P(ce)},null,8,["icon","onClick"])):l.createCommentVNode("",!0),l.createVNode(me,{type:"primary",size:"small",icon:l.unref(dy),circle:"",onClick:N=>Q(ce)},null,8,["icon","onClick"]),l.createVNode(me,{type:"danger",size:"small",icon:l.unref(hy),circle:"",onClick:N=>E(ce,v)},null,8,["icon","onClick"])])]))),128))],!0)])}}},[["__scopeId","data-v-8a705a54"]])},Symbol.toStringTag,{value:"Module"}));var R1=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCommentChange","onCompositionEnd","onCompositionStart","onCompositionUpdate","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onInput","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],V1=function(i){return R1.map(function(e){return e.toLowerCase()}).indexOf(i.toLowerCase())!==-1},L1=function(i,e,t){Object.keys(e).filter(V1).forEach(function(n){var s=e[n];typeof s=="function"&&(n==="onInit"?s(i,t):t.on(n.substring(2),function(r){return s(r,t)}))})},M1=function(i,e,t,n){var s=i.modelEvents?i.modelEvents:null,r=Array.isArray(s)?s.join(" "):s;l.watch(n,function(o,a){t&&typeof o=="string"&&o!==a&&o!==t.getContent({format:i.outputFormat})&&t.setContent(o)}),t.on(r||"change input undo redo",function(){e.emit("update:modelValue",t.getContent({format:i.outputFormat}))})},D1=function(i,e,t,n,s,r){n.setContent(r()),t.attrs["onUpdate:modelValue"]&&M1(e,t,n,s),L1(i,t.attrs,n)},df=0,pf=function(i){var e=Date.now(),t=Math.floor(Math.random()*1e9);return df++,i+"_"+t+df+String(e)},B1=function(i){return i!==null&&i.tagName.toLowerCase()==="textarea"},mf=function(i){return typeof i>"u"||i===""?[]:Array.isArray(i)?i:i.split(" ")},v1=function(i,e){return mf(i).concat(mf(e))},I1=function(i){return i==null},gf=function(i){var e;return typeof((e=i.options)===null||e===void 0?void 0:e.set)=="function"&&i.options.isRegistered("disabled")},Of=function(){return{listeners:[],scriptId:pf("tiny-script"),scriptLoaded:!1}},Z1=function(){var i=Of(),e=function(s,r,o,a){var c=r.createElement("script");c.referrerPolicy="origin",c.type="application/javascript",c.id=s,c.src=o;var u=function(){c.removeEventListener("load",u),a()};c.addEventListener("load",u),r.head&&r.head.appendChild(c)},t=function(s,r,o){i.scriptLoaded?o():(i.listeners.push(o),s.getElementById(i.scriptId)||e(i.scriptId,s,r,function(){i.listeners.forEach(function(a){return a()}),i.scriptLoaded=!0}))},n=function(){i=Of()};return{load:t,reinitialize:n}},F1=Z1(),U1=function(){return typeof window<"u"?window:global},hn=function(){var i=U1();return i&&i.tinymce?i.tinymce:null},X1={apiKey:String,licenseKey:String,cloudChannel:String,id:String,init:Object,initialValue:String,inline:Boolean,modelEvents:[String,Array],plugins:[String,Array],tagName:String,toolbar:[String,Array],modelValue:String,disabled:Boolean,readonly:Boolean,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(i){return i==="html"||i==="text"}}},ai=globalThis&&globalThis.__assign||function(){return ai=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s])}return i},ai.apply(this,arguments)},W1=function(i,e,t,n){return i(n||"div",{id:e,ref:t})},q1=function(i,e,t){return i("textarea",{id:e,visibility:"hidden",ref:t})},Ll={selector:void 0,target:void 0},Ml=function(i,e){var t;typeof((t=i.mode)===null||t===void 0?void 0:t.set)=="function"?i.mode.set(e):i.setMode(e)},j1=l.defineComponent({props:X1,setup:function(i,e){var t=i.init?ai(ai({},i.init),Ll):ai({},Ll),n=l.toRefs(i),s=n.disabled,r=n.readonly,o=n.modelValue,a=n.tagName,c=l.ref(null),u=null,h=i.id||pf("tiny-vue"),f=i.init&&i.init.inline||i.inline,d=!!e.attrs["onUpdate:modelValue"],m=!0,O=i.initialValue?i.initialValue:"",w="",g=function(k){return d?function(){return o!=null&&o.value?o.value:""}:function(){return k?O:w}},p=function(){var k=g(m),y=ai(ai({},t),{disabled:i.disabled,readonly:i.readonly,target:c.value,plugins:v1(t.plugins,i.plugins),toolbar:i.toolbar||t.toolbar,inline:f,license_key:i.licenseKey,setup:function(C){u=C,!gf(u)&&i.disabled===!0&&Ml(u,"readonly"),C.on("init",function(T){return D1(T,i,e,C,o,k)}),typeof t.setup=="function"&&t.setup(C)}});B1(c.value)&&(c.value.style.visibility=""),hn().init(y),m=!1};l.watch(r,function(k){u!==null&&Ml(u,k?"readonly":"design")}),l.watch(s,function(k){u!==null&&(gf(u)?u.options.set("disabled",k):Ml(u,k?"readonly":"design"))}),l.watch(a,function(k){var y;u&&(d||(w=u.getContent()),(y=hn())===null||y===void 0||y.remove(u),l.nextTick(function(){return p()}))}),l.onMounted(function(){if(hn()!==null)p();else if(c.value&&c.value.ownerDocument){var k=i.cloudChannel?i.cloudChannel:"8",y=i.apiKey?i.apiKey:"no-api-key",C=I1(i.tinymceScriptSrc)?"https://cdn.tiny.cloud/1/".concat(y,"/tinymce/").concat(k,"/tinymce.min.js"):i.tinymceScriptSrc;F1.load(c.value.ownerDocument,C,p)}}),l.onBeforeUnmount(function(){hn()!==null&&hn().remove(u)}),f||(l.onActivated(function(){m||p()}),l.onDeactivated(function(){var k;u&&(d||(w=u.getContent()),(k=hn())===null||k===void 0||k.remove(u))}));var b=function(k){var y;u&&(w=u.getContent(),(y=hn())===null||y===void 0||y.remove(u),t=ai(ai(ai({},t),k),Ll),l.nextTick(function(){return p()}))};return e.expose({rerender:b,getEditor:function(){return u}}),function(){return f?W1(l.h,h,c,i.tagName):q1(l.h,h,c)}}});const AE="",z1={style:{height:"100%",overflow:"hidden"}},Y1=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"index",props:{modelValue:{type:String,default:""},value:{type:String,default:""},baseUrl:{type:String,default:""},width:{type:[Number,String],default:"100%"},height:{type:Number,default:500},disabled:{type:Boolean,default:!1},editableRoot:{type:Boolean,default:!0},placeholder:{type:String,default:"请输入"},plugins:{type:[String,Array],default:"importcss autoresize searchreplace autolink directionality code visualblocks visualchars fullscreen image link codesample table charmap nonbreaking anchor insertdatetime advlist lists wordcount charmap quickbars emoticons accordion"},toolbar:{type:[String,Array,Boolean],default:"undo redo | accordion accordionremove | blocks fontfamily fontsize| bold italic underline strikethrough ltr rtl | align numlist bullist | link image | table | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | anchor codesample"}},emits:["update:modelValue","setHtml"],setup(i,{expose:e,emit:t}){const n=t,s=i,r=l.ref("vue-tinymce-"+ +new Date+((Math.random()*1e3).toFixed(0)+"")),o=l.reactive({selector:"#"+r.value,language_url:"/tinymce/langs/zh_CN.js",language:"zh_CN",skin_url:"/tinymce/skins/ui/oxide",content_css:"/tinymce/skins/content/default/content.css",editable_root:s.editableRoot,width:s.width,max_height:s.height,min_height:400,branding:!1,promotion:!1,menubar:"edit view insert format tools table",paste_data_images:!0,image_dimensions:!1,plugins:s.plugins,toolbar:s.toolbar,convert_urls:!1,link_default_target:"_blank",link_context_toolbar:!0,quickbars_insert_toolbar:"",quickbars_image_toolbar:"alignleft aligncenter alignright | rotateleft rotateright | imageoptions",editimage_toolbar:"rotateleft rotateright | flipv fliph | editimage imageoptions",font_family_formats:"Arial=arial,helvetica,sans-serif; 宋体=SimSun; 微软雅黑=Microsoft Yahei; Impact=impact,chicago;",font_size_formats:"11px 12px 14px 16px 18px 24px 36px 48px 64px 72px",image_caption:!0,editimage_cors_hosts:["picsum.photos"],noneditable_class:"mceNonEditable",toolbar_mode:"wrap",content_style:"body {margin:12px; font-family:sans-serif; font-size:14px }p {margin:3px; line-height:24px;}",image_advtab:!0,importcss_append:!0,paste_webkit_styles:"all",paste_merge_formats:!0,nonbreaking_force_tab:!1,paste_auto_cleanup_on_paste:!1,file_picker_types:"file",quickbars_selection_toolbar:"bold italic | quicklink h2 h3 blockquote quickimage quicktable",images_upload_handler:function(h,f){}});console.log(o);const a=l.computed({get(){return s.modelValue},set(h){n("update:modelValue",h)}});return l.watch(()=>a.value,()=>{n("setHtml",fr.activeEditor.getContent({format:"text"}),a.value)}),l.onMounted(()=>{fr.init({})}),e({onGetContent:()=>fr.activeEditor.getContent(),onSetContent:h=>{fr.activeEditor.setContent(h)}}),(h,f)=>(l.openBlock(),l.createElementBlock("div",z1,[l.createVNode(l.unref(j1),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=d=>a.value=d),init:o,disabled:i.disabled,placeholder:i.placeholder,id:r.value},null,8,["modelValue","init","disabled","placeholder","id"])]))}}},Symbol.toStringTag,{value:"Module"}));let Dl=[],_f=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?_f:Dl).push(t=t+i[e])})();function G1(i){if(i<768)return!1;for(let e=0,t=Dl.length;;){let n=e+t>>1;if(i<Dl[n])t=n;else if(i>=_f[n])e=n+1;else return!0;if(e==t)return!1}}function bf(i){return i>=127462&&i<=127487}const yf=8205;function K1(i,e,t=!0,n=!0){return(t?wf:H1)(i,e,n)}function wf(i,e,t){if(e==i.length)return e;e&&kf(i.charCodeAt(e))&&xf(i.charCodeAt(e-1))&&e--;let n=Bl(i,e);for(e+=Sf(n);e<i.length;){let s=Bl(i,e);if(n==yf||s==yf||t&&G1(s))e+=Sf(s),n=s;else if(bf(s)){let r=0,o=e-2;for(;o>=0&&bf(Bl(i,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function H1(i,e,t){for(;e>0;){let n=wf(i,e-2,t);if(n<e)return n;e--}return 0}function Bl(i,e){let t=i.charCodeAt(e);if(!xf(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return kf(n)?(t-55296<<10)+(n-56320)+65536:t}function kf(i){return i>=56320&&i<57344}function xf(i){return i>=55296&&i<56320}function Sf(i){return i<65536?1:2}class Qe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ln(this,e,t);let s=[];return this.decompose(0,e,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(t,this.length,s,1),ci.from(s,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ln(this,e,t);let n=[];return this.decompose(e,t,n,0),ci.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),s=new ms(this),r=new ms(e);for(let o=t,a=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(a+=s.value.length,s.done||a>=n)return!0}}iter(e=1){return new ms(this,e)}iterRange(e,t=this.length){return new Af(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;n=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Tf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Qe.empty:e.length<=32?new ze(e):ci.from(ze.split(e,[]))}}class ze extends Qe{constructor(e,t=J1(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,s){for(let r=0;;r++){let o=this.text[r],a=s+o.length;if((t?n:a)>=e)return new ew(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let r=e<=0&&t>=this.length?this:new ze(Cf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),a=Qr(r.text,o.text.slice(),0,r.length);if(a.length<=32)n.push(new ze(a,o.length+r.length));else{let c=a.length>>1;n.push(new ze(a.slice(0,c)),new ze(a.slice(c)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof ze))return super.replace(e,t,n);[e,t]=Ln(this,e,t);let s=Qr(this.text,Qr(n.text,Cf(this.text,0,e)),t),r=this.length+n.length-(t-e);return s.length<=32?new ze(s,r):ci.from(ze.split(s,[]),r)}sliceString(e,t=this.length,n=`
|
|
21
|
+
*/const ub="10.0.8";function hb(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(an().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(an().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(an().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(an().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ui={FALLBACK_TO_ROOT:$0,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},fb={[Ui.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Ui.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Ui.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Ui.DEPRECATE_TC]:"'tc' and '$tc' has been deprecated in v10. Use 't' or '$t' instead. 'tc' and '$tc’ are going to remove in v11."};function kr(i,...e){return dr(fb[i],...e)}const ve={UNEXPECTED_RETURN_TYPE:_0,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function yt(i,...e){return Qn(i,null,process.env.NODE_ENV!=="production"?{messages:db,args:e}:void 0)}const db={[ve.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[ve.INVALID_ARGUMENT]:"Invalid argument",[ve.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[ve.NOT_INSTALLED]:"Need to install with `app.use` function",[ve.UNEXPECTED_ERROR]:"Unexpected error",[ve.REQUIRED_VALUE]:"Required in value: {0}",[ve.INVALID_VALUE]:"Invalid value",[ve.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[ve.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[ve.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[ve.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},yl=oi("__translateVNode"),wl=oi("__datetimeParts"),kl=oi("__numberParts"),un=oi("__enableEmitter"),hs=oi("__disableEmitter"),dh=oi("__setPluralRules"),ph=oi("__injectWithOption"),xl=oi("__dispose");function fs(i){if(!Pe(i)||It(i))return i;for(const e in i)if(Gt(i,e))if(!e.includes("."))Pe(i[e])&&fs(i[e]);else{const t=e.split("."),n=t.length-1;let s=i,r=!1;for(let o=0;o<n;o++){if(t[o]==="__proto__")throw new Error(`unsafe key: ${t[o]}`);if(t[o]in s||(s[t[o]]=Me()),!Pe(s[t[o]])){process.env.NODE_ENV!=="production"&&Ti(kr(Ui.IGNORE_OBJ_FLATTEN,{key:t[o]})),r=!0;break}s=s[t[o]]}if(r||(It(s)?Du.includes(t[n])||delete i[e]:(s[t[n]]=i[e],delete i[e])),!It(s)){const o=s[t[n]];Pe(o)&&fs(o)}}return i}function Sl(i,e){const{messages:t,__i18n:n,messageResolver:s,flatJson:r}=e,o=xe(t)?t:We(n)?Me():{[i]:Me()};if(We(n)&&n.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:u}=a;c?(o[c]=o[c]||Me(),gr(u,o[c])):gr(u,o)}else ie(a)&&gr(JSON.parse(a),o)}),s==null&&r)for(const a in o)Gt(o,a)&&fs(o[a]);return o}function mh(i){return i.type}function gh(i,e,t){let n=Pe(e.messages)?e.messages:Me();"__i18nGlobal"in t&&(n=Sl(i.locale.value,{messages:n,__i18n:t.__i18nGlobal}));const s=Object.keys(n);s.length&&s.forEach(r=>{i.mergeLocaleMessage(r,n[r])});{if(Pe(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{i.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(Pe(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{i.mergeNumberFormat(o,e.numberFormats[o])})}}}function Oh(i){return l.createVNode(l.Text,null,i,0)}const _h="__INTLIFY_META__",bh=()=>[],pb=()=>!1;let yh=0;function wh(i){return(e,t,n,s)=>i(t,n,l.getCurrentInstance()||void 0,s)}const mb=()=>{const i=l.getCurrentInstance();let e=null;return i&&(e=mh(i)[_h])?{[_h]:e}:null};function Cl(i={}){const{__root:e,__injectWithOption:t}=i,n=e===void 0,s=i.flatJson,r=Yt?l.ref:l.shallowRef;let o=$e(i.inheritLocale)?i.inheritLocale:!0;const a=r(e&&o?e.locale.value:ie(i.locale)?i.locale:cs),c=r(e&&o?e.fallbackLocale.value:ie(i.fallbackLocale)||We(i.fallbackLocale)||xe(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:a.value),u=r(Sl(a.value,i)),h=r(xe(i.datetimeFormats)?i.datetimeFormats:{[a.value]:{}}),f=r(xe(i.numberFormats)?i.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:$e(i.missingWarn)||Pn(i.missingWarn)?i.missingWarn:!0,m=e?e.fallbackWarn:$e(i.fallbackWarn)||Pn(i.fallbackWarn)?i.fallbackWarn:!0,O=e?e.fallbackRoot:$e(i.fallbackRoot)?i.fallbackRoot:!0,w=!!i.fallbackFormat,g=Be(i.missing)?i.missing:null,p=Be(i.missing)?wh(i.missing):null,b=Be(i.postTranslation)?i.postTranslation:null,k=e?e.warnHtmlMessage:$e(i.warnHtmlMessage)?i.warnHtmlMessage:!0,y=!!i.escapeParameter;const C=e?e.modifiers:xe(i.modifiers)?i.modifiers:{};let T=i.pluralRules||e&&e.pluralRules,x;x=(()=>{n&&Yu(null);const U={version:ub,locale:a.value,fallbackLocale:c.value,messages:u.value,modifiers:C,pluralRules:T,missing:p===null?void 0:p,missingWarn:d,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:b===null?void 0:b,warnHtmlMessage:k,escapeParameter:y,messageResolver:i.messageResolver,messageCompiler:i.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=h.value,U.numberFormats=f.value,U.__datetimeFormatters=xe(x)?x.__datetimeFormatters:void 0,U.__numberFormatters=xe(x)?x.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(U.__v_emitter=xe(x)?x.__v_emitter:void 0);const Y=Z0(U);return n&&Yu(Y),Y})(),us(x,a.value,c.value);function R(){return[a.value,c.value,u.value,h.value,f.value]}const _=l.computed({get:()=>a.value,set:U=>{a.value=U,x.locale=a.value}}),S=l.computed({get:()=>c.value,set:U=>{c.value=U,x.fallbackLocale=c.value,us(x,a.value,U)}}),P=l.computed(()=>u.value),Q=l.computed(()=>h.value),E=l.computed(()=>f.value);function W(){return Be(b)?b:null}function B(U){b=U,x.postTranslation=U}function I(){return g}function G(U){U!==null&&(p=wh(U)),g=U,x.missing=p}function Z(U,Y){return U!=="translate"||!Y.resolvedMessage}const H=(U,Y,Ee,qe,Ci,sn)=>{R();let rn;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(x.fallbackContext=e?I0():void 0),rn=U(x)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(x.fallbackContext=void 0)}if(Ee!=="translate exists"&&je(rn)&&rn===br||Ee==="translate exists"&&!rn){const[vi,Ou]=Y();if(process.env.NODE_ENV!=="production"&&e&&ie(vi)&&Z(Ee,Ou)&&(O&&(wr(m,vi)||Ku(d,vi))&&Ti(kr(Ui.FALLBACK_TO_ROOT,{key:vi,type:Ee})),process.env.NODE_ENV!=="production")){const{__v_emitter:il}=x;il&&O&&il.emit("fallback",{type:Ee,key:vi,to:"global",groupId:`${Ee}:${vi}`})}return e&&O?qe(e):Ci(vi)}else{if(sn(rn))return rn;throw yt(ve.UNEXPECTED_RETURN_TYPE)}};function j(...U){return H(Y=>Reflect.apply(ch,null,[Y,...U]),()=>_l(...U),"translate",Y=>Reflect.apply(Y.t,Y,[...U]),Y=>Y,Y=>ie(Y))}function z(...U){const[Y,Ee,qe]=U;if(qe&&!Pe(qe))throw yt(ve.INVALID_ARGUMENT);return j(Y,Ee,tt({resolvedMessage:!0},qe||{}))}function me(...U){return H(Y=>Reflect.apply(th,null,[Y,...U]),()=>gl(...U),"datetime format",Y=>Reflect.apply(Y.d,Y,[...U]),()=>yr,Y=>ie(Y))}function de(...U){return H(Y=>Reflect.apply(sh,null,[Y,...U]),()=>Ol(...U),"number format",Y=>Reflect.apply(Y.n,Y,[...U]),()=>yr,Y=>ie(Y))}function ae(U){return U.map(Y=>ie(Y)||je(Y)||$e(Y)?Oh(String(Y)):Y)}const N={normalize:ae,interpolate:U=>U,type:"vnode"};function q(...U){return H(Y=>{let Ee;const qe=Y;try{qe.processor=N,Ee=Reflect.apply(ch,null,[qe,...U])}finally{qe.processor=null}return Ee},()=>_l(...U),"translate",Y=>Y[yl](...U),Y=>[Oh(Y)],Y=>We(Y))}function J(...U){return H(Y=>Reflect.apply(sh,null,[Y,...U]),()=>Ol(...U),"number format",Y=>Y[kl](...U),bh,Y=>ie(Y)||We(Y))}function Ce(...U){return H(Y=>Reflect.apply(th,null,[Y,...U]),()=>gl(...U),"datetime format",Y=>Y[wl](...U),bh,Y=>ie(Y)||We(Y))}function xi(U){T=U,x.pluralRules=T}function Bi(U,Y){return H(()=>{if(!U)return!1;const Ee=ie(Y)?Y:a.value,qe=Ct(Ee),Ci=x.messageResolver(qe,U);return It(Ci)||Zt(Ci)||ie(Ci)},()=>[U],"translate exists",Ee=>Reflect.apply(Ee.te,Ee,[U,Y]),pb,Ee=>$e(Ee))}function Re(U){let Y=null;const Ee=Iu(x,c.value,a.value);for(let qe=0;qe<Ee.length;qe++){const Ci=u.value[Ee[qe]]||{},sn=x.messageResolver(Ci,U);if(sn!=null){Y=sn;break}}return Y}function Ge(U){const Y=Re(U);return Y??(e?e.tm(U)||{}:{})}function Ct(U){return u.value[U]||{}}function zt(U,Y){if(s){const Ee={[U]:Y};for(const qe in Ee)Gt(Ee,qe)&&fs(Ee[qe]);Y=Ee[U]}u.value[U]=Y,x.messages=u.value}function Si(U,Y){u.value[U]=u.value[U]||{};const Ee={[U]:Y};if(s)for(const qe in Ee)Gt(Ee,qe)&&fs(Ee[qe]);Y=Ee[U],gr(Y,u.value[U]),x.messages=u.value}function V(U){return h.value[U]||{}}function D(U,Y){h.value[U]=Y,x.datetimeFormats=h.value,nh(x,U,Y)}function L(U,Y){h.value[U]=tt(h.value[U]||{},Y),x.datetimeFormats=h.value,nh(x,U,Y)}function ne(U){return f.value[U]||{}}function fe(U,Y){f.value[U]=Y,x.numberFormats=f.value,oh(x,U,Y)}function Le(U,Y){f.value[U]=tt(f.value[U]||{},Y),x.numberFormats=f.value,oh(x,U,Y)}yh++,e&&Yt&&(l.watch(e.locale,U=>{o&&(a.value=U,x.locale=U,us(x,a.value,c.value))}),l.watch(e.fallbackLocale,U=>{o&&(c.value=U,x.fallbackLocale=U,us(x,a.value,c.value))}));const Ae={id:yh,locale:_,fallbackLocale:S,get inheritLocale(){return o},set inheritLocale(U){o=U,U&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,us(x,a.value,c.value))},get availableLocales(){return Object.keys(u.value).sort()},messages:P,get modifiers(){return C},get pluralRules(){return T||{}},get isGlobal(){return n},get missingWarn(){return d},set missingWarn(U){d=U,x.missingWarn=d},get fallbackWarn(){return m},set fallbackWarn(U){m=U,x.fallbackWarn=m},get fallbackRoot(){return O},set fallbackRoot(U){O=U},get fallbackFormat(){return w},set fallbackFormat(U){w=U,x.fallbackFormat=w},get warnHtmlMessage(){return k},set warnHtmlMessage(U){k=U,x.warnHtmlMessage=U},get escapeParameter(){return y},set escapeParameter(U){y=U,x.escapeParameter=U},t:j,getLocaleMessage:Ct,setLocaleMessage:zt,mergeLocaleMessage:Si,getPostTranslationHandler:W,setPostTranslationHandler:B,getMissingHandler:I,setMissingHandler:G,[dh]:xi};return Ae.datetimeFormats=Q,Ae.numberFormats=E,Ae.rt=z,Ae.te=Bi,Ae.tm=Ge,Ae.d=me,Ae.n=de,Ae.getDateTimeFormat=V,Ae.setDateTimeFormat=D,Ae.mergeDateTimeFormat=L,Ae.getNumberFormat=ne,Ae.setNumberFormat=fe,Ae.mergeNumberFormat=Le,Ae[ph]=t,Ae[yl]=q,Ae[wl]=Ce,Ae[kl]=J,process.env.NODE_ENV!=="production"&&(Ae[un]=U=>{x.__v_emitter=U},Ae[hs]=()=>{x.__v_emitter=void 0}),Ae}const kh="vue-i18n: composer properties",Al={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},gb={"vue-i18n-resource-inspector":"Search for scopes ..."},Ob={"vue-i18n-timeline":16764185};let Tl;async function _b(i,e){return new Promise((t,n)=>{try{cb({id:"vue-devtools-plugin-vue-i18n",label:Al["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[kh],app:i},s=>{Tl=s,s.on.visitComponentTree(({componentInstance:o,treeNode:a})=>{bb(o,a,e)}),s.on.inspectComponent(({componentInstance:o,instanceData:a})=>{o.vnode.el&&o.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?o.vnode.el.__VUE_I18N__!==e.global.__composer&&Sh(a,o.vnode.el.__VUE_I18N__):Sh(a,o.vnode.el.__VUE_I18N__))}),s.addInspector({id:"vue-i18n-resource-inspector",label:Al["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:gb["vue-i18n-resource-inspector"]}),s.on.getInspectorTree(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Sb(o,e)});const r=new Map;s.on.getInspectorState(async o=>{if(o.app===i&&o.inspectorId==="vue-i18n-resource-inspector")if(s.unhighlightElement(),Ab(o,e),o.nodeId==="global"){if(!r.has(o.app)){const[a]=await s.getComponentInstances(o.app);r.set(o.app,a)}s.highlightElement(r.get(o.app))}else{const a=Cb(o.nodeId,e);a&&s.highlightElement(a)}}),s.on.editInspectorState(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Pb(o,e)}),s.addTimelineLayer({id:"vue-i18n-timeline",label:Al["vue-i18n-timeline"],color:Ob["vue-i18n-timeline"]}),t(!0)})}catch(s){console.error(s),n(!1)}})}function xh(i){return i.type.name||i.type.displayName||i.type.__file||"Anonymous"}function bb(i,e,t){const n=t.mode==="composition"?t.global:t.global.__composer;if(i&&i.vnode.el&&i.vnode.el.__VUE_I18N__&&i.vnode.el.__VUE_I18N__!==n){const s={label:`i18n (${xh(i)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(s)}}function Sh(i,e){const t=kh;i.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),i.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),i.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),i.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),i.state.push({type:t,key:"messages",editable:!1,value:Pl(e.messages.value)}),i.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),i.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function Pl(i){const e={};return Object.keys(i).forEach(t=>{const n=i[t];Be(n)&&"source"in n?e[t]=xb(n):It(n)&&n.loc&&n.loc.source?e[t]=n.loc.source:Pe(n)?e[t]=Pl(n):e[t]=n}),e}const yb={"<":"<",">":">",'"':""","&":"&"};function wb(i){return i.replace(/[<>"&]/g,kb)}function kb(i){return yb[i]||i}function xb(i){return{_custom:{type:"function",display:`<span>ƒ</span> ${i.source?`("${wb(i.source)}")`:"(?)"}`}}}function Sb(i,e){i.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[n,s]of e.__instances){const r=e.mode==="composition"?s:s.__composer;t!==r&&i.rootNodes.push({id:r.id.toString(),label:`${xh(n)} Scope`})}}function Cb(i,e){let t=null;if(i!=="global"){for(const[n,s]of e.__instances.entries())if(s.id.toString()===i){t=n;break}}return t}function Ch(i,e){if(i==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(n=>n.id.toString()===i);return t?e.mode==="composition"?t:t.__composer:null}}function Ab(i,e){const t=Ch(i.nodeId,e);return t&&(i.state=Tb(t)),null}function Tb(i){const e={},t="Locale related info",n=[{type:t,key:"locale",editable:!0,value:i.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:i.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:i.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:i.inheritLocale}];e[t]=n;const s="Locale messages info",r=[{type:s,key:"messages",editable:!1,value:Pl(i.messages.value)}];e[s]=r;{const o="Datetime formats info",a=[{type:o,key:"datetimeFormats",editable:!1,value:i.datetimeFormats.value}];e[o]=a;const c="Datetime formats info",u=[{type:c,key:"numberFormats",editable:!1,value:i.numberFormats.value}];e[c]=u}return e}function ds(i,e){if(Tl){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),Tl.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:i,groupId:t,time:Date.now(),meta:{},data:e||{},logType:i==="compile-error"?"error":i==="fallback"||i==="missing"?"warning":"default"}})}}function Pb(i,e){const t=Ch(i.nodeId,e);if(t){const[n]=i.path;n==="locale"&&ie(i.state.value)?t.locale.value=i.state.value:n==="fallbackLocale"&&(ie(i.state.value)||We(i.state.value)||Pe(i.state.value))?t.fallbackLocale.value=i.state.value:n==="inheritLocale"&&$e(i.state.value)&&(t.inheritLocale=i.state.value)}}function Qb(i){const e=ie(i.locale)?i.locale:cs,t=ie(i.fallbackLocale)||We(i.fallbackLocale)||xe(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:e,n=Be(i.missing)?i.missing:void 0,s=$e(i.silentTranslationWarn)||Pn(i.silentTranslationWarn)?!i.silentTranslationWarn:!0,r=$e(i.silentFallbackWarn)||Pn(i.silentFallbackWarn)?!i.silentFallbackWarn:!0,o=$e(i.fallbackRoot)?i.fallbackRoot:!0,a=!!i.formatFallbackMessages,c=xe(i.modifiers)?i.modifiers:{},u=i.pluralizationRules,h=Be(i.postTranslation)?i.postTranslation:void 0,f=ie(i.warnHtmlInMessage)?i.warnHtmlInMessage!=="off":!0,d=!!i.escapeParameterHtml,m=$e(i.sync)?i.sync:!0;let O=i.messages;if(xe(i.sharedMessages)){const C=i.sharedMessages;O=Object.keys(C).reduce((x,A)=>{const R=x[A]||(x[A]={});return tt(R,C[A]),x},O||{})}const{__i18n:w,__root:g,__injectWithOption:p}=i,b=i.datetimeFormats,k=i.numberFormats,y=i.flatJson;return{locale:e,fallbackLocale:t,messages:O,flatJson:y,datetimeFormats:b,numberFormats:k,missing:n,missingWarn:s,fallbackWarn:r,fallbackRoot:o,fallbackFormat:a,modifiers:c,pluralRules:u,postTranslation:h,warnHtmlMessage:f,escapeParameter:d,messageResolver:i.messageResolver,inheritLocale:m,__i18n:w,__root:g,__injectWithOption:p}}function Ql(i={}){const e=Cl(Qb(i)),{__extender:t}=i,n={id:e.id,get locale(){return e.locale.value},set locale(s){e.locale.value=s},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(s){e.fallbackLocale.value=s},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(s){e.setMissingHandler(s)},get silentTranslationWarn(){return $e(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(s){e.missingWarn=$e(s)?!s:s},get silentFallbackWarn(){return $e(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(s){e.fallbackWarn=$e(s)?!s:s},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(s){e.fallbackFormat=s},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(s){e.setPostTranslationHandler(s)},get sync(){return e.inheritLocale},set sync(s){e.inheritLocale=s},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(s){e.warnHtmlMessage=s!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(s){e.escapeParameter=s},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...s){return Reflect.apply(e.t,e,[...s])},rt(...s){return Reflect.apply(e.rt,e,[...s])},tc(...s){const[r,o,a]=s,c={plural:1};let u=null,h=null;if(process.env.NODE_ENV!=="production"&&yu(kr(Ui.DEPRECATE_TC)),!ie(r))throw yt(ve.INVALID_ARGUMENT);const f=r;return ie(o)?c.locale=o:je(o)?c.plural=o:We(o)?u=o:xe(o)&&(h=o),ie(a)?c.locale=a:We(a)?u=a:xe(a)&&(h=a),Reflect.apply(e.t,e,[f,u||h||{},c])},te(s,r){return e.te(s,r)},tm(s){return e.tm(s)},getLocaleMessage(s){return e.getLocaleMessage(s)},setLocaleMessage(s,r){e.setLocaleMessage(s,r)},mergeLocaleMessage(s,r){e.mergeLocaleMessage(s,r)},d(...s){return Reflect.apply(e.d,e,[...s])},getDateTimeFormat(s){return e.getDateTimeFormat(s)},setDateTimeFormat(s,r){e.setDateTimeFormat(s,r)},mergeDateTimeFormat(s,r){e.mergeDateTimeFormat(s,r)},n(...s){return Reflect.apply(e.n,e,[...s])},getNumberFormat(s){return e.getNumberFormat(s)},setNumberFormat(s,r){e.setNumberFormat(s,r)},mergeNumberFormat(s,r){e.mergeNumberFormat(s,r)}};return n.__extender=t,process.env.NODE_ENV!=="production"&&(n.__enableEmitter=s=>{const r=e;r[un]&&r[un](s)},n.__disableEmitter=()=>{const s=e;s[hs]&&s[hs]()}),n}function Eb(i,e,t){return{beforeCreate(){const n=l.getCurrentInstance();if(!n)throw yt(ve.UNEXPECTED_ERROR);const s=this.$options;if(s.i18n){const r=s.i18n;if(s.__i18n&&(r.__i18n=s.__i18n),r.__root=e,this===this.$root)this.$i18n=Ah(i,r);else{r.__injectWithOption=!0,r.__extender=t.__vueI18nExtend,this.$i18n=Ql(r);const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=Ah(i,s);else{this.$i18n=Ql({__i18n:s.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}else this.$i18n=i;s.__i18nGlobal&&gh(e,s,s),this.$t=(...r)=>this.$i18n.t(...r),this.$rt=(...r)=>this.$i18n.rt(...r),this.$tc=(...r)=>this.$i18n.tc(...r),this.$te=(r,o)=>this.$i18n.te(r,o),this.$d=(...r)=>this.$i18n.d(...r),this.$n=(...r)=>this.$i18n.n(...r),this.$tm=r=>this.$i18n.tm(r),t.__setInstance(n,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const n=this.$i18n;this.$el.__VUE_I18N__=n.__composer;const s=this.__v_emitter=ol();n.__enableEmitter&&n.__enableEmitter(s),s.on("*",ds)}},unmounted(){const n=l.getCurrentInstance();if(!n)throw yt(ve.UNEXPECTED_ERROR);const s=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",ds),delete this.__v_emitter),this.$i18n&&(s.__disableEmitter&&s.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,s.__disposer&&(s.__disposer(),delete s.__disposer,delete s.__extender),t.__deleteInstance(n),delete this.$i18n}}}function Ah(i,e){i.locale=e.locale||i.locale,i.fallbackLocale=e.fallbackLocale||i.fallbackLocale,i.missing=e.missing||i.missing,i.silentTranslationWarn=e.silentTranslationWarn||i.silentFallbackWarn,i.silentFallbackWarn=e.silentFallbackWarn||i.silentFallbackWarn,i.formatFallbackMessages=e.formatFallbackMessages||i.formatFallbackMessages,i.postTranslation=e.postTranslation||i.postTranslation,i.warnHtmlInMessage=e.warnHtmlInMessage||i.warnHtmlInMessage,i.escapeParameterHtml=e.escapeParameterHtml||i.escapeParameterHtml,i.sync=e.sync||i.sync,i.__composer[dh](e.pluralizationRules||i.pluralizationRules);const t=Sl(i.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(n=>i.mergeLocaleMessage(n,t[n])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(n=>i.mergeDateTimeFormat(n,e.datetimeFormats[n])),e.numberFormats&&Object.keys(e.numberFormats).forEach(n=>i.mergeNumberFormat(n,e.numberFormats[n])),i}const El={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:i=>i==="parent"||i==="global",default:"parent"},i18n:{type:Object}};function $b({slots:i},e){return e.length===1&&e[0]==="default"?(i.default?i.default():[]).reduce((n,s)=>[...n,...s.type===l.Fragment?s.children:[s]],[]):e.reduce((t,n)=>{const s=i[n];return s&&(t[n]=s()),t},Me())}function Th(){return l.Fragment}const Ph=l.defineComponent({name:"i18n-t",props:tt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:i=>je(i)||!isNaN(i)}},El),setup(i,e){const{slots:t,attrs:n}=e,s=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Me();i.locale&&(o.locale=i.locale),i.plural!==void 0&&(o.plural=ie(i.plural)?+i.plural:i.plural);const a=$b(e,r),c=s[yl](i.keypath,a,o),u=tt(Me(),n),h=ie(i.tag)||Pe(i.tag)?i.tag:Th();return l.h(h,u,c)}}});function Nb(i){return We(i)&&!ie(i[0])}function Qh(i,e,t,n){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Me();i.locale&&(o.locale=i.locale),ie(i.format)?o.key=i.format:Pe(i.format)&&(ie(i.format.key)&&(o.key=i.format.key),a=Object.keys(i.format).reduce((d,m)=>t.includes(m)?tt(Me(),d,{[m]:i.format[m]}):d,Me()));const c=n(i.value,o,a);let u=[o.key];We(c)?u=c.map((d,m)=>{const O=s[d.type],w=O?O({[d.type]:d.value,index:m,parts:c}):[d.value];return Nb(w)&&(w[0].key=`${d.type}-${m}`),w}):ie(c)&&(u=[c]);const h=tt(Me(),r),f=ie(i.tag)||Pe(i.tag)?i.tag:Th();return l.h(f,h,u)}}const Eh=l.defineComponent({name:"i18n-n",props:tt({value:{type:Number,required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return Qh(i,e,rh,(...n)=>t[kl](...n))}}),$h=l.defineComponent({name:"i18n-d",props:tt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Kt({useScope:i.scope,__useComponent:!0});return Qh(i,e,ih,(...n)=>t[wl](...n))}});function Rb(i,e){const t=i;if(i.mode==="composition")return t.__getInstance(e)||i.global;{const n=t.__getInstance(e);return n!=null?n.__composer:i.global.__composer}}function Vb(i){const e=o=>{const{instance:a,value:c}=o;if(!a||!a.$)throw yt(ve.UNEXPECTED_ERROR);const u=Rb(i,a.$),h=Nh(c);return[Reflect.apply(u.t,u,[...Rh(h)]),u]};return{created:(o,a)=>{const[c,u]=e(a);Yt&&i.global===u&&(o.__i18nWatcher=l.watch(u.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=u,o.textContent=c},unmounted:o=>{Yt&&o.__i18nWatcher&&(o.__i18nWatcher(),o.__i18nWatcher=void 0,delete o.__i18nWatcher),o.__composer&&(o.__composer=void 0,delete o.__composer)},beforeUpdate:(o,{value:a})=>{if(o.__composer){const c=o.__composer,u=Nh(a);o.textContent=Reflect.apply(c.t,c,[...Rh(u)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function Nh(i){if(ie(i))return{path:i};if(xe(i)){if(!("path"in i))throw yt(ve.REQUIRED_VALUE,"path");return i}else throw yt(ve.INVALID_VALUE)}function Rh(i){const{path:e,locale:t,args:n,choice:s,plural:r}=i,o={},a=n||{};return ie(t)&&(o.locale=t),je(s)&&(o.plural=s),je(r)&&(o.plural=r),[e,a,o]}function Lb(i,e,...t){const n=xe(t[0])?t[0]:{};($e(n.globalInstall)?n.globalInstall:!0)&&([Ph.name,"I18nT"].forEach(r=>i.component(r,Ph)),[Eh.name,"I18nN"].forEach(r=>i.component(r,Eh)),[$h.name,"I18nD"].forEach(r=>i.component(r,$h))),i.directive("t",Vb(e))}const Mb=oi("global-vue-i18n");function Vh(i={},e){const t=__VUE_I18N_LEGACY_API__&&$e(i.legacy)?i.legacy:__VUE_I18N_LEGACY_API__,n=$e(i.globalInjection)?i.globalInjection:!0,s=new Map,[r,o]=Db(i,t),a=oi(process.env.NODE_ENV!=="production"?"vue-i18n":"");function c(d){return s.get(d)||null}function u(d,m){s.set(d,m)}function h(d){s.delete(d)}const f={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},async install(d,...m){if(process.env.NODE_ENV!=="production"&&(d.__VUE_I18N__=f),d.__VUE_I18N_SYMBOL__=a,d.provide(d.__VUE_I18N_SYMBOL__,f),xe(m[0])){const g=m[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let O=null;!t&&n&&(O=Wb(d,f.global)),__VUE_I18N_FULL_INSTALL__&&Lb(d,f,...m),__VUE_I18N_LEGACY_API__&&t&&d.mixin(Eb(o,o.__composer,f));const w=d.unmount;if(d.unmount=()=>{O&&O(),f.dispose(),w()},process.env.NODE_ENV!=="production"){if(!await _b(d,f))throw yt(ve.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const p=ol();if(t){const b=o;b.__enableEmitter&&b.__enableEmitter(p)}else{const b=o;b[un]&&b[un](p)}p.on("*",ds)}},get global(){return o},dispose(){r.stop()},__instances:s,__getInstance:c,__setInstance:u,__deleteInstance:h};return f}function Kt(i={}){const e=l.getCurrentInstance();if(e==null)throw yt(ve.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw yt(ve.NOT_INSTALLED);const t=Bb(e),n=Ib(t),s=mh(e),r=vb(i,s);if(r==="global")return gh(n,i,s),n;if(r==="parent"){let c=Zb(t,e,i.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&Ti(kr(Ui.NOT_FOUND_PARENT_SCOPE)),c=n),c}const o=t;let a=o.__getInstance(e);if(a==null){const c=tt({},i);"__i18n"in s&&(c.__i18n=s.__i18n),n&&(c.__root=n),a=Cl(c),o.__composerExtend&&(a[xl]=o.__composerExtend(a)),Ub(o,e,a),o.__setInstance(e,a)}return a}function Db(i,e,t){const n=l.effectScope(),s=__VUE_I18N_LEGACY_API__&&e?n.run(()=>Ql(i)):n.run(()=>Cl(i));if(s==null)throw yt(ve.UNEXPECTED_ERROR);return[n,s]}function Bb(i){const e=l.inject(i.isCE?Mb:i.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw yt(i.isCE?ve.NOT_INSTALLED_WITH_PROVIDE:ve.UNEXPECTED_ERROR);return e}function vb(i,e){return pr(i)?"__i18n"in e?"local":"global":i.useScope?i.useScope:"local"}function Ib(i){return i.mode==="composition"?i.global:i.global.__composer}function Zb(i,e,t=!1){let n=null;const s=e.root;let r=Fb(e,t);for(;r!=null;){const o=i;if(i.mode==="composition")n=o.__getInstance(r);else if(__VUE_I18N_LEGACY_API__){const a=o.__getInstance(r);a!=null&&(n=a.__composer,t&&n&&!n[ph]&&(n=null))}if(n!=null||s===r)break;r=r.parent}return n}function Fb(i,e=!1){return i==null?null:e&&i.vnode.ctx||i.parent}function Ub(i,e,t){let n=null;l.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,n=ol();const s=t;s[un]&&s[un](n),n.on("*",ds)}},e),l.onUnmounted(()=>{const s=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(n&&n.off("*",ds),s[hs]&&s[hs](),delete e.vnode.el.__VUE_I18N__),i.__deleteInstance(e);const r=s[xl];r&&(r(),delete s[xl])},e)}const Xb=["locale","fallbackLocale","availableLocales"],Lh=["t","rt","d","n","tm","te"];function Wb(i,e){const t=Object.create(null);return Xb.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw yt(ve.UNEXPECTED_ERROR);const o=l.isRef(r.value)?{get(){return r.value.value},set(a){r.value.value=a}}:{get(){return r.get&&r.get()}};Object.defineProperty(t,s,o)}),i.config.globalProperties.$i18n=t,Lh.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw yt(ve.UNEXPECTED_ERROR);Object.defineProperty(i.config.globalProperties,`$${s}`,r)}),()=>{delete i.config.globalProperties.$i18n,Lh.forEach(s=>{delete i.config.globalProperties[`$${s}`]})}}if(hb(),L0(d0),M0(E0),D0(Iu),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const i=an();i.__INTLIFY__=!0,p0(i.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const Mh="3.7.8",qb=Mh,Rn=typeof Buffer=="function",Dh=typeof TextDecoder=="function"?new TextDecoder:void 0,Bh=typeof TextEncoder=="function"?new TextEncoder:void 0,jb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ps=Array.prototype.slice.call(jb),xr=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(ps),zb=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,at=String.fromCharCode.bind(String),vh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Ih=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Zh=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Fh=i=>{let e,t,n,s,r="";const o=i.length%3;for(let a=0;a<i.length;){if((t=i.charCodeAt(a++))>255||(n=i.charCodeAt(a++))>255||(s=i.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=t<<16|n<<8|s,r+=ps[e>>18&63]+ps[e>>12&63]+ps[e>>6&63]+ps[e&63]}return o?r.slice(0,o-3)+"===".substring(o):r},$l=typeof btoa=="function"?i=>btoa(i):Rn?i=>Buffer.from(i,"binary").toString("base64"):Fh,Nl=Rn?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let n=0,s=i.length;n<s;n+=4096)t.push(at.apply(null,i.subarray(n,n+4096)));return $l(t.join(""))},Sr=(i,e=!1)=>e?Ih(Nl(i)):Nl(i),Yb=i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?at(192|e>>>6)+at(128|e&63):at(224|e>>>12&15)+at(128|e>>>6&63)+at(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return at(240|e>>>18&7)+at(128|e>>>12&63)+at(128|e>>>6&63)+at(128|e&63)}},Gb=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Uh=i=>i.replace(Gb,Yb),Xh=Rn?i=>Buffer.from(i,"utf8").toString("base64"):Bh?i=>Nl(Bh.encode(i)):i=>$l(Uh(i)),Vn=(i,e=!1)=>e?Ih(Xh(i)):Xh(i),Wh=i=>Vn(i,!0),Kb=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Hb=i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return at((t>>>10)+55296)+at((t&1023)+56320);case 3:return at((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return at((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},qh=i=>i.replace(Kb,Hb),jh=i=>{if(i=i.replace(/\s+/g,""),!zb.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t,n,s=[];for(let r=0;r<i.length;)e=xr[i.charAt(r++)]<<18|xr[i.charAt(r++)]<<12|(t=xr[i.charAt(r++)])<<6|(n=xr[i.charAt(r++)]),t===64?s.push(at(e>>16&255)):n===64?s.push(at(e>>16&255,e>>8&255)):s.push(at(e>>16&255,e>>8&255,e&255));return s.join("")},Rl=typeof atob=="function"?i=>atob(Zh(i)):Rn?i=>Buffer.from(i,"base64").toString("binary"):jh,zh=Rn?i=>vh(Buffer.from(i,"base64")):i=>vh(Rl(i).split("").map(e=>e.charCodeAt(0))),Yh=i=>zh(Gh(i)),Jb=Rn?i=>Buffer.from(i,"base64").toString("utf8"):Dh?i=>Dh.decode(zh(i)):i=>qh(Rl(i)),Gh=i=>Zh(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),Vl=i=>Jb(Gh(i)),ey=i=>{if(typeof i!="string")return!1;const e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Kh=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),Hh=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Kh(t));i("fromBase64",function(){return Vl(this)}),i("toBase64",function(e){return Vn(this,e)}),i("toBase64URI",function(){return Vn(this,!0)}),i("toBase64URL",function(){return Vn(this,!0)}),i("toUint8Array",function(){return Yh(this)})},Jh=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Kh(t));i("toBase64",function(e){return Sr(this,e)}),i("toBase64URI",function(){return Sr(this,!0)}),i("toBase64URL",function(){return Sr(this,!0)})},ty={version:Mh,VERSION:qb,atob:Rl,atobPolyfill:jh,btoa:$l,btoaPolyfill:Fh,fromBase64:Vl,toBase64:Vn,encode:Vn,encodeURI:Wh,encodeURL:Wh,utob:Uh,btou:qh,decode:Vl,isValid:ey,fromUint8Array:Sr,toUint8Array:Yh,extendString:Hh,extendUint8Array:Jh,extendBuiltins:()=>{Hh(),Jh()}},iy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACOZJREFUeF7tnUF2ozoQRYGNJT2Nvacke3KYJr0x00f9zYnb346FwKpXpZtJD1qgp1fvusAhqO/4wQEcuOlAjzc4gAO3HQAQ0oEDPzgAIMQDBwCEDOBAmQN0kDLfOKoRBwCkkUKzzDIHAKTMN45qxAEAaaTQLLPMAQAp842jGnFAGpD9fv+c6nA8Hv/+y892DgzD8HU4HL62O2PMM0kBkoBIMPR9/zRNE1DUydz7OI5vdabyN4sMILvd7hMozAIEJDesNwckdY1pml6BwwyOeWIguVICU0BeXl5Sa381jwYCgEStgwCHLJV0krPSmHWQl5eXSTYiCAOSUwZMAOGG3AWBQNJ1XXVAuLRyAQf3JFYdhO7hCpAktulOYtFBuPdwx0i7kFQF5PSb8k9/+UBxq52kKiDcf7gHrbnLLXlAhmH4xUN168HasHs3BUlVQApu0JsqxnoMfj4DkCx3uCogBb8cBJDlNf3xCCBZZiiALPMrxGggyS8jgOR7FWokkOSVE0DyfAo5CkjulxVA7nsUegSQ/FxeAAkd/7zFAcltnwAkL0PhRwHJ9RIDSPjo5y8QSP7vFYDk56eJkUDyb5kBpInYL1skkHz7BSDLstPMaCD5r9QA0kzkly8USABkeWoaO6J1SOggjQW+ZLktQwIgJYlp8JhWIQGQBsNeuuQWIQGQ0rQ0elxrkABIo0Ffs+yWIAGQNUlp+NhWIAGQhkO+duktQAIga1PS+PHRIQGQxgO+xfIjQwIgWySEc3RRIQEQwr2ZAxEhAZDN4sGJkgPRIAEQcr25A5EgAZDN48EJI3USACHPD3MgQicBkIfFgxNH6CQAQo4f7oDnTgIgD48HE2zZSWrvFwMg5LeaA1t0kr7vvz4+Pn7VEg0gtZxmnr8OrIUEQP4NEhvoBARrLSTjOFb7YK82UaozO0wFTHvhktZAAiDfptNBCgPo4bBSSAAEQDzkexONJVuDAwiAbBI+DycBkLMqcQ/iIbJ1NQIIgNRNnLPZAARAnEW2rlwAAZC6iXM2G4AAiLPI1pULIIEBSd/j141T2WyHw+Gr7MjHHwUgwQDZ7XafaUnTNLmAY7Y/PcM0TdPvcRzfHh/7/BkAJBAgCQ5vYFxGtfbDfvdQAZAggESA47yb1Hxk/CdIACQAICVFvPfJaf3/tf/w6NZ6S7zlUZNvNyUeViwpojUA9+ZXudQq8RZA9ACZ7gXO4//XDBodJCMhXp/FKtCd4Yb9EAC5XwP+YOq+RyV/6JVxVvMhbi9fa4INIBk5DdpBACSj9gCSYVI0QFRu0JP13KTH+Jo3zE26EhwAcvHpXPBJrHIZ4B6QBEYqh8ovCOdo0EHa7CDvwzDIPCDIw4oZ19E3hnAPkuGd186XsTTzIXSQRjuI2lOz5iTcEAAgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgAKKaTQldAAIgEkFUFQEgbQIilcd585z0Igm1FzgACIBIwdJ1ncSrlGZTAARA1ABJemQgARAAUQSkYwOdvLLwXqwMnwrei5VxVtshKq8gpYPQQWxJuDE7gOSVhQ6S4VPEDpKWXXOfjVs200HoIBkI1h9CB8nznA6S4VPQDiLxTRYdhA6SgWD9IQqXV2nVAAIg9dN/Z0aVr3gB5KJQBZcqKpcB7jfQSaVI9x19378rPW5CB2mwg8zPPqm0jnkzHyUwZm8ApEFAlB7lUIGUr3kzKtHQJZbEpWFGScyH0EHoIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQACIOYhVBYAIACinE9zbQDSICBqL21IJRjH8c2chisCAKRBQBSDOGtSeidW0gQgACLHixIkAAIgcoAkQSqQAAiASAKi8u4uAAEQSUDY/iCvLGx/kOFTwQvvMs5qP0ThDe90kAAdZLfbfU7T9Gwf6W0VAMh9P+kg9z3qggIi8XpUOkiADrLf75+Px+NnBkuehgBIRrXoIBkmlf5CK/PUFsMk4Cj1tealIYAsiGfJ5cCC09caKgMHgFyUvODbIKlipuWcLree+75/8nLjPu8slfSrbaJT8qFDB/kGSw6QWh/zrcwDIAFu0lsJq8U6AQRALHLnZk4AARA3YbUQCiAAYpE7N3MCCIC4CauFUAABEIvcuZkTQADETVgthAIIgFjkzs2cAAIgbsJqIRRAAMQid27mBBAAcRNWC6EAAiAWuXMzJ4AAiJuwWggFEACxyJ2bOQEEQNyE1UIogACIRe7czAkgAOImrBZCAQRALHLnZk4AARA3YbUQCiAAYpE7N3MCCIC4CauFUAABEIvcuZkTQADETVgthAIIgFjkzs2cAAIgbsJqIRRAAMQid27mBJCzUi3dZ0NlmzA3aXModCkgtTNR9e3uSwE51Zv38zoMfo7kwn1XquahKiCFhuR4zZh2HACQdmrNSpc6UHt/96odJJlRsEfIUg8ZH9iBmnuDJBurA1J4HxK45Cwt14HaN+gmgHAfkhsHxl1xoOr9hwkgaVK6COFf6oBF9zADhC6yNB6Mr33vMTte/R5knhhICP0CB6pfWpkDcvpG663rutcFRjG0PQfM4DC7xDqvMZ2kvcTnrHjeutp622qzS6xLk5Y+k5NjMmN8OmB1Q37NLRlAzi65ur7vn6ZpevZZXlSXOJCgmKbp9zAMX9Zd41y/FCDXjD11lhLPOUbcgQRDkqgExKVl8oCI1xh5wR0AkOAFZnnrHACQdf5xdHAHACR4gVneOgcAZJ1/HB3cAQAJXmCWt84BAFnnH0cHdwBAgheY5a1zAEDW+cfRwR0AkOAFZnnrHPgDE4eAQaFl6p8AAAAASUVORK5CYII=",ny="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACZVJREFUeF7tnUt2IjkQRcncWJen2Huya0/A1O6NoW5RUGAwkAqFPhG6nnTXOalPPL2boRBJMq34QwEUuKvAhDYogAL3FQAQ3IECDxQAEOyBAgCCB1BApgAZRKYbrQZRAEAGWWjClCkAIDLdaDWIAgAyyEITpkwBAJHpRqtBFGgKyNvb26+o836/P/yXv3YKzPP8tdlsvtrNoM+RmwASwQghvIcQAKM/X/ze7XYf/U2rzYyqAxLh2O/3n23CZdSFCgDJUajqgKzX67BwkbisrQJAslqtqgKyXq9j6n5vu+6MnqDA8JAASIJbBr10aEhqA8L2yiBl8zy/jHrCBSAGDdtiyqNCAiAt3GZwzGmavrbb7YvBqWdNGUCy5Bur8YiQAMhYHteIdqiiHUA0LDNeH8NAAiDjmVsr4iEg6R2QIRZBy7Ep/Wg88jPCyRaApLjK2bUaTzZ4hwRAnJk+NZxcSLyfbAFIqqMcXg8k9xcVQBwaXhLS6+vrZ+b3c1zWiwAicZPTNkByu7AA4tTskrA0Trb+/wqFq0wCIBInOW6jAYmnky0AcWx2aWi5RXsc1wskACJ1kfN2uZB4Of4FEOdGzwkPSOp/Jz31G4WuCr4cs7ZqO/rJFhmklfMMjTsyJABiyKitpqpxsmX1+BdAWrnO2LgakFg82QIQY0ZtOd3cot3i8S+AtHScwbFzIbF2/AsgBk3aesojQQIgrd1mdPxRTrYAxKhBe5j2CJAASA9OMzoHjZOt3o9/AcSoOXuZtgYkPR//AkgvTjM8j9yivefjXwAxbMyepp4LSa/HvwDSk8uMz8UjJABi3JS9Td/byRaA9OYwB/PxBAmAODBkbyFonGz1cvwLIL25y8l8NCDp4fgXQJwYsscwcov2Ho5/AaRHZzmaUy4krY9/AcSRGXsNxTIkANKrq5zNy+rJFoA4M2LP4ViEBEB6dpSzuVk82QIQZybsPZxcSGoX7QDSu6Mczi+naAeQ74bgzYoOAYkh5UCy2+2q3dirDXQUhVePOjW8JCwpJAByVpsMInGeoTaSky0AARBDFs+bqiSLAAiA5LnOUGsAuVis9XpNDWLIvDWmCiAAUsNnZscAEAAxa94aEwcQACnqs/jJdNEBjp1vNpuvEuMACICo+ypCEUJ4DyFUgeMigN/x/3e73YdWUAACIFpeOvQjMZTqBP50pvb5lCQejnk55v3R0xIzFYDj1KUKJJKYAARA7gGSekxekI/DViv7USUAYYulYlKJkVQGftCJxltHJHFpgLlUm+w7wNKBjvvn1DugShpPmWOv10qMVDoWjUfPJXEBCFusG29LHuoDkHwFyCD5GlbpAUDOMpNByCBkkAe3HQABEAABkEU7E4r0o0xssdhi/UQMgADIjS/YYrHFyt5ixSPYaZoOz04t/Ut9votj3qXKLryOL0wtFOqHy1K3WBLz1hjjOjQ+B7lQBEAABEAeeABAAARAAEROwYOWNbY/NcYAEAABkAQFqEGoQRLscv/SGnf3GmOQQcggKkBcd1LDvDXGABAAOShwepnCfr/X+t74ewp5HPOmqHX/Wp7m1dHxby9xTz1N0z8NXqjwLRIA0VlYANHR8dCLpOBUHB5ACogJIEqi9gRHDIkMorOwAKKjY8weqV8nVhr5524AREdeAFHQsbfsQQZRWNRjFwCioCWAyEWUaMfj7me9TXwfJPXzA7mdlrdki7Vcq0dXkkEUdAQQuYhkkAvtBIUsGUToPTKIULirZmQQBR3JIHIRySBkELl7MlqSQTLEu2hKBlHQkQwiF5EMQga5cU+vd/dU0CVxXIsBIAACIA8SDIAACIAAyLI9KMe8f3SSbE1qbH9qjMEW6/HdIvWBPpefgwDI2SRssdhiscVii8UWK+UbhGQQMsiPxFCDUINQgxioQeILFRRfphAjdvFCBYr0W/MO9Ul6qgGWbRzTr2KLxRaruy1WL3BwzPvdGpxidXCK1RMcAAIgd/ccLYr0Y73xmb4RKteCLRZbrG62WJIUXg4NTrE4xersFAtAluOeuhWVZEIA6QyQ1EVfbif5lRJjpcbR6xgAAiBPyenVvDUgBBAAAZCnClCkd1Okp94VE9ZWfCkZBEAA5AE+AAIgAAIgizKs5JSRV4+epc3+wlTqFmvku3sNrSjSjRfpABIW/2ScRCsAAZCnWwuJsWrc3WuMASAAAiBPFaBIN1ukj3x3J4Pc2tb9F6ZqLDpjJKSMq0s5xboQpMXj7ph3uXlraEUNQg3y1JEjb+MABEAA5KkCFOkU6XySvggTahBqkBujsMUig5BByCBkkEUKkEHIII/r0o/UF+/xsOJZUB5WPGpR4wi2xhicYnGK9TSxUoNQg1CDUIM8vVHECzjFMliDhBD+XbS654uSX17tZYztdvuSqNW3ywGkISCpe+qchR64bVadCCCNAAGOeshKaqrT7ACkASDAUQ+O00hSSACkMiASwevbyeeI8zy/bDabr5ToJOvF5yAZn4NIBE9ZUK69r4Aki0jWC0AyAGF71Q5hAMnUvsYXpgAkc5EymgNIhnjHD4VCYhfJR4g9/mBOYsyWL09eL7ZYlYt0AGnHF0V6pvY1tljHTJX8hGhmaDRfrZKzh3StKNIzivScD6BwuVgBERwAcqV3rQxyBUn8Z9KzUmKbDNQwFuQx3Gmafqd+9nEpEzVI5RpkII+6CBVAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdAAMSFkUsFASAAUspbLvoFEABxYeRSQQAIgJTylot+AQRAXBi5VBAAAiClvOWiXwABEBdGLhUEgABIKW+56BdA8gBxYQKC0FWAd/Pq6klvzhQAEGcLSji6CgCIrp705kwBAHG2oISjqwCA6OpJb84UcAsIP7DpzKmNwgGQRsIzrAkFxL9mJYlukjSStuEHNqXK0e5CAb+AxCAFP8OGO1DgrwI1t1dx0KoZJA5IFsHtUgUkPzMtHevUrjogJ0hCCO8hhF+5AdDevwLxB0NzfyxUqlITQC4ne3xYTTp/2jlWYJ7nwy/p5vyKbq48zQHJDYD2KFBSAQApqS59m1cAQMwvIQGUVABASqpL3+YVABDzS0gAJRUAkJLq0rd5BQDE/BISQEkFAKSkuvRtXgEAMb+EBFBSAQApqS59m1fgP2rmXn0Q5oqWAAAAAElFTkSuQmCC",sy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACM5JREFUeF7tnUF24joQRWNvLMkUsqd09gRMQ28M/SM+JHRikFWWSyXVzSQDJKvq6V2XhH3Q8MQfCqDAXQUGtEEBFLivAIDgDhR4oACAYA8UABA8gAIyBaggMt3o5UQBAHEy0aQpUwBAZLrRy4kCAOJkoklTpgCAyHSjlxMFTAPy9vb2EufhdDqd//NXToFxHI+73e5Y7op9XskUIBGICMMwDM8hBKDQ8dzH4XD4ozNUe6OYAWS73X4CRTUDAckd6asDEqtGCOEdOKrBcR0YSCamoCogm80mlvb36tYgACCxVkGAwyyVVJKbqalWQTabTTBrEQIDkosHqgDChrwJAoHk6elJHRCWVk3AwZ6kVgWhejQFSAzWdSWpUUHYezTHiF9IVAG5PCn/bM8fROy1kqgCwv6jedDcLbfMAzKO4ysv1S0Hq2D1dgWJKiCCDbqryViOweMrAEm+wqqACB4OAkj+nD7sASR5ggJInl5dtAaS+dMIIPO16qolkMybTgCZp1OXrYAkPa0Aktao6xZA8nh6AaRr+89LDkju6wQg8zzUfSsgmZ5iAOne+vMTBJLfWgHIfP+4aAkk/04zgLiwfV6SQPKtF4DkecdNayD5f6oBxI3l8xMFEgDJd42zHt4hoYI4M7wkXc+QAIjEMQ77eIUEQByaXZqyR0gAROoWp/28QQIgTo2+JG1PkADIEqc47usFEgBxbPKlqXuABECWusR5/94hARDnBi+Rfs+QAEgJh3CNp14hARDMXUyBHiEBkGL24EJRgd4gARB8XVyBniABkOL24II9VRIAwc+rKdBDJQGQ1ezBhXuoJACCj1dXoOVKAiCr24MBSlYS7fNiAAT/qilQopIMw3Dc7/evWkEDiJbSjHNWYCkkAPKvkThAp0OwlkJyOBzUbuxqA8V55oSpDt0uTGkJJADyLToVRGjAFrpJIQEQAGnB30VilBwNDiAAUsR8LVwEQG5miT1IC5bVjRFAAETXcY2NBiAA0phldcMFEADRdVxjowEIgDRmWd1wAaQTQOJ39rrWWW+03W53XO/qeVcGkIYBiVCEEN5jCiGEbgC5mZKPcRyPNYEBkEYBkT7lzbt/2mit/Qr5bdYA0iAgnuC4Tk8tSACkQUAkk2ajFsij0H6N/BqpRGteNfme5yovKwqe+MudaaQngExPBK+7T+jiEZAoQ41lFhWksSWWx/1HzX0IgACIkUVUOgwqyG+NWGL90IQKovsQkQpCBUnfuo20oIJQQZJWpIJQQW5NwhKLJdaXAlQQKshaFeT8TlPy4ooNTqdTfHfs/B7Z3D8AAZCkVyRLrBrGSiXSSh5s0h1s0gEkhev9zwEEQOTuWdCTCrJAvJuubNILbNKpIHIzUkGoIHL3LOhJBVkgHhXkvnitGCs1/a3kQQWhgqS8vMrnAFJGVvYg7EG+FKixl6KCUEHK3Moyr0IFyRTsTnMqCBWECvKAJQABEAABkPnltpWlSSqjVvJgD8IeJOXlVT4HkDKyssRiicUSiyXW/LtJK3feVEat5MESiyVWysurfA4gZWRlicUSiyUWS6z5d5NW7rypjFrJgyUWS6yUl1f5HEDKyMoSiyUWSyyWWPPvJpI77/yr227Jy4q/54cKUqCC2Lb9/OgABECSbqGC8MNxtyahglBB2IOwB0kWjq8GVBAqCBXkAS8AAiAAAiCTCrBJZ5OeXGt5riCah2NeJ4In6Q6epCepa6NBrQNT/+T+yLYmyHyLxbdYVwUAZOJGBiAAEhWoAkccmCUWSyyzC6x4NnoI4e/hcIjLnCp/AOIAkKvRqjhMMOj1sJ/dTvcr3alQAcQBIDW+HhVwYbILgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASAAYtKYVoICEACx4kWTcQAIgJg0ppWgAARArHjRZBwAAiAmjWklKAABECteNBkHgACISWNaCQpAAMSKF03GASCNARLD3Ww2IcdNmudV5MTVQlsAaRCQ7Xb7GUJ4mWOw+MPV+/3+dU5b2vxWAEAaBCTzGLZqZ2v0AByANAjIZZk152gw4FhIKYA0CsgMSIBjIRwzNJ4cQXPPxxFsiUm+LLdehmF4jk3jiUzxABoLh88U8Gf1S1BBGq4g1d3jIAAAARAHNpenCCAAInePg54AAiAObC5PEUAARO4eBz0BBEAc2FyeIoAAiNw9DnoCCIA4sLk8RQABELl7HPQEEABxYHN5igACIHL3OOgJIADiwObyFAEEQOTucdATQADEgc3lKQIIgMjd46AngACIA5vLUwQQAJG7x0FPAAEQBzaXpwggACJ3j4OeAAIgDmwuTxFAAETuHgc9AQRAHNhcniKAAIjcPQ56AgiAOLC5PEUAARC5exz0BBAAcWBzeYoAAiBy9zjoCSA3k5xz7kbsxtkb/ROSC4i2J1R/vDoXkIs9+BX1TjnJPIflqoKqH1QBEQrSqT1IS6gAgAiFo5sDBcZxfNU8ekK1gsT5yz0g08Gck2KGApqH55z3wRmxFWkq3IcUGZuLtK2A9ga9CiDsQ9o2aeXoVfcfVQCJg1JFKtusweFrVI9qgFBFGnRo5ZC19x7XdNX3INeBgaSy49oaXn1pVR2Qyzdac84ib2sqiba0AtXgqLbEulWQSlLaT31cL+45hmH40HzmMaVctSXWz2By38npwwZkMWnKYTju9/tXC+qYAeRmyRVfUnwOIbxYEIgYdBSIFSOE8Hccx2PtqnGbsSlApqbiUll0ZolRVBWIMMQBLQHxUwDzgKjOGIOhwA8FAARLoMADBQAEe6AAgOABFJApQAWR6UYvJwoAiJOJJk2ZAgAi041eThQAECcTTZoyBQBEphu9nCgAIE4mmjRlCvwHktvoUMXJI94AAAAASUVORK5CYII=",ry="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAC95JREFUeF7tnVF22zgMRSNvrM1v0j2l2ZPr37gbs2boSo3qWBYJESBB3v505lQSwcd3CUCyreGJPyiAAqsKDGiDAiiwrgCA4A4UeKAAgGAPFAAQPIACMgXIIDLdOKsTBQCkk4VmmjIFAESmG2d1ogCAdLLQTFOmAIDIdOOsThSoGpAfP358D+twuVyuf/MnnwKHw+F8PB7P+a7Y5pWqAiQAEWAYhuHbOI5AYeO599Pp9NNmKH+jVAPI6+vrB1AUMxCQrEhfHJCQNcZxfAOOYnDMAwPJnSUoCsjLy0tI7W/FrUEAQFJbBgGOaqkkkyyWplgGeXl5Gau1CIEByeSBIoDQkLsgEEienp7MAaG0cgEHPUmpDEL2cAVICLbrTFIig9B7uGOkX0hMAZmelH/48wcR95pJTAGh/3APWnflVvWAHA6HZz5Utx+sjNm7K0hMARE06F0txn4MHl8BSNIVNgVE8HAQQNLX9OEZQJImKICk6dXE0UASv4wAEq9VU0cCSdxyAkicTk0eBSTbywog2xo1fQSQPF5eAGna/nGTA5J1nQAkzkPNHwUk95cYQJq3fvwEgeSrVgAS758ujgSSf5cZQLqwfdokgeRTLwBJ8043RwPJn6UGkG4snz5RIAGQdNd0dkbvkJBBOjO8ZLo9QwIgEsd0eE6vkABIh2aXTrlHSABE6pZOz+sNEgDp1Oh7pt0TJACyxykdn9sLJADSscn3Tr0HSABkr0s6P791SACkc4PnmH7LkABIDodwjadWIQEQzJ1NgRYhAZBs9uBCQYHWIAEQfJ1dgZYgAZDs9uCCLWUSAMHPagq0kEkARM0eXLiFTAIg+FhdAc+ZBEDU7cEAOTOJ9ftiAAT/mimQI5MMw3D+9evXs1XQAGKlNONcFdgLCYD8ayReoNMgWHshOZ1OZhu72UBhnXnDVINuF05pDyQA8ik6GURoQA+nSSEBEADx4O8sMUpeDQ4gAJLFfB4uAiCLVaIH8WBZ2xgBBEBsHedsNAABEGeWtQ0XQADE1nHORgMQAHFmWdtwAQRAbB3nbDQAARBnlrUNF0AAxNZxzkYDEABxZlnbcAEEQGwd52w0AAEQZ5a1DRdAAMTWcc5GAxAAcWZZ23ABBEBsHedsNACpHJDwpZ1xHN9CmOM4/g5/Hw6H8/F4PDvz2q5wgw6TBm/jOIb/fg//fzqdfu668MbJAFIpIBHfZuvm24xbJtX8qZ2tse/xxRemPlVRMWkEHHMEKuNr7sip1441qBYkseMv5wUgyoC8vr5+TGXEpp+0jLE5sNEBsV9i0/q5HQCpsMSKNcXUjzy32o+kmlNjs0iNYeqLzH6Nx2ygMLEUY05cZS9xal8Qo8RxHSYlk2ptFrWvB4BEOFJj54wYVv0QNqxtibsDJKFB/6tei4BIdAi3fnPf9iWDVNaDSIyh1aBu7196R0iMCSB663G9cg0pXRIHgPwxhsbtVQmoGnGsWb+7EkvSnGqZQ3k/enh5wWYFINoLJliU7DWvFJDW+pBa1oIMUlkPEsKR9CEtASIxpUb/MZW74bNe18/Cxf6hxPpUSiWDSABpqQ+RAKK1QUhiARBlQHpv1FMfEGr2YABSYYkl7UMsd67YckNyXGr/oZk9AaRSQCQLo1VmzBKF0k/7c1+S8lKr/6AHudneUncuzYWpxSg3X9i6fmkp7Njhy1u5n1pLDam5DpKNyjKTd/kcZOY2FViNUmMrhtxZS2LI3DEs901JPABi0KTX0IfENMu5oYwZ87av0TQkgFTag0gBybWbphgjJyRbGesWjpxj37uhkKLDfL4msF/mL7kLIj0ndXE0a98wB0kfkgMQiSlyjCuZr/YaSLQAEKMSS2KYHDuqxBSlxgUQaToQnFdbBinxwFACxyz13iwiGVt7t64xpqW1u76LJe1D9phGYoh5wfZmEcEGpfIJXu5irWQXwQKpfBZrGZ7kro50J98DR44sUqP+Ek32bFCphU/3GUTSh5QERJpFJEbU7j+kDy4BxKhJl97JkphUaNC7G54EUMn4knFSd2hJXABiCIhVoy4xwprZJIBKSkkLI0p0sYjrb9+XSvye42usgS0adYkJtnRO3d1TtZdAuBXzvX+XaAMg9hkk+VttKQaVmGDLbCkGlvRZFv0HPcjNKqfuYlaLpGkgDThS72gJY1C/gwggTgDR7EOE5txKINd/j80ikhhSMmRUsOu3/pOzNyWWcYml1YdIjJlqthgj19qgk0EcZRCJibbMaQFITBZJLW1jrpkK8trxEo3IIAUyiKQPeQSIZOGlpnsUh2ReVr0fGcRRBpEY6dFOawmIQhwmDTqAOAIkZ6O+A473YRi+xb79ainvWhaRxGJZwtQeX/efxVqaTNKH3DOTZNGnON7DG3Yvl8tHarm1lkVS+48wLoB8qg8gCydKALnduffAMf+KiSSOMI17WUQAiFl5RYnlrMSS9CEagEjiuPdcRAgrgCx8SwZZiCEx5rK0ERoyRPDFlDmyiCSerVvXqaXf1vGSGC1LQADZmeW0AJHAeptFJJBZmo8Sa6f5LO/Hz6FKTSXZCefGfO0XFCWxLHuR1P7D8gHhrLdEN0uIySBfIU7+bFAoSy6XS/jZ0KT3XGwBsieLDMPwLrgbZtp/kEEcZhCpKbdq7ZV/3zSkNItMv+97/a3fhD+b8SRcK+pQMshCptSUX6LEmna1MWp19x+0aUhLYK0bdDKIwwwSQpbu2om8bMKxpy9KjOV6uGVtTw9yZ4W8ZJDaALHIIiUadDKI0wxiYMjo7GGYRZJjkmSp23PoQRz2IDUCUmNMAJJDAYeAKDfq4p1as/Qr0X9QYjktsZQbdTEgmlkEQO5nAx4UrmRJpd1aDIdyL7I7LmmxQQ/itMRS2q13G7HWuABEqgCAzArshkMri5R4QMhzEMfPQRaLl/OJejZAcmeRUv0HTbrjJj1zo54NjtxZpNQDQjJIGxkk+ZO9K5VodkAyZpHssaVU4zTpTnuQEHYmE6oZMNOdNrX4YkABEMeAZHpgqGbAHACXbNDpQZz3IBn6EDU4cvUiJRt0AAEQdUD2ZJHSDTqANADIDgOqw5Ehi5jFuNaP0IM470E8AOIhRgCJuGXh5QtTt1PxELfkjlbp/oMSq4ESS9iom5cugixiHuO9PZQSy3mJJXgeUsx4iWYrFucSlMSYr6daZj4+7h5RGsaWAjXcFYostaqAI1bX2yUCkE9FqlnIrcWsAY7Iu1puNF3buwCkUkAW5db38KKbOczwK4bH4/EcmYxMDptKl/Am3Guc4zj+Du8eqTTOpF+kBJCKATFxd0eD0IM00KR35FfzqQIIgJibztOAAAIgnvxqHiuAAIi56TwNCCAA4smv5rECCICYm87TgAACIJ78ah4rgACIuek8DQggAOLJr+axAgiAmJvO04AAAiCe/GoeK4AAiLnpPA0IIADiya/msQIIgJibztOAAAIgnvxqHiuAAIi56TwNCCAA4smv5rECCICYm87TgAACIJ78ah4rgACIuek8DQggAOLJr+axAgiAmJvO04AAAiCe/GoeK4AAiLnpPA0IIADiya/msQIIgJibztOAALJYrchfHv97Rk0/CO3JdJ5iTQXE2hOmrz9IBWRa6Kp+jdyT+WqPVfDSnzAlUz+YAiIUpPZ1Jj5bBQDEVm9G86TA4XB4tnyFg2kGCQsheCGmp/UjVmUFLN8NEqZiDoiwD1GWnct7UMC6QS8CCH2IBytWG6Np/1EEkDAoWaRaA1YbWInsUQwQski1Pqw2MOveYxbCvAeZBwaSar1YY2DmpVVxQKY7Wj//fwFr0htOa1w9YlJVoBgcxUqspZxkElVzub146DlqeL12sRLrduVSP5PjduUJfFOBUg35vcCqAWRRcj0Nw/BtHMfvm0pyQDMKBCjGcfx9OBzOlk/KtwSsCpB7wU6ZZWse/LtDBQIMIeyagLiVsXpAHK47ITekAIA0tJhMJb8CAJJfU67YkAIA0tBiMpX8CgBIfk25YkMKAEhDi8lU8isAIPk15YoNKQAgDS0mU8mvAIDk15QrNqQAgDS0mEwlvwL/AfRjWW6yHrZ9AAAAAElFTkSuQmCC",oy={xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.12",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",png:"image/png",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",mp3:"audio/mpeg",aac:"audio/aac",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",htm:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jsonld:"application/ld+json",mid:"audio/midi audio/x-midi",midi:"audio/midi audio/x-midi",mjs:"text/javascript",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",otf:"font/otf",rar:"application/x-rar-compressed",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"text/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip"},ef=()=>{function i(a,c){try{const u=decodeURI(a.headers["content-disposition"]);let h=c||u.split("filename*=utf-8")[1];const f=h.substring(h.lastIndexOf(".")+1),d=new Blob([a.data],{type:oy[f]??"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),O=(window.URL||window.webkitURL).createObjectURL(d),w=document.createElement("a");w.setAttribute("href",O);const g=h.lastIndexOf(".");h=`${h.slice(0,g)}_${Ve.dayjs().format("YYYYMMDD")+h.slice(g)}`,w.setAttribute("download",h),document.body.appendChild(w),w.click(),document.body.removeChild(w),window.URL.revokeObjectURL(O)}catch(u){console.error(u)}}function e({multiple:a=!1,acceptTypes:c=""},u){const h=document.createElement("input");h.style.display="none",h.setAttribute("type","file"),a&&h.setAttribute("multiple",a);const f="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xml";h.setAttribute("accept",c||f),document.body.appendChild(h),h.click(),h.addEventListener("change",d=>{u(d)&&document.body.removeChild(h)})}function t(a){return a?a.substring(a.lastIndexOf("/")+1):""}function n(a){return a?new URL(Object.assign({"../static/images/upload-excel.png":iy,"../static/images/upload-file.png":ny,"../static/images/upload-pdf.png":sy,"../static/images/upload-word.png":ry})[`../static/${a}`],self.location).href:""}function s(a,c,u){if(!c)return;let h=u||t(c);const f=h.lastIndexOf(".");h=`${h.slice(0,f)}_${Date.now()+h.slice(f)}`;const d=h.includes(".")?h.split(".").pop().toLowerCase():"";a({url:c,method:"GET",responseType:"blob"}).then(m=>{let O=m.data;if(O.type==="application/json"&&d!=="json"){const w=new FileReader;w.readAsText(O,"utf-8"),w.onload=function(){try{const g=JSON.parse(w.result);if(g.code&&g.code!==200&&g.code!==0){Ve.ElNotification.error({title:"错误",message:g.msg||"下载失败"});return}}catch(g){console.error("解析 JSON 失败:",g)}r(O,h)};return}r(O,h)})}function r(a,c){const u=URL.createObjectURL(a),h=document.createElement("a");h.style.display="none",h.href=u,h.download=c,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>{window.URL.revokeObjectURL(u)},1e3)}function o(a){if(!a)return;const c=document.createElement("input");c.value=a,document.body.appendChild(c),c.select(),document.execCommand("Copy"),c.remove(),Ve.ElNotification({title:"提示",message:"复制成功",type:"success",duration:2e3})}return{exportFile:i,importFile:e,getAssetsFileName:t,getAssetsFilePath:n,downloadBlob:r,downloadFile:s,copy:o}},tf={label:"name",value:"code",children:"children"},nf={label:"key",value:"value"},Cr={label:"name",value:"code",children:"children"},ly={year:"year",month:"month",date:"day"};/*! Element Plus Icons Vue v2.3.2 */var ay=l.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),cy=ay,uy=l.defineComponent({name:"Delete",__name:"delete",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),hy=uy,fy=l.defineComponent({name:"Download",__name:"download",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),dy=fy,py=l.defineComponent({name:"MoreFilled",__name:"more-filled",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"})]))}}),my=py,gy=l.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),Oy=gy;const MQ="",ct=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},_y={class:"a-loading"},Ar=ct({__name:"index",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("div",_y,[...t[0]||(t[0]=[l.createElementVNode("span",{class:"dot dot-spin"},[l.createElementVNode("i"),l.createElementVNode("i"),l.createElementVNode("i"),l.createElementVNode("i")],-1)])]))}},[["__scopeId","data-v-048c6c03"]]),BQ="",by={key:0,class:"table-link"},yy=["onClick"],wy={class:"no-image"},ky={key:4},sf=ct({__name:"index",props:{pageKey:{type:String,default:""},menuId:{type:String,default:""},defaultParams:{type:Array,default:()=>[]},matchData:{type:Object,default:()=>({})},maxHeight:{type:[String,Number],default:-1},tableConfig:{type:Object,default:()=>({})}},emits:["changeSelection","onClickRow","changeExpansionRow","refresh","load","operate"],setup(i,{expose:e,emit:t}){const n=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>i1),loadingComponent:Ar,delay:20}),s=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>s1),loadingComponent:Ar,delay:20}),r=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>o1),loadingComponent:Ar,delay:20}),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>c1)),a=l.defineAsyncComponent(()=>Promise.resolve().then(()=>f1)),{t:c}=Kt(),u=l.inject("actModules"),h=l.inject("apiPrefix"),f=l.inject("request"),d=l.inject("themeColor"),m=l.inject("cacheTokenType"),O=l.inject("cookieStorage"),w=l.inject("menuAuthButtons"),g=on.useRoute(),p=on.useRouter(),b=t,k=i,y=()=>({pageLoading:!1,tableLoading:!1,tableTotal:0,tableSelection:[],tableQuery:{pageIndex:1,pageSize:10},showFormDialog:!1,showEditorPreDialog:!1,dialogTitle:"",editorDialogTitle:"",dialogData:{}});let C=l.reactive(y()),T=l.ref("loading"),x=l.ref([]),A={},R=[],_=l.ref([]),S=l.ref([]),P=l.ref([]),Q=l.ref([]),E=l.ref([]),W=l.ref({});const B=l.ref(null),I=l.ref(null),G=l.ref(null),Z=l.ref(null),H=l.ref(0);let j=l.ref({});const z=$=>f({url:`${h}/sysOperate/getMenuOfOperateByRole`,method:"post",data:$}),me=$=>f({url:`${h}/pages/getPageDetail?key=${$}`,method:"get"}),de=()=>{C=l.reactive(y()),T.value="loading",x.value=[],A={},R=[],_.value=[],S.value=[],P.value=[],Q.value=[],E.value=[],j.value={}},ae=()=>{l.nextTick(()=>{setTimeout(()=>{var ue,he,le,ee,K,Oe,_e;const $=((he=(ue=B.value)==null?void 0:ue.$el)==null?void 0:he.offsetHeight)||0,F=((ee=(le=I.value)==null?void 0:le.$el)==null?void 0:ee.offsetHeight)||0,oe=((Oe=(K=G.value)==null?void 0:K.$el)==null?void 0:Oe.offsetHeight)||0,ge=$-F-oe-6;H.value=k.maxHeight>0?k.maxHeight:(_e=A==null?void 0:A.tableConfig)!=null&&_e.isPagination?ge-48:ge},500)})},v=()=>[..._u(R)],N=$=>{Z.value.updateSelection($)},q=()=>{Z.value.clearSelection()},J=()=>C.tableSelection,Ce=async()=>{await ni(R),b("refresh")},xi=$=>{if(!$||!$.tableQueryDefaultValue)return;const oe=zt($)["value-format"]||"YYYY-MM-DD HH:mm:ss";if($.fieldType=="date"&&$.tableQueryDefaultValue=="nowYear")return Ve.dayjs().format(oe);if($.fieldType=="date"&&$.tableQueryDefaultValue=="yearAgo")return Ve.dayjs().subtract(1,"year").format(oe);if($.fieldType=="dateRange"&&$.tableQueryDefaultValue.includes("&")){const ge=$.tableQueryDefaultValue.split("&");return[Ve.dayjs(ge[0]).subtract(6,"month").format(oe),Ve.dayjs(ge[1]).format(oe)]}if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="yearAgo")return[Ve.dayjs().subtract(1,"year").format(oe),Ve.dayjs().format(oe)];if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="sixMonthsAgo")return[Ve.dayjs().subtract(6,"month").format(oe),Ve.dayjs().format(oe)]},Bi=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const ge=(F.row[$.fieldKey]??"").split(";"),ue=ge&&ge.length?ge[0]:"",he=ue.substring(ue.lastIndexOf(".")+1);return/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/.test(he)},Re=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const ge=(F.row[$.fieldKey]??"").split(";");return ge&&ge.length?ge[0]:""},Ge=($,F)=>{if(!(F.row&&Object.keys(F.row).length))return;const oe=F.row[$.fieldKey]??null;return oe?oe.split(";"):[]},Ct=$=>$==="true",zt=$=>new Function("",$.fieldUiProps)()||{},Si=async($,F)=>Reflect.has(u,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent(u[`/src/views${$}.vue`])):null,V=async($,F)=>Reflect.has(u,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent({loader:u[`/src/views${$}.vue`],loadingComponent:Ar,delay:20})):null,D=async()=>{A.buttons=await Promise.all(A.buttons.map(async $=>{if($.isCustomBtn&&$.customType=="component"){const{customComponentUrl:F,customComponentName:oe}=$,ge=await Si(F);$[oe]=ge}return $}))},L=async()=>{const $=A.fields.filter(F=>(F.formCustomComponentes??[]).some(oe=>oe.permissionCode=="tableShow"&&oe.isFieldCustom));E.value=await Promise.all($.map(async F=>{const oe=F.formCustomComponentes.find(le=>le.permissionCode=="tableShow"),{customComponentUrl:ge,customComponentName:ue}=oe,he=await Si(ge);return F.customTableHeaderName=ue,F.customTableHeaderUrl=ge,F[`customTableHeaderInstance_${ue}`]=he,F.headerItem={label:F.fieldName,prop:F.fieldKey,align:F.tableCellAlignType,width:F.tableCellWidthType=="default"?F.tableCellWidth:"",minWidth:F.tableCellWidthType=="min"?F.tableCellWidth:"",showOverflowTooltip:F.isTableCellOverflowTooltip||!1,sort:F.isTableCellSort||!1},F}))},ne=($,F)=>{switch($){case"array":return typeof F=="string"?F.toString().split().sort((oe,ge)=>oe.sort-ge.sort):[F];case"number":return Number(F);case"boolean":return Ct(F);default:return F}},fe=($,F)=>F[$.fieldKey]?F[$.fieldKey].toString().includes("T")?Ve.dayjs(F[$.fieldKey]).format("YYYY-MM-DD HH:mm:ss"):F[$.fieldKey]:"";function Le($,F={}){return $.replace(/\{([^}]+)\}/g,(oe,ge)=>{const ue=ge.trim().split(".");let he=F;for(const le of ue){if(!he||typeof he!="object")break;he=he[le]}return he!==void 0?he:oe})}const Ae=$=>$?Le($,k.matchData):"",U=($,F,oe)=>{switch($){case"LessThanOrEqual":return F<=oe;case"LessThan":return F<oe;case"GreaterThanOrEqual":return F>=oe;case"GreaterThan":return F>oe;case"NotEqual":return F!=oe;case"Equal":return F==oe;default:return F==oe}},Y=($,F)=>{if(!$.matchFields.length)return!0;const oe=le=>le.matchType=="default"?F[le.matchFieldName]:k.matchData[le.matchType][le.matchFieldName];let ue=$.matchFields.reduce((le,ee,K)=>{const Oe=oe(ee),_e=U(ee.matchCondition,Oe,ee.fieldValue==""?null:ee.fieldValue=="true"||ee.fieldValue=="false"?Ct(ee.fieldValue):ee.fieldValue);return le+=_e,K!==$.matchFields.length-1&&(le+=ee.spliceCondition||"&&"),le},"").split("||"),he=ue.reduce((le,ee,K)=>(le+=`(${ee})`,K<ue.length-1&&(le+="||"),le),"");return new Function(`return ${he}`)()},Ee=($,F)=>Object.keys(F).length?x.value.some(oe=>oe.unique==$.permissionCode)&&Y($,F):!1,qe=async $=>{try{C.pageLoading=!0;const F=k.pageKey??g.params.key,{data:{pageConfigs:oe}}=await me(F);return A=oe.pageConfig?JSON.parse(oe.pageConfig):{},C.tableQuery.pageSize=A.tableConfig.pageSize||10,C.pageLoading=!1,Promise.resolve(Object.keys(A).length)}catch(F){C.pageLoading=!1,console.error(F)}},Ci=async($=[],F={},oe=!0,ge=!1)=>{try{const ue=$.filter(ee=>["select","multipleSelect","selectIcon","switch","virtualizedSelect","virtualizedMultipleSelect","fullLoadTreeSelect","provinceCascade"].includes(ee.fieldType)&&(!Reflect.has(ee,"dataList")||!ee.dataList.length||ge)),le=(await Promise.allSettled(ue.map(async ee=>{const K=ee.postRequestParams.filter(lt=>lt.submitType==="default").reduce((lt,si)=>(lt[si.submitName]=ne(si.paramsType,si.submitValue),lt),{}),Oe=ee.postRequestParams.filter(lt=>lt.submitType==="match").reduce((lt,si)=>(lt[si.submitName]=ne(si.paramsType,F[si.submitValue][si.submitName]),lt),{}),_e=ee.postRequestParams.filter(lt=>lt.submitType==="dynamic").map(lt=>({field:lt.submitName,operate:lt.submitMatchType,value:ne(lt.paramsType,lt.submitValue)}));let Ke={};Object.keys(K).length&&(Ke={...Ke,...K}),Object.keys(Oe).length&&(Ke={...Ke,...Oe}),_e.length&&(Ke.dynamicFilters=_e);const{data:Ai}=await f({url:ee.fieldRequestUrl,method:ee.fieldRequestType||"GET",data:Ke});return Promise.resolve({...ee,dataList:Ai||[]})}))).filter(ee=>ee.status==="fulfilled"&&Reflect.has(ee,"value")).map(ee=>ee.value);return oe&&A.fields.forEach(ee=>{const K=le.find(Oe=>ee.fieldName==Oe.fieldName&&ee.fieldKey==Oe.fieldKey);K&&(ee.dataList=(K==null?void 0:K.dataList)??[])}),le}catch(ue){console.error(ue)}},sn=l.computed(()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return!$||$>=S.value.length}),rn=()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return sn.value?S.value:S.value.slice(0,$)},vi=()=>{var F;const{tableConfig:{tableMoreBtnSplitNumber:$}}=A;return sn.value?[]:S.value.slice($,(F=S.value)==null?void 0:F.length)},Ou=async $=>{try{const F=($||[]).filter(he=>he.useScenes.some(le=>["tableShow"].includes(le))).sort((he,le)=>he.sort-le.sort),oe=["editor","upload","date"];let ge=F.map(he=>{const le=he.formCustomComponentes.some(ee=>ee.permissionCode=="tableShow"&&ee.isFieldCustom);return{label:he.fieldName,prop:he.fieldKey,align:he.tableCellAlignType,width:he.tableCellWidthType=="default"?he.tableCellWidth:"",minWidth:he.tableCellWidthType=="min"?he.tableCellWidth:"",showOverflowTooltip:he.isTableCellOverflowTooltip||!1,sort:he.isTableCellSort||!1,render:!!he.fieldRequestUrl||he.tableCellContentType=="link"||oe.includes(he.fieldType),isCustomTableHeader:le}});A.tableConfig.isSerialNumber&&ge.unshift({prop:"serialNumber",width:80}),A.tableConfig.isCheckRow&&ge.unshift({prop:"checkbox",width:50});const ue=S.value.filter(he=>x.value.some(le=>le.unique==he.permissionCode));A.tableConfig.isOperateRow&&ue.length&&ge.push({label:c("act.operate"),prop:"operate",width:A.tableConfig.tableOperateCellWidth,render:!0,fixed:"right"}),Q.value=F.filter(he=>!!he.fieldRequestUrl&&he.useScenes.includes("tableShow")||he.tableCellContentType=="link"||oe.includes(he.fieldType)),_.value=ge}catch(F){console.error(F)}},il=()=>{S.value=(A.buttons||[]).filter($=>$.permissionCode!==1001&&$.btnPostion.includes("table")).sort(($,F)=>$.sort-F.sort).map($=>($.loading=!1,$.btnAlias&&($.btnName=$.btnAlias),$))},h_=()=>A.fields.filter($=>$.useScenes.includes("tableSearch")).map($=>(["date","dateRange"].includes($.fieldType)?$.queryValue=$.tableQueryDefaultValue?$.tableQueryDefaultValue:xi($):$.queryValue=($==null?void 0:$.tableQueryDefaultValue)||void 0,k.defaultParams.some(F=>{F.field==$.fieldKey&&F.operate===$.tableQueryCondition&&($.queryValue=F.value)}),$)),_u=($,F="queryValue")=>$?($||[]).filter(ge=>!!ge[F]).reduce((ge,ue)=>{var le;const he=zt(ue);if(ue.fieldType==="date"&&he["value-format"]!=="YYYY"){const ee=he!=null&&he.dayJsType?ly[(le=ue.fieldUiProps)==null?void 0:le.dayJsType]:"day",K=he["value-format"]||"YYYY-MM-DD HH:mm:ss";ge=[...ge,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:Ve.dayjs(ue[F]).startOf(ee).format(K)},{field:ue.fieldKey,operate:"LessThanOrEqual",value:Ve.dayjs(ue[F]).endOf(ee).format(K)}]}else if(ue.fieldType==="dateRange"&&ue[F].length)if(ue.fieldKey.includes("&")){const ee=ue.fieldKey.split("&")||[];ge=[...ge,{field:ee[0],operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:ee[1],operate:"LessThanOrEqual",value:ue.queryValue[1]}]}else ge=[...ge,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:ue.fieldKey,operate:"LessThanOrEqual",value:ue.queryValue[1]}];else if(["provinceCascade"].includes(ue.fieldType)&&ue[F].length){const ee=(ue.fieldKey.split("&")||[]).map((K,Oe)=>({field:K,operate:"Equal",value:ue.queryValue[Oe]}));ge=[...ge,...ee]}else return Array.isArray(ue[F])&&!ue[F].length?[...ge]:[...ge,{field:ue.fieldKey,operate:ue.tableQueryCondition,value:ue.tableQueryCondition==="In"&&ue[F]&&typeof ue[F]=="string"?ue[F].split(";"):ue[F]=="true"||ue[F]=="false"?Ct(ue[F]):ue[F]}];return ge},[]):[],CQ=($,F)=>{if(!$.dataList||!Reflect.has(F,$.fieldKey))return"";const oe=F[$.fieldKey];if(!oe&&oe!==0&&oe!==!1)return"";const ge=zt($),ue=Object.assign({key:"key",value:"value"},ge.props||{});return["virtualizedSelect","virtualizedMultipleSelect"].includes($.fieldType)&&(ue.key=ue.label),["multipleSelect","select","switch","virtualizedSelect","virtualizedMultipleSelect","selectIcon"].includes($.fieldType)?($.dataList||[]).filter(he=>{const le=$.fieldType==="selectIcon"?`btn-${he[ue.value]}`:he[ue.value],ee=le=="true"||le=="false"?Ct(le):le;return Array.isArray(oe)?oe.some(K=>K==le==K):typeof oe=="string"?oe.split(";").includes(ee):oe==ee}).map(he=>he[ue.key]).join(";"):oe},ni=async($=[])=>{var F,oe,ge;try{if(!((F=A==null?void 0:A.tableConfig)!=null&&F.dataUrl))return;C.tableLoading=!0;const ue=k.defaultParams.filter(K=>!(A.fields??[]).some(Oe=>Oe.fieldKey===K.field&&Oe.tableQueryCondition===K.operate&&Oe.useScenes.includes("tableSearch"))),he=(((oe=A==null?void 0:A.tableConfig)==null?void 0:oe.defaultParams)??[]).map(K=>({field:K.submitFieldName,operate:K.matchValue,value:ne(K.submitFieldType,K.defaultValue)})),le=[...ue,...he,..._u($)];(ge=A==null?void 0:A.tableConfig)!=null&&ge.isPagination||(C.tableQuery.pageSize=9999);const{data:ee}=await f({url:A.tableConfig.dataUrl,method:"POST",data:{...C.tableQuery,dynamicFilters:le}});C.tableTotal=ee.totalCount||0,P.value=ee.datas||[],C.tableLoading=!1}catch(ue){C.tableLoading=!1,console.error(ue)}},f_=async()=>{try{T.value="loading";const $=k.pageKey;if(!await qe($)){T.value="end";return}await L(),await D(),await Ci(A.fields.filter(he=>he.useScenes.some(le=>["tableSearch","tableShow"].includes(le)))),T.value="success";let oe="";if(m==="sessionStorage")oe=sessionStorage.getItem("accessToken");else{const he=O.getPrefix();oe=O.getItemValue(`${he}accessToken`)}const ue=JSON.parse(ty.decode(oe.split(".")[1]))["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];if(w||k.menuId){const he=k.menuId;x.value=await w({roleId:ue,menuId:he})||[]}else x.value=(await z({roleId:ue,key:$})).data.datas||[];il(),Ou(A.fields),ae(),R=h_(),(!Reflect.has(A.tableConfig,"isExecuteImmediatelyTableApi")||A.tableConfig.isExecuteImmediatelyTableApi)&&await ni(R),b("load"),console.log(A)}catch($){console.error($),T.value="end"}};l.provide("globalProps",k),l.provide("loadComponents",Si),l.provide("defineAsyncLoadComponents",V),l.provide("stringToBoolean",Ct),l.provide("matchCondition",U),l.provide("menuPermissionBtns",x),l.provide("getTableData",ni),l.provide("refreshTable",Ce),l.provide("tableBtnRefs",W.value),l.provide("formatDataType",ne),l.provide("getFieldUiProps",zt),l.provide("disposeRequestData",Ci),l.provide("disposeDate",xi),l.provide("getDefaultQueryValues",h_),l.watch(()=>k.pageKey,($,F)=>{de(),f_()},{immediate:!0});const d_=async($,F)=>{R=$,await ni($),b("refresh"),F(!0)},AQ=$=>{b("operate",$),ni(R)},nl=($,F)=>{const{exportFile:oe,importFile:ge,downloadFile:ue}=ef();if($.isCustomBtn){if($.customType=="component"&&!Reflect.has($,[$.customComponentName])){Ve.ElNotification({title:"提示",message:`当前自定义按钮未创建vue文件,请在路径【/src/views${$.customComponentUrl}】下创建vue文件`,type:"warning",duration:2500});return}if($.customType=="code"){try{new Function("router","route","data","configItem","cookieStorage",$.codeStr)(p,g,F,$,O)}catch(ee){console.error(ee)}return}const le=`${$.customComponentName}-${$.permissionCode}`;W.value[le]&&W.value[le].onTigger({rowData:F,tableSelection:C.tableSelection});return}if($.submitWay=="associationSubTable"){Ve.ElNotification({title:c("act.tip"),message:c("act.developing"),type:"warning",duration:2500});return}if(["export","exportUrl"].includes($.submitWay)){$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0;let le=[...k.defaultParams,..._u(R)],ee=($.submitFields||[]).reduce((Oe,_e)=>{if(_e.matchType=="default")Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:ne(_e.submitFieldType,_e.matchFieldName)}];else if(_e.matchType=="match"){const Ke=_e.submitFieldMatchOrigin==="rowData"?F:k.matchData[_e.submitFieldMatchOrigin];Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:ne(_e.submitFieldType,Ke[_e.matchFieldName])}]}else if(_e.matchType=="selection"){const Ke=C.tableSelection.map(Ai=>Ai[_e.matchFieldName]);Oe=[...Oe,{field:_e.submitFieldName,operate:_e.submitFieldType==="array"?"In":"Equal",value:_e.submitFieldType==="string"?Ke.join():Ke}]}return Oe},[]);const K=[...le,...ee];f({url:Ae($.requestUrl),method:"post",data:{dynamicFilters:K},responseType:["exportUrl"].includes($.submitWay)?"json":"blob"}).then(Oe=>{$.submitWay=="exportUrl"?ue(f,Oe.data):oe(Oe),b("operate",$),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1}).catch(Oe=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1});return}if(["import","batchImport"].includes($.submitWay)){ge({multiple:$.submitWay=="batchImport",acceptTypes:$.importAccept||""},le=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0;const ee=new FormData;if(($.submitFields||[]).forEach(K=>{var Oe,_e;if(K.matchType=="default")ee.append(K.submitFieldName,ne(K.submitFieldType,K.matchFieldName));else if(K.matchType=="match")(Oe=Object.keys(F))!=null&&Oe.length&&ee.append(K.submitFieldName,ne(K.submitFieldType,F[K.matchFieldName]));else if(K.matchType=="query"){const Ke=((_e=R.find(Ai=>Ai.fieldKey==K.matchFieldName))==null?void 0:_e.queryValue)??null;ee.append(K.submitFieldName,ne(K.submitFieldType,Ke))}}),$.submitWay=="import")ee.append($.importFileName||"file",le.target.files[0]);else for(let K of le.target.files)ee.append($.importFileName||"files",K);return f({url:Ae($.requestUrl),method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:ee}).then(K=>{Ve.ElNotification({title:c("act.tip"),message:`${K.msg}`,type:"success",duration:2500}),b("operate",$),ni(R),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1}).catch(()=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1})});return}if($.submitWay==="executeApi"){let le=($.submitFields||[]).reduce((ee,K)=>{var Oe;if(K.matchType=="default")ee[K.submitFieldName]=ne(K.submitFieldType,K.matchFieldName);else if(K.matchType=="match"){const _e=K.submitFieldMatchOrigin==="rowData"?F:k.matchData[K.submitFieldMatchOrigin];ee[K.submitFieldName]=ne(K.submitFieldType,_e[K.matchFieldName])}else K.matchType=="query"&&(ee[K.submitFieldName]=((Oe=R.find(_e=>_e.fieldKey==K.matchFieldName))==null?void 0:Oe.queryValue)??null);return ee},{});if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}if($.btnPostion==="header"){const ee=($.submitFields||[]).filter(K=>K.matchType=="selection").reduce((K,Oe)=>(K[Oe.submitFieldName]=C.tableSelection.reduce((_e,Ke)=>(Oe.submitFieldType==="array"?_e=[..._e,...ne(Oe.submitFieldType,Ke[Oe.matchFieldName])]:_e=[..._e,ne(Oe.submitFieldType,Ke[Oe.matchFieldName])],_e),[]),K),{});Object.assign(le,ee)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0,f({url:Ae($.requestUrl),method:"post",data:le}).then(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1,Ve.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),b("operate",$),ni(R)}).catch(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1});return}if($.submitWay==="messageBox"){if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}Ve.ElMessageBox.confirm(`${c("act.isExecuteOperate")}?`,c("act.tip"),{confirmButtonText:c("act.enter"),cancelButtonText:c("act.cancel"),type:"warning"}).then(()=>{let le=($.submitFields||[]).reduce((ee,K)=>{var Oe;if(K.matchType=="default")ee[K.submitFieldName]=ne(K.submitFieldType,K.matchFieldName);else if(K.matchType=="match"){const _e=K.submitFieldMatchOrigin==="rowData"?F:k.matchData[K.submitFieldMatchOrigin];ee[K.submitFieldName]=ne(K.submitFieldType,_e[K.matchFieldName])}else K.matchType=="query"&&(ee[K.submitFieldName]=((Oe=R.find(_e=>_e.fieldKey==K.matchFieldName))==null?void 0:Oe.queryValue)??null);return ee},{});if($.btnPostion==="header"){const ee=($.submitFields||[]).filter(K=>K.matchType=="selection").reduce((K,Oe)=>(K[Oe.submitFieldName]=C.tableSelection.reduce((_e,Ke)=>(Oe.submitFieldType==="array"?_e=[..._e,...ne(Oe.submitFieldType,Ke[Oe.matchFieldName])]:_e=[..._e,ne(Oe.submitFieldType,Ke[Oe.matchFieldName])],_e),[]),K),{});Object.assign(le,ee)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:F[`loading${$.permissionCode}`]=!0,f({url:Ae($.requestUrl),method:"post",data:le}).then(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1,Ve.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),b("operate",$),ni(R)}).catch(ee=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:F[`loading${$.permissionCode}`]=!1})}).catch(le=>{});return}if($.btnPostion==="header"&&$.submitWay==="dialog"&&($.submitFields||[]).some(le=>le.submitFieldMatchOrigin==="selections")&&!C.tableSelection.length){if(!A.tableConfig.isCheckRow){Ve.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!C.tableSelection.length){Ve.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}return}let he=(A.fields||[]).filter(le=>le.useScenes.includes($.permissionCode)).map(le=>(le.customFiledsComponentes=le.formCustomComponentes.find(ee=>ee.permissionCode==$.permissionCode)||{},le));if(!he.length){Ve.ElNotification({title:c("act.tip"),message:c("act.buttonBindField"),type:"warning",duration:2500});return}if($.submitWay==="dialog"){C.dialogTitle=$.btnName,C.dialogData={dataItem:{...$},rowData:{...F},selections:C.tableSelection||[],formConfig:A.formConfig,formList:he},C.showFormDialog=!0;return}},TQ=($,F,oe)=>{b("onClickRow",$,F,oe)},PQ=($,F)=>{j.value=$,b("changeExpansionRow",$,F)},QQ=$=>{b("changeSelection",$)},EQ=($,F)=>{C.editorDialogTitle=`${c("act.preview")}${$.fieldName}`,C.dialogData={...F,editorContent:F[$.fieldKey]},C.showEditorPreDialog=!0};return e({loadData:f_,getDynamicFiltersData:v,getTableData:ni,refreshTable:Ce,getTableSelection:J,setTableSelection:N,clearSelection:q}),($,F)=>{const oe=l.resolveComponent("el-table-column"),ge=l.resolveComponent("el-image"),ue=l.resolveComponent("el-link"),he=l.resolveComponent("a-svg-icon"),le=l.resolveComponent("el-button"),ee=l.resolveComponent("el-dropdown-item"),K=l.resolveComponent("el-dropdown-menu"),Oe=l.resolveComponent("el-dropdown"),_e=l.resolveComponent("el-empty"),Ke=l.resolveComponent("el-card"),Ai=l.resolveDirective("debounce"),lt=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createBlock(Ke,{class:"act-module",ref_key:"actModuleRef",ref:B,shadow:"never"},{default:l.withCtx(()=>{var si,p_;return[l.unref(T)==="success"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(n),{ref_key:"queryModuleRef",ref:I,data:l.unref(A),onReset:d_,onSearch:d_},null,8,["data"]),l.createVNode(l.unref(s),{ref_key:"headerButtonsModuleRef",ref:G,data:l.unref(A),onOnOperate:nl},null,8,["data"]),l.createVNode(l.unref(r),{ref_key:"aTableRef",ref:Z,loading:l.unref(C).tableLoading,total:l.unref(C).tableTotal,tableQuery:l.unref(C).tableQuery,"onUpdate:tableQuery":F[0]||(F[0]=ye=>l.unref(C).tableQuery=ye),selection:l.unref(C).tableSelection,"onUpdate:selection":F[1]||(F[1]=ye=>l.unref(C).tableSelection=ye),headers:l.unref(_),data:l.unref(P),showPagination:(p_=(si=l.unref(A))==null?void 0:si.tableConfig)==null?void 0:p_.isPagination,tableConfig:k.tableConfig,maxHeight:H.value,onRefresh:Ce,onOnRowClick:TQ,onChangeExpand:PQ,onChangeSelection:QQ},l.createSlots({operate:l.withCtx(({scope:ye})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(rn(),(be,ri)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ri},[Ee(be,ye.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[be.isCustomBtn&&be.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(be[be.customComponentName]),{key:0,ref_for:!0,ref:Tn=>l.unref(W)[`${be.customComponentName}-${be.permissionCode}`]=Tn,buttonData:be,scope:ye,onRefresh:ni,onRefreshTable:Ce},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(le,{class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`],onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading","onClick"])),[[Ai]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(le,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`],onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading","onClick"])),[[Ai]])],64)):l.createCommentVNode("",!0)],64))),128)),sn.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Oe,{key:0,class:"table-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(K,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(vi(),(be,ri)=>(l.openBlock(),l.createBlock(ee,{key:ri,onClick:Tn=>nl(be,ye.row)},{default:l.withCtx(()=>[Ee(be,ye.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[be.isCustomBtn&&be.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(be[be.customComponentName]),{key:0,ref_for:!0,ref:Tn=>l.unref(W)[`${be.customComponentName}-${be.permissionCode}`]=Tn,buttonData:be,scope:ye,onRefresh:ni},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(le,{class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`]},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading"])),[[Ai]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(le,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:ye.row[`loading${be.permissionCode}`]},{default:l.withCtx(()=>[be.btnIcon&&!ye.row[`loading${be.permissionCode}`]?(l.openBlock(),l.createBlock(he,{key:0,class:"mr2",name:be.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(ye.row[`loading${be.permissionCode}`]?be.btnName+l.unref(c)("act.loading")+"...":be.btnName),1)]),_:2},1032,["loading"])),[[Ai]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(le,{class:"table-btn-more",icon:l.unref(my),size:"small",circle:""},null,8,["icon"])]),_:2},1024))]),_:2},[l.renderList(l.unref(E),(ye,be)=>({name:ye.fieldKey,fn:l.withCtx(()=>[ye[`customTableHeaderInstance_${ye.customTableHeaderName}`]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ye[`customTableHeaderInstance_${ye.customTableHeaderName}`]),{key:0,data:ye,configData:l.unref(A),rowData:l.unref(j)},null,8,["data","configData","rowData"])):(l.openBlock(),l.createBlock(oe,{key:1,label:ye.fieldName+l.unref(c)("act.customTableHeader"),width:"260"},null,8,["label"]))])})),l.renderList(l.unref(Q),(ye,be)=>({name:ye.fieldKey,fn:l.withCtx(({scope:ri})=>[ye.tableCellContentType=="link"?(l.openBlock(),l.createElementBlock("span",by,l.toDisplayString(ri.row[ye.fieldKey]),1)):ye.fieldType=="editor"?(l.openBlock(),l.createElementBlock("span",{key:1,class:"table-link",onClick:Tn=>EQ(ye,ri.row)},"点击预览",8,yy)):ye.fieldType=="upload"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[Bi(ye,ri)?(l.openBlock(),l.createBlock(ge,{key:0,class:"file-image",fit:"cover","preview-src-list":Ge(ye,ri),"preview-teleported":"",src:Re(ye,ri)},{error:l.withCtx(()=>[l.createElementVNode("div",wy,l.toDisplayString(ye("act.noImage")),1)]),_:2},1032,["preview-src-list","src"])):(l.openBlock(),l.createBlock(ue,{key:1,type:"primary"}))],64)):ye.fieldType=="date"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:3},[l.createTextVNode(l.toDisplayString(fe(ye,ri.row)),1)],64)):(l.openBlock(),l.createElementBlock("span",ky,l.toDisplayString(CQ(ye,ri.row)),1))])}))]),1032,["loading","total","tableQuery","selection","headers","data","showPagination","tableConfig","maxHeight"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(o),{visible:l.unref(C).showFormDialog,"onUpdate:visible":F[2]||(F[2]=ye=>l.unref(C).showFormDialog=ye),title:l.unref(C).dialogTitle,data:l.unref(C).dialogData,onRefresh:AQ},null,8,["visible","title","data"]),l.createVNode(l.unref(a),{visible:l.unref(C).showEditorPreDialog,"onUpdate:visible":F[3]||(F[3]=ye=>l.unref(C).showEditorPreDialog=ye),title:l.unref(C).editorDialogTitle,data:l.unref(C).dialogData},null,8,["visible","title","data"]),l.unref(T)==="end"?(l.openBlock(),l.createBlock(_e,{key:1,description:l.unref(c)("act.noConfigPage")},{image:l.withCtx(()=>[l.createVNode(he,{name:"config-nodata",width:"200",height:"200"})]),_:1},8,["description"])):l.createCommentVNode("",!0)]}),_:1})),[[lt,l.unref(C).pageLoading]])}}},[["__scopeId","data-v-226b21a1"]]),xy=[{key:"按钮形式",value:"default"},{key:"文字形式",value:"text"}],Sy=[{key:"顶部",value:"header"},{key:"表格",value:"table"}],Cy=[{key:"主题色",value:"primary"},{key:"绿色",value:"success"},{key:"灰色",value:"info"},{key:"橙黄色",value:"warning"},{key:"红色",value:"danger"},{key:"浅蓝",value:"primary-light"}],Ay=[{key:"模态框",value:"dialog"},{key:"提示框",value:"messageBox"},{key:"导入",value:"import"},{key:"多文件导入",value:"batchImport"},{key:"导出(流)",value:"export"},{key:"导出(url)",value:"exportUrl"},{key:"直接执行接口",value:"executeApi"},{key:"关联子表",value:"associationSubTable"}],Ty=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Py=[{key:"且",value:"&&"},{key:"或",value:"||"}],Qy=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"选择列",value:"selection"},{key:"查询条件",value:"query"}],Ey=[{key:"默认匹配",value:"default"},{key:"用户信息变量",value:"userInfo"}],$y=[{key:"组件",value:"component"},{key:"代码",value:"code"}],Ny=[{key:"GET",value:"GET"},{key:"POST",value:"POST"}],rf=[{key:"隐式",value:"implicit"},{key:"输入框",value:"input"},{key:"数字输入框",value:"inputNumber"},{key:"textarea文本框",value:"textarea"},{key:"下拉单选框",value:"select"},{key:"虚拟下拉框",value:"virtualizedSelect"},{key:"下拉多选框",value:"multipleSelect"},{key:"虚拟下拉多选框",value:"virtualizedMultipleSelect"},{key:"树形下拉框",value:"fullLoadTreeSelect"},{key:"树形下拉框(懒加载)",value:"treeSelect"},{key:"级联下拉框",value:"provinceCascade"},{key:"时间框",value:"date"},{key:"时间范围框",value:"dateRange"},{key:"上传",value:"upload"},{key:"富文本",value:"editor"},{key:"switch开关",value:"switch"},{key:"下拉选择图标",value:"selectIcon"}],Ry=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"dynamic",value:"dynamic"}],Vy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"}],Ly=[{key:"居中",value:"center"},{key:"左对齐",value:"left"},{key:"右对齐",value:"right"}],My=[{key:"默认",value:"default"},{key:"链接",value:"link"},{key:"标签",value:"tag"}],Dy=[{key:"默认宽",value:"default"},{key:"最小宽",value:"min"}],of=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],By=[{key:"左侧",value:"right"},{key:"上侧",value:"top"}],vy=[{key:"是",value:"1"},{key:"否",value:"0"}],lf=[{label:"表格配置",options:[{key:"表格查询",value:"tableSearch"},{key:"表格展示",value:"tableShow"}]},{label:"表单配置",options:[]}],Iy={__name:"configForm",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=i,s=()=>({formRow:1,dialogWidth:800,formLabelWidth:120,formLabelPosition:"top"});let r=l.ref(null),o=l.ref(s());return l.watch(()=>n.modelValue,(a,c)=>{a&&(o.value=Object.assign(o.value,{...a}))},{deep:!0,immediate:!0}),e({formRef:r,form:o}),(a,c)=>{const u=l.resolveComponent("el-input-number"),h=l.resolveComponent("el-form-item"),f=l.resolveComponent("el-col"),d=l.resolveComponent("el-option"),m=l.resolveComponent("el-select"),O=l.resolveComponent("el-row"),w=l.resolveComponent("el-form"),g=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(g,{class:"form-card",shadow:"hover",header:"表单配置"},{default:l.withCtx(()=>[l.createVNode(w,{ref_key:"formRef",ref:r,model:l.unref(o),"label-suffix":":","label-width":"110px"},{default:l.withCtx(()=>[l.createVNode(O,null,{default:l.withCtx(()=>[l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"弹窗宽度"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).dialogWidth,"onUpdate:modelValue":c[0]||(c[0]=p=>l.unref(o).dialogWidth=p),min:800},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"排版列数"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).formRow,"onUpdate:modelValue":c[1]||(c[1]=p=>l.unref(o).formRow=p),min:1,max:4},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"label宽度"},{default:l.withCtx(()=>[l.createVNode(u,{modelValue:l.unref(o).formLabelWidth,"onUpdate:modelValue":c[2]||(c[2]=p=>l.unref(o).formLabelWidth=p),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(h,{label:"label位置",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"formLabelPosition"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:l.unref(o).formLabelPosition,"onUpdate:modelValue":c[3]||(c[3]=p=>l.unref(o).formLabelPosition=p),placeholder:"请选择"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(By),(p,b)=>(l.openBlock(),l.createBlock(d,{key:b+"labelPosition",label:p.key,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},IQ="",Zy=ct({__name:"configTable",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=i,s=()=>({dataUrl:void 0,defaultParams:[],isCheckRow:!1,isOperateRow:!0,isPagination:!0,isSerialNumber:!0,isSort:!0,isExpandQuery:!1,isExecuteImmediatelyTableApi:!0,tableOperateCellWidth:160,pageSize:10,tableQueryLabelWidth:100,tableQueryRowWidth:5,tableMoreBtnSplitNumber:0,headerMoreBtnSplitNumber:0}),r=l.inject("conditionList")();let o=l.ref(null),a=l.ref(s());l.watch(()=>n.modelValue,(f,d)=>{if(f){if(!Object.keys(f).length)return;const m={...f,defaultParams:[...f.defaultParams||[]]};Object.keys(a.value).forEach(O=>{["defaultParams"].includes(O)?a.value[O]=[...m[O]||[]]:O==="tableMoreBtnSplitNumber"?a.value[O]=Reflect.has(m,"tableMoreBtnSplitNumber")?m[O]:0:O==="headerMoreBtnSplitNumber"?a.value[O]=Reflect.has(m,"headerMoreBtnSplitNumber")?m[O]:0:O==="isExecuteImmediatelyTableApi"?a.value[O]=Reflect.has(m,"isExecuteImmediatelyTableApi")?m[O]:!0:a.value[O]=m[O]})}},{deep:!0,immediate:!0});const c=()=>{a.value.defaultParams.push({submitFieldName:"",defaultValue:"",matchValue:"",submitFieldType:""})},u=f=>{a.value.defaultParams.splice(f,1)},h=f=>{f||(a.value.pageSize=10)};return e({formRef:o,form:a}),(f,d)=>{const m=l.resolveComponent("el-input"),O=l.resolveComponent("el-form-item"),w=l.resolveComponent("el-col"),g=l.resolveComponent("el-row"),p=l.resolveComponent("el-button"),b=l.resolveComponent("el-divider"),k=l.resolveComponent("el-option"),y=l.resolveComponent("el-select"),C=l.resolveComponent("el-switch"),T=l.resolveComponent("el-input-number"),x=l.resolveComponent("el-form"),A=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(A,{class:"form-card",shadow:"hover",header:"表格配置"},{default:l.withCtx(()=>[l.createVNode(x,{ref_key:"formRef",ref:o,model:l.unref(a),"label-suffix":":","label-width":"120"},{default:l.withCtx(()=>[l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(w,{span:24},{default:l.withCtx(()=>[l.createVNode(O,{label:"表格数据url",prop:"dataUrl",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:l.unref(a).dataUrl,"onUpdate:modelValue":d[0]||(d[0]=R=>l.unref(a).dataUrl=R),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(b,{"content-position":"left"},{default:l.withCtx(()=>[d[14]||(d[14]=l.createTextVNode(" 表格默认参数配置 ",-1)),l.createVNode(p,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:c})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).defaultParams,(R,_)=>(l.openBlock(),l.createBlock(g,{class:"table-post-params",key:_},{default:l.withCtx(()=>[l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"字段",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:R.submitFieldName,"onUpdate:modelValue":S=>R.submitFieldName=S,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".matchValue"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:R.matchValue,"onUpdate:modelValue":S=>R.matchValue=S,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(r),(S,P)=>(l.openBlock(),l.createBlock(k,{key:P,label:S.key,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"默认值",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".defaultValue"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:R.defaultValue,"onUpdate:modelValue":S=>R.defaultValue=S,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(O,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:R.submitFieldType,"onUpdate:modelValue":S=>R.submitFieldType=S,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(of),(S,P)=>(l.openBlock(),l.createBlock(k,{key:P,label:S.key,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(b,{"content-position":"left"}),l.createVNode(w,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(p,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:S=>u(_)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"多选列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isCheckRow,"onUpdate:modelValue":d[1]||(d[1]=R=>l.unref(a).isCheckRow=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"操作列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isOperateRow,"onUpdate:modelValue":d[2]||(d[2]=R=>l.unref(a).isOperateRow=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"分页"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isPagination,"onUpdate:modelValue":d[3]||(d[3]=R=>l.unref(a).isPagination=R),onChange:h},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"序号列"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isSerialNumber,"onUpdate:modelValue":d[4]||(d[4]=R=>l.unref(a).isSerialNumber=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"排序"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isSort,"onUpdate:modelValue":d[5]||(d[5]=R=>l.unref(a).isSort=R)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"展/收查询条件"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isExpandQuery,"onUpdate:modelValue":d[6]||(d[6]=R=>l.unref(a).isExpandQuery=R),onChange:h},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(O,{label:"立即执行接口"},{default:l.withCtx(()=>[l.createVNode(C,{modelValue:l.unref(a).isExecuteImmediatelyTableApi,"onUpdate:modelValue":d[7]||(d[7]=R=>l.unref(a).isExecuteImmediatelyTableApi=R)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(g,null,{default:l.withCtx(()=>[l.unref(a).isOperateRow?(l.openBlock(),l.createBlock(w,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"操作列宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableOperateCellWidth,"onUpdate:modelValue":d[8]||(d[8]=R=>l.unref(a).tableOperateCellWidth=R),min:120},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(a).isPagination?(l.openBlock(),l.createBlock(w,{key:1,span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"分页页数",prop:"pageSize","label-width":"150",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).pageSize,"onUpdate:modelValue":d[9]||(d[9]=R=>l.unref(a).pageSize=R),min:10},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"查询条件label宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableQueryLabelWidth,"onUpdate:modelValue":d[10]||(d[10]=R=>l.unref(a).tableQueryLabelWidth=R),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"查询条件列数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableQueryRowWidth,"onUpdate:modelValue":d[11]||(d[11]=R=>l.unref(a).tableQueryRowWidth=R),min:1},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"表格更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).tableMoreBtnSplitNumber,"onUpdate:modelValue":d[12]||(d[12]=R=>l.unref(a).tableMoreBtnSplitNumber=R),min:0},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(O,{label:"顶部更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(a).headerMoreBtnSplitNumber,"onUpdate:modelValue":d[13]||(d[13]=R=>l.unref(a).headerMoreBtnSplitNumber=R),min:0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},[["__scopeId","data-v-3a00699d"]]),FQ="",Fy=ct({__name:"configBtns",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=on.useRoute(),s=l.inject("apiPrefix"),r=l.inject("request"),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>p1)),a=i,c=()=>({sort:0,permissionCode:null,requestUrl:"",btnName:"",btnAlias:"",btnIcon:"",btnPostion:"",btnType:"",btnColor:"",submitWay:"",importFileName:"",isPromptVerificationSelectTable:"1",isCustomBtn:!1,customType:"",codeStr:"",customComponentName:"",customComponentUrl:"",associationMenuId:"",submitFields:[],matchFields:[]}),u=()=>({tableLoading:!1,showConfigBtnDialog:!1,dialogData:{}});let h=l.reactive(u()),f=l.ref(null),d=0,m=l.ref([]),O=l.ref([]),w=[{prop:"checkbox",width:60},{prop:"serialNumber",width:80},{label:"按钮名称",prop:"btnName",minWidth:200},{label:"权限码",prop:"permissionCode",minWidth:200},{label:"按钮别名",prop:"btnAlias",minWidth:120},{label:"按钮图标",prop:"btnIcon",minWidth:120},{label:"是否自定义",prop:"isCustomBtn",width:120,render:!0},{label:"排序",prop:"sort",width:180,render:!0},{label:"操作",prop:"operate",width:120,render:!0,fixed:"right"}],g=l.ref([]);const p=x=>r({url:`${s}/sysMenus/getAllList`,method:"post",data:x}),b=x=>r({url:`${s}/sysMenus/getMenuOfOperate`,method:"get",params:x}),k=(x,A)=>{O.value.includes(x.permissionCode)||O.value.push(x.permissionCode),Object.assign(g.value[d],x),A(!0)},y=async x=>{try{h.tableLoading=!0;const A=a.id?a.id:n.params.id,{data:R}=await b({id:A});O.value=(R||[]).filter(_=>(x||[]).some(S=>S.permissionCode==_.unique)).map(_=>_.unique),g.value=(R||[]).map((_,S)=>{let P=c(),Q=(x||[]).find(E=>E.permissionCode==_.unique)||{};return{...P,btnIcon:_.icon||"",...Q,btnName:_.name,permissionCode:_.unique,sort:Q.sort?Q.sort:(S+1)*10}}).sort((_,S)=>_.sort-S.sort),h.tableLoading=!1}catch(A){h.tableLoading=!1,console.error(A)}},C=()=>f.value.getSelectionRows()||[];l.provide("associationMenuList",m),l.provide("createDefaultButtonItem",c),l.watch(()=>a.modelValue,async(x,A)=>{try{const R=a.id?a.id:n.params.id;m.value=(await p({dynamicFilters:[{field:"parentId",operate:"Equal",value:R}]})).data||[],await y(x)}catch(R){h.tableLoading=!1,console.error(R)}},{deep:!0});const T=x=>{h.dialogData=x.row,d=x.$index,h.showConfigBtnDialog=!0};return e({getTableSelectionRows:C}),(x,A)=>{const R=l.resolveComponent("el-tag"),_=l.resolveComponent("el-input-number"),S=l.resolveComponent("el-button"),P=l.resolveComponent("a-table"),Q=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(Q,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[...A[2]||(A[2]=[l.createElementVNode("div",{class:"card-header"},[l.createElementVNode("div",{class:"card-header-title"},"按钮配置")],-1)])]),default:l.withCtx(()=>[l.createVNode(P,{ref_key:"tableRef",ref:f,loading:l.unref(h).tableLoading,rowKey:"permissionCode",selection:l.unref(O),"onUpdate:selection":A[0]||(A[0]=E=>l.isRef(O)?O.value=E:O=E),headers:l.unref(w),data:l.unref(g),showPagination:!1},{isCustomBtn:l.withCtx(({scope:E})=>[l.createVNode(R,{type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(E.row.isCustomBtn?"是":"否"),1)]),_:2},1024)]),sort:l.withCtx(({scope:E})=>[l.createVNode(_,{modelValue:E.row.sort,"onUpdate:modelValue":W=>E.row.sort=W,min:0},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:E})=>[l.createVNode(S,{type:"primary",text:"",size:"small",icon:"Aim",onClick:W=>T(E)},{default:l.withCtx(()=>[...A[3]||(A[3]=[l.createTextVNode(" 配置 ",-1)])]),_:1},8,["onClick"])]),_:1},8,["loading","selection","headers","data"]),l.createVNode(l.unref(o),{visible:l.unref(h).showConfigBtnDialog,"onUpdate:visible":A[1]||(A[1]=E=>l.unref(h).showConfigBtnDialog=E),title:"配置按钮",data:l.unref(h).dialogData,onRefresh:k},null,8,["visible","data"])]),_:1})}}},[["__scopeId","data-v-05dd44e9"]]),XQ="",Uy={class:"card-header"},Xy=ct({__name:"configFileds",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>O1)),n=e,s=i;l.inject("configData")();const r=()=>({tableLoading:!1,showAddFieldDialog:!1,dialogTitle:"字段配置",dialogData:{}});let o=l.reactive(r()),a=0,c=[{label:"序号",prop:"serialNumber",width:60},{label:"字段",prop:"fieldName",minWidth:160},{label:"字段Key",prop:"fieldKey",minWidth:160},{label:"字段类型",prop:"fieldType",minWidth:160,render:!0},{label:"使用场景",prop:"useScenes",minWidth:340,render:!0},{label:"排序",prop:"sort",width:200,render:!0},{label:"操作",prop:"operate",width:170,render:!0,fixed:"right"}],u=l.ref([]);lf[0].options.map(k=>({btnName:k.key,permissionCode:k.value}));const h=k=>{if(!Reflect.has(k,"fieldType"))return"";const y=rf.find(C=>C.value==k.fieldType);return(y==null?void 0:y.key)||""},f=k=>Reflect.has(k,"useScenes")?(k.formCustomComponentes??[]).filter(y=>k.useScenes.includes(y.permissionCode)):[],d=k=>(k.formCustomComponentes||[]).filter(y=>y.isFieldCustom).map(y=>`${y.btnName}:是`).join(),m=(k,y)=>{if(a==null){const C=u.value.length;u.value.push({...k,sort:(C+1)*10})}else u.value[a]={...k,postRequestParams:[...k.postRequestParams],useScenes:[...k.useScenes],formCustomComponentes:[...k.formCustomComponentes]};n("update:modelValue",u.value),y(!0)},O=async()=>{try{o.tableLoading=!0,u.value=(s.modelValue||[]).map(k=>({...k,sort:k.sort?k.sort:0})).sort((k,y)=>k.sort-y.sort),o.tableLoading=!1}catch(k){o.tableLoading=!1,console.error(k)}};l.watch(()=>s.modelValue,async(k,y)=>{await O()},{deep:!0,immediate:!0});const w=()=>{a=null,o.dialogData={},o.showAddFieldDialog=!0},g=k=>{a=k.$index,o.dialogData=k.row,o.showAddFieldDialog=!0},p=()=>{n("update:modelValue",u.value)},b=k=>{u.value.splice(k.$index,1),n("update:modelValue",u.value)};return(k,y)=>{const C=l.resolveComponent("el-button"),T=l.resolveComponent("el-tag"),x=l.resolveComponent("el-badge"),A=l.resolveComponent("el-input-number"),R=l.resolveComponent("a-table"),_=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(_,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[l.createElementVNode("div",Uy,[y[3]||(y[3]=l.createElementVNode("div",{class:"card-header-title"},"字段配置",-1)),l.createVNode(C,{class:"card-header-operate",type:"primary",icon:"Plus",onClick:y[0]||(y[0]=S=>w())},{default:l.withCtx(()=>[...y[2]||(y[2]=[l.createTextVNode("添加字段",-1)])]),_:1})])]),default:l.withCtx(()=>[l.createVNode(R,{loading:l.unref(o).tableLoading,headers:l.unref(c),data:l.unref(u),showPagination:!1},{fieldType:l.withCtx(({scope:S})=>[l.createTextVNode(l.toDisplayString(h(S.row)),1)]),useScenes:l.withCtx(({scope:S})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f(S.row),(P,Q)=>(l.openBlock(),l.createBlock(x,{key:Q,value:P.isFieldCustom?"C":"",offset:[-5,5]},{default:l.withCtx(()=>[l.createVNode(T,{style:{margin:"0 4px"},type:"success",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(P.btnName),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),formCustomComponentes:l.withCtx(({scope:S})=>[d(S.row)?(l.openBlock(),l.createBlock(T,{key:0,type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d(S.row)),1)]),_:2},1024)):l.createCommentVNode("",!0)]),sort:l.withCtx(({scope:S})=>[l.createVNode(A,{modelValue:S.row.sort,"onUpdate:modelValue":P=>S.row.sort=P,min:0,onChange:p},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:S})=>[l.createVNode(C,{type:"primary",text:"",size:"small",icon:"EditPen",onClick:P=>g(S)},{default:l.withCtx(()=>[...y[4]||(y[4]=[l.createTextVNode("编辑",-1)])]),_:1},8,["onClick"]),l.createVNode(C,{type:"danger",text:"",size:"small",icon:"Delete",onClick:P=>b(S)},{default:l.withCtx(()=>[...y[5]||(y[5]=[l.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]),_:1},8,["loading","headers","data"]),l.createVNode(l.unref(t),{visible:l.unref(o).showAddFieldDialog,"onUpdate:visible":y[1]||(y[1]=S=>l.unref(o).showAddFieldDialog=S),title:l.unref(o).dialogTitle,configData:s.data,data:l.unref(o).dialogData,onRefresh:m},null,8,["visible","title","configData","data"])]),_:1})}}},[["__scopeId","data-v-5ac6753d"]]),qQ="",Wy={class:"dialog-footer"},qy=ct({__name:"dialogInitConfig",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=on.useRoute(),n=l.inject("apiPrefix"),s=l.inject("request"),r=e,o=i;l.computed(()=>t.params.key);const a=()=>({dataBase:"",api:""}),c=()=>({loading:!1,btnLoading:!1});let u=l.reactive(c()),h=l.ref([]),f=l.ref(null),d=l.ref(a());const m=k=>s({url:`${n}/scripts/getAllDatabaseTable`,method:"get",data:k}),O=async()=>{try{u.loading=!0;const{data:k}=await m();h.value=k||[],u.loading=!1}catch(k){console.error(k),u.loading=!1}};l.watch(()=>o.visible,async(k,y)=>{k&&await O()});const w=()=>({sort:0,fieldName:void 0,fieldKey:void 0,fieldType:void 0,fieldUiProps:"",fieldSubmitType:"string",fieldRequestType:"GET",fieldRequestUrl:void 0,postRequestParams:[],useScenes:[],formColumnCol:12,formCustomComponentes:[],customTableHeaderName:"",customTableHeaderUrl:"",isFormFieldRequired:!0,isFormSetValue:!0,isFormDisabled:!1,tableQueryCondition:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),g=k=>{p(),k()},p=()=>{d.value=Object.assign(d.value,a()),f.value.resetFields(),r("update:visible",!1)},b=k=>{k&&k.validate(async y=>{if(y)try{u.btnLoading=!0;const{data:C}=await s({url:`${n}/scripts/getAllColumnsByTableName`,method:"get",params:{tableName:d.value.dataBase}}),T=(C||[]).map(x=>{let A=w();return A.fieldName=x.comment,A.fieldKey=x.name,A.fieldType="string",A});r("refresh",{formList:T},()=>{p()}),u.btnLoading=!1}catch(C){console.error(C),u.btnLoading=!1}})};return(k,y)=>{const C=l.resolveComponent("el-option"),T=l.resolveComponent("el-select"),x=l.resolveComponent("el-form-item"),A=l.resolveComponent("el-input"),R=l.resolveComponent("el-form"),_=l.resolveComponent("el-button"),S=l.resolveComponent("el-dialog"),P=l.resolveDirective("loading"),Q=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(S,{"model-value":o.visible,title:o.title,top:"10vh",width:"600",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":g},{footer:l.withCtx(()=>[l.createElementVNode("span",Wy,[l.createVNode(_,{loading:l.unref(u).btnLoading,onClick:p},{default:l.withCtx(()=>[...y[3]||(y[3]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(_,{type:"primary",loading:l.unref(u).btnLoading,onClick:y[2]||(y[2]=E=>b(l.unref(f)))},{default:l.withCtx(()=>[...y[4]||(y[4]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[Q]])])]),default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(R,{ref_key:"formRef",ref:f,model:l.unref(d),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(x,{label:"数据库","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"dataBase"},{default:l.withCtx(()=>[l.createVNode(T,{modelValue:l.unref(d).dataBase,"onUpdate:modelValue":y[0]||(y[0]=E=>l.unref(d).dataBase=E),placeholder:"请选择数据库",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(h),(E,W)=>(l.openBlock(),l.createBlock(C,{key:E,label:`${E.tableComment}【${E.tableName}】`,value:E.tableName},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l.createVNode(x,{label:"接口地址(关键字)","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"api"},{default:l.withCtx(()=>[l.createVNode(A,{modelValue:l.unref(d).api,"onUpdate:modelValue":y[1]||(y[1]=E=>l.unref(d).api=E),placeholder:"请输入接口地址(关键字)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[P,l.unref(u).loading]])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-5c2c8b66"]]),zQ="",jy={class:"page-container"},zy={class:"submit-box"},Yy={class:"submit-box-r"},af=ct({__name:"index",props:{pageKey:{type:String,default:""},id:{type:String,default:void 0}},setup(i){const e=on.useRoute(),t=on.useRouter(),n=l.inject("apiPrefix"),s=l.inject("request"),r=i;let o=r.id??void 0,a=r.pageKey?r.pageKey:e.params.key,c=l.ref([]),u=l.ref(),h=l.ref([]),f=l.ref({}),d=l.ref(null),m=l.ref(null),O=l.ref(null),w=l.ref({}),g=l.ref({}),p=l.ref([]),b=l.ref([]),k=l.reactive({pageLoading:!1,saveBtnLoading:!1,showDialogInitConfig:!1});const y=B=>s({url:`${n}/pages/getPageDetail?key=${B}`,method:"get"}),C=B=>s({url:`${n}/pageConfigs/createOrEdit`,method:"post",data:B}),T=B=>s({url:`${n}/sysMenus/getAllList`,method:"post",data:B}),x=B=>s({url:`${n}/sysDataDictionaries/getDictionaryByGroup?groupName=${B}`,method:"get"}),A=async()=>{const{data:B}=await T({dynamicFilters:[{field:"url",operate:"Equal",value:"/pages"}]});c.value=B||[]},R=async()=>{try{const{data:{pageConfigs:B}}=await y(a),I=JSON.parse(B.pageConfig)||{};o=B.pageId,console.log("pageConfigData",I),f.value=I,w.value={...I.tableConfig??{}},g.value={...I.formConfig??{}},p.value=[...I.buttons??[]],b.value=[...I.fields??[]]}catch(B){console.error(B)}},_=()=>{w.value={},g.value={},p.value=[],b.value=[],R()};l.provide("conditionList",()=>h),l.provide("pageKey",()=>l.ref(a)),l.provide("configData",()=>f),l.onMounted(async()=>{try{k.pageLoading=!0,await A(),u.value=e.params.id,h.value=(await x("Condition")).data||[],await R(),k.pageLoading=!1}catch(B){k.pageLoading=!1,console.error(B)}});const S=B=>{const I=c.value.find(G=>G.id==B);t.replace({path:`/actConfig/${I.key}/${I.id}`}),u.value=I.id,a=I.key,R()},P=()=>{k.showDialogInitConfig=!0},Q=({formList:B},I)=>{b.value=[...B],I(!0)},E=()=>{let B={id:o,key:a,pageConfig:{tableConfig:d.value.form,formConfig:m.value.form,buttons:O.value.getTableSelectionRows(),fields:b.value}};B.pageConfig=JSON.stringify(B.pageConfig),k.saveBtnLoading=!0,C(B).then(I=>{Ve.ElNotification({title:"提示",message:"保存成功",type:"success",duration:2500}),_(),k.saveBtnLoading=!1}).catch(I=>{k.saveBtnLoading=!1})},W=async()=>{Promise.all([d.value.formRef.validate(),m.value.formRef.validate()]).then(B=>{B.every(I=>I)&&E()}).catch(B=>B)};return(B,I)=>{const G=l.resolveComponent("el-button"),Z=l.resolveComponent("el-option"),H=l.resolveComponent("el-select"),j=l.resolveComponent("el-card"),z=l.resolveComponent("el-col"),me=l.resolveComponent("el-row"),de=l.resolveDirective("debounce"),ae=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createElementBlock("div",jy,[l.createVNode(me,{style:{margin:"0"},gutter:12},{default:l.withCtx(()=>[l.createVNode(z,{class:"header-operate",span:24},{default:l.withCtx(()=>[l.createVNode(j,{class:"form-card",shadow:"hover"},{default:l.withCtx(()=>[l.createElementVNode("div",zy,[I[10]||(I[10]=l.createElementVNode("div",{class:"submit-box-l"},null,-1)),l.createElementVNode("div",Yy,[l.withDirectives((l.openBlock(),l.createBlock(G,{style:{width:"120px"},type:"primary",loading:l.unref(k).initBtnLoading,onClick:I[0]||(I[0]=v=>P())},{default:l.withCtx(()=>[...I[8]||(I[8]=[l.createTextVNode("一键初始化配置",-1)])]),_:1},8,["loading"])),[[de]]),l.createVNode(H,{class:"menu-select",modelValue:l.unref(u),"onUpdate:modelValue":I[1]||(I[1]=v=>l.isRef(u)?u.value=v:u=v),placeholder:"菜单切换",clearable:"",filterable:"",onChange:S},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(c),v=>(l.openBlock(),l.createBlock(Z,{key:v.id,label:v.name,value:v.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l.withDirectives((l.openBlock(),l.createBlock(G,{style:{width:"120px"},type:"success",loading:l.unref(k).saveBtnLoading,onClick:I[2]||(I[2]=v=>W(B.formRef))},{default:l.withCtx(()=>[...I[9]||(I[9]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[de]])])])]),_:1})]),_:1}),l.createVNode(z,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Zy,{ref_key:"configTableRef",ref:d,modelValue:l.unref(w),"onUpdate:modelValue":I[3]||(I[3]=v=>l.isRef(w)?w.value=v:w=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Iy,{ref_key:"configFormRef",ref:m,modelValue:l.unref(g),"onUpdate:modelValue":I[4]||(I[4]=v=>l.isRef(g)?g.value=v:g=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Fy,{ref_key:"configBtnsRef",ref:O,modelValue:l.unref(p),"onUpdate:modelValue":I[5]||(I[5]=v=>l.isRef(p)?p.value=v:p=v)},null,8,["modelValue"])]),_:1}),l.createVNode(z,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Xy,{modelValue:l.unref(b),"onUpdate:modelValue":I[6]||(I[6]=v=>l.isRef(b)?b.value=v:b=v)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(qy,{visible:l.unref(k).showDialogInitConfig,"onUpdate:visible":I[7]||(I[7]=v=>l.unref(k).showDialogInitConfig=v),title:"一键初始化配置",onRefresh:Q},null,8,["visible"])])),[[ae,l.unref(k).pageLoading]])}}},[["__scopeId","data-v-8dfa8a8a"]]),Gy=(i,e)=>{let t=e.value||1e3,n,s=!1;i.addEventListener("click",r=>{n&&clearTimeout(n),s?r&&r.stopImmediatePropagation():s=!0,n=setTimeout(()=>{n=null,s=!1},t)},!0)},Tr={en:{act:{sort:"Serial Number",noData:"No Data",operate:"Operation",inputPlaceholder:"Please Input ",selectPlaceholder:"Please Select ",tip:"Tip",time:"Time",startTime:"Start Time",endTime:"End Time",loading:"ing",reset:"Reset",requiredMessage:"Required",customTableHeader:"Custom",developing:"In the process of feature development Coming soon",fieldCustom:"Custom",cancel:"Cancel",save:"Save",saveSuccessfully:"Save Successfully",configTableRow:"Please configure the table to select multiple columns",pleaseSelcet:"Please Selcet Need",data:"Data",success:"Success",buttonBindField:"The current button is not bound to a field",enter:"Enter",isExecuteOperate:"Are you sure to perform this operation",noConfigPage:"No Config Page",noImage:"No image",preview:"Preview",uploadText:"Drag the file here, or",clickUpload:"Click to upload",uploadLoading:"Upload loading...",uploadErrorTip:"The file type is incorrect. Please upload the file in the correct format again",uploadLimitTip:"Exceeding the file limit, please confirm and upload again.",expand:"Expand",retract:"Retract",formatCode:"FormatCode"}},zhCn:{act:{sort:"序号",noData:"暂无数据",operate:"操作",inputPlaceholder:"请输入",selectPlaceholder:"请选择",tip:"提示",time:"时间",startTime:"开始时间",endTime:"结束时间",loading:"中",reset:"重置",requiredMessage:"必填项",customTableHeader:"自定义表头(暂未创建文件)",developing:"功能开发中...敬请期待",fieldCustom:"当前字段为自定义,请在项目中创建对应组件",cancel:"取消",save:"保存",saveSuccessfully:"保存成功",configTableRow:"请配置表格多选列",pleaseSelcet:"请选择需要",data:"的数据",success:"成功",buttonBindField:"当前按钮未绑定字段",enter:"确定",isExecuteOperate:"是否确认执行此操作",noConfigPage:"暂无页面信息",noImage:"暂无",preview:"预览",uploadText:"将文件拖到此处,或",clickUpload:"点击上传",uploadLoading:"上传中...",uploadErrorTip:"文件类型不正确,请重新上传正确格式的文件。",uploadLimitTip:"超出文件数量限制,请确认后重新上传。",expand:"展开",retract:"收起",formatCode:"一键格式化代码"}}},cf={ActPage:sf,ActConfig:af},Ky={install(i,e){var m;const{modules:t,apiPrefix:n,request:s,themeColor:r,cacheTokenType:o="sessionStorage",cookieStorage:a,language:{messages:c={},en:u="zhCn"},menuAuthButtons:h}=e,f={act:Object.assign(Tr[u].act,((m=c[u])==null?void 0:m.act)??{})},d=Vh({locale:u,fallbackLocale:u,messages:{...Tr,[u]:f}});i.use(d),i.provide("actModules",t),i.provide("themeColor",r),i.provide("apiPrefix",n||"/api/v1"),i.provide("request",s),i.provide("cacheTokenType",o),i.provide("cookieStorage",a),i.provide("menuAuthButtons",h),i.directive("debounce",Gy),Object.keys(cf).forEach(O=>{i.component(O,cf[O])})}},Hy={ActPage:sf,ActConfig:af};function Jy(i){var o;const{modules:e,language:{messages:t={},en:n="zhCn"}}=i,s={act:Object.assign(Tr[n].act,((o=t[n])==null?void 0:o.act)??{})};return Vh({locale:n,fallbackLocale:n,messages:{...Tr,[n]:s}})}const GQ="",e1={key:0,class:"search-module-container"},t1={class:"no-config-field"},i1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{data:{type:Object,default:()=>({})}},emits:["reset","search"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>uf)),{t:n}=Kt(),s=l.inject("request"),r=l.inject("globalProps"),o=l.inject("loadComponents"),a=l.inject("getFieldUiProps"),c=l.inject("formatDataType"),u=l.inject("disposeDate"),h=l.inject("getDefaultQueryValues"),f=e,d=i,m=l.ref({});let O=l.ref([]),w=l.ref([]),g=l.ref(!0);const p=l.ref(0),b=l.ref(0),k=S=>d.data.tableConfig.isExpandQuery&&g.value?d.data.tableConfig.tableQueryRowWidth>S+1:!0,y=async S=>{O.value=await Promise.all(S.filter(P=>P.useScenes.includes("tableSearch")).map(async P=>{P.tableQueryDefaultValue&&(["date","dateRange"].includes(P.fieldType)?P.queryValue=u(P):P.queryValue=P.tableQueryDefaultValue?P.tableQueryDefaultValue:void 0),r.defaultParams.some(E=>{E.field==P.fieldKey&&E.operate===P.tableQueryCondition&&(P.queryValue=E.value)});const Q=(P.formCustomComponentes??[]).find(E=>E.permissionCode==="tableSearch");if(P.isQueryFieldCustom=!1,Q&&Q.isFieldCustom){const{isFieldCustom:E,customComponentName:W,customComponentUrl:B}=Q;if(P.isQueryFieldCustom=!0,b.value++,E&&!P.customQueryComponent){const I=await o(B,W);P.customQueryComponent=I}}return P}))},C=S=>{const P=(S||[]).filter(Q=>Q.permissionCode===1001).map(Q=>({...Q,loading:!1}));w.value=[...P,{btnName:n("act.reset"),permissionCode:"9999",btnColor:"info",btnIcon:"btn-reset",loading:!1}]},T=async({node:S,resolve:P},Q)=>{const E=a(Q),{label:W,value:B,children:I,isLeaf:G}={...Cr,...E.treeProps||{}};if(S[G])return P([]);const Z=Q.postRequestParams.filter(ae=>ae.submitType==="default").reduce((ae,v)=>(ae[v.submitName]=c(v.paramsType,v.submitValue),ae),{}),H=Q.postRequestParams.filter(ae=>ae.submitType==="match").reduce((ae,v)=>(ae[v.submitName]=c(v.paramsType,r.matchData[v.submitValue][v.submitName]),ae),{}),j=Q.postRequestParams.filter(ae=>ae.submitType==="dynamic").map(ae=>{let v={field:ae.submitName,operate:ae.submitMatchType,value:c(ae.paramsType,ae.submitValue)};return E.loadCode===ae.submitName&&(S!=null&&S.data.value)&&(v.value=S==null?void 0:S.data.value),v});let z={};Object.keys(Z).length&&(z={...z,...Z}),Object.keys(H).length&&(z={...z,...H}),j.length&&(z.dynamicFilters=j),E.loadCode&&Reflect.has(z,E.loadCode)&&(z[E.loadCode]=S==null?void 0:S.data.value);const{data:me}=await s({url:Q.fieldRequestUrl,method:Q.fieldRequestType||"GET",data:z}),de=(me||[]).map(ae=>({label:ae[W],value:ae[B],children:[],isLeaf:ae[G]}));P(de)};l.watch(()=>d.data,(S,P)=>{y(S.fields),C(S.buttons)},{immediate:!0,deep:!0});const x=()=>{p.value++,p.value===b.value&&A({permissionCode:1001})},A=S=>{switch(S.loading=!0,S.permissionCode){case"9999":O.value.forEach(E=>{E.tableQueryDefaultValue?E.queryValue=["date","dateRange"].includes(E.fieldType)?u(E):(E==null?void 0:E.tableQueryDefaultValue)||void 0:E.queryValue=E.fieldType.includes("&")?[]:void 0});const P=h();f("reset",P,()=>{S.loading=!1});break;default:const Q=O.value.filter(E=>Array.isArray(E.queryValue)?E.queryValue.length:!!E.queryValue);f("search",Q,()=>{S.loading=!1});break}},R=()=>{g.value=!g.value},_=()=>{A({permissionCode:1001})};return(S,P)=>{var ae;const Q=l.resolveComponent("el-input"),E=l.resolveComponent("el-option"),W=l.resolveComponent("el-select"),B=l.resolveComponent("el-select-v2"),I=l.resolveComponent("el-cascader"),G=l.resolveComponent("el-tree-select"),Z=l.resolveComponent("el-date-picker"),H=l.resolveComponent("el-form-item"),j=l.resolveComponent("a-svg-icon"),z=l.resolveComponent("el-button"),me=l.resolveComponent("el-form"),de=l.resolveDirective("debounce");return l.unref(O)&&l.unref(O).length?(l.openBlock(),l.createElementBlock("div",e1,[l.createVNode(me,{style:l.normalizeStyle({"--table-query-row":d.data.tableConfig.tableQueryRowWidth}),class:"form-content",ref:"elForm","label-suffix":":","label-position":"right"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(O),(v,N)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:N},[k(N)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[v.isQueryFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[v.customQueryComponent?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(v.customQueryComponent),{key:0,class:"custom-btn",ref_for:!0,ref:q=>m.value[`customQueryComponent_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,queryItem:v,data:d.data,onRefresh:P[9]||(P[9]=q=>A({permissionCode:1001})),onLoaded:x},null,40,["modelValue","onUpdate:modelValue","queryItem","data"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:N},[l.createElementVNode("span",t1,"【"+l.toDisplayString(v.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(n)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(H,{key:0,class:"search-form-item","label-width":d.data.tableConfig.tableQueryLabelWidth,label:v.fieldName},{default:l.withCtx(()=>[v.fieldType==="input"||v.fieldType==="editor"?(l.openBlock(),l.createBlock(Q,l.mergeProps({key:0,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${v.fieldName}`,clearable:""},{ref_for:!0},l.unref(a)(v),{onKeyup:P[0]||(P[0]=l.withKeys(l.withModifiers(q=>A({permissionCode:1001}),["prevent"]),["enter","native"])),onClear:_}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):l.createCommentVNode("",!0),v.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${v.fieldName}`,clearable:"",onKeyup:P[1]||(P[1]=l.withKeys(l.withModifiers(q=>A({permissionCode:1001}),["prevent"]),["enter","native"]))},{ref_for:!0},l.unref(a)(v)),null,16,["modelValue","onUpdate:modelValue","placeholder"])):["select","switch","multipleSelect"].includes(v.fieldType)?(l.openBlock(),l.createBlock(W,l.mergeProps({key:2,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{multiple:v.fieldType==="multipleSelect","collapse-tags":v.fieldType==="multipleSelect","collapse-tags-tooltip":v.fieldType==="multipleSelect",onChange:P[2]||(P[2]=q=>A({permissionCode:1001}))}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(v.dataList,(q,J)=>(l.openBlock(),l.createBlock(E,{key:J,label:q.key,value:q.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","collapse-tags","collapse-tags-tooltip"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(v.fieldType)?(l.openBlock(),l.createBlock(B,l.mergeProps({key:3,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,options:v.dataList,props:{...l.unref(nf)},placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{"collapse-tags":v.fieldType==="virtualizedMultipleSelect","collapse-tags-tooltip":v.fieldType==="virtualizedMultipleSelect",multiple:v.fieldType==="virtualizedMultipleSelect",onChange:P[3]||(P[3]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","collapse-tags","collapse-tags-tooltip","multiple"])):v.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(I,l.mergeProps({key:4,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,options:v.dataList,props:{...l.unref(tf)},clearable:"",filterable:"",placeholder:`${l.unref(n)("act.selectPlaceholder")}${v.fieldName}`},{ref_for:!0},l.unref(a)(v),{onChange:P[4]||(P[4]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder"])):v.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(G,l.mergeProps({key:5,ref_for:!0,ref:q=>m.value[`elTreeSelect_fullLoad_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,data:v.dataList,placeholder:`请选择${v.fieldName}`,props:{...l.unref(Cr),...l.unref(a)(v).treeProps||{}},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[5]||(P[5]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","data","placeholder","props"])):v.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(G,l.mergeProps({key:6,ref_for:!0,ref:q=>m.value[`elTreeSelect_${N}`]=q,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,placeholder:`请选择${v.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(q,J)=>T({node:q,resolve:J},v)},{ref_for:!0},l.unref(a)(v),{onChange:P[6]||(P[6]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):v.fieldType==="date"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:7,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,type:"date",placeholder:`${l.unref(n)("act.selectPlaceholder")}${l.unref(n)("act.time")}`,"value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[7]||(P[7]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):v.fieldType==="dateRange"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:8,modelValue:v.queryValue,"onUpdate:modelValue":q=>v.queryValue=q,type:"daterange","start-placeholder":l.unref(n)("act.startTime"),"end-placeholder":l.unref(n)("act.endTime"),"value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},{ref_for:!0},l.unref(a)(v),{onChange:P[8]||(P[8]=q=>A({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder"])):l.createCommentVNode("",!0)]),_:2},1032,["label-width","label"]))],64)):l.createCommentVNode("",!0)],64))),128)),l.unref(O).length?(l.openBlock(),l.createBlock(H,{key:0,class:"search-form-btn","label-width":"0"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(v,N)=>l.withDirectives((l.openBlock(),l.createBlock(z,{key:N,type:v.btnColor,loading:v.loading,onClick:q=>A(v)},{default:l.withCtx(()=>[v.btnIcon?(l.openBlock(),l.createBlock(j,{key:0,class:"mr6",name:v.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(v.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[de]])),128))]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["style"]),d.data.tableConfig.isExpandQuery&&((ae=l.unref(O))==null?void 0:ae.length)>d.data.tableConfig.tableQueryRowWidth?(l.openBlock(),l.createBlock(z,{key:0,class:"expand",text:"",size:"small",icon:l.unref(g)?"ArrowDown":"ArrowUp",onClick:R},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)?l.unref(n)("act.expand"):l.unref(n)("act.retract")),1)]),_:1},8,["icon"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)}}},[["__scopeId","data-v-5f841262"]])},Symbol.toStringTag,{value:"Module"})),JQ="",n1={class:"header-operate-container"},s1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{data:{type:Object,default:()=>({})}},emits:["onOperate"],setup(i,{emit:e}){const t=e,n=i,{t:s}=Kt();let r=l.ref([]);const o=l.inject("globalProps"),a=l.inject("menuPermissionBtns"),c=l.inject("stringToBoolean"),u=l.inject("matchCondition"),h=l.inject("getTableData"),f=l.inject("tableBtnRefs"),d=l.inject("refreshTable"),m=l.computed(()=>{const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return!y||y>=r.value.length}),O=()=>{const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return m.value?r.value:r.value.slice(0,y)},w=()=>{var C;const{tableConfig:{headerMoreBtnSplitNumber:y}}=n.data;return m.value?[]:r.value.slice(y,(C=r.value)==null?void 0:C.length)},g=y=>{if(!y.matchFields.length)return!0;const C=y.matchFields.filter(_=>_.matchType!="default"),T=_=>o.matchData[_.matchType][_.matchFieldName];let A=C.reduce((_,S,P)=>{const Q=T(S);return _+=u(S.matchCondition,Q,S.fieldValue==""?null:S.fieldValue=="true"||S.fieldValue=="false"?c(S.fieldValue):S.fieldValue),P!==C.length-1&&(_+=S.spliceCondition||"&&"),_},"").split("||"),R=A.reduce((_,S,P)=>(_+=`(${S})`,P<A.length-1&&(_+="||"),_),"");return new Function(`return ${R}`)()},p=y=>a.value.some(C=>C.unique==y.permissionCode)&&g(y),b=y=>{r.value=(y||[]).filter(C=>C.permissionCode!==1001&&C.btnPostion.includes("header")).sort((C,T)=>C.sort-T.sort).map(C=>(C.btnAlias&&(C.btnName=C.btnAlias),Reflect.has(C,"isPromptVerificationSelectTable")||(C.isPromptVerificationSelectTable="1"),C))};l.watch(()=>n.data,(y,C)=>{b(y.buttons)},{immediate:!0});const k=y=>{t("onOperate",y,{})};return(y,C)=>{const T=l.resolveComponent("a-svg-icon"),x=l.resolveComponent("el-button"),A=l.resolveComponent("el-icon"),R=l.resolveComponent("el-dropdown-item"),_=l.resolveComponent("el-dropdown-menu"),S=l.resolveComponent("el-dropdown"),P=l.resolveDirective("debounce");return l.openBlock(),l.createElementBlock("div",n1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(O(),(Q,E)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Q.permissionCode},[p(Q)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Q.isCustomBtn&&Q.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q[Q.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:W=>l.unref(f)[`${Q.customComponentName}-${Q.permissionCode}`]=W,buttonData:Q,onRefresh:C[0]||(C[0]=W=>l.unref(h)()),onRefreshTable:C[1]||(C[1]=W=>l.unref(d)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`],onClick:W=>k(Q)},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[P]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`],onClick:W=>k(Q)},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[P]])],64)):l.createCommentVNode("",!0)],64))),128)),m.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(S,{key:0,class:"header-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(_,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(w(),(Q,E)=>(l.openBlock(),l.createBlock(R,{key:Q.permissionCode,onClick:W=>k(Q)},{default:l.withCtx(()=>[p(Q)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Q.isCustomBtn&&Q.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q[Q.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:W=>l.unref(f)[`${Q.customComponentName}-${Q.permissionCode}`]=W,buttonData:Q,onRefresh:C[2]||(C[2]=W=>l.unref(h)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`]},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading"])),[[P]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:Q.btnColor,loading:Q[`loading${Q.permissionCode}`]},{default:l.withCtx(()=>[Q.btnIcon&&!Q[`loading${Q.permissionCode}`]?(l.openBlock(),l.createBlock(T,{key:0,class:"mr4",name:Q.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(Q[`loading${Q.permissionCode}`]?Q.btnName+l.unref(s)("act.loading")+"...":Q.btnName),1)]),_:2},1032,["type","loading"])),[[P]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:l.withCtx(()=>[l.createVNode(x,{type:"primary"},{default:l.withCtx(()=>[C[3]||(C[3]=l.createTextVNode(" 更多按钮",-1)),l.createVNode(A,{class:"el-icon--right"},{default:l.withCtx(()=>[l.createVNode(l.unref(cy))]),_:1})]),_:1})]),_:1}))])}}},[["__scopeId","data-v-d86fe71c"]])},Symbol.toStringTag,{value:"Module"})),iE="",r1={class:"act-table"},o1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{loading:{type:Boolean,default:!1},maxHeight:{type:Number,default:600},total:{type:Number,default:0},tableQuery:{type:Object,default:()=>({pageIndex:1,pageSize:10})},selection:{type:Array,default:()=>[]},headers:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},showSerialNumber:{type:Boolean,default:!0},showPagination:{type:Boolean,default:!0},rowKey:{type:String,default:"id"},treeProps:{type:Object,default:()=>({children:"children",hasChildren:"hasChildren"})},tableConfig:{type:Object,default:()=>({})}},emits:["update:tableQuery","update:selection","changeSelection","refresh","onRowClick","changeExpand"],setup(i,{expose:e,emit:t}){const{t:n}=Kt(),s=t,r=i;let o=l.ref(null);const a=p=>r.showPagination?p+1+(r.tableQuery.pageIndex-1)*r.tableQuery.pageSize:p+1,c=p=>{l.nextTick(()=>{r.data.forEach(b=>{p.includes(b[r.rowKey])&&o.value.toggleRowSelection(b,!0)})})},u=()=>{o.value.clearSelection()},h=p=>o.value.getSelectionRows();l.watch(()=>r.selection,(p,b)=>{p&&p.length&&c(p)},{deep:!0,immediate:!0});const f=p=>{s("update:selection",p),s("changeSelection",p)},d=(p,b)=>{p&&l.nextTick(()=>{let k=b;r.data.forEach(y=>{r.rowKey&&(k=r.rowKey),r.tableConfig.rowKey&&(k=r.tableConfig.rowKey),p.includes(y[k])&&o.value.toggleRowSelection(y,!0)})})},m=p=>{s("update:tableQuery",{...r.tableQuery,pageSize:p}),s("refresh",[])},O=p=>{s("update:tableQuery",{...r.tableQuery,pageIndex:p}),s("refresh",[])},w=(p,b,k)=>{s("onRowClick",p,b,k)},g=(p,b)=>{s("changeExpand",p,b)};return e({getSelectionRows:h,updateSelection:d,clearSelection:u}),(p,b)=>{const k=l.resolveComponent("el-table-column"),y=l.resolveComponent("el-table"),C=l.resolveComponent("el-pagination"),T=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",r1,[l.withDirectives((l.openBlock(),l.createBlock(y,l.mergeProps({style:{width:"100%"},ref_key:"tableRef",ref:o,data:r.data,stripe:"",border:"","highlight-current-row":"","max-height":r.maxHeight,"row-key":r.rowKey,"default-expand-all":"","tree-props":i.treeProps},r.tableConfig,{onSelectionChange:f,onRowClick:w,onExpandChange:g}),{empty:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.data.length||r.data.length==0?l.unref(n)("act.noData"):""),1)]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.headers,x=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:x.prop},[x.isCustomTableHeader?l.renderSlot(p.$slots,x.prop,{key:0},void 0,!0):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.render?(l.openBlock(),l.createBlock(k,{key:0,label:x.label,align:x.align,width:x.width,minWidth:x.minWidth,sortable:x.sort,"show-overflow-tooltip":x.prop=="operate"?!1:x.showOverflowTooltip,fixed:x.fixed},{default:l.withCtx(A=>[l.renderSlot(p.$slots,x.prop,{scope:A},void 0,!0)]),_:2},1032,["label","align","width","minWidth","sortable","show-overflow-tooltip","fixed"])):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.prop=="checkbox"?(l.openBlock(),l.createBlock(k,{key:0,type:"selection",align:"center",width:x.width,fixed:""},null,8,["width"])):x.prop=="serialNumber"?(l.openBlock(),l.createBlock(k,{key:1,index:a,type:"index",align:"center",width:x.width,label:l.unref(n)("act.sort"),fixed:""},null,8,["width","label"])):(l.openBlock(),l.createBlock(k,{key:2,prop:x.prop,label:x.label,align:x.align,sortable:x.sort,"show-overflow-tooltip":x.showOverflowTooltip,width:x.width,"min-width":x.minWidth,fixed:x.fixed},null,8,["prop","label","align","sortable","show-overflow-tooltip","width","min-width","fixed"]))],64))],64))],64))),128))]),_:3},16,["data","max-height","row-key","tree-props"])),[[T,r.loading]]),r.showPagination?(l.openBlock(),l.createBlock(C,{key:0,class:"table-pagination","current-page":r.tableQuery.pageIndex,"onUpdate:currentPage":b[0]||(b[0]=x=>r.tableQuery.pageIndex=x),"page-size":r.tableQuery.pageSize,"onUpdate:pageSize":b[1]||(b[1]=x=>r.tableQuery.pageSize=x),"page-sizes":[10,20,50,75,100,200,500],background:"",layout:"total, sizes, prev, pager, next, jumper",total:r.total,onSizeChange:m,onCurrentChange:O},null,8,["current-page","page-size","total"])):l.createCommentVNode("",!0)])}}},[["__scopeId","data-v-b5ec4a41"]])},Symbol.toStringTag,{value:"Module"})),rE="",l1={class:"no-config-field"},a1={class:"dialog-footer"},c1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>uf)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>hf)),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>N1)),r=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Y1)),{t:o}=Kt(),a=l.inject("request"),c=l.inject("loadComponents"),u=l.inject("formatDataType"),h=l.inject("globalProps"),f=l.inject("stringToBoolean"),d=l.inject("getFieldUiProps"),m=l.inject("disposeRequestData"),O=e,w=i,g=l.ref(!1),p=l.ref(!1),b=l.ref(null),k=l.ref([]),y=l.ref({}),C=l.ref({}),T=Z=>Z.formColumnCol==null?24:Z.formColumnCol?Z.formColumnCol:24/Z.formRow,x=Z=>["input","textarea"].includes(Z.fieldType)?"blur":(["select","multipleSelect","datetimerange","treeSelect","provinceCascade"].includes(Z.fieldType),"change"),A=async({node:Z,resolve:H},j)=>{const z=d(j),{label:me,value:de,children:ae,isLeaf:v}={...Cr,...z.treeProps||{}};if(Z[v])return H([]);const N=j.postRequestParams.filter(Re=>Re.submitType==="default").reduce((Re,Ge)=>(Re[Ge.submitName]=u(Ge.paramsType,Ge.submitValue),Re),{}),q=j.postRequestParams.filter(Re=>Re.submitType==="match").reduce((Re,Ge)=>(Re[Ge.submitName]=u(Ge.paramsType,h.matchData[Ge.submitValue][Ge.submitName]),Re),{}),J=j.postRequestParams.filter(Re=>Re.submitType==="dynamic").map(Re=>{let Ge={field:Re.submitName,operate:Re.submitMatchType,value:u(Re.paramsType,Re.submitValue)};return z.loadCode===Re.submitName&&(Z!=null&&Z.data.value)&&(Ge.value=Z==null?void 0:Z.data.value),Ge});let Ce={};Object.keys(N).length&&(Ce={...Ce,...N}),Object.keys(q).length&&(Ce={...Ce,...q}),J.length&&(Ce.dynamicFilters=J),z.loadCode&&Reflect.has(Ce,z.loadCode)&&(Ce[z.loadCode]=Z==null?void 0:Z.data.value);const{data:xi}=await a({url:j.fieldRequestUrl,method:j.fieldRequestType||"GET",data:Ce}),Bi=(xi||[]).map(Re=>({label:Re[me],value:Re[de],children:[],isLeaf:Re[v]}));H(Bi)},R=Z=>{if(!["input","textarea"].includes(Z)){if(["multipleSelect","dateRange"].includes(Z))return[];if(["switch"].includes(Z))return!1}},_=(Z,H)=>{if(typeof Z=="string"&&["string"].includes(H))return Z.toString();if(["string"].includes(H))return Z.sort((j,z)=>j.sort-z.sort).join(";");if(["number"].includes(H))return Number(Z);if(["array"].includes(H))return Z.sort((j,z)=>j.sort-z.sort)},S=(Z,H=!1)=>{if(["multipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";").map(z=>H?{value:z}:z):[];if(["virtualizedMultipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";"):[];if(["dateRange","provinceCascade"].includes(Z.fieldType)){const z=Z.fieldKey.split("&");return w.data.rowData[Z.fieldKey]=z.map(me=>w.data.rowData[me]),w.data.rowData[Z.fieldKey]}let j=w.data.rowData[Z.fieldKey];if(["select"].includes(Z.fieldType)){const z=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][z["value-key"]?z["value-key"]:"value"]=="string"&&j!==null&&(j=H?{value:j.toString()}:j.toString())}if(["virtualizedSelect"].includes(Z.fieldType)){const z=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][z["value-key"]?z["value-key"]:"value"]=="string"&&j!==null&&(j=j.toString())}return(j==="true"||j==="false")&&(j=f(j)),j},P=Z=>a({url:w.data.dataItem.requestUrl,method:"post",data:Z});l.watch(()=>w.visible,async(Z,H)=>{var j,z;if(Z)try{g.value=!0;const me=await m(w.data.formList,w.data.rowData,!1,!0);console.log("formList",(j=w.data)==null?void 0:j.formList),k.value=await Promise.all((((z=w.data)==null?void 0:z.formList)??[]).sort((de,ae)=>de.sort-ae.sort).map(async de=>{const ae=me.find(J=>de.fieldName==J.fieldName&&de.fieldKey==J.fieldKey);ae&&(de.dataList=(ae==null?void 0:ae.dataList)??[]),["select","multipleSelect"].includes(de.fieldType)&&(y.value[`${de.fieldKey}ActImplicit`]=Object.keys(w.data.rowData).length&&de.isFormSetValue?S(de,!0):R(de.fieldType)),y.value[de.fieldKey]=Object.keys(w.data.rowData).length&&de.isFormSetValue?S(de):R(de.fieldType),y.value[de.fieldKey]=de.fieldDefaultValue&&!y.value[de.fieldKey]?_(de.fieldDefaultValue,de.fieldSubmitType):y.value[de.fieldKey];const{isFieldCustom:v,customComponentName:N,customComponentUrl:q}=de.customFiledsComponentes;if(v&&!de.customFiledsComponentes[N]){const J=await c(q,N);de.customFiledsComponentes[N]=J}return de})),g.value=!1}catch(me){console.error(me),g.value=!1}});const Q=Z=>{E(),Z()},E=()=>{k.value=[],b.value.resetFields(),O("update:visible",!1)},W=(Z,H)=>{const j=d(H),{fieldKey:z,fieldType:me}=H;if(me==="multipleSelect"){const de=Z.filter(v=>typeof v=="string"),ae=Z.filter(v=>typeof v!="string").map(v=>v.value);y.value[j.createFieldKey]=de.length?_(de,"string"):"",y.value[z]=ae.length?_(ae,"string"):""}else typeof Z=="string"?(y.value[j.createFieldKey]=Z,y.value[z]=""):(y.value[z]=Z.value,delete y.value[j.createFieldKey])},B=(Z,H)=>{const{fieldKey:j,fieldType:z}=H;z==="multipleSelect"?Z===void 0&&(y.value[j]=[]):Z===void 0&&(y.value[j]="")},I=Z=>{Z&&Z.validate(H=>{if(H){const{dataItem:j,rowData:z}=w.data;let me={...l.toRaw(y.value)};p.value=!0,console.log(me),console.log(k.value),Object.keys(me).forEach(v=>{if(v.includes("ActImplicit")){delete me[v];return}const N=k.value.find(q=>q.fieldKey===v);console.log(N),v.includes("&")?v.split("&").forEach((J,Ce)=>{me[J]=me[v]?_(me[v][Ce],N.fieldSubmitType):me[v]}):Array.isArray(me[v])&&(N==null?void 0:N.fieldSubmitType)=="string"&&(me[v]=_(me[v],"string"))});const de=j.submitFields.filter(v=>v.matchType=="default").reduce((v,N)=>(N.submitFieldType==="string"&&(v[N.submitFieldName]=N.matchFieldName.toString()),v),{}),ae=j.submitFields.filter(v=>v.matchType=="match").reduce((v,N)=>(Reflect.has(N,"submitFieldMatchOrigin")&&N.submitFieldMatchOrigin==="selections"?v[N.submitFieldName]=w.data.selections.map(q=>u(N.submitFieldType,q[N.matchFieldName])):Reflect.has(N,"submitFieldMatchOrigin")&&N.submitFieldMatchOrigin!="rowData"?Reflect.has(h.matchData,N.submitFieldMatchOrigin)&&(v[N.submitFieldName]=u(N.submitFieldType,h.matchData[N.submitFieldMatchOrigin][N.matchFieldName])):v[N.submitFieldName]=u(N.submitFieldType,z[N.matchFieldName]),v),{});P({...me,...de,...ae}).then(v=>{try{Ve.ElNotification({title:o("act.tip"),message:o("act.saveSuccessfully"),type:"success",duration:2500}),E(),O("refresh",j)}catch(N){console.error(N)}p.value=!1}).catch(v=>{console.error(v),p.value=!1})}})},G=Z=>{const H=Object.keys(C.value).map(j=>{var z;return(z=C.value[j])==null?void 0:z.updateFormData(y.value)}).filter(j=>j);Promise.all([Z.validate(),...H]).then(j=>{j.every(z=>z)&&I(Z)}).catch(j=>(console.error(j),j))};return(Z,H)=>{var Si;const j=l.resolveComponent("el-input"),z=l.resolveComponent("el-option"),me=l.resolveComponent("el-select"),de=l.resolveComponent("el-select-v2"),ae=l.resolveComponent("el-tree-select"),v=l.resolveComponent("el-date-picker"),N=l.resolveComponent("el-cascader"),q=l.resolveComponent("el-switch"),J=l.resolveComponent("el-form-item"),Ce=l.resolveComponent("el-col"),xi=l.resolveComponent("el-row"),Bi=l.resolveComponent("el-form"),Re=l.resolveComponent("el-button"),Ge=l.resolveComponent("el-dialog"),Ct=l.resolveDirective("loading"),zt=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(Ge,{"model-value":w.visible,title:w.title,top:"5vh",width:(Si=i.data.formConfig)==null?void 0:Si.dialogWidth,draggable:"",overflow:"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!1,"before-close":Q},{footer:l.withCtx(()=>[l.createElementVNode("span",a1,[l.createVNode(Re,{loading:p.value,onClick:E},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.cancel")),1)]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(Re,{type:"primary",loading:p.value,onClick:H[1]||(H[1]=V=>G(b.value))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.save")),1)]),_:1},8,["loading"])),[[zt]])])]),default:l.withCtx(()=>{var V,D;return[l.withDirectives((l.openBlock(),l.createBlock(Bi,{class:"a-form",ref_key:"formRef",ref:b,model:y.value,"label-suffix":":","label-width":(V=i.data.formConfig)==null?void 0:V.formLabelWidth,"label-position":(D=i.data.formConfig)==null?void 0:D.formLabelPosition},{default:l.withCtx(()=>[l.createVNode(xi,{gutter:40},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(k.value,(L,ne)=>(l.openBlock(),l.createBlock(Ce,{span:T(L),key:ne},{default:l.withCtx(()=>[L.customFiledsComponentes.isFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[L.customFiledsComponentes[L.customFiledsComponentes.customComponentName]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(L.customFiledsComponentes[L.customFiledsComponentes.customComponentName]),{key:0,ref_for:!0,ref:fe=>C.value[L.customFiledsComponentes.customComponentName]=fe,formConfig:i.data.formConfig,item:L,rowData:w.data.rowData,visible:w.visible,form:y.value,"onUpdate:form":H[0]||(H[0]=fe=>y.value=fe)},null,40,["formConfig","item","rowData","visible","form"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:ne},[l.createElementVNode("span",l1,"【"+l.toDisplayString(L.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(o)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(J,{key:0,label:L.fieldName,prop:["select","multipleSelect"].includes(L.fieldType)?`${L.fieldKey}ActImplicit`:L.fieldKey,rules:[{required:L.isFormFieldRequired,message:l.unref(o)("act.requiredMessage"),trigger:x(L)}]},{default:l.withCtx(()=>[L.fieldType==="input"?(l.openBlock(),l.createBlock(j,l.mergeProps({key:0,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,clearable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.createCommentVNode("",!0),L.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,clearable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="textarea"?(l.openBlock(),l.createBlock(j,l.mergeProps({key:2,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`,rows:4},{ref_for:!0},l.unref(d)(L),{type:"textarea",disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="selectIcon"?(l.openBlock(),l.createBlock(l.unref(n),l.mergeProps({key:3,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,icons:L.dataList,placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(L.dataList,(fe,Le)=>(l.openBlock(),l.createBlock(z,{key:Le,label:fe.key,value:fe.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","icons","placeholder","disabled"])):["select","multipleSelect"].includes(L.fieldType)?(l.openBlock(),l.createBlock(me,l.mergeProps({key:4,modelValue:y.value[`${L.fieldKey}ActImplicit`],"onUpdate:modelValue":fe=>y.value[`${L.fieldKey}ActImplicit`]=fe,placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`,clearable:"",filterable:"","value-key":"value"},{ref_for:!0},l.unref(d)(L),{multiple:L.fieldType==="multipleSelect",disabled:L.isFormDisabled,onChange:fe=>W(fe,L)}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(L.dataList,(fe,Le)=>(l.openBlock(),l.createBlock(z,{key:Le,label:fe.key,value:fe},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","disabled","onChange"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(L.fieldType)?(l.openBlock(),l.createBlock(de,l.mergeProps({key:5,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,options:L.dataList,props:{...l.unref(nf)},placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`,clearable:"",filterable:""},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled,multiple:L.fieldType==="virtualizedMultipleSelect",onChange:fe=>B(fe,L)}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled","multiple","onChange"])):L.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(ae,l.mergeProps({key:6,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,data:L.dataList,"default-expanded-keys":[y.value[L.fieldKey]||null],placeholder:`请选择${L.fieldName}`,props:{...l.unref(Cr),...l.unref(d)(L).treeProps||{}},"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","data","default-expanded-keys","placeholder","props"])):L.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(ae,l.mergeProps({key:7,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,placeholder:`请选择${L.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(fe,Le)=>A({node:fe,resolve:Le},L)},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):L.fieldType==="date"?(l.openBlock(),l.createBlock(v,l.mergeProps({key:8,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,type:"date",placeholder:`${l.unref(o)("act.selectPlaceholder")}${l.unref(o)("act.time")}`,"value-format":"YYYY-MM-DD HH:mm:ss"},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):L.fieldType==="dateRange"?(l.openBlock(),l.createBlock(v,l.mergeProps({key:9,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,type:"daterange","start-placeholder":l.unref(o)("act.startTime"),"end-placeholder":l.unref(o)("act.endTime"),"value-format":"YYYY-MM-DD HH:mm:ss"},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder","disabled"])):L.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(N,l.mergeProps({key:10,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,options:L.dataList,props:l.unref(tf),clearable:"",filterable:"",placeholder:`${l.unref(o)("act.selectPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L),{disabled:L.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled"])):L.fieldType==="switch"?(l.openBlock(),l.createBlock(q,l.mergeProps({key:11,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,"active-value":!0,"inactive-value":!1},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue"])):L.fieldType==="upload"?(l.openBlock(),l.createBlock(l.unref(s),l.mergeProps({key:12,class:"form-upload",modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,request:l.unref(a)},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","request"])):L.fieldType==="editor"?(l.openBlock(),l.createBlock(l.unref(r),l.mergeProps({key:13,modelValue:y.value[L.fieldKey],"onUpdate:modelValue":fe=>y.value[L.fieldKey]=fe,disabled:L.isFormDisabled,placeholder:`${l.unref(o)("act.inputPlaceholder")}${L.fieldName}`},{ref_for:!0},l.unref(d)(L)),null,16,["modelValue","onUpdate:modelValue","disabled","placeholder"])):l.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))]),_:2},1032,["span"]))),128))]),_:1})]),_:1},8,["model","label-width","label-position"])),[[Ct,g.value]])]}),_:1},8,["model-value","title","width"])}}},[["__scopeId","data-v-f23c8fd2"]])},Symbol.toStringTag,{value:"Module"})),aE="",u1=["innerHTML"],h1={class:"dialog-footer"},f1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const{t}=Kt(),n=e,s=i,r=()=>({loading:!1});let o=l.reactive(r());l.watch(()=>s.visible,async(u,h)=>{u&&(o.loading=!0,o.loading=!1)});const a=u=>{c(),u()},c=()=>{n("update:visible",!1)};return(u,h)=>{const f=l.resolveComponent("el-button"),d=l.resolveComponent("el-dialog");return l.openBlock(),l.createBlock(d,{"model-value":s.visible,title:s.title,top:"5vh",width:800,"append-to-body":"","destroy-on-close":"",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":a},{footer:l.withCtx(()=>[l.createElementVNode("span",h1,[l.createVNode(f,{onClick:c},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(t)("act.cancel")),1)]),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:i.data.editorContent},null,8,u1)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-95be1288"]])},Symbol.toStringTag,{value:"Module"})),hE="",d1={class:"dialog-footer"},p1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"dialogConfigBtn",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>hf)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>u_)),s=on.useRoute(),r=l.inject("apiPrefix"),o=l.inject("request"),a=e,c=i,u=l.computed(()=>s.params.key),h=()=>({btnLoading:!1});let f=l.reactive(h());const d=l.inject("createDefaultButtonItem"),m=l.inject("associationMenuList"),O=l.inject("conditionList")();let w=l.ref([]),g=l.ref(null),p=l.ref(d());const b=Q=>o({url:`${r}/icons/getAllList`,method:"post",data:Q}),k=async()=>{try{const{data:Q}=await b({dynamicFilters:[{field:"type",operate:"Equal",value:"2"}]});w.value=Q||[]}catch(Q){console.error(Q)}};l.watch(()=>c.visible,async(Q,E)=>{if(Q){await k();const W={...c.data};Object.keys(p.value).forEach(B=>{B=="submitFields"||B=="matchFields"?p.value[B]=[...W[B]||[]]:B=="isPromptVerificationSelectTable"?p.value[B]=W[B]??"1":p.value[B]=W[B]})}});const y=()=>{p.value.submitWay=void 0,p.value.customType=void 0,p.value.codeStr=void 0,p.value.customComponentName=void 0,p.value.customComponentUrl=void 0},C=()=>{p.value.submitFields.push({matchType:"match",submitFieldMatchOrigin:"rowData",submitFieldName:"",matchFieldName:"",submitFieldType:""})},T=Q=>{p.value.submitFields.splice(Q,1)},x=()=>{p.value.matchFields.push({matchType:"default",matchFieldName:"",matchCondition:"",fieldValue:"",spliceCondition:""})},A=Q=>{p.value.matchFields.splice(Q,1),p.value.matchFields.length===1&&(p.value.matchFields[0].spliceCondition="")},R=(Q,E)=>{Q.submitFieldMatchOrigin=E==="match"?"rowData":""},_=Q=>{S(),Q()},S=()=>{p.value=Object.assign(p.value,d()),g.value.resetFields(),a("update:visible",!1)},P=Q=>{Q&&Q.validate(E=>{if(E)try{f.btnLoading=!0,a("refresh",{...p.value,submitFields:[...p.value.submitFields],matchFields:[...p.value.matchFields]},()=>{S()}),f.btnLoading=!1}catch(W){console.error(W),f.btnLoading=!1}})};return(Q,E)=>{const W=l.resolveComponent("el-input"),B=l.resolveComponent("el-form-item"),I=l.resolveComponent("el-col"),G=l.resolveComponent("el-option"),Z=l.resolveComponent("el-select"),H=l.resolveComponent("el-row"),j=l.resolveComponent("el-button"),z=l.resolveComponent("el-divider"),me=l.resolveComponent("el-switch"),de=l.resolveComponent("el-form"),ae=l.resolveComponent("el-dialog"),v=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(ae,{"model-value":c.visible,title:c.title,top:"5vh",width:"1200",draggable:"",overflow:"","append-to-body":"","append-to":"body","close-on-click-modal":!1,"before-close":_},{footer:l.withCtx(()=>[l.createElementVNode("span",d1,[l.createVNode(j,{loading:l.unref(f).btnLoading,onClick:S},{default:l.withCtx(()=>[...E[20]||(E[20]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(j,{type:"primary",loading:l.unref(f).btnLoading,onClick:E[17]||(E[17]=N=>P(l.unref(g)))},{default:l.withCtx(()=>[...E[21]||(E[21]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[v]])])]),default:l.withCtx(()=>[l.createVNode(de,{ref_key:"formRef",ref:g,model:l.unref(p),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(H,{gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮",prop:"btnName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).btnName,"onUpdate:modelValue":E[0]||(E[0]=N=>l.unref(p).btnName=N),disabled:"",placeholder:"请输入按钮名称"},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(p).permissionCode),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮图标",prop:"btnIcon"},{default:l.withCtx(()=>[l.createVNode(l.unref(t),{modelValue:l.unref(p).btnIcon,"onUpdate:modelValue":E[1]||(E[1]=N=>l.unref(p).btnIcon=N),icons:l.unref(w),props:{value:"name",type:"btn"}},null,8,["modelValue","icons"])]),_:1})]),_:1}),l.createVNode(I,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"接口地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"requestUrl"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).requestUrl,"onUpdate:modelValue":E[2]||(E[2]=N=>l.unref(p).requestUrl=N),placeholder:"请输入接口地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮位置",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnPostion"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnPostion,"onUpdate:modelValue":E[3]||(E[3]=N=>l.unref(p).btnPostion=N),placeholder:"请选择按钮位置",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Sy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnType,"onUpdate:modelValue":E[4]||(E[4]=N=>l.unref(p).btnType=N),placeholder:"请选择按钮类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(xy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮别名",prop:"btnAlias"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).btnAlias,"onUpdate:modelValue":E[5]||(E[5]=N=>l.unref(p).btnAlias=N),placeholder:"请输入按钮别名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮颜色",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnColor"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).btnColor,"onUpdate:modelValue":E[6]||(E[6]=N=>l.unref(p).btnColor=N),placeholder:"请选择按钮颜色",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(I,{key:0,span:12},{default:l.withCtx(()=>[!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(B,{key:0,label:"提交方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitWay"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).submitWay,"onUpdate:modelValue":E[7]||(E[7]=N=>l.unref(p).submitWay=N),placeholder:"请选择提交方式",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ay),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):l.createCommentVNode("",!0)]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["import","batchImport"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:1,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入提交文件字段",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importFileName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).importFileName,"onUpdate:modelValue":E[8]||(E[8]=N=>l.unref(p).importFileName=N),placeholder:"请输入导入提交文件字段",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["import","batchImport"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:2,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入Accept",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importAccept"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).importAccept,"onUpdate:modelValue":E[9]||(E[9]=N=>l.unref(p).importAccept=N),placeholder:"请输入导入Accept",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"&&["messageBox","executeApi"].includes(l.unref(p).submitWay)?(l.openBlock(),l.createBlock(I,{key:3,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"是否提示校验选择表格",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"isPromptVerificationSelectTable"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).isPromptVerificationSelectTable,"onUpdate:modelValue":E[10]||(E[10]=N=>l.unref(p).isPromptVerificationSelectTable=N),placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(vy),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(z,{"content-position":"left"},{default:l.withCtx(()=>[E[18]||(E[18]=l.createTextVNode(" 提交字段配置 ",-1)),l.createVNode(j,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:C})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).submitFields,(N,q)=>(l.openBlock(),l.createBlock(H,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.submitFieldName,"onUpdate:modelValue":J=>N.submitFieldName=J,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:8},{default:l.withCtx(()=>[l.createVNode(B,{label:"方式","label-width":"80px",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{placeholder:"请输入",modelValue:N.matchFieldName,"onUpdate:modelValue":J=>N.matchFieldName=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchType,"onUpdate:modelValue":J=>N.matchType=J,placeholder:"请选择",style:{width:"120px"},onChange:J=>R(N,J)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Qy),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),N.matchType==="match"?(l.openBlock(),l.createBlock(I,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配源",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldMatchOrigin"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.submitFieldMatchOrigin,"onUpdate:modelValue":J=>N.submitFieldMatchOrigin=J,placeholder:"请输入匹配源",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(I,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitFields."+q+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.submitFieldType,"onUpdate:modelValue":J=>N.submitFieldType=J,placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ty),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(j,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>T(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(z,{"content-position":"left"},{default:l.withCtx(()=>[E[19]||(E[19]=l.createTextVNode(" 匹配字段配置(表格操作列按钮显示/隐藏) ",-1)),l.createVNode(j,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:x})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).matchFields,(N,q)=>(l.openBlock(),l.createBlock(H,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(I,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"matchFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(W,{placeholder:"请输入",modelValue:N.matchFieldName,"onUpdate:modelValue":J=>N.matchFieldName=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchType,"onUpdate:modelValue":J=>N.matchType=J,placeholder:"请选择",style:{width:"180px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ey),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"matchFields."+q+".matchCondition"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.matchCondition,"onUpdate:modelValue":J=>N.matchCondition=J,placeholder:"请选择匹配条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(O),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"字段值",prop:"matchFields."+q+".fieldValue"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:N.fieldValue,"onUpdate:modelValue":J=>N.fieldValue=J,placeholder:"请输入字段值",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(I,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(j,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>A(q)},null,8,["onClick"])]),_:2},1024),q+1!==l.unref(p).matchFields.length?(l.openBlock(),l.createBlock(I,{key:0,span:24},{default:l.withCtx(()=>[l.createVNode(B,{class:"condition-box",label:"","label-width":"0",prop:"matchFields."+q+".spliceCondition"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:N.spliceCondition,"onUpdate:modelValue":J=>N.spliceCondition=J,placeholder:"请选择拼接条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Py),(J,Ce)=>(l.openBlock(),l.createBlock(G,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128)),l.createVNode(H,{gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义按钮",prop:"isCustomBtn"},{default:l.withCtx(()=>[l.createVNode(me,{modelValue:l.unref(p).isCustomBtn,"onUpdate:modelValue":E[11]||(E[11]=N=>l.unref(p).isCustomBtn=N),onChange:y},null,8,["modelValue"])]),_:1})]),_:1}),l.unref(p).isCustomBtn?(l.openBlock(),l.createBlock(I,{key:0,span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"customType"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).customType,"onUpdate:modelValue":E[12]||(E[12]=N=>l.unref(p).customType=N),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref($y),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(I,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"关联菜单"},{default:l.withCtx(()=>[l.createVNode(Z,{modelValue:l.unref(p).associationMenuId,"onUpdate:modelValue":E[13]||(E[13]=N=>l.unref(p).associationMenuId=N),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m),(N,q)=>(l.openBlock(),l.createBlock(G,{key:q,label:N.name,value:N.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.unref(p).customType==="code"?(l.openBlock(),l.createBlock(H,{key:0,gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"代码片段",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"codeStr"},{default:l.withCtx(()=>[l.createVNode(l.unref(n),{modelValue:l.unref(p).codeStr,"onUpdate:modelValue":E[14]||(E[14]=N=>l.unref(p).codeStr=N)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(p).customType==="component"?(l.openBlock(),l.createBlock(H,{key:1,gutter:24},{default:l.withCtx(()=>[l.createVNode(I,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentName"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).customComponentName,"onUpdate:modelValue":E[15]||(E[15]=N=>l.unref(p).customComponentName=N),placeholder:"请输入组件名称",clearable:""},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(u.value),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(I,{span:14},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentUrl"},{default:l.withCtx(()=>[l.createVNode(W,{modelValue:l.unref(p).customComponentUrl,"onUpdate:modelValue":E[16]||(E[16]=N=>l.unref(p).customComponentUrl=N),placeholder:"请输入组件地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-2debd2c2"]])},Symbol.toStringTag,{value:"Module"})),pE="",m1={slot:"prepend"},g1={class:"dialog-footer"},O1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"dialogAddField",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},data:{type:Object,default:()=>({})}},emits:["update:visible","refresh"],setup(i,{emit:e}){const t=l.defineAsyncComponent(()=>Promise.resolve().then(()=>SQ)),n=e,s=i,r=l.inject("pageKey")(),o=l.inject("conditionList")(),a=l.inject("configData")(),c=()=>({btnLoading:!1,showSiteComponentsParamsDialog:!1});let u=l.reactive(c());const h=()=>({sort:0,fieldName:void 0,fieldKey:void 0,fieldType:void 0,fieldUiProps:"",fieldSubmitType:"string",fieldRequestType:"GET",fieldRequestUrl:void 0,postRequestParams:[],useScenes:[],formColumnCol:12,fieldDefaultValue:"",formCustomComponentes:[],customTableHeaderName:"",customTableHeaderUrl:"",isFormFieldRequired:!0,isFormSetValue:!0,isFormDisabled:!1,tableQueryCondition:void 0,tableQueryDefaultValue:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),f=lf,d=l.ref(null),m=l.ref(h()),O=()=>["select","selectIcon","multipleSelect","treeSelect","provinceCascade","switch","virtualizedSelect","virtualizedMultipleSelect"].includes(m.value.fieldType),w=()=>m.value.useScenes.includes("tableSearch")&&m.value.fieldType!=="time",g=()=>m.value.useScenes.includes("tableShow"),p=()=>m.value.fieldType&&m.value.fieldType!=="implicit"&&m.value.useScenes.some(_=>!["tableSearch","tableShow"].some(S=>S==_));l.watch(()=>s.visible,async(_,S)=>{if(_){const P=(a.value.buttons||[]).filter(E=>E.permissionCode!=1001).map(E=>({key:E.btnName,value:E.permissionCode}));f.some(E=>{if(E.label==="表单配置")return E.options=P,!0});const{data:Q}=s;if(!Q.fieldName)return;Object.keys(m.value).forEach(E=>{if(E=="permissionCode")m.value[E]=Q.unique;else if(E=="formCustomComponentes"){const W=Q.useScenes.map(B=>Q[E].find(G=>G.permissionCode==B)||{});m.value[E]=[...W]}else["postRequestParams","useScenes"].includes(E)?m.value[E]=[...Q[E]||[]]:m.value[E]=Q[E]})}});const b=()=>{m.value.postRequestParams.push({submitName:"",submitValue:"",submitType:"default",submitMatchType:"",paramsType:""})},k=_=>{m.value.postRequestParams.splice(_,1)},y=_=>{m.value.postRequestParams=[]},C=_=>{const S=f.find(Q=>Q.label==="表格配置").options,P=f.find(Q=>Q.label==="表单配置").options;m.value.formCustomComponentes=[...S,...P].filter(Q=>_.includes(Q.value)).map(Q=>{const E=m.value.formCustomComponentes.find(W=>W.permissionCode==Q.value);return{btnName:Q.key,permissionCode:Q.value,pageKey:r,customComponentName:(E==null?void 0:E.customComponentName)||void 0,customComponentUrl:(E==null?void 0:E.customComponentUrl)||void 0,isFieldCustom:(E==null?void 0:E.isFieldCustom)||!1}})},T=(_,S)=>{S.customComponentName=void 0,S.customComponentUrl=void 0},x=_=>{A(),_()},A=()=>{m.value=h(),d.value.resetFields(),n("update:visible",!1)},R=_=>{_&&_.validate(S=>{S&&(u.btnLoading=!0,m.value.formCustomComponentes.forEach(P=>{delete P.isFiledCustom}),n("refresh",JSON.parse(JSON.stringify(m.value)),()=>{A()}),u.btnLoading=!1)})};return(_,S)=>{const P=l.resolveComponent("el-input"),Q=l.resolveComponent("el-form-item"),E=l.resolveComponent("el-col"),W=l.resolveComponent("el-option"),B=l.resolveComponent("el-select"),I=l.resolveComponent("el-button"),G=l.resolveComponent("el-row"),Z=l.resolveComponent("el-divider"),H=l.resolveComponent("el-option-group"),j=l.resolveComponent("el-switch"),z=l.resolveComponent("el-input-number"),me=l.resolveComponent("el-form"),de=l.resolveComponent("el-scrollbar"),ae=l.resolveComponent("el-dialog"),v=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(ae,{"model-value":s.visible,title:s.title,top:"5vh",width:"1400",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":x},{footer:l.withCtx(()=>[l.createElementVNode("span",g1,[l.createVNode(I,{onClick:A,loading:l.unref(u).btnLoading},{default:l.withCtx(()=>[...S[30]||(S[30]=[l.createTextVNode("取消",-1)])]),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(I,{type:"primary",loading:l.unref(u).btnLoading,onClick:S[23]||(S[23]=N=>R(d.value))},{default:l.withCtx(()=>[...S[31]||(S[31]=[l.createTextVNode("保存",-1)])]),_:1},8,["loading"])),[[v]])])]),default:l.withCtx(()=>[l.createVNode(de,{ref:"configFieldsScroll","max-height":"800px"},{default:l.withCtx(()=>[l.createVNode(me,{ref_key:"formRef",ref:d,model:m.value,"label-suffix":":","label-width":"120px"},{default:l.withCtx(()=>[l.createVNode(G,null,{default:l.withCtx(()=>[l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldName"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldName,"onUpdate:modelValue":S[0]||(S[0]=N=>m.value.fieldName=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段key",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldKey"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldKey,"onUpdate:modelValue":S[1]||(S[1]=N=>m.value.fieldKey=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"字段类型",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldType,"onUpdate:modelValue":S[2]||(S[2]=N=>m.value.fieldType=N),placeholder:"请选择",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(rf),N=>(l.openBlock(),l.createBlock(W,{key:N.value,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:4},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件参数",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(I,{type:"primary",onClick:S[3]||(S[3]=N=>l.unref(u).showSiteComponentsParamsDialog=!0)},{default:l.withCtx(()=>[...S[24]||(S[24]=[l.createTextVNode("设置props",-1)])]),_:1}),l.createVNode(l.unref(t),{modelValue:m.value.fieldUiProps,"onUpdate:modelValue":S[4]||(S[4]=N=>m.value.fieldUiProps=N),visible:l.unref(u).showSiteComponentsParamsDialog,"onUpdate:visible":S[5]||(S[5]=N=>l.unref(u).showSiteComponentsParamsDialog=N),title:"设置组件参数"},null,8,["modelValue","visible"])]),_:1})]),_:1})]),_:1}),O()?(l.openBlock(),l.createBlock(G,{key:0},{default:l.withCtx(()=>[l.createVNode(E,{span:24},{default:l.withCtx(()=>[l.createVNode(Q,{label:"数据源",prop:"fieldRequestUrl"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入",modelValue:m.value.fieldRequestUrl,"onUpdate:modelValue":S[7]||(S[7]=N=>m.value.fieldRequestUrl=N),clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldRequestType,"onUpdate:modelValue":S[6]||(S[6]=N=>m.value.fieldRequestType=N),placeholder:"请选择",style:{width:"150px"},onChange:y},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ny),N=>(l.openBlock(),l.createBlock(W,{key:N.value,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),m.value.fieldRequestType=="POST"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[S[25]||(S[25]=l.createTextVNode(" POST参数配置 ",-1)),l.createVNode(I,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:b})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.postRequestParams,(N,q)=>(l.openBlock(),l.createBlock(G,{key:q},{default:l.withCtx(()=>[l.createVNode(E,{span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitName"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.submitName,"onUpdate:modelValue":J=>N.submitName=J,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(E,{span:8},{default:l.withCtx(()=>[l.createVNode(Q,{label:"方式",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitValue"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入值",modelValue:N.submitValue,"onUpdate:modelValue":J=>N.submitValue=J,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:N.submitType,"onUpdate:modelValue":J=>N.submitType=J,placeholder:"请选择方式",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ry),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),N.submitType==="dynamic"?(l.openBlock(),l.createBlock(E,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitMatchType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:N.submitMatchType,"onUpdate:modelValue":J=>N.submitMatchType=J,placeholder:"请选择方式",clearable:"",filterable:"",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(E,{span:5},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"postRequestParams."+q+".paramsType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:N.paramsType,"onUpdate:modelValue":J=>N.paramsType=J,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(of),(J,Ce)=>(l.openBlock(),l.createBlock(W,{key:Ce,label:J.key,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(E,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(I,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:J=>k(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128))],64)):l.createCommentVNode("",!0),l.createVNode(G,null,{default:l.withCtx(()=>[l.createVNode(E,{span:24},{default:l.withCtx(()=>[l.createVNode(Q,{label:"使用场景",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"useScenes"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.useScenes,"onUpdate:modelValue":S[8]||(S[8]=N=>m.value.useScenes=N),placeholder:"请选择",multiple:"",clearable:"",filterable:"",onChange:C},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f),N=>(l.openBlock(),l.createBlock(H,{key:N.label,label:N.label},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(N.options,q=>(l.openBlock(),l.createBlock(W,{key:q.key,label:q.key,value:q.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),w()?(l.openBlock(),l.createBlock(G,{key:2},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[26]||(S[26]=[l.createTextVNode("查询模块",-1)])]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"查询条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableQueryCondition"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableQueryCondition,"onUpdate:modelValue":S[9]||(S[9]=N=>m.value.tableQueryCondition=N),placeholder:"请选择查询条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"tableQueryDefaultValue"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.tableQueryDefaultValue,"onUpdate:modelValue":S[10]||(S[10]=N=>m.value.tableQueryDefaultValue=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),g()?(l.openBlock(),l.createBlock(G,{key:3},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[27]||(S[27]=[l.createTextVNode("表格模块",-1)])]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"列宽",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"tableCellWidth"},{default:l.withCtx(()=>[l.createVNode(P,{placeholder:"请输入",modelValue:m.value.tableCellWidth,"onUpdate:modelValue":S[12]||(S[12]=N=>m.value.tableCellWidth=N)},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellWidthType,"onUpdate:modelValue":S[11]||(S[11]=N=>m.value.tableCellWidthType=N),placeholder:"请选择",style:{width:"100px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Dy),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"对齐方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellAlignType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellAlignType,"onUpdate:modelValue":S[13]||(S[13]=N=>m.value.tableCellAlignType=N),placeholder:"请选择对齐方式",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ly),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"内容类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellContentType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellContentType,"onUpdate:modelValue":S[14]||(S[14]=N=>m.value.tableCellContentType=N),placeholder:"请选择内容类型",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(My),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:"溢出隐藏",prop:"isTableCellOverflowTooltip"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isTableCellOverflowTooltip,"onUpdate:modelValue":S[15]||(S[15]=N=>m.value.isTableCellOverflowTooltip=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:"排序",prop:"isTableCellSort"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isTableCellSort,"onUpdate:modelValue":S[16]||(S[16]=N=>m.value.isTableCellSort=N)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),p()?(l.openBlock(),l.createBlock(G,{key:4},{default:l.withCtx(()=>[l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[28]||(S[28]=[l.createTextVNode("表单模块",-1)])]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否必填",prop:"isFormFieldRequired"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormFieldRequired,"onUpdate:modelValue":S[17]||(S[17]=N=>m.value.isFormFieldRequired=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否回显",prop:"isFormSetValue"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormSetValue,"onUpdate:modelValue":S[18]||(S[18]=N=>m.value.isFormSetValue=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:3},{default:l.withCtx(()=>[l.createVNode(Q,{label:"是否禁用",prop:"isFormDisabled"},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:m.value.isFormDisabled,"onUpdate:modelValue":S[19]||(S[19]=N=>m.value.isFormDisabled=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"fieldSubmitType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldSubmitType,"onUpdate:modelValue":S[20]||(S[20]=N=>m.value.fieldSubmitType=N),placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Vy),(N,q)=>(l.openBlock(),l.createBlock(W,{key:q,label:N.key,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"栅格数",prop:"formColumnCol"},{default:l.withCtx(()=>[l.createVNode(z,{modelValue:m.value.formColumnCol,"onUpdate:modelValue":S[21]||(S[21]=N=>m.value.formColumnCol=N),max:24},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(E,{span:6},{default:l.withCtx(()=>[l.createVNode(Q,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"fieldDefaultValue"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:m.value.fieldDefaultValue,"onUpdate:modelValue":S[22]||(S[22]=N=>m.value.fieldDefaultValue=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(Z,{"content-position":"left"},{default:l.withCtx(()=>[...S[29]||(S[29]=[l.createTextVNode("不同场景自定义字段组件",-1)])]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.formCustomComponentes,(N,q)=>(l.openBlock(),l.createBlock(G,{key:q},{default:l.withCtx(()=>[l.createVNode(E,{span:2},{default:l.withCtx(()=>[l.createVNode(Q,{label:`${N.btnName}`,prop:`formCustomComponentes.${q}.isFieldCustom`},{default:l.withCtx(()=>[l.createVNode(j,{modelValue:N.isFieldCustom,"onUpdate:modelValue":J=>N.isFieldCustom=J,onChange:J=>T(J,N)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","prop"])]),_:2},1024),N.isFieldCustom?(l.openBlock(),l.createBlock(E,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件名称","label-width":"220",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentName`},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.customComponentName,"onUpdate:modelValue":J=>N.customComponentName=J,placeholder:"请输入",clearable:""},{default:l.withCtx(()=>[l.createElementVNode("template",m1,[l.createTextVNode(l.toDisplayString(l.unref(r)),1)])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),N.isFieldCustom?(l.openBlock(),l.createBlock(E,{key:1,span:14},{default:l.withCtx(()=>[l.createVNode(Q,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentUrl`},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:N.customComponentUrl,"onUpdate:modelValue":J=>N.customComponentUrl=J,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["model"])]),_:1},512)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-571cf929"]])},Symbol.toStringTag,{value:"Module"})),uf=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"index",props:{modelValue:{type:String}},emits:["update:modelValue"],setup(i,{emit:e}){const t=e,n=i,s=l.computed({get(){return n.modelValue},set(a){t("update:modelValue",a)}}),r=a=>{let c=a.charAt(0);return a=a.replace(/[^\d.]/g,""),a=a.replace(/^\./g,""),a=a.replace(/\.{2,}/g,"."),a=a.replace(".","$#$").replace(/\./g,"").replace("$#$","."),c=="-"&&(a="-"+a),a},o=a=>{s.value=r(a)};return(a,c)=>{const u=l.resolveComponent("el-input");return l.openBlock(),l.createBlock(u,l.mergeProps({modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=h=>s.value=h),modelModifiers:{number:!0},placeholder:"Please input"},a.$attrs,{onInput:o}),null,16,["modelValue"])}}}},Symbol.toStringTag,{value:"Module"})),_E="",bE="",_1={class:"select-icon-container"},b1={class:"icon-list"},y1=["onClick"],w1={class:"icon-value",slot:"reference"},hf=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{modelValue:{type:String,default:""},icons:{type:Array,default:()=>[]},props:{type:Object,default:()=>({value:"value",type:"btn"})}},emits:["update:modelValue"],setup(i,{emit:e}){const t=e,n=i;let s=l.ref(!1),r=l.ref(-1),o=l.ref([]);const a=()=>r.value==-1?"":o.value[r.value];l.watch(()=>n.icons,(u,h)=>{u&&(o.value=(n.icons||[]).map(f=>{const{props:d}=n;return Reflect.has(f,d.value)?`${d.type}-${f[d.value]}`:`${d.type}-${f}`}))},{deep:!0,immediate:!0}),l.watch(()=>n.modelValue,(u,h)=>{if(!u){r.value=-1,t("update:modelValue","");return}const f=o.value.findIndex(d=>d===u);r.value=f},{deep:!0,immediate:!0});const c=(u,h)=>{r.value=h,t("update:modelValue",a()),s.value=!1};return(u,h)=>{const f=l.resolveComponent("a-svg-icon"),d=l.resolveComponent("el-button"),m=l.resolveComponent("el-popover");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(m,{"popper-class":"select-icon-popover",placement:"bottom-start",visible:l.unref(s),"onUpdate:visible":h[0]||(h[0]=O=>l.isRef(s)?s.value=O:s=O),width:400,trigger:"click"},{reference:l.withCtx(()=>[l.createElementVNode("div",w1,[l.unref(r)>=0?(l.openBlock(),l.createBlock(f,{key:0,name:n.modelValue,width:"24",height:"24",color:"#000"},null,8,["name"])):l.createCommentVNode("",!0),l.createVNode(d,{class:"icon-btn",type:"primary"},{default:l.withCtx(()=>[...h[1]||(h[1]=[l.createTextVNode("选择图标",-1)])]),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("ul",b1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(O,w)=>(l.openBlock(),l.createElementBlock("li",{class:l.normalizeClass(["icon-item",{"icon-item-checked":l.unref(r)==w}]),key:w,onClick:g=>c(O,w)},[l.createVNode(f,{class:"icon-svg",name:O,width:"24",height:"24",color:"#999"},null,8,["name"])],10,y1))),128))])]),_:1},8,["visible"])])}}},[["__scopeId","data-v-308d02d4"]])},Symbol.toStringTag,{value:"Module"}));let Pr;const k1=new Uint8Array(16);function x1(){if(!Pr&&(Pr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pr(k1)}const ut=[];for(let i=0;i<256;++i)ut.push((i+256).toString(16).slice(1));function S1(i,e=0){return ut[i[e+0]]+ut[i[e+1]]+ut[i[e+2]]+ut[i[e+3]]+"-"+ut[i[e+4]]+ut[i[e+5]]+"-"+ut[i[e+6]]+ut[i[e+7]]+"-"+ut[i[e+8]]+ut[i[e+9]]+"-"+ut[i[e+10]]+ut[i[e+11]]+ut[i[e+12]]+ut[i[e+13]]+ut[i[e+14]]+ut[i[e+15]]}const ff={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function C1(i,e,t){if(ff.randomUUID&&!e&&!i)return ff.randomUUID();i=i||{};const n=i.random||(i.rng||x1)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=n[s];return e}return S1(n)}const xE="",A1={class:"upload-container"},T1={class:"el-upload__text"},P1={class:"tip-text"},Q1={class:"file-list-l"},E1=["onMouseenter","onMouseleave"],$1={class:"el-file-operate"},N1=Object.freeze(Object.defineProperty({__proto__:null,default:ct({__name:"index",props:{request:{type:Function,required:!0,default:null},modelValue:{type:[Array,String],default:[]},action:{type:String,default:"/api/v1/utils/uploadFiles"},data:{type:Object,default:()=>({uploadFileType:1})},name:{type:String,default:"files"},multiple:{type:Boolean,default:!0},limit:{type:Number,default:9},accept:{type:String,default:"*"},tipText:{type:String,default:""},fileMaxSize:{type:Number,default:100},autoUpload:{type:Boolean,default:!0}},emits:["update:modelValue","delete"],setup(i,{expose:e,emit:t}){const{getAssetsFileName:n,getAssetsFilePath:s,downloadFile:r}=ef(),{t:o}=Kt(),a=t,c=i,u={image:/^(gif|jpg|jpeg|png|bmp|webp)$/i,word:/^(doc|docx|DOC|DOCX)$/i,pdf:/^(pdf|PDF)$/i,excel:/^(xls|xlsx|XLS|XLSX)$/i};let h=l.ref(!1),f=l.ref({}),d=l.ref(!1),m=l.ref(null),O=null,w=l.computed({get(){return C(c.modelValue)},set(B){a("update:modelValue",B)}});const g=B=>{const I=(w.value||[]).map(H=>H.filePath);if(B==0)return I;let G=I.splice(B),Z=I.splice(0,B);return G.concat(Z)},p=B=>{if(!B||typeof B!="string")return"";const I=B.split("?")[0].split("#")[0],G=I.lastIndexOf(".");return G<0?"":I.slice(G+1).toLowerCase()},b=(...B)=>{for(const I of B){const G=`${I||""}`.trim();if(!G)continue;const Z=G.startsWith(".")?G.slice(1).toLowerCase():G.toLowerCase();if(Z==="image")return"image";if(Object.keys(u).includes(Z))return Z;const H=p(G)||Z;let j=null;if(Object.keys(u).some(z=>{if(u[z].test(H))return j=z,!0}),j)return j}return"file"},k=B=>{var H,j;const I=typeof B=="string"?{filePath:B}:B||{},G=I.filePath||I.url||"",Z=I.name||I.fileName||n(G)||((H=I.raw)==null?void 0:H.name)||"";return{...I,uid:I.uid??C1(),name:Z,filePath:G,fileType:b(I.fileType,Z,G,(j=I.raw)==null?void 0:j.name),status:I.status??"success"}},y=(B=[])=>B.filter(Boolean).map(I=>k(I)),C=B=>{const I=Array.isArray(B)?B:B?B.split(";").filter(Boolean):[];return y(I)},T=({name:B})=>{const I=B.lastIndexOf("."),G=B.slice(I),Z=c.accept.trim().split(",");let H=!1;return Z.includes(G)&&(H=!0),H=Z.some(j=>j=="image/*"?u.image.test(G):j.startsWith(".")?B.endsWith(j):j===G),H||Ve.ElNotification({title:`${o("act.tip")}`,message:`【${B}】${o("act.uploadErrorTip")}`,type:"warning",duration:2500}),H},x=(B,I,G)=>{O&&(clearTimeout(O),O=null),O=setTimeout(()=>{B.call(this,I)},G)},A=B=>c.request({url:c.action,method:"POST",data:B,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),R=async B=>{try{const I=B.filter(z=>z.status=="ready"&&T(z)),G=w.value.length+I.length;if(I.length===0){m.value.clearFiles();return}if(G>c.limit){Ve.ElNotification({title:`${o("act.tip")}`,message:`${o("act.uploadLimitTip")}`,type:"warning",duration:2500}),m.value.clearFiles();return}if(!c.autoUpload){const z=I.map(me=>({...me,filePath:null,status:"success"}));a("update:modelValue",z),m.value.clearFiles();return}h.value=!0;const Z=new FormData;Object.keys(c.data).forEach(z=>{Z.append(z,c.data[z])}),I.forEach(z=>{Z.append(c.name,z.raw)});let{data:H}=await A(Z);const j=c.multiple?[...w.value.map(z=>z.filePath),...H.filePaths||[]].join(";"):[...H.filePaths||[]].join(";");m.value.clearFiles(),a("update:modelValue",j),h.value=!1}catch(I){m.value.clearFiles(),h.value=!1,console.error(I)}},_=(B,I)=>{x(R,I,500)},S=(B,I)=>{const G=f.value[`tooltipRef${I}`];d.value=G.scrollWidth<=Math.round(G.getBoundingClientRect().width)},P=({filePath:B,name:I,uid:G},Z)=>{l.nextTick(()=>{document.querySelector(`.previewImage_${G}`).children[0].click()})},Q=({filePath:B,name:I})=>{r(c.request,B)},E=(B,I)=>{w.value=w.value.filter((G,Z)=>Z!==I),a("delete",{data:B})};return e({clearFiles:()=>{w.value=[],m.value.clearFiles()}}),(B,I)=>{const G=l.resolveComponent("upload-filled"),Z=l.resolveComponent("el-icon"),H=l.resolveComponent("el-upload"),j=l.resolveComponent("el-image"),z=l.resolveComponent("el-tooltip"),me=l.resolveComponent("el-button"),de=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",A1,[l.withDirectives((l.openBlock(),l.createBlock(H,l.mergeProps({ref_key:"uploadRef",ref:m,action:"#",drag:"",accept:c.accept,multiple:c.multiple,"auto-upload":!1,"show-file-list":!1,"on-change":_},B.$attrs,{"element-loading-text":l.unref(o)("act.uploadLoading")}),{tip:l.withCtx(()=>[c.tipText?l.renderSlot(B.$slots,"default",{key:0},()=>[l.createElementVNode("p",P1,l.toDisplayString(c.tipText),1)],!0):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createVNode(Z,{class:"el-icon--upload"},{default:l.withCtx(()=>[l.createVNode(G)]),_:1}),l.createElementVNode("div",T1,[l.createTextVNode(l.toDisplayString(l.unref(o)("act.uploadText")),1),l.createElementVNode("em",null,l.toDisplayString(l.unref(o)("act.clickUpload")),1)])]),_:3},16,["accept","multiple","element-loading-text"])),[[de,l.unref(h)]]),l.renderSlot(B.$slots,"default",{},()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(ae,v)=>(l.openBlock(),l.createElementBlock("div",{class:"file-list",key:ae.uid},[l.createElementVNode("div",Q1,[ae.fileType==="image"?(l.openBlock(),l.createBlock(j,{key:0,class:l.normalizeClass(["file-list-image",{[`previewImage_${ae.uid}`]:!0}]),fit:"cover","preview-src-list":g(v),"preview-teleported":"",src:ae.filePath},null,8,["class","preview-src-list","src"])):(l.openBlock(),l.createBlock(j,{key:1,class:"file-list-icon",src:l.unref(s)(`images/upload-${ae.fileType||"file"}.png`)},null,8,["src"])),l.createVNode(z,{effect:"dark",content:ae.name,placement:"bottom-start",disabled:l.unref(d)},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"el-file-name",ref_for:!0,ref:N=>l.unref(f)[`tooltipRef${v}`]=N,onMouseenter:N=>S(N,v),onMouseleave:N=>S(N,v)},l.toDisplayString(ae.name),41,E1)]),_:2},1032,["content","disabled"])]),l.createElementVNode("div",$1,[ae.fileType==="image"?(l.openBlock(),l.createBlock(me,{key:0,type:"primary",size:"small",icon:l.unref(Oy),circle:"",onClick:N=>P(ae)},null,8,["icon","onClick"])):l.createCommentVNode("",!0),l.createVNode(me,{type:"primary",size:"small",icon:l.unref(dy),circle:"",onClick:N=>Q(ae)},null,8,["icon","onClick"]),l.createVNode(me,{type:"danger",size:"small",icon:l.unref(hy),circle:"",onClick:N=>E(ae,v)},null,8,["icon","onClick"])])]))),128))],!0)])}}},[["__scopeId","data-v-8a705a54"]])},Symbol.toStringTag,{value:"Module"}));var R1=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCommentChange","onCompositionEnd","onCompositionStart","onCompositionUpdate","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onInput","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],V1=function(i){return R1.map(function(e){return e.toLowerCase()}).indexOf(i.toLowerCase())!==-1},L1=function(i,e,t){Object.keys(e).filter(V1).forEach(function(n){var s=e[n];typeof s=="function"&&(n==="onInit"?s(i,t):t.on(n.substring(2),function(r){return s(r,t)}))})},M1=function(i,e,t,n){var s=i.modelEvents?i.modelEvents:null,r=Array.isArray(s)?s.join(" "):s;l.watch(n,function(o,a){t&&typeof o=="string"&&o!==a&&o!==t.getContent({format:i.outputFormat})&&t.setContent(o)}),t.on(r||"change input undo redo",function(){e.emit("update:modelValue",t.getContent({format:i.outputFormat}))})},D1=function(i,e,t,n,s,r){n.setContent(r()),t.attrs["onUpdate:modelValue"]&&M1(e,t,n,s),L1(i,t.attrs,n)},df=0,pf=function(i){var e=Date.now(),t=Math.floor(Math.random()*1e9);return df++,i+"_"+t+df+String(e)},B1=function(i){return i!==null&&i.tagName.toLowerCase()==="textarea"},mf=function(i){return typeof i>"u"||i===""?[]:Array.isArray(i)?i:i.split(" ")},v1=function(i,e){return mf(i).concat(mf(e))},I1=function(i){return i==null},gf=function(i){var e;return typeof((e=i.options)===null||e===void 0?void 0:e.set)=="function"&&i.options.isRegistered("disabled")},Of=function(){return{listeners:[],scriptId:pf("tiny-script"),scriptLoaded:!1}},Z1=function(){var i=Of(),e=function(s,r,o,a){var c=r.createElement("script");c.referrerPolicy="origin",c.type="application/javascript",c.id=s,c.src=o;var u=function(){c.removeEventListener("load",u),a()};c.addEventListener("load",u),r.head&&r.head.appendChild(c)},t=function(s,r,o){i.scriptLoaded?o():(i.listeners.push(o),s.getElementById(i.scriptId)||e(i.scriptId,s,r,function(){i.listeners.forEach(function(a){return a()}),i.scriptLoaded=!0}))},n=function(){i=Of()};return{load:t,reinitialize:n}},F1=Z1(),U1=function(){return typeof window<"u"?window:global},hn=function(){var i=U1();return i&&i.tinymce?i.tinymce:null},X1={apiKey:String,licenseKey:String,cloudChannel:String,id:String,init:Object,initialValue:String,inline:Boolean,modelEvents:[String,Array],plugins:[String,Array],tagName:String,toolbar:[String,Array],modelValue:String,disabled:Boolean,readonly:Boolean,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(i){return i==="html"||i==="text"}}},ai=globalThis&&globalThis.__assign||function(){return ai=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s])}return i},ai.apply(this,arguments)},W1=function(i,e,t,n){return i(n||"div",{id:e,ref:t})},q1=function(i,e,t){return i("textarea",{id:e,visibility:"hidden",ref:t})},Ll={selector:void 0,target:void 0},Ml=function(i,e){var t;typeof((t=i.mode)===null||t===void 0?void 0:t.set)=="function"?i.mode.set(e):i.setMode(e)},j1=l.defineComponent({props:X1,setup:function(i,e){var t=i.init?ai(ai({},i.init),Ll):ai({},Ll),n=l.toRefs(i),s=n.disabled,r=n.readonly,o=n.modelValue,a=n.tagName,c=l.ref(null),u=null,h=i.id||pf("tiny-vue"),f=i.init&&i.init.inline||i.inline,d=!!e.attrs["onUpdate:modelValue"],m=!0,O=i.initialValue?i.initialValue:"",w="",g=function(k){return d?function(){return o!=null&&o.value?o.value:""}:function(){return k?O:w}},p=function(){var k=g(m),y=ai(ai({},t),{disabled:i.disabled,readonly:i.readonly,target:c.value,plugins:v1(t.plugins,i.plugins),toolbar:i.toolbar||t.toolbar,inline:f,license_key:i.licenseKey,setup:function(C){u=C,!gf(u)&&i.disabled===!0&&Ml(u,"readonly"),C.on("init",function(T){return D1(T,i,e,C,o,k)}),typeof t.setup=="function"&&t.setup(C)}});B1(c.value)&&(c.value.style.visibility=""),hn().init(y),m=!1};l.watch(r,function(k){u!==null&&Ml(u,k?"readonly":"design")}),l.watch(s,function(k){u!==null&&(gf(u)?u.options.set("disabled",k):Ml(u,k?"readonly":"design"))}),l.watch(a,function(k){var y;u&&(d||(w=u.getContent()),(y=hn())===null||y===void 0||y.remove(u),l.nextTick(function(){return p()}))}),l.onMounted(function(){if(hn()!==null)p();else if(c.value&&c.value.ownerDocument){var k=i.cloudChannel?i.cloudChannel:"8",y=i.apiKey?i.apiKey:"no-api-key",C=I1(i.tinymceScriptSrc)?"https://cdn.tiny.cloud/1/".concat(y,"/tinymce/").concat(k,"/tinymce.min.js"):i.tinymceScriptSrc;F1.load(c.value.ownerDocument,C,p)}}),l.onBeforeUnmount(function(){hn()!==null&&hn().remove(u)}),f||(l.onActivated(function(){m||p()}),l.onDeactivated(function(){var k;u&&(d||(w=u.getContent()),(k=hn())===null||k===void 0||k.remove(u))}));var b=function(k){var y;u&&(w=u.getContent(),(y=hn())===null||y===void 0||y.remove(u),t=ai(ai(ai({},t),k),Ll),l.nextTick(function(){return p()}))};return e.expose({rerender:b,getEditor:function(){return u}}),function(){return f?W1(l.h,h,c,i.tagName):q1(l.h,h,c)}}});const AE="",z1={style:{height:"100%",overflow:"hidden"}},Y1=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"index",props:{modelValue:{type:String,default:""},value:{type:String,default:""},baseUrl:{type:String,default:""},width:{type:[Number,String],default:"100%"},height:{type:Number,default:500},disabled:{type:Boolean,default:!1},editableRoot:{type:Boolean,default:!0},placeholder:{type:String,default:"请输入"},plugins:{type:[String,Array],default:"importcss autoresize searchreplace autolink directionality code visualblocks visualchars fullscreen image link codesample table charmap nonbreaking anchor insertdatetime advlist lists wordcount charmap quickbars emoticons accordion"},toolbar:{type:[String,Array,Boolean],default:"undo redo | accordion accordionremove | blocks fontfamily fontsize| bold italic underline strikethrough ltr rtl | align numlist bullist | link image | table | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | anchor codesample"}},emits:["update:modelValue","setHtml"],setup(i,{expose:e,emit:t}){const n=t,s=i,r=l.ref("vue-tinymce-"+ +new Date+((Math.random()*1e3).toFixed(0)+"")),o=l.reactive({selector:"#"+r.value,language_url:"/tinymce/langs/zh_CN.js",language:"zh_CN",skin_url:"/tinymce/skins/ui/oxide",content_css:"/tinymce/skins/content/default/content.css",editable_root:s.editableRoot,width:s.width,max_height:s.height,min_height:400,branding:!1,promotion:!1,menubar:"edit view insert format tools table",paste_data_images:!0,image_dimensions:!1,plugins:s.plugins,toolbar:s.toolbar,convert_urls:!1,link_default_target:"_blank",link_context_toolbar:!0,quickbars_insert_toolbar:"",quickbars_image_toolbar:"alignleft aligncenter alignright | rotateleft rotateright | imageoptions",editimage_toolbar:"rotateleft rotateright | flipv fliph | editimage imageoptions",font_family_formats:"Arial=arial,helvetica,sans-serif; 宋体=SimSun; 微软雅黑=Microsoft Yahei; Impact=impact,chicago;",font_size_formats:"11px 12px 14px 16px 18px 24px 36px 48px 64px 72px",image_caption:!0,editimage_cors_hosts:["picsum.photos"],noneditable_class:"mceNonEditable",toolbar_mode:"wrap",content_style:"body {margin:12px; font-family:sans-serif; font-size:14px }p {margin:3px; line-height:24px;}",image_advtab:!0,importcss_append:!0,paste_webkit_styles:"all",paste_merge_formats:!0,nonbreaking_force_tab:!1,paste_auto_cleanup_on_paste:!1,file_picker_types:"file",quickbars_selection_toolbar:"bold italic | quicklink h2 h3 blockquote quickimage quicktable",images_upload_handler:function(h,f){}});console.log(o);const a=l.computed({get(){return s.modelValue},set(h){n("update:modelValue",h)}});return l.watch(()=>a.value,()=>{n("setHtml",fr.activeEditor.getContent({format:"text"}),a.value)}),l.onMounted(()=>{fr.init({})}),e({onGetContent:()=>fr.activeEditor.getContent(),onSetContent:h=>{fr.activeEditor.setContent(h)}}),(h,f)=>(l.openBlock(),l.createElementBlock("div",z1,[l.createVNode(l.unref(j1),{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=d=>a.value=d),init:o,disabled:i.disabled,placeholder:i.placeholder,id:r.value},null,8,["modelValue","init","disabled","placeholder","id"])]))}}},Symbol.toStringTag,{value:"Module"}));let Dl=[],_f=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?_f:Dl).push(t=t+i[e])})();function G1(i){if(i<768)return!1;for(let e=0,t=Dl.length;;){let n=e+t>>1;if(i<Dl[n])t=n;else if(i>=_f[n])e=n+1;else return!0;if(e==t)return!1}}function bf(i){return i>=127462&&i<=127487}const yf=8205;function K1(i,e,t=!0,n=!0){return(t?wf:H1)(i,e,n)}function wf(i,e,t){if(e==i.length)return e;e&&kf(i.charCodeAt(e))&&xf(i.charCodeAt(e-1))&&e--;let n=Bl(i,e);for(e+=Sf(n);e<i.length;){let s=Bl(i,e);if(n==yf||s==yf||t&&G1(s))e+=Sf(s),n=s;else if(bf(s)){let r=0,o=e-2;for(;o>=0&&bf(Bl(i,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function H1(i,e,t){for(;e>0;){let n=wf(i,e-2,t);if(n<e)return n;e--}return 0}function Bl(i,e){let t=i.charCodeAt(e);if(!xf(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return kf(n)?(t-55296<<10)+(n-56320)+65536:t}function kf(i){return i>=56320&&i<57344}function xf(i){return i>=55296&&i<56320}function Sf(i){return i<65536?1:2}class Qe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ln(this,e,t);let s=[];return this.decompose(0,e,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(t,this.length,s,1),ci.from(s,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ln(this,e,t);let n=[];return this.decompose(e,t,n,0),ci.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),s=new ms(this),r=new ms(e);for(let o=t,a=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(a+=s.value.length,s.done||a>=n)return!0}}iter(e=1){return new ms(this,e)}iterRange(e,t=this.length){return new Af(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;n=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Tf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Qe.empty:e.length<=32?new ze(e):ci.from(ze.split(e,[]))}}class ze extends Qe{constructor(e,t=J1(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,s){for(let r=0;;r++){let o=this.text[r],a=s+o.length;if((t?n:a)>=e)return new ew(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let r=e<=0&&t>=this.length?this:new ze(Cf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),a=Qr(r.text,o.text.slice(),0,r.length);if(a.length<=32)n.push(new ze(a,o.length+r.length));else{let c=a.length>>1;n.push(new ze(a.slice(0,c)),new ze(a.slice(c)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof ze))return super.replace(e,t,n);[e,t]=Ln(this,e,t);let s=Qr(this.text,Qr(n.text,Cf(this.text,0,e)),t),r=this.length+n.length-(t-e);return s.length<=32?new ze(s,r):ci.from(ze.split(s,[]),r)}sliceString(e,t=this.length,n=`
|
|
22
22
|
`){[e,t]=Ln(this,e,t);let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let a=this.text[o],c=r+a.length;r>e&&o&&(s+=n),e<c&&t>r&&(s+=a.slice(Math.max(0,e-r),t-r)),r=c+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],s=-1;for(let r of e)n.push(r),s+=r.length+1,n.length==32&&(t.push(new ze(n,s)),n=[],s=-1);return s>-1&&t.push(new ze(n,s)),t}}class ci extends Qe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,s){for(let r=0;;r++){let o=this.children[r],a=s+o.length,c=n+o.lines-1;if((t?c:a)>=e)return o.lineInner(e,t,n,s);s=a+1,n=c+1}}decompose(e,t,n,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let a=this.children[r],c=o+a.length;if(e<=c&&t>=o){let u=s&((o<=e?1:0)|(c>=t?2:0));o>=e&&c<=t&&!u?n.push(a):a.decompose(e-o,t-o,n,u)}o=c+1}}replace(e,t,n){if([e,t]=Ln(this,e,t),n.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],a=r+o.length;if(e>=r&&t<=a){let c=o.replace(e-r,t-r,n),u=this.lines-o.lines+c.lines;if(c.lines<u>>5-1&&c.lines>u>>5+1){let h=this.children.slice();return h[s]=c,new ci(h,this.length-(t-e)+n.length)}return super.replace(r,a,c)}r=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
23
23
|
`){[e,t]=Ln(this,e,t);let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let a=this.children[r],c=o+a.length;o>e&&r&&(s+=n),e<c&&t>o&&(s+=a.sliceString(e-o,t-o,n)),o=c+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ci))return 0;let n=0,[s,r,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==a)return n;let c=this.children[s],u=e.children[r];if(c!=u)return n+c.scanIdentical(u,t);n+=c.length+1}}static from(e,t=e.reduce((n,s)=>n+s.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let O of e)O.flatten(m);return new ze(m,t)}let s=Math.max(32,n>>5),r=s<<1,o=s>>1,a=[],c=0,u=-1,h=[];function f(m){let O;if(m.lines>r&&m instanceof ci)for(let w of m.children)f(w);else m.lines>o&&(c>o||!c)?(d(),a.push(m)):m instanceof ze&&c&&(O=h[h.length-1])instanceof ze&&m.lines+O.lines<=32?(c+=m.lines,u+=m.length+1,h[h.length-1]=new ze(O.text.concat(m.text),O.length+1+m.length)):(c+m.lines>s&&d(),c+=m.lines,u+=m.length+1,h.push(m))}function d(){c!=0&&(a.push(h.length==1?h[0]:ci.from(h,u)),u=-1,c=h.length=0)}for(let m of e)f(m);return d(),a.length==1?a[0]:new ci(a,t)}}Qe.empty=new ze([""],0);function J1(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Qr(i,e,t=0,n=1e9){for(let s=0,r=0,o=!0;r<i.length&&s<=n;r++){let a=i[r],c=s+a.length;c>=t&&(c>n&&(a=a.slice(0,n-s)),s<t&&(a=a.slice(t-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=c+1}return e}function Cf(i,e,t){return Qr(i,[""],e,t)}class ms{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ze?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],r=this.offsets[n],o=r>>1,a=s instanceof ze?s.text.length:s.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
24
|
-
`,this;e--}else if(s instanceof ze){let c=s.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[o+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof ze?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Af{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new ms(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=n?s:t<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Tf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},ms.prototype[Symbol.iterator]=Af.prototype[Symbol.iterator]=Tf.prototype[Symbol.iterator]=function(){return this});class ew{constructor(e,t,n,s){this.from=e,this.to=t,this.number=n,this.text=s}get length(){return this.to-this.from}}function Ln(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function ht(i,e,t=!0,n=!0){return K1(i,e,t,n)}function tw(i){return i>=56320&&i<57344}function iw(i){return i>=55296&&i<56320}function Tt(i,e){let t=i.charCodeAt(e);if(!iw(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return tw(n)?(t-55296<<10)+(n-56320)+65536:t}function vl(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ui(i){return i<65536?1:2}const Il=/\r\n?|\n/;var ft=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(ft||(ft={}));class hi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(n,s,r),s+=r):s+=o,n+=r}}iterChangedRanges(e,t=!1){Zl(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];s<0?e.push(n,s):e.push(s,n)}return new hi(e)}composeDesc(e){return this.empty?e:e.empty?this:Pf(this,e)}mapDesc(e,t=!1){return e.empty?this:Fl(this,e,t)}mapPos(e,t=-1,n=ft.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],c=this.sections[o++],u=s+a;if(c<0){if(u>e)return r+(e-s);r+=a}else{if(n!=ft.Simple&&u>=e&&(n==ft.TrackDel&&s<e&&u>e||n==ft.TrackBefore&&s<e||n==ft.TrackAfter&&u>e))return null;if(u>e||u==e&&t<0&&!a)return e==s||t<0?r:r+c;r+=c}s=u}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let n=0,s=0;n<this.sections.length&&s<=t;){let r=this.sections[n++],o=this.sections[n++],a=s+r;if(o>=0&&s<=t&&a>=e)return s<e&&a>t?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+n+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new hi(e)}static create(e){return new hi(e)}}class it extends hi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Zl(this,(t,n,s,r,o)=>e=e.replace(s,s+(n-t),o),!1),e}mapDesc(e,t=!1){return Fl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],a=t[s+1];if(a>=0){t[s]=a,t[s+1]=o;let c=s>>1;for(;n.length<c;)n.push(Qe.empty);n.push(o?e.slice(r,r+o):Qe.empty)}r+=o}return new it(t,n)}compose(e){return this.empty?e:e.empty?this:Pf(this,e,!0)}map(e,t=!1){return e.empty?this:Fl(this,e,t,!0)}iterChanges(e,t=!1){Zl(this,e,t)}get desc(){return hi.create(this.sections)}filter(e){let t=[],n=[],s=[],r=new gs(this);e:for(let o=0,a=0;;){let c=o==e.length?1e9:e[o++];for(;a<c||a==c&&r.len==0;){if(r.done)break e;let h=Math.min(r.len,c-a);gt(s,h,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;gt(t,h,f),f>0&&Xi(n,t,r.text),r.forward(h),a+=h}let u=e[o++];for(;a<u;){if(r.done)break e;let h=Math.min(r.len,u-a);gt(t,h,-1),gt(s,h,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(h),a+=h}}return{changes:new it(t,n),filtered:hi.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],s=this.sections[t+1];s<0?e.push(n):s==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let s=[],r=[],o=0,a=null;function c(h=!1){if(!h&&!s.length)return;o<t&>(s,t-o,-1);let f=new it(s,r);a=a?a.compose(f.map(a)):f,s=[],r=[],o=0}function u(h){if(Array.isArray(h))for(let f of h)u(f);else if(h instanceof it){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);c(),a=a?a.compose(h.map(a)):h}else{let{from:f,to:d=f,insert:m}=h;if(f>d||f<0||d>t)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${t})`);let O=m?typeof m=="string"?Qe.of(m.split(n||Il)):m:Qe.empty,w=O.length;if(f==d&&w==0)return;f<o&&c(),f>o&>(s,f-o,-1),gt(s,d-f,w),Xi(r,s,O),o=d}}return u(e),c(!a),a}static empty(e){return new it(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;n.length<s;)n.push(Qe.empty);n[s]=Qe.of(r.slice(1)),t.push(r[0],n[s].length)}}}return new it(t,n)}static createSet(e,t){return new it(e,t)}}function gt(i,e,t,n=!1){if(e==0&&t<=0)return;let s=i.length-2;s>=0&&t<=0&&t==i[s+1]?i[s]+=e:s>=0&&e==0&&i[s]==0?i[s+1]+=t:n?(i[s]+=e,i[s+1]+=t):i.push(e,t)}function Xi(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<n;)i.push(Qe.empty);i.push(t)}}function Zl(i,e,t){let n=i.inserted;for(let s=0,r=0,o=0;o<i.sections.length;){let a=i.sections[o++],c=i.sections[o++];if(c<0)s+=a,r+=a;else{let u=s,h=r,f=Qe.empty;for(;u+=a,h+=c,c&&n&&(f=f.append(n[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],c=i.sections[o++];e(s,u,r,h,f),s=u,r=h}}}function Fl(i,e,t,n=!1){let s=[],r=n?[]:null,o=new gs(i),a=new gs(e);for(let c=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let u=Math.min(o.len,a.len);gt(s,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let u=a.len;for(gt(s,a.ins,-1);u;){let h=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=h&&(gt(s,0,o.ins),r&&Xi(r,s,o.text),c=o.i),o.forward(h),u-=h}a.next()}else if(o.ins>=0){let u=0,h=o.len;for(;h;)if(a.ins==-1){let f=Math.min(h,a.len);u+=f,h-=f,a.forward(f)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;gt(s,u,c<o.i?o.ins:0),r&&c<o.i&&Xi(r,s,o.text),c=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return r?it.createSet(s,r):hi.create(s);throw new Error("Mismatched change set lengths")}}}function Pf(i,e,t=!1){let n=[],s=t?[]:null,r=new gs(i),o=new gs(e);for(let a=!1;;){if(r.done&&o.done)return s?it.createSet(n,s):hi.create(n);if(r.ins==0)gt(n,r.len,0,a),r.next();else if(o.len==0&&!o.done)gt(n,0,o.ins,a),s&&Xi(s,n,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let c=Math.min(r.len2,o.len),u=n.length;if(r.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;gt(n,c,h,a),s&&h&&Xi(s,n,o.text)}else o.ins==-1?(gt(n,r.off?0:r.len,c,a),s&&Xi(s,n,r.textBit(c))):(gt(n,r.off?0:r.len,o.off?0:o.ins,a),s&&!o.off&&Xi(s,n,o.text));a=(r.ins>c||o.ins>=0&&o.len>c)&&(a||n.length>u),r.forward2(c),o.forward(c)}}}}class gs{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Qe.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class fn{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,s;return this.empty?n=s=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new fn(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return X.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return X.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return X.range(e.anchor,e.head)}static create(e,t,n){return new fn(e,t,n)}}class X{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:X.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new X([this.main],0)}addRange(e,t=!0){return X.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,X.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new X(e.ranges.map(t=>fn.fromJSON(t)),e.main)}static single(e,t=e){return new X([X.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=n:r.from<n)return X.normalized(e.slice(),t);n=r.to}return new X(e,t)}static cursor(e,t=0,n,s){return fn.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(s??16777215)<<6)}static range(e,t,n,s){let r=(n??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?fn.create(t,e,48|r):fn.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(n);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let a=o.from,c=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?X.range(c,a):X.range(a,c))}}return new X(e,t)}}function Qf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ul=0;class ae{constructor(e,t,n,s,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=s,this.id=Ul++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new ae(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Xl),!!e.static,e.enables)}of(e){return new Er([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Er(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Er(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Xl(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class Er{constructor(e,t,n,s){this.dependencies=e,this.facet=t,this.type=n,this.value=s,this.id=Ul++}dynamicSlot(e){var t;let n=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,a=this.type==2,c=!1,u=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,d){if(c&&d.docChanged||u&&(d.docChanged||d.selection)||Wl(f,h)){let m=n(f);if(a?!Ef(m,f.values[o],s):!s(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,d)=>{let m,O=d.config.address[r];if(O!=null){let w=Rr(d,O);if(this.dependencies.every(g=>g instanceof ae?d.facet(g)===f.facet(g):g instanceof rt?d.field(g,!1)==f.field(g,!1):!0)||(a?Ef(m=n(f),w,s):s(m=n(f),w)))return f.values[o]=w,0}else m=n(f);return f.values[o]=m,1}}}}function Ef(i,e,t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!t(i[n],e[n]))return!1;return!0}function Wl(i,e){let t=!1;for(let n of e)bs(i,n)&1&&(t=!0);return t}function nw(i,e,t){let n=t.map(c=>i[c.id]),s=t.map(c=>c.type),r=n.filter(c=>!(c&1)),o=i[e.id]>>1;function a(c){let u=[];for(let h=0;h<n.length;h++){let f=Rr(c,n[h]);if(s[h]==2)for(let d of f)u.push(d);else u.push(f)}return e.combine(u)}return{create(c){for(let u of n)bs(c,u);return c.values[o]=a(c),1},update(c,u){if(!Wl(c,r))return 0;let h=a(c);return e.compare(h,c.values[o])?0:(c.values[o]=h,1)},reconfigure(c,u){let h=Wl(c,n),f=u.config.facets[e.id],d=u.facet(e);if(f&&!h&&Xl(t,f))return c.values[o]=d,0;let m=a(c);return e.compare(m,d)?(c.values[o]=d,0):(c.values[o]=m,1)}}}const $r=ae.define({static:!0});class rt{constructor(e,t,n,s,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new rt(Ul++,e.create,e.update,e.compare||((n,s)=>n===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet($r).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,s)=>{let r=n.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(n.values[t]=o,1)},reconfigure:(n,s)=>{let r=n.facet($r),o=s.facet($r),a;return(a=r.find(c=>c.field==this))&&a!=o.find(c=>c.field==this)?(n.values[t]=a.create(n),1):s.config.address[this.id]!=null?(n.values[t]=s.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,$r.of({field:this,create:e})]}get extension(){return this}}const dn={lowest:4,low:3,default:2,high:1,highest:0};function Os(i){return e=>new $f(e,i)}const Wi={highest:Os(dn.highest),high:Os(dn.high),default:Os(dn.default),low:Os(dn.low),lowest:Os(dn.lowest)};class $f{constructor(e,t){this.inner=e,this.prec=t}}class _s{of(e){return new ql(this,e)}reconfigure(e){return _s.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ql{constructor(e,t){this.compartment=e,this.inner=t}}class Nr{constructor(e,t,n,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let s=[],r=Object.create(null),o=new Map;for(let d of sw(e,t,o))d instanceof rt?s.push(d):(r[d.facet.id]||(r[d.facet.id]=[])).push(d);let a=Object.create(null),c=[],u=[];for(let d of s)a[d.id]=u.length<<1,u.push(m=>d.slot(m));let h=n==null?void 0:n.config.facets;for(let d in r){let m=r[d],O=m[0].facet,w=h&&h[d]||[];if(m.every(g=>g.type==0))if(a[O.id]=c.length<<1|1,Xl(w,m))c.push(n.facet(O));else{let g=O.combine(m.map(p=>p.value));c.push(n&&O.compare(g,n.facet(O))?n.facet(O):g)}else{for(let g of m)g.type==0?(a[g.id]=c.length<<1|1,c.push(g.value)):(a[g.id]=u.length<<1,u.push(p=>g.dynamicSlot(p)));a[O.id]=u.length<<1,u.push(g=>nw(g,O,m))}}let f=u.map(d=>d(a));return new Nr(e,o,f,a,c,r)}}function sw(i,e,t){let n=[[],[],[],[],[]],s=new Map;function r(o,a){let c=s.get(o);if(c!=null){if(c<=a)return;let u=n[c].indexOf(o);u>-1&&n[c].splice(u,1),o instanceof ql&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let u of o)r(u,a);else if(o instanceof ql){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;t.set(o.compartment,u),r(u,a)}else if(o instanceof $f)r(o.inner,o.prec);else if(o instanceof rt)n[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof Er)n[a].push(o),o.facet.extensions&&r(o.facet.extensions,dn.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(u,a)}}return r(i,dn.default),n.reduce((o,a)=>o.concat(a))}function bs(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let s=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|s}function Rr(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Nf=ae.define(),jl=ae.define({combine:i=>i.some(e=>e),static:!0}),Rf=ae.define({combine:i=>i.length?i[0]:void 0,static:!0}),Vf=ae.define(),Lf=ae.define(),Mf=ae.define(),Df=ae.define({combine:i=>i.length?i[0]:!1});class Ei{constructor(e,t){this.type=e,this.value=t}static define(){return new rw}}class rw{of(e){return new Ei(this,e)}}class ow{constructor(e){this.map=e}of(e){return new ke(this,e)}}class ke{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ke(this.type,t)}is(e){return this.type==e}static define(e={}){return new ow(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let s of e){let r=s.map(t);r&&n.push(r)}return n}}ke.reconfigure=ke.define(),ke.appendConfig=ke.define();class He{constructor(e,t,n,s,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Qf(n,t.newLength),r.some(a=>a.type==He.time)||(this.annotations=r.concat(He.time.of(Date.now())))}static create(e,t,n,s,r,o){return new He(e,t,n,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(He.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}He.time=Ei.define(),He.userEvent=Ei.define(),He.addToHistory=Ei.define(),He.remote=Ei.define();function lw(i,e){let t=[];for(let n=0,s=0;;){let r,o;if(n<i.length&&(s==e.length||e[s]>=i[n]))r=i[n++],o=i[n++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Bf(i,e,t){var n;let s,r,o;return t?(s=e.changes,r=it.empty(e.changes.length),o=i.changes.compose(e.changes)):(s=e.changes.map(i.changes),r=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(n=i.selection)===null||n===void 0?void 0:n.map(s),effects:ke.mapEffects(i.effects,s).concat(ke.mapEffects(e.effects,r)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function zl(i,e,t){let n=e.selection,s=Mn(e.annotations);return e.userEvent&&(s=s.concat(He.userEvent.of(e.userEvent))),{changes:e.changes instanceof it?e.changes:it.of(e.changes||[],t,i.facet(Rf)),selection:n&&(n instanceof X?n:X.single(n.anchor,n.head)),effects:Mn(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function vf(i,e,t){let n=zl(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;n=Bf(n,zl(i,e[r],o?n.changes.newLength:i.doc.length),o)}let s=He.create(i,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return cw(t?aw(s):s)}function aw(i){let e=i.startState,t=!0;for(let s of e.facet(Vf)){let r=s(i);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:lw(t,r))}if(t!==!0){let s,r;if(t===!1)r=i.changes.invertedDesc,s=it.empty(e.doc.length);else{let o=i.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}i=He.create(e,s,i.selection&&i.selection.map(r),ke.mapEffects(i.effects,r),i.annotations,i.scrollIntoView)}let n=e.facet(Lf);for(let s=n.length-1;s>=0;s--){let r=n[s](i);r instanceof He?i=r:Array.isArray(r)&&r.length==1&&r[0]instanceof He?i=r[0]:i=vf(e,Mn(r),!1)}return i}function cw(i){let e=i.startState,t=e.facet(Mf),n=i;for(let s=t.length-1;s>=0;s--){let r=t[s](i);r&&Object.keys(r).length&&(n=Bf(n,zl(e,r,i.changes.newLength),!0))}return n==i?i:He.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const uw=[];function Mn(i){return i==null?uw:Array.isArray(i)?i:[i]}var Xe=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(Xe||(Xe={}));const hw=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Yl;try{Yl=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function fw(i){if(Yl)return Yl.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||hw.test(t)))return!0}return!1}function dw(i){return e=>{if(!/\S/.test(e))return Xe.Space;if(fw(e))return Xe.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return Xe.Word;return Xe.Other}}class Te{constructor(e,t,n,s,r,o){this.config=e,this.doc=t,this.selection=n,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)bs(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return bs(this,n),Rr(this,n)}update(...e){return vf(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:s}=t;for(let a of e.effects)a.is(_s.reconfigure)?(t&&(s=new Map,t.compartments.forEach((c,u)=>s.set(u,c)),t=null),s.set(a.value.compartment,a.value.extension)):a.is(ke.reconfigure)?(t=null,n=a.value):a.is(ke.appendConfig)&&(t=null,n=Mn(n).concat(a.value));let r;t?r=e.startState.values.slice():(t=Nr.resolve(n,s,this),r=new Te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=e.startState.facet(jl)?e.newSelection:e.newSelection.asSingle();new Te(t,e.newDoc,o,r,(a,c)=>c.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:X.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),s=this.changes(n.changes),r=[n.range],o=Mn(n.effects);for(let a=1;a<t.ranges.length;a++){let c=e(t.ranges[a]),u=this.changes(c.changes),h=u.map(s);for(let d=0;d<a;d++)r[d]=r[d].map(h);let f=s.mapDesc(u,!0);r.push(c.range.map(f)),s=s.compose(h),o=ke.mapEffects(o,h).concat(ke.mapEffects(Mn(c.effects),f))}return{changes:s,selection:X.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof it?e:it.of(e,this.doc.length,this.facet(Te.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(Te.lineSeparator)||Il))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(bs(this,t),Rr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let s=e[n];s instanceof rt&&this.config.address[s.id]!=null&&(t[n]=s.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n){for(let r in n)if(Object.prototype.hasOwnProperty.call(e,r)){let o=n[r],a=e[r];s.push(o.init(c=>o.spec.fromJSON(a,c)))}}return Te.create({doc:e.doc,selection:X.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Nr.resolve(e.extensions||[],new Map),n=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet(Te.lineSeparator)||Il)),s=e.selection?e.selection instanceof X?e.selection:X.single(e.selection.anchor,e.selection.head):X.single(0);return Qf(s,n.length),t.staticFacet(jl)||(s=s.asSingle()),new Te(t,n,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(Te.tabSize)}get lineBreak(){return this.facet(Te.lineSeparator)||`
|
|
25
|
-
`}get readOnly(){return this.facet(Df)}phrase(e,...t){for(let n of this.facet(Te.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?n:t[r-1]})),e}languageDataAt(e,t,n=-1){let s=[];for(let r of this.facet(Nf))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return dw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let c=ht(t,o,!1);if(r(t.slice(c,o))!=Xe.Word)break;o=c}for(;a<s;){let c=ht(t,a);if(r(t.slice(a,c))!=Xe.Word)break;a=c}return o==a?null:X.range(o+n,a+n)}}Te.allowMultipleSelections=jl,Te.tabSize=ae.define({combine:i=>i.length?i[0]:4}),Te.lineSeparator=Rf,Te.readOnly=Df,Te.phrases=ae.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(s=>i[s]==e[s])}}),Te.languageData=Nf,Te.changeFilter=Vf,Te.transactionFilter=Lf,Te.transactionExtender=Mf,_s.reconfigure=ke.define();function fi(i,e,t={}){let n={};for(let s of i)for(let r of Object.keys(s)){let o=s[r],a=n[r];if(a===void 0)n[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,r))n[r]=t[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)n[s]===void 0&&(n[s]=e[s]);return n}class pn{eq(e){return this==e}range(e,t=e){return Gl.create(e,t,this)}}pn.prototype.startSide=pn.prototype.endSide=0,pn.prototype.point=!1,pn.prototype.mapMode=ft.TrackDel;let Gl=class m_{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new m_(e,t,n)}};function Kl(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class Hl{constructor(e,t,n,s){this.from=e,this.to=t,this.value=n,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,s=0){let r=n?this.to:this.from;for(let o=s,a=r.length;;){if(o==a)return o;let c=o+a>>1,u=r[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==o)return u>=0?o:a;u>=0?a=c:o=c+1}}between(e,t,n,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(s(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let n=[],s=[],r=[],o=-1,a=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],h=this.from[c]+e,f=this.to[c]+e,d,m;if(h==f){let O=t.mapPos(h,u.startSide,u.mapMode);if(O==null||(d=m=O,u.startSide!=u.endSide&&(m=t.mapPos(h,u.endSide),m<d)))continue}else if(d=t.mapPos(h,u.startSide),m=t.mapPos(f,u.endSide),d>m||d==m&&u.startSide>0&&u.endSide<=0)continue;(m-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(a=Math.max(a,m-d)),n.push(u),s.push(d-o),r.push(m-o))}return{mapped:n.length?new Hl(s,r,n,a):null,pos:o}}}class Ne{constructor(e,t,n,s){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=s}static create(e,t,n,s){return new Ne(e,t,n,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Kl)),this.isEmpty)return t.length?Ne.of(t):this;let a=new Zf(this,null,-1).goto(0),c=0,u=[],h=new $i;for(;a.value||c<t.length;)if(c<t.length&&(a.from-t[c].from||a.startSide-t[c].value.startSide)>=0){let f=t[c++];h.addInner(f.from,f.to,f.value)||u.push(f)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(a.chunkIndex)<t[c].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||r<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||r<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||u.push(Gl.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!u.length?Ne.empty:this.nextLayer.update({add:u,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],c=this.chunk[o],u=e.touchesRange(a,a+c.length);if(u===!1)s=Math.max(s,c.maxPoint),t.push(c),n.push(e.mapPos(a));else if(u===!0){let{mapped:h,pos:f}=c.map(a,e);h&&(s=Math.max(s,h.maxPoint),t.push(h),n.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new Ne(n,t,r||Ne.empty,s)}between(e,t,n){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return ys.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ys.from(e).goto(t)}static compare(e,t,n,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),c=If(o,a,n),u=new ws(o,c,r),h=new ws(a,c,r);n.iterGaps((f,d,m)=>Ff(u,f,h,d,m,s)),n.empty&&n.length==0&&Ff(u,0,h,0,0,s)}static eq(e,t,n=0,s){s==null&&(s=1e9-1);let r=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=If(r,o),c=new ws(r,a,0).goto(n),u=new ws(o,a,0).goto(n);for(;;){if(c.to!=u.to||!ea(c.active,u.active)||c.point&&(!u.point||!c.point.eq(u.point)))return!1;if(c.to>s)return!0;c.next(),u.next()}}static spans(e,t,n,s,r=-1){let o=new ws(e,null,r).goto(t),a=t,c=o.openStart;for(;;){let u=Math.min(o.to,n);if(o.point){let h=o.activeForPoint(o.to),f=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,c);s.point(a,u,o.point,h,f,o.pointRank),c=Math.min(o.openEnd(u),h.length)}else u>a&&(s.span(a,u,o.active,c),c=o.openEnd(u));if(o.to>n)return c+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new $i;for(let s of e instanceof Gl?[e]:t?pw(e):e)n.add(s.from,s.to,s.value);return n.finish()}static join(e){if(!e.length)return Ne.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=Ne.empty;s=s.nextLayer)t=new Ne(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}Ne.empty=new Ne([],[],null,-1);function pw(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let n=i[t];if(Kl(e,n)>0)return i.slice().sort(Kl);e=n}return i}Ne.empty.nextLayer=Ne.empty;class $i{finishChunk(e){this.chunks.push(new Hl(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new $i)).add(e,t,n)}addInner(e,t,n){let s=e-this.lastTo||n.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ne.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ne.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function If(i,e,t){let n=new Map;for(let r of i)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&n.set(r.chunk[o],r.chunkPos[o]);let s=new Set;for(let r of e)for(let o=0;o<r.chunk.length;o++){let a=n.get(r.chunk[o]);a!=null&&(t?t.mapPos(a):a)==r.chunkPos[o]&&!(t!=null&&t.touchesRange(a,a+r.chunk[o].length))&&s.add(r.chunk[o])}return s}class Zf{constructor(e,t,n,s=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class ys{constructor(e){this.heap=e}static from(e,t=null,n=-1){let s=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&s.push(new Zf(o,t,n,r));return s.length==1?s[0]:new ys(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jl(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jl(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Jl(this.heap,0)}}}function Jl(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let s=i[n];if(n+1<i.length&&s.compare(i[n+1])>=0&&(s=i[n+1],n++),t.compare(s)<0)break;i[n]=t,i[e]=s,e=n}}class ws{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=ys.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Vr(this.active,e),Vr(this.activeTo,e),Vr(this.activeRank,e),this.minActive=Uf(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:s,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||s-this.activeTo[t])>0;)t++;Lr(this.active,t,n),Lr(this.activeTo,t,s),Lr(this.activeRank,t,r),e&&Lr(e,t,this.cursor.from),this.minActive=Uf(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),n&&Vr(n,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let s=n.length-1;s>=0&&n[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Ff(i,e,t,n,s,r){i.goto(e),t.goto(n);let o=n+s,a=n,c=n-e;for(;;){let u=i.to+c-t.to,h=u||i.endSide-t.endSide,f=h<0?i.to+c:t.to,d=Math.min(f,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&ea(i.activeForPoint(i.to),t.activeForPoint(t.to))||r.comparePoint(a,d,i.point,t.point):d>a&&!ea(i.active,t.active)&&r.compareRange(a,d,i.active,t.active),f>o)break;(u||i.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),a=f,h<=0&&i.next(),h>=0&&t.next()}}function ea(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!i[t].eq(e[t]))return!1;return!0}function Vr(i,e){for(let t=e,n=i.length-1;t<n;t++)i[t]=i[t+1];i.pop()}function Lr(i,e,t){for(let n=i.length-1;n>=e;n--)i[n+1]=i[n];i[e]=t}function Uf(i,e){let t=-1,n=1e9;for(let s=0;s<e.length;s++)(e[s]-n||i[s].endSide-i[t].endSide)<0&&(t=s,n=e[s]);return t}function Dn(i,e,t=i.length){let n=0;for(let s=0;s<t&&s<i.length;)i.charCodeAt(s)==9?(n+=e-n%e,s++):(n++,s=ht(i,s));return n}function ta(i,e,t,n){for(let s=0,r=0;;){if(r>=e)return s;if(s==i.length)break;r+=i.charCodeAt(s)==9?t-r%t:1,s=ht(i,s)}return n===!0?-1:i.length}const ia="ͼ",Xf=typeof Symbol>"u"?"__"+ia:Symbol.for(ia),na=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Wf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class qi{constructor(e,t){this.rules=[];let{finish:n}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,a,c,u){let h=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&a==null)return c.push(o[0]+";");for(let m in a){let O=a[m];if(/&/.test(m))r(m.split(/,\s*/).map(w=>o.map(g=>w.replace(/&/,g))).reduce((w,g)=>w.concat(g)),O,c);else if(O&&typeof O=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");r(s(m),O,h,d)}else O!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+O+";")}(h.length||d)&&c.push((n&&!f&&!u?o.map(n):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
24
|
+
`,this;e--}else if(s instanceof ze){let c=s.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[o+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof ze?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Af{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new ms(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=n?s:t<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Tf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},ms.prototype[Symbol.iterator]=Af.prototype[Symbol.iterator]=Tf.prototype[Symbol.iterator]=function(){return this});class ew{constructor(e,t,n,s){this.from=e,this.to=t,this.number=n,this.text=s}get length(){return this.to-this.from}}function Ln(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function ht(i,e,t=!0,n=!0){return K1(i,e,t,n)}function tw(i){return i>=56320&&i<57344}function iw(i){return i>=55296&&i<56320}function Tt(i,e){let t=i.charCodeAt(e);if(!iw(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return tw(n)?(t-55296<<10)+(n-56320)+65536:t}function vl(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ui(i){return i<65536?1:2}const Il=/\r\n?|\n/;var ft=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(ft||(ft={}));class hi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(n,s,r),s+=r):s+=o,n+=r}}iterChangedRanges(e,t=!1){Zl(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];s<0?e.push(n,s):e.push(s,n)}return new hi(e)}composeDesc(e){return this.empty?e:e.empty?this:Pf(this,e)}mapDesc(e,t=!1){return e.empty?this:Fl(this,e,t)}mapPos(e,t=-1,n=ft.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],c=this.sections[o++],u=s+a;if(c<0){if(u>e)return r+(e-s);r+=a}else{if(n!=ft.Simple&&u>=e&&(n==ft.TrackDel&&s<e&&u>e||n==ft.TrackBefore&&s<e||n==ft.TrackAfter&&u>e))return null;if(u>e||u==e&&t<0&&!a)return e==s||t<0?r:r+c;r+=c}s=u}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let n=0,s=0;n<this.sections.length&&s<=t;){let r=this.sections[n++],o=this.sections[n++],a=s+r;if(o>=0&&s<=t&&a>=e)return s<e&&a>t?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+n+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new hi(e)}static create(e){return new hi(e)}}class it extends hi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Zl(this,(t,n,s,r,o)=>e=e.replace(s,s+(n-t),o),!1),e}mapDesc(e,t=!1){return Fl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],a=t[s+1];if(a>=0){t[s]=a,t[s+1]=o;let c=s>>1;for(;n.length<c;)n.push(Qe.empty);n.push(o?e.slice(r,r+o):Qe.empty)}r+=o}return new it(t,n)}compose(e){return this.empty?e:e.empty?this:Pf(this,e,!0)}map(e,t=!1){return e.empty?this:Fl(this,e,t,!0)}iterChanges(e,t=!1){Zl(this,e,t)}get desc(){return hi.create(this.sections)}filter(e){let t=[],n=[],s=[],r=new gs(this);e:for(let o=0,a=0;;){let c=o==e.length?1e9:e[o++];for(;a<c||a==c&&r.len==0;){if(r.done)break e;let h=Math.min(r.len,c-a);gt(s,h,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;gt(t,h,f),f>0&&Xi(n,t,r.text),r.forward(h),a+=h}let u=e[o++];for(;a<u;){if(r.done)break e;let h=Math.min(r.len,u-a);gt(t,h,-1),gt(s,h,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(h),a+=h}}return{changes:new it(t,n),filtered:hi.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],s=this.sections[t+1];s<0?e.push(n):s==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let s=[],r=[],o=0,a=null;function c(h=!1){if(!h&&!s.length)return;o<t&>(s,t-o,-1);let f=new it(s,r);a=a?a.compose(f.map(a)):f,s=[],r=[],o=0}function u(h){if(Array.isArray(h))for(let f of h)u(f);else if(h instanceof it){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);c(),a=a?a.compose(h.map(a)):h}else{let{from:f,to:d=f,insert:m}=h;if(f>d||f<0||d>t)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${t})`);let O=m?typeof m=="string"?Qe.of(m.split(n||Il)):m:Qe.empty,w=O.length;if(f==d&&w==0)return;f<o&&c(),f>o&>(s,f-o,-1),gt(s,d-f,w),Xi(r,s,O),o=d}}return u(e),c(!a),a}static empty(e){return new it(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;n.length<s;)n.push(Qe.empty);n[s]=Qe.of(r.slice(1)),t.push(r[0],n[s].length)}}}return new it(t,n)}static createSet(e,t){return new it(e,t)}}function gt(i,e,t,n=!1){if(e==0&&t<=0)return;let s=i.length-2;s>=0&&t<=0&&t==i[s+1]?i[s]+=e:s>=0&&e==0&&i[s]==0?i[s+1]+=t:n?(i[s]+=e,i[s+1]+=t):i.push(e,t)}function Xi(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<n;)i.push(Qe.empty);i.push(t)}}function Zl(i,e,t){let n=i.inserted;for(let s=0,r=0,o=0;o<i.sections.length;){let a=i.sections[o++],c=i.sections[o++];if(c<0)s+=a,r+=a;else{let u=s,h=r,f=Qe.empty;for(;u+=a,h+=c,c&&n&&(f=f.append(n[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],c=i.sections[o++];e(s,u,r,h,f),s=u,r=h}}}function Fl(i,e,t,n=!1){let s=[],r=n?[]:null,o=new gs(i),a=new gs(e);for(let c=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let u=Math.min(o.len,a.len);gt(s,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let u=a.len;for(gt(s,a.ins,-1);u;){let h=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=h&&(gt(s,0,o.ins),r&&Xi(r,s,o.text),c=o.i),o.forward(h),u-=h}a.next()}else if(o.ins>=0){let u=0,h=o.len;for(;h;)if(a.ins==-1){let f=Math.min(h,a.len);u+=f,h-=f,a.forward(f)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;gt(s,u,c<o.i?o.ins:0),r&&c<o.i&&Xi(r,s,o.text),c=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return r?it.createSet(s,r):hi.create(s);throw new Error("Mismatched change set lengths")}}}function Pf(i,e,t=!1){let n=[],s=t?[]:null,r=new gs(i),o=new gs(e);for(let a=!1;;){if(r.done&&o.done)return s?it.createSet(n,s):hi.create(n);if(r.ins==0)gt(n,r.len,0,a),r.next();else if(o.len==0&&!o.done)gt(n,0,o.ins,a),s&&Xi(s,n,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let c=Math.min(r.len2,o.len),u=n.length;if(r.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;gt(n,c,h,a),s&&h&&Xi(s,n,o.text)}else o.ins==-1?(gt(n,r.off?0:r.len,c,a),s&&Xi(s,n,r.textBit(c))):(gt(n,r.off?0:r.len,o.off?0:o.ins,a),s&&!o.off&&Xi(s,n,o.text));a=(r.ins>c||o.ins>=0&&o.len>c)&&(a||n.length>u),r.forward2(c),o.forward(c)}}}}class gs{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Qe.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class fn{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,s;return this.empty?n=s=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new fn(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return X.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return X.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return X.range(e.anchor,e.head)}static create(e,t,n){return new fn(e,t,n)}}class X{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:X.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new X([this.main],0)}addRange(e,t=!0){return X.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,X.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new X(e.ranges.map(t=>fn.fromJSON(t)),e.main)}static single(e,t=e){return new X([X.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=n:r.from<n)return X.normalized(e.slice(),t);n=r.to}return new X(e,t)}static cursor(e,t=0,n,s){return fn.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(s??16777215)<<6)}static range(e,t,n,s){let r=(n??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?fn.create(t,e,48|r):fn.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(n);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let a=o.from,c=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?X.range(c,a):X.range(a,c))}}return new X(e,t)}}function Qf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ul=0;class ce{constructor(e,t,n,s,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=s,this.id=Ul++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new ce(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Xl),!!e.static,e.enables)}of(e){return new Er([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Er(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Er(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Xl(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class Er{constructor(e,t,n,s){this.dependencies=e,this.facet=t,this.type=n,this.value=s,this.id=Ul++}dynamicSlot(e){var t;let n=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,a=this.type==2,c=!1,u=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,d){if(c&&d.docChanged||u&&(d.docChanged||d.selection)||Wl(f,h)){let m=n(f);if(a?!Ef(m,f.values[o],s):!s(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,d)=>{let m,O=d.config.address[r];if(O!=null){let w=Rr(d,O);if(this.dependencies.every(g=>g instanceof ce?d.facet(g)===f.facet(g):g instanceof rt?d.field(g,!1)==f.field(g,!1):!0)||(a?Ef(m=n(f),w,s):s(m=n(f),w)))return f.values[o]=w,0}else m=n(f);return f.values[o]=m,1}}}}function Ef(i,e,t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!t(i[n],e[n]))return!1;return!0}function Wl(i,e){let t=!1;for(let n of e)bs(i,n)&1&&(t=!0);return t}function nw(i,e,t){let n=t.map(c=>i[c.id]),s=t.map(c=>c.type),r=n.filter(c=>!(c&1)),o=i[e.id]>>1;function a(c){let u=[];for(let h=0;h<n.length;h++){let f=Rr(c,n[h]);if(s[h]==2)for(let d of f)u.push(d);else u.push(f)}return e.combine(u)}return{create(c){for(let u of n)bs(c,u);return c.values[o]=a(c),1},update(c,u){if(!Wl(c,r))return 0;let h=a(c);return e.compare(h,c.values[o])?0:(c.values[o]=h,1)},reconfigure(c,u){let h=Wl(c,n),f=u.config.facets[e.id],d=u.facet(e);if(f&&!h&&Xl(t,f))return c.values[o]=d,0;let m=a(c);return e.compare(m,d)?(c.values[o]=d,0):(c.values[o]=m,1)}}}const $r=ce.define({static:!0});class rt{constructor(e,t,n,s,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new rt(Ul++,e.create,e.update,e.compare||((n,s)=>n===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet($r).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,s)=>{let r=n.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(n.values[t]=o,1)},reconfigure:(n,s)=>{let r=n.facet($r),o=s.facet($r),a;return(a=r.find(c=>c.field==this))&&a!=o.find(c=>c.field==this)?(n.values[t]=a.create(n),1):s.config.address[this.id]!=null?(n.values[t]=s.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,$r.of({field:this,create:e})]}get extension(){return this}}const dn={lowest:4,low:3,default:2,high:1,highest:0};function Os(i){return e=>new $f(e,i)}const Wi={highest:Os(dn.highest),high:Os(dn.high),default:Os(dn.default),low:Os(dn.low),lowest:Os(dn.lowest)};class $f{constructor(e,t){this.inner=e,this.prec=t}}class _s{of(e){return new ql(this,e)}reconfigure(e){return _s.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ql{constructor(e,t){this.compartment=e,this.inner=t}}class Nr{constructor(e,t,n,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let s=[],r=Object.create(null),o=new Map;for(let d of sw(e,t,o))d instanceof rt?s.push(d):(r[d.facet.id]||(r[d.facet.id]=[])).push(d);let a=Object.create(null),c=[],u=[];for(let d of s)a[d.id]=u.length<<1,u.push(m=>d.slot(m));let h=n==null?void 0:n.config.facets;for(let d in r){let m=r[d],O=m[0].facet,w=h&&h[d]||[];if(m.every(g=>g.type==0))if(a[O.id]=c.length<<1|1,Xl(w,m))c.push(n.facet(O));else{let g=O.combine(m.map(p=>p.value));c.push(n&&O.compare(g,n.facet(O))?n.facet(O):g)}else{for(let g of m)g.type==0?(a[g.id]=c.length<<1|1,c.push(g.value)):(a[g.id]=u.length<<1,u.push(p=>g.dynamicSlot(p)));a[O.id]=u.length<<1,u.push(g=>nw(g,O,m))}}let f=u.map(d=>d(a));return new Nr(e,o,f,a,c,r)}}function sw(i,e,t){let n=[[],[],[],[],[]],s=new Map;function r(o,a){let c=s.get(o);if(c!=null){if(c<=a)return;let u=n[c].indexOf(o);u>-1&&n[c].splice(u,1),o instanceof ql&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let u of o)r(u,a);else if(o instanceof ql){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;t.set(o.compartment,u),r(u,a)}else if(o instanceof $f)r(o.inner,o.prec);else if(o instanceof rt)n[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof Er)n[a].push(o),o.facet.extensions&&r(o.facet.extensions,dn.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(u,a)}}return r(i,dn.default),n.reduce((o,a)=>o.concat(a))}function bs(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let s=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|s}function Rr(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Nf=ce.define(),jl=ce.define({combine:i=>i.some(e=>e),static:!0}),Rf=ce.define({combine:i=>i.length?i[0]:void 0,static:!0}),Vf=ce.define(),Lf=ce.define(),Mf=ce.define(),Df=ce.define({combine:i=>i.length?i[0]:!1});class Ei{constructor(e,t){this.type=e,this.value=t}static define(){return new rw}}class rw{of(e){return new Ei(this,e)}}class ow{constructor(e){this.map=e}of(e){return new ke(this,e)}}class ke{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ke(this.type,t)}is(e){return this.type==e}static define(e={}){return new ow(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let s of e){let r=s.map(t);r&&n.push(r)}return n}}ke.reconfigure=ke.define(),ke.appendConfig=ke.define();class He{constructor(e,t,n,s,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Qf(n,t.newLength),r.some(a=>a.type==He.time)||(this.annotations=r.concat(He.time.of(Date.now())))}static create(e,t,n,s,r,o){return new He(e,t,n,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(He.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}He.time=Ei.define(),He.userEvent=Ei.define(),He.addToHistory=Ei.define(),He.remote=Ei.define();function lw(i,e){let t=[];for(let n=0,s=0;;){let r,o;if(n<i.length&&(s==e.length||e[s]>=i[n]))r=i[n++],o=i[n++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Bf(i,e,t){var n;let s,r,o;return t?(s=e.changes,r=it.empty(e.changes.length),o=i.changes.compose(e.changes)):(s=e.changes.map(i.changes),r=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(n=i.selection)===null||n===void 0?void 0:n.map(s),effects:ke.mapEffects(i.effects,s).concat(ke.mapEffects(e.effects,r)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function zl(i,e,t){let n=e.selection,s=Mn(e.annotations);return e.userEvent&&(s=s.concat(He.userEvent.of(e.userEvent))),{changes:e.changes instanceof it?e.changes:it.of(e.changes||[],t,i.facet(Rf)),selection:n&&(n instanceof X?n:X.single(n.anchor,n.head)),effects:Mn(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function vf(i,e,t){let n=zl(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;n=Bf(n,zl(i,e[r],o?n.changes.newLength:i.doc.length),o)}let s=He.create(i,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return cw(t?aw(s):s)}function aw(i){let e=i.startState,t=!0;for(let s of e.facet(Vf)){let r=s(i);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:lw(t,r))}if(t!==!0){let s,r;if(t===!1)r=i.changes.invertedDesc,s=it.empty(e.doc.length);else{let o=i.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}i=He.create(e,s,i.selection&&i.selection.map(r),ke.mapEffects(i.effects,r),i.annotations,i.scrollIntoView)}let n=e.facet(Lf);for(let s=n.length-1;s>=0;s--){let r=n[s](i);r instanceof He?i=r:Array.isArray(r)&&r.length==1&&r[0]instanceof He?i=r[0]:i=vf(e,Mn(r),!1)}return i}function cw(i){let e=i.startState,t=e.facet(Mf),n=i;for(let s=t.length-1;s>=0;s--){let r=t[s](i);r&&Object.keys(r).length&&(n=Bf(n,zl(e,r,i.changes.newLength),!0))}return n==i?i:He.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const uw=[];function Mn(i){return i==null?uw:Array.isArray(i)?i:[i]}var Xe=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(Xe||(Xe={}));const hw=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Yl;try{Yl=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function fw(i){if(Yl)return Yl.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||hw.test(t)))return!0}return!1}function dw(i){return e=>{if(!/\S/.test(e))return Xe.Space;if(fw(e))return Xe.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return Xe.Word;return Xe.Other}}class Te{constructor(e,t,n,s,r,o){this.config=e,this.doc=t,this.selection=n,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)bs(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return bs(this,n),Rr(this,n)}update(...e){return vf(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:s}=t;for(let a of e.effects)a.is(_s.reconfigure)?(t&&(s=new Map,t.compartments.forEach((c,u)=>s.set(u,c)),t=null),s.set(a.value.compartment,a.value.extension)):a.is(ke.reconfigure)?(t=null,n=a.value):a.is(ke.appendConfig)&&(t=null,n=Mn(n).concat(a.value));let r;t?r=e.startState.values.slice():(t=Nr.resolve(n,s,this),r=new Te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=e.startState.facet(jl)?e.newSelection:e.newSelection.asSingle();new Te(t,e.newDoc,o,r,(a,c)=>c.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:X.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),s=this.changes(n.changes),r=[n.range],o=Mn(n.effects);for(let a=1;a<t.ranges.length;a++){let c=e(t.ranges[a]),u=this.changes(c.changes),h=u.map(s);for(let d=0;d<a;d++)r[d]=r[d].map(h);let f=s.mapDesc(u,!0);r.push(c.range.map(f)),s=s.compose(h),o=ke.mapEffects(o,h).concat(ke.mapEffects(Mn(c.effects),f))}return{changes:s,selection:X.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof it?e:it.of(e,this.doc.length,this.facet(Te.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(Te.lineSeparator)||Il))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(bs(this,t),Rr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let s=e[n];s instanceof rt&&this.config.address[s.id]!=null&&(t[n]=s.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n){for(let r in n)if(Object.prototype.hasOwnProperty.call(e,r)){let o=n[r],a=e[r];s.push(o.init(c=>o.spec.fromJSON(a,c)))}}return Te.create({doc:e.doc,selection:X.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Nr.resolve(e.extensions||[],new Map),n=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet(Te.lineSeparator)||Il)),s=e.selection?e.selection instanceof X?e.selection:X.single(e.selection.anchor,e.selection.head):X.single(0);return Qf(s,n.length),t.staticFacet(jl)||(s=s.asSingle()),new Te(t,n,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(Te.tabSize)}get lineBreak(){return this.facet(Te.lineSeparator)||`
|
|
25
|
+
`}get readOnly(){return this.facet(Df)}phrase(e,...t){for(let n of this.facet(Te.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?n:t[r-1]})),e}languageDataAt(e,t,n=-1){let s=[];for(let r of this.facet(Nf))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return dw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let c=ht(t,o,!1);if(r(t.slice(c,o))!=Xe.Word)break;o=c}for(;a<s;){let c=ht(t,a);if(r(t.slice(a,c))!=Xe.Word)break;a=c}return o==a?null:X.range(o+n,a+n)}}Te.allowMultipleSelections=jl,Te.tabSize=ce.define({combine:i=>i.length?i[0]:4}),Te.lineSeparator=Rf,Te.readOnly=Df,Te.phrases=ce.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(s=>i[s]==e[s])}}),Te.languageData=Nf,Te.changeFilter=Vf,Te.transactionFilter=Lf,Te.transactionExtender=Mf,_s.reconfigure=ke.define();function fi(i,e,t={}){let n={};for(let s of i)for(let r of Object.keys(s)){let o=s[r],a=n[r];if(a===void 0)n[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,r))n[r]=t[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)n[s]===void 0&&(n[s]=e[s]);return n}class pn{eq(e){return this==e}range(e,t=e){return Gl.create(e,t,this)}}pn.prototype.startSide=pn.prototype.endSide=0,pn.prototype.point=!1,pn.prototype.mapMode=ft.TrackDel;let Gl=class m_{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new m_(e,t,n)}};function Kl(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class Hl{constructor(e,t,n,s){this.from=e,this.to=t,this.value=n,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,s=0){let r=n?this.to:this.from;for(let o=s,a=r.length;;){if(o==a)return o;let c=o+a>>1,u=r[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==o)return u>=0?o:a;u>=0?a=c:o=c+1}}between(e,t,n,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(s(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let n=[],s=[],r=[],o=-1,a=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],h=this.from[c]+e,f=this.to[c]+e,d,m;if(h==f){let O=t.mapPos(h,u.startSide,u.mapMode);if(O==null||(d=m=O,u.startSide!=u.endSide&&(m=t.mapPos(h,u.endSide),m<d)))continue}else if(d=t.mapPos(h,u.startSide),m=t.mapPos(f,u.endSide),d>m||d==m&&u.startSide>0&&u.endSide<=0)continue;(m-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(a=Math.max(a,m-d)),n.push(u),s.push(d-o),r.push(m-o))}return{mapped:n.length?new Hl(s,r,n,a):null,pos:o}}}class Ne{constructor(e,t,n,s){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=s}static create(e,t,n,s){return new Ne(e,t,n,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Kl)),this.isEmpty)return t.length?Ne.of(t):this;let a=new Zf(this,null,-1).goto(0),c=0,u=[],h=new $i;for(;a.value||c<t.length;)if(c<t.length&&(a.from-t[c].from||a.startSide-t[c].value.startSide)>=0){let f=t[c++];h.addInner(f.from,f.to,f.value)||u.push(f)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(a.chunkIndex)<t[c].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||r<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||r<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||u.push(Gl.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!u.length?Ne.empty:this.nextLayer.update({add:u,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],c=this.chunk[o],u=e.touchesRange(a,a+c.length);if(u===!1)s=Math.max(s,c.maxPoint),t.push(c),n.push(e.mapPos(a));else if(u===!0){let{mapped:h,pos:f}=c.map(a,e);h&&(s=Math.max(s,h.maxPoint),t.push(h),n.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new Ne(n,t,r||Ne.empty,s)}between(e,t,n){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return ys.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ys.from(e).goto(t)}static compare(e,t,n,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),c=If(o,a,n),u=new ws(o,c,r),h=new ws(a,c,r);n.iterGaps((f,d,m)=>Ff(u,f,h,d,m,s)),n.empty&&n.length==0&&Ff(u,0,h,0,0,s)}static eq(e,t,n=0,s){s==null&&(s=1e9-1);let r=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=If(r,o),c=new ws(r,a,0).goto(n),u=new ws(o,a,0).goto(n);for(;;){if(c.to!=u.to||!ea(c.active,u.active)||c.point&&(!u.point||!c.point.eq(u.point)))return!1;if(c.to>s)return!0;c.next(),u.next()}}static spans(e,t,n,s,r=-1){let o=new ws(e,null,r).goto(t),a=t,c=o.openStart;for(;;){let u=Math.min(o.to,n);if(o.point){let h=o.activeForPoint(o.to),f=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,c);s.point(a,u,o.point,h,f,o.pointRank),c=Math.min(o.openEnd(u),h.length)}else u>a&&(s.span(a,u,o.active,c),c=o.openEnd(u));if(o.to>n)return c+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new $i;for(let s of e instanceof Gl?[e]:t?pw(e):e)n.add(s.from,s.to,s.value);return n.finish()}static join(e){if(!e.length)return Ne.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=Ne.empty;s=s.nextLayer)t=new Ne(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}Ne.empty=new Ne([],[],null,-1);function pw(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let n=i[t];if(Kl(e,n)>0)return i.slice().sort(Kl);e=n}return i}Ne.empty.nextLayer=Ne.empty;class $i{finishChunk(e){this.chunks.push(new Hl(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new $i)).add(e,t,n)}addInner(e,t,n){let s=e-this.lastTo||n.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ne.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ne.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function If(i,e,t){let n=new Map;for(let r of i)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&n.set(r.chunk[o],r.chunkPos[o]);let s=new Set;for(let r of e)for(let o=0;o<r.chunk.length;o++){let a=n.get(r.chunk[o]);a!=null&&(t?t.mapPos(a):a)==r.chunkPos[o]&&!(t!=null&&t.touchesRange(a,a+r.chunk[o].length))&&s.add(r.chunk[o])}return s}class Zf{constructor(e,t,n,s=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class ys{constructor(e){this.heap=e}static from(e,t=null,n=-1){let s=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&s.push(new Zf(o,t,n,r));return s.length==1?s[0]:new ys(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jl(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jl(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Jl(this.heap,0)}}}function Jl(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let s=i[n];if(n+1<i.length&&s.compare(i[n+1])>=0&&(s=i[n+1],n++),t.compare(s)<0)break;i[n]=t,i[e]=s,e=n}}class ws{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=ys.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Vr(this.active,e),Vr(this.activeTo,e),Vr(this.activeRank,e),this.minActive=Uf(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:s,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||s-this.activeTo[t])>0;)t++;Lr(this.active,t,n),Lr(this.activeTo,t,s),Lr(this.activeRank,t,r),e&&Lr(e,t,this.cursor.from),this.minActive=Uf(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),n&&Vr(n,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let s=n.length-1;s>=0&&n[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Ff(i,e,t,n,s,r){i.goto(e),t.goto(n);let o=n+s,a=n,c=n-e;for(;;){let u=i.to+c-t.to,h=u||i.endSide-t.endSide,f=h<0?i.to+c:t.to,d=Math.min(f,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&ea(i.activeForPoint(i.to),t.activeForPoint(t.to))||r.comparePoint(a,d,i.point,t.point):d>a&&!ea(i.active,t.active)&&r.compareRange(a,d,i.active,t.active),f>o)break;(u||i.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),a=f,h<=0&&i.next(),h>=0&&t.next()}}function ea(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!i[t].eq(e[t]))return!1;return!0}function Vr(i,e){for(let t=e,n=i.length-1;t<n;t++)i[t]=i[t+1];i.pop()}function Lr(i,e,t){for(let n=i.length-1;n>=e;n--)i[n+1]=i[n];i[e]=t}function Uf(i,e){let t=-1,n=1e9;for(let s=0;s<e.length;s++)(e[s]-n||i[s].endSide-i[t].endSide)<0&&(t=s,n=e[s]);return t}function Dn(i,e,t=i.length){let n=0;for(let s=0;s<t&&s<i.length;)i.charCodeAt(s)==9?(n+=e-n%e,s++):(n++,s=ht(i,s));return n}function ta(i,e,t,n){for(let s=0,r=0;;){if(r>=e)return s;if(s==i.length)break;r+=i.charCodeAt(s)==9?t-r%t:1,s=ht(i,s)}return n===!0?-1:i.length}const ia="ͼ",Xf=typeof Symbol>"u"?"__"+ia:Symbol.for(ia),na=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Wf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class qi{constructor(e,t){this.rules=[];let{finish:n}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,a,c,u){let h=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&a==null)return c.push(o[0]+";");for(let m in a){let O=a[m];if(/&/.test(m))r(m.split(/,\s*/).map(w=>o.map(g=>w.replace(/&/,g))).reduce((w,g)=>w.concat(g)),O,c);else if(O&&typeof O=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");r(s(m),O,h,d)}else O!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+O+";")}(h.length||d)&&c.push((n&&!f&&!u?o.map(n):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
26
26
|
`)}static newName(){let e=Wf[Xf]||1;return Wf[Xf]=e+1,ia+e.toString(36)}static mount(e,t,n){let s=e[na],r=n&&n.nonce;s?r&&s.setNonce(r):s=new mw(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let qf=new Map;class mw{constructor(e,t){let n=e.ownerDocument||e,s=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=qf.get(n);if(r)return e[na]=r;this.sheet=new s.CSSStyleSheet,qf.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[na]=this}mount(e,t){let n=this.sheet,s=0,r=0;for(let o=0;o<e.length;o++){let a=e[o],c=this.modules.indexOf(a);if(c<r&&c>-1&&(this.modules.splice(c,1),r--,c=-1),c==-1){if(this.modules.splice(r++,0,a),n)for(let u=0;u<a.rules.length;u++)n.insertRule(a.rules[u],s++)}else{for(;r<c;)s+=this.modules[r++].rules.length;s+=a.rules.length,r++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let c=0;c<this.modules.length;c++)o+=this.modules[c].getRules()+`
|
|
27
|
-
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var ji={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ks={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ow=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),dt=0;dt<10;dt++)ji[48+dt]=ji[96+dt]=String(dt);for(var dt=1;dt<=24;dt++)ji[dt+111]="F"+dt;for(var dt=65;dt<=90;dt++)ji[dt]=String.fromCharCode(dt+32),ks[dt]=String.fromCharCode(dt);for(var sa in ji)ks.hasOwnProperty(sa)||(ks[sa]=ji[sa]);function _w(i){var e=gw&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||Ow&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ks:ji)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ie(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];typeof s=="string"?i.setAttribute(n,s):s!=null&&(i[n]=s)}e++}for(;e<arguments.length;e++)jf(i,arguments[e]);return i}function jf(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)jf(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}let wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ra=typeof document<"u"?document:{documentElement:{style:{}}};const oa=/Edge\/(\d+)/.exec(wt.userAgent),zf=/MSIE \d/.test(wt.userAgent),la=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wt.userAgent),Mr=!!(zf||la||oa),Yf=!Mr&&/gecko\/(\d+)/i.test(wt.userAgent),aa=!Mr&&/Chrome\/(\d+)/.exec(wt.userAgent),Gf="webkitFontSmoothing"in ra.documentElement.style,ca=!Mr&&/Apple Computer/.test(wt.vendor),Kf=ca&&(/Mobile\/\w+/.test(wt.userAgent)||wt.maxTouchPoints>2);var re={mac:Kf||/Mac/.test(wt.platform),windows:/Win/.test(wt.platform),linux:/Linux|X11/.test(wt.platform),ie:Mr,ie_version:zf?ra.documentMode||6:la?+la[1]:oa?+oa[1]:0,gecko:Yf,gecko_version:Yf?+(/Firefox\/(\d+)/.exec(wt.userAgent)||[0,0])[1]:0,chrome:!!aa,chrome_version:aa?+aa[1]:0,ios:Kf,android:/Android\b/.test(wt.userAgent),webkit:Gf,webkit_version:Gf?+(/\bAppleWebKit\/(\d+)/.exec(wt.userAgent)||[0,0])[1]:0,safari:ca,safari_version:ca?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wt.userAgent)||[0,0])[1]:0,tabSize:ra.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function xs(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function ua(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Dr(i,e){if(!e.anchorNode)return!1;try{return ua(i,e.anchorNode)}catch{return!1}}function Bn(i){return i.nodeType==3?On(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ss(i,e,t,n){return t?Hf(i,e,t,n,-1)||Hf(i,e,t,n,1):!1}function mn(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Br(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Hf(i,e,t,n,s){for(;;){if(i==t&&e==n)return!0;if(e==(s<0?0:di(i))){if(i.nodeName=="DIV")return!1;let r=i.parentNode;if(!r||r.nodeType!=1)return!1;e=mn(i)+(s<0?0:1),i=r}else if(i.nodeType==1){if(i=i.childNodes[e+(s<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=s<0?di(i):0}else return!1}}function di(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Cs(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function bw(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Jf(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function yw(i,e,t,n,s,r,o,a){let c=i.ownerDocument,u=c.defaultView||window;for(let h=i,f=!1;h&&!f;)if(h.nodeType==1){let d,m=h==c.body,O=1,w=1;if(m)d=bw(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let b=h.getBoundingClientRect();({scaleX:O,scaleY:w}=Jf(h,b)),d={left:b.left,right:b.left+h.clientWidth*O,top:b.top,bottom:b.top+h.clientHeight*w}}let g=0,p=0;if(s=="nearest")e.top<d.top?(p=e.top-(d.top+o),t>0&&e.bottom>d.bottom+p&&(p=e.bottom-d.bottom+o)):e.bottom>d.bottom&&(p=e.bottom-d.bottom+o,t<0&&e.top-p<d.top&&(p=e.top-(d.top+o)));else{let b=e.bottom-e.top,k=d.bottom-d.top;p=(s=="center"&&b<=k?e.top+b/2-k/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-k+o)-d.top}if(n=="nearest"?e.left<d.left?(g=e.left-(d.left+r),t>0&&e.right>d.right+g&&(g=e.right-d.right+r)):e.right>d.right&&(g=e.right-d.right+r,t<0&&e.left<d.left+g&&(g=e.left-(d.left+r))):g=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-r:e.right-(d.right-d.left)+r)-d.left,g||p)if(m)u.scrollBy(g,p);else{let b=0,k=0;if(p){let y=h.scrollTop;h.scrollTop+=p/w,k=(h.scrollTop-y)*w}if(g){let y=h.scrollLeft;h.scrollLeft+=g/O,b=(h.scrollLeft-y)*O}e={left:e.left-b,top:e.top-k,right:e.right-b,bottom:e.bottom-k},b&&Math.abs(b-g)<1&&(n="nearest"),k&&Math.abs(k-p)<1&&(s="nearest")}if(m)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function ww(i){let e=i.ownerDocument,t,n;for(let s=i.parentNode;s&&!(s==e.body||t&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:n}}class kw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?di(t):0),n,Math.min(e.focusOffset,n?di(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let gn=null;re.safari&&re.safari_version>=26&&(gn=!1);function ed(i){if(i.setActive)return i.setActive();if(gn)return i.focus(gn);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(gn==null?{get preventScroll(){return gn={preventScroll:!0},!0}}:void 0),!gn){gn=!1;for(let t=0;t<e.length;){let n=e[t++],s=e[t++],r=e[t++];n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=r&&(n.scrollLeft=r)}}}let td;function On(i,e,t=e){let n=td||(td=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function vn(i,e,t,n){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,i.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,i.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function xw(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function id(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function Sw(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,di(t));;)if(n){if(t.nodeType!=1)return!1;let s=t.childNodes[n-1];s.contentEditable=="false"?n--:(t=s,n=di(t))}else{if(t==i)return!0;n=mn(t),t=t.parentNode}}function nd(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function sd(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=di(t)}else if(t.parentNode&&!Br(t))n=mn(t),t=t.parentNode;else return null}}function rd(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Br(t))n=mn(t)+1,t=t.parentNode;else return null}}class Ot{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ot(e.parentNode,mn(e),t)}static after(e,t){return new Ot(e.parentNode,mn(e)+1,t)}}const ha=[];class De{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,s=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=s?s.nextSibling:n.firstChild)){let a=De.get(r);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=s?s.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&r!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;r&&r!=o.dom;)r=od(r);else n.insertBefore(o.dom,r);s=o.dom}for(r=s?s.nextSibling:n.firstChild,r&&t&&t.node==n&&(t.written=!0);r;)r=od(r)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let s=di(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?s=-1:s=1),e=r}s<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!De.get(n);)n=n.nextSibling;if(!n)return this.length;for(let s=0,r=0;;s++){let o=this.children[s];if(o.dom==n)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let s=-1,r=-1,o=-1,a=-1;for(let c=0,u=n,h=n;c<this.children.length;c++){let f=this.children[c],d=u+f.length;if(u<e&&d>t)return f.domBoundsAround(e,t,u);if(d>=e&&s==-1&&(s=c,r=u),u>t&&f.dom.parentNode==this.dom){o=c,a=h;break}h=d,u=d+f.breakAfter}return{from:r,to:a<0?n+this.length:a,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ha){this.markDirty();for(let s=e;s<t;s++){let r=this.children[s];r.parent==this&&n.indexOf(r)<0&&r.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let s=0;s<n.length;s++)n[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new ld(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,s,r,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}De.prototype.breakAfter=0;function od(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class ld{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function ad(i,e,t,n,s,r,o,a,c){let{children:u}=i,h=u.length?u[e]:null,f=r.length?r[r.length-1]:null,d=f?f.breakAfter:o;if(!(e==n&&h&&!o&&!d&&r.length<2&&h.merge(t,s,r.length?f:null,t==0,a,c))){if(n<u.length){let m=u[n];m&&(s<m.length||m.breakAfter&&(f!=null&&f.breakAfter))?(e==n&&(m=m.split(s),s=0),!d&&f&&m.merge(0,s,f,!0,0,c)?r[r.length-1]=m:((s||m.children.length&&!m.children[0].length)&&m.merge(0,s,null,!1,0,c),r.push(m))):m!=null&&m.breakAfter&&(f?f.breakAfter=1:o=1),n++}for(h&&(h.breakAfter=o,t>0&&(!o&&r.length&&h.merge(t,h.length,r[0],!1,a,0)?h.breakAfter=r.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,a,0),e++));e<n&&r.length;)if(u[n-1].become(r[r.length-1]))n--,r.pop(),c=r.length?0:a;else if(u[e].become(r[0]))e++,r.shift(),a=r.length?0:c;else break;!r.length&&e&&n<u.length&&!u[e-1].breakAfter&&u[n].merge(0,0,u[e-1],!1,a,c)&&e--,(e<n||r.length)&&i.replaceChildren(e,n,r)}}function cd(i,e,t,n,s,r){let o=i.childCursor(),{i:a,off:c}=o.findPos(t,1),{i:u,off:h}=o.findPos(e,-1),f=e-t;for(let d of n)f+=d.length;i.length+=f,ad(i,u,h,a,c,n,0,s,r)}const Cw=256;class Ht extends De{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof Ht)||this.length-(t-e)+n.length>Cw||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ht(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ot(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Aw(this.dom,e,t)}}class Ni extends De{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let s of t)s.setParent(this)}setAttrs(e){if(id(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,s,r,o){return n&&(!(n instanceof Ni&&n.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0)?!1:(cd(this,e,t,n?n.children.slice():[],r-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,s=-1,r=0;for(let a of this.children){let c=n+a.length;c>e&&t.push(n<e?a.split(e-n):a),s<0&&n>=e&&(s=r),n=c,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ni(this.mark,t,o)}domAtPos(e){return ud(this,e)}coordsAt(e,t){return fd(this,e,t)}}function Aw(i,e,t){let n=i.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;e==0&&t<0||e==n&&t>=0?re.chrome||re.gecko||(e?(s--,o=1):r<n&&(r++,o=-1)):t<0?s--:r<n&&r++;let a=On(i,s,r).getClientRects();if(!a.length)return null;let c=a[(o?o<0:t>=0)?0:a.length-1];return re.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?Cs(c,o<0):c||null}class Ri extends De{static create(e,t,n){return new Ri(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ri.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,s,r,o){return n&&(!(n instanceof Ri)||!this.widget.compare(n.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Ri&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Qe.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,s=this.posAtStart;return n?n.slice(s,s+this.length):Qe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ot.before(this.dom):Ot.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?s.length-1:0;r=s[a],!(e>0?a==0:a==s.length-1||r.top<r.bottom);a+=o?-1:1);return Cs(r,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class In extends De{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof In&&e.side==this.side}split(){return new In(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ot.before(this.dom):Ot.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Qe.empty}get isHidden(){return!0}}Ht.prototype.children=Ri.prototype.children=In.prototype.children=ha;function ud(i,e){let t=i.dom,{children:n}=i,s=0;for(let r=0;s<n.length;s++){let o=n[s],a=r+o.length;if(!(a==r&&o.getSide()<=0)){if(e>r&&e<a&&o.dom.parentNode==t)return o.domAtPos(e-r);if(e<=r)break;r=a}}for(let r=s;r>0;r--){let o=n[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r<n.length;r++){let o=n[r];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Ot(t,0)}function hd(i,e,t){let n,{children:s}=i;t>0&&e instanceof Ni&&s.length&&(n=s[s.length-1])instanceof Ni&&n.mark.eq(e.mark)?hd(n,e.children[0],t-1):(s.push(e),e.setParent(i)),i.length+=e.length}function fd(i,e,t){let n=null,s=-1,r=null,o=-1;function a(u,h){for(let f=0,d=0;f<u.children.length&&d<=h;f++){let m=u.children[f],O=d+m.length;O>=h&&(m.children.length?a(m,h-d):(!r||r.isHidden&&(t>0||Pw(r,m)))&&(O>h||d==O&&m.getSide()>0)?(r=m,o=h-d):(d<h||d==O&&m.getSide()<0&&!m.isHidden)&&(n=m,s=h-d)),d=O}}a(i,e);let c=(t<0?n:r)||n||r;return c?c.coordsAt(Math.max(0,c==n?s:o),t):Tw(i)}function Tw(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Bn(e);return t[t.length-1]||null}function Pw(i,e){let t=i.coordsAt(0,1),n=e.coordsAt(0,1);return t&&n&&n.top<t.bottom}function fa(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}const dd=Object.create(null);function vr(i,e,t){if(i==e)return!0;i||(i=dd),e||(e=dd);let n=Object.keys(i),s=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of n)if(r!=t&&(s.indexOf(r)==-1||i[r]!==e[r]))return!1;return!0}function da(i,e,t){let n=!1;if(e)for(let s in e)t&&s in t||(n=!0,s=="style"?i.style.cssText="":i.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(n=!0,s=="style"?i.style.cssText=t[s]:i.setAttribute(s,t[s]));return n}function Qw(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let n=i.attributes[t];e[n.name]=n.value}return e}class pi{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var kt=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(kt||(kt={}));class pe extends pn{constructor(e,t,n,s){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(e){return new As(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new zi(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,s;if(e.isBlockGap)n=-5e8,s=4e8;else{let{start:r,end:o}=pd(e,t);n=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new zi(e,n,s,t,e.widget||null,!0)}static line(e){return new Ts(e)}static set(e,t=!1){return Ne.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}pe.none=Ne.empty;class As extends pe{constructor(e){let{start:t,end:n}=pd(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof As&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&vr(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}As.prototype.point=!1;class Ts extends pe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ts&&this.spec.class==e.spec.class&&vr(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ts.prototype.mapMode=ft.TrackBefore,Ts.prototype.point=!0;class zi extends pe{constructor(e,t,n,s,r,o){super(t,n,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?ft.TrackBefore:ft.TrackAfter:ft.TrackDel}get type(){return this.startSide!=this.endSide?kt.WidgetRange:this.startSide<=0?kt.WidgetBefore:kt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof zi&&Ew(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}zi.prototype.point=!0;function pd(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t??e,end:n??e}}function Ew(i,e){return i==e||!!(i&&e&&i.compare(e))}function Ir(i,e,t,n=0){let s=t.length-1;s>=0&&t[s]+n>=i?t[s]=Math.max(t[s],e):t.push(i,e)}class Je extends De{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,s,r,o){if(n){if(!(n instanceof Je))return!1;this.dom||n.transferDOM(this)}return s&&this.setDeco(n?n.attrs:null),cd(this,e,t,n?n.children.slice():[],r,o),!0}split(e){let t=new Je;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:s}=this.childPos(e);s&&(t.append(this.children[n].split(s),0),this.children[n].merge(s,this.children[n].length,null,!1,0,0),n++);for(let r=n;r<this.children.length;r++)t.append(this.children[r],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){vr(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){hd(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=fa(t,this.attrs||{})),n&&(this.attrs=fa({class:n},this.attrs||{}))}domAtPos(e){return ud(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(id(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(da(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&De.get(s)instanceof Ni;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((n=De.get(s))===null||n===void 0?void 0:n.isEditable)==!1&&(!re.ios||!this.children.some(r=>r instanceof Ht))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof Ht)||/[^ -~]/.test(n.text))return null;let s=Bn(n.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=fd(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=n.bottom-n.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight<r){let o=(r-s.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return e instanceof Je&&this.children.length==0&&e.children.length==0&&vr(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,s=0;n<e.children.length;n++){let r=e.children[n],o=s+r.length;if(o>=t){if(r instanceof Je)return r;if(o>t)break}s=o+r.breakAfter}return null}}class Vi extends De{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,s,r,o){return n&&(!(n instanceof Vi)||!this.widget.compare(n.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ot.before(this.dom):Ot.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Vi(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ha}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Qe.empty}domBoundsAround(){return null}become(e){return e instanceof Vi&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof pa?null:Cs(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class pa extends pi{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Ps{constructor(e,t,n,s){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Vi&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Je),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Zr(new In(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Vi)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:a,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(a){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),r=Math.min(s,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Zr(new Ht(this.text.slice(this.textOff,this.textOff+r)),t),n),this.atCursorPos=!0,this.textOff+=r,e-=r,n=s<=r?0:t.length}}span(e,t,n,s){this.buildText(t-e,n,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,n,s,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof zi){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(n instanceof zi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Vi(n.widget||Zn.block,a,n));else{let c=Ri.create(n.widget||Zn.inline,a,a?0:n.startSide),u=this.atCursorPos&&!c.isEditable&&r<=s.length&&(e<t||n.startSide>0),h=!c.isEditable&&(e<t||r>s.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),u&&(f.append(Zr(new In(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Zr(c,s),r),this.atCursorPos=h,this.pendingBuffer=h?e<t||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,n,s,r){let o=new Ps(e,t,n,r);return o.openEnd=Ne.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Zr(i,e){for(let t of e)i=new Ni(t,[i],i.length);return i}class Zn extends pi{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Zn.inline=new Zn("span"),Zn.block=new Zn("div");var Fe=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Fe||(Fe={}));const _n=Fe.LTR,ma=Fe.RTL;function md(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const $w=md("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Nw=md("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ga=Object.create(null),mi=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);ga[e]=t,ga[t]=-e}function gd(i){return i<=247?$w[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?Nw[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const Rw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Yi{get dir(){return this.level%2?ma:_n}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,s){let r=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==n)return o;(r<0||(s!=0?s<0?a.from<t:a.to>t:e[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Od(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let n=i[t],s=e[t];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!Od(n.inner,s.inner))return!1}return!0}const Ze=[];function Vw(i,e,t,n,s){for(let r=0;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t,c=r?256:s;for(let u=o,h=c,f=c;u<a;u++){let d=gd(i.charCodeAt(u));d==512?d=h:d==8&&f==4&&(d=16),Ze[u]=d==4?2:d,d&7&&(f=d),h=d}for(let u=o,h=c,f=c;u<a;u++){let d=Ze[u];if(d==128)u<a-1&&h==Ze[u+1]&&h&24?d=Ze[u]=h:Ze[u]=256;else if(d==64){let m=u+1;for(;m<a&&Ze[m]==64;)m++;let O=u&&h==8||m<t&&Ze[m]==8?f==1?1:8:256;for(let w=u;w<m;w++)Ze[w]=O;u=m-1}else d==8&&f==1&&(Ze[u]=1);h=d,d&7&&(f=d)}}}function Lw(i,e,t,n,s){let r=s==1?2:1;for(let o=0,a=0,c=0;o<=n.length;o++){let u=o?n[o-1].to:e,h=o<n.length?n[o].from:t;for(let f=u,d,m,O;f<h;f++)if(m=ga[d=i.charCodeAt(f)])if(m<0){for(let w=a-3;w>=0;w-=3)if(mi[w+1]==-m){let g=mi[w+2],p=g&2?s:g&4?g&1?r:s:0;p&&(Ze[f]=Ze[mi[w]]=p),a=w;break}}else{if(mi.length==189)break;mi[a++]=f,mi[a++]=d,mi[a++]=c}else if((O=Ze[f])==2||O==1){let w=O==s;c=w?0:1;for(let g=a-3;g>=0;g-=3){let p=mi[g+2];if(p&2)break;if(w)mi[g+2]|=2;else{if(p&4)break;mi[g+2]|=4}}}}}function Mw(i,e,t,n){for(let s=0,r=n;s<=t.length;s++){let o=s?t[s-1].to:i,a=s<t.length?t[s].from:e;for(let c=o;c<a;){let u=Ze[c];if(u==256){let h=c+1;for(;;)if(h==a){if(s==t.length)break;h=t[s++].to,a=s<t.length?t[s].from:e}else if(Ze[h]==256)h++;else break;let f=r==1,d=(h<e?Ze[h]:n)==1,m=f==d?f?1:2:n;for(let O=h,w=s,g=w?t[w-1].to:i;O>c;)O==g&&(O=t[--w].from,g=w?t[w-1].to:i),Ze[--O]=m;c=h}else r=u,c++}}}function Oa(i,e,t,n,s,r,o){let a=n%2?2:1;if(n%2==s%2)for(let c=e,u=0;c<t;){let h=!0,f=!1;if(u==r.length||c<r[u].from){let w=Ze[c];w!=a&&(h=!1,f=w==16)}let d=!h&&a==1?[]:null,m=h?n:n+1,O=c;e:for(;;)if(u<r.length&&O==r[u].from){if(f)break e;let w=r[u];if(!h)for(let g=w.to,p=u+1;;){if(g==t)break e;if(p<r.length&&r[p].from==g)g=r[p++].to;else{if(Ze[g]==a)break e;break}}if(u++,d)d.push(w);else{w.from>c&&o.push(new Yi(c,w.from,m));let g=w.direction==_n!=!(m%2);_a(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.to}O=w.to}else{if(O==t||(h?Ze[O]!=a:Ze[O]==a))break;O++}d?Oa(i,c,O,n+1,s,d,o):c<O&&o.push(new Yi(c,O,m)),c=O}else for(let c=t,u=r.length;c>e;){let h=!0,f=!1;if(!u||c>r[u-1].to){let w=Ze[c-1];w!=a&&(h=!1,f=w==16)}let d=!h&&a==1?[]:null,m=h?n:n+1,O=c;e:for(;;)if(u&&O==r[u-1].to){if(f)break e;let w=r[--u];if(!h)for(let g=w.from,p=u;;){if(g==e)break e;if(p&&r[p-1].to==g)g=r[--p].from;else{if(Ze[g-1]==a)break e;break}}if(d)d.push(w);else{w.to<c&&o.push(new Yi(w.to,c,m));let g=w.direction==_n!=!(m%2);_a(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.from}O=w.from}else{if(O==e||(h?Ze[O-1]!=a:Ze[O-1]==a))break;O--}d?Oa(i,O,c,n+1,s,d,o):O<c&&o.push(new Yi(O,c,m)),c=O}}function _a(i,e,t,n,s,r,o){let a=e%2?2:1;Vw(i,s,r,n,a),Lw(i,s,r,n,a),Mw(s,r,n,a),Oa(i,s,r,e,t,n,o)}function Dw(i,e,t){if(!i)return[new Yi(0,0,e==ma?1:0)];if(e==_n&&!t.length&&!Rw.test(i))return _d(i.length);if(t.length)for(;i.length>Ze.length;)Ze[Ze.length]=256;let n=[],s=e==_n?0:1;return _a(i,s,s,t,0,i.length,n),n}function _d(i){return[new Yi(0,i,0)]}let bd="";function Bw(i,e,t,n,s){var r;let o=n.head-i.from,a=Yi.find(e,o,(r=n.bidiLevel)!==null&&r!==void 0?r:-1,n.assoc),c=e[a],u=c.side(s,t);if(o==u){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;c=e[a=d],o=c.side(!s,t),u=c.side(s,t)}let h=ht(i.text,o,c.forward(s,t));(h<c.from||h>c.to)&&(h=u),bd=i.text.slice(Math.min(o,h),Math.max(o,h));let f=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return f&&h==u&&f.level+(s?0:1)<c.level?X.cursor(f.side(!s,t)+i.from,f.forward(s,t)?1:-1,f.level):X.cursor(h+i.from,c.forward(s,t)?-1:1,c.level)}function vw(i,e,t){for(let n=e;n<t;n++){let s=gd(i.charCodeAt(n));if(s==1)return _n;if(s==2||s==4)return ma}return _n}const yd=ae.define(),wd=ae.define(),kd=ae.define(),xd=ae.define(),ba=ae.define(),Sd=ae.define(),Cd=ae.define(),ya=ae.define(),wa=ae.define(),Ad=ae.define({combine:i=>i.some(e=>e)}),Td=ae.define({combine:i=>i.some(e=>e)}),Pd=ae.define();class Fn{constructor(e,t="nearest",n="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Fn(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Fn(X.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fr=ke.define({map:(i,e)=>i.map(e)}),Qd=ke.define();function Pt(i,e,t){let n=i.facet(xd);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Li=ae.define({combine:i=>i.length?i[0]:!0});let Iw=0;const Un=ae.define({combine(i){return i.filter((e,t)=>{for(let n=0;n<t;n++)if(i[n].plugin==e.plugin)return!1;return!0})}});class Ye{constructor(e,t,n,s,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Un.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Un.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=t||{};return new Ye(Iw++,e,n,s,a=>{let c=[];return o&&c.push(Qs.of(u=>{let h=u.plugin(a);return h?o(h):pe.none})),r&&c.push(r(a)),c})}static fromClass(e,t){return Ye.define((n,s)=>new e(n,s),t)}}class ka{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Pt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Pt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ed=ae.define(),xa=ae.define(),Qs=ae.define(),$d=ae.define(),Es=ae.define(),Nd=ae.define();function Rd(i,e){let t=i.state.facet(Nd);if(!t.length)return t;let n=t.map(r=>r instanceof Function?r(i):r),s=[];return Ne.spans(n,e.from,e.to,{point(){},span(r,o,a,c){let u=r-e.from,h=o-e.from,f=s;for(let d=a.length-1;d>=0;d--,c--){let m=a[d].spec.bidiIsolate,O;if(m==null&&(m=vw(e.text,u,h)),c>0&&f.length&&(O=f[f.length-1]).to==u&&O.direction==m)O.to=h,f=O.inner;else{let w={from:u,to:h,direction:m,inner:[]};f.push(w),f=w.inner}}}}),s}const Vd=ae.define();function Sa(i){let e=0,t=0,n=0,s=0;for(let r of i.state.facet(Vd)){let o=r(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:n,bottom:s}}const $s=ae.define();class Ft{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new Ft(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>n.toA)){if(s.toA<n.fromA)break;n=n.join(s),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let s=0,r=0,o=0,a=0;;s++){let c=s==e.length?null:e[s],u=o-a,h=c?c.fromB:1e9;for(;r<t.length&&t[r]<h;){let f=t[r],d=t[r+1],m=Math.max(a,f),O=Math.min(h,d);if(m<=O&&new Ft(m+u,O+u,m,O).addToSet(n),d>h)break;r+=2}if(!c)return n;new Ft(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),o=c.toA,a=c.toB}}}class Ur{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=it.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,a,c)=>s.push(new Ft(r,o,a,c))),this.changedRanges=s}static create(e,t,n){return new Ur(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Ld extends De{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=pe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Je],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ft(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:u,toA:h})=>h<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!jw(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Fw(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:h}=this.hasComposition;n=new Ft(u,h,e.changes.mapPos(u,-1),e.changes.mapPos(h,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(re.ie||re.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),c=Ww(o,a,e.changes);return n=Ft.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=re.chrome||re.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Vi&&o.widget instanceof pa&&r.push(o.dom);s.updateGaps(r)}updateChildren(e,t,n){let s=n?n.range.addToSet(e.slice()):e,r=this.childCursor(t);for(let o=s.length-1;;o--){let a=o>=0?s[o]:null;if(!a)break;let{fromA:c,toA:u,fromB:h,toB:f}=a,d,m,O,w;if(n&&n.range.fromB<f&&n.range.toB>h){let y=Ps.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),C=Ps.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=y.breakAtStart,O=y.openStart,w=C.openEnd;let T=this.compositionView(n);C.breakAtStart?T.breakAfter=1:C.content.length&&T.merge(T.length,T.length,C.content[0],!1,C.openStart,0)&&(T.breakAfter=C.content[0].breakAfter,C.content.shift()),y.content.length&&T.merge(0,0,y.content[y.content.length-1],!0,0,y.openEnd)&&y.content.pop(),d=y.content.concat(T).concat(C.content)}else({content:d,breakAtStart:m,openStart:O,openEnd:w}=Ps.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:p}=r.findPos(u,1),{i:b,off:k}=r.findPos(c,-1);ad(this,b,k,g,p,d,m,O,w)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(Qd)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new Ht(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Ni(s,[t],t.length);let n=new Je;return n.append(t,0),n}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(o);let a=De.get(r);a&&a!=o&&(a.dom=null),o.setDOM(r)},n=this.childPos(e.range.fromB,1),s=this.children[n.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)n=s.childPos(n.off,1),s=s.children[n.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,s=n==this.dom,r=!s&&!(this.view.state.facet(Li)||this.dom.tabIndex>-1)&&Dr(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?c:this.moveToLine(this.domAtPos(a.head));if(re.gecko&&a.empty&&!this.hasComposition&&Zw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new Ot(f,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||(!Ss(c.node,c.offset,h.anchorNode,h.anchorOffset)||!Ss(u.node,u.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{re.android&&re.chrome&&this.dom.contains(h.focusNode)&&qw(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=xs(this.view.root);if(f)if(a.empty){if(re.gecko){let d=Uw(c.node,c.offset);if(d&&d!=3){let m=(d==1?sd:rd)(c.node,c.offset);m&&(c=new Ot(m.node,m.offset))}}f.collapse(c.node,c.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([c,u]=[u,c]),d.setEnd(u.node,u.offset),d.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(d)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new Ot(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new Ot(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ss(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=xs(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Je.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let c=this.coordsAt(t.head,-1),u=this.coordsAt(t.head,1);if(!c||!u||c.bottom>u.top)return;let h=this.domAtPos(t.head+t.assoc);n.collapse(h.node,h.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&n.collapse(s,r)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let s=e.offset;!n&&s<t.childNodes.length;s++){let r=De.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(0))}for(let s=e.offset-1;!n&&s>=0;s--){let r=De.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(r.length))}return n?new Ot(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=De.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let s=this.children[t];if(n<s.length||s instanceof Je)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,s=0;for(let r=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],c=r-a.breakAfter,u=c-a.length;if(c<e)break;if(u<=e&&(u<e||a.covers(-1))&&(c>e||a.covers(1))&&(!n||a instanceof Je&&!(n instanceof Je&&t>=0)))n=a,s=u;else if(n&&u==e&&c==e&&a instanceof Vi&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(n=null)}r=u}return n?n.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),s=this.children[t];if(!(s instanceof Je))return null;for(;s.children.length;){let{i:a,off:c}=s.childPos(n,1);for(;;a++){if(a==s.children.length)return null;if((s=s.children[a]).length)break}n=c}if(!(s instanceof Ht))return null;let r=ht(s.text,n);if(r==n)return null;let o=On(s.dom,n,r).getClientRects();for(let a=0;a<o.length;a++){let c=o[a];if(a==o.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,c=this.view.textDirection==Fe.LTR;for(let u=0,h=0;h<this.children.length;h++){let f=this.children[h],d=u+f.length;if(d>s)break;if(u>=n){let m=f.dom.getBoundingClientRect();if(t.push(m.height),o){let O=f.dom.lastChild,w=O?Bn(O):[];if(w.length){let g=w[w.length-1],p=c?g.right-m.left:m.right-g.left;p>a&&(a=p,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=d)}}}u=d+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Fe.RTL:Fe.LTR}measureTextSize(){for(let r of this.children)if(r instanceof Je){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Bn(e.firstChild)[0];t=e.getBoundingClientRect().height,n=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new ld(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(pe.replace({widget:new pa(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return pe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Qs).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,s=this.view.state.facet($d).map((r,o)=>{let a=typeof r=="function";return a&&(n=!0),a?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(Ne.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(Pd))try{if(u(this.view,e.range,e))return!0}catch(h){Pt(this.view.state,h,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!n)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let r=Sa(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:a,offsetHeight:c}=this.view.scrollDOM;yw(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Fe.LTR)}lineHasWidget(e){let{i:t}=this.childCursor().findPos(e);if(t==this.children.length)return!1;let n=s=>s instanceof Ri||s.children.some(n);return n(this.children[t])}}function Zw(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function Md(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=sd(t.focusNode,t.focusOffset),s=rd(t.focusNode,t.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let a=De.get(s.node);if(!a||a instanceof Ht&&a.text!=s.node.nodeValue)r=s;else if(i.docView.lastCompositionAfterCursor){let c=De.get(n.node);!c||c instanceof Ht&&c.text!=n.node.nodeValue||(r=s)}}if(i.docView.lastCompositionAfterCursor=r!=n,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Fw(i,e,t){let n=Md(i,t);if(!n)return null;let{node:s,from:r,to:o}=n,a=s.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(n.from,n.to)!=a)return null;let c=e.invertedDesc,u=new Ft(c.mapPos(r),c.mapPos(o),r,o),h=[];for(let f=s.parentNode;;f=f.parentNode){let d=De.get(f);if(d instanceof Ni)h.push({node:f,deco:d.mark});else{if(d instanceof Je||f.nodeName=="DIV"&&f.parentNode==i.contentDOM)return{range:u,text:s,marks:h,line:f};if(f!=i.contentDOM)h.push({node:f,deco:new As({inclusive:!0,attributes:Qw(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Uw(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}let Xw=class{constructor(){this.changes=[]}compareRange(e,t){Ir(e,t,this.changes)}comparePoint(e,t){Ir(e,t,this.changes)}boundChange(e){Ir(e,e,this.changes)}};function Ww(i,e,t){let n=new Xw;return Ne.compare(i,e,t,n),n.changes}function qw(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function jw(i,e){let t=!1;return e&&i.iterChangedRanges((n,s)=>{n<e.to&&s>e.from&&(t=!0)}),t}function zw(i,e,t=1){let n=i.charCategorizer(e),s=i.doc.lineAt(e),r=e-s.from;if(s.length==0)return X.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,a=r;t<0?o=ht(s.text,r,!1):a=ht(s.text,r);let c=n(s.text.slice(o,a));for(;o>0;){let u=ht(s.text,o,!1);if(n(s.text.slice(u,o))!=c)break;o=u}for(;a<s.length;){let u=ht(s.text,a);if(n(s.text.slice(a,u))!=c)break;a=u}return X.range(o+s.from,a+s.from)}function Yw(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function Gw(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Ca(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function Dd(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function Bd(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function Aa(i,e,t){let n,s,r,o,a=!1,c,u,h,f;for(let O=i.firstChild;O;O=O.nextSibling){let w=Bn(O);for(let g=0;g<w.length;g++){let p=w[g];s&&Ca(s,p)&&(p=Dd(Bd(p,s.bottom),s.top));let b=Yw(e,p),k=Gw(t,p);if(b==0&&k==0)return O.nodeType==3?vd(O,e,t):Aa(O,e,t);(!n||o>k||o==k&&r>b)&&(n=O,s=p,r=b,o=k,a=b?e<p.left?g>0:g<w.length-1:!0),b==0?t>p.bottom&&(!h||h.bottom<p.bottom)?(c=O,h=p):t<p.top&&(!f||f.top>p.top)&&(u=O,f=p):h&&Ca(h,p)?h=Bd(h,p.bottom):f&&Ca(f,p)&&(f=Dd(f,p.top))}}if(h&&h.bottom>=t?(n=c,s=h):f&&f.top<=t&&(n=u,s=f),!n)return{node:i,offset:0};let d=Math.max(s.left,Math.min(s.right,e));if(n.nodeType==3)return vd(n,d,t);if(a&&n.contentEditable!="false")return Aa(n,d,t);let m=Array.prototype.indexOf.call(i.childNodes,n)+(e>=(s.left+s.right)/2?1:0);return{node:i,offset:m}}function vd(i,e,t){let n=i.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;a<n;a++){let c=On(i,a,a+1).getClientRects();for(let u=0;u<c.length;u++){let h=c[u];if(h.top==h.bottom)continue;o||(o=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<r){let d=e>=(h.left+h.right)/2,m=d;if(re.chrome||re.gecko){let O=On(i,a).getBoundingClientRect();Math.abs(O.left-h.right)<.1&&(m=!d)}if(f<=0)return{node:i,offset:a+(m?1:0)};s=a+(m?1:0),r=f}}}return{node:i,offset:s>-1?s:o>0?i.nodeValue.length:0}}function Id(i,e,t,n=-1){var s,r;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,c,{docHeight:u}=i.viewState,{x:h,y:f}=e,d=f-a;if(d<0)return 0;if(d>u)return i.state.doc.length;for(let y=i.viewState.heightOracle.textHeight/2,C=!1;c=i.elementAtHeight(d),c.type!=kt.Text;)for(;d=n>0?c.bottom+y:c.top-y,!(d>=0&&d<=u);){if(C)return t?null:0;C=!0,n=-n}f=a+d;let m=c.from;if(m<i.viewport.from)return i.viewport.from==0?0:t?null:Zd(i,o,c,h,f);if(m>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:Zd(i,o,c,h,f);let O=i.dom.ownerDocument,w=i.root.elementFromPoint?i.root:O,g=w.elementFromPoint(h,f);g&&!i.contentDOM.contains(g)&&(g=null),g||(h=Math.max(o.left+1,Math.min(o.right-1,h)),g=w.elementFromPoint(h,f),g&&!i.contentDOM.contains(g)&&(g=null));let p,b=-1;if(g&&((s=i.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(O.caretPositionFromPoint){let y=O.caretPositionFromPoint(h,f);y&&({offsetNode:p,offset:b}=y)}else if(O.caretRangeFromPoint){let y=O.caretRangeFromPoint(h,f);y&&({startContainer:p,startOffset:b}=y)}p&&(!i.contentDOM.contains(p)||re.safari&&Kw(p,b,h)||re.chrome&&Hw(p,b,h))&&(p=void 0),p&&(b=Math.min(di(p),b))}if(!p||!i.docView.dom.contains(p)){let y=Je.find(i.docView,m);if(!y)return d>c.top+c.height/2?c.to:c.from;({node:p,offset:b}=Aa(y.dom,h,f))}let k=i.docView.nearest(p);if(!k)return null;if(k.isWidget&&((r=k.dom)===null||r===void 0?void 0:r.nodeType)==1){let y=k.dom.getBoundingClientRect();return e.y<y.top||e.y<=y.bottom&&e.x<=(y.left+y.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(p,b)+k.posAtStart}function Zd(i,e,t,n,s){let r=Math.round((n-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,c=Math.floor((s-t.top-(i.defaultLineHeight-a)*.5)/a);r+=c*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+ta(o,r,i.state.tabSize)}function Fd(i,e,t){let n,s=i;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(;;){let r=s.nextSibling;if(r){if(r.nodeName=="BR")break;return!1}else{let o=s.parentNode;if(!o||o.nodeName=="DIV")break;s=o}}return On(i,n-1,n).getBoundingClientRect().right>t}function Kw(i,e,t){return Fd(i,e,t)}function Hw(i,e,t){if(e!=0)return Fd(i,e,t);for(let s=i;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let n=i.nodeType==1?i.getBoundingClientRect():On(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function Ta(i,e,t){let n=i.lineBlockAt(e);if(Array.isArray(n.type)){let s;for(let r of n.type){if(r.from>e)break;if(!(r.to<e)){if(r.from<e&&r.to>e)return r;(!s||r.type==kt.Text&&(s.type!=r.type||(t<0?r.from<e:r.to>e)))&&(s=r)}}return s||n}return n}function Jw(i,e,t,n){let s=Ta(i,e.head,e.assoc||-1),r=!n||s.type!=kt.Text||!(i.lineWrapping||s.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(s.from),c=i.posAtCoords({x:t==(a==Fe.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(c!=null)return X.cursor(c,t?-1:1)}return X.cursor(t?s.to:s.from,t?-1:1)}function Ud(i,e,t,n){let s=i.state.doc.lineAt(e.head),r=i.bidiSpans(s),o=i.textDirectionAt(s.from);for(let a=e,c=null;;){let u=Bw(s,r,o,a,t),h=bd;if(!u){if(s.number==(t?i.state.doc.lines:1))return a;h=`
|
|
27
|
+
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var ji={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ks={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ow=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),dt=0;dt<10;dt++)ji[48+dt]=ji[96+dt]=String(dt);for(var dt=1;dt<=24;dt++)ji[dt+111]="F"+dt;for(var dt=65;dt<=90;dt++)ji[dt]=String.fromCharCode(dt+32),ks[dt]=String.fromCharCode(dt);for(var sa in ji)ks.hasOwnProperty(sa)||(ks[sa]=ji[sa]);function _w(i){var e=gw&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||Ow&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ks:ji)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ie(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];typeof s=="string"?i.setAttribute(n,s):s!=null&&(i[n]=s)}e++}for(;e<arguments.length;e++)jf(i,arguments[e]);return i}function jf(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)jf(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}let wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ra=typeof document<"u"?document:{documentElement:{style:{}}};const oa=/Edge\/(\d+)/.exec(wt.userAgent),zf=/MSIE \d/.test(wt.userAgent),la=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wt.userAgent),Mr=!!(zf||la||oa),Yf=!Mr&&/gecko\/(\d+)/i.test(wt.userAgent),aa=!Mr&&/Chrome\/(\d+)/.exec(wt.userAgent),Gf="webkitFontSmoothing"in ra.documentElement.style,ca=!Mr&&/Apple Computer/.test(wt.vendor),Kf=ca&&(/Mobile\/\w+/.test(wt.userAgent)||wt.maxTouchPoints>2);var re={mac:Kf||/Mac/.test(wt.platform),windows:/Win/.test(wt.platform),linux:/Linux|X11/.test(wt.platform),ie:Mr,ie_version:zf?ra.documentMode||6:la?+la[1]:oa?+oa[1]:0,gecko:Yf,gecko_version:Yf?+(/Firefox\/(\d+)/.exec(wt.userAgent)||[0,0])[1]:0,chrome:!!aa,chrome_version:aa?+aa[1]:0,ios:Kf,android:/Android\b/.test(wt.userAgent),webkit:Gf,webkit_version:Gf?+(/\bAppleWebKit\/(\d+)/.exec(wt.userAgent)||[0,0])[1]:0,safari:ca,safari_version:ca?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wt.userAgent)||[0,0])[1]:0,tabSize:ra.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function xs(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function ua(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Dr(i,e){if(!e.anchorNode)return!1;try{return ua(i,e.anchorNode)}catch{return!1}}function Bn(i){return i.nodeType==3?On(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ss(i,e,t,n){return t?Hf(i,e,t,n,-1)||Hf(i,e,t,n,1):!1}function mn(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Br(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Hf(i,e,t,n,s){for(;;){if(i==t&&e==n)return!0;if(e==(s<0?0:di(i))){if(i.nodeName=="DIV")return!1;let r=i.parentNode;if(!r||r.nodeType!=1)return!1;e=mn(i)+(s<0?0:1),i=r}else if(i.nodeType==1){if(i=i.childNodes[e+(s<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=s<0?di(i):0}else return!1}}function di(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Cs(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function bw(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Jf(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function yw(i,e,t,n,s,r,o,a){let c=i.ownerDocument,u=c.defaultView||window;for(let h=i,f=!1;h&&!f;)if(h.nodeType==1){let d,m=h==c.body,O=1,w=1;if(m)d=bw(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let b=h.getBoundingClientRect();({scaleX:O,scaleY:w}=Jf(h,b)),d={left:b.left,right:b.left+h.clientWidth*O,top:b.top,bottom:b.top+h.clientHeight*w}}let g=0,p=0;if(s=="nearest")e.top<d.top?(p=e.top-(d.top+o),t>0&&e.bottom>d.bottom+p&&(p=e.bottom-d.bottom+o)):e.bottom>d.bottom&&(p=e.bottom-d.bottom+o,t<0&&e.top-p<d.top&&(p=e.top-(d.top+o)));else{let b=e.bottom-e.top,k=d.bottom-d.top;p=(s=="center"&&b<=k?e.top+b/2-k/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-k+o)-d.top}if(n=="nearest"?e.left<d.left?(g=e.left-(d.left+r),t>0&&e.right>d.right+g&&(g=e.right-d.right+r)):e.right>d.right&&(g=e.right-d.right+r,t<0&&e.left<d.left+g&&(g=e.left-(d.left+r))):g=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-r:e.right-(d.right-d.left)+r)-d.left,g||p)if(m)u.scrollBy(g,p);else{let b=0,k=0;if(p){let y=h.scrollTop;h.scrollTop+=p/w,k=(h.scrollTop-y)*w}if(g){let y=h.scrollLeft;h.scrollLeft+=g/O,b=(h.scrollLeft-y)*O}e={left:e.left-b,top:e.top-k,right:e.right-b,bottom:e.bottom-k},b&&Math.abs(b-g)<1&&(n="nearest"),k&&Math.abs(k-p)<1&&(s="nearest")}if(m)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function ww(i){let e=i.ownerDocument,t,n;for(let s=i.parentNode;s&&!(s==e.body||t&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:n}}class kw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?di(t):0),n,Math.min(e.focusOffset,n?di(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let gn=null;re.safari&&re.safari_version>=26&&(gn=!1);function ed(i){if(i.setActive)return i.setActive();if(gn)return i.focus(gn);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(gn==null?{get preventScroll(){return gn={preventScroll:!0},!0}}:void 0),!gn){gn=!1;for(let t=0;t<e.length;){let n=e[t++],s=e[t++],r=e[t++];n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=r&&(n.scrollLeft=r)}}}let td;function On(i,e,t=e){let n=td||(td=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function vn(i,e,t,n){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,i.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,i.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function xw(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function id(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function Sw(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,di(t));;)if(n){if(t.nodeType!=1)return!1;let s=t.childNodes[n-1];s.contentEditable=="false"?n--:(t=s,n=di(t))}else{if(t==i)return!0;n=mn(t),t=t.parentNode}}function nd(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function sd(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=di(t)}else if(t.parentNode&&!Br(t))n=mn(t),t=t.parentNode;else return null}}function rd(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Br(t))n=mn(t)+1,t=t.parentNode;else return null}}class Ot{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ot(e.parentNode,mn(e),t)}static after(e,t){return new Ot(e.parentNode,mn(e)+1,t)}}const ha=[];class De{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,s=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=s?s.nextSibling:n.firstChild)){let a=De.get(r);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=s?s.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&r!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;r&&r!=o.dom;)r=od(r);else n.insertBefore(o.dom,r);s=o.dom}for(r=s?s.nextSibling:n.firstChild,r&&t&&t.node==n&&(t.written=!0);r;)r=od(r)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let s=di(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?s=-1:s=1),e=r}s<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!De.get(n);)n=n.nextSibling;if(!n)return this.length;for(let s=0,r=0;;s++){let o=this.children[s];if(o.dom==n)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let s=-1,r=-1,o=-1,a=-1;for(let c=0,u=n,h=n;c<this.children.length;c++){let f=this.children[c],d=u+f.length;if(u<e&&d>t)return f.domBoundsAround(e,t,u);if(d>=e&&s==-1&&(s=c,r=u),u>t&&f.dom.parentNode==this.dom){o=c,a=h;break}h=d,u=d+f.breakAfter}return{from:r,to:a<0?n+this.length:a,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ha){this.markDirty();for(let s=e;s<t;s++){let r=this.children[s];r.parent==this&&n.indexOf(r)<0&&r.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let s=0;s<n.length;s++)n[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new ld(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,s,r,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}De.prototype.breakAfter=0;function od(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class ld{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function ad(i,e,t,n,s,r,o,a,c){let{children:u}=i,h=u.length?u[e]:null,f=r.length?r[r.length-1]:null,d=f?f.breakAfter:o;if(!(e==n&&h&&!o&&!d&&r.length<2&&h.merge(t,s,r.length?f:null,t==0,a,c))){if(n<u.length){let m=u[n];m&&(s<m.length||m.breakAfter&&(f!=null&&f.breakAfter))?(e==n&&(m=m.split(s),s=0),!d&&f&&m.merge(0,s,f,!0,0,c)?r[r.length-1]=m:((s||m.children.length&&!m.children[0].length)&&m.merge(0,s,null,!1,0,c),r.push(m))):m!=null&&m.breakAfter&&(f?f.breakAfter=1:o=1),n++}for(h&&(h.breakAfter=o,t>0&&(!o&&r.length&&h.merge(t,h.length,r[0],!1,a,0)?h.breakAfter=r.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,a,0),e++));e<n&&r.length;)if(u[n-1].become(r[r.length-1]))n--,r.pop(),c=r.length?0:a;else if(u[e].become(r[0]))e++,r.shift(),a=r.length?0:c;else break;!r.length&&e&&n<u.length&&!u[e-1].breakAfter&&u[n].merge(0,0,u[e-1],!1,a,c)&&e--,(e<n||r.length)&&i.replaceChildren(e,n,r)}}function cd(i,e,t,n,s,r){let o=i.childCursor(),{i:a,off:c}=o.findPos(t,1),{i:u,off:h}=o.findPos(e,-1),f=e-t;for(let d of n)f+=d.length;i.length+=f,ad(i,u,h,a,c,n,0,s,r)}const Cw=256;class Ht extends De{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof Ht)||this.length-(t-e)+n.length>Cw||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ht(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ot(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Aw(this.dom,e,t)}}class Ni extends De{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let s of t)s.setParent(this)}setAttrs(e){if(id(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,s,r,o){return n&&(!(n instanceof Ni&&n.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0)?!1:(cd(this,e,t,n?n.children.slice():[],r-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,s=-1,r=0;for(let a of this.children){let c=n+a.length;c>e&&t.push(n<e?a.split(e-n):a),s<0&&n>=e&&(s=r),n=c,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ni(this.mark,t,o)}domAtPos(e){return ud(this,e)}coordsAt(e,t){return fd(this,e,t)}}function Aw(i,e,t){let n=i.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;e==0&&t<0||e==n&&t>=0?re.chrome||re.gecko||(e?(s--,o=1):r<n&&(r++,o=-1)):t<0?s--:r<n&&r++;let a=On(i,s,r).getClientRects();if(!a.length)return null;let c=a[(o?o<0:t>=0)?0:a.length-1];return re.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?Cs(c,o<0):c||null}class Ri extends De{static create(e,t,n){return new Ri(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ri.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,s,r,o){return n&&(!(n instanceof Ri)||!this.widget.compare(n.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Ri&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Qe.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,s=this.posAtStart;return n?n.slice(s,s+this.length):Qe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ot.before(this.dom):Ot.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?s.length-1:0;r=s[a],!(e>0?a==0:a==s.length-1||r.top<r.bottom);a+=o?-1:1);return Cs(r,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class In extends De{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof In&&e.side==this.side}split(){return new In(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ot.before(this.dom):Ot.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Qe.empty}get isHidden(){return!0}}Ht.prototype.children=Ri.prototype.children=In.prototype.children=ha;function ud(i,e){let t=i.dom,{children:n}=i,s=0;for(let r=0;s<n.length;s++){let o=n[s],a=r+o.length;if(!(a==r&&o.getSide()<=0)){if(e>r&&e<a&&o.dom.parentNode==t)return o.domAtPos(e-r);if(e<=r)break;r=a}}for(let r=s;r>0;r--){let o=n[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r<n.length;r++){let o=n[r];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Ot(t,0)}function hd(i,e,t){let n,{children:s}=i;t>0&&e instanceof Ni&&s.length&&(n=s[s.length-1])instanceof Ni&&n.mark.eq(e.mark)?hd(n,e.children[0],t-1):(s.push(e),e.setParent(i)),i.length+=e.length}function fd(i,e,t){let n=null,s=-1,r=null,o=-1;function a(u,h){for(let f=0,d=0;f<u.children.length&&d<=h;f++){let m=u.children[f],O=d+m.length;O>=h&&(m.children.length?a(m,h-d):(!r||r.isHidden&&(t>0||Pw(r,m)))&&(O>h||d==O&&m.getSide()>0)?(r=m,o=h-d):(d<h||d==O&&m.getSide()<0&&!m.isHidden)&&(n=m,s=h-d)),d=O}}a(i,e);let c=(t<0?n:r)||n||r;return c?c.coordsAt(Math.max(0,c==n?s:o),t):Tw(i)}function Tw(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Bn(e);return t[t.length-1]||null}function Pw(i,e){let t=i.coordsAt(0,1),n=e.coordsAt(0,1);return t&&n&&n.top<t.bottom}function fa(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}const dd=Object.create(null);function vr(i,e,t){if(i==e)return!0;i||(i=dd),e||(e=dd);let n=Object.keys(i),s=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of n)if(r!=t&&(s.indexOf(r)==-1||i[r]!==e[r]))return!1;return!0}function da(i,e,t){let n=!1;if(e)for(let s in e)t&&s in t||(n=!0,s=="style"?i.style.cssText="":i.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(n=!0,s=="style"?i.style.cssText=t[s]:i.setAttribute(s,t[s]));return n}function Qw(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let n=i.attributes[t];e[n.name]=n.value}return e}class pi{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var kt=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(kt||(kt={}));class pe extends pn{constructor(e,t,n,s){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(e){return new As(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new zi(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,s;if(e.isBlockGap)n=-5e8,s=4e8;else{let{start:r,end:o}=pd(e,t);n=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new zi(e,n,s,t,e.widget||null,!0)}static line(e){return new Ts(e)}static set(e,t=!1){return Ne.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}pe.none=Ne.empty;class As extends pe{constructor(e){let{start:t,end:n}=pd(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof As&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&vr(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}As.prototype.point=!1;class Ts extends pe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ts&&this.spec.class==e.spec.class&&vr(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ts.prototype.mapMode=ft.TrackBefore,Ts.prototype.point=!0;class zi extends pe{constructor(e,t,n,s,r,o){super(t,n,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?ft.TrackBefore:ft.TrackAfter:ft.TrackDel}get type(){return this.startSide!=this.endSide?kt.WidgetRange:this.startSide<=0?kt.WidgetBefore:kt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof zi&&Ew(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}zi.prototype.point=!0;function pd(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t??e,end:n??e}}function Ew(i,e){return i==e||!!(i&&e&&i.compare(e))}function Ir(i,e,t,n=0){let s=t.length-1;s>=0&&t[s]+n>=i?t[s]=Math.max(t[s],e):t.push(i,e)}class Je extends De{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,s,r,o){if(n){if(!(n instanceof Je))return!1;this.dom||n.transferDOM(this)}return s&&this.setDeco(n?n.attrs:null),cd(this,e,t,n?n.children.slice():[],r,o),!0}split(e){let t=new Je;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:s}=this.childPos(e);s&&(t.append(this.children[n].split(s),0),this.children[n].merge(s,this.children[n].length,null,!1,0,0),n++);for(let r=n;r<this.children.length;r++)t.append(this.children[r],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){vr(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){hd(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=fa(t,this.attrs||{})),n&&(this.attrs=fa({class:n},this.attrs||{}))}domAtPos(e){return ud(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(id(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(da(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&De.get(s)instanceof Ni;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((n=De.get(s))===null||n===void 0?void 0:n.isEditable)==!1&&(!re.ios||!this.children.some(r=>r instanceof Ht))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof Ht)||/[^ -~]/.test(n.text))return null;let s=Bn(n.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=fd(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=n.bottom-n.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight<r){let o=(r-s.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return e instanceof Je&&this.children.length==0&&e.children.length==0&&vr(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,s=0;n<e.children.length;n++){let r=e.children[n],o=s+r.length;if(o>=t){if(r instanceof Je)return r;if(o>t)break}s=o+r.breakAfter}return null}}class Vi extends De{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,s,r,o){return n&&(!(n instanceof Vi)||!this.widget.compare(n.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ot.before(this.dom):Ot.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Vi(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ha}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Qe.empty}domBoundsAround(){return null}become(e){return e instanceof Vi&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof pa?null:Cs(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class pa extends pi{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Ps{constructor(e,t,n,s){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Vi&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Je),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Zr(new In(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Vi)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:a,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(a){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),r=Math.min(s,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Zr(new Ht(this.text.slice(this.textOff,this.textOff+r)),t),n),this.atCursorPos=!0,this.textOff+=r,e-=r,n=s<=r?0:t.length}}span(e,t,n,s){this.buildText(t-e,n,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,n,s,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof zi){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(n instanceof zi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Vi(n.widget||Zn.block,a,n));else{let c=Ri.create(n.widget||Zn.inline,a,a?0:n.startSide),u=this.atCursorPos&&!c.isEditable&&r<=s.length&&(e<t||n.startSide>0),h=!c.isEditable&&(e<t||r>s.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),u&&(f.append(Zr(new In(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Zr(c,s),r),this.atCursorPos=h,this.pendingBuffer=h?e<t||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,n,s,r){let o=new Ps(e,t,n,r);return o.openEnd=Ne.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Zr(i,e){for(let t of e)i=new Ni(t,[i],i.length);return i}class Zn extends pi{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Zn.inline=new Zn("span"),Zn.block=new Zn("div");var Fe=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Fe||(Fe={}));const _n=Fe.LTR,ma=Fe.RTL;function md(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const $w=md("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Nw=md("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ga=Object.create(null),mi=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);ga[e]=t,ga[t]=-e}function gd(i){return i<=247?$w[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?Nw[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const Rw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Yi{get dir(){return this.level%2?ma:_n}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,s){let r=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==n)return o;(r<0||(s!=0?s<0?a.from<t:a.to>t:e[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Od(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let n=i[t],s=e[t];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!Od(n.inner,s.inner))return!1}return!0}const Ze=[];function Vw(i,e,t,n,s){for(let r=0;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t,c=r?256:s;for(let u=o,h=c,f=c;u<a;u++){let d=gd(i.charCodeAt(u));d==512?d=h:d==8&&f==4&&(d=16),Ze[u]=d==4?2:d,d&7&&(f=d),h=d}for(let u=o,h=c,f=c;u<a;u++){let d=Ze[u];if(d==128)u<a-1&&h==Ze[u+1]&&h&24?d=Ze[u]=h:Ze[u]=256;else if(d==64){let m=u+1;for(;m<a&&Ze[m]==64;)m++;let O=u&&h==8||m<t&&Ze[m]==8?f==1?1:8:256;for(let w=u;w<m;w++)Ze[w]=O;u=m-1}else d==8&&f==1&&(Ze[u]=1);h=d,d&7&&(f=d)}}}function Lw(i,e,t,n,s){let r=s==1?2:1;for(let o=0,a=0,c=0;o<=n.length;o++){let u=o?n[o-1].to:e,h=o<n.length?n[o].from:t;for(let f=u,d,m,O;f<h;f++)if(m=ga[d=i.charCodeAt(f)])if(m<0){for(let w=a-3;w>=0;w-=3)if(mi[w+1]==-m){let g=mi[w+2],p=g&2?s:g&4?g&1?r:s:0;p&&(Ze[f]=Ze[mi[w]]=p),a=w;break}}else{if(mi.length==189)break;mi[a++]=f,mi[a++]=d,mi[a++]=c}else if((O=Ze[f])==2||O==1){let w=O==s;c=w?0:1;for(let g=a-3;g>=0;g-=3){let p=mi[g+2];if(p&2)break;if(w)mi[g+2]|=2;else{if(p&4)break;mi[g+2]|=4}}}}}function Mw(i,e,t,n){for(let s=0,r=n;s<=t.length;s++){let o=s?t[s-1].to:i,a=s<t.length?t[s].from:e;for(let c=o;c<a;){let u=Ze[c];if(u==256){let h=c+1;for(;;)if(h==a){if(s==t.length)break;h=t[s++].to,a=s<t.length?t[s].from:e}else if(Ze[h]==256)h++;else break;let f=r==1,d=(h<e?Ze[h]:n)==1,m=f==d?f?1:2:n;for(let O=h,w=s,g=w?t[w-1].to:i;O>c;)O==g&&(O=t[--w].from,g=w?t[w-1].to:i),Ze[--O]=m;c=h}else r=u,c++}}}function Oa(i,e,t,n,s,r,o){let a=n%2?2:1;if(n%2==s%2)for(let c=e,u=0;c<t;){let h=!0,f=!1;if(u==r.length||c<r[u].from){let w=Ze[c];w!=a&&(h=!1,f=w==16)}let d=!h&&a==1?[]:null,m=h?n:n+1,O=c;e:for(;;)if(u<r.length&&O==r[u].from){if(f)break e;let w=r[u];if(!h)for(let g=w.to,p=u+1;;){if(g==t)break e;if(p<r.length&&r[p].from==g)g=r[p++].to;else{if(Ze[g]==a)break e;break}}if(u++,d)d.push(w);else{w.from>c&&o.push(new Yi(c,w.from,m));let g=w.direction==_n!=!(m%2);_a(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.to}O=w.to}else{if(O==t||(h?Ze[O]!=a:Ze[O]==a))break;O++}d?Oa(i,c,O,n+1,s,d,o):c<O&&o.push(new Yi(c,O,m)),c=O}else for(let c=t,u=r.length;c>e;){let h=!0,f=!1;if(!u||c>r[u-1].to){let w=Ze[c-1];w!=a&&(h=!1,f=w==16)}let d=!h&&a==1?[]:null,m=h?n:n+1,O=c;e:for(;;)if(u&&O==r[u-1].to){if(f)break e;let w=r[--u];if(!h)for(let g=w.from,p=u;;){if(g==e)break e;if(p&&r[p-1].to==g)g=r[--p].from;else{if(Ze[g-1]==a)break e;break}}if(d)d.push(w);else{w.to<c&&o.push(new Yi(w.to,c,m));let g=w.direction==_n!=!(m%2);_a(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.from}O=w.from}else{if(O==e||(h?Ze[O-1]!=a:Ze[O-1]==a))break;O--}d?Oa(i,O,c,n+1,s,d,o):O<c&&o.push(new Yi(O,c,m)),c=O}}function _a(i,e,t,n,s,r,o){let a=e%2?2:1;Vw(i,s,r,n,a),Lw(i,s,r,n,a),Mw(s,r,n,a),Oa(i,s,r,e,t,n,o)}function Dw(i,e,t){if(!i)return[new Yi(0,0,e==ma?1:0)];if(e==_n&&!t.length&&!Rw.test(i))return _d(i.length);if(t.length)for(;i.length>Ze.length;)Ze[Ze.length]=256;let n=[],s=e==_n?0:1;return _a(i,s,s,t,0,i.length,n),n}function _d(i){return[new Yi(0,i,0)]}let bd="";function Bw(i,e,t,n,s){var r;let o=n.head-i.from,a=Yi.find(e,o,(r=n.bidiLevel)!==null&&r!==void 0?r:-1,n.assoc),c=e[a],u=c.side(s,t);if(o==u){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;c=e[a=d],o=c.side(!s,t),u=c.side(s,t)}let h=ht(i.text,o,c.forward(s,t));(h<c.from||h>c.to)&&(h=u),bd=i.text.slice(Math.min(o,h),Math.max(o,h));let f=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return f&&h==u&&f.level+(s?0:1)<c.level?X.cursor(f.side(!s,t)+i.from,f.forward(s,t)?1:-1,f.level):X.cursor(h+i.from,c.forward(s,t)?-1:1,c.level)}function vw(i,e,t){for(let n=e;n<t;n++){let s=gd(i.charCodeAt(n));if(s==1)return _n;if(s==2||s==4)return ma}return _n}const yd=ce.define(),wd=ce.define(),kd=ce.define(),xd=ce.define(),ba=ce.define(),Sd=ce.define(),Cd=ce.define(),ya=ce.define(),wa=ce.define(),Ad=ce.define({combine:i=>i.some(e=>e)}),Td=ce.define({combine:i=>i.some(e=>e)}),Pd=ce.define();class Fn{constructor(e,t="nearest",n="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Fn(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Fn(X.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Fr=ke.define({map:(i,e)=>i.map(e)}),Qd=ke.define();function Pt(i,e,t){let n=i.facet(xd);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Li=ce.define({combine:i=>i.length?i[0]:!0});let Iw=0;const Un=ce.define({combine(i){return i.filter((e,t)=>{for(let n=0;n<t;n++)if(i[n].plugin==e.plugin)return!1;return!0})}});class Ye{constructor(e,t,n,s,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Un.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Un.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=t||{};return new Ye(Iw++,e,n,s,a=>{let c=[];return o&&c.push(Qs.of(u=>{let h=u.plugin(a);return h?o(h):pe.none})),r&&c.push(r(a)),c})}static fromClass(e,t){return Ye.define((n,s)=>new e(n,s),t)}}class ka{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Pt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Pt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ed=ce.define(),xa=ce.define(),Qs=ce.define(),$d=ce.define(),Es=ce.define(),Nd=ce.define();function Rd(i,e){let t=i.state.facet(Nd);if(!t.length)return t;let n=t.map(r=>r instanceof Function?r(i):r),s=[];return Ne.spans(n,e.from,e.to,{point(){},span(r,o,a,c){let u=r-e.from,h=o-e.from,f=s;for(let d=a.length-1;d>=0;d--,c--){let m=a[d].spec.bidiIsolate,O;if(m==null&&(m=vw(e.text,u,h)),c>0&&f.length&&(O=f[f.length-1]).to==u&&O.direction==m)O.to=h,f=O.inner;else{let w={from:u,to:h,direction:m,inner:[]};f.push(w),f=w.inner}}}}),s}const Vd=ce.define();function Sa(i){let e=0,t=0,n=0,s=0;for(let r of i.state.facet(Vd)){let o=r(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:n,bottom:s}}const $s=ce.define();class Ft{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new Ft(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>n.toA)){if(s.toA<n.fromA)break;n=n.join(s),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let s=0,r=0,o=0,a=0;;s++){let c=s==e.length?null:e[s],u=o-a,h=c?c.fromB:1e9;for(;r<t.length&&t[r]<h;){let f=t[r],d=t[r+1],m=Math.max(a,f),O=Math.min(h,d);if(m<=O&&new Ft(m+u,O+u,m,O).addToSet(n),d>h)break;r+=2}if(!c)return n;new Ft(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),o=c.toA,a=c.toB}}}class Ur{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=it.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,a,c)=>s.push(new Ft(r,o,a,c))),this.changedRanges=s}static create(e,t,n){return new Ur(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Ld extends De{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=pe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Je],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ft(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:u,toA:h})=>h<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!jw(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Fw(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:h}=this.hasComposition;n=new Ft(u,h,e.changes.mapPos(u,-1),e.changes.mapPos(h,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(re.ie||re.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),c=Ww(o,a,e.changes);return n=Ft.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=re.chrome||re.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Vi&&o.widget instanceof pa&&r.push(o.dom);s.updateGaps(r)}updateChildren(e,t,n){let s=n?n.range.addToSet(e.slice()):e,r=this.childCursor(t);for(let o=s.length-1;;o--){let a=o>=0?s[o]:null;if(!a)break;let{fromA:c,toA:u,fromB:h,toB:f}=a,d,m,O,w;if(n&&n.range.fromB<f&&n.range.toB>h){let y=Ps.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),C=Ps.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=y.breakAtStart,O=y.openStart,w=C.openEnd;let T=this.compositionView(n);C.breakAtStart?T.breakAfter=1:C.content.length&&T.merge(T.length,T.length,C.content[0],!1,C.openStart,0)&&(T.breakAfter=C.content[0].breakAfter,C.content.shift()),y.content.length&&T.merge(0,0,y.content[y.content.length-1],!0,0,y.openEnd)&&y.content.pop(),d=y.content.concat(T).concat(C.content)}else({content:d,breakAtStart:m,openStart:O,openEnd:w}=Ps.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:p}=r.findPos(u,1),{i:b,off:k}=r.findPos(c,-1);ad(this,b,k,g,p,d,m,O,w)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(Qd)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new Ht(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Ni(s,[t],t.length);let n=new Je;return n.append(t,0),n}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(o);let a=De.get(r);a&&a!=o&&(a.dom=null),o.setDOM(r)},n=this.childPos(e.range.fromB,1),s=this.children[n.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)n=s.childPos(n.off,1),s=s.children[n.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,s=n==this.dom,r=!s&&!(this.view.state.facet(Li)||this.dom.tabIndex>-1)&&Dr(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?c:this.moveToLine(this.domAtPos(a.head));if(re.gecko&&a.empty&&!this.hasComposition&&Zw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new Ot(f,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||(!Ss(c.node,c.offset,h.anchorNode,h.anchorOffset)||!Ss(u.node,u.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{re.android&&re.chrome&&this.dom.contains(h.focusNode)&&qw(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=xs(this.view.root);if(f)if(a.empty){if(re.gecko){let d=Uw(c.node,c.offset);if(d&&d!=3){let m=(d==1?sd:rd)(c.node,c.offset);m&&(c=new Ot(m.node,m.offset))}}f.collapse(c.node,c.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([c,u]=[u,c]),d.setEnd(u.node,u.offset),d.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(d)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new Ot(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new Ot(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ss(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=xs(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Je.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let c=this.coordsAt(t.head,-1),u=this.coordsAt(t.head,1);if(!c||!u||c.bottom>u.top)return;let h=this.domAtPos(t.head+t.assoc);n.collapse(h.node,h.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&n.collapse(s,r)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let s=e.offset;!n&&s<t.childNodes.length;s++){let r=De.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(0))}for(let s=e.offset-1;!n&&s>=0;s--){let r=De.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(r.length))}return n?new Ot(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=De.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let s=this.children[t];if(n<s.length||s instanceof Je)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,s=0;for(let r=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],c=r-a.breakAfter,u=c-a.length;if(c<e)break;if(u<=e&&(u<e||a.covers(-1))&&(c>e||a.covers(1))&&(!n||a instanceof Je&&!(n instanceof Je&&t>=0)))n=a,s=u;else if(n&&u==e&&c==e&&a instanceof Vi&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(n=null)}r=u}return n?n.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),s=this.children[t];if(!(s instanceof Je))return null;for(;s.children.length;){let{i:a,off:c}=s.childPos(n,1);for(;;a++){if(a==s.children.length)return null;if((s=s.children[a]).length)break}n=c}if(!(s instanceof Ht))return null;let r=ht(s.text,n);if(r==n)return null;let o=On(s.dom,n,r).getClientRects();for(let a=0;a<o.length;a++){let c=o[a];if(a==o.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,c=this.view.textDirection==Fe.LTR;for(let u=0,h=0;h<this.children.length;h++){let f=this.children[h],d=u+f.length;if(d>s)break;if(u>=n){let m=f.dom.getBoundingClientRect();if(t.push(m.height),o){let O=f.dom.lastChild,w=O?Bn(O):[];if(w.length){let g=w[w.length-1],p=c?g.right-m.left:m.right-g.left;p>a&&(a=p,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=d)}}}u=d+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Fe.RTL:Fe.LTR}measureTextSize(){for(let r of this.children)if(r instanceof Je){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Bn(e.firstChild)[0];t=e.getBoundingClientRect().height,n=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new ld(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(pe.replace({widget:new pa(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return pe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Qs).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,s=this.view.state.facet($d).map((r,o)=>{let a=typeof r=="function";return a&&(n=!0),a?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(Ne.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(Pd))try{if(u(this.view,e.range,e))return!0}catch(h){Pt(this.view.state,h,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!n)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let r=Sa(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:a,offsetHeight:c}=this.view.scrollDOM;yw(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Fe.LTR)}lineHasWidget(e){let{i:t}=this.childCursor().findPos(e);if(t==this.children.length)return!1;let n=s=>s instanceof Ri||s.children.some(n);return n(this.children[t])}}function Zw(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function Md(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=sd(t.focusNode,t.focusOffset),s=rd(t.focusNode,t.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let a=De.get(s.node);if(!a||a instanceof Ht&&a.text!=s.node.nodeValue)r=s;else if(i.docView.lastCompositionAfterCursor){let c=De.get(n.node);!c||c instanceof Ht&&c.text!=n.node.nodeValue||(r=s)}}if(i.docView.lastCompositionAfterCursor=r!=n,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Fw(i,e,t){let n=Md(i,t);if(!n)return null;let{node:s,from:r,to:o}=n,a=s.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(n.from,n.to)!=a)return null;let c=e.invertedDesc,u=new Ft(c.mapPos(r),c.mapPos(o),r,o),h=[];for(let f=s.parentNode;;f=f.parentNode){let d=De.get(f);if(d instanceof Ni)h.push({node:f,deco:d.mark});else{if(d instanceof Je||f.nodeName=="DIV"&&f.parentNode==i.contentDOM)return{range:u,text:s,marks:h,line:f};if(f!=i.contentDOM)h.push({node:f,deco:new As({inclusive:!0,attributes:Qw(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Uw(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}let Xw=class{constructor(){this.changes=[]}compareRange(e,t){Ir(e,t,this.changes)}comparePoint(e,t){Ir(e,t,this.changes)}boundChange(e){Ir(e,e,this.changes)}};function Ww(i,e,t){let n=new Xw;return Ne.compare(i,e,t,n),n.changes}function qw(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function jw(i,e){let t=!1;return e&&i.iterChangedRanges((n,s)=>{n<e.to&&s>e.from&&(t=!0)}),t}function zw(i,e,t=1){let n=i.charCategorizer(e),s=i.doc.lineAt(e),r=e-s.from;if(s.length==0)return X.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,a=r;t<0?o=ht(s.text,r,!1):a=ht(s.text,r);let c=n(s.text.slice(o,a));for(;o>0;){let u=ht(s.text,o,!1);if(n(s.text.slice(u,o))!=c)break;o=u}for(;a<s.length;){let u=ht(s.text,a);if(n(s.text.slice(a,u))!=c)break;a=u}return X.range(o+s.from,a+s.from)}function Yw(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function Gw(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Ca(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function Dd(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function Bd(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function Aa(i,e,t){let n,s,r,o,a=!1,c,u,h,f;for(let O=i.firstChild;O;O=O.nextSibling){let w=Bn(O);for(let g=0;g<w.length;g++){let p=w[g];s&&Ca(s,p)&&(p=Dd(Bd(p,s.bottom),s.top));let b=Yw(e,p),k=Gw(t,p);if(b==0&&k==0)return O.nodeType==3?vd(O,e,t):Aa(O,e,t);(!n||o>k||o==k&&r>b)&&(n=O,s=p,r=b,o=k,a=b?e<p.left?g>0:g<w.length-1:!0),b==0?t>p.bottom&&(!h||h.bottom<p.bottom)?(c=O,h=p):t<p.top&&(!f||f.top>p.top)&&(u=O,f=p):h&&Ca(h,p)?h=Bd(h,p.bottom):f&&Ca(f,p)&&(f=Dd(f,p.top))}}if(h&&h.bottom>=t?(n=c,s=h):f&&f.top<=t&&(n=u,s=f),!n)return{node:i,offset:0};let d=Math.max(s.left,Math.min(s.right,e));if(n.nodeType==3)return vd(n,d,t);if(a&&n.contentEditable!="false")return Aa(n,d,t);let m=Array.prototype.indexOf.call(i.childNodes,n)+(e>=(s.left+s.right)/2?1:0);return{node:i,offset:m}}function vd(i,e,t){let n=i.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;a<n;a++){let c=On(i,a,a+1).getClientRects();for(let u=0;u<c.length;u++){let h=c[u];if(h.top==h.bottom)continue;o||(o=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<r){let d=e>=(h.left+h.right)/2,m=d;if(re.chrome||re.gecko){let O=On(i,a).getBoundingClientRect();Math.abs(O.left-h.right)<.1&&(m=!d)}if(f<=0)return{node:i,offset:a+(m?1:0)};s=a+(m?1:0),r=f}}}return{node:i,offset:s>-1?s:o>0?i.nodeValue.length:0}}function Id(i,e,t,n=-1){var s,r;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,c,{docHeight:u}=i.viewState,{x:h,y:f}=e,d=f-a;if(d<0)return 0;if(d>u)return i.state.doc.length;for(let y=i.viewState.heightOracle.textHeight/2,C=!1;c=i.elementAtHeight(d),c.type!=kt.Text;)for(;d=n>0?c.bottom+y:c.top-y,!(d>=0&&d<=u);){if(C)return t?null:0;C=!0,n=-n}f=a+d;let m=c.from;if(m<i.viewport.from)return i.viewport.from==0?0:t?null:Zd(i,o,c,h,f);if(m>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:Zd(i,o,c,h,f);let O=i.dom.ownerDocument,w=i.root.elementFromPoint?i.root:O,g=w.elementFromPoint(h,f);g&&!i.contentDOM.contains(g)&&(g=null),g||(h=Math.max(o.left+1,Math.min(o.right-1,h)),g=w.elementFromPoint(h,f),g&&!i.contentDOM.contains(g)&&(g=null));let p,b=-1;if(g&&((s=i.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(O.caretPositionFromPoint){let y=O.caretPositionFromPoint(h,f);y&&({offsetNode:p,offset:b}=y)}else if(O.caretRangeFromPoint){let y=O.caretRangeFromPoint(h,f);y&&({startContainer:p,startOffset:b}=y)}p&&(!i.contentDOM.contains(p)||re.safari&&Kw(p,b,h)||re.chrome&&Hw(p,b,h))&&(p=void 0),p&&(b=Math.min(di(p),b))}if(!p||!i.docView.dom.contains(p)){let y=Je.find(i.docView,m);if(!y)return d>c.top+c.height/2?c.to:c.from;({node:p,offset:b}=Aa(y.dom,h,f))}let k=i.docView.nearest(p);if(!k)return null;if(k.isWidget&&((r=k.dom)===null||r===void 0?void 0:r.nodeType)==1){let y=k.dom.getBoundingClientRect();return e.y<y.top||e.y<=y.bottom&&e.x<=(y.left+y.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(p,b)+k.posAtStart}function Zd(i,e,t,n,s){let r=Math.round((n-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,c=Math.floor((s-t.top-(i.defaultLineHeight-a)*.5)/a);r+=c*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+ta(o,r,i.state.tabSize)}function Fd(i,e,t){let n,s=i;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(;;){let r=s.nextSibling;if(r){if(r.nodeName=="BR")break;return!1}else{let o=s.parentNode;if(!o||o.nodeName=="DIV")break;s=o}}return On(i,n-1,n).getBoundingClientRect().right>t}function Kw(i,e,t){return Fd(i,e,t)}function Hw(i,e,t){if(e!=0)return Fd(i,e,t);for(let s=i;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let n=i.nodeType==1?i.getBoundingClientRect():On(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function Ta(i,e,t){let n=i.lineBlockAt(e);if(Array.isArray(n.type)){let s;for(let r of n.type){if(r.from>e)break;if(!(r.to<e)){if(r.from<e&&r.to>e)return r;(!s||r.type==kt.Text&&(s.type!=r.type||(t<0?r.from<e:r.to>e)))&&(s=r)}}return s||n}return n}function Jw(i,e,t,n){let s=Ta(i,e.head,e.assoc||-1),r=!n||s.type!=kt.Text||!(i.lineWrapping||s.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(s.from),c=i.posAtCoords({x:t==(a==Fe.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(c!=null)return X.cursor(c,t?-1:1)}return X.cursor(t?s.to:s.from,t?-1:1)}function Ud(i,e,t,n){let s=i.state.doc.lineAt(e.head),r=i.bidiSpans(s),o=i.textDirectionAt(s.from);for(let a=e,c=null;;){let u=Bw(s,r,o,a,t),h=bd;if(!u){if(s.number==(t?i.state.doc.lines:1))return a;h=`
|
|
28
28
|
`,s=i.state.doc.line(s.number+(t?1:-1)),r=i.bidiSpans(s),u=i.visualLineSide(s,!t)}if(c){if(!c(h))return a}else{if(!n)return u;c=n(h)}a=u}}function ek(i,e,t){let n=i.state.charCategorizer(e),s=n(t);return r=>{let o=n(r);return s==Xe.Space&&(s=o),s==o}}function tk(i,e,t,n){let s=e.head,r=t?1:-1;if(s==(t?i.state.doc.length:0))return X.cursor(s,e.assoc);let o=e.goalColumn,a,c=i.contentDOM.getBoundingClientRect(),u=i.coordsAtPos(s,e.assoc||-1),h=i.documentTop;if(u)o==null&&(o=u.left-c.left),a=r<0?u.top:u.bottom;else{let m=i.viewState.lineBlockAt(s);o==null&&(o=Math.min(c.right-c.left,i.defaultCharacterWidth*(s-m.from))),a=(r<0?m.top:m.bottom)+h}let f=c.left+o,d=n??i.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let O=a+(d+m)*r,w=Id(i,{x:f,y:O},!1,r);if(O<c.top||O>c.bottom||(r<0?w<s:w>s)){let g=i.docView.coordsForChar(w),p=!g||O<g.top?-1:1;return X.cursor(w,p,void 0,o)}}}function Ns(i,e,t){for(;;){let n=0;for(let s of i)s.between(e-1,e+1,(r,o,a)=>{if(e>r&&e<o){let c=n||t||(e-r<o-e?-1:1);e=c<0?r:o,n=c}});if(!n)return e}}function Xd(i,e){let t=null;for(let n=0;n<e.ranges.length;n++){let s=e.ranges[n],r=null;if(s.empty){let o=Ns(i,s.from,0);o!=s.from&&(r=X.cursor(o,-1))}else{let o=Ns(i,s.from,-1),a=Ns(i,s.to,1);(o!=s.from||a!=s.to)&&(r=X.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}r&&(t||(t=e.ranges.slice()),t[n]=r)}return t?X.create(t,e.mainIndex):e}function Pa(i,e,t){let n=Ns(i.state.facet(Es).map(s=>s(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:X.cursor(n,n<t.from?1:-1)}const Rs="";class ik{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Te.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Rs}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let s=e;;){this.findPointBefore(n,s);let r=this.text.length;this.readNode(s);let o=s.nextSibling;if(o==t)break;let a=De.get(s),c=De.get(o);(a&&c?a.breakAfter:(a?a.breakAfter:Br(s))||Br(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)&&!sk(o,t)&&this.lineBreak(),s=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,a;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=s.exec(t))&&(r=a.index,o=a[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=o-1);n=r+o}}readNode(e){if(e.cmIgnore)return;let t=De.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let s=n.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(nk(e,n.node,n.offset)?t:0))}}function nk(i,e,t){for(;;){if(!e||t<di(e))return!1;if(e==i)return!0;t=mn(e)+1,e=e.parentNode}}function sk(i,e){let t;for(;!(i==e||!i);i=i.nextSibling){let n=De.get(i);if(!(n!=null&&n.isWidget||i.cmIgnore))return!1;n&&(t||(t=[])).push(n)}if(t)for(let n of t){let s=n.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class Wd{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class rk{constructor(e,t,n,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let a=r||o?[]:lk(e),c=new ik(a,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=ak(a,this.bounds.from)}else{let a=e.observer.selectionRange,c=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!ua(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),u=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!ua(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((re.ios||re.chrome)&&e.state.selection.main.empty&&c!=u&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(c,u),d=Math.max(c,u),m=h.from-f,O=h.to-d;(m==0||m==1||f==0)&&(O==0||O==-1||d==e.state.doc.length)&&(c=0,u=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(X.range(u,c)):this.newSel=X.single(u,c)}}}function qd(i,e){let t,{newSel:n}=e,s=i.state.selection.main,r=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,c=s.from,u=null;(r===8||re.android&&e.text.length<a-o)&&(c=s.to,u="end");let h=jd(i.state.doc.sliceString(o,a,Rs),e.text,c-o,u);h&&(re.chrome&&r==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==Rs+Rs&&h.toB--,t={from:o+h.from,to:o+h.toA,insert:Qe.of(e.text.slice(h.from,h.toB).split(Rs))})}else n&&(!i.hasFocus&&i.state.facet(Li)||n.main.eq(s))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!s.empty&&n&&n.main.empty?t={from:s.from,to:s.to,insert:i.state.doc.slice(s.from,s.to)}:(re.mac||re.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=X.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:Qe.of([t.insert.toString().replace("."," ")])}):t&&t.from>=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:i.state.doc.slice(s.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,s.to))}:i.state.doc.lineAt(s.from).to<s.to&&i.docView.lineHasWidget(s.to)&&i.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:i.state.toText(i.inputState.insertingText)}:re.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
|
|
29
|
-
`&&i.lineWrapping&&(n&&(n=X.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Qe.of([" "])}),t)return Qa(i,t,n,r);if(n&&!n.main.eq(s)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(n=Xd(i.state.facet(Es).map(c=>c(i)),n))),i.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function Qa(i,e,t,n=-1){if(re.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&i.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&vn(i.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&vn(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&vn(i.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=ok(i,e,t));return i.state.facet(Sd).some(c=>c(i,e.from,e.to,r,a))||i.dispatch(a()),!0}function ok(i,e,t){let n,s=i.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let c=e.from<r.from?-1:1,u=c<0?r.from:r.to,h=Ns(s.facet(Es).map(f=>f(i)),u,c);e.from==h&&(o=h)}if(o>-1)n={changes:e,selection:X.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let c=r.from<e.from?s.sliceDoc(r.from,e.from):"",u=r.to>e.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(i.state.toText(c+e.insert.sliceString(0,void 0,i.state.lineBreak)+u))}else{let c=s.changes(e),u=t&&t.main.to<=c.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let h=i.state.sliceDoc(e.from,e.to),f,d=t&&Md(i,t.main.head);if(d){let O=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-O}}else f=i.state.doc.lineAt(r.head);let m=r.to-e.to;n=s.changeByRange(O=>{if(O.from==r.from&&O.to==r.to)return{changes:c,range:u||O.map(c)};let w=O.to-m,g=w-h.length;if(i.state.sliceDoc(g,w)!=h||w>=f.from&&g<=f.to)return{range:O};let p=s.changes({from:g,to:w,insert:e.insert}),b=O.to-r.to;return{changes:p,range:u?X.range(Math.max(0,u.anchor+b),Math.max(0,u.head+b)):O.map(p)}})}else n={changes:c,selection:u&&s.selection.replaceRange(u)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:a,scrollIntoView:!0})}function jd(i,e,t,n){let s=Math.min(i.length,e.length),r=0;for(;r<s&&i.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==s&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let c=Math.max(0,r-Math.min(o,a));t-=o+c-r}if(o<r&&i.length<e.length){let c=t<=r&&t>=o?r-t:0;r-=c,a=r+(a-o),o=r}else if(a<r){let c=t<=r&&t>=a?r-t:0;r-=c,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}function lk(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}=i.observer.selectionRange;return t&&(e.push(new Wd(t,n)),(s!=t||r!=n)&&e.push(new Wd(s,r))),e}function ak(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?X.single(t+e,n+e):null}class ck{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,re.safari&&e.contentDOM.addEventListener("input",()=>null),re.gecko&&Ck(e.contentDOM.ownerDocument)}handleEvent(e){!Ok(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let s of n.observers)s(this.view,t);for(let s of n.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=uk(e),n=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,a=n[r];a&&o!=!a.handlers.length&&(s.removeEventListener(r,this.handleEvent),a=null),a||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Gd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),re.android&&re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Yd.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||hk.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,vn(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:re.safari&&!re.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function zd(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(s){Pt(t.state,s)}}}function uk(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let s=n.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let a in r){let c=r[a];c&&t(a).handlers.push(zd(n.value,c))}if(o)for(let a in o){let c=o[a];c&&t(a).observers.push(zd(n.value,c))}}for(let n in Jt)t(n).handlers.push(Jt[n]);for(let n in Ut)t(n).observers.push(Ut[n]);return e}const Yd=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hk="dthko",Gd=[16,17,18,20,91,92,224,225],Xr=6;function Wr(i){return Math.max(0,i)*.7+8}function fk(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class dk{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=ww(e.contentDOM),this.atoms=e.state.facet(Es).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Te.allowMultipleSelections)&&pk(e,t),this.dragging=gk(e,t)&&rp(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&fk(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,s=0,r=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=Sa(this.view);e.clientX-c.left<=s+Xr?t=-Wr(s-e.clientX):e.clientX+c.right>=o-Xr&&(t=Wr(e.clientX-o)),e.clientY-c.top<=r+Xr?n=-Wr(r-e.clientY):e.clientY+c.bottom>=a-Xr&&(n=Wr(e.clientY-a)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Xd(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function pk(i,e){let t=i.state.facet(yd);return t.length?t[0](e):re.mac?e.metaKey:e.ctrlKey}function mk(i,e){let t=i.state.facet(wd);return t.length?t[0](e):re.mac?!e.altKey:!e.ctrlKey}function gk(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=xs(i.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let o=s[r];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Ok(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=De.get(t))&&n.ignoreEvent(e))return!1;return!0}const Jt=Object.create(null),Ut=Object.create(null),Kd=re.ie&&re.ie_version<15||re.ios&&re.webkit_version<604;function _k(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Hd(i,t.value)},50)}function qr(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function Hd(i,e){e=qr(i.state,ya,e);let{state:t}=i,n,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ea!=null&&t.selection.ranges.every(c=>c.empty)&&Ea==r.toString()){let c=-1;n=t.changeByRange(u=>{let h=t.doc.lineAt(u.from);if(h.from==c)return{range:u};c=h.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:X.cursor(u.from+f.length)}})}else o?n=t.changeByRange(c=>{let u=r.line(s++);return{changes:{from:c.from,to:c.to,insert:u.text},range:X.cursor(c.from+u.length)}}):n=t.replaceSelection(r);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ut.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft},Jt.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1),Ut.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")},Ut.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")},Jt.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(kd))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=wk(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new dk(i,e,t,n)),n&&i.observer.ignore(()=>{ed(i.contentDOM);let r=i.root.activeElement;r&&!r.contains(i.contentDOM)&&r.blur()});let s=i.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function Jd(i,e,t,n){if(n==1)return X.cursor(e,t);if(n==2)return zw(i.state,e,t);{let s=Je.find(i.docView,e),r=i.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,a=s?s.posAtEnd:r.to;return a<i.state.doc.length&&a==r.to&&a++,X.range(o,a)}}let ep=(i,e,t)=>e>=t.top&&e<=t.bottom&&i>=t.left&&i<=t.right;function bk(i,e,t,n){let s=Je.find(i.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&ep(t,n,o))return-1;let a=s.coordsAt(r,1);return a&&ep(t,n,a)?1:o&&o.bottom>=n?-1:1}function tp(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:bk(i,t,e.clientX,e.clientY)}}const yk=re.ie&&re.ie_version<=11;let ip=null,np=0,sp=0;function rp(i){if(!yk)return i.detail;let e=ip,t=sp;return ip=i,sp=Date.now(),np=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(np+1)%3:1}function wk(i,e){let t=tp(i,e),n=rp(e),s=i.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,a){let c=tp(i,r),u,h=Jd(i,c.pos,c.bias,n);if(t.pos!=c.pos&&!o){let f=Jd(i,t.pos,t.bias,n),d=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=d<h.from?X.range(d,m):X.range(m,d)}return o?s.replaceRange(s.main.extend(h.from,h.to)):a&&n==1&&s.ranges.length>1&&(u=kk(s,c.pos))?u:a?s.addRange(h):X.create([h])}}}function kk(i,e){for(let t=0;t<i.ranges.length;t++){let{from:n,to:s}=i.ranges[t];if(n<=e&&s>=e)return X.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}Jt.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let s=i.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=X.range(r,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",qr(i.state,wa,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Jt.dragend=i=>(i.inputState.draggedContent=null,!1);function op(i,e,t,n){if(t=qr(i.state,ya,t),!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=i.inputState,o=n&&r&&mk(i,e)?{from:r.from,to:r.to}:null,a={from:s,insert:t},c=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}Jt.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),s=0,r=()=>{++s==t.length&&op(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=r,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),r()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return op(i,e,n,!0),!0}return!1},Jt.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Kd?null:e.clipboardData;return t?(Hd(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(_k(i),!1)};function xk(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function Sk(i){let e=[],t=[],n=!1;for(let s of i.selection.ranges)s.empty||(e.push(i.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of i.selection.ranges){let o=i.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),s=o.number}n=!0}return{text:qr(i,wa,e.join(i.lineBreak)),ranges:t,linewise:n}}let Ea=null;Jt.copy=Jt.cut=(i,e)=>{let{text:t,ranges:n,linewise:s}=Sk(i.state);if(!t&&!s)return!1;Ea=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=Kd?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(xk(i,t),!1)};const lp=Ei.define();function ap(i,e){let t=[];for(let n of i.facet(Cd)){let s=n(i,e);s&&t.push(s)}return t.length?i.update({effects:t,annotations:lp.of(!0)}):null}function cp(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=ap(i.state,e);t?i.dispatch(t):i.update([])}},10)}Ut.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),cp(i)},Ut.blur=i=>{i.observer.clearSelectionRange(),cp(i)},Ut.compositionstart=Ut.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))},Ut.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,re.chrome&&re.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))},Ut.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()},Jt.beforeinput=(i,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let a=o[0],c=i.posAtDOM(a.startContainer,a.startOffset),u=i.posAtDOM(a.endContainer,a.endOffset);return Qa(i,{from:c,to:u,insert:i.state.toText(r)},null),!0}}let s;if(re.chrome&&re.android&&(s=Yd.find(r=>r.inputType==e.inputType))&&(i.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return re.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),re.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Ut.compositionend(i,e),20),!1};const up=new Set;function Ck(i){up.has(i)||(up.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const hp=["pre-wrap","normal","pre-line","break-spaces"];let Xn=!1;function fp(){Xn=!1}class Ak{constructor(e){this.lineWrapping=e,this.doc=Qe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return hp.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s<0?n++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,n,s,r,o){let a=hp.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=s,this.lineLength=r,c){this.heightSamples={};for(let u=0;u<o.length;u++){let h=o[u];h<0?u++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Tk{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class gi{constructor(e,t,n,s,r){this.from=e,this.length=t,this.top=n,this.height=s,this._content=r}get type(){return typeof this._content=="number"?kt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof zi?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new gi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ue=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Ue||(Ue={}));const jr=.001;class xt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>jr&&(Xn=!0),this.height=e)}replace(e,t,n){return xt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,s){let r=this,o=n.doc;for(let a=s.length-1;a>=0;a--){let{fromA:c,toA:u,fromB:h,toB:f}=s[a],d=r.lineAt(c,Ue.ByPosNoHeight,n.setDoc(t),0,0),m=d.to>=u?d:r.lineAt(u,Ue.ByPosNoHeight,n,0,0);for(f+=m.to-u,u=m.to;a>0&&d.from<=s[a-1].toA;)c=s[a-1].fromA,h=s[a-1].fromB,a--,c<d.from&&(d=r.lineAt(c,Ue.ByPosNoHeight,n,0,0));h+=d.from-c,c=d.from;let O=$a.build(n.setDoc(o),e,h,f);r=zr(r,r.replace(c,u,O))}return r.updateHeight(n,0)}static empty(){return new Lt(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,s=0,r=0;for(;;)if(t==n)if(s>r*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),n+=1+a.break,s-=a.size}else if(r>s*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,r-=a.size}else break;else if(s<r){let a=e[t++];a&&(s+=a.size)}else{let a=e[--n];a&&(r+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new Pk(xt.of(e.slice(0,t)),o,xt.of(e.slice(n)))}}function zr(i,e){return i==e?i:(i.constructor!=e.constructor&&(Xn=!0),e)}xt.prototype.size=1;class dp extends xt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,s){return new gi(s,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,s,r){return this.blockAt(0,n,s,r)}forEachLine(e,t,n,s,r,o){e<=r+this.length&&t>=r&&o(this.blockAt(0,n,s,r))}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Lt extends dp{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,s){return new gi(s,this.length,n,this.height,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof Lt||s instanceof pt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof pt?s=new Lt(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):xt.of(n)}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class pt extends xt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-n+1,o,a=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*r);o=c/r,this.length>r+1&&(a=(this.height-c)/(this.length-r-1))}else o=this.height/r;return{firstLine:n,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,n,s){let{firstLine:r,lastLine:o,perLine:a,perChar:c}=this.heightMetrics(t,s);if(t.lineWrapping){let u=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),h=t.doc.lineAt(u),f=a+h.length*c,d=Math.max(n,e-f/2);return new gi(h.from,h.length,d,f,0)}else{let u=Math.max(0,Math.min(o-r,Math.floor((e-n)/a))),{from:h,length:f}=t.doc.line(r+u);return new gi(h,f,n+a*u,a,0)}}lineAt(e,t,n,s,r){if(t==Ue.ByHeight)return this.blockAt(e,n,s,r);if(t==Ue.ByPosNoHeight){let{from:m,to:O}=n.doc.lineAt(e);return new gi(m,O-m,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r),u=n.doc.lineAt(e),h=a+u.length*c,f=u.number-o,d=s+a*f+c*(u.from-r-f);return new gi(u.from,u.length,Math.max(s,Math.min(d,s+this.height-h)),h,0)}forEachLine(e,t,n,s,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:a,perLine:c,perChar:u}=this.heightMetrics(n,r);for(let h=e,f=s;h<=t;){let d=n.doc.lineAt(h);if(h==e){let O=d.number-a;f+=c*O+u*(e-r-O)}let m=c+u*d.length;o(new gi(d.from,d.length,f,m,0)),f+=m,h=d.to+1}}replace(e,t,n){let s=this.length-t;if(s>0){let r=n[n.length-1];r instanceof pt?n[n.length-1]=new pt(r.length+s):n.push(null,new pt(s-1))}if(e>0){let r=n[0];r instanceof pt?n[0]=new pt(e+r.length):n.unshift(new pt(e-1),null)}return xt.of(n)}decomposeLeft(e,t){t.push(new pt(e-1),null)}decomposeRight(e,t){t.push(null,new pt(this.length-e-1))}updateHeight(e,t=0,n=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),c=-1;for(s.from>t&&o.push(new pt(s.from-t-1).updateHeight(e,t));a<=r&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let f=s.heights[s.index++];c==-1?c=f:Math.abs(f-c)>=jr&&(c=-2);let d=new Lt(h,f);d.outdated=!1,o.push(d),a+=h+1}a<=r&&o.push(null,new pt(r-a).updateHeight(e,a));let u=xt.of(o);return(c<0||Math.abs(u.height-this.height)>=jr||Math.abs(c-this.heightMetrics(e,t).perLine)>=jr)&&(Xn=!0),zr(this,u)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Pk extends xt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,s){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,s):this.right.blockAt(e,t,r,s+this.left.length+this.break)}lineAt(e,t,n,s,r){let o=s+this.left.height,a=r+this.left.length+this.break,c=t==Ue.ByHeight?e<o:e<a,u=c?this.left.lineAt(e,t,n,s,r):this.right.lineAt(e,t,n,o,a);if(this.break||(c?u.to<a:u.from>a))return u;let h=t==Ue.ByPosNoHeight?Ue.ByPosNoHeight:Ue.ByPos;return c?u.join(this.right.lineAt(a,h,n,o,a)):this.left.lineAt(a,h,n,s,r).join(u)}forEachLine(e,t,n,s,r,o){let a=s+this.left.height,c=r+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,n,s,r,o),t>=c&&this.right.forEachLine(e,t,n,a,c,o);else{let u=this.lineAt(c,Ue.ByPos,n,s,r);e<u.from&&this.left.forEachLine(e,u.from-1,n,s,r,o),u.to>=e&&u.from<=t&&o(u),t>u.to&&this.right.forEachLine(u.to+1,t,n,a,c,o)}}replace(e,t,n){let s=this.left.length+this.break;if(t<s)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,n));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let a of n)r.push(a);if(e>0&&pp(r,o-1),t<this.length){let a=r.length;this.decomposeRight(t,r),pp(r,a)}return xt.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,s=n+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<s&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?xt.of(this.break?[e,null,t]:[e,t]):(this.left=zr(this.left,e),this.right=zr(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,s){let{left:r,right:o}=this,a=t+r.length+this.break,c=null;return s&&s.from<=t+r.length&&s.more?c=r=r.updateHeight(e,t,n,s):r.updateHeight(e,t,n),s&&s.from<=a+o.length&&s.more?c=o=o.updateHeight(e,a,n,s):o.updateHeight(e,a,n),c?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function pp(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof pt&&(n=i[e+1])instanceof pt&&i.splice(e-1,3,new pt(t.length+1+n.length))}const Qk=5;class $a{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Lt?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Lt(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let s=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new dp(o,s,n)):(o||r||s>=Qk)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Lt(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new pt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Lt)return e;let t=new Lt(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Lt)&&!this.isCovered?this.nodes.push(new Lt(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let s of this.nodes)s instanceof Lt&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(e,t,n,s){let r=new $a(n,e);return Ne.spans(t,n,s,r,0),r.finish(n)}}function Ek(i,e,t){let n=new $k;return Ne.compare(i,e,t,n,0),n.changes}class $k{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,s){(e<t||n&&n.heightRelevant||s&&s.heightRelevant)&&Ir(e,t,this.changes,5)}}function Nk(i,e){let t=i.getBoundingClientRect(),n=i.ownerDocument,s=n.defaultView||window,r=Math.max(0,t.left),o=Math.min(s.innerWidth,t.right),a=Math.max(0,t.top),c=Math.min(s.innerHeight,t.bottom);for(let u=i.parentNode;u&&u!=n.body;)if(u.nodeType==1){let h=u,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let d=h.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),c=Math.min(u==i.parentNode?s.innerHeight:c,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,c)-(t.top+e)}}function Rk(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Vk(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Na{constructor(e,t,n,s){this.from=e,this.to=t,this.size=n,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(e,t){return pe.replace({widget:new Lk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Lk extends pi{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class mp{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=gp,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Fe.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(xa).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Ak(t),this.stateDeco=e.facet(Qs).filter(n=>typeof n!="function"),this.heightMap=xt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(e.doc),[new Ft(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=pe.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let s=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Yr(r,o))}}return this.viewports=e.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?gp:new Ra(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Vs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Qs).filter(h=>typeof h!="function");let s=e.changedRanges,r=Ft.extendWithRanges(s,Ek(n,this.stateDeco,e?e.changes:it.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);fp(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Xn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Td)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Fe.RTL:Fe.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,h=0;if(a.width&&a.height){let{scaleX:y,scaleY:C}=Jf(t,a);(y>.005&&Math.abs(this.scaleX-y)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=y,this.scaleY=C,u|=16,o=c=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=nd(e.scrollDOM);let O=(this.printing?Vk:Nk)(t,this.paddingTop),w=O.top-this.pixelViewport.top,g=O.bottom-this.pixelViewport.bottom;this.pixelViewport=O;let p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(p!=this.inView&&(this.inView=p,p&&(c=!0)),!this.inView&&!this.scrollTarget&&!Rk(e.dom))return 0;let b=a.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),c){let y=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(y)&&(o=!0),o||s.lineWrapping&&Math.abs(b-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:T,textHeight:x}=e.docView.measureTextSize();o=C>0&&s.refresh(r,C,T,x,Math.max(5,b/T),y),o&&(e.docView.minWidth=0,u|=16)}w>0&&g>0?h=Math.max(w,g):w<0&&g<0&&(h=Math.min(w,g)),fp();for(let C of this.viewports){let T=C.from==this.viewport.from?y:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?xt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new Ft(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Tk(C.from,T))}Xn&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,c=new Yr(s.lineAt(o-n*1e3,Ue.ByHeight,r,0,0).from,s.lineAt(a+(1-n)*1e3,Ue.ByHeight,r,0,0).to);if(t){let{head:u}=t.range;if(u<c.from||u>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(u,Ue.ByPos,r,0,0),d;t.y=="center"?d=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&u<c.from?d=f.top:d=f.bottom-h,c=new Yr(s.lineAt(d-1e3/2,Ue.ByHeight,r,0,0).from,s.lineAt(d+h+1e3/2,Ue.ByHeight,r,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Yr(this.heightMap.lineAt(n,Ue.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ue.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Ue.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ue.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=a+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&r<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let s of e)t.touchesRange(s.from,s.to)||n.push(new Na(t.mapPos(s.from),t.mapPos(s.to),s.size,s.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,s=n?1e4:2e3,r=s>>1,o=s<<1;if(this.defaultTextDirection!=Fe.LTR&&!n)return[];let a=[],c=(h,f,d,m)=>{if(f-h<r)return;let O=this.state.selection.main,w=[O.from];O.empty||w.push(O.to);for(let p of w)if(p>h&&p<f){c(h,p-10,d,m),c(p+10,f,d,m);return}let g=Dk(e,p=>p.from>=d.from&&p.to<=d.to&&Math.abs(p.from-h)<r&&Math.abs(p.to-f)<r&&!w.some(b=>p.from<b&&p.to>b));if(!g){if(f<d.to&&t&&n&&t.visibleRanges.some(k=>k.from<=f&&k.to>=f)){let k=t.moveToLineBoundary(X.cursor(f),!1,!0).head;k>h&&(f=k)}let p=this.gapSize(d,h,f,m),b=n||p<2e6?p:2e6;g=new Na(h,f,p,b)}a.push(g)},u=h=>{if(h.length<o||h.type!=kt.Text)return;let f=Mk(h.from,h.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,m,O;if(n){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,p;if(d!=null){let b=Kr(f,d),k=((this.visibleBottom-this.visibleTop)/2+w)/h.height;g=b-k,p=b+k}else g=(this.visibleTop-h.top-w)/h.height,p=(this.visibleBottom-h.top+w)/h.height;m=Gr(f,g),O=Gr(f,p)}else{let w=f.total*this.heightOracle.charWidth,g=s*this.heightOracle.charWidth,p=0;if(w>2e6)for(let T of e)T.from>=h.from&&T.from<h.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+p<this.pixelViewport.left&&(p=T.size-T.displaySize);let b=this.pixelViewport.left+p,k=this.pixelViewport.right+p,y,C;if(d!=null){let T=Kr(f,d),x=((k-b)/2+g)/w;y=T-x,C=T+x}else y=(b-g)/w,C=(k+g)/w;m=Gr(f,y),O=Gr(f,C)}m>h.from&&c(h.from,m,h,f),O<h.to&&c(O,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(u):u(h);return a}gapSize(e,t,n,s){let r=Kr(s,n)-Kr(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){Na.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=pe.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Ne.spans(t,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let s=0;if(n.length!=this.visibleRanges.length)s=12;else for(let r=0;r<n.length&&!(s&8);r++){let o=this.visibleRanges[r],a=n[r];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=n,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Vs(this.heightMap.lineAt(e,Ue.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Vs(this.heightMap.lineAt(this.scaler.fromDOM(e),Ue.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Vs(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Yr{constructor(e,t){this.from=e,this.to=t}}function Mk(i,e,t){let n=[],s=i,r=0;return Ne.spans(t,i,e,{span(){},point(o,a){o>s&&(n.push({from:s,to:o}),r+=o-s),s=a}},20),s<e&&(n.push({from:s,to:e}),r+=e-s),{total:r,ranges:n}}function Gr({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let s=0;;s++){let{from:r,to:o}=e[s],a=o-r;if(n<=a)return r+n;n-=a}}function Kr(i,e){let t=0;for(let{from:n,to:s}of i.ranges){if(e<=s){t+=e-n;break}t+=s-n}return t/i.total}function Dk(i,e){for(let t of i)if(e(t))return t}const gp={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class Ra{constructor(e,t,n){let s=0,r=0,o=0;this.viewports=n.map(({from:a,to:c})=>{let u=t.lineAt(a,Ue.ByPos,e,0,0).top,h=t.lineAt(c,Ue.ByPos,e,0,0).bottom;return s+=h-u,{from:a,to:c,top:u,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-r)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),r=a.bottom}toDOM(e){for(let t=0,n=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return s+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,s=r.domBottom}}fromDOM(e){for(let t=0,n=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-s)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,s=r.domBottom}}eq(e){return e instanceof Ra?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Vs(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new gi(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(s=>Vs(s,e)):i._content)}const Hr=ae.define({combine:i=>i.join(" ")}),Va=ae.define({combine:i=>i.indexOf(!0)>-1}),La=qi.newName(),Op=qi.newName(),_p=qi.newName(),bp={"&light":"."+Op,"&dark":"."+_p};function Ma(i,e,t){return new qi(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return i;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):i+" "+n}})}const Bk=Ma("."+La,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bp),vk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Da=re.ie&&re.ie_version<=11;class Ik{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new kw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(re.ie&&re.ie_version<=11||re.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&re.android&&e.constructor.EDIT_CONTEXT!==!1&&!(re.chrome&&re.chrome_version<126)&&(this.editContext=new Fk(e),e.state.facet(Li)&&(e.contentDOM.editContext=this.editContext.editContext)),Da&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(Li)?n.root.activeElement!=this.dom:!Dr(this.dom,s))return;let r=s.anchorNode&&n.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(re.ie&&re.ie_version<=11||re.android&&re.chrome)&&!n.state.selection.main.empty&&s.focusNode&&Ss(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=xs(e.root);if(!t)return!1;let n=re.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Zk(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Dr(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Sw(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,vk),Da&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Da&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let s=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&vn(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:s}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),s=this.selectionChanged&&Dr(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new rk(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,s=qd(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=yp(t,e.previousSibling||e.target.previousSibling,-1),s=yp(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Li)!=e.state.facet(Li)&&(e.view.contentDOM.editContext=e.state.facet(Li)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function yp(i,e,t){for(;e;){let n=De.get(e);if(n&&n.parent==i)return n;let s=e.parentNode;e=s!=i.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function wp(i,e){let t=e.startContainer,n=e.startOffset,s=e.endContainer,r=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return Ss(o.node,o.offset,s,r)&&([t,n,s,r]=[s,r,t,n]),{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}}function Zk(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return wp(i,s)}let t=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?wp(i,t):null}class Fk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let s=e.state.selection.main,{anchor:r,head:o}=s,a=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:a,drifted:!1});let u=c-a>n.text.length;a==this.from&&r<this.from?a=r:c==this.to&&r>this.to&&(c=r);let h=jd(e.state.sliceDoc(a,c),n.text,(u?s.from:s.to)-a,u?"end":null);if(!h){let d=X.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));d.main.eq(s)||e.dispatch({selection:d,userEvent:"select"});return}let f={from:h.from+a,to:h.toA+a,insert:Qe.of(n.text.slice(h.from,h.toB).split(`
|
|
30
|
-
`))};if((re.mac||re.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:c,insert:Qe.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);Qa(e,f,X.single(this.toEditorPos(n.selectionStart,d),this.toEditorPos(n.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let s=[],r=null;for(let o=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);o<a;o++){let c=e.coordsForChar(o);r=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||r||new DOMRect,s.push(r)}t.updateCharacterBounds(n.rangeStart,s)},this.handlers.textformatupdate=n=>{let s=[];for(let r of n.getTextFormats()){let o=r.underlineStyle,a=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let c=this.toEditorPos(r.rangeStart),u=this.toEditorPos(r.rangeEnd);if(c<u){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(pe.mark({attributes:{style:h}}).range(c,u))}}}e.dispatch({effects:Qd.of(pe.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=xs(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,a,c,u)=>{if(n)return;let h=u.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,t+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+u.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),u.toString()),this.to+=h}t+=h}),s&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(s=>s.forEach(r=>n(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||xw(e.parent)||document,this.viewState=new mp(e.state||Te.create(e)),e.scrollTo&&e.scrollTo.is(Fr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Un).map(s=>new ka(s));for(let s of this.plugins)s.update(this);this.observer=new Ik(this),this.inputState=new ck(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ld(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof He?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,s,r=this.state;for(let d of e){if(d.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=d.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,c=null;e.some(d=>d.annotation(lp))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=ap(r,o),c||(a=1));let u=this.observer.delayedAndroidKey,h=null;if(u?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(Te.phrases)!=this.state.facet(Te.phrases))return this.setState(r);s=Ur.create(this,r,e),s.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:m}=d.state.selection;f=new Fn(m.empty?m:X.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of d.effects)m.is(Fr)&&(f=m.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Jr.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet($s)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Hr)!=s.state.facet(Hr)&&(this.viewState.mustMeasureContent=!0),(t||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(ba))try{d(s)}catch(m){Pt(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!qd(this,h)&&u.force&&vn(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new mp(e),this.plugins=e.facet(Un).map(n=>new ka(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Ld(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Un),n=e.state.facet(Un);if(t!=n){let s=[];for(let r of n){let o=t.indexOf(r);if(o<0)s.push(new ka(r));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Pt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(nd(n))r=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);r=m.from,o=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let h=u.map(m=>{try{return m.read(this)}catch(O){return Pt(this.state,O),kp}}),f=Ur.create(this,this.state,[]),d=!1;f.flags|=c,t?t.flags|=c:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let m=0;m<u.length;m++)if(h[m]!=kp)try{let O=u[m];O.write&&O.write(h[m],this)}catch(O){Pt(this.state,O)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let O=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(O>1||O<-1){s=s+O,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(ba))a(t)}get themeClasses(){return La+" "+(this.state.facet(Va)?_p:Op)+" "+this.state.facet(Hr)}updateAttrs(){let e=xp(this,Ed,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Li)?"true":"false",class:"cm-content",style:`${re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),xp(this,xa,t);let n=this.observer.ignore(()=>{let s=da(this.contentDOM,this.contentAttrs,t),r=da(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let s of n.effects)if(s.is(se.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet($s);let e=this.state.facet(se.cspNonce);qi.mount(this.root,this.styleModules.concat(Bk).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Pa(this,e,Ud(this,e,t,n))}moveByGroup(e,t){return Pa(this,e,Ud(this,e,t,n=>ek(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return X.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return Jw(this,e,t,n)}moveVertically(e,t,n){return Pa(this,e,tk(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Id(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Yi.find(r,e-s.from,-1,t)];return Cs(n,o.dir==Fe.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ad)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Uk)return _d(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Od(r.isolates,n=Rd(this,e))))return r.order;n||(n=Rd(this,e));let s=Dw(e.text,t,n);return this.bidiCache.push(new Jr(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ed(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fr.of(new Fn(typeof e=="number"?X.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Fr.of(new Fn(X.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ye.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ye.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qi.newName(),s=[Hr.of(n),$s.of(Ma(`.${n}`,e))];return t&&t.dark&&s.push(Va.of(!0)),s}static baseTheme(e){return Wi.lowest($s.of(Ma("."+La,e,bp)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&De.get(n)||De.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}se.styleModule=$s,se.inputHandler=Sd,se.clipboardInputFilter=ya,se.clipboardOutputFilter=wa,se.scrollHandler=Pd,se.focusChangeEffect=Cd,se.perLineTextDirection=Ad,se.exceptionSink=xd,se.updateListener=ba,se.editable=Li,se.mouseSelectionStyle=kd,se.dragMovesSelection=wd,se.clickAddsSelectionRange=yd,se.decorations=Qs,se.outerDecorations=$d,se.atomicRanges=Es,se.bidiIsolatedRanges=Nd,se.scrollMargins=Vd,se.darkTheme=Va,se.cspNonce=ae.define({combine:i=>i.length?i[0]:""}),se.contentAttributes=xa,se.editorAttributes=Ed,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=ke.define();const Uk=4096,kp={};class Jr{constructor(e,t,n,s,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let n=[],s=e.length?e[e.length-1].dir:Fe.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir==s&&!t.touchesRange(o.from,o.to)&&n.push(new Jr(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function xp(i,e,t){for(let n=i.state.facet(e),s=n.length-1;s>=0;s--){let r=n[s],o=typeof r=="function"?r(i):r;o&&fa(o,t)}return t}const Xk=re.mac?"mac":re.windows?"win":re.linux?"linux":"key";function Wk(i,e){const t=i.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let s,r,o,a;for(let c=0;c<t.length-1;++c){const u=t[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))s=!0;else if(/^(c|ctrl|control)$/i.test(u))r=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+u)}return s&&(n="Alt-"+n),r&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function eo(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}const qk=Wi.default(se.domEventHandlers({keydown(i,e){return Ap(Cp(e.state),i,e,"editor")}})),Ls=ae.define({enables:qk}),Sp=new WeakMap;function Cp(i){let e=i.facet(Ls),t=Sp.get(e);return t||Sp.set(e,t=Yk(e.reduce((n,s)=>n.concat(s),[]))),t}function jk(i,e,t){return Ap(Cp(i.state),e,i,t)}let Gi=null;const zk=4e3;function Yk(i,e=Xk){let t=Object.create(null),n=Object.create(null),s=(o,a)=>{let c=n[o];if(c==null)n[o]=a;else if(c!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,c,u,h)=>{var f,d;let m=t[o]||(t[o]=Object.create(null)),O=a.split(/ (?!$)/).map(p=>Wk(p,e));for(let p=1;p<O.length;p++){let b=O.slice(0,p).join(" ");s(b,!0),m[b]||(m[b]={preventDefault:!0,stopPropagation:!1,run:[k=>{let y=Gi={view:k,prefix:b,scope:o};return setTimeout(()=>{Gi==y&&(Gi=null)},zk),!0}]})}let w=O.join(" ");s(w,!1);let g=m[w]||(m[w]={preventDefault:!1,stopPropagation:!1,run:((d=(f=m._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});c&&g.run.push(c),u&&(g.preventDefault=!0),h&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let h=t[u]||(t[u]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in h)h[d].run.push(m=>f(m,Ba))}let c=o[e]||o.key;if(c)for(let u of a)r(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return t}let Ba=null;function Ap(i,e,t,n){Ba=e;let s=_w(e),r=Tt(s,0),o=ui(r)==s.length&&s!=" ",a="",c=!1,u=!1,h=!1;Gi&&Gi.view==t&&Gi.scope==n&&(a=Gi.prefix+" ",Gd.indexOf(e.keyCode)<0&&(u=!0,Gi=null));let f=new Set,d=g=>{if(g){for(let p of g.run)if(!f.has(p)&&(f.add(p),p(t)))return g.stopPropagation&&(h=!0),!0;g.preventDefault&&(g.stopPropagation&&(h=!0),u=!0)}return!1},m=i[n],O,w;return m&&(d(m[a+eo(s,e,!o)])?c=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(re.windows&&e.ctrlKey&&e.altKey)&&!(re.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(O=ji[e.keyCode])&&O!=s?(d(m[a+eo(O,e,!0)])||e.shiftKey&&(w=ks[e.keyCode])!=s&&w!=O&&d(m[a+eo(w,e,!1)]))&&(c=!0):o&&e.shiftKey&&d(m[a+eo(s,e,!0)])&&(c=!0),!c&&d(m._any)&&(c=!0)),u&&(c=!0),c&&h&&e.stopPropagation(),Ba=null,c}class Ms{constructor(e,t,n,s,r){this.className=e,this.left=t,this.top=n,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let s=e.coordsAtPos(n.head,n.assoc||1);if(!s)return[];let r=Tp(e);return[new Ms(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Gk(e,t,n)}}function Tp(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Fe.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function Pp(i,e,t,n){let s=i.coordsAtPos(e,t*2);if(!s)return n;let r=i.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=i.posAtCoords({x:r.left+1,y:o}),c=i.posAtCoords({x:r.right-1,y:o});return a==null||c==null?n:{from:Math.max(n.from,Math.min(a,c)),to:Math.min(n.to,Math.max(a,c))}}function Gk(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),s=Math.min(t.to,i.viewport.to),r=i.textDirection==Fe.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),c=Tp(i),u=o.querySelector(".cm-line"),h=u&&window.getComputedStyle(u),f=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),m=Ta(i,n,1),O=Ta(i,s,-1),w=m.type==kt.Text?m:null,g=O.type==kt.Text?O:null;if(w&&(i.lineWrapping||m.widgetLineBreaks)&&(w=Pp(i,n,1,w)),g&&(i.lineWrapping||O.widgetLineBreaks)&&(g=Pp(i,s,-1,g)),w&&g&&w.from==g.from&&w.to==g.to)return b(k(t.from,t.to,w));{let C=w?k(t.from,null,w):y(m,!1),T=g?k(null,t.to,g):y(O,!0),x=[];return(w||m).to<(g||O).from-(w&&g?1:0)||m.widgetLineBreaks>1&&C.bottom+i.defaultLineHeight/2<T.top?x.push(p(f,C.bottom,d,T.top)):C.bottom<T.top&&i.elementAtHeight((C.bottom+T.top)/2).type==kt.Text&&(C.bottom=T.top=(C.bottom+T.top)/2),b(C).concat(x).concat(b(T))}function p(C,T,x,A){return new Ms(e,C-c.left,T-c.top,x-C,A-T)}function b({top:C,bottom:T,horizontal:x}){let A=[];for(let R=0;R<x.length;R+=2)A.push(p(x[R],C,x[R+1],T));return A}function k(C,T,x){let A=1e9,R=-1e9,_=[];function S(E,W,B,I,G){let Z=i.coordsAtPos(E,E==x.to?-2:2),H=i.coordsAtPos(B,B==x.from?2:-2);!Z||!H||(A=Math.min(Z.top,H.top,A),R=Math.max(Z.bottom,H.bottom,R),G==Fe.LTR?_.push(r&&W?f:Z.left,r&&I?d:H.right):_.push(!r&&I?f:H.left,!r&&W?d:Z.right))}let P=C??x.from,Q=T??x.to;for(let E of i.visibleRanges)if(E.to>P&&E.from<Q)for(let W=Math.max(E.from,P),B=Math.min(E.to,Q);;){let I=i.state.doc.lineAt(W);for(let G of i.bidiSpans(I)){let Z=G.from+I.from,H=G.to+I.from;if(Z>=B)break;H>W&&S(Math.max(Z,W),C==null&&Z<=P,Math.min(H,B),T==null&&H>=Q,G.dir)}if(W=I.to+1,W>=B)break}return _.length==0&&S(P,C==null,Q,T==null,i.textDirection),{top:A,bottom:R,horizontal:_}}function y(C,T){let x=a.top+(T?C.top:C.bottom);return{top:x,bottom:x,horizontal:[]}}}function Kk(i,e){return i.constructor==e.constructor&&i.eq(e)}class Hk{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(to)!=e.state.facet(to)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(to);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!Kk(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[n].constructor&&s.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,re.safari&&re.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const to=ae.define();function Qp(i){return[Ye.define(e=>new Hk(e,i)),to.of(i)]}const Ds=ae.define({combine(i){return fi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Jk(i={}){return[Ds.of(i),ex,tx,ix,Td.of(!0)]}function Ep(i){return i.startState.facet(Ds)!=i.state.facet(Ds)}const ex=Qp({above:!0,markers(i){let{state:e}=i,t=e.facet(Ds),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:X.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Ms.forRange(i,o,a))n.push(c)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ep(i);return t&&$p(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){$p(e.state,i)},class:"cm-cursorLayer"});function $p(i,e){e.style.animationDuration=i.facet(Ds).cursorBlinkRate+"ms"}const tx=Qp({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Ms.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Ep(i)},class:"cm-selectionLayer"}),ix=Wi.highest(se.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Np=ke.define({map(i,e){return i==null?null:e.mapPos(i)}}),Bs=rt.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,n)=>n.is(Np)?n.value:t,i)}}),nx=Ye.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(Bs);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Bs)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(Bs),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Bs)!=i&&this.view.dispatch({effects:Np.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function sx(){return[Bs,nx]}function Rp(i,e,t,n,s){e.lastIndex=0;for(let r=i.iterRange(t,n),o=t,a;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=e.exec(r.value);)s(o+a.index,a)}function rx(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let n=[];for(let{from:s,to:r}of t)s=Math.max(i.state.doc.lineAt(s).from,s-e),r=Math.min(i.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}class ox{constructor(e){const{regexp:t,decoration:n,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,c,u,h)=>s(h,u,u+a[0].length,a,c);else if(typeof n=="function")this.addMatch=(a,c,u,h)=>{let f=n(a,c,u);f&&h(u,u+a[0].length,f)};else if(n)this.addMatch=(a,c,u,h)=>h(u,u+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new $i,n=t.add.bind(t);for(let{from:s,to:r}of rx(e,this.maxLength))Rp(e.state.doc,this.regexp,s,r,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,a,c)=>{c>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),s=Math.max(c,s))}),e.viewportMoved||s-n>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),n,s):t}updateRange(e,t,n,s){for(let r of e.visibleRanges){let o=Math.max(r.from,n),a=Math.min(r.to,s);if(a>=o){let c=e.state.doc.lineAt(o),u=c.to<a?e.state.doc.lineAt(a):c,h=Math.max(r.from,c.from),f=Math.min(r.to,u.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){h=o;break}for(;a<u.to;a++)if(this.boundary.test(u.text[a-u.from])){f=a;break}}let d=[],m,O=(w,g,p)=>d.push(p.range(w,g));if(c==u)for(this.regexp.lastIndex=h-c.from;(m=this.regexp.exec(c.text))&&m.index<f-c.from;)this.addMatch(m,e,m.index+c.from,O);else Rp(e.state.doc,this.regexp,h,f,(w,g)=>this.addMatch(g,e,w,O));t=t.update({filterFrom:h,filterTo:f,filter:(w,g)=>w<h||g>f,add:d})}}return t}}const va=/x/.unicode!=null?"gu":"g",lx=new RegExp(`[\0-\b
|
|
31
|
-
--\u2028\u2029\uFEFF-]`,va),ax={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ia=null;function cx(){var i;if(Ia==null&&typeof document<"u"&&document.body){let e=document.body.style;Ia=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Ia||!1}const io=ae.define({combine(i){let e=fi(i,{render:null,specialChars:lx,addSpecialChars:null});return(e.replaceTabs=!cx())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,va)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,va)),e}});function ux(i={}){return[io.of(i),hx()]}let Vp=null;function hx(){return Vp||(Vp=Ye.fromClass(class{constructor(i){this.view=i,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(io)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new ox({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,r=Tt(e[0],0);if(r==9){let o=s.lineAt(n),a=t.state.tabSize,c=Dn(o.text,a,n-o.from);return pe.replace({widget:new mx((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=pe.replace({widget:new px(i,r)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(io);i.startState.facet(io)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const fx="•";function dx(i){return i>=32?fx:i==10?"":String.fromCharCode(9216+i)}class px extends pi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=dx(this.code),n=e.state.phrase("Control character")+" "+(ax[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,n,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class mx extends pi{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function gx(){return _x}const Ox=pe.line({class:"cm-activeLine"}),_x=Ye.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let s=i.lineBlockAt(n.head);s.from>e&&(t.push(Ox.range(s.from)),e=s.from)}return pe.set(t)}},{decorations:i=>i.decorations});class bx extends pi{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Bn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),s=Cs(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function yx(i){let e=Ye.fromClass(class{constructor(t){this.view=t,this.placeholder=i?pe.set([pe.widget({widget:new bx(i),side:1}).range(0)]):pe.none}get decorations(){return this.view.state.doc.length?pe.none:this.placeholder}},{decorations:t=>t.decorations});return typeof i=="string"?[e,se.contentAttributes.of({"aria-placeholder":i})]:e}const Za=2e3;function wx(i,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Za||t.off>Za||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let c=n;c<=s;c++){let u=i.doc.line(c);u.length<=a&&r.push(X.range(u.from+o,u.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let c=n;c<=s;c++){let u=i.doc.line(c),h=ta(u.text,o,i.tabSize,!0);if(h<0)r.push(X.cursor(u.to));else{let f=ta(u.text,a,i.tabSize);r.push(X.range(u.from+h,u.from+f))}}}return r}function kx(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Lp(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),s=t-n.from,r=s>Za?-1:s==n.length?kx(i,e.clientX):Dn(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:r,off:s}}function xx(i,e){let t=Lp(i,e),n=i.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(s.changes)}},get(s,r,o){let a=Lp(i,s);if(!a)return n;let c=wx(i.state,t,a);return c.length?o?X.create(c.concat(n.ranges)):X.create(c):n}}:null}function Sx(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return se.mouseSelectionStyle.of((t,n)=>e(n)?xx(t,n):null)}const Cx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Ax={style:"cursor: crosshair"};function Tx(i={}){let[e,t]=Cx[i.key||"Alt"],n=Ye.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[n,se.contentAttributes.of(s=>{var r;return!((r=s.plugin(n))===null||r===void 0)&&r.isDown?Ax:null})]}const no="-10000px";class Mp{constructor(e,t,n,s){this.facet=t,this.createTooltipView=n,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=n(o,r))}update(e,t){var n;let s=e.state.facet(this.facet),r=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let o=[],a=t?[]:null;for(let c=0;c<r.length;c++){let u=r[c],h=-1;if(u){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==u.create&&(h=f)}if(h<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let f=o[c]=this.tooltipViews[h];a&&(a[c]=t[h]),f.update&&f.update(e)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(n=c.destroy)===null||n===void 0||n.call(c));return t&&(a.forEach((c,u)=>t[u]=c),t.length=a.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Px(i){let e=i.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Fa=ae.define({combine:i=>{var e,t,n;return{position:re.ios?"absolute":((e=i.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=i.find(s=>s.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||Px}}}),Dp=new WeakMap,Ua=Ye.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(Fa);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Mp(i,Xa,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,n=i.state.facet(Fa);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=no,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(re.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(i=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:i,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),s=Sa(this.view);return{visible:{left:n.left+s.left,top:n.top+s.top,right:n.right-s.right,bottom:n.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Fa).tooltipSpace(this.view),scaleX:i,scaleY:e,makeAbsolute:t}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:n,scaleX:s,scaleY:r}=i,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let c=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:h}=u,f=i.pos[a],d=i.size[a];if(!f||c.clip!==!1&&(f.bottom<=Math.max(t.top,n.top)||f.top>=Math.min(t.bottom,n.bottom)||f.right<Math.max(t.left,n.left)-.1||f.left>Math.min(t.right,n.right)+.1)){h.style.top=no;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,O=m?7:0,w=d.right-d.left,g=(e=Dp.get(u))!==null&&e!==void 0?e:d.bottom-d.top,p=u.offset||Ex,b=this.view.textDirection==Fe.LTR,k=d.width>n.right-n.left?b?n.left:n.right-d.width:b?Math.max(n.left,Math.min(f.left-(m?14:0)+p.x,n.right-w)):Math.min(Math.max(n.left,f.left-w+(m?14:0)-p.x),n.right-w),y=this.above[a];!c.strictSide&&(y?f.top-g-O-p.y<n.top:f.bottom+g+O+p.y>n.bottom)&&y==n.bottom-f.bottom>f.top-n.top&&(y=this.above[a]=!y);let C=(y?f.top-n.top:n.bottom-f.bottom)-O;if(C<g&&u.resize!==!1){if(C<this.view.defaultLineHeight){h.style.top=no;continue}Dp.set(u,g),h.style.height=(g=C)/r+"px"}else h.style.height&&(h.style.height="");let T=y?f.top-g-O-p.y:f.bottom+O+p.y,x=k+w;if(u.overlap!==!0)for(let A of o)A.left<x&&A.right>k&&A.top<T+g&&A.bottom>T&&(T=y?A.top-g-2-O:A.bottom+O+2);if(this.position=="absolute"?(h.style.top=(T-i.parent.top)/r+"px",Bp(h,(k-i.parent.left)/s)):(h.style.top=T/r+"px",Bp(h,k/s)),m){let A=f.left+(b?p.x:-p.x)-(k+14-7);m.style.left=A/s+"px"}u.overlap!==!0&&o.push({left:k,top:T,right:x,bottom:T+g}),h.classList.toggle("cm-tooltip-above",y),h.classList.toggle("cm-tooltip-below",!y),u.positioned&&u.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=no}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Bp(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const Qx=se.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ex={x:0,y:0},Xa=ae.define({enables:[Ua,Qx]}),so=ae.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class ro{static create(e){return new ro(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Mp(e,so,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let s=n[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const $x=Xa.compute([so],i=>{let e=i.facet(so);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:ro.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Nx{constructor(e,t,n,s,r){this.view=e,this.source=t,this.field=n,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let s,r=1;if(n instanceof Ri)s=n.posAtStart;else{if(s=e.posAtCoords(t),s==null)return;let a=e.coordsAtPos(s);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),u=c&&c.dir==Fe.RTL?-1:1;r=t.x<a.left?-u:u}let o=this.source(e,s,r);if(o!=null&&o.then){let a=this.pending={pos:s};o.then(c=>{this.pending==a&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Pt(e.state,c,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Ua),t=e?e.manager.tooltips.findIndex(n=>n.create==ro.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Rx(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(n=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Vx(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const oo=4;function Rx(i,e){let{left:t,right:n,top:s,bottom:r}=i.getBoundingClientRect(),o;if(o=i.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),r=Math.max(a.bottom,r)}return e.clientX>=t-oo&&e.clientX<=n+oo&&e.clientY>=s-oo&&e.clientY<=r+oo}function Vx(i,e,t,n,s,r){let o=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>n||o.right<n||o.top>s||Math.min(o.bottom,a)<s)return!1;let c=i.posAtCoords({x:n,y:s},!1);return c>=e&&c<=t}function Lx(i,e={}){let t=ke.define(),n=rt.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let a of s){let c=r.changes.mapPos(a.pos,-1,ft.TrackDel);if(c!=null){let u=Object.assign(Object.create(null),a);u.pos=c,u.end!=null&&(u.end=r.changes.mapPos(u.end)),o.push(u)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Mx)&&(s=[]);return s},provide:s=>so.from(s)});return{active:n,extension:[n,Ye.define(s=>new Nx(s,i,n,t,e.hoverTime||300)),$x]}}function vp(i,e){let t=i.plugin(Ua);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const Mx=ke.define(),Ip=ae.define({combine(i){let e,t;for(let n of i)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function vs(i,e){let t=i.plugin(Zp),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Zp=Ye.fromClass(class{constructor(i){this.input=i.state.facet(Is),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(Ip);this.top=new lo(i,!0,e.topContainer),this.bottom=new lo(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(Ip);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new lo(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new lo(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Is);if(t!=this.input){let n=t.filter(c=>c),s=[],r=[],o=[],a=[];for(let c of n){let u=this.specs.indexOf(c),h;u<0?(h=c(i.view),a.push(h)):(h=this.panels[u],h.update&&h.update(i)),s.push(h),(h.top?r:o).push(h)}this.specs=n,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let c of a)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class lo{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Fp(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Fp(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Fp(i){let e=i.nextSibling;return i.remove(),e}const Is=ae.define({enables:Zp});class Mi extends pn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Mi.prototype.elementClass="",Mi.prototype.toDOM=void 0,Mi.prototype.mapMode=ft.TrackBefore,Mi.prototype.startSide=Mi.prototype.endSide=-1,Mi.prototype.point=!0;const ao=ae.define(),Dx=ae.define(),Bx={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ne.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Zs=ae.define();function vx(i){return[Up(),Zs.of({...Bx,...i})]}const Wa=ae.define({combine:i=>i.some(e=>e)});function Up(i){let e=[Ix];return i&&i.fixed===!1&&e.push(Wa.of(!0)),e}const Ix=Ye.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Zs).map(e=>new Wp(i,e)),this.fixed=!i.state.facet(Wa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Wa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ne.iter(this.view.state.facet(ao),this.view.viewport.from),n=[],s=this.gutters.map(r=>new Zx(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==kt.Text&&o){qa(t,n,a.from);for(let c of s)c.line(this.view,a,n);o=!1}else if(a.widget)for(let c of s)c.widget(this.view,a)}else if(r.type==kt.Text){qa(t,n,r.from);for(let o of s)o.line(this.view,r,n)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet(Zs),t=i.state.facet(Zs),n=i.docChanged||i.heightChanged||i.viewportChanged||!Ne.eq(i.startState.facet(ao),i.state.facet(ao),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(i)&&(n=!0);else{n=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Wp(this.view,r)):(this.gutters[o].update(i),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Fe.LTR?{left:n,right:s}:{right:n,left:s}})});function Xp(i){return Array.isArray(i)?i:[i]}function qa(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class Zx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ne.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let a=new qp(e,o,r,n);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,r,n);this.height=t.bottom,this.i++}line(e,t,n){let s=[];qa(this.cursor,s,t.from),n.length&&(s=s.concat(n));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),s=n?[n]:null;for(let r of e.state.facet(Dx)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Wp{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let c=r.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,s)&&s.preventDefault()});this.markers=Xp(t.markers(e)),t.initialSpacer&&(this.spacer=new qp(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Xp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let n=e.view.viewport;return!Ne.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class qp{constructor(e,t,n,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,s)}update(e,t,n,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),Fx(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let n="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let a=o,c=r<t.length?t[r++]:null,u=!1;if(c){let h=c.elementClass;h&&(n+=" "+h);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){a=f,u=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!c)break;c.toDOM&&(u?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),u&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function Fx(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}const Ux=ae.define(),Xx=ae.define(),Wn=ae.define({combine(i){return fi(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let s in t){let r=n[s],o=t[s];n[s]=r?(a,c,u)=>r(a,c,u)||o(a,c,u):o}return n}})}});class ja extends Mi{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function za(i,e){return i.state.facet(Wn).formatNumber(e,i.state)}const Wx=Zs.compute([Wn],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Ux)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new ja(za(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let s of e.state.facet(Xx)){let r=s(e,t,n);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Wn)!=e.state.facet(Wn),initialSpacer(e){return new ja(za(e,jp(e.state.doc.lines)))},updateSpacer(e,t){let n=za(t.view,jp(t.view.state.doc.lines));return n==e.number?e:new ja(n)},domEventHandlers:i.facet(Wn).domEventHandlers,side:"before"}));function qx(i={}){return[Wn.of(i),Up(),Wx]}function jp(i){let e=9;for(;e<i;)e=e*10+9;return e}const jx=new class extends Mi{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},zx=ao.compute(["selection"],i=>{let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.head).from;s>t&&(t=s,e.push(jx.range(s)))}return Ne.of(e)});function Yx(){return zx}const zp=1024;let Gx=0;class Ya{constructor(e,t){this.from=e,this.to=t}}class Se{constructor(e={}){this.id=Gx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qt.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Se.closedBy=new Se({deserialize:i=>i.split(" ")}),Se.openedBy=new Se({deserialize:i=>i.split(" ")}),Se.group=new Se({deserialize:i=>i.split(" ")}),Se.isolate=new Se({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}}),Se.contextHash=new Se({perNode:!0}),Se.lookAhead=new Se({perNode:!0}),Se.mounted=new Se({perNode:!0});class co{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Se.mounted.id]}}const Kx=Object.create(null);class Qt{constructor(e,t,n,s=0){this.name=e,this.props=t,this.id=n,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Kx,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Qt(e.name||"",t,e.id,n);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Se.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let s of n.split(" "))t[s]=e[n];return n=>{for(let s=n.prop(Se.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?n.name:s[r]];if(o)return o}}}}Qt.none=new Qt("",Object.create(null),0,8);class Ga{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let s=null;for(let r of e){let o=r(n);if(o){s||(s=Object.assign({},n.props));let a=o[1],c=o[0];c.combine&&c.id in s&&(a=c.combine(s[c.id],a)),s[c.id]=a}}t.push(s?new Qt(n.name,s,n.id,n.flags):n)}return new Ga(t)}}const uo=new WeakMap,Yp=new WeakMap;var nt;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(nt||(nt={}));class et{constructor(e,t,n,s,r){if(this.type=e,this.children=t,this.positions=n,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=co.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let s=n.toString();s&&(t&&(t+=","),t+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Ja(this.topNode,e)}cursorAt(e,t=0,n=0){let s=uo.get(this)||this.topNode,r=new Ja(s);return r.moveTo(e,t),uo.set(this,r._tree),r}get topNode(){return new Et(this,0,0,null)}resolve(e,t=0){let n=Fs(uo.get(this)||this.topNode,e,t,!1);return uo.set(this,n),n}resolveInner(e,t=0){let n=Fs(Yp.get(this)||this.topNode,e,t,!0);return Yp.set(this,n),n}resolveStack(e,t=0){return eS(this,e,t)}iterate(e){let{enter:t,leave:n,from:s=0,to:r=this.length}=e,o=e.mode||0,a=(o&nt.IncludeAnonymous)>0;for(let c=this.cursor(o|nt.IncludeAnonymous);;){let u=!1;if(c.from<=r&&c.to>=s&&(!a&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&n&&(a||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:tc(Qt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,s)=>new et(this.type,t,n,s,this.propValues),e.makeTree||((t,n,s)=>new et(Qt.none,t,n,s)))}static build(e){return tS(e)}}et.empty=new et(Qt.none,[],[],0);class Ka{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ka(this.buffer,this.index)}}class Ki{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Qt.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],s=this.set.types[t],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),e+=4,n==e)return r;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,s,r){let{buffer:o}=this,a=-1;for(let c=e;c!=t&&!(Gp(r,s,o[c+1],o[c+2])&&(a=c,n>0));c=o[c+3]);return a}slice(e,t,n){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,c=0;a<t;){r[c++]=s[a++],r[c++]=s[a++]-n;let u=r[c++]=s[a++]-n;r[c++]=s[a++]-e,o=Math.max(o,u)}return new Ki(r,o,this.set)}}function Gp(i,e,t,n){switch(i){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Fs(i,e,t,n){for(var s;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!n&&i instanceof Et&&i.index<0?null:i.parent;if(!o)return i;i=o}let r=n?0:nt.IgnoreOverlays;if(n)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof Et&&o.index<0&&((s=a.enter(e,t,r))===null||s===void 0?void 0:s.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,r);if(!o)return i;i=o}}class Kp{cursor(e=0){return new Ja(this,e)}getChild(e,t=null,n=null){let s=Hp(this,e,t,n);return s.length?s[0]:null}getChildren(e,t=null,n=null){return Hp(this,e,t,n)}resolve(e,t=0){return Fs(this,e,t,!1)}resolveInner(e,t=0){return Fs(this,e,t,!0)}matchContext(e){return Ha(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(n=t,t=s.prevSibling):t=s}return n}get node(){return this}get next(){return this.parent}}class Et extends Kp{constructor(e,t,n,s){super(),this._tree=e,this.from=t,this.index=n,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,s,r=0){for(let o=this;;){for(let{children:a,positions:c}=o._tree,u=t>0?a.length:-1;e!=u;e+=t){let h=a[e],f=c[e]+o.from;if(Gp(s,n,f,f+h.length)){if(h instanceof Ki){if(r&nt.ExcludeBuffers)continue;let d=h.findChild(0,h.buffer.length,t,n-f,s);if(d>-1)return new Oi(new Hx(o,h,e,f),null,d)}else if(r&nt.IncludeAnonymous||!h.type.isAnonymous||ec(h)){let d;if(!(r&nt.IgnoreMounts)&&(d=co.get(h))&&!d.overlay)return new Et(d.tree,f,e,o);let m=new Et(h,f,e,o);return r&nt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?h.children.length-1:0,t,n,s)}}}if(r&nt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let s;if(!(n&nt.IgnoreOverlays)&&(s=co.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:a}of s.overlay)if((t>0?o<=r:o<r)&&(t<0?a>=r:a>r))return new Et(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Hp(i,e,t,n){let s=i.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(n!=null&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return n==null?r:[]}}function Ha(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Hx{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class Oi extends Kp{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Oi(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&nt.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Oi(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Oi(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Oi(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,s=this.index+4,r=n.buffer[this.index+3];if(r>s){let o=n.buffer[this.index+1];e.push(n.slice(s,r,o)),t.push(0)}return new et(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Jp(i){if(!i.length)return null;let e=0,t=i[0];for(let r=1;r<i.length;r++){let o=i[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let n=t instanceof Et&&t.index<0?null:t.parent,s=i.slice();return n?s[e]=n:s.splice(e,1),new Jx(s,t)}class Jx{constructor(e,t){this.heads=e,this.node=t}get next(){return Jp(this.heads)}}function eS(i,e,t){let n=i.resolveInner(e,t),s=null;for(let r=n instanceof Et?n:n.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(s||(s=[n])).push(o.resolve(e,t)),r=o}else{let o=co.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Et(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(Fs(a,e,t,!1))}}return s?Jp(s):n}class Ja{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Et)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=n+s.buffer[e+1],this.to=n+s.buffer[e+2],!0}yield(e){return e?e instanceof Et?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,n);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&nt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&nt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&nt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let s=n<0?0:this.stack[n]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(s)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(s.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:n}=s)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let a=n._tree.children[r];if(this.mode&nt.IncludeAnonymous||a instanceof Ki||!a.type.isAnonymous||ec(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let s=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,n=r+1;break e}s=this.stack[--r]}for(let s=n;s<this.stack.length;s++)t=new Oi(this.buffer,t,this.stack[s]);return this.bufferNode=new Oi(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&t&&t(this),s=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,s=!0}}}matchContext(e){if(!this.buffer)return Ha(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let s=e.length-1,r=this.stack.length-1;s>=0;r--){if(r<0)return Ha(this._tree,e,s);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function ec(i){return i.children.some(e=>e instanceof Ki||!e.type.isAnonymous||ec(e))}function tS(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=zp,reused:r=[],minRepeatType:o=n.types.length}=i,a=Array.isArray(t)?new Ka(t,t.length):t,c=n.types,u=0,h=0;function f(C,T,x,A,R,_){let{id:S,start:P,end:Q,size:E}=a,W=h,B=u;if(E<0)if(a.next(),E==-1){let j=r[S];x.push(j),A.push(P-C);return}else if(E==-3){u=S;return}else if(E==-4){h=S;return}else throw new RangeError(`Unrecognized record size: ${E}`);let I=c[S],G,Z,H=P-C;if(Q-P<=s&&(Z=g(a.pos-T,R))){let j=new Uint16Array(Z.size-Z.skip),z=a.pos-Z.size,me=j.length;for(;a.pos>z;)me=p(Z.start,j,me);G=new Ki(j,Q-Z.start,n),H=Z.start-C}else{let j=a.pos-E;a.next();let z=[],me=[],de=S>=o?S:-1,ce=0,v=Q;for(;a.pos>j;)de>=0&&a.id==de&&a.size>=0?(a.end<=v-s&&(O(z,me,P,ce,a.end,v,de,W,B),ce=z.length,v=a.end),a.next()):_>2500?d(P,j,z,me):f(P,j,z,me,de,_+1);if(de>=0&&ce>0&&ce<z.length&&O(z,me,P,ce,P,v,de,W,B),z.reverse(),me.reverse(),de>-1&&ce>0){let N=m(I,B);G=tc(I,z,me,0,z.length,0,Q-P,N,N)}else G=w(I,z,me,Q-P,W-Q,B)}x.push(G),A.push(H)}function d(C,T,x,A){let R=[],_=0,S=-1;for(;a.pos>T;){let{id:P,start:Q,end:E,size:W}=a;if(W>4)a.next();else{if(S>-1&&Q<S)break;S<0&&(S=E-s),R.push(P,Q,E),_++,a.next()}}if(_){let P=new Uint16Array(_*4),Q=R[R.length-2];for(let E=R.length-3,W=0;E>=0;E-=3)P[W++]=R[E],P[W++]=R[E+1]-Q,P[W++]=R[E+2]-Q,P[W++]=W;x.push(new Ki(P,R[2]-Q,n)),A.push(Q-C)}}function m(C,T){return(x,A,R)=>{let _=0,S=x.length-1,P,Q;if(S>=0&&(P=x[S])instanceof et){if(!S&&P.type==C&&P.length==R)return P;(Q=P.prop(Se.lookAhead))&&(_=A[S]+P.length+Q)}return w(C,x,A,R,_,T)}}function O(C,T,x,A,R,_,S,P,Q){let E=[],W=[];for(;C.length>A;)E.push(C.pop()),W.push(T.pop()+x-R);C.push(w(n.types[S],E,W,_-R,P-_,Q)),T.push(R-x)}function w(C,T,x,A,R,_,S){if(_){let P=[Se.contextHash,_];S=S?[P].concat(S):[P]}if(R>25){let P=[Se.lookAhead,R];S=S?[P].concat(S):[P]}return new et(C,T,x,A,S)}function g(C,T){let x=a.fork(),A=0,R=0,_=0,S=x.end-s,P={size:0,start:0,skip:0};e:for(let Q=x.pos-C;x.pos>Q;){let E=x.size;if(x.id==T&&E>=0){P.size=A,P.start=R,P.skip=_,_+=4,A+=4,x.next();continue}let W=x.pos-E;if(E<0||W<Q||x.start<S)break;let B=x.id>=o?4:0,I=x.start;for(x.next();x.pos>W;){if(x.size<0)if(x.size==-3||x.size==-4)B+=4;else break e;else x.id>=o&&(B+=4);x.next()}R=I,A+=E,_+=B}return(T<0||A==C)&&(P.size=A,P.start=R,P.skip=_),P.size>4?P:void 0}function p(C,T,x){let{id:A,start:R,end:_,size:S}=a;if(a.next(),S>=0&&A<o){let P=x;if(S>4){let Q=a.pos-(S-4);for(;a.pos>Q;)x=p(C,T,x)}T[--x]=P,T[--x]=_-C,T[--x]=R-C,T[--x]=A}else S==-3?u=A:S==-4&&(h=A);return x}let b=[],k=[];for(;a.pos>0;)f(i.start||0,i.bufferStart||0,b,k,-1,0);let y=(e=i.length)!==null&&e!==void 0?e:b.length?k[0]+b[0].length:0;return new et(c[i.topID],b.reverse(),k.reverse(),y)}const em=new WeakMap;function ho(i,e){if(!i.isAnonymous||e instanceof Ki||e.type!=i)return 1;let t=em.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof et)){t=1;break}t+=ho(i,n)}em.set(e,t)}return t}function tc(i,e,t,n,s,r,o,a,c){let u=0;for(let O=n;O<s;O++)u+=ho(i,e[O]);let h=Math.ceil(u*1.5/8),f=[],d=[];function m(O,w,g,p,b){for(let k=g;k<p;){let y=k,C=w[k],T=ho(i,O[k]);for(k++;k<p;k++){let x=ho(i,O[k]);if(T+x>=h)break;T+=x}if(k==y+1){if(T>h){let x=O[y];m(x.children,x.positions,0,x.children.length,w[y]+b);continue}f.push(O[y])}else{let x=w[k-1]+O[k-1].length-C;f.push(tc(i,O,w,y,k,C,x,null,c))}d.push(C+b-r)}}return m(e,t,n,s,0),(a||c)(f,d,o)}class iS{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Oi?this.setBuffer(e.context.buffer,e.index,t):e instanceof Et&&this.map.set(e.tree,t)}get(e){return e instanceof Oi?this.getBuffer(e.context.buffer,e.index):e instanceof Et?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class bn{constructor(e,t,n,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let s=[new bn(0,e.length,e,0,!1,n)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,n=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let a=0,c=0,u=0;;a++){let h=a<t.length?t[a]:null,f=h?h.fromA:1e9;if(f-c>=n)for(;o&&o.from<f;){let d=o;if(c>=d.from||f<=d.to||u){let m=Math.max(d.from,c)-u,O=Math.min(d.to,f)-u;d=m>=O?null:new bn(m,O,d.tree,d.offset+u,a>0,!!h)}if(d&&s.push(d),o.to>f)break;o=r<e.length?e[r++]:null}if(!h)break;c=h.toA,u=h.toA-h.toB}return s}}class tm{startParse(e,t,n){return typeof e=="string"&&(e=new nS(e)),n=n?n.length?n.map(s=>new Ya(s.from,s.to)):[new Ya(0,0)]:[new Ya(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let s=this.startParse(e,t,n);for(;;){let r=s.advance();if(r)return r}}}class nS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Se({perNode:!0});let sS=0;class Xt{constructor(e,t,n,s){this.name=e,this.set=t,this.base=n,this.modified=s,this.id=sS++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Xt&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let s=new Xt(n,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new fo(e);return n=>n.modified.indexOf(t)>-1?n:fo.get(n.base||n,n.modified.concat(t).sort((s,r)=>s.id-r.id))}}let rS=0;class fo{constructor(e){this.name=e,this.instances=[],this.id=rS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&oS(t,a.modified));if(n)return n;let s=[],r=new Xt(e.name,s,e,t);for(let a of t)a.instances.push(r);let o=lS(t);for(let a of e.set)if(!a.modified.length)for(let c of o)s.push(fo.get(a,c));return r}}function oS(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function lS(i){let e=[[]];for(let t=0;t<i.length;t++)for(let n=0,s=e.length;n<s;n++)e.push(e[n].concat(i[t]));return e.sort((t,n)=>n.length-t.length)}function im(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let s of t.split(" "))if(s){let r=[],o=2,a=s;for(let f=0;;){if(a=="..."&&f>0&&f+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==s.length)break;let m=s[f++];if(f==s.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);a=s.slice(f)}let c=r.length-1,u=r[c];if(!u)throw new RangeError("Invalid path: "+s);let h=new Us(n,o,c>0?r.slice(0,c):null);e[u]=h.sort(e[u])}}return nm.add(e)}const nm=new Se({combine(i,e){let t,n,s;for(;i||e;){if(!i||e&&i.depth>=e.depth?(s=e,e=e.next):(s=i,i=i.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new Us(s.tags,s.mode,s.context);t?t.next=r:n=r,t=r}return n}});class Us{constructor(e,t,n,s){this.tags=e,this.mode=t,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Us.empty=new Us([],2,null);function sm(i,e){let t=Object.create(null);for(let r of i)if(!Array.isArray(r.tag))t[r.tag.id]=r.class;else for(let o of r.tag)t[o.id]=r.class;let{scope:n,all:s=null}=e||{};return{style:r=>{let o=s;for(let a of r)for(let c of a.set){let u=t[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}function aS(i,e){let t=null;for(let n of i){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function cS(i,e,t,n=0,s=i.length){let r=new uS(n,Array.isArray(e)?e:[e],t);r.highlightRange(i.cursor(),n,s,"",r.highlighters),r.flush(s)}class uS{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,r){let{type:o,from:a,to:c}=e;if(a>=n||c<=t)return;o.isTop&&(r=this.highlighters.filter(m=>!m.scope||m.scope(o)));let u=s,h=hS(e)||Us.empty,f=aS(r,h.tags);if(f&&(u&&(u+=" "),u+=f,h.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,a),u),h.opaque)return;let d=e.tree&&e.tree.prop(Se.mounted);if(d&&d.overlay){let m=e.node.enter(d.overlay[0].from+a,1),O=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),w=e.firstChild();for(let g=0,p=a;;g++){let b=g<d.overlay.length?d.overlay[g]:null,k=b?b.from+a:c,y=Math.max(t,p),C=Math.min(n,k);if(y<C&&w)for(;e.from<C&&(this.highlightRange(e,y,C,s,r),this.startSpan(Math.min(C,e.to),u),!(e.to>=k||!e.nextSibling())););if(!b||k>n)break;p=b.to+a,p>t&&(this.highlightRange(m.cursor(),Math.max(t,b.from+a),Math.min(n,p),"",O),this.startSpan(Math.min(n,p),u))}w&&e.parent()}else if(e.firstChild()){d&&(s="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,r),this.startSpan(Math.min(n,e.to),u)}while(e.nextSibling());e.parent()}}}function hS(i){let e=i.type.prop(nm);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const te=Xt.define,po=te(),Hi=te(),rm=te(Hi),om=te(Hi),Ji=te(),mo=te(Ji),ic=te(Ji),_i=te(),yn=te(_i),bi=te(),yi=te(),nc=te(),Xs=te(nc),go=te(),M={comment:po,lineComment:te(po),blockComment:te(po),docComment:te(po),name:Hi,variableName:te(Hi),typeName:rm,tagName:te(rm),propertyName:om,attributeName:te(om),className:te(Hi),labelName:te(Hi),namespace:te(Hi),macroName:te(Hi),literal:Ji,string:mo,docString:te(mo),character:te(mo),attributeValue:te(mo),number:ic,integer:te(ic),float:te(ic),bool:te(Ji),regexp:te(Ji),escape:te(Ji),color:te(Ji),url:te(Ji),keyword:bi,self:te(bi),null:te(bi),atom:te(bi),unit:te(bi),modifier:te(bi),operatorKeyword:te(bi),controlKeyword:te(bi),definitionKeyword:te(bi),moduleKeyword:te(bi),operator:yi,derefOperator:te(yi),arithmeticOperator:te(yi),logicOperator:te(yi),bitwiseOperator:te(yi),compareOperator:te(yi),updateOperator:te(yi),definitionOperator:te(yi),typeOperator:te(yi),controlOperator:te(yi),punctuation:nc,separator:te(nc),bracket:Xs,angleBracket:te(Xs),squareBracket:te(Xs),paren:te(Xs),brace:te(Xs),content:_i,heading:yn,heading1:te(yn),heading2:te(yn),heading3:te(yn),heading4:te(yn),heading5:te(yn),heading6:te(yn),contentSeparator:te(_i),list:te(_i),quote:te(_i),emphasis:te(_i),strong:te(_i),link:te(_i),monospace:te(_i),strikethrough:te(_i),inserted:te(),deleted:te(),changed:te(),invalid:te(),meta:go,documentMeta:te(go),annotation:te(go),processingInstruction:te(go),definition:Xt.defineModifier("definition"),constant:Xt.defineModifier("constant"),function:Xt.defineModifier("function"),standard:Xt.defineModifier("standard"),local:Xt.defineModifier("local"),special:Xt.defineModifier("special")};for(let i in M){let e=M[i];e instanceof Xt&&(e.name=i)}sm([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]);var sc;const qn=new Se;function lm(i){return ae.define({combine:i?e=>e.concat(i):void 0})}const rc=new Se;class ei{constructor(e,t,n=[],s=""){this.data=e,this.name=s,Te.prototype.hasOwnProperty("tree")||Object.defineProperty(Te.prototype,"tree",{get(){return st(this)}}),this.parser=t,this.extension=[en.of(this),Te.languageData.of((r,o,a)=>{let c=am(r,o,a),u=c.type.prop(qn);if(!u)return[];let h=r.facet(u),f=c.type.prop(rc);if(f){let d=c.resolve(o-c.from,a);for(let m of f)if(m.test(d,r)){let O=r.facet(m.facet);return m.type=="replace"?O:O.concat(h)}}return h})].concat(n)}isActiveAt(e,t,n=-1){return am(e,t,n).type.prop(qn)==this.data}findRegions(e){let t=e.facet(en);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],s=(r,o)=>{if(r.prop(qn)==this.data){n.push({from:o,to:o+r.length});return}let a=r.prop(Se.mounted);if(a){if(a.tree.prop(qn)==this.data){if(a.overlay)for(let c of a.overlay)n.push({from:c.from+o,to:c.to+o});else n.push({from:o,to:o+r.length});return}else if(a.overlay){let c=n.length;if(s(a.tree,a.overlay[0].from+o),n.length>c)return}}for(let c=0;c<r.children.length;c++){let u=r.children[c];u instanceof et&&s(u,r.positions[c]+o)}};return s(st(e),0),n}get allowsNesting(){return!0}}ei.setState=ke.define();function am(i,e,t){let n=i.facet(en),s=st(i).topNode;if(!n||n.allowsNesting)for(let r=s;r;r=r.enter(e,t,nt.ExcludeBuffers))r.type.isTop&&(s=r);return s}class Oo extends ei{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=lm(e.languageData);return new Oo(t,e.parser.configure({props:[qn.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Oo(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function st(i){let e=i.field(ei.state,!1);return e?e.tree:et.empty}class fS{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Ws=null;class _o{constructor(e,t,n=[],s,r,o,a,c){this.parser=e,this.state=t,this.fragments=n,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new _o(e,t,[],et.empty,0,n,[],null)}startParse(){return this.parser.startParse(new fS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=et.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(bn.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(bn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ws;Ws=this;try{return e()}finally{Ws=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=cm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:s,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((u,h,f,d)=>c.push({fromA:u,toA:h,fromB:f,toB:d})),n=bn.applyChanges(n,c),s=et.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let h=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);h<f&&a.push({from:h,to:f})}}}return new _o(this.parser,t,n,s,r,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:s,to:r}=this.skipped[n];s<e.to&&r>e.from&&(this.fragments=cm(this.fragments,s,r),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends tm{createParse(t,n,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let c=Ws;if(c){for(let u of s)c.tempSkipped.push(u);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=o,new et(Qt.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ws}}function cm(i,e,t){return bn.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class jn{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new jn(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=_o.create(e.facet(en).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new jn(n)}}ei.state=rt.define({create:jn.init,update(i,e){for(let t of e.effects)if(t.is(ei.setState))return t.value;return e.startState.facet(en)!=e.state.facet(en)?jn.init(e.state):i.apply(e)}});let um=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(um=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const oc=typeof navigator<"u"&&(!((sc=navigator.scheduling)===null||sc===void 0)&&sc.isInputPending)?()=>navigator.scheduling.isInputPending():null,dS=Ye.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ei.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ei.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=um(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:s}}=this.view,r=n.field(ei.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!oc?Math.max(25,e.timeRemaining()-5):1e9),a=r.context.treeLen<s&&n.doc.length>s+1e3,c=r.context.work(()=>oc&&oc()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ei.setState.of(new jn(r.context))})),this.chunkBudget>0&&!(c&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),en=ae.define({combine(i){return i.length?i[0]:null},enables:i=>[ei.state,dS,se.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class pS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const mS=ae.define(),qs=ae.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function bo(i){let e=i.facet(qs);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function js(i,e){let t="",n=i.tabSize,s=i.facet(qs)[0];if(s==" "){for(;e>=n;)t+=" ",e-=n;s=" "}for(let r=0;r<e;r++)t+=s;return t}function lc(i,e){i instanceof Te&&(i=new yo(i));for(let n of i.state.facet(mS)){let s=n(i,e);if(s!==void 0)return s}let t=st(i.state);return t.length>=e?gS(i,t,e):null}class yo{constructor(e,t={}){this.state=e,this.options=t,this.unit=bo(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=n.from&&s<=n.to?r&&s==e?{text:"",from:e}:(t<0?s<e:s<=e)?{text:n.text.slice(s-n.from),from:s}:{text:n.text.slice(0,s-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:s}=this.lineAt(e,t);return n.slice(e-s,Math.min(n.length,e+100-s))}column(e,t=1){let{text:n,from:s}=this.lineAt(e,t),r=this.countColumn(n,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(r+=o-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Dn(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const hm=new Se;function gS(i,e,t){let n=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=n.node){let r=[];for(let o=s;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)n={node:r[o],next:n}}return fm(n,i,t)}function fm(i,e,t){for(let n=i;n;n=n.next){let s=_S(n.node);if(s)return s(ac.create(e,t,n))}return 0}function OS(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function _S(i){let e=i.type.prop(hm);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(Se.closedBy))){let s=i.lastChild,r=s&&n.indexOf(s.name)>-1;return o=>dm(o,!0,1,void 0,r&&!OS(o)?s.from:void 0)}return i.parent==null?bS:null}function bS(){return 0}class ac extends yo{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new ac(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(yS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return fm(this.context.next,this.base,this.pos)}}function yS(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function wS(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let s=i.options.simulateBreak,r=i.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let a=t.to;;){let c=e.childAfter(a);if(!c||c==n)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+u}}a=c.to}}function kS({closing:i,align:e=!0,units:t=1}){return n=>dm(n,e,t,i)}function dm(i,e,t,n,s){let r=i.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==i.pos+o,c=e?wS(i):null;return c?a?i.column(c.from):i.column(c.to):i.baseIndent+(a?0:i.unit*t)}const xS=i=>i.baseIndent;function cc({except:i,units:e=1}={}){return t=>{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const SS=200;function CS(){return Te.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,s=t.lineAt(n);if(n>s.from+SS)return i;let r=t.sliceString(s.from,n);if(!e.some(u=>u.test(r)))return i;let{state:o}=i,a=-1,c=[];for(let{head:u}of o.selection.ranges){let h=o.doc.lineAt(u);if(h.from==a)continue;a=h.from;let f=lc(o,h.from);if(f==null)continue;let d=/^\s*/.exec(h.text)[0],m=js(o,f);d!=m&&c.push({from:h.from,to:h.from+d.length,insert:m})}return c.length?[i,{changes:c,sequential:!0}]:i})}const AS=ae.define(),pm=new Se;function TS(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function PS(i,e,t){let n=st(i);if(n.length<t)return null;let s=n.resolveStack(t,1),r=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(r&&a.from<e)break;let c=a.type.prop(pm);if(c&&(a.to<n.length-50||n.length==i.doc.length||!QS(a))){let u=c(a,i);u&&u.from<=t&&u.from>=e&&u.to>t&&(r=u)}}return r}function QS(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function wo(i,e,t){for(let n of i.facet(AS)){let s=n(i,e,t);if(s)return s}return PS(i,e,t)}function mm(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}const ko=ke.define({map:mm}),zs=ke.define({map:mm});function gm(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(i.lineBlockAt(t));return e}const wn=rt.define({create(){return pe.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>i=Om(i,t,n)),i=i.map(e.changes);for(let t of e.effects)if(t.is(ko)&&!ES(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(uc),s=n?pe.replace({widget:new LS(n(e.state,t.value))}):km;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(zs)&&(i=i.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(i=Om(i,e.selection.main.head)),i},provide:i=>se.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,s)=>{t.push(n,s)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let n=i[t++],s=i[t++];if(typeof n!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(km.range(n,s))}return pe.set(e,!0)}});function Om(i,e,t=e){let n=!1;return i.between(e,t,(s,r)=>{s<t&&r>e&&(n=!0)}),n?i.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):i}function xo(i,e,t){var n;let s=null;return(n=i.field(wn,!1))===null||n===void 0||n.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function ES(i,e,t){let n=!1;return i.between(e,e,(s,r)=>{s==e&&r==t&&(n=!0)}),n}function _m(i,e){return i.field(wn,!1)?e:e.concat(ke.appendConfig.of(ym()))}const $S=i=>{for(let e of gm(i)){let t=wo(i.state,e.from,e.to);if(t)return i.dispatch({effects:_m(i.state,[ko.of(t),bm(i,t)])}),!0}return!1},NS=i=>{if(!i.state.field(wn,!1))return!1;let e=[];for(let t of gm(i)){let n=xo(i.state,t.from,t.to);n&&e.push(zs.of(n),bm(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function bm(i,e,t=!0){let n=i.state.doc.lineAt(e.from).number,s=i.state.doc.lineAt(e.to).number;return se.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${s}.`)}const RS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:$S},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:NS},{key:"Ctrl-Alt-[",run:i=>{let{state:e}=i,t=[];for(let n=0;n<e.doc.length;){let s=i.lineBlockAt(n),r=wo(e,s.from,s.to);r&&t.push(ko.of(r)),n=(r?i.lineBlockAt(r.to):s).to+1}return t.length&&i.dispatch({effects:_m(i.state,t)}),!!t.length}},{key:"Ctrl-Alt-]",run:i=>{let e=i.state.field(wn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,s)=>{t.push(zs.of({from:n,to:s}))}),i.dispatch({effects:t}),!0}}],VS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},uc=ae.define({combine(i){return fi(i,VS)}});function ym(i){let e=[wn,BS];return i&&e.push(uc.of(i)),e}function wm(i,e){let{state:t}=i,n=t.facet(uc),s=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),c=xo(i.state,a.from,a.to);c&&i.dispatch({effects:zs.of(c)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,s,e);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const km=pe.replace({widget:new class extends pi{toDOM(i){return wm(i,null)}}});class LS extends pi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return wm(e,this.value)}}const MS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class hc extends Mi{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function DS(i={}){let e={...MS,...i},t=new hc(e,!0),n=new hc(e,!1),s=Ye.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(en)!=o.state.facet(en)||o.startState.field(wn,!1)!=o.state.field(wn,!1)||st(o.startState)!=st(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new $i;for(let c of o.viewportLineBlocks){let u=xo(o.state,c.from,c.to)?n:wo(o.state,c.from,c.to)?t:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:r}=e;return[s,vx({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ne.empty},initialSpacer(){return new hc(e,!1)},domEventHandlers:{...r,click:(o,a,c)=>{if(r.click&&r.click(o,a,c))return!0;let u=xo(o.state,a.from,a.to);if(u)return o.dispatch({effects:zs.of(u)}),!0;let h=wo(o.state,a.from,a.to);return h?(o.dispatch({effects:ko.of(h)}),!0):!1}}}),ym()]}const BS=se.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ys{constructor(e,t){this.specs=e;let n;function s(a){let c=qi.newName();return(n||(n=Object.create(null)))["."+c]=a,c}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof ei?a=>a.prop(qn)==o.data:o?a=>a==o:void 0,this.style=sm(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:r}).style,this.module=n?new qi(n):null,this.themeType=t.themeType}static define(e,t){return new Ys(e,t||{})}}const fc=ae.define(),xm=ae.define({combine(i){return i.length?[i[0]]:null}});function dc(i){let e=i.facet(fc);return e.length?e:i.facet(xm)}function Sm(i,e){let t=[IS],n;return i instanceof Ys&&(i.module&&t.push(se.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(xm.of(i)):n?t.push(fc.computeN([se.darkTheme],s=>s.facet(se.darkTheme)==(n=="dark")?[i]:[])):t.push(fc.of(i)),t}class vS{constructor(e){this.markCache=Object.create(null),this.tree=st(e.state),this.decorations=this.buildDeco(e,dc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=st(e.state),n=dc(e.state),s=n!=dc(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!s&&t.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return pe.none;let n=new $i;for(let{from:s,to:r}of e.visibleRanges)cS(this.tree,t,(o,a,c)=>{n.add(o,a,this.markCache[c]||(this.markCache[c]=pe.mark({class:c})))},s,r);return n.finish()}}const IS=Wi.high(Ye.fromClass(vS,{decorations:i=>i.decorations})),ZS=Ys.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),FS=se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Cm=1e4,Am="()[]{}",Tm=ae.define({combine(i){return fi(i,{afterCursor:!0,brackets:Am,maxScanDistance:Cm,renderMatch:WS})}}),US=pe.mark({class:"cm-matchingBracket"}),XS=pe.mark({class:"cm-nonmatchingBracket"});function WS(i){let e=[],t=i.matched?US:XS;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}const qS=[rt.define({create(){return pe.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(Tm);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=wi(e.state,s.head,-1,n)||s.head>0&&wi(e.state,s.head-1,1,n)||n.afterCursor&&(wi(e.state,s.head,1,n)||s.head<e.state.doc.length&&wi(e.state,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e.state)))}return pe.set(t,!0)},provide:i=>se.decorations.from(i)}),FS];function jS(i={}){return[Tm.of(i),qS]}const zS=new Se;function pc(i,e,t){let n=i.prop(e<0?Se.openedBy:Se.closedBy);if(n)return n;if(i.name.length==1){let s=t.indexOf(i.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function mc(i){let e=i.type.prop(zS);return e?e(i.node):i}function wi(i,e,t,n={}){let s=n.maxScanDistance||Cm,r=n.brackets||Am,o=st(i),a=o.resolveInner(e,t);for(let c=a;c;c=c.parent){let u=pc(c.type,t,r);if(u&&c.from<c.to){let h=mc(c);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return YS(i,e,t,c,h,u,r)}}return GS(i,e,t,o,a.type,s,r)}function YS(i,e,t,n,s,r,o){let a=n.parent,c={from:s.from,to:s.to},u=0,h=a==null?void 0:a.cursor();if(h&&(t<0?h.childBefore(n.from):h.childAfter(n.to)))do if(t<0?h.to<=n.from:h.from>=n.to){if(u==0&&r.indexOf(h.type.name)>-1&&h.from<h.to){let f=mc(h);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(pc(h.type,t,o))u++;else if(pc(h.type,-t,o)){if(u==0){let f=mc(h);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(t<0?h.prevSibling():h.nextSibling());return{start:c,matched:!1}}function GS(i,e,t,n,s,r,o){let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),c=o.indexOf(a);if(c<0||c%2==0!=t>0)return null;let u={from:t<0?e-1:e,to:t>0?e+1:e},h=i.doc.iterRange(e,t>0?i.doc.length:0),f=0;for(let d=0;!h.next().done&&d<=r;){let m=h.value;t<0&&(d+=m.length);let O=e+d*t;for(let w=t>0?0:m.length-1,g=t>0?m.length:-1;w!=g;w+=t){let p=o.indexOf(m[w]);if(!(p<0||n.resolveInner(O+w,1).type!=s))if(p%2==0==t>0)f++;else{if(f==1)return{start:u,end:{from:O+w,to:O+w+1},matched:p>>1==c>>1};f--}}t>0&&(d+=m.length)}return h.done?{start:u,matched:!1}:null}const KS=Object.create(null),Pm=[Qt.none],Qm=[],Em=Object.create(null),HS=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])HS[i]=JS(KS,e);function gc(i,e){Qm.indexOf(i)>-1||(Qm.push(i),console.warn(e))}function JS(i,e){let t=[];for(let a of e.split(" ")){let c=[];for(let u of a.split(".")){let h=i[u]||M[u];h?typeof h=="function"?c.length?c=c.map(h):gc(u,`Modifier ${u} used at start of tag`):c.length?gc(u,`Tag ${u} used as modifier`):c=Array.isArray(h)?h:[h]:gc(u,`Unknown highlighting tag ${u}`)}for(let u of c)t.push(u)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(a=>a.id),r=Em[s];if(r)return r.id;let o=Em[s]=Qt.define({id:Pm.length,name:n,props:[im({[n]:t})]});return Pm.push(o),o.id}Fe.RTL,Fe.LTR;const eC=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=_c(i.state,t.from);return n.line?tC(i):n.block?nC(i):!1};function Oc(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=i(e,t);return s?(n(t.update(s)),!0):!1}}const tC=Oc(oC,0),iC=Oc($m,0),nC=Oc((i,e)=>$m(i,e,rC(e)),0);function _c(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Gs=50;function sC(i,{open:e,close:t},n,s){let r=i.sliceDoc(n-Gs,n),o=i.sliceDoc(s,s+Gs),a=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(o)[0].length,u=r.length-a;if(r.slice(u-e.length,u)==e&&o.slice(c,c+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:s+c,margin:c&&1}};let h,f;s-n<=2*Gs?h=f=i.sliceDoc(n,s):(h=i.sliceDoc(n,n+Gs),f=i.sliceDoc(s-Gs,s));let d=/^\s*/.exec(h)[0].length,m=/\s*$/.exec(f)[0].length,O=f.length-m-t.length;return h.slice(d,d+e.length)==e&&f.slice(O,O+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:s-m-t.length,margin:/\s/.test(f.charAt(O-1))?1:0}}:null}function rC(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),s=t.to<=n.to?n:i.doc.lineAt(t.to);s.from>n.from&&s.from==t.to&&(s=t.to==n.to+1?n:i.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}function $m(i,e,t=e.selection.ranges){let n=t.map(r=>_c(e,r.from).block);if(!n.every(r=>r))return null;let s=t.map((r,o)=>sC(e,n[o],r.from,r.to));if(i!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:n[o].open+" "},{from:r.to,insert:" "+n[o].close}]))};if(i!=1&&s.some(r=>r)){let r=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let c=n[o],{open:u,close:h}=a;r.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:h.pos-h.margin,to:h.pos+c.close.length})}return{changes:r}}return null}function oC(i,e,t=e.selection.ranges){let n=[],s=-1;for(let{from:r,to:o}of t){let a=n.length,c=1e9,u=_c(e,r).line;if(u){for(let h=r;h<=o;){let f=e.doc.lineAt(h);if(f.from>s&&(r==o||o>f.from)){s=f.from;let d=/^\s*/.exec(f.text)[0].length,m=d==f.length,O=f.text.slice(d,d+u.length)==u?d:-1;d<f.text.length&&d<c&&(c=d),n.push({line:f,comment:O,token:u,indent:d,empty:m,single:!1})}h=f.to+1}if(c<1e9)for(let h=a;h<n.length;h++)n[h].indent<n[h].line.text.length&&(n[h].indent=c);n.length==a+1&&(n[a].single=!0)}}if(i!=2&&n.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:c,indent:u,empty:h,single:f}of n)(f||!h)&&r.push({from:a.from+u,insert:c+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:c}of n)if(a>=0){let u=o.from+a,h=u+c.length;o.text[h-o.from]==" "&&h++,r.push({from:u,to:h})}return{changes:r}}return null}const bc=Ei.define(),lC=Ei.define(),aC=ae.define(),Nm=ae.define({combine(i){return fi(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,s)=>e(n,s)||t(n,s)})}}),Rm=rt.define({create(){return ki.empty},update(i,e){let t=e.state.facet(Nm),n=e.annotation(bc);if(n){let c=$t.fromTransaction(e,n.selection),u=n.side,h=u==0?i.undone:i.done;return c?h=Co(h,h.length,t.minDepth,c):h=Mm(h,e.startState.selection),new ki(u==0?n.rest:h,u==0?h:n.rest)}let s=e.annotation(lC);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(He.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let r=$t.fromTransaction(e),o=e.annotation(He.time),a=e.annotation(He.userEvent);return r?i=i.addChanges(r,o,a,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new ki(i.done.map($t.fromJSON),i.undone.map($t.fromJSON))}});function cC(i={}){return[Rm,Nm.of(i),se.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Vm:e.inputType=="historyRedo"?yc:null;return n?(e.preventDefault(),n(t)):!1}})]}function So(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(Rm,!1);if(!s)return!1;let r=s.pop(i,t,e);return r?(n(r),!0):!1}}const Vm=So(0,!1),yc=So(1,!1),uC=So(0,!0),hC=So(1,!0);class $t{constructor(e,t,n,s,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new $t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new $t(e.changes&&it.fromJSON(e.changes),[],e.mapped&&hi.fromJSON(e.mapped),e.startSelection&&X.fromJSON(e.startSelection),e.selectionsAfter.map(X.fromJSON))}static fromTransaction(e,t){let n=Wt;for(let s of e.startState.facet(aC)){let r=s(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new $t(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Wt)}static selection(e){return new $t(void 0,Wt,void 0,void 0,e)}}function Co(i,e,t,n){let s=e+1>t+20?e-t-1:0,r=i.slice(s,e);return r.push(n),r}function fC(i,e){let t=[],n=!1;return i.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,a)=>{for(let c=0;c<t.length;){let u=t[c++],h=t[c++];a>=u&&o<=h&&(n=!0)}}),n}function dC(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function Lm(i,e){return i.length?e.length?i.concat(e):i:e}const Wt=[],pC=200;function Mm(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-pC));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),Co(i,i.length-1,1e9,t.setSelAfter(n)))}else return[$t.selection([e])]}function mC(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function wc(i,e){if(!i.length)return i;let t=i.length,n=Wt;for(;t;){let s=gC(i[t-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let r=i.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,n=s.selectionsAfter}return n.length?[$t.selection(n)]:Wt}function gC(i,e,t){let n=Lm(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):Wt,t);if(!i.changes)return $t.selection(n);let s=i.changes.map(e),r=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(r):r;return new $t(s,ke.mapEffects(i.effects,e),o,i.startSelection.map(r),n)}const OC=/^(input\.type|delete)($|\.)/;class ki{constructor(e,t,n=0,s=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new ki(this.done,this.undone):this}addChanges(e,t,n,s,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||OC.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,fC(a.changes,e.changes))||n=="input.type.compose")?o=Co(o,o.length-1,s.minDepth,new $t(e.changes.compose(a.changes),Lm(ke.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Wt)):o=Co(o,o.length,s.minDepth,e),new ki(o,Wt,t,n)}addSelection(e,t,n,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Wt;return r.length>0&&t-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&dC(r[r.length-1],e)?this:new ki(Mm(this.done,e),this.undone,t,n)}addMapping(e){return new ki(wc(this.done,e),wc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let s=e==0?this.done:this.undone;if(s.length==0)return null;let r=s[s.length-1],o=r.selectionsAfter[0]||t.selection;if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:bc.of({side:e,rest:mC(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let a=s.length==1?Wt:s.slice(0,s.length-1);return r.mapped&&(a=wc(a,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:bc.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ki.empty=new ki(Wt,Wt);const _C=[{key:"Mod-z",run:Vm,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yc,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yc,preventDefault:!0},{key:"Mod-u",run:uC,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:hC,preventDefault:!0}];function zn(i,e){return X.create(i.ranges.map(e),i.mainIndex)}function ti(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ii({state:i,dispatch:e},t){let n=zn(i.selection,t);return n.eq(i.selection,!0)?!1:(e(ti(i,n)),!0)}function Ao(i,e){return X.cursor(e?i.to:i.from)}function Dm(i,e){return ii(i,t=>t.empty?i.moveByChar(t,e):Ao(t,e))}function _t(i){return i.textDirectionAt(i.state.selection.main.head)==Fe.LTR}const Bm=i=>Dm(i,!_t(i)),vm=i=>Dm(i,_t(i));function Im(i,e){return ii(i,t=>t.empty?i.moveByGroup(t,e):Ao(t,e))}const bC=i=>Im(i,!_t(i)),yC=i=>Im(i,_t(i));function wC(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function To(i,e,t){let n=st(i).resolveInner(e.head),s=t?Se.closedBy:Se.openedBy;for(let c=e.head;;){let u=t?n.childAfter(c):n.childBefore(c);if(!u)break;wC(i,u,s)?n=u:c=t?u.to:u.from}let r=n.type.prop(s),o,a;return r&&(o=t?wi(i,n.from,1):wi(i,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,X.cursor(a,t?-1:1)}const kC=i=>ii(i,e=>To(i.state,e,!_t(i))),xC=i=>ii(i,e=>To(i.state,e,_t(i)));function Zm(i,e){return ii(i,t=>{if(!t.empty)return Ao(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const Fm=i=>Zm(i,!1),Um=i=>Zm(i,!0);function Xm(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,n=0,s;if(e){for(let r of i.state.facet(se.scrollMargins)){let o=r(i);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(n=Math.max(o==null?void 0:o.bottom,n))}s=i.scrollDOM.clientHeight-t-n}else s=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(i.defaultLineHeight,s-5)}}function Wm(i,e){let t=Xm(i),{state:n}=i,s=zn(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):Ao(o,e));if(s.eq(n.selection))return!1;let r;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),c=a.top+t.marginTop,u=a.bottom-t.marginBottom;o&&o.top>c&&o.bottom<u&&(r=se.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return i.dispatch(ti(n,s),{effects:r}),!0}const qm=i=>Wm(i,!1),kc=i=>Wm(i,!0);function tn(i,e,t){let n=i.lineBlockAt(e.head),s=i.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?n.to:n.from)&&(s=i.moveToLineBoundary(e,t,!1)),!t&&s.head==n.from&&n.length){let r=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;r&&e.head!=n.from+r&&(s=X.cursor(n.from+r))}return s}const SC=i=>ii(i,e=>tn(i,e,!0)),CC=i=>ii(i,e=>tn(i,e,!1)),AC=i=>ii(i,e=>tn(i,e,!_t(i))),TC=i=>ii(i,e=>tn(i,e,_t(i))),PC=i=>ii(i,e=>X.cursor(i.lineBlockAt(e.head).from,1)),QC=i=>ii(i,e=>X.cursor(i.lineBlockAt(e.head).to,-1));function EC(i,e,t){let n=!1,s=zn(i.selection,r=>{let o=wi(i,r.head,-1)||wi(i,r.head,1)||r.head>0&&wi(i,r.head-1,1)||r.head<i.doc.length&&wi(i,r.head+1,-1);if(!o||!o.end)return r;n=!0;let a=o.start.from==r.head?o.end.to:o.end.from;return t?X.range(r.anchor,a):X.cursor(a)});return n?(e(ti(i,s)),!0):!1}const $C=({state:i,dispatch:e})=>EC(i,e,!1);function qt(i,e){let t=zn(i.state.selection,n=>{let s=e(n);return X.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(ti(i.state,t)),!0)}function jm(i,e){return qt(i,t=>i.moveByChar(t,e))}const zm=i=>jm(i,!_t(i)),Ym=i=>jm(i,_t(i));function Gm(i,e){return qt(i,t=>i.moveByGroup(t,e))}const NC=i=>Gm(i,!_t(i)),RC=i=>Gm(i,_t(i)),VC=i=>qt(i,e=>To(i.state,e,!_t(i))),LC=i=>qt(i,e=>To(i.state,e,_t(i)));function Km(i,e){return qt(i,t=>i.moveVertically(t,e))}const Hm=i=>Km(i,!1),Jm=i=>Km(i,!0);function eg(i,e){return qt(i,t=>i.moveVertically(t,e,Xm(i).height))}const tg=i=>eg(i,!1),ig=i=>eg(i,!0),MC=i=>qt(i,e=>tn(i,e,!0)),DC=i=>qt(i,e=>tn(i,e,!1)),BC=i=>qt(i,e=>tn(i,e,!_t(i))),vC=i=>qt(i,e=>tn(i,e,_t(i))),IC=i=>qt(i,e=>X.cursor(i.lineBlockAt(e.head).from)),ZC=i=>qt(i,e=>X.cursor(i.lineBlockAt(e.head).to)),ng=({state:i,dispatch:e})=>(e(ti(i,{anchor:0})),!0),sg=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.doc.length})),!0),rg=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.selection.main.anchor,head:0})),!0),og=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),FC=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),UC=({state:i,dispatch:e})=>{let t=Qo(i).map(({from:n,to:s})=>X.range(n,Math.min(s+1,i.doc.length)));return e(i.update({selection:X.create(t),userEvent:"select"})),!0},XC=({state:i,dispatch:e})=>{let t=zn(i.selection,n=>{let s=st(i),r=s.resolveStack(n.from,1);if(n.empty){let o=s.resolveStack(n.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&o.next)return X.range(a.to,a.from)}return n});return t.eq(i.selection)?!1:(e(ti(i,t)),!0)};function lg(i,e){let{state:t}=i,n=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to<i.state.doc.length:o.from>0)for(let a=r;;){let c=i.moveVertically(a,e);if(c.head<o.from||c.head>o.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==a.head)break;a=c}}}return s.length==n.ranges.length?!1:(i.dispatch(ti(t,X.create(s,s.length-1))),!0)}const WC=i=>lg(i,!1),qC=i=>lg(i,!0),jC=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=X.create([t.main]):t.main.empty||(n=X.create([X.cursor(t.main.head)])),n?(e(ti(i,n)),!0):!1};function Ks(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,s=n.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let c=e(r);c<o?(t="delete.backward",c=Po(i,c,!1)):c>o&&(t="delete.forward",c=Po(i,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Po(i,o,!1),a=Po(i,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:X.cursor(o,o<r.head?-1:1)}});return s.changes.empty?!1:(i.dispatch(n.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?se.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Po(i,e,t){if(i instanceof se)for(let n of i.state.facet(se.atomicRanges).map(s=>s(i)))n.between(e,e,(s,r)=>{s<e&&r>e&&(e=t?r:s)});return e}const ag=(i,e,t)=>Ks(i,n=>{let s=n.from,{state:r}=i,o=r.doc.lineAt(s),a,c;if(t&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let u=Dn(a,r.tabSize),h=u%bo(r)||bo(r);for(let f=0;f<h&&a[a.length-1-f]==" ";f++)s--;c=s}else c=ht(o.text,s-o.from,e,e)+o.from,c==s&&o.number!=(e?r.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,s-o.from))&&(c=ht(o.text,c-o.from,!1,!1)+o.from);return c}),xc=i=>ag(i,!1,!0),cg=i=>ag(i,!0,!1),ug=(i,e)=>Ks(i,t=>{let n=t.head,{state:s}=i,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let a=null;;){if(n==(e?r.to:r.from)){n==t.head&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let c=ht(r.text,n-r.from,e)+r.from,u=r.text.slice(Math.min(n,c)-r.from,Math.max(n,c)-r.from),h=o(u);if(a!=null&&h!=a)break;(u!=" "||n!=t.head)&&(a=h),n=c}return n}),hg=i=>ug(i,!1),zC=i=>ug(i,!0),YC=i=>Ks(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),GC=i=>Ks(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),KC=i=>Ks(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),HC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Qe.of(["",""])},range:X.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},JC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let s=n.from,r=i.doc.lineAt(s),o=s==r.from?s-1:ht(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:ht(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:i.doc.slice(s,a).append(i.doc.slice(o,s))},range:X.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Qo(i){let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.from),r=i.doc.lineAt(n.to);if(!n.empty&&n.to==r.from&&(r=i.doc.lineAt(n.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});t=r.number+1}return e}function fg(i,e,t){if(i.readOnly)return!1;let n=[],s=[];for(let r of Qo(i)){if(t?r.to==i.doc.length:r.from==0)continue;let o=i.doc.lineAt(t?r.to+1:r.from-1),a=o.length+1;if(t){n.push({from:r.to,to:o.to},{from:r.from,insert:o.text+i.lineBreak});for(let c of r.ranges)s.push(X.range(Math.min(i.doc.length,c.anchor+a),Math.min(i.doc.length,c.head+a)))}else{n.push({from:o.from,to:r.from},{from:r.to,insert:i.lineBreak+o.text});for(let c of r.ranges)s.push(X.range(c.anchor-a,c.head-a))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:X.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const eA=({state:i,dispatch:e})=>fg(i,e,!1),tA=({state:i,dispatch:e})=>fg(i,e,!0);function dg(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of Qo(i))t?n.push({from:s.from,insert:i.doc.slice(s.from,s.to)+i.lineBreak}):n.push({from:s.to,insert:i.lineBreak+i.doc.slice(s.from,s.to)});return e(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const iA=({state:i,dispatch:e})=>dg(i,e,!1),nA=({state:i,dispatch:e})=>dg(i,e,!0),sA=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Qo(e).map(({from:s,to:r})=>(s>0?s--:r<e.doc.length&&r++,{from:s,to:r}))),n=zn(e.selection,s=>{let r;if(i.lineWrapping){let o=i.lineBlockAt(s.head),a=i.coordsAtPos(s.head,s.assoc||1);a&&(r=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2)}return i.moveVertically(s,!0,r)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rA(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=st(i).resolveInner(e),n=t.childBefore(e),s=t.childAfter(e),r;return n&&s&&n.to<=e&&s.from>=e&&(r=n.type.prop(Se.closedBy))&&r.indexOf(s.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(s.from).from&&!/\S/.test(i.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const pg=mg(!1),oA=mg(!0);function mg(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{let{from:r,to:o}=s,a=e.doc.lineAt(r),c=!i&&r==o&&rA(e,r);i&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let u=new yo(e,{simulateBreak:r,simulateDoubleBreak:!!c}),h=lc(u,r);for(h==null&&(h=Dn(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;c?{from:r,to:o}=c:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let f=["",js(e,h)];return c&&f.push(js(e,u.lineIndent(a.from,-1))),{changes:{from:r,to:o,insert:Qe.of(f)},range:X.cursor(r+1+f[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sc(i,e){let t=-1;return i.changeByRange(n=>{let s=[];for(let o=n.from;o<=n.to;){let a=i.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,s,n),t=a.number),o=a.to+1}let r=i.changes(s);return{changes:s,range:X.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const lA=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new yo(i,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Sc(i,(r,o,a)=>{let c=lc(n,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let u=/^\s*/.exec(r.text)[0],h=js(i,c);(u!=h||a.from<r.from+u.length)&&(t[r.from]=c,o.push({from:r.from,to:r.from+u.length,insert:h}))});return s.changes.empty||e(i.update(s,{userEvent:"indent"})),!0},gg=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,n)=>{n.push({from:t.from,insert:i.facet(qs)})}),{userEvent:"input.indent"})),!0),Og=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Dn(s,i.tabSize),o=0,a=js(i,Math.max(0,r-bo(i)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),aA=i=>(i.setTabFocusMode(),!0),cA=[{key:"Ctrl-b",run:Bm,shift:zm,preventDefault:!0},{key:"Ctrl-f",run:vm,shift:Ym},{key:"Ctrl-p",run:Fm,shift:Hm},{key:"Ctrl-n",run:Um,shift:Jm},{key:"Ctrl-a",run:PC,shift:IC},{key:"Ctrl-e",run:QC,shift:ZC},{key:"Ctrl-d",run:cg},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:YC},{key:"Ctrl-Alt-h",run:hg},{key:"Ctrl-o",run:HC},{key:"Ctrl-t",run:JC},{key:"Ctrl-v",run:kc}],uA=[{key:"ArrowLeft",run:Bm,shift:zm,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bC,shift:NC,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:AC,shift:BC,preventDefault:!0},{key:"ArrowRight",run:vm,shift:Ym,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yC,shift:RC,preventDefault:!0},{mac:"Cmd-ArrowRight",run:TC,shift:vC,preventDefault:!0},{key:"ArrowUp",run:Fm,shift:Hm,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ng,shift:rg},{mac:"Ctrl-ArrowUp",run:qm,shift:tg},{key:"ArrowDown",run:Um,shift:Jm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:sg,shift:og},{mac:"Ctrl-ArrowDown",run:kc,shift:ig},{key:"PageUp",run:qm,shift:tg},{key:"PageDown",run:kc,shift:ig},{key:"Home",run:CC,shift:DC,preventDefault:!0},{key:"Mod-Home",run:ng,shift:rg},{key:"End",run:SC,shift:MC,preventDefault:!0},{key:"Mod-End",run:sg,shift:og},{key:"Enter",run:pg,shift:pg},{key:"Mod-a",run:FC},{key:"Backspace",run:xc,shift:xc,preventDefault:!0},{key:"Delete",run:cg,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hg,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:zC,preventDefault:!0},{mac:"Mod-Backspace",run:GC,preventDefault:!0},{mac:"Mod-Delete",run:KC,preventDefault:!0}].concat(cA.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),hA=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:kC,shift:VC},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:xC,shift:LC},{key:"Alt-ArrowUp",run:eA},{key:"Shift-Alt-ArrowUp",run:iA},{key:"Alt-ArrowDown",run:tA},{key:"Shift-Alt-ArrowDown",run:nA},{key:"Mod-Alt-ArrowUp",run:WC},{key:"Mod-Alt-ArrowDown",run:qC},{key:"Escape",run:jC},{key:"Mod-Enter",run:oA},{key:"Alt-l",mac:"Ctrl-l",run:UC},{key:"Mod-i",run:XC,preventDefault:!0},{key:"Mod-[",run:Og},{key:"Mod-]",run:gg},{key:"Mod-Alt-\\",run:lA},{key:"Shift-Mod-k",run:sA},{key:"Shift-Mod-\\",run:$C},{key:"Mod-/",run:eC},{key:"Alt-A",run:iC},{key:"Ctrl-m",mac:"Shift-Alt-m",run:aA}].concat(uA),fA={key:"Tab",run:gg,shift:Og},_g=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class Yn{constructor(e,t,n=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=r?a=>r(_g(a)):_g,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Tt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=vl(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ui(e);let s=this.normalize(t);if(s.length)for(let r=0,o=n;;r++){let a=s.charCodeAt(r),c=this.match(a,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(c)return this.value=c,this;break}o==n&&r<t.length&&t.charCodeAt(r)==a&&o++}}}match(e,t,n){let s=null;for(let r=0;r<this.matches.length;r+=2){let o=this.matches[r],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[r+1],to:n}:(this.matches[r]++,a=!0)),a||(this.matches.splice(r,2),r-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:n}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Yn.prototype[Symbol.iterator]=function(){return this});const bg={from:-1,to:-1,match:/.*/.exec("")},Cc="gm"+(/x/.unicode==null?"":"u");class yg{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=bg,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new wg(e,t,n,s,r);this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Eo(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,s=n+t[0].length;if(this.matchPos=Eo(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Ac=new WeakMap;class Gn{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=Ac.get(e);if(!s||s.from>=n||s.to<=t){let a=new Gn(t,e.sliceString(t,n));return Ac.set(e,a),a}if(s.from==t&&s.to==n)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to<n&&(r+=e.sliceString(s.to,n)),Ac.set(e,new Gn(o,r)),new Gn(t,r.slice(t-o,n-o))}}class wg{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=bg,this.matchPos=Eo(e,s),this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Gn.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this.matchPos=Eo(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Gn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(yg.prototype[Symbol.iterator]=wg.prototype[Symbol.iterator]=function(){return this});function dA(i){try{return new RegExp(i,Cc),!0}catch{return!1}}function Eo(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function Tc(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=Ie("input",{class:"cm-textfield",name:"line",value:e}),n=Ie("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:Hs.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},Ie("label",i.state.phrase("Go to line"),": ",t)," ",Ie("button",{class:"cm-button",type:"submit"},i.state.phrase("go")),Ie("button",{name:"close",onclick:()=>{i.dispatch({effects:Hs.of(!1)}),i.focus()},"aria-label":i.state.phrase("close"),type:"button"},["×"]));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=i,a=o.doc.lineAt(o.selection.main.head),[,c,u,h,f]=r,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let g=m/100;c&&(g=g*(c=="-"?-1:1)+a.number/o.doc.lines),m=Math.round(o.doc.lines*g)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let O=o.doc.line(Math.max(1,Math.min(o.doc.lines,m))),w=X.cursor(O.from+Math.max(0,Math.min(d,O.length)));i.dispatch({effects:[Hs.of(!1),se.scrollIntoView(w.from,{y:"center"})],selection:w}),i.focus()}return{dom:n}}const Hs=ke.define(),kg=rt.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Hs)&&(i=t.value);return i},provide:i=>Is.from(i,e=>e?Tc:null)}),pA=i=>{let e=vs(i,Tc);if(!e){let t=[Hs.of(!0)];i.state.field(kg,!1)==null&&t.push(ke.appendConfig.of([kg,mA])),i.dispatch({effects:t}),e=vs(i,Tc)}return e&&e.dom.querySelector("input").select(),!0},mA=se.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),gA={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},xg=ae.define({combine(i){return fi(i,gA,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function OA(i){let e=[kA,wA];return i&&e.push(xg.of(i)),e}const _A=pe.mark({class:"cm-selectionMatch"}),bA=pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Sg(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=Xe.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=Xe.Word)}function yA(i,e,t,n){return i(e.sliceDoc(t,t+1))==Xe.Word&&i(e.sliceDoc(n-1,n))==Xe.Word}const wA=Ye.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(xg),{state:t}=i,n=t.selection;if(n.ranges.length>1)return pe.none;let s=n.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return pe.none;let c=t.wordAt(s.head);if(!c)return pe.none;o=t.charCategorizer(s.head),r=t.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<e.minSelectionLength||c>200)return pe.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Sg(o,t,s.from,s.to)&&yA(o,t,s.from,s.to)))return pe.none}else if(r=t.sliceDoc(s.from,s.to),!r)return pe.none}let a=[];for(let c of i.visibleRanges){let u=new Yn(t.doc,r,c.from,c.to);for(;!u.next().done;){let{from:h,to:f}=u.value;if((!o||Sg(o,t,h,f))&&(s.empty&&h<=s.from&&f>=s.to?a.push(bA.range(h,f)):(h>=s.to||f<=s.from)&&a.push(_A.range(h,f)),a.length>e.maxMatches))return pe.none}}return pe.set(a)}},{decorations:i=>i.decorations}),kA=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xA=({state:i,dispatch:e})=>{let{selection:t}=i,n=X.create(t.ranges.map(s=>i.wordAt(s.head)||X.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function SA(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new Yn(i.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Yn(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(c=>c.from==a.value.from))continue;if(r){let c=i.wordAt(a.value.from);if(!c||c.from!=a.value.from||c.to!=a.value.to)continue}return a.value}}const CA=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return xA({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=n))return!1;let s=SA(i,n);return s?(e(i.update({selection:i.selection.addRange(X.range(s.from,s.to),!1),effects:se.scrollIntoView(s.to)})),!0):!1},Kn=ae.define({combine(i){return fi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DA(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class Cg{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||dA(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
32
|
-
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new QA(this):new TA(this)}getCursor(e,t=0,n){let s=e.doc?e:Te.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Jn(this,s,t,n):Hn(this,s,t,n)}}class Ag{constructor(e){this.spec=e}}function Hn(i,e,t,n){return new Yn(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),i.wholeWord?AA(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function AA(i,e){return(t,n,s,r)=>((r>t||r+s.length<n)&&(r=Math.max(0,t-2),s=i.sliceString(r,Math.min(i.length,n+2))),(e($o(s,t-r))!=Xe.Word||e(No(s,t-r))!=Xe.Word)&&(e(No(s,n-r))!=Xe.Word||e($o(s,n-r))!=Xe.Word))}class TA extends Ag{constructor(e){super(e)}nextMatch(e,t,n){let s=Hn(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Hn(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==n?null:s.value}prevMatchInRange(e,t,n){for(let s=n;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=Hn(this.spec,e,r,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(r==t)return null;s-=1e4}}prevMatch(e,t,n){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Hn(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=Hn(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Jn(i,e,t,n){return new yg(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?PA(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function $o(i,e){return i.slice(ht(i,e,!1),e)}function No(i,e){return i.slice(e,ht(i,e))}function PA(i){return(e,t,n)=>!n[0].length||(i($o(n.input,n.index))!=Xe.Word||i(No(n.input,n.index))!=Xe.Word)&&(i(No(n.input,n.index+n[0].length))!=Xe.Word||i($o(n.input,n.index+n[0].length))!=Xe.Word)}class QA extends Ag{nextMatch(e,t,n){let s=Jn(this.spec,e,n,e.doc.length).next();return s.done&&(s=Jn(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let r=Math.max(t,n-s*1e4),o=Jn(this.spec,e,r,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let r=+n.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+n.slice(s)}return t})}matchAll(e,t){let n=Jn(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=Jn(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Js=ke.define(),Pc=ke.define(),nn=rt.define({create(i){return new Qc($c(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Js)?i=new Qc(t.value.create(),i.panel):t.is(Pc)&&(i=new Qc(i.query,t.value?Ec:null));return i},provide:i=>Is.from(i,e=>e.panel)});class Qc{constructor(e,t){this.query=e,this.panel=t}}const EA=pe.mark({class:"cm-searchMatch"}),$A=pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NA=Ye.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(nn))}update(i){let e=i.state.field(nn);(e!=i.startState.field(nn)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return pe.none;let{view:t}=this,n=new $i;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:a,to:c}=r[s];for(;s<o-1&&c>r[s+1].from-2*250;)c=r[++s].to;i.highlight(t.state,a,c,(u,h)=>{let f=t.state.selection.ranges.some(d=>d.from==u&&d.to==h);n.add(u,h,f?$A:EA)})}return n.finish()}},{decorations:i=>i.decorations});function er(i){return e=>{let t=e.state.field(nn,!1);return t&&t.query.spec.valid?i(e,t):Eg(e)}}const Ro=er((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=X.single(n.from,n.to),r=i.state.facet(Kn);return i.dispatch({selection:s,effects:[Nc(i,n),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),Qg(i),!0}),Vo=er((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let r=X.single(s.from,s.to),o=i.state.facet(Kn);return i.dispatch({selection:r,effects:[Nc(i,s),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),Qg(i),!0}),RA=er((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:X.create(t.map(n=>X.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),VA=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,r=[],o=0;for(let a=new Yn(i.doc,i.sliceDoc(n,s));!a.next().done;){if(r.length>1e3)return!1;a.value.from==n&&(o=r.length),r.push(X.range(a.value.from,a.value.to))}return e(i.update({selection:X.create(r,o),userEvent:"select.search.matches"})),!0},Tg=er((i,{query:e})=>{let{state:t}=i,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,n,n);if(!r)return!1;let o=r,a=[],c,u,h=[];o.from==n&&o.to==s&&(u=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(t,o.from,o.to),h.push(se.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+".")));let f=i.state.changes(a);return o&&(c=X.single(o.from,o.to).map(f),h.push(Nc(i,o)),h.push(t.facet(Kn).scrollToMatch(c.main,i))),i.dispatch({changes:f,selection:c,effects:h,userEvent:"input.replace"}),!0}),LA=er((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:se.announce.of(n),userEvent:"input.replace.all"}),!0});function Ec(i){return i.state.facet(Kn).createPanel(i)}function $c(i,e){var t,n,s,r,o;let a=i.selection.main,c=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!c)return e;let u=i.facet(Kn);return new Cg({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:u.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function Pg(i){let e=vs(i,Ec);return e&&e.dom.querySelector("[main-field]")}function Qg(i){let e=Pg(i);e&&e==i.root.activeElement&&e.select()}const Eg=i=>{let e=i.state.field(nn,!1);if(e&&e.panel){let t=Pg(i);if(t&&t!=i.root.activeElement){let n=$c(i.state,e.query.spec);n.valid&&i.dispatch({effects:Js.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Pc.of(!0),e?Js.of($c(i.state,e.query.spec)):ke.appendConfig.of(vA)]});return!0},$g=i=>{let e=i.state.field(nn,!1);if(!e||!e.panel)return!1;let t=vs(i,Ec);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Pc.of(!1)}),!0},MA=[{key:"Mod-f",run:Eg,scope:"editor search-panel"},{key:"F3",run:Ro,shift:Vo,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ro,shift:Vo,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:$g,scope:"editor search-panel"},{key:"Mod-Shift-l",run:VA},{key:"Mod-Alt-g",run:pA},{key:"Mod-d",run:CA,preventDefault:!0}];class DA{constructor(e){this.view=e;let t=this.query=e.state.field(nn).query.spec;this.commit=this.commit.bind(this),this.searchField=Ie("input",{value:t.search,placeholder:Mt(e,"Find"),"aria-label":Mt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ie("input",{value:t.replace,placeholder:Mt(e,"Replace"),"aria-label":Mt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ie("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ie("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ie("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,r,o){return Ie("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=Ie("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Ro(e),[Mt(e,"next")]),n("prev",()=>Vo(e),[Mt(e,"previous")]),n("select",()=>RA(e),[Mt(e,"all")]),Ie("label",null,[this.caseField,Mt(e,"match case")]),Ie("label",null,[this.reField,Mt(e,"regexp")]),Ie("label",null,[this.wordField,Mt(e,"by word")]),...e.state.readOnly?[]:[Ie("br"),this.replaceField,n("replace",()=>Tg(e),[Mt(e,"replace")]),n("replaceAll",()=>LA(e),[Mt(e,"replace all")])],Ie("button",{name:"close",onclick:()=>$g(e),"aria-label":Mt(e,"close"),type:"button"},["×"])])}commit(){let e=new Cg({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Js.of(e)}))}keydown(e){jk(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Vo:Ro)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Tg(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Js)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Kn).top}}function Mt(i,e){return i.state.phrase(e)}const Lo=30,Mo=/[\s\.,:;?!]/;function Nc(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,r=Math.max(n.from,e-Lo),o=Math.min(s,t+Lo),a=i.state.sliceDoc(r,o);if(r!=n.from){for(let c=0;c<Lo;c++)if(!Mo.test(a[c+1])&&Mo.test(a[c])){a=a.slice(c);break}}if(o!=s){for(let c=a.length-1;c>a.length-Lo;c--)if(!Mo.test(a[c-1])&&Mo.test(a[c])){a=a.slice(0,c);break}}return se.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${n.number}.`)}const BA=se.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),vA=[nn,Wi.low(NA),BA];class Ng{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=st(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),s=t.text.slice(n-t.from,this.pos-t.from),r=s.search(Mg(e,!1));return r<0?null:{from:n+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Rg(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function IA(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let r=1;r<s.length;r++)t[s[r]]=!0}let n=Rg(e)+Rg(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Vg(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:IA(e);return s=>{let r=s.matchBefore(n);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function ZA(i,e){return t=>{for(let n=st(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class Lg{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function kn(i){return i.selection.main.from}function Mg(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",r=n[n.length-1]!="$";return!s&&!r?i:new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const Rc=Ei.define();function FA(i,e,t,n){let{main:s}=i.selection,r=t-s.from,o=n-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=n&&i.sliceDoc(a.from+r,a.from+o)!=i.sliceDoc(t,n))return{range:a};let c=i.toText(e);return{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:c},range:X.cursor(a.from+r+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Dg=new WeakMap;function UA(i){if(!Array.isArray(i))return i;let e=Dg.get(i);return e||Dg.set(i,e=Vg(i)),e}const Do=ke.define(),tr=ke.define();class XA{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Tt(e,t),s=ui(n);this.chars.push(n);let r=e.slice(t,t+s),o=r.toUpperCase();this.folded.push(Tt(o==r?r.toLowerCase():o,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:s,precise:r,byWord:o}=this;if(t.length==1){let b=Tt(e,0),k=ui(b),y=k==e.length?0:-100;if(b!=t[0])if(b==n[0])y+=-200;else return null;return this.ret(y,[0,k])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,u=0;if(a<0){for(let b=0,k=Math.min(e.length,200);b<k&&u<c;){let y=Tt(e,b);(y==t[u]||y==n[u])&&(s[u++]=b),b+=ui(y)}if(u<c)return null}let h=0,f=0,d=!1,m=0,O=-1,w=-1,g=/[a-z]/.test(e),p=!0;for(let b=0,k=Math.min(e.length,200),y=0;b<k&&f<c;){let C=Tt(e,b);a<0&&(h<c&&C==t[h]&&(r[h++]=b),m<c&&(C==t[m]||C==n[m]?(m==0&&(O=b),w=b+1,m++):m=0));let T,x=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(T=vl(C))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!b||x==1&&g||y==0&&x!=0)&&(t[f]==C||n[f]==C&&(d=!0)?o[f++]=b:o.length&&(p=!1)),y=x,b+=ui(C)}return f==c&&o[0]==0&&p?this.result(-100+(d?-200:0),o,e):m==c&&O==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):m==c?this.ret(-200+-700-e.length,[O,w]):f==c?this.result(-100+(d?-200:0)+-700+(p?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],r=0;for(let o of t){let a=o+(this.astral?ui(Tt(n,o)):1);r&&s[r-1]==o?s[r-1]=a:(s[r++]=o,s[r++]=a)}return this.ret(e-n.length,s)}}class WA{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const ot=ae.define({combine(i){return fi(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qA,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Bg(e(n),t(n)),optionClass:(e,t)=>n=>Bg(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Bg(i,e){return i?e?i+" "+e:i:e}function qA(i,e,t,n,s,r){let o=i.textDirection==Fe.RTL,a=o,c=!1,u="top",h,f,d=e.left-s.left,m=s.right-e.right,O=n.right-n.left,w=n.bottom-n.top;if(a&&d<Math.min(O,m)?a=!1:!a&&m<Math.min(O,d)&&(a=!0),O<=(a?d:m))h=Math.max(s.top,Math.min(t.top,s.bottom-w))-e.top,f=Math.min(400,a?d:m);else{c=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=w||b>e.top?h=t.bottom-e.top:(u="bottom",h=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,p=(e.right-e.left)/r.offsetWidth;return{style:`${u}: ${h/g}px; max-width: ${f/p}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}function jA(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,c=0;for(let u=0;u<r.length;){let h=r[u++],f=r[u++];h>c&&o.appendChild(document.createTextNode(a.slice(c,h)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(h,f))),d.className="cm-completionMatchedText",c=f}return c<a.length&&o.appendChild(document.createTextNode(a.slice(c))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function Vc(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class zA{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,a=e.state.facet(ot);this.optionContent=jA(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Vc(r.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=e.state.field(t).open;for(let h=c.target,f;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(f=/-(\d+)$/.exec(h.id))&&+f[1]<u.length){this.applyCompletion(e,u[+f[1]]),c.preventDefault();return}}),this.dom.addEventListener("focusout",c=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(ot).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:tr.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:r,selected:o,disabled:a}=n.open;(!s.open||s.open.options!=r)&&(this.range=Vc(r.length,o,e.state.facet(ot).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),a!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Vc(t.options.length,t.selected,this.view.state.facet(ot).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Pt(this.view.state,a,"completion info")):(this.addInfoPane(o,s),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;n.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&GA(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(ot).positionInfo(this.view,t,s,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:c}=e[o],{section:u}=a;if(u){let d=typeof u=="string"?u:u.name;if(d!=r&&(o>n.from||n.from==0))if(r=d,typeof u!="string"&&u.header)s.appendChild(u.header(u));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=d}}const h=s.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let f=this.optionClass(a);f&&(h.className=f);for(let d of this.optionContent){let m=d(a,this.view.state,this.view,c);m&&h.appendChild(m)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function YA(i,e){return t=>new zA(t,i,e)}function GA(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function vg(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function KA(i,e){let t=[],n=null,s=null,r=h=>{t.push(h);let{section:f}=h.completion;if(f){n||(n=[]);let d=typeof f=="string"?f:f.name;n.some(m=>m.name==d)||n.push(typeof f=="string"?{name:d}:f)}},o=e.facet(ot);for(let h of i)if(h.hasResult()){let f=h.result.getMatch;if(h.result.filter===!1)for(let d of h.result.options)r(new Lg(d,h.source,f?f(d):[],1e9-t.length));else{let d=e.sliceDoc(h.from,h.to),m,O=o.filterStrict?new WA(d):new XA(d);for(let w of h.result.options)if(m=O.match(w.label)){let g=w.displayLabel?f?f(w,m.matched):[]:m.matched,p=m.score+(w.boost||0);if(r(new Lg(w,h.source,g,p)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:b}=w.section;s||(s=Object.create(null)),s[b]=Math.max(p,s[b]||-1e9)}}}}if(n){let h=Object.create(null),f=0,d=(m,O)=>(m.rank==="dynamic"&&O.rank==="dynamic"?s[O.name]-s[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof O.rank=="number"?O.rank:1e9)||(m.name<O.name?-1:1);for(let m of n.sort(d))f-=1e5,h[m.name]=f;for(let m of t){let{section:O}=m.completion;O&&(m.score+=h[typeof O=="string"?O:O.name])}}let a=[],c=null,u=o.compareCompletions;for(let h of t.sort((f,d)=>d.score-f.score||u(f.completion,d.completion))){let f=h.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?a.push(h):vg(h.completion)>vg(c)&&(a[a.length-1]=h),c=h.completion}return a}class es{constructor(e,t,n,s,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new es(this.options,Ig(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,r,o){if(s&&!o&&e.some(u=>u.isPending))return s.setDisabled();let a=KA(e,t);if(!a.length)return s&&e.some(u=>u.isPending)?s.setDisabled():null;let c=t.facet(ot).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let u=s.options[s.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==u){c=h;break}}return new es(a,Ig(n,c),{pos:e.reduce((u,h)=>h.hasResult()?Math.min(u,h.from):u,1e8),create:nT,above:r.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new es(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new es(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Bo{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Bo(tT,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(ot),r=(n.override||t.languageDataAt("autocomplete",kn(t)).map(UA)).map(c=>(this.active.find(h=>h.source==c)||new jt(c,this.active.some(h=>h.state!=0)?1:0)).update(e,n));r.length==this.active.length&&r.every((c,u)=>c==this.active[u])&&(r=this.active);let o=this.open,a=e.effects.some(c=>c.is(Lc));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!HA(r,this.active)||a?o=es.build(r,t,this.id,o,n,a):o&&o.disabled&&!r.some(c=>c.isPending)&&(o=null),!o&&r.every(c=>!c.isPending)&&r.some(c=>c.hasResult())&&(r=r.map(c=>c.hasResult()?new jt(c.source,0):c));for(let c of e.effects)c.is(Fg)&&(o=o&&o.setSelected(c.value,this.id));return r==this.active&&o==this.open?this:new Bo(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?JA:eT}}function HA(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,r=n==e.length;if(s||r)return s==r;if(i[t++].result!=e[n++].result)return!1}}const JA={"aria-autocomplete":"list"},eT={};function Ig(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const tT=[];function Zg(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(Rc);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class jt{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Zg(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new jt(s.source,0)),n&4&&s.state==0&&(s=new jt(this.source,1)),s=s.updateFor(e,n);for(let r of e.effects)if(r.is(Do))s=new jt(s.source,1,r.value);else if(r.is(tr))s=new jt(s.source,0);else if(r.is(Lc))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(kn(e.state))}}class ts extends jt{constructor(e,t,n,s,r,o){super(e,3,t),this.limit=n,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=kn(e.state);if(a>o||!s||t&2&&(kn(e.startState)==this.from||a<this.limit))return new jt(this.source,t&4?1:0);let c=e.changes.mapPos(this.limit);return iT(s.validFor,e.state,r,o)?new ts(this.source,this.explicit,c,s,r,o):s.update&&(s=s.update(s,r,o,new Ng(e.state,a,!1)))?new ts(this.source,this.explicit,c,s,s.from,(n=s.to)!==null&&n!==void 0?n:kn(e.state)):new jt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ts(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new jt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function iT(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):Mg(i,!0).test(s)}const Lc=ke.define({map(i,e){return i.map(t=>t.map(e))}}),Fg=ke.define(),Nt=rt.define({create(){return Bo.start()},update(i,e){return i.update(e)},provide:i=>[Xa.from(i,e=>e.tooltip),se.contentAttributes.from(i,e=>e.attrs)]});function Mc(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(Nt).active.find(s=>s.source==e.source);return n instanceof ts?(typeof t=="string"?i.dispatch({...FA(i.state,t,n.from,n.to),annotations:Rc.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const nT=YA(Nt,Mc);function vo(i,e="option"){return t=>{let n=t.state.field(Nt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(ot).interactionDelay)return!1;let s=1,r;e=="page"&&(r=vp(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(i?1:-1):i?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Fg.of(a)}),!0}}const sT=i=>{let e=i.state.field(Nt,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(ot).interactionDelay?!1:Mc(i,e.open.options[e.open.selected])},Dc=i=>i.state.field(Nt,!1)?(i.dispatch({effects:Do.of(!0)}),!0):!1,rT=i=>{let e=i.state.field(Nt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:tr.of(null)}),!0)};class oT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const lT=50,aT=1e3,cT=Ye.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(Nt).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(Nt),t=i.state.facet(ot);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Nt)==e)return;let n=i.transactions.some(r=>{let o=Zg(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;r<this.running.length;r++){let o=this.running[r];if(n||o.context.abortOnDocChange&&i.docChanged||o.updates.length+i.transactions.length>lT&&Date.now()-o.time>aT){for(let a of o.context.abortListeners)try{a()}catch(c){Pt(this.view.state,c)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(r=>r.effects.some(o=>o.is(Do)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of i.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(Nt);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=kn(e),n=new Ng(e,t,i.explicit,this.view),s=new oT(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:tr.of(null)}),Pt(this.view.state,r)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(ot),n=this.view.state.field(Nt);for(let s=0;s<this.running.length;s++){let r=this.running[s];if(r.done===void 0)continue;if(this.running.splice(s--,1),r.done){let a=kn(r.updates.length?r.updates[0].startState:this.view.state),c=Math.min(a,r.done.from+(r.active.explicit?0:1)),u=new ts(r.active.source,r.active.explicit,c,r.done,r.done.from,(i=r.done.to)!==null&&i!==void 0?i:a);for(let h of r.updates)u=u.update(h,t);if(u.hasResult()){e.push(u);continue}}let o=n.active.find(a=>a.source==r.active.source);if(o&&o.isPending)if(r.done==null){let a=new jt(r.active.source,0);for(let c of r.updates)a=a.update(c,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Lc.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(Nt,!1);if(e&&e.tooltip&&this.view.state.facet(ot).closeOnBlur){let t=e.open&&vp(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:tr.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Do.of(!1)}),20),this.composing=0}}}),uT=typeof navigator=="object"&&/Win/.test(navigator.platform),hT=Wi.highest(se.domEventHandlers({keydown(i,e){let t=e.state.field(Nt,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(uT&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(o=>o.source==n.source),r=n.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(i.key)>-1&&Mc(e,n),!1}})),Ug=se.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class fT{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class Bc{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,ft.TrackDel),n=e.mapPos(this.to,1,ft.TrackDel);return t==null||n==null?null:new Bc(this.field,t,n)}}class vc{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let c of this.lines){if(n.length){let u=o,h=/^\t*/.exec(c)[0].length;for(let f=0;f<h;f++)u+=e.facet(qs);s.push(t+u.length-h),c=u+c.slice(h)}n.push(c),t+=c.length+1}let a=this.fieldPositions.map(c=>new Bc(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=r[1]?+r[1]:null,c=r[2]||r[3]||"",u=-1,h=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:h&&t[f].name==h)&&(u=f);if(u<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:h}),u=f;for(let d of s)d.field>=u&&d.field++}for(let f of s)if(f.line==n.length&&f.from>r.index){let d=r[2]?3+(r[1]||"").length:2;f.from-=d,f.to-=d}s.push(new fT(u,n.length,r.index,r.index+h.length)),o=o.slice(0,r.index)+c+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(a,c,u)=>{for(let h of s)h.line==n.length&&h.from>u&&(h.from--,h.to--);return c}),n.push(o)}return new vc(n,s)}}let dT=pe.widget({widget:new class extends pi{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),pT=pe.mark({class:"cm-snippetField"});class is{constructor(e,t){this.ranges=e,this.active=t,this.deco=pe.set(e.map(n=>(n.from==n.to?dT:pT).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new is(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const ir=ke.define({map(i,e){return i&&i.map(e)}}),mT=ke.define(),nr=rt.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(ir))return t.value;if(t.is(mT)&&i)return new is(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>se.decorations.from(i,e=>e?e.deco:pe.none)});function Ic(i,e){return X.create(i.filter(t=>t.field==e).map(t=>X.range(t.from,t.to)))}function gT(i){let e=vc.parse(i);return(t,n,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:c}=t.state.selection,u={changes:{from:s,to:r==c.from?c.to:r,insert:Qe.of(o)},scrollIntoView:!0,annotations:n?[Rc.of(n),He.userEvent.of("input.complete")]:void 0};if(a.length&&(u.selection=Ic(a,0)),a.some(h=>h.field>0)){let h=new is(a,0),f=u.effects=[ir.of(h)];t.state.field(nr,!1)===void 0&&f.push(ke.appendConfig.of([nr,_T,bT,Ug]))}t.dispatch(t.state.update(u))}}function Xg(i){return({state:e,dispatch:t})=>{let n=e.field(nr,!1);if(!n||i<0&&n.active==0)return!1;let s=n.active+i,r=i>0&&!n.ranges.some(o=>o.field==s+i);return t(e.update({selection:Ic(n.ranges,s),effects:ir.of(r?null:new is(n.ranges,s)),scrollIntoView:!0})),!0}}const OT=[{key:"Tab",run:Xg(1),shift:Xg(-1)},{key:"Escape",run:({state:i,dispatch:e})=>i.field(nr,!1)?(e(i.update({effects:ir.of(null)})),!0):!1}],Wg=ae.define({combine(i){return i.length?i[0]:OT}}),_T=Wi.highest(Ls.compute([Wg],i=>i.facet(Wg)));function Rt(i,e){return{...e,apply:gT(i)}}const bT=se.domEventHandlers({mousedown(i,e){let t=e.state.field(nr,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=n&&r.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:Ic(t.ranges,s.field),effects:ir.of(t.ranges.some(r=>r.field>s.field)?new is(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),sr={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},xn=ke.define({map(i,e){let t=e.mapPos(i,-1,ft.TrackAfter);return t??void 0}}),Zc=new class extends pn{};Zc.startSide=1,Zc.endSide=-1;const qg=rt.define({create(){return Ne.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(xn)&&(i=i.update({add:[Zc.range(t.value,t.value+1)]}));return i}});function yT(){return[kT,qg]}const Fc="()[]{}<>«»»«[]{}";function jg(i){for(let e=0;e<Fc.length;e+=2)if(Fc.charCodeAt(e)==i)return Fc.charAt(e+1);return vl(i<128?i:i+1)}function zg(i,e){return i.languageDataAt("closeBrackets",e)[0]||sr}const wT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),kT=se.inputHandler.of((i,e,t,n)=>{if((wT?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&ui(Tt(n,0))==1||e!=s.from||t!=s.to)return!1;let r=ST(i.state,n);return r?(i.dispatch(r),!0):!1}),xT=[{key:"Backspace",run:({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=zg(i,i.selection.main.head).brackets||sr.brackets,s=null,r=i.changeByRange(o=>{if(o.empty){let a=CT(i.doc,o.head);for(let c of n)if(c==a&&Io(i.doc,o.head)==jg(Tt(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:X.cursor(o.head-c.length)}}return{range:s=o}});return s||e(i.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function ST(i,e){let t=zg(i,i.selection.main.head),n=t.brackets||sr.brackets;for(let s of n){let r=jg(Tt(s,0));if(e==s)return r==s?PT(i,s,n.indexOf(s+s+s)>-1,t):AT(i,s,r,t.before||sr.before);if(e==r&&Yg(i,i.selection.main.from))return TT(i,s,r)}return null}function Yg(i,e){let t=!1;return i.field(qg).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function Io(i,e){let t=i.sliceString(e,e+2);return t.slice(0,ui(Tt(t,0)))}function CT(i,e){let t=i.sliceString(e-2,e);return ui(Tt(t,0))==t.length?t:t.slice(1)}function AT(i,e,t,n){let s=null,r=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:xn.of(o.to+e.length),range:X.range(o.anchor+e.length,o.head+e.length)};let a=Io(i.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:xn.of(o.head+e.length),range:X.cursor(o.head+e.length)}:{range:s=o}});return s?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function TT(i,e,t){let n=null,s=i.changeByRange(r=>r.empty&&Io(i.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:X.cursor(r.head+t.length)}:n={range:r});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function PT(i,e,t,n){let s=n.stringPrefixes||sr.stringPrefixes,r=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:xn.of(a.to+e.length),range:X.range(a.anchor+e.length,a.head+e.length)};let c=a.head,u=Io(i.doc,c),h;if(u==e){if(Gg(i,c))return{changes:{insert:e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)};if(Yg(i,c)){let d=t&&i.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+d.length,insert:d},range:X.cursor(c+d.length)}}}else{if(t&&i.sliceDoc(c-2*e.length,c)==e+e&&(h=Kg(i,c-2*e.length,s))>-1&&Gg(i,h))return{changes:{insert:e+e+e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)};if(i.charCategorizer(c)(u)!=Xe.Word&&Kg(i,c,s)>-1&&!QT(i,c,e,s))return{changes:{insert:e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)}}return{range:r=a}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Gg(i,e){let t=st(i).resolveInner(e+1);return t.parent&&t.from==e}function QT(i,e,t,n){let s=st(i).resolveInner(e,-1),r=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),c=a.indexOf(t);if(!c||c>-1&&n.indexOf(a.slice(0,c))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>t.length+c;){if(i.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let u=s.to==e&&s.parent;if(!u)break;s=u}return!1}function Kg(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=Xe.Word)return e;for(let s of t){let r=e-s.length;if(i.sliceDoc(r,e)==s&&n(i.sliceDoc(r-1,r))!=Xe.Word)return r}return-1}function ET(i={}){return[hT,Nt,ot.of(i),cT,$T,Ug]}const Hg=[{key:"Ctrl-Space",run:Dc},{mac:"Alt-`",run:Dc},{mac:"Alt-i",run:Dc},{key:"Escape",run:rT},{key:"ArrowDown",run:vo(!0)},{key:"ArrowUp",run:vo(!1)},{key:"PageDown",run:vo(!0,"page")},{key:"PageUp",run:vo(!1,"page")},{key:"Enter",run:sT}],$T=Wi.highest(Ls.computeN([ot],i=>i.facet(ot).defaultKeymap?[Hg]:[]));class Jg{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Sn{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=n.facet(rr).markerFilter;s&&(e=s(e,n));let r=e.slice().sort((m,O)=>m.from-O.from||m.to-O.to),o=new $i,a=[],c=0,u=n.doc.iter(),h=0,f=n.doc.length;for(let m=0;;){let O=m==r.length?null:r[m];if(!O&&!a.length)break;let w,g;if(a.length)w=c,g=a.reduce((k,y)=>Math.min(k,y.to),O&&O.from>w?O.from:1e8);else{if(w=O.from,w>f)break;g=O.to,a.push(O),m++}for(;m<r.length;){let k=r[m];if(k.from==w&&(k.to>k.from||k.to==w))a.push(k),m++,g=Math.min(k.to,g);else{g=Math.min(k.from,g);break}}g=Math.min(g,f);let p=!1;if(a.some(k=>k.from==w&&(k.to==g||g==f))&&(p=w==g,!p&&g-w<10)){let k=w-(h+u.value.length);k>0&&(u.next(k),h=w);for(let y=w;;){if(y>=g){p=!0;break}if(!u.lineBreak&&h+u.value.length>y)break;y=h+u.value.length,h+=u.value.length,u.next()}}let b=UT(a);if(p)o.add(w,w,pe.widget({widget:new vT(b),diagnostics:a.slice()}));else{let k=a.reduce((y,C)=>C.markClass?y+" "+C.markClass:y,"");o.add(w,g,pe.mark({class:"cm-lintRange cm-lintRange-"+b+k,diagnostics:a.slice(),inclusiveEnd:a.some(y=>y.to>g)}))}if(c=g,c==f)break;for(let k=0;k<a.length;k++)a[k].to<=c&&a.splice(k--,1)}let d=o.finish();return new Sn(d,t,ns(d))}}function ns(i,e=null,t=0){let n=null;return i.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!n)n=new Jg(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Jg(n.from,r,n.diagnostic)}}),n}function NT(i,e){let t=e.pos,n=e.end||t,s=i.state.facet(rr).hideOn(i,t,n);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(eO))||i.changes.touchesRange(r.from,Math.max(r.to,n)))}function RT(i,e){return i.field(Dt,!1)?e:e.concat(ke.appendConfig.of(XT))}const eO=ke.define(),Uc=ke.define(),tO=ke.define(),Dt=rt.define({create(){return new Sn(pe.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),n=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);n=ns(t,i.selected.diagnostic,r)||ns(t,null,r)}!t.size&&s&&e.state.facet(rr).autoPanel&&(s=null),i=new Sn(t,s,n)}for(let t of e.effects)if(t.is(eO)){let n=e.state.facet(rr).autoPanel?t.value.length?or.open:null:i.panel;i=Sn.init(t.value,n,e.state)}else t.is(Uc)?i=new Sn(i.diagnostics,t.value?or.open:null,i.selected):t.is(tO)&&(i=new Sn(i.diagnostics,i.panel,t.value));return i},provide:i=>[Is.from(i,e=>e.panel),se.decorations.from(i,e=>e.diagnostics)]}),VT=pe.mark({class:"cm-lintRange cm-lintRange-active"});function LT(i,e,t){let{diagnostics:n}=i.state.field(Dt),s,r=-1,o=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(c,u,{spec:h})=>{if(e>=c&&e<=u&&(c==u||(e>c||t>0)&&(e<u||t<0)))return s=h.diagnostics,r=c,o=u,!1});let a=i.state.facet(rr).tooltipFilter;return s&&a&&(s=a(s,i.state)),s?{pos:r,end:o,above:i.state.doc.lineAt(r).to<o,create(){return{dom:MT(i,s)}}}:null}function MT(i,e){return Ie("ul",{class:"cm-tooltip-lint"},e.map(t=>rO(i,t,!1)))}const DT=i=>{let e=i.state.field(Dt,!1);(!e||!e.panel)&&i.dispatch({effects:RT(i.state,[Uc.of(!0)])});let t=vs(i,or.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},iO=i=>{let e=i.state.field(Dt,!1);return!e||!e.panel?!1:(i.dispatch({effects:Uc.of(!1)}),!0)},BT=[{key:"Mod-Shift-m",run:DT,preventDefault:!0},{key:"F8",run:i=>{let e=i.state.field(Dt,!1);if(!e)return!1;let t=i.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)}}],rr=ae.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...fi(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:nO,tooltipFilter:nO,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,s,r)=>e(n,s,r)||t(n,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function nO(i,e){return i?e?(t,n)=>e(i(t,n),n):i:e}function sO(i){let e=[];if(i)e:for(let{name:t}of i){for(let n=0;n<t.length;n++){let s=t[n];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function rO(i,e,t){var n;let s=t?sO(e.actions):[];return Ie("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ie("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((r,o)=>{let a=!1,c=m=>{if(m.preventDefault(),a)return;a=!0;let O=ns(i.state.field(Dt).diagnostics,e);O&&r.apply(i,O.from,O.to)},{name:u}=r,h=s[o]?u.indexOf(s[o]):-1,f=h<0?u:[u.slice(0,h),Ie("u",u.slice(h,h+1)),u.slice(h+1)],d=r.markClass?" "+r.markClass:"";return Ie("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${h<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&Ie("div",{class:"cm-diagnosticSource"},e.source))}class vT extends pi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ie("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class oO{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=rO(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class or{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)iO(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=sO(r.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let c=ns(this.view.state.field(Dt).diagnostics,r);c&&r.actions[a].apply(e,c.from,c.to)}}else return;s.preventDefault()},n=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=Ie("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=Ie("div",{class:"cm-panel-lint"},this.list,Ie("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>iO(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Dt).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Dt),n=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,c,{spec:u})=>{for(let h of u.diagnostics){if(o.has(h))continue;o.add(h);let f=-1,d;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==h){f=m;break}f<0?(d=new oO(this.view,h),this.items.splice(n,0,d),s=!0):(d=this.items[f],f>n&&(this.items.splice(n,f-n),s=!0)),t&&d.diagnostic==t.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),r=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new oO(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:c})=>{let u=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/u:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Dt),n=ns(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:tO.of(n)})}static open(e){return new or(e)}}function IT(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function Zo(i){return IT(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const ZT=se.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Zo("#d11")},".cm-lintRange-warning":{backgroundImage:Zo("orange")},".cm-lintRange-info":{backgroundImage:Zo("#999")},".cm-lintRange-hint":{backgroundImage:Zo("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function FT(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function UT(i){let e="hint",t=1;for(let n of i){let s=FT(n.severity);s>t&&(t=s,e=n.severity)}return e}const XT=[Dt,se.decorations.compute([Dt],i=>{let{selected:e,panel:t}=i.field(Dt);return!e||!t||e.from==e.to?pe.none:pe.set([VT.range(e.from,e.to)])}),Lx(LT,{hideOn:NT}),ZT],WT=(()=>[qx(),Yx(),ux(),cC(),DS(),Jk(),sx(),Te.allowMultipleSelections.of(!0),CS(),Sm(ZS,{fallback:!0}),jS(),yT(),ET(),Sx(),Tx(),gx(),OA(),Ls.of([...xT,...hA,...MA,..._C,...RS,...Hg,...BT])])();/*!
|
|
29
|
+
`&&i.lineWrapping&&(n&&(n=X.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Qe.of([" "])}),t)return Qa(i,t,n,r);if(n&&!n.main.eq(s)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(n=Xd(i.state.facet(Es).map(c=>c(i)),n))),i.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function Qa(i,e,t,n=-1){if(re.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&i.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&vn(i.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&vn(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&vn(i.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=ok(i,e,t));return i.state.facet(Sd).some(c=>c(i,e.from,e.to,r,a))||i.dispatch(a()),!0}function ok(i,e,t){let n,s=i.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let c=e.from<r.from?-1:1,u=c<0?r.from:r.to,h=Ns(s.facet(Es).map(f=>f(i)),u,c);e.from==h&&(o=h)}if(o>-1)n={changes:e,selection:X.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let c=r.from<e.from?s.sliceDoc(r.from,e.from):"",u=r.to>e.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(i.state.toText(c+e.insert.sliceString(0,void 0,i.state.lineBreak)+u))}else{let c=s.changes(e),u=t&&t.main.to<=c.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let h=i.state.sliceDoc(e.from,e.to),f,d=t&&Md(i,t.main.head);if(d){let O=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-O}}else f=i.state.doc.lineAt(r.head);let m=r.to-e.to;n=s.changeByRange(O=>{if(O.from==r.from&&O.to==r.to)return{changes:c,range:u||O.map(c)};let w=O.to-m,g=w-h.length;if(i.state.sliceDoc(g,w)!=h||w>=f.from&&g<=f.to)return{range:O};let p=s.changes({from:g,to:w,insert:e.insert}),b=O.to-r.to;return{changes:p,range:u?X.range(Math.max(0,u.anchor+b),Math.max(0,u.head+b)):O.map(p)}})}else n={changes:c,selection:u&&s.selection.replaceRange(u)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:a,scrollIntoView:!0})}function jd(i,e,t,n){let s=Math.min(i.length,e.length),r=0;for(;r<s&&i.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==s&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let c=Math.max(0,r-Math.min(o,a));t-=o+c-r}if(o<r&&i.length<e.length){let c=t<=r&&t>=o?r-t:0;r-=c,a=r+(a-o),o=r}else if(a<r){let c=t<=r&&t>=a?r-t:0;r-=c,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}function lk(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}=i.observer.selectionRange;return t&&(e.push(new Wd(t,n)),(s!=t||r!=n)&&e.push(new Wd(s,r))),e}function ak(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?X.single(t+e,n+e):null}class ck{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,re.safari&&e.contentDOM.addEventListener("input",()=>null),re.gecko&&Ck(e.contentDOM.ownerDocument)}handleEvent(e){!Ok(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let s of n.observers)s(this.view,t);for(let s of n.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=uk(e),n=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,a=n[r];a&&o!=!a.handlers.length&&(s.removeEventListener(r,this.handleEvent),a=null),a||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Gd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),re.android&&re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Yd.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||hk.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,vn(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:re.safari&&!re.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function zd(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(s){Pt(t.state,s)}}}function uk(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let s=n.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let a in r){let c=r[a];c&&t(a).handlers.push(zd(n.value,c))}if(o)for(let a in o){let c=o[a];c&&t(a).observers.push(zd(n.value,c))}}for(let n in Jt)t(n).handlers.push(Jt[n]);for(let n in Ut)t(n).observers.push(Ut[n]);return e}const Yd=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hk="dthko",Gd=[16,17,18,20,91,92,224,225],Xr=6;function Wr(i){return Math.max(0,i)*.7+8}function fk(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class dk{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=ww(e.contentDOM),this.atoms=e.state.facet(Es).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Te.allowMultipleSelections)&&pk(e,t),this.dragging=gk(e,t)&&rp(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&fk(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,s=0,r=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=Sa(this.view);e.clientX-c.left<=s+Xr?t=-Wr(s-e.clientX):e.clientX+c.right>=o-Xr&&(t=Wr(e.clientX-o)),e.clientY-c.top<=r+Xr?n=-Wr(r-e.clientY):e.clientY+c.bottom>=a-Xr&&(n=Wr(e.clientY-a)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Xd(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function pk(i,e){let t=i.state.facet(yd);return t.length?t[0](e):re.mac?e.metaKey:e.ctrlKey}function mk(i,e){let t=i.state.facet(wd);return t.length?t[0](e):re.mac?!e.altKey:!e.ctrlKey}function gk(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=xs(i.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let o=s[r];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Ok(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=De.get(t))&&n.ignoreEvent(e))return!1;return!0}const Jt=Object.create(null),Ut=Object.create(null),Kd=re.ie&&re.ie_version<15||re.ios&&re.webkit_version<604;function _k(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Hd(i,t.value)},50)}function qr(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function Hd(i,e){e=qr(i.state,ya,e);let{state:t}=i,n,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ea!=null&&t.selection.ranges.every(c=>c.empty)&&Ea==r.toString()){let c=-1;n=t.changeByRange(u=>{let h=t.doc.lineAt(u.from);if(h.from==c)return{range:u};c=h.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:X.cursor(u.from+f.length)}})}else o?n=t.changeByRange(c=>{let u=r.line(s++);return{changes:{from:c.from,to:c.to,insert:u.text},range:X.cursor(c.from+u.length)}}):n=t.replaceSelection(r);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ut.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft},Jt.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1),Ut.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")},Ut.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")},Jt.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(kd))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=wk(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new dk(i,e,t,n)),n&&i.observer.ignore(()=>{ed(i.contentDOM);let r=i.root.activeElement;r&&!r.contains(i.contentDOM)&&r.blur()});let s=i.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function Jd(i,e,t,n){if(n==1)return X.cursor(e,t);if(n==2)return zw(i.state,e,t);{let s=Je.find(i.docView,e),r=i.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,a=s?s.posAtEnd:r.to;return a<i.state.doc.length&&a==r.to&&a++,X.range(o,a)}}let ep=(i,e,t)=>e>=t.top&&e<=t.bottom&&i>=t.left&&i<=t.right;function bk(i,e,t,n){let s=Je.find(i.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&ep(t,n,o))return-1;let a=s.coordsAt(r,1);return a&&ep(t,n,a)?1:o&&o.bottom>=n?-1:1}function tp(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:bk(i,t,e.clientX,e.clientY)}}const yk=re.ie&&re.ie_version<=11;let ip=null,np=0,sp=0;function rp(i){if(!yk)return i.detail;let e=ip,t=sp;return ip=i,sp=Date.now(),np=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(np+1)%3:1}function wk(i,e){let t=tp(i,e),n=rp(e),s=i.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,a){let c=tp(i,r),u,h=Jd(i,c.pos,c.bias,n);if(t.pos!=c.pos&&!o){let f=Jd(i,t.pos,t.bias,n),d=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=d<h.from?X.range(d,m):X.range(m,d)}return o?s.replaceRange(s.main.extend(h.from,h.to)):a&&n==1&&s.ranges.length>1&&(u=kk(s,c.pos))?u:a?s.addRange(h):X.create([h])}}}function kk(i,e){for(let t=0;t<i.ranges.length;t++){let{from:n,to:s}=i.ranges[t];if(n<=e&&s>=e)return X.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}Jt.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let s=i.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=X.range(r,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",qr(i.state,wa,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Jt.dragend=i=>(i.inputState.draggedContent=null,!1);function op(i,e,t,n){if(t=qr(i.state,ya,t),!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=i.inputState,o=n&&r&&mk(i,e)?{from:r.from,to:r.to}:null,a={from:s,insert:t},c=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}Jt.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),s=0,r=()=>{++s==t.length&&op(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=r,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),r()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return op(i,e,n,!0),!0}return!1},Jt.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Kd?null:e.clipboardData;return t?(Hd(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(_k(i),!1)};function xk(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function Sk(i){let e=[],t=[],n=!1;for(let s of i.selection.ranges)s.empty||(e.push(i.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of i.selection.ranges){let o=i.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),s=o.number}n=!0}return{text:qr(i,wa,e.join(i.lineBreak)),ranges:t,linewise:n}}let Ea=null;Jt.copy=Jt.cut=(i,e)=>{let{text:t,ranges:n,linewise:s}=Sk(i.state);if(!t&&!s)return!1;Ea=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=Kd?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(xk(i,t),!1)};const lp=Ei.define();function ap(i,e){let t=[];for(let n of i.facet(Cd)){let s=n(i,e);s&&t.push(s)}return t.length?i.update({effects:t,annotations:lp.of(!0)}):null}function cp(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=ap(i.state,e);t?i.dispatch(t):i.update([])}},10)}Ut.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),cp(i)},Ut.blur=i=>{i.observer.clearSelectionRange(),cp(i)},Ut.compositionstart=Ut.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))},Ut.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,re.chrome&&re.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))},Ut.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()},Jt.beforeinput=(i,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let a=o[0],c=i.posAtDOM(a.startContainer,a.startOffset),u=i.posAtDOM(a.endContainer,a.endOffset);return Qa(i,{from:c,to:u,insert:i.state.toText(r)},null),!0}}let s;if(re.chrome&&re.android&&(s=Yd.find(r=>r.inputType==e.inputType))&&(i.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return re.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),re.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Ut.compositionend(i,e),20),!1};const up=new Set;function Ck(i){up.has(i)||(up.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const hp=["pre-wrap","normal","pre-line","break-spaces"];let Xn=!1;function fp(){Xn=!1}class Ak{constructor(e){this.lineWrapping=e,this.doc=Qe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return hp.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s<0?n++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,n,s,r,o){let a=hp.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=s,this.lineLength=r,c){this.heightSamples={};for(let u=0;u<o.length;u++){let h=o[u];h<0?u++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Tk{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class gi{constructor(e,t,n,s,r){this.from=e,this.length=t,this.top=n,this.height=s,this._content=r}get type(){return typeof this._content=="number"?kt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof zi?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new gi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ue=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Ue||(Ue={}));const jr=.001;class xt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>jr&&(Xn=!0),this.height=e)}replace(e,t,n){return xt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,s){let r=this,o=n.doc;for(let a=s.length-1;a>=0;a--){let{fromA:c,toA:u,fromB:h,toB:f}=s[a],d=r.lineAt(c,Ue.ByPosNoHeight,n.setDoc(t),0,0),m=d.to>=u?d:r.lineAt(u,Ue.ByPosNoHeight,n,0,0);for(f+=m.to-u,u=m.to;a>0&&d.from<=s[a-1].toA;)c=s[a-1].fromA,h=s[a-1].fromB,a--,c<d.from&&(d=r.lineAt(c,Ue.ByPosNoHeight,n,0,0));h+=d.from-c,c=d.from;let O=$a.build(n.setDoc(o),e,h,f);r=zr(r,r.replace(c,u,O))}return r.updateHeight(n,0)}static empty(){return new Lt(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,s=0,r=0;for(;;)if(t==n)if(s>r*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),n+=1+a.break,s-=a.size}else if(r>s*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,r-=a.size}else break;else if(s<r){let a=e[t++];a&&(s+=a.size)}else{let a=e[--n];a&&(r+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new Pk(xt.of(e.slice(0,t)),o,xt.of(e.slice(n)))}}function zr(i,e){return i==e?i:(i.constructor!=e.constructor&&(Xn=!0),e)}xt.prototype.size=1;class dp extends xt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,s){return new gi(s,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,s,r){return this.blockAt(0,n,s,r)}forEachLine(e,t,n,s,r,o){e<=r+this.length&&t>=r&&o(this.blockAt(0,n,s,r))}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Lt extends dp{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,s){return new gi(s,this.length,n,this.height,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof Lt||s instanceof pt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof pt?s=new Lt(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):xt.of(n)}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class pt extends xt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-n+1,o,a=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*r);o=c/r,this.length>r+1&&(a=(this.height-c)/(this.length-r-1))}else o=this.height/r;return{firstLine:n,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,n,s){let{firstLine:r,lastLine:o,perLine:a,perChar:c}=this.heightMetrics(t,s);if(t.lineWrapping){let u=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),h=t.doc.lineAt(u),f=a+h.length*c,d=Math.max(n,e-f/2);return new gi(h.from,h.length,d,f,0)}else{let u=Math.max(0,Math.min(o-r,Math.floor((e-n)/a))),{from:h,length:f}=t.doc.line(r+u);return new gi(h,f,n+a*u,a,0)}}lineAt(e,t,n,s,r){if(t==Ue.ByHeight)return this.blockAt(e,n,s,r);if(t==Ue.ByPosNoHeight){let{from:m,to:O}=n.doc.lineAt(e);return new gi(m,O-m,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r),u=n.doc.lineAt(e),h=a+u.length*c,f=u.number-o,d=s+a*f+c*(u.from-r-f);return new gi(u.from,u.length,Math.max(s,Math.min(d,s+this.height-h)),h,0)}forEachLine(e,t,n,s,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:a,perLine:c,perChar:u}=this.heightMetrics(n,r);for(let h=e,f=s;h<=t;){let d=n.doc.lineAt(h);if(h==e){let O=d.number-a;f+=c*O+u*(e-r-O)}let m=c+u*d.length;o(new gi(d.from,d.length,f,m,0)),f+=m,h=d.to+1}}replace(e,t,n){let s=this.length-t;if(s>0){let r=n[n.length-1];r instanceof pt?n[n.length-1]=new pt(r.length+s):n.push(null,new pt(s-1))}if(e>0){let r=n[0];r instanceof pt?n[0]=new pt(e+r.length):n.unshift(new pt(e-1),null)}return xt.of(n)}decomposeLeft(e,t){t.push(new pt(e-1),null)}decomposeRight(e,t){t.push(null,new pt(this.length-e-1))}updateHeight(e,t=0,n=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),c=-1;for(s.from>t&&o.push(new pt(s.from-t-1).updateHeight(e,t));a<=r&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let f=s.heights[s.index++];c==-1?c=f:Math.abs(f-c)>=jr&&(c=-2);let d=new Lt(h,f);d.outdated=!1,o.push(d),a+=h+1}a<=r&&o.push(null,new pt(r-a).updateHeight(e,a));let u=xt.of(o);return(c<0||Math.abs(u.height-this.height)>=jr||Math.abs(c-this.heightMetrics(e,t).perLine)>=jr)&&(Xn=!0),zr(this,u)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Pk extends xt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,s){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,s):this.right.blockAt(e,t,r,s+this.left.length+this.break)}lineAt(e,t,n,s,r){let o=s+this.left.height,a=r+this.left.length+this.break,c=t==Ue.ByHeight?e<o:e<a,u=c?this.left.lineAt(e,t,n,s,r):this.right.lineAt(e,t,n,o,a);if(this.break||(c?u.to<a:u.from>a))return u;let h=t==Ue.ByPosNoHeight?Ue.ByPosNoHeight:Ue.ByPos;return c?u.join(this.right.lineAt(a,h,n,o,a)):this.left.lineAt(a,h,n,s,r).join(u)}forEachLine(e,t,n,s,r,o){let a=s+this.left.height,c=r+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,n,s,r,o),t>=c&&this.right.forEachLine(e,t,n,a,c,o);else{let u=this.lineAt(c,Ue.ByPos,n,s,r);e<u.from&&this.left.forEachLine(e,u.from-1,n,s,r,o),u.to>=e&&u.from<=t&&o(u),t>u.to&&this.right.forEachLine(u.to+1,t,n,a,c,o)}}replace(e,t,n){let s=this.left.length+this.break;if(t<s)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,n));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let a of n)r.push(a);if(e>0&&pp(r,o-1),t<this.length){let a=r.length;this.decomposeRight(t,r),pp(r,a)}return xt.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,s=n+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<s&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?xt.of(this.break?[e,null,t]:[e,t]):(this.left=zr(this.left,e),this.right=zr(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,s){let{left:r,right:o}=this,a=t+r.length+this.break,c=null;return s&&s.from<=t+r.length&&s.more?c=r=r.updateHeight(e,t,n,s):r.updateHeight(e,t,n),s&&s.from<=a+o.length&&s.more?c=o=o.updateHeight(e,a,n,s):o.updateHeight(e,a,n),c?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function pp(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof pt&&(n=i[e+1])instanceof pt&&i.splice(e-1,3,new pt(t.length+1+n.length))}const Qk=5;class $a{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Lt?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Lt(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let s=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new dp(o,s,n)):(o||r||s>=Qk)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Lt(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new pt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Lt)return e;let t=new Lt(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Lt)&&!this.isCovered?this.nodes.push(new Lt(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let s of this.nodes)s instanceof Lt&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(e,t,n,s){let r=new $a(n,e);return Ne.spans(t,n,s,r,0),r.finish(n)}}function Ek(i,e,t){let n=new $k;return Ne.compare(i,e,t,n,0),n.changes}class $k{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,s){(e<t||n&&n.heightRelevant||s&&s.heightRelevant)&&Ir(e,t,this.changes,5)}}function Nk(i,e){let t=i.getBoundingClientRect(),n=i.ownerDocument,s=n.defaultView||window,r=Math.max(0,t.left),o=Math.min(s.innerWidth,t.right),a=Math.max(0,t.top),c=Math.min(s.innerHeight,t.bottom);for(let u=i.parentNode;u&&u!=n.body;)if(u.nodeType==1){let h=u,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let d=h.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),c=Math.min(u==i.parentNode?s.innerHeight:c,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,c)-(t.top+e)}}function Rk(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Vk(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Na{constructor(e,t,n,s){this.from=e,this.to=t,this.size=n,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(e,t){return pe.replace({widget:new Lk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Lk extends pi{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class mp{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=gp,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Fe.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(xa).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Ak(t),this.stateDeco=e.facet(Qs).filter(n=>typeof n!="function"),this.heightMap=xt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(e.doc),[new Ft(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=pe.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let s=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Yr(r,o))}}return this.viewports=e.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?gp:new Ra(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Vs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Qs).filter(h=>typeof h!="function");let s=e.changedRanges,r=Ft.extendWithRanges(s,Ek(n,this.stateDeco,e?e.changes:it.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);fp(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Xn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Td)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Fe.RTL:Fe.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,h=0;if(a.width&&a.height){let{scaleX:y,scaleY:C}=Jf(t,a);(y>.005&&Math.abs(this.scaleX-y)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=y,this.scaleY=C,u|=16,o=c=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=nd(e.scrollDOM);let O=(this.printing?Vk:Nk)(t,this.paddingTop),w=O.top-this.pixelViewport.top,g=O.bottom-this.pixelViewport.bottom;this.pixelViewport=O;let p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(p!=this.inView&&(this.inView=p,p&&(c=!0)),!this.inView&&!this.scrollTarget&&!Rk(e.dom))return 0;let b=a.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),c){let y=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(y)&&(o=!0),o||s.lineWrapping&&Math.abs(b-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:T,textHeight:x}=e.docView.measureTextSize();o=C>0&&s.refresh(r,C,T,x,Math.max(5,b/T),y),o&&(e.docView.minWidth=0,u|=16)}w>0&&g>0?h=Math.max(w,g):w<0&&g<0&&(h=Math.min(w,g)),fp();for(let C of this.viewports){let T=C.from==this.viewport.from?y:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?xt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new Ft(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Tk(C.from,T))}Xn&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,c=new Yr(s.lineAt(o-n*1e3,Ue.ByHeight,r,0,0).from,s.lineAt(a+(1-n)*1e3,Ue.ByHeight,r,0,0).to);if(t){let{head:u}=t.range;if(u<c.from||u>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(u,Ue.ByPos,r,0,0),d;t.y=="center"?d=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&u<c.from?d=f.top:d=f.bottom-h,c=new Yr(s.lineAt(d-1e3/2,Ue.ByHeight,r,0,0).from,s.lineAt(d+h+1e3/2,Ue.ByHeight,r,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Yr(this.heightMap.lineAt(n,Ue.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ue.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Ue.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ue.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=a+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&r<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let s of e)t.touchesRange(s.from,s.to)||n.push(new Na(t.mapPos(s.from),t.mapPos(s.to),s.size,s.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,s=n?1e4:2e3,r=s>>1,o=s<<1;if(this.defaultTextDirection!=Fe.LTR&&!n)return[];let a=[],c=(h,f,d,m)=>{if(f-h<r)return;let O=this.state.selection.main,w=[O.from];O.empty||w.push(O.to);for(let p of w)if(p>h&&p<f){c(h,p-10,d,m),c(p+10,f,d,m);return}let g=Dk(e,p=>p.from>=d.from&&p.to<=d.to&&Math.abs(p.from-h)<r&&Math.abs(p.to-f)<r&&!w.some(b=>p.from<b&&p.to>b));if(!g){if(f<d.to&&t&&n&&t.visibleRanges.some(k=>k.from<=f&&k.to>=f)){let k=t.moveToLineBoundary(X.cursor(f),!1,!0).head;k>h&&(f=k)}let p=this.gapSize(d,h,f,m),b=n||p<2e6?p:2e6;g=new Na(h,f,p,b)}a.push(g)},u=h=>{if(h.length<o||h.type!=kt.Text)return;let f=Mk(h.from,h.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,m,O;if(n){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,p;if(d!=null){let b=Kr(f,d),k=((this.visibleBottom-this.visibleTop)/2+w)/h.height;g=b-k,p=b+k}else g=(this.visibleTop-h.top-w)/h.height,p=(this.visibleBottom-h.top+w)/h.height;m=Gr(f,g),O=Gr(f,p)}else{let w=f.total*this.heightOracle.charWidth,g=s*this.heightOracle.charWidth,p=0;if(w>2e6)for(let T of e)T.from>=h.from&&T.from<h.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+p<this.pixelViewport.left&&(p=T.size-T.displaySize);let b=this.pixelViewport.left+p,k=this.pixelViewport.right+p,y,C;if(d!=null){let T=Kr(f,d),x=((k-b)/2+g)/w;y=T-x,C=T+x}else y=(b-g)/w,C=(k+g)/w;m=Gr(f,y),O=Gr(f,C)}m>h.from&&c(h.from,m,h,f),O<h.to&&c(O,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(u):u(h);return a}gapSize(e,t,n,s){let r=Kr(s,n)-Kr(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){Na.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=pe.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Ne.spans(t,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let s=0;if(n.length!=this.visibleRanges.length)s=12;else for(let r=0;r<n.length&&!(s&8);r++){let o=this.visibleRanges[r],a=n[r];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=n,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Vs(this.heightMap.lineAt(e,Ue.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Vs(this.heightMap.lineAt(this.scaler.fromDOM(e),Ue.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Vs(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Yr{constructor(e,t){this.from=e,this.to=t}}function Mk(i,e,t){let n=[],s=i,r=0;return Ne.spans(t,i,e,{span(){},point(o,a){o>s&&(n.push({from:s,to:o}),r+=o-s),s=a}},20),s<e&&(n.push({from:s,to:e}),r+=e-s),{total:r,ranges:n}}function Gr({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let s=0;;s++){let{from:r,to:o}=e[s],a=o-r;if(n<=a)return r+n;n-=a}}function Kr(i,e){let t=0;for(let{from:n,to:s}of i.ranges){if(e<=s){t+=e-n;break}t+=s-n}return t/i.total}function Dk(i,e){for(let t of i)if(e(t))return t}const gp={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class Ra{constructor(e,t,n){let s=0,r=0,o=0;this.viewports=n.map(({from:a,to:c})=>{let u=t.lineAt(a,Ue.ByPos,e,0,0).top,h=t.lineAt(c,Ue.ByPos,e,0,0).bottom;return s+=h-u,{from:a,to:c,top:u,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-r)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),r=a.bottom}toDOM(e){for(let t=0,n=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return s+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,s=r.domBottom}}fromDOM(e){for(let t=0,n=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-s)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,s=r.domBottom}}eq(e){return e instanceof Ra?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Vs(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new gi(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(s=>Vs(s,e)):i._content)}const Hr=ce.define({combine:i=>i.join(" ")}),Va=ce.define({combine:i=>i.indexOf(!0)>-1}),La=qi.newName(),Op=qi.newName(),_p=qi.newName(),bp={"&light":"."+Op,"&dark":"."+_p};function Ma(i,e,t){return new qi(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return i;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):i+" "+n}})}const Bk=Ma("."+La,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bp),vk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Da=re.ie&&re.ie_version<=11;class Ik{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new kw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(re.ie&&re.ie_version<=11||re.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&re.android&&e.constructor.EDIT_CONTEXT!==!1&&!(re.chrome&&re.chrome_version<126)&&(this.editContext=new Fk(e),e.state.facet(Li)&&(e.contentDOM.editContext=this.editContext.editContext)),Da&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(Li)?n.root.activeElement!=this.dom:!Dr(this.dom,s))return;let r=s.anchorNode&&n.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(re.ie&&re.ie_version<=11||re.android&&re.chrome)&&!n.state.selection.main.empty&&s.focusNode&&Ss(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=xs(e.root);if(!t)return!1;let n=re.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Zk(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Dr(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Sw(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,vk),Da&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Da&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let s=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&vn(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:s}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),s=this.selectionChanged&&Dr(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new rk(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,s=qd(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=yp(t,e.previousSibling||e.target.previousSibling,-1),s=yp(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Li)!=e.state.facet(Li)&&(e.view.contentDOM.editContext=e.state.facet(Li)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function yp(i,e,t){for(;e;){let n=De.get(e);if(n&&n.parent==i)return n;let s=e.parentNode;e=s!=i.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function wp(i,e){let t=e.startContainer,n=e.startOffset,s=e.endContainer,r=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return Ss(o.node,o.offset,s,r)&&([t,n,s,r]=[s,r,t,n]),{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}}function Zk(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return wp(i,s)}let t=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?wp(i,t):null}class Fk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let s=e.state.selection.main,{anchor:r,head:o}=s,a=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:a,drifted:!1});let u=c-a>n.text.length;a==this.from&&r<this.from?a=r:c==this.to&&r>this.to&&(c=r);let h=jd(e.state.sliceDoc(a,c),n.text,(u?s.from:s.to)-a,u?"end":null);if(!h){let d=X.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));d.main.eq(s)||e.dispatch({selection:d,userEvent:"select"});return}let f={from:h.from+a,to:h.toA+a,insert:Qe.of(n.text.slice(h.from,h.toB).split(`
|
|
30
|
+
`))};if((re.mac||re.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:c,insert:Qe.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);Qa(e,f,X.single(this.toEditorPos(n.selectionStart,d),this.toEditorPos(n.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let s=[],r=null;for(let o=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);o<a;o++){let c=e.coordsForChar(o);r=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||r||new DOMRect,s.push(r)}t.updateCharacterBounds(n.rangeStart,s)},this.handlers.textformatupdate=n=>{let s=[];for(let r of n.getTextFormats()){let o=r.underlineStyle,a=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let c=this.toEditorPos(r.rangeStart),u=this.toEditorPos(r.rangeEnd);if(c<u){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(pe.mark({attributes:{style:h}}).range(c,u))}}}e.dispatch({effects:Qd.of(pe.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=xs(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,a,c,u)=>{if(n)return;let h=u.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,t+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+u.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),u.toString()),this.to+=h}t+=h}),s&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(s=>s.forEach(r=>n(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||xw(e.parent)||document,this.viewState=new mp(e.state||Te.create(e)),e.scrollTo&&e.scrollTo.is(Fr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Un).map(s=>new ka(s));for(let s of this.plugins)s.update(this);this.observer=new Ik(this),this.inputState=new ck(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ld(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof He?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,s,r=this.state;for(let d of e){if(d.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=d.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,c=null;e.some(d=>d.annotation(lp))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=ap(r,o),c||(a=1));let u=this.observer.delayedAndroidKey,h=null;if(u?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(Te.phrases)!=this.state.facet(Te.phrases))return this.setState(r);s=Ur.create(this,r,e),s.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:m}=d.state.selection;f=new Fn(m.empty?m:X.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of d.effects)m.is(Fr)&&(f=m.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Jr.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet($s)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Hr)!=s.state.facet(Hr)&&(this.viewState.mustMeasureContent=!0),(t||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(ba))try{d(s)}catch(m){Pt(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!qd(this,h)&&u.force&&vn(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new mp(e),this.plugins=e.facet(Un).map(n=>new ka(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Ld(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Un),n=e.state.facet(Un);if(t!=n){let s=[];for(let r of n){let o=t.indexOf(r);if(o<0)s.push(new ka(r));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Pt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(nd(n))r=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);r=m.from,o=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let h=u.map(m=>{try{return m.read(this)}catch(O){return Pt(this.state,O),kp}}),f=Ur.create(this,this.state,[]),d=!1;f.flags|=c,t?t.flags|=c:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let m=0;m<u.length;m++)if(h[m]!=kp)try{let O=u[m];O.write&&O.write(h[m],this)}catch(O){Pt(this.state,O)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let O=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(O>1||O<-1){s=s+O,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(ba))a(t)}get themeClasses(){return La+" "+(this.state.facet(Va)?_p:Op)+" "+this.state.facet(Hr)}updateAttrs(){let e=xp(this,Ed,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Li)?"true":"false",class:"cm-content",style:`${re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),xp(this,xa,t);let n=this.observer.ignore(()=>{let s=da(this.contentDOM,this.contentAttrs,t),r=da(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let s of n.effects)if(s.is(se.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet($s);let e=this.state.facet(se.cspNonce);qi.mount(this.root,this.styleModules.concat(Bk).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Pa(this,e,Ud(this,e,t,n))}moveByGroup(e,t){return Pa(this,e,Ud(this,e,t,n=>ek(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return X.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return Jw(this,e,t,n)}moveVertically(e,t,n){return Pa(this,e,tk(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Id(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Yi.find(r,e-s.from,-1,t)];return Cs(n,o.dir==Fe.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ad)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Uk)return _d(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Od(r.isolates,n=Rd(this,e))))return r.order;n||(n=Rd(this,e));let s=Dw(e.text,t,n);return this.bidiCache.push(new Jr(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ed(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Fr.of(new Fn(typeof e=="number"?X.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Fr.of(new Fn(X.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ye.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ye.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qi.newName(),s=[Hr.of(n),$s.of(Ma(`.${n}`,e))];return t&&t.dark&&s.push(Va.of(!0)),s}static baseTheme(e){return Wi.lowest($s.of(Ma("."+La,e,bp)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&De.get(n)||De.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}se.styleModule=$s,se.inputHandler=Sd,se.clipboardInputFilter=ya,se.clipboardOutputFilter=wa,se.scrollHandler=Pd,se.focusChangeEffect=Cd,se.perLineTextDirection=Ad,se.exceptionSink=xd,se.updateListener=ba,se.editable=Li,se.mouseSelectionStyle=kd,se.dragMovesSelection=wd,se.clickAddsSelectionRange=yd,se.decorations=Qs,se.outerDecorations=$d,se.atomicRanges=Es,se.bidiIsolatedRanges=Nd,se.scrollMargins=Vd,se.darkTheme=Va,se.cspNonce=ce.define({combine:i=>i.length?i[0]:""}),se.contentAttributes=xa,se.editorAttributes=Ed,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=ke.define();const Uk=4096,kp={};class Jr{constructor(e,t,n,s,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let n=[],s=e.length?e[e.length-1].dir:Fe.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir==s&&!t.touchesRange(o.from,o.to)&&n.push(new Jr(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function xp(i,e,t){for(let n=i.state.facet(e),s=n.length-1;s>=0;s--){let r=n[s],o=typeof r=="function"?r(i):r;o&&fa(o,t)}return t}const Xk=re.mac?"mac":re.windows?"win":re.linux?"linux":"key";function Wk(i,e){const t=i.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let s,r,o,a;for(let c=0;c<t.length-1;++c){const u=t[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))s=!0;else if(/^(c|ctrl|control)$/i.test(u))r=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+u)}return s&&(n="Alt-"+n),r&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function eo(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}const qk=Wi.default(se.domEventHandlers({keydown(i,e){return Ap(Cp(e.state),i,e,"editor")}})),Ls=ce.define({enables:qk}),Sp=new WeakMap;function Cp(i){let e=i.facet(Ls),t=Sp.get(e);return t||Sp.set(e,t=Yk(e.reduce((n,s)=>n.concat(s),[]))),t}function jk(i,e,t){return Ap(Cp(i.state),e,i,t)}let Gi=null;const zk=4e3;function Yk(i,e=Xk){let t=Object.create(null),n=Object.create(null),s=(o,a)=>{let c=n[o];if(c==null)n[o]=a;else if(c!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,c,u,h)=>{var f,d;let m=t[o]||(t[o]=Object.create(null)),O=a.split(/ (?!$)/).map(p=>Wk(p,e));for(let p=1;p<O.length;p++){let b=O.slice(0,p).join(" ");s(b,!0),m[b]||(m[b]={preventDefault:!0,stopPropagation:!1,run:[k=>{let y=Gi={view:k,prefix:b,scope:o};return setTimeout(()=>{Gi==y&&(Gi=null)},zk),!0}]})}let w=O.join(" ");s(w,!1);let g=m[w]||(m[w]={preventDefault:!1,stopPropagation:!1,run:((d=(f=m._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});c&&g.run.push(c),u&&(g.preventDefault=!0),h&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let h=t[u]||(t[u]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in h)h[d].run.push(m=>f(m,Ba))}let c=o[e]||o.key;if(c)for(let u of a)r(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return t}let Ba=null;function Ap(i,e,t,n){Ba=e;let s=_w(e),r=Tt(s,0),o=ui(r)==s.length&&s!=" ",a="",c=!1,u=!1,h=!1;Gi&&Gi.view==t&&Gi.scope==n&&(a=Gi.prefix+" ",Gd.indexOf(e.keyCode)<0&&(u=!0,Gi=null));let f=new Set,d=g=>{if(g){for(let p of g.run)if(!f.has(p)&&(f.add(p),p(t)))return g.stopPropagation&&(h=!0),!0;g.preventDefault&&(g.stopPropagation&&(h=!0),u=!0)}return!1},m=i[n],O,w;return m&&(d(m[a+eo(s,e,!o)])?c=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(re.windows&&e.ctrlKey&&e.altKey)&&!(re.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(O=ji[e.keyCode])&&O!=s?(d(m[a+eo(O,e,!0)])||e.shiftKey&&(w=ks[e.keyCode])!=s&&w!=O&&d(m[a+eo(w,e,!1)]))&&(c=!0):o&&e.shiftKey&&d(m[a+eo(s,e,!0)])&&(c=!0),!c&&d(m._any)&&(c=!0)),u&&(c=!0),c&&h&&e.stopPropagation(),Ba=null,c}class Ms{constructor(e,t,n,s,r){this.className=e,this.left=t,this.top=n,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let s=e.coordsAtPos(n.head,n.assoc||1);if(!s)return[];let r=Tp(e);return[new Ms(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Gk(e,t,n)}}function Tp(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Fe.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function Pp(i,e,t,n){let s=i.coordsAtPos(e,t*2);if(!s)return n;let r=i.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=i.posAtCoords({x:r.left+1,y:o}),c=i.posAtCoords({x:r.right-1,y:o});return a==null||c==null?n:{from:Math.max(n.from,Math.min(a,c)),to:Math.min(n.to,Math.max(a,c))}}function Gk(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),s=Math.min(t.to,i.viewport.to),r=i.textDirection==Fe.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),c=Tp(i),u=o.querySelector(".cm-line"),h=u&&window.getComputedStyle(u),f=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),m=Ta(i,n,1),O=Ta(i,s,-1),w=m.type==kt.Text?m:null,g=O.type==kt.Text?O:null;if(w&&(i.lineWrapping||m.widgetLineBreaks)&&(w=Pp(i,n,1,w)),g&&(i.lineWrapping||O.widgetLineBreaks)&&(g=Pp(i,s,-1,g)),w&&g&&w.from==g.from&&w.to==g.to)return b(k(t.from,t.to,w));{let C=w?k(t.from,null,w):y(m,!1),T=g?k(null,t.to,g):y(O,!0),x=[];return(w||m).to<(g||O).from-(w&&g?1:0)||m.widgetLineBreaks>1&&C.bottom+i.defaultLineHeight/2<T.top?x.push(p(f,C.bottom,d,T.top)):C.bottom<T.top&&i.elementAtHeight((C.bottom+T.top)/2).type==kt.Text&&(C.bottom=T.top=(C.bottom+T.top)/2),b(C).concat(x).concat(b(T))}function p(C,T,x,A){return new Ms(e,C-c.left,T-c.top,x-C,A-T)}function b({top:C,bottom:T,horizontal:x}){let A=[];for(let R=0;R<x.length;R+=2)A.push(p(x[R],C,x[R+1],T));return A}function k(C,T,x){let A=1e9,R=-1e9,_=[];function S(E,W,B,I,G){let Z=i.coordsAtPos(E,E==x.to?-2:2),H=i.coordsAtPos(B,B==x.from?2:-2);!Z||!H||(A=Math.min(Z.top,H.top,A),R=Math.max(Z.bottom,H.bottom,R),G==Fe.LTR?_.push(r&&W?f:Z.left,r&&I?d:H.right):_.push(!r&&I?f:H.left,!r&&W?d:Z.right))}let P=C??x.from,Q=T??x.to;for(let E of i.visibleRanges)if(E.to>P&&E.from<Q)for(let W=Math.max(E.from,P),B=Math.min(E.to,Q);;){let I=i.state.doc.lineAt(W);for(let G of i.bidiSpans(I)){let Z=G.from+I.from,H=G.to+I.from;if(Z>=B)break;H>W&&S(Math.max(Z,W),C==null&&Z<=P,Math.min(H,B),T==null&&H>=Q,G.dir)}if(W=I.to+1,W>=B)break}return _.length==0&&S(P,C==null,Q,T==null,i.textDirection),{top:A,bottom:R,horizontal:_}}function y(C,T){let x=a.top+(T?C.top:C.bottom);return{top:x,bottom:x,horizontal:[]}}}function Kk(i,e){return i.constructor==e.constructor&&i.eq(e)}class Hk{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(to)!=e.state.facet(to)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(to);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!Kk(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[n].constructor&&s.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,re.safari&&re.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const to=ce.define();function Qp(i){return[Ye.define(e=>new Hk(e,i)),to.of(i)]}const Ds=ce.define({combine(i){return fi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Jk(i={}){return[Ds.of(i),ex,tx,ix,Td.of(!0)]}function Ep(i){return i.startState.facet(Ds)!=i.state.facet(Ds)}const ex=Qp({above:!0,markers(i){let{state:e}=i,t=e.facet(Ds),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:X.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Ms.forRange(i,o,a))n.push(c)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ep(i);return t&&$p(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){$p(e.state,i)},class:"cm-cursorLayer"});function $p(i,e){e.style.animationDuration=i.facet(Ds).cursorBlinkRate+"ms"}const tx=Qp({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Ms.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Ep(i)},class:"cm-selectionLayer"}),ix=Wi.highest(se.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Np=ke.define({map(i,e){return i==null?null:e.mapPos(i)}}),Bs=rt.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,n)=>n.is(Np)?n.value:t,i)}}),nx=Ye.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(Bs);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Bs)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(Bs),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Bs)!=i&&this.view.dispatch({effects:Np.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function sx(){return[Bs,nx]}function Rp(i,e,t,n,s){e.lastIndex=0;for(let r=i.iterRange(t,n),o=t,a;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=e.exec(r.value);)s(o+a.index,a)}function rx(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let n=[];for(let{from:s,to:r}of t)s=Math.max(i.state.doc.lineAt(s).from,s-e),r=Math.min(i.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}class ox{constructor(e){const{regexp:t,decoration:n,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,c,u,h)=>s(h,u,u+a[0].length,a,c);else if(typeof n=="function")this.addMatch=(a,c,u,h)=>{let f=n(a,c,u);f&&h(u,u+a[0].length,f)};else if(n)this.addMatch=(a,c,u,h)=>h(u,u+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new $i,n=t.add.bind(t);for(let{from:s,to:r}of rx(e,this.maxLength))Rp(e.state.doc,this.regexp,s,r,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,a,c)=>{c>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),s=Math.max(c,s))}),e.viewportMoved||s-n>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),n,s):t}updateRange(e,t,n,s){for(let r of e.visibleRanges){let o=Math.max(r.from,n),a=Math.min(r.to,s);if(a>=o){let c=e.state.doc.lineAt(o),u=c.to<a?e.state.doc.lineAt(a):c,h=Math.max(r.from,c.from),f=Math.min(r.to,u.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){h=o;break}for(;a<u.to;a++)if(this.boundary.test(u.text[a-u.from])){f=a;break}}let d=[],m,O=(w,g,p)=>d.push(p.range(w,g));if(c==u)for(this.regexp.lastIndex=h-c.from;(m=this.regexp.exec(c.text))&&m.index<f-c.from;)this.addMatch(m,e,m.index+c.from,O);else Rp(e.state.doc,this.regexp,h,f,(w,g)=>this.addMatch(g,e,w,O));t=t.update({filterFrom:h,filterTo:f,filter:(w,g)=>w<h||g>f,add:d})}}return t}}const va=/x/.unicode!=null?"gu":"g",lx=new RegExp(`[\0-\b
|
|
31
|
+
--\u2028\u2029\uFEFF-]`,va),ax={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ia=null;function cx(){var i;if(Ia==null&&typeof document<"u"&&document.body){let e=document.body.style;Ia=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Ia||!1}const io=ce.define({combine(i){let e=fi(i,{render:null,specialChars:lx,addSpecialChars:null});return(e.replaceTabs=!cx())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,va)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,va)),e}});function ux(i={}){return[io.of(i),hx()]}let Vp=null;function hx(){return Vp||(Vp=Ye.fromClass(class{constructor(i){this.view=i,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(io)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new ox({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,r=Tt(e[0],0);if(r==9){let o=s.lineAt(n),a=t.state.tabSize,c=Dn(o.text,a,n-o.from);return pe.replace({widget:new mx((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=pe.replace({widget:new px(i,r)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(io);i.startState.facet(io)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const fx="•";function dx(i){return i>=32?fx:i==10?"":String.fromCharCode(9216+i)}class px extends pi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=dx(this.code),n=e.state.phrase("Control character")+" "+(ax[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,n,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class mx extends pi{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function gx(){return _x}const Ox=pe.line({class:"cm-activeLine"}),_x=Ye.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let s=i.lineBlockAt(n.head);s.from>e&&(t.push(Ox.range(s.from)),e=s.from)}return pe.set(t)}},{decorations:i=>i.decorations});class bx extends pi{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Bn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),s=Cs(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function yx(i){let e=Ye.fromClass(class{constructor(t){this.view=t,this.placeholder=i?pe.set([pe.widget({widget:new bx(i),side:1}).range(0)]):pe.none}get decorations(){return this.view.state.doc.length?pe.none:this.placeholder}},{decorations:t=>t.decorations});return typeof i=="string"?[e,se.contentAttributes.of({"aria-placeholder":i})]:e}const Za=2e3;function wx(i,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Za||t.off>Za||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let c=n;c<=s;c++){let u=i.doc.line(c);u.length<=a&&r.push(X.range(u.from+o,u.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let c=n;c<=s;c++){let u=i.doc.line(c),h=ta(u.text,o,i.tabSize,!0);if(h<0)r.push(X.cursor(u.to));else{let f=ta(u.text,a,i.tabSize);r.push(X.range(u.from+h,u.from+f))}}}return r}function kx(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Lp(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),s=t-n.from,r=s>Za?-1:s==n.length?kx(i,e.clientX):Dn(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:r,off:s}}function xx(i,e){let t=Lp(i,e),n=i.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(s.changes)}},get(s,r,o){let a=Lp(i,s);if(!a)return n;let c=wx(i.state,t,a);return c.length?o?X.create(c.concat(n.ranges)):X.create(c):n}}:null}function Sx(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return se.mouseSelectionStyle.of((t,n)=>e(n)?xx(t,n):null)}const Cx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Ax={style:"cursor: crosshair"};function Tx(i={}){let[e,t]=Cx[i.key||"Alt"],n=Ye.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[n,se.contentAttributes.of(s=>{var r;return!((r=s.plugin(n))===null||r===void 0)&&r.isDown?Ax:null})]}const no="-10000px";class Mp{constructor(e,t,n,s){this.facet=t,this.createTooltipView=n,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=n(o,r))}update(e,t){var n;let s=e.state.facet(this.facet),r=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let o=[],a=t?[]:null;for(let c=0;c<r.length;c++){let u=r[c],h=-1;if(u){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==u.create&&(h=f)}if(h<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let f=o[c]=this.tooltipViews[h];a&&(a[c]=t[h]),f.update&&f.update(e)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(n=c.destroy)===null||n===void 0||n.call(c));return t&&(a.forEach((c,u)=>t[u]=c),t.length=a.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Px(i){let e=i.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Fa=ce.define({combine:i=>{var e,t,n;return{position:re.ios?"absolute":((e=i.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=i.find(s=>s.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||Px}}}),Dp=new WeakMap,Ua=Ye.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(Fa);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Mp(i,Xa,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,n=i.state.facet(Fa);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=no,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(re.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(i=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:i,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),s=Sa(this.view);return{visible:{left:n.left+s.left,top:n.top+s.top,right:n.right-s.right,bottom:n.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Fa).tooltipSpace(this.view),scaleX:i,scaleY:e,makeAbsolute:t}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:n,scaleX:s,scaleY:r}=i,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let c=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:h}=u,f=i.pos[a],d=i.size[a];if(!f||c.clip!==!1&&(f.bottom<=Math.max(t.top,n.top)||f.top>=Math.min(t.bottom,n.bottom)||f.right<Math.max(t.left,n.left)-.1||f.left>Math.min(t.right,n.right)+.1)){h.style.top=no;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,O=m?7:0,w=d.right-d.left,g=(e=Dp.get(u))!==null&&e!==void 0?e:d.bottom-d.top,p=u.offset||Ex,b=this.view.textDirection==Fe.LTR,k=d.width>n.right-n.left?b?n.left:n.right-d.width:b?Math.max(n.left,Math.min(f.left-(m?14:0)+p.x,n.right-w)):Math.min(Math.max(n.left,f.left-w+(m?14:0)-p.x),n.right-w),y=this.above[a];!c.strictSide&&(y?f.top-g-O-p.y<n.top:f.bottom+g+O+p.y>n.bottom)&&y==n.bottom-f.bottom>f.top-n.top&&(y=this.above[a]=!y);let C=(y?f.top-n.top:n.bottom-f.bottom)-O;if(C<g&&u.resize!==!1){if(C<this.view.defaultLineHeight){h.style.top=no;continue}Dp.set(u,g),h.style.height=(g=C)/r+"px"}else h.style.height&&(h.style.height="");let T=y?f.top-g-O-p.y:f.bottom+O+p.y,x=k+w;if(u.overlap!==!0)for(let A of o)A.left<x&&A.right>k&&A.top<T+g&&A.bottom>T&&(T=y?A.top-g-2-O:A.bottom+O+2);if(this.position=="absolute"?(h.style.top=(T-i.parent.top)/r+"px",Bp(h,(k-i.parent.left)/s)):(h.style.top=T/r+"px",Bp(h,k/s)),m){let A=f.left+(b?p.x:-p.x)-(k+14-7);m.style.left=A/s+"px"}u.overlap!==!0&&o.push({left:k,top:T,right:x,bottom:T+g}),h.classList.toggle("cm-tooltip-above",y),h.classList.toggle("cm-tooltip-below",!y),u.positioned&&u.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=no}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Bp(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const Qx=se.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ex={x:0,y:0},Xa=ce.define({enables:[Ua,Qx]}),so=ce.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class ro{static create(e){return new ro(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Mp(e,so,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let s=n[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const $x=Xa.compute([so],i=>{let e=i.facet(so);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:ro.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Nx{constructor(e,t,n,s,r){this.view=e,this.source=t,this.field=n,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let s,r=1;if(n instanceof Ri)s=n.posAtStart;else{if(s=e.posAtCoords(t),s==null)return;let a=e.coordsAtPos(s);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),u=c&&c.dir==Fe.RTL?-1:1;r=t.x<a.left?-u:u}let o=this.source(e,s,r);if(o!=null&&o.then){let a=this.pending={pos:s};o.then(c=>{this.pending==a&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Pt(e.state,c,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Ua),t=e?e.manager.tooltips.findIndex(n=>n.create==ro.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Rx(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(n=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Vx(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const oo=4;function Rx(i,e){let{left:t,right:n,top:s,bottom:r}=i.getBoundingClientRect(),o;if(o=i.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),r=Math.max(a.bottom,r)}return e.clientX>=t-oo&&e.clientX<=n+oo&&e.clientY>=s-oo&&e.clientY<=r+oo}function Vx(i,e,t,n,s,r){let o=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>n||o.right<n||o.top>s||Math.min(o.bottom,a)<s)return!1;let c=i.posAtCoords({x:n,y:s},!1);return c>=e&&c<=t}function Lx(i,e={}){let t=ke.define(),n=rt.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let a of s){let c=r.changes.mapPos(a.pos,-1,ft.TrackDel);if(c!=null){let u=Object.assign(Object.create(null),a);u.pos=c,u.end!=null&&(u.end=r.changes.mapPos(u.end)),o.push(u)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Mx)&&(s=[]);return s},provide:s=>so.from(s)});return{active:n,extension:[n,Ye.define(s=>new Nx(s,i,n,t,e.hoverTime||300)),$x]}}function vp(i,e){let t=i.plugin(Ua);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const Mx=ke.define(),Ip=ce.define({combine(i){let e,t;for(let n of i)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function vs(i,e){let t=i.plugin(Zp),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Zp=Ye.fromClass(class{constructor(i){this.input=i.state.facet(Is),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(Ip);this.top=new lo(i,!0,e.topContainer),this.bottom=new lo(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(Ip);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new lo(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new lo(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Is);if(t!=this.input){let n=t.filter(c=>c),s=[],r=[],o=[],a=[];for(let c of n){let u=this.specs.indexOf(c),h;u<0?(h=c(i.view),a.push(h)):(h=this.panels[u],h.update&&h.update(i)),s.push(h),(h.top?r:o).push(h)}this.specs=n,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let c of a)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class lo{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Fp(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Fp(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Fp(i){let e=i.nextSibling;return i.remove(),e}const Is=ce.define({enables:Zp});class Mi extends pn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Mi.prototype.elementClass="",Mi.prototype.toDOM=void 0,Mi.prototype.mapMode=ft.TrackBefore,Mi.prototype.startSide=Mi.prototype.endSide=-1,Mi.prototype.point=!0;const ao=ce.define(),Dx=ce.define(),Bx={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ne.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Zs=ce.define();function vx(i){return[Up(),Zs.of({...Bx,...i})]}const Wa=ce.define({combine:i=>i.some(e=>e)});function Up(i){let e=[Ix];return i&&i.fixed===!1&&e.push(Wa.of(!0)),e}const Ix=Ye.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Zs).map(e=>new Wp(i,e)),this.fixed=!i.state.facet(Wa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Wa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ne.iter(this.view.state.facet(ao),this.view.viewport.from),n=[],s=this.gutters.map(r=>new Zx(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==kt.Text&&o){qa(t,n,a.from);for(let c of s)c.line(this.view,a,n);o=!1}else if(a.widget)for(let c of s)c.widget(this.view,a)}else if(r.type==kt.Text){qa(t,n,r.from);for(let o of s)o.line(this.view,r,n)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet(Zs),t=i.state.facet(Zs),n=i.docChanged||i.heightChanged||i.viewportChanged||!Ne.eq(i.startState.facet(ao),i.state.facet(ao),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(i)&&(n=!0);else{n=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Wp(this.view,r)):(this.gutters[o].update(i),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Fe.LTR?{left:n,right:s}:{right:n,left:s}})});function Xp(i){return Array.isArray(i)?i:[i]}function qa(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class Zx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ne.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let a=new qp(e,o,r,n);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,r,n);this.height=t.bottom,this.i++}line(e,t,n){let s=[];qa(this.cursor,s,t.from),n.length&&(s=s.concat(n));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),s=n?[n]:null;for(let r of e.state.facet(Dx)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Wp{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let c=r.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,s)&&s.preventDefault()});this.markers=Xp(t.markers(e)),t.initialSpacer&&(this.spacer=new qp(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Xp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let n=e.view.viewport;return!Ne.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class qp{constructor(e,t,n,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,s)}update(e,t,n,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),Fx(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let n="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let a=o,c=r<t.length?t[r++]:null,u=!1;if(c){let h=c.elementClass;h&&(n+=" "+h);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){a=f,u=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!c)break;c.toDOM&&(u?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),u&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function Fx(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}const Ux=ce.define(),Xx=ce.define(),Wn=ce.define({combine(i){return fi(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let s in t){let r=n[s],o=t[s];n[s]=r?(a,c,u)=>r(a,c,u)||o(a,c,u):o}return n}})}});class ja extends Mi{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function za(i,e){return i.state.facet(Wn).formatNumber(e,i.state)}const Wx=Zs.compute([Wn],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Ux)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new ja(za(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let s of e.state.facet(Xx)){let r=s(e,t,n);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Wn)!=e.state.facet(Wn),initialSpacer(e){return new ja(za(e,jp(e.state.doc.lines)))},updateSpacer(e,t){let n=za(t.view,jp(t.view.state.doc.lines));return n==e.number?e:new ja(n)},domEventHandlers:i.facet(Wn).domEventHandlers,side:"before"}));function qx(i={}){return[Wn.of(i),Up(),Wx]}function jp(i){let e=9;for(;e<i;)e=e*10+9;return e}const jx=new class extends Mi{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},zx=ao.compute(["selection"],i=>{let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.head).from;s>t&&(t=s,e.push(jx.range(s)))}return Ne.of(e)});function Yx(){return zx}const zp=1024;let Gx=0;class Ya{constructor(e,t){this.from=e,this.to=t}}class Se{constructor(e={}){this.id=Gx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qt.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Se.closedBy=new Se({deserialize:i=>i.split(" ")}),Se.openedBy=new Se({deserialize:i=>i.split(" ")}),Se.group=new Se({deserialize:i=>i.split(" ")}),Se.isolate=new Se({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}}),Se.contextHash=new Se({perNode:!0}),Se.lookAhead=new Se({perNode:!0}),Se.mounted=new Se({perNode:!0});class co{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Se.mounted.id]}}const Kx=Object.create(null);class Qt{constructor(e,t,n,s=0){this.name=e,this.props=t,this.id=n,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Kx,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Qt(e.name||"",t,e.id,n);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Se.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let s of n.split(" "))t[s]=e[n];return n=>{for(let s=n.prop(Se.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?n.name:s[r]];if(o)return o}}}}Qt.none=new Qt("",Object.create(null),0,8);class Ga{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let s=null;for(let r of e){let o=r(n);if(o){s||(s=Object.assign({},n.props));let a=o[1],c=o[0];c.combine&&c.id in s&&(a=c.combine(s[c.id],a)),s[c.id]=a}}t.push(s?new Qt(n.name,s,n.id,n.flags):n)}return new Ga(t)}}const uo=new WeakMap,Yp=new WeakMap;var nt;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(nt||(nt={}));class et{constructor(e,t,n,s,r){if(this.type=e,this.children=t,this.positions=n,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=co.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let s=n.toString();s&&(t&&(t+=","),t+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Ja(this.topNode,e)}cursorAt(e,t=0,n=0){let s=uo.get(this)||this.topNode,r=new Ja(s);return r.moveTo(e,t),uo.set(this,r._tree),r}get topNode(){return new Et(this,0,0,null)}resolve(e,t=0){let n=Fs(uo.get(this)||this.topNode,e,t,!1);return uo.set(this,n),n}resolveInner(e,t=0){let n=Fs(Yp.get(this)||this.topNode,e,t,!0);return Yp.set(this,n),n}resolveStack(e,t=0){return eS(this,e,t)}iterate(e){let{enter:t,leave:n,from:s=0,to:r=this.length}=e,o=e.mode||0,a=(o&nt.IncludeAnonymous)>0;for(let c=this.cursor(o|nt.IncludeAnonymous);;){let u=!1;if(c.from<=r&&c.to>=s&&(!a&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&n&&(a||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:tc(Qt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,s)=>new et(this.type,t,n,s,this.propValues),e.makeTree||((t,n,s)=>new et(Qt.none,t,n,s)))}static build(e){return tS(e)}}et.empty=new et(Qt.none,[],[],0);class Ka{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ka(this.buffer,this.index)}}class Ki{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Qt.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],s=this.set.types[t],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),e+=4,n==e)return r;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,s,r){let{buffer:o}=this,a=-1;for(let c=e;c!=t&&!(Gp(r,s,o[c+1],o[c+2])&&(a=c,n>0));c=o[c+3]);return a}slice(e,t,n){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,c=0;a<t;){r[c++]=s[a++],r[c++]=s[a++]-n;let u=r[c++]=s[a++]-n;r[c++]=s[a++]-e,o=Math.max(o,u)}return new Ki(r,o,this.set)}}function Gp(i,e,t,n){switch(i){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Fs(i,e,t,n){for(var s;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!n&&i instanceof Et&&i.index<0?null:i.parent;if(!o)return i;i=o}let r=n?0:nt.IgnoreOverlays;if(n)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof Et&&o.index<0&&((s=a.enter(e,t,r))===null||s===void 0?void 0:s.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,r);if(!o)return i;i=o}}class Kp{cursor(e=0){return new Ja(this,e)}getChild(e,t=null,n=null){let s=Hp(this,e,t,n);return s.length?s[0]:null}getChildren(e,t=null,n=null){return Hp(this,e,t,n)}resolve(e,t=0){return Fs(this,e,t,!1)}resolveInner(e,t=0){return Fs(this,e,t,!0)}matchContext(e){return Ha(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(n=t,t=s.prevSibling):t=s}return n}get node(){return this}get next(){return this.parent}}class Et extends Kp{constructor(e,t,n,s){super(),this._tree=e,this.from=t,this.index=n,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,s,r=0){for(let o=this;;){for(let{children:a,positions:c}=o._tree,u=t>0?a.length:-1;e!=u;e+=t){let h=a[e],f=c[e]+o.from;if(Gp(s,n,f,f+h.length)){if(h instanceof Ki){if(r&nt.ExcludeBuffers)continue;let d=h.findChild(0,h.buffer.length,t,n-f,s);if(d>-1)return new Oi(new Hx(o,h,e,f),null,d)}else if(r&nt.IncludeAnonymous||!h.type.isAnonymous||ec(h)){let d;if(!(r&nt.IgnoreMounts)&&(d=co.get(h))&&!d.overlay)return new Et(d.tree,f,e,o);let m=new Et(h,f,e,o);return r&nt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?h.children.length-1:0,t,n,s)}}}if(r&nt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let s;if(!(n&nt.IgnoreOverlays)&&(s=co.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:a}of s.overlay)if((t>0?o<=r:o<r)&&(t<0?a>=r:a>r))return new Et(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Hp(i,e,t,n){let s=i.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(n!=null&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return n==null?r:[]}}function Ha(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Hx{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class Oi extends Kp{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Oi(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&nt.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Oi(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Oi(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Oi(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,s=this.index+4,r=n.buffer[this.index+3];if(r>s){let o=n.buffer[this.index+1];e.push(n.slice(s,r,o)),t.push(0)}return new et(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Jp(i){if(!i.length)return null;let e=0,t=i[0];for(let r=1;r<i.length;r++){let o=i[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let n=t instanceof Et&&t.index<0?null:t.parent,s=i.slice();return n?s[e]=n:s.splice(e,1),new Jx(s,t)}class Jx{constructor(e,t){this.heads=e,this.node=t}get next(){return Jp(this.heads)}}function eS(i,e,t){let n=i.resolveInner(e,t),s=null;for(let r=n instanceof Et?n:n.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(s||(s=[n])).push(o.resolve(e,t)),r=o}else{let o=co.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Et(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(Fs(a,e,t,!1))}}return s?Jp(s):n}class Ja{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Et)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=n+s.buffer[e+1],this.to=n+s.buffer[e+2],!0}yield(e){return e?e instanceof Et?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,n);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&nt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&nt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&nt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let s=n<0?0:this.stack[n]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(s)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(s.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:n}=s)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let a=n._tree.children[r];if(this.mode&nt.IncludeAnonymous||a instanceof Ki||!a.type.isAnonymous||ec(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let s=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,n=r+1;break e}s=this.stack[--r]}for(let s=n;s<this.stack.length;s++)t=new Oi(this.buffer,t,this.stack[s]);return this.bufferNode=new Oi(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&t&&t(this),s=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,s=!0}}}matchContext(e){if(!this.buffer)return Ha(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let s=e.length-1,r=this.stack.length-1;s>=0;r--){if(r<0)return Ha(this._tree,e,s);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function ec(i){return i.children.some(e=>e instanceof Ki||!e.type.isAnonymous||ec(e))}function tS(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=zp,reused:r=[],minRepeatType:o=n.types.length}=i,a=Array.isArray(t)?new Ka(t,t.length):t,c=n.types,u=0,h=0;function f(C,T,x,A,R,_){let{id:S,start:P,end:Q,size:E}=a,W=h,B=u;if(E<0)if(a.next(),E==-1){let j=r[S];x.push(j),A.push(P-C);return}else if(E==-3){u=S;return}else if(E==-4){h=S;return}else throw new RangeError(`Unrecognized record size: ${E}`);let I=c[S],G,Z,H=P-C;if(Q-P<=s&&(Z=g(a.pos-T,R))){let j=new Uint16Array(Z.size-Z.skip),z=a.pos-Z.size,me=j.length;for(;a.pos>z;)me=p(Z.start,j,me);G=new Ki(j,Q-Z.start,n),H=Z.start-C}else{let j=a.pos-E;a.next();let z=[],me=[],de=S>=o?S:-1,ae=0,v=Q;for(;a.pos>j;)de>=0&&a.id==de&&a.size>=0?(a.end<=v-s&&(O(z,me,P,ae,a.end,v,de,W,B),ae=z.length,v=a.end),a.next()):_>2500?d(P,j,z,me):f(P,j,z,me,de,_+1);if(de>=0&&ae>0&&ae<z.length&&O(z,me,P,ae,P,v,de,W,B),z.reverse(),me.reverse(),de>-1&&ae>0){let N=m(I,B);G=tc(I,z,me,0,z.length,0,Q-P,N,N)}else G=w(I,z,me,Q-P,W-Q,B)}x.push(G),A.push(H)}function d(C,T,x,A){let R=[],_=0,S=-1;for(;a.pos>T;){let{id:P,start:Q,end:E,size:W}=a;if(W>4)a.next();else{if(S>-1&&Q<S)break;S<0&&(S=E-s),R.push(P,Q,E),_++,a.next()}}if(_){let P=new Uint16Array(_*4),Q=R[R.length-2];for(let E=R.length-3,W=0;E>=0;E-=3)P[W++]=R[E],P[W++]=R[E+1]-Q,P[W++]=R[E+2]-Q,P[W++]=W;x.push(new Ki(P,R[2]-Q,n)),A.push(Q-C)}}function m(C,T){return(x,A,R)=>{let _=0,S=x.length-1,P,Q;if(S>=0&&(P=x[S])instanceof et){if(!S&&P.type==C&&P.length==R)return P;(Q=P.prop(Se.lookAhead))&&(_=A[S]+P.length+Q)}return w(C,x,A,R,_,T)}}function O(C,T,x,A,R,_,S,P,Q){let E=[],W=[];for(;C.length>A;)E.push(C.pop()),W.push(T.pop()+x-R);C.push(w(n.types[S],E,W,_-R,P-_,Q)),T.push(R-x)}function w(C,T,x,A,R,_,S){if(_){let P=[Se.contextHash,_];S=S?[P].concat(S):[P]}if(R>25){let P=[Se.lookAhead,R];S=S?[P].concat(S):[P]}return new et(C,T,x,A,S)}function g(C,T){let x=a.fork(),A=0,R=0,_=0,S=x.end-s,P={size:0,start:0,skip:0};e:for(let Q=x.pos-C;x.pos>Q;){let E=x.size;if(x.id==T&&E>=0){P.size=A,P.start=R,P.skip=_,_+=4,A+=4,x.next();continue}let W=x.pos-E;if(E<0||W<Q||x.start<S)break;let B=x.id>=o?4:0,I=x.start;for(x.next();x.pos>W;){if(x.size<0)if(x.size==-3||x.size==-4)B+=4;else break e;else x.id>=o&&(B+=4);x.next()}R=I,A+=E,_+=B}return(T<0||A==C)&&(P.size=A,P.start=R,P.skip=_),P.size>4?P:void 0}function p(C,T,x){let{id:A,start:R,end:_,size:S}=a;if(a.next(),S>=0&&A<o){let P=x;if(S>4){let Q=a.pos-(S-4);for(;a.pos>Q;)x=p(C,T,x)}T[--x]=P,T[--x]=_-C,T[--x]=R-C,T[--x]=A}else S==-3?u=A:S==-4&&(h=A);return x}let b=[],k=[];for(;a.pos>0;)f(i.start||0,i.bufferStart||0,b,k,-1,0);let y=(e=i.length)!==null&&e!==void 0?e:b.length?k[0]+b[0].length:0;return new et(c[i.topID],b.reverse(),k.reverse(),y)}const em=new WeakMap;function ho(i,e){if(!i.isAnonymous||e instanceof Ki||e.type!=i)return 1;let t=em.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof et)){t=1;break}t+=ho(i,n)}em.set(e,t)}return t}function tc(i,e,t,n,s,r,o,a,c){let u=0;for(let O=n;O<s;O++)u+=ho(i,e[O]);let h=Math.ceil(u*1.5/8),f=[],d=[];function m(O,w,g,p,b){for(let k=g;k<p;){let y=k,C=w[k],T=ho(i,O[k]);for(k++;k<p;k++){let x=ho(i,O[k]);if(T+x>=h)break;T+=x}if(k==y+1){if(T>h){let x=O[y];m(x.children,x.positions,0,x.children.length,w[y]+b);continue}f.push(O[y])}else{let x=w[k-1]+O[k-1].length-C;f.push(tc(i,O,w,y,k,C,x,null,c))}d.push(C+b-r)}}return m(e,t,n,s,0),(a||c)(f,d,o)}class iS{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Oi?this.setBuffer(e.context.buffer,e.index,t):e instanceof Et&&this.map.set(e.tree,t)}get(e){return e instanceof Oi?this.getBuffer(e.context.buffer,e.index):e instanceof Et?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class bn{constructor(e,t,n,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let s=[new bn(0,e.length,e,0,!1,n)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,n=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let a=0,c=0,u=0;;a++){let h=a<t.length?t[a]:null,f=h?h.fromA:1e9;if(f-c>=n)for(;o&&o.from<f;){let d=o;if(c>=d.from||f<=d.to||u){let m=Math.max(d.from,c)-u,O=Math.min(d.to,f)-u;d=m>=O?null:new bn(m,O,d.tree,d.offset+u,a>0,!!h)}if(d&&s.push(d),o.to>f)break;o=r<e.length?e[r++]:null}if(!h)break;c=h.toA,u=h.toA-h.toB}return s}}class tm{startParse(e,t,n){return typeof e=="string"&&(e=new nS(e)),n=n?n.length?n.map(s=>new Ya(s.from,s.to)):[new Ya(0,0)]:[new Ya(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let s=this.startParse(e,t,n);for(;;){let r=s.advance();if(r)return r}}}class nS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Se({perNode:!0});let sS=0;class Xt{constructor(e,t,n,s){this.name=e,this.set=t,this.base=n,this.modified=s,this.id=sS++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Xt&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let s=new Xt(n,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new fo(e);return n=>n.modified.indexOf(t)>-1?n:fo.get(n.base||n,n.modified.concat(t).sort((s,r)=>s.id-r.id))}}let rS=0;class fo{constructor(e){this.name=e,this.instances=[],this.id=rS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&oS(t,a.modified));if(n)return n;let s=[],r=new Xt(e.name,s,e,t);for(let a of t)a.instances.push(r);let o=lS(t);for(let a of e.set)if(!a.modified.length)for(let c of o)s.push(fo.get(a,c));return r}}function oS(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function lS(i){let e=[[]];for(let t=0;t<i.length;t++)for(let n=0,s=e.length;n<s;n++)e.push(e[n].concat(i[t]));return e.sort((t,n)=>n.length-t.length)}function im(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let s of t.split(" "))if(s){let r=[],o=2,a=s;for(let f=0;;){if(a=="..."&&f>0&&f+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==s.length)break;let m=s[f++];if(f==s.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);a=s.slice(f)}let c=r.length-1,u=r[c];if(!u)throw new RangeError("Invalid path: "+s);let h=new Us(n,o,c>0?r.slice(0,c):null);e[u]=h.sort(e[u])}}return nm.add(e)}const nm=new Se({combine(i,e){let t,n,s;for(;i||e;){if(!i||e&&i.depth>=e.depth?(s=e,e=e.next):(s=i,i=i.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new Us(s.tags,s.mode,s.context);t?t.next=r:n=r,t=r}return n}});class Us{constructor(e,t,n,s){this.tags=e,this.mode=t,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Us.empty=new Us([],2,null);function sm(i,e){let t=Object.create(null);for(let r of i)if(!Array.isArray(r.tag))t[r.tag.id]=r.class;else for(let o of r.tag)t[o.id]=r.class;let{scope:n,all:s=null}=e||{};return{style:r=>{let o=s;for(let a of r)for(let c of a.set){let u=t[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}function aS(i,e){let t=null;for(let n of i){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function cS(i,e,t,n=0,s=i.length){let r=new uS(n,Array.isArray(e)?e:[e],t);r.highlightRange(i.cursor(),n,s,"",r.highlighters),r.flush(s)}class uS{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,r){let{type:o,from:a,to:c}=e;if(a>=n||c<=t)return;o.isTop&&(r=this.highlighters.filter(m=>!m.scope||m.scope(o)));let u=s,h=hS(e)||Us.empty,f=aS(r,h.tags);if(f&&(u&&(u+=" "),u+=f,h.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,a),u),h.opaque)return;let d=e.tree&&e.tree.prop(Se.mounted);if(d&&d.overlay){let m=e.node.enter(d.overlay[0].from+a,1),O=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),w=e.firstChild();for(let g=0,p=a;;g++){let b=g<d.overlay.length?d.overlay[g]:null,k=b?b.from+a:c,y=Math.max(t,p),C=Math.min(n,k);if(y<C&&w)for(;e.from<C&&(this.highlightRange(e,y,C,s,r),this.startSpan(Math.min(C,e.to),u),!(e.to>=k||!e.nextSibling())););if(!b||k>n)break;p=b.to+a,p>t&&(this.highlightRange(m.cursor(),Math.max(t,b.from+a),Math.min(n,p),"",O),this.startSpan(Math.min(n,p),u))}w&&e.parent()}else if(e.firstChild()){d&&(s="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,r),this.startSpan(Math.min(n,e.to),u)}while(e.nextSibling());e.parent()}}}function hS(i){let e=i.type.prop(nm);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const te=Xt.define,po=te(),Hi=te(),rm=te(Hi),om=te(Hi),Ji=te(),mo=te(Ji),ic=te(Ji),_i=te(),yn=te(_i),bi=te(),yi=te(),nc=te(),Xs=te(nc),go=te(),M={comment:po,lineComment:te(po),blockComment:te(po),docComment:te(po),name:Hi,variableName:te(Hi),typeName:rm,tagName:te(rm),propertyName:om,attributeName:te(om),className:te(Hi),labelName:te(Hi),namespace:te(Hi),macroName:te(Hi),literal:Ji,string:mo,docString:te(mo),character:te(mo),attributeValue:te(mo),number:ic,integer:te(ic),float:te(ic),bool:te(Ji),regexp:te(Ji),escape:te(Ji),color:te(Ji),url:te(Ji),keyword:bi,self:te(bi),null:te(bi),atom:te(bi),unit:te(bi),modifier:te(bi),operatorKeyword:te(bi),controlKeyword:te(bi),definitionKeyword:te(bi),moduleKeyword:te(bi),operator:yi,derefOperator:te(yi),arithmeticOperator:te(yi),logicOperator:te(yi),bitwiseOperator:te(yi),compareOperator:te(yi),updateOperator:te(yi),definitionOperator:te(yi),typeOperator:te(yi),controlOperator:te(yi),punctuation:nc,separator:te(nc),bracket:Xs,angleBracket:te(Xs),squareBracket:te(Xs),paren:te(Xs),brace:te(Xs),content:_i,heading:yn,heading1:te(yn),heading2:te(yn),heading3:te(yn),heading4:te(yn),heading5:te(yn),heading6:te(yn),contentSeparator:te(_i),list:te(_i),quote:te(_i),emphasis:te(_i),strong:te(_i),link:te(_i),monospace:te(_i),strikethrough:te(_i),inserted:te(),deleted:te(),changed:te(),invalid:te(),meta:go,documentMeta:te(go),annotation:te(go),processingInstruction:te(go),definition:Xt.defineModifier("definition"),constant:Xt.defineModifier("constant"),function:Xt.defineModifier("function"),standard:Xt.defineModifier("standard"),local:Xt.defineModifier("local"),special:Xt.defineModifier("special")};for(let i in M){let e=M[i];e instanceof Xt&&(e.name=i)}sm([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]);var sc;const qn=new Se;function lm(i){return ce.define({combine:i?e=>e.concat(i):void 0})}const rc=new Se;class ei{constructor(e,t,n=[],s=""){this.data=e,this.name=s,Te.prototype.hasOwnProperty("tree")||Object.defineProperty(Te.prototype,"tree",{get(){return st(this)}}),this.parser=t,this.extension=[en.of(this),Te.languageData.of((r,o,a)=>{let c=am(r,o,a),u=c.type.prop(qn);if(!u)return[];let h=r.facet(u),f=c.type.prop(rc);if(f){let d=c.resolve(o-c.from,a);for(let m of f)if(m.test(d,r)){let O=r.facet(m.facet);return m.type=="replace"?O:O.concat(h)}}return h})].concat(n)}isActiveAt(e,t,n=-1){return am(e,t,n).type.prop(qn)==this.data}findRegions(e){let t=e.facet(en);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],s=(r,o)=>{if(r.prop(qn)==this.data){n.push({from:o,to:o+r.length});return}let a=r.prop(Se.mounted);if(a){if(a.tree.prop(qn)==this.data){if(a.overlay)for(let c of a.overlay)n.push({from:c.from+o,to:c.to+o});else n.push({from:o,to:o+r.length});return}else if(a.overlay){let c=n.length;if(s(a.tree,a.overlay[0].from+o),n.length>c)return}}for(let c=0;c<r.children.length;c++){let u=r.children[c];u instanceof et&&s(u,r.positions[c]+o)}};return s(st(e),0),n}get allowsNesting(){return!0}}ei.setState=ke.define();function am(i,e,t){let n=i.facet(en),s=st(i).topNode;if(!n||n.allowsNesting)for(let r=s;r;r=r.enter(e,t,nt.ExcludeBuffers))r.type.isTop&&(s=r);return s}class Oo extends ei{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=lm(e.languageData);return new Oo(t,e.parser.configure({props:[qn.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Oo(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function st(i){let e=i.field(ei.state,!1);return e?e.tree:et.empty}class fS{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Ws=null;class _o{constructor(e,t,n=[],s,r,o,a,c){this.parser=e,this.state=t,this.fragments=n,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new _o(e,t,[],et.empty,0,n,[],null)}startParse(){return this.parser.startParse(new fS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=et.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(bn.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(bn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ws;Ws=this;try{return e()}finally{Ws=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=cm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:s,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((u,h,f,d)=>c.push({fromA:u,toA:h,fromB:f,toB:d})),n=bn.applyChanges(n,c),s=et.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let h=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);h<f&&a.push({from:h,to:f})}}}return new _o(this.parser,t,n,s,r,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:s,to:r}=this.skipped[n];s<e.to&&r>e.from&&(this.fragments=cm(this.fragments,s,r),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends tm{createParse(t,n,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let c=Ws;if(c){for(let u of s)c.tempSkipped.push(u);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=o,new et(Qt.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ws}}function cm(i,e,t){return bn.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class jn{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new jn(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=_o.create(e.facet(en).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new jn(n)}}ei.state=rt.define({create:jn.init,update(i,e){for(let t of e.effects)if(t.is(ei.setState))return t.value;return e.startState.facet(en)!=e.state.facet(en)?jn.init(e.state):i.apply(e)}});let um=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(um=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const oc=typeof navigator<"u"&&(!((sc=navigator.scheduling)===null||sc===void 0)&&sc.isInputPending)?()=>navigator.scheduling.isInputPending():null,dS=Ye.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ei.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ei.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=um(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:s}}=this.view,r=n.field(ei.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!oc?Math.max(25,e.timeRemaining()-5):1e9),a=r.context.treeLen<s&&n.doc.length>s+1e3,c=r.context.work(()=>oc&&oc()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ei.setState.of(new jn(r.context))})),this.chunkBudget>0&&!(c&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),en=ce.define({combine(i){return i.length?i[0]:null},enables:i=>[ei.state,dS,se.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class pS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const mS=ce.define(),qs=ce.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function bo(i){let e=i.facet(qs);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function js(i,e){let t="",n=i.tabSize,s=i.facet(qs)[0];if(s==" "){for(;e>=n;)t+=" ",e-=n;s=" "}for(let r=0;r<e;r++)t+=s;return t}function lc(i,e){i instanceof Te&&(i=new yo(i));for(let n of i.state.facet(mS)){let s=n(i,e);if(s!==void 0)return s}let t=st(i.state);return t.length>=e?gS(i,t,e):null}class yo{constructor(e,t={}){this.state=e,this.options=t,this.unit=bo(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=n.from&&s<=n.to?r&&s==e?{text:"",from:e}:(t<0?s<e:s<=e)?{text:n.text.slice(s-n.from),from:s}:{text:n.text.slice(0,s-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:s}=this.lineAt(e,t);return n.slice(e-s,Math.min(n.length,e+100-s))}column(e,t=1){let{text:n,from:s}=this.lineAt(e,t),r=this.countColumn(n,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(r+=o-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Dn(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const hm=new Se;function gS(i,e,t){let n=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=n.node){let r=[];for(let o=s;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)n={node:r[o],next:n}}return fm(n,i,t)}function fm(i,e,t){for(let n=i;n;n=n.next){let s=_S(n.node);if(s)return s(ac.create(e,t,n))}return 0}function OS(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function _S(i){let e=i.type.prop(hm);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(Se.closedBy))){let s=i.lastChild,r=s&&n.indexOf(s.name)>-1;return o=>dm(o,!0,1,void 0,r&&!OS(o)?s.from:void 0)}return i.parent==null?bS:null}function bS(){return 0}class ac extends yo{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new ac(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(yS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return fm(this.context.next,this.base,this.pos)}}function yS(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function wS(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let s=i.options.simulateBreak,r=i.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let a=t.to;;){let c=e.childAfter(a);if(!c||c==n)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+u}}a=c.to}}function kS({closing:i,align:e=!0,units:t=1}){return n=>dm(n,e,t,i)}function dm(i,e,t,n,s){let r=i.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==i.pos+o,c=e?wS(i):null;return c?a?i.column(c.from):i.column(c.to):i.baseIndent+(a?0:i.unit*t)}const xS=i=>i.baseIndent;function cc({except:i,units:e=1}={}){return t=>{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const SS=200;function CS(){return Te.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,s=t.lineAt(n);if(n>s.from+SS)return i;let r=t.sliceString(s.from,n);if(!e.some(u=>u.test(r)))return i;let{state:o}=i,a=-1,c=[];for(let{head:u}of o.selection.ranges){let h=o.doc.lineAt(u);if(h.from==a)continue;a=h.from;let f=lc(o,h.from);if(f==null)continue;let d=/^\s*/.exec(h.text)[0],m=js(o,f);d!=m&&c.push({from:h.from,to:h.from+d.length,insert:m})}return c.length?[i,{changes:c,sequential:!0}]:i})}const AS=ce.define(),pm=new Se;function TS(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function PS(i,e,t){let n=st(i);if(n.length<t)return null;let s=n.resolveStack(t,1),r=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(r&&a.from<e)break;let c=a.type.prop(pm);if(c&&(a.to<n.length-50||n.length==i.doc.length||!QS(a))){let u=c(a,i);u&&u.from<=t&&u.from>=e&&u.to>t&&(r=u)}}return r}function QS(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function wo(i,e,t){for(let n of i.facet(AS)){let s=n(i,e,t);if(s)return s}return PS(i,e,t)}function mm(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}const ko=ke.define({map:mm}),zs=ke.define({map:mm});function gm(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(i.lineBlockAt(t));return e}const wn=rt.define({create(){return pe.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>i=Om(i,t,n)),i=i.map(e.changes);for(let t of e.effects)if(t.is(ko)&&!ES(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(uc),s=n?pe.replace({widget:new LS(n(e.state,t.value))}):km;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(zs)&&(i=i.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(i=Om(i,e.selection.main.head)),i},provide:i=>se.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,s)=>{t.push(n,s)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let n=i[t++],s=i[t++];if(typeof n!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(km.range(n,s))}return pe.set(e,!0)}});function Om(i,e,t=e){let n=!1;return i.between(e,t,(s,r)=>{s<t&&r>e&&(n=!0)}),n?i.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):i}function xo(i,e,t){var n;let s=null;return(n=i.field(wn,!1))===null||n===void 0||n.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function ES(i,e,t){let n=!1;return i.between(e,e,(s,r)=>{s==e&&r==t&&(n=!0)}),n}function _m(i,e){return i.field(wn,!1)?e:e.concat(ke.appendConfig.of(ym()))}const $S=i=>{for(let e of gm(i)){let t=wo(i.state,e.from,e.to);if(t)return i.dispatch({effects:_m(i.state,[ko.of(t),bm(i,t)])}),!0}return!1},NS=i=>{if(!i.state.field(wn,!1))return!1;let e=[];for(let t of gm(i)){let n=xo(i.state,t.from,t.to);n&&e.push(zs.of(n),bm(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function bm(i,e,t=!0){let n=i.state.doc.lineAt(e.from).number,s=i.state.doc.lineAt(e.to).number;return se.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${s}.`)}const RS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:$S},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:NS},{key:"Ctrl-Alt-[",run:i=>{let{state:e}=i,t=[];for(let n=0;n<e.doc.length;){let s=i.lineBlockAt(n),r=wo(e,s.from,s.to);r&&t.push(ko.of(r)),n=(r?i.lineBlockAt(r.to):s).to+1}return t.length&&i.dispatch({effects:_m(i.state,t)}),!!t.length}},{key:"Ctrl-Alt-]",run:i=>{let e=i.state.field(wn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,s)=>{t.push(zs.of({from:n,to:s}))}),i.dispatch({effects:t}),!0}}],VS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},uc=ce.define({combine(i){return fi(i,VS)}});function ym(i){let e=[wn,BS];return i&&e.push(uc.of(i)),e}function wm(i,e){let{state:t}=i,n=t.facet(uc),s=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),c=xo(i.state,a.from,a.to);c&&i.dispatch({effects:zs.of(c)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,s,e);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const km=pe.replace({widget:new class extends pi{toDOM(i){return wm(i,null)}}});class LS extends pi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return wm(e,this.value)}}const MS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class hc extends Mi{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function DS(i={}){let e={...MS,...i},t=new hc(e,!0),n=new hc(e,!1),s=Ye.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(en)!=o.state.facet(en)||o.startState.field(wn,!1)!=o.state.field(wn,!1)||st(o.startState)!=st(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new $i;for(let c of o.viewportLineBlocks){let u=xo(o.state,c.from,c.to)?n:wo(o.state,c.from,c.to)?t:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:r}=e;return[s,vx({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ne.empty},initialSpacer(){return new hc(e,!1)},domEventHandlers:{...r,click:(o,a,c)=>{if(r.click&&r.click(o,a,c))return!0;let u=xo(o.state,a.from,a.to);if(u)return o.dispatch({effects:zs.of(u)}),!0;let h=wo(o.state,a.from,a.to);return h?(o.dispatch({effects:ko.of(h)}),!0):!1}}}),ym()]}const BS=se.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ys{constructor(e,t){this.specs=e;let n;function s(a){let c=qi.newName();return(n||(n=Object.create(null)))["."+c]=a,c}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof ei?a=>a.prop(qn)==o.data:o?a=>a==o:void 0,this.style=sm(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:r}).style,this.module=n?new qi(n):null,this.themeType=t.themeType}static define(e,t){return new Ys(e,t||{})}}const fc=ce.define(),xm=ce.define({combine(i){return i.length?[i[0]]:null}});function dc(i){let e=i.facet(fc);return e.length?e:i.facet(xm)}function Sm(i,e){let t=[IS],n;return i instanceof Ys&&(i.module&&t.push(se.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(xm.of(i)):n?t.push(fc.computeN([se.darkTheme],s=>s.facet(se.darkTheme)==(n=="dark")?[i]:[])):t.push(fc.of(i)),t}class vS{constructor(e){this.markCache=Object.create(null),this.tree=st(e.state),this.decorations=this.buildDeco(e,dc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=st(e.state),n=dc(e.state),s=n!=dc(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!s&&t.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return pe.none;let n=new $i;for(let{from:s,to:r}of e.visibleRanges)cS(this.tree,t,(o,a,c)=>{n.add(o,a,this.markCache[c]||(this.markCache[c]=pe.mark({class:c})))},s,r);return n.finish()}}const IS=Wi.high(Ye.fromClass(vS,{decorations:i=>i.decorations})),ZS=Ys.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),FS=se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Cm=1e4,Am="()[]{}",Tm=ce.define({combine(i){return fi(i,{afterCursor:!0,brackets:Am,maxScanDistance:Cm,renderMatch:WS})}}),US=pe.mark({class:"cm-matchingBracket"}),XS=pe.mark({class:"cm-nonmatchingBracket"});function WS(i){let e=[],t=i.matched?US:XS;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}const qS=[rt.define({create(){return pe.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(Tm);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=wi(e.state,s.head,-1,n)||s.head>0&&wi(e.state,s.head-1,1,n)||n.afterCursor&&(wi(e.state,s.head,1,n)||s.head<e.state.doc.length&&wi(e.state,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e.state)))}return pe.set(t,!0)},provide:i=>se.decorations.from(i)}),FS];function jS(i={}){return[Tm.of(i),qS]}const zS=new Se;function pc(i,e,t){let n=i.prop(e<0?Se.openedBy:Se.closedBy);if(n)return n;if(i.name.length==1){let s=t.indexOf(i.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function mc(i){let e=i.type.prop(zS);return e?e(i.node):i}function wi(i,e,t,n={}){let s=n.maxScanDistance||Cm,r=n.brackets||Am,o=st(i),a=o.resolveInner(e,t);for(let c=a;c;c=c.parent){let u=pc(c.type,t,r);if(u&&c.from<c.to){let h=mc(c);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return YS(i,e,t,c,h,u,r)}}return GS(i,e,t,o,a.type,s,r)}function YS(i,e,t,n,s,r,o){let a=n.parent,c={from:s.from,to:s.to},u=0,h=a==null?void 0:a.cursor();if(h&&(t<0?h.childBefore(n.from):h.childAfter(n.to)))do if(t<0?h.to<=n.from:h.from>=n.to){if(u==0&&r.indexOf(h.type.name)>-1&&h.from<h.to){let f=mc(h);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(pc(h.type,t,o))u++;else if(pc(h.type,-t,o)){if(u==0){let f=mc(h);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(t<0?h.prevSibling():h.nextSibling());return{start:c,matched:!1}}function GS(i,e,t,n,s,r,o){let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),c=o.indexOf(a);if(c<0||c%2==0!=t>0)return null;let u={from:t<0?e-1:e,to:t>0?e+1:e},h=i.doc.iterRange(e,t>0?i.doc.length:0),f=0;for(let d=0;!h.next().done&&d<=r;){let m=h.value;t<0&&(d+=m.length);let O=e+d*t;for(let w=t>0?0:m.length-1,g=t>0?m.length:-1;w!=g;w+=t){let p=o.indexOf(m[w]);if(!(p<0||n.resolveInner(O+w,1).type!=s))if(p%2==0==t>0)f++;else{if(f==1)return{start:u,end:{from:O+w,to:O+w+1},matched:p>>1==c>>1};f--}}t>0&&(d+=m.length)}return h.done?{start:u,matched:!1}:null}const KS=Object.create(null),Pm=[Qt.none],Qm=[],Em=Object.create(null),HS=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])HS[i]=JS(KS,e);function gc(i,e){Qm.indexOf(i)>-1||(Qm.push(i),console.warn(e))}function JS(i,e){let t=[];for(let a of e.split(" ")){let c=[];for(let u of a.split(".")){let h=i[u]||M[u];h?typeof h=="function"?c.length?c=c.map(h):gc(u,`Modifier ${u} used at start of tag`):c.length?gc(u,`Tag ${u} used as modifier`):c=Array.isArray(h)?h:[h]:gc(u,`Unknown highlighting tag ${u}`)}for(let u of c)t.push(u)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(a=>a.id),r=Em[s];if(r)return r.id;let o=Em[s]=Qt.define({id:Pm.length,name:n,props:[im({[n]:t})]});return Pm.push(o),o.id}Fe.RTL,Fe.LTR;const eC=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=_c(i.state,t.from);return n.line?tC(i):n.block?nC(i):!1};function Oc(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=i(e,t);return s?(n(t.update(s)),!0):!1}}const tC=Oc(oC,0),iC=Oc($m,0),nC=Oc((i,e)=>$m(i,e,rC(e)),0);function _c(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Gs=50;function sC(i,{open:e,close:t},n,s){let r=i.sliceDoc(n-Gs,n),o=i.sliceDoc(s,s+Gs),a=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(o)[0].length,u=r.length-a;if(r.slice(u-e.length,u)==e&&o.slice(c,c+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:s+c,margin:c&&1}};let h,f;s-n<=2*Gs?h=f=i.sliceDoc(n,s):(h=i.sliceDoc(n,n+Gs),f=i.sliceDoc(s-Gs,s));let d=/^\s*/.exec(h)[0].length,m=/\s*$/.exec(f)[0].length,O=f.length-m-t.length;return h.slice(d,d+e.length)==e&&f.slice(O,O+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:s-m-t.length,margin:/\s/.test(f.charAt(O-1))?1:0}}:null}function rC(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),s=t.to<=n.to?n:i.doc.lineAt(t.to);s.from>n.from&&s.from==t.to&&(s=t.to==n.to+1?n:i.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}function $m(i,e,t=e.selection.ranges){let n=t.map(r=>_c(e,r.from).block);if(!n.every(r=>r))return null;let s=t.map((r,o)=>sC(e,n[o],r.from,r.to));if(i!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:n[o].open+" "},{from:r.to,insert:" "+n[o].close}]))};if(i!=1&&s.some(r=>r)){let r=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let c=n[o],{open:u,close:h}=a;r.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:h.pos-h.margin,to:h.pos+c.close.length})}return{changes:r}}return null}function oC(i,e,t=e.selection.ranges){let n=[],s=-1;for(let{from:r,to:o}of t){let a=n.length,c=1e9,u=_c(e,r).line;if(u){for(let h=r;h<=o;){let f=e.doc.lineAt(h);if(f.from>s&&(r==o||o>f.from)){s=f.from;let d=/^\s*/.exec(f.text)[0].length,m=d==f.length,O=f.text.slice(d,d+u.length)==u?d:-1;d<f.text.length&&d<c&&(c=d),n.push({line:f,comment:O,token:u,indent:d,empty:m,single:!1})}h=f.to+1}if(c<1e9)for(let h=a;h<n.length;h++)n[h].indent<n[h].line.text.length&&(n[h].indent=c);n.length==a+1&&(n[a].single=!0)}}if(i!=2&&n.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:c,indent:u,empty:h,single:f}of n)(f||!h)&&r.push({from:a.from+u,insert:c+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:c}of n)if(a>=0){let u=o.from+a,h=u+c.length;o.text[h-o.from]==" "&&h++,r.push({from:u,to:h})}return{changes:r}}return null}const bc=Ei.define(),lC=Ei.define(),aC=ce.define(),Nm=ce.define({combine(i){return fi(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,s)=>e(n,s)||t(n,s)})}}),Rm=rt.define({create(){return ki.empty},update(i,e){let t=e.state.facet(Nm),n=e.annotation(bc);if(n){let c=$t.fromTransaction(e,n.selection),u=n.side,h=u==0?i.undone:i.done;return c?h=Co(h,h.length,t.minDepth,c):h=Mm(h,e.startState.selection),new ki(u==0?n.rest:h,u==0?h:n.rest)}let s=e.annotation(lC);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(He.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let r=$t.fromTransaction(e),o=e.annotation(He.time),a=e.annotation(He.userEvent);return r?i=i.addChanges(r,o,a,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new ki(i.done.map($t.fromJSON),i.undone.map($t.fromJSON))}});function cC(i={}){return[Rm,Nm.of(i),se.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Vm:e.inputType=="historyRedo"?yc:null;return n?(e.preventDefault(),n(t)):!1}})]}function So(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(Rm,!1);if(!s)return!1;let r=s.pop(i,t,e);return r?(n(r),!0):!1}}const Vm=So(0,!1),yc=So(1,!1),uC=So(0,!0),hC=So(1,!0);class $t{constructor(e,t,n,s,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new $t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new $t(e.changes&&it.fromJSON(e.changes),[],e.mapped&&hi.fromJSON(e.mapped),e.startSelection&&X.fromJSON(e.startSelection),e.selectionsAfter.map(X.fromJSON))}static fromTransaction(e,t){let n=Wt;for(let s of e.startState.facet(aC)){let r=s(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new $t(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Wt)}static selection(e){return new $t(void 0,Wt,void 0,void 0,e)}}function Co(i,e,t,n){let s=e+1>t+20?e-t-1:0,r=i.slice(s,e);return r.push(n),r}function fC(i,e){let t=[],n=!1;return i.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,a)=>{for(let c=0;c<t.length;){let u=t[c++],h=t[c++];a>=u&&o<=h&&(n=!0)}}),n}function dC(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function Lm(i,e){return i.length?e.length?i.concat(e):i:e}const Wt=[],pC=200;function Mm(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-pC));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),Co(i,i.length-1,1e9,t.setSelAfter(n)))}else return[$t.selection([e])]}function mC(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function wc(i,e){if(!i.length)return i;let t=i.length,n=Wt;for(;t;){let s=gC(i[t-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let r=i.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,n=s.selectionsAfter}return n.length?[$t.selection(n)]:Wt}function gC(i,e,t){let n=Lm(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):Wt,t);if(!i.changes)return $t.selection(n);let s=i.changes.map(e),r=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(r):r;return new $t(s,ke.mapEffects(i.effects,e),o,i.startSelection.map(r),n)}const OC=/^(input\.type|delete)($|\.)/;class ki{constructor(e,t,n=0,s=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new ki(this.done,this.undone):this}addChanges(e,t,n,s,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||OC.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,fC(a.changes,e.changes))||n=="input.type.compose")?o=Co(o,o.length-1,s.minDepth,new $t(e.changes.compose(a.changes),Lm(ke.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Wt)):o=Co(o,o.length,s.minDepth,e),new ki(o,Wt,t,n)}addSelection(e,t,n,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Wt;return r.length>0&&t-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&dC(r[r.length-1],e)?this:new ki(Mm(this.done,e),this.undone,t,n)}addMapping(e){return new ki(wc(this.done,e),wc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let s=e==0?this.done:this.undone;if(s.length==0)return null;let r=s[s.length-1],o=r.selectionsAfter[0]||t.selection;if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:bc.of({side:e,rest:mC(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let a=s.length==1?Wt:s.slice(0,s.length-1);return r.mapped&&(a=wc(a,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:bc.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ki.empty=new ki(Wt,Wt);const _C=[{key:"Mod-z",run:Vm,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yc,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yc,preventDefault:!0},{key:"Mod-u",run:uC,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:hC,preventDefault:!0}];function zn(i,e){return X.create(i.ranges.map(e),i.mainIndex)}function ti(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ii({state:i,dispatch:e},t){let n=zn(i.selection,t);return n.eq(i.selection,!0)?!1:(e(ti(i,n)),!0)}function Ao(i,e){return X.cursor(e?i.to:i.from)}function Dm(i,e){return ii(i,t=>t.empty?i.moveByChar(t,e):Ao(t,e))}function _t(i){return i.textDirectionAt(i.state.selection.main.head)==Fe.LTR}const Bm=i=>Dm(i,!_t(i)),vm=i=>Dm(i,_t(i));function Im(i,e){return ii(i,t=>t.empty?i.moveByGroup(t,e):Ao(t,e))}const bC=i=>Im(i,!_t(i)),yC=i=>Im(i,_t(i));function wC(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function To(i,e,t){let n=st(i).resolveInner(e.head),s=t?Se.closedBy:Se.openedBy;for(let c=e.head;;){let u=t?n.childAfter(c):n.childBefore(c);if(!u)break;wC(i,u,s)?n=u:c=t?u.to:u.from}let r=n.type.prop(s),o,a;return r&&(o=t?wi(i,n.from,1):wi(i,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,X.cursor(a,t?-1:1)}const kC=i=>ii(i,e=>To(i.state,e,!_t(i))),xC=i=>ii(i,e=>To(i.state,e,_t(i)));function Zm(i,e){return ii(i,t=>{if(!t.empty)return Ao(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const Fm=i=>Zm(i,!1),Um=i=>Zm(i,!0);function Xm(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,n=0,s;if(e){for(let r of i.state.facet(se.scrollMargins)){let o=r(i);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(n=Math.max(o==null?void 0:o.bottom,n))}s=i.scrollDOM.clientHeight-t-n}else s=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(i.defaultLineHeight,s-5)}}function Wm(i,e){let t=Xm(i),{state:n}=i,s=zn(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):Ao(o,e));if(s.eq(n.selection))return!1;let r;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),c=a.top+t.marginTop,u=a.bottom-t.marginBottom;o&&o.top>c&&o.bottom<u&&(r=se.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return i.dispatch(ti(n,s),{effects:r}),!0}const qm=i=>Wm(i,!1),kc=i=>Wm(i,!0);function tn(i,e,t){let n=i.lineBlockAt(e.head),s=i.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?n.to:n.from)&&(s=i.moveToLineBoundary(e,t,!1)),!t&&s.head==n.from&&n.length){let r=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;r&&e.head!=n.from+r&&(s=X.cursor(n.from+r))}return s}const SC=i=>ii(i,e=>tn(i,e,!0)),CC=i=>ii(i,e=>tn(i,e,!1)),AC=i=>ii(i,e=>tn(i,e,!_t(i))),TC=i=>ii(i,e=>tn(i,e,_t(i))),PC=i=>ii(i,e=>X.cursor(i.lineBlockAt(e.head).from,1)),QC=i=>ii(i,e=>X.cursor(i.lineBlockAt(e.head).to,-1));function EC(i,e,t){let n=!1,s=zn(i.selection,r=>{let o=wi(i,r.head,-1)||wi(i,r.head,1)||r.head>0&&wi(i,r.head-1,1)||r.head<i.doc.length&&wi(i,r.head+1,-1);if(!o||!o.end)return r;n=!0;let a=o.start.from==r.head?o.end.to:o.end.from;return t?X.range(r.anchor,a):X.cursor(a)});return n?(e(ti(i,s)),!0):!1}const $C=({state:i,dispatch:e})=>EC(i,e,!1);function qt(i,e){let t=zn(i.state.selection,n=>{let s=e(n);return X.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(ti(i.state,t)),!0)}function jm(i,e){return qt(i,t=>i.moveByChar(t,e))}const zm=i=>jm(i,!_t(i)),Ym=i=>jm(i,_t(i));function Gm(i,e){return qt(i,t=>i.moveByGroup(t,e))}const NC=i=>Gm(i,!_t(i)),RC=i=>Gm(i,_t(i)),VC=i=>qt(i,e=>To(i.state,e,!_t(i))),LC=i=>qt(i,e=>To(i.state,e,_t(i)));function Km(i,e){return qt(i,t=>i.moveVertically(t,e))}const Hm=i=>Km(i,!1),Jm=i=>Km(i,!0);function eg(i,e){return qt(i,t=>i.moveVertically(t,e,Xm(i).height))}const tg=i=>eg(i,!1),ig=i=>eg(i,!0),MC=i=>qt(i,e=>tn(i,e,!0)),DC=i=>qt(i,e=>tn(i,e,!1)),BC=i=>qt(i,e=>tn(i,e,!_t(i))),vC=i=>qt(i,e=>tn(i,e,_t(i))),IC=i=>qt(i,e=>X.cursor(i.lineBlockAt(e.head).from)),ZC=i=>qt(i,e=>X.cursor(i.lineBlockAt(e.head).to)),ng=({state:i,dispatch:e})=>(e(ti(i,{anchor:0})),!0),sg=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.doc.length})),!0),rg=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.selection.main.anchor,head:0})),!0),og=({state:i,dispatch:e})=>(e(ti(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),FC=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),UC=({state:i,dispatch:e})=>{let t=Qo(i).map(({from:n,to:s})=>X.range(n,Math.min(s+1,i.doc.length)));return e(i.update({selection:X.create(t),userEvent:"select"})),!0},XC=({state:i,dispatch:e})=>{let t=zn(i.selection,n=>{let s=st(i),r=s.resolveStack(n.from,1);if(n.empty){let o=s.resolveStack(n.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&o.next)return X.range(a.to,a.from)}return n});return t.eq(i.selection)?!1:(e(ti(i,t)),!0)};function lg(i,e){let{state:t}=i,n=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to<i.state.doc.length:o.from>0)for(let a=r;;){let c=i.moveVertically(a,e);if(c.head<o.from||c.head>o.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==a.head)break;a=c}}}return s.length==n.ranges.length?!1:(i.dispatch(ti(t,X.create(s,s.length-1))),!0)}const WC=i=>lg(i,!1),qC=i=>lg(i,!0),jC=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=X.create([t.main]):t.main.empty||(n=X.create([X.cursor(t.main.head)])),n?(e(ti(i,n)),!0):!1};function Ks(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,s=n.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let c=e(r);c<o?(t="delete.backward",c=Po(i,c,!1)):c>o&&(t="delete.forward",c=Po(i,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Po(i,o,!1),a=Po(i,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:X.cursor(o,o<r.head?-1:1)}});return s.changes.empty?!1:(i.dispatch(n.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?se.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Po(i,e,t){if(i instanceof se)for(let n of i.state.facet(se.atomicRanges).map(s=>s(i)))n.between(e,e,(s,r)=>{s<e&&r>e&&(e=t?r:s)});return e}const ag=(i,e,t)=>Ks(i,n=>{let s=n.from,{state:r}=i,o=r.doc.lineAt(s),a,c;if(t&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let u=Dn(a,r.tabSize),h=u%bo(r)||bo(r);for(let f=0;f<h&&a[a.length-1-f]==" ";f++)s--;c=s}else c=ht(o.text,s-o.from,e,e)+o.from,c==s&&o.number!=(e?r.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,s-o.from))&&(c=ht(o.text,c-o.from,!1,!1)+o.from);return c}),xc=i=>ag(i,!1,!0),cg=i=>ag(i,!0,!1),ug=(i,e)=>Ks(i,t=>{let n=t.head,{state:s}=i,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let a=null;;){if(n==(e?r.to:r.from)){n==t.head&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let c=ht(r.text,n-r.from,e)+r.from,u=r.text.slice(Math.min(n,c)-r.from,Math.max(n,c)-r.from),h=o(u);if(a!=null&&h!=a)break;(u!=" "||n!=t.head)&&(a=h),n=c}return n}),hg=i=>ug(i,!1),zC=i=>ug(i,!0),YC=i=>Ks(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),GC=i=>Ks(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),KC=i=>Ks(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),HC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Qe.of(["",""])},range:X.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},JC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let s=n.from,r=i.doc.lineAt(s),o=s==r.from?s-1:ht(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:ht(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:i.doc.slice(s,a).append(i.doc.slice(o,s))},range:X.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Qo(i){let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.from),r=i.doc.lineAt(n.to);if(!n.empty&&n.to==r.from&&(r=i.doc.lineAt(n.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});t=r.number+1}return e}function fg(i,e,t){if(i.readOnly)return!1;let n=[],s=[];for(let r of Qo(i)){if(t?r.to==i.doc.length:r.from==0)continue;let o=i.doc.lineAt(t?r.to+1:r.from-1),a=o.length+1;if(t){n.push({from:r.to,to:o.to},{from:r.from,insert:o.text+i.lineBreak});for(let c of r.ranges)s.push(X.range(Math.min(i.doc.length,c.anchor+a),Math.min(i.doc.length,c.head+a)))}else{n.push({from:o.from,to:r.from},{from:r.to,insert:i.lineBreak+o.text});for(let c of r.ranges)s.push(X.range(c.anchor-a,c.head-a))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:X.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const eA=({state:i,dispatch:e})=>fg(i,e,!1),tA=({state:i,dispatch:e})=>fg(i,e,!0);function dg(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of Qo(i))t?n.push({from:s.from,insert:i.doc.slice(s.from,s.to)+i.lineBreak}):n.push({from:s.to,insert:i.lineBreak+i.doc.slice(s.from,s.to)});return e(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const iA=({state:i,dispatch:e})=>dg(i,e,!1),nA=({state:i,dispatch:e})=>dg(i,e,!0),sA=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Qo(e).map(({from:s,to:r})=>(s>0?s--:r<e.doc.length&&r++,{from:s,to:r}))),n=zn(e.selection,s=>{let r;if(i.lineWrapping){let o=i.lineBlockAt(s.head),a=i.coordsAtPos(s.head,s.assoc||1);a&&(r=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2)}return i.moveVertically(s,!0,r)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rA(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=st(i).resolveInner(e),n=t.childBefore(e),s=t.childAfter(e),r;return n&&s&&n.to<=e&&s.from>=e&&(r=n.type.prop(Se.closedBy))&&r.indexOf(s.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(s.from).from&&!/\S/.test(i.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const pg=mg(!1),oA=mg(!0);function mg(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{let{from:r,to:o}=s,a=e.doc.lineAt(r),c=!i&&r==o&&rA(e,r);i&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let u=new yo(e,{simulateBreak:r,simulateDoubleBreak:!!c}),h=lc(u,r);for(h==null&&(h=Dn(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;c?{from:r,to:o}=c:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let f=["",js(e,h)];return c&&f.push(js(e,u.lineIndent(a.from,-1))),{changes:{from:r,to:o,insert:Qe.of(f)},range:X.cursor(r+1+f[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sc(i,e){let t=-1;return i.changeByRange(n=>{let s=[];for(let o=n.from;o<=n.to;){let a=i.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,s,n),t=a.number),o=a.to+1}let r=i.changes(s);return{changes:s,range:X.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const lA=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new yo(i,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Sc(i,(r,o,a)=>{let c=lc(n,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let u=/^\s*/.exec(r.text)[0],h=js(i,c);(u!=h||a.from<r.from+u.length)&&(t[r.from]=c,o.push({from:r.from,to:r.from+u.length,insert:h}))});return s.changes.empty||e(i.update(s,{userEvent:"indent"})),!0},gg=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,n)=>{n.push({from:t.from,insert:i.facet(qs)})}),{userEvent:"input.indent"})),!0),Og=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Dn(s,i.tabSize),o=0,a=js(i,Math.max(0,r-bo(i)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),aA=i=>(i.setTabFocusMode(),!0),cA=[{key:"Ctrl-b",run:Bm,shift:zm,preventDefault:!0},{key:"Ctrl-f",run:vm,shift:Ym},{key:"Ctrl-p",run:Fm,shift:Hm},{key:"Ctrl-n",run:Um,shift:Jm},{key:"Ctrl-a",run:PC,shift:IC},{key:"Ctrl-e",run:QC,shift:ZC},{key:"Ctrl-d",run:cg},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:YC},{key:"Ctrl-Alt-h",run:hg},{key:"Ctrl-o",run:HC},{key:"Ctrl-t",run:JC},{key:"Ctrl-v",run:kc}],uA=[{key:"ArrowLeft",run:Bm,shift:zm,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bC,shift:NC,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:AC,shift:BC,preventDefault:!0},{key:"ArrowRight",run:vm,shift:Ym,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yC,shift:RC,preventDefault:!0},{mac:"Cmd-ArrowRight",run:TC,shift:vC,preventDefault:!0},{key:"ArrowUp",run:Fm,shift:Hm,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ng,shift:rg},{mac:"Ctrl-ArrowUp",run:qm,shift:tg},{key:"ArrowDown",run:Um,shift:Jm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:sg,shift:og},{mac:"Ctrl-ArrowDown",run:kc,shift:ig},{key:"PageUp",run:qm,shift:tg},{key:"PageDown",run:kc,shift:ig},{key:"Home",run:CC,shift:DC,preventDefault:!0},{key:"Mod-Home",run:ng,shift:rg},{key:"End",run:SC,shift:MC,preventDefault:!0},{key:"Mod-End",run:sg,shift:og},{key:"Enter",run:pg,shift:pg},{key:"Mod-a",run:FC},{key:"Backspace",run:xc,shift:xc,preventDefault:!0},{key:"Delete",run:cg,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hg,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:zC,preventDefault:!0},{mac:"Mod-Backspace",run:GC,preventDefault:!0},{mac:"Mod-Delete",run:KC,preventDefault:!0}].concat(cA.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),hA=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:kC,shift:VC},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:xC,shift:LC},{key:"Alt-ArrowUp",run:eA},{key:"Shift-Alt-ArrowUp",run:iA},{key:"Alt-ArrowDown",run:tA},{key:"Shift-Alt-ArrowDown",run:nA},{key:"Mod-Alt-ArrowUp",run:WC},{key:"Mod-Alt-ArrowDown",run:qC},{key:"Escape",run:jC},{key:"Mod-Enter",run:oA},{key:"Alt-l",mac:"Ctrl-l",run:UC},{key:"Mod-i",run:XC,preventDefault:!0},{key:"Mod-[",run:Og},{key:"Mod-]",run:gg},{key:"Mod-Alt-\\",run:lA},{key:"Shift-Mod-k",run:sA},{key:"Shift-Mod-\\",run:$C},{key:"Mod-/",run:eC},{key:"Alt-A",run:iC},{key:"Ctrl-m",mac:"Shift-Alt-m",run:aA}].concat(uA),fA={key:"Tab",run:gg,shift:Og},_g=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class Yn{constructor(e,t,n=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=r?a=>r(_g(a)):_g,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Tt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=vl(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ui(e);let s=this.normalize(t);if(s.length)for(let r=0,o=n;;r++){let a=s.charCodeAt(r),c=this.match(a,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(c)return this.value=c,this;break}o==n&&r<t.length&&t.charCodeAt(r)==a&&o++}}}match(e,t,n){let s=null;for(let r=0;r<this.matches.length;r+=2){let o=this.matches[r],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[r+1],to:n}:(this.matches[r]++,a=!0)),a||(this.matches.splice(r,2),r-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:n}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Yn.prototype[Symbol.iterator]=function(){return this});const bg={from:-1,to:-1,match:/.*/.exec("")},Cc="gm"+(/x/.unicode==null?"":"u");class yg{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=bg,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new wg(e,t,n,s,r);this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Eo(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,s=n+t[0].length;if(this.matchPos=Eo(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Ac=new WeakMap;class Gn{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=Ac.get(e);if(!s||s.from>=n||s.to<=t){let a=new Gn(t,e.sliceString(t,n));return Ac.set(e,a),a}if(s.from==t&&s.to==n)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to<n&&(r+=e.sliceString(s.to,n)),Ac.set(e,new Gn(o,r)),new Gn(t,r.slice(t-o,n-o))}}class wg{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=bg,this.matchPos=Eo(e,s),this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Gn.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this.matchPos=Eo(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Gn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(yg.prototype[Symbol.iterator]=wg.prototype[Symbol.iterator]=function(){return this});function dA(i){try{return new RegExp(i,Cc),!0}catch{return!1}}function Eo(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function Tc(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=Ie("input",{class:"cm-textfield",name:"line",value:e}),n=Ie("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:Hs.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},Ie("label",i.state.phrase("Go to line"),": ",t)," ",Ie("button",{class:"cm-button",type:"submit"},i.state.phrase("go")),Ie("button",{name:"close",onclick:()=>{i.dispatch({effects:Hs.of(!1)}),i.focus()},"aria-label":i.state.phrase("close"),type:"button"},["×"]));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=i,a=o.doc.lineAt(o.selection.main.head),[,c,u,h,f]=r,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let g=m/100;c&&(g=g*(c=="-"?-1:1)+a.number/o.doc.lines),m=Math.round(o.doc.lines*g)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let O=o.doc.line(Math.max(1,Math.min(o.doc.lines,m))),w=X.cursor(O.from+Math.max(0,Math.min(d,O.length)));i.dispatch({effects:[Hs.of(!1),se.scrollIntoView(w.from,{y:"center"})],selection:w}),i.focus()}return{dom:n}}const Hs=ke.define(),kg=rt.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Hs)&&(i=t.value);return i},provide:i=>Is.from(i,e=>e?Tc:null)}),pA=i=>{let e=vs(i,Tc);if(!e){let t=[Hs.of(!0)];i.state.field(kg,!1)==null&&t.push(ke.appendConfig.of([kg,mA])),i.dispatch({effects:t}),e=vs(i,Tc)}return e&&e.dom.querySelector("input").select(),!0},mA=se.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),gA={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},xg=ce.define({combine(i){return fi(i,gA,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function OA(i){let e=[kA,wA];return i&&e.push(xg.of(i)),e}const _A=pe.mark({class:"cm-selectionMatch"}),bA=pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Sg(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=Xe.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=Xe.Word)}function yA(i,e,t,n){return i(e.sliceDoc(t,t+1))==Xe.Word&&i(e.sliceDoc(n-1,n))==Xe.Word}const wA=Ye.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(xg),{state:t}=i,n=t.selection;if(n.ranges.length>1)return pe.none;let s=n.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return pe.none;let c=t.wordAt(s.head);if(!c)return pe.none;o=t.charCategorizer(s.head),r=t.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<e.minSelectionLength||c>200)return pe.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Sg(o,t,s.from,s.to)&&yA(o,t,s.from,s.to)))return pe.none}else if(r=t.sliceDoc(s.from,s.to),!r)return pe.none}let a=[];for(let c of i.visibleRanges){let u=new Yn(t.doc,r,c.from,c.to);for(;!u.next().done;){let{from:h,to:f}=u.value;if((!o||Sg(o,t,h,f))&&(s.empty&&h<=s.from&&f>=s.to?a.push(bA.range(h,f)):(h>=s.to||f<=s.from)&&a.push(_A.range(h,f)),a.length>e.maxMatches))return pe.none}}return pe.set(a)}},{decorations:i=>i.decorations}),kA=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xA=({state:i,dispatch:e})=>{let{selection:t}=i,n=X.create(t.ranges.map(s=>i.wordAt(s.head)||X.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function SA(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new Yn(i.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Yn(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(c=>c.from==a.value.from))continue;if(r){let c=i.wordAt(a.value.from);if(!c||c.from!=a.value.from||c.to!=a.value.to)continue}return a.value}}const CA=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return xA({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=n))return!1;let s=SA(i,n);return s?(e(i.update({selection:i.selection.addRange(X.range(s.from,s.to),!1),effects:se.scrollIntoView(s.to)})),!0):!1},Kn=ce.define({combine(i){return fi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DA(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class Cg{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||dA(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
32
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new QA(this):new TA(this)}getCursor(e,t=0,n){let s=e.doc?e:Te.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Jn(this,s,t,n):Hn(this,s,t,n)}}class Ag{constructor(e){this.spec=e}}function Hn(i,e,t,n){return new Yn(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),i.wholeWord?AA(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function AA(i,e){return(t,n,s,r)=>((r>t||r+s.length<n)&&(r=Math.max(0,t-2),s=i.sliceString(r,Math.min(i.length,n+2))),(e($o(s,t-r))!=Xe.Word||e(No(s,t-r))!=Xe.Word)&&(e(No(s,n-r))!=Xe.Word||e($o(s,n-r))!=Xe.Word))}class TA extends Ag{constructor(e){super(e)}nextMatch(e,t,n){let s=Hn(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Hn(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==n?null:s.value}prevMatchInRange(e,t,n){for(let s=n;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=Hn(this.spec,e,r,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(r==t)return null;s-=1e4}}prevMatch(e,t,n){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Hn(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=Hn(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Jn(i,e,t,n){return new yg(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?PA(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function $o(i,e){return i.slice(ht(i,e,!1),e)}function No(i,e){return i.slice(e,ht(i,e))}function PA(i){return(e,t,n)=>!n[0].length||(i($o(n.input,n.index))!=Xe.Word||i(No(n.input,n.index))!=Xe.Word)&&(i(No(n.input,n.index+n[0].length))!=Xe.Word||i($o(n.input,n.index+n[0].length))!=Xe.Word)}class QA extends Ag{nextMatch(e,t,n){let s=Jn(this.spec,e,n,e.doc.length).next();return s.done&&(s=Jn(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let r=Math.max(t,n-s*1e4),o=Jn(this.spec,e,r,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let r=+n.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+n.slice(s)}return t})}matchAll(e,t){let n=Jn(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=Jn(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Js=ke.define(),Pc=ke.define(),nn=rt.define({create(i){return new Qc($c(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Js)?i=new Qc(t.value.create(),i.panel):t.is(Pc)&&(i=new Qc(i.query,t.value?Ec:null));return i},provide:i=>Is.from(i,e=>e.panel)});class Qc{constructor(e,t){this.query=e,this.panel=t}}const EA=pe.mark({class:"cm-searchMatch"}),$A=pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NA=Ye.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(nn))}update(i){let e=i.state.field(nn);(e!=i.startState.field(nn)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return pe.none;let{view:t}=this,n=new $i;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:a,to:c}=r[s];for(;s<o-1&&c>r[s+1].from-2*250;)c=r[++s].to;i.highlight(t.state,a,c,(u,h)=>{let f=t.state.selection.ranges.some(d=>d.from==u&&d.to==h);n.add(u,h,f?$A:EA)})}return n.finish()}},{decorations:i=>i.decorations});function er(i){return e=>{let t=e.state.field(nn,!1);return t&&t.query.spec.valid?i(e,t):Eg(e)}}const Ro=er((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=X.single(n.from,n.to),r=i.state.facet(Kn);return i.dispatch({selection:s,effects:[Nc(i,n),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),Qg(i),!0}),Vo=er((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let r=X.single(s.from,s.to),o=i.state.facet(Kn);return i.dispatch({selection:r,effects:[Nc(i,s),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),Qg(i),!0}),RA=er((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:X.create(t.map(n=>X.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),VA=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,r=[],o=0;for(let a=new Yn(i.doc,i.sliceDoc(n,s));!a.next().done;){if(r.length>1e3)return!1;a.value.from==n&&(o=r.length),r.push(X.range(a.value.from,a.value.to))}return e(i.update({selection:X.create(r,o),userEvent:"select.search.matches"})),!0},Tg=er((i,{query:e})=>{let{state:t}=i,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,n,n);if(!r)return!1;let o=r,a=[],c,u,h=[];o.from==n&&o.to==s&&(u=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(t,o.from,o.to),h.push(se.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+".")));let f=i.state.changes(a);return o&&(c=X.single(o.from,o.to).map(f),h.push(Nc(i,o)),h.push(t.facet(Kn).scrollToMatch(c.main,i))),i.dispatch({changes:f,selection:c,effects:h,userEvent:"input.replace"}),!0}),LA=er((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:se.announce.of(n),userEvent:"input.replace.all"}),!0});function Ec(i){return i.state.facet(Kn).createPanel(i)}function $c(i,e){var t,n,s,r,o;let a=i.selection.main,c=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!c)return e;let u=i.facet(Kn);return new Cg({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:u.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function Pg(i){let e=vs(i,Ec);return e&&e.dom.querySelector("[main-field]")}function Qg(i){let e=Pg(i);e&&e==i.root.activeElement&&e.select()}const Eg=i=>{let e=i.state.field(nn,!1);if(e&&e.panel){let t=Pg(i);if(t&&t!=i.root.activeElement){let n=$c(i.state,e.query.spec);n.valid&&i.dispatch({effects:Js.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Pc.of(!0),e?Js.of($c(i.state,e.query.spec)):ke.appendConfig.of(vA)]});return!0},$g=i=>{let e=i.state.field(nn,!1);if(!e||!e.panel)return!1;let t=vs(i,Ec);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Pc.of(!1)}),!0},MA=[{key:"Mod-f",run:Eg,scope:"editor search-panel"},{key:"F3",run:Ro,shift:Vo,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ro,shift:Vo,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:$g,scope:"editor search-panel"},{key:"Mod-Shift-l",run:VA},{key:"Mod-Alt-g",run:pA},{key:"Mod-d",run:CA,preventDefault:!0}];class DA{constructor(e){this.view=e;let t=this.query=e.state.field(nn).query.spec;this.commit=this.commit.bind(this),this.searchField=Ie("input",{value:t.search,placeholder:Mt(e,"Find"),"aria-label":Mt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ie("input",{value:t.replace,placeholder:Mt(e,"Replace"),"aria-label":Mt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ie("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ie("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ie("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,r,o){return Ie("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=Ie("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Ro(e),[Mt(e,"next")]),n("prev",()=>Vo(e),[Mt(e,"previous")]),n("select",()=>RA(e),[Mt(e,"all")]),Ie("label",null,[this.caseField,Mt(e,"match case")]),Ie("label",null,[this.reField,Mt(e,"regexp")]),Ie("label",null,[this.wordField,Mt(e,"by word")]),...e.state.readOnly?[]:[Ie("br"),this.replaceField,n("replace",()=>Tg(e),[Mt(e,"replace")]),n("replaceAll",()=>LA(e),[Mt(e,"replace all")])],Ie("button",{name:"close",onclick:()=>$g(e),"aria-label":Mt(e,"close"),type:"button"},["×"])])}commit(){let e=new Cg({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Js.of(e)}))}keydown(e){jk(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Vo:Ro)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Tg(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Js)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Kn).top}}function Mt(i,e){return i.state.phrase(e)}const Lo=30,Mo=/[\s\.,:;?!]/;function Nc(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,r=Math.max(n.from,e-Lo),o=Math.min(s,t+Lo),a=i.state.sliceDoc(r,o);if(r!=n.from){for(let c=0;c<Lo;c++)if(!Mo.test(a[c+1])&&Mo.test(a[c])){a=a.slice(c);break}}if(o!=s){for(let c=a.length-1;c>a.length-Lo;c--)if(!Mo.test(a[c-1])&&Mo.test(a[c])){a=a.slice(0,c);break}}return se.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${n.number}.`)}const BA=se.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),vA=[nn,Wi.low(NA),BA];class Ng{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=st(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),s=t.text.slice(n-t.from,this.pos-t.from),r=s.search(Mg(e,!1));return r<0?null:{from:n+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Rg(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function IA(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let r=1;r<s.length;r++)t[s[r]]=!0}let n=Rg(e)+Rg(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Vg(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:IA(e);return s=>{let r=s.matchBefore(n);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function ZA(i,e){return t=>{for(let n=st(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class Lg{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function kn(i){return i.selection.main.from}function Mg(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",r=n[n.length-1]!="$";return!s&&!r?i:new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const Rc=Ei.define();function FA(i,e,t,n){let{main:s}=i.selection,r=t-s.from,o=n-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=n&&i.sliceDoc(a.from+r,a.from+o)!=i.sliceDoc(t,n))return{range:a};let c=i.toText(e);return{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:c},range:X.cursor(a.from+r+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Dg=new WeakMap;function UA(i){if(!Array.isArray(i))return i;let e=Dg.get(i);return e||Dg.set(i,e=Vg(i)),e}const Do=ke.define(),tr=ke.define();class XA{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Tt(e,t),s=ui(n);this.chars.push(n);let r=e.slice(t,t+s),o=r.toUpperCase();this.folded.push(Tt(o==r?r.toLowerCase():o,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:s,precise:r,byWord:o}=this;if(t.length==1){let b=Tt(e,0),k=ui(b),y=k==e.length?0:-100;if(b!=t[0])if(b==n[0])y+=-200;else return null;return this.ret(y,[0,k])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,u=0;if(a<0){for(let b=0,k=Math.min(e.length,200);b<k&&u<c;){let y=Tt(e,b);(y==t[u]||y==n[u])&&(s[u++]=b),b+=ui(y)}if(u<c)return null}let h=0,f=0,d=!1,m=0,O=-1,w=-1,g=/[a-z]/.test(e),p=!0;for(let b=0,k=Math.min(e.length,200),y=0;b<k&&f<c;){let C=Tt(e,b);a<0&&(h<c&&C==t[h]&&(r[h++]=b),m<c&&(C==t[m]||C==n[m]?(m==0&&(O=b),w=b+1,m++):m=0));let T,x=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(T=vl(C))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!b||x==1&&g||y==0&&x!=0)&&(t[f]==C||n[f]==C&&(d=!0)?o[f++]=b:o.length&&(p=!1)),y=x,b+=ui(C)}return f==c&&o[0]==0&&p?this.result(-100+(d?-200:0),o,e):m==c&&O==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):m==c?this.ret(-200+-700-e.length,[O,w]):f==c?this.result(-100+(d?-200:0)+-700+(p?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],r=0;for(let o of t){let a=o+(this.astral?ui(Tt(n,o)):1);r&&s[r-1]==o?s[r-1]=a:(s[r++]=o,s[r++]=a)}return this.ret(e-n.length,s)}}class WA{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const ot=ce.define({combine(i){return fi(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qA,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Bg(e(n),t(n)),optionClass:(e,t)=>n=>Bg(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Bg(i,e){return i?e?i+" "+e:i:e}function qA(i,e,t,n,s,r){let o=i.textDirection==Fe.RTL,a=o,c=!1,u="top",h,f,d=e.left-s.left,m=s.right-e.right,O=n.right-n.left,w=n.bottom-n.top;if(a&&d<Math.min(O,m)?a=!1:!a&&m<Math.min(O,d)&&(a=!0),O<=(a?d:m))h=Math.max(s.top,Math.min(t.top,s.bottom-w))-e.top,f=Math.min(400,a?d:m);else{c=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=w||b>e.top?h=t.bottom-e.top:(u="bottom",h=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,p=(e.right-e.left)/r.offsetWidth;return{style:`${u}: ${h/g}px; max-width: ${f/p}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}function jA(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,c=0;for(let u=0;u<r.length;){let h=r[u++],f=r[u++];h>c&&o.appendChild(document.createTextNode(a.slice(c,h)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(h,f))),d.className="cm-completionMatchedText",c=f}return c<a.length&&o.appendChild(document.createTextNode(a.slice(c))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function Vc(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class zA{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,a=e.state.facet(ot);this.optionContent=jA(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Vc(r.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=e.state.field(t).open;for(let h=c.target,f;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(f=/-(\d+)$/.exec(h.id))&&+f[1]<u.length){this.applyCompletion(e,u[+f[1]]),c.preventDefault();return}}),this.dom.addEventListener("focusout",c=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(ot).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:tr.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:r,selected:o,disabled:a}=n.open;(!s.open||s.open.options!=r)&&(this.range=Vc(r.length,o,e.state.facet(ot).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),a!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Vc(t.options.length,t.selected,this.view.state.facet(ot).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Pt(this.view.state,a,"completion info")):(this.addInfoPane(o,s),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;n.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&GA(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(ot).positionInfo(this.view,t,s,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:c}=e[o],{section:u}=a;if(u){let d=typeof u=="string"?u:u.name;if(d!=r&&(o>n.from||n.from==0))if(r=d,typeof u!="string"&&u.header)s.appendChild(u.header(u));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=d}}const h=s.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let f=this.optionClass(a);f&&(h.className=f);for(let d of this.optionContent){let m=d(a,this.view.state,this.view,c);m&&h.appendChild(m)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function YA(i,e){return t=>new zA(t,i,e)}function GA(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function vg(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function KA(i,e){let t=[],n=null,s=null,r=h=>{t.push(h);let{section:f}=h.completion;if(f){n||(n=[]);let d=typeof f=="string"?f:f.name;n.some(m=>m.name==d)||n.push(typeof f=="string"?{name:d}:f)}},o=e.facet(ot);for(let h of i)if(h.hasResult()){let f=h.result.getMatch;if(h.result.filter===!1)for(let d of h.result.options)r(new Lg(d,h.source,f?f(d):[],1e9-t.length));else{let d=e.sliceDoc(h.from,h.to),m,O=o.filterStrict?new WA(d):new XA(d);for(let w of h.result.options)if(m=O.match(w.label)){let g=w.displayLabel?f?f(w,m.matched):[]:m.matched,p=m.score+(w.boost||0);if(r(new Lg(w,h.source,g,p)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:b}=w.section;s||(s=Object.create(null)),s[b]=Math.max(p,s[b]||-1e9)}}}}if(n){let h=Object.create(null),f=0,d=(m,O)=>(m.rank==="dynamic"&&O.rank==="dynamic"?s[O.name]-s[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof O.rank=="number"?O.rank:1e9)||(m.name<O.name?-1:1);for(let m of n.sort(d))f-=1e5,h[m.name]=f;for(let m of t){let{section:O}=m.completion;O&&(m.score+=h[typeof O=="string"?O:O.name])}}let a=[],c=null,u=o.compareCompletions;for(let h of t.sort((f,d)=>d.score-f.score||u(f.completion,d.completion))){let f=h.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?a.push(h):vg(h.completion)>vg(c)&&(a[a.length-1]=h),c=h.completion}return a}class es{constructor(e,t,n,s,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new es(this.options,Ig(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,r,o){if(s&&!o&&e.some(u=>u.isPending))return s.setDisabled();let a=KA(e,t);if(!a.length)return s&&e.some(u=>u.isPending)?s.setDisabled():null;let c=t.facet(ot).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let u=s.options[s.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==u){c=h;break}}return new es(a,Ig(n,c),{pos:e.reduce((u,h)=>h.hasResult()?Math.min(u,h.from):u,1e8),create:nT,above:r.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new es(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new es(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Bo{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Bo(tT,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(ot),r=(n.override||t.languageDataAt("autocomplete",kn(t)).map(UA)).map(c=>(this.active.find(h=>h.source==c)||new jt(c,this.active.some(h=>h.state!=0)?1:0)).update(e,n));r.length==this.active.length&&r.every((c,u)=>c==this.active[u])&&(r=this.active);let o=this.open,a=e.effects.some(c=>c.is(Lc));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!HA(r,this.active)||a?o=es.build(r,t,this.id,o,n,a):o&&o.disabled&&!r.some(c=>c.isPending)&&(o=null),!o&&r.every(c=>!c.isPending)&&r.some(c=>c.hasResult())&&(r=r.map(c=>c.hasResult()?new jt(c.source,0):c));for(let c of e.effects)c.is(Fg)&&(o=o&&o.setSelected(c.value,this.id));return r==this.active&&o==this.open?this:new Bo(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?JA:eT}}function HA(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,r=n==e.length;if(s||r)return s==r;if(i[t++].result!=e[n++].result)return!1}}const JA={"aria-autocomplete":"list"},eT={};function Ig(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const tT=[];function Zg(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(Rc);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class jt{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Zg(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new jt(s.source,0)),n&4&&s.state==0&&(s=new jt(this.source,1)),s=s.updateFor(e,n);for(let r of e.effects)if(r.is(Do))s=new jt(s.source,1,r.value);else if(r.is(tr))s=new jt(s.source,0);else if(r.is(Lc))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(kn(e.state))}}class ts extends jt{constructor(e,t,n,s,r,o){super(e,3,t),this.limit=n,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=kn(e.state);if(a>o||!s||t&2&&(kn(e.startState)==this.from||a<this.limit))return new jt(this.source,t&4?1:0);let c=e.changes.mapPos(this.limit);return iT(s.validFor,e.state,r,o)?new ts(this.source,this.explicit,c,s,r,o):s.update&&(s=s.update(s,r,o,new Ng(e.state,a,!1)))?new ts(this.source,this.explicit,c,s,s.from,(n=s.to)!==null&&n!==void 0?n:kn(e.state)):new jt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ts(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new jt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function iT(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):Mg(i,!0).test(s)}const Lc=ke.define({map(i,e){return i.map(t=>t.map(e))}}),Fg=ke.define(),Nt=rt.define({create(){return Bo.start()},update(i,e){return i.update(e)},provide:i=>[Xa.from(i,e=>e.tooltip),se.contentAttributes.from(i,e=>e.attrs)]});function Mc(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(Nt).active.find(s=>s.source==e.source);return n instanceof ts?(typeof t=="string"?i.dispatch({...FA(i.state,t,n.from,n.to),annotations:Rc.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const nT=YA(Nt,Mc);function vo(i,e="option"){return t=>{let n=t.state.field(Nt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(ot).interactionDelay)return!1;let s=1,r;e=="page"&&(r=vp(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(i?1:-1):i?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Fg.of(a)}),!0}}const sT=i=>{let e=i.state.field(Nt,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(ot).interactionDelay?!1:Mc(i,e.open.options[e.open.selected])},Dc=i=>i.state.field(Nt,!1)?(i.dispatch({effects:Do.of(!0)}),!0):!1,rT=i=>{let e=i.state.field(Nt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:tr.of(null)}),!0)};class oT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const lT=50,aT=1e3,cT=Ye.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(Nt).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(Nt),t=i.state.facet(ot);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Nt)==e)return;let n=i.transactions.some(r=>{let o=Zg(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;r<this.running.length;r++){let o=this.running[r];if(n||o.context.abortOnDocChange&&i.docChanged||o.updates.length+i.transactions.length>lT&&Date.now()-o.time>aT){for(let a of o.context.abortListeners)try{a()}catch(c){Pt(this.view.state,c)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(r=>r.effects.some(o=>o.is(Do)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of i.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(Nt);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=kn(e),n=new Ng(e,t,i.explicit,this.view),s=new oT(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:tr.of(null)}),Pt(this.view.state,r)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(ot),n=this.view.state.field(Nt);for(let s=0;s<this.running.length;s++){let r=this.running[s];if(r.done===void 0)continue;if(this.running.splice(s--,1),r.done){let a=kn(r.updates.length?r.updates[0].startState:this.view.state),c=Math.min(a,r.done.from+(r.active.explicit?0:1)),u=new ts(r.active.source,r.active.explicit,c,r.done,r.done.from,(i=r.done.to)!==null&&i!==void 0?i:a);for(let h of r.updates)u=u.update(h,t);if(u.hasResult()){e.push(u);continue}}let o=n.active.find(a=>a.source==r.active.source);if(o&&o.isPending)if(r.done==null){let a=new jt(r.active.source,0);for(let c of r.updates)a=a.update(c,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Lc.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(Nt,!1);if(e&&e.tooltip&&this.view.state.facet(ot).closeOnBlur){let t=e.open&&vp(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:tr.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Do.of(!1)}),20),this.composing=0}}}),uT=typeof navigator=="object"&&/Win/.test(navigator.platform),hT=Wi.highest(se.domEventHandlers({keydown(i,e){let t=e.state.field(Nt,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(uT&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(o=>o.source==n.source),r=n.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(i.key)>-1&&Mc(e,n),!1}})),Ug=se.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class fT{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class Bc{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,ft.TrackDel),n=e.mapPos(this.to,1,ft.TrackDel);return t==null||n==null?null:new Bc(this.field,t,n)}}class vc{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let c of this.lines){if(n.length){let u=o,h=/^\t*/.exec(c)[0].length;for(let f=0;f<h;f++)u+=e.facet(qs);s.push(t+u.length-h),c=u+c.slice(h)}n.push(c),t+=c.length+1}let a=this.fieldPositions.map(c=>new Bc(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=r[1]?+r[1]:null,c=r[2]||r[3]||"",u=-1,h=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:h&&t[f].name==h)&&(u=f);if(u<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:h}),u=f;for(let d of s)d.field>=u&&d.field++}for(let f of s)if(f.line==n.length&&f.from>r.index){let d=r[2]?3+(r[1]||"").length:2;f.from-=d,f.to-=d}s.push(new fT(u,n.length,r.index,r.index+h.length)),o=o.slice(0,r.index)+c+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(a,c,u)=>{for(let h of s)h.line==n.length&&h.from>u&&(h.from--,h.to--);return c}),n.push(o)}return new vc(n,s)}}let dT=pe.widget({widget:new class extends pi{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),pT=pe.mark({class:"cm-snippetField"});class is{constructor(e,t){this.ranges=e,this.active=t,this.deco=pe.set(e.map(n=>(n.from==n.to?dT:pT).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new is(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const ir=ke.define({map(i,e){return i&&i.map(e)}}),mT=ke.define(),nr=rt.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(ir))return t.value;if(t.is(mT)&&i)return new is(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>se.decorations.from(i,e=>e?e.deco:pe.none)});function Ic(i,e){return X.create(i.filter(t=>t.field==e).map(t=>X.range(t.from,t.to)))}function gT(i){let e=vc.parse(i);return(t,n,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:c}=t.state.selection,u={changes:{from:s,to:r==c.from?c.to:r,insert:Qe.of(o)},scrollIntoView:!0,annotations:n?[Rc.of(n),He.userEvent.of("input.complete")]:void 0};if(a.length&&(u.selection=Ic(a,0)),a.some(h=>h.field>0)){let h=new is(a,0),f=u.effects=[ir.of(h)];t.state.field(nr,!1)===void 0&&f.push(ke.appendConfig.of([nr,_T,bT,Ug]))}t.dispatch(t.state.update(u))}}function Xg(i){return({state:e,dispatch:t})=>{let n=e.field(nr,!1);if(!n||i<0&&n.active==0)return!1;let s=n.active+i,r=i>0&&!n.ranges.some(o=>o.field==s+i);return t(e.update({selection:Ic(n.ranges,s),effects:ir.of(r?null:new is(n.ranges,s)),scrollIntoView:!0})),!0}}const OT=[{key:"Tab",run:Xg(1),shift:Xg(-1)},{key:"Escape",run:({state:i,dispatch:e})=>i.field(nr,!1)?(e(i.update({effects:ir.of(null)})),!0):!1}],Wg=ce.define({combine(i){return i.length?i[0]:OT}}),_T=Wi.highest(Ls.compute([Wg],i=>i.facet(Wg)));function Rt(i,e){return{...e,apply:gT(i)}}const bT=se.domEventHandlers({mousedown(i,e){let t=e.state.field(nr,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=n&&r.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:Ic(t.ranges,s.field),effects:ir.of(t.ranges.some(r=>r.field>s.field)?new is(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),sr={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},xn=ke.define({map(i,e){let t=e.mapPos(i,-1,ft.TrackAfter);return t??void 0}}),Zc=new class extends pn{};Zc.startSide=1,Zc.endSide=-1;const qg=rt.define({create(){return Ne.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(xn)&&(i=i.update({add:[Zc.range(t.value,t.value+1)]}));return i}});function yT(){return[kT,qg]}const Fc="()[]{}<>«»»«[]{}";function jg(i){for(let e=0;e<Fc.length;e+=2)if(Fc.charCodeAt(e)==i)return Fc.charAt(e+1);return vl(i<128?i:i+1)}function zg(i,e){return i.languageDataAt("closeBrackets",e)[0]||sr}const wT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),kT=se.inputHandler.of((i,e,t,n)=>{if((wT?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&ui(Tt(n,0))==1||e!=s.from||t!=s.to)return!1;let r=ST(i.state,n);return r?(i.dispatch(r),!0):!1}),xT=[{key:"Backspace",run:({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=zg(i,i.selection.main.head).brackets||sr.brackets,s=null,r=i.changeByRange(o=>{if(o.empty){let a=CT(i.doc,o.head);for(let c of n)if(c==a&&Io(i.doc,o.head)==jg(Tt(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:X.cursor(o.head-c.length)}}return{range:s=o}});return s||e(i.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function ST(i,e){let t=zg(i,i.selection.main.head),n=t.brackets||sr.brackets;for(let s of n){let r=jg(Tt(s,0));if(e==s)return r==s?PT(i,s,n.indexOf(s+s+s)>-1,t):AT(i,s,r,t.before||sr.before);if(e==r&&Yg(i,i.selection.main.from))return TT(i,s,r)}return null}function Yg(i,e){let t=!1;return i.field(qg).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function Io(i,e){let t=i.sliceString(e,e+2);return t.slice(0,ui(Tt(t,0)))}function CT(i,e){let t=i.sliceString(e-2,e);return ui(Tt(t,0))==t.length?t:t.slice(1)}function AT(i,e,t,n){let s=null,r=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:xn.of(o.to+e.length),range:X.range(o.anchor+e.length,o.head+e.length)};let a=Io(i.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:xn.of(o.head+e.length),range:X.cursor(o.head+e.length)}:{range:s=o}});return s?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function TT(i,e,t){let n=null,s=i.changeByRange(r=>r.empty&&Io(i.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:X.cursor(r.head+t.length)}:n={range:r});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function PT(i,e,t,n){let s=n.stringPrefixes||sr.stringPrefixes,r=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:xn.of(a.to+e.length),range:X.range(a.anchor+e.length,a.head+e.length)};let c=a.head,u=Io(i.doc,c),h;if(u==e){if(Gg(i,c))return{changes:{insert:e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)};if(Yg(i,c)){let d=t&&i.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+d.length,insert:d},range:X.cursor(c+d.length)}}}else{if(t&&i.sliceDoc(c-2*e.length,c)==e+e&&(h=Kg(i,c-2*e.length,s))>-1&&Gg(i,h))return{changes:{insert:e+e+e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)};if(i.charCategorizer(c)(u)!=Xe.Word&&Kg(i,c,s)>-1&&!QT(i,c,e,s))return{changes:{insert:e+e,from:c},effects:xn.of(c+e.length),range:X.cursor(c+e.length)}}return{range:r=a}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Gg(i,e){let t=st(i).resolveInner(e+1);return t.parent&&t.from==e}function QT(i,e,t,n){let s=st(i).resolveInner(e,-1),r=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),c=a.indexOf(t);if(!c||c>-1&&n.indexOf(a.slice(0,c))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>t.length+c;){if(i.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let u=s.to==e&&s.parent;if(!u)break;s=u}return!1}function Kg(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=Xe.Word)return e;for(let s of t){let r=e-s.length;if(i.sliceDoc(r,e)==s&&n(i.sliceDoc(r-1,r))!=Xe.Word)return r}return-1}function ET(i={}){return[hT,Nt,ot.of(i),cT,$T,Ug]}const Hg=[{key:"Ctrl-Space",run:Dc},{mac:"Alt-`",run:Dc},{mac:"Alt-i",run:Dc},{key:"Escape",run:rT},{key:"ArrowDown",run:vo(!0)},{key:"ArrowUp",run:vo(!1)},{key:"PageDown",run:vo(!0,"page")},{key:"PageUp",run:vo(!1,"page")},{key:"Enter",run:sT}],$T=Wi.highest(Ls.computeN([ot],i=>i.facet(ot).defaultKeymap?[Hg]:[]));class Jg{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Sn{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=n.facet(rr).markerFilter;s&&(e=s(e,n));let r=e.slice().sort((m,O)=>m.from-O.from||m.to-O.to),o=new $i,a=[],c=0,u=n.doc.iter(),h=0,f=n.doc.length;for(let m=0;;){let O=m==r.length?null:r[m];if(!O&&!a.length)break;let w,g;if(a.length)w=c,g=a.reduce((k,y)=>Math.min(k,y.to),O&&O.from>w?O.from:1e8);else{if(w=O.from,w>f)break;g=O.to,a.push(O),m++}for(;m<r.length;){let k=r[m];if(k.from==w&&(k.to>k.from||k.to==w))a.push(k),m++,g=Math.min(k.to,g);else{g=Math.min(k.from,g);break}}g=Math.min(g,f);let p=!1;if(a.some(k=>k.from==w&&(k.to==g||g==f))&&(p=w==g,!p&&g-w<10)){let k=w-(h+u.value.length);k>0&&(u.next(k),h=w);for(let y=w;;){if(y>=g){p=!0;break}if(!u.lineBreak&&h+u.value.length>y)break;y=h+u.value.length,h+=u.value.length,u.next()}}let b=UT(a);if(p)o.add(w,w,pe.widget({widget:new vT(b),diagnostics:a.slice()}));else{let k=a.reduce((y,C)=>C.markClass?y+" "+C.markClass:y,"");o.add(w,g,pe.mark({class:"cm-lintRange cm-lintRange-"+b+k,diagnostics:a.slice(),inclusiveEnd:a.some(y=>y.to>g)}))}if(c=g,c==f)break;for(let k=0;k<a.length;k++)a[k].to<=c&&a.splice(k--,1)}let d=o.finish();return new Sn(d,t,ns(d))}}function ns(i,e=null,t=0){let n=null;return i.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!n)n=new Jg(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Jg(n.from,r,n.diagnostic)}}),n}function NT(i,e){let t=e.pos,n=e.end||t,s=i.state.facet(rr).hideOn(i,t,n);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(eO))||i.changes.touchesRange(r.from,Math.max(r.to,n)))}function RT(i,e){return i.field(Dt,!1)?e:e.concat(ke.appendConfig.of(XT))}const eO=ke.define(),Uc=ke.define(),tO=ke.define(),Dt=rt.define({create(){return new Sn(pe.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),n=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);n=ns(t,i.selected.diagnostic,r)||ns(t,null,r)}!t.size&&s&&e.state.facet(rr).autoPanel&&(s=null),i=new Sn(t,s,n)}for(let t of e.effects)if(t.is(eO)){let n=e.state.facet(rr).autoPanel?t.value.length?or.open:null:i.panel;i=Sn.init(t.value,n,e.state)}else t.is(Uc)?i=new Sn(i.diagnostics,t.value?or.open:null,i.selected):t.is(tO)&&(i=new Sn(i.diagnostics,i.panel,t.value));return i},provide:i=>[Is.from(i,e=>e.panel),se.decorations.from(i,e=>e.diagnostics)]}),VT=pe.mark({class:"cm-lintRange cm-lintRange-active"});function LT(i,e,t){let{diagnostics:n}=i.state.field(Dt),s,r=-1,o=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(c,u,{spec:h})=>{if(e>=c&&e<=u&&(c==u||(e>c||t>0)&&(e<u||t<0)))return s=h.diagnostics,r=c,o=u,!1});let a=i.state.facet(rr).tooltipFilter;return s&&a&&(s=a(s,i.state)),s?{pos:r,end:o,above:i.state.doc.lineAt(r).to<o,create(){return{dom:MT(i,s)}}}:null}function MT(i,e){return Ie("ul",{class:"cm-tooltip-lint"},e.map(t=>rO(i,t,!1)))}const DT=i=>{let e=i.state.field(Dt,!1);(!e||!e.panel)&&i.dispatch({effects:RT(i.state,[Uc.of(!0)])});let t=vs(i,or.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},iO=i=>{let e=i.state.field(Dt,!1);return!e||!e.panel?!1:(i.dispatch({effects:Uc.of(!1)}),!0)},BT=[{key:"Mod-Shift-m",run:DT,preventDefault:!0},{key:"F8",run:i=>{let e=i.state.field(Dt,!1);if(!e)return!1;let t=i.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)}}],rr=ce.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...fi(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:nO,tooltipFilter:nO,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,s,r)=>e(n,s,r)||t(n,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function nO(i,e){return i?e?(t,n)=>e(i(t,n),n):i:e}function sO(i){let e=[];if(i)e:for(let{name:t}of i){for(let n=0;n<t.length;n++){let s=t[n];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function rO(i,e,t){var n;let s=t?sO(e.actions):[];return Ie("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ie("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((r,o)=>{let a=!1,c=m=>{if(m.preventDefault(),a)return;a=!0;let O=ns(i.state.field(Dt).diagnostics,e);O&&r.apply(i,O.from,O.to)},{name:u}=r,h=s[o]?u.indexOf(s[o]):-1,f=h<0?u:[u.slice(0,h),Ie("u",u.slice(h,h+1)),u.slice(h+1)],d=r.markClass?" "+r.markClass:"";return Ie("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${h<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&Ie("div",{class:"cm-diagnosticSource"},e.source))}class vT extends pi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ie("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class oO{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=rO(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class or{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)iO(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=sO(r.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let c=ns(this.view.state.field(Dt).diagnostics,r);c&&r.actions[a].apply(e,c.from,c.to)}}else return;s.preventDefault()},n=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=Ie("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=Ie("div",{class:"cm-panel-lint"},this.list,Ie("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>iO(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Dt).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Dt),n=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,c,{spec:u})=>{for(let h of u.diagnostics){if(o.has(h))continue;o.add(h);let f=-1,d;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==h){f=m;break}f<0?(d=new oO(this.view,h),this.items.splice(n,0,d),s=!0):(d=this.items[f],f>n&&(this.items.splice(n,f-n),s=!0)),t&&d.diagnostic==t.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),r=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new oO(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:c})=>{let u=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/u:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Dt),n=ns(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:tO.of(n)})}static open(e){return new or(e)}}function IT(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function Zo(i){return IT(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const ZT=se.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Zo("#d11")},".cm-lintRange-warning":{backgroundImage:Zo("orange")},".cm-lintRange-info":{backgroundImage:Zo("#999")},".cm-lintRange-hint":{backgroundImage:Zo("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function FT(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function UT(i){let e="hint",t=1;for(let n of i){let s=FT(n.severity);s>t&&(t=s,e=n.severity)}return e}const XT=[Dt,se.decorations.compute([Dt],i=>{let{selected:e,panel:t}=i.field(Dt);return!e||!t||e.from==e.to?pe.none:pe.set([VT.range(e.from,e.to)])}),Lx(LT,{hideOn:NT}),ZT],WT=(()=>[qx(),Yx(),ux(),cC(),DS(),Jk(),sx(),Te.allowMultipleSelections.of(!0),CS(),Sm(ZS,{fallback:!0}),jS(),yT(),ET(),Sx(),Tx(),gx(),OA(),Ls.of([...xT,...hA,...MA,..._C,...RS,...Hg,...BT])])();/*!
|
|
33
33
|
* VueCodemirror v6.1.1
|
|
34
34
|
* Copyright (c) Surmon. All rights reserved.
|
|
35
35
|
* Released under the MIT License.
|